xml-xang-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdier...@apache.org
Subject cvs commit: xml-xang/java/src/org/apache/xang/xap XapSystem.java
Date Tue, 07 Aug 2001 06:16:30 GMT
mdierken    01/08/06 23:16:30

  Modified:    java/src/org/apache/xang/xap XapSystem.java
  Log:
  Change loading of XML document to clear xmlDoc on errors. This will cause a reload on the
next try.
  
  Revision  Changes    Path
  1.5       +28 -22    xml-xang/java/src/org/apache/xang/xap/XapSystem.java
  
  Index: XapSystem.java
  ===================================================================
  RCS file: /home/cvs/xml-xang/java/src/org/apache/xang/xap/XapSystem.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XapSystem.java	2000/04/18 23:05:33	1.4
  +++ XapSystem.java	2001/08/07 06:16:30	1.5
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -10,7 +10,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer. 
  + *    notice, this list of conditions and the following disclaimer.
    *
    * 2. Redistributions in binary form must reproduce the above copyright
    *    notice, this list of conditions and the following disclaimer in
  @@ -18,7 +18,7 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:  
  + *    if any, must include the following acknowledgment:
    *       "This product includes software developed by the
    *        Apache Software Foundation (http://www.apache.org/)."
    *    Alternately, this acknowledgment may appear in the software itself,
  @@ -26,7 +26,7 @@
    *
    * 4. The names "Xang" and "Apache Software Foundation" must
    *    not be used to endorse or promote products derived from this
  - *    software without prior written permission. For written 
  + *    software without prior written permission. For written
    *    permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  @@ -71,15 +71,15 @@
   /**
    * This handles the system represented by the .xap file.
    * It returns the DOM Element referenced by the URL path and dispatches the requeste commands.
  - * 
  - * @author     <a href="mailto:mdierken@apache.org">S. Mike Dierken</a> 
  + *
  + * @author     <a href="mailto:mdierken@apache.org">S. Mike Dierken</a>
    */
   public class XapSystem extends HTTPObject implements IHTTPObjectSystem
   {
       /** Used to identify child elements
        */
       public static final String ATTR_RELATIVE_ID = "name";
  -    
  +
       public XapSystem(String rootFile)
       {
           if (rootFile.endsWith(File.separator))
  @@ -104,18 +104,24 @@
   			if( dynDoc.shouldReload() )
   				xmlDoc = null;
   		}
  -		
  +
   		if( xmlDoc == null )
           {
               // preserves whitespace
               xmlDoc = new DynamicDocument(false,false);
   
  -            xmlDoc.load(rootFile);
  +			try {
  +                xmlDoc.load(rootFile);
  +			}
  +			catch(Exception e)
  +			{
  +				xmlDoc=null;
  +			}
   		}
  -        
  +
   		return xmlDoc;
       }
  -    
  +
       // Hacked up session methods
       public void setSessionObject(String key,Object obj)
       {
  @@ -129,7 +135,7 @@
       {
           return sessionObjects;
       }
  -    
  +
       //////////////////////
       // IHTTPObjectSystem
       /** Get the root object. This root object is used to locate child objects.
  @@ -166,12 +172,12 @@
       protected Element getChildByAttribute(Element node,String attribute,String value)
       {
           String path;
  -        
  -        path ="*[@"+attribute+"='"+value+"']";      
  +
  +        path ="*[@"+attribute+"='"+value+"']";
           return (Element)node.selectSingleNode(path);
       }
   */
  -    
  +
       //////////////////////
       // IHTTPObject
       // child objects
  @@ -189,7 +195,7 @@
           {
               return null;
           }
  -        
  +
           node = (Element)xmlDoc.getDocumentElement();
   		for (int i=startingOffset; i < idPath.size(); i++)
           {
  @@ -214,14 +220,14 @@
       {
           return false;
       }
  -	
  -	
  +
  +
   	//////////
       //
       String rootFile="";
       DynamicDocument xmlDoc=null;
       Hashtable sessionObjects= new Hashtable();
  -	
  +
       //////////
       //
       static public void main(String args[])
  @@ -232,13 +238,13 @@
           {
               loop = Integer.parseInt(args[1]);
           }
  -        
  +
           for (int i=0; i < loop; i++)
           {
               server.invoke("GET","http://debug/servlet/Xap/","northwind/service",null,null,System.out);
           }
       }
  -    
  -    public final static String RCS_STRING = "$Workfile: XapSystem.java $ " + "$Revision:
1.4 $";
  +
  +    public final static String RCS_STRING = "$Workfile: XapSystem.java $ " + "$Revision:
1.5 $";
   }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xang-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xang-cvs-help@xml.apache.org


Mime
View raw message