Package org.apache.maven.wagon

Examples of org.apache.maven.wagon.TransferFailedException


                }
            }
        }
        catch ( DavException e )
        {
            throw new TransferFailedException( e.getMessage(), e );
        }
        catch ( IOException e )
        {
            throw new TransferFailedException( e.getMessage(), e );
        }
        finally
        {
            if ( method != null )
            {
View Full Code Here


                    case HttpStatus.SC_NOT_FOUND:
                        result = false;
                        break;
                    //add more entries here
                    default:
                        throw new TransferFailedException(
                            "Failed to transfer file: " + url + ". Return code is: " + statusCode + reasonPhrase );
                }

                EntityUtils.consume( response.getEntity() );
                return result;
            }
            finally
            {
                response.close();
            }
        }
        catch ( IOException e )
        {
            throw new TransferFailedException( e.getMessage(), e );
        }
        catch ( HttpException e )
        {
            throw new TransferFailedException( e.getMessage(), e );
        }
    }
View Full Code Here

                    // add more entries here
                default:
                {
                    cleanupGetTransfer( resource );
                    TransferFailedException e = new TransferFailedException(
                        "Failed to transfer file: " + url + ". Return code is: " + statusCode + " " + reasonPhrase );
                    fireTransferError( resource, e, TransferEvent.REQUEST_GET );
                    throw e;
                }
            }

            Header contentLengthHeader = response.getFirstHeader( "Content-Length" );

            if ( contentLengthHeader != null )
            {
                try
                {
                    long contentLength = Long.parseLong( contentLengthHeader.getValue() );

                    resource.setContentLength( contentLength );
                }
                catch ( NumberFormatException e )
                {
                    fireTransferDebug(
                        "error parsing content length header '" + contentLengthHeader.getValue() + "' " + e );
                }
            }

            Header lastModifiedHeader = response.getFirstHeader( "Last-Modified" );
            if ( lastModifiedHeader != null )
            {
                Date lastModified = DateUtils.parseDate( lastModifiedHeader.getValue() );
                if ( lastModified != null )
                {
                    resource.setLastModified( lastModified.getTime() );
                    fireTransferDebug( "last-modified = " + lastModifiedHeader.getValue() +
                                           " (" + lastModified.getTime() + ")" );
                }
            }

            HttpEntity entity = response.getEntity();
            if ( entity != null )
            {
                inputData.setInputStream( entity.getContent() );
            }
        }
        catch ( IOException e )
        {
            fireTransferError( resource, e, TransferEvent.REQUEST_GET );

            throw new TransferFailedException( e.getMessage(), e );
        }
        catch ( HttpException e )
        {
            fireTransferError( resource, e, TransferEvent.REQUEST_GET );

            throw new TransferFailedException( e.getMessage(), e );
        }
    }
View Full Code Here

                    byteBuffer = ByteBuffer.allocate( bytes.length );
                    byteBuffer.put( bytes );
                }
                catch ( IOException e )
                {
                    throw new TransferFailedException( e.getMessage(), e );
                }
            }
            this.resource = resource;
            this.length = resource == null ? -1 : resource.getContentLength();
View Full Code Here

                    case HttpStatus.SC_NOT_FOUND:
                        throw new ResourceDoesNotExistException( "File: " + url + " does not exist" );

                        //add more entries here
                    default:
                        throw new TransferFailedException(
                            "Failed to transfer file: " + url + ". Return code is: " + statusCode );
                }
                HttpEntity entity = response.getEntity();
                if ( entity != null )
                {
                    return HtmlFileListParser.parseFileList( url, entity.getContent() );
                }
                else
                {
                    return Collections.emptyList();
                }

            }
            finally
            {
                response.close();
            }
        }
        catch ( IOException e )
        {
            throw new TransferFailedException( "Could not read response body.", e );
        }
        catch ( HttpException e )
        {
            throw new TransferFailedException( "Could not read response body.", e );
        }
    }
View Full Code Here

                        throw new ResourceDoesNotExistException( "File: " + url + " does not exist" + reasonPhrase );

                        //add more entries here
                    default:
                    {
                        TransferFailedException e = new TransferFailedException(
                            "Failed to transfer file: " + url + ". Return code is: " + statusCode + reasonPhrase );
                        fireTransferError( resource, e, TransferEvent.REQUEST_PUT );
                        throw e;
                    }
                }

                firePutCompleted( resource, source );

                EntityUtils.consume( response.getEntity() );
            }
            finally
            {
                response.close();
            }
        }
        catch ( IOException e )
        {
            fireTransferError( resource, e, TransferEvent.REQUEST_PUT );

            throw new TransferFailedException( e.getMessage(), e );
        }
        catch ( HttpException e )
        {
            fireTransferError( resource, e, TransferEvent.REQUEST_PUT );

            throw new TransferFailedException( e.getMessage(), e );
        }
    }
View Full Code Here

        try
        {
            SftpATTRS attrs = channel.stat( dir );
            if ( ( attrs.getPermissions() & S_IFDIR ) == 0 )
            {
                throw new TransferFailedException( "Remote path is not a directory:" + dir );
            }
        }
        catch ( SftpException e )
        {
            // doesn't exist, make it and try again
View Full Code Here

        {
            String msg =
                "Error occurred while deploying '" + sourceDirectory.getAbsolutePath() + "' " + "to remote repository: "
                    + getRepository().getUrl() + ": " + e.getMessage();

            throw new TransferFailedException( msg, e );
        }
    }
View Full Code Here

        try
        {
            SftpATTRS attrs = changeToRepositoryDirectory( dir, filename );
            if ( ( attrs.getPermissions() & S_IFDIR ) == 0 )
            {
                throw new TransferFailedException( "Remote path is not a directory:" + dir );
            }

            Vector fileList = channel.ls( filename );
            List files = new ArrayList( fileList.size() );
            for ( Iterator i = fileList.iterator(); i.hasNext(); )
            {
                ChannelSftp.LsEntry entry = (ChannelSftp.LsEntry) i.next();
               
                String name = entry.getFilename();
                if ( entry.getAttrs().isDir() )
                {
                    if ( !name.equals( "." ) && !name.equals( ".." ) )
                    {
                        if ( !name.endsWith( "/" ) )
                        {
                            name += "/";
                        }
                        files.add( name );
                    }
                }
                else
                {
                    files.add( name );
                }
            }
            return files;
        }
        catch ( SftpException e )
        {
            String msg =
                "Error occurred while listing '" + destinationDirectory + "' " + "on remote repository: "
                    + getRepository().getUrl() + ": " + e.getMessage();

            throw new TransferFailedException( msg, e );
        }
    }
View Full Code Here

        {
            String msg =
                "Error occurred while looking for '" + resourceName + "' " + "on remote repository: "
                    + getRepository().getUrl() + ": " + e.getMessage();

            throw new TransferFailedException( msg, e );
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.wagon.TransferFailedException

Copyright © 2018 www.massapicom. 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.