Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0016531
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] A. Platformminorsometimes2011-03-29 13:132011-06-13 10:57
ReporteradrianromeroView Statuspublic 
Assigned Todalsasua 
PrioritynormalResolutionfixedFixed in Version3.0MP0
StatusclosedFix in branchFixed in SCM revision7d9ed704c9ce
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionpiSCM revision 
Review Assigned To
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0016531: Cannot use null in a BaseOBObject parameter when calling a procedure

DescriptionWhen using the class CallStoredProcedure to call a procedure and passing NULL in a parameter of type BaseOBObject an error is returned. If the value is not null it works
Steps To ReproduceWhen calling a procedure pass a parameter using the following code:

types.add(org.openbravo.model.common.currency.ConversionRate.class);
parameters.add(null);

The problem is in the method getSQLType that raises an exception. In this particular case VARCHAR must be returned.
TagsNo tags attached.
Attached Filesdiff file icon Fix-16531.diff [^] (581 bytes) 2011-03-29 13:18 [Show Content]

- Relationships Relation Graph ] Dependency Graph ]
blocks backport 00165412.50MP30 closedadrianromero Cannot use null in a BaseOBObject parameter when calling a procedure 

-  Notes
(0035335)
maite (developer)
2011-03-29 15:58

support_ticket=10946
due_date=03/06/2011
(0035433)
hgbot (developer)
2011-03-31 17:26

Repository: erp/devel/pi
Changeset: 7d9ed704c9ceb4df05b49f73fac52ccf63d5f062
Author: Adrián Romero <adrianromero <at> openbravo.com>
Date: Thu Mar 31 17:24:30 2011 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/7d9ed704c9ceb4df05b49f73fac52ccf63d5f062 [^]

Fixes issue 0016531: Cannot use null in a BaseOBObject parameter when calling a procedure
It has been modified the code to detect nulls when assigning as a procedure parameter a BaseOBObject

---
M src/org/openbravo/service/db/CallStoredProcedure.java
---
(0035434)
adrianromero (manager)
2011-03-31 17:34

* Testing the issue

Call an stored procedure passing a null value to a parameter of type BaseOBObject. For example the following code works:

List<Object> parameters = new ArrayList<Object>();
List<Class<?>> types = new ArrayList<Class<?>>();

types.add(BigDecimal.class);
parameters.add(new BigDecimal(120.0)); // Amount to covert: 120,00 €

types.add(String.class);
parameters.add("102"); // ID for EUR

types.add(String.class);
parameters.add("100"); // ID for USD

types.add(Date.class);
parameters.add(new Date()); // Conversion date

types.add(String.class);
parameters.add("S"); // ID for standard conversion type

types.add(String.class);
parameters.add("4028E6C72959682B01295A070852010D"); // ID for Sample Client

types.add(String.class);
parameters.add("0"); // ID for root organization "*"

BigDecimal strPrice = (BigDecimal)CallStoredProcedure.getInstance().call(
"C_CURRENCY_CONVERT", parameters, types);

System.out.println(strPrice);

But if you want to pass the Currency object as null should work too:

types.add(org.openbravo.model.common.currency.Currency.Class);
parameters.add(null);

The procedure will not calculate properly the change because it will be missing the currency parameter but the error described in this issue report will not appear

* Other areas affected

No other areas affected. Only the CallStoredProcedure class has been modified in the case of null parameters.
(0038284)
jonalegriaesarte (reporter)
2011-06-13 10:57

Verified

- Issue History
Date Modified Username Field Change
2011-03-29 13:13 adrianromero New Issue
2011-03-29 13:13 adrianromero Assigned To => mtaal
2011-03-29 13:13 adrianromero Modules => Core
2011-03-29 13:18 adrianromero File Added: Fix-16531.diff
2011-03-29 15:22 adrianromero Issue Monitored: adrianromero
2011-03-29 15:22 adrianromero Issue End Monitor: adrianromero
2011-03-29 15:22 adrianromero Issue Monitored: networkb
2011-03-29 15:58 maite Note Added: 0035335
2011-03-29 16:01 adrianromero Status new => scheduled
2011-03-29 16:01 adrianromero Steps to Reproduce Updated View Revisions
2011-03-29 16:02 adrianromero Issue cloned 0016541
2011-03-29 16:02 adrianromero Relationship added blocks 0016541
2011-03-31 17:13 adrianromero Assigned To mtaal => adrianromero
2011-03-31 17:26 hgbot Checkin
2011-03-31 17:26 hgbot Note Added: 0035433
2011-03-31 17:26 hgbot Status scheduled => resolved
2011-03-31 17:26 hgbot Resolution open => fixed
2011-03-31 17:26 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/7d9ed704c9ceb4df05b49f73fac52ccf63d5f062 [^]
2011-03-31 17:34 adrianromero Note Added: 0035434
2011-06-03 10:58 dalsasua Assigned To adrianromero => dalsasua
2011-06-13 10:57 jonalegriaesarte Note Added: 0038284
2011-06-13 10:57 jonalegriaesarte Status resolved => closed
2011-06-13 10:57 jonalegriaesarte Fixed in Version => 3.0MP0


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker