/** * Simple util to get stack trace. * <p> * This will unwrap a TikaException and return the cause if not null * <p> * NOTE: If your stacktraces are truncated, make sure to start your jvm * with: -XX:-OmitStackTraceInFastThrow * * @param t throwable * @return * @throws IOException */ public static String getFilteredStackTrace(Throwable t) { Throwable cause = t; if ((t instanceof TikaException) && t.getCause() != null) { cause = t.getCause(); } return getStackTrace(cause); }
/** * Records details of a {@link Parser}'s failure to the * {@link Metadata}, so you can check what went wrong even if the * {@link Exception} wasn't immediately thrown (eg when several different * Parsers are used) */ public static void recordParserFailure(Parser parser, Throwable failure, Metadata metadata) { String trace = ExceptionUtils.getStackTrace(failure); metadata.add(EMBEDDED_EXCEPTION, trace); metadata.add(EMBEDDED_PARSER, getParserClassname(parser)); }
} catch (InvalidFormatException e) { parentMetadata.add(TikaCoreProperties.TIKA_META_EXCEPTION_WARNING, ExceptionUtils.getStackTrace(e)); ExceptionUtils.getStackTrace(e)); ExceptionUtils.getStackTrace(e));
} catch (InvalidFormatException e) { metadata.add(TikaCoreProperties.TIKA_META_EXCEPTION_WARNING, ExceptionUtils.getStackTrace(e)); } catch (InvalidFormatException e) { metadata.add(TikaCoreProperties.TIKA_META_EXCEPTION_WARNING, ExceptionUtils.getStackTrace(e)); } catch (InvalidFormatException e) { metadata.add(TikaCoreProperties.TIKA_META_EXCEPTION_WARNING, ExceptionUtils.getStackTrace(e)); } catch (InvalidFormatException e) { metadata.add(TikaCoreProperties.TIKA_META_EXCEPTION_WARNING, ExceptionUtils.getStackTrace(e));
} catch (InvalidFormatException e) { metadata.add(TikaCoreProperties.TIKA_META_EXCEPTION_WARNING, ExceptionUtils.getStackTrace(e)); } catch (InvalidFormatException e) { metadata.add(TikaCoreProperties.TIKA_META_EXCEPTION_WARNING, ExceptionUtils.getStackTrace(e));
} catch (InvalidFormatException e) { metadata.add(TikaCoreProperties.TIKA_META_EXCEPTION_WARNING, ExceptionUtils.getStackTrace(e)); } catch (InvalidFormatException e) { metadata.add(TikaCoreProperties.TIKA_META_EXCEPTION_WARNING, ExceptionUtils.getStackTrace(e)); ExceptionUtils.getStackTrace(e));
} catch (InvalidFormatException e) { metadata.add(TikaCoreProperties.TIKA_META_EXCEPTION_WARNING, ExceptionUtils.getStackTrace(e)); } catch (InvalidFormatException|ZipException e) { metadata.add(TikaCoreProperties.TIKA_META_EXCEPTION_WARNING, ExceptionUtils.getStackTrace(e));
} catch (Exception e) { metadata.add(TikaCoreProperties.TIKA_META_EXCEPTION_WARNING, ExceptionUtils.getStackTrace(e)); ExceptionUtils.getStackTrace(e)); } catch (ZipException e) { metadata.add(TikaCoreProperties.TIKA_META_EXCEPTION_WARNING, ExceptionUtils.getStackTrace(e)); ExceptionUtils.getStackTrace(e));
/** * Simple util to get stack trace. * <p> * This will unwrap a TikaException and return the cause if not null * <p> * NOTE: If your stacktraces are truncated, make sure to start your jvm * with: -XX:-OmitStackTraceInFastThrow * * @param t throwable * @return * @throws IOException */ public static String getFilteredStackTrace(Throwable t) { Throwable cause = t; if ((t instanceof TikaException) && t.getCause() != null) { cause = t.getCause(); } return getStackTrace(cause); }
/** * Simple util to get stack trace. * <p> * This will unwrap a TikaException and return the cause if not null * <p> * NOTE: If your stacktraces are truncated, make sure to start your jvm * with: -XX:-OmitStackTraceInFastThrow * * @param t throwable * @return * @throws IOException */ public static String getFilteredStackTrace(Throwable t) { Throwable cause = t; if ((t instanceof TikaException) && t.getCause() != null) { cause = t.getCause(); } return getStackTrace(cause); }
private void handlePart(PackagePart packagePart, XWPFStylesShim styles, XWPFListManager listManager, XHTMLContentHandler xhtml) throws IOException, SAXException { Map<String, String> linkedRelationships = loadLinkedRelationships(packagePart, true, metadata); try (InputStream stream = packagePart.getInputStream()) { XMLReaderUtils.parseSAX( new CloseShieldInputStream(stream), new OfflineContentHandler(new EmbeddedContentHandler( new OOXMLWordAndPowerPointTextHandler( new OOXMLTikaBodyPartHandler(xhtml, styles, listManager, config), linkedRelationships, config.getIncludeShapeBasedContent(), config.getConcatenatePhoneticRuns()))), context); } catch (TikaException|IOException e) { metadata.add(TikaCoreProperties.TIKA_META_EXCEPTION_WARNING, ExceptionUtils.getStackTrace(e)); } }
@Override public void execute(ISchedulingService service) throws CloneNotSupportedException { logger.info("before prepare {}", remoteStreamUrl); try { if (prepare()) { logger.info("after prepare {}", remoteStreamUrl); packetFeederJobName = scheduler.addScheduledJob(10, RemoteBroadcastStream.this); } else { logger.warn("input format context cannot be created for {}", remoteStreamUrl); close(); } } catch (Exception e) { logger.error(ExceptionUtils.getStackTrace(e)); } } });
/** * buf is the flv packet */ @Override public int call(Pointer opaque, BytePointer buf, int bufSize) { int size = 0; try { offset = 0; RemoteBroadcastStream os = queueReferences.get(opaque); buf.get(os.tempData, 0, os.tempData.length); if (!os.headerWritten) { os.headerWritten = true; offset = 13; //first 13 byte are flv header } int dataPosition = offset; do { dataPosition = sendData(os.tempData, dataPosition, bufSize, os); } while (dataPosition != 0 && dataPosition < bufSize); return bufSize; } catch (Exception t) { logger.error("Error on OutputStream.write(): {} size {}" , t , size); logger.error(ExceptionUtils.getStackTrace(t)); return -1; } } }
/** * Records details of a {@link Parser}'s failure to the * {@link Metadata}, so you can check what went wrong even if the * {@link Exception} wasn't immediately thrown (eg when several different * Parsers are used) */ public static void recordParserFailure(Parser parser, Throwable failure, Metadata metadata) { String trace = ExceptionUtils.getStackTrace(failure); metadata.add(EMBEDDED_EXCEPTION, trace); metadata.add(EMBEDDED_PARSER, getParserClassname(parser)); }
} catch (InvalidFormatException e) { parentMetadata.add(TikaCoreProperties.TIKA_META_EXCEPTION_WARNING, ExceptionUtils.getStackTrace(e)); ExceptionUtils.getStackTrace(e)); ExceptionUtils.getStackTrace(e));
} catch (InvalidFormatException e) { metadata.add(TikaCoreProperties.TIKA_META_EXCEPTION_WARNING, ExceptionUtils.getStackTrace(e)); } catch (InvalidFormatException e) { metadata.add(TikaCoreProperties.TIKA_META_EXCEPTION_WARNING, ExceptionUtils.getStackTrace(e));
ExceptionUtils.getStackTrace(e));
} catch (InvalidFormatException e) { metadata.add(TikaCoreProperties.TIKA_META_EXCEPTION_WARNING, ExceptionUtils.getStackTrace(e)); } catch (InvalidFormatException e) { metadata.add(TikaCoreProperties.TIKA_META_EXCEPTION_WARNING, ExceptionUtils.getStackTrace(e)); ExceptionUtils.getStackTrace(e));
} catch (InvalidFormatException e) { metadata.add(TikaCoreProperties.TIKA_META_EXCEPTION_WARNING, ExceptionUtils.getStackTrace(e)); } catch (InvalidFormatException|ZipException e) { metadata.add(TikaCoreProperties.TIKA_META_EXCEPTION_WARNING, ExceptionUtils.getStackTrace(e));
private void handlePart(PackagePart packagePart, XWPFStylesShim styles, XWPFListManager listManager, XHTMLContentHandler xhtml) throws IOException, SAXException { Map<String, String> linkedRelationships = loadLinkedRelationships(packagePart, true, metadata); try (InputStream stream = packagePart.getInputStream()) { XMLReaderUtils.parseSAX( new CloseShieldInputStream(stream), new OfflineContentHandler(new EmbeddedContentHandler( new OOXMLWordAndPowerPointTextHandler( new OOXMLTikaBodyPartHandler(xhtml, styles, listManager, config), linkedRelationships, config.getIncludeShapeBasedContent(), config.getConcatenatePhoneticRuns()))), context); } catch (TikaException|IOException e) { metadata.add(TikaCoreProperties.TIKA_META_EXCEPTION_WARNING, ExceptionUtils.getStackTrace(e)); } }