harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oleg Khaschansky" <oleg.v.khaschan...@gmail.com>
Subject Re: [classlib][awt] Test failure
Date Mon, 27 Nov 2006 11:22:54 GMT
> What do you think?
I don't like the idea of changing these wrappers manually. It's
possible to loose these changes if somebody will regenerate them
someday. But it is ok as a temporary solution.

On 11/24/06, Tim Ellison <t.p.ellison@gmail.com> wrote:
> Oleg Khaschansky wrote:
> > Do you suggest to introduce the error handling for all the wrappers or
> > only for this one? If for all, do you think if it will affect the
> > performance?
>
> I was thinking of something like this.  In the non-error case it would
> add an additional NULL check as the function address is being cached,
> and no additional overhead after the cache has been populated.
>
> The actual exception thrown is open to debate.
>
> Index:
> src/main/native/x11wrapper/linux/org_apache_harmony_awt_nativebridge_linux_X11.cpp
> ===================================================================
> ---
> src/main/native/x11wrapper/linux/org_apache_harmony_awt_nativebridge_linux_X11.cpp
> (revision 478891)
> +++
> src/main/native/x11wrapper/linux/org_apache_harmony_awt_nativebridge_linux_X11.cpp
> (working copy)
> @@ -23,6 +23,7 @@
>
>  #include "org_apache_harmony_awt_nativebridge_linux_X11.h"
>  #include "org_apache_harmony_awt_nativebridge_linux_ErrorHandler.h"
> +#include "exceptions.h"
>
>  static libHandler libX11;
>  static libHandler libXmu;
> @@ -575,6 +576,10 @@
>  JNIEXPORT jint  JNICALL
> Java_org_apache_harmony_awt_nativebridge_linux_X11_XmuLookupStandardColormap(
> JNIEnv *env, jobject self, jlong dpy, jint screen, jlong visualid, jint
> depth, jlong property, jint replace, jint retain) {
>      if (p_nbridge_XmuLookupStandardColormap == NULL) {
>          p_nbridge_XmuLookupStandardColormap = (int (*) (void *, int,
> long, int, long, int, int)) FindFunction(libXmu,
> "XmuLookupStandardColormap");
> +        if (p_nbridge_XmuLookupStandardColormap == NULL) {
> +            throwNewExceptionByName(env,
> "java/lang/UnsupportedOperationException", "Function not found");
> +            return 0;
> +               }
>      }
>      return (jint) (* p_nbridge_XmuLookupStandardColormap)((void *) dpy,
> (int) screen, (long) visualid, (int) depth, (long) property, (int)
> replace, (int) retain);
>  }
>
>
> What do you think?
>
> Regards,
> Tim
>
> --
>
> Tim Ellison (t.p.ellison@gmail.com)
> IBM Java technology centre, UK.
>

Mime
View raw message