Example usage for java.io FileNotFoundException toString

List of usage examples for java.io FileNotFoundException toString

Introduction

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

Prototype

public String toString() 

Source Link

Document

Returns a short description of this throwable.

Usage

From source file:BwaPairedAlignment.java

/**
 * Code to run in each one of the mappers. This is, the alignment with the corresponding entry data
 * The entry data has to be written into the local filesystem
 *//*w  w  w  .  j  a  v  a2 s  .  co m*/
@Override
public Iterator<String> call(Integer arg0, Iterator<Tuple2<String, String>> arg1) throws Exception {

    // STEP 1: Input fastq reads tmp file creation
    LOG.info("JMAbuin:: Tmp dir: " + this.tmpDir);
    String fastqFileName1 = this.tmpDir + this.appId + "-RDD" + arg0 + "_1";
    String fastqFileName2 = this.tmpDir + this.appId + "-RDD" + arg0 + "_2";

    LOG.info("JMAbuin:: Writing file: " + fastqFileName1);
    LOG.info("JMAbuin:: Writing file: " + fastqFileName2);

    File FastqFile1 = new File(fastqFileName1);
    File FastqFile2 = new File(fastqFileName2);

    FileOutputStream fos1;
    FileOutputStream fos2;

    BufferedWriter bw1;
    BufferedWriter bw2;

    ArrayList<String> returnedValues = new ArrayList<String>();

    //We write the data contained in this split into the two tmp files
    try {
        fos1 = new FileOutputStream(FastqFile1);
        fos2 = new FileOutputStream(FastqFile2);

        bw1 = new BufferedWriter(new OutputStreamWriter(fos1));
        bw2 = new BufferedWriter(new OutputStreamWriter(fos2));

        Tuple2<String, String> newFastqRead;

        while (arg1.hasNext()) {
            newFastqRead = arg1.next();

            bw1.write(newFastqRead._1.toString());
            bw1.newLine();

            bw2.write(newFastqRead._2.toString());
            bw2.newLine();
        }

        bw1.close();
        bw2.close();

        arg1 = null;

        returnedValues = this.runAlignmentProcess(arg0, fastqFileName1, fastqFileName2);

        // Delete temporary files, as they have now been copied to the
        // output directory
        LOG.info("JMAbuin:: Deleting file: " + fastqFileName1);
        FastqFile1.delete();
        LOG.info("JMAbuin:: Deleting file: " + fastqFileName2);
        FastqFile2.delete();

    } catch (FileNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        LOG.error(e.toString());
    }

    return returnedValues.iterator();
}

From source file:org.flowable.osgi.blueprint.BlueprintBasicTest.java

protected InputStream createTestBundleWithProcessEngineConfiguration() {
    try {//from  w w w.ja v a2s. com
        return TinyBundles.bundle()
                .add("OSGI-INF/blueprint/context.xml",
                        new FileInputStream(new File("src/test/resources/config/context.xml")))
                .set(Constants.BUNDLE_SYMBOLICNAME, "org.flowable.osgi.config")
                .set(Constants.DYNAMICIMPORT_PACKAGE, "*").build();
    } catch (FileNotFoundException fnfe) {
        fail("Failure in createTestBundleWithProcessEngineConfiguration " + fnfe.toString());
        return null;
    }
}

From source file:byps.test.servlet.MyRemoteStreams.java

@Override
public InputStream getVideoCheckSupportByteRange() throws RemoteException {
    BContentStream stream = null;//  w ww . j a  va  2  s  .  co  m
    try {
        stream = new BContentStreamWrapper(new java.io.File("d:/temp/bypssrv-data/video.mp4"));
    } catch (FileNotFoundException e) {
        throw new BException(BExceptionC.INTERNAL, e.toString());
    }
    return stream;
}

From source file:org.apache.nutch.collection.CollectionManager.java

/**
 * Save collections into file//ww  w .  j a v a 2  s. c o  m
 * 
 * @throws Exception
 */
