public void addFieldError(String fieldName, String errorMessage) { log.error("Validation error for " + fieldName + ":" + errorMessage); }
public void addActionError(String anErrorMessage) { log.error("Validation error: " + anErrorMessage); }
@Override public void error(SAXParseException exception) throws SAXException { LOG.error(exception.getMessage() + " at (" + exception.getPublicId() + ":" + exception.getLineNumber() + ":" + exception.getColumnNumber() + ")", exception); throw exception; }
private void closeQuietly(InputStream is) { try { if (is != null) is.close(); } catch (IOException e) { if (LOG.isErrorEnabled()) LOG.error("Unable to close file input stream", e); } }
private void closeQuietly(InputStream is) { try { if (is != null) is.close(); } catch (IOException e) { if (LOG.isErrorEnabled()) LOG.error("Unable to close input stream", e); } } }
public boolean addResourceStore(final ResourceStore pStore) { try { final int n = stores.length; final ResourceStore[] newStores = new ResourceStore[n + 1]; System.arraycopy(stores, 0, newStores, 1, n); newStores[0] = pStore; stores = newStores; delegate = new ResourceStoreClassLoader(parent, stores); return true; } catch (final RuntimeException e) { LOG.error("Could not add resource store", e); } return false; }
private static List<URL> getURLs(ClassLoaderInterface classLoader, String[] dirNames) { List<URL> urls = new ArrayList<URL>(); for (String dirName : dirNames) { try { Enumeration<URL> classLoaderURLs = classLoader.getResources(dirName); while (classLoaderURLs.hasMoreElements()) { URL url = classLoaderURLs.nextElement(); urls.add(url); } } catch (IOException ioe) { if (LOG.isErrorEnabled()) LOG.error("Could not read driectory [#0]", ioe, dirName); } } return urls; }
protected boolean evaluateExpression(String expression, Object object) throws ValidationException { Object obj = null; try { obj = getFieldValue(expression, object); } catch (ValidationException e) { throw e; } catch (Exception e) { log.error(e.getMessage(), e); // let this pass, but it will be logged right below } Boolean answer = Boolean.FALSE; if (obj != null && obj instanceof Boolean) { answer = (Boolean) obj; } else { log.warn("Got result of " + obj + " when trying to get Boolean for expression " + expression); } return answer; }
public List<Class> findClasses() { classesNotLoaded.clear(); List<Class> classes = new ArrayList<Class>(); for (ClassInfo classInfo : classInfos.values()) { try { classes.add(classInfo.get()); } catch (Throwable e) { if (LOG.isErrorEnabled()) LOG.error("Error loading class [#0]", e, classInfo.getName()); classesNotLoaded.add(classInfo.getName()); } } return classes; }
@Override public boolean end(Writer writer, String body) { if (_value == null) _value = "top"; Object obj = findValue(_value); if (obj instanceof String) { String number = formatPhoneNumber((String) obj); try { writer.write(number); } catch (IOException e) { LOG.error("Could not write out Text tag", e); } } return super.end(writer, ""); }
public List<Class> findClasses(Test<ClassInfo> test) { classesNotLoaded.clear(); List<Class> classes = new ArrayList<Class>(); for (ClassInfo classInfo : classInfos.values()) { try { if (test.test(classInfo)) { classes.add(classInfo.get()); } } catch (Throwable e) { if (LOG.isErrorEnabled()) LOG.error("Error loading class [#0]", e, classInfo.getName()); classesNotLoaded.add(classInfo.getName()); } } return classes; }
@Override public boolean end(Writer writer, String body) { if (_value == null) _value = "top"; Object obj = findValue(_value); if (obj instanceof String) { String number = formatPhoneNumber((String) obj); try { writer.write(number); } catch (IOException e) { LOG.error("Could not write out Text tag", e); } } return super.end(writer, ""); }
public List<Class> findClassesInPackage(String packageName, boolean recursive) { classesNotLoaded.clear(); List<Class> classes = new ArrayList<Class>(); for (ClassInfo classInfo : classInfos.values()) { try { if (recursive && classInfo.getPackageName().startsWith(packageName)){ classes.add(classInfo.get()); } else if (classInfo.getPackageName().equals(packageName)){ classes.add(classInfo.get()); } } catch (Throwable e) { if (LOG.isErrorEnabled()) LOG.error("Error loading class [#0]", e, classInfo.getName()); classesNotLoaded.add(classInfo.getName()); } } return classes; }
@Override public boolean end(Writer writer, String body) { if (_value == null) _value = "top"; Object obj = findValue(_value); if (obj instanceof NameBean) { NameBean name = (NameBean) obj; String value = name.getName(); try { if (value != null) writer.write(value); } catch (IOException e) { LOG.error("Could not write out Text tag", e); } } return super.end(writer, ""); } }
@Override public boolean end(Writer writer, String body) { if (_value == null) _value = "top"; Object obj = findValue(_value); if (obj instanceof RouteBean) { RouteBean route = (RouteBean) obj; String value = RoutePresenter.getDescriptionForRoute(route); try { if( value != null) writer.write(value); } catch (IOException e) { LOG.error("Could not write out Text tag", e); } } return super.end(writer, ""); } }
@Override public boolean end(Writer writer, String body) { if (_value == null) _value = "top"; Object obj = findValue(_value); if (obj instanceof NameBean) { NameBean name = (NameBean) obj; String value = name.getName(); try { if (value != null) writer.write(value); } catch (IOException e) { LOG.error("Could not write out Text tag", e); } } return super.end(writer, ""); } }
@Override public boolean end(Writer writer, String body) { if (_value == null) _value = "top"; Object obj = findValue(_value); if (obj instanceof RouteBean) { RouteBean route = (RouteBean) obj; String value = RoutePresenter.getDescriptionForRoute(route); try { if( value != null) writer.write(value); } catch (IOException e) { LOG.error("Could not write out Text tag", e); } } return super.end(writer, ""); } }
protected void notifyDeveloperParameterException(Object action, String property, String message) { String developerNotification = LocalizedTextUtil.findText(ParametersInterceptor.class, "devmode.notification", ActionContext.getContext().getLocale(), "Developer Notification:\n{0}", new Object[]{ "Unexpected Exception caught setting '" + property + "' on '" + action.getClass() + ": " + message } ); LOG.error(developerNotification); // see https://issues.apache.org/jira/browse/WW-4066 if (action instanceof ValidationAware) { Collection<String> messages = ((ValidationAware) action).getActionMessages(); messages.add(message); ((ValidationAware) action).setActionMessages(messages); } }
/** * Overrides to be able to render body in a template rather than always before the template */ public boolean end(Writer writer, String body) { evaluateParams(); try { addParameter("body", body); mergeTemplate(writer, buildTemplateName(template, getDefaultTemplate())); } catch (Exception e) { LOG.error("error when rendering", e); } finally { popComponentStack(); } return false; }
/** * {@inheritDoc} */ public void prepare() { ActionContext actionContext = ActionContext.getContext(); HttpServletRequest request = (HttpServletRequest) actionContext.get(StrutsStatics.HTTP_REQUEST); ConversationContextManager contextManager = scopeContainer.getComponent(HttpConversationContextManagerProvider.class).getManager(request); try { scopeContainer.getComponent(ConversationProcessor.class).processConversations(new StrutsConversationAdapter(actionContext.getActionInvocation(), contextManager)); Map<String, Map<String, String>> stackItem = new HashMap<String, Map<String, String>>(); stackItem.put(StrutsScopeConstants.CONVERSATION_ID_MAP_STACK_KEY, ConversationAdapter.getAdapter().getViewContext()); actionContext.getValueStack().push(stackItem); } catch (ConversationException e) { LOG.error("Programmatic Conversation error in Prepare method", e); } }