List of usage examples for java.lang InternalError getMessage
public String getMessage()
From source file:net.sf.firemox.xml.XmlTbs.java
/** * Reads from the tbs directory the existing XML files, parse them, add them * to the mdb file in the right order/*from w w w . j a v a 2s . co m*/ * * @param mdbName * the mdb name used to find the directory containing the XML files. * @param out * the outputStream where the cards would written in. * @throws IOException */ @SuppressWarnings("unchecked") public static void updateMdb(String mdbName, OutputStream out) throws IOException { final String incomingDir = IdConst.TBS_DIR + "/" + mdbName + "/recycled"; // Save the first card's code offset final long referenceOffset = ((FileOutputStream) out).getChannel().position(); MToolKit.writeInt24(out, 0); // initialize the card pager cardPager = new ReferencePager(); // list the available cards final String[] cards = MToolKit.getFile(incomingDir).list(FileFilterUtils.andFileFilter( FileFilterUtils.suffixFileFilter("xml"), FileFilterUtils.notFileFilter(FileFilterUtils.suffixFileFilter(IdConst.FILE_DATABASE_SAVED)))); final Pair<String, String>[] sortedPair = new Pair[cards.length]; for (int i = sortedPair.length; i-- > 0;) { sortedPair[i] = new Pair<String, String>(cards[i].toLowerCase(), cards[i]); } Arrays.sort(sortedPair); System.out.println("\t" + sortedPair.length + " founds ..."); for (Pair<String, String> pair : sortedPair) { final File file = MToolKit.getFile(incomingDir + "/" + pair.value); try { referencedAbilities = null; referencedTest = null; referencedActions = null; referencedNonMacroActions = null; writeCard(incomingDir, out, file.getAbsolutePath()); } catch (InternalError e) { XmlConfiguration.error(e.getMessage()); } } // Save the first card's code offset final long curentOffset = ((FileOutputStream) out).getChannel().position(); ((FileOutputStream) out).getChannel().position(referenceOffset); MToolKit.writeInt24(out, (int) curentOffset); ((FileOutputStream) out).getChannel().position(curentOffset); // Write the card references cardPager.write(out); System.out.println("Build completed"); System.out.println("\t" + sortedPair.length + " proceeded card" + (sortedPair.length > 1 ? "s" : "")); System.out.println("\t" + XmlConfiguration.uncompleted + " uncompleted card" + (XmlConfiguration.uncompleted > 1 ? "s" : "")); System.out.println( "\tRate : " + (sortedPair.length - XmlConfiguration.uncompleted) * 100. / sortedPair.length + "%"); }
From source file:com.netscape.admin.certsrv.Console.java
/** * common initialization routine./*from ww w .j a v a2 s.c o m*/ * * @param language language string. For example, "en" for english */ protected static void common_init(String language) { Locale.setDefault(new Locale(language, Locale.getDefault().getCountry())); try { // bug 115085: init calls needs to be inside the try block as, on Unix, during // initialization any call to java.awt.* will cause an exception to be thrown // if Xserver is not accessable. The jvm prints correctly the error message about // unaccessable Xserver but exception stack trace makes it less readable if (_info == null) _info = new ConsoleInfo(); PreferenceManager.setLocalStorageFlag(_preferences.getBoolean(PREFERENCE_LOCAL, false)); if (!_useJavaLookAndFeel) { SuiLookAndFeel nmclf = new SuiLookAndFeel(); UIManager.setLookAndFeel(nmclf); // With JDK1.4 on Unix, the first instance of JFileChooser // has an incorrect layout for some of the buttons. Create // and discard an instance. if (!_isWindows) { new JFileChooser(); } } FontFactory.initializeLFFonts(); // load default customized fonts for login/splash } catch (InternalError ie) { System.err.println("Console: " + ie.getMessage()); System.exit(1); } catch (Exception e) { Debug.println("Console.common_init: Cannot init " + e); } }
From source file:hudson.model.Hudson.java
public Hudson(File root, ServletContext context) throws IOException, InterruptedException { // As hudson is starting, grant this process full controll SecurityContextHolder.getContext().setAuthentication(ACL.SYSTEM); try {//from www .ja v a2 s . c o m this.root = root; this.servletContext = context; computeVersion(context); if (theInstance != null) throw new IllegalStateException("second instance"); theInstance = this; log.load(); Trigger.timer = new Timer("Hudson cron thread"); queue = new Queue(CONSISTENT_HASH ? LoadBalancer.CONSISTENT_HASH : LoadBalancer.DEFAULT); try { dependencyGraph = DependencyGraph.EMPTY; } catch (InternalError e) { if (e.getMessage().contains("window server")) { throw new Error( "Looks like the server runs without X. Please specify -Djava.awt.headless=true as JVM option", e); } throw e; } // get or create the secret TextFile secretFile = new TextFile(new File(Hudson.getInstance().getRootDir(), "secret.key")); if (secretFile.exists()) { secretKey = secretFile.readTrim(); } else { SecureRandom sr = new SecureRandom(); byte[] random = new byte[32]; sr.nextBytes(random); secretKey = Util.toHexString(random); secretFile.write(secretKey); } try { proxy = ProxyConfiguration.load(); } catch (IOException e) { LOGGER.log(Level.SEVERE, "Failed to load proxy configuration", e); } // load plugins. pluginManager = new PluginManager(context); pluginManager.initialize(); // if we are loading old data that doesn't have this field if (slaves == null) slaves = new NodeList(); adjuncts = new AdjunctManager(servletContext, pluginManager.uberClassLoader, "adjuncts/" + VERSION_HASH); load(); // try { // // fill up the cache // load(); // // Controller c = new Controller(); // c.startCPUProfiling(ProfilingModes.CPU_TRACING,""); // "java.*"); // load(); // c.stopCPUProfiling(); // c.captureSnapshot(ProfilingModes.SNAPSHOT_WITHOUT_HEAP); // } catch (Exception e) { // throw new Error(e); // } if (slaveAgentPort != -1) { try { tcpSlaveAgentListener = new TcpSlaveAgentListener(slaveAgentPort); } catch (BindException e) { new AdministrativeError(getClass().getName() + ".tcpBind", "Failed to listen to incoming slave connection", "Failed to listen to incoming slave connection. <a href='configure'>Change the port number</a> to solve the problem.", e); } } else tcpSlaveAgentListener = null; udpBroadcastThread = new UDPBroadcastThread(this); udpBroadcastThread.start(); updateComputerList(); {// master is online now Computer c = toComputer(); if (c != null) for (ComputerListener cl : ComputerListener.all()) cl.onOnline(c, new StreamTaskListener(System.out)); } getQueue().load(); for (ItemListener l : ItemListener.all()) l.onLoaded(); // run the initialization script, if it exists. File initScript = new File(getRootDir(), "init.groovy"); if (initScript.exists()) { LOGGER.info("Executing " + initScript); GroovyShell shell = new GroovyShell(pluginManager.uberClassLoader); try { shell.evaluate(initScript); } catch (Throwable t) { t.printStackTrace(); } } File userContentDir = new File(getRootDir(), "userContent"); if (!userContentDir.exists()) { userContentDir.mkdirs(); FileUtils.writeStringToFile(new File(userContentDir, "readme.txt"), Messages.Hudson_USER_CONTENT_README()); } Trigger.init(); // start running trigger } finally { SecurityContextHolder.clearContext(); } }
From source file:jenkins.model.Jenkins.java
/** * @param pluginManager/*w w w. j a v a2s . c o m*/ * If non-null, use existing plugin manager. create a new one. */ @edu.umd.cs.findbugs.annotations.SuppressWarnings({ "SC_START_IN_CTOR", // bug in FindBugs. It flags UDPBroadcastThread.start() call but that's for another class "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD" // Trigger.timer }) protected Jenkins(File root, ServletContext context, PluginManager pluginManager) throws IOException, InterruptedException, ReactorException { long start = System.currentTimeMillis(); // As Jenkins is starting, grant this process full control ACL.impersonate(ACL.SYSTEM); try { this.root = root; this.servletContext = context; computeVersion(context); if (theInstance != null) throw new IllegalStateException("second instance"); theInstance = this; if (!new File(root, "jobs").exists()) { // if this is a fresh install, use more modern default layout that's consistent with slaves workspaceDir = "${JENKINS_HOME}/workspace/${ITEM_FULLNAME}"; } // doing this early allows InitStrategy to set environment upfront final InitStrategy is = InitStrategy.get(Thread.currentThread().getContextClassLoader()); Trigger.timer = new java.util.Timer("Jenkins cron thread"); queue = new Queue(LoadBalancer.CONSISTENT_HASH); try { dependencyGraph = DependencyGraph.EMPTY; } catch (InternalError e) { if (e.getMessage().contains("window server")) { throw new Error( "Looks like the server runs without X. Please specify -Djava.awt.headless=true as JVM option", e); } throw e; } // get or create the secret TextFile secretFile = new TextFile(new File(getRootDir(), "secret.key")); if (secretFile.exists()) { secretKey = secretFile.readTrim(); } else { SecureRandom sr = new SecureRandom(); byte[] random = new byte[32]; sr.nextBytes(random); secretKey = Util.toHexString(random); secretFile.write(secretKey); // this marker indicates that the secret.key is generated by the version of Jenkins post SECURITY-49. // this indicates that there's no need to rewrite secrets on disk new FileBoolean(new File(root, "secret.key.not-so-secret")).on(); } try { proxy = ProxyConfiguration.load(); } catch (IOException e) { LOGGER.log(SEVERE, "Failed to load proxy configuration", e); } if (pluginManager == null) pluginManager = new LocalPluginManager(this); this.pluginManager = pluginManager; // JSON binding needs to be able to see all the classes from all the plugins WebApp.get(servletContext).setClassLoader(pluginManager.uberClassLoader); adjuncts = new AdjunctManager(servletContext, pluginManager.uberClassLoader, "adjuncts/" + SESSION_HASH, TimeUnit2.DAYS.toMillis(365)); // initialization consists of ... executeReactor(is, pluginManager.initTasks(is), // loading and preparing plugins loadTasks(), // load jobs InitMilestone.ordering() // forced ordering among key milestones ); if (KILL_AFTER_LOAD) System.exit(0); launchTcpSlaveAgentListener(); if (UDPBroadcastThread.PORT != -1) { try { udpBroadcastThread = new UDPBroadcastThread(this); udpBroadcastThread.start(); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to broadcast over UDP (use -Dhudson.udp=-1 to disable)", e); } } dnsMultiCast = new DNSMultiCast(this); Timer.get().scheduleAtFixedRate(new SafeTimerTask() { @Override protected void doRun() throws Exception { trimLabels(); } }, TimeUnit2.MINUTES.toMillis(5), TimeUnit2.MINUTES.toMillis(5), TimeUnit.MILLISECONDS); updateComputerList(); {// master is online now Computer c = toComputer(); if (c != null) for (ComputerListener cl : ComputerListener.all()) cl.onOnline(c, new LogTaskListener(LOGGER, INFO)); } for (ItemListener l : ItemListener.all()) { long itemListenerStart = System.currentTimeMillis(); try { l.onLoaded(); } catch (RuntimeException x) { LOGGER.log(Level.WARNING, null, x); } if (LOG_STARTUP_PERFORMANCE) LOGGER.info(String.format("Took %dms for item listener %s startup", System.currentTimeMillis() - itemListenerStart, l.getClass().getName())); } // All plugins are loaded. Now we can figure out who depends on who. resolveDependantPlugins(); if (LOG_STARTUP_PERFORMANCE) LOGGER.info(String.format("Took %dms for complete Jenkins startup", System.currentTimeMillis() - start)); } finally { SecurityContextHolder.clearContext(); } }
From source file:org.jahia.ajax.gwt.helper.ZipHelper.java
private boolean doUnzipContent(final NoCloseZipInputStream zis, final String dest, JCRSessionWrapper currentUserSession) throws RepositoryException { List<String> errorFiles = new ArrayList<String>(); boolean result = false; try {/*from w ww . j a v a2 s .c o m*/ ZipEntry zipentry; while ((zipentry = zis.getNextEntry()) != null) { String filename = null; try { filename = zipentry.getName().replace('\\', '/'); if (logger.isDebugEnabled()) { logger.debug("Unzip file (" + zipentry.getMethod() + ")" + filename); } if (filename.endsWith("/")) { filename = filename.substring(0, filename.length() - 1); } int endIndex = filename.lastIndexOf('/'); String parentName = dest; if (endIndex > -1) { parentName += "/" + filename.substring(0, endIndex); filename = filename.substring(endIndex + 1); } JCRNodeWrapper target = ensureDir(parentName, currentUserSession); if (zipentry.isDirectory()) { String folderName = JCRContentUtils.escapeLocalNodeName(filename); if (!target.hasNode(folderName)) { try { target.createCollection(folderName); } catch (ItemExistsException e) { // ignore - it is already there } } } else { target.uploadFile(filename, zis, JCRContentUtils.getMimeType(filename)); } result = true; } catch (InternalError err) { logger.error("Error when unzipping file", err); if (filename != null) { errorFiles.add(filename); } } } } catch (IOException e) { logger.error("Error when unzipping file", e); result = false; } catch (InternalError err) { logger.error("Error when unzipping file, " + err.getMessage(), err); result = false; } return result; }
From source file:org.methodize.nntprss.feed.Channel.java
/** * Retrieves the latest RSS doc from the remote site *//*from www .j a v a 2 s. c o m*/ public synchronized void poll() { // Use method-level variable // Guard against change in history mid-poll polling = true; // boolean keepHistory = historical; long keepExpiration = expiration; lastPolled = new Date(); int statusCode = -1; HttpMethod method = null; String urlString = url.toString(); try { HttpClient httpClient = getHttpClient(); channelManager.configureHttpClient(httpClient); HttpResult result = null; try { connected = true; boolean redirected = false; int count = 0; do { URL currentUrl = new URL(urlString); method = new GetMethod(urlString); method.setRequestHeader("User-agent", AppConstants.getUserAgent()); method.setRequestHeader("Accept-Encoding", "gzip"); method.setFollowRedirects(false); method.setDoAuthentication(true); // ETag if (lastETag != null) { method.setRequestHeader("If-None-Match", lastETag); } // Last Modified if (lastModified != 0) { final String NAME = "If-Modified-Since"; //defend against such fun like net.freeroller.rickard got If-Modified-Since "Thu, 24 Aug 2028 12:29:54 GMT" if (lastModified < System.currentTimeMillis()) { final String DATE = httpDate.format(new Date(lastModified)); method.setRequestHeader(NAME, DATE); log.debug("channel " + this.name + " using " + NAME + " " + DATE); //ALEK } } method.setFollowRedirects(false); method.setDoAuthentication(true); HostConfiguration hostConfig = new HostConfiguration(); hostConfig.setHost(currentUrl.getHost(), currentUrl.getPort(), currentUrl.getProtocol()); result = executeHttpRequest(httpClient, hostConfig, method); statusCode = result.getStatusCode(); if (statusCode == HttpStatus.SC_MOVED_PERMANENTLY || statusCode == HttpStatus.SC_MOVED_TEMPORARILY || statusCode == HttpStatus.SC_SEE_OTHER || statusCode == HttpStatus.SC_TEMPORARY_REDIRECT) { redirected = true; // Resolve against current URI - may be a relative URI try { urlString = new java.net.URI(urlString).resolve(result.getLocation()).toString(); } catch (URISyntaxException use) { // Fall back to just using location from result urlString = result.getLocation(); } if (statusCode == HttpStatus.SC_MOVED_PERMANENTLY && channelManager.isObserveHttp301()) { try { url = new URL(urlString); if (log.isInfoEnabled()) { log.info("Channel = " + this.name + ", updated URL from HTTP Permanent Redirect"); } } catch (MalformedURLException mue) { // Ignore URL permanent redirect for now... } } } else { redirected = false; } // method.getResponseBody(); // method.releaseConnection(); count++; } while (count < 5 && redirected); } catch (HttpRecoverableException hre) { if (log.isDebugEnabled()) { log.debug("Channel=" + name + " - Temporary Http Problem - " + hre.getMessage()); } status = STATUS_CONNECTION_TIMEOUT; statusCode = HttpStatus.SC_INTERNAL_SERVER_ERROR; } catch (ConnectException ce) { // @TODO Might also be a connection refused - not only a timeout... if (log.isDebugEnabled()) { log.debug("Channel=" + name + " - Connection Timeout, skipping - " + ce.getMessage()); } status = STATUS_CONNECTION_TIMEOUT; statusCode = HttpStatus.SC_INTERNAL_SERVER_ERROR; } catch (UnknownHostException ue) { if (log.isDebugEnabled()) { log.debug("Channel=" + name + " - Unknown Host Exception, skipping"); } status = STATUS_UNKNOWN_HOST; statusCode = HttpStatus.SC_INTERNAL_SERVER_ERROR; } catch (NoRouteToHostException re) { if (log.isDebugEnabled()) { log.debug("Channel=" + name + " - No Route To Host Exception, skipping"); } status = STATUS_NO_ROUTE_TO_HOST; statusCode = HttpStatus.SC_INTERNAL_SERVER_ERROR; } catch (SocketException se) { // e.g. Network is unreachable if (log.isDebugEnabled()) { log.debug("Channel=" + name + " - Socket Exception, skipping"); } status = STATUS_SOCKET_EXCEPTION; statusCode = HttpStatus.SC_INTERNAL_SERVER_ERROR; } // Only process if ok - if not ok (e.g. not modified), don't do anything if (connected && statusCode == HttpStatus.SC_OK) { PushbackInputStream pbis = new PushbackInputStream(new ByteArrayInputStream(result.getResponse()), PUSHBACK_BUFFER_SIZE); skipBOM(pbis); BufferedInputStream bis = new BufferedInputStream(pbis); DocumentBuilder db = AppConstants.newDocumentBuilder(); try { Document rssDoc = null; if (!parseAtAllCost) { try { rssDoc = db.parse(bis); } catch (InternalError ie) { // Crimson library throws InternalErrors if (log.isDebugEnabled()) { log.debug("InternalError thrown by Crimson", ie); } throw new SAXException("InternalError thrown by Crimson: " + ie.getMessage()); } } else { // Parse-at-all-costs selected // Read in document to local array - may need to parse twice ByteArrayOutputStream bos = new ByteArrayOutputStream(); byte[] buf = new byte[1024]; int bytesRead = bis.read(buf); while (bytesRead > -1) { if (bytesRead > 0) { bos.write(buf, 0, bytesRead); } bytesRead = bis.read(buf); } bos.flush(); bos.close(); byte[] rssDocBytes = bos.toByteArray(); try { // Try the XML document parser first - just in case // the doc is well-formed rssDoc = db.parse(new ByteArrayInputStream(rssDocBytes)); } catch (SAXParseException spe) { if (log.isDebugEnabled()) { log.debug("XML parse failed, trying tidy"); } // Fallback to parse-at-all-costs parser rssDoc = LooseParser.parse(new ByteArrayInputStream(rssDocBytes)); } } processChannelDocument(expiration, rssDoc); // Update last modified / etag from headers // lastETag = httpCon.getHeaderField("ETag"); // lastModified = httpCon.getHeaderFieldDate("Last-Modified", 0); Header hdrETag = method.getResponseHeader("ETag"); lastETag = hdrETag != null ? hdrETag.getValue() : null; Header hdrLastModified = method.getResponseHeader("Last-Modified"); lastModified = hdrLastModified != null ? parseHttpDate(hdrLastModified.getValue()) : 0; log.debug("channel " + this.name + " parsed Last-Modifed " + hdrLastModified + " to " + (lastModified != 0 ? "" + (new Date(lastModified)) : "" + lastModified)); //ALEK status = STATUS_OK; } catch (SAXParseException spe) { if (log.isEnabledFor(Priority.WARN)) { log.warn("Channel=" + name + " - Error parsing RSS document - check feed"); } status = STATUS_INVALID_CONTENT; } bis.close(); // end if response code == HTTP_OK } else if (connected && statusCode == HttpStatus.SC_NOT_MODIFIED) { if (log.isDebugEnabled()) { log.debug("Channel=" + name + " - HTTP_NOT_MODIFIED, skipping"); } status = STATUS_OK; } else if (statusCode == HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED) { if (log.isEnabledFor(Priority.WARN)) { log.warn("Channel=" + name + " - Proxy authentication required"); } status = STATUS_PROXY_AUTHENTICATION_REQUIRED; } else if (statusCode == HttpStatus.SC_UNAUTHORIZED) { if (log.isEnabledFor(Priority.WARN)) { log.warn("Channel=" + name + " - Authentication required"); } status = STATUS_USER_AUTHENTICATION_REQUIRED; } // Update channel in database... channelDAO.updateChannel(this); } catch (FileNotFoundException fnfe) { if (log.isEnabledFor(Priority.WARN)) { log.warn("Channel=" + name + " - File not found returned by web server - check feed"); } status = STATUS_NOT_FOUND; } catch (Exception e) { if (log.isEnabledFor(Priority.WARN)) { log.warn("Channel=" + name + " - Exception while polling channel", e); } } catch (NoClassDefFoundError ncdf) { // Throw if SSL / redirection to HTTPS if (log.isEnabledFor(Priority.WARN)) { log.warn("Channel=" + name + " - NoClassDefFound", ncdf); } } finally { connected = false; polling = false; } }
From source file:org.pentaho.platform.web.http.api.resources.services.FileServiceTest.java
@Test public void testDoCreateDirsNegative() throws Exception { String pathId = "path:to:file:file1.ext"; doReturn("/path/to/file/file1.ext").when(fileService).idToPath(pathId); RepositoryFileDto parentDir = mock(RepositoryFileDto.class); doReturn("").when(parentDir).getPath(); doReturn(FileUtils.PATH_SEPARATOR).when(parentDir).getId(); when(fileService.getRepoWs().getFile(FileUtils.PATH_SEPARATOR)).thenReturn(parentDir); RepositoryFileDto filePath = mock(RepositoryFileDto.class); doReturn("/path").when(filePath).getPath(); doReturn("/path").when(filePath).getId(); RepositoryFileDto fileTo = mock(RepositoryFileDto.class); doReturn("/path/to").when(fileTo).getPath(); doReturn("/path/to").when(fileTo).getId(); RepositoryFileDto fileFile = mock(RepositoryFileDto.class); doReturn("/path/to/file").when(fileFile).getPath(); doReturn("/path/to/file").when(fileFile).getId(); RepositoryFileDto fileFileExt = mock(RepositoryFileDto.class); doReturn("/path/to/file/file1").when(fileFileExt).getPath(); doReturn("/path/to/file/file1").when(fileFileExt).getId(); when(fileService.getRepoWs().getFile("/path")).thenReturn(filePath); when(fileService.getRepoWs().getFile("/path/to")).thenReturn(fileTo); when(fileService.getRepoWs().getFile("/path/to/file")).thenReturn(fileFile); when(fileService.getRepoWs().getFile("/path/to/file/file1.ext")).thenReturn(fileFileExt); assertFalse(fileService.doCreateDir(pathId)); verify(fileService.getRepoWs(), times(0)).createFolder(anyString(), any(RepositoryFileDto.class), anyString());/*from w w w . j a v a 2 s.c om*/ when(fileService.getRepoWs().getFile("/path")).thenReturn(null); when(fileService.getRepoWs().createFolder(eq("/"), any(RepositoryFileDto.class), eq("/path"))) .thenThrow(new InternalError("negativetest")); try { fileService.doCreateDir(pathId); } catch (InternalError e) { assertEquals(e.getMessage(), "negativetest"); } }
From source file:org.rdv.datapanel.AbstractDataPanel.java
/** * Undock the UI component and display fullscreen. * /*from ww w . j a va 2s . com*/ * @since 1.1 */ void maximizePanel() { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] devices = ge.getScreenDevices(); for (int i = 0; i < devices.length; i++) { GraphicsDevice device = devices[i]; if (device.isFullScreenSupported() && device.getFullScreenWindow() == null) { maximized = true; dataPanelContainer.removeDataPanel(component); frame = new JFrame(getTitle()); frame.setUndecorated(true); frame.getContentPane().add(component); try { device.setFullScreenWindow(frame); } catch (InternalError e) { log.error("Failed to switch to full screen mode: " + e.getMessage() + "."); restorePanel(true); return; } frame.setVisible(true); frame.requestFocus(); return; } } log.warn("No screens available or full screen exclusive mode is unsupported on your platform."); }
From source file:zsk.JFCMainClient.java
/** Interfaccia generale pubblica * @param args/*from ww w . j av a 2 s . c om*/ * @param silentMode * @param downloadDir */ public static void fpInit(final String[] args, final boolean silentMode, final String downloadDir) { Runtime.getRuntime().addShutdownHook(new Thread() { public void run() { debugoutput("shutdown hook handler."); if (JFCMainClient.frame == null) { JFCMainClient.shutdownAppl(); } debugoutput("shutdown hook handler. end run()"); } }); try { // load from file config = new XMLConfiguration(szConfigFile); debugoutput("configuration loaded from file: ".concat(config.getBasePath())); // create empty config entries? } catch (ConfigurationException e1) { debugoutput("configuration could not be load from file: ".concat(szConfigFile) .concat(" creating new one.")); config = new XMLConfiguration(); } JFCMainClient.saargs = args; if (args.length > 0) { bIsCLI = true; runCLI(silentMode, downloadDir); } else { try { UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); } catch (UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } catch (IllegalAccessException ex) { ex.printStackTrace(); } catch (InstantiationException ex) { ex.printStackTrace(); } catch (ClassNotFoundException ex) { ex.printStackTrace(); } catch (java.lang.InternalError ie) { System.err.println(ie.getMessage()); printHelp(); System.exit(1); } // try { /*javax.swing.SwingUtilities.invokeAndWait(new Runnable() { });*/ guiThread = new Thread(new Runnable() { public void run() { try { initializeUI(silentMode, downloadDir); while (!guiThread.isInterrupted()) { } } catch (java.awt.HeadlessException he) { System.err.println(he.getMessage()); JFCMainClient.printHelp(); System.exit(1); } } }); guiThread.start(); // } catch (InterruptedException e) { // e.printStackTrace(); // } catch (InvocationTargetException e) { // e.printStackTrace(); // } } // if }