fixing config==null on doSync; improved management of exceptions

task_21379
Francesco Mangiacrapa 3 years ago
parent 9704fdd3e9
commit 23df1ec770

@ -6,7 +6,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
## [v1.4.0-SNAPSHOT] - 2021-05-10 ## [v1.4.0-SNAPSHOT] - 2021-05-10
####Enhancements #### Enhancements
[#21379] Moved to new ws-synchronized-module-library (based on w-thredds 1.x) and performed UMA tokens "context switches" [#21379] Moved to new ws-synchronized-module-library (based on w-thredds 1.x) and performed UMA tokens "context switches"
[#21444] Moved to maven-portal-bom >= 3.6.2-SNAPSHOT [#21444] Moved to maven-portal-bom >= 3.6.2-SNAPSHOT

@ -283,21 +283,29 @@ public class WsThreddsWidget implements HasWsSyncNotificationListner {
* @param config the config * @param config the config
*/ */
private void performFolderSync(final WsFolder folder, WsThreddsSynchFolderConfiguration config) { private void performFolderSync(final WsFolder folder, WsThreddsSynchFolderConfiguration config) {
GWT.log("Performing doSyncFolder on: "+folder); GWT.log("Performing doSyncFolder on: "+folder+" and config: "+config);
final Modal box = new Modal(true); final Modal box = new Modal(true);
box.setTitle("Starting synchronization..."); box.setTitle("Starting synchronization...");
box.hide(false); box.hide(false);
LoaderIcon loader = new LoaderIcon("Inizializiting synchronization to the folder: "+folder.getFoderName()); final LoaderIcon loader = new LoaderIcon("Inizializiting synchronization to the folder: "+folder.getFoderName());
box.add(loader); box.add(loader);
wsThreddsSyncService.doSyncFolder(folder.getFolderId(), config, new AsyncCallback<ThSyncStatus>() { wsThreddsSyncService.doSyncFolder(folder.getFolderId(), config, new AsyncCallback<ThSyncStatus>() {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
Window.alert(caught.getMessage()); //Window.alert(caught.getMessage());
viewManager.cancelMonitor(folder); viewManager.cancelMonitor(folder);
if(box!=null) if(box!=null) {
box.hide(); try {
box.remove(loader);
}catch (Exception e) {
}
Alert alertError = new Alert(caught.getMessage(), AlertType.ERROR);
alertError.setClose(false);
box.add(alertError);
}
} }

@ -318,7 +318,7 @@ public class SyncronizeWithThredds {
firstSync = true; firstSync = true;
} catch (Exception e) { } catch (Exception e) {
logger.error("Error on check item sync: ", e); logger.error("Error on check item sync: ", e);
throw new Exception("Sorry an error occurred during folder publishing, refresh and try again"); throw e;
} }
try { try {
@ -332,8 +332,8 @@ public class SyncronizeWithThredds {
return workspaceThreddsSynchronizeLib.doSync(folderId); return workspaceThreddsSynchronizeLib.doSync(folderId);
} catch (Exception e) { } catch (Exception e) {
logger.error("Error on do sync: ", e); logger.error("Error on doSyncFolder for folderId: "+folderId, e);
throw new Exception(e.getMessage() + ", refresh and try again"); throw e;
} finally { } finally {

@ -197,6 +197,11 @@ public class ThreddsWorkspaceSyncServiceImpl extends RemoteServiceServlet implem
config = BeanConverter.toThSynchFolderConfiguration(clientConfig, folderId, config = BeanConverter.toThSynchFolderConfiguration(clientConfig, folderId,
clientConfig.getSelectedScope().getScopeName()); clientConfig.getSelectedScope().getScopeName());
logger.debug("Creating server config " + config); logger.debug("Creating server config " + config);
}else {
logger.info("The config sent from client is null, Loading it from ws-thredds");
ThSyncFolderDescriptor descr = getSyncService().getConfiguration(folderId, false, this.getThreadLocalRequest(), user);
logger.info("From ws-thredds loaded the config: "+config);
config = descr.getConfiguration();
} }
ThSyncStatus status = getSyncService().doSyncFolder(folderId, config, this.getThreadLocalRequest(), user); ThSyncStatus status = getSyncService().doSyncFolder(folderId, config, this.getThreadLocalRequest(), user);
@ -205,7 +210,7 @@ public class ThreddsWorkspaceSyncServiceImpl extends RemoteServiceServlet implem
return status; return status;
} catch (Exception e) { } catch (Exception e) {
logger.error("Do sync Folder error: ", e); logger.error("Do sync Folder error: ", e);
throw new Exception("Sorry, an error occurred during synchonization phase, try again later"); throw new Exception("Sorry, an error occurred during synchonization phase. The server encountered the error: "+e.getMessage(), e);
} }
} }

Loading…
Cancel
Save