axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sanjaya Karunasena (JIRA)" <j...@apache.org>
Subject [jira] Updated: (AXIS2-2159) The class org.apache.axis2.uitl.Builder can be refactored to improve usability, improve object orientation and slightly improve performance
Date Mon, 12 Feb 2007 04:21:06 GMT

     [ https://issues.apache.org/jira/browse/AXIS2-2159?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Sanjaya Karunasena updated AXIS2-2159:
--------------------------------------

    Attachment: Axis2_Builder_Refactored_1.patch

The method "public static OMBuilder getBuilder(InputStream inStream, String charSetEnc, String
soapNamespaceURI)" in the class "org.apache.axis2.util.Builder" has been refactored as below.

The method getBuilder(Reader in) is deprecated so that if some is using that they can switch
to an appropriate getBuilder(InputStream inStream, ...) method.

Above method is refactored using method overloading and tow null checks went away automatically.
Since last two parameters are both of type String, I have to introduce a method getSOAPBuilder
to achieve the appropriate level of method overloading. Added some javadocs to the methods
I have modified/introduced. Fixed the other classes which make use of this method. They are,

../transport/mail/SimpleMailListener.java 
../transport/mail/server/MailSorter.java
../transport/jms/JMSUtils.java
../transport/TransportUtils.java


The interface look more object oriented and a developer who need to use this class, no longer
need to open the class and go through the implementation to see whether it can handle different
parameter choices.

Also I have removed the unused import statements in this class.


> The class org.apache.axis2.uitl.Builder can be refactored to improve usability, improve
object orientation and slightly improve performance
> -------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-2159
>                 URL: https://issues.apache.org/jira/browse/AXIS2-2159
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Improvement
>          Components: kernel
>         Environment: NA
>            Reporter: Sanjaya Karunasena
>         Attachments: Axis2_Builder_Refactored_1.patch
>
>
> The method "public static OMBuilder getBuilder(InputStream inStream, String charSetEnc,
String soapNamespaceURI)" in the class org.apache.axis2.uitl.Builder takes three parameters,
but when you look at the code last two parameters are optional. A more object oriented way
of handling this would be to have this method overloaded to handle the difference scenarios.
> Right now this method has two null checks which get executed every time due to this.
When I navigate through the calling stack I realize every time the caller is well aware of
whether the optional parameters are available or not and he is passing null in such scenarios
since there is no overloaded method. At the external interfaces where a parameter is really
required implementors are passing a default value making the null check redundant.
> Also there is one overloaded method which takes a parameter of type Reader which provides
the same functionality. IMO this method is again redundant since the only difference is how
you handle the input, which should be the responsibility of the caller, not the utility class
like this.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


Mime
View raw message