Hi Brian,
On 14.01.2010 19:54, Brian Patzmann wrote:
Hello,
A specific example:
A brief snippet of the xsd:
<xsd:element name="BenefitSummaryItem">
<xsd:complexType>
.....
<xsd:element name="BenefitElementName" type="xsd:string"
minOccurs="0"/>
.....
</xsd:complexType>
</xsd:element>
And from this, the generated code block below is created from the castor code:
....
desc.setImmutable(true);
handler = new org.exolab.castor.xml.XMLFieldHandler() {
@Override
public java.lang.Object getValue( java.lang.Object object )
throws IllegalStateException
{
BenefitElectionInformation target =
(BenefitElectionInformation) object;
return target.getBenefitElementName();
}
@Override
public void setValue( java.lang.Object object, java.lang.Object
value)
throws IllegalStateException, IllegalArgumentException
{
try {
BenefitElectionInformation target =
(BenefitElectionInformation) object;
target.setBenefitElementName( (java.lang.String) value);
} catch (java.lang.Exception ex) {
throw new IllegalStateException(ex.toString());
}
}
....
In here, there are " throws IllegalStateException" and " throws
IllegalStateException, IllegalArgumentException"
> on the methods getValue(..) and setValue(..). Being as these
> are unchecked exceptions, we were just wondering if it was possible
> to generate this without those throws? It is understood that they
> are overriding methods within XMLFieldHandler, but it's
> necessary for the generated code to actually declare them
> since they are unchecked.
Let me look into this a bit more, okay. Before thinking about whether to
remove them or not, I'd first like to understand whether there's a
reason for their existence.
When I was talking about the redundant throws within the CASTOR
> project I was referencing this:
> http://jira.codehaus.org/browse/CASTOR-2094
I guess this Jira issue refers to code quality as reported by
Checkstyle, and is specific to the JDO side of things only. So, yes, it
definitely is related, but not, the intention was a bit different.
Regards
Werner
-----Original Message-----
From: Werner Guttmann [mailto:[email protected]]
Sent: Thursday, January 14, 2010 1:38 PM
To: Brian Patzmann
Cc: [email protected]
Subject: Re: Castor generating Redudant Throws in Code
Hi Brian,
On 14.01.2010 17:26, Brian Patzmann wrote:
> All,
>
> We are a user of the Castor project and appreciate all the work that
> has gone into this set of software. I was just wondering if there
> was any consideration being taken into the amount of redundant throws
> being generated inside of the generated code?
Can you please post some examples of those redundant throws clauses ? I
guess I do have an idea about those, but let's please try to be more
specific.
> Is this something that
> a setting could fix or is it more detailed than that? I am still
> investigating if there is a manner in which I can run the generation
> such that they won't be created but am so far coming up empty.
It depends. There's plenty of settings to control the code generation
process in many areas, but to me you are looking at a code quality
issue. But let's see.
> I saw from the Codehaus repository that the redundant throws were
> addressed within the Castor project itself, ...
I am not sure I do understand this statement fully. Can you please
elaborate ?
> so I'm just trying to see
> if there is anything that can be or is being done in relation to
> these same issues within the code the Castor project generates.
>
> Thank-you,
>
> Brian B Patzmann Senior Software Engineer
Benefitfocus is the largest healthcare benefits software provider
serving 320,979 employers, 477 carriers and 53.8 million
consumers. To learn more visit www.benefitfocus.com.
BENEFITFOCUS.COM CONFIDENTIALITY NOTICE: This electronic message is
intended only for the individual or entity to which it is addressed
and may contain information that is confidential and protected by
law. Unauthorized review, use, disclosure, or dissemination of this
communication or its contents in any way is prohibited and may be
unlawful. If you are not the intended recipient or a person responsible
for delivering this message to an intended recipient, please notify
the original sender immediately by e-mail or telephone, return the
original message to the original sender or to [email protected],
and destroy all copies or derivations of the original message.
Thank you. (BFeComNote Rev. 05/02/2007)
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email