[jboss-user] [JBoss Portal] - CMS repository Export folder : little bug

Antoine_h do-not-reply at jboss.com
Tue Oct 17 07:31:21 EDT 2006

when trying to export folder or files, there is sometimes this error : 

14:03:38,140 ERROR [STDERR] java.lang.NullPointerException 
  | 14:03:38,140 ERROR [STDERR] at org.jboss.portal.cms.impl.jcr.command.GetArchiveCommand.zipFiles(GetArchiveCommand.java:112) 
  | 14:03:38,140 ERROR [STDERR] at org.jboss.portal.cms.impl.jcr.command.GetArchiveCommand.execute(GetArchiveCommand.java:72) 
  | 14:03:38,140 ERROR [STDERR] at org.jboss.portal.cms.impl.jcr.JCRCommand.dispatch(JCRCommand.java:61) 
  | 14:03:38,140 ERROR [STDERR] at org.jboss.portal.cms.impl.jcr.JCRCMS.execute(JCRCMS.java:436) 
sometimes is : 
  - when asking to export a folder and there is some sub folders with no files in it (no file for the asked language) 
  - when asking to export a file that exist in language A but you ask export for language B 

in the code of GetArchiveCommand.java : 
private ZipOutputStream zipFiles(String sPath, ZipOutputStream zos) 
  |    { 
  | .... 
  |                JCRCommand fileList = (JCRCommand) this.mContext.getCommandFactory().createFileGetCommand(node.getPath(), new Locale(this.msLanguage)); 
  |                File childFile = (File) this.mContext.execute(fileList); 
  |                ZipEntry entry = new ZipEntry(this.rootFolderName + node.getPath()); 
  |                zos.putNextEntry(entry); 
  |                Content content = childFile.getContent(); 
  | ... 
line "112" is : Content content = childFile.getContent(); 

childFile is null when the file was not found for the language that is asked (but may exist for another language). 
It should be checked before use and do nothing if the file is not found. 
(optional log ?) 

As a workaround (what I did, may be not the best way) : I put a big "if not null" in the source code, recompiled all without deploying the new version ("build main"), and then just replaced the 
GetArchiveCommand.class in the corresponding archive file of portal.
It works, and avoid to reinstall the whole portal, with changes in the xml descriptor files etc...

I have open a Jira issue for that bug.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3978759#3978759

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3978759

More information about the jboss-user mailing list