Trevor Pounds commented on SIGAR-227: -------------------------------------
Sorry for the weird formatting in the description. It looks like text formatting is not enabled for the JIRA description content.
> Invalid file causes org.hyperic.sigar.FileWatcher.add to fail before list is fully processed > -------------------------------------------------------------------------------------------- > > Key: SIGAR-227 > URL: http://jira.hyperic.com/browse/SIGAR-227 > Project: Sigar > Issue Type: Bug > Affects Versions: 1.6.4 > Reporter: Trevor Pounds > Assignee: Doug MacEachern > Priority: Major > > The org.hyperic.sigar.FileWatcher class will fail to add the full list of files if a file is invalid. The invalid file causes the loop within org.hyperic.sigar.FileWatcher.add(File[]) to abort with org.hyperic.sigar.SigarFileNotFoundException before the remaining files in the list are tried. > The following code can be used to exhibit the bug. > {code:java} > try { > FileWatcher watcher = new FileWatcher(); > watcher.add(new String[] { "BAD_FILE", "GOOD_FILE" }); > } catch (SigarFileNotFoundException e) > e.printStackTrace(); > } > {code} > Which results in the following stack trace. > {noformat} > org.hyperic.sigar.SigarFileNotFoundException: BAD_FILE: No such file or directory > at org.hyperic.sigar.FileAttrs.gather(Native Method) > at org.hyperic.sigar.FileInfo.fetchInfo(FileInfo.java:432) > at org.hyperic.sigar.FileInfo.fetchFileInfo(FileInfo.java:452) > at org.hyperic.sigar.Sigar.getFileInfo(Sigar.java:731) > at org.hyperic.sigar.FileWatcher.add(FileWatcher.java:63) > at org.hyperic.sigar.FileTail.add(FileTail.java:92) > at org.hyperic.sigar.FileWatcher.add(FileWatcher.java:78) > ... > {noformat}
> Invalid file causes org.hyperic.sigar.FileWatcher.add to fail before list is fully processed > -------------------------------------------------------------------------------------------- > > Key: SIGAR-227 > URL: http://jira.hyperic.com/browse/SIGAR-227 > Project: Sigar > Issue Type: Bug > Affects Versions: 1.6.4 > Reporter: Trevor Pounds > Assignee: Doug MacEachern > Priority: Major > Attachments: SIGAR-227.diff > > > The org.hyperic.sigar.FileWatcher class will fail to add the full list of files if a file is invalid. The invalid file causes the loop within org.hyperic.sigar.FileWatcher.add(File[]) to abort with org.hyperic.sigar.SigarFileNotFoundException before the remaining files in the list are tried. > The following code can be used to exhibit the bug. > {code:java} > try { > FileWatcher watcher = new FileWatcher(); > watcher.add(new String[] { "BAD_FILE", "GOOD_FILE" }); > } catch (SigarFileNotFoundException e) > e.printStackTrace(); > } > {code} > Which results in the following stack trace. > {noformat} > org.hyperic.sigar.SigarFileNotFoundException: BAD_FILE: No such file or directory > at org.hyperic.sigar.FileAttrs.gather(Native Method) > at org.hyperic.sigar.FileInfo.fetchInfo(FileInfo.java:432) > at org.hyperic.sigar.FileInfo.fetchFileInfo(FileInfo.java:452) > at org.hyperic.sigar.Sigar.getFileInfo(Sigar.java:731) > at org.hyperic.sigar.FileWatcher.add(FileWatcher.java:63) > at org.hyperic.sigar.FileTail.add(FileTail.java:92) > at org.hyperic.sigar.FileWatcher.add(FileWatcher.java:78) > ... > {noformat}