Refine search
throw new TransferFailedException( "Unsupported Protocol: '" + protocol + "': " + e.getMessage(), e ); throw new TransferFailedException( "Connection failed: " + e.getMessage(), e ); throw new TransferFailedException( "Authentication failed: " + e.getMessage(), e ); throw new TransferFailedException( "Authorization failed: " + e.getMessage(), e );
@Override public boolean resourceExists(String resourceName) throws TransferFailedException, AuthorizationException { String url = buildUrl(resourceName); try (Response response = client.head(url)) { final int statusCode = response.getStatusCode(); switch (statusCode) { case HttpURLConnection.HTTP_OK: return true; case HttpURLConnection.HTTP_FORBIDDEN: throw new AuthorizationException("Access denied to: " + url); case HttpURLConnection.HTTP_NOT_FOUND: return false; case HttpURLConnection.HTTP_UNAUTHORIZED: throw new AuthorizationException("Unauthorized to access: " + url); case HttpURLConnection.HTTP_PROXY_AUTH: throw new AuthorizationException("Proxy authentication required to access: " + url); default: throw new TransferFailedException("Failed to look for file: " + url + ". Return code is: " + statusCode); } } catch (IOException e) { throw new TransferFailedException("Error transferring file: " + e.getMessage(), e); } }
private void raiseAndtroubleShootPassword() throws AuthorizationException { StringBuffer buf = new StringBuffer(); buf.append("\n\n\n-----AUTHENTICATION ERROR-----\n"); buf.append("Cannot find password for repository id:"); buf.append(getRepository().getId()); buf.append(" in settings.xml!\n"); buf.append("-----AUTHENTICATION ERROR-----\n\n\n"); throw new AuthorizationException(buf.toString()); }
throw new DownloadFailedException( url, "Download failed. Reason: " + e.getMessage(), e ); throw new DownloadFailedException( url, "Download failed. Reason: " + e.getMessage(), e );
e.printStackTrace(); System.exit( 4 ); e.printStackTrace(); System.exit( 6 );
throw new AuthorizationException( "Access denied to: " + url ); throw new AuthorizationException( "Access denied to: " + url ); throw new TransferFailedException( "Failed to look for file: " + buildUrl( resource ) + ". Return code is: " + statusCode ); throw new TransferFailedException( "Error transferring file: " + e.getMessage(), e );
if ( responseCode == HttpURLConnection.HTTP_FORBIDDEN || responseCode == HttpURLConnection.HTTP_UNAUTHORIZED ) throw new AuthorizationException( "Access denied to: " + url );
break; case HttpStatus.SC_FORBIDDEN: throw new AuthorizationException( "Access denied to: " + url ); throw new AuthorizationException( "Not authorized" ); throw new AuthorizationException( "Not authorized by proxy" ); throw new TransferFailedException( "Failed to transfer file " + url + " with status code " + statusCode ); throw new TransferFailedException( e.getMessage(), e ); throw new TransferFailedException( e.getMessage(), e );
throw new TransferFailedException( "Unsupported Protocol: '" + protocol + "': " + e.getMessage(), e ); throw new TransferFailedException( "Connection failed: " + e.getMessage(), e ); throw new TransferFailedException( "Authentication failed: " + e.getMessage(), e ); throw new TransferFailedException( "Authorization failed: " + e.getMessage(), e );
break; case HttpStatus.SC_FORBIDDEN: throw new AuthorizationException( "Access denied to: " + url ); throw new AuthorizationException( "Not authorized" ); throw new AuthorizationException( "Not authorized by proxy" ); throw new TransferFailedException( "Failed to transfer file " + url + " with status code " + statusCode ); throw new TransferFailedException( e.getMessage(), e ); throw new TransferFailedException( e.getMessage(), e );
throw new TransferFailedException( "Unsupported Protocol: '" + protocol + "': " + e.getMessage(), e ); throw new TransferFailedException( "Unable to add checksum methods: " + e.getMessage(), e ); throw new TransferFailedException( "Connection failed: " + e.getMessage(), e ); throw new TransferFailedException( "Authorization failed: " + e.getMessage(), e );
throw new AuthorizationException( "Access denied to: " + url ); throw new AuthorizationException( "Not authorized." ); throw new AuthorizationException( "Not authorized by proxy." ); throw new TransferFailedException( "Failed to transfer file: " + url + ". Return code is: " + statusCode ); throw new TransferFailedException( "Could not read response body.", e ); throw new TransferFailedException( "Could not read response body.", e );
throw new TransferFailedException( "Unsupported Protocol: '" + protocol + "': " + e.getMessage(), e ); throw new TransferFailedException( "Unable to add checksum methods: " + e.getMessage(), e ); throw new TransferFailedException( "Connection failed: " + e.getMessage(), e ); throw new TransferFailedException( "Authorization failed: " + e.getMessage(), e );
throw new AuthorizationException(String.format("Could not authenticate with %s", getAuthenticationInfo().getPassword())); throw new TransferFailedException(String.format("Download failed: %s", responseText)); throw new TransferFailedException("There was an unexpected server error! (500)"); throw new TransferFailedException(String.format("Could not transfer %s to %s", s, getTargetHost().getHostName())); } catch (URISyntaxException e) { throw new TransferFailedException(String.format("Could not construct url %s to %s", s, getTargetHost().getHostName()));
throw new AuthorizationException( "Access denied to: " + url ); throw new AuthorizationException( "Not authorized." ); throw new AuthorizationException( "Not authorized by proxy." ); throw new TransferFailedException( "Failed to transfer file: " + url + ". Return code is: " + statusCode ); throw new TransferFailedException( "Could not read response body.", e ); throw new TransferFailedException( "Could not read response body.", e );
throw new AuthorizationException("Access denied to: " + url); throw new AuthorizationException("Unauthorized to access: " + url); throw new AuthorizationException("Proxy authentication required to access: " + url); throw new TransferFailedException("Failed to transfer file: " + url + ". Return code is: " + statusCode); message.append(" with proxyInfo ").append(getProxyInfo().toString()); throw new TransferFailedException(message.toString(), e);
throw new AuthorizationException(String.format("Could not authenticate with %s", getAuthenticationInfo().getPassword())); throw new TransferFailedException(String.format("Upload failed: %s", responseText)); throw new TransferFailedException("There was an unexpected server error! (500)"); throw new TransferFailedException(String.format("Could not transfer %s to %s", s, getTargetHost().getHostName())); } catch (URISyntaxException e) { throw new TransferFailedException(String.format("Could not construct url %s to %s", s, getTargetHost().getHostName()));
protected void finishPutTransfer( Resource resource, InputStream input, OutputStream output ) throws TransferFailedException, AuthorizationException, ResourceDoesNotExistException { try { int statusCode = putConnection.getResponseCode(); switch ( statusCode ) { // Success Codes case HttpURLConnection.HTTP_OK: // 200 case HttpURLConnection.HTTP_CREATED: // 201 case HttpURLConnection.HTTP_ACCEPTED: // 202 case HttpURLConnection.HTTP_NO_CONTENT: // 204 break; case HttpURLConnection.HTTP_FORBIDDEN: throw new AuthorizationException( "Access denied to: " + buildUrl( resource ) ); case HttpURLConnection.HTTP_NOT_FOUND: throw new ResourceDoesNotExistException( "File: " + buildUrl( resource ) + " does not exist" ); // add more entries here default: throw new TransferFailedException( "Failed to transfer file: " + buildUrl( resource ) + ". Return code is: " + statusCode ); } } catch ( IOException e ) { fireTransferError( resource, e, TransferEvent.REQUEST_PUT ); throw new TransferFailedException( "Error transferring file: " + e.getMessage(), e ); } }
throw new TransferFailedException( "Cyclic http redirect detected. Aborting! " + visitingUrl ); || responseCode == HttpURLConnection.HTTP_UNAUTHORIZED ) throw new AuthorizationException( "Access denied to: " + buildUrl( resource ) ); throw new TransferFailedException( message.toString(), e );
case HttpStatus.SC_FORBIDDEN: fireSessionConnectionRefused(); throw new AuthorizationException( "Access denied to: " + url ); throw new AuthorizationException( "Not authorized" ); throw new AuthorizationException( "Not authorized by proxy" ); TransferFailedException e = new TransferFailedException( "Failed to transfer file " + url + " with status code " + statusCode ); fireTransferError( resource, e, TransferEvent.REQUEST_GET ); throw new TransferFailedException( e.getMessage(), e ); throw new TransferFailedException( e.getMessage(), e );