The following document contains the results of PMD's CPD 4.1.
File | Line |
---|---|
org/apache/maven/plugin/eclipse/writers/EclipseManifestWriter.java | 280 |
org/apache/maven/plugin/eclipse/writers/rad/RadManifestWriter.java | 234 |
classpath.append( dependency.getArtifactId() + ".jar" ); } } } /** * Check if the two manifests are equal. Manifest.equal can not be used because of the special case the Classpath * entr, witch must be comaired sorted so that a different oder in the classpath does not result in "not equal". * This not not realy correct but in this case it is more important to reduce the number of version-controll files. * * @param manifest the new manifest * @param existingManifest to compaire the new one with * @return are the manifests equal */ private boolean areManifestsEqual( Manifest manifest, Manifest existingManifest ) { if ( existingManifest == null ) { return false; } Set keys = new HashSet(); Attributes existingMap = existingManifest.getMainAttributes(); Attributes newMap = manifest.getMainAttributes(); keys.addAll( existingMap.keySet() ); keys.addAll( newMap.keySet() ); Iterator iterator = keys.iterator(); while ( iterator.hasNext() ) { Attributes.Name key = (Attributes.Name) iterator.next(); String newValue = (String) newMap.get( key ); String existingValue = (String) existingMap.get( key ); // special case classpath... they are qual when there entries // are equal if ( Attributes.Name.CLASS_PATH.equals( key ) ) { newValue = orderClasspath( newValue ); existingValue = orderClasspath( existingValue ); } if ( ( newValue == null || !newValue.equals( existingValue ) ) && ( existingValue == null || !existingValue.equals( newValue ) ) ) { return false; } } return true; } /** * Convert all dependencies in a blank seperated list of jars and projects representing the classpath. * * @return the blank separeted classpath string */ private String constructManifestClasspath() { StringBuffer stringBuffer = new StringBuffer(); IdeDependency[] deps = config.getDepsOrdered(); |
File | Line |
---|---|
org/apache/maven/plugin/eclipse/writers/rad/RadApplicationXMLWriter.java | 57 |
org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpApplicationXMLWriter.java | 37 |
{ private static final String APPLICATION_XML_APPLICATION = "application"; private static final String APPLICATION_XML_CONTEXT_ROOT = "context-root"; private static final String APPLICATION_XML_DESCRIPTION = "description"; private static final String APPLICATION_XML_DISPLAY_NAME = "display-name"; private static final String APPLICATION_XML_FILENAME = "application.xml"; private static final String APPLICATION_XML_MODULE = "module"; private static final String APPLICATION_XML_WEB = "web"; private static final String APPLICATION_XML_WEB_URI = "web-uri"; private static final String HREF = "href"; private static final String ID = "id"; private static final String MODULEMAP_EARPROJECT_MAP = "modulemap:EARProjectMap"; private static final String MODULEMAPS_APPLICATION_EJB_MODULE = "application:EjbModule"; private static final String MODULEMAPS_APPLICATION_WEB_MODULE = "application:WebModule"; private static final String MODULEMAPS_FILENAME = ".modulemaps"; private static final String MODULEMAPS_MAPPINGS = "mappings"; private static final String MODULEMAPS_PROJECT_NAME = "projectName"; private static final String MODULEMAPS_UTILITY_JARMAPPINGS = "utilityJARMappings"; private static final String URI = "uri"; private static final String VERSION = "version"; private static final String XMI_ID = "xmi:id"; private static final String XMI_TYPE = "xmi:type"; private static final String XMI_VERSION = "xmi:version"; private static final String XMLNS = "xmlns"; private static final String XMLNS_APPLICATION = "xmlns:application"; private static final String XMLNS_MODULEMAP = "xmlns:modulemap"; private static final String XMLNS_SCHEMA_LOCATION = "xmlns:schemaLocation"; |
File | Line |
---|---|
org/apache/maven/plugin/eclipse/writers/EclipseManifestWriter.java | 371 |
org/apache/maven/plugin/eclipse/writers/rad/RadManifestWriter.java | 321 |
String[] entries = newValue.split( " " ); Arrays.sort( entries ); StringBuffer buffer = new StringBuffer( newValue.length() ); for ( int index = 0; index < entries.length; index++ ) { buffer.append( entries[index] ); buffer.append( ' ' ); } return buffer.toString(); } /** * Read and parse the existing manifest file. * * @param manifestFile file * @return the read manifest * @throws IOException if the file could not be read */ private Manifest readExistingManifest( File manifestFile ) throws IOException { if ( !manifestFile.exists() ) { return null; } Manifest existingManifest = new Manifest(); FileInputStream inputStream = new FileInputStream( manifestFile ); existingManifest.read( inputStream ); inputStream.close(); return existingManifest; } /** * Verify is the manifest sould be overwritten this sould take in account that the manifest should only be written * if the contents of the classpath was changed not the order. The classpath sorting oder should be ignored. * * @param manifest the newly created classpath * @param manifestFile the file where the manifest * @return if the new manifest file must be written * @throws MojoExecutionException */ private boolean shouldNewManifestFileBeWritten( Manifest manifest, File manifestFile ) throws MojoExecutionException { try { Manifest existingManifest = readExistingManifest( manifestFile ); if ( areManifestsEqual( manifest, existingManifest ) ) { |
File | Line |
---|---|
org/apache/maven/plugin/eclipse/Messages.java | 34 |
org/apache/maven/plugin/ide/Messages.java | 40 |
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME ); /** * Don't instantiate. */ private Messages() { } /** * Returns a string from the bundle. * * @param key message key * @return message value or <code>!key!</code> if key is not found */ public static String getString( String key ) { try { return RESOURCE_BUNDLE.getString( key ); } catch ( MissingResourceException e ) { return '!' + key + '!'; } } /** * Returns a string from the bundle, formatting it using provided params. * * @param key message key * @param params MessageFormat arguments * @return message value or <code>!key!</code> if key is not found */ public static String getString( String key, Object[] params ) { try { return MessageFormat.format( RESOURCE_BUNDLE.getString( key ), params ); } catch ( MissingResourceException e ) { return '!' + key + '!'; } } /** * Returns a string from the bundle, formatting it using provided param. * * @param key message key * @param param MessageFormat arguments * @return message value or <code>!key!</code> if key is not found */ public static String getString( String key, Object param ) { return getString( key, new Object[] { param } ); } } |
File | Line |
---|---|
org/apache/maven/plugin/eclipse/RadPlugin.java | 310 |
org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java | 792 |
for ( Iterator iter = reactorProjects.iterator(); iter.hasNext(); ) { MavenProject reactorProject = (MavenProject) iter.next(); if ( reactorProject.getGroupId().equals( artifact.getGroupId() ) && reactorProject.getArtifactId().equals( artifact.getArtifactId() ) ) { if ( reactorProject.getVersion().equals( artifact.getVersion() ) ) { return true; } else { getLog().info( "Artifact " + artifact.getId() + " already available as a reactor project, but with different version. Expected: " + artifact.getVersion() + ", found: " + reactorProject.getVersion() ); } } } } return false; } /** * @return an array with all dependencies avalaible in the workspace, to be implemented by the subclasses. */ protected IdeDependency[] getWorkspaceArtefacts() |
File | Line |
---|---|
org/apache/maven/plugin/eclipse/writers/rad/RadApplicationXMLWriter.java | 398 |
org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpApplicationXMLWriter.java | 478 |
if ( newModulemapsXmlDomChildren[newIndex] == this.modulemapsXmlDomChildren[index] ) { modulemapsXmlDom.removeChild( newIndex ); break; } } } } for ( int index = 0; index < this.applicationXmlDomChildren.length; index++ ) { if ( this.applicationXmlDomChildren[index] != null ) { Xpp3Dom[] newApplicationXmlDomChildren = applicationXmlDom.getChildren(); for ( int newIndex = 0; newIndex < newApplicationXmlDomChildren.length; newIndex++ ) { if ( newApplicationXmlDomChildren[newIndex] == this.applicationXmlDomChildren[index] ) { applicationXmlDom.removeChild( newIndex ); break; } } } } } /** * update the application.xml and the .modulemaps file for a specified dependency.all WAR an EJB dependencies will * go in both files all others only in the modulemaps files. Webapplications contextroots are corrected to the * contextRoot specified in the pom. * * @param applicationXmlDom dom-tree of application.xml * @param modulemapXmlDom dom-tree of modulemaps * @param dependency the eclipse dependency to handle */ private void updateApplicationXml( Xpp3Dom applicationXmlDom, Xpp3Dom modulemapXmlDom, IdeDependency dependency ) { |