axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henrik Nordberg (JIRA)" <>
Subject [jira] Commented: (AXISCPP-721) Axis###Exception::getMessage() returns a static variable
Date Tue, 05 Jul 2005 16:47:14 GMT
    [ ] 

Henrik Nordberg commented on AXISCPP-721:

 Samisa wrote: 
> b. Constructor with 2 parameters, exception code and message, with message defaulting
to null. ExceptionClass(int code, char* msg = null)

Please change the second argument from char* to const char*, if you must use C style strings.
Having it non-const implies that ExceptionClass will own that pointer, which I don't think
is the intention (even if that was the case before).

Also, and I know I have suggested this a couple of times already, but why not use "const std::string&"

 - Henrik

> Axis###Exception::getMessage() returns a static variable
> --------------------------------------------------------
>          Key: AXISCPP-721
>          URL:
>      Project: Axis-C++
>         Type: Bug
>   Components: Server - Engine
>     Versions: current (nightly)
>     Reporter: Henrik Nordberg
>     Assignee: Dushshantha Chandradasa
>     Priority: Minor
>  Attachments: ExceptionModel_before.JPG
> Axis exceptions' method getMessage() returns a static variable. Here is an example of
the code for AxisSoapException:
> const string AxisSoapException::getMessage (const exception* objException)
> {
>     static string objExDetail = objException->what();
>     return objExDetail;
> }
> What is the purpose of making objExDetail static? Doing so means that it is initialized
the first time this method is called (once per instance of the class), and after that the
same value will be returned no matter what objException is. Here is a version without static:
> string AxisSoapException::getMessage (const exception& objException) const {
>     return objException.what();
> }
> I also made the method const since we will not modify members. Also why use a pointer
when we don't have to? :)
> I also think that since this code is common between Axis exceptions, it should be move
to a common base class.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

View raw message