diff --git a/bindings/java/src/jni/javasigar.c b/bindings/java/src/jni/javasigar.c index 4e6d34ad..c5caa4f9 100644 --- a/bindings/java/src/jni/javasigar.c +++ b/bindings/java/src/jni/javasigar.c @@ -1255,7 +1255,7 @@ JNIEXPORT jlong SIGAR_JNI(ptql_SigarProcessQuery_findProcess) sigar_ptql_re_impl_set(sigar, NULL, NULL); if (status < 0) { - sigar_throw_ptql_malformed(env, sigar->errbuf); + sigar_throw_exception(env, sigar->errbuf); } else if (status != SIGAR_OK) { sigar_throw_error(env, jsigar, status); @@ -1288,7 +1288,7 @@ JNIEXPORT jlongArray SIGAR_JNI(ptql_SigarProcessQuery_findProcesses) sigar_ptql_re_impl_set(sigar, NULL, NULL); if (status < 0) { - sigar_throw_ptql_malformed(env, sigar->errbuf); + sigar_throw_exception(env, sigar->errbuf); return NULL; } else if (status != SIGAR_OK) { diff --git a/bindings/java/src/org/hyperic/sigar/ptql/MalformedQueryException.java b/bindings/java/src/org/hyperic/sigar/ptql/MalformedQueryException.java index 4933b2b4..a771f524 100644 --- a/bindings/java/src/org/hyperic/sigar/ptql/MalformedQueryException.java +++ b/bindings/java/src/org/hyperic/sigar/ptql/MalformedQueryException.java @@ -18,11 +18,13 @@ package org.hyperic.sigar.ptql; +import org.hyperic.sigar.SigarException; + /** * Exception for malformed process queries which cannot * be parsed. */ -public class MalformedQueryException extends Exception { +public class MalformedQueryException extends SigarException { public MalformedQueryException() { } diff --git a/bindings/java/src/org/hyperic/sigar/ptql/ProcessFinder.java b/bindings/java/src/org/hyperic/sigar/ptql/ProcessFinder.java index 182f9fd6..9ce76e14 100644 --- a/bindings/java/src/org/hyperic/sigar/ptql/ProcessFinder.java +++ b/bindings/java/src/org/hyperic/sigar/ptql/ProcessFinder.java @@ -39,20 +39,15 @@ public class ProcessFinder { } public long findSingleProcess(String query) - throws SigarException, SigarNotImplementedException { + throws SigarException { - try { - ProcessQuery processQuery = - ProcessQueryFactory.getInstance(query); - return findSingleProcess(processQuery); - } catch (MalformedQueryException e) { - throw new SigarException(e.getMessage()); - } + ProcessQuery processQuery = + ProcessQueryFactory.getInstance(query); + return findSingleProcess(processQuery); } public long findSingleProcess(ProcessQuery query) - throws SigarException, SigarNotImplementedException, - MalformedQueryException { + throws SigarException { if (query instanceof SigarProcessQuery) { return ((SigarProcessQuery)query).findProcess(getSigar()); @@ -75,25 +70,17 @@ public class ProcessFinder { ProcessFinder finder = new ProcessFinder(sigar); - try { - return finder.find(ProcessQueryFactory.getInstance(query)); - } catch (MalformedQueryException e) { - throw new SigarException(e.getMessage()); - } + return finder.find(ProcessQueryFactory.getInstance(query)); } public long[] find(String query) - throws SigarException, SigarNotImplementedException { + throws SigarException { - try { - return find(ProcessQueryFactory.getInstance(query)); - } catch (MalformedQueryException e) { - throw new SigarException(e.getMessage()); - } + return find(ProcessQueryFactory.getInstance(query)); } public long[] find(ProcessQuery query) - throws SigarException, SigarNotImplementedException { + throws SigarException { if (query instanceof SigarProcessQuery) { return ((SigarProcessQuery)query).findProcesses(getSigar()); diff --git a/bindings/java/src/org/hyperic/sigar/ptql/SigarProcessQuery.java b/bindings/java/src/org/hyperic/sigar/ptql/SigarProcessQuery.java index 6b3f4c48..8be64733 100644 --- a/bindings/java/src/org/hyperic/sigar/ptql/SigarProcessQuery.java +++ b/bindings/java/src/org/hyperic/sigar/ptql/SigarProcessQuery.java @@ -47,10 +47,10 @@ public class SigarProcessQuery implements ProcessQuery { } public native long findProcess(Sigar sigar) - throws SigarException, SigarNotImplementedException, MalformedQueryException; + throws SigarException; public native long[] findProcesses(Sigar sigar) - throws SigarException, SigarNotImplementedException; + throws SigarException; static boolean re(String haystack, String needle) { if (haystack == null) {