Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25219] Android: FileNotFoundExceptions should not be inside the Titanium log

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2018-05-19T16:13:05.000+0000
Affected Version/sn/a
Fix Version/sRelease 7.3.0
ComponentsAndroid
Labelsn/a
ReporterHans Knöchel
AssigneeChristopher Williams
Created2017-09-01T13:54:05.000+0000
Updated2018-07-04T19:43:15.000+0000

Description

When referencing a file that does not exist (let's say in a Ti.UI.ImageView), we should only log one error message to say it does not exist - which we do, but we also log like 30 lines exception-logs and two additional warnings that do not help the developer in any case and only spams the console. To clean this little but annoying issue, we could just adjust the log by leaving out the 3rd parameter that uses the exception-log. Example of a log:
[ERROR] TiDrawableReference: (main) [100,100] Problem opening stream with url logo.png: Resources/logo.png
[ERROR] TiDrawableReference: java.io.FileNotFoundException: Resources/logo.png
[ERROR] TiDrawableReference: 	at android.content.res.AssetManager.openAsset(Native Method)
[ERROR] TiDrawableReference: 	at android.content.res.AssetManager.open(AssetManager.java:347)
[ERROR] TiDrawableReference: 	at android.content.res.AssetManager.open(AssetManager.java:321)
[ERROR] TiDrawableReference: 	at org.appcelerator.titanium.util.TiFileHelper.openInputStream(TiFileHelper.java:222)
[ERROR] TiDrawableReference: 	at org.appcelerator.titanium.view.TiDrawableReference.getInputStream(TiDrawableReference.java:860)
[ERROR] TiDrawableReference: 	at org.appcelerator.titanium.view.TiDrawableReference.getBitmap(TiDrawableReference.java:316)
[ERROR] TiDrawableReference: 	at org.appcelerator.titanium.view.TiDrawableReference.getBitmap(TiDrawableReference.java:300)
[ERROR] TiDrawableReference: 	at org.appcelerator.titanium.view.TiDrawableReference.getBitmap(TiDrawableReference.java:284)
[ERROR] TiDrawableReference: 	at org.appcelerator.titanium.view.TiDrawableReference.getDrawable(TiDrawableReference.java:497)
[ERROR] TiDrawableReference: 	at ti.modules.titanium.ui.widget.TiToolbar.handleSetLogo(TiToolbar.java:238)
[ERROR] TiDrawableReference: 	at ti.modules.titanium.ui.widget.TiToolbar.setLogo(TiToolbar.java:227)
[ERROR] TiDrawableReference: 	at ti.modules.titanium.ui.widget.TiToolbar.propertyChanged(TiToolbar.java:559)
[ERROR] TiDrawableReference: 	at org.appcelerator.kroll.KrollProxy.firePropertyChanged(KrollProxy.java:928)
[ERROR] TiDrawableReference: 	at org.appcelerator.kroll.KrollProxy.onPropertyChanged(KrollProxy.java:1016)
[ERROR] TiDrawableReference: 	at org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method)
[ERROR] TiDrawableReference: 	at org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:62)
[ERROR] TiDrawableReference: 	at org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:921)
[ERROR] TiDrawableReference: 	at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1144)
[ERROR] TiDrawableReference: 	at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:363)
[ERROR] TiDrawableReference: 	at org.appcelerator.titanium.proxy.TiWindowProxy.handleMessage(TiWindowProxy.java:116)
[ERROR] TiDrawableReference: 	at ti.modules.titanium.ui.WindowProxy.handleMessage(WindowProxy.java:452)
[ERROR] TiDrawableReference: 	at android.os.Handler.dispatchMessage(Handler.java:98)
[ERROR] TiDrawableReference: 	at android.os.Looper.loop(Looper.java:154)
[ERROR] TiDrawableReference: 	at android.app.ActivityThread.main(ActivityThread.java:6119)
[ERROR] TiDrawableReference: 	at java.lang.reflect.Method.invoke(Native Method)
[ERROR] TiDrawableReference: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
[ERROR] TiDrawableReference: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
[WARN]  TiDrawableReference: (main) [0,100] Could not open stream to get bitmap
[WARN]  TiDrawableReference: (main) [0,100] Could not open stream to get bitmap

Comments

  1. Christopher Williams 2017-09-01

    https://github.com/appcelerator/titanium_mobile/pull/9391
  2. Lokesh Choudhary 2018-02-23

    [~cwilliams], Can you please provide a backport.
  3. Lokesh Choudhary 2018-05-17

    FR Passed. Waiting for merger to be enabled.
  4. Samir Mohammed 2018-07-04

    *Closing ticket.* Verified fix in SDK version 7.3.0.v20180628132121 Test and other information can be found at: https://github.com/appcelerator/titanium_mobile/pull/9391

JSON Source