vmassol 2003/03/29 14:10:43
Modified: framework/src/java/share/org/apache/cactus/client
WebTestResultParser.java
documentation/docs/xdocs changes.xml
Log:
Fixed bug in Cactus exception handling where an invalid test result could result in
a <code>StringIndexOutOfBoundsException</code>, thus hiding the real problem.
Revision Changes Path
1.9 +19 -21
jakarta-cactus/framework/src/java/share/org/apache/cactus/client/WebTestResultParser.java
Index: WebTestResultParser.java
===================================================================
RCS file:
/home/cvs/jakarta-cactus/framework/src/java/share/org/apache/cactus/client/WebTestResultParser.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- WebTestResultParser.java 3 Jan 2003 15:35:44 -0000 1.8
+++ WebTestResultParser.java 29 Mar 2003 22:10:43 -0000 1.9
@@ -142,11 +142,7 @@
}
else
{
- // Display the first 100 characters of the invalid data as it can
- // be very big ...
- throw new ParsingException("Not a valid response. First 100 "
- + "characters of the reponse: ["
- + theData.substring(0, 100) + "]");
+ throw new ParsingException(formatError(theData));
}
return buffer;
@@ -180,11 +176,7 @@
}
else
{
- // Display the first 100 characters of the invalid data as it can
- // be very big ...
- throw new ParsingException("Not a valid response. First 100 "
- + "characters of the reponse: ["
- + theData.substring(0, 100) + "]");
+ throw new ParsingException(formatError(theData));
}
return buffer;
@@ -217,11 +209,7 @@
}
else
{
- // Display the first 100 characters of the invalid data as it can
- // be very big ...
- throw new ParsingException("Not a valid response. First 100 "
- + "characters of the reponse: ["
- + theData.substring(0, 100) + "]");
+ throw new ParsingException(formatError(theData));
}
return buffer;
@@ -254,13 +242,23 @@
}
else
{
- // Display the first 100 characters of the invalid data as it can
- // be very big ...
- throw new ParsingException("Not a valid response. First 100 "
- + "characters of the reponse: ["
- + theData.substring(0, 100) + "]");
+ throw new ParsingException(formatError(theData));
}
return buffer;
+ }
+
+ /**
+ * @param theData the data to format
+ * @return the first 100 characters (or less if the data has fewer
+ * characters) of the invalid data as it can be very big
+ */
+ private String formatError(String theData)
+ {
+ int nbChars = theData.length() > 100 ? 100 : theData.length();
+
+ return "Not a valid response. First " + nbChars
+ + " characters of the reponse: ["
+ + theData.substring(0, nbChars) + "]";
}
}
1.91 +5 -0 jakarta-cactus/documentation/docs/xdocs/changes.xml
Index: changes.xml
===================================================================
RCS file: /home/cvs/jakarta-cactus/documentation/docs/xdocs/changes.xml,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -r1.90 -r1.91
--- changes.xml 29 Mar 2003 11:47:34 -0000 1.90
+++ changes.xml 29 Mar 2003 22:10:43 -0000 1.91
@@ -57,6 +57,11 @@
</devs>
<release version="1.5" date="- in CVS">
+ <action dev="VMA" type="fix" due-to="Melissa White" due-to-email="[EMAIL
PROTECTED]">
+ Fixed bug in Cactus exception handling where an invalid test result
+ could result in a <code>StringIndexOutOfBoundsException</code>, thus
+ hiding the real problem.
+ </action>
<action dev="CML" type="add">
Added a new custom Ant task (WebXmlMerge) that merges the content of
two web deployment descriptors into one. That includes the
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]