修改部分阻断问题

This commit is contained in:
zhoudaxia 2016-08-26 12:56:01 +08:00
parent ac3d4364c7
commit ed407d3129
10 changed files with 22 additions and 3 deletions

View File

@ -46,8 +46,9 @@ public class AutoExtract implements ActionListener {
try { try {
JarFile extractJar = new JarFile("extract.jar"); JarFile extractJar = new JarFile("extract.jar");
is = extractJar.getInputStream(extractJar.getJarEntry("license/cpl-v10.html")); is = extractJar.getInputStream(extractJar.getJarEntry("license/cpl-v10.html"));
extractFJar.close();
} catch (IOException e) { } catch (IOException e) {
return true; return true;
} }
@ -250,7 +251,7 @@ public class AutoExtract implements ActionListener {
} }
File installDir = null; File installDir = null;
File suggestedDir; File suggestedDir;s
AutoExtract extractor = new AutoExtract(); AutoExtract extractor = new AutoExtract();

View File

@ -68,5 +68,6 @@ public class JarJarTest {
ClassLoader ucl = new URLClassLoader(new URL[] { u}); ClassLoader ucl = new URLClassLoader(new URL[] { u});
ucl.loadClass(clas); ucl.loadClass(clas);
ucl.close();
} }
} }

View File

@ -68,6 +68,7 @@ public class AutoExtract implements ActionListener {
JarFile extractJar = new JarFile("extract.jar"); JarFile extractJar = new JarFile("extract.jar");
is = extractJar.getInputStream(extractJar.getJarEntry("license/cpl-v10.html")); is = extractJar.getInputStream(extractJar.getJarEntry("license/cpl-v10.html"));
extractJar.close();
} catch (IOException e) { } catch (IOException e) {
return true; return true;
} }

View File

@ -161,6 +161,7 @@ public class BattlesRunner {
String record; String record;
while ((record = br.readLine()) != null) { while ((record = br.readLine()) != null) {
robots.add(record); robots.add(record);
fr.close();
} }
} catch (IOException e) { } catch (IOException e) {
System.out.println("Battles input file not found ... Aborting"); System.out.println("Battles input file not found ... Aborting");

View File

@ -76,7 +76,9 @@ public class PrepareBattles {
BufferedReader br = null; BufferedReader br = null;
try { try {
FileReader fr = new FileReader(participantsfile);
fr = new FileReader(participantsfile);
br = new BufferedReader(fr); br = new BufferedReader(fr);
String participant; String participant;
@ -101,6 +103,7 @@ public class PrepareBattles {
} }
} }
} }
fr.close();
} catch (IOException e) { } catch (IOException e) {
System.out.println("Participants file not found ... Aborting"); System.out.println("Participants file not found ... Aborting");
System.out.println(e); System.out.println(e);
@ -117,6 +120,7 @@ public class PrepareBattles {
try { try {
outtxt = new PrintStream(new BufferedOutputStream(new FileOutputStream(battlesfile)), false); outtxt = new PrintStream(new BufferedOutputStream(new FileOutputStream(battlesfile)), false);
outtxt.close();
} catch (IOException e) { } catch (IOException e) {
System.out.println("Not able to open battles file " + battlesfile + " ... Aborting"); System.out.println("Not able to open battles file " + battlesfile + " ... Aborting");
System.out.println(e); System.out.println(e);
@ -201,6 +205,7 @@ public class PrepareBattles {
} }
} }
} }
fr.close();
} catch (IOException e) { } catch (IOException e) {
System.out.println("Participants file not found ... Aborting"); System.out.println("Participants file not found ... Aborting");
System.out.println(e); System.out.println(e);
@ -241,6 +246,7 @@ public class PrepareBattles {
} }
} }
} }
fr.close();
} catch (IOException e) { } catch (IOException e) {
System.out.println("Priority battles file not found ... "); System.out.println("Priority battles file not found ... ");
} finally { } finally {

View File

@ -259,6 +259,7 @@ public class BotsDownload {
names.add(name); names.add(name);
} }
} }
fr.close();
} catch (IOException e) { } catch (IOException e) {
System.out.println("Participants file not found ... Aborting"); System.out.println("Participants file not found ... Aborting");
System.out.println(e); System.out.println(e);
@ -299,6 +300,7 @@ public class BotsDownload {
String name = record.substring(0, record.indexOf(",")); String name = record.substring(0, record.indexOf(","));
size.checkCompetitorForSize(name, 1500); size.checkCompetitorForSize(name, 1500);
} }
fr.close();
} catch (IOException e) { } catch (IOException e) {
System.out.println("Battles input file not found ... Aborting"); System.out.println("Battles input file not found ... Aborting");
System.out.println(e); System.out.println(e);
@ -400,6 +402,7 @@ public class BotsDownload {
String version = parameters.getProperty("team.version", ""); String version = parameters.getProperty("team.version", "");
return (botname.equals(botname.substring(0, botname.indexOf(" ")) + " " + version)); return (botname.equals(botname.substring(0, botname.indexOf(" ")) + " " + version));
jarf.close();
} catch (Exception e) { } catch (Exception e) {
System.out.println(e); System.out.println(e);
return false; return false;
@ -487,6 +490,7 @@ public class BotsDownload {
} }
} }
} }
fr.close();
} catch (IOException e) { } catch (IOException e) {
System.out.println("Participants file not found when removing old participants ... Aborting"); System.out.println("Participants file not found when removing old participants ... Aborting");
System.out.println(e); System.out.println(e);

View File

@ -105,6 +105,7 @@ public class ResultsUpload {
results.add(bot2); results.add(bot2);
} }
} }
fr.close();
} catch (IOException e) { } catch (IOException e) {
System.out.println("Can't open result file for upload"); System.out.println("Can't open result file for upload");
return; return;

View File

@ -133,6 +133,7 @@ public class SoundManager implements ISoundManager {
if (m.getClass().getSimpleName().equals(mixerClassName)) { if (m.getClass().getSimpleName().equals(mixerClassName)) {
return m; return m;
} }
m.close();
} }
return null; return null;
} }

View File

@ -228,6 +228,7 @@ public class PreferencesSoundOptionsTab extends WizardPanel {
if (AudioSystem.getMixer(mi).getSourceLineInfo(clipLineInfo).length > 0) { if (AudioSystem.getMixer(mi).getSourceLineInfo(clipLineInfo).length > 0) {
mixers.add(mi); mixers.add(mi);
} }
mi.close();
} }
mixerComboBox = new JComboBox(mixers); mixerComboBox = new JComboBox(mixers);
@ -318,6 +319,7 @@ public class PreferencesSoundOptionsTab extends WizardPanel {
getMixerComboBox().setSelectedItem(mi); getMixerComboBox().setSelectedItem(mi);
break; break;
} }
mi.close();
} }
} }
@ -353,6 +355,7 @@ public class PreferencesSoundOptionsTab extends WizardPanel {
boolean volumeSupported; boolean volumeSupported;
boolean panSupported; boolean panSupported;
mixer.close();
try { try {
Line line = mixer.getLine(lineInfo); Line line = mixer.getLine(lineInfo);