浏览代码

Fixed ParserTestClass

IRCParser now compiles on JRE 1.5


git-svn-id: http://svn.dmdirc.com/trunk@73 00569f92-eb28-0410-84fd-f71c24880f
tags/0.1
Shane Mc Cormack 17 年前
父节点
当前提交
8a5daf33f0
共有 2 个文件被更改,包括 11 次插入6 次删除
  1. 9
    4
      src/dmdirc/parser/IRCParser.java
  2. 2
    2
      src/dmdirc/parser/ParserTestClass.java

+ 9
- 4
src/dmdirc/parser/IRCParser.java 查看文件

@@ -1174,15 +1174,20 @@ public class IRCParser implements Runnable {
1174 1174
 		ChannelInfo iChannel;
1175 1175
 		ChannelClientInfo iChannelClientInfo;
1176 1176
 		ClientInfo iClient;
1177
-		
1178 1177
 		if (sParam.equals("324")) {
1179 1178
 			sChannelName = token[3];
1180
-			sModestr = Arrays.copyOfRange(token,4,token.length);
1179
+			// Java 6 Only
1180
+			// sModestr = Arrays.copyOfRange(token,4,token.length);
1181
+			sModestr = new String[token.length-4];
1182
+			System.arraycopy(token, 4, sModestr, 0, token.length-4);
1181 1183
 		} else {
1182 1184
 			sChannelName = token[2];
1183
-			sModestr = Arrays.copyOfRange(token,3,token.length);
1185
+			// Java 6 Only
1186
+			// sModestr = Arrays.copyOfRange(token,3,token.length);
1187
+			sModestr = new String[token.length-3];
1188
+			System.arraycopy(token, 3, sModestr, 0, token.length-3);
1184 1189
 		}
1185
-		
1190
+
1186 1191
 		if (!ChannelInfo.isValidChannelName(this, sChannelName)) { ProcessUserMode(sParam, token, sModestr); return; }
1187 1192
 		
1188 1193
 		iChannel = GetChannelInfo(sChannelName);

+ 2
- 2
src/dmdirc/parser/ParserTestClass.java 查看文件

@@ -35,6 +35,7 @@ public class ParserTestClass {
35 35
 	private int nTotalTests;
36 36
 	private int nPassedTests;
37 37
 	private int nFailedTests;
38
+	private IRCParser myParser = null;
38 39
 	private boolean bCanOutput = true;
39 40
 	private class TestResult {
40 41
 		boolean bResult;
@@ -46,7 +47,7 @@ public class ParserTestClass {
46 47
 	// sExpected is Case Sensitive.
47 48
 	private TestResult TestClientInfo(String sInput, String sExpected) {
48 49
 		++nTotalTests;
49
-		ClientInfo cTemp = new ClientInfo(sInput);
50
+		ClientInfo cTemp = new ClientInfo(myParser, sInput);
50 51
 		TestResult tResult = new TestResult();
51 52
 		tResult.sInput = sInput;
52 53
 		tResult.sExpected = sExpected;
@@ -66,7 +67,6 @@ public class ParserTestClass {
66 67
 		return tResult;
67 68
 	}
68 69
 	
69
-	
70 70
 	public void RunTests(String args[]) { RunTests(); }
71 71
 	public void RunTests() {
72 72
 		if (bCanOutput) { System.out.printf("  ClientInfo Tests Begin\n"); }

正在加载...
取消
保存