/*
 * Copyright (c) 2012, United States Government, as represented by the Secretary of Health and Human Services. 
 * All rights reserved. 
 *
 * Redistribution and use in source and binary forms, with or without 
 * modification, are permitted provided that the following conditions are met: 
 *     * Redistributions of source code must retain the above 
 *       copyright notice, this list of conditions and the following disclaimer. 
 *     * Redistributions in binary form must reproduce the above copyright 
 *       notice, this list of conditions and the following disclaimer in the documentation 
 *       and/or other materials provided with the distribution. 
 *     * Neither the name of the United States Government nor the 
 *       names of its contributors may be used to endorse or promote products 
 *       derived from this software without specific prior written permission. 
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
 * DISCLAIMED. IN NO EVENT SHALL THE UNITED STATES GOVERNMENT BE LIABLE FOR ANY 
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
 */
package gov.hhs.fha.nhinc.properties;

import java.io.FileReader;
import java.io.File;

import java.text.SimpleDateFormat;
import java.util.Properties;
import java.util.Date;

import java.util.Iterator;
import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * 
 * @author dunnek
 */
public class HibernateAccessor {
    private static Log log = LogFactory.getLog(PropertyAccessor.class);
    private static final String CRLF = System.getProperty("line.separator");
    private static String m_sPropertyFileDir = "";
    private static boolean m_bFailedToLoadEnvVar = false;

    static {
        String sValue = PropertyAccessor.getPropertyFileLocation();
        if ((sValue != null) && (sValue.length() > 0)) {
            // Set it up so that we always have a "/" at the end - in case
            // ------------------------------------------------------------
            if ((sValue.endsWith("/")) || (sValue.endsWith("\\"))) {
                m_sPropertyFileDir = sValue;
            } else {
                String sFileSeparator = System.getProperty("file.separator");
                m_sPropertyFileDir = sValue + sFileSeparator;
            }
        } else {
            log.error("Failed to load Hibernate Directory");
            m_bFailedToLoadEnvVar = true;
        }
    }

    public static File getHibernateFile(String hibernateFileName) throws PropertyAccessException {
        String sFileSeparator = System.getProperty("file.separator");
        checkEnvVarSet();

        File result = new File(m_sPropertyFileDir + "hibernate" + sFileSeparator + hibernateFileName);

        if (result == null) {
            throw new PropertyAccessException("Unable to locate " + hibernateFileName);
        }
        return result;
    }

    private static boolean checkEnvVarSet() throws PropertyAccessException {
        if (m_bFailedToLoadEnvVar) {
            throw new PropertyAccessException("Failed to load Hibernate Directory");
        }

        return true; // We only get here if the env variable was loaded.
    }
}

@@ -1736,186 +1736,70 @@
 ort 
-java.io.FileReader;%0Aimport java.io.File;%0A%0Aimport java.text.SimpleDateFormat;%0Aimport java.util.Properties;%0Aimport java.util.Date;%0A%0Aimport java.util.Iterator;%0Aimport java.util.Set;
+gov.hhs.fha.nhinc.nhinclib.NullChecker;%0A%0Aimport java.io.File;%0A
 %0Aimp
@@ -2020,85 +2020,8 @@
 s);%0A
-    private static final String CRLF = System.getProperty(%22line.separator%22);%0A
     
@@ -2223,48 +2223,39 @@
 if (
-(sValue != null) && (sValue.length() %3E 0
+NullChecker.isNotNullish(sValue
 )) %7B
@@ -2421,17 +2421,16 @@
      if 
-(
 (sValue.
@@ -2442,39 +2442,22 @@
 ith(
-%22/%22)) %7C%7C (sValue.endsWith(%22%5C%5C%22)
+File.separator
 )) %7B
@@ -2527,86 +2527,8 @@
 e %7B%0A
-                String sFileSeparator = System.getProperty(%22file.separator%22);%0A
     
@@ -2569,22 +2569,22 @@
 Value + 
-s
 File
-S
+.s
 eparator
@@ -2839,78 +2839,8 @@
 n %7B%0A
-        String sFileSeparator = System.getProperty(%22file.separator%22);%0A
     
@@ -2932,14 +2932,14 @@
 %22 + 
-s
 File
-S
+.s
 epar
@@ -2982,22 +2982,24 @@
 if (
+!
 result
- == null
+.exists()
 ) %7B%0A

Fix dead block of code and check for File.exist instead.