throw new TransferFailedException( "Authorization failed: " + 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()); }
e.printStackTrace(); System.exit( 6 );
@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); } }
throw new TransferFailedException( "Authorization failed: " + e.getMessage(), e );
throw new AuthorizationException( "Access denied to: " + url ); throw new AuthorizationException( "Access denied to: " + url );
if ( responseCode == HttpURLConnection.HTTP_FORBIDDEN || responseCode == HttpURLConnection.HTTP_UNAUTHORIZED ) throw new AuthorizationException( "Access denied to: " + url );
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 ); } }
break; case HttpStatus.SC_FORBIDDEN: throw new AuthorizationException( "Access denied to: " + url ); throw new AuthorizationException( "Not authorized" ); throw new AuthorizationException( "Not authorized by proxy" );
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 AuthorizationException("Access denied to: " + url); throw new AuthorizationException("Unauthorized to access: " + url); throw new AuthorizationException("Proxy authentication required to access: " + url);
throw new AuthorizationException( "Access denied to: " + url ); throw new AuthorizationException( "Not authorized." ); throw new AuthorizationException( "Not authorized by proxy." );
throw new AuthorizationException( "Access denied to: " + url ); throw new AuthorizationException( "Not authorized." ); throw new AuthorizationException( "Not authorized by proxy." );
throw new AuthorizationException(String.format("Could not authenticate with %s", getAuthenticationInfo().getPassword()));
throw new AuthorizationException(String.format("Could not authenticate with %s", getAuthenticationInfo().getPassword()));
|| responseCode == HttpURLConnection.HTTP_UNAUTHORIZED ) throw new AuthorizationException( "Access denied to: " + buildUrl( resource ) );
throw new AuthorizationException( "Access denied to: " + url ); throw new AuthorizationException( "Not authorized." ); throw new AuthorizationException( "Not authorized by proxy." ); throw new AuthorizationException( "Access denied to: " + url ); throw new AuthorizationException( "Not authorized." ); throw new AuthorizationException( "Not authorized by proxy." );
+ consoleOutput ); case 6: throw new AuthorizationException( "Process exit status was: " + status + "Process output:\n" + consoleOutput ); case 7:
throw new AuthorizationException( e.getMessage() );
throw new AuthorizationException( "Access denied to: " + dest );