|
Hi Everyone,Good morning, I am sorry for the lengthy email.... I am encountering this error when calling prototype that contains calls to Java method from the main rpgle program....
I am calling the procedure with following eval statement from main program... First time I call the procedure, I instantiate the object with Constructer.... The second time I call the procedure ... I donot want to call the constructer method again. When the procedure is call second time, The intitialization loop is bypassed and the call to l java method is done ... The program errors saying "JVM 1 has ended" and Pointer not set for location referenced. The program works fine if i initialize (that is call the CONSTRUCTER) every time the sub procedure is called...
Any help you could provide would be much appreciated.... Thank You !!!! =========== Part of Main Program ============= D $Encrypt PR 32767 Varying D AlgID 32 D KeyID 64 D UnencryptedStr 32767 Const Varying Eval Encrypted = $Encrypt(AlgID : KeyID : UnencryptedStr) ================ End of Partial Main Program ========== ========== Here is the sub procedure ================== H NoMain Debug Option(*NoDebugIO)‚*=====================================================================
‚* Data Definition Specifications:‚*=====================================================================
‚* D AccessCtl UDS 60 Dtaara(Ingrian) D SrvProvider 20 D User_Name 20 D Pass_Word 20 D Initialization UDS Dtaara(*LDA) D CryptoObject 11 D $Encrypt PR 32767 Varying D AlgID 32 D KeyID 64 D UnEncryptedStr 32767 Const Varying P $Encrypt B Export D $Encrypt PI 32767 Varying D AlgID 32 D KeyID 64 D UnEncryptedStr 32767 Const Varying D ReturnMessage S 1000 Varying D NotEncrypted C 'Not Encrypted' D Initialized C 'Initialized' ‚* Prototype for Java constructor in class CipherHandler D CipherHandlerObjCtor...D PR O EXTPROC(*JAVA : 'com.sbux.crypto.c+
D ontrollers.CipherHandler' : D *CONSTRUCTOR)D CLASS(*JAVA : 'com.sbux.crypto.con+
D trollers.CipherHandler' ) ‚* Prototype for Java method Encrypt in class CipherHandlerD Encrypt PR O CLASS(*JAVA : 'com.sbux.crypto.com+
D mon.ReturnObject' )D EXTPROC(*JAVA : 'com.sbux.crypto.c+ D ontrollers.CipherHandler' : 'encry+
D pt' )D O CLASS(*JAVA : 'java.lang.String' ) D O CLASS(*JAVA : 'java.lang.String' ) D O CLASS(*JAVA : 'java.lang.String' )
‚* Definition of a Java method, getBytes() on the String class D GetBytes PR 65535A ExtProc(*JAVA: D 'java.lang.String': D 'getBytes') Varying ‚* Prototype for Java constructor in class ‚* getReturnCode in class ReturnObjectD GetReturnCode PR 10I 0 EXTPROC(*JAVA : 'com.sbux.crypto.c+ D ommon.ReturnObject' : 'getReturnCo+
D de' ) D ‚* Prototype for Java method ‚* getReturnString in class ReturnObject D GetReturnStringValue...D PR O CLASS(*JAVA : 'java.lang.String' ) D EXTPROC(*JAVA : 'com.sbux.crypto.c+ D ommon.ReturnObject' : 'getReturnSt+
D ringValue' ) ‚* Prototype for Java constructor in class ReturnObject D ReturnObjectObjCtor...D PR O EXTPROC(*JAVA : 'com.sbux.crypto.c+ D ommon.ReturnObject' : *CONSTRUCTOR) D CLASS(*JAVA : 'com.sbux.crypto.com+
D mon.ReturnObject' ) ‚* Prototype for Java method:‚* registerAccessCredentials in class CipherHandler in package com.sbux.crypto.controllers
D RegisterAccessCredentials...D PR EXTPROC(*JAVA : 'com.sbux.crypto.c+ D ontrollers.CipherHandler' : 'regis+
D terAccessCredentials' )D O CLASS(*JAVA : 'java.lang.String' ) D O CLASS(*JAVA : 'java.lang.String' ) D O CLASS(*JAVA : 'java.lang.String' )
‚* Prototype for Java method:‚* getReturnMessage in class ReturnObject in package com.sbux.cryptsbux.crypto.common
D GetReturnMessage...D PR O CLASS(*JAVA : 'java.lang.String' ) D EXTPROC(*JAVA : 'com.sbux.crypto.c+ D ommon.ReturnObject' : 'getReturnMe+
D ssage' ) ‚* Definition of Java constructor for the String class D StringC PR O ExtProc(*JAVA: D 'java.lang.String': D *CONSTRUCTOR) D 65535A Const Varying ‚* Java class CipherHandler Object D CipherHandlerObj...D S O CLASS(*JAVA: 'com.sbux.crypto.cont+
D rollers.CipherHandler' ) ‚* Returned field Enclaration for Java method: ‚* Encrypt in class CipherHandler ‚* Java returned type is com.sbux.crypto.common.ReturnObjectD EncryptRet S O CLASS(*JAVA : 'com.sbux.crypto.com+
D mon.ReturnObject' )‚* Returned field for Java method getReturnCode in class ReturnObject
D GetReturnCodeRet... D S 10I 0 D GetReturnMessageRet...D S O CLASS(*JAVA : 'java.lang.String' )
‚* Prototype for Java method getReturnStringValue in class ReturnObject
D GetReturnStringValueRet...D S O CLASS(*JAVA : 'java.lang.String' )
‚* Parameter field Enclarations for Java method: ‚* registerAccessCredentials in class CipherHandlerD Provider S O CLASS(*JAVA : 'java.lang.String' ) D User S O CLASS(*JAVA : 'java.lang.String' ) D Password S O CLASS(*JAVA : 'java.lang.String' )
‚* Parameter field Enclarations for Java method: ‚* Encrypt in class CipherHandlerD J_AlgID S O CLASS(*JAVA : 'java.lang.String' ) D J_KeyID S O CLASS(*JAVA : 'java.lang.String' ) D J_UnEncrypted S O CLASS(*JAVA : 'java.lang.String' )
‚* Java object of class ReturnObject in package com.sbux.crypto.common
D ReturnObjectObj...D S O CLASS(*JAVA: 'com.sbux.crypto.comm+
D on.ReturnObject' )‚*=====================================================================
‚* Mainline‚*=====================================================================
/Free If CryptoObject <> Initialized; CipherHandlerObj = CipherHandlerObjCtor(); ReturnObjectObj = ReturnObjectObjCtor; In *Lock AccessCtl; Unlock AccessCtl; Provider = StringC(%Trim(SrvProvider)); User = StringC(%Trim(User_Name)); PassWord = StringC(%Trim(Pass_Word)); CALLP registerAccessCredentials( cipherHandlerObj : Provider : User : PassWord ) ; CryptoObject = Initialized; Out Initialization; EndIf; J_AlgID = StringC(%Trim(AlgID)); J_KeyID = StringC(%Trim(KeyID)); J_Unencrypted = StringC(%TrimR(UnEncryptedStr)); EncryptRet = Encrypt( CipherHandlerObj : J_AlgID : J_KeyID : J_Unencrypted ); GetReturnStringValueRet = GetReturnStringValue(EncryptRet); If getReturnStringValueRet <> *NULL; Return GetBytes(getReturnStringValueRet); Else; getReturnCodeRet = getReturnCode( EncryptRet ); getReturnMessageRet = getReturnMessage( EncryptRet ); If getReturnMessageRet <> *NULL; ReturnMessage = getBytes(getReturnMessageRet); EndIF; Return NotEncrypted + ' ' + %Trim(ReturnMessage); EndIf; /End-Free P $Encrypt E VENKAT REDDY
As an Amazon Associate we earn from qualifying purchases.
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.