You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-dev@jakarta.apache.org by cm...@apache.org on 2003/05/01 15:38:02 UTC

cvs commit: jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/webxml WebXmlVersion.java

cmlenz      2003/05/01 06:38:02

  Modified:    integration/ant/src/test/org/apache/cactus/integration/ant/webxml
                        Tag: CACTUS_14_ANT_BRANCH TestWebXmlVersion.java
               integration/ant/src/java/org/apache/cactus/integration/ant/webxml
                        Tag: CACTUS_14_ANT_BRANCH WebXmlVersion.java
  Log:
  Add a valueOf(String) method that returns the correct WebXmlVersion instance based on the Public ID
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.2   +2 -2      jakarta-cactus/integration/ant/src/test/org/apache/cactus/integration/ant/webxml/Attic/TestWebXmlVersion.java
  
  Index: TestWebXmlVersion.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/integration/ant/src/test/org/apache/cactus/integration/ant/webxml/Attic/TestWebXmlVersion.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- TestWebXmlVersion.java	30 Apr 2003 15:32:43 -0000	1.1.2.1
  +++ TestWebXmlVersion.java	1 May 2003 13:38:02 -0000	1.1.2.2
  @@ -151,7 +151,7 @@
       {
           try
           {
  -            WebXmlVersion.valueOf(null);
  +            WebXmlVersion.valueOf((DocumentType) null);
               fail("Expected NullPointerException");
           }
           catch (NullPointerException expected)
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.2   +15 -3     jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/webxml/Attic/WebXmlVersion.java
  
  Index: WebXmlVersion.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/integration/ant/src/java/org/apache/cactus/integration/ant/webxml/Attic/WebXmlVersion.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- WebXmlVersion.java	30 Apr 2003 15:32:43 -0000	1.1.2.1
  +++ WebXmlVersion.java	1 May 2003 13:38:02 -0000	1.1.2.2
  @@ -203,11 +203,23 @@
        */
       public static WebXmlVersion valueOf(DocumentType theDocType)
       {
  -        if (V2_2.getPublicId().equals(theDocType.getPublicId()))
  +        return valueOf(theDocType.getPublicId());
  +    }
  +
  +    /**
  +     * Returns the version corresponding to the given public ID.
  +     * 
  +     * @param thePublicId The public ID
  +     * @return The version that matches the public ID, or <code>null</code>
  +     *         if the ID is not recognized
  +     */
  +    public static WebXmlVersion valueOf(String thePublicId)
  +    {
  +        if (V2_2.getPublicId().equals(thePublicId))
           {
               return WebXmlVersion.V2_2;
           }
  -        else if (V2_3.getPublicId().equals(theDocType.getPublicId()))
  +        else if (V2_3.getPublicId().equals(thePublicId))
           {
               return WebXmlVersion.V2_3;
           }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-dev-help@jakarta.apache.org