2 Replies Latest reply on Sep 10, 2006 6:46 PM by starksm64

    LinkHandler - small fixes

    alesj

      I added a fis.close() in LinkHandler:

       public LinkHandler(FileSystemContext context, VirtualFileHandler parent, File file, URI uri)
       throws IOException
       {
       super(context, parent, file, uri);
       // Read the link info from the file
       FileInputStream fis = new FileInputStream(file);
       try
       {
       links = VFSUtils.readLinkInfo(fis, file.getName());
       }
       catch (URISyntaxException e)
       {
       IOException ex = new IOException();
       ex.initCause(e);
       throw ex;
       }
       finally
       {
       fis.close();
       }
       }
      


      and there should be some 'for loop' breaking in VFSUtils

       public static void parseLinkProperties(InputStream is, List<LinkInfo> info)
       throws IOException, URISyntaxException
       {
       Properties props = new Properties();
       props.load(is);
       // Iterate over the property tuples
       for(int n = 0; ; n ++)
       {
       String nameKey = "link.name." + n;
       String name = props.getProperty(nameKey);
       String uriKey = "link.uri." + n;
       String uri = props.getProperty(uriKey);
       // fixme - should break this 'for loop'
       if (name == null || uri == null)
       {
       break;
       }
       LinkInfo link = new LinkInfo(name, new URI(uri));
       info.add(link);
       }
       }
      


      Scott, I hope this is ok with you?

      Rgds, Ales