Project

General

Profile

« Previous | Next » 

Revision ec6ac40a

Added by Andreas Müller almost 4 years ago

cleanup getService

View differences:

eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationState.java
141 141

  
142 142
        Method[] methods = ICdmRepository.class.getDeclaredMethods();
143 143

  
144
        T service = null;
145

  
146 144
        for (Method method : methods) {
147 145
            Type type = method.getGenericReturnType();
148 146

  
149 147
            if (type.equals(serviceClass)) {
150 148
                try {
151
                    service = (T) method.invoke(configuration, null);
152
                    break;
153
                } catch (IllegalArgumentException iae) {
154
                    throw new CdmApplicationException(iae);
155
                } catch (IllegalAccessException iae) {
149
                    @SuppressWarnings("unchecked")
150
                    T service = (T) method.invoke(configuration);
151
                    return service;
152
                } catch (IllegalArgumentException | IllegalAccessException | InvocationTargetException iae) {
156 153
                    throw new CdmApplicationException(iae);
157
                } catch (InvocationTargetException ite) {
158
                    throw new CdmApplicationException(ite);
159 154
                }
160 155
            }
161 156
        }
162
        return service;
157
        return null;
163 158
    }
164 159

  
165 160
    /**

Also available in: Unified diff