Cleanup minor code warnings

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@618198 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ExtractBindexInfo.java b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ExtractBindexInfo.java
index bff99cf..86aee85 100644
--- a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ExtractBindexInfo.java
+++ b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ExtractBindexInfo.java
@@ -202,10 +202,8 @@
         {
             return m_resource.getVersion().toString();
         }
-        else
-        {
-            return null;
-        }
+
+        return null;
     }
 
 
@@ -249,10 +247,8 @@
         {
             return m_resource.getDocumentation().toString();
         }
-        else
-        {
-            return null;
-        }
+
+        return null;
     }
 
 
@@ -266,10 +262,8 @@
         {
             return m_resource.getLicense().toString();
         }
-        else
-        {
-            return null;
-        }
+
+        return null;
     }
 
 
@@ -283,10 +277,8 @@
         {
             return m_resource.getSource().toString();
         }
-        else
-        {
-            return null;
-        }
+
+        return null;
     }
 
 
@@ -300,10 +292,8 @@
         {
             return m_resource.getId();
         }
-        else
-        {
-            return null;
-        }
+
+        return null;
     }
 
 }
diff --git a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrCleanRepo.java b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrCleanRepo.java
index f17aed1..98faa9b 100644
--- a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrCleanRepo.java
+++ b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrCleanRepo.java
@@ -78,7 +78,7 @@
     private ArtifactRepository m_localRepo;
 
 
-    public void execute() throws MojoExecutionException
+    public void execute()
     {
         // If no OBR repository, return
         if ( "NONE".equalsIgnoreCase( obrRepository ) )
@@ -169,10 +169,8 @@
             elem.setAttribute( "lastmodified", format.format( d ) );
             return elem;
         }
-        else
-        {
-            return null;
-        }
+
+        return null;
     }
 
 
@@ -214,22 +212,22 @@
             return null;
         }
         // The document is the root of the DOM tree.
-        file = file.getAbsoluteFile();
-        getLog().info( "Parsing " + file );
+        File targetFile = file.getAbsoluteFile();
+        getLog().info( "Parsing " + targetFile );
         Document doc = null;
         try
         {
-            doc = constructor.parse( file );
+            doc = constructor.parse( targetFile );
         }
         catch ( SAXException e )
         {
-            getLog().error( "Cannot parse " + file + " : " + e.getMessage() );
-            throw new MojoExecutionException( "Cannot parse " + file + " : " + e.getMessage() );
+            getLog().error( "Cannot parse " + targetFile + " : " + e.getMessage() );
+            throw new MojoExecutionException( "Cannot parse " + targetFile + " : " + e.getMessage() );
         }
         catch ( IOException e )
         {
-            getLog().error( "Cannot open " + file + " : " + e.getMessage() );
-            throw new MojoExecutionException( "Cannot open " + file + " : " + e.getMessage() );
+            getLog().error( "Cannot open " + targetFile + " : " + e.getMessage() );
+            throw new MojoExecutionException( "Cannot open " + targetFile + " : " + e.getMessage() );
         }
         return doc;
     }
diff --git a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrUpdate.java b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrUpdate.java
index cfbce3f..73f9da7 100644
--- a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrUpdate.java
+++ b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrUpdate.java
@@ -199,7 +199,7 @@
             {
                 return;
             }
-            Node obrXmlRoot = ( Element ) obrXmlDoc.getDocumentElement();
+            Node obrXmlRoot = obrXmlDoc.getDocumentElement();
             // sort the obr file
             sortObrXml( obrXmlRoot );
         }
@@ -497,30 +497,30 @@
         {
             return resource( node );
         }
-        else
-        { // look at the repository node (first in the file)
-            if ( node.getNodeName().compareTo( "repository" ) == 0 )
-            {
-                Date d = new Date();
-                d.setTime( System.currentTimeMillis() );
-                NamedNodeMap nList = node.getAttributes();
-                Node n = nList.getNamedItem( "lastmodified" );
-                n.setNodeValue( m_format.format( d ) );
-            }
-            NodeList list = node.getChildNodes();
-            if ( list.getLength() > 0 )
-            {
-                for ( int i = 0; i < list.getLength(); i++ )
-                {
-                    if ( walkOnTree( list.item( i ) ) )
-                    {
-                        return true;
-                    }
-                }
-            }
-            return false;
+
+        // look at the repository node (first in the file)
+        if ( node.getNodeName().compareTo( "repository" ) == 0 )
+        {
+            Date d = new Date();
+            d.setTime( System.currentTimeMillis() );
+            NamedNodeMap nList = node.getAttributes();
+            Node n = nList.getNamedItem( "lastmodified" );
+            n.setNodeValue( m_format.format( d ) );
         }
 
+        NodeList list = node.getChildNodes();
+        if ( list.getLength() > 0 )
+        {
+            for ( int i = 0; i < list.getLength(); i++ )
+            {
+                if ( walkOnTree( list.item( i ) ) )
+                {
+                    return true;
+                }
+            }
+        }
+
+        return false;
     }
 
 
@@ -536,19 +536,16 @@
             node.appendChild( m_resourceBundle.getNode( m_repositoryDoc ) );
             return;
         }
-        else
+
+        System.out.println( "Second branch..." );
+        NodeList list = node.getChildNodes();
+        if ( list.getLength() > 0 )
         {
-            System.out.println( "Second branch..." );
-            NodeList list = node.getChildNodes();
-            if ( list.getLength() > 0 )
+            for ( int i = 0; i < list.getLength(); i++ )
             {
-                for ( int i = 0; i < list.getLength(); i++ )
-                {
-                    searchRepository( list.item( i ), id );
-                }
+                searchRepository( list.item( i ), id );
             }
         }
