当前位置: 首页>>代码示例>>Java>>正文


Java ExceptionsHelper.stackTrace方法代码示例

本文整理汇总了Java中org.elasticsearch.ExceptionsHelper.stackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java ExceptionsHelper.stackTrace方法的具体用法?Java ExceptionsHelper.stackTrace怎么用?Java ExceptionsHelper.stackTrace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.elasticsearch.ExceptionsHelper的用法示例。


在下文中一共展示了ExceptionsHelper.stackTrace方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: toString

import org.elasticsearch.ExceptionsHelper; //导入方法依赖的package包/类
/**
 * Return a {@link String} that is the json representation of the provided {@link ToXContent}.
 * Wraps the output into an anonymous object.
 */
public static String toString(ToXContent toXContent) {
    try {
        XContentBuilder builder = JsonXContent.contentBuilder();
        if (toXContent.isFragment()) {
            builder.startObject();
        }
        toXContent.toXContent(builder, ToXContent.EMPTY_PARAMS);
        if (toXContent.isFragment()) {
            builder.endObject();
        }
        return builder.string();
    } catch (IOException e) {
        return "Error building toString out of XContent: " + ExceptionsHelper.stackTrace(e);
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:20,代码来源:Strings.java

示例2: testConvert

import org.elasticsearch.ExceptionsHelper; //导入方法依赖的package包/类
public void testConvert() throws IOException {
    RestRequest request = new FakeRestRequest();
    RestChannel channel = new DetailedExceptionRestChannel(request);
    ShardSearchFailure failure = new ShardSearchFailure(new ParsingException(1, 2, "foobar", null),
            new SearchShardTarget("node_1", new Index("foo", "_na_"), 1));
    ShardSearchFailure failure1 = new ShardSearchFailure(new ParsingException(1, 2, "foobar", null),
            new SearchShardTarget("node_1", new Index("foo", "_na_"), 2));
    SearchPhaseExecutionException ex = new SearchPhaseExecutionException("search", "all shards failed",  new ShardSearchFailure[] {failure, failure1});
    BytesRestResponse response = new BytesRestResponse(channel, new RemoteTransportException("foo", ex));
    String text = response.content().utf8ToString();
    String expected = "{\"error\":{\"root_cause\":[{\"type\":\"parsing_exception\",\"reason\":\"foobar\",\"line\":1,\"col\":2}],\"type\":\"search_phase_execution_exception\",\"reason\":\"all shards failed\",\"phase\":\"search\",\"grouped\":true,\"failed_shards\":[{\"shard\":1,\"index\":\"foo\",\"node\":\"node_1\",\"reason\":{\"type\":\"parsing_exception\",\"reason\":\"foobar\",\"line\":1,\"col\":2}}]},\"status\":400}";
    assertEquals(expected.trim(), text.trim());
    String stackTrace = ExceptionsHelper.stackTrace(ex);
    assertTrue(stackTrace.contains("Caused by: ParsingException[foobar]"));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:16,代码来源:BytesRestResponseTests.java

示例3: toString

import org.elasticsearch.ExceptionsHelper; //导入方法依赖的package包/类
@Override
public String toString() {
    return "shard [" + (shardTarget == null ? "_na" : shardTarget) + "], reason [" + reason + "], cause [" + (cause == null ? "_na" : ExceptionsHelper.stackTrace(cause)) + "]";
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:ShardSearchFailure.java

示例4: toString

import org.elasticsearch.ExceptionsHelper; //导入方法依赖的package包/类
@Override
public String toString() {
    return "[" + index + "][" + shardId + "] failed, reason [" + reason() + "], cause [" + ExceptionsHelper.stackTrace(reason) + "]";
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:5,代码来源:DefaultShardOperationFailedException.java


注:本文中的org.elasticsearch.ExceptionsHelper.stackTrace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。