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


Java TApplicationException.INTERNAL_ERROR属性代码示例

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


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

示例1: createTranslator

private MessageTransalator createTranslator(TProtocolFactory protocolFactory) {
    return new MessageTransalator(protocolFactory, new AuthTokenExchanger<AuthToken, UserData>() {
        @Override
        public AuthToken createEmptyAuthToken() {
            return new AuthToken();
        }

        @Override
        public UserData process(AuthToken authToken) throws TException {
            if ("sometoken".equals(authToken.getToken())) {
                return new UserData().setId("user1");
            }

            if ("fataltoken".equals(authToken.getToken())) {
                throw new TApplicationException(TApplicationException.INTERNAL_ERROR, "fatal!!!");
            }

            throw new UnauthorizedException("token is invalid");
        }
    });
}
 
开发者ID:aatarasoff,项目名称:thrift-api-gateway-core,代码行数:21,代码来源:MessageTranslatorTests.java

示例2: parse_text

public List<ParseTree> parse_text(String text, List<String> outputFormat) throws TApplicationException
{
    List<ParseTree> results = new ArrayList<ParseTree>();

    try
    {
        treePrinter = ParserUtil.setOptions(outputFormat, tlp);

        // assume no tokenization was done; use Stanford's default org.ets.research.nlp.stanford_thrift.tokenizer
        DocumentPreprocessor preprocess = new DocumentPreprocessor(new StringReader(text));
        Iterator<List<HasWord>> foundSentences = preprocess.iterator();
        while (foundSentences.hasNext())
        {
            Tree parseTree = parser.apply(foundSentences.next());
            results.add(new ParseTree(ParserUtil.TreeObjectToString(parseTree, treePrinter), parseTree.score()));
        }
    }
    catch (Exception e)
    {
        // FIXME
        throw new TApplicationException(TApplicationException.INTERNAL_ERROR, e.getMessage());
    }

    return results;
}
 
开发者ID:dmnapolitano,项目名称:stanford-thrift,代码行数:25,代码来源:StanfordParserThrift.java

示例3: parse_tokens

/**
 * @param tokens One sentence worth of tokens at a time.
 * @return A ParseTree object of the String representation of the tree, plus its probability.
 * @throws TApplicationException
 */
public ParseTree parse_tokens(List<String> tokens, List<String> outputFormat) throws TApplicationException
{
    try
    {
        treePrinter = ParserUtil.setOptions(outputFormat, tlp);

        // a single sentence worth of tokens
        String[] tokenArray = new String[tokens.size()];
        tokens.toArray(tokenArray);
        List<CoreLabel> crazyStanfordFormat = Sentence.toCoreLabelList(tokenArray);
        Tree parseTree = parser.apply(crazyStanfordFormat);
        return new ParseTree(ParserUtil.TreeObjectToString(parseTree, treePrinter), parseTree.score());
    }
    catch (Exception e)
    {
        // FIXME
        throw new TApplicationException(TApplicationException.INTERNAL_ERROR, e.getMessage());
    }
}
 
开发者ID:dmnapolitano,项目名称:stanford-thrift,代码行数:24,代码来源:StanfordParserThrift.java

示例4: parse_tagged_sentence

public ParseTree parse_tagged_sentence(String taggedSentence, List<String> outputFormat, String divider) throws TApplicationException
{
    try
    {
        treePrinter = ParserUtil.setOptions(outputFormat, tlp);

        // a single sentence worth of tagged text, better be properly tokenized >:D
        Tree parseTree = parser.apply(CoreNLPThriftUtil.getListOfTaggedWordsFromTaggedSentence(taggedSentence, divider));
        return new ParseTree(ParserUtil.TreeObjectToString(parseTree, treePrinter), parseTree.score());
    }
    catch (Exception e)
    {
        // FIXME
        throw new TApplicationException(TApplicationException.INTERNAL_ERROR, e.getMessage());
    }
}
 
开发者ID:dmnapolitano,项目名称:stanford-thrift,代码行数:16,代码来源:StanfordParserThrift.java

示例5: lexicalize_parse_tree

/** If one were to call any of these other methods to get a parse tree for some input sentence
 * with the -outputFormatOptions flag of "lexicalize", they would receive their parse tree,
 * in the -outputFormat of their choice, with every leaf marked with it's head word.
 * This function does exactly that on an existing parse tree.
 * NOTE that this WILL re-lexicalize a pre-lexicalized tree, so don't pass in a tree that
 * has been lexicalized and expect to get back the same thing as what you passed in.
 */
