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
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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]
+2 −1
Original line number Diff line number Diff line
@@ -123,6 +123,7 @@ public class Availability implements TAPResource, VOSIResource {

		// reason/description of the (non-)availability:
		pw.print("\t<note>");
		if (service.getAvailability() != null)
			pw.print(VOSerializer.formatText(service.getAvailability()));
		pw.println("</note>");

+2 −2
Original line number Diff line number Diff line
@@ -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)