[Httpunit-commit] CVS: httpunit/src/com/meterware/httpunit FormControl.java,1.21,1.22 WebClient.java
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2002-09-05 14:46:58
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv29932/src/com/meterware/httpunit
Modified Files:
FormControl.java WebClient.java WebForm.java WebRequest.java
Log Message:
Minor bug fixes
Index: FormControl.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/FormControl.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- FormControl.java 27 Aug 2002 16:26:03 -0000 1.21
+++ FormControl.java 5 Sep 2002 14:46:55 -0000 1.22
@@ -265,7 +265,7 @@
return new TextAreaFormControl( node );
} else if (node.getNodeName().equals( "select" )) {
return new SelectionFormControl( node );
- } else if (node.getNodeName().equals( "button" )) {
+ } else if (node.getNodeName().equalsIgnoreCase( "button" )) {
final String type = NodeUtils.getNodeAttribute( node, "type", "submit" );
if (type.equalsIgnoreCase( "submit" )) {
return new SubmitButton( form, node );
Index: WebClient.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebClient.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- WebClient.java 30 Aug 2002 15:20:09 -0000 1.29
+++ WebClient.java 5 Sep 2002 14:46:55 -0000 1.30
@@ -105,8 +105,7 @@
: wrs.getScriptableDelegate().evaluateURL( urlString );
if (result == null) return null;
- URL url = new URL( "javascript", null, -1, urlString.substring( "javascript:".length() ), JAVASCRIPT_STREAM_HANDLER );
- return new DefaultWebResponse( this, request.getTarget(), url, result );
+ return new DefaultWebResponse( this, request.getTarget(), request.getURL(), result );
}
}
@@ -424,8 +423,6 @@
private DialogResponder _dialogResponder = new DialogAdapter();
- private static URLStreamHandler JAVASCRIPT_STREAM_HANDLER = new JavascriptURLStreamHandler();
-
/**
* Examines the headers in the response and throws an exception if appropriate.
@@ -537,18 +534,6 @@
}
}
-
-
-
-//==================================================================================================
-
-
-class JavascriptURLStreamHandler extends URLStreamHandler {
-
- protected URLConnection openConnection( URL u ) throws IOException {
- return null;
- }
-}
Index: WebForm.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebForm.java,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -r1.61 -r1.62
--- WebForm.java 27 Aug 2002 16:26:04 -0000 1.61
+++ WebForm.java 5 Sep 2002 14:46:55 -0000 1.62
@@ -477,7 +477,7 @@
public void setParameter( String name, final String[] values ) {
FormParameter parameter = getParameter( name );
- if (parameter == null) throw new NoSuchParameterException( name );
+ if (parameter == UNKNOWN_PARAMETER) throw new NoSuchParameterException( name );
parameter.setValues( values );
}
Index: WebRequest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebRequest.java,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- WebRequest.java 29 Aug 2002 20:51:02 -0000 1.46
+++ WebRequest.java 5 Sep 2002 14:46:55 -0000 1.47
@@ -34,6 +34,7 @@
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
+import java.net.URLStreamHandler;
import java.util.Dictionary;
import java.util.Enumeration;
@@ -48,6 +49,8 @@
**/
abstract
public class WebRequest {
+
+ private static URLStreamHandler JAVASCRIPT_STREAM_HANDLER = new JavascriptURLStreamHandler();
private SubmitButton _button;
/**
@@ -85,7 +88,11 @@
* Creates a new URL, handling the case where the relative URL begins with a '?'
*/
private URL newURL( final URL base, final String spec ) throws MalformedURLException {
- return spec.startsWith( "?" ) ? new URL( base + spec ) : new URL( base, spec );
+ if (spec.toLowerCase().startsWith( "javascript:" )) {
+ return new URL( "javascript", null, -1, spec.substring( "javascript:".length() ), JAVASCRIPT_STREAM_HANDLER );
+ } else {
+ return spec.startsWith( "?" ) ? new URL( base + spec ) : new URL( base, spec );
+ }
}
@@ -595,6 +602,20 @@
}
}
+}
+
+
+
+
+
+//======================================== class JavaScriptURLStreamHandler ============================================
+
+
+class JavascriptURLStreamHandler extends URLStreamHandler {
+
+ protected URLConnection openConnection( URL u ) throws IOException {
+ return null;
+ }
}
|