diff options
author | Violeta Georgieva | 2012-02-28 21:01:34 +0000 |
---|---|---|
committer | Violeta Georgieva | 2012-02-28 21:01:34 +0000 |
commit | 74489711fdf0c56d2d45d14bd3104ad1824deb9f (patch) | |
tree | 807f9f1e9849dc4395e18f568ca79d8901bb1893 | |
parent | 6d8d08249f3c50d97b31593865ecc3112c36d410 (diff) | |
download | org.eclipse.gemini.naming-74489711fdf0c56d2d45d14bd3104ad1824deb9f.tar.gz org.eclipse.gemini.naming-74489711fdf0c56d2d45d14bd3104ad1824deb9f.tar.xz org.eclipse.gemini.naming-74489711fdf0c56d2d45d14bd3104ad1824deb9f.zip |
bug 371310: Add findbugs, pmd and tycho-source plugins to the Gemini Naming build
-rw-r--r-- | framework/.project | 27 | ||||
-rw-r--r-- | framework/pom.xml | 17 | ||||
-rw-r--r-- | framework/src/main/java/org/eclipse/gemini/naming/BuilderUtils.java | 2 | ||||
-rw-r--r-- | framework/src/main/java/org/eclipse/gemini/naming/OSGiInitialContextFactoryBuilder.java | 14 | ||||
-rw-r--r-- | framework/src/main/java/org/eclipse/gemini/naming/TraditionalObjectFactoryBuilder.java | 2 | ||||
-rw-r--r-- | pom.xml | 55 |
6 files changed, 111 insertions, 6 deletions
diff --git a/framework/.project b/framework/.project new file mode 100644 index 0000000..79bd23e --- /dev/null +++ b/framework/.project @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.gemini.naming</name> + <comment></comment> + <projects></projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/framework/pom.xml b/framework/pom.xml index c476512..4541b0a 100644 --- a/framework/pom.xml +++ b/framework/pom.xml @@ -14,4 +14,21 @@ <version>1.0.0-SNAPSHOT</version>
</parent>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-source-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>findbugs-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
</project>
diff --git a/framework/src/main/java/org/eclipse/gemini/naming/BuilderUtils.java b/framework/src/main/java/org/eclipse/gemini/naming/BuilderUtils.java index 40ae2c6..e82061c 100644 --- a/framework/src/main/java/org/eclipse/gemini/naming/BuilderUtils.java +++ b/framework/src/main/java/org/eclipse/gemini/naming/BuilderUtils.java @@ -183,7 +183,7 @@ class BuilderUtils { int indexOfConstructor = -1;
- for(int i = 0; i < callStack.length; i++) {
+ for(int i = 0; callStack != null && i < callStack.length; i++) {
if(callStack[i].getName().equals(namingClassType)) {
indexOfConstructor = i;
}
diff --git a/framework/src/main/java/org/eclipse/gemini/naming/OSGiInitialContextFactoryBuilder.java b/framework/src/main/java/org/eclipse/gemini/naming/OSGiInitialContextFactoryBuilder.java index 1d88f81..71baaba 100644 --- a/framework/src/main/java/org/eclipse/gemini/naming/OSGiInitialContextFactoryBuilder.java +++ b/framework/src/main/java/org/eclipse/gemini/naming/OSGiInitialContextFactoryBuilder.java @@ -668,9 +668,9 @@ class OSGiInitialContextFactoryBuilder implements URL propertiesURL = bundle.getResource(JNDI_PROPERTIES_FILE_NAME);
if (propertiesURL != null) {
File jndiPropertiesFile = (File) propertiesURL.getContent();
+ FileInputStream userDefinedPropertiesStream = null;
try {
- FileInputStream userDefinedPropertiesStream =
- new FileInputStream(jndiPropertiesFile);
+ userDefinedPropertiesStream = new FileInputStream(jndiPropertiesFile);
Properties fileDefinedJndiProperties = new Properties();
fileDefinedJndiProperties.load(userDefinedPropertiesStream);
return fileDefinedJndiProperties;
@@ -680,6 +680,16 @@ class OSGiInitialContextFactoryBuilder implements // already been tested to be available
logger.log(Level.FINEST, "Exception encountered while trying to locate a jndi.properties file.", e);
}
+ finally {
+ if (userDefinedPropertiesStream != null) {
+ try {
+ userDefinedPropertiesStream.close();
+ }
+ catch (IOException e) {
+ logger.log(Level.FINEST, "Exception encountered while trying to close a jndi.properties file.", e);
+ }
+ }
+ }
}
}
catch (IOException e) {
diff --git a/framework/src/main/java/org/eclipse/gemini/naming/TraditionalObjectFactoryBuilder.java b/framework/src/main/java/org/eclipse/gemini/naming/TraditionalObjectFactoryBuilder.java index 3ed3af3..f84d261 100644 --- a/framework/src/main/java/org/eclipse/gemini/naming/TraditionalObjectFactoryBuilder.java +++ b/framework/src/main/java/org/eclipse/gemini/naming/TraditionalObjectFactoryBuilder.java @@ -60,7 +60,7 @@ class TraditionalObjectFactoryBuilder implements ObjectFactoryBuilder { return new TraditionalObjectFactory(clientBundleContext);
}
- private class TraditionalObjectFactory implements DirObjectFactory {
+ private static class TraditionalObjectFactory implements DirObjectFactory {
private final BundleContext m_clientBundleContext;
@@ -142,7 +142,58 @@ <target>1.5</target>
</configuration>
</plugin>
- </plugins>
-
+ </plugins>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-source-plugin</artifactId>
+ <version>${tycho-version}</version>
+ <executions>
+ <execution>
+ <id>plugin-source</id>
+ <goals>
+ <goal>plugin-source</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>findbugs-maven-plugin</artifactId>
+ <version>2.4.0</version>
+ <configuration>
+ <findbugsXmlOutput>true</findbugsXmlOutput>
+ <failOnError>false</failOnError>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ <version>2.7</version>
+ <configuration>
+ <sourceEncoding>${project.build.sourceEncoding}</sourceEncoding>
+ <minimumTokens>100</minimumTokens>
+ <targetJdk>1.5</targetJdk>
+ <format>xml</format>
+ <failOnViolation>false</failOnViolation>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>cpd-check</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
</build>
</project>
|