LS2J Error: Threw java.lang.StackOverflowError
The stack over flow occurs when making many calls to LS2J. The size of the string did not seem to impact the stack, just that it was a string. There seems to be a problem with integers but not as noticible as with strings. I did some testing in 6.5.1 and 6.5.4 with the following results.
| Call Details | Number of calls with 6.5.1 & 6.5.4 | ||
| One String | 101,818 | ||
| Two Strings | 50,908 | ||
| Three Strings | 33,938 | ||
| One String 10 Integers | 101,789 | ||
| One String 20 Integers | 101,777 |
This problem has been "approved for investigation" by IBM. Becuase of this problem I am now forced to convert my document based LEI LotusScript code to Java. The last count was 4,600 lines of code. The code I used for testing follows.
Java Code
public class StackTest {
public StackTest (){
}
public void String1( String one ){
}
public void String2( String one , String two ){
}
public void String3( String one , String two , String three ){
}
public void String10( String one , String two , String three , String four , String five , String six , String seven , String eight , String nine , String ten ){
}
public void Integer1( int one ){
}
public void Integer2( int one , int two ){
}
public void Integer3( int one , int two , int three ){
}
public void Integer10( int one , int two , int three , int four , int five , int six , int seven , int eight , int nine , int ten ){
}
public void String1Integer10( String sOne, int one , int two , int three , int four , int five , int six , int seven , int eight , int nine , int ten ){
}
public void String1Integer20( String sOne, int one , int two , int three , int four , int five , int six , int seven , int eight , int nine , int ten, int oneone , int onetwo , int onethree , int onefour , int onefive , int onesix , int oneseven , int oneeight , int onenine , int oneten ){
}
}
LotusScript Code
Option Declare
Uselsx "*javacon"
Use "com.ChadSmiley"
Sub Initialize
On Error Goto ErrorHandler
Dim mySession As JavaSession
Dim myClass As JavaClass
Dim StringTest As JavaObject
Dim myJavaError As JavaError
Set mySession = New JavaSession()
Set myClass = mySession.GetClass("com/ChadSmiley/StackTest")
Set StringTest = myClass.CreateObject()
Dim i As Long
While True
i = i + 1
Call StringTest.String1( "1234567890" )
'101,818
'Call StringTest.String1( "12345678901234567890" )
'101,818
'Call StringTest.String2( "1234567890" , "1234567890" )
'50,908
'Call StringTest.String2( "12345678901234567890" , "12345678901234567890" )
'50,908
'Call StringTest.String3( "1234567890" , "1234567890" , "1234567890" )
'33,938
'Call StringTest.String1Integer10( "1234567890" , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 )
'101,789
'Call StringTest.String1Integer20( "1234567890" , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 )
'101,777
'Call StringTest.Integer10( 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 , 12345 )
'more than 740,000
If( i Mod 10000 )= 0Then
Print i
End If
Wend
Exit Sub
ErrorHandler:
Print i
Print "Error: " + Cstr( Err ) + " - " + Error( Err )
Set myJavaError = mySession.GetLastJavaError
Print myJavaError.stackTrace
End Sub