public static void main(String args[]) throws Exception {
    // cache the initial set of loggers before this test begins
    // to add any loggers
    Enumeration<String> e = logMgr.getLoggerNames();
    List<String> defaultLoggers = getDefaultLoggerNames();
    while (e.hasMoreElements()) {
      String logger = e.nextElement();
      if (!defaultLoggers.contains(logger)) {
        initialLoggerNames.add(logger);
      }
    }
    ;

    String tstSrc = System.getProperty(TST_SRC_PROP);
    File fname = new File(tstSrc, LM_PROP_FNAME);
    String prop = fname.getCanonicalPath();
    System.setProperty(CFG_FILE_PROP, prop);
    logMgr.readConfiguration();

    System.out.println();
    if (checkLoggers() == PASSED) {
      System.out.println(MSG_PASSED);
    } else {
      System.out.println(MSG_FAILED);
      throw new Exception(MSG_FAILED);
    }
  }
  private File findMostLikelyHomeDir(
      List<File> possibleHomeDirList, List<String> homeContentPathList) {
    int numFoundMax = 0;
    File mostLikelyHomeDir = null;
    for (File possibleHomeDir : possibleHomeDirList) {
      trace(String.format("Is [%s] my home directory?", possibleHomeDir));

      int numFound = 0;
      for (String homeContentPath : homeContentPathList) {
        File homeContentFile = new File(possibleHomeDir, homeContentPath);
        if (homeContentFile.exists()) {
          trace(String.format("  [%s] contained? Yes.", homeContentPath));
          numFound++;
        } else {
          trace(String.format("  [%s] contained? No.", homeContentPath));
        }
      }
      if (numFound == 0) {
        trace("No.");
      } else {
        trace(String.format("Maybe. %d related file(s) found.", numFound));
      }
      if (numFound > numFoundMax) {
        try {
          mostLikelyHomeDir = possibleHomeDir.getCanonicalFile();
          numFoundMax = numFound;
        } catch (IOException e) {
          // ???
        }
      }
    }
    return mostLikelyHomeDir;
  }
  private static List<File> createPossibleHomeDirList() {
    List<File> homeDirCheckList = new ArrayList<File>(4);

    // include codeSource dir in check list
    CodeSource lib = OCSSWRuntimeConfig.class.getProtectionDomain().getCodeSource();
    if (lib != null) {
      URL libUrl = lib.getLocation();
      if (libUrl.getProtocol().equals("file")) {
        String libPath = libUrl.getPath();
        File libParentDir = new File(libPath).getParentFile();
        if (libParentDir != null) {
          // include one above libParentDir
          if (libParentDir.getParentFile() != null) {
            homeDirCheckList.add(libParentDir.getParentFile());
          }
          // include libParentDir
          homeDirCheckList.add(libParentDir);
        }
      }
    }
    // include CWD in check list
    homeDirCheckList.add(new File(".").getAbsoluteFile());
    // include one above CWD in check list
    homeDirCheckList.add(new File("src/test").getAbsoluteFile());
    return homeDirCheckList;
  }
Exemple #4
0
    @Override
    public void actionPerformed(ActionEvent e) {
      Frame frame = getFrame();
      JFileChooser chooser = new JFileChooser();
      int ret = chooser.showOpenDialog(frame);

      if (ret != JFileChooser.APPROVE_OPTION) {
        return;
      }

      File f = chooser.getSelectedFile();
      if (f.isFile() && f.canRead()) {
        Document oldDoc = getEditor().getDocument();
        if (oldDoc != null) {
          oldDoc.removeUndoableEditListener(undoHandler);
        }
        if (elementTreePanel != null) {
          elementTreePanel.setEditor(null);
        }
        getEditor().setDocument(new PlainDocument());
        frame.setTitle(f.getName());
        Thread loader = new FileLoader(f, editor.getDocument());
        loader.start();
      } else {
        JOptionPane.showMessageDialog(
            getFrame(),
            "Could not open file: " + f,
            "Error opening file",
            JOptionPane.ERROR_MESSAGE);
      }
    }
  public void reassemble(int totalpieces, int peer_ID, long fileSize, long pieceSize) {
    // System.out.println("%%%%");
    String dir = "peer_" + peer_ID;
    File theDir = new File(dir);
    if (!theDir.exists()) {

      try {
        theDir.mkdir();
      } catch (SecurityException e) {
        System.err.println(e);
      }
    }
    String fileName;
    for (int i = 1; i <= totalpieces - 1; i++) {
      Integer num = new Integer(i);
      byte[] temp = new byte[4];
      int size = 0;
      size = size - 4;
      System.out.println(i + " = " + size);
      byte[] buffer = new byte[size];
    }
    Integer num = new Integer(totalpieces);
    int size = (int) (fileSize % pieceSize);
    System.out.println(size);
    byte[] buffer = new byte[size];
  }
Exemple #6
0
  /**
   * Find mod files in the "mods" folder
   *
   * @param modFolder Folder to search
   * @param modFiles List of mod files to load
   */
  protected void findModFiles(File modFolder, LinkedList<File> modFiles) {
    List<String> supportedVerions = Arrays.asList(SUPPORTED_VERSIONS);

    for (File modFile : modFolder.listFiles(this)) {
      try {
        // Check for a version file
        ZipFile modZip = new ZipFile(modFile);
        ZipEntry version = modZip.getEntry("version.txt");

        if (version != null) {
          // Read the version string
          InputStream versionStream = modZip.getInputStream(version);
          BufferedReader versionReader = new BufferedReader(new InputStreamReader(versionStream));
          String strVersion = versionReader.readLine();
          versionReader.close();

          // Only add the mod if the version matches and we were able to successfully add it to the
          // class path
          if (supportedVerions.contains(strVersion) && addURLToClassPath(modFile.toURI().toURL())) {
            modFiles.add(modFile);
          }
        }

        modZip.close();
      } catch (Exception ex) {
        logger.warning(
            "Error enumerating '"
                + modFile.getAbsolutePath()
                + "': Invalid zip file or error reading file");
      }
    }
  }
Exemple #7
0
 private void LoadQueriesBtnMouseClicked(
     java.awt.event.MouseEvent evt) { // GEN-FIRST:event_LoadQueriesBtnMouseClicked
   // Algorithm
   /*
    * Goto queries' directory and load all queryfile.query to Combobox
    * Change local directory to repository diretory
    * List all file there
    * Try to load all file and add to combobox
    *
    *
    */
   String sQueryRepositoryPath = "/home/natuan/Documents/OntologyMysql/QueriesRepository/";
   File dir = new File(sQueryRepositoryPath);
   String[] children = dir.list();
   if (children == null) {
     // Either dir does not exist or is not a directory
   } else {
     System.out.println("list files");
     for (int i = 0; i < children.length; i++) {
       // Get filename of file or directory
       String filename = children[i];
       String sContent = ReadWholeFileToString(sQueryRepositoryPath + filename);
       queryList.add(sContent);
       QueriesCmb.addItem(filename);
       SparqlTxtArea.setText(sContent);
       //   System.out.println(filename);
     }
     QueriesCmb.setSelectedIndex(children.length - 1);
   }
 } // GEN-LAST:event_LoadQueriesBtnMouseClicked
Exemple #8
0
  public void handleInit(QuickServer quickserver) throws Exception {
    Logger logger = null;
    FileHandler xmlLog = null;
    File log = new File("./log/");
    if (!log.canRead()) log.mkdir();
    try {
      logger = Logger.getLogger("");
      logger.setLevel(Level.FINEST);

      logger = Logger.getLogger("org.quickserver.net.qsadmin");
      xmlLog = new FileHandler("log/FtpServer_QSAdmin%u%g.xml", 1024 * 1024, 20, true);
      xmlLog.setLevel(Level.FINEST);
      logger.addHandler(xmlLog);

      logger = Logger.getLogger("org.quickserver");
      xmlLog = new FileHandler("log/FtpServer_QuickServer%u%g.xml", 1024 * 1024, 20, true);
      xmlLog.setLevel(Level.FINEST);
      logger.addHandler(xmlLog);

      logger = Logger.getLogger("ftpserver");
      xmlLog = new FileHandler("log/FtpServer%u%g.xml", 1024 * 1024, 20, true);
      xmlLog.setLevel(Level.FINEST);
      logger.addHandler(xmlLog);

      quickserver.setAppLogger(logger); // img
    } catch (IOException e) {
      System.err.println("Could not create txtLog FileHandler : " + e);
      throw e;
    }
  }
  public void preprocess(Run run) {
    File logFile = new File(getRunDir(run), "genetik.log");

    try {
      SimpleFileHandler fh = new SimpleFileHandler(logFile);
      fh.setFormatter(new CompactFormatter());

      Logger logger = Logger.getLogger(GenetikConstants.LOGGER);
      logger.setLevel(Level.INFO);
      logger.setUseParentHandlers(false);
      Handler handlers[] = logger.getHandlers();

      logger.addHandler(fh);

      for (Handler h : handlers) {
        logger.removeHandler(h);

        if (h instanceof SimpleFileHandler) h.close(); // close our old one
      }
    } catch (Exception exp) {
      throw new IllegalArgumentException(
          "Unable to create log file at " + logFile.getAbsolutePath());
    }

    super.preprocess(run);
  }
  /**
   * @param sourceFile File to read from
   * @return List of String objects with the shas
   */
  public static FileRequestFileContent readRequestFile(final File sourceFile) {
    if (!sourceFile.isFile() || !(sourceFile.length() > 0)) {
      return null;
    }
    Document d = null;
    try {
      d = XMLTools.parseXmlFile(sourceFile.getPath());
    } catch (final Throwable t) {
      logger.log(Level.SEVERE, "Exception in readRequestFile, during XML parsing", t);
      return null;
    }

    if (d == null) {
      logger.log(Level.SEVERE, "Could'nt parse the request file");
      return null;
    }

    final Element rootNode = d.getDocumentElement();

    if (rootNode.getTagName().equals(TAG_FrostFileRequestFile) == false) {
      logger.severe(
          "Error: xml request file does not contain the root tag '"
              + TAG_FrostFileRequestFile
              + "'");
      return null;
    }

    final String timeStampStr = XMLTools.getChildElementsTextValue(rootNode, TAG_timestamp);
    if (timeStampStr == null) {
      logger.severe("Error: xml file does not contain the tag '" + TAG_timestamp + "'");
      return null;
    }
    final long timestamp = Long.parseLong(timeStampStr);

    final List<Element> nodelist = XMLTools.getChildElementsByTagName(rootNode, TAG_shaList);
    if (nodelist.size() != 1) {
      logger.severe("Error: xml request files must contain only one element '" + TAG_shaList + "'");
      return null;
    }

    final Element rootShaNode = nodelist.get(0);

    final List<String> shaList = new LinkedList<String>();
    final List<Element> xmlKeys = XMLTools.getChildElementsByTagName(rootShaNode, TAG_sha);
    for (final Element el : xmlKeys) {

      final Text txtname = (Text) el.getFirstChild();
      if (txtname == null) {
        continue;
      }

      final String sha = txtname.getData();
      shaList.add(sha);
    }

    final FileRequestFileContent content = new FileRequestFileContent(timestamp, shaList);
    return content;
  }
Exemple #11
0
  /**
   * Find mod classes in the class path and enumerated mod files list
   *
   * @param classPathEntries Java class path split into string entries
   * @return map of classes to load
   */
  private HashMap<String, Class> findModClasses(
      String[] classPathEntries, LinkedList<File> modFiles) {
    // To try to avoid loading the same mod multiple times if it appears in more than one entry in
    // the class path, we index
    // the mods by name and hopefully match only a single instance of a particular mod
    HashMap<String, Class> modsToLoad = new HashMap<String, Class>();

    try {
      logger.info("Searching protection domain code source...");

      File packagePath =
          new File(LiteLoader.class.getProtectionDomain().getCodeSource().getLocation().toURI());
      LinkedList<Class> modClasses =
          getSubclassesFor(packagePath, Minecraft.class.getClassLoader(), LiteMod.class, "LiteMod");

      for (Class mod : modClasses) {
        modsToLoad.put(mod.getSimpleName(), mod);
      }

      if (modClasses.size() > 0)
        logger.info(String.format("Found %s potential matches", modClasses.size()));
    } catch (Throwable th) {
      logger.warning("Error loading from local class path: " + th.getMessage());
    }

    // Search through the class path and find mod classes
    for (String classPathPart : classPathEntries) {
      logger.info(String.format("Searching %s...", classPathPart));

      File packagePath = new File(classPathPart);
      LinkedList<Class> modClasses =
          getSubclassesFor(packagePath, Minecraft.class.getClassLoader(), LiteMod.class, "LiteMod");

      for (Class mod : modClasses) {
        modsToLoad.put(mod.getSimpleName(), mod);
      }

      if (modClasses.size() > 0)
        logger.info(String.format("Found %s potential matches", modClasses.size()));
    }

    // Search through mod files and find mod classes
    for (File modFile : modFiles) {
      logger.info(String.format("Searching %s...", modFile.getAbsolutePath()));

      LinkedList<Class> modClasses =
          getSubclassesFor(modFile, Minecraft.class.getClassLoader(), LiteMod.class, "LiteMod");

      for (Class mod : modClasses) {
        modsToLoad.put(mod.getSimpleName(), mod);
      }

      if (modClasses.size() > 0)
        logger.info(String.format("Found %s potential matches", modClasses.size()));
    }

    return modsToLoad;
  }
 public static void main(final String[] args) {
   final File targetFile = new File("D:\\abc.def");
   final File tmp = new File(targetFile.getPath() + ".frftmp");
   if (!FileAccess.compressFileGZip(targetFile, tmp)) {
     return; // error
   }
   targetFile.delete();
   tmp.renameTo(targetFile);
 }
