ref #7993: missed to commit some changes to catch 403 Exceptiojn
authorKatja Luther <k.luther@bgbm.org>
Tue, 29 Jan 2019 10:55:27 +0000 (11:55 +0100)
committerKatja Luther <k.luther@bgbm.org>
Tue, 29 Jan 2019 10:55:27 +0000 (11:55 +0100)
eu.etaxonomy.taxeditor.bulkeditor/plugin.xml
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/l10n/messages_de.properties
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/service/CdmServiceRequestExecutor.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/ContextManager.java

index 0c39a587c430af3b14d0b9c70b3ba78bf2b38428..b16708376ebe7881728be8eeab64969310b015fe 100644 (file)
             name="%page.name">
       </page>
       <page
-            category="eu.etaxonomy.taxeditor.preferences.general"
+            category="eu.etaxonomy.taxeditor.preference.UIPreferences"
             class="eu.etaxonomy.taxeditor.bulkeditor.preference.BulkEditorGeneralPreferencePage"
             id="eu.etaxonomy.taxeditor.preferences.bulkeditor.general"
             name="%page.name.0">
index b065576eda06ef770b42f90d0b7f33625b556b7e..6ae6d04b7a918b7d053d421c65d24be31450b507 100644 (file)
@@ -60,4 +60,4 @@ DynamicMarkerTypeEditingMenuE4_YES=Ja
 DynamicNewObjectMenuE4_NEW=Neu
 OccurrenceEditorInput_EDITOR_NAME=Specimen-Editor (Liste)
 
-BulkEditorGeneralPreferencePage=Zeige Field Units in Listeneditor an
+BulkEditorGeneralPreferencePage=Field Units in Specimen-Listeneditor anzeigen
index 783845df10ad827d29ee6bc422043d5119a80c43..90fab0c977fb8f80abb61b2f978e95bd4412fca4 100644 (file)
@@ -5,6 +5,7 @@ import java.io.OutputStream;
 import java.util.HashSet;
 import java.util.Set;
 
+import org.apache.http.NoHttpResponseException;
 import org.apache.log4j.Logger;
 import org.springframework.remoting.httpinvoker.HttpInvokerClientConfiguration;
 import org.springframework.remoting.support.RemoteInvocation;
@@ -50,7 +51,7 @@ public class CdmServiceRequestExecutor extends CdmAuthenticatedHttpInvokerReques
        protected RemoteInvocationResult doExecuteRequest(HttpInvokerClientConfiguration config,
                        java.io.ByteArrayOutputStream baos)
                                        throws java.io.IOException,
-                                       java.lang.ClassNotFoundException {
+                                       java.lang.ClassNotFoundException, NoHttpResponseException {
                RemoteInvocationResult rir = fromCache(currentRemoteInvocation);
 
                if(rir == null) {
@@ -58,7 +59,13 @@ public class CdmServiceRequestExecutor extends CdmAuthenticatedHttpInvokerReques
                    if (!(currentRemoteInvocation.getMethodName() == null) && !(config.getServiceUrl() == null)){
                       // logger.info("Remote invoking : " + currentRemoteInvocation.getMethodName() + "@" + config.getServiceUrl());
                    }
-                   rir = super.doExecuteRequest(config, baos);
+                   try{
+                       rir = super.doExecuteRequest(config, baos);
+                   }catch(Exception e){
+                       if (e instanceof NoHttpResponseException){
+                          throw e;
+                       }
+                   }
                        if(rir.getValue() != null && !rir.hasException()) {
                            if (currentRemoteInvocation == null){
                                logger.debug("return RemoteInvocationResult without caching" );
index 86d1f88a71b69e7a90389d1d8cf74d5b3eba9344..7c84812afc6b9668c9ddb1671cf79f8bacddb6b5 100644 (file)
@@ -24,6 +24,7 @@ import org.eclipse.ui.IWorkbenchListener;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.XMLMemento;
 import org.eclipse.ui.internal.Workbench;
+import org.springframework.remoting.RemoteAccessException;
 
 import eu.etaxonomy.taxeditor.model.IContextListener;
 import eu.etaxonomy.taxeditor.model.MementoHelper;
@@ -81,8 +82,9 @@ public class ContextManager implements IWorkbenchListener{
     }
     /**
      * <p>notifyContextStart</p>
+     * @throws Throwable
      */
-    public void notifyContextStart() {
+    public void notifyContextStart() throws RemoteAccessException {
         MessagingUtils.info("Notifying context listeners, that the context has started.");
         ProgressMonitorDialog dialog = new ProgressMonitorDialog(StoreUtil.getShell());
 
@@ -107,7 +109,16 @@ public class ContextManager implements IWorkbenchListener{
                 }
             });
         } catch (InvocationTargetException e) {
-            MessagingUtils.error(getClass(), e);
+            if (e.getTargetException().getClass().equals(RemoteAccessException.class)){
+                if (e.getTargetException().getMessage().contains("403")){
+                   // new CdmAuthenticationException("Access Denied", e.getTargetException());
+                    throw new CdmAuthenticationException("You are logged in now but you are not permitted to use the TaxEditor with the selected data source", e.getTargetException());
+                }else{
+                    MessagingUtils.error(getClass(), e.getTargetException());
+                }
+            }else{
+                MessagingUtils.error(getClass(), e);
+            }
         } catch (InterruptedException e) {
             MessagingUtils.error(getClass(), e);
         }
@@ -139,7 +150,15 @@ public class ContextManager implements IWorkbenchListener{
                 }
             });
         } catch (InvocationTargetException e) {
-            MessagingUtils.error(getClass(), e);
+            if (e.getTargetException().getClass().equals(RemoteAccessException.class)){
+                if (e.getTargetException().getMessage().contains("403")){
+                    MessagingUtils.confirmDialog("Access denied", "Access denied");
+                }else{
+                    MessagingUtils.error(getClass(), e.getTargetException());
+                }
+            }else{
+                MessagingUtils.error(getClass(), e);
+            }
         } catch (InterruptedException e) {
             MessagingUtils.error(getClass(), e);
         }