tn5250j/src/org/tn5250j/tools/system OperatingSystem.java,1.8,1.9

"Kenneth J. Pouncey" <[email protected]> Tue, 14 Jun 2005 06:06:59 +0000
Newsgroups gmane.comp.java.tn5250j.cvs
Message-ID <[email protected]>
Update of /cvsroot/tn5250j/tn5250j/src/org/tn5250j/tools/system
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7480/src/org/tn5250j/tools/system

Modified Files:
	OperatingSystem.java 
Log Message:
changed dsiplay url code to work correctly when there are not parameters specified

Index: OperatingSystem.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/tools/system/OperatingSystem.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** OperatingSystem.java	9 Jun 2005 04:54:45 -0000	1.8
--- OperatingSystem.java	14 Jun 2005 06:06:57 -0000	1.9
***************
*** 163,167 ****
        return java14;
     }
!    
     public static final boolean hasJava15()
     {
--- 163,167 ----
        return java14;
     }
! 
     public static final boolean hasJava15()
     {
***************
*** 174,180 ****
      * file in the system browser. If you want to display a file, you must
      * include the absolute path name.
!     * 
      * @param url the file's url (the url must start with either "http://",
!     *           "mailto:" or "file://").
      */
     public static void displayURL(String url) {
--- 174,180 ----
      * file in the system browser. If you want to display a file, you must
      * include the absolute path name.
!     *
      * @param url the file's url (the url must start with either "http://",
!     *           "https://","mailto:" or "file://").
      */
     public static void displayURL(String url) {
***************
*** 187,201 ****
           urlUrl = new java.net.URL(url);
           protocol = urlUrl.getProtocol();
        }
        catch (MalformedURLException e) {
           log.warn(e.getMessage());
        }
!       
        Properties props = ConfigureFactory.getInstance().getProperties(ConfigureFactory.SESSIONS);
  
!       if (props.getProperty("emul.protocol." + protocol,
!             ConfigureFactory.SESSIONS).trim().length() > 0) {
!          String commandTemplate = props.getProperty(
!                "emul.protocol." + protocol, ConfigureFactory.SESSIONS).trim();
           Object[] urlParm = new Object[1];
           urlParm[0] = url;
--- 187,204 ----
           urlUrl = new java.net.URL(url);
           protocol = urlUrl.getProtocol();
+          if (protocol.startsWith("http"))
+             protocol = "http";
        }
        catch (MalformedURLException e) {
           log.warn(e.getMessage());
        }
! 
        Properties props = ConfigureFactory.getInstance().getProperties(ConfigureFactory.SESSIONS);
  
!       // We now check if we have a property defined for the external program to
!       //   handle this protocol.
!       if (props.getProperty("emul.protocol." + protocol,"").trim().length() > 0) {
!          String commandTemplate = props.getProperty("emul.protocol." + protocol).trim();
! 
           Object[] urlParm = new Object[1];
           urlParm[0] = url;
***************
*** 207,219 ****
           }
           catch (Exception exx) {
!             log.warn("Unable to parse the url " + url + " using command " + 
                    commandTemplate);
           }
        }
  
!       if (command != null && command.length() > 0) {
  
           execute(command);
!          
        }
        else {
--- 210,224 ----
           }
           catch (Exception exx) {
!             log.warn("Unable to parse the url " + url + " using command " +
                    commandTemplate);
           }
        }
  
!       // execute the command if there was one if not then fall through to generic
!       //   processing.
!       if (command != null && command.trim().length() > 0) {
  
           execute(command);
! 
        }
        else {
***************
*** 260,266 ****
  
     public static int execute(String command) {
!       
        int exitCode = -1;
!       
        try {
           Process p = Runtime.getRuntime().exec(command);
--- 265,271 ----
  
     public static int execute(String command) {
! 
        int exitCode = -1;
! 
        try {
           Process p = Runtime.getRuntime().exec(command);
***************
*** 346,350 ****
        if(System.getProperty("java.version").compareTo("1.4") >= 0)
           java14 = true;
!       
        if(System.getProperty("java.version").compareTo("1.5") >= 0)
           java15 = true;
--- 351,355 ----
        if(System.getProperty("java.version").compareTo("1.4") >= 0)
           java14 = true;
! 
        if(System.getProperty("java.version").compareTo("1.5") >= 0)
           java15 = true;



-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.  
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20