[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jmeter-dev
Subject:    svn commit: r579677 -
From:       sebb () apache ! org
Date:       2007-09-26 14:43:48
Message-ID: 20070926144349.2F5ED1A9832 () eris ! apache ! org
[Download RAW message or body]

Author: sebb
Date: Wed Sep 26 07:43:48 2007
New Revision: 579677

URL: http://svn.apache.org/viewvc?rev=579677&view=rev
Log:
Better handling of errors when reading the Auth file

Modified:
    jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/AuthManager.java


Modified: jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/AuthManager.java
                
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/http/org/apache/jm \
eter/protocol/http/control/AuthManager.java?rev=579677&r1=579676&r2=579677&view=diff \
                ==============================================================================
                
--- jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/AuthManager.java \
                (original)
+++ jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/AuthManager.java \
Wed Sep 26 07:43:48 2007 @@ -29,6 +29,7 @@
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.NoSuchElementException;
 import java.util.StringTokenizer;
 
 import org.apache.jmeter.config.ConfigElement;
@@ -226,7 +227,7 @@
 	public void save(String authFile) throws IOException {
 		File file = new File(authFile);
 		if (!file.isAbsolute()) {
-			file = new File(System.getProperty("user.dir") + File.separator + authFile);
+			file = new File(System.getProperty("user.dir"),authFile);
 		}
 		PrintWriter writer = new PrintWriter(new FileWriter(file));
 		writer.println("# JMeter generated Authorization file");
@@ -254,6 +255,7 @@
 		}
 
 		String line;
+		boolean ok = true;
 		while ((line = reader.readLine()) != null) {
 			try {
 				if (line.startsWith("#") || line.trim().length() == 0) { //$NON-NLS-1$
@@ -271,12 +273,15 @@
 				}
 				Authorization auth = new Authorization(url, user, pass,domain,realm);
 				getAuthObjects().addItem(auth);
-			} catch (Exception e) {
-				reader.close();
-				throw new IOException("Error parsing auth line\n\t'" + line + "'\n\t" + e);
+			} catch (NoSuchElementException e) {
+				log.error("Error parsing auth line: '" + line + "'");
+				ok = false;
 			}
 		}
 		reader.close();
+		if (!ok){
+			JMeterUtils.reportErrorToUser("One or more errors found when reading the Auth \
file - see the log file"); +		}
 	}
 
 	/**



---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic