Bug 217853 - Util.getLineSeparator NullPointerException
Summary: Util.getLineSeparator NullPointerException
Status: VERIFIED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3.1   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.4 M6   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-05 11:16 EST by Mark Howard CLA
Modified: 2008-03-25 12:41 EDT (History)
2 users (show)

See Also:


Attachments
simple patch for this NPE (1.14 KB, patch)
2008-02-05 11:16 EST, Mark Howard CLA
no flags Details | Diff
example java class (1.09 KB, text/x-java)
2008-02-05 11:59 EST, Mark Howard CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Howard CLA 2008-02-05 11:16:56 EST
Created attachment 88892 [details]
simple patch for this NPE

Build ID: 3.3.1

Steps To Reproduce:
Call util.getLineSeparator from some custom (non-eclipse) code. A NullPointerException is produced, despite code lower down in the method suggesting that it should work without a platform running.

More information:
This appears to have worked in the past, e.g. so that the ant script mentioned on the following page would work: http://www.eclipse.org/articles/Article-JET2/jet_tutorial2.html

The attached patch is against the R3_3_maintenance cvs branch, although the bug appears to be present in CVS HEAD. Fixing this in the 3.3 branch would be very much appreciated.
Comment 1 Eric Jodet CLA 2008-02-05 11:39:41 EST
> Call util.getLineSeparator from some custom (non-eclipse) code.
May you please provide us with some sample code along with a step by step scenario in order for us to try and reproduce this issue.
Thanks
Comment 2 Mark Howard CLA 2008-02-05 11:59:40 EST
Created attachment 88899 [details]
example java class

I'm attaching a simple class which demonstrates the NPE. This class is trying to use JET to generate a java source file from a jet template. The NPE is raised through calls to jdt's Util.java, via constructors:

java.lang.NullPointerException
        at org.eclipse.jdt.internal.core.util.Util.getLineSeparator(Util.java:882)
        at org.eclipse.jdt.core.jdom.DOMFactory.<init>(DOMFactory.java:32)
        at org.eclipse.emf.codegen.jet.JETSkeleton.<init>(JETSkeleton.java:53)
        at org.eclipse.emf.codegen.jet.JETCompiler.handleDirective(JETCompiler.java:277)
        at org.eclipse.emf.codegen.jet.JETParser$DelegatingListener.handleDirective(JETParser.java:133)
        at org.eclipse.emf.codegen.jet.JETParser$Directive.accept(JETParser.java:444)
        at org.eclipse.emf.codegen.jet.JETParser.parse(JETParser.java:512)
        at org.eclipse.emf.codegen.jet.JETCompiler.parse(JETCompiler.java:631)
        at org.eclipse.emf.codegen.jet.JETCompiler.parse(JETCompiler.java:624)
        at com.onespatial.maven2.JetMojo.processTemplate(JetMojo.java:75)
Comment 3 Jerome Lanneluc CLA 2008-02-06 06:32:06 EST
org.eclipse.jdt.core.jdom was not designed to run out of the context of an Eclipse workspace. Moreover it is deprecated. Its replacement org.eclipse.jdt.core.dom is known to be able to run out of the context of an Eclipse workspace if binding resolution is not requested.

No change planned.
Comment 4 Kent Johnson CLA 2008-03-25 12:41:15 EDT
Verified for 3.4M6