B4J Question jPOI "setAutoFilter" and B4JPackager 11

Vikjh

Member
Licensed User
I can't solve the problem with B4JPackager 11 and POI "setAutoFilter" method. The code is quite simple and it works in debug and release mode and
don't work in B4JPackager

B4X:
        Dim SheetObj As JavaObject =sheet1
            SheetObj.RunMethod("createFreezePane",Array(0,2))
            Dim CelReng As JavaObject
            'Working in debug and release  don't work B4JPackager 
            'CelReng = CelReng.InitializeStatic("org.apache.poi.ss.util.CellRangeAddress").RunMethod("valueOf", Array("2:2"))
            'Working in debug and release  and B4JPackager 
            CelReng.InitializeNewInstance("org.apache.poi.ss.util.CellRangeAddress",Array(1,1, 0, ResColumns.Size))
            'Working in debug and relase don't work B4JPackager 
            SheetObj.RunMethod("setAutoFilter",Array(CelReng))
If I comment on the last line everything will work, but I need to set a filter
The necessary lines are added to Main :
B4X:
#PackagerProperty: AdditionalModuleInfoString = opens schemaorg_apache_xmlbeans.system.sD023D6490046BA0250A839A9AD24C443;
#PackagerProperty: IncludedModules = jdk.charsets
 

Vikjh

Member
Licensed User
The app crashes.

excel$ResumableSub_Exportxcel.resume (java line: -1)
java.lang.ExceptionInInitializerError
at b4j/org.apache.poi.ss.util.CellReference.<init>(Unknown Source)
at b4j/org.apache.poi.ss.formula.FormulaParser$SimpleRangePart.getCellReference(Unknown Source)
at b4j/org.apache.poi.ss.formula.FormulaParser.createAreaRef(Unknown Source)
at b4j/org.apache.poi.ss.formula.FormulaParser.createAreaRefParseNode(Unknown Source)
at b4j/org.apache.poi.ss.formula.FormulaParser.parseRangeable(Unknown Source)
at b4j/org.apache.poi.ss.formula.FormulaParser.parseRangeExpression(Unknown Source)
at b4j/org.apache.poi.ss.formula.FormulaParser.parseSimpleFactor(Unknown Source)
at b4j/org.apache.poi.ss.formula.FormulaParser.percentFactor(Unknown Source)
at b4j/org.apache.poi.ss.formula.FormulaParser.powerFactor(Unknown Source)
at b4j/org.apache.poi.ss.formula.FormulaParser.Term(Unknown Source)
at b4j/org.apache.poi.ss.formula.FormulaParser.additiveExpression(Unknown Source)
at b4j/org.apache.poi.ss.formula.FormulaParser.concatExpression(Unknown Source)
at b4j/org.apache.poi.ss.formula.FormulaParser.comparisonExpression(Unknown Source)
at b4j/org.apache.poi.ss.formula.FormulaParser.intersectionExpression(Unknown Source)
at b4j/org.apache.poi.ss.formula.FormulaParser.unionExpression(Unknown Source)
at b4j/org.apache.poi.ss.formula.FormulaParser.parse(Unknown Source)
at b4j/org.apache.poi.ss.formula.FormulaParser.parse(Unknown Source)
at b4j/org.apache.poi.xssf.usermodel.XSSFName.setRefersToFormula(Unknown Source)
at b4j/org.apache.poi.xssf.usermodel.XSSFSheet.setAutoFilter(Unknown Source)
at b4j/org.apache.poi.xssf.streaming.SXSSFSheet.setAutoFilter(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at b4j/anywheresoftware.b4j.object.JavaObject.RunMethod(Unknown Source)
at b4j/b4j.example.excel$ResumableSub_Exportxcel.resume(Unknown Source)
at b4j/anywheresoftware.b4a.BA.checkAndRunWaitForEvent(Unknown Source)
at b4j/anywheresoftware.b4a.BA.raiseEvent2(Unknown Source)
at b4j/anywheresoftware.b4a.keywords.Common.CallSub4(Unknown Source)
at b4j/anywheresoftware.b4a.keywords.Common.access$0(Unknown Source)
at b4j/anywheresoftware.b4a.keywords.Common$CallSubDelayedHelper.run(Unknown Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(Unknown Source)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.nio.charset.UnsupportedCharsetException: Big5
at java.base/java.nio.charset.Charset.forName(Unknown Source)
at b4j/org.apache.poi.util.StringUtil.<clinit>(Unknown Source)
... 38 more
 
Upvote 0

Vikjh

Member
Licensed User
Strange thing... I removed the line from Main and everything worked!
B4X:
#PackagerProperty: IncludedModules = jdk.crypto.ec
 
Upvote 0

bdunkleysmith

Active Member
Licensed User
Longtime User
If you have:
B4X:
#PackagerProperty: IncludedModules = jdk.crypto.ec
and
B4X:
#PackagerProperty: IncludedModules = jdk.charsets

on separate lines then it violates Tips and special cases 6. Each PackagerProperty key should appear at most once. So for example if using both WebView and jPOI add: #PackagerProperty: IncludedModules = jdk.charsets, javafx.web in Integrated B4JPackager11 - The simple way to distribute standalone UI apps
 
Upvote 0
Top