protected String formatObject(IFormComponent field, Locale locale, Object object) { if (!BigDecimal.class.isInstance(object)) throw new ApplicationRuntimeException("BigDecimalTranslator translates values of type BigDecimal, not: " + object.getClass()); return object.toString(); }
/** * Digs down through (potentially) a stack of ApplicationRuntimeExceptions until it reaches the * originating exception, which is returned. */ protected Throwable findNestedException(ApplicationRuntimeException ex) { Throwable cause = ex.getRootCause(); if (cause == null || cause == ex) return ex; if (cause instanceof ApplicationRuntimeException) return findNestedException((ApplicationRuntimeException) cause); return cause; }
throw new ApplicationRuntimeException(e.getMessage(), location, e); throw new ApplicationRuntimeException(ResolverMessages.noSuchComponentType( type, namespace), location, null);
PropertyPersistenceStrategy findStrategy(IComponent component, String propertyName) { // So much for Law of Demeter! IPropertySpecification propertySpecification = component.getSpecification().getPropertySpecification(propertyName); if (propertySpecification == null) { _log.error(RecordMessages.missingPropertySpecification(propertyName, component), null, null); return null; } String name = propertySpecification.getPersistence(); // Should check for nulls, but the architecture of the framework pretty // much // ensures that we won't get here unless there is a property // and a persistence value for the property. try { return _strategySource.getStrategy(name); } catch (ApplicationRuntimeException ex) { _log.error(ex.getMessage(), propertySpecification.getLocation(), ex); return null; } }
private void endSchema() { SchemaImpl schema = (SchemaImpl) peekObject(); schema.setAnnotation(peekContent()); try { schema.validateKeyAttributes(); } catch (ApplicationRuntimeException e) { _errorHandler.error(LOG, ParseMessages.invalidElementKeyAttribute(schema.getId(), e), e .getLocation(), e); } }
throw new ApplicationRuntimeException(e.getMessage(), location, e); throw new ApplicationRuntimeException(ResolverMessages.noSuchComponentType( type, namespace), location, null);
PropertyPersistenceStrategy findStrategy(IComponent component, String propertyName) { // So much for Law of Demeter! IPropertySpecification propertySpecification = component.getSpecification().getPropertySpecification(propertyName); if (propertySpecification == null) { _log.error(RecordMessages.missingPropertySpecification(propertyName, component), null, null); return null; } String name = propertySpecification.getPersistence(); // Should check for nulls, but the architecture of the framework pretty // much // ensures that we won't get here unless there is a property // and a persistence value for the property. try { return _strategySource.getStrategy(name); } catch (ApplicationRuntimeException ex) { _log.error(ex.getMessage(), propertySpecification.getLocation(), ex); return null; } }
/** @since 3.0 * */ public void setPageName(String pageName) { if (_pageName != null) throw new ApplicationRuntimeException(Tapestry .getMessage("AbstractPage.attempt-to-change-name")); _pageName = pageName; }
public PropertyPersistenceStrategy getStrategy(String name) { if (!_strategies.containsKey(name)) throw new ApplicationRuntimeException(RecordMessages .unknownPersistenceStrategy(name)); return (PropertyPersistenceStrategy) _strategies.get(name); }
private ApplicationRuntimeException createBodylessComponentException(IComponent component) { return new ApplicationRuntimeException(ImplMessages.bodylessComponent(), component, null, null); } }
private ApplicationRuntimeException createBodylessComponentException(IComponent component) { return new ApplicationRuntimeException(ImplMessages.bodylessComponent(), component, null, null); } }
private void sendRedirect(String URL) { String finalURL = _servletResponse.encodeRedirectURL(URL); try { _servletResponse.sendRedirect(finalURL); } catch (IOException ex) { throw new ApplicationRuntimeException(WebMessages.unableToRedirect(URL, ex), ex); } }
public IEngine construct() { try { return (IEngine) _engineClass.newInstance(); } catch (Exception ex) { throw new ApplicationRuntimeException(ImplMessages.errorInstantiatingEngine(_engineClass, ex), ex); } } }
private String[] squeeze(Object[] input) { try { return _dataSqueezer.squeeze(input); } catch (Exception ex) { throw new ApplicationRuntimeException(ex); } }
private void validateNamePattern(String methodPattern, String nameSubstring) { if (nameSubstring.indexOf('*') >= 0) throw new ApplicationRuntimeException(MethodMatchMessages .invalidNamePattern(methodPattern)); } }
public void registryDidShutdown() { try { repository.shutDown(); } catch (RepositoryException e) { throw new ApplicationRuntimeException(e); } }
public void setLocale(Locale value) { if (_locale != null) throw new ApplicationRuntimeException(Tapestry .getMessage("AbstractPage.attempt-to-change-locale")); _locale = value; }
/** @since 3.0 * */ public void setPageName(String pageName) { if (_pageName != null) throw new ApplicationRuntimeException(Tapestry .getMessage("AbstractPage.attempt-to-change-name")); _pageName = pageName; }
public void setLocale(Locale value) { if (_locale != null) throw new ApplicationRuntimeException(Tapestry .getMessage("AbstractPage.attempt-to-change-locale")); _locale = value; }
public void setEncodingType(String encodingType) { if (_encodingType != null && !_encodingType.equals(encodingType)) throw new ApplicationRuntimeException(FormMessages.encodingTypeContention(_form, _encodingType, encodingType), _form, null, null); _encodingType = encodingType; }