Author: oheger
Date: Sat Apr 18 19:08:35 2015
New Revision: 1674562
URL: http://svn.apache.org/r1674562
Log:
Fixed null checks reported by findbugs.
Some methods were partly checking for null references, but de facto assuming
that parameters are not null. The checks were removed, and the documentation
now states that these parameters must not be null.
Modified:
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/io/FileLocatorUtils.java
Modified:
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/io/FileLocatorUtils.java
URL:
http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/io/FileLocatorUtils.java?rev=1674562&r1=1674561&r2=1674562&view=diff
==============================================================================
---
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/io/FileLocatorUtils.java
(original)
+++
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/io/FileLocatorUtils.java
Sat Apr 18 19:08:35 2015
@@ -425,7 +425,7 @@ public final class FileLocatorUtils
* name.
*
* @param basePath the base path
- * @param fileName the file name
+ * @param fileName the file name (must not be <b>null</b>)
* @return the file object (<b>null</b> if no file can be obtained)
*/
static File getFile(String basePath, String fileName)
@@ -550,22 +550,17 @@ public final class FileLocatorUtils
* {@code getURL()} does not seem to be a valid URL.
*
* @param basePath the base path
- * @param fileName the file name
+ * @param fileName the file name (must not be <b>null</b>)
* @return the resulting file
*/
static File constructFile(String basePath, String fileName)
{
File file;
- File absolute = null;
- if (fileName != null)
+ File absolute = new File(fileName);
+ if (StringUtils.isEmpty(basePath) || absolute.isAbsolute())
{
- absolute = new File(fileName);
- }
-
- if (StringUtils.isEmpty(basePath) || (absolute != null &&
absolute.isAbsolute()))
- {
- file = new File(fileName);
+ file = absolute;
}
else
{