[jira] [Commented] (OFBIZ-6291) Update code to check for types rather than throw ClassCastException

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (OFBIZ-6291) Update code to check for types rather than throw ClassCastException

Nicolas Malin (Jira)

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

Adam Heath commented on OFBIZ-6291:
-----------------------------------

"int i = foo..." isn't the part that is slower.  The instanceOf pattern is slower.

Good debuggers can check the return value of the expression before returnning, without the need for a local variable.  It introduces additional noise.

Also, I'm differing to Adrian here, who has a bit more familiarity with that code; I have added this to my list of things to check, but I'm working on several other branches right now against trunk, so please be patient.

> Update code to check for types rather than throw ClassCastException
> -------------------------------------------------------------------
>
>                 Key: OFBIZ-6291
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-6291
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: framework
>    Affects Versions: Trunk
>            Reporter: Gareth Carter
>            Priority: Trivial
>         Attachments: LocalizedConverters.patch, minilang_compare.patch, minilang_compare_r1675655.patch
>
>
> framework/minilang/src/org/ofbiz/minilang/method/conditional/Compare.java
> framework/base/src/org/ofbiz/base/util/ObjectType.java
> framework/minilang/src/org/ofbiz/minilang/MiniLangUtil.java
> all throw ClassCastExceptions and are ignored instead of checking types
> This caused issues in debugging when adding a ClassCastException breakpoint



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