Skip to content

Commit c7d6c7f

Browse files
committed
resolve issue gwhalin#38
1 parent cd7440e commit c7d6c7f

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

src/main/java/com/schooner/MemCached/AscIIClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ public MemcachedItem gets(String cmd, String key, Integer hashCode, boolean asSt
854854
sock.flush();
855855

856856
int dataSize = 0;
857-
byte flag = 0;
857+
int flag = 0;
858858
MemcachedItem item = new MemcachedItem();
859859

860860
// get result code
@@ -878,7 +878,7 @@ public MemcachedItem gets(String cmd, String key, Integer hashCode, boolean asSt
878878
case 1:
879879
break;
880880
case 2:
881-
flag = Byte.parseByte(sb.toString());
881+
flag = Integer.parseInt(sb.toString());
882882
break;
883883
case 3:
884884
// get the data size

src/test/java/com/schooner/MemCached/MemCachedClientAsciiTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,15 @@ public void testGetMutiArrayStringArrayIntegerArray() {
399399
}
400400
}
401401

402+
public void testGets() {
403+
mc.set("foo1", "bar1");
404+
mc.set("foo2", 2000L);
405+
mc.set("foo3", true);
406+
assertEquals("bar1", mc.gets("foo1").value);
407+
assertEquals(2000L, mc.gets("foo2").value);
408+
assertEquals(true, mc.gets("foo3").value);
409+
}
410+
402411
public void testSetByteArray() {
403412
byte[] b = new byte[10];
404413
for (int i = 0; i < 10; i++)

src/test/java/com/schooner/MemCached/MemCachedClientBinaryTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,15 @@ public void testGetMutiArrayStringArrayIntegerArrayBool() {
505505
}
506506
}
507507

508+
public void testGets() {
509+
mc.set("foo1", "bar1");
510+
mc.set("foo2", 2000L);
511+
mc.set("foo3", true);
512+
assertEquals("bar1", mc.gets("foo1").value);
513+
assertEquals(2000L, mc.gets("foo2").value);
514+
assertEquals(true, mc.gets("foo3").value);
515+
}
516+
508517
public void testSetByteArray() {
509518
byte[] b = new byte[10];
510519
for (int i = 0; i < 10; i++)

0 commit comments

Comments
 (0)