]> source.dussan.org Git - sonarqube.git/commitdiff
Manual merge of branch 3.2
authorEric Hartmann <hartmann.eric@gmail.com>
Tue, 24 Jul 2012 08:39:33 +0000 (10:39 +0200)
committerEric Hartmann <hartmann.eric@gmail.com>
Tue, 24 Jul 2012 08:39:33 +0000 (10:39 +0200)
1  2 
sonar-core/src/main/java/org/sonar/core/plugins/PluginClassloaders.java

index a53effc5c34bf3665f32f426fd78edc60f6a5b64,f4c6c7e87f97fe21c7f6dcd47125321076e4bdcf..90d42808000eb684a44c7b282a8e0ec36fb186fa
@@@ -122,11 -130,10 +130,14 @@@ public class PluginClassloaders 
          realm.addURL(url);
        }
        return realm;
+     } catch (UnsupportedClassVersionError e) {
+       throw new SonarException("The plugin " + plugin.getKey() + " is not supported with Java " + SystemUtils.JAVA_VERSION_TRIMMED, e);
      } catch (Throwable e) {
 +      // SONAR-3688
 +      // Throwable is explicitely caught instead of Exception in order to log the plugins
 +      // that are compiled for Java > 5. In such case java.lang.UnsupportedClassVersionError
 +      // is raised. 
        throw new SonarException("Fail to build the classloader of " + plugin.getKey(), e);
      }
    }
          base.addURL(file.toURI().toURL());
        }
        return true;
+     } catch (UnsupportedClassVersionError e) {
+       throw new SonarException("The plugin " + plugin.getKey() + " is not supported with Java " + SystemUtils.JAVA_VERSION_TRIMMED, e);
      } catch (Throwable e) {
 -      throw new SonarException("Fail to extend the plugin " + plugin.getBasePlugin() + " with " + plugin.getKey(), e);
 +      // SONAR-3688
 +      // Throwable is explicitely caught instead of Exception in order to log the plugins
 +      // that are compiled for Java > 5. In such case java.lang.UnsupportedClassVersionError
 +      // is raised. 
 +      throw new SonarException("Fail to extend the plugin " + plugin.getBasePlugin() + " for " + plugin.getKey(), e);
      }
    }
  
      }
    }
  
-   public Plugin instantiatePlugin(PluginMetadata metadata) {
+   public Plugin instantiatePlugin(PluginMetadata plugin) {
      try {
-       Class claz = get(metadata.getKey()).loadClass(metadata.getMainClass());
-       return (Plugin) claz.newInstance();
+       Class clazz = get(plugin.getKey()).loadClass(plugin.getMainClass());
+       return (Plugin) clazz.newInstance();
+     } catch (UnsupportedClassVersionError e) {
+       throw new SonarException("The plugin " + plugin.getKey() + " is not supported with Java " + SystemUtils.JAVA_VERSION_TRIMMED, e);
  
      } catch (Throwable e) {
 -      throw new SonarException("Fail to load the plugin " + plugin.getKey(), e);
 +      // SONAR-3688
 +      // Throwable is explicitely caught instead of Exception in order to log the plugins
 +      // that are compiled for Java > 5. In such case java.lang.UnsupportedClassVersionError
 +      // is raised. 
 +      throw new SonarException("Fail to load plugin " + metadata.getKey(), e);
      }
    }