Commits

jcarreira  committed bed6c84

Fixing build, code cleanups...
Made small modification to XWork DTD to allow params, results, and interceptor-refs under Actions to come in any order and to allow Result to either contain text (for the default param) or param elements.

git-svn-id: http://svn.opensymphony.com/svn/xwork/trunk/src@40e221344d-f017-0410-9bd5-d282ab1896d7

  • Participants
  • Parent commits 54cb1ad

Comments (0)

Files changed (8)

File etc/xwork-1.0.dtd

     default (true|false) "false"
 >
 
-<!ELEMENT interceptors (interceptor*, interceptor-stack*)>
+<!ELEMENT interceptors (interceptor|interceptor-stack)+>
 
 <!ELEMENT interceptor (param*)>
 <!ATTLIST interceptor
 
 <!ELEMENT global-results (result+)>
 
-<!ELEMENT action (param*, result*, interceptor-ref*)>
+<!ELEMENT action (param|result|interceptor-ref)*>
 <!ATTLIST action
 name CDATA #REQUIRED
     class CDATA #REQUIRED
     name CDATA #REQUIRED
 >
 
-<!ELEMENT result (param*)>
+<!ELEMENT result (#PCDATA|param)*>
 <!ATTLIST result
     name CDATA #REQUIRED
     type CDATA #IMPLIED

File java/com/opensymphony/xwork/XworkException.java

+/*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
 package com.opensymphony.xwork;
 
+
 /**
  * XworkException
  * @author Jason Carreira
  * Created Sep 7, 2003 12:15:03 AM
  */
 public class XworkException extends RuntimeException {
+    //~ Instance fields ////////////////////////////////////////////////////////
+
     Throwable throwable;
 
+    //~ Constructors ///////////////////////////////////////////////////////////
+
     /**
      * Constructs a <code>XworkException</code> with no detail  message.
      */
         this.throwable = cause;
     }
 
+    //~ Methods ////////////////////////////////////////////////////////////////
+
     public Throwable getThrowable() {
         return throwable;
     }

File java/com/opensymphony/xwork/config/ConfigurationException.java

  * Created Feb 24, 2003 8:15:08 AM
  */
 public class ConfigurationException extends XworkException {
+    //~ Constructors ///////////////////////////////////////////////////////////
+
     /**
-     * Constructs a <code>ConfigurationException</code> with no detail  message.
-     */
+ * Constructs a <code>ConfigurationException</code> with no detail  message.
+ */
     public ConfigurationException() {
     }
 
     /**
-     * Constructs a <code>ConfigurationException</code> with the specified
-     * detail message.
-     *
-     * @param   s   the detail message.
-     */
+ * Constructs a <code>ConfigurationException</code> with the specified
+ * detail message.
+ *
+ * @param   s   the detail message.
+ */
     public ConfigurationException(String s) {
         super(s);
     }
 
     /**
-     * Constructs a <code>ConfigurationException</code> with no detail  message.
-     */
+ * Constructs a <code>ConfigurationException</code> with no detail  message.
+ */
     public ConfigurationException(Throwable cause) {
         super(cause);
     }
 
     /**
-     * Constructs a <code>ConfigurationException</code> with the specified
-     * detail message.
-     *
-     * @param   s   the detail message.
-     */
+ * Constructs a <code>ConfigurationException</code> with the specified
+ * detail message.
+ *
+ * @param   s   the detail message.
+ */
     public ConfigurationException(String s, Throwable cause) {
         super(s, cause);
     }

File java/com/opensymphony/xwork/config/providers/InterceptorBuilder.java

     */
     public static Interceptor buildInterceptor(Class interceptorClass, Map params) throws ConfigurationException {
         String message;
+
         try {
             Interceptor interceptor = (Interceptor) interceptorClass.newInstance();
             OgnlUtil.setProperties(params, interceptor);
         } catch (Exception e) {
             throw new ConfigurationException("Caught Exception while registering Interceptor class " + interceptorClass.getName(), e);
         }
+
         throw new ConfigurationException(message);
     }
 

File java/com/opensymphony/xwork/config/providers/XmlConfigurationProvider.java

 import com.opensymphony.util.ClassLoaderUtil;
 import com.opensymphony.util.FileManager;
 import com.opensymphony.util.TextUtils;
+
 import com.opensymphony.xwork.config.Configuration;
 import com.opensymphony.xwork.config.ConfigurationException;
 import com.opensymphony.xwork.config.ConfigurationProvider;
 import com.opensymphony.xwork.config.entities.PackageConfig;
 import com.opensymphony.xwork.config.entities.ResultConfig;
 import com.opensymphony.xwork.config.entities.ResultTypeConfig;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
+
 import org.xml.sax.EntityResolver;
 import org.xml.sax.ErrorHandler;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
 
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
 import java.io.IOException;
 import java.io.InputStream;
+
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
 
 /**
  * Looks in the classpath for "xwork.xml" and uses it for the XWork configuration.
             dbf.setValidating(true);
             dbf.setNamespaceAware(true);
 
-            DocumentBuilder builder = dbf.newDocumentBuilder();
+            db = dbf.newDocumentBuilder();
             db.setEntityResolver(new EntityResolver() {
                     public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
                         if ("-//OpenSymphony Group//XWork 1.0//EN".equals(publicId)) {
         } catch (Exception e) {
             final String s = "Caught exception while loading file " + fileName;
             LOG.error(s, e);
-            throw new ConfigurationException(s,e);
+            throw new ConfigurationException(s, e);
         } finally {
             if (is != null) {
                 try {

File test/com/opensymphony/xwork/ActionNestingTest.java

         }
 
         /**
-        * Initializes the configuration object.
-        */
+* Initializes the configuration object.
+*/
         public void init(Configuration configurationManager) {
             PackageConfig packageContext = new PackageConfig();
             ActionConfig config = new ActionConfig(null, SimpleAction.class, null, null, null);
         }
 
         /**
-        * Tells whether the ConfigurationProvider should reload its configuration
-        * @return
-        */
+* Tells whether the ConfigurationProvider should reload its configuration
+* @return
+*/
         public boolean needsReload() {
             return false;
         }

File test/com/opensymphony/xwork/config/providers/XmlConfigurationProviderInvalidFileTest.java

+/*
+ * Copyright (c) 2002-2003 by OpenSymphony
+ * All rights reserved.
+ */
 package com.opensymphony.xwork.config.providers;
 
-import com.opensymphony.xwork.config.ConfigurationProvider;
 import com.opensymphony.xwork.config.ConfigurationException;
+import com.opensymphony.xwork.config.ConfigurationProvider;
+
 
 /**
  * XmlConfigurationProviderInvalidFileTest
  * Created Sep 6, 2003 2:36:10 PM
  */
 public class XmlConfigurationProviderInvalidFileTest extends ConfigurationTestBase {
+    //~ Methods ////////////////////////////////////////////////////////////////
+
     public void testInvalidFileThrowsException() {
         final String filename = "com/opensymphony/xwork/config/providers/xwork-test-invalid-file.xml";
         ConfigurationProvider provider = buildConfigurationProvider(filename);
+
         try {
             provider.init(configuration);
             fail();

File test/com/opensymphony/xwork/config/providers/xwork-test-multilevel.xml

         </interceptors>
 
         <action name="action1" class="com.opensymphony.xwork.SimpleAction">
-            <interceptor-ref name="params"/>
             <result name="success" type="chain"/>
+            <interceptor-ref name="params"/>
         </action>
     </package>
 
 
     <package name="namespace2" extends="namespace1" namespace="/namespace2">
         <action name="action2" class="com.opensymphony.xwork.SimpleAction">
-            <interceptor-ref name="params"/>
             <result name="success" type="chain"/>
+            <interceptor-ref name="params"/>
         </action>
     </package>
 
     <package name="namespace3" extends="namespace2" namespace="/namespace3">
         <action name="action3" class="com.opensymphony.xwork.SimpleAction">
+            <result name="success" type="chain"/>
             <interceptor-ref name="params"/>
             <interceptor-ref name="static-params"/>
-            <result name="success" type="chain"/>
         </action>
     </package>