Refine search
PlexusConfiguration config = configuration.getChild( parameter.getName(), false ); if ( config != null ) String expression = config.getValue( null ); value = config.getAttribute( "default-value", null ); + configuration.getName() + "'"; throw new ComponentConfigurationException( configuration, msg, e );
throws ComponentConfigurationException if ( configuration.getChildCount() > 0 ) throw new ComponentConfigurationException( "When configuring a basic element the configuration cannot " + "contain any child elements. " + "Configuration element '" + configuration.getName() + "'." ); if ( e.getFailedConfiguration() == null ) e.setFailedConfiguration( configuration );
if ( e.getFailedConfiguration() != null ) message += " for parameter " + e.getFailedConfiguration().getName(); message += ": " + e.getMessage();
private URL[] buildURLs(List<String> runtimeClasspathElements) throws ComponentConfigurationException { // Add the projects classes and dependencies List<URL> urls = new ArrayList<URL>(runtimeClasspathElements.size()); for (String element : runtimeClasspathElements) { try { final URL url = new File(element).toURI().toURL(); urls.add(url); } catch (MalformedURLException e) { throw new ComponentConfigurationException("Unable to access project dependency: " + element, e); } } // Add the plugin's dependencies (so Trove stuff works if Trove isn't on return urls.toArray(new URL[urls.size()]); }
public Object fromConfiguration( ConverterLookup converterLookup, PlexusConfiguration configuration, Class type, Class baseType, ClassLoader classLoader, ExpressionEvaluator expressionEvaluator, ConfigurationListener listener ) throws ComponentConfigurationException { if ( configuration.getChildCount() > 0 ) { throw new ComponentConfigurationException( "When configuring a basic element the configuration cannot " + "contain any child elements. " + "Configuration element '" + configuration.getName() + "'." ); } Object retValue = fromExpression( configuration, expressionEvaluator ); if ( retValue instanceof String ) { try { retValue = Enum.valueOf( type, (String) retValue ); } catch ( RuntimeException e ) { throw new ComponentConfigurationException( "Cannot assign value " + retValue + " to property " + configuration.getName() + " of " + baseType.getName() + ": " + e.getMessage(), e ); } } return retValue; }
protected Object fromExpression( PlexusConfiguration configuration, ExpressionEvaluator expressionEvaluator, Class type ) throws ComponentConfigurationException { Object v = fromExpression( configuration, expressionEvaluator ); if ( v != null ) { if ( !type.isAssignableFrom( v.getClass() ) ) { String msg = "Cannot assign configuration entry '" + configuration.getName() + "' to '" + type + "' from '" + configuration.getValue( null ) + "', which is of type " + v.getClass(); throw new ComponentConfigurationException( configuration, msg ); } } return v; }
private void addEntry( Properties properties, String element, PlexusConfiguration property ) throws ComponentConfigurationException { String name; name = property.getChild( "name" ).getValue( null ); if ( name == null ) { String msg = "Converter: java.util.Properties. Trying to convert the configuration element: '" + element + "', missing child element 'name'."; throw new ComponentConfigurationException( msg ); } String value = property.getChild( "value" ).getValue( "" ); properties.put( name, value ); } }
for ( int i = 0, size = configuration.getChildCount(); i < size; i++ ) final PlexusConfiguration element = configuration.getChild( i ); if ( "property".equals( element.getName() ) && element.getChildCount() > 0 ) final Object name = fromExpression( element.getChild( "name" ), evaluator ); if ( null == e.getFailedConfiguration() ) e.setFailedConfiguration( configuration );
String implementation = configuration.getAttribute( IMPLEMENTATION, null ); + " 'implementation' attribute: '" + implementation + "' cannot be loaded"; throw new ComponentConfigurationException( msg, e ); + " using 'implementation' attribute: '" + implementation + "' cannot be loaded"; throw new ComponentConfigurationException( msg, e ); + " 'implementation' attribute: '" + implementation + "' cannot be loaded"; throw new ComponentConfigurationException( msg, e );
private void addEntry( Properties properties, String element, PlexusConfiguration property, ExpressionEvaluator expressionEvaluator ) throws ComponentConfigurationException { Object name = fromExpression( property.getChild( "name" ), expressionEvaluator ); if ( name == null ) { String msg = "Trying to convert the configuration element: '" + element + "', missing child element 'name' for property."; throw new ComponentConfigurationException( msg ); } Object value = fromExpression( property.getChild( "value" ), expressionEvaluator ); if ( value == null ) { properties.setProperty( name.toString(), "" ); } else { properties.setProperty( name.toString(), value.toString() ); } }
if ( null == e.getFailedConfiguration() ) e.setFailedConfiguration( configuration ); throw new ComponentConfigurationException( configuration, "Cannot store value into array", e );
if ( type == implementation && type.isInterface() && configuration.getChildCount() <= 0 ) if ( e.getFailedConfiguration() == null ) e.setFailedConfiguration( configuration );
reportsDir = mojo.getConfigurationValue("reportsDirectory", File.class); } catch (ComponentConfigurationException e) { e.printStackTrace(listener.fatalError(Messages.SurefireArchiver_NoReportsDir())); build.setResult(Result.FAILURE); return true;
public Object fromConfiguration( ConverterLookup converterLookup, PlexusConfiguration configuration, Class type, Class baseType, ClassLoader classLoader, ExpressionEvaluator expressionEvaluator, ConfigurationListener listener ) throws ComponentConfigurationException { Object retValue = fromExpression( configuration, expressionEvaluator, type ); if ( retValue == null ) { try { // it is a "composite" - we compose it from its children. It does not have a value of its own Class implementation = getClassForImplementationHint( type, configuration, classLoader ); retValue = instantiateObject( implementation ); processConfiguration( converterLookup, retValue, classLoader, configuration, expressionEvaluator, listener ); } catch ( ComponentConfigurationException e ) { if ( e.getFailedConfiguration() == null ) { e.setFailedConfiguration( configuration ); } throw e; } } return retValue; }
public ComponentConfigurationException( final PlexusConfiguration configuration, final String message ) { super( message ); setFailedConfiguration( configuration ); }
private URL[] buildURLs(List<String> runtimeClasspathElements) throws ComponentConfigurationException { // Add the projects classes and dependencies List<URL> urls = new ArrayList<URL>(runtimeClasspathElements.size()); for (String element : runtimeClasspathElements) { try { final URL url = new File(element).toURI().toURL(); urls.add(url); } catch (MalformedURLException e) { throw new ComponentConfigurationException("Unable to access project dependency: " + element, e); } } // Add the plugin's dependencies (so Trove stuff works if Trove isn't on return urls.toArray(new URL[urls.size()]); }
@SuppressWarnings( { "unchecked", "rawtypes" } ) public Object fromConfiguration( final ConverterLookup lookup, final PlexusConfiguration configuration, final Class<?> type, final Class<?> enclosingType, final ClassLoader loader, final ExpressionEvaluator evaluator, final ConfigurationListener listener ) throws ComponentConfigurationException { if ( configuration.getChildCount() > 0 ) { throw new ComponentConfigurationException( "Basic element '" + configuration.getName() + "' must not contain child elements" ); } Object result = fromExpression( configuration, evaluator ); if ( result instanceof String ) { try { result = Enum.valueOf( (Class) type, (String) result ); } catch ( final RuntimeException e ) { throw new ComponentConfigurationException( "Cannot convert '" + result + "' to Enum", e ); } } return result; } }
protected final void failIfNotTypeCompatible( final Object value, final Class<?> type, final PlexusConfiguration configuration ) throws ComponentConfigurationException { if ( null != value && null != type && !type.isInstance( value ) ) { final String reason = String.format( "Cannot assign configuration entry '%s' with value '%s' of type %s to property of type %s", configuration.getName(), configuration.getValue(), value.getClass().getCanonicalName(), type.getCanonicalName() ); throw new ComponentConfigurationException( configuration, reason ); } }
private OptionallyConfigurableMojoComponent configureCompoundComponent(OptionallyConfigurableMojoComponent component, PlexusConfiguration configuration) throws ComponentConfigurationException { PlexusConfiguration name = configuration.getChild(OptionallyConfigurableMojoComponent.ELEMENT_NAME, false); if (name == null || name.getValue() == null) { throw new ComponentConfigurationException(String.format( "Cannot configure component; \"%s\" property must be provided", OptionallyConfigurableMojoComponent.ELEMENT_NAME)); } component.setName(name.getValue()); PlexusConfiguration config = configuration.getChild(OptionallyConfigurableMojoComponent.ELEMENT_CONFIGURATION, false); if (config != null) { component.setConfiguration(generateConfigurationMap(config)); } return component; }
if ( Object.class == elementType || String.class == elementType ) for ( int i = 0, size = configuration.getChildCount(); i < size; i++ ) final PlexusConfiguration element = configuration.getChild( i ); map.put( element.getName(), fromExpression( element, evaluator ) ); if ( null == e.getFailedConfiguration() ) e.setFailedConfiguration( configuration );