Exemplo n.º 1
0
 /**
  * Whether the antlr version is 2.7.2 (or higher).
  *
  * @return true if the version of Antlr present is 2.7.2 or later.
  * @since Ant 1.6
  */
 protected boolean is272() {
   AntClassLoader l = null;
   try {
     l = getProject().createClassLoader(commandline.getClasspath());
     l.loadClass("antlr.Version");
     return true;
   } catch (ClassNotFoundException e) {
     return false;
   } finally {
     if (l != null) {
       l.cleanup();
     }
   }
 }
Exemplo n.º 2
0
 /**
  * Load named class and test whether it can be rmic'ed
  *
  * @param classname the name of the class to be tested
  * @return true if the class can be rmic'ed
  */
 public boolean isValidRmiRemote(String classname) {
   try {
     Class testClass = loader.loadClass(classname);
     // One cannot RMIC an interface for "classic" RMI (JRMP)
     if (testClass.isInterface() && !iiop && !idl) {
       return false;
     }
     return isValidRmiRemote(testClass);
   } catch (ClassNotFoundException e) {
     log(ERROR_UNABLE_TO_VERIFY_CLASS + classname + ERROR_NOT_FOUND, Project.MSG_WARN);
   } catch (NoClassDefFoundError e) {
     log(ERROR_UNABLE_TO_VERIFY_CLASS + classname + ERROR_NOT_DEFINED, Project.MSG_WARN);
   } catch (Throwable t) {
     log(
         ERROR_UNABLE_TO_VERIFY_CLASS
             + classname
             + ERROR_LOADING_CAUSED_EXCEPTION
             + t.getMessage(),
         Project.MSG_WARN);
   }
   // we only get here if an exception has been thrown
   return false;
 }