The following document contains the results of PMD's CPD 5.2.3.
File | Line |
---|---|
org/jomc/mojo/JomcContainerDescriptorHandler.java | 880 |
org/jomc/mojo/JomcResourceTransformer.java | 903 |
this.modletMarshaller.marshal( element, file ); } private <T> JAXBElement<T> transformModletObject( final JAXBElement<? extends ModletObject> element, final Class<T> boundType ) throws ModelException, TransformerException, JAXBException, IOException, URISyntaxException, InstantiationException { if ( element == null ) { throw new NullPointerException( "element" ); } if ( !boundType.isInstance( element.getValue() ) ) { throw new IllegalArgumentException( element.toString() ); } @SuppressWarnings( "unchecked" ) JAXBElement<T> transformed = (JAXBElement<T>) element; if ( this.modletObjectStylesheet != null ) { final Transformer transformer = TransformerFactory.newInstance().newTransformer( new StreamSource( this.getResource( this.modletObjectStylesheet ).toURI().toASCIIString() ) ); final ModelContext modletContext = this.createModelContext(); final Marshaller marshaller = modletContext.createMarshaller( ModletObject.MODEL_PUBLIC_ID ); final Unmarshaller unmarshaller = modletContext.createUnmarshaller( ModletObject.MODEL_PUBLIC_ID ); final JAXBSource source = new JAXBSource( marshaller, element ); final JAXBResult result = new JAXBResult( unmarshaller ); for ( final Map.Entry<Object, Object> e : System.getProperties().entrySet() ) { transformer.setParameter( e.getKey().toString(), e.getValue() ); } transformer.transform( source, result ); if ( result.getResult() instanceof JAXBElement<?> && boundType.isInstance( ( (JAXBElement<?>) result.getResult() ).getValue() ) ) { @SuppressWarnings( "unchecked" ) final JAXBElement<T> e = (JAXBElement<T>) result.getResult(); transformed = e; } else { throw new ModelException( Messages.getMessage( "illegalModletTransformationResult", this.modletObjectStylesheet ) ); } } return transformed; } private static String normalizeResourceName( final String name ) { String normalized = name; if ( normalized != null ) { normalized = normalized.replace( '\\', '/' ); if ( normalized.startsWith( "/" ) ) { normalized = normalized.substring( 1 ); } if ( normalized.endsWith( "/" ) ) { normalized = normalized.substring( 0, normalized.length() ); } } return normalized; } private ModelContext createModelContext() throws ModelException, InstantiationException { final ModelContextFactory modelContextFactory; if ( this.modelContextFactoryClassName != null ) { modelContextFactory = ModelContextFactory.newInstance( this.modelContextFactoryClassName ); } else { modelContextFactory = ModelContextFactory.newInstance(); } final ModelContext modelContext = modelContextFactory.newModelContext(); modelContext.setModletSchemaSystemId( this.modletSchemaSystemId ); if ( this.providerLocation != null ) { modelContext.setAttribute( DefaultModelContext.PROVIDER_LOCATION_ATTRIBUTE_NAME, this.providerLocation ); } if ( this.platformProviderLocation != null ) { modelContext.setAttribute( DefaultModelContext.PLATFORM_PROVIDER_LOCATION_ATTRIBUTE_NAME, this.platformProviderLocation ); } if ( this.modletLocation != null ) { modelContext.setAttribute( DefaultModletProvider.MODLET_LOCATION_ATTRIBUTE_NAME, this.modletLocation ); } if ( this.modelContextAttributes != null ) { for ( final ModelContextAttribute e : this.modelContextAttributes ) { final Object object = e.getObject( modelContext ); if ( object != null ) { modelContext.setAttribute( e.getKey(), object ); } else { modelContext.clearAttribute( e.getKey() ); } } } return modelContext; } } |
File | Line |
---|---|
org/jomc/mojo/AbstractJomcMojo.java | 2571 |
org/jomc/mojo/AbstractJomcMojo.java | 2713 |
final URL url = this.getResource( propertiesResourceType.getLocation() ); final Properties properties = new Properties(); try { if ( url != null ) { if ( this.isLoggable( Level.FINER ) ) { this.log( Level.FINER, Messages.getMessage( "loadingProperties", url.toExternalForm() ), null ); } final URLConnection con = url.openConnection(); con.setConnectTimeout( propertiesResourceType.getConnectTimeout() ); con.setReadTimeout( propertiesResourceType.getReadTimeout() ); con.connect(); in = con.getInputStream(); if ( PropertiesResourceType.PLAIN_FORMAT.equalsIgnoreCase( propertiesResourceType.getFormat() ) ) { properties.load( in ); } else if ( PropertiesResourceType.XML_FORMAT.equalsIgnoreCase( propertiesResourceType.getFormat() ) ) { properties.loadFromXML( in ); } } else if ( propertiesResourceType.isOptional() ) { if ( this.isLoggable( Level.WARNING ) ) { this.log( Level.WARNING, Messages.getMessage( "propertiesNotFound", propertiesResourceType.getLocation() ), null ); } } else { throw new MojoExecutionException( Messages.getMessage( "propertiesNotFound", propertiesResourceType.getLocation() ) ); } suppressExceptionOnClose = false; } catch ( final SocketTimeoutException e ) { String m = Messages.getMessage( e ); m = m == null ? "" : " " + m; if ( propertiesResourceType.isOptional() ) { if ( this.isLoggable( Level.WARNING ) ) { this.log( Level.WARNING, Messages.getMessage( "failedLoadingProperties", url.toExternalForm(), m ), e ); } } else { throw new MojoExecutionException( Messages.getMessage( "failedLoadingProperties", url.toExternalForm(), m ), e ); } } catch ( final IOException e ) { String m = Messages.getMessage( e ); m = m == null ? "" : " " + m; if ( propertiesResourceType.isOptional() ) { if ( this.isLoggable( Level.WARNING ) ) { this.log( Level.WARNING, Messages.getMessage( "failedLoadingProperties", url.toExternalForm(), m ), e ); } } else { throw new MojoExecutionException( Messages.getMessage( "failedLoadingProperties", url.toExternalForm(), m ), e ); } } finally { try { if ( in != null ) { in.close(); } } catch ( final IOException e ) { if ( suppressExceptionOnClose ) { this.getLog().error( e ); } else { throw new MojoExecutionException( Messages.getMessage( e ), e ); } } } return properties; } /** * Creates a new {@code Properties} instance from a {@code PropertiesResourceType}. * * @param modelContext The model context to search. * @param propertiesResourceType The {@code PropertiesResourceType} specifying the properties to create. * * @return The properties for {@code propertiesResourceType}. * * @throws NullPointerException if {@code modelContext} or {@code propertiesResourceType} is {@code null}. * @throws MojoExecutionException if loading properties fails. * * @see #getResource(org.jomc.modlet.ModelContext, java.lang.String) * @since 1.8 */ protected Properties getProperties( final ModelContext modelContext, |
File | Line |
---|---|
org/jomc/mojo/AbstractJomcMojo.java | 2160 |
org/jomc/mojo/AbstractJomcMojo.java | 2428 |
transformer.setParameter( e.getKey(), e.getObject() ); } for ( final TransformationOutputProperty e : resource.getTransformationOutputProperties() ) { transformer.setOutputProperty( e.getKey(), e.getValue() ); } suppressExceptionOnClose = false; return transformer; } else if ( resource.isOptional() ) { if ( this.isLoggable( Level.WARNING ) ) { this.log( Level.WARNING, Messages.getMessage( "transformerNotFound", resource.getLocation() ), null ); } } else { throw new MojoExecutionException( Messages.getMessage( "transformerNotFound", resource.getLocation() ) ); } } catch ( final InstantiationException e ) { throw new MojoExecutionException( Messages.getMessage( e ), e ); } catch ( final URISyntaxException e ) { throw new MojoExecutionException( Messages.getMessage( e ), e ); } catch ( final TransformerConfigurationException e ) { String m = Messages.getMessage( e ); if ( m == null ) { m = Messages.getMessage( e.getException() ); } m = m == null ? "" : " " + m; throw new MojoExecutionException( Messages.getMessage( "failedCreatingTransformer", resource.getLocation(), m ), e ); } catch ( final SocketTimeoutException e ) { String m = Messages.getMessage( e ); m = m == null ? "" : " " + m; if ( resource.isOptional() ) { if ( this.isLoggable( Level.WARNING ) ) { this.log( Level.WARNING, Messages.getMessage( "failedLoadingTransformer", url.toExternalForm(), m ), e ); } } else { throw new MojoExecutionException( Messages.getMessage( "failedLoadingTransformer", url.toExternalForm(), m ), e ); } } catch ( final IOException e ) { String m = Messages.getMessage( e ); m = m == null ? "" : " " + m; if ( resource.isOptional() ) { if ( this.isLoggable( Level.WARNING ) ) { this.log( Level.WARNING, Messages.getMessage( "failedLoadingTransformer", url.toExternalForm(), m ), e ); } } else { throw new MojoExecutionException( Messages.getMessage( "failedLoadingTransformer", url.toExternalForm(), m ), e ); } } finally { try { if ( in != null ) { in.close(); } } catch ( final IOException e ) { if ( suppressExceptionOnClose ) { this.getLog().error( e ); } else { throw new MojoExecutionException( Messages.getMessage( e ), e ); } } } return null; } |
File | Line |
---|---|
org/jomc/mojo/AbstractJomcMojo.java | 2037 |
org/jomc/mojo/AbstractJomcMojo.java | 2305 |
final URL url = this.getResource( resource.getLocation() ); final ErrorListener errorListener = new ErrorListener() { public void warning( final TransformerException exception ) throws TransformerException { try { log( Level.WARNING, Messages.getMessage( exception ), exception ); } catch ( final MojoExecutionException e ) { getLog().warn( exception ); getLog().error( e ); } } public void error( final TransformerException exception ) throws TransformerException { try { log( Level.SEVERE, Messages.getMessage( exception ), exception ); } catch ( final MojoExecutionException e ) { getLog().error( exception ); getLog().error( e ); } throw exception; } public void fatalError( final TransformerException exception ) throws TransformerException { try { log( Level.SEVERE, Messages.getMessage( exception ), exception ); } catch ( final MojoExecutionException e ) { getLog().error( exception ); getLog().error( e ); } throw exception; } }; try { if ( url != null ) { if ( this.isLoggable( Level.FINER ) ) { this.log( Level.FINER, Messages.getMessage( "loadingTransformer", url.toExternalForm() ), null ); } final URLConnection con = url.openConnection(); con.setConnectTimeout( resource.getConnectTimeout() ); con.setReadTimeout( resource.getReadTimeout() ); con.connect(); in = con.getInputStream(); final TransformerFactory transformerFactory = TransformerFactory.newInstance(); transformerFactory.setErrorListener( errorListener ); final Transformer transformer = transformerFactory.newTransformer( new StreamSource( in, url.toURI().toASCIIString() ) ); transformer.setErrorListener( errorListener ); for ( final Map.Entry<Object, Object> e : System.getProperties().entrySet() ) { transformer.setParameter( e.getKey().toString(), e.getValue() ); } if ( this.getMavenProject().getProperties() != null ) { for ( final Map.Entry<Object, Object> e : this.getMavenProject().getProperties().entrySet() ) { transformer.setParameter( e.getKey().toString(), e.getValue() ); } } if ( this.transformationParameterResources != null ) { for ( int i = 0, s0 = this.transformationParameterResources.size(); i < s0; i++ ) { for ( final Map.Entry<Object, Object> e : this.getProperties( |
File | Line |
---|---|
org/jomc/mojo/JomcContainerDescriptorHandler.java | 784 |
org/jomc/mojo/JomcResourceTransformer.java | 807 |
this.jomcMarshaller.marshal( element, file ); } private <T> JAXBElement<T> transformModelObject( final JAXBElement<? extends ModelObject> element, final Class<T> boundType ) throws ModelException, TransformerException, JAXBException, IOException, URISyntaxException, InstantiationException { if ( element == null ) { throw new NullPointerException( "element" ); } if ( !boundType.isInstance( element.getValue() ) ) { throw new IllegalArgumentException( element.toString() ); } @SuppressWarnings( "unchecked" ) JAXBElement<T> transformed = (JAXBElement<T>) element; if ( this.modelObjectStylesheet != null ) { final Transformer transformer = TransformerFactory.newInstance().newTransformer( new StreamSource( this.getResource( this.modelObjectStylesheet ).toURI().toASCIIString() ) ); final ModelContext modelContext = this.createModelContext(); final Marshaller marshaller = modelContext.createMarshaller( this.model ); final Unmarshaller unmarshaller = modelContext.createUnmarshaller( this.model ); final JAXBSource source = new JAXBSource( marshaller, element ); final JAXBResult result = new JAXBResult( unmarshaller ); for ( final Map.Entry<Object, Object> e : System.getProperties().entrySet() ) { transformer.setParameter( e.getKey().toString(), e.getValue() ); } transformer.transform( source, result ); if ( result.getResult() instanceof JAXBElement<?> && boundType.isInstance( ( (JAXBElement<?>) result.getResult() ).getValue() ) ) { @SuppressWarnings( "unchecked" ) final JAXBElement<T> e = (JAXBElement<T>) result.getResult(); transformed = e; } else { throw new ModelException( Messages.getMessage( "illegalModuleTransformationResult", this.modelObjectStylesheet ) ); } } return transformed; } private Object unmarshalModletObject( final InputStream in ) throws ModelException, JAXBException, InstantiationException { if ( in == null ) { throw new NullPointerException( "in" ); } if ( this.modletUnmarshaller == null ) { this.modletUnmarshaller = this.createModelContext().createUnmarshaller( ModletObject.MODEL_PUBLIC_ID ); } return this.modletUnmarshaller.unmarshal( in ); } private void marshalModletObject( final JAXBElement<? extends ModletObject> element, final File file ) |
File | Line |
---|---|
org/jomc/mojo/JomcContainerDescriptorHandler.java | 407 |
org/jomc/mojo/JomcResourceTransformer.java | 562 |
archiver.addFile( moduleFile, normalizeResourceName( this.moduleResource ) ); } if ( !this.modlets.getModlet().isEmpty() ) { if ( this.modletIncludes != null ) { for ( final Iterator<Modlet> it = this.modlets.getModlet().iterator(); it.hasNext(); ) { final Modlet m = it.next(); if ( !this.modletIncludes.contains( m.getName() ) ) { it.remove(); if ( this.getLogger() != null && this.getLogger().isInfoEnabled() ) { this.getLogger().info( LOG_PREFIX + Messages.getMessage( "excludingModlet", m.getName() ) ); } } } } if ( this.modletExcludes != null ) { for ( final String exclude : this.modletExcludes ) { final Modlet excluded = this.modlets.getModlet( exclude ); if ( excluded != null ) { this.modlets.getModlet().remove( excluded ); if ( this.getLogger() != null && this.getLogger().isInfoEnabled() ) { this.getLogger().info( LOG_PREFIX + Messages.getMessage( "excludingModlet", excluded.getName() ) ); } } } } if ( this.getLogger() != null && this.getLogger().isInfoEnabled() ) { for ( final Modlet m : this.modlets.getModlet() ) { this.getLogger().info( LOG_PREFIX + Messages.getMessage( "includingModlet", m.getName() ) ); } } final Modlet mergedModlet = this.modlets.getMergedModlet( this.modletName, this.model ); mergedModlet.setVendor( this.modletVendor ); mergedModlet.setVersion( this.modletVersion ); final JAXBElement<Modlet> transformedModlet = this.transformModletObject( new org.jomc.modlet.ObjectFactory().createModlet( mergedModlet ), Modlet.class ); |
File | Line |
---|---|
org/jomc/mojo/JomcContainerDescriptorHandler.java | 345 |
org/jomc/mojo/JomcResourceTransformer.java | 504 |
if ( !this.modules.getModule().isEmpty() ) { if ( this.moduleIncludes != null ) { for ( final Iterator<Module> it = this.modules.getModule().iterator(); it.hasNext(); ) { final Module m = it.next(); if ( !this.moduleIncludes.contains( m.getName() ) ) { it.remove(); if ( this.getLogger() != null && this.getLogger().isInfoEnabled() ) { this.getLogger().info( LOG_PREFIX + Messages.getMessage( "excludingModule", m.getName() ) ); } } } } if ( this.moduleExcludes != null ) { for ( final String exclude : this.moduleExcludes ) { final Module excluded = this.modules.getModule( exclude ); if ( excluded != null ) { this.modules.getModule().remove( excluded ); if ( this.getLogger() != null && this.getLogger().isInfoEnabled() ) { this.getLogger().info( LOG_PREFIX + Messages.getMessage( "excludingModule", excluded.getName() ) ); } } } } if ( this.getLogger() != null && this.getLogger().isInfoEnabled() ) { for ( final Module m : this.modules.getModule() ) { this.getLogger().info( LOG_PREFIX + Messages.getMessage( "includingModule", m.getName() ) ); } } final Module mergedModule = this.modules.getMergedModule( this.moduleName ); mergedModule.setVersion( this.moduleVersion ); mergedModule.setVendor( this.moduleVendor ); final JAXBElement<Module> transformedModule = this.transformModelObject( new org.jomc.model.ObjectFactory().createModule( mergedModule ), Module.class ); |
File | Line |
---|---|
org/jomc/mojo/JomcContainerDescriptorHandler.java | 661 |
org/jomc/mojo/JomcResourceTransformer.java | 682 |
} } /** * Creates an {@code URL} for a given resource location. * <p> * This method first searches the class loader of the class for a single resource matching {@code location}. If * such a resource is found, the URL of that resource is returned. If no such resource is found, an attempt is made * to parse the given location to an URL. On successful parsing, that URL is returned. Failing that, the given * location is interpreted as a file name. If that file is found, the URL of that file is returned. Otherwise an * {@code IOException} is thrown. * </p> * * @param location The location to create an {@code URL} from. * * @return An {@code URL} for {@code location}. * * @throws NullPointerException if {@code location} is {@code null}. * @throws IOException if creating an URL fails. */ protected URL getResource( final String location ) throws IOException { if ( location == null ) { throw new NullPointerException( "location" ); } try { String absolute = location; if ( !absolute.startsWith( "/" ) ) { absolute = "/" + location; } URL resource = this.getClass().getResource( absolute ); if ( resource == null ) { try { resource = new URL( location ); } catch ( final MalformedURLException e ) { if ( this.getLogger() != null && this.getLogger().isDebugEnabled() ) { this.getLogger().debug( Messages.getMessage( e ), e ); } resource = null; } } if ( resource == null ) { final File f = new File( location ); if ( f.isFile() ) { resource = f.toURI().toURL(); } } if ( resource == null ) { throw new IOException( Messages.getMessage( "resourceNotFound", location ) ); } return resource; } catch ( final MalformedURLException e ) { String m = Messages.getMessage( e ); m = m == null ? "" : " " + m; // JDK: As of JDK 6, "new IOException( message, cause )". throw (IOException) new IOException( Messages.getMessage( "malformedLocation", location, m ) ).initCause( e ); } } private Object unmarshalModelObject( final InputStream in ) throws ModelException, JAXBException, InstantiationException { if ( in == null ) { throw new NullPointerException( "in" ); } if ( this.jomcUnmarshaller == null ) { this.jomcUnmarshaller = this.createModelContext().createUnmarshaller( this.model ); } return this.jomcUnmarshaller.unmarshal( in ); } private void marshalModelObject( final JAXBElement<? extends ModelObject> element, final File file ) |
File | Line |
---|---|
org/jomc/mojo/AbstractJomcMojo.java | 1209 |
org/jomc/mojo/AbstractJomcMojo.java | 1257 |
for ( final Iterator<?> it = compileArtifacts.iterator(); it.hasNext(); ) { final Artifact a = (Artifact) it.next(); final Artifact pluginArtifact = this.getPluginArtifact( a ); if ( a.getFile() == null ) { if ( this.isLoggable( Level.WARNING ) ) { this.log( Level.WARNING, Messages.getMessage( "ignoringArtifact", a.toString() ), null ); } continue; } if ( pluginArtifact != null ) { if ( this.isLoggable( Level.FINER ) ) { this.log( Level.FINER, Messages.getMessage( "ignoringPluginArtifact", a.toString(), pluginArtifact.toString() ), null ); } continue; } final String element = a.getFile().getAbsolutePath(); elements.add( element ); } return elements; } /** * Gets the project's test class path elements. * * @return A set of class path element strings. * * @throws MojoExecutionException if getting the class path elements fails. */ protected Set<String> getTestClasspathElements() throws MojoExecutionException |
File | Line |
---|---|
org/jomc/mojo/AbstractJomcMojo.java | 1178 |
org/jomc/mojo/AbstractJomcMojo.java | 1209 |
org/jomc/mojo/AbstractJomcMojo.java | 1257 |
for ( final Iterator<?> it = runtimeArtifacts.iterator(); it.hasNext(); ) { final Artifact a = (Artifact) it.next(); final Artifact pluginArtifact = this.getPluginArtifact( a ); if ( a.getFile() == null ) { if ( this.isLoggable( Level.WARNING ) ) { this.log( Level.WARNING, Messages.getMessage( "ignoringArtifact", a.toString() ), null ); } continue; } if ( pluginArtifact != null ) { if ( this.isLoggable( Level.FINER ) ) { this.log( Level.FINER, Messages.getMessage( "ignoringPluginArtifact", a.toString(), pluginArtifact.toString() ), null ); } continue; } final String element = a.getFile().getAbsolutePath(); elements.add( element ); } |
File | Line |
---|---|
org/jomc/mojo/JomcContainerDescriptorHandler.java | 143 |
org/jomc/mojo/JomcResourceTransformer.java | 152 |
private static final String LOG_PREFIX = "[JOMC] "; /** * The identifier of the model to process. */ private String model = ModelObject.MODEL_PUBLIC_ID; /** * The encoding of the assembled module. */ private String moduleEncoding; /** * The name of the assembled module. */ private String moduleName; /** * The version of the assembled module. */ private String moduleVersion; /** * The vendor of the assembled module. */ private String moduleVendor; /** * The resource name of the assembled module. */ private String moduleResource = DefaultModelProvider.getDefaultModuleLocation(); /** * Names of resources to process. */ private String[] moduleResources = { DefaultModelProvider.getDefaultModuleLocation() }; /** * Included modules. */ private List<String> moduleIncludes; /** * Excluded modules. */ private List<String> moduleExcludes; /** * The encoding of the assembled modlet. */ private String modletEncoding; /** * The name of the assembled modlet. */ private String modletName; /** * The version of the assembled modlet. */ private String modletVersion; /** * The vendor of the assembled modlet. */ private String modletVendor; /** * The resource name of the assembled modlet resources. */ private String modletResource = DefaultModletProvider.getDefaultModletLocation(); /** * Names of modlet resources to process. */ private String[] modletResources = { DefaultModletProvider.getDefaultModletLocation() }; /** * Included modlets. */ private List<String> modletIncludes; /** * Excluded modlets. */ private List<String> modletExcludes; /** * Location of a XSLT document to use for transforming the merged model document. */ private String modelObjectStylesheet; /** * Location of a XSLT document to use for transforming the merged modlet document. */ private String modletObjectStylesheet; /** * The location to search for providers. */ private String providerLocation; /** * The location to search for platform providers. */ private String platformProviderLocation; /** * The system id of the modlet schema. */ private String modletSchemaSystemId; /** * The location to search for modlets. */ private String modletLocation; /** * Name of the {@code ModelContextFactory} implementation class. */ private String modelContextFactoryClassName; /** * {@code ModelContext} attributes to apply. */ private List<ModelContextAttribute> modelContextAttributes; /** * Modlet resources. */ private Modlets modlets = new Modlets(); /** * Model resources. */ private Modules modules = new Modules(); /** * The JOMC JAXB marshaller of the instance. */ private Marshaller jomcMarshaller; |
File | Line |
---|---|
org/jomc/mojo/JomcContainerDescriptorHandler.java | 811 |
org/jomc/mojo/JomcContainerDescriptorHandler.java | 907 |
org/jomc/mojo/JomcResourceTransformer.java | 834 |
org/jomc/mojo/JomcResourceTransformer.java | 930 |
final Unmarshaller unmarshaller = modelContext.createUnmarshaller( this.model ); final JAXBSource source = new JAXBSource( marshaller, element ); final JAXBResult result = new JAXBResult( unmarshaller ); for ( final Map.Entry<Object, Object> e : System.getProperties().entrySet() ) { transformer.setParameter( e.getKey().toString(), e.getValue() ); } transformer.transform( source, result ); if ( result.getResult() instanceof JAXBElement<?> && boundType.isInstance( ( (JAXBElement<?>) result.getResult() ).getValue() ) ) { @SuppressWarnings( "unchecked" ) final JAXBElement<T> e = (JAXBElement<T>) result.getResult(); transformed = e; } else { throw new ModelException( Messages.getMessage( |
File | Line |
---|---|
org/jomc/mojo/KeyValueType.java | 171 |
org/jomc/mojo/KeyValueType.java | 268 |
try { o = javaClass.getConstructor( String.class ).newInstance( o ); } catch ( final NoSuchMethodException e ) { final Method valueOf = javaClass.getMethod( "valueOf", String.class ); if ( Modifier.isStatic( valueOf.getModifiers() ) && valueOf.getReturnType().equals( javaClass ) ) { o = valueOf.invoke( null, o ); } else { throw (InstantiationException) new InstantiationException( Messages.getMessage( "noSuchMethodCreatingObject", this.getType(), this.getValue(), javaClass.getSimpleName() ) ).initCause( e ); } } } } else if ( this.getType() != null ) { |
File | Line |
---|---|
org/jomc/mojo/KeyValueType.java | 204 |
org/jomc/mojo/KeyValueType.java | 310 |
Messages.getMessage( "classNotFound", this.getType() ) ).initCause( e ); } catch ( final NoSuchMethodException e ) { throw (InstantiationException) new InstantiationException( Messages.getMessage( "noSuchMethodCreatingObject", this.getType(), this.getValue(), javaClass.getSimpleName() ) ).initCause( e ); } catch ( final IllegalAccessException e ) { throw (InstantiationException) new InstantiationException( Messages.getMessage( "failedCreatingObject", this.getType() ) ).initCause( e ); } catch ( final InvocationTargetException e ) { throw (InstantiationException) new InstantiationException( Messages.getMessage( "failedCreatingObject", this.getType() ) ).initCause( e ); } } |
File | Line |
---|---|
org/jomc/mojo/AbstractJomcMojo.java | 1093 |
org/jomc/mojo/AbstractJomcMojo.java | 1141 |
this.log( Level.FINEST, Messages.getMessage( "mainClasspathInfo" ), null ); } int i = 0; final URL[] urls = new URL[ uris.size() ]; for ( final URI uri : uris ) { urls[i++] = uri.toURL(); if ( this.isLoggable( Level.FINEST ) ) { this.log( Level.FINEST, "\t" + urls[i - 1].toExternalForm(), null ); } } return new URLClassLoader( urls, Thread.currentThread().getContextClassLoader() ); } catch ( final IOException e ) { throw new MojoExecutionException( Messages.getMessage( e ), e ); } } /** * Gets the project's test class loader of the instance. * * @return The project's test class loader of the instance. * * @throws MojoExecutionException if getting the class loader fails. */ protected ClassLoader getTestClassLoader() throws MojoExecutionException |
File | Line |
---|---|
org/jomc/mojo/JomcContainerDescriptorHandler.java | 640 |
org/jomc/mojo/JomcResourceTransformer.java | 445 |
} catch ( final InstantiationException e ) { // JDK: As of JDK 6, "new IOException( message, cause )". throw (IOException) new IOException( Messages.getMessage( e ) ).initCause( e ); } catch ( final JAXBException e ) { String message = Messages.getMessage( e ); if ( message == null && e.getLinkedException() != null ) { message = Messages.getMessage( e.getLinkedException() ); } // JDK: As of JDK 6, "new IOException( message, cause )". throw (IOException) new IOException( message ).initCause( e ); } catch ( final ModelException e ) { // JDK: As of JDK 6, "new IOException( message, cause )". throw (IOException) new IOException( Messages.getMessage( e ) ).initCause( e ); } } |
File | Line |
---|---|
org/jomc/mojo/MainInstanceShowMojo.java | 73 |
org/jomc/mojo/TestInstanceShowMojo.java | 73 |
public MainInstanceShowMojo() { super(); } @Override protected JAXBElement<?> getDisplayModel( final ModelContext modelContext ) throws MojoExecutionException { final Model model = this.getModel( modelContext ); final Modules modules = ModelHelper.getModules( model ); final Instance instance = modules != null ? modules.getInstance( this.identifier ) : null; JAXBElement<?> displayModel = null; if ( instance != null ) { displayModel = new org.jomc.model.ObjectFactory().createInstance( instance ); } return displayModel; } @Override protected ClassLoader getDisplayClassLoader() throws MojoExecutionException { return this.getMainClassLoader(); |
File | Line |
---|---|
org/jomc/mojo/MainModuleShowMojo.java | 73 |
org/jomc/mojo/TestModuleShowMojo.java | 73 |
public MainModuleShowMojo() { super(); } @Override protected JAXBElement<?> getDisplayModel( final ModelContext modelContext ) throws MojoExecutionException { final Model model = this.getModel( modelContext ); final Modules modules = ModelHelper.getModules( model ); final Module module = modules != null ? modules.getModule( this.identifier ) : null; JAXBElement<?> displayModel = null; if ( module != null ) { displayModel = new org.jomc.model.ObjectFactory().createModule( module ); } return displayModel; } @Override protected ClassLoader getDisplayClassLoader() throws MojoExecutionException { return this.getMainClassLoader(); |
File | Line |
---|---|
org/jomc/mojo/MainSpecificationShowMojo.java | 73 |
org/jomc/mojo/TestSpecificationShowMojo.java | 73 |
public MainSpecificationShowMojo() { super(); } @Override protected JAXBElement<?> getDisplayModel( final ModelContext modelContext ) throws MojoExecutionException { final Model model = this.getModel( modelContext ); final Modules modules = ModelHelper.getModules( model ); final Specification specification = modules != null ? modules.getSpecification( this.identifier ) : null; JAXBElement<?> displayModel = null; if ( specification != null ) { displayModel = new org.jomc.model.ObjectFactory().createSpecification( specification ); } return displayModel; } @Override protected ClassLoader getDisplayClassLoader() throws MojoExecutionException { return this.getMainClassLoader(); |
File | Line |
---|---|
org/jomc/mojo/AbstractJomcMojo.java | 1820 |
org/jomc/mojo/AbstractJomcMojo.java | 1899 |
URL resource = this.getClass().getResource( absolute ); if ( resource == null ) { try { resource = new URL( location ); } catch ( final MalformedURLException e ) { if ( this.isLoggable( Level.FINEST ) ) { this.log( Level.FINEST, Messages.getMessage( e ), e ); } resource = null; } } if ( resource == null ) { final File f = this.getAbsoluteFile( location ); if ( f.isFile() ) { resource = f.toURI().toURL(); } } return resource; } catch ( final MalformedURLException e ) |