Uploaded image for project: 'Axis-C++'
  1. Axis-C++
  2. AXISCPP-496

soap/xsd classes throw exceptions by pointer not by value

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.5 Final
    • Serialization
    • None

    Description

      By chance I discovered that a lot of the classes in soap/xsd throw exceptions by pointer rather than by value. For example (from Date.cpp)....

      throw new AxisSoapException(CLIENT_SOAP_SOAP_CONTENT_ERROR, const_cast<AxisChar*>(exceptionMessage.c_str()));

      This is different from the rest of Axis C++ which does (example taken from SoapDeSerializer.cpp)...

      throw AxisGenException (AXISC_NODE_VALUE_MISMATCH_EXCEPTION);

      (Notice the lack of "new")
      What follows is what I think will happen, but I'm not sure so it will take some investigation. I think samples, clients and testcases catch (AxisException &e) so they will catch an exception reference or a exception value, but not an exception pointer. Clients would have to catch (AxisException *e) in order to catch an exception throw using throw new AxisSoapException().

      If an exception is new'ed and then thrown, who will delete the storage? It will be up to the client application or else there will be a storage leak.

      Also many of the methods in soap/xsd have throws(AxisSoapException) on their method prototype. I think this means that the method will allow AxisSoapException's to be thrown OK, but any other exceptions that are thrown will get converted to a bad_exception. So I think that AxisSoapException*'s will become bad_exception's as well. I think it is a bad idea to put throws(AxisSoapException) on a method prototype, since the compiler doesn't seem to check and it causes unforseen problems at runtime.

      I discussed this problem with Adrian Dick since he wrote the code originally. He agreed that it seems like a problem and he asked me to raise this JIRA.

      Attachments

        Activity

          People

            samisa Don Samisa Abeysinghe
            whitlock Mark Whitlock
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: