bodewig 2003/07/24 05:53:35 Modified: src/main/org/apache/tools/ant/taskdefs KeySubst.java src/main/org/apache/tools/ant/types/selectors ContainsRegexpSelector.java ContainsSelector.java Log: Fix potential NPEs Revision Changes Path 1.20 +2 -2 ant/src/main/org/apache/tools/ant/taskdefs/KeySubst.java Index: KeySubst.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/KeySubst.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- KeySubst.java 19 Jul 2003 08:10:59 -0000 1.19 +++ KeySubst.java 24 Jul 2003 12:53:34 -0000 1.20 @@ -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 @@ // ignore } } - if (bw != null) { + if (br != null) { try { br.close(); } catch (IOException e) { 1.4 +7 -4 ant/src/main/org/apache/tools/ant/types/selectors/ContainsRegexpSelector.java Index: ContainsRegexpSelector.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/selectors/ContainsRegexpSelector.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ContainsRegexpSelector.java 4 Jul 2003 23:18:49 -0000 1.3 +++ ContainsRegexpSelector.java 24 Jul 2003 12:53:35 -0000 1.4 @@ -172,10 +172,13 @@ } 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); + } } } } 1.9 +7 -4 ant/src/main/org/apache/tools/ant/types/selectors/ContainsSelector.java Index: ContainsSelector.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/selectors/ContainsSelector.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- ContainsSelector.java 19 Jul 2003 11:20:22 -0000 1.8 +++ ContainsSelector.java 24 Jul 2003 12:53:35 -0000 1.9 @@ -214,10 +214,13 @@ } 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); + } } } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]