From 98eb1be60c5bf86930c89469747c58f458503100 Mon Sep 17 00:00:00 2001 From: Caesar11 Date: Thu, 11 Dec 2014 01:52:51 -0500 Subject: [PATCH] fixed bug in GstoreConnector.recv() --- api/java/lib/GstoreJavaAPI.jar | Bin 5616 -> 5786 bytes api/java/src/jgsc/GstoreConnector.java | 23 ++++++++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/api/java/lib/GstoreJavaAPI.jar b/api/java/lib/GstoreJavaAPI.jar index cf98b9d02bb56d2fc6015cdccb22b967e6ebd231..4d14ebc1460fa94de76dfc4eb763fa9022a62f02 100644 GIT binary patch delta 5506 zcmV-|6@BXPE1E3~P)h>@6aWYa2mmT}kqln~1$L2bEPusVd3;<|75;AK&C=;>n@p3o zX&acXB$KUaxGUs3gx?d zv(d)0vwyi%##)z3CaoxYUKk3cyCZuejfqIIw{cVVZjLKVi&;I9d?L5S%Ivi=?VA+> z9iywZvJtm}Q$&8E#eW3chS%pFdkP=gFp`7g_9-+0v3$u5pVVqA=g8Xd<4B z=TGH(J>x( zgltr|3s84Bt<9TJ{c4i*0#`Vm=ITT$5+mqwR@LnAQ*FpZE$S4!QCo*5V#g#jV2Kxv zV}BgAWnVUD^_ytIQm(Qx8OpWA##4=(DKkgOR;0hx#{fWsBQTgt1#N!>xh0ip2(CTO zs0P94#|oV4#Y$2=jz|-yp@ksRGL%S8V9-`CRw>LpexfZOPsFT@5A?EIbOrrr#ai)3 zi}cz|tizdfRV1CZl4PrXJmIeza>TZZh<~$8oQ-oBPq~ym$=I)c^_Es)e1nN|QBBum zsmzB?QYF2hMix!=_ec2SwW(6rWMZ=@G%{9nuMC`TVvG3EAB$%l=EaF`FtJs;E0xdr zZ~@uXYGRRGq&t$eg0WQ6YVczRF7#sOSZ`~@CfHB zlaYQ#{8UGMIAi7V8Tv|b-WBa9v6IEn!njYchx@Z6Ys!{fBzjS2Bt4Qf`J~|Vp-*AS zi3ifiuH6h3yC3u+p|DgF?2Nn~#Unx_%A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^*WZiI49FN>n8DlZ^tVgeSBdOcNc7DB~brpNj zMlPL4z|=R9lyK;K3FE`A1)`Zy6&Y1;*>BT{@}qhDzx`}_Ok zNxM|-ueSO>q6KUmtTy(C4QB|szCt2UYne1q#*-UDFVuTj3?=~de(&PdtB#WSTISob zzLxcE*+9z%T4v?}8h_RSRX+9Fa@IfFnFWR+^^XA@ z|8d_N_@4ih=Ra~f>LZ#G12P4CP^VFtGpJu)Jxne^Qd~-S%YV*kCec+he>jT)DXgM+ z>w~pj31FhZIen&4cpB*}(5GJ42`A$>@1DK&d*F`4E@-ldSr@O5AV&Czjbpzz*0J!? zfm$QBmuFvnmd69WU@=|_JiQ?2s!V)#^m%88IJ-eOi5FgwcJZDHHaaw!M6;aYde{B? zpTGX?zDqx**?)Q3?LT?+*qh5F-fu0HL@;Lw?Jjt>U|e2y=Tsa~c-(J2z3|9#m@B8e zPsacON_8`hAeAk>zG0Jbo~Gg)b{KouRbR)LYnYMhrC_e!Cuyy=VH*7W2T)4~2!H9b z)=LKf03sX!08mQ-0u%rg00;;O0DEhTMY4Ya?i&CA0F%cRIu1{3i$#_^*G$R`008b7 zlMfa;AWv(HMStnD)=LKf03sX!02u%P00000000000001U4U-`j7n6V%6b1zq00000 Dlhz5J diff --git a/api/java/src/jgsc/GstoreConnector.java b/api/java/src/jgsc/GstoreConnector.java index d545e14..990b527 100644 --- a/api/java/src/jgsc/GstoreConnector.java +++ b/api/java/src/jgsc/GstoreConnector.java @@ -207,8 +207,14 @@ public class GstoreConnector int context_len = GstoreConnector.byte4ToInt(head); // in Java String, there is no need for terminator '\0' in C. so we should omit '\0' at the end of receiving message. - byte[] data_context = new byte[context_len-1]; - dis.read(data_context); + byte[] data_context = new byte[context_len]; + int recv_len = 0; + do + { + int cur_len = dis.read(data_context, recv_len, data_context.length-recv_len); + recv_len += cur_len; + }while (recv_len < data_context.length); + String ret = new String(data_context,"utf-8"); return ret; @@ -283,11 +289,22 @@ public class GstoreConnector //gc.build("db_LUBM10", "example/rdf_triple/LUBM_10_GStore.n3"); String sparql = "select ?x where {" - + " ?x. " + + "?x . " + + "?x . " + "}"; gc.load("db_cdblp"); String answer = gc.query(sparql); System.out.println(answer); + + answer = gc.query(sparql); + System.out.println(answer); + + sparql = "select ?x where {" + + "?x . " + + "?x . " + + "}"; + answer = gc.query(sparql); + System.out.println(answer); } }