× 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.



Don,

Looks to me like you are doing the right thing in your example... I misread the earlier message as saying that the class was java.util.List. My mistake.

See, I knew I was asking a stupid question :-)

-SK



On 1/5/2017 4:45 PM, Don Brown wrote:
Forgive me but I am confused with your question and your question is
definitely not stupid.

My java skills are very, very poor and trial and error are my teacher.

I am trying to return an object into listIdJ using the method getIds on
java object result.

listIdJ = getIds(result);

The prototype for getIds is;

D getIds PR O ExtProc(*JAVA:
D 'com.braintreegateway.-
D ResourceCollection':'getIds')
D Class(*JAVA:'java.util.List')

So my understanding is for the ExtProc(*Java ... that you specify the
class as the first parameter and the method as the second.

From the results of;

javap -s com.braintreegateway.ResourceCollection

Compiled from "ResourceCollection.java"
public class com.braintreegateway.ResourceCollection extends
java.lang.Object implements java.lang.Iterable{
public com.braintreegateway.ResourceCollection(com.braintreegateway.Pager,
com.braintreegateway.util.NodeWrapper);
Signature:
(Lcom/braintreegateway/Pager;Lcom/braintreegateway/util/NodeWrapper;)V
public int getMaximumSize();
Signature: ()I
public java.util.Iterator iterator();
Signature: ()Ljava/util/Iterator;
public java.lang.Object getFirst();
Signature: ()Ljava/lang/Object;
public java.util.List getIds();
Signature: ()Ljava/util/List;
static java.util.List access$000(com.braintreegateway.ResourceCollection);
Signature: (Lcom/braintreegateway/ResourceCollection;)Ljava/util/List;

If I change the prototype as follows I get an error that the method is not
found when I run the program;

D getIds PR O ExtProc(*JAVA:
D 'com.braintreegateway.-
D ResourceCollection':'getIds')
D Class(*java:'com.braintreegateway.-
D ResourceCollection')

I have defined the receiving java object (listIdJ) as follows;

D listIdJ S O Class(*JAVA:'java.util.List')


If I open the jar file in eclipse and expand the
com.braintreegateway.resourceCollection.class I can get the following
signature details.

// Compiled from ResourceCollection.java (version 1.5 : 49.0, super bit)
// Signature:
<T:Ljava/lang/Object;>Ljava/lang/Object;Ljava/lang/Iterable<TT;>;
public class com.braintreegateway.ResourceCollection implements
java.lang.Iterable {

// Field descriptor #22 Ljava/util/List;
// Signature: Ljava/util/List<Ljava/lang/String;>;
private java.util.List ids;

// Field descriptor #26 Lcom/braintreegateway/Pager;
// Signature: Lcom/braintreegateway/Pager<TT;>;
private com.braintreegateway.Pager pager;

// Field descriptor #29 I
private int pageSize;

// Method descriptor #31
(Lcom/braintreegateway/Pager;Lcom/braintreegateway/util/NodeWrapper;)V
// Signature:
(Lcom/braintreegateway/Pager<TT;>;Lcom/braintreegateway/util/NodeWrapper;)V
// Stack: 3, Locals: 3
public ResourceCollection(com.braintreegateway.Pager pager,
com.braintreegateway.util.NodeWrapper response);
0 aload_0 [this]
1 invokespecial java.lang.Object() [4]
4 aload_0 [this]
5 aload_1 [pager]
6 putfield com.braintreegateway.ResourceCollection.pager :
com.braintreegateway.Pager [1]
9 aload_0 [this]
10 aload_2 [response]
11 ldc <String "page-size"> [5]
13 invokevirtual
com.braintreegateway.util.NodeWrapper.findInteger(java.lang.String) :
java.lang.Integer [6]
16 invokevirtual java.lang.Integer.intValue() : int [7]
19 putfield com.braintreegateway.ResourceCollection.pageSize : int
[2]
22 aload_0 [this]
23 aload_2 [response]
24 ldc <String "ids/*"> [8]
26 invokevirtual
com.braintreegateway.util.NodeWrapper.findAllStrings(java.lang.String) :
java.util.List [9]
29 putfield com.braintreegateway.ResourceCollection.ids :
java.util.List [3]
32 return
Line numbers:
[pc: 0, line: 74]
[pc: 4, line: 75]
[pc: 9, line: 76]
[pc: 22, line: 77]
[pc: 32, line: 78]
Local variable table:
[pc: 0, pc: 33] local: this index: 0 type:
com.braintreegateway.ResourceCollection
[pc: 0, pc: 33] local: pager index: 1 type:
com.braintreegateway.Pager
[pc: 0, pc: 33] local: response index: 2 type:
com.braintreegateway.util.NodeWrapper
Local variable type table:
[pc: 0, pc: 33] local: this index: 0 type:
com.braintreegateway.ResourceCollection<T>
[pc: 0, pc: 33] local: pager index: 1 type:
com.braintreegateway.Pager<T>

// Method descriptor #43 ()I
// Stack: 1, Locals: 1
public int getMaximumSize();
0 aload_0 [this]
1 getfield com.braintreegateway.ResourceCollection.ids :
java.util.List [3]
4 invokeinterface java.util.List.size() : int [10] [nargs: 1]
9 ireturn
Line numbers:
[pc: 0, line: 86]
Local variable table:
[pc: 0, pc: 10] local: this index: 0 type:
com.braintreegateway.ResourceCollection
Local variable type table:
[pc: 0, pc: 10] local: this index: 0 type:
com.braintreegateway.ResourceCollection<T>

// Method descriptor #45 ()Ljava/util/Iterator;
// Signature: ()Ljava/util/Iterator<TT;>;
// Stack: 4, Locals: 1
public java.util.Iterator iterator();
0 new com.braintreegateway.ResourceCollection$PagedIterator [11]
3 dup
4 aload_0 [this]
5 aload_0 [this]
6 invokespecial
com.braintreegateway.ResourceCollection$PagedIterator(com.braintreegateway.ResourceCollection,
com.braintreegateway.ResourceCollection) [12]
9 areturn
Line numbers:
[pc: 0, line: 90]
Local variable table:
[pc: 0, pc: 10] local: this index: 0 type:
com.braintreegateway.ResourceCollection
Local variable type table:
[pc: 0, pc: 10] local: this index: 0 type:
com.braintreegateway.ResourceCollection<T>

// Method descriptor #48 ()Ljava/lang/Object;
// Signature: ()TT;
// Stack: 4, Locals: 1
public java.lang.Object getFirst();
0 aload_0 [this]
1 getfield com.braintreegateway.ResourceCollection.pager :
com.braintreegateway.Pager [1]
4 aload_0 [this]
5 getfield com.braintreegateway.ResourceCollection.ids :
java.util.List [3]
8 iconst_0
9 iconst_1
10 invokeinterface java.util.List.subList(int, int) : java.util.List
[13] [nargs: 3]
15 invokeinterface com.braintreegateway.Pager.getPage(java.util.List)
: java.util.List [14] [nargs: 2]
20 iconst_0
21 invokeinterface java.util.List.get(int) : java.lang.Object [15]
[nargs: 2]
26 areturn
Line numbers:
[pc: 0, line: 94]
Local variable table:
[pc: 0, pc: 27] local: this index: 0 type:
com.braintreegateway.ResourceCollection
Local variable type table:
[pc: 0, pc: 27] local: this index: 0 type:
com.braintreegateway.ResourceCollection<T>

// Method descriptor #51 ()Ljava/util/List;
// Signature: ()Ljava/util/List<Ljava/lang/String;>;
// Stack: 1, Locals: 1
public java.util.List getIds();
0 aload_0 [this]
1 getfield com.braintreegateway.ResourceCollection.ids :
java.util.List [3]
4 areturn
Line numbers:
[pc: 0, line: 98]
Local variable table:
[pc: 0, pc: 5] local: this index: 0 type:
com.braintreegateway.ResourceCollection
Local variable type table:
[pc: 0, pc: 5] local: this index: 0 type:
com.braintreegateway.ResourceCollection<T>

// Method descriptor #54
(Lcom/braintreegateway/ResourceCollection;)Ljava/util/List;
// Stack: 1, Locals: 1
static synthetic java.util.List
access$000(com.braintreegateway.ResourceCollection x0);
0 aload_0 [x0]
1 getfield com.braintreegateway.ResourceCollection.ids :
java.util.List [3]
4 areturn
Line numbers:
[pc: 0, line: 16]
Local variable table:
[pc: 0, pc: 5] local: x0 index: 0 type:
com.braintreegateway.ResourceCollection

// Method descriptor #57 (Lcom/braintreegateway/ResourceCollection;)I
// Stack: 1, Locals: 1
static synthetic int access$100(com.braintreegateway.ResourceCollection
x0);
0 aload_0 [x0]
1 getfield com.braintreegateway.ResourceCollection.pageSize : int [2]
4 ireturn
Line numbers:
[pc: 0, line: 16]
Local variable table:
[pc: 0, pc: 5] local: x0 index: 0 type:
com.braintreegateway.ResourceCollection

// Method descriptor #59
(Lcom/braintreegateway/ResourceCollection;)Lcom/braintreegateway/Pager;
// Stack: 1, Locals: 1
static synthetic com.braintreegateway.Pager
access$200(com.braintreegateway.ResourceCollection x0);
0 aload_0 [x0]
1 getfield com.braintreegateway.ResourceCollection.pager :
com.braintreegateway.Pager [1]
4 areturn
Line numbers:
[pc: 0, line: 16]
Local variable table:
[pc: 0, pc: 5] local: x0 index: 0 type:
com.braintreegateway.ResourceCollection

Inner classes:
[inner class info: #11
com/braintreegateway/ResourceCollection$PagedIterator, outer class info:
#16 com/braintreegateway/ResourceCollection
inner name: #19 PagedIterator, accessflags: 2 private]


Don Brown

MSD Information Technology

Suite 5/29 McDougall Street Milton Q 4064
( 07 3368 7888
+ PO Box 1629 MILTON Q 4054
Ê 07 3368 7877
* Don.Brown@xxxxxxxxxx
È 0408 751 644
þ www.msd.net.au www.architect4web.com.au





I am a proud supporter of THE REFERRAL NETWORK and recommend the services
of the other member businesses. For more information please checkout the
website www.refnet.net.au





From: Scott Klement <rpg400-l@xxxxxxxxxxxxxxxx>
To: "RPG programming on the IBM i (AS/400 and iSeries)"
<rpg400-l@xxxxxxxxxxxx>
Date: 06/01/2017 07:32 AM
Subject: Re: ILERPG call to Java get list fails and generates core
dump
Sent by: "RPG400-L" <rpg400-l-bounces@xxxxxxxxxxxx>



Don,

Forgive me if this is a stupid question, but... You told us the method
was "java.util.List getIds()". But you appear to be calling
"com.braintreegateway.ResourceCollection getIds()".

So... why don't these match? Is there more than one getIds() method?
If so, can you show us the signature et al for the braintree one so that
we can see the signature for the one you're trying to call?

-SK





On 1/5/2017 3:08 AM, Don Brown wrote:
I am hoping someone can point me in the right direction with this one.

Java is crashing when I use a method that should return a java list
object..

I checked the class using the javap -s command in qsh I get the details
about the class; (All class details from this are included below)

The method I am using is gstIds
public java.util.List getIds();
Signature: ()Ljava/util/List;

I have the prototype defined in my program as follows;

D getIds PR O ExtProc(*JAVA:
D 'com.braintreegateway.-
D ResourceCollection':'getIds')
D Class(*JAVA:'java.util.List')

D listIdJ S O Class(*JAVA:'java.util.List')

The following code snippet precedes the error but running in debug all
statements complete normally

// Create search request
transReqJ = transReqC();
dateParamsJ = dateParams(transReqJ);
transreqJ = setRange(dateParamsJ: startJ: endJ);
transGatewayJ = transGateway(gateway);

// Retrieve the transactions
result = search(transGatewayJ: transReqJ);

When the following line is executed it results in a gpf and system dump.
There is a stack trace showing on the screen but is meaningless to me -
See below.

listIdJ = getIds(result);

The joblog shows error MSG:RNX0301 Java exception received when calling
Java method.
Cause . . . . . : RPG procedure STTAPP100R in program XAPSW/STTAPP100R
received Java exception "**UNKNOWN ERROR**" when calling method
"getIds"

with signature "()Ljava.util.List;" in class
"com.braintreegateway.ResourceCollection".


Results from javap -s

javap -s com.braintreegateway.ResourceCollection

The java.version property was detected as input. This property is used
as
output only and has no effect on JVM initialization.
Compiled from "ResourceCollection.java"
public class com.braintreegateway.ResourceCollection extends
java.lang.Object implements java.lang.Iterable{
public
com.braintreegateway.ResourceCollection(com.braintreegateway.Pager,
com.braintreegateway.util.NodeWrapper);
Signature:
(Lcom/braintreegateway/Pager;Lcom/braintreegateway/util/NodeWrapper;)V

public int getMaximumSize();
Signature: ()I
public java.util.Iterator iterator();
Signature: ()Ljava/util/Iterator;
public java.lang.Object getFirst();
Signature: ()Ljava/lang/Object;
public java.util.List getIds();
Signature: ()Ljava/util/List;
static java.util.List
access$000(com.braintreegateway.ResourceCollection);

Signature: (Lcom/braintreegateway/ResourceCollection;)Ljava/util/List;


Stack Trace from screen when error occurs

----------- Stack Backtrace -----------
gpProtectedRunCallInMethod+0x24 (0xD07F3BC0 [libj9vm24.so+0x15bc0])
signalProtectAndRunGlue+0x14 (0xD080F090 [libj9vm24.so+0x31090])
j9sig_protect+0x138 (0xD0872F54 [libj9prt24.so+0x1f54])
gpProtectAndRun+0xc4 (0xD080F19C [libj9vm24.so+0x3119c])
gpCheckCallin+0x44 (0xD07F4398 [libj9vm24.so+0x16398])
callVirtualObjectMethodA+0x38 (0xD07F8538 [libj9vm24.so+0x1a538])
J9_i5OS_CallObjectMethodA+0xac (0xD054C8B0 [libi5osenv.so+0xd8b0])
(0x000036F0)


Don Brown


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.