List of usage examples for java.io IOException getStackTrace
public StackTraceElement[] getStackTrace()
From source file:ch.unibas.fittingwizard.mocks.MockMultipoleGaussScript.java
@Override public MultipoleGaussOutput execute(MultipoleGaussInput input) { File specificMoleculeDir = new File(moleculesDir, input.getMoleculeName()); File logOutfile = new File(specificMoleculeDir, input.getMoleculeName() + logExtension); File punOutfile = new File(specificMoleculeDir, input.getMoleculeName() + punExtension); File cubeOutfile = new File(specificMoleculeDir, input.getMoleculeName() + cubeExtension); File vdwOutfile = new File(specificMoleculeDir, input.getMoleculeName() + vdwExtension); File precomputedDataDir = new File(moleculeTestdataDir, input.getMoleculeName()); for (String fileExtension : filesToCopy) { File precomputedFile = new File(precomputedDataDir, input.getMoleculeName() + fileExtension); try {/*from ww w.jav a 2s . co m*/ FileUtils.copyFile(precomputedFile, new File(specificMoleculeDir, input.getMoleculeName() + fileExtension)); } catch (IOException e) { logger.error(e.getStackTrace()); throw new RuntimeException("Could not copy precomputed file " + precomputedFile); } } MultipoleGaussOutput output = new MultipoleGaussOutput(true, logOutfile, punOutfile, cubeOutfile, vdwOutfile); return output; }
From source file:org.openlmis.upload.parser.CSVParser.java
@Transactional public int process(InputStream inputStream, ModelClass modelClass, RecordHandler recordHandler, AuditFields auditFields) throws UploadException { CsvBeanReader csvBeanReader = null;/* w w w.j a v a 2 s .c om*/ String[] headers = null; try { csvBeanReader = new CsvBeanReader(modelClass, inputStream); headers = csvBeanReader.getHeaders(); csvBeanReader.validateHeaders(); Importable importedModel; while ((importedModel = csvBeanReader.readWithCellProcessors()) != null) { recordHandler.execute(importedModel, csvBeanReader.getRowNumber(), auditFields); } recordHandler.postProcess(auditFields); } catch (SuperCsvConstraintViolationException constraintException) { if (constraintException.getMessage().contains("^\\d{1,2}/\\d{1,2}/\\d{4}$")) { createHeaderException("incorrect.date.format", headers, constraintException); } createHeaderException("missing.mandatory", headers, constraintException); } catch (SuperCsvCellProcessorException processorException) { createHeaderException("incorrect.data.type", headers, processorException); } catch (SuperCsvException superCsvException) { if (csvBeanReader.length() > headers.length) { throw new UploadException("incorrect.file.format"); } createDataException("column.do.not.match", headers, superCsvException); } catch (IOException e) { throw new UploadException(e.getStackTrace().toString()); } return csvBeanReader.getRowNumber() - 1; }
From source file:org.forgerock.doc.maven.ImageDataTransformer.java
/** * Construct an updater to match DocBook XML files. * * <p>/*www . j a v a 2s. c o m*/ * * The files are updated in place. * * <p> * The following example shows how this might be used in your code with * tools from Apache Commons. * <pre> * File xmlSourceDirectory = new File("/path/to/xml/files/"); * * // Match normal directories, and XML files. * IOFileFilter dirFilter = FileFilterUtils * .and(FileFilterUtils.directoryFileFilter(), * HiddenFileFilter.VISIBLE); * IOFileFilter fileFilter = FileFilterUtils.and( * FileFilterUtils.fileFileFilter(), * FileFilterUtils.suffixFileFilter(".xml")); * FileFilter filterToMatch = FileFilterUtils.or(dirFilter, fileFilter); * * // Update XML files. * ImageDataTransformer idt = new ImageDataTransformer(filterToMatch); * return idt.update(xmlSourceDirectory); * </pre> * * @param filterToMatch Filter to match XML files. */ public ImageDataTransformer(final FileFilter filterToMatch) { super(filterToMatch, -1); try { this.transformer = getTransformer(); } catch (IOException ie) { System.err.println(ie.getStackTrace()); System.exit(1); } catch (TransformerConfigurationException tce) { System.err.println(tce.getStackTrace()); System.exit(1); } }
From source file:com.tridion.storage.si4t.dao.JPASearchPageDAO.java
public void create(CharacterData page, String relativePath) throws StorageException { log.debug("Create."); TridionPublishableItemProcessor tp;// w w w . j av a 2 s . c om try { tp = new TridionPublishableItemProcessor(page.getString(), FactoryAction.UPDATE, IndexType.PAGE, Integer.toString(page.getPublicationId()), "tcm:" + page.getPublicationId() + "-" + page.getId() + "-64", this.storageId); CharacterData c = tp.processPageSource(page); if (c != null) { super.create(c, relativePath); } else { log.error( "Error processing page: " + relativePath + ", proceeding with deployment of original page"); super.create(page, relativePath); } } catch (IOException e) { log.error(Utils.stacktraceToString(e.getStackTrace())); throw new StorageException("IO Exception: " + e.getLocalizedMessage(), e); } }
From source file:com.tridion.storage.si4t.dao.JPASearchPageDAO.java
@Override public void update(CharacterData page, String originalRelativePath, String newRelativePath) throws StorageException { log.debug("Update. Orgpath=" + originalRelativePath); TridionPublishableItemProcessor tp;/* ww w .jav a 2s . c om*/ try { tp = new TridionPublishableItemProcessor(page.getString(), FactoryAction.UPDATE, IndexType.PAGE, Integer.toString(page.getPublicationId()), "tcm:" + page.getPublicationId() + "-" + page.getId() + "-64", this.storageId); CharacterData c = tp.processPageSource(page); if (c != null) { super.update(c, originalRelativePath, newRelativePath); } else { log.error("Error processing page: " + newRelativePath + ", proceeding with deployment of original page"); super.update(page, originalRelativePath, newRelativePath); } } catch (IOException e) { log.error(Utils.stacktraceToString(e.getStackTrace())); throw new StorageException("IO Exception: " + e.getLocalizedMessage(), e); } }
From source file:com.sysunite.nifi.StringSplitTest.java
@Test public void testOnTrigger() { try {/*from ww w .j av a 2 s . c om*/ String file = "line.txt"; byte[] contents = FileUtils .readFileToByteArray(new File(getClass().getClassLoader().getResource(file).getFile())); InputStream in = new ByteArrayInputStream(contents); InputStream cont = new ByteArrayInputStream(IOUtils.toByteArray(in)); // Add properites testRunner.setProperty(StringSplit.SPLIT, ";"); testRunner.setProperty("RouteA", "0"); testRunner.setProperty("RouteB", "1"); testRunner.setProperty("AnotherThing", "3"); // Add the content to the runner testRunner.enqueue(cont); // Run the enqueued content, it also takes an int = number of contents queued testRunner.run(); //get contents for a specific dynamic relationship List<MockFlowFile> results = testRunner.getFlowFilesForRelationship("RouteB"); assertTrue("1 match", results.size() == 1); MockFlowFile result = results.get(0); result.assertAttributeEquals("RouteB", "(ABCT1-N-02A/02B)CT1-W2hoofdrijbaan"); //get original flowfile contents results = testRunner.getFlowFilesForRelationship("original"); result = results.get(0); String resultValue = new String(testRunner.getContentAsByteArray(result)); System.out.println(resultValue); } catch (IOException e) { System.out.println("FOUT!!"); System.out.println(e.getStackTrace()); } }
From source file:com.sysunite.weaver.nifi.FilterXMLNodesTest.java
@Test public void testOnTrigger() { try {// ww w .j av a 2 s .c o m String file = "slagboom.xml"; byte[] contents = FileUtils .readFileToByteArray(new File(getClass().getClassLoader().getResource(file).getFile())); InputStream in = new ByteArrayInputStream(contents); InputStream cont = new ByteArrayInputStream(IOUtils.toByteArray(in)); // Generate a test runner to mock a processor in a flow TestRunner runner = TestRunners.newTestRunner(new FilterXMLNodes()); // Add properites runner.setProperty(FilterXMLNodes.PROP_NODE, "FunctionalPhysicalObject"); runner.setProperty(FilterXMLNodes.PROP_NODE_ATTRIBUTE, "name"); runner.setProperty(FilterXMLNodes.PROP_PREGMATCH, "(.*)AB(.*)CT(.*)"); // Add the content to the runner runner.enqueue(cont); // Run the enqueued content, it also takes an int = number of contents queued runner.run(); // All results were processed with out failure //runner.assertQueueEmpty(); // If you need to read or do aditional tests on results you can access the content List<MockFlowFile> results = runner.getFlowFilesForRelationship(FilterXMLNodes.MY_RELATIONSHIP); //assertTrue("1 match", results.size() == 1); System.out.println("aantal gevonden: " + results.size()); //MockFlowFile result = results.get(0); //String resultValue = new String(runner.getContentAsByteArray(result)); //System.out.println("Match: " + IOUtils.toString(runner.getContentAsByteArray(result))); } catch (IOException e) { System.out.println("FOUT!!"); System.out.println(e.getStackTrace()); } }
From source file:org.apache.hadoop.mapred.ShuffleExceptionTracker.java
private boolean checkStackException(IOException ie) { StackTraceElement[] stack = ie.getStackTrace(); for (StackTraceElement elem : stack) { String stacktrace = elem.toString(); if (stacktrace.matches(exceptionStackRegex)) { return true; }// w w w .j a v a2 s.c om } return false; }
From source file:com.hp.octane.integrations.services.vulnerabilities.SSCOctaneClosedIssuesSync.java
public List<OctaneIssue> getCloseIssueInSSCOpenedInOctane() { List<String> issueRemoteIds = null; try {// ww w . ja va 2 s. com issueRemoteIds = getRemoteIdsOpenVulnsFromOctane(vulnerabilitiesQueueItem.jobId, vulnerabilitiesQueueItem.buildId); Issues sscIssues = getOpenVulnsFromSSC(sscProjectConfiguration, sscRestClient); return getClosedInSSCOpenInOctane(issueRemoteIds, sscIssues); } catch (IOException e) { logger.error(e.getMessage()); logger.error(e.getStackTrace()); } return new ArrayList<>(); }
From source file:com.sysunite.weaver.nifi.CreateObjectPropertyTest.java
@Test public void testOnTrigger() { try {/*from w w w . ja v a2 s.co m*/ String file = "slagboom.xml"; byte[] contents = FileUtils .readFileToByteArray(new File(getClass().getClassLoader().getResource(file).getFile())); InputStream in = new ByteArrayInputStream(contents); InputStream cont = new ByteArrayInputStream(IOUtils.toByteArray(in)); // Generate a test runner to mock a processor in a flow TestRunner runner = TestRunners.newTestRunner(new CreateObjectProperty()); // Add properites runner.setProperty(CreateObjectProperty.PROP_NODE, "FunctionalPhysicalObject"); runner.setProperty(CreateObjectProperty.PROP_NODE_ATTRIBUTE, "id"); runner.setProperty(CreateObjectProperty.PROP_CHILDNODE, "HasAsSubject"); runner.setProperty(CreateObjectProperty.PROP_CHILDNODE_ATTRIBUTE, "noattr"); //optional runner.setProperty(CreateObjectProperty.PROP_CHILDNODE_SUB, "Geometry"); runner.setProperty(CreateObjectProperty.PROP_CHILDNODE_SUB_ATTRIBUTE, "id"); // Add the content to the runner runner.enqueue(cont); // Run the enqueued content, it also takes an int = number of contents queued runner.run(); // All results were processed with out failure //runner.assertQueueEmpty(); // // If you need to read or do aditional tests on results you can access the content // List<MockFlowFile> results = runner.getFlowFilesForRelationship(CreateObjectProperty.MY_RELATIONSHIP); // //assertTrue("1 match", results.size() == 1); // // System.out.println("aantal gevonden: " + results.size()); // // MockFlowFile result = results.get(0); // String resultValue = new String(runner.getContentAsByteArray(result)); // // // //check weaver // String checkValue = weaver.get("816ee370-4274-e211-a3a8-b8ac6f902f00").toString(); // // assertEquals(checkValue, resultValue); //System.out.println("Match: " + IOUtils.toString(runner.getContentAsByteArray(result))); } catch (IOException e) { System.out.println("FOUT!!"); System.out.println(e.getStackTrace()); } }