From f8948118bdba21dad4ef8a29c1dee23554b8f89e Mon Sep 17 00:00:00 2001 From: zhoudaxia <1018795633@qq.cin> Date: Fri, 26 Aug 2016 10:53:50 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E9=83=A8=E5=88=86=E9=98=BB?= =?UTF-8?q?=E6=96=AD=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/net/sf/robocode/installer/AutoExtract.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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;