Revision 43888 branches/org.gvsig.desktop-2018a/org.gvsig.desktop.framework/org.gvsig.andami/src/main/java/org/gvsig/andami/plugins/PluginClassLoader.java

View differences:

PluginClassLoader.java
49 49
import java.util.zip.ZipEntry;
50 50
import java.util.zip.ZipException;
51 51
import java.util.zip.ZipFile;
52
import org.apache.commons.lang3.StringUtils;
52 53

  
53 54
import org.gvsig.andami.messages.Messages;
54 55
import org.slf4j.Logger;
......
208 209
        Class<?> c = null;
209 210

  
210 211
        // Intentamos cargar con el URLClassLoader
211
        try {
212
            if (!isOtherLoader) {
213
                c = super.loadClass(name, resolve);
214
                logger.debug("Classloader {}, found class {}.", this.getPluginName(), name);
212
        for( int retry=0; c==null && retry<3; retry++) {
213
            try {
214
                if (!isOtherLoader) {
215
                    c = super.loadClass(name, resolve);
216
                    logger.debug("Classloader {}, found class {}.", this.getPluginName(), name);
217
                }
218
            } catch (ClassNotFoundException e1) {
215 219
            }
216
        } catch (ClassNotFoundException e1) {
217
            try {
218
                c = singleLoadClass(name);
219
            } catch (ClassNotFoundException e2) {
220
            if (c == null) {
220 221
                try {
222
                    c = singleLoadClass(name);
223
                } catch (ClassNotFoundException e2) {
224
                }
225
            }
226
            if (c == null) {
227
                try {
221 228
                    isOtherLoader = true;
222 229
                    c = loadOtherClass(name);
223 230
                } catch (ClassNotFoundException e3) {
......
227 234
                    isOtherLoader = false;
228 235
                }
229 236
            }
237
            if( c==null ) {
238
                logger.info("class "+name+", retry "+retry);
239
            }
230 240
        }
231 241
        if (c == null) {
242
            if( StringUtils.startsWith(name,"java.") || StringUtils.startsWith(name,"javax.") ) {
243
                logger.warn("Can't locate class '"+name+"'. It can be a serious problem. It is advisable that you close the application.");
244
            }
232 245
            throw new ClassNotFoundException(Messages.getString(
233 246
                    "PluginClassLoader.Error_reading_file") + name);
234 247
        }

Also available in: Unified diff