Example usage for java.io IOException toString

List of usage examples for java.io IOException toString

Introduction

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

Prototype

public String toString() 

Source Link

Document

Returns a short description of this throwable.

Usage

From source file:com.sastix.cms.server.services.content.impl.DistributedCacheServiceImpl.java

@Override
public void cacheIt(String uri, String tenantId) {
    try {/*  w w  w . j  a  v a  2s .c  o m*/
        if (hashedDirectoryService.getFileSize(uri, tenantId) < Constants.MAX_FILE_SIZE_TO_CACHE) {
            final byte[] data = hashedDirectoryService.getBytesByURI(uri, tenantId);
            final CacheDTO cacheDTO = new CacheDTO(uri, data);
            cacheService.cacheResource(cacheDTO);
        }
    } catch (IOException e) {
        throw new ResourceAccessError(e.toString());
    }

}

From source file:NCDSearch.NCDSearch.java

public NCDSearch(String targetpath, String path) {

    try {/*from   w ww .  j  a v a 2 s. c o  m*/
        this.targetbytes = org.apache.commons.io.FileUtils.readFileToByteArray(new File(targetpath));
    } catch (IOException e) {
        System.out.println(e.toString());
        System.out.println("Could not find target!" + targetpath);
    }

    search(path, COMPRESSION);
}

From source file:com.computationnode.Multiplier.java

@POST
@Consumes(MediaType.APPLICATION_JSON)//w w  w.ja v a  2  s  .  co  m
@Produces(MediaType.APPLICATION_JSON)
public Response multiply(String inputValues) throws IOException {
    ObjectMapper mapper = new ObjectMapper();
    String responseString = new String();
    try {
        Double[] inputArray = mapper.readValue(inputValues, Double[].class);
        if (inputArray.length % 2 != 0) {
            return Response.serverError().entity("Something wrong").build();
        }
        double[] resultArray = new double[inputArray.length / 2];
        for (int i = 0; i < inputArray.length; i += 2) {
            resultArray[i / 2] = inputArray[i] * inputArray[i + 1];
        }
        responseString = mapper.writeValueAsString(resultArray);
    } catch (IOException e) {
        return Response.serverError().entity(e.toString()).build();
    }
    return Response.ok(responseString, MediaType.APPLICATION_JSON).build();
}

From source file:com.sword.plugin.converter.ConverterMsg2Text.java

@Override
public BlobHolder convert(BlobHolder blobHolder, Map<String, Serializable> parameters)
        throws ConversionException {
    try {//from w  w  w. j  a  v  a 2s .co m

        final String USER_TEMP = System.getProperty("java.io.tmpdir");

        Message msg = null;
        try {
            blobHolder.getBlob().transferTo(new File(USER_TEMP + "\\converterMsg2Txt.conv"));
            MsgParser msgp = new MsgParser();
            msg = msgp.parseMsg(USER_TEMP + "\\converterMsg2Txt.conv");

        } catch (IOException e1) {
            log.error(e1.toString());
        }

        String text = msg.toString() + msg.getBodyText();

        return new SimpleCachableBlobHolder(new StringBlob(text, "text/plain"));
    } catch (Exception e) {
        log.error("Error during Msg2Txt conversion", e);
        throw new ConversionException("Error during XML2Text conversion", e);
    }
}

From source file:org.sample.SessionTest.app.PageSource.java

public void saveForced(WebDriver webDriver, String subTitle) {

    if (StringUtils.isEmpty(subTitle)) {
        subTitle = "";
    } else {//ww w .j  av  a2 s  .  c  o m
        subTitle = "-" + subTitle;
    }

    int sequenceNo = sequence.incrementAndGet();
    String evidenceFile = String.format("page_source_%03d%s.txt", sequenceNo, subTitle);
    File pageSourceFile = new File(evidenceSavingDirectory, evidenceFile);

    try {
        FileUtils.writeStringToFile(pageSourceFile, webDriver.getPageSource());

    } catch (IOException e) {
        logger.error(e.toString());
    }

}

From source file:com.example.todo.selenium.RestLog.java

public void saveForced(StringWriter writer, String subTitle) {

    if (StringUtils.isEmpty(subTitle)) {
        subTitle = "";
    } else {/* w ww.  j  av  a  2 s  .co m*/
        subTitle = "-" + subTitle;
    }

    int sequenceNo = sequence.incrementAndGet();
    String evidenceFile = String.format("rest_communi_%03d%s.txt", sequenceNo, subTitle);
    File pageSourceFile = new File(evidenceSavingDirectory, evidenceFile);

    try {
        FileUtils.writeStringToFile(pageSourceFile, writer.toString());

    } catch (IOException e) {
        logger.error(e.toString());
    }

}

From source file:org.terasoluna.gfw.functionaltest.app.DBLog.java

private void writeLog(String sql, int sequenceNo, String subTitle, String tableName) {
    String evidenceFile = String.format("dblog_%03d%s-%s.log", sequenceNo, subTitle, tableName);
    List<Map<String, Object>> results = jdbcTemplate.queryForList(sql);
    try {/*  w  ww  . j  av  a  2s.c om*/
        FileUtils.writeLines(new File(evidenceSavingDirectory, evidenceFile), results);
    } catch (IOException e) {
        logger.error(e.toString());
    } finally {
        results.clear();
        results = null;
    }
}

From source file:net.cnmconsulting.spring.config.PropertiesFactoryBeanAutowireTest.java

@Test
public void testCreateProperties() {
    PropertiesFactoryBean propertiesFactoryBean = new PropertiesFactoryBean(stringEncryptor);
    Resource location = new ClassPathResource("props-test.properties");
    propertiesFactoryBean.setLocation(location);
    try {// w ww .ja  v  a  2s. c o  m
        Properties props = propertiesFactoryBean.createProperties();
        assertNotNull(props);
        String pass = (String) props.getProperty("pass");
        assertNotNull(pass);

    } catch (IOException e) {
        e.printStackTrace();
        fail(e.toString());
    }

}

From source file:de.ailis.oneinstance.OneInstanceClient.java

/**
 * @see java.lang.Runnable#run()//from w ww.java  2s. co m
 */
@Override
public void run() {
    try {
        try {
            // Send the application ID.
            PrintWriter out = new PrintWriter(new OutputStreamWriter(this.socket.getOutputStream(), "UTF-8"));
            out.println(this.appId);
            out.flush();

            // Read the data from the client
            InputStream in = this.socket.getInputStream();
            ObjectInputStream objIn = new ObjectInputStream(in);
            File workingDir = (File) objIn.readObject();
            String[] args = (String[]) objIn.readObject();

            // Call event handler
            boolean result = OneInstance.getInstance().fireNewInstance(workingDir, args);

            // Send the result
            out.println(result ? "start" : "exit");
            out.flush();

            // Wait for client disconnect.
            in.read();
        } finally {
            this.socket.close();
        }
    } catch (IOException e) {
        LOG.error(e.toString(), e);
    } catch (ClassNotFoundException e) {
        LOG.error(e.toString(), e);
    }
}

From source file:dataLoader.Loader.java

public Loader(String jsonURL) {
    try {/*  w ww  . ja  v a2  s  .co m*/
        URL url = new URL(jsonURL);
        ObjectMapper mapper = new ObjectMapper();
        record = mapper.readValue(url,
                mapper.getTypeFactory().constructCollectionType(List.class, support.JsonClass.class));
        //System.out.println("size of record copied from url : "+record.size());
        communityGroup = summary(record);
    } catch (java.io.IOException e) {
        System.out.println(e.toString());
    }
}