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


Java ParseException.getMessage方法代码示例

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


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

示例1: getAsObject

import java.text.ParseException; //导入方法依赖的package包/类
/**
 * Conversion to server representation, so converting currency to internal
 * integer with cents format. Prior to the conversion the input value is
 * validated.
 * 
 * @param context
 *            JSF context.
 * @param component
 *            Component which value will be processed.
 * @param value
 *            Value.
 */
public Object getAsObject(FacesContext context, UIComponent component,
        String value) {
    final PriceConverter converter = getConverter(context);

    try {
        return converter.parse(value);
    } catch (ParseException e) {
        String msg = e.getMessage();
        if (msg != null
                && msg.equals("ERROR_PRICEMODEL_INVALID_FRACTIONAL_PART")) {
            throw new ConverterException(JSFUtils.getFacesMessage(
                    component, context,
                    BaseBean.ERROR_PRICEMODEL_INVALID_FRACTIONAL_PART));
        }
        throw new ConverterException(JSFUtils.getFacesMessage(component,
                context, BaseBean.ERROR_PRICEMODEL_INPUT));
    }
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:31,代码来源:CurrencyConverter.java

示例2: update

import java.text.ParseException; //导入方法依赖的package包/类
protected void update(EventDateMapping mapping, Record record, SessionContext context, Session hibSession) {
	try {
		if (mapping == null) return;
		Formats.Format<Date> dateFormat = Formats.getDateFormat(Formats.Pattern.DATE_EVENT);
		if (ToolBox.equals(dateFormat.format(mapping.getClassDate()), record.getField(0)) &&
				ToolBox.equals(dateFormat.format(mapping.getEventDate()), record.getField(1)) &&
				ToolBox.equals(mapping.getNote(), record.getField(2))) return;
		mapping.setClassDate(dateFormat.parse(record.getField(0)));
		mapping.setEventDate(dateFormat.parse(record.getField(1)));
		mapping.setNote(record.getField(2));
		hibSession.saveOrUpdate(mapping);
		ChangeLog.addChange(hibSession,
				context,
				mapping,
				dateFormat.format(mapping.getClassDate()) + " &rarr; " + dateFormat.format(mapping.getEventDate()),
				Source.SIMPLE_EDIT, 
				Operation.UPDATE,
				null,
				null);
	} catch (ParseException e) {
		throw new GwtRpcException(e.getMessage(), e);
	}
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:24,代码来源:EventDateMappings.java

示例3: ConditionRouter

import java.text.ParseException; //导入方法依赖的package包/类
public ConditionRouter(URL url) {
    this.url = url;
    this.priority = url.getParameter(Constants.PRIORITY_KEY, 0);
    this.force = url.getParameter(Constants.FORCE_KEY, false);
    try {
        String rule = url.getParameterAndDecoded(Constants.RULE_KEY);
        if (rule == null || rule.trim().length() == 0) {
            throw new IllegalArgumentException("Illegal route rule!");
        }
        rule = rule.replace("consumer.", "").replace("provider.", "");
        int i = rule.indexOf("=>");
        String whenRule = i < 0 ? null : rule.substring(0, i).trim();
        String thenRule = i < 0 ? rule.trim() : rule.substring(i + 2).trim();
        Map<String, MatchPair> when = StringUtils.isBlank(whenRule) || "true".equals(whenRule) ? new HashMap<String, MatchPair>() : parseRule(whenRule);
        Map<String, MatchPair> then = StringUtils.isBlank(thenRule) || "false".equals(thenRule) ? null : parseRule(thenRule);
        // NOTE: When条件是允许为空的,外部业务来保证类似的约束条件
        this.whenCondition = when;
        this.thenCondition = then;
    } catch (ParseException e) {
        throw new IllegalStateException(e.getMessage(), e);
    }
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:23,代码来源:ConditionRouter.java

示例4: DERUTCTime

import java.text.ParseException; //导入方法依赖的package包/类
/**
 * The correct format for this is YYMMDDHHMMSSZ (it used to be that seconds were
 * never encoded. When you're creating one of these objects from scratch, that's
 * what you want to use, otherwise we'll try to deal with whatever gets read from
 * the input stream... (this is why the input format is different from the getTime()
 * method output).
 * <p>
 *
 * @param time the time string.
 */
public DERUTCTime(
    String  time)
{
    this.time = time;
    try
    {
        this.getDate();
    }
    catch (ParseException e)
    {
        throw new IllegalArgumentException("invalid date string: " + e.getMessage());
    }
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:24,代码来源:DERUTCTime.java

示例5: DERGeneralizedTime

import java.text.ParseException; //导入方法依赖的package包/类
/**
 * The correct format for this is YYYYMMDDHHMMSS[.f]Z, or without the Z
 * for local time, or Z+-HHMM on the end, for difference between local
 * time and UTC time. The fractional second amount f must consist of at
 * least one number with trailing zeroes removed.
 *
 * @param time the time string.
 * @exception IllegalArgumentException if String is an illegal format.
 */
public DERGeneralizedTime(
    String  time)
{
    this.time = time;
    try
    {
        this.getDate();
    }
    catch (ParseException e)
    {
        throw new IllegalArgumentException("invalid date string: " + e.getMessage());
    }
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:23,代码来源:DERGeneralizedTime.java

示例6: CompiledFields

import java.text.ParseException; //导入方法依赖的package包/类
public CompiledFields(final List<Field> fields,
                      final FieldIndexMap fieldIndexMap, final Map<String, String> paramMap) {
    if (null != fields) {
        compiledFields = new ArrayList<>(fields.size());

        final ExpressionParser expressionParser = new ExpressionParser(new FunctionFactory(), new ParamFactory());
        for (final Field field : fields) {
            // Create compiled field.
            int groupDepth = -1;
            if (field.getGroup() != null) {
                groupDepth = field.getGroup();
            }
            Expression expression = null;
            if (fieldIndexMap != null && field.getExpression() != null && field.getExpression().trim().length() > 0) {
                try {
                    expression = expressionParser.parse(fieldIndexMap, field.getExpression());
                } catch (final ParseException e) {
                    throw new RuntimeException(e.getMessage(), e);
                }
            }

            CompiledFilter filter = null;
            if (field.getFilter() != null) {
                filter = new CompiledFilter(field.getFilter(), paramMap);
            }

            final CompiledField compiledField = new CompiledField(field, groupDepth, expression, filter);

            // Only include this field if it is used for display, grouping,
            // sorting.
            compiledFields.add(compiledField);
        }
    } else {
        compiledFields = Collections.emptyList();
    }
}
 
开发者ID:gchq,项目名称:stroom-query,代码行数:37,代码来源:CompiledFields.java

示例7: Synchronizer

import java.text.ParseException; //导入方法依赖的package包/类
/**
 * Creates an new Synchronizer from the given ODataEntry.
 * 
 * @param odata_entry created by a POST request on the OData interface.
 * @throws ODataException if the given entry is malformed.
 */
public Synchronizer (ODataEntry odata_entry) throws ODataException
{
   Map<String, Object> props = odata_entry.getProperties ();

   String label = (String) props.get(SynchronizerEntitySet.LABEL);
   String schedule = (String) props.get(SynchronizerEntitySet.SCHEDULE);
   String request = (String) props.get(SynchronizerEntitySet.REQUEST);
   String service_url = (String) props.get(SynchronizerEntitySet.SERVICE_URL);

   if (schedule == null || schedule.isEmpty () || service_url == null ||
      service_url.isEmpty ())
   {
      throw new IncompleteDocException();
   }

   if (request != null && !request.equals ("start") &&
      !request.equals ("stop"))
   {
      throw new InvalidValueException(SynchronizerEntitySet.REQUEST, request);
   }

   try
   {
      this.syncConf =
         SYNCHRONIZER_SERVICE.createSynchronizer (label,
            "ODataProductSynchronizer", schedule);
      updateFromEntry (odata_entry);
   }
   catch (ParseException e)
   {
      throw new ExpectedException(e.getMessage());
   }
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:40,代码来源:Synchronizer.java

示例8: decode

import java.text.ParseException; //导入方法依赖的package包/类
public Object decode(Object jv) throws IOException
{
	if( jv instanceof String ) {
		try {
			return new SimpleDateFormat(DATE_FORMAT).parse((String) jv);
		} catch (ParseException e) {
			throw new IllegalArgumentException(e.getMessage(), e);
		}
	}
	if( jv instanceof Number ) 
		return new Date(((Number)jv).longValue());
	return (Date)null;
}
 
开发者ID:zhuxiaolei,项目名称:dubbo2,代码行数:14,代码来源:GenericJSONConverter.java

示例9: parseInteger

import java.text.ParseException; //导入方法依赖的package包/类
private int parseInteger( String integer ) {
    try {
        return INTEGER_FORMAT.parse( integer ).intValue();
    } catch (ParseException e) {
        throw new NumberFormatException( "Unable to parse integer [int: " + integer + ", error: " + e.getMessage() );
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:JTidyPrintWriter.java

示例10: getThisUpdate

import java.text.ParseException; //导入方法依赖的package包/类
public Date getThisUpdate()
{
    try
    {
        return resp.getThisUpdate().getDate();
    }
    catch (ParseException e)
    {
        throw new IllegalStateException("ParseException: " + e.getMessage());
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:12,代码来源:SingleResp.java

示例11: getIntValue

import java.text.ParseException; //导入方法依赖的package包/类
/**
 * Gets an integer result from the column labeled 'name'
 *
 * @param name - name of the column
 * @return the result
 */
public int getIntValue(String name) {
    int valueNdx = new StringOfValues(getStdoutLine(0)).getIndex(name);
    try {
        return NumberFormat.getInstance().parse(new StringOfValues(getStdoutLine(1)).getValue(valueNdx)).intValue();
    } catch (ParseException e) {
        throw new NumberFormatException(e.getMessage());
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:JstatResults.java

示例12: parse

import java.text.ParseException; //导入方法依赖的package包/类
@Override
public Date parse(final String input) throws InvalidDateException {
    if(StringUtils.isBlank(input)) {
        throw new InvalidDateException();
    }
    synchronized(format) {
        try {
            return format.parse(input);
        }
        catch(ParseException e) {
            throw new InvalidDateException(e.getMessage(), e);
        }
    }
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:15,代码来源:AbstractDateFormatter.java

示例13: after

import java.text.ParseException; //导入方法依赖的package包/类
/**
 * 日期比较,当baseDate大于compareDate时,返回TRUE,当小于等于时,返回false
 * @param format
 *            日期字符串格式
 * @param baseDate
 *            被比较的日期
 * @param compareDate
 *            比较日期
 * @return
 */
public static boolean after(String format, String baseDate,
                             String compareDate) {
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format);
    try {
        Date base = simpleDateFormat.parse(baseDate);
        Date compare = simpleDateFormat.parse(compareDate);

        return compare.after(base);
    } catch (ParseException e) {
        throw new RuntimeException(e.getMessage());
    }
}
 
开发者ID:DevopsJK,项目名称:SuitAgent,代码行数:23,代码来源:DateUtil.java

示例14: getTodayLastSecond

import java.text.ParseException; //导入方法依赖的package包/类
/**
 * 获取当天的最后一秒
 * 
 * @param timeZone
 *            时区
 * @return GMT时间对象
 */
public Date getTodayLastSecond(int timeZone) {
	// 当前的GMT时间
	Date now = getNow();

	// 获取本地的年月日
	String ymd = this.getDateFormat(timeZone).format(now);

	// 获取本地的当天的最后一秒,换算成GMT的时间对象
	try {
		return this.getDateTimeFormat(timeZone).parse(ymd + " 23:59:59");
	} catch (ParseException e) {
		throw new ZhhrUtilException(e.getMessage(), e);
	}
}
 
开发者ID:wooui,项目名称:springboot-training,代码行数:22,代码来源:DateUtil.java

示例15: UserSynchronizer

import java.text.ParseException; //导入方法依赖的package包/类
/**
 * Creates an new UserSynchronizer from the given ODataEntry.
 *
 * @param odata_entry created by a POST request on the OData interface.
 * @throws ODataException if the given entry is malformed.
 */
public UserSynchronizer(ODataEntry odata_entry) throws ODataException
{
   Map<String, Object> props = odata_entry.getProperties();

   String label       = (String) props.get(LABEL);
   String schedule    = (String) props.get(SCHEDULE);
   String request     = (String) props.get(REQUEST);
   String service_url = (String) props.get(SERVICE_URL);

   if (schedule == null || schedule.isEmpty() || service_url == null || service_url.isEmpty())
   {
      throw new IncompleteDocException();
   }

   if (request != null && !request.equals("start") && !request.equals("stop"))
   {
      throw new InvalidValueException(REQUEST, request);
   }

   try
   {
      this.syncConf = SYNC_SERVICE.createSynchronizer(label, "ODataUserSynchronizer", schedule);
      updateFromEntry(odata_entry);
   }
   catch (ParseException e)
   {
      throw new ExpectedException(e.getMessage());
   }
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:36,代码来源:UserSynchronizer.java


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