|
[Hibernate-issues] [Hibernate-JIRA] Assigned: (HB-487) Unecessary object creation in CharBooleanType
From: <leg...@at...> - 2003-11-21 21:12:24
|
Message:
The following issue has been re-assigned.
Assignee: Gavin King (mailto:ga...@hi...)
Assigner: Max Rydahl Andersen (mailto:xa...@xa...)
Date: Fri, 21 Nov 2003 3:10 PM
Comment:
I'll throw this in Gavin's direction - he is the valid-data-guru ;)
(Gavin - should we throw exception on data that is neither TRUE nor FALSE ?...)
When decided then just throw the issue back to me and i'll commit it - unless you ain't that busy ;)
---------------------------------------------------------------------
View the issue:
http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-487
Here is an overview of the issue:
---------------------------------------------------------------------
Key: HB-487
Summary: Unecessary object creation in CharBooleanType
Type: Patch
Status: Open
Priority: Trivial
Project: Hibernate2
Components:
core
Versions:
2.1 beta 6
Assignee: Gavin King
Reporter: Bertrand Renuart
Created: Fri, 21 Nov 2003 1:51 PM
Updated: Fri, 21 Nov 2003 3:10 PM
Description:
Unecessary objects are created when converting the data retrieved from the resultset to a Boolean.
Original code:
--------------
return new Boolean( code.toUpperCase().equals( getTrueString() ) );
Explanation:
------------
- code.toUpperCase() creates a new String - code.equalsIgnoreCase() should be used instead
- new Boolean() creates a new Boolean instance where Boolean.TRUE | FALSE could be used
This would lead to the following code:
if ( code.equalsIgnoreCase(getTrueString())) {
return Boolean.TRUE;
}
else {
return Boolean.FALSE;
}
A bit more efficient ;-)
Note: what should we do if code != getFalseString()? Should we throw an SQLException ?
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
|
|
[Hibernate-issues] [Hibernate-JIRA] Assigned: (HB-487) Unecessary object creation in CharBooleanType
From: <leg...@at...> - 2003-11-21 23:04:24
|
Message:
The following issue has been re-assigned.
Assignee: Max Rydahl Andersen (mailto:xa...@xa...)
Assigner: Gavin King (mailto:ga...@hi...)
Date: Fri, 21 Nov 2003 5:03 PM
Comment:
I applied the patch.
Yes, we should probably throw exception I suppose.
---------------------------------------------------------------------
View the issue:
http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-487
Here is an overview of the issue:
---------------------------------------------------------------------
Key: HB-487
Summary: Unecessary object creation in CharBooleanType
Type: Patch
Status: Open
Priority: Trivial
Project: Hibernate2
Components:
core
Versions:
2.1 beta 6
Assignee: Max Rydahl Andersen
Reporter: Bertrand Renuart
Created: Fri, 21 Nov 2003 1:51 PM
Updated: Fri, 21 Nov 2003 5:03 PM
Description:
Unecessary objects are created when converting the data retrieved from the resultset to a Boolean.
Original code:
--------------
return new Boolean( code.toUpperCase().equals( getTrueString() ) );
Explanation:
------------
- code.toUpperCase() creates a new String - code.equalsIgnoreCase() should be used instead
- new Boolean() creates a new Boolean instance where Boolean.TRUE | FALSE could be used
This would lead to the following code:
if ( code.equalsIgnoreCase(getTrueString())) {
return Boolean.TRUE;
}
else {
return Boolean.FALSE;
}
A bit more efficient ;-)
Note: what should we do if code != getFalseString()? Should we throw an SQLException ?
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
|
|
[Hibernate-issues] [Hibernate-JIRA] Assigned: (HB-487) Unecessary object creation in CharBooleanType
From: <leg...@at...> - 2003-11-23 21:28:25
|
Message: The following issue has been re-assigned. Assignee: Gavin King (mailto:ga...@hi...) --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-487 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-487 Summary: Unecessary object creation in CharBooleanType Type: Patch Status: Open Priority: Trivial Project: Hibernate2 Components: core Versions: 2.1 beta 6 Assignee: Gavin King Reporter: Bertrand Renuart Created: Fri, 21 Nov 2003 1:51 PM Updated: Sun, 23 Nov 2003 3:27 PM Description: Unecessary objects are created when converting the data retrieved from the resultset to a Boolean. Original code: -------------- return new Boolean( code.toUpperCase().equals( getTrueString() ) ); Explanation: ------------ - code.toUpperCase() creates a new String - code.equalsIgnoreCase() should be used instead - new Boolean() creates a new Boolean instance where Boolean.TRUE | FALSE could be used This would lead to the following code: if ( code.equalsIgnoreCase(getTrueString())) { return Boolean.TRUE; } else { return Boolean.FALSE; } A bit more efficient ;-) Note: what should we do if code != getFalseString()? Should we throw an SQLException ? --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |