dev@grizzly.java.net

Re: PUGrizzlyConfigTest failure

From: Ryan Lubke <ryan.lubke_at_oracle.com>
Date: Mon, 21 May 2012 09:39:19 -0700

Interesting! Thanks for the patch. I'll look into this today.

On 5/21/12 1:18 AM, Bongjae Chang wrote:
> Hi,
>
> When I ran modules/config's unit tests, I got the following exception
>
> -------------------------------------------------------
> T E S T S
> -------------------------------------------------------
> Running org.glassfish.grizzly.config.PUGrizzlyConfigTest
> 2012. 5. 21 ???? 5:11:16 org.glassfish.grizzly.config.Utils newInstance
> ???: Instance could not be initialized. Class=interface
> org.glassfish.grizzly.filterchain.Filter, name=websockets,
> realClassName=org.glassfish.grizzly.websockets.WebSocketFilter
> 2012. 5. 21 ???? 5:11:16
> org.glassfish.grizzly.config.GenericGrizzlyListener configureSubProtocol
> ???: Can not initialize sub protocol. Finder:
> org.glassfish.grizzly.config.portunif.HttpProtocolFinder
> java.lang.NullPointerException
> at
> org.glassfish.grizzly.filterchain.AbstractFilterChain.notifyConstructed(AbstractFilterChain.java:114)
> at
> org.glassfish.grizzly.filterchain.FilterChainBuilder$StatelessFilterChainBuilder.build(FilterChainBuilder.java:145)
> at
> org.glassfish.grizzly.config.GenericGrizzlyListener.configureSubProtocol(GenericGrizzlyListener.java:355)
> at
> org.glassfish.grizzly.config.GenericGrizzlyListener.configureProtocol(GenericGrizzlyListener.java:292)
> at
> org.glassfish.grizzly.config.GenericGrizzlyListener.configure(GenericGrizzlyListener.java:232)
> at
> org.glassfish.grizzly.config.GrizzlyConfig.setupNetwork(GrizzlyConfig.java:81)
> at
> org.glassfish.grizzly.config.PUGrizzlyConfigTest.puConfig(PUGrizzlyConfigTest.java:69)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
> at
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
> at
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
> at
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
> at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
> at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
> at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
> at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
> at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
> at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
> at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
> at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
> at
> org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:228)
> at
> org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:134)
> at
> org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:113)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
> at
> org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
> at
> org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
> at
> org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:103)
> at
> org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:74)
>
> It seems "WebSockets enabled by default"'s side-effect. :-)
>
> I attached the simple patch.
> ===
> ---
> ../../../dev/grizzly2_git/modules/config/src/main/java/org/glassfish/grizzly/config/GenericGrizzlyListener.java(revision
> 51afab3a2cd4a91584be3d23a8f6d7c4d14dd6c5)
> +++
> ../../../dev/grizzly2_git/modules/config/src/main/java/org/glassfish/grizzly/config/GenericGrizzlyListener.java(revision
> )
> @@ -601,7 +601,7 @@
> }
> final int httpServerFilterIdx =
> filterChainBuilder.indexOfType(HttpServerFilter.class);
> - if (httpServerFilterIdx >= 0) {
> + if (httpServerFilterIdx >= 0 && f != null) {
> // Insert the WebSocketFilter right after HttpCodecFilter
> filterChainBuilder.add(httpServerFilterIdx, f);
> }
>
> ===
>
> Thanks!
>
> Regards,
> Bongjae Chang