[MNG-5368] UnsupportedOperationException thrown when version range is not correct in dependencyManagement definitions

o Updated to log an error message for any caught 'InvalidVersionSpecificationException's.
This commit is contained in:
Christian Schulte 2015-12-19 17:37:11 +01:00
parent 23b5fcffa7
commit a3cdfbbbe9
1 changed files with 19 additions and 5 deletions

View File

@ -144,6 +144,9 @@ public class LegacyRepositorySystem
}
catch ( InvalidVersionSpecificationException e )
{
// MNG-5368: Log a message instead of returning 'null' silently.
this.logger.error( String.format( "Invalid version specification '%s' creating dependency artifact '%s'.",
d.getVersion(), d ), e );
return null;
}
@ -180,6 +183,11 @@ public class LegacyRepositorySystem
}
catch ( InvalidVersionSpecificationException e )
{
// MNG-5368: Log a message instead of returning 'null' silently.
this.logger.error( String.format(
"Invalid version specification '%s' creating extension artifact '%s:%s:%s'.",
version, groupId, artifactId, version, e ) );
return null;
}
@ -193,18 +201,24 @@ public class LegacyRepositorySystem
public Artifact createPluginArtifact( Plugin plugin )
{
String version = plugin.getVersion();
if ( StringUtils.isEmpty( version ) )
{
version = "RELEASE";
}
VersionRange versionRange;
try
{
String version = plugin.getVersion();
if ( StringUtils.isEmpty( version ) )
{
version = "RELEASE";
}
versionRange = VersionRange.createFromVersionSpec( version );
}
catch ( InvalidVersionSpecificationException e )
{
// MNG-5368: Log a message instead of returning 'null' silently.
this.logger.error( String.format(
"Invalid version specification '%s' creating plugin artifact '%s'.",
version, plugin, e ) );
return null;
}