Bug? Bitmap Initialize do not work in debug mode

Victor Pavlov

Member
Licensed User
Longtime User
This code works fine in release mode.
The same crashes in debug mode.

MyBitmap.Initialize("", "")
Return MyBitmap

This code was used from B4A version 3.20 and worked fine in 3 our products.
We always used Legacy Debugger, now switching to new one.

Output is:
Error occurred on line: 679 (Configuration)
java.io.FileNotFoundException: /: open failed: EISDIR (Is a directory)
at libcore.io.IoBridge.open(IoBridge.java:416)
at java.io.FileInputStream.<init>(FileInputStream.java:78)
at anywheresoftware.b4a.objects.streams.File.OpenInput(File.java:209)
at anywheresoftware.b4a.objects.drawable.CanvasWrapper$BitmapWrapper.Initialize(CanvasWrapper.java:498)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:742)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:342)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:246)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at anywheresoftware.b4a.debug.Debug.delegate(Debug.java:262)
at microinvest.Restaurant.configuration._loadbitmapex(configuration.java:752)
at microinvest.Restaurant.main._activity_create(main.java:484)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:697)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:246)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at microinvest.Restaurant.main.afterFirstLayout(main.java:102)
at microinvest.Restaurant.main.access$000(main.java:17)
at microinvest.Restaurant.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
Caused by: libcore.io.ErrnoException: open failed: EISDIR (Is a directory)
at libcore.io.IoBridge.open(IoBridge.java:405)
... 34 more
 
Last edited:

sorex

Expert
Licensed User
Longtime User
you need to supply a file.

it fails in debug and release mode here which is normal since it can't find any file.
 

Victor Pavlov

Member
Licensed User
Longtime User
Please, advice!
This code was working for last 2 years.

B4X:
Public Sub LoadBitmapEx(MyFile As String) As Bitmap
dim s as String

s = MyFile & ".jpg"
If File.Exists(File.DirAssets, s) Then 
MyBitmap = LoadBitmap(File.DirAssets, s)
else
MyBitmap.Initialize("", "")
End If

Return MyBitmap
 
Top