Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 336252 - DBWSBuilder fails with npe - package with 2 (or more) procs
Summary: DBWSBuilder fails with npe - package with 2 (or more) procs
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: David McCann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-03 11:08 EST by Mike Norman CLA
Modified: 2022-06-09 10:04 EDT (History)
1 user (show)

See Also:


Attachments
Proposed Fix. (12.31 KB, patch)
2011-03-03 11:55 EST, David McCann CLA
no flags Details | Diff
Supporting tests. (22.74 KB, patch)
2011-03-04 12:41 EST, David McCann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Norman CLA 2011-02-03 11:08:07 EST
While generating a PL/SQL provider service from a datable package fails with NPE:

java.lang.NullPointerException
at
org.eclipse.persistence.tools.dbws.DBWSBuilder.buildOROXProjectsForAdvancedPLS
QLProcedure(DBWSBuilder.java:932)
at
org.eclipse.persistence.tools.dbws.DBWSBuilder.buildOROXProjects(DBWSBuilder.j
ava:774)
at
org.eclipse.persistence.tools.dbws.DBWSBuilder.build(DBWSBuilder.java:514)
at
oracle.jdeveloper.webservices.model.toplink.dbws.generator.TopLinkDBInvokeBuil
der.action(TopLinkDBInvokeBuilder.java:315)
at
oracle.jdeveloper.webservices.model.generator.GeneratorAction.run(GeneratorAct
ion.java:142)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java
:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908
)
at java.lang.Thread.run(Thread.java:619)
Comment 1 David McCann CLA 2011-03-03 08:52:29 EST
This issue occurs when there are more than two stored procedures being processed, and at least one of them is considered a PLSQL Procedure Operation.  

Here's the problem:  we initially iterate over each OperationModel (there is one per stored procedure) and create DbStoredProcedure instances accordingly.  A list of these DbStoredProcedure instances is created for each OPModel, and stored in a global list (of lists of DbStoredProcedure instances).  Later on, we process each OPModel again (building projects) and a PLSQLHelperObjectsBuilder is created - this holds DatabaseType info for each procedure in the OPModel.  During processing we want to create a PLSQLStoredProcedureCall for each stored procedure in the current OPModel.  In order to create the PLSQLStoredProcedureCall for a given stored procedure, we need the DbStoredProcedure instance created earlier, and the DatabaseType for that DbStoredProcedure instance, which is in the PLSQLHelperObjectsBuilder.  The NPE occurs because the code iterates over the global list of DbStoredProcedure instances, and tries to match up each DbStoredProcedure with an entry in the PLSQLHelperObjectsBuilder (to get the corresponding DatabaseType);  since the PLSQLHelperObjectsBuilder was created for the current OPModel, and hence only knows types for this OPModel's stored procedures, at some point the PLSQLHelperObjectsBuilder will return null.  In addition, if two stored procedures had the same name it is possible that the wrong DatabaseType could be returned from the PLSQLHelperObjectsBuilder.
Comment 2 David McCann CLA 2011-03-03 11:55:20 EST
Created attachment 190286 [details]
Proposed Fix.
Comment 3 David McCann CLA 2011-03-04 12:41:11 EST
Created attachment 190419 [details]
Supporting tests.
Comment 4 David McCann CLA 2011-03-04 15:53:54 EST
Reviewed by:  michael.norman@oracle.com

Tests:  all unit tests pass as expected; dbws/testing/visit/P1P4testWebServiceSuite

Revision: 9078
Comment 5 Eclipse Webmaster CLA 2022-06-09 10:04:03 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink