Skip to content

Instantly share code, notes, and snippets.

@jlg
Created February 11, 2011 11:49
Show Gist options
  • Select an option

  • Save jlg/822241 to your computer and use it in GitHub Desktop.

Select an option

Save jlg/822241 to your computer and use it in GitHub Desktop.
diff --git a/py4j-java/src/py4j/Protocol.java b/py4j-java/src/py4j/Protocol.java
index 03be9d6..2e0113a 100644
--- a/py4j-java/src/py4j/Protocol.java
+++ b/py4j-java/src/py4j/Protocol.java
@@ -164,6 +164,10 @@ public class Protocol {
return Integer.parseInt(commandPart.substring(1, commandPart.length()));
}
+ public final static long getLong(String commandPart) {
+ return Long.parseLong(commandPart.substring(1, commandPart.length()));
+ }
+
public final static String getMemberOutputCommand(char memberType) {
StringBuilder builder = new StringBuilder();
@@ -212,7 +216,10 @@ public class Protocol {
case DOUBLE_TYPE:
return getDouble(commandPart);
case INTEGER_TYPE:
- return getInteger(commandPart);
+ try { // try to fit it in Integer
+ return getInteger(commandPart);
+ } catch (NumberFormatException e) {}
+ return getLong(commandPart);
case NULL_TYPE:
return getNull(commandPart);
case VOID:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment