Package java.text

Examples of java.text.ParseException


    private void parseMinute() throws ParseException
    {
        // read minute
        if ( upGeneralizedTime.length() < 12 )
        {
            throw new ParseException( I18n.err( I18n.ERR_04374 ), 10 );
        }
        try
        {
            int minute = Integer.parseInt( upGeneralizedTime.substring( 10, 12 ) );
            calendar.set( Calendar.MINUTE, minute );
        }
        catch ( NumberFormatException e )
        {
            throw new ParseException( I18n.err( I18n.ERR_04375 ), 10 );
        }
    }
View Full Code Here


    private void parseHour() throws ParseException
    {
        if ( upGeneralizedTime.length() < 10 )
        {
            throw new ParseException( I18n.err( I18n.ERR_04376 ), 8 );
        }
        try
        {
            int hour = Integer.parseInt( upGeneralizedTime.substring( 8, 10 ) );
            calendar.set( Calendar.HOUR_OF_DAY, hour );
        }
        catch ( NumberFormatException e )
        {
            throw new ParseException( I18n.err( I18n.ERR_04377 ), 8 );
        }
    }
View Full Code Here

    private void parseDay() throws ParseException
    {
        if ( upGeneralizedTime.length() < 8 )
        {
            throw new ParseException( I18n.err( I18n.ERR_04378 ), 6 );
        }
        try
        {
            int day = Integer.parseInt( upGeneralizedTime.substring( 6, 8 ) );
            calendar.set( Calendar.DAY_OF_MONTH, day );
        }
        catch ( NumberFormatException e )
        {
            throw new ParseException( I18n.err( I18n.ERR_04379 ), 6 );
        }
    }
View Full Code Here

    private void parseMonth() throws ParseException
    {
        if ( upGeneralizedTime.length() < 6 )
        {
            throw new ParseException( I18n.err( I18n.ERR_04380 ), 4 );
        }
        try
        {
            int month = Integer.parseInt( upGeneralizedTime.substring( 4, 6 ) );
            calendar.set( Calendar.MONTH, month - 1 );
        }
        catch ( NumberFormatException e )
        {
            throw new ParseException( I18n.err( I18n.ERR_04381 ), 4 );
        }
    }
View Full Code Here

    private void parseYear() throws ParseException
    {
        if ( upGeneralizedTime.length() < 4 )
        {
            throw new ParseException( I18n.err( I18n.ERR_04382 ), 0 );
        }
        try
        {
            int year = Integer.parseInt( upGeneralizedTime.substring( 0, 4 ) );
            calendar.set( Calendar.YEAR, year );
        }
        catch ( NumberFormatException e )
        {
            throw new ParseException( I18n.err( I18n.ERR_04383 ), 0 );
        }
    }
View Full Code Here

        if (StringUtils.isBlank(loggerName)) {
            throw new IllegalArgumentException("Null value not permitted");
        }

        if (!loggerName.startsWith(SyncopeLoggerType.AUDIT.getPrefix())) {
            throw new ParseException("Audit logger name must start with " + SyncopeLoggerType.AUDIT.getPrefix(), 0);
        }

        String[] splitted = loggerName.split("\\.");
        if (splitted == null || splitted.length < 5) {
            throw new ParseException("Unparsable logger name", 0);
        }

        Category category = Category.valueOf(splitted[2]);
        Enum<?> subcategory = Enum.valueOf(category.getSubCategory(), splitted[3]);
        Result result = Result.valueOf(splitted[4]);
View Full Code Here

        public Calendar parse(String dateTime) throws ParseException {
            try {
                final Calendar c = ISO8601.parse(dateTime);
                if (c == null) {
                    throw new ParseException(dateTime
                        + " cannot be parsed as ISO8601 formatted date string",
                        0);
                }
                return c;
            } catch (Exception e) {
                throw new ParseException(e.getMessage(), 0);
            }
        }
View Full Code Here

    /**
     * Validate that logicalPartition is represented in the format p10_1 ( partition 10, schema 1)
     */
    if (logicalPartition.charAt(0) != 'p')
    {
      throw new ParseException(logicalPartition, 0);
    }
    String nextStr = logicalPartition.substring(1);
    String[] parts = nextStr.split("_");
   
    if (parts.length != 2)
    {
      throw new ParseException("logical Partition does not have numbers of format p[num1]_[num2]" + logicalPartition, 0);
    }
    int p = Integer.parseInt(parts[0]);
    int s = Integer.parseInt(parts[1]);
   
    _logicalPartition = logicalPartition;
View Full Code Here

     * LP :  "p1_1"
     * state: "MASTER"
     */
    String[] parts = resourceKey.split(",");
    if (parts.length != NUM_SUBKEYS)
      throw new ParseException("Resource key " + resourceKey + " has " + parts.length + " parts instead of " + NUM_SUBKEYS, 0);
    _physicalSource = parts[0];
    _physicalPartition = parts[1];
    _logicalPartitionRepresentation = new LogicalPartitionRepresentation(parts[2]);   
    _role = new Role(parts[3]);   
  }
View Full Code Here

        // ignore this exception, we will try the next format
      }
    }

    // we were unable to parse the date
    throw new ParseException("Unable to parse the date " + dateValue, 0);
  }
View Full Code Here

TOP

Related Classes of java.text.ParseException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.