qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kw...@apache.org
Subject svn commit: r1762915 - in /qpid/java/trunk: broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java systests/src/test/java/org/apache/qpid/systest/rest/PublishMessageRestTest.java
Date Fri, 30 Sep 2016 14:33:49 GMT
Author: kwall
Date: Fri Sep 30 14:33:49 2016
New Revision: 1762915

URL: http://svn.apache.org/viewvc?rev=1762915&view=rev
Log:
QPID-7366: [Java Broker] Remove additional publish guards - these belong in the message conversion
layer

Modified:
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java
    qpid/java/trunk/systests/src/test/java/org/apache/qpid/systest/rest/PublishMessageRestTest.java

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java?rev=1762915&r1=1762914&r2=1762915&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java
(original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java
Fri Sep 30 14:33:49 2016
@@ -770,33 +770,6 @@ public abstract class AbstractVirtualHos
                 throw new IllegalArgumentException("The message content (if present) can
only be a string, map or list");
             }
         }
-        if (message.getHeaders() != null)
-        {
-            for (Map.Entry<String, Object> entry : message.getHeaders().entrySet())
-            {
-                final String key = entry.getKey();
-                final Object value = entry.getValue();
-                final int keyLength = key.getBytes(StandardCharsets.UTF_8).length;
-                if (keyLength > 255)
-                {
-                    // Disallow keys of more than 255 bytes.  Converting for a 0-8..0-10
client would fail to tolerate
-                    // key as it cannot be represented as shortstring/str8.  Ultimately is
too restrictive for 1.0.
-                    throw new IllegalArgumentException(String.format("Header key '%s' is
too long. Must be fewer than 256 bytes",
-                                                                     key));
-                }
-                if (keyLength == 0)
-                {
-                    // Disallow empty keys. Converting for a 0-8..0-91 client would fail
within Broker.  For 0-10, the client fails.
-                    throw new IllegalArgumentException(String.format("Header entries with
empty keys unsupported", key));
-                }
-                if (value == null)
-                {
-                    // Disallow null values. Converting for a 0-8..0-91 client would fail
within Broker. For 0-10, such
-                    // properties are treated as if the property never existed.
-                    throw new IllegalArgumentException(String.format("Header key '%s' value
of null is unsupported.", key));
-                }
-            }
-        }
 
         InternalMessage internalMessage = InternalMessage.createMessage(getMessageStore(),
header, body, message.isPersistent());
         AutoCommitTransaction txn = new AutoCommitTransaction(getMessageStore());

Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/systest/rest/PublishMessageRestTest.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/systest/rest/PublishMessageRestTest.java?rev=1762915&r1=1762914&r2=1762915&view=diff
==============================================================================
--- qpid/java/trunk/systests/src/test/java/org/apache/qpid/systest/rest/PublishMessageRestTest.java
(original)
+++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/systest/rest/PublishMessageRestTest.java
Fri Sep 30 14:33:49 2016
@@ -134,28 +134,6 @@ public class PublishMessageRestTest exte
         assertEquals("Unexpected number of properties", headers.size(), count);
     }
 
-    public void testPublishMessageWithIllegalPropertyKeysAndValues() throws Exception
-    {
-        {
-            final Map<String, Object> headers = new HashMap<>();
-            final String keytoolong = Strings.repeat("*", 256);
-            headers.put(keytoolong, "helloworld");
-            expectPublishFailure(headers, SC_UNPROCESSABLE_ENTITY);
-        }
-
-        {
-            final Map<String, Object> headers = new HashMap<>();
-            headers.put("", "emptykey");
-            expectPublishFailure(headers, SC_UNPROCESSABLE_ENTITY);
-        }
-
-        {
-            final Map<String, Object> headers = new HashMap<>();
-            headers.put("nullvalue", null);
-            expectPublishFailure(headers, SC_UNPROCESSABLE_ENTITY);
-        }
-    }
-
     private void expectPublishFailure(final Map<String, Object> headers, final int
responseCode) throws IOException
     {
         final Map<String, Object> messageBody = Collections.<String, Object>singletonMap("headers",
headers);



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


Mime
View raw message