[Httpunit-commit] SF.net SVN: httpunit: [918] trunk/httpunit
Brought to you by:
russgold
|
From: <wol...@us...> - 2008-04-15 17:51:26
|
Revision: 918
http://httpunit.svn.sourceforge.net/httpunit/?rev=918&view=rev
Author: wolfgang_fahl
Date: 2008-04-15 10:51:21 -0700 (Tue, 15 Apr 2008)
Log Message:
-----------
fix for Bug report 1212204 by Brian Bonner
Modified Paths:
--------------
trunk/httpunit/src/com/meterware/httpunit/UncheckedParameterHolder.java
trunk/httpunit/test/com/meterware/servletunit/HttpServletRequestTest.java
Modified: trunk/httpunit/src/com/meterware/httpunit/UncheckedParameterHolder.java
===================================================================
--- trunk/httpunit/src/com/meterware/httpunit/UncheckedParameterHolder.java 2008-04-15 17:37:31 UTC (rev 917)
+++ trunk/httpunit/src/com/meterware/httpunit/UncheckedParameterHolder.java 2008-04-15 17:51:21 UTC (rev 918)
@@ -2,7 +2,7 @@
/********************************************************************************************************************
* $Id$
*
- * Copyright (c) 2002-2003, 2007, Russell Gold
+ * Copyright (c) 2002-2003, 2007-2008 Russell Gold
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
@@ -105,7 +105,7 @@
String name = (String) e.nextElement();
Object[] values = (Object[]) _parameters.get( name );
for (int i = 0; i < values.length; i++) {
- if (values[i] instanceof String) {
+ if (values[i] instanceof String || values[i] == null) {
processor.addParameter( name, (String) values[i], _characterSet );
} else if (values[i] instanceof UploadFileSpec) {
processor.addFile( name, (UploadFileSpec) values[i] );
Modified: trunk/httpunit/test/com/meterware/servletunit/HttpServletRequestTest.java
===================================================================
--- trunk/httpunit/test/com/meterware/servletunit/HttpServletRequestTest.java 2008-04-15 17:37:31 UTC (rev 917)
+++ trunk/httpunit/test/com/meterware/servletunit/HttpServletRequestTest.java 2008-04-15 17:51:21 UTC (rev 918)
@@ -209,6 +209,34 @@
}
+ /**
+ * test Bug report 1212204
+ * by Brian Bonner
+ * @throws Exception
+ */
+ public void testBug1212204() throws Exception {
+ WebRequest request = new
+ GetMethodWebRequest("http://localhost/pathinfo?queryString");
+ //assertEquals("queryString", request.getQueryString());
+ request = new
+ GetMethodWebRequest("http://localhost/pathinfo?queryString");
+ request.setParameter("queryString","");
+ assertEquals("queryString=", request.getQueryString());
+ request = new
+ GetMethodWebRequest("http://localhost/pathinfo?queryString");
+ request.setParameter("queryString",(String)null);
+ assertEquals("queryString", request.getQueryString());
+ WebRequest wr = new
+ GetMethodWebRequest("http://localhost?wsdl");
+ wr.setParameter("abc","def");
+ wr.setParameter("def","");
+ wr.setParameter("test",(String)null);
+ wr.setParameter("wsdl", (String)null);
+
+ assertEquals("wsdl&abc=def&def=&test",wr.getQueryString());
+ }
+
+
public void testInlineSingleValuedParameter() throws Exception {
WebRequest wr = new GetMethodWebRequest( "http://localhost/simple?color=red&color=blue&age=12" );
HttpServletRequest request = new ServletUnitHttpRequest( NULL_SERVLET_REQUEST, wr, _context, new Hashtable(), NO_MESSAGE_BODY );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|