Hi,
We are creating a simple CI with one relation. The CI has a reference to static file in the primary relation and also a reference to static file in secondary relation. Both attributes are configured with ContentSelectCCE widget.
Following is the code snippet for creating the content instance. If we remove the setRelations, it works fine but ofcourse doesn't create data in secondary relation.
However, with the code in place, it gives error while checking the referenced attributes. Seems like it gets a null pointer excpetion while checking the reference. Intrestingly, we are providing the same instance reference (thumbnail) to both primary and secondary reference attributes.
What are we missing?
Sohail
________________________________________________________________
ContentInstance newMM = (ContentInstance)mmType.newInstance();
newMM.setAttributeValue("title", "A new mm by API");
newMM.setAttributeValue("description", "I was added through API");
newMM.setAttributeValue("thumbnail", thumbnail);
newMM.setLogicalPath("/Test Content");
ContentRelationInstance oneImage = new ContentRelationInstance(mmType.getObjectTypeRef());
oneImage.setAttributeValue("image-title", "CN Tower");
oneImage.setAttributeValue("image-src",thumbnail);
oneImage.setAttributeValue("image-alt", "Alt-Text for CN Tower");
oneImage.setAttributeValue("image-type","Large");
AttributedObject[] newImages = {oneImage};
newMM.setRelations("image", newImages);
-----------------------
Exception:
com.vignette.as.client.exception.ApplicationException
at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:234)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:348)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:259)
at com.vignette.as.server.ejb.ContentInstanceOpsBean_qoaxtk_EOImpl_1030_WLStub.commit(Unknown Source)
at com.vignette.as.client.javabean.ManagedObject.commit(ManagedObject.java:1335)
at com.vignette.as.client.javabean.ContentInstance.commit(ContentInstance.java:942)
at ca.test.migration.utils.images.Main.createMultiMedia(Main.java:176)
at ca.test.migration.utils.images.Main.main(Main.java:84)
Nested exception is:
java.lang.NullPointerException
at com.vignette.as.server.persist.ContentInstancePersistor.checkReferenceAttribute(ContentInstancePersistor.java:461)
at com.vignette.as.server.persist.ContentInstancePersistor.checkAutomaticAttributes(ContentInstancePersistor.java:353)
at com.vignette.as.server.persist.ContentInstancePersistor.checkAutomaticAttributes(ContentInstancePersistor.java:316)
at com.vignette.as.server.persist.ContentInstancePersistor.checkAutomaticAttributes(ContentInstancePersistor.java:286)
at com.vignette.as.server.persist.ContentInstancePersistor.commit(ContentInstancePersistor.java:135)
at com.vignette.as.server.logic.common.ManagedObjectOpsLogic.commit(ManagedObjectOpsLogic.java:123)
at com.vignette.as.server.logic.cm.ContentInstanceOpsLogic.commit(ContentInstanceOpsLogic.java:74)
at com.vignette.as.server.logic.cm.ContentInstanceOpsLogicGen.commit(ContentInstanceOpsLogicGen.java:651)
at com.vignette.as.server.ejb.ContentInstanceOpsBean.commit(ContentInstanceOpsBean.java:632)
at com.vignette.as.server.ejb.ContentInstanceOpsBean_qoaxtk_EOImpl.commit(ContentInstanceOpsBean_qoaxtk_EOImpl.java:764)
at com.vignette.as.server.ejb.ContentInstanceOpsBean_qoaxtk_EOImpl_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:590)
at weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:230)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:478)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:473)
at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:119)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
newMM.commit();