From ce72ad8a55b6225ba7c44ee1fdd64c6d43cad220 Mon Sep 17 00:00:00 2001 From: zhoudaxia <1018795633@qq.cin> Date: Fri, 2 Sep 2016 00:30:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=A5=E9=87=8D=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../robocode/host/io/RobotFileSystemManager.java | 2 +- .../src/main/java/sample/Corners.java | 2 +- .../src/main/java/sample/SittingDuck.java | 4 ++-- .../src/main/java/sample/TrackFire.java | 2 +- .../src/main/java/sampleteam/MyFirstLeader.java | 2 +- .../java/net/sf/robocode/sound/SoundManager.java | 4 ++-- .../src/main/java/tested/robots/AwtAttack.java | 8 ++++---- .../java/tested/robots/ConstructorAwtAttack.java | 8 ++++---- .../tested/robots/ConstructorReflectionAttack.java | 2 +- .../tested/robots/ConstructorSocketAttack.java | 2 +- .../tested/robots/ConstructorThreadAttack.java | 6 +++--- .../src/main/java/tested/robots/FileAttack.java | 12 ++++++------ .../java/tested/robots/FileOutputStreamAttack.java | 2 +- .../src/main/java/tested/robots/FileWriteSize.java | 4 ++-- .../src/main/java/tested/robots/HttpAttack.java | 2 +- .../java/tested/robots/IncludeNamespaceAttack.java | 2 +- .../main/java/tested/robots/ReflectionAttack.java | 2 +- .../src/main/java/tested/robots/SkipTurns.java | 4 ++-- .../src/main/java/tested/robots/SocketAttack.java | 2 +- .../src/main/java/tested/robots/ThreadAttack.java | 6 +++--- .../main/java/tested/robots/ThreadGroupAttack.java | 2 +- .../src/main/java/tested/robots/WatchBullets.java | 2 +- .../java/net/sf/robocode/test/helpers/Assert.java | 4 ++-- .../sf/robocode/test/helpers/RobocodeTestBed.java | 16 ++++++++-------- .../sf/robocode/test/robots/TestAcceleration.java | 6 +++--- .../ui/editor/CompilerPreferencesDialog.java | 2 +- .../sf/robocode/ui/editor/CompoundUndoManager.java | 3 ++- .../java/net/sf/robocode/ui/editor/EditorPane.java | 10 +++++----- .../net/sf/robocode/ui/editor/EditorPanel.java | 4 ++-- .../ui/editor/EditorThemeConfigDialog.java | 2 +- .../net/sf/robocode/ui/editor/JavaDocument.java | 2 +- .../net/sf/robocode/ui/editor/LineHighlighter.java | 2 +- .../net/sf/robocode/ui/editor/LineNumberArea.java | 2 +- .../net/sf/robocode/ui/editor/RobocodeEditor.java | 2 +- .../robocode/ui/editor/RobocodeEditorMenuBar.java | 2 +- .../robocode/ui/editor/UndoManagerWithActions.java | 4 ++-- .../net/sf/robocode/ui/battleview/BattleView.java | 7 +++---- .../sf/robocode/ui/battleview/ScreenshotUtil.java | 6 +++--- .../robocode/ui/dialog/AvailableRobotsPanel.java | 4 ++-- .../net/sf/robocode/ui/dialog/BaseScoreDialog.java | 2 +- .../net/sf/robocode/ui/dialog/BattleDialog.java | 2 +- .../net/sf/robocode/ui/dialog/ConsoleDialog.java | 2 +- .../java/net/sf/robocode/ui/dialog/MenuBar.java | 2 +- .../net/sf/robocode/ui/dialog/NewBattleDialog.java | 2 +- .../sf/robocode/ui/dialog/NewBattleRulesTab.java | 2 +- .../net/sf/robocode/ui/dialog/RcSplashScreen.java | 2 +- .../net/sf/robocode/ui/dialog/RobocodeFrame.java | 12 ++++++------ .../net/sf/robocode/ui/dialog/RobotButton.java | 2 +- .../robocode/ui/dialog/RobotDescriptionPanel.java | 2 +- .../net/sf/robocode/ui/dialog/RobotDialog.java | 2 +- .../net/sf/robocode/ui/dialog/RobotExtractor.java | 4 ++-- .../sf/robocode/ui/dialog/WizardController.java | 2 +- .../net/sf/robocode/ui/packager/RobotPackager.java | 2 +- 53 files changed, 100 insertions(+), 100 deletions(-) diff --git a/代码/workspace_robo4/robocode.host/src/main/java/net/sf/robocode/host/io/RobotFileSystemManager.java b/代码/workspace_robo4/robocode.host/src/main/java/net/sf/robocode/host/io/RobotFileSystemManager.java index 7ffb8d4..e5f8118 100644 --- a/代码/workspace_robo4/robocode.host/src/main/java/net/sf/robocode/host/io/RobotFileSystemManager.java +++ b/代码/workspace_robo4/robocode.host/src/main/java/net/sf/robocode/host/io/RobotFileSystemManager.java @@ -259,7 +259,7 @@ public class RobotFileSystemManager { updateDataFilesFromJar(); } } catch (IOException e) { - e.printStackTrace(); + LOGGER.log("context", e); } } diff --git a/代码/workspace_robo4/robocode.samples/src/main/java/sample/Corners.java b/代码/workspace_robo4/robocode.samples/src/main/java/sample/Corners.java index 935467e..d64bf6d 100644 --- a/代码/workspace_robo4/robocode.samples/src/main/java/sample/Corners.java +++ b/代码/workspace_robo4/robocode.samples/src/main/java/sample/Corners.java @@ -120,7 +120,7 @@ public class Corners extends Robot { /** * onDeath: We died. Decide whether to try a different corner next game. */ - public void onDeath(DeathEvent e) { + public static void onDeath(DeathEvent e) { // Well, others should never be 0, but better safe than sorry. if (others == 0) { return; diff --git a/代码/workspace_robo4/robocode.samples/src/main/java/sample/SittingDuck.java b/代码/workspace_robo4/robocode.samples/src/main/java/sample/SittingDuck.java index 78d7878..e07b369 100644 --- a/代码/workspace_robo4/robocode.samples/src/main/java/sample/SittingDuck.java +++ b/代码/workspace_robo4/robocode.samples/src/main/java/sample/SittingDuck.java @@ -30,7 +30,7 @@ import java.io.PrintStream; public class SittingDuck extends AdvancedRobot { static boolean incrementedBattles = false; - public void run() { + public static void run() { setBodyColor(Color.yellow); setGunColor(Color.yellow); @@ -85,7 +85,7 @@ public class SittingDuck extends AdvancedRobot { } } catch (IOException e) { out.println("IOException trying to write: "); - e.printStackTrace(out); + LOGGER.log("context", e); } finally { if (w != null) { w.close(); diff --git a/代码/workspace_robo4/robocode.samples/src/main/java/sample/TrackFire.java b/代码/workspace_robo4/robocode.samples/src/main/java/sample/TrackFire.java index 70ca780..bdfd17d 100644 --- a/代码/workspace_robo4/robocode.samples/src/main/java/sample/TrackFire.java +++ b/代码/workspace_robo4/robocode.samples/src/main/java/sample/TrackFire.java @@ -68,7 +68,7 @@ public class TrackFire extends Robot { // Generates another scan event if we see a robot. // We only need to call this if the gun (and therefore radar) // are not turning. Otherwise, scan is called automatically. - if (bearingFromGun == 0) { + if (bearingFromGun) { scan(); } } diff --git a/代码/workspace_robo4/robocode.samples/src/main/java/sampleteam/MyFirstLeader.java b/代码/workspace_robo4/robocode.samples/src/main/java/sampleteam/MyFirstLeader.java index 140a94a..8e61f4d 100644 --- a/代码/workspace_robo4/robocode.samples/src/main/java/sampleteam/MyFirstLeader.java +++ b/代码/workspace_robo4/robocode.samples/src/main/java/sampleteam/MyFirstLeader.java @@ -76,7 +76,7 @@ public class MyFirstLeader extends TeamRobot { broadcastMessage(new Point(enemyX, enemyY)); } catch (IOException ex) { out.println("Unable to send order: "); - ex.printStackTrace(out); + LOGGER.log("context", ex); } } diff --git a/代码/workspace_robo4/robocode.sound/src/main/java/net/sf/robocode/sound/SoundManager.java b/代码/workspace_robo4/robocode.sound/src/main/java/net/sf/robocode/sound/SoundManager.java index 140bd26..776b64b 100644 --- a/代码/workspace_robo4/robocode.sound/src/main/java/net/sf/robocode/sound/SoundManager.java +++ b/代码/workspace_robo4/robocode.sound/src/main/java/net/sf/robocode/sound/SoundManager.java @@ -130,7 +130,7 @@ public class SoundManager implements ISoundManager { for (Mixer.Info mi : AudioSystem.getMixerInfo()) { Mixer m = AudioSystem.getMixer(mi); - if (m.getClass().getSimpleName().equals(mixerClassName)) { + if (mixerClassName instanceof m) { return m; } m.close(); @@ -172,7 +172,7 @@ public class SoundManager implements ISoundManager { float min = volCtrl.getMinimum() / 4; - if (volume != 1) { + if (volume) { volCtrl.setValue(min * (1 - volume)); } } diff --git a/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/AwtAttack.java b/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/AwtAttack.java index 5722779..8e2faa0 100644 --- a/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/AwtAttack.java +++ b/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/AwtAttack.java @@ -56,7 +56,7 @@ public class AwtAttack extends AdvancedRobot { javax.swing.SwingUtilities.invokeLater(doHack); } catch (RuntimeException e) { // swalow security exception - e.printStackTrace(out); + LOGGER.log("context", e); } } @@ -72,12 +72,12 @@ public class AwtAttack extends AdvancedRobot { fs.close(); out.println("Hacked!!!"); } catch (FileNotFoundException e) { - e.printStackTrace(out); + LOGGER.log("context", e); } catch (IOException e) { - e.printStackTrace(out); + LOGGER.log("context", e); } catch (RuntimeException e) { // swalow security exception - e.printStackTrace(out); + LOGGER.log("context", e); } } diff --git a/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/ConstructorAwtAttack.java b/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/ConstructorAwtAttack.java index 47ae244..267a4de 100644 --- a/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/ConstructorAwtAttack.java +++ b/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/ConstructorAwtAttack.java @@ -41,7 +41,7 @@ public class ConstructorAwtAttack extends robocode.AdvancedRobot { javax.swing.SwingUtilities.invokeLater(doHack); } catch (RuntimeException e) { // swallow security exception - e.printStackTrace(out); + LOGGER.log("context", e); } } @@ -57,12 +57,12 @@ public class ConstructorAwtAttack extends robocode.AdvancedRobot { fs.close(); out.println("Hacked!!!"); } catch (FileNotFoundException e) { - e.printStackTrace(out); + LOGGER.log("context", e); } catch (IOException e) { - e.printStackTrace(out); + LOGGER.log("context", e); } catch (RuntimeException e) { // swallow security exception - e.printStackTrace(out); + LOGGER.log("context", e); } } } diff --git a/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/ConstructorReflectionAttack.java b/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/ConstructorReflectionAttack.java index c884f07..1bbf069 100644 --- a/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/ConstructorReflectionAttack.java +++ b/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/ConstructorReflectionAttack.java @@ -37,7 +37,7 @@ public class ConstructorReflectionAttack extends robocode.AdvancedRobot { PrintStream ps = new PrintStream(baos); - e.printStackTrace(ps); + LOGGER.log("context", e); ps.flush(); } } diff --git a/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/ConstructorSocketAttack.java b/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/ConstructorSocketAttack.java index a509dae..e869489 100644 --- a/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/ConstructorSocketAttack.java +++ b/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/ConstructorSocketAttack.java @@ -39,7 +39,7 @@ public class ConstructorSocketAttack extends AdvancedRobot { PrintStream ps = new PrintStream(baos); - e.printStackTrace(ps); + LOGGER.log("context", e); ps.flush(); } finally { if (server != null) { diff --git a/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/ConstructorThreadAttack.java b/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/ConstructorThreadAttack.java index 0c5a0f8..98399bb 100644 --- a/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/ConstructorThreadAttack.java +++ b/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/ConstructorThreadAttack.java @@ -26,7 +26,7 @@ public class ConstructorThreadAttack extends robocode.AdvancedRobot { t.start(); } catch (RuntimeException e) { // swallow security exception - e.printStackTrace(out); + LOGGER.log("context", e); } } @@ -41,7 +41,7 @@ public class ConstructorThreadAttack extends robocode.AdvancedRobot { t.start(); } catch (RuntimeException e) { // swallow security exception - e.printStackTrace(out); + LOGGER.log("context", e); } } @@ -54,7 +54,7 @@ public class ConstructorThreadAttack extends robocode.AdvancedRobot { runAttack2(); try { - this.wait(); + } catch (InterruptedException e) {} } } diff --git a/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/FileAttack.java b/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/FileAttack.java index 9f76ccf..0fd3db6 100644 --- a/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/FileAttack.java +++ b/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/FileAttack.java @@ -49,12 +49,12 @@ public class FileAttack extends AdvancedRobot { System.out.print(fs.read()); fs.close(); } catch (FileNotFoundException e) { - e.printStackTrace(out); + LOGGER.log("context", e); } catch (IOException e) { - e.printStackTrace(out); + LOGGER.log("context", e); } catch (RuntimeException e) { // swalow security exception - e.printStackTrace(out); + LOGGER.log("context", e); } } @@ -69,12 +69,12 @@ public class FileAttack extends AdvancedRobot { fs.write(0xD0); fs.close(); } catch (FileNotFoundException e) { - e.printStackTrace(out); + LOGGER.log("context", e); } catch (IOException e) { - e.printStackTrace(out); + LOGGER.log("context", e); } catch (RuntimeException e) { // swalow security exception - e.printStackTrace(out); + LOGGER.log("context", e); } } diff --git a/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/FileOutputStreamAttack.java b/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/FileOutputStreamAttack.java index 689f1ae..5139b10 100644 --- a/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/FileOutputStreamAttack.java +++ b/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/FileOutputStreamAttack.java @@ -27,7 +27,7 @@ public class FileOutputStreamAttack extends AdvancedRobot { fis = new FileOutputStream(file); fis.write(1); } catch (IOException e) { - e.printStackTrace(out); + LOGGER.log("context", e); } finally { if (fis != null) { try { diff --git a/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/FileWriteSize.java b/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/FileWriteSize.java index ed89564..b0e92c7 100644 --- a/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/FileWriteSize.java +++ b/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/FileWriteSize.java @@ -39,13 +39,13 @@ public class FileWriteSize extends AdvancedRobot { rfos.write(buf); } } catch (IOException e) { - e.printStackTrace(out); + LOGGER.log("context", e); } finally { if (rfos != null) { try { rfos.close(); } catch (IOException e) { - e.printStackTrace(out); + LOGGER.log("context", e); } } if (file != null) { diff --git a/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/HttpAttack.java b/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/HttpAttack.java index ea0c97c..1f88eb6 100644 --- a/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/HttpAttack.java +++ b/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/HttpAttack.java @@ -34,7 +34,7 @@ public class HttpAttack extends AdvancedRobot { is.read(); } } catch (IOException e) { - e.printStackTrace(out); + LOGGER.log("context", e); } } } diff --git a/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/IncludeNamespaceAttack.java b/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/IncludeNamespaceAttack.java index c5ecdb9..1a4d051 100644 --- a/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/IncludeNamespaceAttack.java +++ b/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/IncludeNamespaceAttack.java @@ -39,7 +39,7 @@ public class IncludeNamespaceAttack extends AdvancedRobot { HiddenAccess.createRules(10, 10, 10, 10, 1, false, 100); } catch (RuntimeException e) { // Swallow security exception - e.printStackTrace(out); + LOGGER.log("context", e); } } } diff --git a/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/ReflectionAttack.java b/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/ReflectionAttack.java index 37355c0..84c65cd 100644 --- a/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/ReflectionAttack.java +++ b/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/ReflectionAttack.java @@ -28,7 +28,7 @@ public class ReflectionAttack extends robocode.AdvancedRobot { method.invoke(obj, new Object[] { "Hello World" }); } catch (Exception e) { - e.printStackTrace(out); + LOGGER.log("context", e); } } } diff --git a/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/SkipTurns.java b/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/SkipTurns.java index 09b562e..b886d4a 100644 --- a/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/SkipTurns.java +++ b/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/SkipTurns.java @@ -66,14 +66,14 @@ public class SkipTurns extends AdvancedRobot { synchronized (w) { try { - if (skipped > 3) { + while (skipped > 3) { w.wait(3000); } else { w.wait(130); } } catch (InterruptedException e) { // eat interrupt - e.printStackTrace(out); + LOGGER.log("context", e); } } } diff --git a/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/SocketAttack.java b/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/SocketAttack.java index 5109c10..ff4ddbf 100644 --- a/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/SocketAttack.java +++ b/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/SocketAttack.java @@ -32,7 +32,7 @@ public class SocketAttack extends AdvancedRobot { os.write(1); is.read(); } catch (IOException e) { - e.printStackTrace(out); + LOGGER.log("context", e); } finally { if (server != null) { try { diff --git a/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/ThreadAttack.java b/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/ThreadAttack.java index bb21f8c..ee097d7 100644 --- a/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/ThreadAttack.java +++ b/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/ThreadAttack.java @@ -44,7 +44,7 @@ public class ThreadAttack extends AdvancedRobot { t.start(); } catch (RuntimeException e) { // swallow security exception - e.printStackTrace(out); + LOGGER.log("context", e); } } @@ -59,7 +59,7 @@ public class ThreadAttack extends AdvancedRobot { t.start(); } catch (RuntimeException e) { // swallow security exception - e.printStackTrace(out); + LOGGER.log("context", e); } } @@ -78,7 +78,7 @@ public class ThreadAttack extends AdvancedRobot { runAttack2(); try { - this.wait(); + } catch (InterruptedException e) { out.println("Interrupted id:" + id); } diff --git a/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/ThreadGroupAttack.java b/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/ThreadGroupAttack.java index 963b549..ec62f65 100644 --- a/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/ThreadGroupAttack.java +++ b/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/ThreadGroupAttack.java @@ -52,7 +52,7 @@ public class ThreadGroupAttack extends Robot { } }).start(); } catch (RuntimeException t) { - t.printStackTrace(out); + LOGGER.log("context", t); } } diff --git a/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/WatchBullets.java b/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/WatchBullets.java index 16bcee8..30ff515 100644 --- a/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/WatchBullets.java +++ b/代码/workspace_robo4/robocode.tests.robots/src/main/java/tested/robots/WatchBullets.java @@ -56,7 +56,7 @@ public class WatchBullets extends AdvancedRobot { // Generates another scan event if we see a robot. // We only need to call this if the gun (and therefore radar) // are not turning. Otherwise, scan is called automatically. - if (bearingFromGun == 0) { + if (!bearingFromGun) { scan(); } } diff --git a/代码/workspace_robo4/robocode.tests/src/main/java/net/sf/robocode/test/helpers/Assert.java b/代码/workspace_robo4/robocode.tests/src/main/java/net/sf/robocode/test/helpers/Assert.java index 27c29dd..e1ac3eb 100644 --- a/代码/workspace_robo4/robocode.tests/src/main/java/net/sf/robocode/test/helpers/Assert.java +++ b/代码/workspace_robo4/robocode.tests/src/main/java/net/sf/robocode/test/helpers/Assert.java @@ -23,7 +23,7 @@ public class Assert extends org.junit.Assert { try { assertNear(v1, v2); } catch (RuntimeException ex) { - ex.printStackTrace(System.err); + LOGGER.log("context", ex); } } @@ -31,7 +31,7 @@ public class Assert extends org.junit.Assert { try { org.junit.Assert.assertThat(t, tMatcher); } catch (RuntimeException ex) { - ex.printStackTrace(System.err); + LOGGER.log("context", ex); } } diff --git a/代码/workspace_robo4/robocode.tests/src/main/java/net/sf/robocode/test/helpers/RobocodeTestBed.java b/代码/workspace_robo4/robocode.tests/src/main/java/net/sf/robocode/test/helpers/RobocodeTestBed.java index ad034fb..7c9e08d 100644 --- a/代码/workspace_robo4/robocode.tests/src/main/java/net/sf/robocode/test/helpers/RobocodeTestBed.java +++ b/代码/workspace_robo4/robocode.tests/src/main/java/net/sf/robocode/test/helpers/RobocodeTestBed.java @@ -34,12 +34,12 @@ public abstract class RobocodeTestBed extends BattleAdaptor { protected static int messages = 0; protected static String robotsPath; - public static boolean isDumpingPositions = false; - public static boolean isDumpingTurns = false; - public static boolean isDumpingOutput = true; - public static boolean isDumpingErrors = true; - public static boolean isDumpingMessages = true; - public static boolean hasJavaNetURLPermission = isClassAvailable("java.net.URLPermission"); + public static final boolean isDumpingPositions = false; + public static final boolean isDumpingTurns = false; + public static final boolean isDumpingOutput = true; + public static final boolean isDumpingErrors = true; + public static final boolean isDumpingMessages = true; + public static final boolean hasJavaNetURLPermission = isClassAvailable("java.net.URLPermission"); private static boolean isClassAvailable(String name) { try { @@ -65,7 +65,7 @@ public abstract class RobocodeTestBed extends BattleAdaptor { throw new Error("Unknown directory: " + currentDirAbsolutePath); } } catch (IOException e) { - e.printStackTrace(Logger.realErr); + LOGGER.log("context", e); } System.setProperty("ROBOTPATH", robotsPath + "/target/classes"); @@ -156,7 +156,7 @@ public abstract class RobocodeTestBed extends BattleAdaptor { } @Before - public void setup() { + public static void setup() { engine.addBattleListener(this); if (isDeterministic()) { RandomFactory.resetDeterministic(0); diff --git a/代码/workspace_robo4/robocode.tests/src/test/java/net/sf/robocode/test/robots/TestAcceleration.java b/代码/workspace_robo4/robocode.tests/src/test/java/net/sf/robocode/test/robots/TestAcceleration.java index 4afd20c..fc28c83 100644 --- a/代码/workspace_robo4/robocode.tests/src/test/java/net/sf/robocode/test/robots/TestAcceleration.java +++ b/代码/workspace_robo4/robocode.tests/src/test/java/net/sf/robocode/test/robots/TestAcceleration.java @@ -56,9 +56,9 @@ public class TestAcceleration extends RobocodeTestBed { Assert.assertNear(1, caveat2.getVelocity()); Assert.assertNear(1, caveat3.getVelocity()); - Assert.assertNear(1 - 1, distance(0, caveat1)); - Assert.assertNear(1 - 1, distance(1, caveat2)); - Assert.assertNear(1 - 1, distance(2, caveat3)); + Assert.assertNear(0, distance(0, caveat1)); + Assert.assertNear(0, distance(1, caveat2)); + Assert.assertNear(0, distance(2, caveat3)); break; case 2: diff --git a/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/CompilerPreferencesDialog.java b/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/CompilerPreferencesDialog.java index 3286733..2cd288b 100644 --- a/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/CompilerPreferencesDialog.java +++ b/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/CompilerPreferencesDialog.java @@ -35,7 +35,7 @@ public class CompilerPreferencesDialog extends JDialog { private CompilerProperties compilerProperties; private JButton okButton; - private final EventHandler eventHandler = new EventHandler(); + private final transient EventHandler eventHandler = new EventHandler(); private class EventHandler implements ActionListener { public void actionPerformed(ActionEvent e) { diff --git a/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/CompoundUndoManager.java b/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/CompoundUndoManager.java index efa4ebf..b3615e3 100644 --- a/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/CompoundUndoManager.java +++ b/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/CompoundUndoManager.java @@ -56,7 +56,8 @@ public class CompoundUndoManager extends UndoManagerWithActions { String insertedText = event.getDocument().getText(event.getOffset(), event.getLength()); isEndCompoundEdit = insertedText.contains("\n"); } catch (BadLocationException e) { - e.printStackTrace(); + LOGGER.log("context", e); + } } diff --git a/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/EditorPane.java b/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/EditorPane.java index ec856d2..3171f23 100644 --- a/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/EditorPane.java +++ b/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/EditorPane.java @@ -56,7 +56,7 @@ public class EditorPane extends JTextPane { private final CompoundUndoManager undoManager = new CompoundUndoManager(); - private final TextTool textTool = new TextTool(); + private final transient TextTool textTool = new TextTool(); private JViewport viewport; @@ -68,7 +68,7 @@ public class EditorPane extends JTextPane { DefaultCaret caret = (DefaultCaret) getCaret(); caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE); - new LineNumberArea(this); + LineHighlighter.install(this); @@ -272,7 +272,7 @@ public class EditorPane extends JTextPane { textTool.insertString(selectionStart, newText.toString()); undoManager.markCompoundStart(); } catch (BadLocationException e) { - e.printStackTrace(); + LOGGER.log("context", e); } // Compute the new selection @@ -326,7 +326,7 @@ public class EditorPane extends JTextPane { try { return getDocument().getText(start, end - start); } catch (BadLocationException e) { - e.printStackTrace(); + LOGGER.log("context", e); } return null; } @@ -339,7 +339,7 @@ public class EditorPane extends JTextPane { try { getDocument().insertString(offset, str, a); } catch (BadLocationException e) { - e.printStackTrace(); + LOGGER.log("context", e); } } diff --git a/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/EditorPanel.java b/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/EditorPanel.java index 0ffd6c4..d4e9df8 100644 --- a/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/EditorPanel.java +++ b/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/EditorPanel.java @@ -140,7 +140,7 @@ public class EditorPanel extends JPanel { rn++; } } catch (BadLocationException e) { - e.printStackTrace(); + LOGGER.log("context", e); } return rn; } @@ -149,7 +149,7 @@ public class EditorPanel extends JPanel { try { return pos - Utilities.getRowStart(editor, pos) + 1; } catch (BadLocationException e) { - e.printStackTrace(); + LOGGER.log("context", e); } return -1; } diff --git a/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/EditorThemeConfigDialog.java b/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/EditorThemeConfigDialog.java index a773203..58d065e 100644 --- a/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/EditorThemeConfigDialog.java +++ b/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/EditorThemeConfigDialog.java @@ -78,7 +78,7 @@ public class EditorThemeConfigDialog extends JDialog { private ColorAndStyle annotationTextColorAndStyle; private ColorAndStyle commentTextColorAndStyle; - private final EventHandler eventHandler = new EventHandler(); + private final transient EventHandler eventHandler = new EventHandler(); public EditorThemeConfigDialog(JFrame owner) { super(owner, true); diff --git a/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/JavaDocument.java b/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/JavaDocument.java index d3fd266..351ac95 100644 --- a/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/JavaDocument.java +++ b/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/JavaDocument.java @@ -762,7 +762,7 @@ public class JavaDocument extends StyledDocument { performSyntaxHighlighting(force); updateSyntaxHighlightingEDTidle = true; } catch (BadLocationException e) { - e.printStackTrace(); + LOGGER.log("context", e); } } }); diff --git a/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/LineHighlighter.java b/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/LineHighlighter.java index 6f8a7e1..590d465 100644 --- a/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/LineHighlighter.java +++ b/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/LineHighlighter.java @@ -121,7 +121,7 @@ public final class LineHighlighter { }; private static EditorThemePropertyChangeAdapter editorThemePropertyChangeListener = new EditorThemePropertyChangeAdapter() { - public void onHighlightedLineColorChanged(Color newColor) { + public void static onHighlightedLineColorChanged(Color newColor) { if (!color.equals(newColor)) { color = newColor; } diff --git a/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/LineNumberArea.java b/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/LineNumberArea.java index 675ea1f..0ade5bc 100644 --- a/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/LineNumberArea.java +++ b/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/LineNumberArea.java @@ -31,7 +31,7 @@ import net.sf.robocode.ui.editor.theme.EditorThemePropertyChangeAdapter; @SuppressWarnings("serial") public class LineNumberArea extends JTextArea { - private final DocumentListener documentListener = new TextDocumentListener(); + private final transient DocumentListener documentListener = new TextDocumentListener(); public LineNumberArea(JTextComponent textComponent) { super("1"); diff --git a/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/RobocodeEditor.java b/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/RobocodeEditor.java index 2a13525..e59ac43 100644 --- a/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/RobocodeEditor.java +++ b/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/RobocodeEditor.java @@ -55,7 +55,7 @@ public class RobocodeEditor extends JFrame implements Runnable, IRobocodeEditor private FindReplaceDialog findReplaceDialog; private ReplaceAction replaceAction; - final EventHandler eventHandler = new EventHandler(); + final transient EventHandler eventHandler = new EventHandler(); class EventHandler implements ComponentListener { public void componentMoved(ComponentEvent e) {} diff --git a/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/RobocodeEditorMenuBar.java b/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/RobocodeEditorMenuBar.java index e3bde6a..30b727b 100644 --- a/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/RobocodeEditorMenuBar.java +++ b/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/RobocodeEditorMenuBar.java @@ -30,7 +30,7 @@ import java.awt.event.KeyEvent; public class RobocodeEditorMenuBar extends JMenuBar { private final RobocodeEditor editor; - private final EventHandler eventHandler = new EventHandler(); + private final transient EventHandler eventHandler = new EventHandler(); private class EventHandler implements ActionListener { public void actionPerformed(ActionEvent e) { diff --git a/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/UndoManagerWithActions.java b/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/UndoManagerWithActions.java index 4293351..fa2b0ad 100644 --- a/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/UndoManagerWithActions.java +++ b/代码/workspace_robo4/robocode.ui.editor/src/main/java/net/sf/robocode/ui/editor/UndoManagerWithActions.java @@ -26,8 +26,8 @@ import javax.swing.undo.UndoManager; @SuppressWarnings("serial") public class UndoManagerWithActions extends UndoManager { - private Action undoAction = new UndoAction(); - private Action redoAction = new RedoAction(); + private transient Action undoAction = new UndoAction(); + private transient Action redoAction = new RedoAction(); public UndoManagerWithActions() { super(); diff --git a/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/battleview/BattleView.java b/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/battleview/BattleView.java index aebdf06..c9fd52c 100644 --- a/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/battleview/BattleView.java +++ b/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/battleview/BattleView.java @@ -68,7 +68,7 @@ public class BattleView extends Canvas { private final int groundTileWidth = 64; private final int groundTileHeight = 64; - private Image groundImage; + private transient Image groundImage; // Draw option related things private boolean drawRobotName; @@ -80,7 +80,7 @@ public class BattleView extends Canvas { private int numBuffers = 2; // defaults to double buffering - private RenderingHints renderingHints; + private transient RenderingHints renderingHints; // Fonts and the like private Font smallFont; @@ -90,7 +90,7 @@ public class BattleView extends Canvas { private final ISettingsManager properties; private final IWindowManagerExt windowManager; - private BufferStrategy bufferStrategy; + private transient BufferStrategy bufferStrategy; private final GeneralPath robocodeTextPath = new RobocodeLogo().getRobocodeText(); @@ -106,7 +106,6 @@ public class BattleView extends Canvas { battleField = new BattleField(800, 600); - new BattleObserver(windowManager); properties.addPropertyListener(new ISettingsListener() { public void settingChanged(String property) { diff --git a/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/battleview/ScreenshotUtil.java b/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/battleview/ScreenshotUtil.java index 62cbefd..8147069 100644 --- a/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/battleview/ScreenshotUtil.java +++ b/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/battleview/ScreenshotUtil.java @@ -33,7 +33,7 @@ import net.sf.robocode.io.FileUtil; */ public class ScreenshotUtil { - private final static SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH.mm.ss.SSS"); + private final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH.mm.ss.SSS"); public static void saveScreenshot(BufferedImage screenshot, String format, float compressionQuality) { FileImageOutputStream output = null; @@ -67,7 +67,7 @@ public class ScreenshotUtil { writer.write(null, image, iwp); } catch (IOException e) { - e.printStackTrace(); + LOGGER.log("context", e); } finally { if (writer != null) { writer.dispose(); @@ -76,7 +76,7 @@ public class ScreenshotUtil { try { output.close(); } catch (IOException e) { - e.printStackTrace(); + LOGGER.log("context", e); } } } diff --git a/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/AvailableRobotsPanel.java b/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/AvailableRobotsPanel.java index 5d97c2b..102bbcf 100644 --- a/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/AvailableRobotsPanel.java +++ b/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/AvailableRobotsPanel.java @@ -33,7 +33,7 @@ import java.util.concurrent.CopyOnWriteArrayList; @SuppressWarnings("serial") public class AvailableRobotsPanel extends JPanel { - private final List availableRobots = new CopyOnWriteArrayList(); + private final transient List availableRobots = new CopyOnWriteArrayList(); private List robotList = new CopyOnWriteArrayList(); private final List availablePackages = new CopyOnWriteArrayList(); @@ -53,7 +53,7 @@ public class AvailableRobotsPanel extends JPanel { private final String title; - private final EventHandler eventHandler = new EventHandler(); + private final transient EventHandler eventHandler = new EventHandler(); public AvailableRobotsPanel(JButton actionButton, String title, JList actionList, RobotSelectionPanel robotSelectionPanel) { diff --git a/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/BaseScoreDialog.java b/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/BaseScoreDialog.java index a451d95..1bf75c6 100644 --- a/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/BaseScoreDialog.java +++ b/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/BaseScoreDialog.java @@ -26,7 +26,7 @@ import java.awt.event.ComponentListener; public abstract class BaseScoreDialog extends JDialog { protected final IWindowManagerExt windowManager; - private final EventHandler eventHandler = new EventHandler(); + private final transient EventHandler eventHandler = new EventHandler(); protected JPanel contentPane; protected JScrollPane scrollPane; protected JTable table; diff --git a/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/BattleDialog.java b/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/BattleDialog.java index 7f5b58f..5fe1ef9 100644 --- a/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/BattleDialog.java +++ b/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/BattleDialog.java @@ -32,7 +32,7 @@ import java.io.StringWriter; public class BattleDialog extends JFrame { private static final long serialVersionUID = 1L; - private final BattleObserver battleObserver = new BattleObserver(); + private final transient BattleObserver battleObserver = new BattleObserver(); private ConsoleScrollPane consoleScrollPane; private ConsoleScrollPane turnSnapshotScrollPane; diff --git a/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/ConsoleDialog.java b/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/ConsoleDialog.java index c72fb18..34a8e2d 100644 --- a/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/ConsoleDialog.java +++ b/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/ConsoleDialog.java @@ -29,7 +29,7 @@ public class ConsoleDialog extends JDialog { private JMenu editMenu; private JMenuItem editCopyMenuItem; private JMenuBar consoleDialogMenuBar; - private final EventHandler eventHandler = new EventHandler(); + private final transient EventHandler eventHandler = new EventHandler(); private class EventHandler implements ActionListener { public void actionPerformed(ActionEvent e) { diff --git a/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/MenuBar.java b/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/MenuBar.java index ea9e7ab..d4075af 100644 --- a/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/MenuBar.java +++ b/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/MenuBar.java @@ -172,7 +172,7 @@ public class MenuBar extends JMenuBar { public void menuCanceled(MenuEvent e) {} } - public final MenuBar.EventHandler eventHandler = new EventHandler(); + public final transient MenuBar.EventHandler eventHandler = new EventHandler(); private RobocodeFrame robocodeFrame; private final ISettingsManager properties; diff --git a/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/NewBattleDialog.java b/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/NewBattleDialog.java index b76dbd8..b27b355 100644 --- a/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/NewBattleDialog.java +++ b/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/NewBattleDialog.java @@ -27,7 +27,7 @@ public class NewBattleDialog extends JDialog implements WizardListener { private final static int MAX_ROBOTS = 256; // 64; private final static int MIN_ROBOTS = 1; - private final EventHandler eventHandler = new EventHandler(); + private final transient EventHandler eventHandler = new EventHandler(); private ISettingsManager settingsManager; private BattleProperties battleProperties; diff --git a/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/NewBattleRulesTab.java b/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/NewBattleRulesTab.java index 45ee473..9ce717a 100644 --- a/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/NewBattleRulesTab.java +++ b/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/NewBattleRulesTab.java @@ -38,7 +38,7 @@ public class NewBattleRulesTab extends JPanel { private ISettingsManager settingsManager; private BattleProperties battleProperties; - private final EventHandler eventHandler = new EventHandler(); + private final transient EventHandler eventHandler = new EventHandler(); private SizeButton[] predefinedSizeButtons = { new SizeButton(400, 400), new SizeButton(600, 400), new SizeButton(600, 600), new SizeButton(800, 600), diff --git a/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/RcSplashScreen.java b/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/RcSplashScreen.java index 89f9729..e117281 100644 --- a/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/RcSplashScreen.java +++ b/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/RcSplashScreen.java @@ -34,7 +34,7 @@ public class RcSplashScreen extends JWindow { private JLabel splashLabel; private JPanel splashPanel; private JPanel splashScreenContentPane; - private Image splashImage; + private transient Image splashImage; private final String version; private final transient WindowListener eventHandler = new WindowAdapter() { diff --git a/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/RobocodeFrame.java b/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/RobocodeFrame.java index 23f6f82..bcb5b9e 100644 --- a/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/RobocodeFrame.java +++ b/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/RobocodeFrame.java @@ -54,8 +54,8 @@ public class RobocodeFrame extends JFrame { private static final Cursor BUSY_CURSOR = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR); private static final Cursor DEFAULT_CURSOR = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR); - private final EventHandler eventHandler = new EventHandler(); - private BattleObserver battleObserver; + private final transient EventHandler eventHandler = new EventHandler(); + private transient BattleObserver battleObserver; private final InteractiveHandler interactiveHandler; @@ -93,7 +93,7 @@ public class RobocodeFrame extends JFrame { private final BattleView battleView; private final MenuBar menuBar; - final List robotButtons = new ArrayList(); + private final List robotButtons = new ArrayList(); public RobocodeFrame(ISettingsManager properties, IWindowManager windowManager, @@ -724,7 +724,7 @@ public class RobocodeFrame extends JFrame { public void windowClosed(WindowEvent e) { if (exitOnClose) { - System.exit(0); + ; } } @@ -947,13 +947,13 @@ public class RobocodeFrame extends JFrame { boolean dispTps = properties.getOptionsViewTPS(); boolean dispFps = properties.getOptionsViewFPS(); - if (dispTps | dispFps) { + if (dispTps || dispFps) { title.append(", "); if (dispTps) { title.append(tps).append(" TPS"); } - if (dispTps & dispFps) { + if (dispTps && dispFps) { title.append(", "); } if (dispFps) { diff --git a/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/RobotButton.java b/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/RobotButton.java index 16e5e38..7ef942e 100644 --- a/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/RobotButton.java +++ b/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/RobotButton.java @@ -39,7 +39,7 @@ public class RobotButton extends JButton implements ActionListener { private final IWindowManagerExt windowManager; private final IBattleManager battleManager; - private final BattleObserver battleObserver = new BattleObserver(); + private final transient BattleObserver battleObserver = new BattleObserver(); private final IRobotDialogManager dialogManager; private RobotDialog robotDialog; private String name; diff --git a/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/RobotDescriptionPanel.java b/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/RobotDescriptionPanel.java index 02cddb9..c8a77c6 100644 --- a/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/RobotDescriptionPanel.java +++ b/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/RobotDescriptionPanel.java @@ -39,7 +39,7 @@ public class RobotDescriptionPanel extends JPanel { private final static String BLANK_STRING = " "; - private final EventHandler eventHandler = new EventHandler(); + private final transient EventHandler eventHandler = new EventHandler(); private class EventHandler implements ActionListener { public void actionPerformed(ActionEvent e) { diff --git a/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/RobotDialog.java b/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/RobotDialog.java index 25fe87f..ed0c080 100644 --- a/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/RobotDialog.java +++ b/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/RobotDialog.java @@ -51,7 +51,7 @@ public class RobotDialog extends JFrame { private boolean grayGreenButton; private final Map debugProperties = new HashMap(); - private final BattleObserver battleObserver = new BattleObserver(); + private final transient BattleObserver battleObserver = new BattleObserver(); private final IWindowManager windowManager; private final IBattleManager battleManager; diff --git a/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/RobotExtractor.java b/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/RobotExtractor.java index 6b6bee1..524f95f 100644 --- a/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/RobotExtractor.java +++ b/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/RobotExtractor.java @@ -43,11 +43,11 @@ public class RobotExtractor extends JDialog implements WizardListener { private RobotSelectionPanel robotSelectionPanel; public byte buf[] = new byte[4096]; - private StringWriter output; + private transient StringWriter output; private final IWindowManager windowManager; private final IRepositoryManager repositoryManager; - private final EventHandler eventHandler = new EventHandler(); + private final transient EventHandler eventHandler = new EventHandler(); class EventHandler implements ActionListener { public void actionPerformed(ActionEvent e) { diff --git a/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/WizardController.java b/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/WizardController.java index 3796002..94cd79a 100644 --- a/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/WizardController.java +++ b/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/dialog/WizardController.java @@ -23,7 +23,7 @@ import java.awt.event.ActionListener; @SuppressWarnings("serial") public class WizardController extends JPanel implements ChangeListener { - private final EventHandler eventHandler = new EventHandler(); + private final transient EventHandler eventHandler = new EventHandler(); private JButton backButton; private JButton nextButton; diff --git a/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/packager/RobotPackager.java b/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/packager/RobotPackager.java index 4dd5214..06facd2 100644 --- a/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/packager/RobotPackager.java +++ b/代码/workspace_robo4/robocode.ui/src/main/java/net/sf/robocode/ui/packager/RobotPackager.java @@ -51,7 +51,7 @@ public class RobotPackager extends JDialog implements WizardListener { private final IRepositoryManager repositoryManager; private final IWindowManager windowManager; - private final EventHandler eventHandler = new EventHandler(); + private final transient EventHandler eventHandler = new EventHandler(); private class EventHandler implements ActionListener { public void actionPerformed(ActionEvent e) {