How to debug a NullPointer exception on stardup?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to debug a NullPointer exception on stardup?

h.goebel
Administrator
Hi,

when bundling Freeplane 1.3.11 for magia I must have done something
wrong: the packages application fails to start, I get a

STDOUT: ## DEBUG: errors - FrameworkErrorEvent bundle #1
STDOUT: ## DEBUG: errors - FrameworkErrorEvent throwable:
Exception: java.lang.NullPointerException thrown from the
UncaughtExceptionHandler in thread "startlevel job thread"

How can I debug this?

Sorry, if this is is dull question, but I've not worked on the code for
quite some time now and I did not find somethin about debugging in the wiki.

--
Regards
Hartmut Goebel

| Hartmut Goebel          | [hidden email]               |
| www.crazy-compilers.com | compilers which you thought are impossible |



--
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to debug a NullPointer exception on stardup?

Felix Natter
Administrator
"h.goebel [via Freeplane Developer]"
<[hidden email]> writes:

> Hi,

Hi Hartmut,

> when bundling Freeplane 1.3.11 for magia I must have done something
> wrong: the packages application fails to start, I get a
>
> STDOUT: ## DEBUG: errors - FrameworkErrorEvent bundle #1
> STDOUT: ## DEBUG: errors - FrameworkErrorEvent throwable:
> Exception: java.lang.NullPointerException thrown from the
> UncaughtExceptionHandler in thread "startlevel job thread"

Unfortunately that doesn't ring a bell for me.

> How can I debug this?
>
> Sorry, if this is is dull question, but I've not worked on the code for
> quite some time now and I did not find somethin about debugging in the wiki.

if you can reproduce the error when running from eclipse then you
can do the following:

- open the debug perspective (button in the top right corner)
- open the breakpoints view
- click on "J!" (Add Java Exception Breakpoint)
- choose java.lang.NullPointerException
- debug and trigger the error

If you can't reproduce when running from eclipse, then you can use "jdb"
directly (\exists tutorials on the web) or insert logging statements.
Maybe I can help with this.

Best Regards,
--
Felix Natter
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to debug a NullPointer exception on stardup?

Dimitry Polivaev
Administrator
In reply to this post by h.goebel
> when bundling Freeplane 1.3.11 for magia I must have done something
> wrong: the packages application fails to start, I get a
>
> STDOUT: ## DEBUG: errors - FrameworkErrorEvent bundle #1
> STDOUT: ## DEBUG: errors - FrameworkErrorEvent throwable:
> Exception: java.lang.NullPointerException thrown from the
> UncaughtExceptionHandler in thread "startlevel job thread"
>
> How can I debug this?

There is a standard solution: remote debugging, see e.g.

http://javapapers.com/core-java/java-remote-debug-with-eclipse/

Add all freeplane projects and knopflerfish source code to the debug configuration source code paths
(http://www.knopflerfish.org/releases/2.3.3/)

Use flag suspend=y

Regards,
Dimitry
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to debug a NullPointer exception on stardup?

h.goebel
Administrator
In reply to this post by Felix Natter
Hi,

Am 25.07.2014 19:28, schrieb Felix Natter [via Freeplane Developer]:
> > when bundling Freeplane 1.3.11 for magia I must have done something
> > wrong: the packages application fails to start, I get a
> >
> > STDOUT: ## DEBUG: errors - FrameworkErrorEvent bundle #1
> > STDOUT: ## DEBUG: errors - FrameworkErrorEvent throwable:
> > Exception: java.lang.NullPointerException thrown from the
> > UncaughtExceptionHandler in thread "startlevel job thread"
>
> Unfortunately that doesn't ring a bell for me.

Now I found time digging into this. I needed to use `git bisect`, since
debugging with eclipse raised some totally different issue.

I found this commit being the bad one:

ceab063022aac7c8011a48e3c5b6f8daa939fb37 is the first bad commit
commit ceab063022aac7c8011a48e3c5b6f8daa939fb37
Author: dpolivaev <dpolivaev>
Date:   Sun Nov 17 21:45:59 2013 +0100

    try to get rounded splash as described in
   
http://docs.oracle.com/javase/tutorial/uiswing/misc/trans_shaped_windows.html
    and
   
http://www.oracle.com/technetwork/articles/javase/translucent-shaped-windows-139324.html

containing this (relevant) change:
---
a/freeplane/src/org/freeplane/main/application/FreeplaneSplashModern.java
+++
b/freeplane/src/org/freeplane/main/application/FreeplaneSplashModern.java

@@ -60,6 +61,11 @@ public class FreeplaneSplashModern extends JWindow {
                super(frame);
                splashResource =
ResourceController.getResourceController().getRes
                splashImage = new ImageIcon(splashResource);
+               try {
+                      
getClass().getClassLoader().loadClass("com.sun.awt.AWTUtil
+               }
+               catch (Exception e) {}
+               setBackground(new Color(0x57, 0xbf, 0x5e,0));
                getRootPane().setOpaque(false);
                final Dimension screenSize =
Toolkit.getDefaultToolkit().getScreen
                final Dimension labelSize = new
Dimension(splashImage.getIconWidth

I found that setBackground raises the error.

Is it okay to simply move the setBackground() call into the try-statement?


BTW: I tracked it down even more and found that the .getMethod()-call
within the try raises a NullPointerException, too.

--
Regards
Hartmut Goebel

| Hartmut Goebel          | [hidden email]               |
| www.crazy-compilers.com | compilers which you thought are impossible |

--
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to debug a NullPointer exception on stardup?

Dimitry Polivaev
Administrator
> I found that setBackground raises the error.
>
> Is it okay to simply move the setBackground() call into the try-statement?

This issues should already be solved on all branches because of
https://sourceforge.net/p/freeplane/discussion/758437/thread/be2cb81b/

reporting

Aug 03, 2014 3:31:48 PM org.freeplane.core.util.LogUtils severe
SEVERE:
java.lang.UnsupportedOperationException: PERPIXEL_TRANSLUCENT translucency is not supported
        at java.awt.Window.setBackground(Window.java:3815)
        at org.freeplane.main.application.FreeplaneSplashModern.<init>(FreeplaneSplashModern.java:68)
        at
org.freeplane.main.application.FreeplaneGUIStarter.createController(FreeplaneGUIStarter.java:150)
        at org.freeplane.main.osgi.ActivatorImpl.startFramework(ActivatorImpl.java:178)
        at org.freeplane.main.osgi.ActivatorImpl.start(ActivatorImpl.java:79)
        at org.freeplane.main.osgi.Activator.start(Activator.java:36)
        at org.knopflerfish.framework.BundleImpl.start0(BundleImpl.java:374)
        at org.knopflerfish.framework.PermissionOps.callStart0(PermissionOps.java:215)
(I deleted the ugly stack traces from the forum after fixing the problem)

So update to the last version and check again.

Actually I think that the setBackground call could be removed. All the stuff made sense only for non
rectangular splashes which have been deactivated because they did not work properly on some
configurations.

Regards,
Dimitry

Loading...