Maven Petals Plugin

Encoding error into generated JBI descriptor if POM contains characters with accent

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 2.1.4
  • Fix Version/s: 2.2.0
  • Component/s: jbi-package
  • Security Level: Public
  • Description:
    Hide
    1. Create a SA project with Petals Studio. The SA embeds any SU.
    2. Update the description of the artifact into the POM file, with a text containing following characters: 'é', 'è', 'à', 'ç', 'ù', or '€',
    3. Package the SA using the maven-petals-plugin (the parameter 'updateJBIXml' is to 'true')
    4. Install the SA into Petals ESB
      ---> We get an error similar to:
      [Petals.AutoLoaderServiceImpl]-WARNING 2011-09-15 09:42:12,091 Unable to read a JBI descriptor
      org.ow2.petals.jbi.descriptor.JBIDescriptorException: Failed to build Java bindings from JBI descriptor XML document
              at org.ow2.petals.jbi.descriptor.original.JBIDescriptorBuilder.buildJavaJBIDescriptor(JBIDescriptorBuilder.java:217)
              at org.ow2.petals.jbi.management.util.PackageHelper.loadDescriptor(PackageHelper.java:130)
              at org.ow2.petals.jbi.management.autoload.AutoLoaderServiceImpl.getJBIArchives(AutoLoaderServiceImpl.java:362)
              at org.ow2.petals.jbi.management.autoload.AutoLoaderServiceImpl.install(AutoLoaderServiceImpl.java:134)
              at org.ow2.petals.jbi.management.autoload.InstallDirectoryScanner.run(InstallDirectoryScanner.java:81)
              at java.util.TimerThread.mainLoop(Timer.java:512)
              at java.util.TimerThread.run(Timer.java:462)
      Caused by: javax.xml.bind.UnmarshalException
       - with linked exception:
      [com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 2 of 3-byte UTF-8 sequence.]
              at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:213)
              at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:190)
              at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:241)
              at org.ow2.petals.jbi.descriptor.original.JBIDescriptorBuilder.buildJavaJBIDescriptor(JBIDescriptorBuilder.java:210)
              ... 6 more
      Caused by: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 2 of 3-byte UTF-8 sequence.
              at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.invalidByte(UTF8Reader.java:684)
              at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read(UTF8Reader.java:405)
              at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(XMLEntityScanner.java:1742)
              at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.skipChar(XMLEntityScanner.java:1416)
              at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2792)
              at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
              at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
              at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
              at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
              at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
              at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
              at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
              at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
              at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:211)
              ... 9 more

    The same problem occurs on the JBI descriptor of a component, service-unit or shared library

    Show
    1. Create a SA project with Petals Studio. The SA embeds any SU.
    2. Update the description of the artifact into the POM file, with a text containing following characters: 'é', 'è', 'à', 'ç', 'ù', or '€',
    3. Package the SA using the maven-petals-plugin (the parameter 'updateJBIXml' is to 'true')
    4. Install the SA into Petals ESB ---> We get an error similar to:
      [Petals.AutoLoaderServiceImpl]-WARNING 2011-09-15 09:42:12,091 Unable to read a JBI descriptor
      org.ow2.petals.jbi.descriptor.JBIDescriptorException: Failed to build Java bindings from JBI descriptor XML document
              at org.ow2.petals.jbi.descriptor.original.JBIDescriptorBuilder.buildJavaJBIDescriptor(JBIDescriptorBuilder.java:217)
              at org.ow2.petals.jbi.management.util.PackageHelper.loadDescriptor(PackageHelper.java:130)
              at org.ow2.petals.jbi.management.autoload.AutoLoaderServiceImpl.getJBIArchives(AutoLoaderServiceImpl.java:362)
              at org.ow2.petals.jbi.management.autoload.AutoLoaderServiceImpl.install(AutoLoaderServiceImpl.java:134)
              at org.ow2.petals.jbi.management.autoload.InstallDirectoryScanner.run(InstallDirectoryScanner.java:81)
              at java.util.TimerThread.mainLoop(Timer.java:512)
              at java.util.TimerThread.run(Timer.java:462)
      Caused by: javax.xml.bind.UnmarshalException
       - with linked exception:
      [com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 2 of 3-byte UTF-8 sequence.]
              at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:213)
              at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:190)
              at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:241)
              at org.ow2.petals.jbi.descriptor.original.JBIDescriptorBuilder.buildJavaJBIDescriptor(JBIDescriptorBuilder.java:210)
              ... 6 more
      Caused by: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 2 of 3-byte UTF-8 sequence.
              at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.invalidByte(UTF8Reader.java:684)
              at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read(UTF8Reader.java:405)
              at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(XMLEntityScanner.java:1742)
              at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.skipChar(XMLEntityScanner.java:1416)
              at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2792)
              at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
              at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
              at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
              at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
              at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
              at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
              at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
              at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
              at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:211)
              ... 9 more
    The same problem occurs on the JBI descriptor of a component, service-unit or shared library
  • Environment:
    Petals ESB 3.1.3, Windows XP (French edition)
  1. MAVPETALSPLUG-12.patch
    (9 kB)
    Christophe DENEUX
    Thu, 15 Sep 2011 - 11:54:01 +0200

