public static String fixPropertyValue(String string, boolean bResourceListBundle)
    {
        if (string == null)
            string = Constants.BLANK;
        StringBuffer strBuff = new StringBuffer();
        StringReader stringReader = new StringReader(string);
        LineNumberReader lineReader = new LineNumberReader(stringReader);
        boolean bFirstTime = true;
        String strLine;
        try   {
            while ((strLine = lineReader.readLine()) != null)
            {
                if (!bFirstTime)
                {
                    if (bResourceListBundle)
                        strBuff.append(" + \"\\n\" +" + "\n\t\t");
                    else
                        strBuff.append("\\n\\\n");
                }
                if (bResourceListBundle)
                    strBuff.append('\"');
                if (!bFirstTime)
                    if (!bResourceListBundle)
                        if (strLine.startsWith(" "))
                            strBuff.append("\\"); // Escape out the first space for properties files
                strBuff.append(ResourcesUtilities.encodeLine(strLine, bResourceListBundle));
                if (bResourceListBundle)
                    strBuff.append("\"");
                bFirstTime = false;
            }
        } catch (IOException ex)    {
            ex.printStackTrace(); // Never
        }
        return strBuff.toString();
    }
public static String fixPropertyValue ( String string , boolean bResourceListBundle ) { if ( string == null ) string = Constants . BLANK ; StringBuffer strBuff = new StringBuffer ( ) ; StringReader stringReader = new StringReader ( string ) ; LineNumberReader lineReader = new LineNumberReader ( stringReader ) ; boolean bFirstTime = true ; String strLine ; try { while ( ( strLine = lineReader . readLine ( ) ) != null ) { if ( ! bFirstTime ) { if ( bResourceListBundle ) strBuff . append ( " + \"\\n\" +" + "\n\t\t" ) ; else strBuff . append ( "\\n\\\n" ) ; } if ( bResourceListBundle ) strBuff . append ( '\"' ) ; if ( ! bFirstTime ) if ( ! bResourceListBundle ) if ( strLine . startsWith ( " " ) ) strBuff . append ( "\\" ) ; strBuff . append ( ResourcesUtilities . encodeLine ( strLine , bResourceListBundle ) ) ; if ( bResourceListBundle ) strBuff . append ( "\"" ) ; bFirstTime = false ; } } catch ( IOException ex ) { ex . printStackTrace ( ) ; } return strBuff . toString ( ) ; }
Clean up this long string and convert it to a java quoted string.