List of usage examples for twitter4j.auth RequestToken getAuthorizationURL
public String getAuthorizationURL()
From source file:com.twitter4rk.TwitterAuthFragment.java
License:Apache License
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mTwitterWebView = new WebView(getActivity()); final Bundle args = getArguments(); if (args == null) { // This wont be case because startTwitterAuth() handles args for // fragment throw new IllegalArgumentException( "No arguments passed to fragment, Please use startTwitterAuth(...) method for showing this fragment"); }//from w w w . j av a 2 s . c o m // Get builder from args mBuilder = args.getParcelable(BUILDER_KEY); // Hide action bar if (mBuilder.hideActionBar) mBuilder.activity.getActionBar().hide(); // Init progress dialog mProgressDialog = new ProgressDialog(mBuilder.activity); mProgressDialog.setMessage(mBuilder.progressText == null ? "Loading ..." : mBuilder.progressText); if (mBuilder.isProgressEnabled) mProgressDialog.show(); // Init ConfigurationBuilder twitter4j final ConfigurationBuilder cb = new ConfigurationBuilder(); if (mBuilder.isDebugEnabled) cb.setDebugEnabled(true); cb.setOAuthConsumerKey(mBuilder.consumerKey); cb.setOAuthConsumerSecret(mBuilder.consumerSecret); // Web view client to handler url loading mTwitterWebView.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { // Get url first final Uri uri = Uri.parse(url); // Check if we need to see for callback URL if (mBuilder.callbackUrl != null && url.contains(mBuilder.callbackUrl)) { // Get req info String oauthToken = uri.getQueryParameter("oauth_token"); String oauthVerifier = uri.getQueryParameter("oauth_verifier"); if (mListener != null) mListener.onSuccess(oauthToken, oauthVerifier); if (mBuilder.isActionBarVisible && mBuilder.hideActionBar && getActivity() != null) getActivity().getActionBar().show(); mIsAuthenticated = true; removeMe(); return true; // If no callback URL then check for info directly } else if (uri.getQueryParameter("oauth_token") != null && uri.getQueryParameter("oauth_verifier") != null) { // Get req info String oauthToken = uri.getQueryParameter("oauth_token"); String oauthVerifier = uri.getQueryParameter("oauth_verifier"); if (mListener != null) mListener.onSuccess(oauthToken, oauthVerifier); if (mBuilder.isActionBarVisible && mBuilder.hideActionBar && getActivity() != null) getActivity().getActionBar().show(); mIsAuthenticated = true; removeMe(); return true; // If nothing then its failure } else { // Notify user if (mListener != null) mListener.onFailure( new Exception("Couldn't find the callback URL or oath parameters in response")); if (mBuilder.isActionBarVisible && mBuilder.hideActionBar && getActivity() != null) getActivity().getActionBar().show(); removeMe(); return false; } } }); // Web Crome client to handler progress dialog visibility mTwitterWebView.setWebChromeClient(new WebChromeClient() { @Override public void onProgressChanged(WebView view, int newProgress) { if (newProgress == 100) { if (mProgressDialog.isShowing()) mProgressDialog.dismiss(); } } }); final Handler handler = new Handler(); new Thread(new Runnable() { @Override public void run() { try { final TwitterFactory twitterFactory = new TwitterFactory(cb.build()); final Twitter twitter = twitterFactory.getInstance(); RequestToken requestToken = null; if (mBuilder.callbackUrl == null) requestToken = twitter.getOAuthRequestToken(); else requestToken = twitter.getOAuthRequestToken(mBuilder.callbackUrl); final RequestToken finalRequestToken = requestToken; handler.post(new Runnable() { @Override public void run() { final String url = finalRequestToken.getAuthorizationURL(); mTwitterWebView.loadUrl(url); } }); } catch (TwitterException e) { e.printStackTrace(); } } }).start(); return mTwitterWebView; }
From source file:com.vuze.client.plugins.twitter.TwitterPlugin.java
License:Open Source License
public void initialize(PluginInterface _plugin_interface) { plugin_interface = _plugin_interface; String ac_str = plugin_interface.getPluginconfig().getPluginStringParameter("twitter.access.token", ""); String acs_str = plugin_interface.getPluginconfig().getPluginStringParameter("twitter.access.token.secret", "");//from ww w.j a v a 2s .c o m if (ac_str.length() > 0 && acs_str.length() > 0) { access_token = new AccessToken(ac_str, acs_str); } ta_tweets = plugin_interface.getTorrentManager().getPluginAttribute("tweets"); final LocaleUtilities loc_utils = plugin_interface.getUtilities().getLocaleUtilities(); log = plugin_interface.getLogger().getChannel("Twitter"); UIManager ui_manager = plugin_interface.getUIManager(); config_model = ui_manager.createBasicPluginConfigModel("plugins", "twitter.name"); enable = config_model.addBooleanParameter2(CONFIG_ENABLE, "twitter.enable", CONFIG_ENABLE_DEFAULT); LabelParameter tweet_info = config_model.addLabelParameter2("twitter.tweet.info"); tweet_text = config_model.addStringParameter2(CONFIG_TWEET_ADDED, CONFIG_TWEET_ADDED, loc_utils.getLocalisedMessageText(CONFIG_TWEET_ADDED_DEFAULT)); ParameterGroup tweet_group = config_model.createGroup("twitter.tweet.group", new Parameter[] { tweet_info, tweet_text }); // twitter_user = config_model.addStringParameter2( CONFIG_TWITTER_USER, "twitter.user", "" ); // twitter_password = config_model.addPasswordParameter2( CONFIG_TWITTER_PASSWORD, "twitter.password", PasswordParameter.ET_PLAIN, new byte[0] ); LabelParameter oauth_info = config_model.addLabelParameter2("twitter.oauth.info"); final ActionParameter oauth_setup = config_model.addActionParameter2("twitter.oauth.start.label", "twitter.oauth.start.button"); final RequestToken[] request_token = { null }; final StringParameter oauth_pin = config_model.addStringParameter2("twitter.oauth.pin", "twitter.oauth.pin", ""); oauth_pin.setValue(""); final ActionParameter oauth_done = config_model.addActionParameter2("twitter.oauth.done.label", "twitter.oauth.done.button"); oauth_setup.addConfigParameterListener(new ConfigParameterListener() { public void configParameterChanged(ConfigParameter param) { oauth_setup.setEnabled(false); plugin_interface.getUtilities().createThread("Twitter Setup", new Runnable() { public void run() { Twitter twitter = new TwitterFactory().getInstance(); try { RequestToken requestToken = twitter.getOAuthRequestToken(); request_token[0] = requestToken; oauth_done.setEnabled(true); log.log("OAuth URL: " + requestToken.getAuthorizationURL()); plugin_interface.getUIManager().openURL(new URL(requestToken.getAuthorizationURL())); Thread.sleep(5000); } catch (Throwable e) { log.log("OAuth setup failed", e); plugin_interface.getUIManager().showMessageBox("twitter.oauth.error.title", "twitter.oauth.error.details", UIManagerEvent.MT_OK); } finally { oauth_setup.setEnabled(true); } } }); } }); oauth_done.addConfigParameterListener(new ConfigParameterListener() { public void configParameterChanged(ConfigParameter param) { plugin_interface.getUtilities().createThread("Twitter Setup", new Runnable() { public void run() { try { Twitter twitter = new TwitterFactory().getInstance(); AccessToken at = twitter.getOAuthAccessToken(request_token[0], oauth_pin.getValue()); access_token = at; String token = at.getToken(); String token_secret = at.getTokenSecret(); plugin_interface.getPluginconfig().setPluginParameter("twitter.access.token", token); plugin_interface.getPluginconfig().setPluginParameter("twitter.access.token.secret", token_secret); plugin_interface.getPluginconfig().save(); log.log("OAuth setup successful - token saved"); plugin_interface.getUIManager().showMessageBox("twitter.oauth.ok.title", "twitter.oauth.ok.details", UIManagerEvent.MT_OK); } catch (Throwable e) { log.log("OAuth setup failed", e); plugin_interface.getUIManager().showMessageBox("twitter.oauth.error.title", "twitter.oauth.error.details", UIManagerEvent.MT_OK); } } }); } }); oauth_done.setEnabled(false); ParameterGroup auth_group = config_model.createGroup("twitter.oauth.group", new Parameter[] { oauth_info, oauth_setup, oauth_pin, oauth_done }); ActionParameter action = config_model.addActionParameter2("twitter.tweet_test", "twitter.send"); action.addConfigParameterListener(new ConfigParameterListener() { public void configParameterChanged(ConfigParameter param) { plugin_interface.getUtilities().createThread("Twitter Test", new Runnable() { public void run() { Map<String, String> params = new HashMap<String, String>(); params.put("%t", "<test_torrent_name>"); params.put("%m", "<magnet_uri>"); TwitterResult result = sendTweet(params); if (result.isOK()) { plugin_interface.getUIManager().showMessageBox("twitter.testok.title", "twitter.testok.details", UIManagerEvent.MT_OK); } else { plugin_interface.getUIManager() .showMessageBox("twitter.testfail.title", "!" + loc_utils.getLocalisedMessageText("twitter.testfail.details", new String[] { result.getError() }) + "!", UIManagerEvent.MT_OK); } } }); } }); view_model = ui_manager.createBasicPluginViewModel(loc_utils.getLocalisedMessageText("twitter.name")); view_model.getActivity().setVisible(false); view_model.getProgress().setVisible(false); log.addListener(new LoggerChannelListener() { public void messageLogged(int type, String content) { view_model.getLogArea().appendText(content + "\n"); } public void messageLogged(String str, Throwable error) { view_model.getLogArea().appendText(str + "\n"); view_model.getLogArea().appendText(error.toString() + "\n"); } }); view_model.getStatus().setText(enable.getValue() ? "Enabled" : "Disabled"); enable.addListener(new ParameterListener() { public void parameterChanged(Parameter p) { view_model.getStatus().setText(enable.getValue() ? "Enabled" : "Disabled"); checkEnabled(); } }); enable.addEnabledOnSelection(tweet_info); enable.addEnabledOnSelection(tweet_text); enable.addEnabledOnSelection(oauth_info); enable.addEnabledOnSelection(oauth_setup); enable.addEnabledOnSelection(oauth_pin); enable.addEnabledOnSelection(oauth_done); enable.addEnabledOnSelection(action); plugin_interface.getUIManager().addUIListener(new UIManagerListener() { public void UIAttached(UIInstance instance) { if (instance instanceof UISWTInstance) { checkEnabled(); } } public void UIDetached(UIInstance instance) { } }); timer = plugin_interface.getUtilities().createTimer("refresher"); timer_event = timer.addPeriodicEvent(60 * 1000, this); plugin_interface.getDownloadManager().addListener(this); }
From source file:com.yattatech.dbtc.activity.async.TwitterAuthAsyncTask.java
License:Open Source License
@Override protected Integer doInBackground(Void... params) { Integer result = SUCCESS;// w w w .j av a2 s . c om try { if (!mActivity.isConnected()) { result = NO_CONNECTION; } else if (GenericFragmentActivity.FACADE.isTwitterLogged()) { mActivity.startNewActivity(TwitterWriteScreen.class); } else { TwitterUtil.invalidRequestToken(); final RequestToken requestToken = TwitterUtil.getRequestToken(); final String authUrl = requestToken.getAuthorizationURL(); final Intent intent = new Intent(mActivity, TwitterAuthenticatorScreen.class); intent.putExtra(Constants.TWITTER_URL, authUrl); intent.putExtra(Constants.TWITTER_REQUEST_TOKEN, requestToken); mActivity.startActivityForResult(intent, Constants.TWITTER_SUCCCESS); } } catch (Exception e) { Debug.e(TAG, "Failed:", e); result = FAILED; } return result; }
From source file:de.dev.eth0.retweeter.TwitterAuthenticator.java
License:BEER-WARE LICENSE
public void authenticate() throws TwitterException, IOException { Twitter twitter = getTwitter();// www . j a v a 2 s .c om twitter.setOAuthAccessToken(null); AccessToken accessToken = null; RequestToken requestToken = twitter.getOAuthRequestToken(); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); while (null == accessToken) { System.out.println("Open the following URL and grant access to your account:"); System.out.println(requestToken.getAuthorizationURL()); System.out.print("Enter the PIN(if aviailable) or just hit enter.[PIN]:"); String pin = br.readLine(); try { if (pin.length() > 0) { accessToken = twitter.getOAuthAccessToken(requestToken, pin); } else { accessToken = twitter.getOAuthAccessToken(); } } catch (TwitterException te) { logger.error("Couldnt get access token", te); } } System.out.println("Your accessToken: " + accessToken.getToken()); System.out.println("Your accessTokenSecret: " + accessToken.getTokenSecret()); System.out.println("add this to your config: "); System.out.println("\"accessToken\":\"" + accessToken.getToken() + "\","); System.out.println("\"accessSecret\":\"" + accessToken.getTokenSecret() + "\","); }
From source file:de.hikinggrass.eiwomisarc.UpdateStatus.java
License:Apache License
/** * Usage: java twitter4j.examples.tweets.UpdateStatus [text] * /*w w w.ja va2 s .co m*/ * @param args * message */ public UpdateStatus() { try { ConfigurationBuilder confBuilder = new ConfigurationBuilder(); //use https for oauth confBuilder.setUseSSL(true); Configuration conf = confBuilder.build(); Twitter twitter = new TwitterFactory(conf).getInstance(); twitter.setOAuthConsumer("HaBxuZMHygmtcuPeCbOLg", "zg6bV26ksBrgKHdhmiLlubTtV9MaDhoIRZC1ODUKw"); try { // get request token. // this will throw IllegalStateException if access token is already available RequestToken requestToken = twitter.getOAuthRequestToken(); System.out.println("Got request token."); System.out.println("Request token: " + requestToken.getToken()); System.out.println("Request token secret: " + requestToken.getTokenSecret()); AccessToken accessToken = null; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); while (null == accessToken) { System.out.println("Open the following URL and grant access to your account:"); System.out.println(requestToken.getAuthorizationURL()); System.out.print("Enter the PIN(if available) and hit enter after you granted access.[PIN]:"); String pin = br.readLine(); try { if (pin.length() > 0) { accessToken = twitter.getOAuthAccessToken(requestToken, pin); } else { accessToken = twitter.getOAuthAccessToken(requestToken); } } catch (TwitterException te) { if (401 == te.getStatusCode()) { System.out.println("Unable to get the access token."); } else { te.printStackTrace(); } } } System.out.println("Got access token."); System.out.println("Access token: " + accessToken.getToken()); System.out.println("Access token secret: " + accessToken.getTokenSecret()); } catch (IllegalStateException ie) { // access token is already available, or consumer key/secret is not set. if (!twitter.getAuthorization().isEnabled()) { System.out.println("OAuth consumer key/secret is not set."); System.exit(-1); } } Status status = twitter.updateStatus("test from eiwomisarc"); System.out.println("Successfully updated the status to [" + status.getText() + "]."); System.exit(0); } catch (TwitterException te) { te.printStackTrace(); System.out.println("Failed to get timeline: " + te.getMessage()); System.exit(-1); } catch (IOException ioe) { ioe.printStackTrace(); System.out.println("Failed to read the system input."); System.exit(-1); } }
From source file:de.jetsli.twitter.TwitterSearch.java
License:Apache License
/** * Opening the url will show you a PIN// w w w . jav a 2 s. com * * @throws TwitterException */ public RequestToken doDesktopLogin() throws TwitterException { twitter = new TwitterFactory().getInstance(); twitter.setOAuthConsumer(consumerKey, consumerSecret); RequestToken requestToken = twitter.getOAuthRequestToken(""); System.out.println("Open the following URL and grant access to your account:"); System.out.println(requestToken.getAuthorizationURL()); return requestToken; }
From source file:de.vanita5.twittnuker.util.OAuthPasswordAuthenticator.java
License:Open Source License
public AccessToken getOAuthAccessToken(final String username, final String password) throws AuthenticationException { if (twitter == null) return null; final RequestToken requestToken; try {// w ww. j a va 2 s . c om requestToken = twitter.getOAuthRequestToken(OAUTH_CALLBACK_OOB); } catch (final TwitterException e) { if (e.isCausedByNetworkIssue()) throw new AuthenticationException(e); throw new AuthenticityTokenException(); } try { final String oauthToken = requestToken.getToken(); final String authorizationUrl = requestToken.getAuthorizationURL().toString(); final String authenticityToken = readAuthenticityTokenFromHtml( client.get(authorizationUrl, authorizationUrl, null, null).asReader()); if (authenticityToken == null) throw new AuthenticityTokenException(); final Configuration conf = twitter.getConfiguration(); final HttpParameter[] params = new HttpParameter[4]; params[0] = new HttpParameter("authenticity_token", authenticityToken); params[1] = new HttpParameter("oauth_token", oauthToken); params[2] = new HttpParameter("session[username_or_email]", username); params[3] = new HttpParameter("session[password]", password); final String oAuthAuthorizationUrl = conf.getOAuthAuthorizationURL().toString(); final String oauthPin = readOAuthPINFromHtml( client.post(oAuthAuthorizationUrl, oAuthAuthorizationUrl, params).asReader()); if (isEmpty(oauthPin)) throw new WrongUserPassException(); return twitter.getOAuthAccessToken(requestToken, oauthPin); } catch (final IOException e) { throw new AuthenticationException(e); } catch (final TwitterException e) { throw new AuthenticationException(e); } catch (final NullPointerException e) { throw new AuthenticationException(e); } catch (final XmlPullParserException e) { throw new AuthenticationException(e); } }
From source file:edu.harvard.iq.dvn.core.web.admin.OptionsPage.java
public String authorizeTwitter() { String callbackURL = "http://" + PropertyUtil.getHostUrl() + "/dvn"; callbackURL += getVDCRequestBean().getCurrentVDC() == null ? "/faces/networkAdmin/NetworkOptionsPage.xhtml" : getVDCRequestBean().getCurrentVDCURL() + "/faces/admin/OptionsPage.xhtml"; Twitter twitter = new TwitterFactory().getInstance(); try {//from w ww. j ava 2s . c om RequestToken requestToken = twitter.getOAuthRequestToken(callbackURL); getSessionMap().put("requestToken", requestToken); redirect(requestToken.getAuthorizationURL()); } catch (TwitterException te) { te.printStackTrace(); } return null; }
From source file:ehealth.external.twitter.GetAccessToken.java
License:Apache License
/** * Usage: java twitter4j.examples.oauth.GetAccessToken [consumer key] [consumer secret] * * @param args message//from w w w . java2 s. c o m */ protected void loginTwitter(String[] args) { File file = new File("twitter4j.properties"); Properties prop = new Properties(); InputStream is = null; OutputStream os = null; try { if (file.exists()) { is = new FileInputStream(file); prop.load(is); } if (args.length < 2) { if (null == prop.getProperty("oauth.consumerKey") && null == prop.getProperty("oauth.consumerSecret")) { // consumer key/secret are not set in twitter4j.properties System.out.println( "Usage: java twitter4j.examples.oauth.GetAccessToken [consumer key] [consumer secret]"); System.exit(-1); } } else { prop.setProperty("oauth.consumerKey", args[0]); prop.setProperty("oauth.consumerSecret", args[1]); os = new FileOutputStream("twitter4j.properties"); prop.store(os, "twitter4j.properties"); } } catch (IOException ioe) { ioe.printStackTrace(); System.exit(-1); } finally { if (is != null) { try { is.close(); } catch (IOException ignore) { } } if (os != null) { try { os.close(); } catch (IOException ignore) { } } } try { Twitter twitter = new TwitterFactory().getInstance(); RequestToken requestToken = twitter.getOAuthRequestToken(); System.out.println("Got request token."); System.out.println("Request token: " + requestToken.getToken()); System.out.println("Request token secret: " + requestToken.getTokenSecret()); AccessToken accessToken = null; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); while (null == accessToken) { System.out.println("Open the following URL and grant access to your account:"); System.out.println(requestToken.getAuthorizationURL()); try { Desktop.getDesktop().browse(new URI(requestToken.getAuthorizationURL())); } catch (UnsupportedOperationException ignore) { } catch (IOException ignore) { } catch (URISyntaxException e) { throw new AssertionError(e); } System.out.print("Enter the PIN(if available) and hit enter after you granted access.[PIN]:"); String pin = br.readLine(); try { if (pin.length() > 0) { accessToken = twitter.getOAuthAccessToken(requestToken, pin); } else { accessToken = twitter.getOAuthAccessToken(requestToken); } } catch (TwitterException te) { if (401 == te.getStatusCode()) { System.out.println("Unable to get the access token."); } else { te.printStackTrace(); } } } System.out.println("Got access token."); System.out.println("Access token: " + accessToken.getToken()); System.out.println("Access token secret: " + accessToken.getTokenSecret()); try { prop.setProperty("oauth.accessToken", accessToken.getToken()); prop.setProperty("oauth.accessTokenSecret", accessToken.getTokenSecret()); os = new FileOutputStream(file); prop.store(os, "twitter4j.properties"); os.close(); } catch (IOException ioe) { ioe.printStackTrace(); System.exit(-1); } finally { if (os != null) { try { os.close(); } catch (IOException ignore) { } } } System.out.println("Successfully stored access token to " + file.getAbsolutePath() + "."); System.exit(0); } catch (TwitterException te) { te.printStackTrace(); System.out.println("Failed to get accessToken: " + te.getMessage()); System.exit(-1); } catch (IOException ioe) { ioe.printStackTrace(); System.out.println("Failed to read the system input."); System.exit(-1); } }
From source file:ehealth.external.twitter.UpdateStatus.java
License:Apache License
private void loginTwitter() { File file = new File("twitter4j.properties"); Properties prop = new Properties(); InputStream is = null;/*from w ww . j a v a2 s . c o m*/ OutputStream os = null; try { if (file.exists()) { is = new FileInputStream(file); prop.load(is); } prop.setProperty("oauth.consumerKey", "2JaAM5RaAv56zT3HxI6fpp6Nq"); prop.setProperty("oauth.consumerSecret", "SRzpW5f4vk4QYeFPtJR7whQvjmM75D1JuBHTP4blTPCWu77Acl"); os = new FileOutputStream("twitter4j.properties"); prop.store(os, "twitter4j.properties"); } catch (IOException ioe) { ioe.printStackTrace(); } finally { if (is != null) { try { is.close(); } catch (IOException ignore) { } } if (os != null) { try { os.close(); } catch (IOException ignore) { } } } try { try { // get request token. // this will throw IllegalStateException if access token is // already available RequestToken requestToken = twitter.getOAuthRequestToken(); System.out.println("Got request token."); System.out.println("Request token: " + requestToken.getToken()); System.out.println("Request token secret: " + requestToken.getTokenSecret()); AccessToken accessToken = null; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); while (null == accessToken) { System.out.println("Open the following URL and grant access to your account:"); System.out.println(requestToken.getAuthorizationURL()); try { Desktop.getDesktop().browse(new URI(requestToken.getAuthorizationURL())); } catch (UnsupportedOperationException ignore) { } catch (IOException ignore) { } catch (URISyntaxException e) { throw new AssertionError(e); } System.out.print("Enter the PIN(if available) and hit enter after you granted access.[PIN]:"); String pin = br.readLine(); try { if (pin.length() > 0) { accessToken = twitter.getOAuthAccessToken(requestToken, pin); } else { accessToken = twitter.getOAuthAccessToken(requestToken); } } catch (TwitterException te) { if (401 == te.getStatusCode()) { System.out.println("Unable to get the access token."); } else { te.printStackTrace(); } } } System.out.println("Got access token."); System.out.println("Access token: " + accessToken.getToken()); System.out.println("Access token secret: " + accessToken.getTokenSecret()); try { prop.setProperty("oauth.accessToken", accessToken.getToken()); prop.setProperty("oauth.accessTokenSecret", accessToken.getTokenSecret()); os = new FileOutputStream(file); prop.store(os, "twitter4j.properties"); os.close(); } catch (IOException ioe) { ioe.printStackTrace(); System.exit(-1); } finally { if (os != null) { try { os.close(); } catch (IOException ignore) { } } } } catch (IllegalStateException ie) { // access token is already available, or consumer key/secret is // not set. if (!twitter.getAuthorization().isEnabled()) { System.out.println("OAuth consumer key/secret is not set."); } } } catch (TwitterException te) { te.printStackTrace(); System.out.println("Failed to get timeline: " + te.getMessage()); } catch (IOException ioe) { ioe.printStackTrace(); System.out.println("Failed to read the system input."); } catch (Exception e) { } }