Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Commit

Permalink
IN PROGRESS - issue NEXUS-1831: Allow users to import folder backups …
Browse files Browse the repository at this point in the history
…(which is default on artifactory 2.0)

https://issues.sonatype.org/browse/NEXUS-1831

git-svn-id: file:///opt/svn/repositories/sonatype.org/nexus-plugins/trunk/nexus-migration-plugin@313 c41184c3-3edd-4803-b646-023156917d6f
  • Loading branch information
velo committed Jul 29, 2009
1 parent 9ed444e commit d1a24ff
Showing 1 changed file with 25 additions and 43 deletions.
Expand Up @@ -106,63 +106,45 @@ protected InputStream getConfigurationFile( File backup, String filename )
throws IOException, ZipException, FileNotFoundException, ResourceException
{
ZipFile zipFile = null;
try

if ( backup.isFile() )
{
if ( backup.isFile() )
{
zipFile = new ZipFile( backup );
}
zipFile = new ZipFile( backup );
}

final InputStream cfg;
if ( zipFile != null )
final InputStream cfg;
if ( zipFile != null )
{
ZipEntry cfgEntry = zipFile.getEntry( filename );
if ( cfgEntry == null )
{
ZipEntry cfgEntry = zipFile.getEntry( filename );
if ( cfgEntry == null )
{
cfg = null;
}
else
{
cfg = zipFile.getInputStream( cfgEntry );
}
cfg = null;
}
else
{
File cfgFile = new File( backup, filename );
if ( !cfgFile.exists() )
{
cfg = null;
}
else
{
cfg = new FileInputStream( cfgFile );
}
}

if ( cfg == null )
{
throw new ResourceException( Status.CLIENT_ERROR_BAD_REQUEST,
"Artifactory backup is invalid, missing: '" + filename + "'" );
cfg = zipFile.getInputStream( cfgEntry );
}
return cfg;
}
finally
else
{
try
File cfgFile = new File( backup, filename );
if ( !cfgFile.exists() )
{
if ( zipFile != null )
{
zipFile.close();
}
cfg = null;
}
catch ( IOException e )
else
{
if ( getLogger().isDebugEnabled() )
{
getLogger().debug( "Exception closing Artifactory zip file: " + e.getMessage(), e );
}
cfg = new FileInputStream( cfgFile );
}
}

if ( cfg == null )
{
throw new ResourceException( Status.CLIENT_ERROR_BAD_REQUEST, "Artifactory backup is invalid, missing: '"
+ filename + "'" );
}
return cfg;

}

}

0 comments on commit d1a24ff

Please sign in to comment.