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.cloudera.sqoop.tool.ImportAllTablesTool.java

@Override
/** {@inheritDoc} */
public int run(SqoopOptions options) {
    HiveImport hiveImport = null;//from   ww w . j av  a 2 s. c om

    if (!init(options)) {
        return 1;
    }

    try {
        if (options.doHiveImport()) {
            hiveImport = new HiveImport(options, manager, options.getConf(), false);
        }

        String[] tables = manager.listTables();
        if (null == tables) {
            System.err.println("Could not retrieve tables list from server");
            LOG.error("manager.listTables() returned null");
            return 1;
        } else {
            for (String tableName : tables) {
                importTable(options, tableName, hiveImport);
            }
        }
    } catch (IOException ioe) {
        LOG.error("Encountered IOException running import job: " + ioe.toString());
        if (System.getProperty(Sqoop.SQOOP_RETHROW_PROPERTY) != null) {
            throw new RuntimeException(ioe);
        } else {
            return 1;
        }
    } catch (ImportException ie) {
        LOG.error("Error during import: " + ie.toString());
        if (System.getProperty(Sqoop.SQOOP_RETHROW_PROPERTY) != null) {
            throw new RuntimeException(ie);
        } else {
            return 1;
        }
    } finally {
        destroy(options);
    }

    return 0;
}

From source file:com.marklogic.contentpump.Versions.java

protected Versions(String component) {
    info = new Properties();
    String versionInfoFile = component + "-version-info.properties";
    InputStream is = null;//w  ww. j  a v a  2 s .com
    try {
        is = Thread.currentThread().getContextClassLoader().getResourceAsStream(versionInfoFile);
        if (is == null) {
            throw new IOException("Resource not found");
        }
        info.load(is);
    } catch (IOException ex) {
        LogFactory.getLog(getClass()).warn("Could not read '" + versionInfoFile + "', " + ex.toString(), ex);
    } finally {
        IOUtils.closeStream(is);
    }
}

From source file:com.amazon.photosharing.rest.ContentService.java

@POST
@Path("/upload")
@Produces(MediaType.APPLICATION_JSON)/*from w ww  .ja v a2s.c  o  m*/
@Consumes(MediaType.MULTIPART_FORM_DATA)

public Response uploadPictureToS3(@Context HttpHeaders httpHeaders,
        @FormDataParam("comments") List<String> commentStringList,
        @FormDataParam("file") InputStream fileInputStream,
        @FormDataParam("file") FormDataContentDisposition disposition) {
    try {
        Comment[] comments = new Comment[commentStringList.size()];

        int i = 0;
        for (String commentString : commentStringList) {
            Comment comment = new Comment();
            comment.setText(commentString);
            comments[i] = comment;
            i++;
        }

        String userName = _request.getUserPrincipal().getName();

        _logger.info("Username : " + userName);
        _logger.info("Comments: " + comments);

        if (disposition != null)
            _logger.info("Name: " + disposition.getName());
        if (disposition != null)
            _logger.info("Filename: " + disposition.getFileName());

        User user = _userFacade.findUser(userName);
        Media media = _facade.uploadPictureToS3(user, disposition.getFileName(), fileInputStream,
                disposition.getType(), comments);

        MediaResult uploadResult = new MediaResult(media);

        return Response.status(HttpStatus.SC_OK).entity(uploadResult).build();
    }

    catch (IOException exc) {
        _logger.error(exc.toString(), exc);
        return Response.status(HttpStatus.SC_BAD_REQUEST).build();
    }
}

From source file:net.servicefixture.Configuration.java

private void loadProperties() {
    try {//from w w  w.  j  a  va  2s .  c om
        properties.load(
                Thread.currentThread().getContextClassLoader().getResourceAsStream(SERVICEFIXTURE_PROPERTIES));
        InfoLogger.log(log, "Loaded properties from " + SERVICEFIXTURE_PROPERTIES + " successfully.");
    } catch (IOException e) {
        InfoLogger.log(log,
                "Unable to loaded properties from " + SERVICEFIXTURE_PROPERTIES + " due to:" + e.toString());
    }
}

From source file:com.newatlanta.appengine.vfs.provider.GaeFileContent.java

