Author: toad
Date: 2007-03-29 20:38:28 +0000 (Thu, 29 Mar 2007)
New Revision: 12428
Modified:
trunk/freenet/src/freenet/node/fcp/ClientGetMessage.java
Log:
Error handling when parsing ReturnType
Modified: trunk/freenet/src/freenet/node/fcp/ClientGetMessage.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/ClientGetMessage.java 2007-03-29
20:27:36 UTC (rev 12427)
+++ trunk/freenet/src/freenet/node/fcp/ClientGetMessage.java 2007-03-29
20:38:28 UTC (rev 12428)
@@ -86,7 +86,7 @@
}
}
String returnTypeString = fs.get("ReturnType");
- returnType = parseReturnType(returnTypeString);
+ returnType = parseReturnTypeFCP(returnTypeString);
if(returnType == RETURN_TYPE_DIRECT) {
diskFile = null;
tempFile = null;
@@ -231,6 +231,14 @@
}
}
+ short parseReturnTypeFCP(String string) throws MessageInvalidException {
+ try {
+ return parseReturnType(string);
+ } catch (NumberFormatException e) {
+ throw new
MessageInvalidException(ProtocolErrorMessage.INVALID_FIELD, "Unable to parse
ReturnType "+string+" : "+e, identifier, global);
+ }
+ }
+
public static short parseReturnType(String string) {
if(string == null)
return RETURN_TYPE_DIRECT;