Loading ...
Sorry, an error occurred while loading the content.

Re: Exceptions in JSX

Expand Messages
  • bren@mail.csse.monash.edu.au
    Hi Marti, ... know if ... parsing ... display an ... Thanks a lot for your post - I m not 100% on Exception handling, and you make the issues very clear. Your
    Message 1 of 4 , Oct 1, 2001
    • 0 Attachment
      Hi Marti,
      > Why is it that all exceptions seem to be caught by JSX? I need to
      know if
      > there is a ClassNotFoundException during deserialization, or a
      parsing
      > error, or whatever, so I can tell that something went wrong and
      display an
      > intelligent message about it.
      Thanks a lot for your post - I'm not 100% on Exception handling, and
      you make the issues very clear. Your approach is much appreciated.

      I'm starting to use Raimi's and Philip's ideas and code to improve
      this.

      JSX 0.9.0.3 is a first effort at incorporating these ideas, and
      hopefully is sufficient to give you the behaviour and information
      you need.

      Have a great day!


      Cheers,
      Brendan
      ------------------------------------------------------------------
      Explanations:
      Unfortunately, I don't think I can give a really good reason for
      JSX's exception handling (especially the catch-alls), except for
      a residual focus on debugging JSX itself.

      Philip Gust posted some excellent solutions to this a couple of
      months ago, and Raimi a long time before that... but I am only just
      starting to give them the attention they deserve.

      It's delayed partly because there were other issues that seemed
      more important, partly because JSX had iterated through a couple
      more releases when the patch arrived (so it was hard to integrate),
      and partly because I have little experience in proper Exception
      handling - which I'm well and truly about to get!

      Having had a first go at improving the Exception handling, I feel
      ashamed that I didn't honour Philip's and Raimi's contribution
      by diving into them much sooner - Exception handling is a difficult
      area for me, and I really need the guidance of an experienced eye.
      I've just printed out Philip's solution, and will examine it in
      detail tommorrow.

      So this is not just an explanation, but also an apology for not
      accepting more fully the gifts of others - thank you Philip and
      Raimi! I promise to try harder! :-)

      And have an extra fantastic day, you who read this far! ;-)


      Cheers,
      Brendan



      --- In JSX-ideas@y..., Marti DeMore <Martha.D.DeMore@j...> wrote:
      >
      > Why is it that all exceptions seem to be caught by JSX? I need to
      know if
      > there is a ClassNotFoundException during deserialization, or a
      parsing
      > error, or whatever, so I can tell that something went wrong and
      display an
      > intelligent message about it. For example, in ObjIn.java:
      >
      > protected Object readObjectOverride() throws IOException {
      > if (d.invocationCount>0) //ie if already inside
      > defaultReadObject(); //false = don't read
      in fields
      > if (TRACE) System.err.println("readObjectOverride()");
      > Object o = null;
      > try {
      > o = d.deserialize();
      > } catch (Exception e) {
      > e.printStackTrace();
      > }
      >
      > The method signature indicates it can throw an IOException, but
      then
      > catches ALL exceptions from deserialize() and puts them into the
      bit
      > bucket. Other exceptions are caught even deeper, leaving me with a
      > partially restored object. I needed the exception to know this.
      Is there
      > anything I can do about this?
      >
      > -Marti DeMore
      > Jet Propulsion Laboratory
      > Pasadena, CA, USA
      > Martha.D.DeMore@j...
    • Marti DeMore
      I ll give 0.9.0.3 a try Tuesday morning and see how the exception behavior fits for me. One of the biggest problems I had was when I changed the name of a
      Message 2 of 4 , Oct 1, 2001
      • 0 Attachment
        I'll give 0.9.0.3 a try Tuesday morning and see how the exception behavior
        fits for me. One of the biggest problems I had was when I changed the name
        of a member in one of my objects. When I tried to read an old output
        stream, I got no exception, and that particular object simply was left as
        null.

        -Marti

        At 10/1/2001 06:46 AM, you wrote:
        >Hi Marti,
        > > Why is it that all exceptions seem to be caught by JSX? I need to
        >know if
        > > there is a ClassNotFoundException during deserialization, or a
        >parsing
        > > error, or whatever, so I can tell that something went wrong and
        >display an
        > > intelligent message about it.
        >Thanks a lot for your post - I'm not 100% on Exception handling, and
        >you make the issues very clear. Your approach is much appreciated.
        >
        >I'm starting to use Raimi's and Philip's ideas and code to improve
        >this.
        >
        >JSX 0.9.0.3 is a first effort at incorporating these ideas, and
        >hopefully is sufficient to give you the behaviour and information
        >you need.
        >
        >Have a great day!
        >
        >
        >Cheers,
        >Brendan
        >------------------------------------------------------------------
        >Explanations:
        >Unfortunately, I don't think I can give a really good reason for
        >JSX's exception handling (especially the catch-alls), except for
        >a residual focus on debugging JSX itself.
        >
        >Philip Gust posted some excellent solutions to this a couple of
        >months ago, and Raimi a long time before that... but I am only just
        >starting to give them the attention they deserve.
        >
        >It's delayed partly because there were other issues that seemed
        >more important, partly because JSX had iterated through a couple
        >more releases when the patch arrived (so it was hard to integrate),
        >and partly because I have little experience in proper Exception
        >handling - which I'm well and truly about to get!
        >
        >Having had a first go at improving the Exception handling, I feel
        >ashamed that I didn't honour Philip's and Raimi's contribution
        >by diving into them much sooner - Exception handling is a difficult
        >area for me, and I really need the guidance of an experienced eye.
        >I've just printed out Philip's solution, and will examine it in
        >detail tommorrow.
        >
        >So this is not just an explanation, but also an apology for not
        >accepting more fully the gifts of others - thank you Philip and
        >Raimi! I promise to try harder! :-)
        >
        >And have an extra fantastic day, you who read this far! ;-)
        >
        >
        >Cheers,
        >Brendan
        >
        >
        >
        >--- In JSX-ideas@y..., Marti DeMore <Martha.D.DeMore@j...> wrote:
        > >
        > > Why is it that all exceptions seem to be caught by JSX? I need to
        >know if
        > > there is a ClassNotFoundException during deserialization, or a
        >parsing
        > > error, or whatever, so I can tell that something went wrong and
        >display an
        > > intelligent message about it. For example, in ObjIn.java:
        > >
        > > protected Object readObjectOverride() throws IOException {
        > > if (d.invocationCount>0) //ie if already inside
        > > defaultReadObject(); //false = don't read
        >in fields
        > > if (TRACE) System.err.println("readObjectOverride()");
        > > Object o = null;
        > > try {
        > > o = d.deserialize();
        > > } catch (Exception e) {
        > > e.printStackTrace();
        > > }
        > >
        > > The method signature indicates it can throw an IOException, but
        >then
        > > catches ALL exceptions from deserialize() and puts them into the
        >bit
        > > bucket. Other exceptions are caught even deeper, leaving me with a
        > > partially restored object. I needed the exception to know this.
        >Is there
        > > anything I can do about this?
        > >
        > > -Marti DeMore
        > > Jet Propulsion Laboratory
        > > Pasadena, CA, USA
        > > Martha.D.DeMore@j...
        >
        >
        >
        >To unsubscribe from this group, send an email to:
        >JSX-ideas-unsubscribe@egroups.com
        >
        >
        >
        >Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
      • bren@mail.csse.monash.edu.au
        Hi Marti, ... You raise a central conumdrum for schema evolution. The behaviour you describe (silent failure) is what binary serialization does, too. (I just
        Message 3 of 4 , Oct 1, 2001
        • 0 Attachment
          Hi Marti,

          > One of the biggest problems I had was when I changed the name
          > of a member in one of my objects. When I tried to read an old
          > output stream, I got no exception, and that particular object
          > simply was left as null.

          You raise a central conumdrum for schema evolution. The behaviour
          you describe (silent failure) is what binary serialization does, too.
          (I just confirmed this with some test code, to be 100% sure).

          JSX used to throw an exception for this, but it was inconvenient for
          users. Perhaps there could be a user switch, to enable this
          exception?

          However, the philosophical stance behind Java's Serialization is that
          an object is responsible for its own serialization. Fields with
          name changes can be read back in with GetField; or the object can
          customise its serialzation by writing/reading the stream directly
          (writeInt(), writeObject() etc).

          An alternative approach is to make the serialization dynamically
          customizable from outside the classes in question.

          But you raise a third way - to handle these as they arise via an
          Exception. Unfortunately, this would seem to break compatibility
          with Java's Serialization altogether, and so would have to be
          implemented in an entirely new tool... but very interesting, and
          perhaps a much more convenient way to go about it! Thanks for this
          idea.

          Have a great day!


          Cheers,
          Brendan

          >
          > -Marti
          >
          > At 10/1/2001 06:46 AM, you wrote:
          > >Hi Marti,
          > > > Why is it that all exceptions seem to be caught by JSX? I need
          to
          > >know if
          > > > there is a ClassNotFoundException during deserialization, or a
          > >parsing
          > > > error, or whatever, so I can tell that something went wrong and
          > >display an
          > > > intelligent message about it.
          > >Thanks a lot for your post - I'm not 100% on Exception handling,
          and
          > >you make the issues very clear. Your approach is much appreciated.
          > >
          > >I'm starting to use Raimi's and Philip's ideas and code to improve
          > >this.
          > >
          > >JSX 0.9.0.3 is a first effort at incorporating these ideas, and
          > >hopefully is sufficient to give you the behaviour and information
          > >you need.
          > >
          > >Have a great day!
          > >
          > >
          > >Cheers,
          > >Brendan
          > >------------------------------------------------------------------
          > >Explanations:
          > >Unfortunately, I don't think I can give a really good reason for
          > >JSX's exception handling (especially the catch-alls), except for
          > >a residual focus on debugging JSX itself.
          > >
          > >Philip Gust posted some excellent solutions to this a couple of
          > >months ago, and Raimi a long time before that... but I am only just
          > >starting to give them the attention they deserve.
          > >
          > >It's delayed partly because there were other issues that seemed
          > >more important, partly because JSX had iterated through a couple
          > >more releases when the patch arrived (so it was hard to integrate),
          > >and partly because I have little experience in proper Exception
          > >handling - which I'm well and truly about to get!
          > >
          > >Having had a first go at improving the Exception handling, I feel
          > >ashamed that I didn't honour Philip's and Raimi's contribution
          > >by diving into them much sooner - Exception handling is a difficult
          > >area for me, and I really need the guidance of an experienced eye.
          > >I've just printed out Philip's solution, and will examine it in
          > >detail tommorrow.
          > >
          > >So this is not just an explanation, but also an apology for not
          > >accepting more fully the gifts of others - thank you Philip and
          > >Raimi! I promise to try harder! :-)
          > >
          > >And have an extra fantastic day, you who read this far! ;-)
          > >
          > >
          > >Cheers,
          > >Brendan
          > >
          > >
          > >
          > >--- In JSX-ideas@y..., Marti DeMore <Martha.D.DeMore@j...> wrote:
          > > >
          > > > Why is it that all exceptions seem to be caught by JSX? I need
          to
          > >know if
          > > > there is a ClassNotFoundException during deserialization, or a
          > >parsing
          > > > error, or whatever, so I can tell that something went wrong and
          > >display an
          > > > intelligent message about it. For example, in ObjIn.java:
          > > >
          > > > protected Object readObjectOverride() throws IOException {
          > > > if (d.invocationCount>0) //ie if already
          inside
          > > > defaultReadObject(); //false = don't
          read
          > >in fields
          > > > if (TRACE) System.err.println("readObjectOverride
          ()");
          > > > Object o = null;
          > > > try {
          > > > o = d.deserialize();
          > > > } catch (Exception e) {
          > > > e.printStackTrace();
          > > > }
          > > >
          > > > The method signature indicates it can throw an IOException, but
          > >then
          > > > catches ALL exceptions from deserialize() and puts them into the
          > >bit
          > > > bucket. Other exceptions are caught even deeper, leaving me
          with a
          > > > partially restored object. I needed the exception to know this.
          > >Is there
          > > > anything I can do about this?
          > > >
          > > > -Marti DeMore
          > > > Jet Propulsion Laboratory
          > > > Pasadena, CA, USA
          > > > Martha.D.DeMore@j...
          > >
          > >
          > >
          > >To unsubscribe from this group, send an email to:
          > >JSX-ideas-unsubscribe@egroups.com
          > >
          > >
          > >
          > >Your use of Yahoo! Groups is subject to
          http://docs.yahoo.com/info/terms/
        Your message has been successfully submitted and would be delivered to recipients shortly.