From: Andreas Beeker Date: Fri, 22 Jun 2018 21:25:00 +0000 (+0000) Subject: #59268 - Work on providing an updated version of XMLBeans X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=18db483a728580633b2e717490db1e143191966a;p=poi.git #59268 - Work on providing an updated version of XMLBeans (imported from https://github.com/apache/poi/pull/113) git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1834165 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/.classpath b/.classpath index 944cd2142b..e312554be1 100644 --- a/.classpath +++ b/.classpath @@ -18,7 +18,7 @@ - + diff --git a/build.gradle b/build.gradle index 1f32f6e2dc..01aa775e68 100644 --- a/build.gradle +++ b/build.gradle @@ -25,6 +25,12 @@ buildscript { } } +repositories { + maven { url "https://repository.apache.org/content/repositories/staging" } + mavenCentral() +} + + // Only add the plugin for Sonar if enabled if (project.hasProperty('enableSonar')) { println 'Enabling Sonar support' @@ -189,7 +195,7 @@ project('ooxml') { compileJava.dependsOn 'ant-compile-ooxml-xsds' dependencies { - compile 'org.apache.xmlbeans:xmlbeans:2.6.0' + compile 'org.apache.xmlbeans:xmlbeans:3.0.0' compile 'org.apache.commons:commons-collections4:4.1' compile 'org.apache.commons:commons-math3:3.6.1' compile 'org.apache.commons:commons-compress:1.17' diff --git a/build.xml b/build.xml index c70c4b3099..0465da74a8 100644 --- a/build.xml +++ b/build.xml @@ -199,9 +199,9 @@ under the License. - + + value="https://repository.apache.org/content/repositories/staging/org/apache/xmlbeans/xmlbeans/3.0.0/xmlbeans-3.0.0.jar"/> @@ -624,7 +624,7 @@ under the License. - + @@ -729,12 +729,8 @@ under the License. - + - - - - @@ -840,7 +836,7 @@ under the License. + classpath="${ooxml.xmlbeans.jar}"/> @@ -871,7 +867,7 @@ under the License. nopvr="@{nopvr}" > - + @@ -1954,8 +1950,8 @@ under the License. - - + + diff --git a/maven/poi-ooxml-schemas.pom b/maven/poi-ooxml-schemas.pom index baf531d542..295eeab9b0 100644 --- a/maven/poi-ooxml-schemas.pom +++ b/maven/poi-ooxml-schemas.pom @@ -62,7 +62,7 @@ org.apache.xmlbeans xmlbeans - 2.6.0 + 3.0.0 diff --git a/sonar/pom.xml b/sonar/pom.xml index 81b000c761..f201c7b49d 100644 --- a/sonar/pom.xml +++ b/sonar/pom.xml @@ -63,7 +63,7 @@ true - 2.6.0 + 3.0.0 4.12 2.5.1 2.13.0 diff --git a/src/integrationtest/build.xml b/src/integrationtest/build.xml index 4d29baea5d..26bd57e108 100644 --- a/src/integrationtest/build.xml +++ b/src/integrationtest/build.xml @@ -119,8 +119,8 @@ Before running this, you should execute the "assemble" target in the main build. - - + + diff --git a/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFUnicodeSurrogates.java b/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFUnicodeSurrogates.java new file mode 100644 index 0000000000..9346235bc3 --- /dev/null +++ b/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFUnicodeSurrogates.java @@ -0,0 +1,42 @@ +package org.apache.poi.xssf.streaming; + +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.util.TempFile; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.junit.Assert; +import org.junit.Test; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; + +public class TestSXSSFUnicodeSurrogates { + + private static String unicodeText = "𝝊𝝋𝝌𝝍𝝎𝝏𝝐𝝑𝝒𝝓𝝔𝝕𝝖𝝗𝝘𝝙𝝚𝝛𝝜𝝝𝝞𝝟𝝠𝝡𝝢𝝣𝝤𝝥𝝦𝝧𝝨𝝩𝝪𝝫𝝬𝝭𝝮𝝯𝝰𝝱𝝲𝝳𝝴𝝵𝝶𝝷𝝸𝝹𝝺"; + + @Test + public void testWriteUnicodeSurrogates() throws IOException { + String sheetName = "Sheet1"; + File tf = TempFile.createTempFile("poi-xmlbeans-test", ".xlsx"); + try (SXSSFWorkbook wb = new SXSSFWorkbook()) { + Sheet sheet = wb.createSheet(sheetName); + Row row = sheet.createRow(0); + Cell cell = row.createCell(0); + cell.setCellValue(unicodeText); + try (FileOutputStream os = new FileOutputStream(tf)) { + wb.write(os); + } + try (FileInputStream fis = new FileInputStream(tf); + XSSFWorkbook wb2 = new XSSFWorkbook(fis)) { + Sheet sheet2 = wb2.getSheet(sheetName); + Cell cell2 = sheet2.getRow(0).getCell(0); + Assert.assertEquals(unicodeText, cell2.getStringCellValue()); + } + } finally { + tf.delete(); + } + } +} diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFUnicodeSurrogates.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFUnicodeSurrogates.java new file mode 100644 index 0000000000..d4d7369234 --- /dev/null +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFUnicodeSurrogates.java @@ -0,0 +1,42 @@ +package org.apache.poi.xssf.usermodel; + +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.util.TempFile; +import org.junit.Assert; +import org.junit.Test; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; + +public class TestXSSFUnicodeSurrogates { + + private static String unicodeText = "𝝊𝝋𝝌𝝍𝝎𝝏𝝐𝝑𝝒𝝓𝝔𝝕𝝖𝝗𝝘𝝙𝝚𝝛𝝜𝝝𝝞𝝟𝝠𝝡𝝢𝝣𝝤𝝥𝝦𝝧𝝨𝝩𝝪𝝫𝝬𝝭𝝮𝝯𝝰𝝱𝝲𝝳𝝴𝝵𝝶𝝷𝝸𝝹𝝺"; + + @Test + public void testWriteUnicodeSurrogates() throws IOException { + String sheetName = "Sheet1"; + File tf = TempFile.createTempFile("poi-xmlbeans-test", ".xlsx"); + try (XSSFWorkbook wb = new XSSFWorkbook()) { + Sheet sheet = wb.createSheet(sheetName); + Row row = sheet.createRow(0); + Cell cell = row.createCell(0); + cell.setCellValue(unicodeText); + try (FileOutputStream os = new FileOutputStream(tf)) { + wb.write(os); + } + try (FileInputStream fis = new FileInputStream(tf); + XSSFWorkbook wb2 = new XSSFWorkbook(fis)) { + Sheet sheet2 = wb2.getSheet(sheetName); + Cell cell2 = sheet2.getRow(0).getCell(0); + Assert.assertEquals(unicodeText, cell2.getStringCellValue()); + } + } finally { + tf.delete(); + } + } +} +