Package de.lmu.ifi.dbs.elki.utilities.exceptions

Examples of de.lmu.ifi.dbs.elki.utilities.exceptions.APIViolationException


    try {
      runmethod1 = this.getClass().getMethod("run", signature1);
      runmethod2 = null;
    }
    catch(SecurityException e) {
      throw new APIViolationException("Security exception finding an appropriate 'run' method.", e);
    }
    catch(NoSuchMethodException e) {
      runmethod1 = null;
      // Try without "database" parameter.
      try {
        runmethod2 = this.getClass().getMethod("run", signature2);
      }
      catch(NoSuchMethodException e2) {
        runmethod2 = null;
      }
      catch(SecurityException e2) {
        throw new APIViolationException("Security exception finding an appropriate 'run' method.", e2);
      }
    }

    if(runmethod1 != null) {
      try {
        StringBuffer buf = new StringBuffer();
        for(Class<?> cls : signature1) {
          buf.append(cls.toString()).append(",");
        }
        return (R) runmethod1.invoke(this, relations1);
      }
      catch(IllegalArgumentException e) {
        throw new APIViolationException("Invoking the real 'run' method failed.", e);
      }
      catch(IllegalAccessException e) {
        throw new APIViolationException("Invoking the real 'run' method failed.", e);
      }
      catch(InvocationTargetException e) {
        if(e.getTargetException() instanceof RuntimeException) {
          throw (RuntimeException) e.getTargetException();
        }
        throw new APIViolationException("Invoking the real 'run' method failed: " + e.getTargetException().toString(), e.getTargetException());
      }
    }
    else if(runmethod2 != null) {
      try {
        StringBuffer buf = new StringBuffer();
        for(Class<?> cls : signature1) {
          buf.append(cls.toString()).append(",");
        }
        return (R) runmethod2.invoke(this, relations2);
      }
      catch(IllegalArgumentException e) {
        throw new APIViolationException("Invoking the real 'run' method failed.", e);
      }
      catch(IllegalAccessException e) {
        throw new APIViolationException("Invoking the real 'run' method failed.", e);
      }
      catch(InvocationTargetException e) {
        if(e.getTargetException() instanceof RuntimeException) {
          throw (RuntimeException) e.getTargetException();
        }
        throw new APIViolationException("Invoking the real 'run' method failed: " + e.getTargetException().toString(), e.getTargetException());
      }
    }
    else {
      throw new APIViolationException("No appropriate 'run' method found.");
    }
  }
View Full Code Here


    try {
      runmethod1 = this.getClass().getMethod("run", signature1);
      runmethod2 = null;
    }
    catch(SecurityException e) {
      throw new APIViolationException("Security exception finding an appropriate 'run' method.", e);
    }
    catch(NoSuchMethodException e) {
      runmethod1 = null;
      // Try without "database" parameter.
      try {
        runmethod2 = this.getClass().getMethod("run", signature2);
      }
      catch(NoSuchMethodException e2) {
        runmethod2 = null;
      }
      catch(SecurityException e2) {
        throw new APIViolationException("Security exception finding an appropriate 'run' method.", e2);
      }
    }

    if(runmethod1 != null) {
      try {
        StringBuffer buf = new StringBuffer();
        for(Class<?> cls : signature1) {
          buf.append(cls.toString()).append(",");
        }
        return (R) runmethod1.invoke(this, relations1);
      }
      catch(IllegalArgumentException e) {
        throw new APIViolationException("Invoking the real 'run' method failed.", e);
      }
      catch(IllegalAccessException e) {
        throw new APIViolationException("Invoking the real 'run' method failed.", e);
      }
      catch(InvocationTargetException e) {
        if(e.getTargetException() instanceof RuntimeException) {
          throw (RuntimeException) e.getTargetException();
        }
        if(e.getTargetException() instanceof AssertionError) {
          throw (AssertionError) e.getTargetException();
        }
        throw new APIViolationException("Invoking the real 'run' method failed: " + e.getTargetException().toString(), e.getTargetException());
      }
    }
    else if(runmethod2 != null) {
      try {
        StringBuffer buf = new StringBuffer();
        for(Class<?> cls : signature1) {
          buf.append(cls.toString()).append(",");
        }
        return (R) runmethod2.invoke(this, relations2);
      }
      catch(IllegalArgumentException e) {
        throw new APIViolationException("Invoking the real 'run' method failed.", e);
      }
      catch(IllegalAccessException e) {
        throw new APIViolationException("Invoking the real 'run' method failed.", e);
      }
      catch(InvocationTargetException e) {
        if(e.getTargetException() instanceof RuntimeException) {
          throw (RuntimeException) e.getTargetException();
        }
        if(e.getTargetException() instanceof AssertionError) {
          throw (AssertionError) e.getTargetException();
        }
        throw new APIViolationException("Invoking the real 'run' method failed: " + e.getTargetException().toString(), e.getTargetException());
      }
    }
    else {
      throw new APIViolationException("No appropriate 'run' method found.");
    }
  }
View Full Code Here

TOP

Related Classes of de.lmu.ifi.dbs.elki.utilities.exceptions.APIViolationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.