Browse Source

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

task_21379
parent
commit
23df1ec770
  1. 2
      CHANGELOG.md
  2. 18
      src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/WsThreddsWidget.java
  3. 6
      src/main/java/org/gcube/portlets/widgets/wsthreddssync/server/SyncronizeWithThredds.java
  4. 7
      src/main/java/org/gcube/portlets/widgets/wsthreddssync/server/ThreddsWorkspaceSyncServiceImpl.java

2
CHANGELOG.md

@ -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
####Enhancements
#### Enhancements
[#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

18
src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/WsThreddsWidget.java

@ -283,21 +283,29 @@ public class WsThreddsWidget implements HasWsSyncNotificationListner {
* @param config the 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);
box.setTitle("Starting synchronization...");
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);
wsThreddsSyncService.doSyncFolder(folder.getFolderId(), config, new AsyncCallback<ThSyncStatus>() {
@Override
public void onFailure(Throwable caught) {
Window.alert(caught.getMessage());
//Window.alert(caught.getMessage());
viewManager.cancelMonitor(folder);
if(box!=null)
box.hide();
if(box!=null) {
try {
box.remove(loader);
}catch (Exception e) {
}
Alert alertError = new Alert(caught.getMessage(), AlertType.ERROR);
alertError.setClose(false);
box.add(alertError);
}
}

6
src/main/java/org/gcube/portlets/widgets/wsthreddssync/server/SyncronizeWithThredds.java

@ -318,7 +318,7 @@ public class SyncronizeWithThredds {
firstSync = true;
} catch (Exception 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 {
@ -332,8 +332,8 @@ public class SyncronizeWithThredds {
return workspaceThreddsSynchronizeLib.doSync(folderId);
} catch (Exception e) {
logger.error("Error on do sync: ", e);
throw new Exception(e.getMessage() + ", refresh and try again");
logger.error("Error on doSyncFolder for folderId: "+folderId, e);
throw e;
} finally {

7
src/main/java/org/gcube/portlets/widgets/wsthreddssync/server/ThreddsWorkspaceSyncServiceImpl.java

@ -197,6 +197,11 @@ public class ThreddsWorkspaceSyncServiceImpl extends RemoteServiceServlet implem
config = BeanConverter.toThSynchFolderConfiguration(clientConfig, folderId,
clientConfig.getSelectedScope().getScopeName());
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);
@ -205,7 +210,7 @@ public class ThreddsWorkspaceSyncServiceImpl extends RemoteServiceServlet implem
return status;
} catch (Exception 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