You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2016/01/28 20:13:49 UTC

svn commit: r1727420 - in /webservices/axiom/trunk/axiom-api/src: main/java/org/apache/axiom/mime/ContentType.java test/java/org/apache/axiom/mime/ContentTypeBuilderTest.java test/java/org/apache/axiom/mime/ContentTypeTest.java

Author: veithen
Date: Thu Jan 28 19:13:48 2016
New Revision: 1727420

URL: http://svn.apache.org/viewvc?rev=1727420&view=rev
Log:
Use varargs in the ContentType constructor.

Modified:
    webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/mime/ContentType.java
    webservices/axiom/trunk/axiom-api/src/test/java/org/apache/axiom/mime/ContentTypeBuilderTest.java
    webservices/axiom/trunk/axiom-api/src/test/java/org/apache/axiom/mime/ContentTypeTest.java

Modified: webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/mime/ContentType.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/mime/ContentType.java?rev=1727420&r1=1727419&r2=1727420&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/mime/ContentType.java (original)
+++ webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/mime/ContentType.java Thu Jan 28 19:13:48 2016
@@ -71,12 +71,12 @@ public final class ContentType {
      * @param mediaType
      *            the media type
      * @param parameters
-     *            an array specifying the parameters as name/value pairs (with even entries
+     *            the parameters as name/value pairs (with even entries
      *            representing the parameter names, and odd entries the corresponding values)
      */
-    public ContentType(MediaType mediaType, String[] parameters) {
+    public ContentType(MediaType mediaType, String... parameters) {
         this.mediaType = mediaType;
-        this.parameters = (String[])parameters.clone();
+        this.parameters = parameters.clone();
     }
 
     /**

Modified: webservices/axiom/trunk/axiom-api/src/test/java/org/apache/axiom/mime/ContentTypeBuilderTest.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-api/src/test/java/org/apache/axiom/mime/ContentTypeBuilderTest.java?rev=1727420&r1=1727419&r2=1727420&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-api/src/test/java/org/apache/axiom/mime/ContentTypeBuilderTest.java (original)
+++ webservices/axiom/trunk/axiom-api/src/test/java/org/apache/axiom/mime/ContentTypeBuilderTest.java Thu Jan 28 19:13:48 2016
@@ -30,7 +30,7 @@ public class ContentTypeBuilderTest exte
     }
     
     public void testFromExistingContentType() {
-        ContentType contentType = new ContentType(MediaType.TEXT_XML, new String[] { "charset", "utf-8" });
+        ContentType contentType = new ContentType(MediaType.TEXT_XML, "charset", "utf-8");
         ContentTypeBuilder builder = new ContentTypeBuilder(contentType);
         assertEquals(MediaType.TEXT_XML, builder.getMediaType());
         assertEquals("utf-8", builder.getParameter("charset"));

Modified: webservices/axiom/trunk/axiom-api/src/test/java/org/apache/axiom/mime/ContentTypeTest.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-api/src/test/java/org/apache/axiom/mime/ContentTypeTest.java?rev=1727420&r1=1727419&r2=1727420&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-api/src/test/java/org/apache/axiom/mime/ContentTypeTest.java (original)
+++ webservices/axiom/trunk/axiom-api/src/test/java/org/apache/axiom/mime/ContentTypeTest.java Thu Jan 28 19:13:48 2016
@@ -31,7 +31,7 @@ public class ContentTypeTest extends Tes
     }
     
     public void testGetParameterIgnoresCase() {
-        ContentType ct = new ContentType(MediaType.TEXT_XML, new String[] { "charset", "utf-8" });
+        ContentType ct = new ContentType(MediaType.TEXT_XML, "charset", "utf-8");
         assertEquals("utf-8", ct.getParameter("CHARSET"));
     }
     
@@ -133,19 +133,19 @@ public class ContentTypeTest extends Tes
     }
 
     public void testToString() {
-        ContentType ct = new ContentType(MediaType.TEXT_XML, new String[] { "charset", "utf-8" });
+        ContentType ct = new ContentType(MediaType.TEXT_XML, "charset", "utf-8");
         assertEquals("text/xml; charset=\"utf-8\"", ct.toString());
     }
     
     public void testToStringWithQuote() {
         ContentType ct = new ContentType(new MediaType("application", "x-some-format"),
-                new String[] { "comment", "this is not a \"quote\""});
+                "comment", "this is not a \"quote\"");
         assertEquals("application/x-some-format; comment=\"this is not a \\\"quote\\\"\"", ct.toString());
     }
 
     public void testToStringWithBackslash() {
         ContentType ct = new ContentType(new MediaType("application", "x-some-format"),
-                new String[] { "filename", "c:\\temp\\test.dat"});
+                "filename", "c:\\temp\\test.dat");
         assertEquals("application/x-some-format; filename=\"c:\\\\temp\\\\test.dat\"", ct.toString());
     }
 }