Author: mattmann
Date: Sun Jun  5 06:05:53 2011
New Revision: 1131920

URL: http://svn.apache.org/viewvc?rev=1131920&view=rev
Log:
- fix for OODT-191 PushPull FileRetrievalSystem NPE if mime comment for type 
doesn't include ampersand

Modified:
    oodt/trunk/CHANGES.txt
    
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/FileRetrievalSystem.java

Modified: oodt/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/oodt/trunk/CHANGES.txt?rev=1131920&r1=1131919&r2=1131920&view=diff
==============================================================================
--- oodt/trunk/CHANGES.txt (original)
+++ oodt/trunk/CHANGES.txt Sun Jun  5 06:05:53 2011
@@ -4,6 +4,9 @@ Apache OODT Change Log
 Release 0.3-SNAPSHOT (in progress)
 --------------------------------------------
 
+* OODT-191 PushPull FileRetrievalSystem NPE if mime comment for type doesn't 
+  include ampersand (mattmann, bfoster) 
+
 * OODT-184 Add ability to poll the load of any particular node (Gabe Resneck 
via mattmann)
 
 * OODT-60 Annoying build warnings about dependencies that 

Modified: 
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/FileRetrievalSystem.java
URL: 
http://svn.apache.org/viewvc/oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/FileRetrievalSystem.java?rev=1131920&r1=1131919&r2=1131920&view=diff
==============================================================================
--- 
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/FileRetrievalSystem.java
 (original)
+++ 
oodt/trunk/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/FileRetrievalSystem.java
 Sun Jun  5 06:05:53 2011
@@ -423,10 +423,16 @@ public class FileRetrievalSystem {
             String description = this.mimeTypeDetection
                     .getDescriptionForMimeType(mimeType);
             if (description != null) {
-               for (String field : description.split("\\&\\&")) {
-                       String[] keyval = field.split("\\=");
-                       remoteFile.addMetadata(keyval[0].trim(), 
keyval[1].trim());
-               }   
+              if(description.indexOf("&") != -1){
+                for (String field : description.split("\\&\\&")) {
+                  String[] keyval = field.split("\\=");
+                  remoteFile.addMetadata(keyval[0].trim(), keyval[1].trim());
+                }                   
+              }
+              else{
+                // it's the ProductType
+                remoteFile.addMetadata(RemoteFile.PRODUCT_TYPE, description);
+              }
                if (remoteFile.getMetadata(RemoteFile.UNIQUE_ELEMENT) != null)
                        uniqueMetadataElement = 
remoteFile.getMetadata(RemoteFile.UNIQUE_ELEMENT);
             }


Reply via email to