[Mtbrowser-developers] SF.net SVN: mtbrowser: [22] trunk
Status: Beta
Brought to you by:
ipv6guru
|
From: <cod...@us...> - 2007-06-17 01:04:54
|
Revision: 22
http://mtbrowser.svn.sourceforge.net/mtbrowser/?rev=22&view=rev
Author: coder_2020
Date: 2007-06-16 18:04:51 -0700 (Sat, 16 Jun 2007)
Log Message:
-----------
I added some code to handle Exceptions
Modified Paths:
--------------
trunk/ExecuteBrowser.class
trunk/ExecuteBrowser.java
trunk/FindBrowsers.class
trunk/FindBrowsers.java
trunk/GenericFunctions.class
Added Paths:
-----------
trunk/DataMissingException.class
trunk/MtBrowserException.class
trunk/MtBrowserExceptions.java
trunk/NotFoundBrowserException.class
Added: trunk/DataMissingException.class
===================================================================
(Binary files differ)
Property changes on: trunk/DataMissingException.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/ExecuteBrowser.class
===================================================================
(Binary files differ)
Modified: trunk/ExecuteBrowser.java
===================================================================
--- trunk/ExecuteBrowser.java 2007-06-15 21:29:20 UTC (rev 21)
+++ trunk/ExecuteBrowser.java 2007-06-17 01:04:51 UTC (rev 22)
@@ -1,4 +1,5 @@
package mtbrowser;
+import java.io.IOException;
public class ExecuteBrowser {
private String browserName, link;
@@ -11,24 +12,28 @@
this.browserName = browserName;
this.link = link;
}
- public void startBrowser() throws Exception
+ public void startBrowser() throws MtBrowserException
{
if(browserName == "" || link == "")
- throw new Exception("Browser or Link is missing\n");
-
- String cmd = "./startbrowser " + browserName + " " + link;
- Process p = Runtime.getRuntime().exec(cmd);
-
- /*BufferedReader stdInput = new BufferedReader(new
- InputStreamReader(p.getInputStream()));
- String s = stdInput.readLine();
- return s != null ? s : "";*/
+ throw new DataMissingException("Browser or Link is missing\n");
+ try{
+ String cmd = "./startbrowser " + browserName + " " + link;
+ Process p = Runtime.getRuntime().exec(cmd);
+ }catch(IOException e)
+ {
+ throw new DataMissingException("Could not start Browser " + e.getMessage());
+ }
}
- public static void startBrowser(String browserName, String link)throws Exception
+ public static void startBrowser(String browserName, String link)throws MtBrowserException
{
if(browserName == "" || link == "")
- throw new Exception("Browser or Link is missing");
- String cmd = "./startbrowser " + browserName + " " + link;
- Process p = Runtime.getRuntime().exec(cmd);
+ throw new DataMissingException("Browser or Link is missing");
+ try{
+ String cmd = "./startbrowser " + browserName + " " + link;
+ Process p = Runtime.getRuntime().exec(cmd);
+ }catch(IOException e)
+ {
+ throw new DataMissingException("Could not start Browser " + e.getMessage());
+ }
}
}
Modified: trunk/FindBrowsers.class
===================================================================
(Binary files differ)
Modified: trunk/FindBrowsers.java
===================================================================
--- trunk/FindBrowsers.java 2007-06-15 21:29:20 UTC (rev 21)
+++ trunk/FindBrowsers.java 2007-06-17 01:04:51 UTC (rev 22)
@@ -16,7 +16,7 @@
{
this("");
}
- public String Find()
+ public String Find() throws MtBrowserException
{
return check(browserName);
}
@@ -29,7 +29,7 @@
return browserName;
}
- public static String check(String browserName) {
+ public static String check(String browserName) throws MtBrowserException {
try {
@@ -55,9 +55,7 @@
return s != null ? s : "";
}
catch (IOException e) {
- System.out.println("exception happened: ");
- e.printStackTrace();
+ throw new NotFoundBrowserException("Not Found Exception " + e.getMessage() + e.getStackTrace());
}
- return "";
}
}
Modified: trunk/GenericFunctions.class
===================================================================
(Binary files differ)
Added: trunk/MtBrowserException.class
===================================================================
(Binary files differ)
Property changes on: trunk/MtBrowserException.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/MtBrowserExceptions.java
===================================================================
--- trunk/MtBrowserExceptions.java (rev 0)
+++ trunk/MtBrowserExceptions.java 2007-06-17 01:04:51 UTC (rev 22)
@@ -0,0 +1,45 @@
+package mtbrowser;
+
+class MtBrowserException extends Exception
+{
+ public MtBrowserException()
+ {
+ this("Unexpected Error happened");
+ }
+ public MtBrowserException(String smessage)
+ {
+ this.message = message;
+ }
+ public void setMessage(String s)
+ {
+ message = s;
+ }
+ public String getMessage()
+ {
+ return message;
+ }
+ protected String message;
+}
+
+class NotFoundBrowserException extends MtBrowserException
+{
+ public NotFoundBrowserException()
+ {
+ this("NotFoundBrowserException");
+ }
+ public NotFoundBrowserException(String message)
+ {
+ super(message);
+ }
+}
+class DataMissingException extends MtBrowserException
+{
+ public DataMissingException()
+ {
+ this("DataMissingException");
+ }
+ public DataMissingException(String message)
+ {
+ super(message);
+ }
+}
\ No newline at end of file
Added: trunk/NotFoundBrowserException.class
===================================================================
(Binary files differ)
Property changes on: trunk/NotFoundBrowserException.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|