Menu

Null Ptr parsing

Help
2006-07-21
2013-04-17
  • Jeff Winkler

    Jeff Winkler - 2006-07-21

    Hi,
    I'm getting a problem with layoutdemo.xml.. the Display just comes back null. I have this helper function-

        void showDlg( String fileName ) {
            System.out.println ("WD = " + System.getProperty("user.dir"));
            System.out.println (fileName+ " exists = " + new File (fileName).exists());
            CookSwt cookSwt = new CookSwt ();
            Display d = (Display)cookSwt.xmlDecode (fileName);
            if ( d == null )
                System.err.println ("Failed to decode XML for "+ fileName);
            else
                SwtUtils.showDisplay ( d );
        }

    Which gives the following output:
    WD = E:\eclipse-platform-3.2RC7-win32\Calistoworkspace\cookSWT
    helloWorld.xml exists = true
    WD = E:\eclipse-platform-3.2RC7-win32\Calistoworkspace\cookSWT
    layoutdemo.xml exists = true
    Failed to decode XML for layoutdemo.xml

    What's the approach for tracking down XML parse

     
    • Jeff Winkler

      Jeff Winkler - 2006-07-21

      .. errors? Are problems reported anywhere? I want to give this to non-java users, failing silently will make it tough for them to use.

      Thanks

       
    • Coconut

      Coconut - 2006-07-21

      There are two ways:

      1. enable assertion (-ea of JVM) and that will print out exception traces.

      2. Write your own exception handler that prints out exception (just follow DebugExceptionHandler's example by removing the assert keyword) and use it as default.

       

Log in to post a comment.