add SigarException.setMessage and use in FileInfo to include file name

This commit is contained in:
Doug MacEachern 2007-01-23 00:42:18 +00:00
parent 2dcff7e5c9
commit fdb740265a
2 changed files with 27 additions and 7 deletions

View File

@ -425,6 +425,7 @@ public class FileInfo extends FileAttrs {
FileInfo info = new FileInfo();
try {
if (followSymlinks) {
info.gather(sigar, name);
info.lstat = false;
@ -433,6 +434,10 @@ public class FileInfo extends FileAttrs {
info.gatherLink(sigar, name);
info.lstat = true;
}
} catch (SigarException e) {
e.setMessage(name + ": " + e.getMessage());
throw e;
}
info.sigar = sigar;
info.name = name;

View File

@ -23,7 +23,22 @@ package org.hyperic.sigar;
*/
public class SigarException extends Exception {
private String message;
public SigarException () { super(); }
public SigarException (String s) { super(s); }
public String getMessage() {
if (this.message != null) {
return this.message;
}
else {
return super.getMessage();
}
}
void setMessage(String message) {
this.message = message;
}
}