public void run() { HarvestController hc; GenericProcessingController gpc; try { if (null == _harvesterController.get()) { // Some sort of internal bug? No idea... _harvesterController.set(new HarvestController()); } if (null == _genericController.get()) { // (ditto, not seen this but better safe than sorry) _genericController.set(new GenericProcessingController()); } List<DocumentPojo> toAdd = new LinkedList<DocumentPojo>(); List<DocumentPojo> toUpdate = new LinkedList<DocumentPojo>(); List<DocumentPojo> toRemove = new LinkedList<DocumentPojo>(); hc = _harvesterController.get(); hc.harvestSource(_sourceToProcess, toAdd, toUpdate, toRemove); // (toAdd includes toUpdate) if (HarvestEnum.error != _sourceToProcess.getHarvestStatus().getHarvest_status()) { gpc = _genericController.get(); gpc.processDocuments( SourceUtils.getHarvestType(_sourceToProcess), toAdd, toUpdate, toRemove, _sourceToProcess); // (toRemove includes toUpdate) SourceUtils.updateHarvestStatus( _sourceToProcess, HarvestEnum.success, toAdd, toRemove.size(), null); // (note also releases the "in_progress" lock) // (note also prunes sources based on "maxDocs") // (also handles the intra-source distribution logic) } // (if we've declared error, then "in_progress" lock already released so nothing to do) } catch (Error e) { // Don't like to catch these, but otherwise we leak away sources _sourceToProcess.setReachedMaxDocs(); // (will try again - this really just ensured // lastDistributedCycleComplete isn't tripped) SourceUtils.updateHarvestStatus( _sourceToProcess, HarvestEnum.error, null, 0, "Source error: " + e.getMessage()); _logger.error("Source error on " + _sourceToProcess.getKey() + ": " + e.getMessage()); e.printStackTrace(); } catch (Exception e) { // Limit any problems to a single source _sourceToProcess.setReachedMaxDocs(); // (will try again - this really just ensured // lastDistributedCycleComplete isn't tripped) SourceUtils.updateHarvestStatus( _sourceToProcess, HarvestEnum.error, null, 0, "Source error: " + e.getMessage()); _logger.error("Source error on " + _sourceToProcess.getKey() + ": " + e.getMessage()); e.printStackTrace(); } }
public static Expr parse(Query query, String s, boolean checkAllUsed) { try { Reader in = new StringReader(s); ARQParser parser = new ARQParser(in); parser.setQuery(query); Expr expr = parser.Expression(); if (checkAllUsed) { Token t = parser.getNextToken(); if (t.kind != ARQParserTokenManager.EOF) throw new QueryParseException( "Extra tokens beginning \"" + t.image + "\" starting line " + t.beginLine + ", column " + t.beginColumn, t.beginLine, t.beginColumn); } return expr; } catch (ParseException ex) { throw new QueryParseException( ex.getMessage(), ex.currentToken.beginLine, ex.currentToken.beginLine); } catch (TokenMgrError tErr) { throw new QueryParseException(tErr.getMessage(), -1, -1); } catch (Error err) { // The token stream can throw java.lang.Error's String tmp = err.getMessage(); if (tmp == null) throw new QueryParseException(err, -1, -1); throw new QueryParseException(tmp, -1, -1); } }
@Override public void runFile(String filename, ScriptRunner runner) throws InternalScriptingException { if (!inContext()) { enterContext(); } File fullPath = new File(_scriptsDirectory, filename); FileReader fr = null; try { fr = new FileReader(fullPath); } catch (FileNotFoundException e) { throw new InternalScriptingException("Could not find file"); } try { setScriptRunner(runner); mcJavascriptContext.evaluateReader(mcJavascriptScope, fr, fullPath.getName(), 0, null); setScriptRunner(null); } catch (IOException e) { throw new InternalScriptingException("Error Running file"); } catch (EcmaError e) { throw new InternalScriptingException(e.getMessage()); } catch (EvaluatorException e) { throw new InternalScriptingException(e.getMessage()); } catch (Error e) { throw new InternalScriptingException(e.getMessage()); } if (!inContext()) { exitContext(); } }
public Event execute( XMLConsumer consumer, ExpressionContext expressionContext, ExecutionContext executionContext, MacroContext macroContext, Event startEvent, Event endEvent) throws SAXException { Iterator iter = getSubstitutions().iterator(); while (iter.hasNext()) { Subst subst = (Subst) iter.next(); char[] chars; if (subst instanceof Literal) { chars = ((Literal) subst).getCharArray(); consumer.characters(chars, 0, chars.length); } else { JXTExpression expr = (JXTExpression) subst; try { Object val = expr.getNode(expressionContext); Invoker.executeNode(consumer, val); } catch (Exception e) { throw new SAXParseException(e.getMessage(), getLocation(), e); } catch (Error err) { throw new SAXParseException(err.getMessage(), getLocation(), new ErrorHolder(err)); } } } return getNext(); }
public static void main(String args[]) throws ParseException { pascal parser = new pascal(System.in); while (true) { System.out.println("Reading from standard input..."); System.out.print( "Enter a define like:| VAR myVar , b : INTEGER; myArray : ARRAY[1..5] OF INTEGER; :"); try { switch (pascal.define()) { case 0: System.out.println("OK."); break; case 1: System.out.println("Goodbye."); break; default: break; } } catch (Exception e) { System.out.println("NOK."); System.out.println(e.getMessage()); pascal.ReInit(System.in); } catch (Error e) { System.out.println("Oops."); System.out.println(e.getMessage()); break; } } }
private static void writeConfigForTable(BufferedWriter writer, Class<?> clazz) throws SQLException, IOException { String tableName = DatabaseTableConfig.extractTableName(clazz); List<DatabaseFieldConfig> fieldConfigs = new ArrayList<DatabaseFieldConfig>(); // walk up the classes finding the fields try { for (Class<?> working = clazz; working != null; working = working.getSuperclass()) { for (Field field : working.getDeclaredFields()) { DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig != null) { fieldConfigs.add(fieldConfig); } } } } catch (Error e) { System.err.println( "Skipping " + clazz + " because we got an error finding its definition: " + e.getMessage()); return; } if (fieldConfigs.isEmpty()) { System.out.println("Skipping " + clazz + " because no annotated fields found"); return; } @SuppressWarnings({"rawtypes", "unchecked"}) DatabaseTableConfig<?> tableConfig = new DatabaseTableConfig(clazz, tableName, fieldConfigs); DatabaseTableConfigLoader.write(writer, tableConfig); writer.append("#################################"); writer.newLine(); System.out.println("Wrote config for " + clazz); }
// All throwable handling. private static void perform(Query query, String string, Action action) { Reader in = new StringReader(string); ARQParser parser = new ARQParser(in); try { query.setStrict(true); parser.setQuery(query); action.exec(parser); } catch (com.hp.hpl.jena.sparql.lang.arq.ParseException ex) { throw new QueryParseException( ex.getMessage(), ex.currentToken.beginLine, ex.currentToken.beginColumn); } catch (com.hp.hpl.jena.sparql.lang.arq.TokenMgrError tErr) { // Last valid token : not the same as token error message - but this should not happen int col = parser.token.endColumn; int line = parser.token.endLine; throw new QueryParseException(tErr.getMessage(), line, col); } catch (QueryException ex) { throw ex; } catch (JenaException ex) { throw new QueryException(ex.getMessage(), ex); } catch (Error err) { // The token stream can throw errors. throw new QueryParseException(err.getMessage(), err, -1, -1); } catch (Throwable th) { Log.warn(ParserSPARQL11.class, "Unexpected throwable: ", th); throw new QueryException(th.getMessage(), th); } }
public static void main(String args[]) throws ParseException { EG1 parser = new EG1(System.in); while (true) { System.out.println("Reading from standard input..."); System.out.print("Enter an expression like \u005c"1+(2+3)*4;\u005c" :"); try { switch (EG1.one_line()) { case 0: System.out.println("OK."); break; case 1: System.out.println("Goodbye."); break; default: break; } } catch (Exception e) { System.out.println("NOK."); System.out.println(e.getMessage()); EG1.ReInit(System.in); } catch (Error e) { System.out.println("Oops."); System.out.println(e.getMessage()); break; } } }
public void evaluate() { try { // clear problems and console messages problemsView.setText(""); consoleView.setText(""); // update status view statusView.setText(" Parsing ..."); tabbedPane.setSelectedIndex(0); LispExpr root = Parser.parse(textView.getText()); statusView.setText(" Running ..."); tabbedPane.setSelectedIndex(1); // update run button runButton.setIcon(stopImage); runButton.setActionCommand("Stop"); // start run thread runThread = new RunThread(root); runThread.start(); } catch (SyntaxError e) { tabbedPane.setSelectedIndex(0); System.err.println( "Syntax Error at " + e.getLine() + ", " + e.getColumn() + " : " + e.getMessage()); } catch (Error e) { // parsing error System.err.println(e.getMessage()); statusView.setText(" Errors."); } }
protected static void onMissingClass(Error err, EventInfo<?> e) { EventProxy.error = "Missing Event Handler Class!"; EventProxy.errorDetails = new StringBuilder(); EventProxy.addCrashDetailLine("\n"); EventProxy.addCrashDetailLine( "You are seeing this message because an event callback was injected by the Event"); EventProxy.addCrashDetailLine( "Injection Subsystem but the specified callback class was not defined! The"); EventProxy.addCrashDetailLine("details of the missing callback are as follows:"); EventProxy.addDetailLineBreak(); EventProxy.addCrashDetailLine(" Event Name: " + e.getName()); EventProxy.addCrashDetailLine(" Cancellable: " + e.isCancellable()); EventProxy.addDetailLineBreak(); EventProxy.addCrashDetailLine(" Callback class: " + err.getMessage().replace('/', '.')); EventProxy.addDetailLineBreak(); EventProxy.addCrashDetailLine( "If you are the mod author then in order to fix the error you must provide an"); EventProxy.addCrashDetailLine( "implementation for the specified class, or check that the class name and package"); EventProxy.addCrashDetailLine("are correct."); EventProxy.addDetailLineBreak(); EventProxy.addCrashDetailLine( "This is an unrecoverable error, please report it to the mod author and remove"); EventProxy.addCrashDetailLine("the offending mod."); EventProxy.addStackTrace(err); throw new RuntimeErrorException( err, "Missing event handler class for event " + e.getName() + ", see crash report for details"); }
public void testExceptionHandling() { final ComponentAdapter componentAdapter = new ThreadLocalizing.ThreadLocalized( new ConstructorInjection.ConstructorInjector( TargetInvocationExceptionTester.class, ThrowingComponent.class, null)); final TargetInvocationExceptionTester tester = (TargetInvocationExceptionTester) componentAdapter.getComponentInstance(null, ComponentAdapter.NOTHING.class); try { tester.throwsCheckedException(); fail("ClassNotFoundException expected"); } catch (final ClassNotFoundException e) { assertEquals("junit", e.getMessage()); } try { tester.throwsRuntimeException(); fail("RuntimeException expected"); } catch (final RuntimeException e) { assertEquals("junit", e.getMessage()); } try { tester.throwsError(); fail("Error expected"); } catch (final Error e) { assertEquals("junit", e.getMessage()); } }
@Override public Object runFunction(ScriptRunner runner, IFunction func, Object... args) throws InternalScriptingException { Object ret = null; try { enterContext(); setScriptRunner(runner); if (func instanceof JSFunction) { ((JSFunction) func) .getFunction() .call(mcJavascriptContext, mcJavascriptScope, mcJavascriptScope, args); } else { throw new InternalScriptingException("Invalid Function"); } setScriptRunner(null); } catch (EcmaError e) { throw new InternalScriptingException(e.getMessage()); } catch (EvaluatorException e) { throw new InternalScriptingException(e.getMessage()); } catch (Error e) { throw new InternalScriptingException(e.getMessage()); } finally { exitContext(); } return ret; }
public String errorsToString() { if (errors == null || errors.size() == 0) return ""; String errorString = "\nNotes:\n"; for (Error e : errors) { errorString += e.getMessage() + "\n"; } return errorString + "\n\n"; }
public static void checkError(Error error) { // Check required fields assertNotNull(error.getMessage(), String.format(NOT_NULL_OBJECT_FMT, "Message", "Error")); assertNotNull( error.getMajorErrorCode(), String.format(NOT_NULL_OBJECT_FMT, "MajorErrorCode", "Error")); assertNotNull( error.getMinorErrorCode(), String.format(NOT_NULL_OBJECT_FMT, "MinorErrorCode", "Error")); // NOTE vendorSpecificErrorCode cannot be checked // NOTE stackTrace cannot be checked }
@Test public void testShouldThrowAnErrorIfCallingLoadDoesNotCauseTheComponentToLoad() { LoadsOk ok = new LoadsOk(false); try { ok.get(); fail(); } catch (Error e) { assertEquals("Expected failure", e.getMessage()); } }
@Override public UIViewRoot createView(FacesContext context, String viewId) { UIViewRoot root = null; try { root = super.createView(context, viewId); } catch (RuntimeException e) { if (AjaxUtil.isAjaxRequest(context)) { // If exception was caught during our ajax request then we need to process it // and send ajax response with details about exception. CommonAjaxViewRoot.processExceptionDuringAjax(context, e); Log.log(context, e.getMessage(), e); } else { // We need to rethrow exception. throw new RuntimeException(e); } } catch (Error e) { if (AjaxUtil.isAjaxRequest(context)) { // If exception was caught during our ajax request then we need to process it // and send ajax response with details about exception. CommonAjaxViewRoot.processExceptionDuringAjax(context, e); Log.log(context, e.getMessage(), e); } else { // We need to rethrow exception. throw new Error(e); } } // If created instance of UIViewRoot does not implement our interface WrappedAjaxRoot // then we need to wrap it with our AjaxViewRoot UIViewRoot riRoot; if (null == root || root instanceof WrappedAjaxRoot) { riRoot = root; } else { riRoot = getAjaxViewRoot(root, context); } ExternalContext externalContext = context.getExternalContext(); Map<String, String> requestParameterMap = externalContext.getRequestParameterMap(); Map<String, Object> requestMap = externalContext.getRequestMap(); if (requestParameterMap.containsKey("of_sessionExpiration") && requestParameterMap.containsKey(AjaxUtil.AJAX_REQUEST_MARKER)) { if (!requestMap.containsKey(SESSION_EXPIRATION_PROCESSING)) { requestMap.put(SESSION_EXPIRATION_PROCESSING, Boolean.TRUE); String actionURL = getActionURL(context, viewId); actionURL = externalContext.encodeActionURL(actionURL); requestMap.put(LOCATION_HEADER, actionURL); } } return riRoot; }
@Test @DataFrom("blankString_false") public void testMatches_False(String input) { StringBlankMatcher matcher = new StringBlankMatcher(); try { MatcherAssert.assertThat(input, matcher); } catch (Error e) { String message = e.getMessage(); want.string(message) .contains("expected is empty string, but actual", StringMode.IgnoreSpace); } }
public Map<String, Construct> evaluate(BindableEvent e) throws EventException { Map<String, Construct> retn = new HashMap<String, Construct>(); if (e instanceof Error) { Error msg = (Error) e; retn.put("id", new CString(msg.getBot().getID(), Target.UNKNOWN)); retn.put("message", new CString(msg.getMessage(), Target.UNKNOWN)); } return retn; }
public void run() { try { while (runThread == this) { interpreter.evaluate(program); break; } } catch (Error e) { tabbedPane.setSelectedIndex(0); System.err.println("Runtime Error: " + e.getMessage()); } // notify GUI that program execution finished runFinished(); }
public void testUnparsable() throws Exception { String str; str = ""; try { DataObjectFactory.createStatus(str); fail("should fail"); } catch (TwitterException expected) { } catch (Error notExpected) { fail("failed" + notExpected.getMessage()); } try { DataObjectFactory.createStatus(str); fail("should fail"); } catch (TwitterException expected) { } catch (Error notExpected) { fail("failed" + notExpected.getMessage()); } str = "{\"in_reply_to_status_id_str\":null,\"place\":null,\"in_reply_to_user_id\":null,\"text\":\"working\",\"contributors\":null,\"retweet_count\":0,\"in_reply_to_user_id_str\":null,\"retweeted\":false,\"id_str\":\"794626207\",\"source\":\"\\u003Ca href=\\\"http:\\/\\/twitterhelp.blogspot.com\\/2008\\/05\\/twitter-via-mobile-web-mtwittercom.html\\\" rel=\\\"nofollow\\\"\\u003Emobile web\\u003C\\/a\\u003E\",\"truncated\":false,\"geo\":null,\"in_reply_to_status_id\":null,\"favorited\":false,\"user\":{\"show_all_inline_media\":false,\"geo_enabled\":false,\"profile_background_tile\":false,\"time_zone\":null,\"favourites_count\":0,\"description\":null,\"friends_count\":0,\"profile_link_color\":\"0084B4\",\"location\":null,\"profile_sidebar_border_color\":\"C0DEED\",\"id_str\":\"14481043\",\"url\":null,\"follow_request_sent\":false,\"statuses_count\":1,\"profile_use_background_image\":true,\"lang\":\"en\",\"profile_background_color\":\"C0DEED\",\"profile_image_url\":\"http:\\/\\/a3.twimg.com\\/a\\/1292975674\\/images\\/default_profile_3_normal.png\",\"profile_background_image_url\":\"http:\\/\\/a3.twimg.com\\/a\\/1292975674\\/images\\/themes\\/theme1\\/bg.png\",\"followers_count\":44,\"protected\":false,\"contributors_enabled\":false,\"notifications\":false,\"screen_name\":\"Yusuke\",\"name\":\"Yusuke\",\"is_translator\":false,\"listed_count\":1,\"following\":false,\"verified\":false,\"profile_text_color\":\"333333\",\"id\":14481043,\"utc_offset\":null,\"created_at\":\"Tue Apr 22 21:49:13 +0000 2008\",\"profile_sidebar_fill_color\":\"DDEEF6\"},\"id\":794626207,\"coordinates\":null,\"in_reply_to_screen_name\":null,\"created_at\":\"Tue Apr 2200 21:49:34 +0000 2008\""; try { DataObjectFactory.createCategory(str); fail("should fail"); } catch (TwitterException expected) { expected.printStackTrace(); } catch (Error notExpected) { fail("failed" + notExpected.getMessage()); } try { DataObjectFactory.createCategory(str); fail("should fail"); } catch (TwitterException expected) { } catch (Error notExpected) { fail("failed" + notExpected.getMessage()); } }
public void prettyPrint() { try { // clear old problem messages problemsView.setText(""); // update status view statusView.setText(" Parsing ..."); LispExpr root = Parser.parse(textView.getText()); statusView.setText(" Pretty Printing ..."); String newText = PrettyPrinter.prettyPrint(root); textView.setText(newText); statusView.setText(" Done."); } catch (Error e) { System.err.println(e.getMessage()); statusView.setText(" Errors."); } }
private static void executeTransaction(Realm realm, Realm.Transaction transaction) { if (transaction == null) return; realm.beginTransaction(); try { transaction.execute(realm); realm.commitTransaction(); } catch (RuntimeException e) { realm.cancelTransaction(); Log.e(LOG_TAG, e.getMessage(), e); throw new RealmException("Error during transaction.", e); } catch (Error e) { realm.cancelTransaction(); Log.e(LOG_TAG, e.getMessage(), e); throw e; } }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try { final String S_ProcName = "startElement"; assert qName.equals("Tenant"); CFSecuritySaxLoader saxLoader = (CFSecuritySaxLoader) getParser(); if (saxLoader == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFSecuritySchemaObj schemaObj = saxLoader.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } CFLibXmlCoreContext curContext = getParser().getCurContext(); ICFSecurityTenantObj useTenant = saxLoader.getUseTenant(); if (useTenant == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "saxLoader.useTenant"); } curContext.putNamedValue("Object", useTenant); } catch (RuntimeException e) { throw new RuntimeException( "Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } catch (Error e) { throw new Error( "Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } }
@Test public void testRunWithError() throws Exception { job = new JobSupport() { @Override public void execute(JobExecution execution) { execution.setExitStatus(ExitStatus.FAILED); throw new Error("foo"); } }; try { run(ExitStatus.FAILED); fail("Expected Error"); } catch (Error e) { assertEquals("foo", e.getMessage()); } }
@Test public void testErrorWrapper() { try { throw new RuntimeExceptionWrapper(new Error("msg")); } catch (RuntimeException e) { try { ExceptionUnwrapper.unwrap(e); fail(); } catch (Error ee) { assertTrue(ee instanceof Error); assertEquals("msg", ee.getMessage()); } Throwable t = ExceptionUnwrapper.unwrapAny(e); assertTrue(t instanceof Error); assertEquals("msg", t.getMessage()); } }
public void reportQueuedErrors() { // Report unique errors in order of their sequence Error[] errorList = errorSet.toArray(new Error[errorSet.size()]); Arrays.sort( errorList, new Comparator<Error>() { public int compare(Error o1, Error o2) { return o1.getSequence() - o2.getSequence(); } }); for (Error error : errorList) { reportAnalysisError(new AnalysisError(error.getMessage(), error.getCause())); } for (String aMissingClassMessageList : missingClassMessageList) { reportMissingClass(aMissingClassMessageList); } }
protected static void onMissingHandler(Error err, EventInfo<?> e) { String descriptor = err.getMessage(); int dotPos = descriptor.lastIndexOf('.'); int bracketPos = descriptor.indexOf('('); String signature = descriptor.substring(bracketPos); String sourceClass = e.getSource() != null ? e.getSource().getClass().getSimpleName() : "?"; EventProxy.error = "Missing Event Handler Method!"; EventProxy.errorDetails = new StringBuilder(); EventProxy.addCrashDetailLine("\n"); EventProxy.addCrashDetailLine( "You are seeing this message because an event callback was injected by the Event"); EventProxy.addCrashDetailLine( "Injection Subsystem but the specified callback method was not defined. The"); EventProxy.addCrashDetailLine("details of the missing callback are as follows:"); EventProxy.addDetailLineBreak(); EventProxy.addCrashDetailLine(" Event Name: " + e.getName()); EventProxy.addCrashDetailLine(" Cancellable: " + e.isCancellable()); EventProxy.addDetailLineBreak(); EventProxy.addCrashDetailLine(" Callback class: " + descriptor.substring(0, dotPos)); EventProxy.addCrashDetailLine( " Callback method: " + descriptor.substring(dotPos + 1, bracketPos)); EventProxy.addDetailLineBreak(); EventProxy.addCrashDetailLine( "If you are the mod author then in order to fix the error you must add a suitable"); EventProxy.addCrashDetailLine( "callback method in the above class. The method signature should be as follows:"); EventProxy.addDetailLineBreak(); EventProxy.addCrashDetailLine( EventProxy.generateHandlerTemplate( descriptor.substring(dotPos + 1, bracketPos), signature, sourceClass)); EventProxy.addDetailLineBreak(); EventProxy.addCrashDetailLine( "This is an unrecoverable error, please report it to the mod author and remove"); EventProxy.addCrashDetailLine("the offending mod."); EventProxy.addStackTrace(err); throw new RuntimeErrorException( err, "Missing event handler method for event " + e.getName() + ", see crash report for details"); }
private void seriousError(Error err) { // try to prevent timeslicing until we have a chance to deal with OOM // Note that modern-day JVM priority indifference with native threads // may make this priority-jumbling pointless setPriority(DEFAULT_PRIORITY + 1); if (controller != null) { // hold all ToeThreads from proceeding to next processor controller.freeReserveMemory(); controller.requestCrawlPause(); if (controller.getFrontier().getFrontierJournal() != null) { controller.getFrontier().getFrontierJournal().seriousError(getName() + err.getMessage()); } } // OutOfMemory etc. String extraInfo = DevUtils.extraInfo(); System.err.println("<<<"); System.err.println(ArchiveUtils.getLog17Date()); System.err.println(err); System.err.println(extraInfo); err.printStackTrace(System.err); if (controller != null) { PrintWriter pw = new PrintWriter(System.err); controller.getToePool().compactReportTo(pw); pw.flush(); } System.err.println(">>>"); // DevUtils.sigquitSelf(); String context = "unknown"; if (currentCuri != null) { // update fetch-status, saving original as annotation currentCuri.getAnnotations().add("err=" + err.getClass().getName()); currentCuri.getAnnotations().add("os" + currentCuri.getFetchStatus()); currentCuri.setFetchStatus(S_SERIOUS_ERROR); context = currentCuri.shortReportLine() + " in " + currentProcessorName; } String message = "Serious error occured trying " + "to process '" + context + "'\n" + extraInfo; logger.log(Level.SEVERE, message.toString(), err); setPriority(DEFAULT_PRIORITY); }
/** Invoked whenever we should be polled */ public void run() { // avoid this thread to throw exceptions because the thread pool wont re-schedule a new thread try { // log starting if (LoggingLevel.ERROR == runLoggingLevel) { LOG.error("Scheduled task started on: {}", this.getEndpoint()); } else if (LoggingLevel.WARN == runLoggingLevel) { LOG.warn("Scheduled task started on: {}", this.getEndpoint()); } else if (LoggingLevel.INFO == runLoggingLevel) { LOG.info("Scheduled task started on: {}", this.getEndpoint()); } else if (LoggingLevel.DEBUG == runLoggingLevel) { LOG.debug("Scheduled task started on: {}", this.getEndpoint()); } else { LOG.trace("Scheduled task started on: {}", this.getEndpoint()); } // execute scheduled task doRun(); // log completed if (LoggingLevel.ERROR == runLoggingLevel) { LOG.error("Scheduled task completed on: {}", this.getEndpoint()); } else if (LoggingLevel.WARN == runLoggingLevel) { LOG.warn("Scheduled task completed on: {}", this.getEndpoint()); } else if (LoggingLevel.INFO == runLoggingLevel) { LOG.info("Scheduled task completed on: {}", this.getEndpoint()); } else if (LoggingLevel.DEBUG == runLoggingLevel) { LOG.debug("Scheduled task completed on: {}", this.getEndpoint()); } else { LOG.trace("Scheduled task completed on: {}", this.getEndpoint()); } } catch (Error e) { // must catch Error, to ensure the task is re-scheduled LOG.error( "Error occurred during running scheduled task on: " + this.getEndpoint() + ", due: " + e.getMessage(), e); } }
private Digester2 getDigester() { Digester2 digester; try { digester = new Digester2(); return digester; } catch (Error e) { LOGGER.log(Level.FINER, "Failed to get Digest2 error: " + e.getMessage(), e); dumpClassLoader("getDigester()"); // Switch out the context class loader because in some configurations, the // LogFactory class used by Log used by the Digester can't be loaded. ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader()); digester = new Digester2(); return digester; } finally { Thread.currentThread().setContextClassLoader(classLoader); } } }