- Timestamp:
- 2010-09-04T14:10:43+02:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r3447 r3512 143 143 if(archive != null) 144 144 { 145 ZipFile zipFile = null; 145 146 try 146 147 { 147 ZipFilezipFile = new ZipFile(archive);148 zipFile = new ZipFile(archive); 148 149 ZipEntry entry = zipFile.getEntry(full_name); 149 150 if(entry != null) … … 152 153 int offs = 0; 153 154 byte[] buf = new byte[size]; 154 InputStream is = zipFile.getInputStream(entry); 155 while(size > 0) 156 { 157 int l = is.read(buf, offs, size); 158 offs += l; 159 size -= l; 155 InputStream is = null; 156 try { 157 is = zipFile.getInputStream(entry); 158 while(size > 0) 159 { 160 int l = is.read(buf, offs, size); 161 offs += l; 162 size -= l; 163 } 164 img = Toolkit.getDefaultToolkit().createImage(buf); 165 } finally { 166 if (is != null) { 167 is.close(); 168 } 160 169 } 161 img = Toolkit.getDefaultToolkit().createImage(buf);162 170 } 163 171 } catch (Exception e) { 164 172 System.err.println(tr("Warning: failed to handle zip file ''{0}''. Exception was: {1}", archive.getName(), e.toString())); 173 } finally { 174 if (zipFile != null) { 175 try { 176 zipFile.close(); 177 } catch (IOException ex) { 178 } 179 } 165 180 } 166 181 }
Note:
See TracChangeset
for help on using the changeset viewer.