@Override public void uploadAttachment( JSONObject doc ,String name ,File file ,String contentType ) throws Exception { FileInputStream fis = null; try { long size = file.length(); fis = new FileInputStream(file); uploadAttachment(doc, name, fis, contentType, size); } catch (Exception e) { throw e; } finally { if( null != fis ) { try { fis.close(); } catch (Exception e) { // Ignore } } } }