RFR: Export InitializeEncoding for JVM access

Roger Riggs Roger.Riggs at Oracle.com
Wed Apr 4 14:32:04 UTC 2018


Hi Andrew,

The function itself seems straightforward enough.

Can you clarify the boundary that you are replacing?  The initialization 
has a lot of
intermingled responsibilities and is quite sensitive.

What else needs to be said about when it can be called and who should be 
calling it?

I don't see the similarity to Canonicalize, which is not a supported 
interface, just
exported for use within the implementation.

Thanks, Roger


On 4/4/2018 8:17 AM, Andrew Leonard wrote:
> Hi,
> I would like to propose and find a sponsor for this change please, which
> is is export from libjava the JNU_InitializeEncoding() method, so that a
> JVM can initialize the platform encoding. Currently
> Java_java_lang_System_initProperties initializes the encoding, however for
>
> a generic JVM that will naturally provide it's own System implementation,
> the JVM needs a way to initialize this encoding directly. We can thus
> simply export it as per the change below.. There is precendence for doing
> this sort of export with Canonicalize().
> Thanks
> Andrew
>
> diff --git a/src/java.base/share/native/libjava/jni_util.c
> b/src/java.base/share/native/libjava/jni_util.c
> --- a/src/java.base/share/native/libjava/jni_util.c
> +++ b/src/java.base/share/native/libjava/jni_util.c
> @@ -840,6 +840,15 @@
>       String_value_ID = (*env)->GetFieldID(env, strClazz, "value", "[B");
>   }
>   
> +/*
> + * Export this method to allow JVM to initialize platform encoding
> explicitly.
> + */
> +JNIEXPORT void JNICALL
> +JNU_InitializeEncoding(JNIEnv *env, const char *encname)
> +{
> +       InitializeEncoding(env, encname);
> +}
> +
>   JNIEXPORT jstring
>   NewStringPlatform(JNIEnv *env, const char *str)
>   {
>
>
>
>
> Andrew Leonard
> Java Runtimes Development
> IBM Hursley
> IBM United Kingdom Ltd
> Phone internal: 245913, external: 01962 815913
> internet email: andrew_m_leonard at uk.ibm.com
>
>
> Unless stated otherwise above:
> IBM United Kingdom Limited - Registered in England and Wales with number
> 741598.
> Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU



More information about the core-libs-dev mailing list