-
     }
 
 
diff --git a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrUtils.java b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrUtils.java
index cc9c144..c68052b 100644
--- a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrUtils.java
+++ b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrUtils.java
@@ -48,20 +48,22 @@
      */
     public static URI findRepositoryXml( String mavenRepository, String obrRepository )
     {
+        String targetPath = obrRepository;
+
         // Combine location settings into a single repository location
-        if ( null == obrRepository || obrRepository.trim().length() == 0 )
+        if ( null == targetPath || targetPath.trim().length() == 0 )
         {
-            obrRepository = mavenRepository + '/' + REPO_XML;
+            targetPath = mavenRepository + '/' + REPO_XML;
         }
-        else if ( !obrRepository.toLowerCase().endsWith( DOT_XML ) )
+        else if ( !targetPath.toLowerCase().endsWith( DOT_XML ) )
         {
-            obrRepository = obrRepository + '/' + REPO_XML;
+            targetPath = targetPath + '/' + REPO_XML;
         }
 
         URI uri;
         try
         {
-            uri = new URI( obrRepository );
+            uri = new URI( targetPath );
             uri.toURL(); // check protocol
         }
         catch ( Exception e )
@@ -72,7 +74,7 @@
         // fall-back to file-system approach
         if ( null == uri || !uri.isAbsolute() )
         {
-            uri = new File( obrRepository ).toURI();
+            uri = new File( targetPath ).toURI();
         }
 
         return uri;
diff --git a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/RemoteFileManager.java b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/RemoteFileManager.java
index cee8dd8..4d6ac83 100644
--- a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/RemoteFileManager.java
+++ b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/RemoteFileManager.java
@@ -187,12 +187,16 @@
         try
         {
             file = File.createTempFile( String.valueOf( System.currentTimeMillis() ), suffix );
-            m_wagon.get( url, file );
         }
         catch ( IOException e )
         {
             throw new MojoExecutionException( "I/O problem", e );
         }
+
+        try
+        {
+            m_wagon.get( url, file );
+        }
         catch ( TransferFailedException e )
         {
             file.delete(); // cleanup on failure
diff --git a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ResourcesBundle.java b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ResourcesBundle.java
index 6d267fa..1e5f01d 100644
--- a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ResourcesBundle.java
+++ b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ResourcesBundle.java
@@ -355,19 +355,19 @@
             resource.appendChild( license );
         }
 
-        List list = ( ArrayList ) getNodeCategories( father );
+        List list = getNodeCategories( father );
         for ( int i = 0; i < list.size(); i++ )
         {
             resource.appendChild( ( Node ) list.get( i ) );
         }
 
-        list = ( ArrayList ) getNodeCapabilities( father );
+        list = getNodeCapabilities( father );
         for ( int i = 0; i < list.size(); i++ )
         {
             resource.appendChild( ( Node ) list.get( i ) );
         }
 
-        list = ( ArrayList ) getNodeRequirement( father );
+        list = getNodeRequirement( father );
         for ( int i = 0; i < list.size(); i++ )
         {
             resource.appendChild( ( Node ) list.get( i ) );
@@ -528,13 +528,13 @@
 
         addCapability( capability );
 
-        List capabilities = ( ArrayList ) ebi.getCapabilities();
+        List capabilities = ebi.getCapabilities();
         for ( int i = 0; i < capabilities.size(); i++ )
         {
             addCapability( ( Capability ) capabilities.get( i ) );
         }
 
-        List requirement = ( ArrayList ) ebi.getRequirement();
+        List requirement = ebi.getRequirement();
         for ( int i = 0; i < requirement.size(); i++ )
         {
             addRequire( ( Require ) requirement.get( i ) );
@@ -574,11 +574,8 @@
         {
             return ( symbolicName.compareTo( getSymbolicName() ) == 0 ) && ( version.compareTo( getVersion() ) == 0 );
         }
-        else
-        {
-            return false;
-        }
 
+        return false;
     }
 
 
@@ -590,7 +587,7 @@
     private List getNodeCategories( Document father )
     {
         List listNode = new ArrayList();
-        List listCategory = ( ArrayList ) getCategory();
+        List listCategory = getCategory();
         for ( int i = 0; i < listCategory.size(); i++ )
         {
             listNode.add( ( ( Category ) listCategory.get( i ) ).getNode( father ) );
@@ -607,7 +604,7 @@
     private List getNodeCapabilities( Document father )
     {
         List listNode = new ArrayList();
-        List listCapability = ( ArrayList ) getCapability();
+        List listCapability = getCapability();
         for ( int i = 0; i < listCapability.size(); i++ )
         {
             listNode.add( ( ( Capability ) listCapability.get( i ) ).getNode( father ) );
@@ -624,7 +621,7 @@
     private List getNodeRequirement( Document father )
     {
         List listNode = new ArrayList();
-        List listRequirement = ( ArrayList ) getRequire();
+        List listRequirement = getRequire();
         for ( int i = 0; i < listRequirement.size(); i++ )
         {
             listNode.add( ( ( Require ) listRequirement.get( i ) ).getNode( father ) );
@@ -645,10 +642,8 @@
             {
                 return "id";
             }
-            else
-            {
-                return "";
-            }
+
+            return "";
         }
         String result = "";
         if ( getPresentationName() == null )