Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > CVS update: joist/java/org/joist/util URL.java

Project highlights: Architectural Overview

joist
Discussion topic

Back to topic list

CVS update: joist/java/org/joist/util URL.java

Author stack
Full name Michael Stack
Date 2000-11-14 10:28:04 PST
Message User: stack
  Date: 00/11/14 10:28:04

  Modified: java/org/joist/util URL.java
  Log:
  Narrowed interface on getPort method -- because i could
  
  Revision Changes Path
  1.13 +16 -10 joist/java/org/joist​/util/URL.java
  
  Index: URL.java
  ====================​====================​====================​=======
  RCS file: /cvs/joist/java/org/​joist/util/URL.java,​v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- URL.java 2000/11/14 02:02:44 1.12
  +++ URL.java 2000/11/14 18:28:04 1.13
  @@ -62,7 +62,7 @@
    * Parses and builds URLs
    *
    * @author David C. Pellegrini <A HREF="mailto:davidp@​dataweb-systems.com"​>davidp@dataweb-s​ystems.com</A>​
  - * @version $Revision: 1.12 $
  + * @version $Revision: 1.13 $
    *
    * Copyright (c) 1999 dataweb systems, inc.
    * Copyright (c) 1999, 2000 Collab.Net, Inc.
  @@ -126,19 +126,19 @@
        * If port is default for the protocol, we return null else we pull port
        * for the passed in protocol from inProperties.
        *
  - * @param inProperties Instance of JoistProperties. Used to pull http
  - * ports from.
  - * @param inProtocol Either 'http' or 'https'.
  + * @param inProtocol Either 'http' or 'https'. Can be null and we assume
  + * the default 'http'.
        *
  - * @return Port to use as string. Null if port is
  + * @return Port to use as string. Null if port is default for the
  + * protocol (80 for 'http' and 443 for 'https').
        *
        * @exception NullPointerException If i can't get a JoistProperties
        */
  - public String getPort( org.joist.util.JoistProperties inProperties,
  - String inProtocol )
  + public String getPort( String inProtocol )
           throws NullPointerException
        {
           String port = null; // Port to return
  + String protocol = ( inProtocol == null )? getProtocol( ): inProtocol;
           
           final String HTTP_PROTOCOL = "http";
           final Integer DEFAULT_HTTP_PORT = new Integer( 80 );
  @@ -146,10 +146,16 @@
           final String HTTP_PORT_KEY = "http_port"; // Key to pull http_port
           final String HTTPS_PORT_KEY = "https_port"; // Key to pull https_port.
           
  - boolean isHttp = inProtocol.equalsIgnoreCase( HTTP_PROTOCOL );
  + // JoistProperties is a singleton of system properties.
  + org.joist.util.JoistProperties properties
  + = org.joist.util.Joist​Properties.getInstan​ce( );
  + if( properties == null )
  + throw new NullPointerException( "JoistProperties is null" );
  +
  + boolean isHttp = protocol.equalsIgnoreCase( HTTP_PROTOCOL );
           Integer defaultPort = ( isHttp )? DEFAULT_HTTP_PORT: DEFAULT_HTTPS_PORT;
           String portKey = ( isHttp )? HTTP_PORT_KEY: HTTPS_PORT_KEY;
  - port = inProperties.getProperty( portKey );
  + port = properties.getProperty( portKey );
           if( port == null )
               throw new NullPointerException( portKey + " is null" );
           if( port.equals( defaultPort.toString( ) ) )
  @@ -192,9 +198,9 @@
           final String DEFAULT_PROTOCOL = HTTP_PROTOCOL; // Default protocol
            
           String protocol = DEFAULT_PROTOCOL; // Protocol to return.
  -
           if( inProtocol != null )
               protocol = inProtocol;
  +
           if( !protocol.equalsIgnoreCase( HTTP_PROTOCOL )
               && !protocol.equalsIgnoreCase( HTTPS_PROTOCOL ) )
           {

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

CVS update: joist/java/org/joist/util URL.java stack Michael Stack 2000-11-14 10:28:04 PST
Messages per page: