On Nov 19, 2008, at 9:44 PM, Davis Ford wrote:
> I've confirmed this is an issue when I post a request that has zero
> parameters. This is a test case I had, and only this test case fails
> for me.
>
> Here is the example POST method:
>
> @POST
> @Produces("text/html")
> @Consumes({"application/x-www-form-urlencoded", "*/xml"})
^
|
Why
do you have that?
>
> public String doPost(@FormParam("xml") String xml) {
> if(xml == null) { etc..
> }
>
> Now, I have a bunch of integration tests that send the parameter "xml"
> and I have one test that does not include the parameter "xml" at all.
> This seems to generate a NPE, which is not what I would expect.
>
> This is with Jetty 6.1.14 and
>
> <dependency>
> <!-- the implementation of JAX-RS -->
> <groupId>com.sun.jersey</groupId>
> <artifactId>jersey-core</artifactId>
> <version>0.11-ea-SNAPSHOT</version>
What happens if you use 1.0 or 1.0.1-SNAPSHOT ?
>
> </dependency>
> <dependency>
> <!-- the implementation of JAX-RS -->
> <groupId>com.sun.jersey</groupId>
> <artifactId>jersey-server</artifactId>
> <version>0.11-ea-SNAPSHOT</version>
> </dependency>
>
I tried a quick test with 1.0.1-SNAPSHOT using the grizzly server and
could not reproduce the issue when sending a POST request with no form
parameters using curl. Note that i am not familiar with Jetty and
maven configuration.
Paul.
> On Wed, Nov 19, 2008 at 3:33 PM, Davis Ford <davisford_at_gmail.com>
> wrote:
>> Hi,
>>
>> I've changed my mvn project around a bit now to automatically launch
>> Jetty for pre-integration-phase and shut it down for
>> post-integration-phase. With my current configuration "mvn
>> jetty:run,
>> mvn jetty:run-war", etc. all work fine.
>>
>> However, I want to put this into a CI system, and have maven
>> automatically start Jetty when I run the integration-test phase. I
>> do
>> this via the configuration below, but when I run, and Jetty kicks
>> off,
>> I see this when my Integration Test runs:
>>
>> 2008-11-19 15:30:28.512::WARN: /efax/incoming-fax
>> com.sun.jersey.api.container.ContainerException: Exception injecting
>> parameters to Web resource method
>> at
>> com.sun.jersey.impl.model.method.dispatch.FormDispatchProvider
>> $FormParamInInvoker.getParams(FormDispatchProvider.java:99)
>>
>> etc..further down ->
>>
>> Caused by: com.sun.jersey.api.container.ContainerException:
>> java.lang.NullPointerException
>> at
>> com
>> .sun.jersey.impl.model.method.dispatch.MultipartFormDispatchProvider
>> $
>> MultipartFormParamInjectable
>> .getValue(MultipartFormDispatchProvider.java:145)
>> at
>> com.sun.jersey.impl.model.method.dispatch.FormDispatchProvider
>> $FormParamInInvoker.getParams(FormDispatchProvider.java:93)
>> ... 27 more
>> Caused by: java.lang.NullPointerException
>> at
>> com
>> .sun.jersey.impl.model.method.dispatch.MultipartFormDispatchProvider
>> $
>> MultipartFormParamInjectable
>> .getAsForm(MultipartFormDispatchProvider.java:152)
>> at
>> com
>> .sun.jersey.impl.model.method.dispatch.MultipartFormDispatchProvider
>> $
>> MultipartFormParamInjectable
>> .getValue(MultipartFormDispatchProvider.java:140)
>>
>> If I do this by manually starting Jetty via (mvn jetty:run), and then
>> run this same integration test from inside Eclipse, it passes no
>> problem.
>>
>> This is how I set up the pom.xml :
>>
>> Surefire plugin will only run test named **IntegrationTest* under the
>> integration-test phase.
>>
>> <plugin>
>> <artifactId>maven-surefire-plugin</artifactId>
>> <configuration>
>> <excludes>
>> <exclude>**/*IntegrationTest*.java</exclude>
>> </excludes>
>> </configuration>
>> <executions>
>> <execution>
>> <id>integration-test</id>
>> <goals>
>> <goal>test</goal>
>> </goals>
>> <phase>integration-test</phase>
>> <configuration>
>> <excludes>
>> <exclude>none</exclude>
>> </excludes>
>> <includes>
>> <include>**/
>> *IntegrationTest*.java</include>
>> </includes>
>> </configuration>
>> </execution>
>> </executions>
>> </plugin>
>>
>> And then I configured Jetty like this:
>>
>> <plugin>
>> <!-- JETTY 6 PLUGIN -->
>> <groupId>org.mortbay.jetty</groupId>
>> <artifactId>maven-jetty-plugin</artifactId>
>> <version>6.1.14</version>
>> <configuration>
>> <scanIntervalSeconds>10</scanIntervalSeconds>
>> <contextPath>/efax</contextPath>
>> <connectors>
>> <connector
>> implementation="org.mortbay.jetty.nio.SelectChannelConnector">
>> <port>4000</port>
>> <maxIdleTime>60000</maxIdleTime>
>> </connector>
>> </connectors>
>> <jetty-config>jetty.xml</jetty-config>
>> <webApp>${basedir}/target/efax</webApp>
>> </configuration>
>> <executions>
>> <execution>
>> <id>start-jetty</id>
>> <phase>pre-integration-test</phase>
>> <goals>
>> <goal>run-war</goal>
>> </goals>
>> <configuration>
>> <scanIntervalSeconds>0</
>> scanIntervalSeconds>
>> <daemon>true</daemon>
>> </configuration>
>> </execution>
>> <execution>
>> <id>stop-jetty</id>
>> <phase>post-integration-test</phase>
>> <goals>
>> <goal>stop</goal>
>> </goals>
>> </execution>
>> </executions>
>> </plugin>
>>
>> --
>> Zeno Consulting, Inc.
>> http://www.zenoconsulting.biz
>> 248.894.4922 phone
>> 313.884.2977 fax
>>
>
>
>
> --
> Zeno Consulting, Inc.
> http://www.zenoconsulting.biz
> 248.894.4922 phone
> 313.884.2977 fax
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>