Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 205859 Details for
Bug 351509
Null Pointer Exception when using Scrollable Cursor on a OneToMany Mapping
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch and testcase
309142v3.patch (text/plain), 4.81 KB, created by
David Minsky
on 2011-10-24 14:37:07 EDT
(
hide
)
Description:
Patch and testcase
Filename:
MIME Type:
Creator:
David Minsky
Created:
2011-10-24 14:37:07 EDT
Size:
4.81 KB
patch
obsolete
>Index: foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/queries/QueryFrameworkTestSuite.java >=================================================================== >--- foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/queries/QueryFrameworkTestSuite.java (revision 10265) >+++ foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/queries/QueryFrameworkTestSuite.java (working copy) >@@ -63,6 +63,7 @@ > addTest(buildArgumentValuesTest()); > addTest(new ScrollableCursorForwardOnlyResultSetTest()); // Bug 309142 > addTest(new ConformResultsSubclassesTest()); // Bug 327900 >+ addTest(new ScrollableCursorJoinedAttributeTest()); // Bug 351509 > } > > //SRG test set is maintained by QA only, do NOT add any new test cases into it. >Index: foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/queries/ScrollableCursorJoinedAttributeTest.java >=================================================================== >--- foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/queries/ScrollableCursorJoinedAttributeTest.java (revision 0) >+++ foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/queries/ScrollableCursorJoinedAttributeTest.java (revision 0) >@@ -0,0 +1,59 @@ >+package org.eclipse.persistence.testing.tests.queries; >+ >+import java.util.List; >+import java.util.Vector; >+ >+import org.eclipse.persistence.queries.DatabaseQuery; >+import org.eclipse.persistence.queries.ReadAllQuery; >+import org.eclipse.persistence.queries.ScrollableCursor; >+ >+import org.eclipse.persistence.testing.framework.TestCase; >+import org.eclipse.persistence.testing.models.employee.domain.Employee; >+ >+/** >+ * Test using a ScrollableCursor with a simple joined attribute. >+ * Bug 351509 - Null Pointer Exception when using ScrollableCursor on a OneToMany Mapping >+ */ >+public class ScrollableCursorJoinedAttributeTest extends TestCase { >+ >+ protected List cursoredResults; >+ protected Exception caughtException; >+ >+ public ScrollableCursorJoinedAttributeTest() { >+ super(); >+ setDescription("Scrollable Cursor Test incorporating a joined attribute"); >+ } >+ >+ public void test() { >+ getSession().getIdentityMapAccessor().initializeAllIdentityMaps(); >+ >+ cursoredResults = new Vector(); >+ ReadAllQuery cursoredQuery = new ReadAllQuery(Employee.class); >+ cursoredQuery.useScrollableCursor(); >+ cursoredQuery.addJoinedAttribute(cursoredQuery.getExpressionBuilder().anyOfAllowingNone("phoneNumbers")); >+ cursoredQuery.addOrdering(cursoredQuery.getExpressionBuilder().get("id")); >+ >+ try { >+ ScrollableCursor cursor = (ScrollableCursor)getSession().executeQuery(cursoredQuery); >+ while (cursor.hasNext()) { >+ Object result = cursor.next(); >+ cursoredResults.add(result); >+ } >+ cursor.close(); >+ } catch (Exception e) { >+ caughtException = e; >+ } >+ } >+ >+ public void verify() { >+ if (caughtException != null) { >+ throwError("Cursored query should not result in an exception", caughtException); >+ } >+ assertNotSame("Test data for cursored results should be nonzero", 0, cursoredResults.size()); >+ } >+ >+ public void reset() { >+ this.cursoredResults = null; >+ } >+ >+} >Index: foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/queries/ScrollableCursor.java >=================================================================== >--- foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/queries/ScrollableCursor.java (revision 10265) >+++ foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/queries/ScrollableCursor.java (working copy) >@@ -550,6 +550,12 @@ > row = this.nextRow; > this.nextRow = null; > } >+ >+ this.position = currentPosition + 1; // bug 309142 >+ if (row == null) { >+ return null; >+ } >+ > // If using 1-m joining need to fetch 1-m rows as well. > if (this.query.isObjectLevelReadQuery() && ((ObjectLevelReadQuery)this.query).hasJoining()) { > JoinedAttributeManager joinManager = ((ObjectLevelReadQuery)this.query).getJoinedAttributeManager(); >@@ -558,12 +564,6 @@ > } > } > >- this.position = currentPosition + 1; // bug 309142 >- >- if (row == null) { >- return null; >- } >- > Object object = buildAndRegisterObject(row); > if (object == InvalidObject.instance) { > continue;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 351509
:
199306
|
200400
|
205852
|
205859
|
205864