Details
-
New Feature
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
Version 5.0.3
-
None
-
None
Description
The project https://github.com/centic9/poi-on-android allows to run Apache POI as part of Android Apps and thus also uses XMLBeans.
When trying to update to Apache POI 5.2.0, I saw that there is a problem with the SAX parser on Android as it fails when both features "namespaces" and "namespace-prefix" are set to true.
XMLBeans currently does this in the class Locale.SaxLoader and thus an Android Application crashes with an error "The 'namespace-prefix' feature is not supported while the 'namespaces' feature is enabled."
Therefore I will introduce a system property which can be used to control the SAX feature "namespace-prefixes" to be able to set it to "false" if required.
The full stacktrace is:
E/AndroidRuntime: FATAL EXCEPTION: main Process: org.dstadler.poiandroidtest.poitest, PID: 26552 java.lang.RuntimeException: Unable to start activity ComponentInfo{org.dstadler.poiandroidtest.poitest/org.dstadler.poiandroidtest.poitest.DocumentListActivity}: java.lang.IllegalStateException: org.apache.poi.ooxml.POIXMLException: unable to parse shared strings table at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892) at android.app.ActivityThread.-wrap11(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6541) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) Caused by: java.lang.IllegalStateException: org.apache.poi.ooxml.POIXMLException: unable to parse shared strings table at org.dstadler.poiandroidtest.poitest.DocumentListActivity.onCreate(DocumentListActivity.java:191) at android.app.Activity.performCreate(Activity.java:6975) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892) at android.app.ActivityThread.-wrap11(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6541) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) Caused by: org.apache.poi.ooxml.POIXMLException: unable to parse shared strings table at org.apache.poi.ooxml.POIXMLFactory.createDocumentPart(POIXMLFactory.java:68) at org.apache.poi.ooxml.POIXMLDocumentPart.read(POIXMLDocumentPart.java:661) at org.apache.poi.ooxml.POIXMLDocument.load(POIXMLDocument.java:165) at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:274) at org.apache.poi.xssf.usermodel.XSSFWorkbookFactory.createWorkbook(XSSFWorkbookFactory.java:118) at org.apache.poi.xssf.usermodel.XSSFWorkbookFactory.create(XSSFWorkbookFactory.java:98) at org.apache.poi.xssf.usermodel.XSSFWorkbookFactory.create(XSSFWorkbookFactory.java:36) at org.apache.poi.ss.usermodel.WorkbookFactory.lambda$create$2(WorkbookFactory.java:224) at org.apache.poi.ss.usermodel.WorkbookFactory$$ExternalSyntheticLambda4.create(Unknown Source:2) at org.apache.poi.ss.usermodel.WorkbookFactory.wp(WorkbookFactory.java:329) at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:224) at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:185) at org.dstadler.poiandroidtest.poitest.DocumentListActivity.onCreate(DocumentListActivity.java:81) at android.app.Activity.performCreate(Activity.java:6975) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892) at android.app.ActivityThread.-wrap11(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6541) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) Caused by: java.io.IOException: unable to parse shared strings table at org.apache.poi.xssf.model.SharedStringsTable.readFrom(SharedStringsTable.java:136) at org.apache.poi.xssf.model.SharedStringsTable.<init>(SharedStringsTable.java:112) at org.apache.poi.xssf.usermodel.XSSFRelation$$ExternalSyntheticLambda14.init(Unknown Source:2) at org.apache.poi.ooxml.POIXMLFactory.createDocumentPart(POIXMLFactory.java:61) at org.apache.poi.ooxml.POIXMLDocumentPart.read(POIXMLDocumentPart.java:661) at org.apache.poi.ooxml.POIXMLDocument.load(POIXMLDocument.java:165) at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:274) at org.apache.poi.xssf.usermodel.XSSFWorkbookFactory.createWorkbook(XSSFWorkbookFactory.java:118) at org.apache.poi.xssf.usermodel.XSSFWorkbookFactory.create(XSSFWorkbookFactory.java:98) at org.apache.poi.xssf.usermodel.XSSFWorkbookFactory.create(XSSFWorkbookFactory.java:36) at org.apache.poi.ss.usermodel.WorkbookFactory.lambda$create$2(WorkbookFactory.java:224) at org.apache.poi.ss.usermodel.WorkbookFactory$$ExternalSyntheticLambda4.create(Unknown Source:2) at org.apache.poi.ss.usermodel.WorkbookFactory.wp(WorkbookFactory.java:329) at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:224) at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:185) at org.dstadler.poiandroidtest.poitest.DocumentListActivity.onCreate(DocumentListActivity.java:81) at android.app.Activity.performCreate(Activity.java:6975) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892) at android.app.ActivityThread.-wrap11(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6541) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) Caused by: org.apache.xmlbeans.XmlException: error: The 'namespace-prefix' feature is not supported while the 'namespaces' feature is enabled. at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:2565) at org.apache.xmlbeans.impl.store.Locale.lambda$parseToXmlObject$3(Locale.java:725) at org.apache.xmlbeans.impl.store.Locale$$ExternalSyntheticLambda4.parse(Unknown Source:6) at org.apache.xmlbeans.impl.store.Locale.syncWrap(Locale.java:498) at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:724) at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:233) at org.apache.xmlbeans.impl.schema.AbstractDocumentFactory.parse(AbstractDocumentFactory.java:71) at org.apache.poi.xssf.model.SharedStringsTable.readFrom(SharedStringsTable.java:125) at org.apache.poi.xssf.model.SharedStringsTable.<init>(SharedStringsTable.java:112) at org.apache.poi.xssf.usermodel.XSSFRelation$$ExternalSyntheticLambda14.init(Unknown Source:2) at org.apache.poi.ooxml.POIXMLFactory.createDocumentPart(POIXMLFactory.java:61) at org.apache.poi.ooxml.POIXMLDocumentPart.read(POIXMLDocumentPart.java:661) at org.apache.poi.ooxml.POIXMLDocument.load(POIXMLDocument.java:165) at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:274) at org.apache.poi.xssf.usermodel.XSSFWorkbookFactory.createWorkbook(XSSFWorkbookFactory.java:118) at org.apache.poi.xssf.usermodel.XSSFWorkbookFactory.create(XSSFWorkbookFactory.java:98) at org.apache.poi.xssf.usermodel.XSSFWorkbookFactory.create(XSSFWorkbookFactory.java:36) at org.apache.poi.ss.usermodel.WorkbookFactory.lambda$create$2(WorkbookFactory.java:224) at org.apache.poi.ss.usermodel.WorkbookFactory$$ExternalSyntheticLambda4.create(Unknown Source:2) at org.apache.poi.ss.usermodel.WorkbookFactory.wp(WorkbookFactory.java:329) at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:224) at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:185) at org.dstadler.poiandroidtest.poitest.DocumentListActivity.onCreate(DocumentListActivity.java:81) at android.app.Activity.performCreate(Activity.java:6975) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892) at android.app.ActivityThread.-wrap11(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6541) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) E/AndroidRuntime: Caused by: org.xml.sax.SAXNotSupportedException: The 'namespace-prefix' feature is not supported while the 'namespaces' feature is enabled. at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:258) at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:2538) ... 34 more
Attachments
Issue Links
- is cloned by
-
XMLBEANS-612 Adjust Class loading to allow using XMLBeans on Android
- Resolved