You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by ma...@apache.org on 2011/02/10 16:05:39 UTC

svn commit: r1069417 - in /oodt/trunk: CHANGES.txt filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Reference.java filemgr/src/test/org/apache/oodt/cas/filemgr/structs/TestReference.java

Author: mattmann
Date: Thu Feb 10 15:05:38 2011
New Revision: 1069417

URL: http://svn.apache.org/viewvc?rev=1069417&view=rev
Log:
- fix for OODT-136 Lack of cataloged mime type causes recoverable exception in Reference core class

Modified:
    oodt/trunk/CHANGES.txt
    oodt/trunk/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Reference.java
    oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/structs/TestReference.java

Modified: oodt/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/oodt/trunk/CHANGES.txt?rev=1069417&r1=1069416&r2=1069417&view=diff
==============================================================================
--- oodt/trunk/CHANGES.txt (original)
+++ oodt/trunk/CHANGES.txt Thu Feb 10 15:05:38 2011
@@ -4,6 +4,9 @@ Apache OODT Change Log
 Release 0.3-SNAPSHOT (in progress)
 --------------------------------------------
 
+* OODT-136 Lack of cataloged mime type causes recoverable exception in 
+  Reference core class (mattmann)
+
 * OODT-134 Update website with News of Release 0.2 and links for download (goodale)
 
 * OODT-128 CAS workflow monitor webapp fails to load due to unparsable 

Modified: oodt/trunk/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Reference.java
URL: http://svn.apache.org/viewvc/oodt/trunk/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Reference.java?rev=1069417&r1=1069416&r2=1069417&view=diff
==============================================================================
--- oodt/trunk/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Reference.java (original)
+++ oodt/trunk/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Reference.java Thu Feb 10 15:05:38 2011
@@ -210,6 +210,9 @@ public class Reference {
      *            the String name of the mimetype of this reference
      */
     public void setMimeType(String name) {
+        if(name == null || (name != null && 
+            name.equals(""))) return;
+        
         try {
           this.mimeType = mimeTypeRepository.forName(name);
         } catch (MimeTypeException e) {

Modified: oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/structs/TestReference.java
URL: http://svn.apache.org/viewvc/oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/structs/TestReference.java?rev=1069417&r1=1069416&r2=1069417&view=diff
==============================================================================
--- oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/structs/TestReference.java (original)
+++ oodt/trunk/filemgr/src/test/org/apache/oodt/cas/filemgr/structs/TestReference.java Thu Feb 10 15:05:38 2011
@@ -48,5 +48,22 @@ public class TestReference extends TestC
     assertNotNull(r.getMimeType());
     assertEquals("application/x-hdf", r.getMimeType().getName());
   }
+  
+  /**
+   * @since OODT-136
+   */
+  public void testSetNullMimeType(){
+    Reference r = new Reference("file:///tmp/test.he5",
+        "file:///archive/test.he5/test.he5", 0L);
+    
+    String nullType = null;
+    try{
+      r.setMimeType("");
+      r.setMimeType(nullType);
+    }
+    catch(Exception e){
+      fail(e.getMessage());
+    }
+  }
 
 }