shuber      2005/06/09 16:09:20 CEST

  Modified files:        (Branch: JAHIA-4-1-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.4.12  +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.4.11&r2=1.1.4.12&f=h
  
  
  
  Index: eventlistener.jsp
  ===================================================================
  RCS file: 
/home/cvs/repository/corporate_portal_templates/src/view/jsp/eventlistener.jsp,v
  retrieving revision 1.1.4.11
  retrieving revision 1.1.4.12
  diff -u -r1.1.4.11 -r1.1.4.12
  --- eventlistener.jsp 31 May 2005 09:53:16 -0000      1.1.4.11
  +++ eventlistener.jsp 9 Jun 2005 14:09:20 -0000       1.1.4.12
  @@ -509,20 +509,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
  

Reply via email to