NullPointerException running Cling Workbench on Ubuntu

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

NullPointerException running Cling Workbench on Ubuntu

Anthony Hull
I have recently installed Cling 2.0-alpha3 on a 64-bit Ubuntu 13.10 system, having previous used it under Windows 7. I can use the libraries to build and run my application, but when I try to run the workbench (cling-workbench-2.0-alpha3-standalone.jar), it crashes with a NullPointerException.

If I ignore the error and continue, the workbench appears, I can view devices but I cannot interact with services: the Use Service button is visible, but not Invoke Action etc.


Trace:
----------------------------------------------------------------------------------------------------------------

An exceptional error occurred!
You can try to continue or exit the application.

Please tell us about this here:
http://www.4thline.org/projects/mailinglists-cling.html

-------------------------------------------------------------------------------------------------------------

java.lang.NullPointerException
        at org.fourthline.cling.workbench.browser.impl.BrowserPresenter.onRemoteDeviceComplete(BrowserPresenter.java:117)
        at org.fourthline.cling.workbench.browser.impl.BrowserPresenter$Proxy$_$$_WeldClientProxy.onRemoteDeviceComplete(BrowserPresenter$Proxy$_$$_WeldClientProxy.java)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:267)
        at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)
        at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137)
        at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:263)
        at org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:170)
        at org.jboss.weld.introspector.ForwardingWeldMethod.invokeOnInstance(ForwardingWeldMethod.java:51)
        at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:154)
        at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:245)
        at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:233)
        at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:213)
        at org.jboss.weld.event.ObserverNotifier.notifyObserver(ObserverNotifier.java:117)
        at org.jboss.weld.event.ObserverNotifier.notifyObservers(ObserverNotifier.java:85)
        at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:80)
        at org.jboss.weld.event.EventImpl.fire(EventImpl.java:69)
        at org.fourthline.cling.ManagedUpnpService$RegistryListenerAdapter.remoteDeviceAdded(ManagedUpnpService.java:187)
        at org.fourthline.cling.RegistryListenerAdapter$Proxy$_$$_WeldClientProxy.remoteDeviceAdded(RegistryListenerAdapter$Proxy$_$$_WeldClientProxy.java)
        at org.fourthline.cling.registry.RemoteItems$1.run(RemoteItems.java:111)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:744)

 
Reply | Threaded
Open this post in threaded view
|

Re: NullPointerException running Cling Workbench on Ubuntu

Christian Bauer
Administrator

On 11.03.2014, at 18:28, Anthony Hull [via Mailinglists] <[hidden email]> wrote:

> If I ignore the error and continue, the workbench appears, I can view devices but I cannot interact with services: the Use Service button is visible, but not Invoke Action etc.

Those buttons should be unrelated to the problem, they are only active if you select a service etc.

> java.lang.NullPointerException
>         at org.fourthline.cling.workbench.browser.impl.BrowserPresenter.onRemoteDeviceComplete(BrowserPresenter.java:117)

This is the code:

                MimeType contentType =
                        responseMsg.getHeaders().getFirstHeader(UpnpHeader.Type.CONTENT_TYPE, ContentTypeHeader.class).getValue();


The reason for the NPE is that some device returns no content type header in the HTTP response when delivering the device icon.

I've committed a more lenient routine that ignores icons without content type:

https://github.com/4thline/cling/commit/1b60a224b400516e6e9e6176e222c271482b7121