[jira] [Commented] (CLOUDSTACK-9633) test_snapshot is failing due to incorrect string construction in utils.py

2016-12-01 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-9633?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15711265#comment-15711265
 ] 

ASF GitHub Bot commented on CLOUDSTACK-9633:


Github user borisstoyanov commented on the issue:

https://github.com/apache/cloudstack/pull/1800
  
@rhtyd I've spend some time and found out what was wrong with the 
test_01_snapshot_root_disk 
the issue come from the way snapshot name has been stored in the DB:

- in 4.8: snapshots/2/7/84ab1c82-13e9-44cb-8978-bc4c8c38f78f

- in 4.10: snapshots/89/188/dc59f069-752e-4fb3-bcdf-2dfa15b31674.vhd

so this is why we're experiencing the failure at the first place with 4.10 
I'm building a 4.9 env now to check this there as well. 


> test_snapshot is failing due to incorrect string construction in utils.py
> -
>
> Key: CLOUDSTACK-9633
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-9633
> Project: CloudStack
>  Issue Type: Bug
>  Security Level: Public(Anyone can view this level - this is the 
> default.) 
>  Components: marvin
>Affects Versions: 4.1.0, 4.8.0, 4.9.0
> Environment: https://github.com/apache/cloudstack/pull/1800
>Reporter: Boris Stoyanov
> Fix For: 4.8.1, 4.10.0.0, 4.9.2.0
>
>
> When searching for the snapshot vhd on the nfs storage it adds 
> ([name].vhd.vhd) I've removed the extension for xenserver and it passed. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (CLOUDSTACK-9632) Upgrade bountycastle to 1.55+

2016-12-01 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-9632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15711261#comment-15711261
 ] 

ASF GitHub Bot commented on CLOUDSTACK-9632:


Github user rhtyd commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1799#discussion_r90398722
  
