B4J Question Error during LoadLayout (java.lang.ArrayIndexOutOfBoundsException: arraycopy: length -4 is negative)

peacemaker

Expert
Licensed User
Longtime User
HI, All

I have a complex layout, and before all was OK, but at some point, when the layout gots to be complex - the error is started to occur (non-crashing), at LoadLayout:

B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    dd.Initialize
    'The designer script calls the DDD class. A new class instance will be created if needed.
    'In this case we want to create it ourselves as we want to access it in our code.
    xui.RegisterDesignerClass(dd)
    Root.LoadLayout("MainPage")    'error - at this point

Waiting for debugger to connect...
Program started.

java.lang.ArrayIndexOutOfBoundsException: arraycopy: length -4 is negative
at java.base/java.lang.System.arraycopy(Native Method)
at anywheresoftware.b4a.keywords.Bit.ArrayCopy(Bit.java:192)
at b4j.example.bitmapcreator._fillhorizontalline(bitmapcreator.java:4370)
at b4j.example.bitmapcreator._drawrect2(bitmapcreator.java:2583)
at b4j.example.bitmapcreator._drawrectrounded2(bitmapcreator.java:2686)
at b4j.example.bitmapcreator._drawcanvasasync(bitmapcreator.java:1663)
at b4j.example.bitmapcreator$1.run(bitmapcreator.java:5075)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
What can it be ?
The layout file is attached.
 

Attachments

  • MainPage.zip
    4.3 KB · Views: 166

peacemaker

Expert
Licensed User
Longtime User
Small testing project - yes, always best variant. But this time - it's some internal non-crashing error - is it possible to debug it deeper than ... just trying lo LoadLayout ?
If yes, please, suggest.
I dot see how small project can help here. But i'm trying to prepare.
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
Ahhh, clear.
Here the test project.

p.s. file below
 
Last edited:
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
Opps, indeed, sorry, cleaned.
 

Attachments

  • debug_proj.zip
    23 KB · Views: 149
Upvote 0

agraham

Expert
Licensed User
Longtime User
Just by removing views one by one
Yes. Save a layout file copy. Remove view, test, if error there copy layout file back, remove another view - rinse and repeat. Or do a binary chop. Remove half the views, then a quarter then finally one by one.
 
Upvote 0
Top