Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix primitive serialization #162

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions json-serde/src/main/java/org/openx/data/jsonserde/JsonSerDe.java
Original file line number Diff line number Diff line change
Expand Up @@ -302,22 +302,22 @@ public Object serializeField(Object obj,
Boolean.FALSE;
break;
case BYTE:
result = ((ByteObjectInspector)poi).get(obj);
result = Byte.valueOf(((ByteObjectInspector)poi).get(obj));
break;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since result is an object, not a primitive, Java autoboxing takes care of that automatically.
See http://docs.oracle.com/javase/tutorial/java/data/autoboxing.html

case DOUBLE:
result = ((DoubleObjectInspector)poi).get(obj);
result = Double.valueOf(((DoubleObjectInspector)poi).get(obj));
break;
case FLOAT:
result = ((FloatObjectInspector)poi).get(obj);
result = Float.valueOf(((FloatObjectInspector)poi).get(obj));
break;
case INT:
result = ((IntObjectInspector)poi).get(obj);
result = Integer.valueOf(((IntObjectInspector)poi).get(obj));
break;
case LONG:
result = ((LongObjectInspector)poi).get(obj);
result = Long.valueOf(((LongObjectInspector)poi).get(obj));
break;
case SHORT:
result = ((ShortObjectInspector)poi).get(obj);
result = Short.valueOf(((ShortObjectInspector)poi).get(obj));
break;
case STRING:
result = ((StringObjectInspector)poi).getPrimitiveJavaObject(obj);
Expand Down