Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions msgpack-core/src/main/java/org/msgpack/value/Variable.java
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,11 @@ public Variable setIntegerValue(long v) {
public Variable setIntegerValue(BigInteger v) {
if (0 <= v.compareTo(LONG_MIN) && v.compareTo(LONG_MAX) <= 0) {
this.type = Type.LONG;
this.accessor = integerAccessor;
this.longValue = v.longValue();
} else {
this.type = Type.BIG_INTEGER;
this.accessor = integerAccessor;
this.objectValue = v;
}
return this;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,12 @@ protected void _handleEOF() throws JsonParseException {}
@Override
public String getText() throws IOException, JsonParseException {
// This method can be called for new BigInteger(text)
return value.asRawValue().stringValue();
if (value.isRawValue()) {
return value.asRawValue().stringValue();
}
else {
return value.toString();
}
}

@Override
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.msgpack.core.MessagePack;
import org.msgpack.core.MessagePacker;
import org.msgpack.core.buffer.OutputStreamBufferOutput;
import org.msgpack.value.ExtensionValue;

import java.io.*;
import java.math.BigDecimal;
Expand All @@ -19,6 +20,7 @@
import java.util.List;
import java.util.Map;

import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertNull;
Expand Down Expand Up @@ -142,9 +144,9 @@ else if (k.equals("bool")) {
else if (k.equals("ext")) {
// #9
bitmap |= 1 << 10;
MessagePackExtensionType extensionType = (MessagePackExtensionType) v;
assertEquals(0, extensionType.extType());
assertEquals(ByteBuffer.wrap(extPayload), extensionType.byteBuffer());
ExtensionValue extensionValue = (ExtensionValue) v;
assertEquals(0, extensionValue.getType());
assertArrayEquals(extPayload, extensionValue.getData());
}
}
assertEquals(0x7FF, bitmap);
Expand Down Expand Up @@ -249,9 +251,9 @@ else if (k.equals("child_map_age")) {
// #10
assertEquals(true, array.get(i++));
// #11
MessagePackExtensionType extensionType = (MessagePackExtensionType) array.get(i++);
assertEquals(-1, extensionType.extType());
assertEquals(ByteBuffer.wrap(extPayload), extensionType.byteBuffer());
ExtensionValue extensionValue = (ExtensionValue) array.get(i++);
assertEquals(-1, extensionValue.getType());
assertArrayEquals(extPayload, extensionValue.getData());
}

@Test
Expand Down