Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Duplicate
-
1.2.13-core
-
None
-
None
-
Linux 2.6 Java(TM) SE Runtime Environment (build 1.6.0_16-b01) tomcat 6.0.18 myfaces-api/impl-1.2.7 trinidad-api/impl 1.2.13-SNAPSHOT (trunk)
Description
when request with the header of Googlebots comes org/apache/myfaces/trinidadinternal/agent/AgentImpl.java gets initialized with String _agent = NULL; and String _agentVersion = NULL; and a NPE is thrown:
java.lang.NullPointerException: version must be non-null
at org.apache.myfaces.trinidad.context.Version._checkNonEmptyString(Version.java:197)
at org.apache.myfaces.trinidad.context.Version.<init>(Version.java:69)
at org.apache.myfaces.trinidad.context.Version.<init>(Version.java:54)
at org.apache.myfaces.trinidadinternal.style.util.NameUtils._isBrowserAndVersionMatch(NameUtils.java:640)
at org.apache.myfaces.trinidadinternal.style.util.NameUtils.getContextName(NameUtils.java:344)
at org.apache.myfaces.trinidadinternal.style.cache.FileSystemStyleCache.getTargetStyleSheetName(FileSystemStyleCache.java:325)
at org.apache.myfaces.trinidadinternal.skin.SkinStyleProvider.getTargetStyleSheetName(SkinStyleProvider.java:199)
at org.apache.myfaces.trinidadinternal.style.cache.FileSystemStyleCache._getOutputFiles(FileSystemStyleCache.java:879)
at org.apache.myfaces.trinidadinternal.style.cache.FileSystemStyleCache._createStyleSheetFiles(FileSystemStyleCache.java:757)
at org.apache.myfaces.trinidadinternal.style.cache.FileSystemStyleCache._createEntry(FileSystemStyleCache.java:542)
at org.apache.myfaces.trinidadinternal.style.cache.FileSystemStyleCache._getEntry(FileSystemStyleCache.java:445)
at org.apache.myfaces.trinidadinternal.style.cache.FileSystemStyleCache.getStyleSheetURIs(FileSystemStyleCache.java:165)
at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.StyleSheetRenderer.encodeAll(StyleSheetRenderer.java:97)
at org.apache.myfaces.trinidad.render.CoreRenderer.delegateRenderer(CoreRenderer.java:446)
at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.HeadRenderer.encodeBegin(HeadRenderer.java:80)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeBegin(CoreRenderer.java:311)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeBegin(UIXComponentBase.java:718)
at org.apache.myfaces.trinidad.component.UIXComponentBase.__encodeRecursive(UIXComponentBase.java:1478)
at org.apache.myfaces.trinidad.component.UIXComponentBase.__encodeRecursive(UIXComponentBase.java:1489)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeAll(UIXComponentBase.java:771)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:257)
at org.apache.myfaces.application.jsp.JspViewHandlerImpl.actuallyRenderView(JspViewHandlerImpl.java:427)
at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:383)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:48)
at org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:193)
at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:140)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:155)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Unknown Source)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(Unknown Source)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:247)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:157)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Unknown Source)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(Unknown Source)
at org.piranko.filters.LocaleFilter.doFilter(LocaleFilter.java:82)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Unknown Source)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(Unknown Source)
at org.piranko.filters.ExceptionsFilter.doFilter(ExceptionsFilter.java:61)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Unknown Source)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(Unknown Source)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:247)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:157)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Unknown Source)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(Unknown Source)
at org.apache.catalina.core.StandardWrapperValve.invoke(Unknown Source)
at org.apache.catalina.core.StandardContextValve.invoke(Unknown Source)
at org.apache.catalina.core.StandardHostValve.invoke(Unknown Source)
at org.apache.catalina.valves.ErrorReportValve.invoke(Unknown Source)
at org.apache.catalina.core.StandardEngineValve.invoke(Unknown Source)
at org.apache.catalina.connector.CoyoteAdapter.service(Unknown Source)
at org.apache.jk.server.JkCoyoteHandler.invoke(Unknown Source)
at org.apache.jk.common.HandlerRequest.invoke(Unknown Source)
at org.apache.jk.common.ChannelSocket.invoke(Unknown Source)
at org.apache.jk.common.ChannelSocket.processConnection(Unknown Source)
at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(Unknown Source)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown Source)
at java.lang.Thread.run(Thread.java:619)
We have patched the code temporary with:
Index: trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/Agent.java
===================================================================
— trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/Agent.java (revision 807570)
+++ trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/Agent.java (working copy)
@@ -124,7 +124,12 @@
*/
public static final String AGENT_UNKNOWN = "unknown";
+
/**
+ * Constant used for unknown versions of agents
+ */
+ public static final String VERSION_UNKNOWN = "unknown";
+ /**
- Constant for Konqueror agent
*/
public static final String AGENT_KONQUEROR = "konqueror";
and
Index: trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/AgentImpl.java
===================================================================
— trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/AgentImpl.java (revision 807570)
+++ trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/agent/AgentImpl.java (working copy)
@@ -146,8 +146,8 @@
private static class AgentEntry
{
Object _type = TYPE_UNKNOWN;
- String _agent;
- String _agentVersion;
+ String _agent = AGENT_UNKNOWN;
+ String _agentVersion = VERSION_UNKNOWN;
String _platform;
String _platformVersion;
String _makeModel;
so that the AgentEntry class _agent and _agentVersion will always be initialized. Is that acceptable solution or another brake might be expected.
We have also observed that to reproduce the error one must not call the local server with "http://localhost:8080/" but with "http://10.1.1.208:8080/" otherwise the problem does not apear. This is probably because the styles are pulled out of cache of some sort and not freshly created when the problem appears when creating new stylesheet.
Attachments
Issue Links
- is duplicated by
-
TRINIDAD-1520 NPE from Google Bot (unknown agent)
- Closed