--- Diff: 
utils/src/main/java/com/cloud/utils/security/CertificateHelper.java ---
@@ -40,123 +46,122 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import com.cloud.utils.exception.CloudRuntimeException;
-import org.apache.commons.codec.binary.Base64;
-
-import com.cloud.utils.Ternary;
-import org.bouncycastle.openssl.PEMReader;
-
 public class CertificateHelper {
-public static byte[] buildAndSaveKeystore(String alias, String cert, 
String privateKey, String storePassword) throws KeyStoreException, 
CertificateException,
-NoSuchAlgorithmException, InvalidKeySpecException, IOException {
-KeyStore ks = buildKeystore(alias, cert, privateKey, 
storePassword);
-
-ByteArrayOutputStream os = new ByteArrayOutputStream();
-ks.store(os, storePassword != null ? storePassword.toCharArray() : 
null);
-os.close();
-return os.toByteArray();
+public static byte[] buildAndSaveKeystore(final String alias, final 
String cert, final String privateKey, final String storePassword) throws 
KeyStoreException, CertificateException,
+NoSuchAlgorithmException, InvalidKeySpecException, IOException {
+final KeyStore ks = buildKeystore(alias, cert, privateKey, 
storePassword);
+
+try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) 
{
+ks.store(os, storePassword != null ? 
storePassword.toCharArray() : null);
+return os.toByteArray();
+}
 }
 
-public static byte[] buildAndSaveKeystore(List> certs, String storePassword) throws KeyStoreException, 
NoSuchAlgorithmException,
-CertificateException, IOException, InvalidKeySpecException {
-KeyStore ks = KeyStore.getInstance("JKS");
+public static byte[] buildAndSaveKeystore(final List> certs, final String storePassword) throws KeyStoreException, 
NoSuchAlgorithmException,
+CertificateException, IOException, InvalidKeySpecException {
+final KeyStore ks = KeyStore.getInstance("JKS");
 ks.load(null, storePassword != null ? storePassword.toCharArray() 
: null);
 
 //name,cert,key
-for (Ternary cert : certs) {
+for (final Ternary cert : certs) {
 if (cert.third() == null) {
-Certificate c = buildCertificate(cert.second());
+final Certificate c = buildCertificate(cert.second());
 ks.setCertificateEntry(cert.first(), c);
 } else {
-Certificate[] c = new Certificate[certs.size()];
+final Certificate[] c = new Certificate[certs.size()];
 int i = certs.size();
-for (Ternary ct : certs) {
+for (final Ternary ct : certs) {
 c[i - 1] = buildCertificate(ct.second());
 i--;
 }
 ks.setKeyEntry(cert.first(), 
buildPrivateKey(cert.third()), storePassword != null ? 
storePassword.toCharArray() : null, c);
 }
 }
 
-ByteArrayOutputStream os = new ByteArrayOutputStream();
-ks.store(os, storePassword != null ? storePassword.toCharArray() : 
null);
-os.close();
-return os.toByteArray();
+try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) 
{
+ks.store(os, storePassword != null ? 
storePassword.toCharArray() : null);
+return os.toByteArray();
+}
 }
 
-public static KeyStore loadKeystore(byte[] ksData, String 
storePassword) throws KeyStoreException, CertificateException, 
NoSuchAlgorithmException, IOException {
-assert (ksData != null);
-KeyStore ks = KeyStore.getInstance("JKS");
-ks.load(new ByteArrayInputStream(ksData), storePassword != null ? 
storePassword.toCharArray() : null);
+public static KeyStore loadKeystore(final byte[] ksData, final String 
storePassword) throws KeyStoreException, CertificateException, 
NoSuchAlgorithmException, IOException {
+assert ksData != null;
+final KeyStore ks = KeyStore.getInstance("JKS");
+try (final ByteArrayInputStream is = new 

[jira] [Commented] (CLOUDSTACK-9632) Upgrade bountycastle to 1.55+

2016-12-01 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-9632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15711258#comment-15711258
 ] 

ASF GitHub Bot commented on CLOUDSTACK-9632:


Github user rhtyd commented on a diff in the pull request:

https://github.com/apache/cloudstack/pull/1799#discussion_r90398614
  
--- Diff: 
utils/src/main/java/com/cloud/utils/security/CertificateHelper.java ---
@@ -40,123 +46,122 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import com.cloud.utils.exception.CloudRuntimeException;
-import org.apache.commons.codec.binary.Base64;
-
-import com.cloud.utils.Ternary;
-import org.bouncycastle.openssl.PEMReader;
-
 public class CertificateHelper {
-public static byte[] buildAndSaveKeystore(String alias, String cert, 
String privateKey, String storePassword) throws KeyStoreException, 
CertificateException,
-NoSuchAlgorithmException, InvalidKeySpecException, IOException {
-KeyStore ks = buildKeystore(alias, cert, privateKey, 
storePassword);
-
-ByteArrayOutputStream os = new ByteArrayOutputStream();
-ks.store(os, storePassword != null ? storePassword.toCharArray() : 
null);
-os.close();
-return os.toByteArray();
+public static byte[] buildAndSaveKeystore(final String alias, final 
String cert, final String privateKey, final String storePassword) throws 
KeyStoreException, CertificateException,
+NoSuchAlgorithmException, InvalidKeySpecException, IOException {
+final KeyStore ks = buildKeystore(alias, cert, privateKey, 
storePassword);
+
+try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) 
{
+ks.store(os, storePassword != null ? 
storePassword.toCharArray() : null);
+return os.toByteArray();
+}
 }
 
-public static byte[] buildAndSaveKeystore(List> certs, String storePassword) throws KeyStoreException, 
NoSuchAlgorithmException,
-CertificateException, IOException, InvalidKeySpecException {
-KeyStore ks = KeyStore.getInstance("JKS");
+public static byte[] buildAndSaveKeystore(final List> certs, final String storePassword) throws KeyStoreException, 
NoSuchAlgorithmException,
+CertificateException, IOException, InvalidKeySpecException {
+final KeyStore ks = KeyStore.getInstance("JKS");
 ks.load(null, storePassword != null ? storePassword.toCharArray() 
: null);
 
 //name,cert,key
-for (Ternary cert : certs) {
+for (final Ternary cert : certs) {
 if (cert.third() == null) {
-Certificate c = buildCertificate(cert.second());
+final Certificate c = buildCertificate(cert.second());
 ks.setCertificateEntry(cert.first(), c);
 } else {
-Certificate[] c = new Certificate[certs.size()];
+final Certificate[] c = new Certificate[certs.size()];
 int i = certs.size();
-for (Ternary ct : certs) {
+for (final Ternary ct : certs) {
 c[i - 1] = buildCertificate(ct.second());
 i--;
 }
 ks.setKeyEntry(cert.first(), 
buildPrivateKey(cert.third()), storePassword != null ? 
storePassword.toCharArray() : null, c);
 }
 }
 
-ByteArrayOutputStream os = new ByteArrayOutputStream();
-ks.store(os, storePassword != null ? storePassword.toCharArray() : 
null);
-os.close();
-return os.toByteArray();
+try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) 
{
+ks.store(os, storePassword != null ? 
storePassword.toCharArray() : null);
+return os.toByteArray();
+}
 }
 
-public static KeyStore loadKeystore(byte[] ksData, String 
storePassword) throws KeyStoreException, CertificateException, 
NoSuchAlgorithmException, IOException {
-assert (ksData != null);
-KeyStore ks = KeyStore.getInstance("JKS");
-ks.load(new ByteArrayInputStream(ksData), storePassword != null ? 
storePassword.toCharArray() : null);
+public static KeyStore loadKeystore(final byte[] ksData, final String 
storePassword) throws KeyStoreException, CertificateException, 
NoSuchAlgorithmException, IOException {
+assert ksData != null;
+final KeyStore ks = KeyStore.getInstance("JKS");
+try (final ByteArrayInputStream is = new 

<    1   2   3