I came across some code that uses reflection to get to the "path" variable in the FileInputStream!! Weirder part is that commons.lang.reflect.FieldUtils.readField(is, "path", true)
throws a java.lang.IllegalArgumentException
. That too intermittently... May be some specific scenario leads to that, but I am not able to figure out. Any pointers as to what could cause reflection to fail to "see" the Field?
The code is buried in lot of Cascading workflows related mumbo jumbo but here is the relevant part -
//This same method is invoked multiple times on same file. If it matters?
method(SourceCall<Object, InputStream> sc) {
InputStream is = sc.getInput();
if (is instanceof FileInputStream) {
FileInputStream fileInputStream = (FileInputStream)is;
//The line below throws IllegalArgumentException - sometimes
String fileName = (String)FieldUtils.readField(fileInputStream , "path", true);
return fileName;
}
}
Aucun commentaire:
Enregistrer un commentaire