Project

General

Profile

« Previous | Next » 

Revision c5a4c165

Added by Andreas Müller almost 3 years ago

fix #9629 handle OptionalDataException earlier in stack and recursive getCause()

View differences:

eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/ApplicationWorkbenchAdvisor.java
98 98
    		    	          || t.getCause() instanceof CdmAuthenticationException
99 99
    		    	          || (t.getMessage() != null && t.getMessage().contains("status code = 403"))){
100 100
                        MessagingUtils.informationDialog("Access denied", MessagingUtils.ACCESS_DENIED);
101
                    }else if (includesCause(t, OptionalDataException.class)){
102
                        MessagingUtils.informationDialog("Error (OptionalDataException)",
103
                                MessagingUtils.RESTART_EDITOR_MESSAGE
104
                                );
101 105
                    }else
102 106

  
103 107
    		    	// NOTE : Currently we only allow RuntimeExceptions since
......
127 131
                                    t,
128 132
                                    true);
129 133
                        }
130
                    }else {
131
                        if (includesCause(t, OptionalDataException.class)){
132
                            MessagingUtils.warn(this.getClass(), MessagingUtils.RESTART_EDITOR_MESSAGE);
133
                        }
134 134
                    }
135 135
		    	}
136 136
		    }
......
142 142
        private <T extends Exception> boolean includesCause(Throwable t, Class<? extends Throwable> clazz) {
143 143
            boolean result = false;
144 144

  
145
            if (clazz.isAssignableFrom(t.getClass())){
145
            if (clazz.isAssignableFrom(t.getClass()) ){
146 146
                return true;
147
            }else if (t.getCause() != null){
147
            }else if (t.getCause() != null && t.getCause() != t){
148 148
                return includesCause(t.getCause(), clazz);
149 149
            }
150 150
            return result;

Also available in: Unified diff