[jboss-cvs] JBossAS SVN: r103958 - projects/annotations/trunk/indexer/src/main/java/org/jboss/papaki/indexer.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Apr 14 07:52:04 EDT 2010
Author: jesper.pedersen
Date: 2010-04-14 07:52:03 -0400 (Wed, 14 Apr 2010)
New Revision: 103958
Modified:
projects/annotations/trunk/indexer/src/main/java/org/jboss/papaki/indexer/FileUtil.java
Log:
Check if the directory exists and close JAR file
Modified: projects/annotations/trunk/indexer/src/main/java/org/jboss/papaki/indexer/FileUtil.java
===================================================================
--- projects/annotations/trunk/indexer/src/main/java/org/jboss/papaki/indexer/FileUtil.java 2010-04-14 10:43:39 UTC (rev 103957)
+++ projects/annotations/trunk/indexer/src/main/java/org/jboss/papaki/indexer/FileUtil.java 2010-04-14 11:52:03 UTC (rev 103958)
@@ -199,6 +199,13 @@
{
InputStream in = null;
OutputStream out = null;
+
+ // Make sure that the directory is _really_ there
+ if (copy.getParentFile() != null && !copy.getParentFile().exists())
+ {
+ if (!copy.getParentFile().mkdirs())
+ throw new IOException("Could not create " + copy.getParentFile());
+ }
try
{
@@ -241,11 +248,21 @@
}
else
{
- if (!copy.mkdirs())
- throw new IOException("Could not create " + copy);
+ if (!copy.exists())
+ {
+ if (!copy.mkdirs())
+ throw new IOException("Could not create " + copy);
+ }
+ else
+ {
+ if (!copy.isDirectory())
+ throw new IOException(copy + " isn't a directory");
+ }
}
}
+ jar.close();
+
return target;
}
More information about the jboss-cvs-commits
mailing list