perfsonar-dev - r1498 - trunk/perfsonar/src/org/perfsonar/service/commons/storage/xmldb/exist/rest
Subject: perfsonar development work
List archive
r1498 - trunk/perfsonar/src/org/perfsonar/service/commons/storage/xmldb/exist/rest
Chronological Thread
- From:
- To:
- Subject: r1498 - trunk/perfsonar/src/org/perfsonar/service/commons/storage/xmldb/exist/rest
- Date: Mon, 31 Jul 2006 09:07:17 -0400
Author: mac
Date: 2006-07-31 09:07:16 -0400 (Mon, 31 Jul 2006)
New Revision: 1498
Modified:
trunk/perfsonar/src/org/perfsonar/service/commons/storage/xmldb/exist/rest/ExistDbHTTPAccess.java
Log:
Bug discovered by Loukik has been fixed.
If an empty line was returned by database in result set, the database sent it
as:
<exist:value .../>
and ExistDbHTTPAccess was waiting for
<exist:value ...></exist:value>
Error was in String.substr(int,int) method where one of indices was negative
(because of the lack of "</" sequence)
Modified:
trunk/perfsonar/src/org/perfsonar/service/commons/storage/xmldb/exist/rest/ExistDbHTTPAccess.java
===================================================================
---
trunk/perfsonar/src/org/perfsonar/service/commons/storage/xmldb/exist/rest/ExistDbHTTPAccess.java
2006-07-31 12:08:05 UTC (rev 1497)
+++
trunk/perfsonar/src/org/perfsonar/service/commons/storage/xmldb/exist/rest/ExistDbHTTPAccess.java
2006-07-31 13:07:16 UTC (rev 1498)
@@ -59,6 +59,10 @@
*/
public static final int DEBUG = 0x4000;
+ /**
+ * Enable DEBUG
+ */
+ public static final int DEBUG_MORE = 0xc000;
// -------------------------------------------------- other
@@ -159,6 +163,10 @@
if ((flags&DEBUG)>0)
debug = true;
+ boolean debug_more = false;
+ if ((flags&DEBUG_MORE)>0)
+ debug_more = true;
+
boolean full = false;
if ((flags&RETURN_XML_DB_RESULT)>0)
full = true;
@@ -295,8 +303,12 @@
//read each line
StringBuffer response = new StringBuffer();
String str;
- while ((str = rd.readLine()) != null) {
+ while ((str = rd.readLine()) != null) {
+ if (debug_more) {
+ System.out.println("[->] read line: ["+str+"]");
+ }
+
boolean doParseLine = true;
if (allowRemoveExistResult||full) {
@@ -359,7 +371,12 @@
if (str.trim().startsWith("<exist:value")) {
int ind1 = str.indexOf('>');
int ind2 = str.indexOf('<',ind1);
- str = str.substring(ind1+1,ind2);
+ // if negative indices,
+ // it means
+ // [<exist:value exist:type="(...)"/>]
+ if ((ind2<0)||(ind1<0)) { str=""; } //return
empty string
+ else
+ str = str.substring(ind1+1,ind2);
//return content of <exist:value> tag
}
}
@@ -383,6 +400,7 @@
//convert results to String
result = response.toString();
+
} //HTTP 200 OK
else {
- r1498 - trunk/perfsonar/src/org/perfsonar/service/commons/storage/xmldb/exist/rest, svnlog, 07/31/2006
Archive powered by MHonArc 2.6.16.