public void save() throws IOException {
    try {
        final FileOutputStream fos = new FileOutputStream(new File(configfile.getFile()));
        final Document doc = new DocumentImpl();
        final Element collections = doc.createElement(Subcollection.TAG_COLLECTIONS);
        final Iterator iterator = collectionMap.values().iterator();

        while (iterator.hasNext()) {
            final Subcollection subCol = (Subcollection) iterator.next();
            final Element collection = doc.createElement(Subcollection.TAG_COLLECTION);
            collections.appendChild(collection);
            final Element name = doc.createElement(Subcollection.TAG_NAME);
            name.setNodeValue(subCol.getName());
            collection.appendChild(name);
            final Element whiteList = doc.createElement(Subcollection.TAG_WHITELIST);
            whiteList.setNodeValue(subCol.getWhiteListString());
            collection.appendChild(whiteList);
            final Element blackList = doc.createElement(Subcollection.TAG_BLACKLIST);
            blackList.setNodeValue(subCol.getBlackListString());
            collection.appendChild(blackList);
        }

        DomUtil.saveDom(fos, collections);
        fos.flush();
        fos.close();
    } catch (FileNotFoundException e) {
        throw new IOException(e.toString());
    }
}

From source file:org.montanafoodhub.base.get.OrderHub.java

protected List<Order> readFromFile(Context context) {
    List<Order> myOrderArr = new ArrayList<Order>();
    try {/* w  w w .j a va2  s. com*/
        // getItem the time the file was last changed here
        File myFile = new File(context.getFilesDir() + "/" + fileName);
        SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
        String lastRefreshTSStr = sdf.format(myFile.lastModified());
        Log.w(HubInit.logTag, "Using file (" + fileName + ") last modified on : " + lastRefreshTSStr);
        lastRefreshTS = sdf.getCalendar();

        // create products from the file here
        InputStream inputStream = context.openFileInput(fileName);
        if (inputStream != null) {
            parseCSV(myOrderArr, inputStream);
        }
        inputStream.close();
    } catch (FileNotFoundException e) {
        Log.e(HubInit.logTag, "File  (" + fileName + ") not found: " + e.toString());
    } catch (IOException e) {
        Log.e(HubInit.logTag, "Can not read file  (" + fileName + ") : " + e.toString());
    } catch (ParseException pe) {
        Log.e(HubInit.logTag, "Can't parse Order date  (" + fileName + ") : " + pe.toString());
    }
    Log.w(HubInit.logTag, "Number of orders loaded: " + myOrderArr.size());
    return myOrderArr;
}

From source file:org.montanafoodhub.base.get.CertificationHub.java

protected HashMap<String, Certification> readFromFile(Context context) {
    HashMap<String, Certification> myCertificationMap = new HashMap<String, Certification>();
    try {/*w  w w  .j  a  v a2s  .c om*/
        // getItem the time the file was last changed here
        File myFile = new File(context.getFilesDir() + "/" + fileName);
        SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
        String lastRefreshTSStr = sdf.format(myFile.lastModified());
        Log.w(HubInit.logTag, "Using file (" + fileName + ") last modified on : " + lastRefreshTSStr);
        lastRefreshTS = sdf.getCalendar();

        // create products from the file here
        InputStream inputStream = context.openFileInput(fileName);
        if (inputStream != null) {
            parseCSV(myCertificationMap, inputStream);
        }
        inputStream.close();
    } catch (FileNotFoundException e) {
        Log.e(HubInit.logTag, "File  (" + fileName + ") not found: " + e.toString());
    } catch (IOException e) {
        Log.e(HubInit.logTag, "Can not read file  (" + fileName + ") : " + e.toString());
    }
    Log.w(HubInit.logTag, "Number of certifications loaded: " + myCertificationMap.size());
    return myCertificationMap;
}

From source file:main.java.miro.browser.util.DownloadHandler.java

public void sendDownload(String filepath) {
    try {//from  ww w.j av a  2s  .c  o m
        File file = new File(filepath);
        InputStream stream = new FileInputStream(file);
        runDownloadService(stream, file.getName());
    } catch (FileNotFoundException e) {
        e.printStackTrace();
        log.log(Level.WARNING, e.toString());
    }
}

From source file:org.montanafoodhub.base.get.ItemHub.java

