<i18n dev> ArrayIndexOutOfBoundsException in ResourceBundle.getBundle(String)in JDK 6&7
Alan.Bateman at oracle.com
Fri Nov 4 12:39:08 PDT 2011
On 04/11/2011 12:03, Heiko Wagner wrote:
> Hi Tom, thanks for your reply. I am using JNI in a different,propably never
> designed to be used that way, kind of scenario. I use JNI to bring Java to a
> legacy Smalltalk based product.
> The Smalltalk code does directly invoke the JNI calls from its own Smalltalk
> VM main thread. So the Java VM is not aware of the calling thread and has no
> call stack information. Currently, I am using
> ClassLoader.getSystemClassLoader(), which perfectly works for me. I have no
> idea if this makes sense in gerneal, but for me a
> MissingResourceBundleException in my use case, would be what I propably
> would have expected, instead of a ArrayIndexOutOfBoundsException, so maybe a
> additional size check on the call stack array size would make sense.
The thread must be known to the VM as otherwise you wouldn't have a
JNIEnv and wouldn't be able to call the method (so I'll bet the thread
is attaching via AttachCurrentThread somewhere).
As to the ArrayIndexOutOfBoundsException, that does seem to be a bug as
I assume that getClassContext is returning an array of one element
corresponding to the caller frame (getBundle in this case).
More information about the i18n-dev