add SigarException.setMessage and use in FileInfo to include file name
This commit is contained in:
parent
2dcff7e5c9
commit
fdb740265a
|
@ -425,13 +425,18 @@ public class FileInfo extends FileAttrs {
|
|||
|
||||
FileInfo info = new FileInfo();
|
||||
|
||||
if (followSymlinks) {
|
||||
info.gather(sigar, name);
|
||||
info.lstat = false;
|
||||
}
|
||||
else {
|
||||
info.gatherLink(sigar, name);
|
||||
info.lstat = true;
|
||||
try {
|
||||
if (followSymlinks) {
|
||||
info.gather(sigar, name);
|
||||
info.lstat = false;
|
||||
}
|
||||
else {
|
||||
info.gatherLink(sigar, name);
|
||||
info.lstat = true;
|
||||
}
|
||||
} catch (SigarException e) {
|
||||
e.setMessage(name + ": " + e.getMessage());
|
||||
throw e;
|
||||
}
|
||||
|
||||
info.sigar = sigar;
|
||||
|
|
|
@ -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