public void close() throws FileSystemException {
    synchronized (closeableList) {
        // using array avoids ConcurrentModificationException
        Closeable[] closeableArray = closeableList.toArray(new Closeable[closeableList.size()]);
        for (Closeable closeable : closeableArray) {
            try {
                closeable.close();/*from  w w w  . ja v a2s  .c  o m*/
            } catch (IOException e) {
                GaeVFS.log.warning(e.toString());
            }
        }
    }
}

From source file:com.photon.phresco.nativeapp.unit.test.testcases.D_ProductDetailActivityTest.java

/**
 * get the detail about product from web server
 *
 *//* ww w .  j a v  a2  s . c  o  m*/

@Test
public final void testProductDetail() {
    Product product = new Product();

    try {
        PhrescoLogger.info(TAG + " testProductDetail -------------- START ");

        int productId = 1;
        JSONObject productDetailJSONObj = product.getProductJSONObject(
                Constants.getWebContextURL() + Constants.getRestAPI() + Constants.PRODUCTS_URL + productId);
        assertNotNull(productDetailJSONObj);
        JSONArray productDetailArray = productDetailJSONObj.getJSONArray("product");
        assertTrue(productDetailArray.length() > 0);

        PhrescoLogger.info(TAG + "testProductDetail -------------- END ");
    } catch (IOException ex) {
        PhrescoLogger.info(TAG + "testProductDetail - IOException: " + ex.toString());
        PhrescoLogger.warning(ex);
    } catch (JSONException ex) {
        PhrescoLogger.info(TAG + "testProductDetail - JSONException: " + ex.toString());
        PhrescoLogger.warning(ex);
    }
}

From source file:com.athena.meerkat.controller.web.provisioning.log.LogTailerListener.java

@Override
public void handle(String line) {

    if (stop) {//from ww w .  j a va  2  s . c  o m
        LOGGER.warn("trailer already was stopped!!");
        stop();
        return;
    }

    if (line == null) {
        LOGGER.warn("log is null!!");
    } else {
        try {
            if (this.session != null) {
                this.session.sendMessage(new TextMessage(line));
            }

            add(line);

        } catch (IOException e) {
            LOGGER.error(e.toString(), e);
        } finally {

            if (line.indexOf(TomcatProvisioningService.LOG_END) > -1) {
                stop();
            }
        }
    }
}

From source file:org.openmrs.mobile.listeners.forms.AvailableFormsListListener.java

private Document writeResponseToDoc(String response) {
    Document xFormsDoc = null;/*from w  ww. j a  va  2 s  . c  om*/
    try {
        xFormsDoc = new Document();
        KXmlParser parser = new KXmlParser();
        parser.setInput(new StringReader(response));
        parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
        xFormsDoc.parse(parser);
    } catch (IOException e) {
        mLogger.d(e.toString());
    } catch (XmlPullParserException e) {
        mLogger.d(e.toString());
    }
    return xFormsDoc;
}

From source file:libra.preprocess.stage2.KmerIndexBuilderPartitioner.java

@Override
public int getPartition(CompressedSequenceWritable key, IntWritable value, int numReduceTasks) {
    if (!this.initialized) {
        try {//from   ww w. j  a  v a2  s.  c  o  m
            initialize();
            this.initialized = true;
        } catch (IOException ex) {
            throw new RuntimeException(ex.toString());
        }
    }

    try {
        initializeSecond(numReduceTasks);
    } catch (IOException ex) {
        throw new RuntimeException(ex.toString());
    }

    int partition = getPartitionIndex(key);
    if (partition < 0) {
        throw new RuntimeException("partition failed");
    }

    return partition;
}

From source file:com.juick.android.JASocketClient.java

public boolean send(String str) {
    if (os == null)
        return false;
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    try {/*from   w  ww.  jav a 2 s  .com*/
        byte[] bytes = str.getBytes("utf-8");
        baos.write(bytes);
        os.write(baos.toByteArray());
        os.write('\n');
        os.flush();
        markActivity();
        return true;
    } catch (IOException e) {
        log("WS send:" + e.toString());
        disconnect(); // will iterate loop
        return false;
    }
}