fix metadata parsing in mboot

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@280372 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-09-12 17:06:59 +00:00
parent 997774aa7b
commit 057268bd56
1 changed files with 49 additions and 58 deletions

View File

@ -196,53 +196,13 @@ public class RepositoryMetadata
{ {
if ( insideVersioning ) if ( insideVersioning )
{ {
if ( insideSnapshot ) if ( "snapshot".equals( rawName ) )
{ {
if ( "buildNumber".equals( rawName ) ) insideSnapshot = true;
{
try
{
metadata.setSnapshotBuildNumber( Integer.valueOf( getBodyText() ).intValue() );
}
catch ( NumberFormatException e )
{
// Ignore
}
}
else if ( "timestamp".equals( rawName ) )
{
metadata.setSnapshotTimestamp( getBodyText() );
}
else if ( "localCopy".equals( rawName ) )
{
metadata.setLocalCopy( Boolean.valueOf( getBodyText() ).booleanValue() );
}
} }
else if ( insideVersions ) else if ( "versions".equals( rawName ) )
{ {
if ( "version".equals( rawName ) ) insideVersions = true;
{
metadata.addVersion( getBodyText() );
}
}
else
{
if ( "snapshot".equals( rawName ) )
{
insideSnapshot = true;
}
else if ( "versions".equals( rawName ) )
{
insideVersions = true;
}
else if ( "latest".equals( rawName ) )
{
metadata.setLatestVersion( getBodyText() );
}
else if ( "release".equals( rawName ) )
{
metadata.setReleaseVersion( getBodyText() );
}
} }
} }
else else
@ -252,18 +212,6 @@ public class RepositoryMetadata
{ {
insideVersioning = true; insideVersioning = true;
} }
else if ( "groupId".equals( rawName ) )
{
metadata.setGroupId( getBodyText() );
}
else if ( "artifactId".equals( rawName ) )
{
metadata.setArtifactId( getBodyText() );
}
else if ( "version".equals( rawName ) )
{
metadata.setVersion( getBodyText() );
}
} }
} }
@ -286,14 +234,57 @@ public class RepositoryMetadata
{ {
insideVersioning = false; insideVersioning = false;
} }
if ( "snapshot".equals( rawName ) ) else if ( insideSnapshot && "snapshot".equals( rawName ) )
{ {
if ( "buildNumber".equals( rawName ) )
{
try
{
metadata.setSnapshotBuildNumber( Integer.valueOf( getBodyText() ).intValue() );
}
catch ( NumberFormatException e )
{
// Ignore
}
}
else if ( "timestamp".equals( rawName ) )
{
metadata.setSnapshotTimestamp( getBodyText() );
}
else if ( "localCopy".equals( rawName ) )
{
metadata.setLocalCopy( Boolean.valueOf( getBodyText() ).booleanValue() );
}
insideSnapshot = false; insideSnapshot = false;
} }
if ( "versions".equals( rawName ) ) else if ( insideVersions && "versions".equals( rawName ) )
{ {
if ( "version".equals( rawName ) )
{
metadata.addVersion( getBodyText() );
}
insideVersions = false; insideVersions = false;
} }
else if ( "latest".equals( rawName ) )
{
metadata.setLatestVersion( getBodyText() );
}
else if ( "release".equals( rawName ) )
{
metadata.setReleaseVersion( getBodyText() );
}
}
else if ( "groupId".equals( rawName ) )
{
metadata.setGroupId( getBodyText() );
}
else if ( "artifactId".equals( rawName ) )
{
metadata.setArtifactId( getBodyText() );
}
else if ( "version".equals( rawName ) )
{
metadata.setVersion( getBodyText() );
} }
bodyText = new StringBuffer(); bodyText = new StringBuffer();
} }