Prints a "FEDORA STARTUP ERROR" to STDERR along with the stacktrace of
the Throwable (if given) and finally, throws a ServletException.
510991
protected void failStartup(String message, Throwable th)
            throws ServletException {
        System.err.println("\n**************************");
        System.err.println("** FEDORA STARTUP ERROR **");
        System.err.println("**************************\n");
        System.err.println(message);
        if (th == null) {
            System.err.println();
            throw new ServletException(message);
        } else {
            th.printStackTrace();
            System.err.println();
            throw new ServletException(message, th);
        }
    }
327627
def _scons_user_error(e):
    
    global print_stacktrace
    etype, value, tb = sys.exc_info()
    if print_stacktrace:
        traceback.print_exception(etype, value, tb)
    filename, lineno, routine, dummy = find_deepest_user_frame(traceback.extract_tb(tb))
    sys.stderr.write("\nscons: *** %s\n" % value)
    sys.stderr.write('File "%s", line %d, in %s\n' % (filename, lineno, routine))
    sys.exit(2)
980810
def _on_process_stderr_ready(self):
        
        try:
            o = self.readAllStandardError()
        except (TypeError, RuntimeError):
            # widget already deleted
            return
        try:
            output = bytes(o).decode(self._encoding)
        except TypeError:
            output = bytes(o.data()).decode(self._encoding)
        for line in output.splitlines():
            self._srv_logger.error(line)
194251
private static String fork(String sjavac, String portfile, String logfile, int poolsize, int keepalive,
            final PrintStream err, String stdouterrfile, String background)
            throws IOException, ProblemException {
        if (stdouterrfile != null && stdouterrfile.trim().equals("")) {
            stdouterrfile = null;
        }
        final String startserver = "--startserver:portfile=" + portfile + ",logfile=" + logfile + ",stdouterrfile=" + stdouterrfile + ",poolsize=" + poolsize + ",keepalive="+ keepalive;

        if (background.equals("true")) {
            sjavac += "%20" + startserver;
            sjavac = sjavac.replaceAll("%20", " ");
            sjavac = sjavac.replaceAll("%2C", ",");
            // If the java/sh/cmd launcher fails the failure will be captured by stdouterr because of the redirection here.
            String[] cmd = {"/bin/sh", "-c", sjavac + " >> " + stdouterrfile + " 2>&1"};
            if (!(new File("/bin/sh")).canExecute()) {
                ArrayList<String> wincmd = new ArrayList<String>();
                wincmd.add("cmd");
                wincmd.add("/c");
                wincmd.add("start");
                wincmd.add("cmd");
                wincmd.add("/c");
                wincmd.add(sjavac + " >> " + stdouterrfile + " 2>&1");
                cmd = wincmd.toArray(new String[wincmd.size()]);
            }
            Process pp = null;
            try {
                pp = Runtime.getRuntime().exec(cmd);
            } catch (Exception e) {
                e.printStackTrace(err);
                e.printStackTrace(new PrintWriter(stdouterrfile));
            }
            StringBuilder rs = new StringBuilder();
            for (String s : cmd) {
                rs.append(s + " ");
            }
            return rs.toString();
        }

        // Do not spawn a background server, instead run it within the same JVM.
        Thread t = new Thread() {
            @Override
            public void run() {
                try {
                    JavacServer.startServer(startserver, err);
                } catch (Throwable t) {
                    t.printStackTrace(err);
                }
            }
        };
        t.start();
        return "";
    }
834834
void sendError( ServletRequest request, ServletResponse response, ServletContext servletContext,
                    int productionTimeErrorCode )
        throws IOException
    {
        InternalUtils.sendDevTimeError( _messageKeyPrefix, getMessageArgs(), null, productionTimeErrorCode,
                                        request, response, servletContext );
    }
1266636
public static void throwServletException(Throwable cause)
            throws ServletException
    {
        ServletException servletException = new ServletException(cause);

        // todo: future cleanup
        // the servlet 2.5 api sets does the equivalent of initCause in its constructor
        // where the servlet 2.4 api does not, so check for the 2.5 behavior before setting initCause
        if (servletException.getCause() == null) {
            servletException.initCause(cause);
        }
        throw servletException;
    }
