jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1205614 - /jmeter/trunk/src/reports/org/apache/jmeter/report/writers/AbstractReportWriter.java
Date Wed, 23 Nov 2011 21:38:26 GMT
Author: pmouawad
Date: Wed Nov 23 21:38:26 2011
New Revision: 1205614

URL: http://svn.apache.org/viewvc?rev=1205614&view=rev
Log:
Added checks for File manipulations

Modified:
    jmeter/trunk/src/reports/org/apache/jmeter/report/writers/AbstractReportWriter.java

Modified: jmeter/trunk/src/reports/org/apache/jmeter/report/writers/AbstractReportWriter.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/reports/org/apache/jmeter/report/writers/AbstractReportWriter.java?rev=1205614&r1=1205613&r2=1205614&view=diff
==============================================================================
--- jmeter/trunk/src/reports/org/apache/jmeter/report/writers/AbstractReportWriter.java (original)
+++ jmeter/trunk/src/reports/org/apache/jmeter/report/writers/AbstractReportWriter.java Wed
Nov 23 21:38:26 2011
@@ -22,6 +22,8 @@ import java.util.Calendar;
 
 import org.apache.jmeter.testelement.AbstractTestElement;
 import org.apache.jmeter.testelement.TestElement;
+import org.apache.jorphan.logging.LoggingManager;
+import org.apache.log.Logger;
 
 /**
  * The abstract report writer provides the common implementation for subclasses
@@ -30,7 +32,6 @@ import org.apache.jmeter.testelement.Tes
 public abstract class AbstractReportWriter extends AbstractTestElement implements ReportWriter
{
 
     private static final long serialVersionUID = 240L;
-
     public static final String TARGET_DIRECTORY = "ReportWriter.target.directory";
 
     /**
@@ -65,7 +66,9 @@ public abstract class AbstractReportWrit
     public void makeDirectory() {
         File output = new File(getTargetDirectory());
         if (!output.exists() || !output.isDirectory()) {
-            output.mkdir();
+            if(!output.mkdir()) {
+            	throw new IllegalStateException("Could not create directory:"+output.getAbsolutePath());
+            }
         }
     }
 
@@ -77,7 +80,10 @@ public abstract class AbstractReportWrit
         if (output.exists() && output.isDirectory()) {
             // if the directory already exists and is a directory,
             // we just renamed to "archive.date"
-            output.renameTo(new File("archive." + getDayString()));
+            if(!output.renameTo(new File("archive." + getDayString()))) {
+            	throw new IllegalStateException("Could not rename directory:"+output.getAbsolutePath()+
+            			" to archive." + getDayString());
+            }
         }
     }
 



Mime
View raw message