Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 313408

Summary: package whose repository is in the current directory can cause NullPointer exception
Product: [Technology] RTSC Reporter: Sasha Slijepcevic <sascha>
Component: CoreAssignee: Sasha Slijepcevic <sascha>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: d-russo
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: target:3.20
Bug Depends on:    
Bug Blocks: 313634    
Attachments:
Description Flags
testcase none

Description Sasha Slijepcevic CLA 2010-05-18 13:39:52 EDT
Attached is the package 'eclnew' which loads the package 'testpkg'. The package 'testpkg' is located in the directory 'eclnew/testpkg', and when 'eclnew' is being built, the repository directory for 'testpkg' is the current working directory.

To replicate the bug, unzip the attached file and build 'eclnew', without specifying XDCPATH.

If XDCPATH is not being set to include the current working directory, this physical organization causes NullPointer exception. The exception is caused by the difference between the path used by xdc.findFile and the path used by BrowserSession. When the schema for 'testpkg' is loaded, xdc.findFile automatically adds the current working directory to the search path, and 'testpkg' is found and processed correctly. However, when BrowserSession searches for the spec for 'testpkg' at the time when the config files are generated, only the package path is searched.

Here is the relevant part of the error output:
configuring test.x64P from package/cfg/test_x64P.cfg ...
java.lang.NullPointerException
        at xdc.services.intern.gen.Config.pkgSpec(Config.java:2739)
        at xdc.services.intern.gen.Config.getPkgAliases(Config.java:1765)
        at xdc.services.intern.gen.Config.gen(Config.java:251)
        at xdc.services.intern.gen.Prog.gen(Prog.java:63)
        at xdc.services.intern.gen.Prog.gen(Prog.java:40)
...
js: "/db/rtree/install/trees/products/xdcprod/xdcprod-m36/product/Linux/xdctools_3_20_00_36_eng/packages/xdc/cfg/Main.xs", line 31: XDC runtime exception: java.lang.NullPointerException
Comment 1 Sasha Slijepcevic CLA 2010-05-18 13:43:12 EDT
Created attachment 168977 [details]
testcase
Comment 2 Sasha Slijepcevic CLA 2010-05-19 18:16:45 EDT
The workaround that prevents NullPointer exception was implemented in xdc-v32.
The new bug filed as a request for a better solution is 313634.
Comment 3 Dave Russo CLA 2010-05-27 18:10:20 EDT
unziped example and built with xdctool 3.20.00.30 and observed the NULL pointer exception.  cleaned and rebuilt with 3.20.00.39 and got:

Warning: xdc.cfg.INCOMPATIBLE_TARGET_VERSION: current target 'ti.targets.C64P' [
1,0,6.1,6] is not compatible with targets used to build the following packages;
package ti.targets.rts6000 [in C:/users/dr/xdctools_3_20_00_39_eng/packages/ti/t
argets/rts6000/] was built using 'ti.targets.C64P' [1,0,7.0,0]

js: "C:/users/dr/xdctools_3_20_00_39_eng/packages/xdc/cfg/Main.xs", line 31: XDC
 runtime error: parser cannot find package 'testpkg' along the path 'c:/users/dr
/xdctools_3_20_00_39_eng/packages;..;'.
gmake.exe: *** [package/cfg/test_x64P.c] Error 1
gmake.exe: *** Deleting file `package/cfg/test_x64P.c'