tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@hyperreal.org
Subject cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util URLUtil.java
Date Fri, 22 Oct 1999 01:47:16 GMT
costin      99/10/21 18:47:14

  Modified:    src/share/org/apache/tomcat/core ResponseImpl.java
               src/share/org/apache/tomcat/service TcpEndpoint.java
               src/share/org/apache/tomcat/shell Startup.java
               src/share/org/apache/tomcat/util URLUtil.java
  Log:
  Small fixes + removed some strange JDK-specific code that may fail
  in different VMs.
  
  Revision  Changes    Path
  1.3       +18 -7     jakarta-tomcat/src/share/org/apache/tomcat/core/ResponseImpl.java
  
  Index: ResponseImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ResponseImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ResponseImpl.java	1999/10/19 23:38:31	1.2
  +++ ResponseImpl.java	1999/10/22 01:47:07	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ResponseImpl.java,v
1.2 1999/10/19 23:38:31 costin Exp $
  - * $Revision: 1.2 $
  - * $Date: 1999/10/19 23:38:31 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ResponseImpl.java,v
1.3 1999/10/22 01:47:07 costin Exp $
  + * $Revision: 1.3 $
  + * $Date: 1999/10/22 01:47:07 $
    *
    * ====================================================================
    *
  @@ -141,7 +141,7 @@
       
       public void finish() throws IOException {
   	try {
  -	    if (usingWriter) {
  +	    if (usingWriter && (writer != null)) {
   	        writer.flush();
   	    }
   	    out.reallyFlush();
  @@ -185,11 +185,22 @@
   	if (writer == null) {
   	    String encoding = getCharacterEncoding();
   
  -	    if (encoding == null)
  +	    if ((encoding == null) || "Default".equals(encoding) )
   	        writer = new PrintWriter(new OutputStreamWriter(out));
   	    else
  -	        writer =
  -                    new PrintWriter(new OutputStreamWriter(out, encoding));
  +		try {
  +		    writer = new PrintWriter(new OutputStreamWriter(out, encoding));
  +		} catch (java.io.UnsupportedEncodingException ex) {
  +		    // if we don't do that, the runtime exception will propagate
  +		    // and we'll try to send an error page - but surprise, we
  +		    // still can't get the Writer to send the error page...
  +		    writer = new PrintWriter( new OutputStreamWriter(out));
  +
  +		    // Deal with strange encodings - webmaster should see a message
  +		    // and install encoding classes - n new, unknown language was discovered,
  +		    // and they read our site!
  +		    System.out.println("Unsuported encoding: " + encoding );
  +		}
   	}
   
   	out.setUsingWriter (usingWriter);
  
  
  
  1.2       +6 -5      jakarta-tomcat/src/share/org/apache/tomcat/service/TcpEndpoint.java
  
  Index: TcpEndpoint.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/TcpEndpoint.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TcpEndpoint.java	1999/10/09 00:20:48	1.1
  +++ TcpEndpoint.java	1999/10/22 01:47:09	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/TcpEndpoint.java,v
1.1 1999/10/09 00:20:48 duncan Exp $
  - * $Revision: 1.1 $
  - * $Date: 1999/10/09 00:20:48 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/TcpEndpoint.java,v
1.2 1999/10/22 01:47:09 costin Exp $
  + * $Revision: 1.2 $
  + * $Date: 1999/10/22 01:47:09 $
    *
    * ====================================================================
    *
  @@ -93,7 +93,7 @@
    */
   public class TcpEndpoint  { // implements Endpoint {
   
  -    private StringManager sm =StringManager.getManager(Constants.Package);
  +    private StringManager sm =StringManager.getManager("org.apache.tomcat.service");
   
       private static final int BACKLOG = 50;
       private static final int TIMEOUT = 1000;
  @@ -228,7 +228,7 @@
   	// XXX reuse, pools, etc
   
   	// XXX set socket options
  -	s.setSoLinger( true, 100);
  +	// 	s.setSoLinger( true, 100);
   	
   	TcpConnection con=new TcpConnection();
   	con.setEndpoint(this);
  @@ -258,6 +258,7 @@
   	    running = false;
   	    String msg = sm.getString("endpoint.err.fatal",
   				      serverSocket, e);
  +	    e.printStackTrace(); // something very wrong happened - better know what
   	    System.err.println(msg);
   	}
       }
  
  
  
  1.2       +9 -5      jakarta-tomcat/src/share/org/apache/tomcat/shell/Startup.java
  
  Index: Startup.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/shell/Startup.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Startup.java	1999/10/09 00:20:54	1.1
  +++ Startup.java	1999/10/22 01:47:10	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/shell/Startup.java,v 1.1
1999/10/09 00:20:54 duncan Exp $
  - * $Revision: 1.1 $
  - * $Date: 1999/10/09 00:20:54 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/shell/Startup.java,v 1.2
1999/10/22 01:47:10 costin Exp $
  + * $Revision: 1.2 $
  + * $Date: 1999/10/22 01:47:10 $
    *
    * ====================================================================
    *
  @@ -117,6 +117,7 @@
   
   	ServerConfig serverConfig = config.getServerConfig();
   	Registry registry =  createRegistry(serverConfig.getAdminPort());
  +
   	Enumeration contextManagers = serverConfig.getContextManagers();
   
   	while (contextManagers.hasMoreElements()) {
  @@ -173,8 +174,9 @@
   		// XXX
   		// instead of HTTPServer it should be EndpointManager,
   		//   ContextManager, Handler, etc
  -	        registry.bind(Constants.Registry.Service + ":" +
  -		    server.getPort(), new AdminImpl(server));
  +	        if( registry != null )
  +		    registry.bind(Constants.Registry.Service + ":" +
  +				  server.getPort(), new AdminImpl(server));
   
   		// XXX
   		// start/stop individual components
  @@ -222,6 +224,8 @@
           Registry registry = null;
   	int numberAttempts = 0;
   
  +	if (port==0) return null;
  +			 
   	if (port < 0) {
   	    port = newPort();
   	}
  
  
  
  1.3       +5 -5      jakarta-tomcat/src/share/org/apache/tomcat/util/URLUtil.java
  
  Index: URLUtil.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/URLUtil.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- URLUtil.java	1999/10/12 08:30:46	1.2
  +++ URLUtil.java	1999/10/22 01:47:13	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/URLUtil.java,v 1.2
1999/10/12 08:30:46 gonzo Exp $
  - * $Revision: 1.2 $
  - * $Date: 1999/10/12 08:30:46 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/URLUtil.java,v 1.3
1999/10/22 01:47:13 costin Exp $
  + * $Revision: 1.3 $
  + * $Date: 1999/10/22 01:47:13 $
    *
    * ====================================================================
    *
  @@ -114,12 +114,12 @@
               } catch (IOException npe) {
               }
   
  -	    resolve = new URL("file", null, fName);
  +	    resolve = new URL("file", "", fName);
   	} else {
               String path = System.getProperty("user.dir") +
                   File.separator + s;
   
  -	    resolve = new URL("file", null, path);
  +	    resolve = new URL("file", "", path);
   	}
   
           if (! resolve.getProtocol().equalsIgnoreCase(
  
  
  

Mime
View raw message