abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r443090 - /incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/MimeTypeHelper.java
Date Wed, 13 Sep 2006 19:35:14 GMT
Author: jmsnell
Date: Wed Sep 13 12:35:14 2006
New Revision: 443090

URL: http://svn.apache.org/viewvc?view=rev&rev=443090
Log:
WILDCARD as a static.  Unfortunately the MimeType constructor throws an exception we need
to catch
so we have to have a method to create the wildcard.

Modified:
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/MimeTypeHelper.java

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/MimeTypeHelper.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/MimeTypeHelper.java?view=diff&rev=443090&r1=443089&r2=443090
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/MimeTypeHelper.java
(original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/MimeTypeHelper.java
Wed Sep 13 12:35:14 2006
@@ -30,6 +30,16 @@
 
 public class MimeTypeHelper {
    
+  private static final MimeType WILDCARD = createWildcard();
+  
+  private static MimeType createWildcard() {
+    try {
+      return new MimeType("*/*");
+    } catch (Exception e) {
+      return null; // Won't happen
+    }
+  }
+  
   public static boolean isMatch(String a, String b) {
     if ((a == null || a.length() == 0) && 
         (b == null || b.length() == 0)) 
@@ -45,7 +55,6 @@
   
   public static boolean isMatch(MimeType a, MimeType b) {
     try {
-      final MimeType WILDCARD = new MimeType("*/*");
       if (a == null || b == null) return true;
       if (a.match(b)) return true;
       if (a.equals(WILDCARD)) return true;



Mime
View raw message