This provides better error messages specifically when SSL configuration is wrong.
I also made a change to DeamonException:
Instead of having a list of error types, I changed it to accept a string resources.
This allows different adapters to report errors that might be unique to their implementation without poluting the DeamonException class with types that are not relevant to anyone else.
@ -237,11 +237,11 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -237,11 +237,11 @@ public class BitCometAdapter implements IDaemonAdapter {
@ -297,13 +297,13 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -297,13 +297,13 @@ public class BitCometAdapter implements IDaemonAdapter {
}
log.d(LOG_NAME,"Error: No entity in HTTP response");
thrownewDaemonException(ExceptionType.UnexpectedResponse,"No HTTP entity object in response.");
thrownewDaemonException(R.string.error_jsonresponseerror,"No HTTP entity object in response.");
@ -356,10 +356,10 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -356,10 +356,10 @@ public class BitCometAdapter implements IDaemonAdapter {
@ -415,7 +415,7 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -415,7 +415,7 @@ public class BitCometAdapter implements IDaemonAdapter {
@ -535,7 +535,7 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -535,7 +535,7 @@ public class BitCometAdapter implements IDaemonAdapter {
@ -677,9 +677,9 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -677,9 +677,9 @@ public class BitCometAdapter implements IDaemonAdapter {
@ -724,7 +724,7 @@ public class BitCometAdapter implements IDaemonAdapter {
@@ -724,7 +724,7 @@ public class BitCometAdapter implements IDaemonAdapter {
@ -121,16 +121,16 @@ public class BitfluAdapter implements IDaemonAdapter {
@@ -121,16 +121,16 @@ public class BitfluAdapter implements IDaemonAdapter {
"Invalid reply from server, http status code: "+httpstatus);
}
@ -172,10 +172,10 @@ public class BitfluAdapter implements IDaemonAdapter {
@@ -172,10 +172,10 @@ public class BitfluAdapter implements IDaemonAdapter {
@ -158,11 +158,11 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
@@ -158,11 +158,11 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
@ -204,13 +204,13 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
@@ -204,13 +204,13 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
}
log.d(LOG_NAME,"Error: No entity in HTTP response");
thrownewDaemonException(ExceptionType.UnexpectedResponse,"No HTTP entity object in response.");
thrownewDaemonException(R.string.error_jsonresponseerror,"No HTTP entity object in response.");
@ -235,10 +235,10 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
@@ -235,10 +235,10 @@ public class BuffaloNasAdapter implements IDaemonAdapter {
@ -206,11 +206,11 @@ public class DLinkRouterBTAdapter implements IDaemonAdapter {
@@ -206,11 +206,11 @@ public class DLinkRouterBTAdapter implements IDaemonAdapter {
@ -284,16 +284,16 @@ public class DLinkRouterBTAdapter implements IDaemonAdapter {
@@ -284,16 +284,16 @@ public class DLinkRouterBTAdapter implements IDaemonAdapter {
}
log.d(LOG_NAME,"Error: No entity in HTTP response");
thrownewDaemonException(ExceptionType.UnexpectedResponse,"No HTTP entity object in response.");
thrownewDaemonException(R.string.error_jsonresponseerror,"No HTTP entity object in response.");
@ -405,17 +405,17 @@ public class DelugeAdapter implements IDaemonAdapter {
@@ -405,17 +405,17 @@ public class DelugeAdapter implements IDaemonAdapter {
returnnewDaemonTaskSuccessResult(task);
default:
returnnewDaemonTaskFailureResult(task,newDaemonException(ExceptionType.MethodUnsupported,task.getMethod()+" is not "+
returnnewDaemonTaskFailureResult(task,newDaemonException(R.string.error_unsupported,task.getMethod()+" is not "+
// Unable to establish version number; assume an old version by setting it to version 1
version=10000;
@ -517,7 +517,7 @@ public class DelugeAdapter implements IDaemonAdapter {
@@ -517,7 +517,7 @@ public class DelugeAdapter implements IDaemonAdapter {
// Still no session cookie?
if(sessionCookie==null){
// Set error message and cancel the action that was requested
thrownewDaemonException(ExceptionType.AuthenticationFailure,"Password error? Server time difference? No (valid) cookie in "+
thrownewDaemonException(R.string.error_401,"Password error? Server time difference? No (valid) cookie in "+
"response and JSON was: "+HttpHelper.convertStreamToString(instream));
}
@ -563,14 +563,14 @@ public class DelugeAdapter implements IDaemonAdapter {
@@ -563,14 +563,14 @@ public class DelugeAdapter implements IDaemonAdapter {
}
// No result?
thrownewDaemonException(ExceptionType.UnexpectedResponse,"No HTTP entity in response object.");
thrownewDaemonException(R.string.error_jsonresponseerror,"No HTTP entity in response object.");
@ -212,7 +212,7 @@ public class KtorrentAdapter implements IDaemonAdapter {
@@ -212,7 +212,7 @@ public class KtorrentAdapter implements IDaemonAdapter {
task.getMethod()+" is not supported by "+getType()));
}
}catch(LoggedOutExceptione){
@ -226,7 +226,7 @@ public class KtorrentAdapter implements IDaemonAdapter {
@@ -226,7 +226,7 @@ public class KtorrentAdapter implements IDaemonAdapter {
returnexecuteTask(log,task);
}else{
// Never retry more than twice; in this case just return a task failure
"Retried "+retries+" already, so we stopped now"));
}
@ -266,7 +266,7 @@ public class KtorrentAdapter implements IDaemonAdapter {
@@ -266,7 +266,7 @@ public class KtorrentAdapter implements IDaemonAdapter {
@ -303,7 +303,7 @@ public class KtorrentAdapter implements IDaemonAdapter {
@@ -303,7 +303,7 @@ public class KtorrentAdapter implements IDaemonAdapter {
@ -320,7 +320,7 @@ public class KtorrentAdapter implements IDaemonAdapter {
@@ -320,7 +320,7 @@ public class KtorrentAdapter implements IDaemonAdapter {
instream.close();
// Challenge string should be something like TncpX3TB8uZ0h8eqztZ6
@ -346,7 +346,7 @@ public class KtorrentAdapter implements IDaemonAdapter {
@@ -346,7 +346,7 @@ public class KtorrentAdapter implements IDaemonAdapter {
throwe;
}catch(Exceptione){
log.d(LOG_NAME,"Error during login: "+e.toString());
@ -374,7 +374,7 @@ public class KtorrentAdapter implements IDaemonAdapter {
@@ -374,7 +374,7 @@ public class KtorrentAdapter implements IDaemonAdapter {
// This happens in particular when we were logged out (because somebody else logged into KTorrent's web interface)
thrownewLoggedOutException();
}else{
thrownewDaemonException(ExceptionType.UnexpectedResponse,"Action response was not OK but "+result);
thrownewDaemonException(R.string.error_jsonresponseerror,"Action response was not OK but "+result);
}
}catch(LoggedOutExceptione){
@ -384,7 +384,7 @@ public class KtorrentAdapter implements IDaemonAdapter {
@@ -384,7 +384,7 @@ public class KtorrentAdapter implements IDaemonAdapter {
@ -428,7 +428,7 @@ public class KtorrentAdapter implements IDaemonAdapter {
@@ -428,7 +428,7 @@ public class KtorrentAdapter implements IDaemonAdapter {
// This happens in particular when we were logged out (because somebody else logged into KTorrent's web interface)
thrownewLoggedOutException();
}else{
thrownewDaemonException(ExceptionType.UnexpectedResponse,"Action response was not 1 but "+result);
thrownewDaemonException(R.string.error_jsonresponseerror,"Action response was not 1 but "+result);
}
}catch(LoggedOutExceptione){
@ -438,7 +438,7 @@ public class KtorrentAdapter implements IDaemonAdapter {
@@ -438,7 +438,7 @@ public class KtorrentAdapter implements IDaemonAdapter {
@ -191,7 +191,7 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -191,7 +191,7 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@ -348,10 +348,10 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -348,10 +348,10 @@ public class QbittorrentAdapter implements IDaemonAdapter {
default:
returnnewDaemonTaskFailureResult(task,
newDaemonException(ExceptionType.MethodUnsupported,task.getMethod()+" is not supported by "+getType()));
newDaemonException(R.string.error_unsupported,task.getMethod()+" is not supported by "+getType()));
@ -369,7 +369,7 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -369,7 +369,7 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@ -386,7 +386,7 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -386,7 +386,7 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@ -419,11 +419,11 @@ public class QbittorrentAdapter implements IDaemonAdapter {
@@ -419,11 +419,11 @@ public class QbittorrentAdapter implements IDaemonAdapter {
}
log.d(LOG_NAME,"Error: No entity in HTTP response");
thrownewDaemonException(ExceptionType.UnexpectedResponse,"No HTTP entity object in response.");
thrownewDaemonException(R.string.error_jsonresponseerror,"No HTTP entity object in response.");
@ -311,15 +311,15 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -311,15 +311,15 @@ public class RtorrentAdapter implements IDaemonAdapter {
@ -342,12 +342,12 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -342,12 +342,12 @@ public class RtorrentAdapter implements IDaemonAdapter {
@ -382,7 +382,7 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -382,7 +382,7 @@ public class RtorrentAdapter implements IDaemonAdapter {
"Response on retrieveing torrents did not return a list of objects");
}else{
@ -528,7 +528,7 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -528,7 +528,7 @@ public class RtorrentAdapter implements IDaemonAdapter {
"Response on retrieveing torrent files did not return a list of objects");
}else{
@ -635,7 +635,7 @@ public class RtorrentAdapter implements IDaemonAdapter {
@@ -635,7 +635,7 @@ public class RtorrentAdapter implements IDaemonAdapter {
@ -167,7 +167,7 @@ public class SynologyAdapter implements IDaemonAdapter {
@@ -167,7 +167,7 @@ public class SynologyAdapter implements IDaemonAdapter {
@ -183,7 +183,7 @@ public class SynologyAdapter implements IDaemonAdapter {
@@ -183,7 +183,7 @@ public class SynologyAdapter implements IDaemonAdapter {
@ -194,7 +194,7 @@ public class SynologyAdapter implements IDaemonAdapter {
@@ -194,7 +194,7 @@ public class SynologyAdapter implements IDaemonAdapter {
@ -258,7 +258,7 @@ public class SynologyAdapter implements IDaemonAdapter {
@@ -258,7 +258,7 @@ public class SynologyAdapter implements IDaemonAdapter {
@ -290,7 +290,7 @@ public class SynologyAdapter implements IDaemonAdapter {
@@ -290,7 +290,7 @@ public class SynologyAdapter implements IDaemonAdapter {
@ -315,7 +315,7 @@ public class SynologyAdapter implements IDaemonAdapter {
@@ -315,7 +315,7 @@ public class SynologyAdapter implements IDaemonAdapter {
@ -450,10 +450,10 @@ public class SynologyAdapter implements IDaemonAdapter {
@@ -450,10 +450,10 @@ public class SynologyAdapter implements IDaemonAdapter {
returnjson.getJSONObject("data");
}else{
log.e(LOG_NAME,"not a success: "+json.toString());
@ -462,7 +462,7 @@ public class SynologyAdapter implements IDaemonAdapter {
@@ -462,7 +462,7 @@ public class SynologyAdapter implements IDaemonAdapter {
HttpEntityentity=response.getEntity();
if(entity==null){
log.e(LOG_NAME,"Error: No entity in HTTP response");
thrownewDaemonException(ExceptionType.UnexpectedResponse,"No HTTP entity object in response.");
thrownewDaemonException(R.string.error_jsonresponseerror,"No HTTP entity object in response.");
}
// Read JSON response
java.io.InputStreaminstream=entity.getContent();
@ -472,10 +472,10 @@ public class SynologyAdapter implements IDaemonAdapter {
@@ -472,10 +472,10 @@ public class SynologyAdapter implements IDaemonAdapter {
@ -483,10 +483,10 @@ public class SynologyAdapter implements IDaemonAdapter {
@@ -483,10 +483,10 @@ public class SynologyAdapter implements IDaemonAdapter {
@ -507,7 +507,7 @@ public class SynologyAdapter implements IDaemonAdapter {
@@ -507,7 +507,7 @@ public class SynologyAdapter implements IDaemonAdapter {
@ -528,7 +528,7 @@ public class SynologyAdapter implements IDaemonAdapter {
@@ -528,7 +528,7 @@ public class SynologyAdapter implements IDaemonAdapter {
@ -352,17 +352,17 @@ public class TransmissionAdapter implements IDaemonAdapter {
@@ -352,17 +352,17 @@ public class TransmissionAdapter implements IDaemonAdapter {
@ -431,7 +431,7 @@ public class TransmissionAdapter implements IDaemonAdapter {
@@ -431,7 +431,7 @@ public class TransmissionAdapter implements IDaemonAdapter {
"401 HTTP response (username or password incorrect)");
}
@ -465,16 +465,16 @@ public class TransmissionAdapter implements IDaemonAdapter {
@@ -465,16 +465,16 @@ public class TransmissionAdapter implements IDaemonAdapter {
}
log.d(LOG_NAME,"Error: No entity in HTTP response");
thrownewDaemonException(ExceptionType.UnexpectedResponse,"No HTTP entity object in response.");
thrownewDaemonException(R.string.error_jsonresponseerror,"No HTTP entity object in response.");
@ -187,10 +184,10 @@ public class TtorrentAdapter implements IDaemonAdapter {
@@ -187,10 +184,10 @@ public class TtorrentAdapter implements IDaemonAdapter {
default:
returnnewDaemonTaskFailureResult(task,
newDaemonException(ExceptionType.MethodUnsupported,task.getMethod()+" is not supported by "+getType()));
newDaemonException(R.string.error_unsupported,task.getMethod()+" is not supported by "+getType()));
@ -208,7 +205,7 @@ public class TtorrentAdapter implements IDaemonAdapter {
@@ -208,7 +205,7 @@ public class TtorrentAdapter implements IDaemonAdapter {
@ -225,7 +222,7 @@ public class TtorrentAdapter implements IDaemonAdapter {
@@ -225,7 +222,7 @@ public class TtorrentAdapter implements IDaemonAdapter {
@ -255,11 +252,11 @@ public class TtorrentAdapter implements IDaemonAdapter {
@@ -255,11 +252,11 @@ public class TtorrentAdapter implements IDaemonAdapter {
}
log.d(LOG_NAME,"Error: No entity in HTTP response");
thrownewDaemonException(ExceptionType.UnexpectedResponse,"No HTTP entity object in response.");
thrownewDaemonException(R.string.error_jsonresponseerror,"No HTTP entity object in response.");
thrownewDaemonException(DaemonException.ExceptionType.UnexpectedResponse,"Map of objects returned by Vuze, but these object do not have some <info> attached or no <_object_id> is available");
thrownewDaemonException(R.string.error_jsonresponseerror,"Map of objects returned by Vuze, but these object do not have some <info> attached or no <_object_id> is available");
thrownewDaemonException(ExceptionType.AuthenticationFailure,"HTTP "+HttpStatus.SC_UNAUTHORIZED+" response (so no user or password or incorrect ones)");
thrownewDaemonException(R.string.error_401,"HTTP "+HttpStatus.SC_UNAUTHORIZED+" response (so no user or password or incorrect ones)");
}elseif(statusCode!=HttpStatus.SC_OK){
thrownewDaemonException(ExceptionType.ConnectionError,"HTTP status code: "+statusCode+" != "+HttpStatus.SC_OK);
thrownewDaemonException(R.string.error_httperror,"HTTP status code: "+statusCode+" != "+HttpStatus.SC_OK);
}
// parse response stuff
@ -248,7 +247,7 @@ public class VuzeXmlOverHttpClient {
@@ -248,7 +247,7 @@ public class VuzeXmlOverHttpClient {
// Error
StringerrorText=pullParser.nextText();// the value of the ERROR