axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andreas Veithen (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AXIS2-5868) Small logic error in axis2-kernel ParameterIncludeImpl.java
Date Sun, 20 Aug 2017 14:17:00 GMT

    [ https://issues.apache.org/jira/browse/AXIS2-5868?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16134434#comment-16134434
] 

Andreas Veithen commented on AXIS2-5868:
----------------------------------------

I believe that piece of code is actually nonsense and should be removed. There are two reasons:
* We synchronize on parameters anyway, so I don't understand why we would want to replace
the {{HashMap}} by a {{ConcurrentHashMap}} dynamically.
* As far as I know, {{ConcurrentModificationException}} is only thrown by iterators created
from a {{HashMap}}, but never by {{put}}.

> Small logic error in axis2-kernel ParameterIncludeImpl.java
> -----------------------------------------------------------
>
>                 Key: AXIS2-5868
>                 URL: https://issues.apache.org/jira/browse/AXIS2-5868
>             Project: Axis2
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 1.7.6
>            Reporter: Jeff Thomas
>
> Found small bug in the axis2-kernel ParameterIncludeImpl.java.
> The "parameters.put(param.getName(), param)" is always performed twice.
> It looks like a copy/paste mistake when moving the "put" into the try block, the original
line was not removed and remains outside of the try block.  In the worst-case scenario, the
ConcurrentModificationException would not be caught as expected.
> {code:java}
> public void addParameter(Parameter param) {
>   if (param != null) {
>     synchronized (parameters) {
>       parameters.put(param.getName(), param);
>       try {
>         parameters.put(param.getName(), param);
>       } catch (ConcurrentModificationException cme) {
>         ...
>       }
>   }
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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


Mime
View raw message