[customwars] r760 committed - MapFormatException now extends IOException

3 views
Skip to first unread message

codesite...@google.com

unread,
Oct 16, 2012, 12:46:22 PM10/16/12
to customwar...@googlegroups.com
Revision: 760
Author: ace.stef
Date: Tue Oct 16 09:45:58 2012
Log: MapFormatException now extends IOException
http://code.google.com/p/customwars/source/detail?r=760

Modified:
/trunk/v2/src/com/customwars/client/io/loading/map/BinaryCW2MapParser.java
/trunk/v2/src/com/customwars/client/io/loading/map/MapFormatException.java

=======================================
---
/trunk/v2/src/com/customwars/client/io/loading/map/BinaryCW2MapParser.java
Fri Feb 18 15:15:52 2011
+++
/trunk/v2/src/com/customwars/client/io/loading/map/BinaryCW2MapParser.java
Tue Oct 16 09:45:58 2012
@@ -91,8 +91,6 @@
* for each unit in transport
* <UNIT_ID>
* <OWNER_ID>
- *
- * @author stefan
*/
public class BinaryCW2MapParser implements MapParser {
private static final String CW2_HEADER_START = "CW2.map";
@@ -126,8 +124,6 @@
try {
validateStream(in);
map = readMap();
- } catch (IOException ex) {
- throw new MapFormatException(ex);
} finally {
IOUtil.closeStream(in);
}
@@ -191,7 +187,7 @@
return new Location2D(hqCol, hqRow);
}

- private void addPlayer(Player player) {
+ private void addPlayer(Player player) throws MapFormatException {
if (players.containsKey(player.getId())) {
throw new MapFormatException("Duplicate player ID(" +
player.getId() + ")");
} else {
@@ -398,7 +394,7 @@
}

/**
- * Write the players to the outputstream
+ * Write the players to the output stream
* player size, playerID, color and hq location
*/
private void writePlayers() throws IOException {
@@ -492,7 +488,7 @@

/**
* This util method makes sure some text is always written
- * to the outputstream, even if the given txt is null
+ * to the output stream, even if the given txt is null
*/
private static void writeTxt(DataOutputStream out, String txt) throws
IOException {
if (txt == null) {
=======================================
---
/trunk/v2/src/com/customwars/client/io/loading/map/MapFormatException.java
Wed Jun 24 06:57:57 2009
+++
/trunk/v2/src/com/customwars/client/io/loading/map/MapFormatException.java
Tue Oct 16 09:45:58 2012
@@ -1,6 +1,11 @@
package com.customwars.client.io.loading.map;

-public class MapFormatException extends RuntimeException {
+import java.io.IOException;
+
+/**
+ * Thrown when the map file does not have the expected format
+ */
+public class MapFormatException extends IOException {
public MapFormatException(Throwable cause) {
super(cause);
}
Reply all
Reply to author
Forward
0 new messages