- avoid unnecesssary exception wrapping
authorAleš Křenek <ljocha@ics.muni.cz>
Tue, 9 Jun 2009 09:57:34 +0000 (09:57 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Tue, 9 Jun 2009 09:57:34 +0000 (09:57 +0000)
- handle Axis fault in example explicitely

org.glite.lb.client-java/Makefile
org.glite.lb.client-java/examples/QueryDemo.java
org.glite.lb.client-java/src/org/glite/lb/Job.java

index b2e1f6c..9a1a9f7 100644 (file)
@@ -17,7 +17,7 @@ examples: ${EXAMPLES}
 
 
 ${EXAMPLES}: %.class: %.java
-       ${jdk_prefix}/bin/javac -cp build/classes/:${stagedir}/share/java/jobid-api-java.jar $<
+       ${jdk_prefix}/bin/javac -cp build/classes/:${stagedir}/share/java/jobid-api-java.jar:`ls ${axis_prefix}/lib/*.jar | tr '\012' :` $<
 
 
 check:
index 07410ae..0c48e84 100644 (file)
@@ -17,7 +17,7 @@ import org.glite.wsdl.types.lb.QueryRecValue;
 import org.glite.wsdl.types.lb.QueryRecord;
 import org.glite.wsdl.types.lb.StatName;
 import org.glite.wsdl.types.lb.Timeval;
-
+import org.apache.axis.AxisFault;
 
 
 /**
@@ -240,7 +240,18 @@ public class QueryDemo {
                     System.out.println(jobStatusToString(statusit.next()));
                 }
             }
-          } catch (Exception e) { e.printStackTrace(); }
+          } catch (Exception e)
+         {
+               Throwable cause = e.getCause();
+
+               if (cause != null && cause instanceof AxisFault) {
+                       cause.printStackTrace();
+               }
+               else {
+                       System.err.println("Oops");
+                       e.printStackTrace();
+               }
+         }
         }
     }
 }
index e33365c..2344adc 100644 (file)
@@ -126,11 +126,7 @@ public class Job {
             throw new IllegalStateException("serverConnection is null, please set it");
         if (jobId == null)
             throw new IllegalStateException("jobId is null, please set it");
-        try {
-            return serverConnection.jobState(jobId.toString(), flags);
-        } catch (LBException ex) {
-            throw new LBException(ex);
-        }
+        return serverConnection.jobState(jobId.toString(), flags);
     }
   
        /**