commit d613766a104c25e5a7ce73cce8211ede1d27f36b
parent 19bb5a2c37cbfe2738f0377fba75800f859f08f7
Author: Jan Dankert <devnull@localhost>
Date: Wed, 19 Dec 2018 14:42:38 +0100
Move fields from the generic CMSExceptions to CMSServerErrorException.
Diffstat:
3 files changed, 84 insertions(+), 109 deletions(-)
diff --git a/src/de/openrat/client/util/CMSException.java b/src/de/openrat/client/util/CMSException.java
@@ -2,86 +2,19 @@ package de.openrat.client.util;
public class CMSException extends RuntimeException
{
-
- private static final long serialVersionUID = 3734310284809339317L;
-
- private String message;
- private String status;
- private String description;
- private String reason;
-
public CMSException(String message, Throwable cause)
{
super(message, cause);
}
- public CMSException(String message, String status, String description, String reason, Throwable cause)
- {
- super(message, cause);
-
- this.message = message;
- this.status = status;
- this.description = description;
- this.reason = reason;
- }
-
- public CMSException(String message, String status, String description, String reason)
- {
- super(message);
-
- this.message = message;
- this.status = status;
- this.description = description;
- this.reason = reason;
- }
-
public CMSException(String message)
{
super(message);
- this.message = message;
}
public CMSException(Throwable cause)
{
super(cause);
- this.message = cause.getMessage();
}
- /**
- * Inhalt des Feldes <code>status</code>.
- *
- * @return status
- */
- public String getStatus()
- {
- return status;
- }
-
- /**
- * Inhalt des Feldes <code>description</code>.
- *
- * @return description
- */
- public String getDescription()
- {
- return description;
- }
-
- /**
- * Inhalt des Feldes <code>reason</code>.
- *
- * @return reason
- */
- public String getReason()
- {
- return reason;
- }
-
- @Override
- public String getMessage()
- {
- String message = this.message + " - Status: " + this.status + ", Description: " + this.description + ", Reason: " + this.reason;
-
- return message;
- }
}
diff --git a/src/de/openrat/client/util/CMSRequest.java b/src/de/openrat/client/util/CMSRequest.java
@@ -150,7 +150,7 @@ public class CMSRequest
{
e.printStackTrace(logWriter);
}
- throw new CMSException("XML-Parser-Configuration invalid", "", "", e.getMessage(), e);
+ throw new CMSException("XML-Parser-Configuration invalid: "+e.getMessage(), e);
}
catch (SAXException e)
{
@@ -183,7 +183,7 @@ public class CMSRequest
if (httpStatus.isServerError())
{
- if (rootNode.getName() == "error")
+ if (rootNode.getName().equals("server") || rootNode.getName().equals("error") )
{
// Server reports an technical error.
String error = rootNode.getChild("error").getValue();
diff --git a/src/de/openrat/client/util/CMSServerErrorException.java b/src/de/openrat/client/util/CMSServerErrorException.java
@@ -1,43 +1,85 @@
package de.openrat.client.util;
-public class CMSServerErrorException extends CMSException
-{
-
- private static final long serialVersionUID = 3734310284809339317L;
-
- private String message;
- private String status;
- private String description;
- private String reason;
-
- public CMSServerErrorException(String message, Throwable cause)
- {
- super(message, cause);
- }
-
- public CMSServerErrorException(String message, String status, String description, String reason, Throwable cause)
- {
- super(message, cause);
-
- this.message = message;
- this.status = status;
- this.description = description;
- this.reason = reason;
- }
-
- public CMSServerErrorException(String message)
- {
- super(message);
- this.message = message;
- }
-
- public CMSServerErrorException(String message, String status, String description, String reason)
- {
- super(message);
-
- this.message = message;
- this.status = status;
- this.description = description;
- this.reason = reason;
- }
+public class CMSServerErrorException extends CMSException {
+
+ private String message;
+ private String status;
+ private String description;
+ private String reason;
+
+ public CMSServerErrorException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ public CMSServerErrorException(String message, String status, String description, String reason, Throwable cause)
+ {
+ super(message, cause);
+
+ this.message = message;
+ this.status = status;
+ this.description = description;
+ this.reason = reason;
+ }
+
+ public CMSServerErrorException(String message, String status, String description, String reason)
+ {
+ super(message);
+
+ this.message = message;
+ this.status = status;
+ this.description = description;
+ this.reason = reason;
+ }
+
+ public CMSServerErrorException(String message)
+ {
+ super(message);
+ this.message = message;
+ }
+
+ public CMSServerErrorException(Throwable cause)
+ {
+ super(cause);
+ this.message = cause.getMessage();
+ }
+
+ /**
+ * Inhalt des Feldes <code>status</code>.
+ *
+ * @return status
+ */
+ public String getStatus()
+ {
+ return status;
+ }
+
+ /**
+ * Inhalt des Feldes <code>description</code>.
+ *
+ * @return description
+ */
+ public String getDescription()
+ {
+ return description;
+ }
+
+ /**
+ * Inhalt des Feldes <code>reason</code>.
+ *
+ * @return reason
+ */
+ public String getReason()
+ {
+ return reason;
+ }
+
+ @Override
+ public String getMessage()
+ {
+ String message = this.message + " - Status: " + this.status + ", Description: " + this.description + ", Reason: " + this.reason;
+
+ return message;
+ }
+
}