/** * Generic exception handler. */ public static CoreException handleException(Throwable t) { CoreException ce = coreException(t); Log.error(ce.getStatus()); return ce; }
public static Class<?> forName(String name, ClassLoader cl) { try { return cl.loadClass(name); } catch (ClassNotFoundException ex) { throw RuntimeExceptionWrapper.wrap(ex); } catch (NoClassDefFoundError ex) { Log.debug("Potential problem loading class: {0}", ex, name); throw RuntimeExceptionWrapper.wrap(ex); } catch (UnsupportedClassVersionError e) { Log.error("Can't load the class \"{0}\" compiled using newer version of JDK than current JRE ({1})", e, name, System.getProperty("java.version")); throw RuntimeExceptionWrapper.wrap(e); } catch (Throwable t) { Log.error("Can't load class: " + name, t); throw RuntimeExceptionWrapper.wrap(t); } }
public static Page valueOf(int pageNum) { for (Page page : values()) { if (page.pageNum == pageNum) return page; } Log.warn("There is no pageNum {0}", pageNum); return NO_SUCH_PAGE; }
public static void debug(String pattern, Object... params) { final Logger log = LoggerFactory.getLogger(Log.class); if (!isDebugEnabled()) { return; } String message = format(pattern, params); log.debug(message); }
public boolean revert(long date) { File fileToRevert = getPrev(date); if (fileToRevert != null) { File currentSourceFile = projectModel.getSourceByName(fileToRevert.getName()); try { FileUtils.copyFile(fileToRevert, currentSourceFile); projectModel.reset(ReloadType.FORCED); projectModel.buildProjectTree(); Log.info("Project was reverted successfully"); } catch (Exception e) { Log.error("Can't revert project at " + new SimpleDateFormat().format(new Date(date))); } return true; } return false; }
protected void addFields(CompiledDependency dependency) { CompiledOpenClass compiledOpenClass = dependency.getCompiledOpenClass(); for (IOpenField depField : compiledOpenClass.getOpenClassWithErrors().getFields().values()) { try { if (isDependencyFieldInheritable(depField)) { addField(depField); } } catch (OpenlNotCheckedException e) { if (Log.isDebugEnabled()) { Log.debug(e.getMessage(), e); } addError(e); } } }
static public void debug(String s) { if (DEBUG) { Log.debug(s); System.out.println(s); } }
Log.info("Exclude " + element); continue;
protected void addFields(CompiledDependency dependency) { CompiledOpenClass compiledOpenClass = dependency.getCompiledOpenClass(); for (IOpenField depField : compiledOpenClass.getOpenClassWithErrors().getFields().values()) { try { if (isDependencyFieldInheritable(depField)) { addField(depField); } } catch (OpenlNotCheckedException e) { if (Log.isDebugEnabled()) { Log.debug(e.getMessage(), e); } addError(e); } } }
static public void debug(String s, Throwable t) { if (DEBUG) { Log.debug(s, t); System.out.println(s); System.out.println(t.getMessage()); } }
public static void debug(String pattern, Throwable t, Object... params) { final Logger log = LoggerFactory.getLogger(Log.class); if (!isDebugEnabled()) { return; } String message = format(pattern, params); log.debug(message, t); }
public void sessionDidActivate() { try { userWorkspace.activate(); } catch (ProjectException e) { Log.error("Error at activation", e); } }
protected void addTestSuiteMethodsFromDependencies() { for (CompiledDependency dependency : this.getDependencies()) { for (IOpenMethod depMethod : dependency.getCompiledOpenClass().getOpenClassWithErrors().getMethods()) { if (depMethod instanceof TestSuiteMethod) { TestSuiteMethod testSuiteMethod = (TestSuiteMethod) depMethod; try { // Workaround for set dependency names in method while // compile if (testSuiteMethod.getModuleName() == null) { testSuiteMethod.setModuleName(dependency.getDependencyName()); } TestSuiteMethod newTestSuiteMethod = createNewTestSuiteMethod(testSuiteMethod); addMethod(newTestSuiteMethod); } catch (OpenlNotCheckedException e) { if (Log.isDebugEnabled()) { Log.debug(e.getMessage(), e); } addError(e); } } } } }
public static Class<?> forName(String name, ClassLoader cl) { try { return cl.loadClass(name); } catch (ClassNotFoundException ex) { throw RuntimeExceptionWrapper.wrap(ex); } catch (NoClassDefFoundError ex) { Log.debug("Potential problem loading class: {0}", ex, name); throw RuntimeExceptionWrapper.wrap(ex); } catch (UnsupportedClassVersionError e) { Log.error("Can't load the class \"{0}\" compiled using newer version of JDK than current JRE ({1})", e, name, System.getProperty("java.version")); throw RuntimeExceptionWrapper.wrap(e); } catch (Throwable t) { Log.error("Can't load class: " + name, t); throw RuntimeExceptionWrapper.wrap(t); } }
Properties getProperties() { if (properties != null) { return properties; } // check the propertiesFileProperty first String propertiesFileName = getContext().findProperty(propertiesFileProperty); if (propertiesFileName == null) { propertiesFileName = propertiesFileDefaultName; } // is it valid URL? Log.debug("Looking for " + propertiesFileName); if (!loadAsURL(propertiesFileName) && !loadAsResource(propertiesFileName) && !loadAsFile(propertiesFileName)) { properties = parent == null ? NO_PROPERTIES : parent.getProperties(); } return properties; }
public static Page valueOf(int pageNum) { for (Page page : values()) { if (page.pageNum == pageNum) return page; } Log.warn("There is no pageNum {0}", pageNum); return NO_SUCH_PAGE; }
public static void debug(String pattern, Object... params) { final Logger log = LoggerFactory.getLogger(Log.class); if (!isDebugEnabled()) { return; } String message = format(pattern, params); log.debug(message); }
@Override public void printStackTrace() { Log.error(getMessage(), _t); }
if (Log.isDebugEnabled()) { Log.debug(e.getMessage(), e);