[ https://jira.codehaus.org/browse/MRELEASE-417?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Robert Scholte updated MRELEASE-417: ------------------------------------ Description: The following two methods will always return null if the attribute resolvedSnapshotDependencies is not null. Second you can avoid extra lookups by doing a get and check if the value is null (without calling containsKey before). {code} /** * Retrieve the release version for the resolved snapshot dependency. * */ public String getDependencyDevelopmentVersion( String artifactConflictId ) { if ( ( resolvedSnapshotDependencies == null ) && ( resolvedSnapshotDependencies.containsKey( artifactConflictId ) ) ) { java.util.Map versionMap = ( java.util.Map ) resolvedSnapshotDependencies.get( artifactConflictId ); return ( String ) versionMap.get( DEVELOPMENT_KEY ); } return null; } /** * Retrieve the release version for the resolved snapshot dependency. * */ public String getDependencyReleaseVersion( String artifactConflictId ) { if ( ( resolvedSnapshotDependencies == null ) && ( resolvedSnapshotDependencies.containsKey( artifactConflictId ) ) ) { java.util.Map versionMap = ( java.util.Map ) resolvedSnapshotDependencies.get( artifactConflictId ); return ( String ) versionMap.get( RELEASE_KEY ); } return null; } {code} was: The following two methods will always return null if the attribute resolvedSnapshotDependencies is not null. Second you can avoid extra lookups by doing a get and check if the value is null (without calling containsKey before). /** * Retrieve the release version for the resolved snapshot dependency. * */ public String getDependencyDevelopmentVersion( String artifactConflictId ) { if ( ( resolvedSnapshotDependencies == null ) && ( resolvedSnapshotDependencies.containsKey( artifactConflictId ) ) ) { java.util.Map versionMap = ( java.util.Map ) resolvedSnapshotDependencies.get( artifactConflictId ); return ( String ) versionMap.get( DEVELOPMENT_KEY ); } return null; } /** * Retrieve the release version for the resolved snapshot dependency. * */ public String getDependencyReleaseVersion( String artifactConflictId ) { if ( ( resolvedSnapshotDependencies == null ) && ( resolvedSnapshotDependencies.containsKey( artifactConflictId ) ) ) { java.util.Map versionMap = ( java.util.Map ) resolvedSnapshotDependencies.get( artifactConflictId ); return ( String ) versionMap.get( RELEASE_KEY ); } return null; } > generated ReleaseDescriptor contains buggy method: > getDependencyDevelopmentVersion and getDependencyReleaseVersion > ------------------------------------------------------------------------------------------------------------------ > > Key: MRELEASE-417 > URL: https://jira.codehaus.org/browse/MRELEASE-417 > Project: Maven 2.x Release Plugin > Issue Type: Bug > Components: prepare > Reporter: Jens Mühlenhoff > > The following two methods will always return null if the attribute > resolvedSnapshotDependencies is not null. > Second you can avoid extra lookups by doing a get and check if the value is > null (without calling containsKey before). > {code} > /** > * Retrieve the release version for the resolved snapshot dependency. > * > */ > public String getDependencyDevelopmentVersion( String artifactConflictId ) > { > if ( ( resolvedSnapshotDependencies == null ) && ( > resolvedSnapshotDependencies.containsKey( artifactConflictId ) ) ) > { > java.util.Map versionMap = ( java.util.Map ) > resolvedSnapshotDependencies.get( artifactConflictId ); > return ( String ) versionMap.get( DEVELOPMENT_KEY ); > } > return null; > } > /** > * Retrieve the release version for the resolved snapshot dependency. > * > */ > public String getDependencyReleaseVersion( String artifactConflictId ) > { > if ( ( resolvedSnapshotDependencies == null ) && ( > resolvedSnapshotDependencies.containsKey( artifactConflictId ) ) ) > { > java.util.Map versionMap = ( java.util.Map ) > resolvedSnapshotDependencies.get( artifactConflictId ); > return ( String ) versionMap.get( RELEASE_KEY ); > } > return null; > } > {code} -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira