Browse Source

Fix potential NPEs

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274920 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 22 years ago
parent
commit
dc8100463d
3 changed files with 16 additions and 10 deletions
  1. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/KeySubst.java
  2. +7
    -4
      src/main/org/apache/tools/ant/types/selectors/ContainsRegexpSelector.java
  3. +7
    -4
      src/main/org/apache/tools/ant/types/selectors/ContainsSelector.java

+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/KeySubst.java View File

@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000,2002 The Apache Software Foundation. All rights
* Copyright (c) 2000,2002-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -123,7 +123,7 @@ public class KeySubst extends Task {
// ignore
}
}
if (bw != null) {
if (br != null) {
try {
br.close();
} catch (IOException e) {


+ 7
- 4
src/main/org/apache/tools/ant/types/selectors/ContainsRegexpSelector.java View File

@@ -172,10 +172,13 @@ public class ContainsRegexpSelector extends BaseExtendSelector {
} catch (IOException ioe) {
throw new BuildException("Could not read file " + filename);
} finally {
try {
in.close();
} catch (Exception e) {
throw new BuildException("Could not close file " + filename);
if (in != null) {
try {
in.close();
} catch (Exception e) {
throw new BuildException("Could not close file "
+ filename);
}
}
}
}


+ 7
- 4
src/main/org/apache/tools/ant/types/selectors/ContainsSelector.java View File

@@ -214,10 +214,13 @@ public class ContainsSelector extends BaseExtendSelector {
} catch (IOException ioe) {
throw new BuildException("Could not read file " + filename);
} finally {
try {
in.close();
} catch (Exception e) {
throw new BuildException("Could not close file " + filename);
if (in != null) {
try {
in.close();
} catch (Exception e) {
throw new BuildException("Could not close file "
+ filename);
}
}
}
}


Loading…
Cancel
Save