diff options
author | Robert Antoni Buj i Gelonch <robert.buj@gmail.com> | 2014-09-25 19:41:12 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2014-10-02 15:25:29 +0200 |
commit | 6f42a714399f4d0c46dad95c7c11bcd513c27eaa (patch) | |
tree | b5ea97f0171124e8232fe909e86ac0a087e8a3d0 /scripting/workben/installer/ZipData.java | |
parent | 36d24bced0ea5fcbbd380b15e9d1a813fbef32cf (diff) |
scripting: Format_java_code.sh initial run
Conflicts:
scripting/java/com/sun/star/script/framework/io/UCBStreamHandler.java
Change-Id: I09b94d8c96dfbaf498bd93a0088feb80a9e4afb6
Diffstat (limited to 'scripting/workben/installer/ZipData.java')
-rw-r--r-- | scripting/workben/installer/ZipData.java | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/scripting/workben/installer/ZipData.java b/scripting/workben/installer/ZipData.java index 466f87a6e863..6e5d513a16be 100644 --- a/scripting/workben/installer/ZipData.java +++ b/scripting/workben/installer/ZipData.java @@ -24,7 +24,7 @@ import javax.swing.*; public class ZipData { public boolean extractEntry(String entry, String destination, - JLabel statusLabel) { + JLabel statusLabel) { OutputStream out = null; InputStream in = null; @@ -37,6 +37,7 @@ public class ZipData { } String entryName; + if (entry.lastIndexOf("/") != -1) { entryName = entry.substring(entry.lastIndexOf("/") + 1); } else { @@ -44,9 +45,10 @@ public class ZipData { } String destName; + if (destination.lastIndexOf(File.separator) != -1) { destName = destination.substring(destination - .lastIndexOf(File.separator) + 1); + .lastIndexOf(File.separator) + 1); } else { destName = destination; } @@ -60,12 +62,13 @@ public class ZipData { entry = "/" + entry; in = this.getClass().getResourceAsStream(entry); + if (in == null) { System.err.println("File " + entry + " not found in jar file"); if (statusLabel != null) statusLabel.setText("Failed extracting " + entry - + "see SFramework.log for more information"); + + "see SFramework.log for more information"); return false; } @@ -74,11 +77,11 @@ public class ZipData { out = new FileOutputStream(destination); } catch (IOException ioe) { System.err.println("Error opening " + destination + ": " - + ioe.getMessage()); + + ioe.getMessage()); if (statusLabel != null) statusLabel.setText("Error opening" + destination - + "see SFramework.log for more information"); + + "see SFramework.log for more information"); return false; } @@ -91,11 +94,12 @@ public class ZipData { out.write(bytes, 0, len); } catch (IOException ioe) { System.err.println("Error writing " + destination + ": " - + ioe.getMessage()); + + ioe.getMessage()); if (statusLabel != null) statusLabel.setText("Failed writing " + destination - + "see SFramework.log for more information"); + + "see SFramework.log for more information"); + return false; } finally { try { @@ -104,6 +108,7 @@ public class ZipData { } catch (IOException ioe) { } } + return true; } } |