public String lexicalize_parse_tree(String tree) throws TApplicationException
{
    try
    {
        Tree parseTree = Tree.valueOf(tree);
        Tree lexicalizedTree = Trees.lexicalize(parseTree, tlp.headFinder());
        treePrinter = ParserUtil.setOptions(null, tlp); // use defaults
        Function<Tree, Tree> a = TreeFunctions.getLabeledToDescriptiveCoreLabelTreeFunction();
        lexicalizedTree = a.apply(lexicalizedTree);
        return ParserUtil.TreeObjectToString(lexicalizedTree, treePrinter);
    }
    catch (Exception e)
    {
        // FIXME
        throw new TApplicationException(TApplicationException.INTERNAL_ERROR, e.getMessage());
    }
}
 
开发者ID:dmnapolitano,项目名称:stanford-thrift,代码行数:24,代码来源:StanfordParserThrift.java

示例6: sr_parse_text

public List<ParseTree> sr_parse_text(String untokenizedText, List<String> outputFormat) throws TApplicationException
{
    try
    {
        List<ParseTree> results = new ArrayList<ParseTree>();
        List<List<TaggedToken>> posTaggedText = tagger.tag_text(untokenizedText);
        for (List<TaggedToken> taggedSentence : posTaggedText)
        {
            List<TaggedWord> taggedWords = CoreNLPThriftUtil.convertTaggedTokensToTaggedWords(taggedSentence);
            results.add(srparser.parseTaggedWords(taggedWords, outputFormat));
        }
        return results;
    }
    catch (Exception e)
    {
        // FIXME
        throw new TApplicationException(TApplicationException.INTERNAL_ERROR, e.getMessage());
    }
}
 
开发者ID:dmnapolitano,项目名称:stanford-thrift,代码行数:19,代码来源:StanfordCoreNLPHandler.java

示例7: sumbitTask

private void sumbitTask(TProtocol out, final TMessage msg, final WriterHandler onComplete, Runnable task){
	try {
		serverDef.executor.submit(task);
	} catch (RejectedExecutionException e) {
		TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "TooBusy");
		writeException(out, msg, onComplete, x, null);
		logger.error("RejectedExecutionException: "+e.getLocalizedMessage());
	}
}
 
开发者ID:houkx,项目名称:nettythrift,代码行数:9,代码来源:DefaultNettyProcessor.java

示例8: sr_parse_tagged_sentence

public ParseTree sr_parse_tagged_sentence(String taggedSentence, List<String> outputFormat, String divider) throws TApplicationException
{
	try
	{
		// a single sentence worth of tagged text, better be properly tokenized >:D
		List<TaggedWord> taggedWords = CoreNLPThriftUtil.getListOfTaggedWordsFromTaggedSentence(taggedSentence, divider);
		return parseTaggedWords(taggedWords, outputFormat);
	}
	catch (Exception e)
	{
		// FIXME
		throw new TApplicationException(TApplicationException.INTERNAL_ERROR, e.getMessage());
	}
}
 
开发者ID:dmnapolitano,项目名称:stanford-thrift,代码行数:14,代码来源:StanfordSRParserThrift.java

示例9: sr_parse_tokens

public ParseTree sr_parse_tokens(List<String> tokenizedSentence, List<String> outputFormat) throws TApplicationException
{
    try
    {
        List<TaggedToken> taggedSentence = tagger.tag_tokenized_sentence(tokenizedSentence);
        return srparser.parseTaggedWords(CoreNLPThriftUtil.convertTaggedTokensToTaggedWords(taggedSentence), outputFormat);
    }
    catch (Exception e)
    {
        // FIXME
        throw new TApplicationException(TApplicationException.INTERNAL_ERROR, e.getMessage());
    }
}
 
开发者ID:dmnapolitano,项目名称:stanford-thrift,代码行数:13,代码来源:StanfordCoreNLPHandler.java

示例10: createApplicationException

private TApplicationException createApplicationException(TException e) {
    return new TApplicationException(TApplicationException.INTERNAL_ERROR, e.getMessage());
}
 
开发者ID:aatarasoff,项目名称:thrift-api-gateway-core,代码行数:3,代码来源:MessageTransalator.java


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