List of usage examples for java.net ConnectException printStackTrace
public void printStackTrace()
From source file:fr.enseirb.odroidx.videomanager.Uploader.java
public void doUpload(Uri myFile) { createNotification();/*from ww w.j av a 2 s . co m*/ File f = new File(myFile.getPath()); SendName(f.getName().replace(' ', '-')); Log.e(getClass().getSimpleName(), "test: " + f.exists()); if (f.exists()) { Socket s; try { Log.e(getClass().getSimpleName(), "test: " + server_ip); s = new Socket(InetAddress.getByName(server_ip), 5088);// Bug // using // variable // port OutputStream fluxsortie = s.getOutputStream(); int nb_parts = (int) (f.length() / PART_SIZE); InputStream in = new BufferedInputStream(new FileInputStream(f)); ByteArrayOutputStream byte_array = new ByteArrayOutputStream(); BufferedOutputStream buffer = new BufferedOutputStream(byte_array); byte[] to_write = new byte[PART_SIZE]; for (int i = 0; i < nb_parts; i++) { in.read(to_write, 0, PART_SIZE); buffer.write(to_write); buffer.flush(); fluxsortie.write(byte_array.toByteArray()); byte_array.reset(); if ((i % 250) == 0) { mBuilder.setProgress(nb_parts, i, false); mNotifyManager.notify(NOTIFY_ID, mBuilder.getNotification()); } } int remaining = (int) (f.length() - nb_parts * PART_SIZE); in.read(to_write, 0, remaining); buffer.write(to_write); buffer.flush(); fluxsortie.write(byte_array.toByteArray()); byte_array.reset(); buffer.close(); fluxsortie.close(); in.close(); s.close(); } catch (ConnectException e) { if (STATUS != HTTP_SERVER) STATUS = CONNECTION_ERROR; e.printStackTrace(); } catch (UnknownHostException e) { if (STATUS != HTTP_SERVER) STATUS = UNKNOWN; Log.i(getClass().getSimpleName(), "Unknown host"); e.printStackTrace(); } catch (IOException e) { if (STATUS != HTTP_SERVER) STATUS = CONNECTION_ERROR; e.printStackTrace(); } } }
From source file:me.ryandowling.Followers.java
public void run() { this.latestFollower = this.username; this.numberOfFollowers = 0; this.tempLatestFollower = this.username; this.tempNumberOfFollowers = 0; while (true) { System.out.println("Getting Information From Twitch API"); try {//from w w w . ja v a2 s .c om followerInformation = Utils.urlToString("https://api.twitch.tv/kraken/channels/" + username + "/follows?direction=DESC&limit=1&offset=0"); } catch (ConnectException e) { System.err.println("Couldn't Connect To Twitch API!"); sleep(); continue; } catch (IOException e) { e.printStackTrace(); sleep(); continue; } JSONParser parser = new JSONParser(); this.tempLatestFollower = this.latestFollower; try { Object obj = parser.parse(followerInformation); JSONObject jsonObject = (JSONObject) obj; JSONArray msg = (JSONArray) jsonObject.get("follows"); this.latestFollower = (String) ((JSONObject) ((JSONObject) msg.get(0)).get("user")) .get("display_name"); this.tempNumberOfFollowers = (Long) jsonObject.get("_total"); } catch (Exception e) { e.printStackTrace(); sleep(); continue; } if (this.newStream && !this.newStreamRun) { try { // Save the number of followers at the start of the stream FileUtils.write(this.followersStartTodayTxrFile.toFile(), this.numberOfFollowers + ""); this.startNumberOfFollowers = this.numberOfFollowers; this.newStreamRun = true; } catch (IOException e) { e.printStackTrace(); } } if (this.firstFollower == null && this.latestFollower != null) { this.firstFollower = this.latestFollower; } if (!this.tempLatestFollower.equalsIgnoreCase(this.latestFollower) && this.tempNumberOfFollowers > this.numberOfFollowers) { newFollower(); } if (this.tempNumberOfFollowers > this.numberOfFollowers) { this.numberOfFollowers = this.tempNumberOfFollowers; moreFollowers(); } System.out.println("Latest follower is " + this.latestFollower); System.out.println("There are " + this.numberOfFollowers + " followers"); System.out.println("There have been " + (this.numberOfFollowers - this.startNumberOfFollowers) + " followers today"); sleep(); } }
From source file:com.hellblazer.process.JavaProcessTest.java
public void testLocalMBeanServerConnection() throws Exception { copyTestClassFile();/*from w w w. j ava 2s . co m*/ final JavaProcess process = new JavaProcessImpl(processFactory.create()); int sleepTime = 60000; process.setArguments(new String[] { "-jmx", Integer.toString(sleepTime) }); process.setJavaClass(HelloWorld.class.getCanonicalName()); process.setDirectory(testDir); process.setJavaExecutable(javaBin); try { launchProcess(process); Condition condition = new Condition() { @Override public boolean isTrue() { try { connection = process.getLocalMBeanServerConnection(HelloWorld.JMX_CONNECTION_NAME); return true; } catch (ConnectException e) { return false; } catch (NoLocalJmxConnectionException e) { return false; } catch (IOException e) { e.printStackTrace(); System.out.flush(); System.err.flush(); System.out.println("error"); fail("error retrieving JMX connection: " + e); return false; } } }; assertTrue("JMX connection established", Utils.waitForCondition(60 * 1000, condition)); Set<ObjectName> names = connection.queryNames(null, null); assertTrue(names.size() > 1); } finally { if (process != null) { process.destroy(); } } assertTrue("Process not active", !process.isActive()); }
From source file:it.geosolutions.geonetwork.util.HTTPUtils.java
/** * @return true if the server response was an HTTP_OK */// www .ja v a 2s . c o m public boolean httpPing(String url) { GetMethod httpMethod = null; try { // HttpClient client = new HttpClient(); setAuth(client, url, username, pw); httpMethod = new GetMethod(url); client.getHttpConnectionManager().getParams().setConnectionTimeout(2000); lastHttpStatus = client.executeMethod(httpMethod); if (lastHttpStatus != HttpStatus.SC_OK) { LOGGER.warn("PING failed at '" + url + "': (" + lastHttpStatus + ") " + httpMethod.getStatusText()); return false; } else { return true; } } catch (ConnectException e) { return false; } catch (IOException e) { e.printStackTrace(); return false; } finally { if (httpMethod != null) httpMethod.releaseConnection(); } }
From source file:hellomindwavepro.ThinkGearSocket.java
public void start() throws ConnectException { try {/* w w w .j ava 2 s. co m*/ neuroSocket = new Socket("127.0.0.1", 13854); } catch (ConnectException e) { //e.printStackTrace(); System.out.println("Oi plonker! Is ThinkkGear running?"); running = false; throw e; } catch (UnknownHostException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } try { inStream = neuroSocket.getInputStream(); outStream = neuroSocket.getOutputStream(); stdIn = new BufferedReader(new InputStreamReader(neuroSocket.getInputStream())); running = true; } catch (IOException e) { e.printStackTrace(); } if (appName != "" && appKey != "") { JSONObject appAuth = new JSONObject(); try { appAuth.put("appName", appName); } catch (JSONException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try { appAuth.put("appKey", appKey); } catch (JSONException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } //throws some error sendMessage(appAuth.toString()); System.out.println("appAuth" + appAuth); } JSONObject format = new JSONObject(); try { format.put("enableRawOutput", true); } catch (JSONException e) { // TODO Auto-generated catch block System.out.println("raw error"); e.printStackTrace(); } try { format.put("format", "Json"); } catch (JSONException e) { // TODO Auto-generated catch block System.out.println("Json error"); e.printStackTrace(); } //System.out.println("format "+format); sendMessage(format.toString()); t = new Thread(this); t.start(); }
From source file:com.claim.controller.FileTransferController.java
public boolean uploadMutiFilesWithFTP(ObjFileTransfer ftpObj) throws Exception { FTPClient ftpClient = new FTPClient(); int replyCode; boolean completed = false; try {//from w w w .j a va 2s . c o m FtpProperties properties = new ResourcesProperties().loadFTPProperties(); try { ftpClient.connect(properties.getFtp_server(), properties.getFtp_port()); FtpUtil.showServerReply(ftpClient); } catch (ConnectException ex) { FtpUtil.showServerReply(ftpClient); Console.LOG(ex.getMessage(), 0); System.out.println("ConnectException: " + ex.getMessage()); ex.printStackTrace(); } catch (SocketException ex) { FtpUtil.showServerReply(ftpClient); Console.LOG(ex.getMessage(), 0); System.out.println("SocketException: " + ex.getMessage()); ex.printStackTrace(); } catch (UnknownHostException ex) { FtpUtil.showServerReply(ftpClient); Console.LOG(ex.getMessage(), 0); System.out.println("UnknownHostException: " + ex.getMessage()); ex.printStackTrace(); } replyCode = ftpClient.getReplyCode(); FtpUtil.showServerReply(ftpClient); if (!FTPReply.isPositiveCompletion(replyCode)) { FtpUtil.showServerReply(ftpClient); ftpClient.disconnect(); Console.LOG("Exception in connecting to FTP Serve ", 0); throw new Exception("Exception in connecting to FTP Server"); } else { FtpUtil.showServerReply(ftpClient); Console.LOG("Success in connecting to FTP Serve ", 1); } try { boolean success = ftpClient.login(properties.getFtp_username(), properties.getFtp_password()); FtpUtil.showServerReply(ftpClient); if (!success) { throw new Exception("Could not login to the FTP server."); } else { Console.LOG("login to the FTP server. Successfully ", 1); } //ftpClient.enterLocalPassiveMode(); } catch (FTPConnectionClosedException ex) { FtpUtil.showServerReply(ftpClient); Console.LOG(ex.getMessage(), 0); System.out.println("Error: " + ex.getMessage()); ex.printStackTrace(); } ftpClient.setFileType(FTP.BINARY_FILE_TYPE); //FTP_REMOTE_HOME = ftpClient.printWorkingDirectory(); // APPROACH #2: uploads second file using an OutputStream File files = new File(ftpObj.getFtp_directory_path()); String workingDirectoryReportType = properties.getFtp_remote_directory() + File.separator + ftpObj.getFtp_report_type(); FtpUtil.ftpCreateDirectoryTree(ftpClient, workingDirectoryReportType); FtpUtil.showServerReply(ftpClient); String workingDirectoryStmp = workingDirectoryReportType + File.separator + ftpObj.getFtp_stmp(); FtpUtil.ftpCreateDirectoryTree(ftpClient, workingDirectoryStmp); FtpUtil.showServerReply(ftpClient); for (File file : files.listFiles()) { if (file.isFile()) { System.out.println("file ::" + file.getName()); InputStream in = new FileInputStream(file); ftpClient.changeWorkingDirectory(workingDirectoryStmp); completed = ftpClient.storeFile(file.getName(), in); in.close(); Console.LOG( " " + file.getName() + " ", 1); FtpUtil.showServerReply(ftpClient); } } Console.LOG(" ?... ", 1); //completed = ftpClient.completePendingCommand(); FtpUtil.showServerReply(ftpClient); completed = true; ftpClient.disconnect(); } catch (IOException ex) { Console.LOG(ex.getMessage(), 0); FtpUtil.showServerReply(ftpClient); System.out.println("Error: " + ex.getMessage()); ex.printStackTrace(); } finally { try { if (ftpClient.isConnected()) { ftpClient.logout(); ftpClient.disconnect(); } } catch (IOException ex) { FtpUtil.showServerReply(ftpClient); Console.LOG(ex.getMessage(), 0); ex.printStackTrace(); } } return completed; }
From source file:bpv.neurosky.connector.ThinkGearSocket.java
public void start() throws ConnectException { try {//from ww w. ja va2 s . co m neuroSocket = new Socket("127.0.0.1", 13854); } catch (ConnectException e) { //e.printStackTrace(); System.out.println("Oi plonker! Is ThinkkGear running?"); running = false; throw e; } catch (UnknownHostException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } try { inStream = neuroSocket.getInputStream(); outStream = neuroSocket.getOutputStream(); stdIn = new BufferedReader(new InputStreamReader(neuroSocket.getInputStream())); running = true; } catch (IOException e) { e.printStackTrace(); } if (appName != "" && appKey != "") { JSONObject appAuth = new JSONObject(); try { appAuth.put("appName", appName); } catch (JSONException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try { appAuth.put("appKey", appKey); } catch (JSONException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } //throws some error sendMessage(appAuth.toString()); System.out.println("appAuth" + appAuth); } JSONObject format = new JSONObject(); try { format.put("enableRawOutput", true); } catch (JSONException e) { // TODO Auto-generated catch block System.out.println("raw error"); e.printStackTrace(); } try { format.put("format", "Json"); } catch (JSONException e) { // TODO Auto-generated catch block System.out.println("Json error"); e.printStackTrace(); } //System.out.println("format "+format); sendMessage(format.toString()); t = new Thread(this); t.start(); System.out.println("Conexo Estabelecida: Iniciando leitura de socket..."); }
From source file:com.claim.controller.FileTransferController.java
public boolean uploadMutiFilesWithFTPS(ObjFileTransfer ftpObj) throws Exception { FTPSClient ftpsClient = null;//from w ww.ja v a 2s.c o m int replyCode; boolean completed = false; try { FtpProperties properties = new ResourcesProperties().loadFTPProperties(); try { ftpsClient = new FTPSClient(properties.getFtp_protocal(), properties.isFtp_impicit()); //ftpsClient.setAuthValue(ConstantFtp.FTPS_PROTOCAL); ftpsClient.setDataTimeout(ConstantFtp.FTP_TIMEOUT); ftpsClient.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out))); System.out.print(ftpsClient.getReplyString()); ftpsClient.connect(properties.getFtp_server(), properties.getFtp_port()); FtpUtil.showServerReply(ftpsClient); } catch (ConnectException ex) { FtpUtil.showServerReply(ftpsClient); Console.LOG(ex.getMessage(), 0); System.out.println("ConnectException: " + ex.getMessage()); ex.printStackTrace(); } catch (SocketException ex) { FtpUtil.showServerReply(ftpsClient); Console.LOG(ex.getMessage(), 0); System.out.println("SocketException: " + ex.getMessage()); ex.printStackTrace(); } catch (UnknownHostException ex) { FtpUtil.showServerReply(ftpsClient); Console.LOG(ex.getMessage(), 0); System.out.println("UnknownHostException: " + ex.getMessage()); ex.printStackTrace(); } replyCode = ftpsClient.getReplyCode(); FtpUtil.showServerReply(ftpsClient); if (!FTPReply.isPositiveCompletion(replyCode)) { ftpsClient.disconnect(); Console.LOG("Exception in connecting to FTP Serve ", 0); throw new Exception("Exception in connecting to FTP Server"); } else { Console.LOG("Success in connecting to FTP Serve ", 1); } try { boolean success = ftpsClient.login(properties.getFtp_username(), properties.getFtp_password()); FtpUtil.showServerReply(ftpsClient); if (!success) { throw new Exception("Could not login to the FTP server."); } else { Console.LOG("login to the FTP server. Successfully ", 1); } //ftpClient.enterLocalPassiveMode(); } catch (FTPConnectionClosedException ex) { Console.LOG(ex.getMessage(), 0); FtpUtil.showServerReply(ftpsClient); System.out.println("Error: " + ex.getMessage()); ex.printStackTrace(); } ftpsClient.setFileType(FTP.BINARY_FILE_TYPE); ftpsClient.execPBSZ(0); //FTP_REMOTE_HOME = ftpClient.printWorkingDirectory(); String workingDirectoryReportType = properties.getFtp_remote_directory() + File.separator + ftpObj.getFtp_report_type(); FtpUtil.ftpCreateDirectoryTree(ftpsClient, workingDirectoryReportType); FtpUtil.showServerReply(ftpsClient); String workingDirectoryStmp = workingDirectoryReportType + File.separator + ftpObj.getFtp_stmp(); FtpUtil.ftpCreateDirectoryTree(ftpsClient, workingDirectoryStmp); FtpUtil.showServerReply(ftpsClient); // APPROACH #2: uploads second file using an OutputStream File files = new File(ftpObj.getFtp_directory_path()); for (File file : files.listFiles()) { if (file.isFile()) { System.out.println("file ::" + file.getName()); InputStream in = new FileInputStream(file); ftpsClient.changeWorkingDirectory(workingDirectoryStmp); completed = ftpsClient.storeFile(file.getName(), in); in.close(); Console.LOG( " " + file.getName() + " ", 1); FtpUtil.showServerReply(ftpsClient); } } Console.LOG(" ?... ", 1); //completed = ftpClient.completePendingCommand(); FtpUtil.showServerReply(ftpsClient); completed = true; ftpsClient.disconnect(); } catch (IOException ex) { Console.LOG(ex.getMessage(), 0); FtpUtil.showServerReply(ftpsClient); System.out.println("Error: " + ex.getMessage()); ex.printStackTrace(); } finally { try { if (ftpsClient.isConnected()) { ftpsClient.logout(); ftpsClient.disconnect(); } } catch (IOException ex) { FtpUtil.showServerReply(ftpsClient); Console.LOG(ex.getMessage(), 0); ex.printStackTrace(); } } return completed; }
From source file:org.apache.eagle.jpm.spark.running.parser.SparkApplicationParser.java
private boolean fetchSparkApps() { String appURL = app.getTrackingUrl() + Constants.SPARK_APPS_URL + "?" + Constants.ANONYMOUS_PARAMETER; InputStream is = null;//from w ww . ja v a 2 s .co m SparkApplication[] sparkApplications = null; try { is = InputStreamUtils.getInputStream(appURL, null, Constants.CompressionType.NONE); LOG.info("fetch spark application from {}", appURL); sparkApplications = OBJ_MAPPER.readValue(is, SparkApplication[].class); } catch (java.net.ConnectException e) { LOG.warn("fetch spark application from {} failed, {}", appURL, e); e.printStackTrace(); return true; } catch (Exception e) { LOG.warn("fetch spark application from {} failed, {}", appURL, e); e.printStackTrace(); return false; } finally { Utils.closeInputStream(is); } for (SparkApplication sparkApplication : sparkApplications) { String id = sparkApplication.getId(); if (id.contains(" ") || !id.startsWith("app")) { //spark version < 1.6.0 and id contains white space, need research again later LOG.warn("skip spark application {}", id); continue; } currentAttempt = sparkApplication.getAttempts().size(); int lastSavedAttempt = 1; if (sparkAppEntityMap.containsKey(id)) { lastSavedAttempt = Integer.parseInt( sparkAppEntityMap.get(id).getTags().get(SparkJobTagName.SPARK_APP_ATTEMPT_ID.toString())); } for (int j = lastSavedAttempt; j <= currentAttempt; j++) { commonTags.put(SparkJobTagName.SPARK_APP_NAME.toString(), sparkApplication.getName()); commonTags.put(SparkJobTagName.SPARK_APP_ATTEMPT_ID.toString(), "" + j); commonTags.put(SparkJobTagName.SPARK_APP_ID.toString(), id); SparkAppEntity attemptEntity = new SparkAppEntity(); attemptEntity.setTags(new HashMap<>(commonTags)); attemptEntity.setAppInfo(app); attemptEntity.setStartTime( Utils.dateTimeToLong(sparkApplication.getAttempts().get(j - 1).getStartTime())); attemptEntity.setTimestamp(attemptEntity.getStartTime()); if (sparkJobConfigs.containsKey(id) && j == currentAttempt) { attemptEntity.setConfig(sparkJobConfigs.get(id)); } if (attemptEntity.getConfig() == null) { attemptEntity.setConfig(getJobConfig(id, j)); if (j == currentAttempt) { sparkJobConfigs.put(id, attemptEntity.getConfig()); } } try { JobConfig jobConfig = attemptEntity.getConfig(); attemptEntity.setExecMemoryBytes( Utils.parseMemory(jobConfig.get(Constants.SPARK_EXECUTOR_MEMORY_KEY))); attemptEntity.setDriveMemoryBytes(isClientMode(jobConfig) ? 0 : Utils.parseMemory(jobConfig.get(Constants.SPARK_DRIVER_MEMORY_KEY))); attemptEntity .setExecutorCores(Integer.parseInt(jobConfig.get(Constants.SPARK_EXECUTOR_CORES_KEY))); // spark.driver.cores may not be set. String driverCoresStr = jobConfig.get(Constants.SPARK_DRIVER_CORES_KEY); int driverCores = 0; if (driverCoresStr != null && !isClientMode(jobConfig)) { driverCores = Integer.parseInt(driverCoresStr); } attemptEntity.setDriverCores(driverCores); } catch (Exception e) { LOG.warn("add config failed, {}", e); e.printStackTrace(); } if (j == currentAttempt) { //current attempt attemptEntity.setYarnState(app.getState()); attemptEntity.setYarnStatus(app.getFinalStatus()); sparkAppEntityMap.put(id, attemptEntity); this.sparkRunningJobManager.update(app.getId(), id, attemptEntity); } else { attemptEntity.setYarnState(Constants.AppState.FINISHED.toString()); attemptEntity.setYarnStatus(Constants.AppStatus.FAILED.toString()); } sparkAppEntityCreationHandler.add(attemptEntity); } } sparkAppEntityCreationHandler.flush(); return true; }
From source file:org.kepler.actor.rest.RESTService.java
/** * * @param pmPairList// w w w . j a v a2 s .c o m * List of the name and value parameters that user has provided * through paramInputPort. However in method this list is * combined with the user configured ports and the combined list * name value pair parameters are added to the service URL * separated by ampersand. * @param nvPairList * List of the name and value parameters that user has provided * @return the results after executing the Get service. */ public String executeGetMethod(List<NameValuePair> nvPairList, String serSiteURL) throws IllegalActionException { if (_debugging) { _debug("I AM IN GET METHOD"); } //log.debug("I AM IN GET METHOD"); HttpClient client = new HttpClient(); StringBuilder results = new StringBuilder(); results.append(serSiteURL); List<NameValuePair> fullPairList = getCombinedPairList(nvPairList); if (fullPairList.size() > 0) { results.append("?"); int pairListSize = fullPairList.size(); for (int j = 0; j < pairListSize; j++) { NameValuePair nvPair = fullPairList.get(j); results.append(nvPair.getName()).append(ServiceUtils.EQUALDELIMITER).append(nvPair.getValue()); if (j < pairListSize - 1) { results.append("&"); } } } if (_debugging) { _debug("RESULTS :" + results.toString()); } // Create a method instance. GetMethod method = new GetMethod(results.toString()); InputStream rstream = null; StringBuilder resultsForDisplay = new StringBuilder(); try { messageBldr = new StringBuilder(); messageBldr.append("In excuteGetMethod, communicating with service: ").append(serSiteURL) .append(" STATUS Code: "); int statusCode = client.executeMethod(method); messageBldr.append(statusCode); log.debug(messageBldr.toString()); if (_debugging) { _debug(messageBldr.toString()); } // if(statusCode == 201){ // System.out.println("Success -- " + statusCode + // ServiceUtils.ANEMPTYSPACE + method.getResponseBodyAsString()); // }else{ // System.out.println("Failure -- " + statusCode + // ServiceUtils.ANEMPTYSPACE + method.getResponseBodyAsString()); // } rstream = method.getResponseBodyAsStream(); BufferedReader br = new BufferedReader(new InputStreamReader(rstream)); String s; while ((s = br.readLine()) != null) { resultsForDisplay.append(s).append(ServiceUtils.LINESEP); } } catch (HttpException httpe) { if (_debugging) { _debug("Fatal protocol violation: " + httpe.getMessage()); } httpe.printStackTrace(); throw new IllegalActionException(this, httpe, "Fatal Protocol Violation: " + httpe.getMessage()); } catch (ConnectException conExp) { if (_debugging) { _debug("Perhaps service '" + serSiteURL + "' is not reachable: " + conExp.getMessage()); } conExp.printStackTrace(); throw new IllegalActionException(this, conExp, "Perhaps service '" + serSiteURL + "' is not reachable: " + conExp.getMessage()); } catch (IOException ioe) { if (_debugging) { _debug("IOException: " + ioe.getMessage()); } // System.err.println("Fatal transport error: " + e.getMessage()); ioe.printStackTrace(); throw new IllegalActionException(this, ioe, "IOException: " + ioe.getMessage()); } catch (Exception e) { if (_debugging) { _debug("Fatal transport error: " + e.getMessage()); } // System.err.println("Fatal transport error: " + e.getMessage()); e.printStackTrace(); throw new IllegalActionException(this, e, "Error: " + e.getMessage()); } finally { // Release the connection. method.releaseConnection(); client = null; // close InputStream; if (rstream != null) try { rstream.close(); } catch (IOException e) { e.printStackTrace(); throw new IllegalActionException(this, e, "InputStream Close Exception: " + e.getMessage()); } } return resultsForDisplay.toString(); }