[jboss-jira] [JBoss JIRA] (JGRP-2169) PDC.java can NPE when calling deleteFile

Bela Ban (JIRA) issues at jboss.org
Tue May 9 01:24:00 EDT 2017


     [ https://issues.jboss.org/browse/JGRP-2169?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bela Ban resolved JGRP-2169.
----------------------------
    Resolution: Done


Fixed by removing the before trace statement

> 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}



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)


More information about the jboss-jira mailing list