Examples of ArchiverException


Examples of org.codehaus.plexus.archiver.ArchiverException

                        longWarningGiven = true;
                    }
                }
                else if ( longFileMode.isFailMode() )
                {
                    throw new ArchiverException( "Entry: " + vPath + " longer than " + TarConstants.NAMELEN
                                                 + "characters." );
                }
            }

            TarEntry te = new TarEntry( vPath );
View Full Code Here

Examples of org.codehaus.plexus.archiver.ArchiverException

    private void validate()
        throws ArchiverException
    {
        if ( destFile == null )
        {
            throw new ArchiverException( "Destination file attribute is required" );
        }

        if ( destFile.isDirectory() )
        {
            throw new ArchiverException( "Destination file attribute must not represent a directory!" );
        }

        if ( source == null )
        {
            throw new ArchiverException( "Source file attribute is required" );
        }

        if ( source.isDirectory() )
        {
            throw new ArchiverException( "Source file attribute must not represent a directory!" );
        }
    }
View Full Code Here

Examples of org.codehaus.plexus.archiver.ArchiverException

        throws ArchiverException
    {
        int index = indexOfValue( value );
        if ( index == -1 )
        {
            throw new ArchiverException( value + " is not a legal value for this attribute" );
        }
        this.index = index;
        this.value = value;
    }
View Full Code Here

Examples of org.codehaus.plexus.archiver.ArchiverException

        }
       
        ResourceIterator iter = getResources();
        if ( !iter.hasNext() && !hasVirtualFiles() )
        {
            throw new ArchiverException( "You must set at least one file." );
        }

        zipFile = getDestFile();

        if ( zipFile == null )
        {
            throw new ArchiverException( "You must set the destination " + archiveType + "file." );
        }

        if ( zipFile.exists() && !zipFile.isFile() )
        {
            throw new ArchiverException( zipFile + " isn't a file." );
        }

        if ( zipFile.exists() && !zipFile.canWrite() )
        {
            throw new ArchiverException( zipFile + " is read-only." );
        }

        // Whether or not an actual update is required -
        // we don't need to update if the original file doesn't exist

        addingNewFiles = true;

        if ( doUpdate && !zipFile.exists() )
        {
            doUpdate = false;
            getLogger().debug( "ignoring update attribute as " + archiveType + " doesn't exist." );
        }

        success = false;

        if ( doUpdate )
        {
            renamedFile = FileUtils.createTempFile( "zip", ".tmp", zipFile.getParentFile() );
            renamedFile.deleteOnExit();

            try
            {
                FileUtils.rename( zipFile, renamedFile );
            }
            catch ( SecurityException e )
            {
                getLogger().debug( e.toString() );
                throw new ArchiverException( "Not allowed to rename old file (" + zipFile.getAbsolutePath()
                    + ") to temporary file", e );
            }
            catch ( IOException e )
            {
                getLogger().debug( e.toString() );
                throw new ArchiverException( "Unable to rename old file (" + zipFile.getAbsolutePath()
                    + ") to temporary file", e );
            }
        }

        String action = doUpdate ? "Updating " : "Building ";
View Full Code Here

Examples of org.codehaus.plexus.archiver.ArchiverException

    protected void zipFile( ArchiveEntry entry, ZipOutputStream zOut, String vPath )
        throws IOException, ArchiverException
    {
        if ( ResourceUtils.isSame( entry.getResource(), getDestFile() ) )
        {
            throw new ArchiverException( "A zip file cannot include itself" );
        }

        InputStream in = entry.getInputStream();
        try
        {
            // ZIPs store time with a granularity of 2 seconds, round up
            final long lastModified = entry.getResource().getLastModified() + ( roundUp ? 1999 : 0 );
            zipFile( in, zOut, vPath, lastModified, null, entry.getMode() );
        }
        catch ( IOException e )
        {
            throw new ArchiverException( "IOException when zipping " + entry.getName() + ": " + e.getMessage(), e );
        }
        finally
        {
            IOUtil.close( in );
        }
View Full Code Here

Examples of org.codehaus.plexus.archiver.ArchiverException

            // remainder zeros
            os.write( empty );
        }
        catch ( IOException ioe )
        {
            throw new ArchiverException( "Could not create empty ZIP archive " + "(" + ioe.getMessage() + ")", ioe );
        }
        finally
        {
            IOUtil.close( os );
        }
View Full Code Here

Examples of org.codehaus.plexus.archiver.ArchiverException

            getLogger().debug( "expand complete" );
        }
        catch ( final IOException ioe )
        {
            throw new ArchiverException( "Error while expanding " + getSourceFile().getAbsolutePath(), ioe );
        }
        finally
        {
            if ( zf != null )
            {
View Full Code Here

Examples of org.codehaus.plexus.archiver.ArchiverException

                extractFile( sourceFile, destDirectory, inputStream, name, time, isDirectory, mode );
            }
        }
        catch ( final ArchiveFilterException e )
        {
            throw new ArchiverException( "Error verifying \'" + name + "\' for inclusion: " + e.getMessage(), e );
        }
    }
View Full Code Here

Examples of org.codehaus.plexus.archiver.ArchiverException

                }
            }
        }
        catch ( final IOException ioe )
        {
            throw new ArchiverException( "Error while expanding " + getSourceFile().getAbsolutePath(), ioe );
        }
        finally
        {
            if ( zipFile != null )
            {
View Full Code Here

Examples of org.codehaus.plexus.archiver.ArchiverException

        {
            String defManifest = "/org/codehaus/plexus/archiver/jar/defaultManifest.mf";
            InputStream in = Manifest.class.getResourceAsStream( defManifest );
            if ( in == null )
            {
                throw new ArchiverException( "Could not find default manifest: "
                                             + defManifest );
            }
            try
            {
                Manifest defaultManifest = new Manifest( new InputStreamReader( in, "UTF-8" ) );
                Attribute createdBy = new Attribute( "Created-By",
                                                     System.getProperty( "java.vm.version" ) + " ("
                                                     + System.getProperty( "java.vm.vendor" ) + ")" );
                defaultManifest.getMainSection().storeAttribute( createdBy );
                return defaultManifest;
            }
            catch ( UnsupportedEncodingException e )
            {
                return new Manifest( new InputStreamReader( in ) );
            }
            finally
            {
                IOUtil.close( in );
            }
        }
        catch ( ManifestException e )
        {
            throw new ArchiverException( "Default manifest is invalid !!", e );
        }
        catch ( IOException e )
        {
            throw new ArchiverException( "Unable to read default manifest", e );
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.