cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amaury SECHET (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAY-1583) context.getObjectStore() returning null causing NullpointerException in DataMergeHandler
Date Fri, 08 Jul 2011 21:18:17 GMT

    [ https://issues.apache.org/jira/browse/CAY-1583?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13062188#comment-13062188
] 

Amaury SECHET commented on CAY-1583:
------------------------------------

Yes you are right, I made a mistake and meant DataContextMergeHandler. Anyway, no, the application
doesn't use serialization. This is a quite simple application that process a huge amount of
data to put it in a database. The only thing is that tha amount of data is huge and everything
is multithreaded, causing this race condition.

Index: branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataContext.java
===================================================================
--- branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataContext.java
(révision 1144473)
+++ branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataContext.java
(copie de travail)
@@ -199,9 +199,6 @@
      * @since 1.2
      */
     public DataContext(DataChannel channel, ObjectStore objectStore) {
-        // use a setter to properly initialize EntityResolver
-        setChannel(channel);
-
         // inject self as parent context
         if (objectStore != null) {
             this.objectStore = objectStore;
@@ -211,7 +208,10 @@
             this.usingSharedSnaphsotCache = domain != null
                     && objectStore.getDataRowCache() == domain.getSharedSnapshotCache();
         }
-
+	
+	// use a setter to properly initialize EntityResolver
+        setChannel(channel);
+	
         this.graphAction = new DataContextGraphAction(this);
     }
 


> context.getObjectStore() returning null causing NullpointerException in DataMergeHandler
> ----------------------------------------------------------------------------------------
>
>                 Key: CAY-1583
>                 URL: https://issues.apache.org/jira/browse/CAY-1583
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Core Library
>    Affects Versions: 3.0.1
>         Environment: sun Java 6 jre under both debian (squeeze) and ubuntu (maverik)
linux with MySQL 5.1 using InnoDB.
>            Reporter: Amaury SECHET
>
> context.getObjectStore() return null, but nowhere in the code the constructor is called
with null as objectStore
> This looks like a multithreading problem (object accessed before full initialization)
or deserialization issue.
> However, I have a patch that's either, solve the issue, or at least make it almost impossible
to trigger. Simply switch position of
> 		// use a setter to properly initialize EntityResolver
> 		setChannel(channel);
> 		
> form before the objectContext to after.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

Mime
View raw message