Compare commits
24 Commits
Author | SHA1 | Date |
---|---|---|
zhoudaxia | c8a60b61ab | |
zhoudaxia | 2abb17fb2a | |
zhoudaxia | a750f517f8 | |
zhoudaxia | 9ea2ce7c39 | |
zhoudaxia | ea56f7703b | |
zhoudaxia | 499629a174 | |
zhoudaxia | 09eb70541f | |
zhoudaxia | 22bca973c9 | |
zhoudaxia | 80aaeb5288 | |
zhoudaxia | 8de83a6245 | |
zhoudaxia | 62c8ddd3f0 | |
zhoudaxia | bccf1bc9b1 | |
zhoudaxia | 52dc88f7e0 | |
zhoudaxia | 07fd4ac9c8 | |
zhoudaxia | 9db2ee6127 | |
zhoudaxia | 923e6a1a58 | |
zhoudaxia | 40d7a56d23 | |
zhoudaxia | e8b545d55a | |
roadfar | d5740acf90 | |
roadfar | e825b1b219 | |
周浩 | 884b71721d | |
zhoudaxia | d974e4b4b4 | |
zhoudaxia | 316f891873 | |
zhoudaxia | 7b06d38064 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,2 +0,0 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.launching.PREF_VM_XML=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>\r\n<vmSettings defaultVM\="57,org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType13,1471573647997" defaultVMConnector\="">\r\n<vmType id\="org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType">\r\n<vm id\="1471573647997" name\="jdk1.6.0_45" path\="C\:\\Program Files\\Java\\jdk1.6.0_45"/>\r\n</vmType>\r\n</vmSettings>\r\n
|
|
@ -1,4 +0,0 @@
|
|||
activeuserprofiles=DESKTOP-SHKMAML;Team
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.rse.systemtype.local.systemType.defaultUserId=Terrans Force
|
||||
useridperkey=DESKTOP-SHKMAML.Local\=Terrans Force;
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
@ -1,29 +0,0 @@
|
|||
INDEX VERSION 1.126+E:\2016Spring\robocodefiles\download\app\workspace_robo4\.metadata\.plugins\org.eclipse.jdt.core
|
||||
3253539546.index
|
||||
240634369.index
|
||||
3357244662.index
|
||||
3837392347.index
|
||||
1270703585.index
|
||||
743580145.index
|
||||
4213330522.index
|
||||
2815204631.index
|
||||
972965919.index
|
||||
649753860.index
|
||||
2097671088.index
|
||||
2394798482.index
|
||||
1886545541.index
|
||||
2420224983.index
|
||||
9299668.index
|
||||
2806151389.index
|
||||
2816454019.index
|
||||
2169288515.index
|
||||
3228954160.index
|
||||
2122446671.index
|
||||
2936589608.index
|
||||
1812437159.index
|
||||
2690281349.index
|
||||
3090911769.index
|
||||
844486800.index
|
||||
195189658.index
|
||||
2555277089.index
|
||||
4256357263.index
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,14 @@
|
|||
Robocode is licensed under the Eclipse Public License v1.0 (EPL), which is available at
|
||||
http://robocode.sourceforge.net/license/epl-v10.html
|
||||
|
||||
Notable exceptions are:
|
||||
-----------------------
|
||||
|
||||
Ant and Maven tools:
|
||||
- Files/tools located under the directory /tools/bin are licensed under the Apache Software Foundation (Apache-2.0):
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
The license files for the Ant and Maven tools are provided under the /tools/licenses directory.
|
||||
|
||||
CILReader.cs:
|
||||
- The file /plugins/dotnet/robocode.dotnet.nhost/src/mono/reflection/CILReader.cs is copyrighted (C) 2009 Novell, Inc.
|
||||
(http://www.novell.com)
|
|
@ -65,7 +65,7 @@ public class Module extends BaseModule {
|
|||
Container.cache.addComponent("robocode.host.vb", DotNetHost.class);
|
||||
Container.cache.addComponent("robocode.host.dotnet", DotNetHost.class);
|
||||
|
||||
} catch (RuntimeException e) {
|
||||
} catch (Throwable e) {
|
||||
Logger.logError(e);
|
||||
throw new Error("Can't initialize .NET Robocode", e);
|
||||
}
|
||||
|
|
|
@ -42,7 +42,6 @@ public class AutoExtract implements ActionListener {
|
|||
JarFile extractJar = new JarFile("extract.jar");
|
||||
|
||||
is = extractJar.getInputStream(extractJar.getJarEntry("license/cpl-v10.html"));
|
||||
extractJar.close();
|
||||
} catch (IOException e) {
|
||||
return true;
|
||||
}
|
||||
|
@ -241,7 +240,7 @@ public class AutoExtract implements ActionListener {
|
|||
// Set native look and feel
|
||||
try {
|
||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
} catch (Exception 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;
|
||||
|
|
|
@ -40,33 +40,33 @@ public class TestMaxTurnRate extends RobocodeTestBed {
|
|||
if (event.getTurnSnapshot().getTurn() == 26) {
|
||||
final String out = buf.toString();
|
||||
|
||||
Assert.assertTrue(out.contains("1: 0.0, 0.0") || out.contains("1: 0.0, -0.0"));
|
||||
Assert.assertTrue(out.contains("2: 0.0, -1.0") || out.contains("2: 0.0, -0.999999999"));
|
||||
Assert.assertTrue(out.contains("3: 0.0, -2.0") || out.contains("3: 0.0, -1.999999999"));
|
||||
Assert.assertTrue(out.contains("4: 0.0, -3.0") || out.contains("4: 0.0, -2.999999999"));
|
||||
Assert.assertTrue(out.contains("5: 0.0, -4.0") || out.contains("5: 0.0, -3.999999999"));
|
||||
Assert.assertTrue(out.contains("6: 0.0, -5.0") || out.contains("6: 0.0, -4.999999999"));
|
||||
Assert.assertTrue(out.contains("7: 0.0, -6.0") || out.contains("7: 0.0, -5.999999999"));
|
||||
Assert.assertTrue(out.contains("8: 0.0, -7.0") || out.contains("8: 0.0, -6.999999999"));
|
||||
Assert.assertTrue(out.contains("9: 0.0, -8.0") || out.contains("9: 0.0, -7.999999999"));
|
||||
Assert.assertTrue(out.contains("10: 0.0, -9.0") || out.contains("10: 0.0, -8.999999999"));
|
||||
Assert.assertTrue(out.contains("11: 0.0, -10.0") || out.contains("11: 0.0, -9.999999999"));
|
||||
Assert.assertTrue(out.contains("12: 0.0, -10.0") || out.contains("12: 0.0, -9.999999999"));
|
||||
Assert.assertTrue(out.contains("13: 0.0, -10.0") || out.contains("13: 0.0, -9.999999999"));
|
||||
Assert.assertTrue(out.contains("1: 0.0, 0.0") | out.contains("1: 0.0, -0.0"));
|
||||
Assert.assertTrue(out.contains("2: 0.0, -1.0") | out.contains("2: 0.0, -0.999999999"));
|
||||
Assert.assertTrue(out.contains("3: 0.0, -2.0") | out.contains("3: 0.0, -1.999999999"));
|
||||
Assert.assertTrue(out.contains("4: 0.0, -3.0") | out.contains("4: 0.0, -2.999999999"));
|
||||
Assert.assertTrue(out.contains("5: 0.0, -4.0") | out.contains("5: 0.0, -3.999999999"));
|
||||
Assert.assertTrue(out.contains("6: 0.0, -5.0") | out.contains("6: 0.0, -4.999999999"));
|
||||
Assert.assertTrue(out.contains("7: 0.0, -6.0") | out.contains("7: 0.0, -5.999999999"));
|
||||
Assert.assertTrue(out.contains("8: 0.0, -7.0") | out.contains("8: 0.0, -6.999999999"));
|
||||
Assert.assertTrue(out.contains("9: 0.0, -8.0") | out.contains("9: 0.0, -7.999999999"));
|
||||
Assert.assertTrue(out.contains("10: 0.0, -9.0") | out.contains("10: 0.0, -8.999999999"));
|
||||
Assert.assertTrue(out.contains("11: 0.0, -10.0") | out.contains("11: 0.0, -9.999999999"));
|
||||
Assert.assertTrue(out.contains("12: 0.0, -10.0") | out.contains("12: 0.0, -9.999999999"));
|
||||
Assert.assertTrue(out.contains("13: 0.0, -10.0") | out.contains("13: 0.0, -9.999999999"));
|
||||
|
||||
Assert.assertTrue(out.contains("14: 0.0, 0.0") || out.contains("14: 0.0, -0.0"));
|
||||
Assert.assertTrue(out.contains("15: 0.0, 1.0") || out.contains("15: 0.0, 0.999999999"));
|
||||
Assert.assertTrue(out.contains("16: 0.0, 2.0") || out.contains("16: 0.0, 1.999999999"));
|
||||
Assert.assertTrue(out.contains("17: 0.0, 3.0") || out.contains("17: 0.0, 2.999999999"));
|
||||
Assert.assertTrue(out.contains("18: 0.0, 4.0") || out.contains("18: 0.0, 3.999999999"));
|
||||
Assert.assertTrue(out.contains("19: 0.0, 5.0") || out.contains("19: 0.0, 4.999999999"));
|
||||
Assert.assertTrue(out.contains("20: 0.0, 6.0") || out.contains("20: 0.0, 5.999999999"));
|
||||
Assert.assertTrue(out.contains("21: 0.0, 7.0") || out.contains("21: 0.0, 6.999999999"));
|
||||
Assert.assertTrue(out.contains("22: 0.0, 8.0") || out.contains("22: 0.0, 7.999999999"));
|
||||
Assert.assertTrue(out.contains("23: 0.0, 9.0") || out.contains("23: 0.0, 8.999999999"));
|
||||
Assert.assertTrue(out.contains("24: 0.0, 10.0") || out.contains("24: 0.0, 9.999999999"));
|
||||
Assert.assertTrue(out.contains("25: 0.0, 10.0") || out.contains("25: 0.0, 9.999999999"));
|
||||
Assert.assertTrue(out.contains("26: 0.0, 10.0") || out.contains("26: 0.0, 9.999999999"));
|
||||
Assert.assertTrue(out.contains("14: 0.0, 0.0") | out.contains("14: 0.0, -0.0"));
|
||||
Assert.assertTrue(out.contains("15: 0.0, 1.0") | out.contains("15: 0.0, 0.999999999"));
|
||||
Assert.assertTrue(out.contains("16: 0.0, 2.0") | out.contains("16: 0.0, 1.999999999"));
|
||||
Assert.assertTrue(out.contains("17: 0.0, 3.0") | out.contains("17: 0.0, 2.999999999"));
|
||||
Assert.assertTrue(out.contains("18: 0.0, 4.0") | out.contains("18: 0.0, 3.999999999"));
|
||||
Assert.assertTrue(out.contains("19: 0.0, 5.0") | out.contains("19: 0.0, 4.999999999"));
|
||||
Assert.assertTrue(out.contains("20: 0.0, 6.0") | out.contains("20: 0.0, 5.999999999"));
|
||||
Assert.assertTrue(out.contains("21: 0.0, 7.0") | out.contains("21: 0.0, 6.999999999"));
|
||||
Assert.assertTrue(out.contains("22: 0.0, 8.0") | out.contains("22: 0.0, 7.999999999"));
|
||||
Assert.assertTrue(out.contains("23: 0.0, 9.0") | out.contains("23: 0.0, 8.999999999"));
|
||||
Assert.assertTrue(out.contains("24: 0.0, 10.0") | out.contains("24: 0.0, 9.999999999"));
|
||||
Assert.assertTrue(out.contains("25: 0.0, 10.0") | out.contains("25: 0.0, 9.999999999"));
|
||||
Assert.assertTrue(out.contains("26: 0.0, 10.0") | out.contains("26: 0.0, 9.999999999"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,6 @@ public class AutoExtract implements ActionListener {
|
|||
JarFile extractJar = new JarFile("extract.jar");
|
||||
|
||||
is = extractJar.getInputStream(extractJar.getJarEntry("license/cpl-v10.html"));
|
||||
extractFJar.close();
|
||||
} catch (IOException e) {
|
||||
return true;
|
||||
}
|
||||
|
@ -247,11 +246,11 @@ 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 installDir = null;
|
||||
File suggestedDir;s
|
||||
File suggestedDir;
|
||||
|
||||
AutoExtract extractor = new AutoExtract();
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ public class HiddenAccess {
|
|||
System.exit(-1);
|
||||
} catch (MalformedURLException e) {
|
||||
Logger.logError(e);
|
||||
} catch (MyException e) {
|
||||
} catch (Error e) {
|
||||
Logger.logError(e);
|
||||
throw e;
|
||||
}
|
||||
|
|
|
@ -103,38 +103,38 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
|||
*
|
||||
* @see #fieldWidth
|
||||
*/
|
||||
public static final int fieldWidth;
|
||||
public int fieldWidth;
|
||||
|
||||
/**
|
||||
* Contains the height of the battlefield.
|
||||
*
|
||||
* @see #fieldWidth
|
||||
*/
|
||||
public static final int fieldHeight;
|
||||
public int fieldHeight;
|
||||
|
||||
/**
|
||||
* Current number of other robots on the battle field.
|
||||
*/
|
||||
public static final int others;
|
||||
public int others;
|
||||
|
||||
/**
|
||||
* Current energy of this robot, where 100 means full energy and 0 means no energy (dead).
|
||||
*/
|
||||
public static final int energy;
|
||||
public int energy;
|
||||
|
||||
/**
|
||||
* Current horizontal location of this robot (in pixels).
|
||||
*
|
||||
* @see #robotY
|
||||
*/
|
||||
public static final int robotX;
|
||||
public int robotX;
|
||||
|
||||
/**
|
||||
* Current vertical location of this robot (in pixels).
|
||||
*
|
||||
* @see #robotX
|
||||
*/
|
||||
public static final int robotY;
|
||||
public int robotY;
|
||||
|
||||
/**
|
||||
* Current heading angle of this robot (in degrees).
|
||||
|
@ -147,7 +147,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
|||
* @see #turnBackLeft(int, int)
|
||||
* @see #turnBackRight(int, int)
|
||||
*/
|
||||
public static final int heading;
|
||||
public int heading;
|
||||
|
||||
/**
|
||||
* Current gun heading angle of this robot (in degrees).
|
||||
|
@ -158,7 +158,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
|||
* @see #turnGunTo(int)
|
||||
* @see #bearGunTo(int)
|
||||
*/
|
||||
public static final int gunHeading;
|
||||
public int gunHeading;
|
||||
|
||||
/**
|
||||
* Current gun heading angle of this robot compared to its body (in degrees).
|
||||
|
@ -169,7 +169,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
|||
* @see #turnGunTo(int)
|
||||
* @see #bearGunTo(int)
|
||||
*/
|
||||
public static final int gunBearing;
|
||||
public int gunBearing;
|
||||
|
||||
/**
|
||||
* Flag specifying if the gun is ready to fire, i.e. gun heat <= 0.
|
||||
|
@ -179,7 +179,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
|||
* @see #fire()
|
||||
* @see #fire(double)
|
||||
*/
|
||||
public static final boolean gunReady;
|
||||
public boolean gunReady;
|
||||
|
||||
/**
|
||||
* Current distance to the scanned nearest other robot (in pixels).
|
||||
|
@ -193,7 +193,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
|||
* @see #scannedVelocity
|
||||
* @see #scannedHeading
|
||||
*/
|
||||
public static final int scannedDistance = -1;
|
||||
public int scannedDistance = -1;
|
||||
|
||||
/**
|
||||
* Current angle to the scanned nearest other robot (in degrees).
|
||||
|
@ -207,7 +207,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
|||
* @see #scannedVelocity
|
||||
* @see #scannedHeading
|
||||
*/
|
||||
public static final int scannedAngle = -1;
|
||||
public int scannedAngle = -1;
|
||||
|
||||
/**
|
||||
* Current angle to the scanned nearest other robot (in degrees) compared to
|
||||
|
@ -222,7 +222,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
|||
* @see #scannedVelocity
|
||||
* @see #scannedHeading
|
||||
*/
|
||||
public static final int scannedBearing = -1;
|
||||
public int scannedBearing = -1;
|
||||
|
||||
/**
|
||||
* Current velocity of the scanned nearest other robot.
|
||||
|
@ -239,7 +239,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
|||
* @see #scannedEnergy
|
||||
* @see #scannedHeading
|
||||
*/
|
||||
public static final int scannedVelocity = -99;
|
||||
public int scannedVelocity = -99;
|
||||
|
||||
/**
|
||||
* Current heading of the scanned nearest other robot (in degrees).
|
||||
|
@ -253,7 +253,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
|||
* @see #scannedEnergy
|
||||
* @see #scannedVelocity
|
||||
*/
|
||||
public static final int scannedHeading = -1;
|
||||
public int scannedHeading = -1;
|
||||
|
||||
/**
|
||||
* Current energy of scanned nearest other robot.
|
||||
|
@ -266,7 +266,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
|||
* @see #scannedBearing
|
||||
* @see #scannedVelocity
|
||||
*/
|
||||
public static final int scannedEnergy = -1;
|
||||
public int scannedEnergy = -1;
|
||||
|
||||
/**
|
||||
* Latest angle from where this robot was hit by a bullet (in degrees).
|
||||
|
@ -276,7 +276,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
|||
* @see #onHitByBullet()
|
||||
* @see #hitByBulletBearing
|
||||
*/
|
||||
public static final int hitByBulletAngle = -1;
|
||||
public int hitByBulletAngle = -1;
|
||||
|
||||
/**
|
||||
* Latest angle from where this robot was hit by a bullet (in degrees)
|
||||
|
@ -287,7 +287,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
|||
* @see #onHitByBullet()
|
||||
* @see #hitByBulletAngle
|
||||
*/
|
||||
public static final int hitByBulletBearing = -1;
|
||||
public int hitByBulletBearing = -1;
|
||||
|
||||
/**
|
||||
* Latest angle where this robot has hit another robot (in degrees).
|
||||
|
@ -297,7 +297,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
|||
* @see #onHitRobot()
|
||||
* @see #hitRobotBearing
|
||||
*/
|
||||
public static final int hitRobotAngle = -1;
|
||||
public int hitRobotAngle = -1;
|
||||
|
||||
/**
|
||||
* Latest angle where this robot has hit another robot (in degrees)
|
||||
|
@ -308,7 +308,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
|||
* @see #onHitRobot()
|
||||
* @see #hitRobotAngle
|
||||
*/
|
||||
public static final int hitRobotBearing = -1;
|
||||
public int hitRobotBearing = -1;
|
||||
|
||||
/**
|
||||
* Latest angle where this robot has hit a wall (in degrees).
|
||||
|
@ -318,7 +318,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
|||
* @see #onHitWall()
|
||||
* @see #hitWallBearing
|
||||
*/
|
||||
public static final int hitWallAngle = -1;
|
||||
public int hitWallAngle = -1;
|
||||
|
||||
/**
|
||||
* Latest angle where this robot has hit a wall (in degrees)
|
||||
|
@ -329,7 +329,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
|||
* @see #onHitWall()
|
||||
* @see #hitWallAngle
|
||||
*/
|
||||
public static final int hitWallBearing = -1;
|
||||
public int hitWallBearing = -1;
|
||||
|
||||
/**
|
||||
* The robot event handler for this robot.
|
||||
|
@ -898,9 +898,9 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
|||
// Make sure that we rescan if the robot did not execute anything this turn.
|
||||
// When the robot executes the currentTurn will automatically be increased by 1,
|
||||
// So when the turn stays the same, the robot did not take any action this turn.
|
||||
|
||||
if (lastTurn == currentTurn) {
|
||||
peer.rescan(); // Spend a turn on rescanning
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -165,7 +165,7 @@ public final class RobotPeer implements IRobotPeerBattle, IRobotPeer {
|
|||
teamMembers = null;
|
||||
isTeamLeader = false;
|
||||
teamIndex = -1; // Must be set to -1 when robot is not in a team
|
||||
} else if(team != null){
|
||||
} else {
|
||||
teamName = team.getName();
|
||||
teamMembers = team.getMemberNames();
|
||||
isTeamLeader = team.size() == 1; // That is current team size, more might follow later. First robot is leader
|
||||
|
|
|
@ -379,7 +379,7 @@ public class RecordManager implements IRecordManager {
|
|||
fos.flush();
|
||||
}
|
||||
}
|
||||
if (isxml&&xwr!=null) {
|
||||
if (isxml) {
|
||||
xwr.endElement(); // turns
|
||||
xwr.endElement(); // record
|
||||
osw.flush();
|
||||
|
|
|
@ -46,7 +46,7 @@ public class BattleEventDispatcher implements IBattleListener {
|
|||
for (IBattleListener listener : listeners) {
|
||||
try {
|
||||
listener.onBattleStarted(event);
|
||||
} catch (RuntimeException ex) {
|
||||
} catch (Throwable ex) {
|
||||
logError("onBattleStarted " + listener.getClass(), ex);
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ public class BattleEventDispatcher implements IBattleListener {
|
|||
for (IBattleListener listener : listeners) {
|
||||
try {
|
||||
listener.onBattleCompleted(event);
|
||||
} catch (RuntimeException ex) {
|
||||
} catch (Throwable ex) {
|
||||
logError("onBattleCompleted " + listener.getClass(), ex);
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ public class BattleEventDispatcher implements IBattleListener {
|
|||
for (IBattleListener listener : listeners) {
|
||||
try {
|
||||
listener.onBattleFinished(event);
|
||||
} catch (RuntimeException ex) {
|
||||
} catch (Throwable ex) {
|
||||
logError("onBattleFinished " + listener.getClass(), ex);
|
||||
}
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ public class BattleEventDispatcher implements IBattleListener {
|
|||
for (IBattleListener listener : listeners) {
|
||||
try {
|
||||
listener.onBattlePaused(event);
|
||||
} catch (RuntimeException ex) {
|
||||
} catch (Throwable ex) {
|
||||
logError("onBattlePaused " + listener.getClass(), ex);
|
||||
}
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ public class BattleEventDispatcher implements IBattleListener {
|
|||
for (IBattleListener listener : listeners) {
|
||||
try {
|
||||
listener.onBattleResumed(event);
|
||||
} catch (RuntimeException ex) {
|
||||
} catch (Throwable ex) {
|
||||
logError("onBattleResumed " + listener.getClass(), ex);
|
||||
}
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ public class BattleEventDispatcher implements IBattleListener {
|
|||
for (IBattleListener listener : listeners) {
|
||||
try {
|
||||
listener.onRoundStarted(event);
|
||||
} catch (RuntimeException ex) {
|
||||
} catch (Throwable ex) {
|
||||
logError("onRoundStarted " + listener.getClass(), ex);
|
||||
}
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ public class BattleEventDispatcher implements IBattleListener {
|
|||
for (IBattleListener listener : listeners) {
|
||||
try {
|
||||
listener.onRoundEnded(event);
|
||||
} catch (RuntimeException ex) {
|
||||
} catch (Throwable ex) {
|
||||
logError("onRoundEnded " + listener.getClass(), ex);
|
||||
}
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ public class BattleEventDispatcher implements IBattleListener {
|
|||
for (IBattleListener listener : listeners) {
|
||||
try {
|
||||
listener.onTurnStarted(event);
|
||||
} catch (RuntimeException ex) {
|
||||
} catch (Throwable ex) {
|
||||
logError("onTurnStarted " + listener.getClass(), ex);
|
||||
}
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ public class BattleEventDispatcher implements IBattleListener {
|
|||
for (IBattleListener listener : listeners) {
|
||||
try {
|
||||
listener.onTurnEnded(event);
|
||||
} catch (RuntimeException ex) {
|
||||
} catch (Throwable ex) {
|
||||
logError("onTurnEnded " + listener.getClass(), ex);
|
||||
}
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ public class BattleEventDispatcher implements IBattleListener {
|
|||
for (IBattleListener listener : listeners) {
|
||||
try {
|
||||
listener.onBattleMessage(event);
|
||||
} catch (RuntimeException ex) {
|
||||
} catch (Throwable ex) {
|
||||
logError("onBattleMessage " + listener.getClass(), ex);
|
||||
}
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ public class BattleEventDispatcher implements IBattleListener {
|
|||
for (IBattleListener listener : listeners) {
|
||||
try {
|
||||
listener.onBattleError(event);
|
||||
} catch (RuntimeException ex) {
|
||||
} catch (Throwable ex) {
|
||||
Logger.realErr.println(listener.getClass() + " " + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -171,7 +171,7 @@ public final class RobocodeMain extends RobocodeMainBase {
|
|||
System.exit(8);
|
||||
}
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
} catch (Throwable e) {
|
||||
Logger.logError(e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -309,13 +309,10 @@ public final class RobotStatics implements IRobotStatics, Serializable {
|
|||
int index = serializer.deserializeInt(buffer);
|
||||
int contestantIndex = serializer.deserializeInt(buffer);
|
||||
|
||||
if(teammates!=null)
|
||||
return new RobotStatics(robocodeVersion, isJuniorRobot, isInteractiveRobot, isPaintRobot, isAdvancedRobot,
|
||||
isTeamRobot, isTeamLeader, isDroid, isSentryRobot, name, shortName, veryShortName, fullClassName,
|
||||
shortClassName, battleRules, teammates.toArray(new String[teammates.size()]), teamName, index,
|
||||
contestantIndex);
|
||||
else
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -160,7 +160,7 @@ public final class VersionManager implements IVersionManager {
|
|||
version = versionFileLineToVersion(versionString);
|
||||
} catch (Exception ignore) {}
|
||||
}
|
||||
if (version!=null&&version.equals(UNKNOWN_VERSION)) {
|
||||
if (version.equals(UNKNOWN_VERSION)) {
|
||||
logWarning("Getting version from file");
|
||||
return getVersionFromFile();
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ public class JavaHost implements IHost {
|
|||
}
|
||||
return checkInterfaces(robotClass, robotItem);
|
||||
|
||||
} catch (RuntimeException t) {
|
||||
} catch (Throwable t) {
|
||||
if (message) {
|
||||
logError("Got an error with " + robotItem.getFullClassName() + ": " + t); // just message here
|
||||
if (t.getMessage() != null && t.getMessage().contains("Bad version number in .class file")) {
|
||||
|
|
|
@ -382,7 +382,7 @@ public final class EventManager implements IEventManager {
|
|||
} catch (RuntimeException e) {
|
||||
currentTopEvent = null;
|
||||
throw e;
|
||||
} catch (MyException e) {
|
||||
} catch (Error e) {
|
||||
currentTopEvent = null;
|
||||
throw e;
|
||||
} finally {
|
||||
|
|
|
@ -157,7 +157,7 @@ abstract class HostingRobotProxy implements IHostingRobotProxy, IHostedThread {
|
|||
private void loadClassBattle() {
|
||||
try {
|
||||
robotClassLoader.loadRobotMainClass(true);
|
||||
} catch (RuntimeException e) {
|
||||
} catch (Throwable e) {
|
||||
println("SYSTEM: Could not load " + statics.getName() + " : ");
|
||||
println(e);
|
||||
drainEnergy();
|
||||
|
@ -183,7 +183,7 @@ abstract class HostingRobotProxy implements IHostingRobotProxy, IHostedThread {
|
|||
robot = null;
|
||||
logError(e);
|
||||
return false;
|
||||
} catch (RuntimeException e) {
|
||||
} catch (Throwable e) {
|
||||
println("SYSTEM: An error occurred during initialization of " + statics.getName());
|
||||
println("SYSTEM: " + e);
|
||||
println(e);
|
||||
|
@ -247,7 +247,7 @@ abstract class HostingRobotProxy implements IHostingRobotProxy, IHostedThread {
|
|||
println(e);
|
||||
logMessage(statics.getName() + " stopped successfully.");
|
||||
throw e; // must be re-thrown in order to stop the thread
|
||||
} catch (RuntimeException t) {
|
||||
} catch (Throwable t) {
|
||||
drainEnergy();
|
||||
println(t);
|
||||
logMessage(statics.getName() + ": Throwable: " + t); // without stack here
|
||||
|
|
|
@ -244,7 +244,7 @@ public class RobotClassLoader extends URLClassLoader implements IRobotClassLoade
|
|||
} else {
|
||||
warnIfStaticRobotInstanceFields();
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
} catch (Throwable e) {
|
||||
robotClass = null;
|
||||
throw new ClassNotFoundException(e.getMessage(), e);
|
||||
}
|
||||
|
@ -289,7 +289,7 @@ public class RobotClassLoader extends URLClassLoader implements IRobotClassLoade
|
|||
}
|
||||
}
|
||||
}
|
||||
} catch (RuntimeException t) {
|
||||
} catch (Throwable t) {
|
||||
Logger.logError(t);
|
||||
}
|
||||
}
|
||||
|
@ -305,7 +305,7 @@ public class RobotClassLoader extends URLClassLoader implements IRobotClassLoade
|
|||
Class<?> type = null;
|
||||
try {
|
||||
type = loadRobotClassLocaly(className, false);
|
||||
} catch (RuntimeException t) {
|
||||
} catch (Throwable t) {
|
||||
continue;
|
||||
}
|
||||
if (type != null) {
|
||||
|
@ -366,7 +366,7 @@ public class RobotClassLoader extends URLClassLoader implements IRobotClassLoade
|
|||
modifiersField.setInt(field, modifiers & ~Modifier.FINAL); // Remove the FINAL modifier
|
||||
field.set(null, null);
|
||||
|
||||
} catch (RuntimeException ignore) {}
|
||||
} catch (Throwable ignore) {}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -383,7 +383,7 @@ public class RobotClassLoader extends URLClassLoader implements IRobotClassLoade
|
|||
for (Field field: type.getDeclaredFields()) {
|
||||
fields.add(field);
|
||||
}
|
||||
} catch (RuntimeException ignore) {// NoClassDefFoundError does occur with some robots, e.g. sgp.Drunken [1.12]
|
||||
} catch (Throwable ignore) {// NoClassDefFoundError does occur with some robots, e.g. sgp.Drunken [1.12]
|
||||
// We ignore all exceptions and errors here so we can proceed to retrieve
|
||||
// field from super classes.
|
||||
}
|
||||
|
|
|
@ -68,6 +68,5 @@ public class JarJarTest {
|
|||
ClassLoader ucl = new URLClassLoader(new URL[] { u});
|
||||
|
||||
ucl.loadClass(clas);
|
||||
ucl.close();
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -68,7 +68,6 @@ public class AutoExtract implements ActionListener {
|
|||
JarFile extractJar = new JarFile("extract.jar");
|
||||
|
||||
is = extractJar.getInputStream(extractJar.getJarEntry("license/cpl-v10.html"));
|
||||
extractJar.close();
|
||||
} catch (IOException e) {
|
||||
return true;
|
||||
}
|
||||
|
@ -338,7 +337,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
|
||||
}
|
||||
|
||||
AutoExtract extractor = new AutoExtract();
|
||||
|
@ -609,6 +608,9 @@ public class AutoExtract implements ActionListener {
|
|||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (out != null) {
|
||||
out.close();
|
||||
}
|
||||
if (file != null) {
|
||||
if (!file.delete()) {
|
||||
System.err.println("Could not delete the file: " + file);
|
||||
|
|
|
@ -72,7 +72,6 @@ public abstract class RepositoryItem implements IRepositoryItem, Serializable {
|
|||
if (itemUrl == null && other.itemUrl != null) {
|
||||
return false;
|
||||
}
|
||||
if (itemUrl != null)
|
||||
return itemUrl.equals(other.itemUrl);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,7 +62,6 @@ public abstract class BaseRoot implements Serializable, IRepositoryRoot {
|
|||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof IRepositoryRoot) {
|
||||
return ((IRepositoryRoot) obj).getURL().equals(rootURL);
|
||||
|
|
|
@ -107,9 +107,9 @@ public class BattlesRunner {
|
|||
final BattleSpecification specification = new BattleSpecification(battle.getNumRounds(),
|
||||
battle.getBattlefield(), robotsList);
|
||||
|
||||
|
||||
lastResults = null;
|
||||
engine.runBattle(specification, true);
|
||||
if (lastResults.length > 1) {
|
||||
if (lastResults != null && lastResults.length > 1) {
|
||||
dumpResults(outtxt, lastResults, param[param.length - 1], melee);
|
||||
}
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ public class BattlesRunner {
|
|||
try {
|
||||
FileReader fr = new FileReader(inputfile);
|
||||
br = new BufferedReader(fr);
|
||||
fr.close();
|
||||
|
||||
String record;
|
||||
while ((record = br.readLine()) != null) {
|
||||
robots.add(record);
|
||||
|
|
|
@ -76,9 +76,7 @@ public class PrepareBattles {
|
|||
BufferedReader br = null;
|
||||
|
||||
try {
|
||||
|
||||
|
||||
fr = new FileReader(participantsfile);
|
||||
FileReader fr = new FileReader(participantsfile);
|
||||
|
||||
br = new BufferedReader(fr);
|
||||
String participant;
|
||||
|
@ -103,7 +101,6 @@ public class PrepareBattles {
|
|||
}
|
||||
}
|
||||
}
|
||||
fr.close();
|
||||
} catch (IOException e) {
|
||||
System.out.println("Participants file not found ... Aborting");
|
||||
System.out.println(e);
|
||||
|
@ -120,7 +117,6 @@ public class PrepareBattles {
|
|||
|
||||
try {
|
||||
outtxt = new PrintStream(new BufferedOutputStream(new FileOutputStream(battlesfile)), false);
|
||||
outtxt.close();
|
||||
} catch (IOException e) {
|
||||
System.out.println("Not able to open battles file " + battlesfile + " ... Aborting");
|
||||
System.out.println(e);
|
||||
|
@ -205,7 +201,6 @@ public class PrepareBattles {
|
|||
}
|
||||
}
|
||||
}
|
||||
fr.close();
|
||||
} catch (IOException e) {
|
||||
System.out.println("Participants file not found ... Aborting");
|
||||
System.out.println(e);
|
||||
|
@ -246,7 +241,6 @@ public class PrepareBattles {
|
|||
}
|
||||
}
|
||||
}
|
||||
fr.close();
|
||||
} catch (IOException e) {
|
||||
System.out.println("Priority battles file not found ... ");
|
||||
} finally {
|
||||
|
@ -425,7 +419,6 @@ public class PrepareBattles {
|
|||
}
|
||||
}
|
||||
}
|
||||
fr.close();
|
||||
} catch (IOException e) {
|
||||
System.out.println("Participants file not found ... Aborting");
|
||||
System.out.println(e);
|
||||
|
|
|
@ -259,7 +259,6 @@ public class BotsDownload {
|
|||
names.add(name);
|
||||
}
|
||||
}
|
||||
fr.close();
|
||||
} catch (IOException e) {
|
||||
System.out.println("Participants file not found ... Aborting");
|
||||
System.out.println(e);
|
||||
|
@ -300,7 +299,6 @@ public class BotsDownload {
|
|||
String name = record.substring(0, record.indexOf(","));
|
||||
size.checkCompetitorForSize(name, 1500);
|
||||
}
|
||||
fr.close();
|
||||
} catch (IOException e) {
|
||||
System.out.println("Battles input file not found ... Aborting");
|
||||
System.out.println(e);
|
||||
|
@ -392,7 +390,7 @@ public class BotsDownload {
|
|||
InputStream properties = jarf.getInputStream(zipe);
|
||||
|
||||
Properties parameters = getProperties(properties);
|
||||
jarf.close();
|
||||
|
||||
if (!isteams.equals("YES")) {
|
||||
String classname = parameters.getProperty("robot.classname", "");
|
||||
String version = parameters.getProperty("robot.version", "");
|
||||
|
@ -402,7 +400,6 @@ public class BotsDownload {
|
|||
String version = parameters.getProperty("team.version", "");
|
||||
|
||||
return (botname.equals(botname.substring(0, botname.indexOf(" ")) + " " + version));
|
||||
|
||||
} catch (Exception e) {
|
||||
System.out.println(e);
|
||||
return false;
|
||||
|
@ -490,7 +487,6 @@ public class BotsDownload {
|
|||
}
|
||||
}
|
||||
}
|
||||
fr.close();
|
||||
} catch (IOException e) {
|
||||
System.out.println("Participants file not found when removing old participants ... Aborting");
|
||||
System.out.println(e);
|
||||
|
|
|
@ -204,7 +204,7 @@ public class FileTransfer {
|
|||
if (conn != null) {
|
||||
conn.disconnect();
|
||||
}
|
||||
} catch (RuntimeException ignore) {// we expect this, right ?
|
||||
} catch (Throwable ignore) {// we expect this, right ?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,7 +105,6 @@ public class ResultsUpload {
|
|||
results.add(bot2);
|
||||
}
|
||||
}
|
||||
fr.close();
|
||||
} catch (IOException e) {
|
||||
System.out.println("Can't open result file for upload");
|
||||
return;
|
||||
|
|
|
@ -73,7 +73,6 @@ public class UpdateRatingFiles {
|
|||
while ((record = br.readLine()) != null) {
|
||||
battles.add(record);
|
||||
}
|
||||
fr.close();
|
||||
} catch (IOException e) {
|
||||
System.out.println("Can't open # battles file ... Aborting # battles update");
|
||||
return false;
|
||||
|
|
|
@ -133,7 +133,6 @@ public class SoundManager implements ISoundManager {
|
|||
if (m.getClass().getSimpleName().equals(mixerClassName)) {
|
||||
return m;
|
||||
}
|
||||
m.close();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ public class AwtAttack extends AdvancedRobot {
|
|||
};
|
||||
|
||||
javax.swing.SwingUtilities.invokeLater(doHack);
|
||||
} catch (RuntimeException e) {
|
||||
} catch (Throwable e) {
|
||||
// swalow security exception
|
||||
e.printStackTrace(out);
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ public class AwtAttack extends AdvancedRobot {
|
|||
e.printStackTrace(out);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace(out);
|
||||
} catch (RuntimeException e) {
|
||||
} catch (Throwable e) {
|
||||
// swalow security exception
|
||||
e.printStackTrace(out);
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ public class ConstructorAwtAttack extends robocode.AdvancedRobot {
|
|||
};
|
||||
|
||||
javax.swing.SwingUtilities.invokeLater(doHack);
|
||||
} catch (RuntimeException e) {
|
||||
} catch (Throwable e) {
|
||||
// swallow security exception
|
||||
e.printStackTrace(out);
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public class ConstructorAwtAttack extends robocode.AdvancedRobot {
|
|||
e.printStackTrace(out);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace(out);
|
||||
} catch (RuntimeException e) {
|
||||
} catch (Throwable e) {
|
||||
// swallow security exception
|
||||
e.printStackTrace(out);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ public class ConstructorThreadAttack extends robocode.AdvancedRobot {
|
|||
Thread t = new Thread(a);
|
||||
|
||||
t.start();
|
||||
} catch (RuntimeException e) {
|
||||
} catch (Throwable e) {
|
||||
// swallow security exception
|
||||
e.printStackTrace(out);
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ public class ConstructorThreadAttack extends robocode.AdvancedRobot {
|
|||
Thread t = new Thread(tg, a);
|
||||
|
||||
t.start();
|
||||
} catch (RuntimeException e) {
|
||||
} catch (Throwable e) {
|
||||
// swallow security exception
|
||||
e.printStackTrace(out);
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ public class FileAttack extends AdvancedRobot {
|
|||
e.printStackTrace(out);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace(out);
|
||||
} catch (RuntimeException e) {
|
||||
} catch (Throwable e) {
|
||||
// swalow security exception
|
||||
e.printStackTrace(out);
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ public class FileAttack extends AdvancedRobot {
|
|||
e.printStackTrace(out);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace(out);
|
||||
} catch (RuntimeException e) {
|
||||
} catch (Throwable e) {
|
||||
// swalow security exception
|
||||
e.printStackTrace(out);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public class IncludeNamespaceAttack extends AdvancedRobot {
|
|||
private void namespaceAttack() {
|
||||
try {
|
||||
HiddenAccess.createRules(10, 10, 10, 10, 1, false, 100);
|
||||
} catch (RuntimeException e) {
|
||||
} catch (Throwable e) {
|
||||
// Swallow security exception
|
||||
e.printStackTrace(out);
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ public class ThreadAttack extends AdvancedRobot {
|
|||
Thread t = new Thread(a);
|
||||
|
||||
t.start();
|
||||
} catch (RuntimeException e) {
|
||||
} catch (Throwable e) {
|
||||
// swallow security exception
|
||||
e.printStackTrace(out);
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ public class ThreadAttack extends AdvancedRobot {
|
|||
Thread t = new Thread(tg, a);
|
||||
|
||||
t.start();
|
||||
} catch (RuntimeException e) {
|
||||
} catch (Throwable e) {
|
||||
// swallow security exception
|
||||
e.printStackTrace(out);
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public class ThreadGroupAttack extends Robot {
|
|||
}
|
||||
}
|
||||
}).start();
|
||||
} catch (RuntimeException t) {
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace(out);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ public class UndeadThread extends AdvancedRobot {
|
|||
while (true) {
|
||||
try {
|
||||
body();
|
||||
} catch (RuntimeException t) {
|
||||
} catch (Throwable t) {
|
||||
// spamming the console
|
||||
out.println("Swalowed it, HA HA HA HA HAAAAA !!!!!");
|
||||
out.println(t);
|
||||
|
|
|
@ -22,7 +22,7 @@ public class Assert extends org.junit.Assert {
|
|||
public static void allAssertNear(double v1, double v2) {
|
||||
try {
|
||||
assertNear(v1, v2);
|
||||
} catch (RuntimeException ex) {
|
||||
} catch (Throwable ex) {
|
||||
ex.printStackTrace(System.err);
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public class Assert extends org.junit.Assert {
|
|||
public static <T> void allAssertThat(T t, org.hamcrest.Matcher<T> tMatcher) {
|
||||
try {
|
||||
org.junit.Assert.assertThat(t, tMatcher);
|
||||
} catch (RuntimeException ex) {
|
||||
} catch (Throwable ex) {
|
||||
ex.printStackTrace(System.err);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,10 +50,10 @@ public class AlphanumericComparatorTest {
|
|||
String str1 = unsortedStrings[i];
|
||||
String str2 = correctlySortedStrings[i];
|
||||
|
||||
|
||||
if (!(str1 == null && str2 == null) && !str1.equals(str2)) {
|
||||
sortedCorrectly = false;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
Assert.assertTrue(sortedCorrectly);
|
||||
}
|
||||
|
|
|
@ -146,7 +146,7 @@ public class EditWindow extends JInternalFrame {
|
|||
setModified(editorPanel.getEditorPane().isModified());
|
||||
}
|
||||
});
|
||||
} catch (RuntimeException e) {
|
||||
} catch (Throwable e) {
|
||||
Logger.logError(e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -484,7 +484,6 @@ public class JavaDocument extends StyledDocument {
|
|||
spaceBuffer = new String(chars);
|
||||
}
|
||||
// Return a string containing the given number of spaces
|
||||
if(spaceBuffer!=null)
|
||||
return spaceBuffer.substring(0, count);
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ public class WindowMenuItem extends JCheckBoxMenuItem implements ActionListener
|
|||
if (window.isIcon()) {
|
||||
try {
|
||||
window.setIcon(false);
|
||||
} catch (RuntimeException ignored) {}
|
||||
} catch (Throwable ignored) {}
|
||||
}
|
||||
if (window.getDesktopPane() != null) {
|
||||
window.getDesktopPane().setSelectedFrame(window);
|
||||
|
@ -83,7 +83,7 @@ public class WindowMenuItem extends JCheckBoxMenuItem implements ActionListener
|
|||
window.grabFocus();
|
||||
try {
|
||||
window.setSelected(true);
|
||||
} catch (RuntimeException ignored) {}
|
||||
} catch (Throwable ignored) {}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -574,14 +574,14 @@ public class WindowManager implements IWindowManagerExt {
|
|||
private void setLookAndFeel() {
|
||||
try {
|
||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
} catch (RuntimeException t) {
|
||||
} catch (Throwable t) {
|
||||
// Work-around for problems with setting Look and Feel described here:
|
||||
// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6468089
|
||||
Locale.setDefault(Locale.US);
|
||||
|
||||
try {
|
||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
} catch (RuntimeException t2) {
|
||||
} catch (Throwable t2) {
|
||||
// For some reason Ubuntu 7 can cause a NullPointerException when trying to getting the LAF
|
||||
System.err.println("Could not set the Look and Feel (LAF). The default LAF is used instead");
|
||||
}
|
||||
|
|
|
@ -132,7 +132,7 @@ public final class AwtBattleAdaptor {
|
|||
calculateFPS();
|
||||
}
|
||||
}
|
||||
} catch (RuntimeException t) {
|
||||
} catch (Throwable t) {
|
||||
Logger.logError(t);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -227,10 +227,7 @@ public class PreferencesSoundOptionsTab extends WizardPanel {
|
|||
for (Mixer.Info mi : mixerInfo) {
|
||||
if (AudioSystem.getMixer(mi).getSourceLineInfo(clipLineInfo).length > 0) {
|
||||
mixers.add(mi);
|
||||
AudioSystem.getMixer(mi).close();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
mixerComboBox = new JComboBox(mixers);
|
||||
|
@ -299,8 +296,9 @@ public class PreferencesSoundOptionsTab extends WizardPanel {
|
|||
if (mixerInfo != null) {
|
||||
Mixer mixer = AudioSystem.getMixer((Mixer.Info) getMixerComboBox().getSelectedItem());
|
||||
|
||||
if (mixer != null) {
|
||||
mixerClassName = mixer.getClass().getSimpleName();
|
||||
mixer.close();
|
||||
}
|
||||
}
|
||||
if (mixerClassName != null) {
|
||||
props.setOptionsSoundMixer(mixerClassName);
|
||||
|
@ -318,10 +316,8 @@ public class PreferencesSoundOptionsTab extends WizardPanel {
|
|||
for (Mixer.Info mi : AudioSystem.getMixerInfo()) {
|
||||
if (AudioSystem.getMixer(mi).getClass().getSimpleName().equals(mixerName)) {
|
||||
getMixerComboBox().setSelectedItem(mi);
|
||||
AudioSystem.getMixer(mi).close();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -329,7 +325,6 @@ public class PreferencesSoundOptionsTab extends WizardPanel {
|
|||
public void actionPerformed(ActionEvent e) {
|
||||
Object src = e.getSource();
|
||||
|
||||
|
||||
if (src == enableAllSoundsButton) {
|
||||
setAllSoundsButtonsEnabled(true);
|
||||
} else if (src == disableAllSoundsButton) {
|
||||
|
@ -358,7 +353,6 @@ public class PreferencesSoundOptionsTab extends WizardPanel {
|
|||
|
||||
boolean volumeSupported;
|
||||
boolean panSupported;
|
||||
mixer.close();
|
||||
|
||||
try {
|
||||
Line line = mixer.getLine(lineInfo);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
package net.sf.robocode.ui.dialog;
|
||||
|
||||
|
||||
|
@ -31,14 +32,17 @@ public class TeamCreator extends JDialog implements WizardListener {
|
|||
private RobotSelectionPanel robotSelectionPanel;
|
||||
private TeamCreatorOptionsPanel teamCreatorOptionsPanel;
|
||||
|
||||
private final int minRobots = 2;
|
||||
private final int maxRobots = 10;
|
||||
private final int minRobots = 2;//每个编队至少两人
|
||||
private final int maxRobots = 10;//每个编队最多10人
|
||||
|
||||
private final EventHandler eventHandler = new EventHandler();
|
||||
|
||||
//EventHandler具体实现ActionListener接口,实现动作的监听操作
|
||||
class EventHandler implements ActionListener {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
//e为传入的参数,传入临时变量e,为ActionEvent类型
|
||||
if (e.getActionCommand().equals("Refresh")) {
|
||||
//执行跟新操作
|
||||
getRobotSelectionPanel().refreshRobotList(true);
|
||||
}
|
||||
}
|
||||
|
@ -59,9 +63,12 @@ public class TeamCreator extends JDialog implements WizardListener {
|
|||
return teamCreatorOptionsPanel;
|
||||
}
|
||||
|
||||
//获取创建编队嵌入框中的内容
|
||||
private JPanel getTeamCreatorContentPane() {
|
||||
if (teamCreatorContentPane == null) {
|
||||
//如果嵌入框内容为空
|
||||
teamCreatorContentPane = new JPanel();
|
||||
//新建嵌入框
|
||||
teamCreatorContentPane.setLayout(new BorderLayout());
|
||||
teamCreatorContentPane.add(getWizardController(), BorderLayout.SOUTH);
|
||||
teamCreatorContentPane.add(getWizardPanel(), BorderLayout.CENTER);
|
||||
|
@ -75,8 +82,12 @@ public class TeamCreator extends JDialog implements WizardListener {
|
|||
return teamCreatorContentPane;
|
||||
}
|
||||
|
||||
protected RobotSelectionPanel getRobotSelectionPanel() {
|
||||
if (robotSelectionPanel == null) {
|
||||
//选择机器人组成编队
|
||||
protected RobotSelectionPanel getRobotSelectionPanel()
|
||||
{
|
||||
//如果当前选择为空
|
||||
if (robotSelectionPanel == null)
|
||||
{
|
||||
robotSelectionPanel = net.sf.robocode.core.Container.createComponent(RobotSelectionPanel.class);
|
||||
robotSelectionPanel.setup(minRobots, maxRobots, false, "Select the robots for this team.", false, true, true,
|
||||
false, false, false, null);
|
||||
|
@ -84,8 +95,11 @@ public class TeamCreator extends JDialog implements WizardListener {
|
|||
return robotSelectionPanel;
|
||||
}
|
||||
|
||||
private WizardCardPanel getWizardPanel() {
|
||||
if (wizardPanel == null) {
|
||||
//新建一个嵌入板
|
||||
private WizardCardPanel getWizardPanel()
|
||||
{
|
||||
if (wizardPanel == null)
|
||||
{
|
||||
wizardPanel = new WizardCardPanel(this);
|
||||
wizardPanel.add(getRobotSelectionPanel(), "Select robots");
|
||||
wizardPanel.add(getTeamCreatorOptionsPanel(), "Select options");
|
||||
|
@ -93,23 +107,27 @@ public class TeamCreator extends JDialog implements WizardListener {
|
|||
return wizardPanel;
|
||||
}
|
||||
|
||||
public void initialize() {
|
||||
//窗口初始化
|
||||
public void initialize()
|
||||
{
|
||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||
setTitle("Create a team");
|
||||
setContentPane(getTeamCreatorContentPane());
|
||||
}
|
||||
|
||||
private WizardController getWizardController() {
|
||||
if (wizardController == null) {
|
||||
if (wizardController == null)
|
||||
{
|
||||
wizardController = getWizardPanel().getWizardController();
|
||||
}
|
||||
return wizardController;
|
||||
}
|
||||
|
||||
//添加取消键动作
|
||||
public void cancelButtonActionPerformed() {
|
||||
dispose();
|
||||
}
|
||||
|
||||
//添加完成键动作
|
||||
public void finishButtonActionPerformed() {
|
||||
try {
|
||||
int rc = createTeam();
|
||||
|
@ -127,12 +145,14 @@ public class TeamCreator extends JDialog implements WizardListener {
|
|||
}
|
||||
}
|
||||
|
||||
//将创建的编队写入数据库
|
||||
public int createTeam() throws IOException {
|
||||
File file = new File(repositoryManager.getRobotsDirectory(),
|
||||
teamCreatorOptionsPanel.getTeamPackage().replace('.', File.separatorChar)
|
||||
+ teamCreatorOptionsPanel.getTeamNameField().getText() + ".team");
|
||||
|
||||
if (file.exists()) {
|
||||
//如果当前编队已经存在
|
||||
int ok = JOptionPane.showConfirmDialog(this, file + " already exists. Are you sure you want to replace it?",
|
||||
"Warning", JOptionPane.YES_NO_CANCEL_OPTION);
|
||||
|
||||
|
@ -150,10 +170,13 @@ public class TeamCreator extends JDialog implements WizardListener {
|
|||
String webPageFieldString = teamCreatorOptionsPanel.getWebpageField().getText();
|
||||
|
||||
if (webPageFieldString != null && webPageFieldString.length() > 0) {
|
||||
try {
|
||||
try
|
||||
{
|
||||
webPageUrl = new URL(webPageFieldString);
|
||||
} catch (MalformedURLException e) {
|
||||
try {
|
||||
} catch (MalformedURLException e)
|
||||
{
|
||||
try
|
||||
{
|
||||
webPageUrl = new URL("http://" + webPageFieldString);
|
||||
teamCreatorOptionsPanel.getWebpageField().setText(webPageUrl.toString());
|
||||
} catch (MalformedURLException ignored) {}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
package net.sf.robocode.ui.dialog;
|
||||
|
||||
|
||||
|
@ -17,6 +18,7 @@ import java.net.URL;
|
|||
import java.util.List;
|
||||
|
||||
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class TeamCreatorOptionsPanel extends WizardPanel {
|
||||
private TeamCreator teamCreator;
|
||||
|
@ -39,16 +41,20 @@ public class TeamCreatorOptionsPanel extends WizardPanel {
|
|||
|
||||
private String teamPackage;
|
||||
|
||||
private class EventHandler implements ComponentListener, DocumentListener {
|
||||
public void insertUpdate(DocumentEvent e) {
|
||||
private class EventHandler implements ComponentListener, DocumentListener
|
||||
{
|
||||
public void insertUpdate(DocumentEvent e)
|
||||
{
|
||||
fireStateChanged();
|
||||
}
|
||||
|
||||
public void changedUpdate(DocumentEvent e) {
|
||||
public void changedUpdate(DocumentEvent e)
|
||||
{
|
||||
fireStateChanged();
|
||||
}
|
||||
|
||||
public void removeUpdate(DocumentEvent e) {
|
||||
public void removeUpdate(DocumentEvent e)
|
||||
{
|
||||
fireStateChanged();
|
||||
}
|
||||
|
||||
|
@ -59,32 +65,38 @@ public class TeamCreatorOptionsPanel extends WizardPanel {
|
|||
public void componentShown(ComponentEvent e) {
|
||||
List<IRobotSpecItem> selectedRobots;
|
||||
|
||||
if (teamCreator != null) {
|
||||
if (teamCreator != null)
|
||||
{
|
||||
selectedRobots = teamCreator.getRobotSelectionPanel().getSelectedRobots();
|
||||
} else {
|
||||
} else
|
||||
{
|
||||
selectedRobots = teamPackager.getRobotSelectionPanel().getSelectedRobots();
|
||||
}
|
||||
|
||||
if (selectedRobots != null) {
|
||||
if (selectedRobots != null)
|
||||
{
|
||||
IRobotSpecItem robotSpecification = selectedRobots.get(0);
|
||||
|
||||
getTeamNameLabel().setText("Please choose a name for your team: (Must be a valid Java classname)");
|
||||
getTeamNameField().setText(robotSpecification.getShortClassName() + "Team");
|
||||
getTeamPackageLabel().setText(robotSpecification.getFullPackage() + ".");
|
||||
teamPackage = robotSpecification.getFullPackage();
|
||||
if (teamPackage != null) {
|
||||
if (teamPackage != null)
|
||||
{
|
||||
teamPackage += ".";
|
||||
}
|
||||
|
||||
String d = robotSpecification.getDescription();
|
||||
|
||||
if (d == null) {
|
||||
if (d == null)
|
||||
{
|
||||
d = "";
|
||||
}
|
||||
getDescriptionArea().setText(d);
|
||||
String a = robotSpecification.getAuthorName();
|
||||
|
||||
if (a == null) {
|
||||
if (a == null)
|
||||
{
|
||||
a = "";
|
||||
}
|
||||
getAuthorField().setText(a);
|
||||
|
@ -303,11 +315,7 @@ public class TeamCreatorOptionsPanel extends WizardPanel {
|
|||
return teamPackageLabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到队伍包
|
||||
*
|
||||
* @return 返回一个字符串
|
||||
*/
|
||||
|
||||
public String getTeamPackage() {
|
||||
return (teamPackage != null) ? teamPackage : ".";
|
||||
}
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 609 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue