List of usage examples for java.io FileNotFoundException getLocalizedMessage
public String getLocalizedMessage()
From source file:controller.CLI.java
private String parseRead(String[] args) { if (args.length == 2) { File file = new File(args[1]); try {/*from w w w . j a v a 2 s. co m*/ lps.add(p, Parser.parse(file)); p++; redo = 0; // TODO: Fix this in another way? VisLP.readScope = true; VisLP.feasScope = true; return "Read " + file + " OK.\n"; } catch (FileNotFoundException e) { return "File " + file + " not found.\n"; } catch (IllegalArgumentException e) { return "Read not OK. " + e.getLocalizedMessage(); } } else { return Data.SYNTAX.get(Data.read); } }
From source file:thobe.logfileviewer.server.EthSource.java
@Override public void run() { System.out.println("Starting EthSource"); this.clientAccepter = new ClientAccepter(this, this.serverSocket); System.out.println("ClientAccepter created, start it"); this.clientAccepter.start(); System.out.println("ClientConnectionChecker created, start it"); this.clientConnectionChecker = new ClientConnectionChecker(this); this.clientConnectionChecker.start(); this.startTime.set(System.currentTimeMillis()); this.lpsPrinter.schedule(new LPSPrinter(this), 5000, 5000); BufferedReader reader = null; StringBuffer strBuffer = new StringBuffer(); while (!this.quitRequested) { // Open the file if (reader == null) { System.out.println("Opening " + this.file.getAbsolutePath()); try { reader = new BufferedReader(new FileReader(this.file)); } catch (FileNotFoundException e) { System.err.println( "Could not find file " + this.file.getAbsolutePath() + ": " + e.getLocalizedMessage()); break; }/* w w w . jav a 2 s .c o m*/ } // clear the strBuffer strBuffer.setLength(0); String line = null; int linesCollected = 0; // collect N lines from the file try { while (((line = reader.readLine()) != null) && linesCollected < MAX_LINES_PER_BLOCK) { strBuffer.append(line + "\n"); linesCollected++; this.linesSend.incrementAndGet(); } if (line == null) { if (this.infiniteMode) { System.out.println("EOF reached, reopeneing file"); reader = null; } else { System.out.println("EOF reached, stopp!"); break; } } } catch (IOException e1) { System.err.println("Error reading file: " + e1.getLocalizedMessage()); break; } // now put the lines to the clients synchronized (this.clientWriterMap) { String block = strBuffer.toString(); for (Entry<Socket, PrintWriter> entry : this.clientWriterMap.entrySet()) { PrintWriter out = entry.getValue(); out.write(block, 0, block.length()); } } try { Thread.sleep(this.sleepTime.get()); } catch (InterruptedException e) { break; } } // close the reader if (reader != null) { try { reader.close(); } catch (IOException e) { System.err.println("Error closing reader: " + e.getLocalizedMessage()); } } try { System.out.println("Quit the client accepter"); this.clientAccepter.quit(); System.out.println("Quit the client connection checker"); this.clientConnectionChecker.quit(); System.out.println("Quit the LPSPrinter"); this.lpsPrinter.cancel(); this.clientAccepter.interrupt(); this.clientAccepter.join(); this.clientConnectionChecker.interrupt(); this.clientConnectionChecker.join(); } catch (InterruptedException e) { } System.out.println("Stopping EthSource"); }
From source file:net.unicon.sakora.impl.csv.CsvHandlerBase.java
/** * Handled initial setup of the sync context, * called from {@link #readInput(CsvSyncContext)} * //from www . j a v a2 s .co m * @param context the sync context * @return true if the file was read successfully, false otherwise */ protected boolean setup(CsvSyncContext context) { /* intentionally avoid storing this as an instance member to * try to get away from storing processing state in singleton beans */ boolean fileWasRead = false; String csvPath = context.getProperties().get(CsvSyncServiceImpl.BATCH_PROCESSING_DIR) + File.separator + csvFileName; context.getProperties().put(BATCH_FILE_PATH, csvPath); context.getProperties().put(READ_ALL_LINES, "false"); csvr = null; try { // TODO: support for reading input from CHS started but not yet finished if (false /* is a valid content entity reference */) { try { br = new BufferedReader( new InputStreamReader(contentHostingService.getResource(csvPath).streamContent())); } catch (ServerOverloadException e) { e.printStackTrace(); } catch (PermissionException e) { e.printStackTrace(); } catch (IdUnusedException e) { e.printStackTrace(); } catch (TypeException e) { e.printStackTrace(); } } else { inputFile = new File(csvPath); br = new BufferedReader(new FileReader(inputFile)); } csvr = new CSVReader(br); // if the csv files have headers, skip them if (hasHeader) { csvr.readNext(); } fileWasRead = true; } catch (FileNotFoundException ffe) { dao.create(new SakoraLog(this.getClass().toString(), ffe.getLocalizedMessage())); log.info("SakoraCSV reader failed to locate file [" + csvPath + "] (this is OK if you did not upload this file as part of the feed): " + ffe.getLocalizedMessage()); } catch (IOException ioe) { dao.create(new SakoraLog(this.getClass().toString(), ioe.getLocalizedMessage())); log.warn("SakoraCSV reader failed to read from file [" + csvPath + "]: " + ioe, ioe); } return fileWasRead; }
From source file:net.sf.housekeeper.swing.ApplicationPresenter.java
/** * Replaces the current domain objects from the persistent storage. *//* w w w.ja va 2s . c om*/ private void loadDomainData() { try { PersistenceController.instance().replaceDomainWithSaved(household); } catch (FileNotFoundException exception) { LOG.error("Could not load domain data", exception); final String nodata = LocalisationManager.INSTANCE.getText("gui.mainFrame.nodata"); view.showErrorDialog(nodata); } catch (Exception exception) { LOG.error("Could not load domain data", exception); view.showErrorDialog(exception.getLocalizedMessage()); } }
From source file:org.openhab.io.cv.internal.resources.RrdResource.java
/** * returns a rrd series data, an array of [[timestamp,data1,data2,...]] * /*from w w w.ja v a2 s. c o m*/ * @param persistenceService * @param item * @param consilidationFunction * @param timeBegin * @param timeEnd * @param resolution * @return */ public Object getRrdSeries(QueryablePersistenceService persistenceService, Item item, ConsolFun consilidationFunction, Date timeBegin, Date timeEnd, long resolution) { Map<Long, ArrayList<String>> data = new TreeMap<Long, ArrayList<String>>(); try { List<String> itemNames = new ArrayList<String>(); if (item instanceof GroupItem) { GroupItem groupItem = (GroupItem) item; for (Item member : groupItem.getMembers()) { itemNames.add(member.getName()); } } else { itemNames.add(item.getName()); } for (String itemName : itemNames) { addRrdData(data, itemName, consilidationFunction, timeBegin, timeEnd, resolution); } } catch (FileNotFoundException e) { // rrd file does not exist, fallback to generic persistance service logger.debug("no rrd file found '{}'", (RRD_FOLDER + File.separator + item.getName() + ".rrd")); return getPersistenceSeries(persistenceService, item, timeBegin, timeEnd, resolution); } catch (Exception e) { logger.error(e.getLocalizedMessage() + ": fallback to generic persistance service"); return getPersistenceSeries(persistenceService, item, timeBegin, timeEnd, resolution); } return convertToRrd(data); }
From source file:com.qut.middleware.crypto.impl.CryptoProcessorImpl.java
public void serializeKeyStore(KeyStore keyStore, String keyStorePassphrase, String filename) throws CryptoException { FileOutputStream fos = null;/*w w w.j a va 2s .com*/ try { fos = new FileOutputStream(filename); keyStore.store(fos, keyStorePassphrase.toCharArray()); } catch (FileNotFoundException e) { this.logger.error(e.getLocalizedMessage()); this.logger.debug(e.toString()); throw new CryptoException(e.getLocalizedMessage(), e); } catch (KeyStoreException e) { this.logger.error(e.getLocalizedMessage()); this.logger.debug(e.toString()); throw new CryptoException(e.getLocalizedMessage(), e); } catch (NoSuchAlgorithmException e) { this.logger.error(e.getLocalizedMessage()); this.logger.debug(e.toString()); throw new CryptoException(e.getLocalizedMessage(), e); } catch (CertificateException e) { this.logger.error(e.getLocalizedMessage()); this.logger.debug(e.toString()); throw new CryptoException(e.getLocalizedMessage(), e); } catch (IOException e) { this.logger.error(e.getLocalizedMessage()); this.logger.debug(e.toString()); throw new CryptoException(e.getLocalizedMessage(), e); } finally { if (fos != null) { try { fos.flush(); fos.close(); } catch (IOException e) { this.logger.error(e.getLocalizedMessage()); this.logger.debug(e.toString()); throw new CryptoException(e.getLocalizedMessage(), e); } } } }
From source file:fr.certu.chouette.exchange.csv.importer.CSVImportLinePlugin.java
/** * @param objectIdPrefix// w w w . j av a 2 s .c o m * @param srid * @param report * @param rootObject * @param validate * @param report * @param entryName * @return * @throws ExchangeException */ private List<Line> processImport(String filePath, String objectIdPrefix, String srid, Report report) throws ExchangeException { ChouetteCsvReader csvReader = null; Map<String, Timetable> timetableMap = new HashMap<String, Timetable>(); PTNetwork ptNetwork = null; Company company = null; List<Line> lines = new ArrayList<Line>(); lineProducer.clean(); ReportItem fileReportItem = null; try { File input = new File(filePath); fileReportItem = new ExchangeReportItem(ExchangeReportItem.KEY.FILE, Report.STATE.OK, input.getName()); report.addItem(fileReportItem); FileInputStream stream = new FileInputStream(input); csvReader = new ChouetteCsvReader(new InputStreamReader(stream, "UTF-8"), ';'); } catch (FileNotFoundException e) { ReportItem errorItem = new ExchangeReportItem(ExchangeReportItem.KEY.FILE_ERROR, Report.STATE.ERROR, e.getLocalizedMessage()); fileReportItem.addItem(errorItem); throw new ExchangeException(ExchangeExceptionCode.FILE_NOT_FOUND, filePath); } catch (UnsupportedEncodingException e) { ReportItem errorItem = new ExchangeReportItem(ExchangeReportItem.KEY.FILE_ERROR, Report.STATE.ERROR, e.getLocalizedMessage()); fileReportItem.addItem(errorItem); throw new ExchangeException(ExchangeExceptionCode.INVALID_CSV_FILE, filePath); } String[] currentLine; try { currentLine = csvReader.readNext(); // check if firstLine is correct (detect oldfashion format) if ((currentLine.length < TimetableProducer.TITLE_COLUMN + 2) || currentLine[TimetableProducer.TITLE_COLUMN].isEmpty() || currentLine[TimetableProducer.TITLE_COLUMN + 1].isEmpty()) { CSVReportItem reportItem = new CSVReportItem(CSVReportItem.KEY.FILE_FORMAT, Report.STATE.ERROR); report.addItem(reportItem); return null; } } catch (IOException e) { ReportItem errorItem = new ExchangeReportItem(ExchangeReportItem.KEY.FILE_ERROR, Report.STATE.ERROR, e.getLocalizedMessage()); fileReportItem.addItem(errorItem); throw new ExchangeException(ExchangeExceptionCode.INVALID_CSV_FILE, filePath); } CSVReportItem timetableCountReport = new CSVReportItem(CSVReportItem.KEY.TIMETABLE_COUNT, Report.STATE.OK); while (currentLine[TimetableProducer.TITLE_COLUMN].equals(TimetableProducer.TIMETABLE_LABEL_TITLE)) { Timetable timetable = timetableProducer.produce(csvReader, currentLine, objectIdPrefix, srid, timetableCountReport); if (timetable != null) { logger.debug("timetable \n" + timetable.toString()); timetableMap.put(timetable.getObjectId().split(":")[2], timetable); } currentLine = getStartOfNextBloc(filePath, report, csvReader, true); if (currentLine == null) break; } if (currentLine == null) return null; ptNetwork = ptNetworkProducer.produce(csvReader, currentLine, objectIdPrefix, srid, report); if (ptNetwork == null) return null; logger.debug("network \n" + ptNetwork); currentLine = getStartOfNextBloc(filePath, report, csvReader, true); if (currentLine == null) return null; company = companyProducer.produce(csvReader, currentLine, objectIdPrefix, srid, report); if (company == null) return null; logger.debug("company \n" + company.toString()); currentLine = getStartOfNextBloc(filePath, report, csvReader, true); if (currentLine == null) return null; CSVReportItem lineCountReport = new CSVReportItem(CSVReportItem.KEY.LINE_COUNT, Report.STATE.OK); while (currentLine[LineProducer.TITLE_COLUMN].equals(LineProducer.LINE_NAME_TITLE)) { logger.debug("lines"); Line line = lineProducer.produce(csvReader, currentLine, objectIdPrefix, srid, lineCountReport); if (line != null) { line.setCompany(company); line.setPtNetwork(ptNetwork); assemble(line, timetableMap, report); logger.debug("line \n" + line.toString()); if (line.getRoutes().isEmpty()) { logger.error("empty line removed :" + line.getNumber()); CSVReportItem reportItem = new CSVReportItem(CSVReportItem.KEY.INVALID_LINE, Report.STATE.ERROR, line.getName()); report.addItem(reportItem); } else { CSVReportItem reportItem = new CSVReportItem(CSVReportItem.KEY.OK_LINE, Report.STATE.OK, line.getName()); report.addItem(reportItem); lines.add(line); } } try { currentLine = csvReader.readNext(); if (currentLine == null) break; } catch (IOException e) { ReportItem errorItem = new ExchangeReportItem(ExchangeReportItem.KEY.FILE_ERROR, Report.STATE.ERROR, e.getLocalizedMessage()); fileReportItem.addItem(errorItem); throw new ExchangeException(ExchangeExceptionCode.INVALID_CSV_FILE, filePath); } } // compute barycenters if (!lineProducer.getCommercials().isEmpty()) { geographicService.computeBarycentre(lineProducer.getCommercials().values()); } // warns unused Timetables int tmCount = timetableMap.size(); for (Timetable tm : timetableMap.values()) { if (tm.getVehicleJourneys() == null || tm.getVehicleJourneys().isEmpty()) { CSVReportItem unused = new CSVReportItem(CSVReportItem.KEY.UNUSED_TIMETABLE, Report.STATE.WARNING, tm.getComment(), tm.getObjectId()); timetableCountReport.addItem(unused); tmCount--; } } timetableCountReport.addMessageArgs(Integer.toString(tmCount)); report.addItem(timetableCountReport); lineCountReport.addMessageArgs(Integer.toString(lines.size())); report.addItem(lineCountReport); return lines; }
From source file:org.pentaho.platform.plugin.action.eclipsebirt.BIRTReportComponent.java
@Override protected boolean executeAction() { // IRuntimeContext context = getRuntimeContext(); // Get the real location of the report definition file BirtReportAction reportAction = (BirtReportAction) getActionDefinition(); IActionSequenceResource reportDefResource = getResource(reportAction.getReportDefinition().getName()); String reportDefinitionPath = reportDefResource.getAddress(); InputStream reportDefinition; try {//from ww w . j ava2 s .c o m reportDefinition = PentahoSystem.get(ISolutionRepository.class, getSession()) .getResourceInputStream(reportDefResource, true, ISolutionRepository.ACTION_EXECUTE); } catch (FileNotFoundException e1) { error(e1.getLocalizedMessage()); return false; } // Get the type of the output type = reportAction.getOutputType().getStringValue(); typeIdx = BIRTReportComponent.outputTypeStrings.indexOf(type); if (typeIdx < 0) { error(Messages.getErrorString("BIRT.ERROR_0003_REPORT_TYPE_NOT_VALID", type)); //$NON-NLS-1$ return false; } switch (typeIdx) { case OUTPUT_TYPE_HTML: { mimeType = "text/html"; //$NON-NLS-1$ extension = ".html"; //$NON-NLS-1$ renderOptions = new HTMLRenderOption(); break; } case OUTPUT_TYPE_PDF: { mimeType = "application/pdf"; //$NON-NLS-1$ extension = ".pdf"; //$NON-NLS-1$ renderOptions = new HTMLRenderOption(); break; } default: { error(Messages.getErrorString("BIRT.ERROR_0003_REPORT_TYPE_NOT_VALID", type)); //$NON-NLS-1$ return false; } } if (ComponentBase.debug) { debug(Messages.getString("BIRT.DEBUG_EXECUTING_REPORT", reportDefinitionPath, type)); //$NON-NLS-1$ } String fullyQualifiedServerUrl = PentahoSystem.getApplicationContext().getFullyQualifiedServerURL(); boolean result = false; try { // TODO support caching or the ReportRunnable object // Create an isntance of a runnable report using the report // definition file provided IReportRunnable design = BIRTReportComponent.reportEngine.openReportDesign(reportDefinition); if (design == null) { return false; } //getParameterDefns //IGetParameterDefinitionTask parameterDefinitionTask = reportEngine.createGetParameterDefinitionTask(design); parameterDefinitionTask = BIRTReportComponent.reportEngine.createGetParameterDefinitionTask(design); // Set up the parameters for the report HashMap parameterMap = new HashMap(); int parameterStatus = setupParameters(parameterDefinitionTask.getParameterDefns(false), parameterMap); if (parameterStatus == IRuntimeContext.PARAMETERS_FAIL) { error(Messages.getErrorString("BIRT.ERROR_0005_INVALID_REPORT_PARAMETERS")); //$NON-NLS-1$ return false; } else if (parameterStatus == IRuntimeContext.PARAMETERS_UI_NEEDED) { return true; } parameterDefinitionTask.close(); // Run task IRunAndRenderTask runTask = BIRTReportComponent.reportEngine.createRunAndRenderTask(design); IPentahoSession session = this.getSession(); runTask.setLocale(session.getLocale()); // Get the output stream that the content is going into OutputStream outputStream = null; IContentItem contentItem = null; IActionOutput actionOutput = reportAction.getOutputReport(); if (actionOutput != null) { if (actionOutput.getName().equals(BirtReportAction.REPORT_OUTPUT_ELEMENT)) { contentItem = getOutputItem(reportAction.getOutputReport().getName(), mimeType, extension); } else { contentItem = getOutputContentItem(actionOutput.getName()); contentItem.setMimeType(mimeType); } try { outputStream = contentItem.getOutputStream(getActionName()); } catch (Exception e) { } } else { // There was no output in the action-sequence document, so make // a default // outputStream. warn(Messages.getString("Base.WARN_NO_OUTPUT_STREAM")); //$NON-NLS-1$ outputStream = getDefaultOutputStream(mimeType); if (outputStream != null) { setOutputMimeType(mimeType); } } if (outputStream == null) { // We could not get an output stream for the content error(Messages.getErrorString("BIRT.ERROR_0006_INVALID_OUTPUT_STREAM")); //$NON-NLS-1$ return false; } // Execute the report try { result = generateReport(parameterMap, outputStream, runTask, fullyQualifiedServerUrl); } finally { if (contentItem != null) { contentItem.closeOutputStream(); } } } catch (Throwable e) { error(Messages.getErrorString("BIRT.ERROR_0007_REPORT_ERRORS_ENCOUNTERED", reportDefinitionPath), e); //$NON-NLS-1$ } return result; }
From source file:com.evolveum.polygon.connector.hcm.DocumentProcessing.java
public Map<String, Object> parseXMLData(HcmConnectorConfiguration conf, ResultsHandler handler, Map<String, Object> schemaAttributeMap, Filter query) { XMLInputFactory factory = XMLInputFactory.newInstance(); try {/*from w w w. j ava 2s . c o m*/ String uidAttributeName = conf.getUidAttribute(); String primariId = conf.getPrimaryId(); String startName = ""; String value = null; StringBuilder assignmentXMLBuilder = null; List<String> builderList = new ArrayList<String>(); Integer nOfIterations = 0; Boolean isSubjectToQuery = false; Boolean isAssigment = false; Boolean evaluateAttr = true; Boolean specificAttributeQuery = false; XMLEventReader eventReader = factory.createXMLEventReader(new FileReader(conf.getFilePath())); List<String> dictionary = populateDictionary(FIRSTFLAG); if (!attrsToGet.isEmpty()) { attrsToGet.add(uidAttributeName); attrsToGet.add(primariId); specificAttributeQuery = true; evaluateAttr = false; LOGGER.ok("The uid and primary id were added to the queried attribute list"); schemaAttributeMap = modifySchemaAttributeMap(schemaAttributeMap); } while (eventReader.hasNext()) { XMLEvent event = eventReader.nextEvent(); Integer code = event.getEventType(); if (code == XMLStreamConstants.START_ELEMENT) { StartElement startElement = event.asStartElement(); startName = startElement.getName().getLocalPart(); if (!evaluateAttr && attrsToGet.contains(startName)) { evaluateAttr = true; } if (!elementIsEmployeeData) { if (startName.equals(EMPLOYEES)) { if (dictionary.contains(nOfIterations.toString())) { LOGGER.ok("The defined number of iterations has been hit: {0}", nOfIterations.toString()); break; } else { startName = ""; elementIsEmployeeData = true; nOfIterations++; } } } else if (evaluateAttr) { if (!isAssigment) { if (!ASSIGNMENTTAG.equals(startName)) { } else { assignmentXMLBuilder = new StringBuilder(); isAssigment = true; } } else { builderList = processAssignment(startName, null, START, builderList); } if (multiValuedAttributesList.contains(startName)) { elementIsMultiValued = true; } } } else if (elementIsEmployeeData) { if (code == XMLStreamConstants.CHARACTERS && evaluateAttr) { Characters characters = event.asCharacters(); if (!characters.isWhiteSpace()) { StringBuilder valueBuilder; if (value != null) { valueBuilder = new StringBuilder(value).append("") .append(characters.getData().toString()); } else { valueBuilder = new StringBuilder(characters.getData().toString()); } value = valueBuilder.toString(); // value = StringEscapeUtils.escapeXml10(value); // LOGGER.info("The attribute value for: {0} is // {1}", startName, value); } } else if (code == XMLStreamConstants.END_ELEMENT) { EndElement endElement = event.asEndElement(); String endName = endElement.getName().getLocalPart(); isSubjectToQuery = checkFilter(endName, value, query, uidAttributeName); if (!isSubjectToQuery) { attributeMap.clear(); elementIsEmployeeData = false; value = null; endName = EMPLOYEES; } if (endName.equals(EMPLOYEES)) { attributeMap = handleEmployeeData(attributeMap, schemaAttributeMap, handler, uidAttributeName, primariId); elementIsEmployeeData = false; } else if (evaluateAttr) { if (endName.equals(startName)) { if (value != null) { if (!isAssigment) { if (!elementIsMultiValued) { attributeMap.put(startName, value); } else { multiValuedAttributeBuffer.put(startName, value); } } else { value = StringEscapeUtils.escapeXml10(value); builderList = processAssignment(endName, value, VALUE, builderList); builderList = processAssignment(endName, null, END, builderList); } // LOGGER.info("Attribute name: {0} and the // Attribute value: {1}", endName, value); value = null; } } else { if (endName.equals(ASSIGNMENTTAG)) { builderList = processAssignment(endName, null, CLOSE, builderList); // if (assigmentIsActive) { for (String records : builderList) { assignmentXMLBuilder.append(records); } attributeMap.put(ASSIGNMENTTAG, assignmentXMLBuilder.toString()); // } else { // } builderList = new ArrayList<String>(); // assigmentIsActive = false; isAssigment = false; } else if (multiValuedAttributesList.contains(endName)) { processMultiValuedAttributes(multiValuedAttributeBuffer); } } } if (specificAttributeQuery && evaluateAttr) { evaluateAttr = false; } } } else if (code == XMLStreamConstants.END_DOCUMENT) { handleBufferedData(uidAttributeName, primariId, handler); } } } catch (FileNotFoundException e) { StringBuilder errorBuilder = new StringBuilder("File not found at the specified path.") .append(e.getLocalizedMessage()); LOGGER.error("File not found at the specified path: {0}", e); throw new ConnectorIOException(errorBuilder.toString()); } catch (XMLStreamException e) { LOGGER.error("Unexpected processing error while parsing the .xml document : {0}", e); StringBuilder errorBuilder = new StringBuilder( "Unexpected processing error while parsing the .xml document. ") .append(e.getLocalizedMessage()); throw new ConnectorIOException(errorBuilder.toString()); } return attributeMap; }
From source file:com.nextgis.firereporter.GetFiresService.java
protected String readFromFile(File filePath) { String ret = ""; try {/*from ww w. jav a 2s. co m*/ FileInputStream inputStream = new FileInputStream(filePath); if (inputStream != null) { InputStreamReader inputStreamReader = new InputStreamReader(inputStream); BufferedReader bufferedReader = new BufferedReader(inputStreamReader); String receiveString = ""; StringBuilder stringBuilder = new StringBuilder(); while ((receiveString = bufferedReader.readLine()) != null) { stringBuilder.append(receiveString); } inputStream.close(); ret = stringBuilder.toString(); } } catch (FileNotFoundException e) { SendError(e.getLocalizedMessage()); } catch (IOException e) { SendError(e.getLocalizedMessage()); } return ret; }