Activity

Hide
Christophe DENEUX added a comment - Thu, 15 Sep 2011 - 11:50:54 +0200

The problem is due to the artefact petals-jbi-descriptor that does not encode correctly french accents when marshalling (writing) the JBI descriptor.
The method JBIDescriptorBuilder.buildXmlStringJBIdescriptor will generate a String encoded with the default local (in this case: CP1252). Next, the string bytes are put into a stream but these bytes does not correspond to the encoding UTF-8 defined in the XML header.

This method MUST be deprecated and replaced by a marshalling using directly an output stream.

Show
Christophe DENEUX added a comment - Thu, 15 Sep 2011 - 11:50:54 +0200 The problem is due to the artefact petals-jbi-descriptor that does not encode correctly french accents when marshalling (writing) the JBI descriptor. The method JBIDescriptorBuilder.buildXmlStringJBIdescriptor will generate a String encoded with the default local (in this case: CP1252). Next, the string bytes are put into a stream but these bytes does not correspond to the encoding UTF-8 defined in the XML header. This method MUST be deprecated and replaced by a marshalling using directly an output stream.
Hide
Christophe DENEUX added a comment - Thu, 15 Sep 2011 - 11:54:01 +0200

A patch fixing the problem and including unit tests, to apply on petals-jbi-descriptor:2.0.4

Show
Christophe DENEUX added a comment - Thu, 15 Sep 2011 - 11:54:01 +0200 A patch fixing the problem and including unit tests, to apply on petals-jbi-descriptor:2.0.4
Hide
Christophe DENEUX added a comment - Thu, 15 Sep 2011 - 15:23:32 +0200

The problem has been fixed for a specific customer version of the maven-petals-plugin.

The fix is located into the branch petals-enterprise-3.1.x/petals/tools-common/petals-jbi-descriptor. And the maven-petals-plugin must be updated to use the new method JBIDescriptorBuilder.writeJBIdescriptor(...) instead of JBIDescriptorBuilder.buildXmlStringJBIdescriptor(...)

Show
Christophe DENEUX added a comment - Thu, 15 Sep 2011 - 15:23:32 +0200 The problem has been fixed for a specific customer version of the maven-petals-plugin. The fix is located into the branch petals-enterprise-3.1.x/petals/tools-common/petals-jbi-descriptor. And the maven-petals-plugin must be updated to use the new method JBIDescriptorBuilder.writeJBIdescriptor(...) instead of JBIDescriptorBuilder.buildXmlStringJBIdescriptor(...)
Hide
Christophe DENEUX added a comment - Thu, 15 Sep 2011 - 15:23:50 +0200

To merge in trunk

Show
Christophe DENEUX added a comment - Thu, 15 Sep 2011 - 15:23:50 +0200 To merge in trunk
Hide
Christophe DENEUX added a comment - Tue, 25 Mar 2014 - 17:07:38 +0100

Merged in trunk by svn#29975.

Show
Christophe DENEUX added a comment - Tue, 25 Mar 2014 - 17:07:38 +0100 Merged in trunk by svn#29975.

People

Dates

  • Created:
    Thu, 15 Sep 2011 - 11:46:02 +0200
    Updated:
    Tue, 25 Mar 2014 - 17:07:38 +0100
    Resolved:
    Thu, 15 Dec 2011 - 11:00:46 +0100