Revision: 17641
          http://sourceforge.net/p/gate/code/17641
Author:   markagreenwood
Date:     2014-03-12 15:58:21 +0000 (Wed, 12 Mar 2014)
Log Message:
-----------
call toString instead of casting to String as there is no guarantee that the 
persistance ID is a String given that the interface defines the ID as an Object 
-- maybe we should change the interface to String instead but this is a safe 
first step

Modified Paths:
--------------
    gate/trunk/src/main/gate/persist/SerialDataStore.java

Modified: gate/trunk/src/main/gate/persist/SerialDataStore.java
===================================================================
--- gate/trunk/src/main/gate/persist/SerialDataStore.java       2014-03-12 
14:13:54 UTC (rev 17640)
+++ gate/trunk/src/main/gate/persist/SerialDataStore.java       2014-03-12 
15:58:21 UTC (rev 17641)
@@ -499,7 +499,7 @@
     }
 
     // create a File to representing the resource storage file
-    File resourceFile = new File(resourceTypeDirectory, 
(String)lrPersistenceId);
+    File resourceFile = new File(resourceTypeDirectory, 
lrPersistenceId.toString());
     if(! resourceFile.exists() || ! resourceFile.isFile())
       throw new PersistenceException("Can't find file " + resourceFile);
 
@@ -581,11 +581,11 @@
   /** Get the name of an LR from its ID. */
   @Override
   public String getLrName(Object lrId) {
-    int secondSeparator = ((String) lrId).lastIndexOf("___");
-    lrId = ((String) lrId).substring(0, secondSeparator);
-    int firstSeparator = ((String) lrId).lastIndexOf("___");
-
-    return ((String) lrId).substring(0, firstSeparator);
+    String sLRid = lrId.toString();
+    int secondSeparator = sLRid.lastIndexOf("___");
+    lrId = sLRid.substring(0, secondSeparator);
+    int firstSeparator = sLRid.lastIndexOf("___");
+    return sLRid.substring(0, firstSeparator);
   } // getLrName
 
   /** Set method for the autosaving behaviour of the data store.

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to