Merge branch 'master' of git://github.com/jclouds/jclouds

This commit is contained in:
Andrea Turli 2010-11-11 12:55:39 +01:00
commit 4f83c7dc1e
15 changed files with 247 additions and 262 deletions

View File

@ -64,44 +64,51 @@ public class ParseAtmosStorageErrorFromXmlContent implements HttpErrorHandler {
}
public static final Pattern DIRECTORY_PATH = Pattern.compile("^/rest/namespace/?([^/]+)/$");
public static final Pattern DIRECTORY_KEY_PATH = Pattern
.compile("^/rest/namespace/?([^/]+)/(.*)");
public static final Pattern DIRECTORY_KEY_PATH = Pattern.compile("^/rest/namespace/?([^/]+)/(.*)");
public void handleError(HttpCommand command, HttpResponse response) {
Exception exception = new HttpResponseException(command, response);
try {
AtmosStorageError error = parseErrorFromContentOrNull(command, response);
AtmosStorageError error = null;
if (response.getPayload() != null) {
try {
String content = Utils.toStringAndClose(response.getPayload().getInput());
if (content != null && content.indexOf('<') >= 0) {
error = utils.parseAtmosStorageErrorFromContent(command, response, Utils.toInputStream(content));
} else {
exception = content != null ? new HttpResponseException(command, response, content) : exception;
}
} catch (IOException e) {
logger.warn(e, "exception reading error from response", response);
}
}
if (error != null && error.getCode() == 1016) {
File file = new File(command.getRequest().getEndpoint().getPath());
exception = new KeyAlreadyExistsException(file.getParentFile().getAbsolutePath(), file
.getName());
exception = new KeyAlreadyExistsException(file.getParentFile().getAbsolutePath(), file.getName());
} else {
switch (response.getStatusCode()) {
case 401:
exception = new AuthorizationException(command.getRequest(),
error != null ? error.getMessage() : response.getStatusLine());
break;
case 404:
if (!command.getRequest().getMethod().equals("DELETE")) {
String message = error != null ? error.getMessage() : String.format(
"%s -> %s", command.getRequest().getRequestLine(), response
.getStatusLine());
String path = command.getRequest().getEndpoint().getPath();
Matcher matcher = DIRECTORY_PATH.matcher(path);
case 401:
exception = new AuthorizationException(exception.getMessage(), exception);
break;
case 404:
if (!command.getRequest().getMethod().equals("DELETE")) {
String message = error != null ? error.getMessage() : String.format("%s -> %s", command.getRequest()
.getRequestLine(), response.getStatusLine());
String path = command.getRequest().getEndpoint().getPath();
Matcher matcher = DIRECTORY_PATH.matcher(path);
if (matcher.find()) {
exception = new ContainerNotFoundException(matcher.group(1), message);
} else {
matcher = DIRECTORY_KEY_PATH.matcher(path);
if (matcher.find()) {
exception = new ContainerNotFoundException(matcher.group(1), message);
} else {
matcher = DIRECTORY_KEY_PATH.matcher(path);
if (matcher.find()) {
exception = new KeyNotFoundException(matcher.group(1), matcher.group(2),
message);
}
exception = new KeyNotFoundException(matcher.group(1), matcher.group(2), message);
}
}
break;
default:
exception = error != null ? new AtmosStorageResponseException(command, response,
error) : new HttpResponseException(command, response);
}
break;
default:
exception = error != null ? new AtmosStorageResponseException(command, response, error)
: new HttpResponseException(command, response);
}
}
@ -111,17 +118,4 @@ public class ParseAtmosStorageErrorFromXmlContent implements HttpErrorHandler {
}
}
AtmosStorageError parseErrorFromContentOrNull(HttpCommand command, HttpResponse response) {
if (response.getPayload() != null) {
try {
String content = Utils.toStringAndClose(response.getPayload().getInput());
if (content != null && content.indexOf('<') >= 0)
return utils.parseAtmosStorageErrorFromContent(command, response, Utils
.toInputStream(content));
} catch (IOException e) {
logger.warn(e, "exception reading error from response", response);
}
}
return null;
}
}

View File

@ -66,7 +66,7 @@ public class ParseAWSErrorFromXmlContent implements HttpErrorHandler {
public void handleError(HttpCommand command, HttpResponse response) {
HttpRequest request = command.getRequest();
Exception exception = null;
Exception exception = new HttpResponseException(command, response);
try {
AWSError error = null;
String message = null;
@ -81,14 +81,13 @@ public class ParseAWSErrorFromXmlContent implements HttpErrorHandler {
} else {
try {
message = Utils.toStringAndClose(response.getPayload().getInput());
exception = new HttpResponseException(command, response, message);
} catch (IOException e) {
}
}
}
message = message != null ? message : String.format("%s -> %s", request.getRequestLine(),
response.getStatusLine());
if (exception == null)
exception = new HttpResponseException(command, response, message);
switch (response.getStatusCode()) {
case 400:
if (error != null && error.getCode() != null
@ -98,13 +97,13 @@ public class ParseAWSErrorFromXmlContent implements HttpErrorHandler {
.getCode().endsWith(".Duplicate"))) || (message != null && message.indexOf("already exists") != -1))
exception = new IllegalStateException(message, exception);
else if (error != null && error.getCode() != null && error.getCode().equals("AuthFailure"))
exception = new AuthorizationException(command.getRequest(), message);
exception = new AuthorizationException(exception.getMessage(), exception);
else if (message != null && message.indexOf("Failed to bind the following fields") != -1)// Nova
exception = new IllegalArgumentException(message, exception);
break;
case 401:
case 403:
exception = new AuthorizationException(command.getRequest(), message);
exception = new AuthorizationException(exception.getMessage(), exception);
break;
case 404:
if (!command.getRequest().getMethod().equals("DELETE")) {

View File

@ -80,12 +80,14 @@ public class ParseAzureStorageErrorFromXmlContent implements HttpErrorHandler {
} catch (RuntimeException e) {
try {
message = Utils.toStringAndClose(response.getPayload().getInput());
exception = new HttpResponseException(command, response, message);
} catch (IOException e1) {
}
}
} else {
try {
message = Utils.toStringAndClose(response.getPayload().getInput());
exception = new HttpResponseException(command, response, message);
} catch (IOException e) {
}
}
@ -94,7 +96,7 @@ public class ParseAzureStorageErrorFromXmlContent implements HttpErrorHandler {
response.getStatusLine());
switch (response.getStatusCode()) {
case 401:
exception = new AuthorizationException(command.getRequest(), message);
exception = new AuthorizationException(exception.getMessage(), exception);
break;
case 404:
if (!command.getRequest().getMethod().equals("DELETE")) {

View File

@ -19,7 +19,6 @@
package org.jclouds.rest;
import org.jclouds.http.HttpRequest;
/**
* Thrown when there is an authorization error.
@ -39,14 +38,6 @@ public class AuthorizationException extends RuntimeException {
super(arg0, arg1);
}
public AuthorizationException(HttpRequest resource, String error) {
super(String.format("%s -> %s", resource.getRequestLine(), error));
}
public AuthorizationException(HttpRequest resource, String error, Throwable arg1) {
super(String.format("%s -> %s", resource.getRequestLine(), error), arg1);
}
public AuthorizationException(Throwable arg0) {
super(arg0);
}

View File

@ -53,23 +53,17 @@ public class GoGridErrorHandler implements HttpErrorHandler {
try {
Exception exception = new HttpResponseException(command, response);
Set<ErrorResponse> errors = parseErrorsFromContentOrNull(response);
if (errors != null)
exception = new GoGridResponseException(command, response, errors);
switch (response.getStatusCode()) {
case 400:
if (Iterables.get(errors, 0).getMessage()
.indexOf("No object found") != -1) {
exception = new ResourceNotFoundException(Iterables.get(errors,
0).getMessage(), exception);
if (Iterables.get(errors, 0).getMessage().indexOf("No object found") != -1) {
exception = new ResourceNotFoundException(Iterables.get(errors, 0).getMessage(), exception);
break;
}
case 403:
exception = new AuthorizationException(command.getRequest(),
errors != null ? errors.toString() : response.getStatusLine());
exception = new AuthorizationException(exception.getMessage(), exception);
break;
default:
exception = errors != null ? new GoGridResponseException(command,
response, errors) : new HttpResponseException(command,
response);
}
command.setException(exception);
} finally {

View File

@ -57,7 +57,7 @@ public class ParseCloudFilesErrorFromHttpResponse implements HttpErrorHandler {
exception = content != null ? new HttpResponseException(command, response, content) : exception;
switch (response.getStatusCode()) {
case 401:
exception = new AuthorizationException(command.getRequest(), content, exception);
exception = new AuthorizationException(exception.getMessage(), exception);
break;
case 404:
if (!command.getRequest().getMethod().equals("DELETE")) {

View File

@ -52,9 +52,10 @@ public class ParseCloudServersErrorFromHttpResponse implements HttpErrorHandler
Exception exception = new HttpResponseException(command, response);
try {
String content = parseErrorFromContentOrNull(command, response);
exception = content != null ? new HttpResponseException(command, response, content) : exception;
switch (response.getStatusCode()) {
case 401:
exception = new AuthorizationException(command.getRequest(), content);
exception = new AuthorizationException(exception.getMessage(), exception);
break;
case 404:
if (!command.getRequest().getMethod().equals("DELETE")) {

View File

@ -64,8 +64,8 @@ public class ParseRimuHostingException implements Function<Exception, Object> {
RimuHostingResponse firstResponse = Iterables.get(responseMap.values(), 0);
String errorClass = firstResponse.getErrorInfo().getErrorClass();
if (errorClass.equals("PermissionException"))
throw new AuthorizationException(responseException.getCommand().getRequest(),
firstResponse.getErrorInfo().getErrorMessage());
throw new AuthorizationException(
firstResponse.getErrorInfo().getErrorMessage(), responseException);
throw new RuntimeException(firstResponse.getErrorInfo().getErrorMessage(), e);
}
}

View File

@ -1,3 +1,3 @@
echo log_level :info>>c:\etc\chef\client.rb
echo log_location STDOUT>>c:\etc\chef\client.rb
echo chef_server_url "http://localhost:4000">>c:\etc\chef\client.rb
echo log_level :info>>c:\etc\chef\client.rb
echo log_location STDOUT>>c:\etc\chef\client.rb
echo chef_server_url "http://localhost:4000">>c:\etc\chef\client.rb

View File

@ -1,134 +1,134 @@
@echo off
set PATH=
set JAVA_HOME=
set PATH=
GOTO FUNCTION_END
:abort
echo aborting: %EXCEPTION%
exit /b 1
:default
set INSTANCE_NAME=mkebsboot
set INSTANCE_HOME=/mnt/tmp
set LOG_DIR=/mnt/tmp
exit /b 0
:mkebsboot
set TMP_DIR=/mnt/tmp
exit /b 0
:findPid
set FOUND_PID=
set _expression=%1
shift
set FIND_PROCESS=TASKLIST /FI "WINDOWTITLE eq %_expression%" /NH
FOR /F "usebackq tokens=2 delims= " %%A IN (`cmd /c "%FIND_PROCESS% 2>NUL"`) DO (
SET FOUND_PID=%%A
)
if defined FOUND_PID (
exit /b 0
) else (
set EXCEPTION=%_expression% not found
exit /b 1
)
:forget
SETLOCAL
set FOUND_PID=
set NEXT_MINUTE=
set INSTANCE_NAME=%1
shift
set SCRIPT=%1
shift
set LOG_DIR=%1
shift
CALL :findProcess %INSTANCE_NAME%
if defined FOUND_PID (
echo %INSTANCE_NAME% already running pid [%FOUND_PID%]
) else (
CALL :nextMinute
set _DATE=%DATE:~4%
set CMD=schtasks /create /sd %_DATE% /tn %INSTANCE_NAME% /ru System /tr "cmd /c title %INSTANCE_NAME%&%SCRIPT% >%LOG_DIR%\stdout.log 2>%LOG_DIR%\stderr.log" /sc:once /st %NEXT_MINUTE%
echo %INSTANCE_NAME% will start at %NEXT_MINUTE%
set SECONDS=%TIME:~6,2%
set /a SECOND=60-SECONDS
%CMD% >NUL
ping -n %SECONDS% 127.0.0.1 > NUL 2>&1
CALL :findProcess %INSTANCE_NAME%
if not defined FOUND_PID (
set EXCEPTION=%INSTANCE_NAME% did not start
abort
)
)
exit /b 0
:FUNCTION_END
set PATH=c:\windows\;C:\windows\system32;c:\windows\system32\wbem
if not "%1" == "init" if not "%1" == "status" if not "%1" == "stop" if not "%1" == "start" if not "%1" == "tail" if not "%1" == "tailerr" if not "%1" == "run" (
set EXCEPTION=bad argument: %1 not in init status stop start tail tailerr run
goto abort
)
goto CASE_%1
:CASE_init
call :default
if errorlevel 1 goto abort
call :mkebsboot
if errorlevel 1 goto abort
md %INSTANCE_HOME%
del %INSTANCE_HOME%\mkebsboot.cmd 2>NUL
echo @echo off>>%INSTANCE_HOME%\mkebsboot.cmd
echo title mkebsboot>>%INSTANCE_HOME%\mkebsboot.cmd
echo set PATH=c:\windows\;C:\windows\system32;c:\windows\system32\wbem>>%INSTANCE_HOME%\mkebsboot.cmd
echo set INSTANCE_NAME=mkebsboot>>%INSTANCE_HOME%\mkebsboot.cmd
echo set TMP_DIR=%TMP_DIR%>>%INSTANCE_HOME%\mkebsboot.cmd
echo set INSTANCE_NAME=%INSTANCE_NAME%>>%INSTANCE_HOME%\mkebsboot.cmd
echo set INSTANCE_HOME=%INSTANCE_HOME%>>%INSTANCE_HOME%\mkebsboot.cmd
echo set LOG_DIR=%LOG_DIR%>>%INSTANCE_HOME%\mkebsboot.cmd
echo cd /d %%INSTANCE_HOME%%>>%INSTANCE_HOME%\mkebsboot.cmd
md %INSTANCE_HOME%
del %INSTANCE_HOME%\mkebsboot.cmd 2>NUL
echo @echo off>>%INSTANCE_HOME%\mkebsboot.cmd
echo title mkebsboot>>%INSTANCE_HOME%\mkebsboot.cmd
echo set PATH=c:\windows\;C:\windows\system32;c:\windows\system32\wbem>>%INSTANCE_HOME%\mkebsboot.cmd
echo set INSTANCE_NAME=mkebsboot>>%INSTANCE_HOME%\mkebsboot.cmd
echo set TMP_DIR=%TMP_DIR%>>%INSTANCE_HOME%\mkebsboot.cmd
echo set INSTANCE_NAME=%INSTANCE_NAME%>>%INSTANCE_HOME%\mkebsboot.cmd
echo set INSTANCE_HOME=%INSTANCE_HOME%>>%INSTANCE_HOME%\mkebsboot.cmd
echo set LOG_DIR=%LOG_DIR%>>%INSTANCE_HOME%\mkebsboot.cmd
echo cd /d %%INSTANCE_HOME%%>>%INSTANCE_HOME%\mkebsboot.cmd
echo exit /b 0 >>%INSTANCE_HOME%\mkebsboot.cmd
GOTO END_SWITCH
:CASE_status
call :default
if errorlevel 1 goto abort
call :findPid %INSTANCE_NAME%
if errorlevel 1 goto abort
echo [%FOUND_PID%]
GOTO END_SWITCH
:CASE_stop
call :default
if errorlevel 1 goto abort
call :findPid %INSTANCE_NAME%
if errorlevel 1 goto abort
if defined FOUND_PID (
TASKKILL /F /T /PID %FOUND_PID% >NUL
)
GOTO END_SWITCH
:CASE_start
call :default
if errorlevel 1 goto abort
call :forget %INSTANCE_NAME% %INSTANCE_HOME%\%INSTANCE_NAME%.cmd %LOG_DIR%
if errorlevel 1 goto abort
GOTO END_SWITCH
:CASE_tail
call :default
if errorlevel 1 goto abort
tail %LOG_DIR%\stdout.log
GOTO END_SWITCH
:CASE_tailerr
call :default
if errorlevel 1 goto abort
tail %LOG_DIR%\stderr.log
GOTO END_SWITCH
:CASE_run
call :default
if errorlevel 1 goto abort
%INSTANCE_HOME%\%INSTANCE_NAME%.cmd
GOTO END_SWITCH
:END_SWITCH
exit /b 0
@echo off
set PATH=
set JAVA_HOME=
set PATH=
GOTO FUNCTION_END
:abort
echo aborting: %EXCEPTION%
exit /b 1
:default
set INSTANCE_NAME=mkebsboot
set INSTANCE_HOME=/mnt/tmp
set LOG_DIR=/mnt/tmp
exit /b 0
:mkebsboot
set TMP_DIR=/mnt/tmp
exit /b 0
:findPid
set FOUND_PID=
set _expression=%1
shift
set FIND_PROCESS=TASKLIST /FI "WINDOWTITLE eq %_expression%" /NH
FOR /F "usebackq tokens=2 delims= " %%A IN (`cmd /c "%FIND_PROCESS% 2>NUL"`) DO (
SET FOUND_PID=%%A
)
if defined FOUND_PID (
exit /b 0
) else (
set EXCEPTION=%_expression% not found
exit /b 1
)
:forget
SETLOCAL
set FOUND_PID=
set NEXT_MINUTE=
set INSTANCE_NAME=%1
shift
set SCRIPT=%1
shift
set LOG_DIR=%1
shift
CALL :findProcess %INSTANCE_NAME%
if defined FOUND_PID (
echo %INSTANCE_NAME% already running pid [%FOUND_PID%]
) else (
CALL :nextMinute
set _DATE=%DATE:~4%
set CMD=schtasks /create /sd %_DATE% /tn %INSTANCE_NAME% /ru System /tr "cmd /c title %INSTANCE_NAME%&%SCRIPT% >%LOG_DIR%\stdout.log 2>%LOG_DIR%\stderr.log" /sc:once /st %NEXT_MINUTE%
echo %INSTANCE_NAME% will start at %NEXT_MINUTE%
set SECONDS=%TIME:~6,2%
set /a SECOND=60-SECONDS
%CMD% >NUL
ping -n %SECONDS% 127.0.0.1 > NUL 2>&1
CALL :findProcess %INSTANCE_NAME%
if not defined FOUND_PID (
set EXCEPTION=%INSTANCE_NAME% did not start
abort
)
)
exit /b 0
:FUNCTION_END
set PATH=c:\windows\;C:\windows\system32;c:\windows\system32\wbem
if not "%1" == "init" if not "%1" == "status" if not "%1" == "stop" if not "%1" == "start" if not "%1" == "tail" if not "%1" == "tailerr" if not "%1" == "run" (
set EXCEPTION=bad argument: %1 not in init status stop start tail tailerr run
goto abort
)
goto CASE_%1
:CASE_init
call :default
if errorlevel 1 goto abort
call :mkebsboot
if errorlevel 1 goto abort
md %INSTANCE_HOME%
del %INSTANCE_HOME%\mkebsboot.cmd 2>NUL
echo @echo off>>%INSTANCE_HOME%\mkebsboot.cmd
echo title mkebsboot>>%INSTANCE_HOME%\mkebsboot.cmd
echo set PATH=c:\windows\;C:\windows\system32;c:\windows\system32\wbem>>%INSTANCE_HOME%\mkebsboot.cmd
echo set INSTANCE_NAME=mkebsboot>>%INSTANCE_HOME%\mkebsboot.cmd
echo set TMP_DIR=%TMP_DIR%>>%INSTANCE_HOME%\mkebsboot.cmd
echo set INSTANCE_NAME=%INSTANCE_NAME%>>%INSTANCE_HOME%\mkebsboot.cmd
echo set INSTANCE_HOME=%INSTANCE_HOME%>>%INSTANCE_HOME%\mkebsboot.cmd
echo set LOG_DIR=%LOG_DIR%>>%INSTANCE_HOME%\mkebsboot.cmd
echo cd /d %%INSTANCE_HOME%%>>%INSTANCE_HOME%\mkebsboot.cmd
md %INSTANCE_HOME%
del %INSTANCE_HOME%\mkebsboot.cmd 2>NUL
echo @echo off>>%INSTANCE_HOME%\mkebsboot.cmd
echo title mkebsboot>>%INSTANCE_HOME%\mkebsboot.cmd
echo set PATH=c:\windows\;C:\windows\system32;c:\windows\system32\wbem>>%INSTANCE_HOME%\mkebsboot.cmd
echo set INSTANCE_NAME=mkebsboot>>%INSTANCE_HOME%\mkebsboot.cmd
echo set TMP_DIR=%TMP_DIR%>>%INSTANCE_HOME%\mkebsboot.cmd
echo set INSTANCE_NAME=%INSTANCE_NAME%>>%INSTANCE_HOME%\mkebsboot.cmd
echo set INSTANCE_HOME=%INSTANCE_HOME%>>%INSTANCE_HOME%\mkebsboot.cmd
echo set LOG_DIR=%LOG_DIR%>>%INSTANCE_HOME%\mkebsboot.cmd
echo cd /d %%INSTANCE_HOME%%>>%INSTANCE_HOME%\mkebsboot.cmd
echo exit /b 0 >>%INSTANCE_HOME%\mkebsboot.cmd
GOTO END_SWITCH
:CASE_status
call :default
if errorlevel 1 goto abort
call :findPid %INSTANCE_NAME%
if errorlevel 1 goto abort
echo [%FOUND_PID%]
GOTO END_SWITCH
:CASE_stop
call :default
if errorlevel 1 goto abort
call :findPid %INSTANCE_NAME%
if errorlevel 1 goto abort
if defined FOUND_PID (
TASKKILL /F /T /PID %FOUND_PID% >NUL
)
GOTO END_SWITCH
:CASE_start
call :default
if errorlevel 1 goto abort
call :forget %INSTANCE_NAME% %INSTANCE_HOME%\%INSTANCE_NAME%.cmd %LOG_DIR%
if errorlevel 1 goto abort
GOTO END_SWITCH
:CASE_tail
call :default
if errorlevel 1 goto abort
tail %LOG_DIR%\stdout.log
GOTO END_SWITCH
:CASE_tailerr
call :default
if errorlevel 1 goto abort
tail %LOG_DIR%\stderr.log
GOTO END_SWITCH
:CASE_run
call :default
if errorlevel 1 goto abort
%INSTANCE_HOME%\%INSTANCE_NAME%.cmd
GOTO END_SWITCH
:END_SWITCH
exit /b 0

View File

@ -1,17 +1,17 @@
md %TEMP%\%USERNAME%\scripttest
del %TEMP%\%USERNAME%\scripttest\yahooprod.cmd 2>NUL
echo @echo off>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
echo title yahooprod>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
echo set PATH=c:\windows\;C:\windows\system32;c:\windows\system32\wbem>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
echo set INSTANCE_NAME=yahooprod>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
echo set JAVA_HOME=%JAVA_HOME%>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
echo cd /d %TEMP%\%USERNAME%\scripttest>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
md %TEMP%\%USERNAME%\scripttest
del %TEMP%\%USERNAME%\scripttest\yahooprod.cmd 2>NUL
echo @echo off>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
echo title yahooprod>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
echo set PATH=c:\windows\;C:\windows\system32;c:\windows\system32\wbem>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
echo set INSTANCE_NAME=yahooprod>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
echo set JAVA_HOME=%JAVA_HOME%>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
echo cd /d %TEMP%\%USERNAME%\scripttest>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
echo exit /b 0 >>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
md %TEMP%\%USERNAME%\scripttest
del %TEMP%\%USERNAME%\scripttest\yahooprod.cmd 2>NUL
echo @echo off>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
echo title yahooprod>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
echo set PATH=c:\windows\;C:\windows\system32;c:\windows\system32\wbem>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
echo set INSTANCE_NAME=yahooprod>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
echo set JAVA_HOME=%JAVA_HOME%>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
echo cd /d %TEMP%\%USERNAME%\scripttest>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
md %TEMP%\%USERNAME%\scripttest
del %TEMP%\%USERNAME%\scripttest\yahooprod.cmd 2>NUL
echo @echo off>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
echo title yahooprod>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
echo set PATH=c:\windows\;C:\windows\system32;c:\windows\system32\wbem>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
echo set INSTANCE_NAME=yahooprod>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
echo set JAVA_HOME=%JAVA_HOME%>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
echo cd /d %TEMP%\%USERNAME%\scripttest>>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd
echo exit /b 0 >>%TEMP%\%USERNAME%\scripttest\yahooprod.cmd

View File

@ -1,35 +1,35 @@
@echo off
set PATH=
set JAVA_HOME=
set PATH=
set RUNTIME=
GOTO FUNCTION_END
:abort
echo aborting: %EXCEPTION%
exit /b 1
:default
set RUNTIME=Moo
exit /b 0
:FUNCTION_END
set PATH=c:\windows\;C:\windows\system32;c:\windows\system32\wbem
if not "%1" == "start" if not "%1" == "stop" if not "%1" == "status" (
set EXCEPTION=bad argument: %1 not in start stop status
goto abort
)
goto CASE_%1
:CASE_start
call :default
if errorlevel 1 goto abort
echo start %RUNTIME%
GOTO END_SWITCH
:CASE_stop
call :default
if errorlevel 1 goto abort
echo stop %RUNTIME%
GOTO END_SWITCH
:CASE_status
echo hello world>>%TEMP%\%USERNAME%\scripttest\temp.txt
echo the following should be []: [%RUNTIME%]
GOTO END_SWITCH
:END_SWITCH
exit /b 0
@echo off
set PATH=
set JAVA_HOME=
set PATH=
set RUNTIME=
GOTO FUNCTION_END
:abort
echo aborting: %EXCEPTION%
exit /b 1
:default
set RUNTIME=Moo
exit /b 0
:FUNCTION_END
set PATH=c:\windows\;C:\windows\system32;c:\windows\system32\wbem
if not "%1" == "start" if not "%1" == "stop" if not "%1" == "status" (
set EXCEPTION=bad argument: %1 not in start stop status
goto abort
)
goto CASE_%1
:CASE_start
call :default
if errorlevel 1 goto abort
echo start %RUNTIME%
GOTO END_SWITCH
:CASE_stop
call :default
if errorlevel 1 goto abort
echo stop %RUNTIME%
GOTO END_SWITCH
:CASE_status
echo hello world>>%TEMP%\%USERNAME%\scripttest\temp.txt
echo the following should be []: [%RUNTIME%]
GOTO END_SWITCH
:END_SWITCH
exit /b 0

View File

@ -65,9 +65,10 @@ public class ParseSlicehostErrorFromHttpResponse implements HttpErrorHandler {
Exception exception = new HttpResponseException(command, response);
try {
String content = response.getStatusCode() != 401 ? parseErrorFromContentOrNull(command, response) : null;
exception = content != null ? new HttpResponseException(command, response, content) : exception;
switch (response.getStatusCode()) {
case 401:
exception = new AuthorizationException(command.getRequest(), content);
exception = new AuthorizationException(exception.getMessage(), exception);
break;
case 403:
case 404:

View File

@ -79,6 +79,7 @@ public class ParseVCloudErrorFromHttpResponse implements HttpErrorHandler {
} else {
try {
message = Utils.toStringAndClose(response.getPayload().getInput());
exception = message != null ? new HttpResponseException(command, response, message) : exception;
} catch (IOException e) {
}
}
@ -96,7 +97,7 @@ public class ParseVCloudErrorFromHttpResponse implements HttpErrorHandler {
break;
case 401:
case 403:
exception = new AuthorizationException(command.getRequest(), message);
exception = new AuthorizationException(exception.getMessage(), exception);
break;
case 404:
if (!command.getRequest().getMethod().equals("DELETE")) {

View File

@ -54,6 +54,8 @@ public class ParseTerremarkVCloudErrorFromHttpResponse implements HttpErrorHandl
try {
String content = parseErrorFromContentOrNull(command, response);
if (content != null)
exception = new HttpResponseException(command, response, content);
if (response.getMessage() != null
&& ((response.getMessage().indexOf("because there is a pending task running") != -1)
|| (response.getMessage().indexOf("because it is already powered off") != -1)
@ -65,7 +67,7 @@ public class ParseTerremarkVCloudErrorFromHttpResponse implements HttpErrorHandl
exception = new IllegalArgumentException(response.getMessage(), exception);
break;
case 401:
exception = new AuthorizationException(command.getRequest(), content);
exception = new AuthorizationException(exception.getMessage(), exception);
break;
case 403: // TODO temporary as terremark mistakenly uses this for vApp
// not found.