Hi !
Anybody have a clue ?

Regards.

Daniel

On 2021/08/17 19:31:33, Daniel Langevin <daniel.lange...@shq.gouv.qc.ca> wrote: 
> Hi,
> 
> I try to modify an application who retrieve LDAP search,
> Convert result in XML and generate HTML with camel-saxon.
> 
> CAMEL 3.11.1 Karaf 4.2.10
> 
> 
> But facing a problem.
> 
> I Add a variable in my Search, (networkAddress) this new variable contains 
> String encoded in a special format and also contains null value 
> 
> When I use xsteam to format the body who contains 
> ArrayList<javax.naming.directory.SearchResult> 
> I received an error.
> 
> ...
> <to 
> uri="ldap:ldapSHQinterne?base=ou=xxxxxxxxxx,o=yyyyyyyyyy&returnedAttributes=ou,sn,givenName,fullName,telephoneNumber,physicalDeliveryOfficeName,mail,pwmLastPwdUpdate,pwmResponseSet,Photo,passwordExpirationTime,loginGraceRemaining,loginDisabled,loginTime,lockedByIntruder,networkAddress"
>  />
> <marshal><xstream/></marshal>  .... ERROR RECEIVE HERE
> <to uri="xslt-saxon:file:/opt/repo-XXX/SIN/eDirSecretStore.xsl"/>
> ...
> 
> ---- Debugging information ----
> message             : Failed calling method
> cause-exception     : com.thoughtworks.xstream.io.StreamException
> cause-message       :
> method              : com.sun.jndi.ldap.LdapAttribute.writeObject()
> -------------------------------
>         at 
> com.thoughtworks.xstream.core.util.SerializationMembers.callWriteObject(SerializationMembers.java:158)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.converters.reflection.SerializableConverter.doMarshal(SerializableConverter.java:257)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:90)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:87)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.converters.reflection.SerializableConverter$1.writeToStream(SerializableConverter.java:139)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.core.util.CustomObjectOutputStream.writeObjectOverride(CustomObjectOutputStream.java:87)
>  ~[!/:?]
>         at 
> java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344) 
> ~[?:1.8.0_121]
>         at 
> javax.naming.directory.BasicAttributes.writeObject(BasicAttributes.java:293) 
> ~[?:1.8.0_121]
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
> ~[?:1.8.0_121]
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
> ~[?:1.8.0_121]
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  ~[?:1.8.0_121]
>         at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_121]
>         at 
> com.thoughtworks.xstream.core.util.SerializationMembers.callWriteObject(SerializationMembers.java:154)
>  ~[!/:?]
>         ... 73 more
> Caused by: com.thoughtworks.xstream.io.StreamException:
>         at 
> com.thoughtworks.xstream.io.xml.StaxWriter.setValue(StaxWriter.java:160) 
> ~[!/:?]
>         at 
> com.thoughtworks.xstream.io.WriterWrapper.setValue(WriterWrapper.java:45) 
> ~[!/:?]
>         at 
> com.thoughtworks.xstream.converters.SingleValueConverterWrapper.marshal(SingleValueConverterWrapper.java:45)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:50)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:87)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.converters.reflection.SerializableConverter$1.writeToStream(SerializableConverter.java:139)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.core.util.CustomObjectOutputStream.writeObjectOverride(CustomObjectOutputStream.java:87)
>  ~[!/:?]
>         at 
> java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344) 
> ~[?:1.8.0_121]
>         at 
> javax.naming.directory.BasicAttribute.writeObject(BasicAttribute.java:507) 
> ~[?:1.8.0_121]
>         at sun.reflect.GeneratedMethodAccessor124.invoke(Unknown Source) 
> ~[?:?]
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  ~[?:1.8.0_121]
>         at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_121]
>         at 
> com.thoughtworks.xstream.core.util.SerializationMembers.callWriteObject(SerializationMembers.java:154)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.converters.reflection.SerializableConverter.doMarshal(SerializableConverter.java:257)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:90)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:87)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.converters.reflection.SerializableConverter$1.writeToStream(SerializableConverter.java:139)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.core.util.CustomObjectOutputStream.writeObjectOverride(CustomObjectOutputStream.java:87)
>  ~[!/:?]
>         at 
> java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344) 
> ~[?:1.8.0_121]
>         at 
> javax.naming.directory.BasicAttributes.writeObject(BasicAttributes.java:293) 
> ~[?:1.8.0_121]
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
> ~[?:1.8.0_121]
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
> ~[?:1.8.0_121]
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  ~[?:1.8.0_121]
>         at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_121]
>         at 
> com.thoughtworks.xstream.core.util.SerializationMembers.callWriteObject(SerializationMembers.java:154)
>  ~[!/:?]
>         ... 73 more
> Caused by: com.ctc.wstx.exc.WstxIOException: Invalid null character in text 
> to output
>         at 
> com.ctc.wstx.sw.BaseStreamWriter.writeCharacters(BaseStreamWriter.java:467) 
> ~[!/:6.2.6]
>         at 
> com.thoughtworks.xstream.io.xml.StaxWriter.setValue(StaxWriter.java:158) 
> ~[!/:?]
>         at 
> com.thoughtworks.xstream.io.WriterWrapper.setValue(WriterWrapper.java:45) 
> ~[!/:?]
>         at 
> com.thoughtworks.xstream.converters.SingleValueConverterWrapper.marshal(SingleValueConverterWrapper.java:45)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:50)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:87)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.converters.reflection.SerializableConverter$1.writeToStream(SerializableConverter.java:139)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.core.util.CustomObjectOutputStream.writeObjectOverride(CustomObjectOutputStream.java:87)
>  ~[!/:?]
>         at 
> java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344) 
> ~[?:1.8.0_121]
>         at 
> javax.naming.directory.BasicAttribute.writeObject(BasicAttribute.java:507) 
> ~[?:1.8.0_121]
>         at sun.reflect.GeneratedMethodAccessor124.invoke(Unknown Source) 
> ~[?:?]
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  ~[?:1.8.0_121]
>         at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_121]
>         at 
> com.thoughtworks.xstream.core.util.SerializationMembers.callWriteObject(SerializationMembers.java:154)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.converters.reflection.SerializableConverter.doMarshal(SerializableConverter.java:257)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:90)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:87)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.converters.reflection.SerializableConverter$1.writeToStream(SerializableConverter.java:139)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.core.util.CustomObjectOutputStream.writeObjectOverride(CustomObjectOutputStream.java:87)
>  ~[!/:?]
>         at 
> java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344) 
> ~[?:1.8.0_121]
>         at 
> javax.naming.directory.BasicAttributes.writeObject(BasicAttributes.java:293) 
> ~[?:1.8.0_121]
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
> ~[?:1.8.0_121]
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
> ~[?:1.8.0_121]
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  ~[?:1.8.0_121]
>         at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_121]
>         at 
> com.thoughtworks.xstream.core.util.SerializationMembers.callWriteObject(SerializationMembers.java:154)
>  ~[!/:?]
>         ... 73 more
> Caused by: java.io.IOException: Invalid null character in text to output
>         at 
> com.ctc.wstx.api.InvalidCharHandler$FailingHandler.convertInvalidChar(InvalidCharHandler.java:51)
>  ~[!/:6.2.6]
>         at com.ctc.wstx.sw.XmlWriter.handleInvalidChar(XmlWriter.java:629) 
> ~[!/:6.2.6]
>         at 
> com.ctc.wstx.sw.BufferingXmlWriter.writeCharacters(BufferingXmlWriter.java:497)
>  ~[!/:6.2.6]
>         at 
> com.ctc.wstx.sw.BaseStreamWriter.writeCharacters(BaseStreamWriter.java:465) 
> ~[!/:6.2.6]
>         at 
> com.thoughtworks.xstream.io.xml.StaxWriter.setValue(StaxWriter.java:158) 
> ~[!/:?]
>         at 
> com.thoughtworks.xstream.io.WriterWrapper.setValue(WriterWrapper.java:45) 
> ~[!/:?]
>         at 
> com.thoughtworks.xstream.converters.SingleValueConverterWrapper.marshal(SingleValueConverterWrapper.java:45)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:50)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:87)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.converters.reflection.SerializableConverter$1.writeToStream(SerializableConverter.java:139)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.core.util.CustomObjectOutputStream.writeObjectOverride(CustomObjectOutputStream.java:87)
>  ~[!/:?]
>         at 
> java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344) 
> ~[?:1.8.0_121]
>         at 
> javax.naming.directory.BasicAttribute.writeObject(BasicAttribute.java:507) 
> ~[?:1.8.0_121]
>         at sun.reflect.GeneratedMethodAccessor124.invoke(Unknown Source) 
> ~[?:?]
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  ~[?:1.8.0_121]
>         at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_121]
>         at 
> com.thoughtworks.xstream.core.util.SerializationMembers.callWriteObject(SerializationMembers.java:154)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.converters.reflection.SerializableConverter.doMarshal(SerializableConverter.java:257)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:90)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:87)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.converters.reflection.SerializableConverter$1.writeToStream(SerializableConverter.java:139)
>  ~[!/:?]
>         at 
> com.thoughtworks.xstream.core.util.CustomObjectOutputStream.writeObjectOverride(CustomObjectOutputStream.java:87)
>  ~[!/:?]
>         at 
> java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344) 
> ~[?:1.8.0_121]
>         at 
> javax.naming.directory.BasicAttributes.writeObject(BasicAttributes.java:293) 
> ~[?:1.8.0_121]
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
> ~[?:1.8.0_121]
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
> ~[?:1.8.0_121]
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  ~[?:1.8.0_121]
>         at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_121]
>         at 
> com.thoughtworks.xstream.core.util.SerializationMembers.callWriteObject(SerializationMembers.java:154)
>  ~[!/:?]
>         ... 73 more
> 
> 
> And If I convert it to  JSON with xstream it Works !!!!!!!!!
> 
> Like this
> 
> <dataFormats>
>     <json id="XstreamJson" library="XStream" prettyPrint="true"/>
> </dataFormats>
> ...
> <to 
> uri="ldap:ldapSHQinterne?base=ou=xxxxxxxxxx,o=yyyyyyyyyy&returnedAttributes=ou,sn,givenName,fullName,telephoneNumber,physicalDeliveryOfficeName,mail,pwmLastPwdUpdate,pwmResponseSet,Photo,passwordExpirationTime,loginGraceRemaining,loginDisabled,loginTime,lockedByIntruder,networkAddress"
>  />
> <marshal><custom ref="XstreamJson" /></marshal>  
> Result for the networkAdress
> ...
> },
>         "com.sun.jndi.ldap.LdapAttribute": {
>           "@serialization": "custom",
>           "javax.naming.directory.BasicAttribute": {
>             "default": {
>               "ordered": false,
>               "attrID": "networkAddress"
>             },
>             "int": 1,
>             "string": "9#\u0000\u0000����"
>           },
> ...
> 
> Why it's work in JSON using xstream and not for XML ?????
> 
> Someone did it before with XML ?????
> 
> Regards
> 
> 
> Daniel Langevin
> Direction de l’assistance et des technologie
> Direction des ressources informationnelles et matérielles
> 
> 

Reply via email to