add SigarException.setMessage and use in FileInfo to include file name
This commit is contained in:
parent
2dcff7e5c9
commit
fdb740265a
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue