shuber 2005/06/09 16:11:01 CEST
Modified files: (Branch: JAHIA-4-0-BRANCH)
src/view/jsp eventlistener.jsp
Log:
Add check for field existence in beforeFieldActivation listener. getField can
return null if the field has been marked for deletion !
Revision Changes Path
1.1.2.1 +14 -8 corporate_portal_templates/src/view/jsp/eventlistener.jsp
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/corporate_portal_templates/src/view/jsp/eventlistener.jsp.diff?r1=1.1&r2=1.1.2.1&f=h
Index: eventlistener.jsp
===================================================================
RCS file:
/home/cvs/repository/corporate_portal_templates/src/view/jsp/eventlistener.jsp,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- eventlistener.jsp 13 Nov 2003 14:38:23 -0000 1.1
+++ eventlistener.jsp 9 Jun 2005 14:11:01 -0000 1.1.2.1
@@ -362,20 +362,26 @@
// Last activation Date Field
if ( "metaDataPublishingDate".equals(fieldDef.getName()) ){
JahiaField theField =
contentField.getJahiaField(jParams.getEntryLoadRequest());
-
theField.setObject(String.valueOf(saveVersion.getVersionID()*1000L));
- theField.save(jParams);
+ // the field could be null in case it was marked for deletion !
+ if (theField != null) {
+
theField.setObject(String.valueOf(saveVersion.getVersionID()*1000L));
+ theField.save(jParams);
+ // reload the contentField
+ contentField = ContentField.getField(theField.getID());
+ }
- // reload the contentField
- contentField = ContentField.getField(theField.getID());
}
// Publisher Field
if ( "metaDataPublisher".equals(fieldDef.getName()) ){
JahiaField theField =
contentField.getJahiaField(jParams.getEntryLoadRequest());
- theField.setValue(jParams.getUser().getUsername());
- theField.save(jParams);
+ // the field could be null in case it was marked for deletion !
+ if (theField != null) {
+ theField.setValue(jParams.getUser().getUsername());
+ theField.save(jParams);
+ // reload the contentField
+ contentField = ContentField.getField(theField.getID());
+ }
- // reload the contentField
- contentField = ContentField.getField(theField.getID());
}
}%>
\ No newline at end of file