Richfaces fileuploader nullpointer Firefox [英] Richfaces fileuploader nullpointer firefox

查看:73
本文介绍了Richfaces fileuploader nullpointer Firefox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

随着Firefox 62的引入,我现有的RichFaces fileuploader在尝试对上传的文件进行解码时突然抛出空指针.这是在JBoss 5.1环境中使用Richfaces 3.3.3.我尝试上传不同的图像类型均无济于事.还需要注意的是,此问题仅在Firefox 62上出现,以后所有其他浏览器都可以正常工作.

With the introduction of Firefox 62 my existing RichFaces fileuploader is suddenly throwing null pointers upon trying to decode the uploaded file. This is using Richfaces 3.3.3 on a JBoss 5.1 environment. I've tried uploading different image types to no avail. It's also to be noted that this issue only occurs on Firefox 62 and later all other browsers are working fine.

Stacktrace:

Stacktrace:

Caused by: java.lang.NullPointerException
at org.richfaces.renderkit.FileUploadRendererBase.doDecode(FileUploadRendererBase.java:139)
at org.ajax4jsf.renderkit.RendererBase.decode(RendererBase.java:75)
at javax.faces.component.UIComponentBase.decode(UIComponentBase.java:789)
at javax.faces.component.UIInput.decode(UIInput.java:725)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1031)
at javax.faces.component.UIInput.processDecodes(UIInput.java:639)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1026)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1026)
at javax.faces.component.UIForm.processDecodes(UIForm.java:209)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1026)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1026)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1026)
at javax.faces.component.UIInput.processDecodes(UIInput.java:639)
at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1026)
at org.ajax4jsf.component.AjaxViewRoot$1.invokeContextCallback(AjaxViewRoot.java:400)
at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:240)
at org.ajax4jsf.component.AjaxViewRoot.processDecodes(AjaxViewRoot.java:417)
at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)

Fileuploader xhtml:

Fileuploader xhtml:

<rich:fileUpload fileUploadListener="#{manageAttachmentContentItemAction.listener}"
maxFilesQuantity="1" 
id="upload" immediateUpload="true"
uploadControlLabel="#{messagesAction.getMessage('manage.content.item.action.upload.add_label')}" addControlLabel="#{messagesAction.getMessage('manage.content.item.action.upload.add_label')}"
progressLabel="#{messagesAction.getMessage('manage.content.item.action.upload.progress_label')}" 
disabled="#{manageAttachmentContentItemAction.previewItem != null}" 
listHeight="60px" listWidth="350px"
allowFlash="false" required="true" noDuplicate="true">
<a4j:support  event="onuploadcomplete" reRender="image_preview,uploadFunction" />
<a4j:support  event="onerror" action="#{manageAttachmentContentItemAction.onErrorOccurred}" reRender="uploadFunction" />
<a4j:support  event="ontyperejected" action="#{manageAttachmentContentItemAction.onTypeRejected}" reRender="uploadFunction" />
<a4j:support  event="onsizerejected" action="#{manageAttachmentContentItemAction.onFileSizeRejected}" reRender="uploadFunction"  />

任何提示将不胜感激

推荐答案

您可以使用NPE这样的东西.

You can works with NPE something like this.

1)覆盖FileUploadRenderer

1) Override the FileUploadRenderer

public class CustomFileUploadRenderer extends FileUploadRenderer {

@Override
protected void doDecode(FacesContext context, UIComponent component) {
    try {
        super.doDecode(context, component);
    } catch (NullPointerException e) {
        LOGGER.info("double decode error ignored", e);
    }
}

2)将自定义类添加到faces-config.xml

2) add custom class to the faces-config.xml

    <render-kit>
     <renderer>
          <component-family>org.richfaces.component.FileUpload</component-family>
          <renderer-type>org.richfaces.renderkit.html.FileUploadRenderer</renderer-type>
          <renderer-class>com.nnn.web.jsf.component.CustomFileUploadRenderer</renderer-class>
     </renderer>
</render-kit>

对我有用.

P/秒 我不确定,但是此问题来自问题 https://bugzilla.mozilla .org/show_bug.cgi?id = 583351

P/s I`m not sure, but this problem going from the issue https://bugzilla.mozilla.org/show_bug.cgi?id=583351

这篇关于Richfaces fileuploader nullpointer Firefox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