url = new URL( "http://" + server + "/~cddb/cddb.cgi" );
} catch (MalformedURLException e) {
throw new Exception(DcResources.getText("msgInvalidURLChangeSetting", url.toString()));
}
HttpConnection connection = HttpConnectionUtil.getConnection(url);
try {
PrintWriter out = new PrintWriter(connection.getOutputStream());
String query = "cmd=" + command + "&hello=" + userLogin + "+" + userDomain + "+" +
clientName + "+" + clientVersion + "&proto="+ protocol;
out.println(query);
out.flush();
out.close();
} catch ( IOException e ) {
throw new Exception(DcResources.getText("msgFreeDBServerUnreachable", e.getMessage()));
}
String output = connection.getString();
//Preliminary freedb error check, error codes 4xx and 5xx indicate an error
if (output.startsWith("4") || output.startsWith("5") || output.startsWith("202")) {
throw new Exception(DcResources.getText("msgFreeDBServerReturnedError", output));
}