java.io.IOException

Appcelerator JIRA | Ashraf Abu | 6 months ago
  1. 0

    Resolving TIMOB-23230 brought attention to this error. Logs as follows:- {code} ERROR] : TiBlob: (main) [449,5770] null [ERROR] : TiBlob: java.io.IOException [ERROR] : TiBlob: at java.io.InputStream.reset(InputStream.java:208) [ERROR] : TiBlob: at org.appcelerator.titanium.TiBlob.guessAdditionalContentTypeFromStream(TiBlob.java:239) [ERROR] : TiBlob: at org.appcelerator.titanium.TiBlob.guessContentTypeFromStream(TiBlob.java:214) [ERROR] : TiBlob: at org.appcelerator.titanium.TiBlob.loadBitmapInfo(TiBlob.java:270) [ERROR] : TiBlob: at org.appcelerator.titanium.TiBlob.blobFromFile(TiBlob.java:140) [ERROR] : TiBlob: at org.appcelerator.titanium.TiBlob.blobFromFile(TiBlob.java:113) [ERROR] : TiBlob: at ti.modules.titanium.media.TiCameraActivity$3.onPictureTaken(TiCameraActivity.java:563) [ERROR] : TiBlob: at android.hardware.Camera$EventHandler.handleMessage(Camera.java:1092) [ERROR] : TiBlob: at android.os.Handler.dispatchMessage(Handler.java:102) [ERROR] : TiBlob: at android.os.Looper.loop(Looper.java:148) [ERROR] : TiBlob: at android.app.ActivityThread.main(ActivityThread.java:5417) [ERROR] : TiBlob: at java.lang.reflect.Method.invoke(Native Method) [ERROR] : TiBlob: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) [ERROR] : TiBlob: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) {code} This was tested on an Android 6.0, Nexus 6. Test code as follows:- {code} var window = Ti.UI.createWindow(); var overlay = Ti.UI.createView(); var button = Titanium.UI.createButton({ color : '#fff', bottom : "10dp", width : "130dp", height : "50dp", font : { fontSize : "14dp", fontWeight : 'bold', fontFamily : 'Helvetica Neue' }, title : 'Take Picture' }); button.addEventListener('click', function() { Ti.Media.takePicture(); }); window.add(overlay); overlay.add(button); window.addEventListener('open', function(e){ var cameraPermission = "android.permission.CAMERA"; var storagePermission = "android.permission.READ_EXTERNAL_STORAGE"; var hasCameraPerm = Ti.Android.hasPermission(cameraPermission); var hasStoragePerm = Ti.Android.hasPermission(storagePermission); var permissionsToRequest = []; if (!hasCameraPerm) { permissionsToRequest.push(cameraPermission); } if (!hasStoragePerm) { permissionsToRequest.push(storagePermission); } if (permissionsToRequest.length > 0) { Ti.Android.requestPermissions(permissionsToRequest, function(e) { if (e.success) { showCamera(); } else { Ti.API.info("ERROR: " + e.error); } }); } else { showCamera(); } }); Ti.Media.addEventListener('cameraready', function(e){ Ti.Media.takePicture(); }); var container = Ti.UI.createView({ top:'10%', height:'80%' }); var img = Ti.UI.createImageView({ }); container.add(img); window.add(container); window.open(); function showCamera() { Ti.Media.showCamera({ success : function(e) { Ti.API.info('GOT SUCCESS CALLBACK'); var imgWid = e.media.width; var imgHeight = e.media.height; var mSize = container.size; var mW = mSize.width; var mH = mSize.height; var wS = imgWid/mW; var hS = imgHeight/mH; var tS = (wS < hS) ? wS : hS; var dstWid = imgWid/tS; var dstHeight = imgHeight/ tS; Ti.API.info(imgWid+' '+imgHeight+' '+mW+' '+mH+' '+wS+' '+hS+' '+tS+' '+dstWid+' '+dstHeight); var resize = e.media.imageAsResized(dstWid,dstHeight); img.image = resize; }, overlay : overlay, mediaTypes : [Ti.Media.MEDIA_TYPE_PHOTO], saveToPhotoGallery : true }); } {code}

    Appcelerator JIRA | 6 months ago | Ashraf Abu
    java.io.IOException
  2. 0

    Resolving TIMOB-23230 brought attention to this error. Logs as follows:- {code} ERROR] : TiBlob: (main) [449,5770] null [ERROR] : TiBlob: java.io.IOException [ERROR] : TiBlob: at java.io.InputStream.reset(InputStream.java:208) [ERROR] : TiBlob: at org.appcelerator.titanium.TiBlob.guessAdditionalContentTypeFromStream(TiBlob.java:239) [ERROR] : TiBlob: at org.appcelerator.titanium.TiBlob.guessContentTypeFromStream(TiBlob.java:214) [ERROR] : TiBlob: at org.appcelerator.titanium.TiBlob.loadBitmapInfo(TiBlob.java:270) [ERROR] : TiBlob: at org.appcelerator.titanium.TiBlob.blobFromFile(TiBlob.java:140) [ERROR] : TiBlob: at org.appcelerator.titanium.TiBlob.blobFromFile(TiBlob.java:113) [ERROR] : TiBlob: at ti.modules.titanium.media.TiCameraActivity$3.onPictureTaken(TiCameraActivity.java:563) [ERROR] : TiBlob: at android.hardware.Camera$EventHandler.handleMessage(Camera.java:1092) [ERROR] : TiBlob: at android.os.Handler.dispatchMessage(Handler.java:102) [ERROR] : TiBlob: at android.os.Looper.loop(Looper.java:148) [ERROR] : TiBlob: at android.app.ActivityThread.main(ActivityThread.java:5417) [ERROR] : TiBlob: at java.lang.reflect.Method.invoke(Native Method) [ERROR] : TiBlob: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) [ERROR] : TiBlob: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) {code} This was tested on an Android 6.0, Nexus 6. Test code as follows:- {code} var window = Ti.UI.createWindow(); var overlay = Ti.UI.createView(); var button = Titanium.UI.createButton({ color : '#fff', bottom : "10dp", width : "130dp", height : "50dp", font : { fontSize : "14dp", fontWeight : 'bold', fontFamily : 'Helvetica Neue' }, title : 'Take Picture' }); button.addEventListener('click', function() { Ti.Media.takePicture(); }); window.add(overlay); overlay.add(button); window.addEventListener('open', function(e){ var cameraPermission = "android.permission.CAMERA"; var storagePermission = "android.permission.READ_EXTERNAL_STORAGE"; var hasCameraPerm = Ti.Android.hasPermission(cameraPermission); var hasStoragePerm = Ti.Android.hasPermission(storagePermission); var permissionsToRequest = []; if (!hasCameraPerm) { permissionsToRequest.push(cameraPermission); } if (!hasStoragePerm) { permissionsToRequest.push(storagePermission); } if (permissionsToRequest.length > 0) { Ti.Android.requestPermissions(permissionsToRequest, function(e) { if (e.success) { showCamera(); } else { Ti.API.info("ERROR: " + e.error); } }); } else { showCamera(); } }); Ti.Media.addEventListener('cameraready', function(e){ Ti.Media.takePicture(); }); var container = Ti.UI.createView({ top:'10%', height:'80%' }); var img = Ti.UI.createImageView({ }); container.add(img); window.add(container); window.open(); function showCamera() { Ti.Media.showCamera({ success : function(e) { Ti.API.info('GOT SUCCESS CALLBACK'); var imgWid = e.media.width; var imgHeight = e.media.height; var mSize = container.size; var mW = mSize.width; var mH = mSize.height; var wS = imgWid/mW; var hS = imgHeight/mH; var tS = (wS < hS) ? wS : hS; var dstWid = imgWid/tS; var dstHeight = imgHeight/ tS; Ti.API.info(imgWid+' '+imgHeight+' '+mW+' '+mH+' '+wS+' '+hS+' '+tS+' '+dstWid+' '+dstHeight); var resize = e.media.imageAsResized(dstWid,dstHeight); img.image = resize; }, overlay : overlay, mediaTypes : [Ti.Media.MEDIA_TYPE_PHOTO], saveToPhotoGallery : true }); } {code}

    Appcelerator JIRA | 6 months ago | Ashraf Abu
    java.io.IOException
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    IOException on Movie.decodeFile() - android

    Stack Overflow | 3 years ago | Ganesh
    java.io.IOException
  5. 0

    IOException - Cannot load file

    Stack Overflow | 5 years ago | Bojan Kogoj
    java.io.IOException

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.io.IOException

      No message provided

      at java.io.InputStream.reset()
    2. Java RT
      InputStream.reset
      1. java.io.InputStream.reset(InputStream.java:208)
      1 frame
    3. org.appcelerator.titanium
      TiBlob.blobFromFile
      1. org.appcelerator.titanium.TiBlob.guessAdditionalContentTypeFromStream(TiBlob.java:239)
      2. org.appcelerator.titanium.TiBlob.guessContentTypeFromStream(TiBlob.java:214)
      3. org.appcelerator.titanium.TiBlob.loadBitmapInfo(TiBlob.java:270)
      4. org.appcelerator.titanium.TiBlob.blobFromFile(TiBlob.java:140)
      5. org.appcelerator.titanium.TiBlob.blobFromFile(TiBlob.java:113)
      5 frames
    4. ti.modules.titanium
      TiCameraActivity$3.onPictureTaken
      1. ti.modules.titanium.media.TiCameraActivity$3.onPictureTaken(TiCameraActivity.java:563)
      1 frame
    5. Android Platform
      ActivityThread.main
      1. android.hardware.Camera$EventHandler.handleMessage(Camera.java:1092)
      2. android.os.Handler.dispatchMessage(Handler.java:102)
      3. android.os.Looper.loop(Looper.java:148)
      4. android.app.ActivityThread.main(ActivityThread.java:5417)
      4 frames
    6. Java RT
      Method.invoke
      1. java.lang.reflect.Method.invoke(Native Method)
      1 frame
    7. Android
      ZygoteInit.main
      1. com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
      2. com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
      2 frames