...

how to throw

jeepzy3
01-23-2003, 04:41 AM
I have this code ... The compiler instructed "unreported exception; must be caught or thrown". So I put the stmts in the following try/catch block. I'd like to throw the exception, not catch it, but am not sure of the syntax. The error msg is being written correctly to the logfile. This is the msg I want to throw.


try {
AttributedObject[] AttObjArray = super.getRelations(XML_NAME_RELATOR_CONTENT);
AttributedObject attrObj = AttObjArray[0];

AttributeData field = attrObj.getAttribute(XML_SALES_SUMMARY);
AttributeDefinitionData field2 = field.getAttributeDefinition();


logger.debug("Content Length Validations - begin");
//Content Length validations
if (!fieldLengthCheck(XML_SALES_SUMMARY,1000,(AttributedObject) attrObj))
throw new ValidationException(this,new Exception(dispName + " can be no more than " + fld_maxLen + " characters."));
if (!fieldLengthCheck(XML_ADDITIONAL_DESC,1000,attrObj))
throw new ValidationException(this,new Exception(dispName + " can be no more than " + fld_maxLen + " characters."));

logger.debug("Content Length Validations - end");

} catch (Exception e) { logger.debug("get e.Msg: " + e.getMessage()); }

bcarl314
01-23-2003, 01:36 PM
in your class definition use something like

public class myClass() throws IOException {
//code here
}
just replace IOException with the exception you need to throw

jeepzy3
01-24-2003, 10:57 PM
thanks! - that worked



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum