Merge RP1A.200326.001
Change-Id: Ia9a3de1d6d3a786fa0ac2f5af6c4fdea4c8331a3
diff --git a/Common/src/com/googlecode/android_scripting/rpc/MethodDescriptor.java b/Common/src/com/googlecode/android_scripting/rpc/MethodDescriptor.java
index 01b63a5..f1a8634 100644
--- a/Common/src/com/googlecode/android_scripting/rpc/MethodDescriptor.java
+++ b/Common/src/com/googlecode/android_scripting/rpc/MethodDescriptor.java
@@ -26,6 +26,10 @@
import com.googlecode.android_scripting.jsonrpc.RpcReceiverManager;
import com.googlecode.android_scripting.util.VisibleForTesting;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
@@ -37,10 +41,6 @@
import java.util.List;
import java.util.Map;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
/**
* An adapter that wraps {@code Method}.
*/
@@ -550,7 +550,10 @@
return false;
}
- /** Returns the converters for {@code String}, {@code Integer} and {@code Boolean}. */
+ /**
+ * Returns the converters for {@code String}, {@code Integer}, {@code Long},
+ * and {@code Boolean}.
+ */
private static Map<Class<?>, Converter<?>> populateConverters() {
Map<Class<?>, Converter<?>> converters = new HashMap<Class<?>, Converter<?>>();
converters.put(String.class, new Converter<String>() {
@@ -569,6 +572,16 @@
}
}
});
+ converters.put(Long.class, new Converter<Long>() {
+ @Override
+ public Long convert(String input) {
+ try {
+ return Long.decode(input);
+ } catch (NumberFormatException e) {
+ throw new IllegalArgumentException("'" + input + "' is not a long");
+ }
+ }
+ });
converters.put(Boolean.class, new Converter<Boolean>() {
@Override
public Boolean convert(String input) {