Example usage for java.io IOException getLocalizedMessage

List of usage examples for java.io IOException getLocalizedMessage

Introduction

In this page you can find the example usage for java.io IOException getLocalizedMessage.

Prototype

public String getLocalizedMessage() 

Source Link

Document

Creates a localized description of this throwable.

Usage

From source file:it.geosolutions.geoserver.jms.impl.handlers.DocumentFileHandler.java

@Override
public boolean synchronize(DocumentFile event) throws Exception {
    FileOutputStream fout = null;
    try {/* w w w  .  j a  v  a  2  s  . c  o  m*/
        fout = new FileOutputStream(event.getPath());
        xstream.toXML(event.getBody(), fout);
        return true;
    } catch (IOException e) {
        if (LOGGER.isLoggable(java.util.logging.Level.SEVERE))
            LOGGER.severe(e.getLocalizedMessage());
        throw e;
    } finally {
        IOUtils.closeQuietly(fout);
    }
}

From source file:ru.altruix.commons.android.WebServiceTaskHelper.java

@Override
public String inputStreamToString(final InputStream is) {
    String line = "";
    final StringBuilder total = new StringBuilder();

    final BufferedReader rd = new BufferedReader(new InputStreamReader(is));

    try {/*w  ww.  ja  va  2s .  co m*/
        while ((line = rd.readLine()) != null) {
            total.append(line);
        }
    } catch (IOException e) {
        Log.e(TAG, e.getLocalizedMessage(), e);
    }

    return total.toString();
}

From source file:com.dpillay.projects.yafu.controller.FileUploadController.java

@RequestMapping(value = "/cancelUpload", method = RequestMethod.GET)
public @ResponseBody String cancelUpload(@RequestParam(value = "key", required = false) String key) {
    UploadResource uploadStatus = this.uploadMap.get(key);
    if (uploadStatus != null) {
        try {// w  w w .j  av a 2  s.c o m
            uploadStatus.cancel();
            return "{ \"uploadCanceled\": true }";
        } catch (IOException e) {
            log.error(e.getLocalizedMessage(), e);
        }
    }
    return "{ \"uploadCanceled\": false }";
}

From source file:com.googlecode.jgenhtml.JGenXmlTest.java

private void runJgenhtml() {
    try {/*  w  w  w  .  ja v  a 2  s .c  o  m*/
        File outputDir = JGenHtmlTestUtils.getTestDir();
        FileUtils.cleanDirectory(outputDir);//START WITH A CLEAN DIRECTORY!
        String outputDirPath = outputDir.getAbsolutePath();
        String traceFile = JGenHtmlTestUtils.getJstdTraceFiles(false, false)[0];
        String[] argv = new String[] { "-o", outputDirPath, traceFile };
        traceFileName = new File(traceFile).getName();
        JGenHtml.main(argv);
    } catch (IOException ex) {
        fail(ex.getLocalizedMessage());
    }
}

From source file:be.roots.taconic.pricingguide.job.RetryRequestJob.java

@Scheduled(fixedDelay = 30000)
public void retryPricingGuideRequestForUnfoundContact() throws MessagingException {

    final List<Request> unsendRequests = getUnsendRequests();
    for (Request unsendRequest : unsendRequests) {
        LOGGER.info(unsendRequest.getId() + " - Retrying to send request for hsID " + unsendRequest.getHsId()
                + " a " + unsendRequest.getRetryCount() + " time");
        unsendRequest.increaseRetryCount();
        try {//from   w  w w  . ja  va2s. com
            pricingGuideService.buildPricingGuide(unsendRequest);
        } catch (IOException e) {
            LOGGER.error(unsendRequest.getId() + " - " + e.getLocalizedMessage(), e);
        }
    }

}

From source file:com.dpillay.projects.yafu.controller.FileUploadController.java

@RequestMapping(value = "/fileUpload", method = RequestMethod.POST)
@ResponseStatus(value = HttpStatus.OK)//from w  w w .  j a va  2s  .c  o m
public String handleFormUpload(@RequestParam(value = "file", required = false) final MultipartFile file,
        @RequestParam(value = "key", required = false) final String key, ModelMap modelMap,
        final HttpServletRequest request) {
    if (log.isDebugEnabled())
        log.debug("Received upload file: {} with key: {}", file.getOriginalFilename(), key);
    if (!file.isEmpty()) {
        try {
            getFileUploadStatus(key, file, request.getSession().getId());
        } catch (IOException e) {
            log.error(e.getLocalizedMessage(), e);
        }
    }
    return null;
}

From source file:com.dpillay.projects.yafu.controller.FileUploadController.java

@RequestMapping(value = "/deleteUpload", method = RequestMethod.GET)
public @ResponseBody String deleteUpload(@RequestParam(value = "key", required = false) String key) {
    UploadResource uploadStatus = this.uploadMap.get(key);
    if (uploadStatus != null) {
        try {/*from   w w w  .jav  a  2s .  c o m*/
            uploadStatus.close();
            uploadStatus.delete();
            return "{ \"uploadDeleted\": true }";
        } catch (IOException e) {
            log.error(e.getLocalizedMessage(), e);
        } finally {
            this.uploadMap.remove(key);
        }
    }
    return "{ \"uploadDeleted\": false }";
}

From source file:fedroot.dacs.http.DacsResponse.java

public DacsResponse(HttpResponse httpResponse) throws DacsException {
    this.httpResponse = httpResponse;
    if (httpResponse.getEntity() != null) {
        try { // we use a BufferedHttpEntity so we can reset the input stream  after a DacsCheckRequest
            this.inputStream = new BufferedHttpEntity(httpResponse.getEntity()).getContent();
        } catch (IOException ex) {
            logger.log(Level.SEVERE, null, ex);
            throw new DacsException(ex.getLocalizedMessage());
        }//from  ww w .  j  a  v a 2s. c o m
    }
}

From source file:org.umit.icm.mobile.connectivity.ServiceHTTPS.java

/**
 * Returns an HTTPS Response String.//from w  w w.  j a  v  a2  s  .  c o m
 * 
 *                                                                                                 
              
@return      String
 *
         
@see HttpClient
 */
@Override
public String connect() {

    HttpClient httpClient = new DefaultHttpClient();
    HttpGet httpGet = new HttpGet(getServiceURL());

    try {
        HttpResponse httpResponse = httpClient.execute(httpGet);
        StatusLine statusLine = httpResponse.getStatusLine();
        if (statusLine.getStatusCode() != 200) {
            return "blocked";
        }
        HttpEntity httpEntity = httpResponse.getEntity();
        InputStream inputStream = httpEntity.getContent();
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        int bytes = 0;
        byte[] buffer = new byte[1024];
        while ((bytes = inputStream.read(buffer)) != -1) {
            byteArrayOutputStream.write(buffer, 0, bytes);
        }
        if (new String(byteArrayOutputStream.toByteArray()) != null)
            return "normal";
        else
            return "blocked";
    } catch (IOException e) {
        Log.w("####", e.getLocalizedMessage());
        return "blocked";
    }
}

From source file:com.wealdtech.configuration.ConfigurationSource.java

public T getConfiguration(final String filename, final Class<T> klazz) {
    final ObjectMapper mapper = ObjectMapperFactory.getDefaultMapper();
    try {//from  w  ww . ja v  a 2  s .  com
        return mapper.readValue(readFile(filename), klazz);
    } catch (IOException ioe) {
        LOGGER.error("Failed to parse JSON configuration file: {}", ioe.getLocalizedMessage(), ioe);
        throw new DataError("Failed to parse JSON configuration file", ioe);
    }
}