Author: julien(a)jboss.com
Date: 2008-03-18 20:41:18 -0400 (Tue, 18 Mar 2008)
New Revision: 10321
Modified:
modules/common/trunk/common/src/main/java/org/jboss/portal/common/net/media/MediaType.java
modules/common/trunk/common/src/main/java/org/jboss/portal/common/util/ContentInfo.java
modules/common/trunk/common/src/main/java/org/jboss/portal/common/util/MarkupInfo.java
Log:
corrected a few minor issues in the argument type check
Modified:
modules/common/trunk/common/src/main/java/org/jboss/portal/common/net/media/MediaType.java
===================================================================
---
modules/common/trunk/common/src/main/java/org/jboss/portal/common/net/media/MediaType.java 2008-03-18
23:30:27 UTC (rev 10320)
+++
modules/common/trunk/common/src/main/java/org/jboss/portal/common/net/media/MediaType.java 2008-03-19
00:41:18 UTC (rev 10321)
@@ -58,10 +58,16 @@
public static MediaType create(String mediaTypeName)
{
+ if (mediaTypeName == null)
+ {
+ throw new IllegalArgumentException("No null media type value
accepted");
+ }
+
+ //
int slashIndex = mediaTypeName.indexOf('/');
if (slashIndex == -1)
{
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("The media type " + mediaTypeName +
" does not contain a /");
}
//
@@ -74,12 +80,20 @@
public static MediaType create(String typeName, String subtypeName)
{
- TypeDef type = TypeDef.create(typeName);
+ if (typeName == null)
+ {
+ throw new IllegalArgumentException("No null type name accepted");
+ }
+ if (subtypeName == null)
+ {
+ throw new IllegalArgumentException("No null subtype name accepted");
+ }
//
+ TypeDef type = TypeDef.create(typeName);
if (type == null)
{
- return null;
+ throw new IllegalArgumentException("Type not recognized in content type
" + typeName + "/" + subtypeName);
}
//
@@ -99,6 +113,8 @@
{
throw new IllegalArgumentException("No null subtype accepted");
}
+
+ //
return new MediaType(type, subtype);
}
Modified:
modules/common/trunk/common/src/main/java/org/jboss/portal/common/util/ContentInfo.java
===================================================================
---
modules/common/trunk/common/src/main/java/org/jboss/portal/common/util/ContentInfo.java 2008-03-18
23:30:27 UTC (rev 10320)
+++
modules/common/trunk/common/src/main/java/org/jboss/portal/common/util/ContentInfo.java 2008-03-19
00:41:18 UTC (rev 10321)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.common.util;
+import org.jboss.portal.common.net.media.MediaType;
+
/**
* Describe how content should be interpreted.
*
Modified:
modules/common/trunk/common/src/main/java/org/jboss/portal/common/util/MarkupInfo.java
===================================================================
---
modules/common/trunk/common/src/main/java/org/jboss/portal/common/util/MarkupInfo.java 2008-03-18
23:30:27 UTC (rev 10320)
+++
modules/common/trunk/common/src/main/java/org/jboss/portal/common/util/MarkupInfo.java 2008-03-19
00:41:18 UTC (rev 10321)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.common.util;
+import org.jboss.portal.common.net.media.MediaType;
+
/**
* Extends content to describe markup content.
*