Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8535529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:27:10+00:00 2026-06-11T10:27:10+00:00

In my GWT project, I created an elaborate design for an exception chain to

  • 0

In my GWT project, I created an elaborate design for an exception chain to be thrown in service calls, only to discover that the getCause() always returns null in a client’s onFailure() method.

After debugging through GWT serialization code, I found this code in SerializabilityUtil:

private static boolean fieldQualifiesForSerialization(Field field) {
    if (Throwable.class == field.getDeclaringClass()) {
        /**
         * Only serialize Throwable's detailMessage field; all others are ignored.
         *
         * NOTE: Changing the set of fields that we serialize for Throwable will
         * necessitate a change to our JRE emulation's version of Throwable.
         */
        if ("detailMessage".equals(field.getName())) {
            assert (isNotStaticTransientOrFinal(field));
            return true;
        } else {
            return false;
        }
    } else {
        return isNotStaticTransientOrFinal(field);
    }
}

Can anyone help me here, why would GWT designers put this in their code? Is there something really wrong (or security sensitive) with Throwable.cause?

And that taken for granted, how can I tell GWT serialization to make an exception for my exception class?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T10:27:11+00:00Added an answer on June 11, 2026 at 10:27 am

    Note the comments in the code that say Changing the set of fields that we serialize for Throwable will necessitate a change to our JRE emulation's version of Throwable. That’s why the code is there, because Throwable is Java, not Javascript, and as such, whatever is serialized to be caught at the client end must be compatible with GWT’s Javascript implementation of JRE classes. Look up GWT JRE Emulation Reference for more info.

    (Note that they might have attempted to be more aggressive in implementing Throwable sub-classes on the client side, but even if they did, they would still have no way to ensure that, say, some third party library’s exceptions would be present, and that would break the client-side deserialization.)

    I too have a rather elaborate exception chain, in my project. What I did is I made sure to preserve the message, rather than the cause, in all my exception object constructors. Unfortunately, some Java exceptions are, shall we say, less than verbose with regards to their message, as opposed to C#, for instance. NullPointerException, for example, has an altogether empty message, whereas ArrayIndexOutOfBoundsException just has a number. So, I took care to embed the name of the cause exception in the message, in my constructors.

    It’s not perfect, but it works.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created one GWT webapplication project.Inthat i want to create servlet program,but in that
I have gwt-project that is comunication to database. Application design mvp pattern and view
I have a simple GWT project in Eclipse, it has a servlet that calls
I have created a GWT project that has some menu items. These menu items
I have a gwt project that uses gwt-mosaic. Here is the error message I
I have a Smart GWT Project where the data that is to be displayed
I created an GWT project in eclipse. Now I tried to implement openId with
I've just created a GWT project and now I'm trying to search a file
I have a maven-based GWT project that includes Guava. I am running into trouble
I've created a GWT project using Eclipse which was working perfectly (I was able

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.