@@ -12,12 +12,12 @@ UseLSX "*javacon"
12
12
See the documentation of the individual classes for code examples .
13
13
% END REM
14
14
15
- REM Version : v1 .1.0
15
+ REM Version : v1 .1.1
16
16
17
17
REM Author : Harald Albers , HS - Hamburger Software GmbH & Co . KG
18
18
19
19
% REM Copyright
20
- Copyright (C ) 2010 HS - Hamburger Software GmbH & Co . KG . All rights reserved .
20
+ Copyright (C ) 2015 HS - Hamburger Software GmbH & Co . KG . All rights reserved .
21
21
22
22
This library is released under the Apache Licence Version 2.0 , see
23
23
http ://www.apache.org/licenses/LICENSE-2.0.txt
@@ -158,7 +158,7 @@ Class AbstractRegexMatcher
158
158
Dim jSession As New JavaSession
159
159
Dim jPatternClass As JavaClass
160
160
Set jPatternClass = jSession.GetClass("java/util/regex/Pattern")
161
- Set jPatternFactoryMethod = jPatternClass.GetMethod( "compile",_
161
+ Set jPatternFactoryMethod = getJavaMethod(jPatternClass, "compile",_
162
162
"(Ljava/lang/String;I)Ljava/util/regex/Pattern;")
163
163
End Sub
164
164
@@ -373,4 +373,23 @@ Class RegexMatcher As AbstractRegexMatcher
373
373
replaceFirst = jMatcher .replaceFirst(Replacement )
374
374
End Function
375
375
376
- End Class
376
+ End Class
377
+
378
+
379
+ % REM
380
+ Gets the JavaMethod with the specified name and signature from the given JavaClass .
381
+ This is needed to avoid " LS2J Error: Threw java.lang.InternalError" errors on recent
382
+ Domino versions when accessing Pattern .compile(String , int ).
383
+ % END REM
384
+ Private Function getJavaMethod(jClass As JavaClass , methodName As String , signature As String ) As JavaMethod
385
+ Dim jMCollection As JavaMethodCollection
386
+ Set jMCollection = jClass .getClassMethods()
387
+
388
+ ForAll m In jMCollection
389
+ If m.Methodname = methodName And m.Signature = signature Then
390
+ Set getJavaMethod = m
391
+ Exit Function
392
+ End If
393
+ End ForAll
394
+ Error 1 , " Method not found"
395
+ End Function
0 commit comments