[
https://issues.apache.org/jira/browse/OFBIZ-6291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14510663#comment-14510663
]
Gareth Carter commented on OFBIZ-6291:
--------------------------------------
What I have found is the cast to BigDecimal is fastest only if the object being
cast is always BigDecimal, casting another object (eg java.lang.String) without
type check (eg, catching and ignoring ClassCastException) is much slower. But
these are in the nanosecond range of performance, hardly an argument to use one
method or another. I just think it would be better to check for types rather
than throwing an uncaught exception and not doing anything
I appreciate all committers are busy with life, work or other. This is a
trivial issue, I don't believe this will have any functional impact, its just
an improvement in code readability and follows better practices.
I still have reservations about compareBigDecimals but this is another issue to
discuss somewhere else
> 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)