You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Niall Pemberton (JIRA)" <ji...@apache.org> on 2007/05/22 02:35:16 UTC
[jira] Updated: (BEANUTILS-178) New implementation in
commons-beanutils
[ https://issues.apache.org/jira/browse/BEANUTILS-178?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Niall Pemberton updated BEANUTILS-178:
--------------------------------------
Description: NOTE: Seem to have lost the comment for this issue when transferring from Bugzilla to Jira - I'll copy yhe comments in here (was: typing...)
Summary: New implementation in commons-beanutils (was: [beanutils] New implementation in commons-beanutils)
On 2004-09-13 15:06 Fabio Lourencetti Gonçalves wrote:
I'm facing a problem with beanutil using jtds jdbc driver (an open source
driver for sql server.)
The problem occurs in the class BasicDynaBean, method set(String name, Object
value) when using this code below
org.apache.commons.beanutils.RowSetDynaClass rsdc =
new org.apache.commons.beanutils.RowSetDynaClass(resultSet);
When a column is of "text" type, jtds driver returns a java.sql.Clob java type
and it throws a ConversionException ("Cannot convert value of type '...clob
implementarion...' to property '...' of type 'java.lang.String');
I made an implementarion to this method as follows below. What do you think
about?
Tks.
Fabio
Sao Paulo/Brazil
-------------------------------
public void set(String name, Object value) {
DynaProperty descriptor = getDynaProperty(name);
if (value == null) {
if (descriptor.getType().isPrimitive()) {
throw new NullPointerException
("Primitive value for '" + name + "'");
}
} else if (!isAssignable(descriptor.getType(), value.getClass())) {
if(value instanceof Clob &&
descriptor.getType() == java.lang.String.class) {
try {
value = ((Clob)value).getSubString(1, (int)((Clob)
value).length());
}
catch(SQLException ex) {
throw new ConversionException("Cannot convert value of
type '" +
value.getClass().getName() +
"' (CLOB) to property '" + name + "' of type '" +
descriptor.getType().getName() + "'");
}
}
else {
throw new ConversionException("Cannot assign value of type '" +
value.getClass().getName() +
"' to property '" + name + "' of type '" +
descriptor.getType().getName() + "'");
}
}
values.put(name, value);
}
> New implementation in commons-beanutils
> ---------------------------------------
>
> Key: BEANUTILS-178
> URL: https://issues.apache.org/jira/browse/BEANUTILS-178
> Project: Commons BeanUtils
> Issue Type: Improvement
> Components: DynaBean
> Affects Versions: 1.6
> Environment: Operating System: All
> Platform: All
> Reporter: Fabio Lourencetti Gonçalves
> Priority: Minor
> Fix For: 1.8.0
>
>
> NOTE: Seem to have lost the comment for this issue when transferring from Bugzilla to Jira - I'll copy yhe comments in here
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org