Cleanup minor code warnings
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@618193 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java
index 4aa9f86..a6b080f 100644
--- a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java
+++ b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java
@@ -226,10 +226,8 @@
{
continue;
}
- else
- {
- throw new MojoExecutionException( "Artifact was not found in the repo" + node.getArtifact(), e );
- }
+
+ throw new MojoExecutionException( "Artifact was not found in the repo" + node.getArtifact(), e );
}
node.getArtifact().setFile( artifact.getFile() );
diff --git a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
index 4b7382d..e148343 100644
--- a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
+++ b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
@@ -535,7 +535,7 @@
}
- private static Map getProperties( Model projectModel, String prefix, Object model )
+ private static Map getProperties( Model projectModel, String prefix )
{
Map properties = new HashMap();
Method methods[] = Model.class.getDeclaredMethods();
@@ -760,9 +760,9 @@
properties.putAll( currentProject.getProperties() );
properties.putAll( currentProject.getModel().getProperties() );
- properties.putAll( getProperties( currentProject.getModel(), "project.build.", currentProject.getBuild() ) );
- properties.putAll( getProperties( currentProject.getModel(), "pom.", currentProject.getModel() ) );
- properties.putAll( getProperties( currentProject.getModel(), "project.", currentProject ) );
+ properties.putAll( getProperties( currentProject.getModel(), "project.build." ) );
+ properties.putAll( getProperties( currentProject.getModel(), "pom." ) );
+ properties.putAll( getProperties( currentProject.getModel(), "project." ) );
properties.put( "project.baseDir", baseDir );
properties.put( "project.build.directory", getBuildDirectory() );
properties.put( "project.build.outputdirectory", getOutputDirectory() );
@@ -890,10 +890,8 @@
// includes transitive dependencies
return project.getArtifacts();
}
- else
- {
- // only includes direct dependencies
- return project.getDependencyArtifacts();
- }
+
+ // only includes direct dependencies
+ return project.getDependencyArtifacts();
}
}
diff --git a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/DependencyEmbedder.java b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/DependencyEmbedder.java
index be96063..878c416 100644
--- a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/DependencyEmbedder.java
+++ b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/DependencyEmbedder.java
@@ -154,14 +154,19 @@
abstract boolean matches( Artifact dependency );
- private boolean matches( String text )
+ boolean matches( String text )
{
+ boolean result;
+
if ( null == text )
{
- text = m_defaultValue;
+ result = m_instruction.matches( m_defaultValue );
+ }
+ else
+ {
+ result = m_instruction.matches( text );
}
- boolean result = m_instruction.matches( text );
return m_instruction.isNegated() ? !result : result;
}
}
diff --git a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java
index 1cdc6dc..88e20c3 100644
--- a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java
+++ b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java
@@ -37,7 +37,7 @@
/**
* Generate an OSGi manifest for this project
- *
+ *
* @goal manifest
* @phase process-classes
* @requiresDependencyResolution runtime
@@ -89,7 +89,7 @@
public Manifest getManifest( MavenProject project, Jar[] classpath ) throws IOException
{
- return getManifest( project, null, null, classpath );
+ return getManifest( project, new Properties(), new Properties(), classpath );
}
@@ -166,16 +166,13 @@
}
finally
{
- if ( os != null )
+ try
{
- try
- {
- os.close();
- }
- catch ( IOException e )
- {
- //nothing we can do here
- }
+ os.close();
+ }
+ catch ( IOException e )
+ {
+ // nothing we can do here
}
}
}
diff --git a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/OBRInstall.java b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/OBRInstall.java
index c0822da..7635924 100644
--- a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/OBRInstall.java
+++ b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/OBRInstall.java
@@ -26,7 +26,6 @@
import org.apache.felix.obr.plugin.ObrUtils;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.project.MavenProject;
@@ -67,7 +66,7 @@
private MavenProject project;
- public void execute() throws MojoExecutionException
+ public void execute()
{
if ( "NONE".equalsIgnoreCase( obrRepository ) )
{
diff --git a/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundleAllPluginTest.java b/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundleAllPluginTest.java
index 5f69548..1ac29d3 100644
--- a/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundleAllPluginTest.java
+++ b/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundleAllPluginTest.java
@@ -52,9 +52,9 @@
private void init()
{
plugin = new BundleAllPlugin();
- File basedir = new File( getBasedir() );
- plugin.setBasedir( basedir );
- File buildDirectory = new File( basedir, "target" );
+ File baseDirectory = new File( getBasedir() );
+ plugin.setBasedir( baseDirectory );
+ File buildDirectory = new File( baseDirectory, "target" );
plugin.setBuildDirectory( buildDirectory.getPath() );
File outputDirectory = new File( buildDirectory, "test-classes" );
plugin.setOutputDirectory( outputDirectory );