× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Try including the following statements before the getObjects call:

Trace.setTraceAllOn(true);
Trace.setTraceOn(true);

Then, either post the output here or send it to me privately off list and we
can see exactly what's happening.

Thanks,
Gary

-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-
bounces@xxxxxxxxxxxx] On Behalf Of Christopher J. Jewell
Sent: Monday, May 21, 2007 5:43 PM
To: JAVA400-L@xxxxxxxxxxxx
Subject: JTOpen - strange behavior of ObjectList -
ArrayIndexOutOfBounds when retrieving Object Attributes

Does anyone have any idea why I might be getting the following strange
behavior from JTopen's com.ibm.as400.access.ObjectList?

1. Successfully create an ObjectList and add the Extended Attribute as
a
value to retrieve:

ObjectList objectList = new ObjectList(this.as400, "MYLIBRARY",
ObjectList.ALL, "*PGM");
objectList.addObjectAttributeToRetrieve(ObjectDescription.EXTENDE
D_ATTRIBUT
E);

2. Do this:

ObjectDescription[] ods = objectList.getObjects(-1, 0);

retrieves all objects in the list as specified,

3. But if do this with the exact same ObjectList:
ObjectDescription[] ods = objectList.getObjects(1, 1); //
get the next one
element

then this throws:
java.lang.ArrayIndexOutOfBoundsException
at java.lang.System.arraycopy(Native Method)
at
com.ibm.as400.access.ObjectList.getObjects(ObjectList.java:950)
...

I have Googled ArrayIndexOutOfBounds AND ObjectList and have not found
anything - suggesting I'm doing something crazy here!

However, the issue is something to do with the
addObjectAttributeToRetrieve
method because if I comment that, the getObjects works just fine.
Obviously
I can do a objectDescription.getValue() after reading from the
ObjectList
but this involves another call out to the system (according to the
documentation).

Thanks in advance,

Chris Jewell
Korasoft Inc.
San Rafael, CA
mailto:jewellcj@xxxxxxxxxxxx
www.korasoft.com

--
This is the Java Programming on and around the iSeries / AS400
(JAVA400-L) mailing list
To post a message email: JAVA400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.