當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。