]
Bela Ban updated JGRP-2169:
---------------------------
Fix Version/s: 4.0.3
PDC.java can NPE when calling deleteFile
----------------------------------------
Key: JGRP-2169
URL:
https://issues.jboss.org/browse/JGRP-2169
Project: JGroups
Issue Type: Bug
Affects Versions: 4.0.1
Reporter: Elias Ross
Assignee: Bela Ban
Fix For: 4.0.3
As seen in my logs:
{noformat}
[thread=jgroups-4,pv36d01ls-geo02042101-26405] [level=ERROR] [logger=unknown.jul.logger]
- JGRP000027: failed passing message up
java.lang.NullPointerException: null
at org.jgroups.protocols.PDC.deleteFile(PDC.java:271)
~[org.jgroups-jgroups-4.0.1.Final.jar:4.0.1.Final]
at org.jgroups.protocols.PDC.writeNodeToDisk(PDC.java:208)
~[org.jgroups-jgroups-4.0.1.Final.jar:4.0.1.Final]
at org.jgroups.protocols.PDC.down(PDC.java:89)
~[org.jgroups-jgroups-4.0.1.Final.jar:4.0.1.Final]
{noformat}
It seems that there are code paths where deleteFile can be called with a null parameter.
For example:
{code:java}
protected File writeToTempFile(File dir, Address logical_addr, Address physical_addr,
String logical_name) throws Exception {
DataOutputStream out=null;
File file=null;
String filename=null;
try {
file=File.createTempFile("temp", null, dir);
^^ If this fails, then file is null and delete is called with null
filename=file.getName();
...
}
catch(Exception e) {
Util.close(out);
log.error(Util.getMessage("FailedToWriteTemporaryFile") + filename,
e);
deleteFile(file);
return null;
}
{code}