745774
public void requestFailed (Exception cause)
    {
        Object[] args = _args != null ? ArrayUtil.append(_args, cause) : new Object[] { cause };
        if (_slogger != null) {
            _slogger.warning(_errorText, args);
        } else if (_jlogger != null) {
            _jlogger.log(Level.WARNING, Logger.format(_errorText, args), cause);
        } else {
            System.err.println(Logger.format(_errorText, args));
        }
    }
578241
def print_err(*args, end='\n'):
    
    print(*args, end=end, file=sys.stderr)
    sys.stderr.flush()
364636
protected synchronized void doStart()
        throws Exception
    {
        if (isStarted())
            return;
        
        _contextLog = LogFactory.getLog("org.browsermob.proxy.jetty.jetty.context."+getHttpContext().getHttpContextName());
        
        if (_contextLog==null)
            _contextLog=log;
        
        if (_sessionManager!=null)
            _sessionManager.start();
        
        // Initialize classloader
        _loader=getHttpContext().getClassLoader();

        if (_autoInitializeServlets)
            initializeServlets();
    }
46930
static void showError(Exception e) {
    String stackTrace = org.languagetool.tools.Tools.getFullStackTrace(e);
    String msg = "<html><p style='width: 600px;'>" + StringTools.escapeHTML(stackTrace);
    JOptionPane.showMessageDialog(null, msg, "Error", JOptionPane.ERROR_MESSAGE);
    e.printStackTrace();
  }
844169
@SuppressWarnings("checkstyle:regexp")
	public static void showError(String message, Throwable exception) {
		try (PrintWriter logger = new PrintWriter(getConsoleLogger())) {
			if (message != null && !message.isEmpty()) {
				logger.println(message);
			} else if (exception != null) {
				exception.printStackTrace(logger);
			}
			logger.println();
			logger.flush();
			showHelp(logger, false);
			showVersion(true);
		}
	}
891194
private static void logException(String tag, Throwable t) {
        Log.e(tag, "%s in thread %d", t, threadId());
        t.printStackTrace();
    }
333150
@RequirePOST
    public synchronized void doClearError(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
        getACL().checkPermission(getPermission());

        if(workerThread!=null && !workerThread.isRunning())
            workerThread = null;
        rsp.sendRedirect(".");
    }
427470
@Override
    public void init() throws ServletException {

        String fedoraHome = Constants.FEDORA_HOME;

        if (fedoraHome == null || fedoraHome.length() == 0) {
            throw new ServletException("FEDORA_HOME is not defined");
        } else {
            _serverDir = new File(new File(fedoraHome), "server");
            if (!_serverDir.isDirectory()) {
                throw new ServletException("No such directory: "
                        + _serverDir.getPath());
            }
        }

    }
950779
public void error(Throwable e) {
		out.println(new Date()+" ERROR:" +e.getMessage());
		e.printStackTrace(out);
	}
574459
public void onError( Exception e ) {
        e.printStackTrace();
        String localizedMessage = e.getLocalizedMessage();
        if (localizedMessage == null) {
            localizedMessage = e.getMessage();
        }
        if (localizedMessage == null || localizedMessage.trim().length() == 0) {
            localizedMessage = "An undefined error was thrown. Please send the below trace to your technical contact:\n";
            localizedMessage += ExceptionUtils.getStackTrace(e);
        }

        String _localizedMessage = localizedMessage;
        SwingUtilities.invokeLater(new Runnable(){
            public void run() {
                JOptionPane.showMessageDialog(parent, _localizedMessage, "ERROR", JOptionPane.ERROR_MESSAGE);
            }
        });
    }
30717
public void init() throws Exception {

        // If the status file exists, make sure it doesn't indicate
        // that the server is running!
        if (_statusFile.exists()) {
            ServerStatusMessage[] messages = getAllMessages();
            ServerStatusMessage lastMessage = messages[messages.length - 1];
            if (lastMessage.getState() == ServerState.STARTED) {
                throw new Exception("The server is already running or was shut down unexpectedly.\n"
                        + "If the server has shut down unexpectedly, you must manually delete\n"
                        + "the following file: "
                        + _statusFile.getPath()
                        + "\n"
                        + "then try again.");
            }
        }

        _statusFile.clear();
        _statusFile.append(ServerState.NOT_STARTING,
                           "Waiting for startup to begin");
    }