几乎修改了全部阻断问题

This commit is contained in:
zhoudaxia 2016-08-26 20:59:34 +08:00
parent 92e6225590
commit ea887f280b
8 changed files with 14 additions and 11 deletions

View File

@ -609,6 +609,7 @@ public class AutoExtract implements ActionListener {
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
if(out!=null)
out.close(); out.close();
if (file != null) { if (file != null) {
if (!file.delete()) { if (!file.delete()) {

View File

@ -61,7 +61,7 @@ public abstract class BaseRoot implements Serializable, IRepositoryRoot {
public void extractJAR() { public void extractJAR() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj instanceof IRepositoryRoot) { if (obj instanceof IRepositoryRoot) {
return ((IRepositoryRoot) obj).getURL().equals(rootURL); return ((IRepositoryRoot) obj).getURL().equals(rootURL);

View File

@ -109,7 +109,7 @@ public class BattlesRunner {
lastResults = null; lastResults = null;
engine.runBattle(specification, true); engine.runBattle(specification, true);
if (lastResults != null && lastResults.length > 1) { if (lastResults.length > 1) {
dumpResults(outtxt, lastResults, param[param.length - 1], melee); dumpResults(outtxt, lastResults, param[param.length - 1], melee);
} }
} }
@ -157,11 +157,10 @@ public class BattlesRunner {
try { try {
FileReader fr = new FileReader(inputfile); FileReader fr = new FileReader(inputfile);
br = new BufferedReader(fr); br = new BufferedReader(fr);
fr.close();
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

@ -425,6 +425,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);

View File

@ -392,7 +392,7 @@ public class BotsDownload {
InputStream properties = jarf.getInputStream(zipe); InputStream properties = jarf.getInputStream(zipe);
Properties parameters = getProperties(properties); Properties parameters = getProperties(properties);
jarf.close();
if (!isteams.equals("YES")) { if (!isteams.equals("YES")) {
String classname = parameters.getProperty("robot.classname", ""); String classname = parameters.getProperty("robot.classname", "");
String version = parameters.getProperty("robot.version", ""); String version = parameters.getProperty("robot.version", "");
@ -402,7 +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;

View File

@ -50,7 +50,7 @@ public class AlphanumericComparatorTest {
String str1 = unsortedStrings[i]; String str1 = unsortedStrings[i];
String str2 = correctlySortedStrings[i]; String str2 = correctlySortedStrings[i];
if (!(str1 == null && str2 == null) && !str1.equals(str2)) { if (str1!=null&&!(str1 == null && str2 == null) && !str1.equals(str2)) {
sortedCorrectly = false; sortedCorrectly = false;
break; break;
} }

View File

@ -484,6 +484,7 @@ public class JavaDocument extends StyledDocument {
spaceBuffer = new String(chars); spaceBuffer = new String(chars);
} }
// Return a string containing the given number of spaces // Return a string containing the given number of spaces
if(spaceBuffer!=null)
return spaceBuffer.substring(0, count); return spaceBuffer.substring(0, count);
} }

View File

@ -227,8 +227,9 @@ public class PreferencesSoundOptionsTab extends WizardPanel {
for (Mixer.Info mi : mixerInfo) { for (Mixer.Info mi : mixerInfo) {
if (AudioSystem.getMixer(mi).getSourceLineInfo(clipLineInfo).length > 0) { if (AudioSystem.getMixer(mi).getSourceLineInfo(clipLineInfo).length > 0) {
mixers.add(mi); mixers.add(mi);
AudioSystem.getMixer(mi).close();
} }
AudioSystem.getMixer(mi).close();
} }
mixerComboBox = new JComboBox(mixers); mixerComboBox = new JComboBox(mixers);
@ -297,9 +298,8 @@ public class PreferencesSoundOptionsTab extends WizardPanel {
if (mixerInfo != null) { if (mixerInfo != null) {
Mixer mixer = AudioSystem.getMixer((Mixer.Info) getMixerComboBox().getSelectedItem()); Mixer mixer = AudioSystem.getMixer((Mixer.Info) getMixerComboBox().getSelectedItem());
if (mixer != null) {
mixerClassName = mixer.getClass().getSimpleName(); mixerClassName = mixer.getClass().getSimpleName();
}
} }
if (mixerClassName != null) { if (mixerClassName != null) {
props.setOptionsSoundMixer(mixerClassName); props.setOptionsSoundMixer(mixerClassName);
@ -317,9 +317,10 @@ public class PreferencesSoundOptionsTab extends WizardPanel {
for (Mixer.Info mi : AudioSystem.getMixerInfo()) { for (Mixer.Info mi : AudioSystem.getMixerInfo()) {
if (AudioSystem.getMixer(mi).getClass().getSimpleName().equals(mixerName)) { if (AudioSystem.getMixer(mi).getClass().getSimpleName().equals(mixerName)) {
getMixerComboBox().setSelectedItem(mi); getMixerComboBox().setSelectedItem(mi);
AudioSystem.getMixer(mi).close();
break; break;
} }
AudioSystem.getMixer(mi).close();
} }
} }