diff --git a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.installer/src/main/java/net/sf/robocode/installer/AutoExtract.java b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.installer/src/main/java/net/sf/robocode/installer/AutoExtract.java index b191f9b..9ebdb61 100644 --- a/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.installer/src/main/java/net/sf/robocode/installer/AutoExtract.java +++ b/代码/workspace_robo4/plugins/dotnet/robocode.dotnet.installer/src/main/java/net/sf/robocode/installer/AutoExtract.java @@ -9,6 +9,7 @@ package net.sf.robocode.installer; import javax.swing.*; + import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -33,18 +34,19 @@ public class AutoExtract implements ActionListener { private static File installDir; private static final String javaVersion = System.getProperty("java.version"); - private boolean acceptLicense() { + private boolean acceptLicense() throws IOException { String licenseText = ""; InputStream is; + JarFile extractJar = null; try { - JarFile extractJar = new JarFile("extract.jar"); + extractJar = new JarFile("extract.jar"); is = extractJar.getInputStream(extractJar.getJarEntry("license/cpl-v10.html")); } catch (IOException e) { return true; - }finally{ + } finally{ extractJar.close(); } if (is == null) { @@ -227,7 +229,7 @@ public class AutoExtract implements ActionListener { } } - public static void main(String argv[]) { + public static void main(String argv[]) throws HeadlessException, IOException { // Verify that the Java version is version 6 (1.6.0) or newer if (javaVersion.startsWith("1.") && javaVersion.charAt(2) < '5') { final String message = "Robocode requires Java 6 (1.6.0) or newer.\n" @@ -242,7 +244,7 @@ public class AutoExtract implements ActionListener { // Set native look and feel try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (RuntimeException t) {// For some reason Ubuntu 7 can cause a NullPointerException when trying to getting the LAF + } catch (Throwable t) {// For some reason Ubuntu 7 can cause a NullPointerException when trying to getting the LAF } File suggestedDir;