diff --git a/.classpath b/.classpath index 944cd2142..e312554be 100644 --- a/.classpath +++ b/.classpath @@ -18,7 +18,7 @@ - + diff --git a/build.gradle b/build.gradle index 1f32f6e2d..01aa775e6 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 c70c4b309..0465da74a 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 baf531d54..295eeab9b 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 81b000c76..f201c7b49 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 4d29baea5..26bd57e10 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 000000000..9346235bc --- /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 000000000..d4d736923 --- /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(); + } + } +} +