[jboss-cvs] JBossAS SVN: r101379 - projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Feb 24 04:36:47 EST 2010
Author: jeff.zhang
Date: 2010-02-24 04:36:47 -0500 (Wed, 24 Feb 2010)
New Revision: 101379
Modified:
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/Main.java
Log:
[JBJCA-272] fix non-existing output directory
Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/Main.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/Main.java 2010-02-24 06:29:55 UTC (rev 101378)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/Main.java 2010-02-24 09:36:47 UTC (rev 101379)
@@ -130,42 +130,45 @@
FailureHelper fh = new FailureHelper(failures);
File reportDirectory = new File(output);
- if (reportDirectory.exists())
+ if (!reportDirectory.mkdirs())
{
- String reportName = url.getFile();
- int lastIndex = reportName.lastIndexOf(File.separator);
- if (lastIndex != -1)
- reportName = reportName.substring(lastIndex + 1);
- reportName += ".log";
+ throw new IOException(output + " can't be created");
+ }
- File report = new File(reportDirectory, reportName);
- FileWriter fw = null;
- try
+ String reportName = url.getFile();
+ int lastIndex = reportName.lastIndexOf(File.separator);
+ if (lastIndex != -1)
+ reportName = reportName.substring(lastIndex + 1);
+ reportName += ".log";
+
+ File report = new File(reportDirectory, reportName);
+ FileWriter fw = null;
+ try
+ {
+ fw = new FileWriter(report);
+ BufferedWriter bw = new BufferedWriter(fw, 8192);
+ bw.write(fh.asText(validator.getResourceBundle()));
+ bw.flush();
+ }
+ catch (IOException ioe)
+ {
+ ioe.printStackTrace();
+ }
+ finally
+ {
+ if (fw != null)
{
- fw = new FileWriter(report);
- BufferedWriter bw = new BufferedWriter(fw, 8192);
- bw.write(fh.asText(validator.getResourceBundle()));
- bw.flush();
- }
- catch (IOException ioe)
- {
- ioe.printStackTrace();
- }
- finally
- {
- if (fw != null)
+ try
{
- try
- {
- fw.close();
- }
- catch (IOException ignore)
- {
- // Ignore
- }
+ fw.close();
}
+ catch (IOException ignore)
+ {
+ // Ignore
+ }
}
}
+
exitCode = FAIL;
}
exitCode = SUCCESS;
More information about the jboss-cvs-commits
mailing list