[jboss-dev-forums] [Design of POJO Server] - LinkHandler - small fixes

alesj do-not-reply at jboss.com
Sun Sep 10 09:44:37 EDT 2006


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

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3970608#3970608

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3970608



More information about the jboss-dev-forums mailing list