You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rg...@apache.org on 2016/01/14 14:26:23 UTC

svn commit: r1724604 - in /qpid/java/branches/6.0.x: ./ broker-core/src/main/java/org/apache/qpid/server/model/AttributeValueConverter.java

Author: rgodfrey
Date: Thu Jan 14 13:26:23 2016
New Revision: 1724604

URL: http://svn.apache.org/viewvc?rev=1724604&view=rev
Log:
QPID-6979 : merge to 6.0.x

Modified:
    qpid/java/branches/6.0.x/   (props changed)
    qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/model/AttributeValueConverter.java

Propchange: qpid/java/branches/6.0.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jan 14 13:26:23 2016
@@ -9,5 +9,5 @@
 /qpid/branches/java-broker-vhost-refactor/java:1493674-1494547
 /qpid/branches/java-network-refactor/qpid/java:805429-821809
 /qpid/branches/qpid-2935/qpid/java:1061302-1072333
-/qpid/java/trunk:1715445-1715447,1715586,1715940,1716086-1716087,1716127-1716128,1716141,1716153,1716155,1716194,1716204,1716209,1716227,1716277,1716357,1716368,1716370,1716374,1716432,1716444-1716445,1716455,1716461,1716474,1716489,1716497,1716515,1716555,1716602,1716606-1716610,1716619,1716636,1717269,1717299,1717401,1717446,1717449,1717626,1717691,1717735,1717780,1718744,1719047,1719051,1720664,1721151,1721198,1722339,1723064,1724216,1724251,1724257,1724397,1724432
+/qpid/java/trunk:1715445-1715447,1715586,1715940,1716086-1716087,1716127-1716128,1716141,1716153,1716155,1716194,1716204,1716209,1716227,1716277,1716357,1716368,1716370,1716374,1716432,1716444-1716445,1716455,1716461,1716474,1716489,1716497,1716515,1716555,1716602,1716606-1716610,1716619,1716636,1717269,1717299,1717401,1717446,1717449,1717626,1717691,1717735,1717780,1718744,1719047,1719051,1720664,1721151,1721198,1722339,1723064,1724216,1724251,1724257,1724397,1724432,1724603
 /qpid/trunk/qpid:796646-796653

Modified: qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/model/AttributeValueConverter.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/model/AttributeValueConverter.java?rev=1724604&r1=1724603&r2=1724604&view=diff
==============================================================================
--- qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/model/AttributeValueConverter.java (original)
+++ qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/model/AttributeValueConverter.java Thu Jan 14 13:26:23 2016
@@ -22,12 +22,14 @@ package org.apache.qpid.server.model;
 
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
+import java.io.InputStream;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Proxy;
 import java.lang.reflect.Type;
 import java.lang.reflect.TypeVariable;
+import java.nio.charset.StandardCharsets;
 import java.security.cert.Certificate;
 import java.security.cert.CertificateException;
 import java.security.cert.CertificateFactory;
@@ -145,21 +147,19 @@ abstract class AttributeValueConverter<T
 
     static final AttributeValueConverter<Certificate> CERTIFICATE_CONVERTER = new AttributeValueConverter<Certificate>()
     {
-        private static final String BEGIN_CERTIFICATE = "-----BEGIN CERTIFICATE-----\n";
-        private static final String END_CERTIFICATE = "\n-----END CERTIFICATE-----";
-
         private final CertificateFactory _certFactory;
 
         {
             try
             {
-                _certFactory=CertificateFactory.getInstance("X.509");
+                _certFactory = CertificateFactory.getInstance("X.509");
             }
             catch (CertificateException e)
             {
                 throw new ServerScopedRuntimeException(e);
             }
         }
+
         @Override
         public Certificate convert(final Object value, final ConfiguredObject object)
         {
@@ -181,23 +181,7 @@ abstract class AttributeValueConverter<T
             else if(value instanceof String)
             {
                 String strValue = AbstractConfiguredObject.interpolate(object, (String) value);
-                // convert all line endings to UNIX style
-                strValue = strValue.replaceAll("\r\n","\n").replaceAll("\r","\n");
-                if(strValue.contains(BEGIN_CERTIFICATE))
-                {
-                    strValue = strValue.substring(strValue.indexOf(BEGIN_CERTIFICATE) + BEGIN_CERTIFICATE.length());
-                    if(strValue.contains(END_CERTIFICATE))
-                    {
-                        strValue = strValue.substring(0,strValue.indexOf(END_CERTIFICATE));
-                    }
-                    else
-                    {
-                        // contains begin but not end - invalid
-                        return null;
-                    }
-                }
-
-                return convert(BINARY_CONVERTER.convert(strValue, object),object);
+                return convert(strValue.getBytes(StandardCharsets.UTF_8), object);
             }
             else if(value == null)
             {



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org