Hey Bob et al. This patch should make drools compatible with the HEAD version of Jelly. You will also want to add the junit taglib as a dependency in your maven build, as it is no longer in the core jar.
- Morgan ===== Morgan Delagrange http://jakarta.apache.org/taglibs http://jakarta.apache.org/commons http://axion.tigris.org http://jakarta.apache.org/watchdog __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com
Index: src/java/main/org/drools/io/SemanticsLoader.java =================================================================== RCS file: /cvsroot/drools/drools/src/java/main/org/drools/io/SemanticsLoader.java,v retrieving revision 1.5 diff -u -r1.5 SemanticsLoader.java --- src/java/main/org/drools/io/SemanticsLoader.java 20 Aug 2002 05:06:24 -0000 1.5 +++ src/java/main/org/drools/io/SemanticsLoader.java 29 Jan 2003 23:55:00 -0000 @@ -48,9 +48,11 @@ import org.drools.smf.SemanticModule; import org.drools.tags.semantics.SemanticsTagLibrary; +import org.xml.sax.SAXException; import org.apache.commons.jelly.Script; import org.apache.commons.jelly.JellyContext; +import org.apache.commons.jelly.JellyException; import org.apache.commons.jelly.XMLOutput; import org.apache.commons.jelly.parser.XMLParser; @@ -92,9 +94,9 @@ * @return The loaded semantic module or <code>null</code> if none found. * * @throws IOException If an IO errors occurs. - * @throws Exception If an error occurs evaluating the definition. + * @throws JellyException If an error occurs evaluating the definition. */ - public SemanticModule load(String packageName) throws IOException, Exception + public SemanticModule load(String packageName) throws IOException, JellyException { ClassLoader cl = Thread.currentThread().getContextClassLoader(); @@ -123,7 +125,16 @@ parser.setContext( context ); - Script script = parser.parse( url.toExternalForm() ); + Script script = null; + try + { + script = parser.parse( url.toExternalForm() ); + } + catch (SAXException e) + { + throw new JellyException( e ); + } + XMLOutput output = XMLOutput.createXMLOutput( System.err ); Index: src/java/main/org/drools/semantics/jelly/JellyConsequenceTag.java =================================================================== RCS file: /cvsroot/drools/drools/src/java/main/org/drools/semantics/jelly/JellyConsequenceTag.java,v retrieving revision 1.4 diff -u -r1.4 JellyConsequenceTag.java --- src/java/main/org/drools/semantics/jelly/JellyConsequenceTag.java 19 Nov 2002 16:21:07 -0000 1.4 +++ src/java/main/org/drools/semantics/jelly/JellyConsequenceTag.java 29 Jan 2003 +23:55:00 -0000 @@ -51,7 +51,7 @@ import org.apache.commons.jelly.TagSupport; import org.apache.commons.jelly.XMLOutput; import org.apache.commons.jelly.DynaTag; -import org.apache.commons.jelly.JellyException; +import org.apache.commons.jelly.JellyTagException; /** Jelly semantics <code>Consequence</code>. * @@ -87,13 +87,13 @@ * @throws Exception If an error occurs while attempting * to perform this tag. */ - public void doTag(XMLOutput output) throws Exception + public void doTag(XMLOutput output) throws JellyTagException { ConsequenceTag tag = (ConsequenceTag) findAncestorWithClass( ConsequenceTag.class ); if ( tag == null ) { - throw new JellyException( "No consequence wrapper available" ); + throw new JellyTagException( "No consequence wrapper available" ); } JellyConsequence consequence = new JellyConsequence( getBody(), Index: src/java/main/org/drools/semantics/jelly/SemanticsTagLibrary.java =================================================================== RCS file: /cvsroot/drools/drools/src/java/main/org/drools/semantics/jelly/SemanticsTagLibrary.java,v retrieving revision 1.5 diff -u -r1.5 SemanticsTagLibrary.java --- src/java/main/org/drools/semantics/jelly/SemanticsTagLibrary.java 1 Jan 2003 22:15:31 -0000 1.5 +++ src/java/main/org/drools/semantics/jelly/SemanticsTagLibrary.java 29 Jan 2003 +23:55:01 -0000 @@ -46,13 +46,13 @@ */ -import org.apache.commons.jelly.impl.DynamicTagLibrary; -import org.apache.commons.jelly.Tag; +import java.util.Map; +import org.apache.commons.jelly.JellyException; +import org.apache.commons.jelly.Tag; +import org.apache.commons.jelly.impl.DynamicTagLibrary; import org.xml.sax.Attributes; -import java.util.Map; - /** Custom Jelly semantics tag library. * * @author <a href="mailto:[EMAIL PROTECTED]">bob mcwhirter</a> @@ -76,11 +76,11 @@ * * @return The new tag. * - * @throws Exception If an error occurs while attempting to + * @throws JellyException If an error occurs while attempting to * create the tag for the specified name. */ public Tag createTag(String name, - Attributes attrs) throws Exception + Attributes attrs) throws JellyException { Map tags = getTagClasses(); @@ -88,7 +88,15 @@ if ( type != null ) { - return (Tag) type.newInstance(); + try { + return (Tag) type.newInstance(); + } + catch (InstantiationException e) { + throw new JellyException(e); + } + catch (IllegalAccessException e) { + throw new JellyException(e); + } } return null; Index: src/java/main/org/drools/tags/knowledge/AssertTag.java =================================================================== RCS file: /cvsroot/drools/drools/src/java/main/org/drools/tags/knowledge/AssertTag.java,v retrieving revision 1.1 diff -u -r1.1 AssertTag.java --- src/java/main/org/drools/tags/knowledge/AssertTag.java 20 Aug 2002 18:33:17 -0000 1.1 +++ src/java/main/org/drools/tags/knowledge/AssertTag.java 29 Jan 2003 23:55:01 +-0000 @@ -46,10 +46,10 @@ */ -import org.drools.AssertionException; - -import org.apache.commons.jelly.XMLOutput; import org.apache.commons.jelly.JellyException; +import org.apache.commons.jelly.JellyTagException; +import org.apache.commons.jelly.XMLOutput; +import org.drools.AssertionException; /** Assert an object into the working memory. * @@ -82,10 +82,10 @@ * * @param output The output sink. * - * @throws Exception If an error occurs while attempting + * @throws JellyTagException If an error occurs while attempting * to perform this tag. */ - public void doTag(XMLOutput output) throws Exception + public void doTag(XMLOutput output) throws JellyTagException { validateAttributes(); @@ -95,7 +95,7 @@ } catch (AssertionException e) { - throw new JellyException( e ); - } + throw new JellyTagException( e ); + } } } Index: src/java/main/org/drools/tags/knowledge/FactTagSupport.java =================================================================== RCS file: /cvsroot/drools/drools/src/java/main/org/drools/tags/knowledge/FactTagSupport.java,v retrieving revision 1.3 diff -u -r1.3 FactTagSupport.java --- src/java/main/org/drools/tags/knowledge/FactTagSupport.java 28 Aug 2002 20:24:59 -0000 1.3 +++ src/java/main/org/drools/tags/knowledge/FactTagSupport.java 29 Jan 2003 23:55:01 +-0000 @@ -49,7 +49,7 @@ import org.drools.WorkingMemory; import org.apache.commons.jelly.TagSupport; -import org.apache.commons.jelly.JellyException; +import org.apache.commons.jelly.JellyTagException; import org.apache.commons.jelly.MissingAttributeException; /** Support for fact tags. @@ -116,9 +116,9 @@ * * @return The working memory. * - * @throws JellyException If a working memory cannot be retrieved. + * @throws JellyTagException If a working memory cannot be retrieved. */ - protected WorkingMemory getWorkingMemory() throws JellyException + protected WorkingMemory getWorkingMemory() throws JellyTagException { WorkingMemory memory = (WorkingMemory) getContext().getVariable( "org.drools.working-memory" ); @@ -128,7 +128,7 @@ if ( tag == null ) { - throw new JellyException( "No working memory available" ); + throw new JellyTagException( "No working memory available" ); } return tag.getMemory(); Index: src/java/main/org/drools/tags/knowledge/KnowledgeTag.java =================================================================== RCS file: /cvsroot/drools/drools/src/java/main/org/drools/tags/knowledge/KnowledgeTag.java,v retrieving revision 1.3 diff -u -r1.3 KnowledgeTag.java --- src/java/main/org/drools/tags/knowledge/KnowledgeTag.java 21 Aug 2002 05:46:13 -0000 1.3 +++ src/java/main/org/drools/tags/knowledge/KnowledgeTag.java 29 Jan 2003 23:55:01 +-0000 @@ -46,12 +46,11 @@ */ -import org.drools.WorkingMemory; -import org.drools.RuleBase; - +import org.apache.commons.jelly.JellyTagException; import org.apache.commons.jelly.TagSupport; import org.apache.commons.jelly.XMLOutput; -import org.apache.commons.jelly.JellyException; +import org.drools.RuleBase; +import org.drools.WorkingMemory; /** Work in a knowledge session. * @@ -175,16 +174,16 @@ * * @param output The output sink. * - * @throws Exception If an error occurs while attempting + * @throws JellyTagException If an error occurs while attempting * to perform this tag. */ - public void doTag(XMLOutput output) throws Exception + public void doTag(XMLOutput output) throws JellyTagException { if ( this.workingMemory == null && this.ruleBase == null ) { - throw new JellyException( "Either 'memory' or 'rulebase' attribute must be specified" ); + throw new JellyTagException( "Either 'memory' or 'rulebase' attribute +must be specified" ); } if ( this.workingMemory == null ) Index: src/java/main/org/drools/tags/knowledge/LoadRulesTag.java =================================================================== RCS file: /cvsroot/drools/drools/src/java/main/org/drools/tags/knowledge/LoadRulesTag.java,v retrieving revision 1.4 diff -u -r1.4 LoadRulesTag.java --- src/java/main/org/drools/tags/knowledge/LoadRulesTag.java 22 Aug 2002 19:59:51 -0000 1.4 +++ src/java/main/org/drools/tags/knowledge/LoadRulesTag.java 29 Jan 2003 23:55:01 +-0000 @@ -46,19 +46,20 @@ */ -import org.drools.RuleBase; -import org.drools.io.RuleSetLoader; -import org.drools.rule.RuleSet; - -import org.apache.commons.jelly.TagSupport; -import org.apache.commons.jelly.XMLOutput; -import org.apache.commons.jelly.JellyException; -import org.apache.commons.jelly.MissingAttributeException; - import java.io.File; +import java.net.MalformedURLException; import java.net.URL; -import java.util.List; import java.util.Iterator; +import java.util.List; + +import org.apache.commons.jelly.JellyException; +import org.apache.commons.jelly.JellyTagException; +import org.apache.commons.jelly.MissingAttributeException; +import org.apache.commons.jelly.TagSupport; +import org.apache.commons.jelly.XMLOutput; +import org.drools.RuleBase; +import org.drools.io.RuleSetLoader; +import org.drools.rule.RuleSet; /** Load <code>Rule</code>s and <code>RuleSet</code>s * into a <code>RuleBase</code>. @@ -138,10 +139,12 @@ * * @param output The output sink. * - * @throws Exception If an error occurs while attempting + * @throws MissingAttributeException If uri or file attribute is not + * set. + * @throws JellyTagException If an error occurs while attempting * to perform this tag. */ - public void doTag(XMLOutput output) throws Exception + public void doTag(XMLOutput output) throws JellyTagException { if ( getUri() == null && @@ -150,24 +153,30 @@ throw new MissingAttributeException( "uri or file" ); } - URL url = null; - - if ( getUri() != null ) - { - url = new URL( getUri() ); - } - else - { - File file = new File( getFile() ); - - url = file.toURL(); - } + URL url = null; + try + { + if (getUri() != null) + { + url = new URL(getUri()); + } + else + { + File file = new File(getFile()); + + url = file.toURL(); + } + } + catch (MalformedURLException e) + { + throw new JellyTagException(e); + } RuleBaseTag tag = (RuleBaseTag) findAncestorWithClass( RuleBaseTag.class ); if ( tag == null ) { - throw new JellyException( "<load-rules> may only be used within a <rule-set>" ); + throw new JellyTagException( "<load-rules> may only be used within a +<rule-set>" ); } try @@ -189,7 +198,7 @@ } catch (Exception e) { - throw new JellyException( e ); + throw new JellyTagException( e ); } } } Index: src/java/main/org/drools/tags/knowledge/ModifyTag.java =================================================================== RCS file: /cvsroot/drools/drools/src/java/main/org/drools/tags/knowledge/ModifyTag.java,v retrieving revision 1.1 diff -u -r1.1 ModifyTag.java --- src/java/main/org/drools/tags/knowledge/ModifyTag.java 20 Aug 2002 18:33:17 -0000 1.1 +++ src/java/main/org/drools/tags/knowledge/ModifyTag.java 29 Jan 2003 23:55:01 +-0000 @@ -46,10 +46,10 @@ */ -import org.drools.FactException; - -import org.apache.commons.jelly.XMLOutput; import org.apache.commons.jelly.JellyException; +import org.apache.commons.jelly.JellyTagException; +import org.apache.commons.jelly.XMLOutput; +import org.drools.FactException; /** Modify an object in the working memory. * @@ -82,10 +82,10 @@ * * @param output The output sink. * - * @throws Exception If an error occurs while attempting + * @throws JellyTagException If an error occurs while attempting * to perform this tag. */ - public void doTag(XMLOutput output) throws Exception + public void doTag(XMLOutput output) throws JellyTagException { validateAttributes(); @@ -95,7 +95,7 @@ } catch (FactException e) { - throw new JellyException( e ); + throw new JellyTagException( e ); } } } Index: src/java/main/org/drools/tags/knowledge/RetractTag.java =================================================================== RCS file: /cvsroot/drools/drools/src/java/main/org/drools/tags/knowledge/RetractTag.java,v retrieving revision 1.1 diff -u -r1.1 RetractTag.java --- src/java/main/org/drools/tags/knowledge/RetractTag.java 20 Aug 2002 18:33:17 -0000 1.1 +++ src/java/main/org/drools/tags/knowledge/RetractTag.java 29 Jan 2003 23:55:01 +-0000 @@ -49,7 +49,7 @@ import org.drools.RetractionException; import org.apache.commons.jelly.XMLOutput; -import org.apache.commons.jelly.JellyException; +import org.apache.commons.jelly.JellyTagException; /** Retract an object from the working memory. * @@ -82,10 +82,10 @@ * * @param output The output sink. * - * @throws Exception If an error occurs while attempting + * @throws JellyTagException If an error occurs while attempting * to perform this tag. */ - public void doTag(XMLOutput output) throws Exception + public void doTag(XMLOutput output) throws JellyTagException { validateAttributes(); @@ -95,7 +95,7 @@ } catch (RetractionException e) { - throw new JellyException( e ); + throw new JellyTagException( e ); } } } Index: src/java/main/org/drools/tags/knowledge/RuleBaseTag.java =================================================================== RCS file: /cvsroot/drools/drools/src/java/main/org/drools/tags/knowledge/RuleBaseTag.java,v retrieving revision 1.4 diff -u -r1.4 RuleBaseTag.java --- src/java/main/org/drools/tags/knowledge/RuleBaseTag.java 21 Aug 2002 05:46:13 -0000 1.4 +++ src/java/main/org/drools/tags/knowledge/RuleBaseTag.java 29 Jan 2003 23:55:01 +-0000 @@ -53,7 +53,7 @@ import org.apache.commons.jelly.TagSupport; import org.apache.commons.jelly.XMLOutput; -import org.apache.commons.jelly.JellyException; +import org.apache.commons.jelly.JellyTagException; import org.apache.commons.jelly.MissingAttributeException; /** Create a <code>RuleBase</code>. @@ -121,10 +121,10 @@ * * @param ruleSet The rule-set to add. * - * @throws JellyException If an error occurs while attempting + * @throws JellyTagException If an error occurs while attempting * to add the rule-set. */ - public void addRuleSet(RuleSet ruleSet) throws JellyException + public void addRuleSet(RuleSet ruleSet) throws JellyTagException { try { @@ -132,7 +132,7 @@ } catch (RuleIntegrationException e) { - throw new JellyException( e ); + throw new JellyTagException( e ); } } @@ -140,10 +140,10 @@ * * @param rule The rule to add. * - * @throws JellyException If an error occurs while attempting + * @throws JellyTagException If an error occurs while attempting * to add the rule. */ - public void addRule(Rule rule) throws JellyException + public void addRule(Rule rule) throws JellyTagException { try { @@ -151,7 +151,7 @@ } catch (RuleIntegrationException e) { - throw new JellyException( e ); + throw new JellyTagException( e ); } } @@ -163,10 +163,13 @@ * * @param output The output sink. * - * @throws Exception If an error occurs while attempting + * @throws MissingAttributeException If the var attribute + * has not been set + * @throws JellyTagException If an error occurs while attempting * to perform this tag. */ - public void doTag(XMLOutput output) throws Exception + public void doTag(XMLOutput output) + throws MissingAttributeException, JellyTagException { if ( this.var == null ) { Index: src/java/main/org/drools/tags/rule/ComponentTag.java =================================================================== RCS file: /cvsroot/drools/drools/src/java/main/org/drools/tags/rule/ComponentTag.java,v retrieving revision 1.1 diff -u -r1.1 ComponentTag.java --- src/java/main/org/drools/tags/rule/ComponentTag.java 27 Sep 2002 20:55:32 -0000 1.1 +++ src/java/main/org/drools/tags/rule/ComponentTag.java 29 Jan 2003 23:55:01 +-0000 @@ -48,7 +48,7 @@ import org.apache.commons.beanutils.ConvertingWrapDynaBean; import org.apache.commons.jelly.DynaBeanTagSupport; -import org.apache.commons.jelly.JellyException; +import org.apache.commons.jelly.JellyTagException; /** Base for dynamic semantic component tags. * @@ -117,11 +117,11 @@ * @param name The attribute name. * @param value The value. * - * @throws Exception If an error occurs while attempting + * @throws JellyTagException If an error occurs while attempting * to set the attribute value. */ public void setAttribute(String name, - Object value) throws Exception + Object value) throws JellyTagException { super.setAttribute( name, value ); @@ -129,9 +129,9 @@ /** Hook before attributes are set for initialization. * - * @throws Exception If an error occurs. + * @throws JellyTagException If an error occurs. */ - public void beforeSetAttributes() throws Exception + public void beforeSetAttributes() throws JellyTagException { try { @@ -140,7 +140,7 @@ } catch (Exception e) { - throw new JellyException( "Unable to instantiate: " + getComponentClass().getName() ); + throw new JellyTagException( "Unable to instantiate: " + +getComponentClass().getName() ); } } } Index: src/java/main/org/drools/tags/rule/ComponentTagFactory.java =================================================================== RCS file: /cvsroot/drools/drools/src/java/main/org/drools/tags/rule/ComponentTagFactory.java,v retrieving revision 1.2 diff -u -r1.2 ComponentTagFactory.java --- src/java/main/org/drools/tags/rule/ComponentTagFactory.java 19 Nov 2002 16:21:07 -0000 1.2 +++ src/java/main/org/drools/tags/rule/ComponentTagFactory.java 29 Jan 2003 23:55:01 +-0000 @@ -46,6 +46,7 @@ */ +import org.apache.commons.jelly.JellyException; import org.apache.commons.jelly.Tag; import org.apache.commons.jelly.impl.TagFactory; @@ -117,13 +118,25 @@ * * @return The new tag. * - * @throws Exception If an error while attempting to + * @throws JellyException If an error while attempting to * instantiate the tag. */ public Tag createTag(String name, - Attributes attrs) throws Exception + Attributes attrs) throws JellyException { - ComponentTag tag = (ComponentTag) getTagClass().newInstance(); + ComponentTag tag = null; + try + { + tag = (ComponentTag) getTagClass().newInstance(); + } + catch (IllegalAccessException e) + { + throw new JellyException(e); + } + catch (InstantiationException e) + { + throw new JellyException(e); + } tag.setComponentClass( getComponentClass() ); Index: src/java/main/org/drools/tags/rule/ConditionComponentTag.java =================================================================== RCS file: /cvsroot/drools/drools/src/java/main/org/drools/tags/rule/ConditionComponentTag.java,v retrieving revision 1.1 diff -u -r1.1 ConditionComponentTag.java --- src/java/main/org/drools/tags/rule/ConditionComponentTag.java 27 Sep 2002 20:55:32 -0000 1.1 +++ src/java/main/org/drools/tags/rule/ConditionComponentTag.java 29 Jan 2003 +23:55:01 -0000 @@ -52,6 +52,7 @@ import org.apache.commons.jelly.XMLOutput; import org.apache.commons.jelly.JellyException; +import org.apache.commons.jelly.JellyTagException; /** Dynamic <code>Condition</code> component tag. * @@ -84,16 +85,16 @@ * * @param output The output sink. * - * @throws Exception If an error occurs while attempting + * @throws JellyTagException If an error occurs while attempting * to perform this tag. */ - public void doTag(XMLOutput output) throws Exception + public void doTag(XMLOutput output) throws JellyTagException { ConditionReceptor receptor = (ConditionReceptor) findAncestorWithClass( ConditionReceptor.class ); if ( receptor == null ) { - throw new JellyException( "No receptor for condition" ); + throw new JellyTagException( "No receptor for condition" ); } if ( getComponent() instanceof ConfigurableCondition) @@ -105,7 +106,11 @@ } catch (ConfigurationException e) { - throw new JellyException( e ); + throw new JellyTagException( e ); + } + catch (JellyException e) + { + throw new JellyTagException( e ); } } Index: src/java/main/org/drools/tags/rule/ConditionTag.java =================================================================== RCS file: /cvsroot/drools/drools/src/java/main/org/drools/tags/rule/ConditionTag.java,v retrieving revision 1.4 diff -u -r1.4 ConditionTag.java --- src/java/main/org/drools/tags/rule/ConditionTag.java 27 Sep 2002 20:55:32 -0000 1.4 +++ src/java/main/org/drools/tags/rule/ConditionTag.java 29 Jan 2003 23:55:01 +-0000 @@ -50,7 +50,7 @@ import org.drools.rule.Rule; import org.apache.commons.jelly.XMLOutput; -import org.apache.commons.jelly.JellyException; +import org.apache.commons.jelly.JellyTagException; /** Construct a <code>Condition</code> for a <code>Rule</code>. * @@ -144,23 +144,23 @@ * * @param output The output sink. * - * @throws Exception If an error occurs while attempting + * @throws JellyTagException If an error occurs while attempting * to perform this tag. */ - public void doTag(XMLOutput output) throws Exception + public void doTag(XMLOutput output) throws JellyTagException { Rule rule = getRule(); if ( rule == null ) { - throw new JellyException( "No rule available" ); + throw new JellyTagException( "No rule available" ); } invokeBody( output ); if ( this.condition == null ) { - throw new JellyException( "Condition expected" ); + throw new JellyTagException( "Condition expected" ); } if ( this.var != null ) Index: src/java/main/org/drools/tags/rule/ConsequenceComponentTag.java =================================================================== RCS file: /cvsroot/drools/drools/src/java/main/org/drools/tags/rule/ConsequenceComponentTag.java,v retrieving revision 1.1 diff -u -r1.1 ConsequenceComponentTag.java --- src/java/main/org/drools/tags/rule/ConsequenceComponentTag.java 27 Sep 2002 20:55:32 -0000 1.1 +++ src/java/main/org/drools/tags/rule/ConsequenceComponentTag.java 29 Jan 2003 +23:55:01 -0000 @@ -52,6 +52,7 @@ import org.apache.commons.jelly.XMLOutput; import org.apache.commons.jelly.JellyException; +import org.apache.commons.jelly.JellyTagException; /** Dynamic <code>Consequence</code> component tag. * @@ -84,16 +85,16 @@ * * @param output The output sink. * - * @throws Exception If an error occurs while attempting + * @throws JellyTagException If an error occurs while attempting * to perform this tag. */ - public void doTag(XMLOutput output) throws Exception + public void doTag(XMLOutput output) throws JellyTagException { ConsequenceReceptor receptor = (ConsequenceReceptor) findAncestorWithClass( ConsequenceReceptor.class ); if ( receptor == null ) { - throw new JellyException( "No receptor for consequence" ); + throw new JellyTagException( "No receptor for consequence" ); } if ( getComponent() instanceof ConfigurableConsequence ) @@ -105,7 +106,11 @@ } catch (ConfigurationException e) { - throw new JellyException( e ); + throw new JellyTagException( e ); + } + catch (JellyException e) + { + throw new JellyTagException( e ); } } Index: src/java/main/org/drools/tags/rule/ConsequenceTag.java =================================================================== RCS file: /cvsroot/drools/drools/src/java/main/org/drools/tags/rule/ConsequenceTag.java,v retrieving revision 1.5 diff -u -r1.5 ConsequenceTag.java --- src/java/main/org/drools/tags/rule/ConsequenceTag.java 1 Jan 2003 22:15:31 -0000 1.5 +++ src/java/main/org/drools/tags/rule/ConsequenceTag.java 29 Jan 2003 23:55:01 +-0000 @@ -50,7 +50,7 @@ import org.drools.spi.Consequence; import org.apache.commons.jelly.XMLOutput; -import org.apache.commons.jelly.JellyException; +import org.apache.commons.jelly.JellyTagException; /** Construct a <code>Consequence</code> for a <code>Rule</code>. * @@ -144,23 +144,23 @@ * * @param output The output sink. * - * @throws Exception If an error occurs while attempting + * @throws JellyTagException If an error occurs while attempting * to perform this tag. */ - public void doTag(XMLOutput output) throws Exception + public void doTag(XMLOutput output) throws JellyTagException { Rule rule = getRule(); if ( rule == null ) { - throw new JellyException( "No rule available" ); + throw new JellyTagException( "No rule available" ); } invokeBody( output ); if ( this.consequence == null ) { - throw new JellyException( "Consequence expected" ); + throw new JellyTagException( "Consequence expected" ); } if ( this.var != null ) Index: src/java/main/org/drools/tags/rule/DeclarationTag.java =================================================================== RCS file: /cvsroot/drools/drools/src/java/main/org/drools/tags/rule/DeclarationTag.java,v retrieving revision 1.5 diff -u -r1.5 DeclarationTag.java --- src/java/main/org/drools/tags/rule/DeclarationTag.java 27 Sep 2002 20:55:32 -0000 1.5 +++ src/java/main/org/drools/tags/rule/DeclarationTag.java 29 Jan 2003 23:55:01 +-0000 @@ -52,7 +52,7 @@ import org.apache.commons.jelly.XMLOutput; import org.apache.commons.jelly.MissingAttributeException; -import org.apache.commons.jelly.JellyException; +import org.apache.commons.jelly.JellyTagException; /** Construct a <code>Declaration</code> for a <code>Rule</code>. * @@ -150,16 +150,16 @@ * * @return The configured declaration. * - * @throws Exception If an error occurs while attempting to + * @throws JellyTagException If an error occurs while attempting to * configure the declaration. */ - protected Declaration createDeclaration(XMLOutput output) throws Exception + protected Declaration createDeclaration(XMLOutput output) throws JellyTagException { invokeBody( output ); if ( this.objectType == null ) { - throw new JellyException( "No object type specified" ); + throw new JellyTagException( "No object type specified" ); } Declaration decl = new Declaration( this.objectType, @@ -189,10 +189,10 @@ * * @param output The output sink. * - * @throws Exception If an error occurs while attempting + * @throws JellyTagException If an error occurs while attempting * to perform this tag. */ - public void doTag(XMLOutput output) throws Exception + public void doTag(XMLOutput output) throws JellyTagException { verifyAttributes(); Index: src/java/main/org/drools/tags/rule/DurationTag.java =================================================================== RCS file: /cvsroot/drools/drools/src/java/main/org/drools/tags/rule/DurationTag.java,v retrieving revision 1.1 diff -u -r1.1 DurationTag.java --- src/java/main/org/drools/tags/rule/DurationTag.java 22 Aug 2002 07:42:39 -0000 1.1 +++ src/java/main/org/drools/tags/rule/DurationTag.java 29 Jan 2003 23:55:01 -0000 @@ -50,7 +50,7 @@ import org.drools.rule.Rule; import org.apache.commons.jelly.XMLOutput; -import org.apache.commons.jelly.JellyException; +import org.apache.commons.jelly.JellyTagException; /** Construct a <code>Duration</code> for a <code>Rule</code>. * @@ -129,23 +129,23 @@ * * @param output The output sink. * - * @throws Exception If an error occurs while attempting + * @throws JellyTagException If an error occurs while attempting * to perform this tag. */ - public void doTag(XMLOutput output) throws Exception + public void doTag(XMLOutput output) throws JellyTagException { Rule rule = getRule(); if ( rule == null ) { - throw new JellyException( "No rule available" ); + throw new JellyTagException( "No rule available" ); } invokeBody( output ); if ( this.duration == null ) { - throw new JellyException( "Duration expected" ); + throw new JellyTagException( "Duration expected" ); } if ( this.var != null ) Index: src/java/main/org/drools/tags/rule/ExtractionTag.java =================================================================== RCS file: /cvsroot/drools/drools/src/java/main/org/drools/tags/rule/ExtractionTag.java,v retrieving revision 1.4 diff -u -r1.4 ExtractionTag.java --- src/java/main/org/drools/tags/rule/ExtractionTag.java 27 Sep 2002 20:55:32 -0000 1.4 +++ src/java/main/org/drools/tags/rule/ExtractionTag.java 29 Jan 2003 23:55:01 +-0000 @@ -52,7 +52,7 @@ import org.drools.spi.Extractor; import org.apache.commons.jelly.XMLOutput; -import org.apache.commons.jelly.JellyException; +import org.apache.commons.jelly.JellyTagException; /** Construct an <code>Extraction</code> for a <code>Rule</code>. * @@ -168,10 +168,10 @@ * * @param output The output sink. * - * @throws Exception If an error occurs while attempting + * @throws JellyTagException If an error occurs while attempting * to perform this tag. */ - public void doTag(XMLOutput output) throws Exception + public void doTag(XMLOutput output) throws JellyTagException { requiredAttribute( "target", this.target ); @@ -180,21 +180,21 @@ if ( rule == null ) { - throw new JellyException( "No rule available" ); + throw new JellyTagException( "No rule available" ); } Declaration decl = rule.getDeclaration( this.target ); if ( decl == null ) { - throw new JellyException( "Unknown declaration: " + this.target ); + throw new JellyTagException( "Unknown declaration: " + this.target ); } invokeBody( output ); if ( this.extractor == null ) { - throw new JellyException( "Extractor expected" ); + throw new JellyTagException( "Extractor expected" ); } Extraction extraction = new Extraction( decl, Index: src/java/main/org/drools/tags/rule/ExtractorComponentTag.java =================================================================== RCS file: /cvsroot/drools/drools/src/java/main/org/drools/tags/rule/ExtractorComponentTag.java,v retrieving revision 1.1 diff -u -r1.1 ExtractorComponentTag.java --- src/java/main/org/drools/tags/rule/ExtractorComponentTag.java 27 Sep 2002 20:55:32 -0000 1.1 +++ src/java/main/org/drools/tags/rule/ExtractorComponentTag.java 29 Jan 2003 +23:55:01 -0000 @@ -52,6 +52,7 @@ import org.apache.commons.jelly.XMLOutput; import org.apache.commons.jelly.JellyException; +import org.apache.commons.jelly.JellyTagException; /** Dynamic <code>Extractor</code> component tag. * @@ -84,16 +85,16 @@ * * @param output The output sink. * - * @throws Exception If an error occurs while attempting + * @throws JellyTagException If an error occurs while attempting * to perform this tag. */ - public void doTag(XMLOutput output) throws Exception + public void doTag(XMLOutput output) throws JellyTagException { ExtractorReceptor receptor = (ExtractorReceptor) findAncestorWithClass( ExtractorReceptor.class ); if ( receptor == null ) { - throw new JellyException( "No receptor for extractor" ); + throw new JellyTagException( "No receptor for extractor" ); } if ( getComponent() instanceof ConfigurableExtractor) @@ -105,7 +106,11 @@ } catch (ConfigurationException e) { - throw new JellyException( e ); + throw new JellyTagException( e ); + } + catch (JellyException e) + { + throw new JellyTagException( e ); } } Index: src/java/main/org/drools/tags/rule/FixedDurationTag.java =================================================================== RCS file: /cvsroot/drools/drools/src/java/main/org/drools/tags/rule/FixedDurationTag.java,v retrieving revision 1.1 diff -u -r1.1 FixedDurationTag.java --- src/java/main/org/drools/tags/rule/FixedDurationTag.java 22 Aug 2002 07:42:39 -0000 1.1 +++ src/java/main/org/drools/tags/rule/FixedDurationTag.java 29 Jan 2003 23:55:01 +-0000 @@ -50,7 +50,7 @@ import org.apache.commons.jelly.TagSupport; import org.apache.commons.jelly.XMLOutput; -import org.apache.commons.jelly.JellyException; +import org.apache.commons.jelly.JellyTagException; /** Construct a <code>FixedDuration</code> for a <code>Rule</code>. * @@ -146,16 +146,16 @@ * * @param output The output sink. * - * @throws Exception If an error occurs while attempting + * @throws JellyTagException If an error occurs while attempting * to perform this tag. */ - public void doTag(XMLOutput output) throws Exception + public void doTag(XMLOutput output) throws JellyTagException { DurationTag tag = (DurationTag) findAncestorWithClass( DurationTag.class ); if ( tag == null ) { - throw new JellyException( "No duration available" ); + throw new JellyTagException( "No duration available" ); } FixedDuration duration = new FixedDuration(); Index: src/java/main/org/drools/tags/rule/ObjectTypeComponentTag.java =================================================================== RCS file: /cvsroot/drools/drools/src/java/main/org/drools/tags/rule/ObjectTypeComponentTag.java,v retrieving revision 1.1 diff -u -r1.1 ObjectTypeComponentTag.java --- src/java/main/org/drools/tags/rule/ObjectTypeComponentTag.java 27 Sep 2002 20:55:32 -0000 1.1 +++ src/java/main/org/drools/tags/rule/ObjectTypeComponentTag.java 29 Jan 2003 +23:55:01 -0000 @@ -51,7 +51,7 @@ import org.drools.smf.ConfigurationException; import org.apache.commons.jelly.XMLOutput; -import org.apache.commons.jelly.JellyException; +import org.apache.commons.jelly.JellyTagException; /** Dynamic <code>ObjectType</code> component tag. * @@ -84,16 +84,16 @@ * * @param output The output sink. * - * @throws Exception If an error occurs while attempting + * @throws JellyTagException If an error occurs while attempting * to perform this tag. */ - public void doTag(XMLOutput output) throws Exception + public void doTag(XMLOutput output) throws JellyTagException { ObjectTypeReceptor receptor = (ObjectTypeReceptor) findAncestorWithClass( ObjectTypeReceptor.class ); if ( receptor == null ) { - throw new JellyException( "No receptor for object type" ); + throw new JellyTagException( "No receptor for object type" ); } if ( getComponent() instanceof ConfigurableObjectType) @@ -104,7 +104,7 @@ } catch (ConfigurationException e) { - throw new JellyException( e ); + throw new JellyTagException( e ); } } Index: src/java/main/org/drools/tags/rule/ParameterTag.java =================================================================== RCS file: /cvsroot/drools/drools/src/java/main/org/drools/tags/rule/ParameterTag.java,v retrieving revision 1.3 diff -u -r1.3 ParameterTag.java --- src/java/main/org/drools/tags/rule/ParameterTag.java 19 Aug 2002 21:15:42 -0000 1.3 +++ src/java/main/org/drools/tags/rule/ParameterTag.java 29 Jan 2003 23:55:01 +-0000 @@ -50,7 +50,7 @@ import org.drools.rule.Rule; import org.apache.commons.jelly.XMLOutput; -import org.apache.commons.jelly.JellyException; +import org.apache.commons.jelly.JellyTagException; /** Construct a root fact object parameter <code>Declaration</code> * for a <code>Rule</code>. @@ -87,10 +87,10 @@ * * @param output The output sink. * - * @throws Exception If an error occurs while attempting + * @throws JellyTagException If an error occurs while attempting * to perform this tag. */ - public void doTag(XMLOutput output) throws Exception + public void doTag(XMLOutput output) throws JellyTagException { verifyAttributes(); @@ -98,7 +98,7 @@ if ( rule == null ) { - throw new JellyException( "No rule available" ); + throw new JellyTagException( "No rule available" ); } Declaration decl = createDeclaration( output ); Index: src/java/main/org/drools/tags/rule/RuleSetTag.java =================================================================== RCS file: /cvsroot/drools/drools/src/java/main/org/drools/tags/rule/RuleSetTag.java,v retrieving revision 1.5 diff -u -r1.5 RuleSetTag.java --- src/java/main/org/drools/tags/rule/RuleSetTag.java 1 Jan 2003 23:11:40 -0000 1.5 +++ src/java/main/org/drools/tags/rule/RuleSetTag.java 29 Jan 2003 23:55:01 -0000 @@ -50,6 +50,7 @@ import org.drools.rule.RuleSet; import org.drools.tags.knowledge.RuleBaseTag; +import org.apache.commons.jelly.JellyTagException; import org.apache.commons.jelly.XMLOutput; /** Construct a <code>RuleSet</code>. @@ -143,10 +144,10 @@ * * @param output The output sink. * - * @throws Exception If an error occurs while attempting + * @throws JellyTagException If an error occurs while attempting * to perform this tag. */ - public void doTag(XMLOutput output) throws Exception + public void doTag(XMLOutput output) throws JellyTagException { requiredAttribute( "name", this.name ); Index: src/java/main/org/drools/tags/rule/RuleTag.java =================================================================== RCS file: /cvsroot/drools/drools/src/java/main/org/drools/tags/rule/RuleTag.java,v retrieving revision 1.3 diff -u -r1.3 RuleTag.java --- src/java/main/org/drools/tags/rule/RuleTag.java 20 Aug 2002 21:19:55 -0000 1.3 +++ src/java/main/org/drools/tags/rule/RuleTag.java 29 Jan 2003 23:55:01 -0000 @@ -46,10 +46,13 @@ */ +import org.drools.rule.DuplicateRuleNameException; +import org.drools.rule.InvalidRuleException; import org.drools.rule.Rule; import org.drools.rule.RuleSet; import org.drools.tags.knowledge.RuleBaseTag; +import org.apache.commons.jelly.JellyTagException; import org.apache.commons.jelly.XMLOutput; /** Construct a <code>Rule</code> for a <code>RuleSet</code>. @@ -143,10 +146,10 @@ * * @param output The output sink. * - * @throws Exception If an error occurs while attempting + * @throws JellyTagException If an error occurs while attempting * to perform this tag. */ - public void doTag(XMLOutput output) throws Exception + public void doTag(XMLOutput output) throws JellyTagException { requiredAttribute( "name", this.name ); @@ -168,7 +171,18 @@ if ( ruleSet != null ) { - ruleSet.addRule( this.rule ); + try + { + ruleSet.addRule( this.rule ); + } + catch (InvalidRuleException e) + { + throw new JellyTagException(e); + } + catch (DuplicateRuleNameException e) + { + throw new JellyTagException(e); + } } else { Index: src/java/main/org/drools/tags/rule/RulesTag.java =================================================================== RCS file: /cvsroot/drools/drools/src/java/main/org/drools/tags/rule/RulesTag.java,v retrieving revision 1.1 diff -u -r1.1 RulesTag.java --- src/java/main/org/drools/tags/rule/RulesTag.java 20 Aug 2002 05:06:24 -0000 1.1 +++ src/java/main/org/drools/tags/rule/RulesTag.java 29 Jan 2003 23:55:01 -0000 @@ -46,6 +46,7 @@ */ +import org.apache.commons.jelly.JellyTagException; import org.apache.commons.jelly.XMLOutput; /** General rules container tag. @@ -78,10 +79,10 @@ * * @param output The output sink. * - * @throws Exception If an error occurs while attempting + * @throws JellyTagException If an error occurs while attempting * to perform this tag. */ - public void doTag(XMLOutput output) throws Exception + public void doTag(XMLOutput output) throws JellyTagException { invokeBody( output ); } Index: src/java/main/org/drools/tags/rule/SemanticsTag.java =================================================================== RCS file: /cvsroot/drools/drools/src/java/main/org/drools/tags/rule/SemanticsTag.java,v retrieving revision 1.5 diff -u -r1.5 SemanticsTag.java --- src/java/main/org/drools/tags/rule/SemanticsTag.java 1 Jan 2003 22:15:31 -0000 1.5 +++ src/java/main/org/drools/tags/rule/SemanticsTag.java 29 Jan 2003 23:55:01 +-0000 @@ -46,6 +46,8 @@ */ +import java.io.IOException; + import org.drools.smf.SemanticModule; import org.drools.io.SemanticsLoader; @@ -54,6 +56,7 @@ import org.apache.commons.jelly.XMLOutput; import org.apache.commons.jelly.MissingAttributeException; import org.apache.commons.jelly.JellyException; +import org.apache.commons.jelly.JellyTagException; /** Load semantics. * @@ -131,14 +134,25 @@ * * @return The semantic module. * - * @throws Exception If an error occurs while attempting + * @throws JellyTagException If an error occurs while attempting * to load the semantic module. */ - protected SemanticModule getSemanticModule() throws Exception + protected SemanticModule getSemanticModule() throws JellyTagException { SemanticsLoader loader = new SemanticsLoader(); - return loader.load( getModule() ); + try + { + return loader.load( getModule() ); + } + catch (IOException e) + { + throw new JellyTagException( e ); + } + catch (JellyException e) + { + throw new JellyTagException( e ); + } } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -149,10 +163,13 @@ * * @param output The output sink. * - * @throws Exception If an error occurs while attempting + * @throws MissingAttributeException If the module attribute + * has not been set + * @throws JellyTagException If an error occurs while attempting * to perform this tag. */ - public void doTag(XMLOutput output) throws Exception + public void doTag(XMLOutput output) + throws MissingAttributeException, JellyTagException { if ( this.module == null || @@ -165,7 +182,7 @@ if ( semanticModule == null ) { - throw new JellyException( "Unknown semantic module: " + this.module ); + throw new JellyTagException( "Unknown semantic module: " + this.module ); } if ( this.var != null ) Index: src/java/main/org/drools/tags/rule/SemanticsTagLibrary.java =================================================================== RCS file: /cvsroot/drools/drools/src/java/main/org/drools/tags/rule/SemanticsTagLibrary.java,v retrieving revision 1.6 diff -u -r1.6 SemanticsTagLibrary.java --- src/java/main/org/drools/tags/rule/SemanticsTagLibrary.java 27 Sep 2002 20:55:32 -0000 1.6 +++ src/java/main/org/drools/tags/rule/SemanticsTagLibrary.java 29 Jan 2003 23:55:01 +-0000 @@ -76,10 +76,8 @@ * * @param module The module to make available as a taglib. * - * @throws Exception If an error occurs while attempting - * to initialize the module as a tag library. */ - SemanticsTagLibrary(SemanticModule module) throws Exception + SemanticsTagLibrary(SemanticModule module) { super( module.getUri() ); this.module = module; @@ -105,10 +103,8 @@ /** Register <code>ObjectType</code>s. * - * @throws Exception If an error occurs while attempting - * to register this module's object-types. */ - protected void registerObjectTypes() throws Exception + protected void registerObjectTypes() { Set names = getSemanticModule().getObjectTypeNames(); @@ -131,11 +127,9 @@ * @param name The name. * @param beanClass The class. * - * @throws Exception If an error occurs while attempting - * to register the object-type. */ protected void registerObjectType(final String name, - final Class beanClass) throws Exception + final Class beanClass) { registerBeanTag( name, new ComponentTagFactory( beanClass, @@ -147,7 +141,7 @@ * @throws Exception If an error occurs while attempting * to register this module's conditions. */ - protected void registerConditions() throws Exception + protected void registerConditions() { Set names = getSemanticModule().getConditionNames(); @@ -170,11 +164,9 @@ * @param name The name. * @param beanClass The class. * - * @throws Exception If an error occurs while attempting - * to register the condition. */ protected void registerCondition(final String name, - final Class beanClass) throws Exception + final Class beanClass) { registerBeanTag( name, new ComponentTagFactory( beanClass, @@ -183,10 +175,8 @@ /** Register <code>Extractors</code>s. * - * @throws Exception If an error occurs while attempting - * to register this module's extractors. */ - protected void registerExtractors() throws Exception + protected void registerExtractors() { Set names = getSemanticModule().getExtractorNames(); @@ -209,11 +199,9 @@ * @param name The name. * @param beanClass The class. * - * @throws Exception If an error occurs while attempting - * to register the extractor. */ protected void registerExtractor(final String name, - final Class beanClass) throws Exception + final Class beanClass) { registerBeanTag( name, new ComponentTagFactory( beanClass, @@ -222,10 +210,8 @@ /** Register <code>Consequence</code>s. * - * @throws Exception If an error occurs while attempting - * to register this module's consequences. */ - protected void registerConsequences() throws Exception + protected void registerConsequences() { Set names = getSemanticModule().getConsequenceNames(); @@ -248,11 +234,9 @@ * @param name The name. * @param beanClass The class. * - * @throws Exception If an error occurs while attempting - * to register the consequence. */ protected void registerConsequence(final String name, - final Class beanClass) throws Exception + final Class beanClass) { registerBeanTag( name, new ComponentTagFactory( beanClass, Index: src/java/main/org/drools/tags/semantics/ConditionTag.java =================================================================== RCS file: /cvsroot/drools/drools/src/java/main/org/drools/tags/semantics/ConditionTag.java,v retrieving revision 1.2 diff -u -r1.2 ConditionTag.java --- src/java/main/org/drools/tags/semantics/ConditionTag.java 19 Sep 2002 06:58:01 -0000 1.2 +++ src/java/main/org/drools/tags/semantics/ConditionTag.java 29 Jan 2003 23:55:01 +-0000 @@ -46,10 +46,11 @@ */ +import org.drools.smf.InvalidConditionException; import org.drools.smf.SimpleSemanticModule; import org.apache.commons.jelly.XMLOutput; -import org.apache.commons.jelly.JellyException; +import org.apache.commons.jelly.JellyTagException; /** Defines a <code>Condition</code>. * @@ -82,10 +83,10 @@ * * @param output The output sink. * - * @throws Exception If an error occurs while attempting + * @throws JellyTagException If an error occurs while attempting * to perform this tag. */ - public void doTag(XMLOutput output) throws Exception + public void doTag(XMLOutput output) throws JellyTagException { checkAttributes(); @@ -93,13 +94,24 @@ if ( module == null ) { - throw new JellyException( "Only allowed within a module" ); + throw new JellyTagException( "Only allowed within a module" ); } - Class conditionClass = Class.forName( getClassname() ); + try + { + Class conditionClass = Class.forName( getClassname() ); - module.addCondition( getName(), - conditionClass ); + module.addCondition( getName(), + conditionClass ); + } + catch (ClassNotFoundException e) + { + throw new JellyTagException( e ); + } + catch (InvalidConditionException e) + { + throw new JellyTagException( e ); + } } } Index: src/java/main/org/drools/tags/semantics/ConsequenceTag.java =================================================================== RCS file: /cvsroot/drools/drools/src/java/main/org/drools/tags/semantics/ConsequenceTag.java,v retrieving revision 1.2 diff -u -r1.2 ConsequenceTag.java --- src/java/main/org/drools/tags/semantics/ConsequenceTag.java 19 Sep 2002 06:58:01 -0000 1.2 +++ src/java/main/org/drools/tags/semantics/ConsequenceTag.java 29 Jan 2003 23:55:01 +-0000 @@ -46,10 +46,11 @@ */ +import org.drools.smf.InvalidConsequenceException; import org.drools.smf.SimpleSemanticModule; import org.apache.commons.jelly.XMLOutput; -import org.apache.commons.jelly.JellyException; +import org.apache.commons.jelly.JellyTagException; /** Defines an <code>Consequence</code>. * @@ -82,10 +83,10 @@ * * @param output The output sink. * - * @throws Exception If an error occurs while attempting + * @throws JellyTagException If an error occurs while attempting * to perform this tag. */ - public void doTag(XMLOutput output) throws Exception + public void doTag(XMLOutput output) throws JellyTagException { checkAttributes(); @@ -93,13 +94,24 @@ if ( module == null ) { - throw new JellyException( "Only allowed within a module" ); + throw new JellyTagException( "Only allowed within a module" ); } - Class consequenceClass = Class.forName( getClassname() ); + try + { + Class consequenceClass = Class.forName( getClassname() ); - module.addConsequence( getName(), - consequenceClass ); + module.addConsequence( getName(), + consequenceClass ); + } + catch (ClassNotFoundException e) + { + throw new JellyTagException( e ); + } + catch (InvalidConsequenceException e) + { + throw new JellyTagException( e ); + } } } Index: src/java/main/org/drools/tags/semantics/ExtractorTag.java =================================================================== RCS file: /cvsroot/drools/drools/src/java/main/org/drools/tags/semantics/ExtractorTag.java,v retrieving revision 1.4 diff -u -r1.4 ExtractorTag.java --- src/java/main/org/drools/tags/semantics/ExtractorTag.java 19 Sep 2002 06:58:01 -0000 1.4 +++ src/java/main/org/drools/tags/semantics/ExtractorTag.java 29 Jan 2003 23:55:01 +-0000 @@ -46,10 +46,11 @@ */ +import org.drools.smf.InvalidExtractorException; import org.drools.smf.SimpleSemanticModule; import org.apache.commons.jelly.XMLOutput; -import org.apache.commons.jelly.JellyException; +import org.apache.commons.jelly.JellyTagException; /** Defines a <code>Extractor</code>. * @@ -82,10 +83,10 @@ * * @param output The output sink. * - * @throws Exception If an error occurs while attempting + * @throws JellyTagException If an error occurs while attempting * to perform this tag. */ - public void doTag(XMLOutput output) throws Exception + public void doTag(XMLOutput output) throws JellyTagException { checkAttributes(); @@ -93,13 +94,24 @@ if ( module == null ) { - throw new JellyException( "Only allowed within a module" ); + throw new JellyTagException( "Only allowed within a module" ); } - Class extractClass = Class.forName( getClassname() ); + try + { + Class extractClass = Class.forName( getClassname() ); - module.addExtractor( getName(), - extractClass ); + module.addExtractor( getName(), + extractClass ); + } + catch (ClassNotFoundException e) + { + throw new JellyTagException( e ); + } + catch (InvalidExtractorException e) + { + throw new JellyTagException( e ); + } } } Index: src/java/main/org/drools/tags/semantics/ObjectTypeTag.java =================================================================== RCS file: /cvsroot/drools/drools/src/java/main/org/drools/tags/semantics/ObjectTypeTag.java,v retrieving revision 1.2 diff -u -r1.2 ObjectTypeTag.java --- src/java/main/org/drools/tags/semantics/ObjectTypeTag.java 19 Sep 2002 06:58:01 -0000 1.2 +++ src/java/main/org/drools/tags/semantics/ObjectTypeTag.java 29 Jan 2003 23:55:01 +-0000 @@ -46,10 +46,11 @@ */ +import org.drools.smf.InvalidObjectTypeException; import org.drools.smf.SimpleSemanticModule; import org.apache.commons.jelly.XMLOutput; -import org.apache.commons.jelly.JellyException; +import org.apache.commons.jelly.JellyTagException; /** Defines an <code>ObjectType</code>. * @@ -82,10 +83,10 @@ * * @param output The output sink. * - * @throws Exception If an error occurs while attempting + * @throws JellyTagException If an error occurs while attempting * to perform this tag. */ - public void doTag(XMLOutput output) throws Exception + public void doTag(XMLOutput output) throws JellyTagException { checkAttributes(); @@ -93,13 +94,24 @@ if ( module == null ) { - throw new JellyException( "Only allowed within a module" ); + throw new JellyTagException( "Only allowed within a module" ); } - Class objectTypeClass = Class.forName( getClassname() ); + try + { + Class objectTypeClass = Class.forName( getClassname() ); - module.addObjectType( getName(), - objectTypeClass ); + module.addObjectType( getName(), + objectTypeClass ); + } + catch (ClassNotFoundException e) + { + throw new JellyTagException( e ); + } + catch (InvalidObjectTypeException e) + { + throw new JellyTagException( e ); + } } } Index: src/java/main/org/drools/tags/semantics/SemanticModuleTag.java =================================================================== RCS file: /cvsroot/drools/drools/src/java/main/org/drools/tags/semantics/SemanticModuleTag.java,v retrieving revision 1.3 diff -u -r1.3 SemanticModuleTag.java --- src/java/main/org/drools/tags/semantics/SemanticModuleTag.java 19 Sep 2002 06:58:01 -0000 1.3 +++ src/java/main/org/drools/tags/semantics/SemanticModuleTag.java 29 Jan 2003 +23:55:02 -0000 @@ -48,6 +48,7 @@ import org.drools.smf.SimpleSemanticModule; +import org.apache.commons.jelly.JellyTagException; import org.apache.commons.jelly.XMLOutput; import org.apache.commons.jelly.MissingAttributeException; @@ -146,10 +147,12 @@ * * @param output The output sink. * - * @throws Exception If an error occurs while attempting + * @throws MissingAttributeException If the uri attribute + * has not been set + * @throws JellyTagException If an error occurs while attempting * to perform this tag. */ - public void doTag(XMLOutput output) throws Exception + public void doTag(XMLOutput output) throws JellyTagException { if ( getUri() == null ) {
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]