Author: ross.gardler
Date: Fri Sep 12 15:34:23 2008
New Revision: 1303

Modified:
     
trunk/uk.ac.osswatch.simal.core/src/main/java/uk/ac/osswatch/simal/model/jena/Person.java
     
trunk/uk.ac.osswatch.simal.core/src/main/java/uk/ac/osswatch/simal/rdf/AbstractSimalRepository.java
     
trunk/uk.ac.osswatch.simal.core/src/main/java/uk/ac/osswatch/simal/rdf/jena/SimalRepository.java

Log:
@refactor Remove some findbugs errors

Modified:  
trunk/uk.ac.osswatch.simal.core/src/main/java/uk/ac/osswatch/simal/model/jena/Person.java
==============================================================================
---  
trunk/uk.ac.osswatch.simal.core/src/main/java/uk/ac/osswatch/simal/model/jena/Person.java
        
(original)
+++  
trunk/uk.ac.osswatch.simal.core/src/main/java/uk/ac/osswatch/simal/model/jena/Person.java
        
Fri Sep 12 15:34:23 2008
@@ -202,10 +202,6 @@
      Set<String> names = getNames();
      if (names.size() == 0) {
        names = getGivennames();
-    }
-    if (names == null) {
-      return toString();
-    } else {
        if (names.size() == 0) {
          return getURI();
        }

Modified:  
trunk/uk.ac.osswatch.simal.core/src/main/java/uk/ac/osswatch/simal/rdf/AbstractSimalRepository.java
==============================================================================
---  
trunk/uk.ac.osswatch.simal.core/src/main/java/uk/ac/osswatch/simal/rdf/AbstractSimalRepository.java
      
(original)
+++  
trunk/uk.ac.osswatch.simal.core/src/main/java/uk/ac/osswatch/simal/rdf/AbstractSimalRepository.java
      
Fri Sep 12 15:34:23 2008
@@ -38,7 +38,6 @@
    private static final Logger logger = LoggerFactory
        .getLogger(AbstractSimalRepository.class);

-  protected static ISimalRepository instance;
    protected boolean isTest = false;
    protected boolean initialised;


Modified:  
trunk/uk.ac.osswatch.simal.core/src/main/java/uk/ac/osswatch/simal/rdf/jena/SimalRepository.java
==============================================================================
---  
trunk/uk.ac.osswatch.simal.core/src/main/java/uk/ac/osswatch/simal/rdf/jena/SimalRepository.java
         
(original)
+++  
trunk/uk.ac.osswatch.simal.core/src/main/java/uk/ac/osswatch/simal/rdf/jena/SimalRepository.java
         
Fri Sep 12 15:34:23 2008
@@ -71,6 +71,7 @@
    private static final Logger logger = LoggerFactory
        .getLogger(SimalRepository.class);

+  private static ISimalRepository instance;
    private transient Model model;

    /**
@@ -182,12 +183,14 @@
    public void add(String data) throws SimalRepositoryException {
      logger.debug("Adding RDF data string:\n\t" + data);

-    File file = new File("testingAddData.rdf");
+    File file = new File("tempData.rdf");
+    FileWriter fw = null;
+    BufferedWriter bw = null;
      try {
-      FileWriter fw = new FileWriter(file);
-      BufferedWriter bw = new BufferedWriter(fw);
+      fw = new FileWriter(file);
+      bw = new BufferedWriter(fw);
        bw.write(data);
-      bw.close();
+      bw.flush();

        addProject(file.toURI().toURL(), "");
      } catch (MalformedURLException mue) {
@@ -198,7 +201,24 @@
        throw new SimalRepositoryException(
            "Unable to write file from data string", e);
      } finally {
-      file.delete();
+      if (bw != null) {
+        try {
+          bw.close();
+        } catch (IOException e) {
+          logger.warn("Unable to close writer", e);
+        }
+      }
+      if (fw != null) {
+        try {
+          fw.close();
+        } catch (IOException e) {
+          logger.warn("Unable to close writer", e);
+        }
+      }
+      boolean deleted = file.delete();
+      if (!deleted) {
+        logger.warn("Failt to delete temporary file {}", file.toString());
+      }
      }

    }

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Simal Commits" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/simal-commits?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to