protected String prompt() { String prompt = System.getProperty(PROMPT_PROPERTY_NAME); final StringBuffer result = new StringBuffer(); boolean commandMode = false; try { StringReader reader = new StringReader(prompt); int i; while ((i = reader.read()) != -1) { char c = (char) i; if (commandMode) { switch (c) { case 'P': result.append(new File( (String) AccessController .doPrivileged(new GetPropertyAction( "user.dir")))); break; case 'G': result.append("> "); break; case 'D': final Date now = new Date(); DateFormat.getDateTimeInstance().format(now, result, null); break; default: result.append(c); } commandMode = false; } else { switch (c) { case '$': commandMode = true; break; default: result.append(c); } } } } catch (Exception ioex) {  log.error("Error in prompt()", ioex);
protected String prompt() { String prompt = System.getProperty(PROMPT_PROPERTY_NAME); final StringBuffer result = new StringBuffer(); boolean commandMode = false; try { StringReader reader = new StringReader(prompt); int i; while ((i = reader.read()) != -1) { char c = (char) i; if (commandMode) { switch (c) { case 'P': result.append(new File((String) AccessController .doPrivileged(new GetPropertyAction("user.dir")))); break; case 'G': result.append("> "); break; case 'D': final Date now = new Date(); DateFormat.getDateTimeInstance().format(now, result, null); break; default: result.append(c); } commandMode = false;
    protected String prompt() {        String prompt = System.getProperty(PROMPT_PROPERTY_NAME);        final StringBuffer result = new StringBuffer();        boolean commandMode = false;        try {            StringReader reader = new StringReader(prompt);            int i;            while ((i = reader.read()) != -1) {                char c = (char) i;                if (commandMode) {                    switch (c) {                    case 'P':                        result.append(new File(                                (String) AccessController                                        .doPrivileged(new GetPropertyAction(                                                "user.dir"))));                        break;                    case 'G':                        result.append("> ");                        break;                    case 'D':                        final Date now = new Date();                        DateFormat.getDateTimeInstance().format(now, result,                                null);                        break;                    default:                        result.append(c);                    }                    commandMode = false;                } else {                    switch (c) {                    case '$':                        commandMode = true;                        break;                    default:                        result.append(c);                    }                }            }        } catch (Exception ioex) {            // This should never occur            log.error("Error in prompt()", ioex);        }        return result.toString();    }