Exemple #13
0
 public void startFile(String logfile) {
   File parent = new File(logfile).getParentFile();
   if (!parent.isDirectory() && !parent.mkdirs()) {
     logger.warning("Could not create log folder: " + parent);
   }
   Handler fileHandler = new RotatingFileHandler(logfile);
   fileHandler.setFormatter(new DateOutputFormatter(FILE_DATE));
   logger.addHandler(fileHandler);
 }
  public File getRunDir(Run run) {
    String runName = run.getName();
    if (runName == null) throw new IllegalArgumentException("Run doesn't have a name.");

    File runDir = new File(root, runName);

    if (!runDir.exists()) runDir.mkdir();

    return runDir;
  }
 public void saveRunData(Run run, String name, String data) {
   File file = new File(getRunDir(run), name);
   try {
     BufferedWriter writer = new BufferedWriter(new FileWriter(file));
     writer.write(data);
     writer.close();
   } catch (Exception exp) {
     throw new IllegalArgumentException(
         "Error trying to save data to " + file.getAbsolutePath(), exp);
   }
 }
 /**
  * Enqueue a direct GET if not already enqueued, or already downloaded to download dir.
  *
  * @return true if item was enqueued
  */
 public boolean maybeEnqueueDirectGet(
     final FrostDownloadItem dlItem, final long expectedFileSize) {
   if (!isDirectTransferInProgress(dlItem)) {
     final File targetFile = new File(dlItem.getDownloadFilename());
     if (!targetFile.isFile() || targetFile.length() != expectedFileSize) {
       directTransferQueue.appendItemToQueue(dlItem);
       return true;
     }
   }
   return false;
 }
Exemple #17
0
 public boolean compile(String sol) throws ServerException {
   try {
     createSrcFile();
     File f = new File(workDir, srcFileName);
     FileWriter fw = new FileWriter(f);
     fw.write(sol);
     fw.close();
     exec(compileCmd, "", 2, 2048);
     File ef = new File(workDir, executableName);
     return ef.exists();
   } catch (Exception e) {
     throw UtilSrv.se("Can't compile.", e);
   }
 }
Exemple #18
0
    public void actionPerformed(ActionEvent e) {
      Frame frame = getFrame();
      JFileChooser chooser = new JFileChooser();
      int ret = chooser.showSaveDialog(frame);

      if (ret != JFileChooser.APPROVE_OPTION) {
        return;
      }

      File f = chooser.getSelectedFile();
      frame.setTitle(f.getName());
      Thread saver = new FileSaver(f, editor.getDocument());
      saver.start();
    }
Exemple #19
0
 private void maybeInitHomeDir() throws RuntimeConfigException {
   String homeDirPath = getProperty(homeDirKey);
   if (!isNullOrEmptyString(homeDirPath)) {
     // ok set: must be an existing directory
     File homeDir = new File(homeDirPath);
     if (!homeDir.isDirectory()) {
       throw createInvalidPropertyValueException(homeDirKey, homeDirPath);
     }
     try {
       this.homeDirPath = homeDir.getCanonicalPath();
     } catch (IOException e) {
       throw new RuntimeConfigException(e.getMessage(), e);
     }
   }
 }
Exemple #20
0
 public static String[] get_filelist(String path, boolean nodirs, boolean nofiles) {
   File folder = new File(path);
   if (folder.isDirectory()) {
     File[] listOfFiles = folder.listFiles();
     java.util.Vector<String> r = new java.util.Vector<String>();
     for (int i = 0; listOfFiles != null && i < listOfFiles.length; i++) {
       if ((listOfFiles[i].isFile() && !nofiles) || (listOfFiles[i].isDirectory() && !nodirs)) {
         r.add(listOfFiles[i].getName());
       }
     }
     return r.toArray(new String[0]);
   } else {
     return null; // A: no existe o no es directorio
   }
 }
