Fix the url of getting cert in HAS client.
diff --git a/has-project/has-client/src/main/java/org/apache/kerby/has/client/HasClient.java b/has-project/has-client/src/main/java/org/apache/kerby/has/client/HasClient.java
index f208033..9a9721f 100755
--- a/has-project/has-client/src/main/java/org/apache/kerby/has/client/HasClient.java
+++ b/has-project/has-client/src/main/java/org/apache/kerby/has/client/HasClient.java
@@ -552,7 +552,7 @@
URL url;
try {
- url = new URL("http://" + host + ":" + port + "/has/v1/getcert");
+ url = new URL("http://" + host + ":" + port + "/has/v1/conf/getcert");
} catch (MalformedURLException e) {
throw new HasException("Failed to create a URL object." + e.getMessage());
}
diff --git a/has-project/has-client/src/main/java/org/apache/kerby/has/client/HasClientUtil.java b/has-project/has-client/src/main/java/org/apache/kerby/has/client/HasClientUtil.java
index 93b2c5b..4e70e06 100644
--- a/has-project/has-client/src/main/java/org/apache/kerby/has/client/HasClientUtil.java
+++ b/has-project/has-client/src/main/java/org/apache/kerby/has/client/HasClientUtil.java
@@ -116,6 +116,7 @@
String s;
while ((s = br.readLine()) != null) {
data.append(s);
+ data.append(System.getProperty("line.separator"));
}
return data.toString();
}
diff --git a/kerby-tool/has-tool/src/main/java/org/apache/kerby/kerberos/tool/admin/local/cmd/DeployHTTPSCertsCommand.java b/kerby-tool/has-tool/src/main/java/org/apache/kerby/kerberos/tool/admin/local/cmd/DeployHTTPSCertsCommand.java
index e49ffa5..0b54bb7 100644
--- a/kerby-tool/has-tool/src/main/java/org/apache/kerby/kerberos/tool/admin/local/cmd/DeployHTTPSCertsCommand.java
+++ b/kerby-tool/has-tool/src/main/java/org/apache/kerby/kerberos/tool/admin/local/cmd/DeployHTTPSCertsCommand.java
@@ -186,7 +186,7 @@
sb.append(tempString);
}
} catch (IOException e1) {
- throw new HasException("Failed to read file: " + e1.getMessage());
+ throw new HasException("Failed to read file. " + e1.getMessage());
}
String[] hostArray = sb.toString().replace(" ", "").split(",");
@@ -199,7 +199,7 @@
trustStore.load(in, truststoreSecret.toCharArray());
} catch (Exception e2) {
throw new HasException("Failed to get truststore from the file: "
- + truststoreFile, e2);
+ + truststoreFile + ". " + e2.getMessage());
}
RandomStringGenerator generator = new RandomStringGenerator.Builder()
.withinRange('a', 'z')
@@ -215,7 +215,7 @@
continue;
}
} catch (UnknownHostException e3) {
- throw new HasException("Failed to get local hostname.", e3);
+ throw new HasException("Failed to get local hostname. " + e3.getMessage());
}
KeyStore ks;
@@ -231,7 +231,7 @@
keyStoreInfoMap.put(hostname, keyStoreInfo);
trustStore.setCertificateEntry(hostname, cert);
} catch (Exception e4) {
- throw new HasException("Failed to generate keystore.", e4);
+ throw new HasException("Failed to generate keystore. " + e4.getMessage());
}
}
@@ -239,7 +239,7 @@
try {
finalTrustStoreFile = saveKeyStore(truststoreFile, trustStore, password);
} catch (Exception e5) {
- throw new HasException("Failed to generate trust store files.", e5);
+ throw new HasException("Failed to generate trust store files. " + e5.getMessage());
}
// Generate keystore, truststore, ssl config files and transfer them to destination
@@ -254,7 +254,7 @@
files.add(createClientSSLConfig(pathToDeploy + "/truststore.jks",
truststoreSecret, keyStoreInfo.getKeyPasswd()));
} catch (Exception e6) {
- throw new HasException("Failed to generate key store files.", e6);
+ throw new HasException("Failed to generate key store files. " + e6.getMessage());
}
JSch jsch = new JSch();
@@ -294,14 +294,15 @@
}
}
} catch (SftpException e10) {
- throw new HasException("Failed to mkdir path: " + e10);
+ throw new HasException("Failed to mkdir path: " + e10.getMessage());
}
for (File file : files) {
try {
channel.put(file.getAbsolutePath(), file.getName());
- } catch (SftpException e10) {
- throw new HasException("Failed to send the https cert files.", e10);
+ } catch (SftpException e11) {
+ throw new HasException("Failed to send the https cert files. "
+ + e11.getMessage());
}
}
channel.disconnect();