Update of /cvsroot/jwebunit/jWebUnit/src/net/sourceforge/jwebunit
In directory
sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2100/src/net/sourceforge/jwebunit
Modified Files:
HttpUnitDialog.java
Log Message:
Extracted regexp creation to a method with error handling.
Index: HttpUnitDialog.java
===================================================================
RCS file:
/cvsroot/jwebunit/jWebUnit/src/net/sourceforge/jwebunit/HttpUnitDialog.java,v
retrieving revision 1.60
retrieving revision 1.61
diff -C2 -d -r1.60 -r1.61
*** HttpUnitDialog.java 29 Dec 2005 10:43:40 -0000 1.60
--- HttpUnitDialog.java 29 Dec 2005 16:46:31 -0000 1.61
***************
*** 635,642 ****
public boolean isMatchInResponse(String regexp) {
try {
! RE re = new RE(regexp, RE.MATCH_SINGLELINE);
return re.match(getTestContext().toEncodedString(resp.getText()));
- } catch (RESyntaxException e) {
- throw new
RuntimeException(ExceptionUtility.stackTraceToString(e));
} catch (IOException e) {
throw new
RuntimeException(ExceptionUtility.stackTraceToString(e));
--- 635,640 ----
public boolean isMatchInResponse(String regexp) {
try {
! RE re = getRE(regexp);
return re.match(getTestContext().toEncodedString(resp.getText()));
} catch (IOException e) {
throw new
RuntimeException(ExceptionUtility.stackTraceToString(e));
***************
*** 700,704 ****
throw new RuntimeException("No table with summary or id [" +
tableSummaryOrId + "] found in response.");
}
! RE re = new RE(regexp, RE.MATCH_SINGLELINE);
for (int row = 0; row < table.getRowCount(); row++) {
for (int col = 0; col < table.getColumnCount(); col++) {
--- 698,702 ----
throw new RuntimeException("No table with summary or id [" +
tableSummaryOrId + "] found in response.");
}
! RE re = getRE(regexp);
for (int row = 0; row < table.getRowCount(); row++) {
for (int col = 0; col < table.getColumnCount(); col++) {
***************
*** 1342,1346 ****
public boolean isMatchInElement(Element element, String regexp) {
NodeList children = element.getChildNodes();
! RE re = new RE(regexp, RE.MATCH_SINGLELINE);
for (int i = 0; i < children.getLength(); i++) {
Node child = children.item(i);
--- 1340,1344 ----
public boolean isMatchInElement(Element element, String regexp) {
NodeList children = element.getChildNodes();
! RE re = getRE(regexp);
for (int i = 0; i < children.getLength(); i++) {
Node child = children.item(i);
***************
*** 1360,1363 ****
--- 1358,1369 ----
}
+ private RE getRE(String regexp) {
+ try {
+ return new RE(regexp, RE.MATCH_SINGLELINE);
+ } catch (RESyntaxException e) {
+ throw new
RuntimeException(ExceptionUtility.stackTraceToString(e));
+ }
+ }
+
/**
* Make the window with the given name in the current conversation active.
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Jwebunit-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-development