Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-10783

Android: Window url is assumed relative to calling js file directory, causes FileNotFoundException

    Details

    • Sprint:
      Release 3.0.0

      Description

      Problem

      When a window is created with the url property, that url used to be (2.1.2 and earlier) treated as relative to the Resources directory. Now (2.2.0.v20120904164912) it is treated as relative to the directory of the calling js file. If the calling js file is in a subdirectory, an error (java.io.FileNotFoundException) is generated. This is going to break a lot of existing code.

      Works in 2.1.2
      Broken in 2.2.0.v20120904164912

      Testcase

      Note in this example that the "loader.js" file is in a "ui" subdirectory.

      app.js

       
      Ti.UI.setBackgroundColor('#000'); 
      Ti.include('ui/loader.js'); 
      

      ui/loader.js

       
      var win1=Ti.UI.createWindow({ 
          title:'Window 1', 
          backgroundColor:'#fff', 
          url:'win1.js' 
      }); 
      win1.open(); 
      

      win1.js

       
      var winOne = Ti.UI.currentWindow; 
       
      var label1 = Ti.UI.createLabel({ 
        color:'#999', 
        text:'I am Window 1', 
        font:{fontSize:20,fontFamily:'Helvetica Neue'}, 
        textAlign:'center', 
        width:'auto' 
      }); 
       
      winOne.add(label1); 
      

      Error log

      ...
      [ERROR][TiAssetHelper( 345)] Error while reading asset "Resources/ui/win1.js":
      [ERROR][TiAssetHelper( 345)] java.io.FileNotFoundException: Resources/ui/win1.js
      [ERROR][TiAssetHelper( 345)] at android.content.res.AssetManager.openAsset(Native Method)
      [ERROR][TiAssetHelper( 345)] at android.content.res.AssetManager.open(AssetManager.java:313)
      [ERROR][TiAssetHelper( 345)] at android.content.res.AssetManager.open(AssetManager.java:287)
      [ERROR][TiAssetHelper( 345)] at org.appcelerator.kroll.util.KrollAssetHelper.readAsset(KrollAssetHelper.java:77)
      [ERROR][TiAssetHelper( 345)] at org.appcelerator.kroll.runtime.v8.V8Runtime.nativeRunModule(Native Method)
      [ERROR][TiAssetHelper( 345)] at org.appcelerator.kroll.runtime.v8.V8Runtime.doRunModule(V8Runtime.java:140)
      [ERROR][TiAssetHelper( 345)] at org.appcelerator.kroll.KrollRuntime.handleMessage(KrollRuntime.java:284)
      [ERROR][TiAssetHelper( 345)] at org.appcelerator.kroll.runtime.v8.V8Runtime.handleMessage(V8Runtime.java:166)
      [ERROR][TiAssetHelper( 345)] at android.os.Handler.dispatchMessage(Handler.java:95)
      [ERROR][TiAssetHelper( 345)] at android.os.Looper.loop(Looper.java:123)
      [ERROR][TiAssetHelper( 345)] at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:108)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                opiecyrus Opie Cyrus
                Reporter:
                bitshftr Shawn Lipscomb
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-14156
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Integration