Exemple #21
0
 private void maybeInitConfigFile() throws RuntimeConfigException {
   String configFilePath = getProperty(configFileKey);
   if (!isNullOrEmptyString(configFilePath)) {
     File configFile = new File(configFilePath);
     // ok set: must be an existing file
     if (!configFile.isFile()) {
       throw createInvalidPropertyValueException(configFileKey, configFile.getPath());
     }
     try {
       this.configFilePath = configFile.getCanonicalPath();
     } catch (IOException e) {
       throw new RuntimeConfigException(e.getMessage(), e);
     }
   }
 }
Exemple #22
0
  /** Get the "mods" folder */
  public File getModsFolder() {
    if (modsFolder == null) {
      modsFolder = new File(Minecraft.getMinecraftDir(), "mods");

      if (!modsFolder.exists() || !modsFolder.isDirectory()) {
        try {
          // Attempt to create the "mods" folder if it does not already exist
          modsFolder.mkdirs();
        } catch (Exception ex) {
        }
      }
    }

    return modsFolder;
  }
Exemple #23
0
 private void assumeHomeDir() {
   List<File> possibleHomeDirList = createPossibleHomeDirList();
   List<String> homeContentPathList = createHomeContentPathList();
   // The existance of the files in homeContentPathList is optional.
   // We assume that the home directory is the one in which most files of homeContentPathList are
   // present.
   trace("Auto-detecting home directory...");
   File mostLikelyHomeDir = findMostLikelyHomeDir(possibleHomeDirList, homeContentPathList);
   if (mostLikelyHomeDir != null) {
     homeDirPath = mostLikelyHomeDir.getPath();
   } else {
     homeDirPath = new File(".").getAbsolutePath();
   }
   homeDirAssumed = true;
   setProperty(homeDirKey, homeDirPath);
 }
  public FileBasedGenerationalDriver(File rootFolder) {
    super();

    if (rootFolder == null || !rootFolder.exists())
      throw new IllegalArgumentException("Valid Root folder is required " + rootFolder);
    root = rootFolder;
    mode = JSON_MODE;
  }
Exemple #25
0
  /**
   * Recursive function to enumerate classes inside a classpath folder
   *
   * @param superClass
   * @param classloader
   * @param classes
   * @param packagePath
   * @param packageName
   */
  private static void enumerateDirectory(
      String prefix,
      Class superClass,
      ClassLoader classloader,
      LinkedList<Class> classes,
      File packagePath,
      String packageName) {
    File[] classFiles = packagePath.listFiles();

    for (File classFile : classFiles) {
      if (classFile.isDirectory()) {
        enumerateDirectory(
            prefix,
            superClass,
            classloader,
            classes,
            classFile,
            packageName + classFile.getName() + ".");
      } else {
        if (classFile.getName().endsWith(".class")
            && (prefix == null || classFile.getName().startsWith(prefix))) {
          String classFileName = classFile.getName();
          String className = packageName + classFileName.substring(0, classFileName.length() - 6);
          checkAndAddClass(classloader, superClass, classes, className);
        }
      }
    }
  }
 /** Generate a local password and save it in the local-password file. */
 public void postConstruct() {
   logger.fine("Generating local password");
   SecureRandom random = new SecureRandom();
   byte[] pwd = new byte[PASSWORD_BYTES];
   random.nextBytes(pwd);
   password = toHex(pwd);
   File localPasswordFile = new File(env.getConfigDirPath(), LOCAL_PASSWORD_FILE);
   PrintWriter w = null;
   try {
     if (!localPasswordFile.exists()) {
       localPasswordFile.createNewFile();
       /*
        * XXX - There's a security hole here.
        * Between the time the file is created and the permissions
        * are changed to prevent others from opening it, someone
        * else could open it and wait for the data to be written.
        * Java needs the ability to create a file that's readable
        * only by the owner; coming in JDK 7.
        */
       localPasswordFile.setWritable(false, false); // take from all
       localPasswordFile.setWritable(true, true); // owner only
       localPasswordFile.setReadable(false, false); // take from all
       localPasswordFile.setReadable(true, true); // owner only
     }
     w = new PrintWriter(localPasswordFile);
     w.println(password);
   } catch (IOException ex) {
     // ignore errors
     logger.log(Level.FINE, "Exception writing local password file", ex);
   } finally {
     if (w != null) w.close();
   }
 }
