AnsweredAssumed Answered

problems with date atributte

Question asked by rcortesr on Jan 8, 2007
Latest reply on Nov 1, 2010 by prateekgoyal
Hi,

I add documents to the repository with a program, this program use JSR 170 interface.

When I set the date atributte appears to me the following ERROR:
Exception in thread "main" javax.jcr.ValueFormatException: The property value is not compatible with the type defined for the property: 
   property: {factura.model}Fecha_Factura
   property value: PropertyValue[actual-type=STRING, multi-valued=false, value-type=STRING, value=5-12-2007]: The property value is not compatible with the type defined for the property:
   property: {factura.model}Fecha_Factura
   property value: PropertyValue[actual-type=STRING, multi-valued=false, value-type=STRING, value=5-12-2007]
   at org.alfresco.jcr.item.PropertyImpl.writeValue(PropertyImpl.java:617)
   at org.alfresco.jcr.item.PropertyImpl.setPropertyValue(PropertyImpl.java:511)
   at org.alfresco.jcr.item.NodeImpl.setProperty(NodeImpl.java:354)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.alfresco.jcr.util.JCRProxyFactory$SessionContextInvocationHandler.invoke(JCRProxyFactory.java:130)
   at $Proxy68.setProperty(Unknown Source)
   at org.alfresco.sample.jcr.Main.main(Main.java:113)
Caused by: org.alfresco.service.cmr.repository.datatype.TypeConversionException: The property value is not compatible with the type defined for the property:
   property: {factura.model}Fecha_Factura
   property value: PropertyValue[actual-type=STRING, multi-valued=false, value-type=STRING, value=5-12-2007]
   at org.alfresco.repo.node.AbstractNodeServiceImpl.makeSerializableValue(AbstractNodeServiceImpl.java:673)
   at org.alfresco.repo.node.db.DbNodeServiceImpl.getProperties(DbNodeServiceImpl.java:768)
   at org.alfresco.repo.node.db.DbNodeServiceImpl.setPropertyImpl(DbNodeServiceImpl.java:928)
   at org.alfresco.repo.node.db.DbNodeServiceImpl.setProperty(DbNodeServiceImpl.java:897)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.alfresco.repo.service.StoreRedirectorProxyFactory$RedirectorInvocationHandler.invoke(StoreRedirectorProxyFactory.java:213)
   at $Proxy2.setProperty(Unknown Source)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:335)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
   at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:116)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:80)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:40)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
   at $Proxy15.setProperty(Unknown Source)
   at org.alfresco.jcr.item.PropertyImpl.writeValue(PropertyImpl.java:613)
   … 9 more
Caused by: org.alfresco.service.cmr.repository.datatype.TypeConversionException: Failed to convert date 5-12-2007 to string
   at org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter$12.convert(DefaultTypeConverter.java:190)
   at org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter$12.convert(DefaultTypeConverter.java:181)
   at org.alfresco.service.cmr.repository.datatype.TypeConverter.convert(TypeConverter.java:112)
   at org.alfresco.repo.domain.PropertyValue$ValueType$8.convert(PropertyValue.java:149)
   at org.alfresco.repo.domain.PropertyValue.getValue(PropertyValue.java:670)
   at org.alfresco.repo.node.AbstractNodeServiceImpl.makeSerializableValue(AbstractNodeServiceImpl.java:667)
   … 36 more
Caused by: org.alfresco.error.AlfrescoRuntimeException: Failed to parse date 5-12-2007
   at org.alfresco.util.ISO8601DateFormat.parse(ISO8601DateFormat.java:191)
   at org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter$12.convert(DefaultTypeConverter.java:185)
   … 41 more
Caused by: java.lang.NumberFormatException: For input string: "5-12"
   at java.lang.NumberFormatException.forInputString(Unknown Source)
   at java.lang.Integer.parseInt(Unknown Source)
   at java.lang.Integer.parseInt(Unknown Source)
   at org.alfresco.util.ISO8601DateFormat.parse(ISO8601DateFormat.java:111)
   … 42 more
org.alfresco.service.cmr.repository.datatype.TypeConversionException: The property value is not compatible with the type defined for the property:
   property: {factura.model}Fecha_Factura
   property value: PropertyValue[actual-type=STRING, multi-valued=false, value-type=STRING, value=5-12-2007]
   at org.alfresco.repo.node.AbstractNodeServiceImpl.makeSerializableValue(AbstractNodeServiceImpl.java:673)
   at org.alfresco.repo.node.db.DbNodeServiceImpl.getProperties(DbNodeServiceImpl.java:768)
   at org.alfresco.repo.node.db.DbNodeServiceImpl.setPropertyImpl(DbNodeServiceImpl.java:928)
   at org.alfresco.repo.node.db.DbNodeServiceImpl.setProperty(DbNodeServiceImpl.java:897)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.alfresco.repo.service.StoreRedirectorProxyFactory$RedirectorInvocationHandler.invoke(StoreRedirectorProxyFactory.java:213)
   at $Proxy2.setProperty(Unknown Source)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:335)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
   at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:116)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:80)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:40)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
   at $Proxy15.setProperty(Unknown Source)
   at org.alfresco.jcr.item.Propert

Outcomes