Source:
private void dohandle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { if (callbacks.length == 1 && callbacks[0] instanceof NameCallback) { ((NameCallback) callbacks[0]).setName("anonymous CLI user"); return; } for (Callback current : callbacks) { if (current instanceof RealmCallback) { RealmCallback rcb = (RealmCallback) current; String defaultText = rcb.getDefaultText(); realm = defaultText; rcb.setText(defaultText); } else if (current instanceof RealmChoiceCallback) { throw new UnsupportedCallbackException(current, "Realm choice not currently supported."); } else if (current instanceof NameCallback) { NameCallback ncb = (NameCallback) current; if (username == null) { showRealm(); try { console.setCompletion(false); console.getHistory().setUseHistory(false); username = readLine("Username: ", false); console.getHistory().setUseHistory(true); console.setCompletion(true); } catch (CommandLineException e) { throw new IOException("Failed to read username.", e); } if (username == null || username.length() == 0) { throw new SaslException("No username supplied."); } } connInfoBean.setUsername(username); ncb.setName(username); } else if (current instanceof PasswordCallback && digest == null) { PasswordCallback pcb = (PasswordCallback) current; if (password == null) { showRealm(); String temp; try { console.setCompletion(false); console.getHistory().setUseHistory(false); temp = readLine("Password: ", true); console.getHistory().setUseHistory(true); console.setCompletion(true); } catch (CommandLineException e) { throw new IOException("Failed to read password.", e); } if (temp != null) { password = temp.toCharArray(); } } try { Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } pcb.setPassword(password); } else if (current instanceof DigestHashCallback && digest != null) { DigestHashCallback dhc = (DigestHashCallback) current; dhc.setHexHash(digest); } else { error("Unexpected Callback " + current.getClass().getName()); throw new UnsupportedCallbackException(current); } } }

Target:
private void dohandle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { if (callbacks.length == 1 && callbacks[0] instanceof NameCallback) { ((NameCallback) callbacks[0]).setName("anonymous CLI user"); return; } for (Callback current : callbacks) { if (current instanceof RealmCallback) { RealmCallback rcb = (RealmCallback) current; String defaultText = rcb.getDefaultText(); realm = defaultText; rcb.setText(defaultText); } else if (current instanceof RealmChoiceCallback) { throw new UnsupportedCallbackException(current, "Realm choice not currently supported."); } else if (current instanceof NameCallback) { NameCallback ncb = (NameCallback) current; if (username == null) { showRealm(); try { console.setCompletion(false); console.getHistory().setUseHistory(false); username = readLine("Username: ", false); console.getHistory().setUseHistory(true); console.setCompletion(true); } catch (CommandLineException e) { throw new IOException("Failed to read username.", e); } if (username == null || username.length() == 0) { throw new SaslException("No username supplied."); } } connInfoBean.setUsername(username); ncb.setName(username); } else if (current instanceof PasswordCallback && digest == null) { PasswordCallback pcb = (PasswordCallback) current; if (password == null) { showRealm(); String temp; try { console.setCompletion(false); console.getHistory().setUseHistory(false); temp = readLine("Password: ", true); console.getHistory().setUseHistory(true); console.setCompletion(true); } catch (CommandLineException e) { throw new IOException("Failed to read password.", e); } if (temp != null) { password = temp.toCharArray(); } } pcb.setPassword(password); } else if (current instanceof DigestHashCallback && digest != null) { DigestHashCallback dhc = (DigestHashCallback) current; dhc.setHexHash(digest); } else { error("Unexpected Callback " + current.getClass().getName()); throw new UnsupportedCallbackException(current); } } }