Buggy code:
public class PaymentCalculatorUtil { private static Log _log = LogFactory . getLog ( PaymentCalculatorUtil . class ) ; public static Double getDoubleFromCurrency ( String currencyString ) { } public static long getLongFromCurrency ( String currencyString ) { } public static CreditApp populateAppFromRequest ( ActionRequest actionRequest , CreditApp creditApp ) { } public static CreditAppBankReference populateBankReferenceFromJsonString ( String referenceJson , CreditAppBankReference reference ) throws JSONException { } public static CreditAppPrincipal populatePrincipalFromJsonString ( String principalJson , CreditAppPrincipal principal ) throws JSONException { } public static void generateCreditAppXML ( CreditApp creditApp , String path ) { PaymentCalculatorUtil . _log . info ( "generateCreditAppXML<seq2seq4repair_space>running..." ) ; String creditAppXML = "" ; creditAppXML += "<?xml<seq2seq4repair_space>version=\"1.0\"<seq2seq4repair_space>encoding=\"UTF-8\"?>" ; creditAppXML += "<CreditApp>" ; creditAppXML += creditApp . toXmlString ( ) ; try { creditAppXML += "<CreditAppPrincipals>" ; List < CreditAppPrincipal > principals = CreditAppPrincipalLocalServiceUtil . getCreditAppPrincipalByCreditAppId ( creditApp . getCreditAppId ( ) ) ; PaymentCalculatorUtil . _log . info ( ( "generateCreditAppXML<seq2seq4repair_space>principals" + ( principals . toString ( ) ) ) ) ; if ( ( principals != null ) && ( ! ( principals . isEmpty ( ) ) ) ) { for ( CreditAppPrincipal principal : principals ) { creditAppXML += principal . toXmlString ( ) ; } } creditAppXML += "<//CreditAppPrincipals>" ; creditAppXML += "<CreditAppBankReferences>" ; List < CreditAppBankReference > bankReferences = CreditAppBankReferenceLocalServiceUtil . getCreditAppBankReferenceByCreditApp ( creditApp . getCreditAppId ( ) ) ; PaymentCalculatorUtil . _log . info ( ( "generateCreditAppXML<seq2seq4repair_space>bankReferences" + ( bankReferences . toString ( ) ) ) ) ; if ( ( bankReferences != null ) && ( ! ( bankReferences . isEmpty ( ) ) ) ) { for ( CreditAppBankReference bankReference : bankReferences ) { creditAppXML += bankReference . toXmlString ( ) ; } } creditAppXML += "<//CreditAppBankReferences>" ; creditAppXML += "<PurchaseOption>" ; PurchaseOption purchaseOption = PurchaseOptionLocalServiceUtil . getPurchaseOption ( creditApp . getPurchaseOptionId ( ) ) ; PaymentCalculatorUtil . _log . info ( ( "generateCreditAppXML<seq2seq4repair_space>purchaseOption" + purchaseOption ) ) ; if ( purchaseOption != null ) creditAppXML += purchaseOption . toXmlString ( ) ; creditAppXML += "<//PurchaseOption>" ; creditAppXML += "<Term>" ; Term term = TermLocalServiceUtil . getTerm ( creditApp . getTermId ( ) ) ; PaymentCalculatorUtil . _log . info ( ( "generateCreditAppXML<seq2seq4repair_space>term" + term ) ) ; if ( term != null ) creditAppXML += term . toXmlString ( ) ; creditAppXML += "<//Term>" ; creditAppXML += "<Product>" ; Product product = ProductLocalServiceUtil . getProduct ( creditApp . getProductId ( ) ) ; PaymentCalculatorUtil . _log . info ( ( "generateCreditAppXML<seq2seq4repair_space>product" + product ) ) ; if ( product != null ) creditAppXML += product . toXmlString ( ) ; creditAppXML += "<//Product>" ; creditAppXML += "<RateFactorRule>" ; RateFactorRule rateFactorRule = RateFactorRuleLocalServiceUtil . getRateFactorRule ( creditApp . getRateFactorRuleId ( ) ) ; PaymentCalculatorUtil . _log . info ( ( "generateCreditAppXML<seq2seq4repair_space>rateFactorRule" + rateFactorRule ) ) ; if ( rateFactorRule != null ) creditAppXML += rateFactorRule . toXmlString ( ) ; creditAppXML += "<//RateFactorRule>" ; creditAppXML += "<Vendor>" ; try { Group group = GroupLocalServiceUtil . getGroup ( creditApp . getVendorId ( ) ) ; PaymentCalculatorUtil . _log . info ( ( "generateCreditAppXML<seq2seq4repair_space>group" + group ) ) ; ExpandoBridge bridge = group . getExpandoBridge ( ) ; PaymentCalculatorUtil . _log . info ( ( "generateCreditAppXML<seq2seq4repair_space>bridge" + bridge ) ) ; creditAppXML += "<model><model-name>com.liferay.portal.model.Group<//model-name>" ; creditAppXML += "<column><column-name>VendorName<//column-name><column-value><![CDATA[" ; creditAppXML += group . getName ( ) ; creditAppXML += "]]><//column-value><//column>" ; creditAppXML += "<column><column-name>VendorAddress<//column-name><column-value><![CDATA[" ; creditAppXML += ( ( bridge . getAttribute ( "Vendor<seq2seq4repair_space>Address" ) ) + "<seq2seq4repair_space>" ) + ( bridge . getAttribute ( "Vendor<seq2seq4repair_space>Address<seq2seq4repair_space>2" ) ) ; creditAppXML += "]]><//column-value><//column>" ; creditAppXML += "<column><column-name>Vendor<seq2seq4repair_space>Cit<//column-name><column-value><![CDATA[" ; creditAppXML += bridge . getAttribute ( "Vendor<seq2seq4repair_space>City" ) ; creditAppXML += "]]><//column-value><//column>" ; creditAppXML += "<column><column-name>VendorState<//column-name><column-value><![CDATA[" ; creditAppXML += bridge . getAttribute ( "Vendor<seq2seq4repair_space>State" ) ; creditAppXML += "]]><//column-value><//column>" ; creditAppXML += "<column><column-name>VendorZip<//column-name><column-value><![CDATA[" ; creditAppXML += bridge . getAttribute ( "Vendor<seq2seq4repair_space>Zip" ) ; creditAppXML += "]]><//column-value><//column>" ; creditAppXML += "<column><column-name>VendorPhone<//column-name><column-value><![CDATA[" ; creditAppXML += bridge . getAttribute ( "Vendor<seq2seq4repair_space>Phone" ) ; creditAppXML += "]]><//column-value><//column>" ; creditAppXML += "<//model>" ; } catch ( Exception ex ) { PaymentCalculatorUtil . _log . error ( "generateCreditAppXML<seq2seq4repair_space>error<seq2seq4repair_space>while<seq2seq4repair_space>getting<seq2seq4repair_space>vendor<seq2seq4repair_space>info.<seq2seq4repair_space>Please<seq2seq4repair_space>check<seq2seq4repair_space>custom<seq2seq4repair_space>fields<seq2seq4repair_space>for<seq2seq4repair_space>Vendor<seq2seq4repair_space>Info" ) ; } creditAppXML += "<//Vendor>" ; creditAppXML += "<//CreditApp>" ; DateFormat dateFormat = new SimpleDateFormat ( "MMddyyyy_HHmm" ) ; <START_BUG> String fileName = ( ( ( "..\\..\\..\\..\\..\\creditApps\\creditApp_" + ( creditApp . getCustomerName ( ) ) ) + "_" ) + ( dateFormat . format ( new Date ( ) ) ) ) + ".xml" ; <END_BUG> File generatedFile = new File ( ( path + fileName ) ) ; FileWriter fileWriter = new FileWriter ( generatedFile ) ; fileWriter . write ( creditAppXML ) ; fileWriter . close ( ) ; } catch ( IOException ioe ) { PaymentCalculatorUtil . _log . error ( ioe ) ; } catch ( Exception e ) { PaymentCalculatorUtil . _log . error ( ( "generateCreditAppXML<seq2seq4repair_space>generic<seq2seq4repair_space>exception<seq2seq4repair_space>" + e ) ) ; } } }

Fix:
String fileName = ( ( ( "..\\..\\..\\creditApps\\creditApp_" + ( creditApp . getCustomerName ( ) ) ) + "_" ) + ( dateFormat . format ( new Date ( ) ) ) ) + ".xml" ;