[jboss-cvs] JBossAS SVN: r92526 - in projects/annotations/trunk: indexer/src/main/java/org/jboss/annotations/indexer and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Aug 18 09:30:16 EDT 2009
Author: jesper.pedersen
Date: 2009-08-18 09:30:15 -0400 (Tue, 18 Aug 2009)
New Revision: 92526
Modified:
projects/annotations/trunk/build.xml
projects/annotations/trunk/indexer/src/main/java/org/jboss/annotations/indexer/FileUtil.java
Log:
Eliminate findbugs warnings
Modified: projects/annotations/trunk/build.xml
===================================================================
--- projects/annotations/trunk/build.xml 2009-08-18 13:08:53 UTC (rev 92525)
+++ projects/annotations/trunk/build.xml 2009-08-18 13:30:15 UTC (rev 92526)
@@ -225,6 +225,7 @@
</fileset>
</auxClasspath>
<class location="${target.dir}/jboss-annotations.jar" />
+ <class location="${target.dir}/jboss-annotations-indexer.jar" />
</findbugs>
<findbugs home="${basedir}/tools/findbugs/lib/"
@@ -237,6 +238,7 @@
</fileset>
</auxClasspath>
<class location="${target.dir}/jboss-annotations.jar" />
+ <class location="${target.dir}/jboss-annotations-indexer.jar" />
</findbugs>
</target>
Modified: projects/annotations/trunk/indexer/src/main/java/org/jboss/annotations/indexer/FileUtil.java
===================================================================
--- projects/annotations/trunk/indexer/src/main/java/org/jboss/annotations/indexer/FileUtil.java 2009-08-18 13:08:53 UTC (rev 92525)
+++ projects/annotations/trunk/indexer/src/main/java/org/jboss/annotations/indexer/FileUtil.java 2009-08-18 13:30:15 UTC (rev 92526)
@@ -105,10 +105,27 @@
JarEntry entry = new JarEntry(file.getPath());
jos.putNextEntry(entry);
- FileInputStream in = new FileInputStream(f);
- while ((bytesRead = in.read(buffer)) != -1)
- jos.write(buffer, 0, bytesRead);
- in.close();
+ FileInputStream in = null;
+ try
+ {
+ in = new FileInputStream(f);
+ while ((bytesRead = in.read(buffer)) != -1)
+ jos.write(buffer, 0, bytesRead);
+ }
+ finally
+ {
+ if (in != null)
+ {
+ try
+ {
+ in.close();
+ }
+ catch (IOException ioe)
+ {
+ // Ignore
+ }
+ }
+ }
}
}
@@ -136,7 +153,8 @@
if (target.exists())
recursiveDelete(target);
- target.mkdirs();
+ if (!target.mkdirs())
+ throw new IOException("Could not create " + target);
JarFile jar = new JarFile(file);
Enumeration<JarEntry> entries = jar.entries();
@@ -166,7 +184,8 @@
}
else
{
- copy.mkdirs();
+ if (!copy.mkdirs())
+ throw new IOException("Could not create " + copy);
}
}
@@ -176,8 +195,9 @@
/**
* Recursive delete
* @param f The file handler
+ * @exception IOException Thrown if a file could not be deleted
*/
- public static void recursiveDelete(File f)
+ public static void recursiveDelete(File f) throws IOException
{
if (f.exists())
{
@@ -192,11 +212,13 @@
}
else
{
- files[i].delete();
+ if (!files[i].delete())
+ throw new IOException("Could not delete " + files[i]);
}
}
}
- f.delete();
+ if (!f.delete())
+ throw new IOException("Could not delete " + f);
}
}
More information about the jboss-cvs-commits
mailing list