[GLASSFISH-3926] Bad error reporting in MetaData.initialize() (possible NPE) Created: 17/Dec/07  Updated: 06/Jan/11

Status: Open
Project: glassfish
Component/s: other
Affects Version/s: 9.0pe
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: hallorant Assignee: Dhiru Pandey
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All
URL: https://glassfish.dev.java.net/source/browse/glassfish/tools/src/java/com/sun/enterprise/tools/common/dd/webapp/MetaData.java?rev=1.4&view=markup


Issuezilla Id: 3,926

 Description   

The method "initialize" tries to assign "data"

private static void initialize(){
...
SunWebAppData data = null;
try

{ data = SunWebAppData.createGraph(in); }

catch (Schema2BeansException e)

{ System.out.println("Failed to create bean graph for SunWebAppData"); //NOI18N }

//System.out.println("############ " + data.dumpBeanNode()); //NOI18N
ParamData pData = null;

// initialize all param name arrays
sessionParamName = new String[data.sizeSessionParam()];
storeParamName = new String[data.sizeStoreParam()];
managerParamName = new String[data.sizeManagerParam()];
...

if this fails then "data" is null, however, immediatly below this assignment
(as seen in the snippet above) "data" is unconditionally dereferenced many
times.

I think this catch block needs to be fixed to throw an IllegalStateException or
some other semantic exception explaining the problem. This would be much more
fail-fast than it currently is. For example,

try

{ data = SunWebAppData.createGraph(in); }

catch (Schema2BeansException e)

{ throw new IllegalStateException("Failed to create bean graph for SunWebAppData"); //NOI18N }

 Comments   
Comment by harpreet [ 02/Apr/08 ]

Not critical for v2.1 should be fixed for next release

Comment by sanandal [ 11/Jan/09 ]

"Reclassifying as P4 because this issue is not deemed "must fix" for this v2.1
release whose primary release driver is SailFin.
This issue will be scrubbed after this release and will be given the right
priority for the next release."

Generated at Sun Dec 04 02:20:54 UTC 2016 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.