Hi all,
I take the liberty of submitting you my problem, because I can't find anywere a
forum to do it.
the problem is :
when i execute the following codes :
results = sXSet.openXStream(XSet.XAM_JOB_QUERY_RESULTS, XSet.MODE_READ_ONLY);
List<XUID> xuids = new ArrayList<XUID>();
XUIDIterator iterator = new XUIDIterator(results);
int i = 1;
while (iterator.hasNext()) {
XUID xuid = (XUID)iterator.next();
xuids.add(xuid);
System.out.println("[" + i++ + "]" + "xuid = [" + xuid + "]");
}
I get the exception mentioned below on 'iterator.hasNext()':
org.snia.xam.InvalidXUIDException: byte[] too short 0
at org.snia.xam.util.XUIDIterator.hasNext(Unknown Source)
Your help will be appreciate
Thanks you in avance
Best regards
Diabate
Please answer the following questions:
* What VIM / XSystem are you using?
* How many iterations did the loop get through (i.e. what is the value of "i").
* This looks like you may be running Java 5 or later, but exactly what version?
* What OS is hosting the client?
Offhand it looks like an invalid XUID is being returned in the results.
Mike Allison
> --
> You received this message because you are subscribed to the "XAM Developers Group" group.
> To post to this group, send email to
> xam-develo...@googlegroups.com
> To unsubscribe from this group, send email to
> xam-developers-g...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/xam-developers-group?hl=en
> Reminder that due to the SNIA IP Policy, only bug reports can be accepted as feedback for the specification or code.
1) I use the XAM HTTP VIM
2) There one iteration to loop as you can see on the log below :
Query[SELECT ".xset.xuid" WHERE "filename" like '%testDoc%']:
SUCCESS: <Create XSet>
SUCCESS: <Create Job Command Property>
SUCCESS: <Create Query Command XStream>
XStream Write
SUCCESS: <XSet SubmitJob>
Waiting until query is finished
Query job is completed!
XUID result set found = 1 *********
Open Query Results XStream
3) I use java 6
4) The client is hosting to a professionnal windows xp.
For your information, the same program of test work fine with the
Reference VIM.
best regards,
Diabate
On 1 fév, 18:23, "Michael J. Allison" <alliso...@sbcglobal.net> wrote:
> It's hard to tell exactly what is happening. The XUID Iterator is trying to create an instance of a DefaultXUID class and apparently the passed in byte xuid values are too short (less than the minimum XUID length). This is difficult because you did not include the entire stack trace, but I think I know where it's broken.
>
> Please answer the following questions:
> * What VIM / XSystem are you using?
> * How many iterations did the loop get through (i.e. what is the value of "i").
> * This looks like you may be running Java 5 or later, but exactly what version?
> * What OS is hosting the client?
>
> Offhand it looks like an invalid XUID is being returned in the results.
>
> Mike Allison
>
Open the result XStream
Read 80 bytes from the stream
Build an XSet from it
Process your results
That's more or less what the XUID iterator does (it will also wait until the query job has results, but that's not important here). If that code works, the error is in the XUIDIterator. If this new code is unable to read all 80 bytes of the XUID, then error is probably in the HTTP VIM transport.
I'd also put in some debugging to show how long the result stream is. It should be exactly 80 bytes. If the result stream has less than 80 bytes, it's an error in the XAM System at the remote end (I assume it is the Reference VIM, but you didn't state what system is at the far end).
If you can reduce your test program to a small reproducible test case I can run it in my environment and see if I can get it to fail.
Mike A
I am sorry but it's not possible to attach files to this area.
You can find below my test case. The superclass ExampleBase contain
the following methods : initLibrary(), connectToVIM(s_xri) and
authenticate(xsystem).
public class QueryExecutor extends ExampleBase {
private static XSet sXSet;
private static XStream sXStream;
private static XSystem xsystem;
private static final int BUFFER_SIZE = 80;
public static void main(String[] args) {
String query = "SELECT \".xset.xuid\" WHERE \"filename\" like
'%testDoc%'";
try {
// Have to init and load VIM since it's being run in this
JVM
initLibrary();
// Now do the client connect to the VIM
System.out.println("Client application connecting to the
VIM");
xsystem = connectToVIM(s_xri);
// Authenticate our user credentials
System.out.println("\nClient application authenticating
user credentials");
authenticate(xsystem);
System.out.print("Query[" + query + "]: ");
execQuery(query, true);
xsystem.close();
System.out.println("\nClosed connection to XSystem (" + s_xri
+ ")");
} catch (Exception ex) {
ex.printStackTrace();
}finally{
System.exit(0);
}
}
private static void execQuery(String query, boolean wait) throws
Exception {
XSet xSet = QueryFactory.Query( xsystem, query );
if (wait) {
System.out.println("Waiting until query is finished");
checkQuery();
}
sXSet.close();
}
private static void checkQuery() throws XAMException {
boolean finished = false;
while (!finished) {
String status = "N/A";
try {
// Make sure that there is nothing wrong with query job
status = sXSet.getString(XSet.XAM_JOB_ERRORHEALTH);
} catch (FieldDoesNotExistException e) {
// Ignore field not found exceptions, they are not fatal
here
}
if (status.equals(XSet.XAM_JOB_ERRORHEALTH_ERROR)) {
sXSet.haltJob();
break;
}
// Check job status and show the results if job already
finished
status = sXSet.getString(XSet.XAM_JOB_STATUS);
if (status.equals(XSet.XAM_JOB_STATUS_COMPLETE)) {
finished = true;
System.out.println("Query job is completed!");
// Check whether the results field
(xam.job.query.results.count)
// exists or not
if (!sXSet.containsField(XSet.XAM_JOB_QUERY_RESULTS_COUNT))
break;
// Get how many results set are returned from query job
int resultCount = (int) sXSet.getLong
(XSet.XAM_JOB_QUERY_RESULTS_COUNT);
if (resultCount == 0)
break;
displayXUIDs(resultCount);
}
}
}
private static void displayXUIDs(long inCount) throws XAMException {
System.out.println("XUID result set found = " + inCount);
XStream results = null;
try {
results = sXSet.openXStream(XSet.XAM_JOB_QUERY_RESULTS,
XSet.MODE_READ_ONLY);
System.out.println("Open Query Results XStream");
} catch (FieldDoesNotExistException e) {
System.out.println("\nQuery Results XStream Unavailable");
return;
}
System.out.println("\n --------------- <Start XUID List>
------------------");
List<XUID> xuids = new ArrayList<XUID>();
XUIDIterator iterator = new XUIDIterator(results);
int i = 1;
while (iterator.hasNext()) {
XUID xuid = (XUID)iterator.next();
xuids.add(xuid);
System.out.println("[" + i++ + "]" + "xuid = [" + xuid + "]");
}
System.out.println("---------------- <End XUID
List>---------------------- \n");
results.close();
System.out.println("Close Query Results XStream");
}
}
thanks you,
diabate
On Feb 3, 2010, at 1:29 AM, mdi wrote:
> Hi Mike,
>
On Feb 3, 2010, at 1:29 AM, mdi wrote:
> Hi Mike,
>
Mike A
On Feb 3, 10:31 am, "Michael J. Allison" <alliso...@sbcglobal.net>
wrote:
Diabate