Uploaded image for project: 'Alfresco'
  1. Alfresco
  2. ALF-2705

ClassCastException in getProperties()

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 3.3 Community
    • Fix Version/s: 3.3 Enterprise, 4.0 Enterprise
    • Component/s: CMIS
    • Security Level: external (External user)
    • Labels:
      None
    • Environment:
      Alfresco 3.3 Community, Linux, MySQL, Java 1.6.
    • Resolution Time Custom Field:
      5 days, 22 hours, 6 minutes, 9 seconds

      Description

      CMIS getProperties() method fails when called for an object with aspects which add repeating attributes. It is easy to reproduce by attaching Category aspect with some values to an object and then by calling getProperties() on it.

      17:04:16,697 User:admin ERROR [repo.cmis.ws] java.lang.ClassCastException: org.alfresco.service.cmr.repository.NodeRef cannot be cast to java.lang.String
      java.lang.ClassCastException: org.alfresco.service.cmr.repository.NodeRef cannot be cast to java.lang.String
      at org.alfresco.repo.cmis.ws.utils.PropertyUtil.createProperty(PropertyUtil.java:615)
      at org.alfresco.repo.cmis.ws.utils.PropertyUtil.convertToCmisProperties(PropertyUtil.java:496)
      at org.alfresco.repo.cmis.ws.utils.PropertyUtil.getProperties(PropertyUtil.java:473)
      at org.alfresco.repo.cmis.ws.DMObjectServicePort.getProperties(DMObjectServicePort.java:703)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.alfresco.repo.transaction.RetryingTransactionInterceptor$1.execute(RetryingTransactionInterceptor.java:58)
      at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:321)
      at org.alfresco.repo.transaction.RetryingTransactionInterceptor.invoke(RetryingTransactionInterceptor.java:52)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      at org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invoke(ThrowsAdviceInterceptor.java:124)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
      at $Proxy173.getProperties(Unknown Source)

      Possible fix is to patch PropertyUtil.java with following diff:

      diff -uNr original/java/org/alfresco/repo/cmis/ws/utils/PropertyUtil.java patched/java/org/alfresco/repo/cmis/ws/utils/PropertyUtil.java
      — original/java/org/alfresco/repo/cmis/ws/utils/PropertyUtil.java 2010-03-25 15:06:26.000000000 +0100
      +++ patched/java/org/alfresco/repo/cmis/ws/utils/PropertyUtil.java 2010-05-04 18:02:59.000000000 +0200
      @@ -612,9 +612,9 @@

      if (value instanceof Collection)
      {

      • for (String propertyValue : (Collection<String>) value)
        + for (Serializable propertyValue : (Collection<Serializable>) value) { - property.getValue().add(propertyValue); + property.getValue().add(propertyValue.toString()); }

        }
        else

        Attachments

          Issue Links

            Structure

              Activity

                People

                • Assignee:
                  closedbugs Closed Bugs
                  Reporter:
                  karolbe Karol Bryd (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Date of First Response:

                    Structure Helper Panel