Exemple #27
0
  /**
   * Enumerate classes on the classpath which are subclasses of the specified class
   *
   * @param superClass
   * @return
   */
  private static LinkedList<Class> getSubclassesFor(
      File packagePath, ClassLoader classloader, Class superClass, String prefix) {
    LinkedList<Class> classes = new LinkedList<Class>();

    try {
      if (packagePath.isDirectory()) {
        enumerateDirectory(prefix, superClass, classloader, classes, packagePath);
      } else if (packagePath.isFile()
          && (packagePath.getName().endsWith(".jar")
              || packagePath.getName().endsWith(".zip")
              || packagePath.getName().endsWith(".litemod"))) {
        enumerateCompressedPackage(prefix, superClass, classloader, classes, packagePath);
      }
    } catch (Throwable th) {
      logger.log(Level.WARNING, "Enumeration error", th);
    }

    return classes;
  }
Exemple #28
0
 private void initLibDirs() throws RuntimeConfigException {
   this.libDirPaths = new String[0];
   String libDirPathsString = getProperty(libDirsKey);
   if (libDirPathsString != null) {
     String[] libDirPaths = splitLibDirPaths(libDirPathsString);
     for (String libDirPath : libDirPaths) {
       File libDir = new File(libDirPath);
       if (!libDir.isDirectory()) {
         throw createInvalidPropertyValueException(libDirsKey, libDirPathsString);
       }
     }
     this.libDirPaths = libDirPaths;
   } else {
     // try default
     libDirPathsString = substitute(defaultHomeLibDirPath);
     File libDir = new File(libDirPathsString);
     if (libDir.isDirectory()) {
       this.libDirPaths = new String[] {libDirPathsString};
     }
   }
 }
  /** Save the bundle to a file. Returns false if save was not successful. */
  public boolean saveBundleToFile(final String localeName) {
    try {
      final File externalBundleDir = new File(EXTERNAL_BUNDLE_DIR);
      if (!externalBundleDir.isDirectory()) {
        externalBundleDir.mkdirs();
      }
      final String filename = EXTERNAL_BUNDLE_DIR + "langres_" + localeName + ".properties";
      final PrintWriter out =
          new PrintWriter(
              new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filename), "UTF-8")));

      final TreeMap<String, String> sorter = new TreeMap<String, String>(bundle);

      for (final String string : sorter.keySet()) {
        String key = string;
        String val = getString(key);
        key = key.trim();
        val = val.trim();
        // change newlines in val into \n
        final StringBuilder sbTmp = new StringBuilder();
        for (int x = 0; x < val.length(); x++) {
          final char c = val.charAt(x);
          if (c == '\n') {
            sbTmp.append("\\n");
          } else {
            sbTmp.append(c);
          }
        }
        val = sbTmp.toString();

        out.println(key + "=" + val);
      }

      out.close();
      return true;
    } catch (final Throwable t) {
      logger.log(Level.SEVERE, "Error saving bundle.", t);
      return false;
    }
  }
Exemple #30
0
  /** Enumerate the java class path and "mods" folder to find mod classes, then load the classes */
  private void prepareMods() {
    // List of mod files in the "mods" folder
    LinkedList<File> modFiles = new LinkedList<File>();

    // Find and enumerate the "mods" folder
    File modFolder = getModsFolder();
    if (modFolder.exists() && modFolder.isDirectory()) {
      logger.info("Mods folder found, searching " + modFolder.getPath());
      findModFiles(modFolder, modFiles);
      logger.info("Found " + modFiles.size() + " mod file(s)");
    }

    // Find and enumerate classes on the class path
    HashMap<String, Class> modsToLoad = null;
    try {
      logger.info("Enumerating class path...");

      String classPath = System.getProperty("java.class.path");
      String classPathSeparator = System.getProperty("path.separator");
      String[] classPathEntries = classPath.split(classPathSeparator);

      logger.info(String.format("Class path separator=\"%s\"", classPathSeparator));
      logger.info(
          String.format(
              "Class path entries=(\n   classpathEntry=%s\n)",
              classPath.replace(classPathSeparator, "\n   classpathEntry=")));

      logger.info("Loading mods from class path...");

      modsToLoad = findModClasses(classPathEntries, modFiles);

      logger.info("Mod class discovery completed");
    } catch (Throwable th) {
      logger.log(Level.WARNING, "Mod class discovery failed", th);
      return;
    }

    loadMods(modsToLoad);
  }