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

@ -195,37 +195,6 @@ public class RepositoryMetadata
public void startElement( String uri, String localName, String rawName, Attributes attributes )
{
if ( insideVersioning )
{
if ( insideSnapshot )
{
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() );
}
}
else if ( insideVersions )
{
if ( "version".equals( rawName ) )
{
metadata.addVersion( getBodyText() );
}
}
else
{
if ( "snapshot".equals( rawName ) )
{
@ -235,15 +204,6 @@ public class RepositoryMetadata
{
insideVersions = true;
}
else if ( "latest".equals( rawName ) )
{
metadata.setLatestVersion( getBodyText() );
}
else if ( "release".equals( rawName ) )
{
metadata.setReleaseVersion( getBodyText() );
}
}
}
else
{
@ -252,18 +212,6 @@ public class RepositoryMetadata
{
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;
}
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;
}
if ( "versions".equals( rawName ) )
else if ( insideVersions && "versions".equals( rawName ) )
{
if ( "version".equals( rawName ) )
{
metadata.addVersion( getBodyText() );
}
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();
}