Uploaded image for project: 'Bamboo Data Center'
  1. Bamboo Data Center
  2. BAM-11527

Export can write bad XML that Import chokes on

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Medium
    • None
    • 4.0.1
    • Import / Export
    • Bamboo 4.0.1; Original data from Bamboo 1.x, upgraded through 1.2.4, 2.0.6, 2.6.3, 2.7.4, 4.0.1

    Description

      I attempted export / re-import to switch DB type from HSQL to MySQL. Import failed. Logs reveal the cause is invalid characters improperly escaped in the export XML:

      2012-05-10 15:31:57,613 WARN [qtp582642819-12] [BambooStAXMappingHelperAbstractImpl] Exception during processing testCaseResultErrors.error #1069
      com.ctc.wstx.exc.WstxIOException: Invalid character 0x7f, can only be included in xml 1.1 using character entities (at char #3078549, byte #3078764)
              at com.ctc.wstx.sr.StreamScanner.constructFromIOE(StreamScanner.java:625)
              at com.ctc.wstx.sr.StreamScanner.loadMore(StreamScanner.java:994)
              at com.ctc.wstx.sr.StreamScanner.loadMore(StreamScanner.java:1033)
              at com.ctc.wstx.sr.BasicStreamReader.readCDataSecondary(BasicStreamReader.java:4310)
              at com.ctc.wstx.sr.BasicStreamReader.readCoalescedText(BasicStreamReader.java:4120)
              at com.ctc.wstx.sr.BasicStreamReader.getElementText(BasicStreamReader.java:675)
              at org.codehaus.staxmate.in.SMInputCursor.getElemStringValue(SMInputCursor.java:1331)
              at com.atlassian.bamboo.resultsummary.tests.TestCaseResultErrorMapper.importProperties(TestCaseResultErrorMapper.java:86)
              at com.atlassian.bamboo.resultsummary.tests.TestCaseResultErrorMapper.importProperties(TestCaseResultErrorMapper.java:21)
              at com.atlassian.bamboo.migration.BambooStAXMappingHelperAbstractImpl.importXml(BambooStAXMappingHelperAbstractImpl.java:167)
              at com.atlassian.bamboo.migration.BambooStAXListImportStrategy.importListItemXml(BambooStAXListImportStrategy.java:268)
              at com.atlassian.bamboo.migration.BambooStAXListImportStrategy.access$100(BambooStAXListImportStrategy.java:17)
              at com.atlassian.bamboo.migration.BambooStAXListImportStrategy$3.importListItems(BambooStAXListImportStrategy.java:103)
              at com.atlassian.bamboo.migration.BambooStAXListImportStrategy.importListXml(BambooStAXListImportStrategy.java:235)
              at com.atlassian.bamboo.migration.BambooStAXMappingListHelperAbstractImpl.importListXml(BambooStAXMappingListHelperAbstractImpl.java:179)
              at com.atlassian.bamboo.resultsummary.tests.TestCaseResultErrorMapper.importData(TestCaseResultErrorMapper.java:143)
              at com.atlassian.bamboo.migration.XmlMigrator.importData(XmlMigrator.java:360)
              at com.atlassian.bamboo.migration.XmlMigrator.importFile(XmlMigrator.java:329)
              at com.atlassian.bamboo.migration.XmlMigrator.loadXmlData(XmlMigrator.java:285)
              at com.atlassian.bamboo.migration.XmlMigrator.importXml(XmlMigrator.java:180)
              at com.atlassian.bamboo.migration.XmlMigrator$$FastClassByCGLIB$$b6578fc7.invoke(<generated>)
              at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
              at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:694)
              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
              at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
              at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:629)
              at com.atlassian.bamboo.migration.XmlMigrator$$EnhancerByCGLIB$$204e6f8b.importXml(<generated>)
              at com.atlassian.bamboo.migration.ImportExportManagerImpl.bambooImport(ImportExportManagerImpl.java:113)
              at com.atlassian.bamboo.migration.ImportExportManagerImpl.bambooImport(ImportExportManagerImpl.java:91)
              at com.atlassian.bamboo.ww2.actions.setup.SetupImportDataAction.execute(SetupImportDataAction.java:53)
      ........
      Caused by: java.io.CharConversionException: Invalid character 0x7f, can only be included in xml 1.1 using character entities (at char #3078549, byte #3078764)
              at com.ctc.wstx.io.BaseReader.reportInvalidXml11(BaseReader.java:222)
              at com.ctc.wstx.io.BambooUTF8Reader.read(BambooUTF8Reader.java:140)
              at com.ctc.wstx.io.ReaderSource.readInto(ReaderSource.java:87)
              at com.ctc.wstx.io.BranchingReaderSource.readInto(BranchingReaderSource.java:57)
              at com.ctc.wstx.sr.StreamScanner.loadMore(StreamScanner.java:988)
      

      The problem XML in question is where binary data was printed in JUnit test output, and that's in a /bamboo/testCaseResultErrors/error/content XML element.

      Workaround
      1. Use tail -c +#### fileName|head -c 1024 to get the section of the file where the offending character is located at. ### being the byte number as reported in the error. Experiment with reducing a few bytes before the offending character to get the ID of the error.
      2. After getting the ID, manually edit the contents of the error through the database to remove the offending characters:
        UPDATE test_error SET error_content='Removed' WHERE error_id=<ID>; 

        Replace <ID> with the error ID you found from the text.

      3. Take the export again and import it into the new instance.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              1b78f3292624 Max Bowsher
              Votes:
              3 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated: