Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-2517

NullPointerException in BaseClassFieldReader.writeExternal() when a global method is used in LHS and serialize package

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 7.7.0.Final
    • Fix Version/s: None
    • Component/s: core engine
    • Labels:

      Description

      Under the conditions:

      • A rule uses a method of global variable in LHS. e.g. Person(myUtil.transform(name) == "John-san")
      • A package is serialized
        Serializing the package throws NullPointerException.
        java.lang.NullPointerException: null
        	at org.drools.core.base.BaseClassFieldReader.writeExternal(BaseClassFieldReader.java:196)
        	at org.drools.core.base.extractors.MVELObjectClassFieldReader.writeExternal(MVELObjectClassFieldReader.java:72)
        	at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1459)
        	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1430)
        	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
        	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
        	at org.drools.core.base.ClassFieldAccessorStore$FieldLookupEntry.writeExternal(ClassFieldAccessorStore.java:384)
        	at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1459)
        	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1430)
        	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
        	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
        	at java.util.concurrent.ConcurrentHashMap.writeObject(ConcurrentHashMap.java:1413)
        	at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
        	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        	at java.lang.reflect.Method.invoke(Method.java:497)
        	at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1028)
        	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
        	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
        	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
        	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
        	at org.drools.core.base.ClassFieldAccessorStore.writeExternal(ClassFieldAccessorStore.java:61)
        	at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1459)
        	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1430)
        	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
        	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
        	at org.drools.core.definitions.impl.KnowledgePackageImpl.writeExternal(KnowledgePackageImpl.java:250)
        	at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1459)
        	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1430)
        	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
        	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
        	at java.util.ArrayList.writeObject(ArrayList.java:762)
        	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        	at java.lang.reflect.Method.invoke(Method.java:497)
        	at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1028)
        	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
        	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
        	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
        	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
        	at org.drools.compiler.integrationtests.SerializedPackageMergeTest.testBuildAndSerializePackagesWithGlobalMethodInLHS(SerializedPackageMergeTest.java:244)
        

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  mfusco Mario Fusco
                  Reporter:
                  tkobayashi Toshiya Kobayashi
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: