basic exception handling
authorAleš Křenek <ljocha@ics.muni.cz>
Tue, 2 Jun 2009 08:12:48 +0000 (08:12 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Tue, 2 Jun 2009 08:12:48 +0000 (08:12 +0000)
org.glite.lb.client-java/src/org/glite/lb/Context.java
org.glite.lb.client-java/src/org/glite/lb/ContextLL.java
org.glite.lb.client-java/src/org/glite/lb/ProducerTestLL.java
org.glite.lb.client-java/src/org/glite/lb/SSLSend.java

index 1fc4358..dbb531d 100644 (file)
@@ -125,7 +125,7 @@ public abstract class Context {
      * Abstract method which will serve as method for sending messages with events.
      * @param event event for which will be created and send message
      */
-    public abstract void log(Event event);
+    public abstract void log(Event event) throws LBException;
     
     /**
      * Creates message prepared to send
index 357c86c..3eeb4d4 100644 (file)
@@ -55,7 +55,7 @@ public class ContextLL extends Context {
     }
 
     @Override
-    public void log(Event event) {
+    public void log(Event event) throws LBException {
         if (event == null) {
             throw new IllegalArgumentException("ContextLL event");
         }
index d5d600c..afbbd25 100644 (file)
@@ -156,7 +156,11 @@ public class ProducerTestLL {
             /* And now is the context and event prepared to work.
              * 
              */
-            ctx.log(running);
+           try { 
+               ctx.log(running);
+           } catch (LBException e) {
+               e.printStackTrace();
+           }
         }
     }
 }
index b687762..6b56958 100644 (file)
@@ -26,9 +26,11 @@ public class SSLSend {
      */
     public void send(String keyStoreSender, String host,
             int port, int timeout, String message) 
-    throws KeyStoreException,IOException,NoSuchAlgorithmException,KeyManagementException
+       throws LBException
+//    throws KeyStoreException,IOException,NoSuchAlgorithmException,KeyManagementException
     {
 
+      try {
        SSL lbsock = new SSL();
 
        lbsock.setProxy(keyStoreSender);
@@ -54,6 +56,18 @@ public class SSLSend {
        s.print(message + '\n' + '\0');
        s.flush();
        s.close();
+      } 
+      catch (KeyStoreException e) {
+       throw new LBException(e);
+      }
+      catch (IOException e) {
+       throw new LBException(e);
+      }
+      catch (NoSuchAlgorithmException e) {
+       throw new LBException(e);
+      }
+      catch (KeyManagementException e) {
+       throw new LBException(e);
+      }
     }
-
 }