protected HashMap<String, Item> readFromFile(Context context) {
    HashMap<String, Item> myItemMap = new HashMap<String, Item>();
    try {//  w w w  .j  a  v  a2s  .  c  om
        // getItem the time the file was last changed here
        File myFile = new File(context.getFilesDir() + "/" + fileName);
        SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
        String lastRefreshTSStr = sdf.format(myFile.lastModified());
        Log.w(HubInit.logTag, "Using file (" + fileName + ") last modified on : " + lastRefreshTSStr);
        lastRefreshTS = sdf.getCalendar();

        // create products from the file here
        InputStream inputStream = context.openFileInput(fileName);
        if (inputStream != null) {
            parseCSV(myItemMap, inputStream);
        }
        inputStream.close();
    } catch (FileNotFoundException e) {
        Log.e(HubInit.logTag, "File  (" + fileName + ") not found: " + e.toString());
    } catch (IOException e) {
        Log.e(HubInit.logTag, "Can not read file  (" + fileName + ") : " + e.toString());
    }
    Log.w(HubInit.logTag, "Number of items loaded: " + myItemMap.size());
    return myItemMap;
}

From source file:at.ac.tuwien.dsg.depic.depictool.generator.DaaSGenerator.java

private String loadTemplateClass(String templateName) {

    String templateConstraintClass = "";

    String filePath = "";

    if (templateName.equals("MetricConstraint")) {
        filePath = rootPath + "/classes/templateclass/" + "TemplateConstraint.tpl";
    } else if (templateName.equals("ConstraintConverter")) {
        filePath = rootPath + "/classes/templateclass/" + "ConstraintConverter.tpl";
    } else if (templateName.equals("ConsumerRequirement")) {
        filePath = rootPath + "/classes/templateclass/" + "ConsumerRequirement.tpl";
    }/* w w  w. j  a  v  a2  s. c om*/

    FileInputStream fstream = null;
    try {
        fstream = new FileInputStream(filePath);
        // FileInputStream fstream = new FileInputStream("covertype.csv");
    } catch (FileNotFoundException ex) {
        Logger.logInfo(ex.toString());
    }

    DataInputStream in = new DataInputStream(fstream);
    BufferedReader br = new BufferedReader(new InputStreamReader(in));

    String strLine = "";

    try {
        while ((strLine = br.readLine()) != null) {
            templateConstraintClass = templateConstraintClass + strLine + "\n";

        }
    } catch (IOException ex) {
        Logger.logInfo(ex.toString());
    }

    return templateConstraintClass;
}

From source file:org.sonar.plugins.cxx.compiler.CxxCompilerSensor.java

@Override
protected void processReport(final Project project, final SensorContext context, File report)
        throws javax.xml.stream.XMLStreamException {
    int countViolations = 0;
    final CompilerParser parser = getCompilerParser();
    final String reportCharset = getParserStringProperty(REPORT_CHARSET_DEF, parser.defaultCharset());
    final String reportRegEx = getParserStringProperty(REPORT_REGEX_DEF, parser.defaultRegexp());
    final List<CompilerParser.Warning> warnings = new LinkedList<CompilerParser.Warning>();

    // Iterate through the lines of the input file
    CxxUtils.LOG.info("Scanner '" + parser.key() + "' initialized with report '{}'" + ", CharSet= '"
            + reportCharset + "'", report);
    try {//  ww  w . j av a 2 s. co  m
        parser.ParseReport(report, reportCharset, reportRegEx, warnings);
        for (CompilerParser.Warning w : warnings) {
            // get filename from file system - e.g. VC writes case insensitive file name to html
            if (isInputValid(w.filename, w.line, w.id, w.msg)) {
                if (saveUniqueViolation(project, context, parser.rulesRepositoryKey(), w.filename, w.line, w.id,
                        w.msg)) {
                    countViolations++;
                }
            } else {
                CxxUtils.LOG.warn("C-Compiler warning: {}", w.msg);
            }
        }
        CxxUtils.LOG.info("C-Compiler warnings processed = " + countViolations);
    } catch (java.io.FileNotFoundException e) {
        CxxUtils.LOG.error("processReport Exception: " + "report.getName" + " - not processed '{}'",
                e.toString());
    } catch (java.lang.IllegalArgumentException e1) {
        CxxUtils.LOG.error("processReport Exception: " + "report.getName" + " - not processed '{}'",
                e1.toString());
    }
}