[jetrix-cvs] SF.net SVN: jetrix:[745] jetrix/trunk/src
Brought to you by:
smanux
From: <sm...@us...> - 2008-08-27 14:39:20
|
Revision: 745 http://jetrix.svn.sourceforge.net/jetrix/?rev=745&view=rev Author: smanux Date: 2008-08-27 14:39:18 +0000 (Wed, 27 Aug 2008) Log Message: ----------- Fixed the format of team messages (trailing space required when no team is specified) Implemented the parsing of the noconnecting message for the agents Modified Paths: -------------- jetrix/trunk/src/java/net/jetrix/messages/TeamMessage.java jetrix/trunk/src/java/net/jetrix/protocols/TetrinetProtocol.java jetrix/trunk/src/test/net/jetrix/protocols/TetrinetProtocolTest.java Modified: jetrix/trunk/src/java/net/jetrix/messages/TeamMessage.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/messages/TeamMessage.java 2008-08-27 14:36:45 UTC (rev 744) +++ jetrix/trunk/src/java/net/jetrix/messages/TeamMessage.java 2008-08-27 14:39:18 UTC (rev 745) @@ -30,6 +30,15 @@ /** the name of the team */ private String name; + public TeamMessage() + { + } + + public TeamMessage(String name) + { + this.name = name; + } + public String getName() { return name; Modified: jetrix/trunk/src/java/net/jetrix/protocols/TetrinetProtocol.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/protocols/TetrinetProtocol.java 2008-08-27 14:36:45 UTC (rev 744) +++ jetrix/trunk/src/java/net/jetrix/protocols/TetrinetProtocol.java 2008-08-27 14:39:18 UTC (rev 745) @@ -309,6 +309,12 @@ leave.setRawMessage(this, line); m = leave; } + else if ("noconnecting".equals(cmd)) + { + NoConnectingMessage noconnecting = new NoConnectingMessage(); + noconnecting.setText(line.substring(cmd.length() + 1)); + m = noconnecting; + } return m; } @@ -412,9 +418,9 @@ StringBuilder message = new StringBuilder(); message.append("team "); message.append(m.getSlot()); + message.append(" "); if (m.getName() != null) { - message.append(" "); message.append(m.getName()); } return message.toString(); @@ -827,7 +833,7 @@ // check the size of the init string if (initString.length() % 2 != 0) { - throw new IllegalArgumentException("Invalid initialization string, the length is not even"); + throw new IllegalArgumentException("Invalid initialization string, the length is not even (" + initString + ")"); } // parse the hex values from the init string @@ -842,7 +848,7 @@ } catch (NumberFormatException e) { - throw new IllegalArgumentException("Invalid initialization string, illegal characters found", e); + throw new IllegalArgumentException("Invalid initialization string, illegal characters found (" + initString + ")", e); } // find the hash pattern for a tetrinet client @@ -857,7 +863,7 @@ // check the size of the pattern found if (pattern.length() == 0) { - throw new IllegalArgumentException("Invalid initialization string, unable to find the pattern"); + throw new IllegalArgumentException("Invalid initialization string, unable to find the pattern (" + initString + ")"); } // decode the string Modified: jetrix/trunk/src/test/net/jetrix/protocols/TetrinetProtocolTest.java =================================================================== --- jetrix/trunk/src/test/net/jetrix/protocols/TetrinetProtocolTest.java 2008-08-27 14:36:45 UTC (rev 744) +++ jetrix/trunk/src/test/net/jetrix/protocols/TetrinetProtocolTest.java 2008-08-27 14:39:18 UTC (rev 745) @@ -155,7 +155,7 @@ { TeamMessage msg2 = new TeamMessage(); msg2.setSlot(1); - assertEquals("team 1", protocol.translate(msg2, locale)); + assertEquals("team 1 ", protocol.translate(msg2, locale)); } public void testGetMessageTeam1() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |