MyFaces Trinidad
  1. MyFaces Trinidad
  2. TRINIDAD-91

UIOutput puts Converter as element of object arrays (holding component state), w/o calling to its saveState() method. It causes NotSerializableException

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.1-plugins, 1.2.2-plugins
    • Component/s: Plugins
    • Labels:
      None
    • Environment:
      Geronimo-2.0-tomcat6-jee5-m6-rc1

      Description

      The following snipet:
      <h:outputText id="cellStrtDate" styleClass="table-text-norm" value="#

      {obj.srvDate}

      " >
      <f:convertDateTime pattern="yyyy-MM-dd" timeZone="#

      {commonInfo.timeZone}

      " />
      </h:outputText>

      causes:
      java.io.NotSerializableException: javax.faces.convert.DateTimeConverter
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
      at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)
      at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)
      at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
      at java.util.ArrayList.writeObject(ArrayList.java:570)
      at sun.reflect.GeneratedMethodAccessor311.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
      at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
      at java.util.ArrayList.writeObject(ArrayList.java:570)
      at sun.reflect.GeneratedMethodAccessor311.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
      at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
      at java.util.ArrayList.writeObject(ArrayList.java:570)
      at sun.reflect.GeneratedMethodAccessor311.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
      at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
      at java.util.ArrayList.writeObject(ArrayList.java:570)
      at sun.reflect.GeneratedMethodAccessor311.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
      at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
      at java.util.ArrayList.writeObject(ArrayList.java:570)
      at sun.reflect.GeneratedMethodAccessor311.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
      at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
      at java.util.ArrayList.writeObject(ArrayList.java:570)
      at sun.reflect.GeneratedMethodAccessor311.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
      at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
      at org.apache.myfaces.application.jsp.JspStateManagerImpl.serializeView(JspStateManagerImpl.java:638)
      at org.apache.myfaces.application.jsp.JspStateManagerImpl.saveSerializedViewInServletSession(JspStateManagerImpl.java:538)
      at org.apache.myfaces.application.jsp.JspStateManagerImpl.saveSerializedView(JspStateManagerImpl.java:371)
      at javax.faces.application.StateManager.saveView(StateManager.java:47)
      at org.apache.myfaces.application.jsp.JspViewHandlerImpl$StateMarkerAwareWriter.flushToWriter(JspViewHandlerImpl.java:387)
      at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:322)
      at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
      at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:132)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)

      of course Converter and DateTimeConverter are not serializable....

      The problem is that in 1.2 branch of JSF in UIOutput converter is put to Object[] array for serialization w/o delegating to StateHolder interface of Converter (from decompiled code):
      public Object saveState(FacesContext facesContext)

      { Object values[] = new Object[3]; values[0] = super.saveState(facesContext); values[1] = _value; values[2] = _converter; return ((Object) (values)); }

      however it should be like in trunk http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/component/UIOutput.java?revision=482726&view=markup:
      public Object saveState(FacesContext context)

      { Object values[] = new Object[3]; values[0] = super.saveState(context); values[1] = saveAttachedState(context, _converter); values[2] = _value; return values; }

      by the way, I failed to find UIOutput at http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/api/src/main/java/javax/faces/component/
      does it mean that UIOutput is somehow generated in "jsf12" branch or comes from https://javaserverfaces.dev.java.net/?
      But on https://javaserverfaces.dev.java.net/ the latest sources has correct variant.

        Activity

        Hide
        Alexander Zynevich added a comment -

        just checked 1.2.0-SNAPSHOT on http://people.apache.org/repo/m2-snapshot-repository/org/apache/myfaces/core/myfaces-api/1.2.0-SNAPSHOT/
        from 5 july, it has the same WRONG code.

        Show
        Alexander Zynevich added a comment - just checked 1.2.0-SNAPSHOT on http://people.apache.org/repo/m2-snapshot-repository/org/apache/myfaces/core/myfaces-api/1.2.0-SNAPSHOT/ from 5 july, it has the same WRONG code.
        Hide
        Matthias Weßendorf added a comment -

        good catch.

        It's in the plugins of Trinidad, I'll fix it !

        Show
        Matthias Weßendorf added a comment - good catch. It's in the plugins of Trinidad, I'll fix it !
        Hide
        Matthias Weßendorf added a comment -

        a new nbuild of myfaces is now available

        Show
        Matthias Weßendorf added a comment - a new nbuild of myfaces is now available
        Hide
        Alexander Zynevich added a comment -

        Thanks, that helped!

        Show
        Alexander Zynevich added a comment - Thanks, that helped!

          People

          • Assignee:
            Matthias Weßendorf
            Reporter:
            Alexander Zynevich
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development