Skip to content
Snippets Groups Projects
Commit d8e311ad authored by gmantele's avatar gmantele
Browse files

[TAP] Fix bug: test NULL before formatting a string/text (for an XML document).

parent de0d2c30
No related branches found
No related tags found
No related merge requests found
......@@ -220,7 +220,7 @@ public class VOTableFormat implements OutputFormat {
out.newLine();
// Indicate that the query has been successfully processed: [REQUIRED]
out.write("<INFO name=\"QUERY_STATUS\" value=\"ERROR\">" + VOSerializer.formatText(message) + "</INFO>");
out.write("<INFO name=\"QUERY_STATUS\" value=\"ERROR\">" + (message == null ? "" : VOSerializer.formatText(message)) + "</INFO>");
out.newLine();
// Append the PROVIDER information (if any): [OPTIONAL]
......
......@@ -123,7 +123,8 @@ public class Availability implements TAPResource, VOSIResource {
// reason/description of the (non-)availability:
pw.print("\t<note>");
pw.print(VOSerializer.formatText(service.getAvailability()));
if (service.getAvailability() != null)
pw.print(VOSerializer.formatText(service.getAvailability()));
pw.println("</note>");
pw.println("</availability>");
......
......@@ -415,7 +415,7 @@ public class TAP implements VOSIResource {
// TAP access:
xml.append("\t<interface role=\"std\" xsi:type=\"vs:ParamHTTP\">\n");
xml.append("\t\t<accessURL use=\"base\">").append(VOSerializer.formatText(getAccessURL())).append("</accessURL>\n");
xml.append("\t\t<accessURL use=\"base\">").append((getAccessURL() == null) ? "" : VOSerializer.formatText(getAccessURL())).append("</accessURL>\n");
xml.append("\t</interface>\n");
// Language description:
......@@ -678,7 +678,7 @@ public class TAP implements VOSIResource {
// Write the error in the response and return the appropriate HTTP status code:
errorWriter.writeError(t, response, request, reqID, owner, resourceName);
// Log the error:
getLogger().logHttp(LogLevel.ERROR, response, reqID, owner, "HTTP " + response.getStatus() + " - Can not complete the execution of the TAP resource \"" + resourceName + "\", because: " + t.getMessage(), t);
getLogger().logHttp(LogLevel.ERROR, response, reqID, owner, "HTTP " + response.getStatus() + " - Can not complete the execution of the TAP resource \"" + resourceName + "\"!", t);
}finally{
// Notify the queue of the asynchronous jobs that a new connection is available:
if (resourceName.equalsIgnoreCase(Sync.RESOURCE_NAME) && service.getFactory().countFreeConnections() >= 1)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment