org.apache.tika.utils.ExceptionUtils Java Examples

The following examples show how to use org.apache.tika.utils.ExceptionUtils. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Incident.java    From snowflake-jdbc with Apache License 2.0 5 votes vote down vote up
/**
 * Submit an exception to GS from a Throwable, this is the only constructor
 * that should be used to report incidents
 *
 * @param exc       a Throwable we want to report
 * @param jobId     job id String
 * @param requestId request id string
 */
public Incident(SFSession session,
                Throwable exc,
                String jobId,
                String requestId)
{
  this(session,
       jobId,
       requestId,
       exc.getMessage(),
       ExceptionUtils.getStackTrace(exc),
       String.valueOf(exc.getStackTrace()[0]));
}
 
Example #2
Source File: Incident.java    From snowflake-jdbc with Apache License 2.0 5 votes vote down vote up
/**
 * Submit an exception to GS from a Throwable, this is the only constructor
 * that should be used to report incidents
 *
 * @param serverUrl    GS's url
 * @param sessionToken GS's session token
 * @param exc          an Throwable we want to report
 * @param jobId        job id String
 * @param requestId    request id string
 */
public Incident(String serverUrl,
                String sessionToken,
                Throwable exc,
                String jobId,
                String requestId)
{
  this(serverUrl,
       sessionToken,
       jobId,
       requestId,
       exc.getMessage(),
       ExceptionUtils.getStackTrace(exc),
       String.valueOf(exc.getStackTrace()[0]));
}
 
Example #3
Source File: SolrUtil.java    From jate with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Get indexed term vectors
 * @param fieldname  field where term vectors will be retrieved
 * @param solrIndexSearcher  solr index searcher
 * @return Terms  term vectors
 * @throws JATEException
 */
public static Terms getTermVector(String fieldname, SolrIndexSearcher solrIndexSearcher) throws JATEException {
    try {
        Fields fields = MultiFields.getFields(solrIndexSearcher.getSlowAtomicReader());

        Terms vector = fields.terms(fieldname);
        if (vector == null)
            throw new JATEException(String.format("Cannot find expected field: %s", fieldname));
        return vector;
    } catch (IOException ioe) {
        StringBuilder sb = new StringBuilder(String.format("Cannot find expected field: %s. Error stacktrack: \n", fieldname));
        sb.append(org.apache.commons.lang.exception.ExceptionUtils.getFullStackTrace(ioe));
        throw new JATEException(sb.toString());
    }
}
 
Example #4
Source File: SolrUtil.java    From jate with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static Terms getTermVector(int docId, String fieldname, SolrIndexSearcher solrIndexSearcher) throws JATEException {
    try {
        Terms vector = solrIndexSearcher.getSlowAtomicReader().getTermVector(docId, fieldname);

        return vector;
    } catch (IOException ioe) {
        StringBuilder sb = new StringBuilder(String.format("Cannot find expected field: %s. Error stacktrack:\n", fieldname));
        sb.append(org.apache.commons.lang.exception.ExceptionUtils.getFullStackTrace(ioe));
        throw new JATEException(sb.toString());
    }
}