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


Java ParseException.initCause方法代码示例

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


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

示例1: wrapRecognitionException

import java.text.ParseException; //导入方法依赖的package包/类
private ParseException wrapRecognitionException( String schemaDescription, RecognitionException re )
{
    String msg = I18n.err( errorCodeOnParseExceptionWithPosition, schemaDescription, re.getMessage(),
        re.getColumn() );
    LOG.error( msg );
    ParseException parseException = new ParseException( msg, re.getColumn() );
    parseException.initCause( re );
    return parseException;
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:10,代码来源:AbstractSchemaParser.java

示例2: wrapTokenStreamException

import java.text.ParseException; //导入方法依赖的package包/类
private ParseException wrapTokenStreamException( String schemaDescription, TokenStreamException tse )
{
    String msg = I18n.err( errorCodeOnParseException, schemaDescription, tse.getMessage() );
    LOG.error( msg );
    ParseException parseException = new ParseException( msg, 0 );
    parseException.initCause( tse );
    return parseException;
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:9,代码来源:AbstractSchemaParser.java

示例3: from

import java.text.ParseException; //导入方法依赖的package包/类
/**
 * Attempts to return a {@code HostSpecifier} for the given string, throwing an exception if
 * parsing fails. Always use this method in preference to {@link #fromValid(String)} for a
 * specifier that is not already known to be valid.
 *
 * @throws ParseException if the specifier is not valid.
 */
public static HostSpecifier from(String specifier) throws ParseException {
  try {
    return fromValid(specifier);
  } catch (IllegalArgumentException e) {
    // Since the IAE can originate at several different points inside
    // fromValid(), we implement this method in terms of that one rather
    // than the reverse.

    ParseException parseException = new ParseException("Invalid host specifier: " + specifier, 0);
    parseException.initCause(e);
    throw parseException;
  }
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:21,代码来源:HostSpecifier.java

示例4: parse

import java.text.ParseException; //导入方法依赖的package包/类
@Override
public void parse(Reader in) throws IOException, ParseException {
  LineNumberReader br = new LineNumberReader(in);
  try {
    String line = null;
    String lastSynSetID = "";
    CharsRef synset[] = new CharsRef[8];
    int synsetSize = 0;
    
    while ((line = br.readLine()) != null) {
      String synSetID = line.substring(2, 11);

      if (!synSetID.equals(lastSynSetID)) {
        addInternal(synset, synsetSize);
        synsetSize = 0;
      }

      if (synset.length <= synsetSize+1) {
        synset = Arrays.copyOf(synset, synset.length * 2);
      }
      
      synset[synsetSize] = parseSynonym(line, new CharsRefBuilder());
      synsetSize++;
      lastSynSetID = synSetID;
    }
    
    // final synset in the file
    addInternal(synset, synsetSize);
  } catch (IllegalArgumentException e) {
    ParseException ex = new ParseException("Invalid synonym rule at line " + br.getLineNumber(), 0);
    ex.initCause(e);
    throw ex;
  } finally {
    br.close();
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:37,代码来源:WordnetSynonymParser.java

示例5: parse

import java.text.ParseException; //导入方法依赖的package包/类
@Override
public void parse(Reader in) throws IOException, ParseException {
  LineNumberReader br = new LineNumberReader(in);
  try {
    addInternal(br);
  } catch (IllegalArgumentException e) {
    ParseException ex = new ParseException("Invalid synonym rule at line " + br.getLineNumber(), 0);
    ex.initCause(e);
    throw ex;
  } finally {
    br.close();
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:SolrSynonymParser.java

示例6: parseLeniently

import java.text.ParseException; //导入方法依赖的package包/类
/**
 * Parse the given version number as a constant or dot based version.
 * <p>This method allows to use {@code "LUCENE_X_Y"} constant names,
 * or version numbers in the format {@code "x.y.z"}.
 *
 * @lucene.internal
 */
public static Version parseLeniently(String version) throws ParseException {
  String versionOrig = version;
  version = version.toUpperCase(Locale.ROOT);
  switch (version) {
    case "LATEST":
    case "LUCENE_CURRENT":
      return LATEST;
    case "LUCENE_4_0_0":
      return LUCENE_4_0_0;
    case "LUCENE_4_0_0_ALPHA":
      return LUCENE_4_0_0_ALPHA;
    case "LUCENE_4_0_0_BETA":
      return LUCENE_4_0_0_BETA;
    default:
      version = version
        .replaceFirst("^LUCENE_(\\d+)_(\\d+)_(\\d+)$", "$1.$2.$3")
        .replaceFirst("^LUCENE_(\\d+)_(\\d+)$", "$1.$2.0")
        .replaceFirst("^LUCENE_(\\d)(\\d)$", "$1.$2.0");
      try {
        return parse(version);
      } catch (ParseException pe) {
        ParseException pe2 = new ParseException("failed to parse lenient version string \"" + versionOrig + "\": " + pe.getMessage(), 0);
        pe2.initCause(pe);
        throw pe2;
      }
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:35,代码来源:Version.java

示例7: stringToValue

import java.text.ParseException; //导入方法依赖的package包/类
@Override
public Object stringToValue(String text) throws ParseException {
    try {
        return Integer.valueOf(text, this.radix);
    }
    catch (NumberFormatException nfe) {
        ParseException pe = new ParseException("illegal format", 0);
        pe.initCause(nfe);
        throw pe;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:ValueFormatter.java

示例8: getNodeElementDto

import java.text.ParseException; //导入方法依赖的package包/类
public static NodeElementDto getNodeElementDto(String inventoryID) throws ParseException {
    List<String> arr = Util.splitWithEscape(inventoryID, ":");
    try {
        NodeDto node = NodeUtil.getNode(arr.get(1));
        String nodeElementName = arr.get(2);
        List<String> elemNames = splitElementName(nodeElementName);
        int level = 0;
        NodeElementDto result = getNodeElement(node.getSubElements(), elemNames, level);
        return result;
    } catch (Exception e) {
        ParseException ex = new ParseException(inventoryID, 0);
        ex.initCause(e);
        throw ex;
    }
}
 
开发者ID:openNaEF,项目名称:openNaEF,代码行数:16,代码来源:InventoryIdDecoder.java

示例9: setParseError

import java.text.ParseException; //导入方法依赖的package包/类
private void setParseError(String reason, Exception e) throws ParseException {
    ParseException newExc = makeParseException(reason + ": " + e.getMessage());
    newExc.initCause(e);
    throw newExc;
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:6,代码来源:CollationRuleParser.java


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