You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/07/20 03:38:20 UTC

[jira] [Commented] (LANG-1250) SerializationUtils::deserialize has unnecessary code and a comment for that

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

ASF GitHub Bot commented on LANG-1250:
--------------------------------------

GitHub user Glease opened a pull request:

    https://github.com/apache/commons-lang/pull/174

    [LANG-1250] SerializationUtils::deserialize has unnecessary code and a comment for that

    There is no real CCE possible, even the javadoc say so. Github's blame showed the code and javadoc is written by two indiviual person in two different years, so that may be the cause.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/Glease/commons-lang patch-1

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/commons-lang/pull/174.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #174
    
----
commit c9fa6ce087cd0c04902d11f0257bf23cce5a403a
Author: Glease <gl...@outlook.com>
Date:   2016-07-20T03:14:05Z

    Update SerializationUtils.java
    
    There is no real CCE possible, even the javadoc say so. Github's blame showed the code and javadoc is written by two indiviual person in two different years, so that may be the cause.

----


> SerializationUtils::deserialize has unnecessary code and a comment for that
> ---------------------------------------------------------------------------
>
>                 Key: LANG-1250
>                 URL: https://issues.apache.org/jira/browse/LANG-1250
>             Project: Commons Lang
>          Issue Type: Improvement
>          Components: lang.*
>    Affects Versions: 3.4
>            Reporter: glease w.
>            Priority: Trivial
>              Labels: easyfix, newbie
>             Fix For: 3.x
>
>   Original Estimate: 5m
>  Remaining Estimate: 5m
>
> In org.apache.commons.lang3.SerializationUtils L219-L227: 
> {quote}
>         try \{
>             // stream closed in the finally
>             in = new ObjectInputStream(inputStream);
>             @SuppressWarnings("unchecked") // may fail with CCE if serialised form is incorrect
>             final T obj = (T) in.readObject();
>             return obj;
>         } catch (final ClassCastException ex) \{
>             throw new SerializationException(ex);
> {quote}
> and in the javadoc: 
> {quote}
>      \* 
>      \* <p>
>      \* If the call site incorrectly types the return value, a \{@link ClassCastException} is thrown from the call site.
>      \* Without Generics in this declaration, the call site must type cast and can cause the same ClassCastException.
>      \* Note that in both cases, {color:red}the ClassCastException is in the call site, not in this method.{color}
>      \* </p>
>      \*
> {quote}
> There is a conflict. The first catch block and that inlined comment needs to be removed. I'll submit a patch via github soon.
>  Blame showed the javadoc and code are written by indiviual person in different years, so that may be the cause. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)