jaxp/src/com/sun/org/apache/xerces/internal/impl/dv/xs/AbstractDateTimeDV.java
author dfuchs
Fri, 17 May 2013 10:40:21 +0200
changeset 17538 d8d911c4e5d4
parent 12457 c348e06f0e82
child 25264 040625ce9b72
permissions -rw-r--r--
8013900: More warnings compiling jaxp. Summary: Some internal implementation classes in Jaxp were redefining equals() without redefining hashCode(). This patch adds hashCode() methods that are consistent with equals(). Reviewed-by: chegar, joehw
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
     1
/*
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
     2
 * reserved comment block
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
     3
 * DO NOT REMOVE OR ALTER!
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
     4
 */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
     5
/*
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
     6
 * Copyright 1999-2005 The Apache Software Foundation.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
     7
 *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
     8
 * Licensed under the Apache License, Version 2.0 (the "License");
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
     9
 * you may not use this file except in compliance with the License.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    10
 * You may obtain a copy of the License at
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    11
 *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    12
 *      http://www.apache.org/licenses/LICENSE-2.0
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    13
 *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    14
 * Unless required by applicable law or agreed to in writing, software
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    15
 * distributed under the License is distributed on an "AS IS" BASIS,
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    17
 * See the License for the specific language governing permissions and
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    18
 * limitations under the License.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    19
 */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    20
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    21
package com.sun.org.apache.xerces.internal.impl.dv.xs;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    22
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    23
import java.math.BigDecimal;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    24
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    25
import javax.xml.datatype.DatatypeFactory;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    26
import javax.xml.datatype.Duration;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    27
import javax.xml.datatype.XMLGregorianCalendar;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    28
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    29
import com.sun.org.apache.xerces.internal.impl.Constants;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    30
import com.sun.org.apache.xerces.internal.jaxp.datatype.DatatypeFactoryImpl;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    31
import com.sun.org.apache.xerces.internal.xs.datatypes.XSDateTime;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    32
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    33
/**
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    34
 * This is the base class of all date/time datatype validators.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    35
 * It implements common code for parsing, validating and comparing datatypes.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    36
 * Classes that extend this class, must implement parse() method.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    37
 *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    38
 * REVISIT: There are many instance variables, which would cause problems
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    39
 *          when we support grammar caching. A grammar is possibly used by
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    40
 *          two parser instances at the same time, then the same simple type
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    41
 *          decl object can be used to validate two strings at the same time.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    42
 *          -SG
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    43
 *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    44
 * @xerces.internal
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    45
 *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    46
 * @author Elena Litani
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    47
 * @author Len Berman
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    48
 * @author Gopal Sharma, SUN Microsystems Inc.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    49
 *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    50
 * @version $Id: AbstractDateTimeDV.java,v 1.7 2010-11-01 04:39:46 joehw Exp $
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    51
 */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    52
public abstract class AbstractDateTimeDV extends TypeValidator {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    53
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    54
    //debugging
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    55
    private static final boolean DEBUG = false;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    56
    //define shared variables for date/time
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    57
    //define constants to be used in assigning default values for
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    58
    //all date/time excluding duration
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    59
    protected final static int YEAR = 2000;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    60
    protected final static int MONTH = 01;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    61
    protected final static int DAY = 01;
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    62
    protected static final DatatypeFactory datatypeFactory = new DatatypeFactoryImpl();
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    63
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    64
    @Override
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    65
    public short getAllowedFacets() {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    66
        return (XSSimpleTypeDecl.FACET_PATTERN | XSSimpleTypeDecl.FACET_WHITESPACE | XSSimpleTypeDecl.FACET_ENUMERATION | XSSimpleTypeDecl.FACET_MAXINCLUSIVE | XSSimpleTypeDecl.FACET_MININCLUSIVE | XSSimpleTypeDecl.FACET_MAXEXCLUSIVE | XSSimpleTypeDecl.FACET_MINEXCLUSIVE);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    67
    }//getAllowedFacets()
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    68
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    69
    // distinguishes between identity and equality for date/time values
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    70
    // ie: two values representing the same "moment in time" but with different
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    71
    // remembered timezones are now equal but not identical.
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    72
    @Override
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    73
    public boolean isIdentical(Object value1, Object value2) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    74
        if (!(value1 instanceof DateTimeData) || !(value2 instanceof DateTimeData)) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    75
            return false;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    76
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    77
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    78
        DateTimeData v1 = (DateTimeData) value1;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    79
        DateTimeData v2 = (DateTimeData) value2;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    80
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    81
        // original timezones must be the same in addition to date/time values
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    82
        // being 'equal'
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    83
        if ((v1.timezoneHr == v2.timezoneHr) && (v1.timezoneMin == v2.timezoneMin)) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    84
            return v1.equals(v2);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    85
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    86
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    87
        return false;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    88
    }//isIdentical()
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    89
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    90
    // the parameters are in compiled form (from getActualValue)
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    91
    @Override
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    92
    public int compare(Object value1, Object value2) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    93
        return compareDates(((DateTimeData) value1),
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    94
                ((DateTimeData) value2), true);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    95
    }//compare()
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    96
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    97
    /**
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    98
     * Compare algorithm described in dateDime (3.2.7). Duration datatype
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
    99
     * overwrites this method
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   100
     *
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   101
     * @param date1 normalized date representation of the first value
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   102
     * @param date2 normalized date representation of the second value
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   103
     * @param strict
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   104
     * @return less, greater, less_equal, greater_equal, equal
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   105
     */
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   106
    protected short compareDates(DateTimeData date1, DateTimeData date2, boolean strict) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   107
        if (date1.utc == date2.utc) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   108
            return compareOrder(date1, date2);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   109
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   110
        short c1, c2;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   111
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   112
        DateTimeData tempDate = new DateTimeData(null, this);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   113
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   114
        if (date1.utc == 'Z') {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   115
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   116
            //compare date1<=date1<=(date2 with time zone -14)
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   117
            //
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   118
            cloneDate(date2, tempDate); //clones date1 value to global temporary storage: fTempDate
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   119
            tempDate.timezoneHr = 14;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   120
            tempDate.timezoneMin = 0;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   121
            tempDate.utc = '+';
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   122
            normalize(tempDate);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   123
            c1 = compareOrder(date1, tempDate);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   124
            if (c1 == LESS_THAN) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   125
                return c1;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   126
            }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   127
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   128
            //compare date1>=(date2 with time zone +14)
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   129
            //
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   130
            cloneDate(date2, tempDate); //clones date1 value to global temporary storage: tempDate
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   131
            tempDate.timezoneHr = -14;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   132
            tempDate.timezoneMin = 0;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   133
            tempDate.utc = '-';
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   134
            normalize(tempDate);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   135
            c2 = compareOrder(date1, tempDate);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   136
            if (c2 == GREATER_THAN) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   137
                return c2;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   138
            }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   139
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   140
            return INDETERMINATE;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   141
        } else if (date2.utc == 'Z') {
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   142
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   143
            //compare (date1 with time zone -14)<=date2
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   144
            //
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   145
            cloneDate(date1, tempDate); //clones date1 value to global temporary storage: tempDate
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   146
            tempDate.timezoneHr = -14;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   147
            tempDate.timezoneMin = 0;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   148
            tempDate.utc = '-';
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   149
            if (DEBUG) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   150
                System.out.println("tempDate=" + dateToString(tempDate));
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   151
            }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   152
            normalize(tempDate);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   153
            c1 = compareOrder(tempDate, date2);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   154
            if (DEBUG) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   155
                System.out.println("date=" + dateToString(date2));
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   156
                System.out.println("tempDate=" + dateToString(tempDate));
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   157
            }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   158
            if (c1 == LESS_THAN) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   159
                return c1;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   160
            }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   161
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   162
            //compare (date1 with time zone +14)<=date2
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   163
            //
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   164
            cloneDate(date1, tempDate); //clones date1 value to global temporary storage: tempDate
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   165
            tempDate.timezoneHr = 14;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   166
            tempDate.timezoneMin = 0;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   167
            tempDate.utc = '+';
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   168
            normalize(tempDate);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   169
            c2 = compareOrder(tempDate, date2);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   170
            if (DEBUG) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   171
                System.out.println("tempDate=" + dateToString(tempDate));
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   172
            }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   173
            if (c2 == GREATER_THAN) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   174
                return c2;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   175
            }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   176
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   177
            return INDETERMINATE;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   178
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   179
        return INDETERMINATE;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   180
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   181
    }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   182
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   183
    /**
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   184
     * Given normalized values, determines order-relation between give date/time
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   185
     * objects.
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   186
     *
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   187
     * @param date1 date/time object
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   188
     * @param date2 date/time object
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   189
     * @return 0 if date1 and date2 are equal, a value less than 0 if date1 is
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   190
     * less than date2, a value greater than 0 if date1 is greater than date2
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   191
     */
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   192
    protected short compareOrder(DateTimeData date1, DateTimeData date2) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   193
        if (date1.position < 1) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   194
            if (date1.year < date2.year) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   195
                return -1;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   196
            }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   197
            if (date1.year > date2.year) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   198
                return 1;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   199
            }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   200
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   201
        if (date1.position < 2) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   202
            if (date1.month < date2.month) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   203
                return -1;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   204
            }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   205
            if (date1.month > date2.month) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   206
                return 1;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   207
            }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   208
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   209
        if (date1.day < date2.day) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   210
            return -1;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   211
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   212
        if (date1.day > date2.day) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   213
            return 1;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   214
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   215
        if (date1.hour < date2.hour) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   216
            return -1;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   217
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   218
        if (date1.hour > date2.hour) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   219
            return 1;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   220
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   221
        if (date1.minute < date2.minute) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   222
            return -1;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   223
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   224
        if (date1.minute > date2.minute) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   225
            return 1;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   226
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   227
        if (date1.second < date2.second) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   228
            return -1;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   229
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   230
        if (date1.second > date2.second) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   231
            return 1;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   232
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   233
        if (date1.utc < date2.utc) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   234
            return -1;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   235
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   236
        if (date1.utc > date2.utc) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   237
            return 1;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   238
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   239
        return 0;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   240
    }
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   241
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   242
    /**
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   243
     * Parses time hh:mm:ss.sss and time zone if any
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   244
     *
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   245
     * @param start
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   246
     * @param end
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   247
     * @param data
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   248
     * @exception RuntimeException
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   249
     */
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   250
    protected void getTime(String buffer, int start, int end, DateTimeData data) throws RuntimeException {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   251
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   252
        int stop = start + 2;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   253
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   254
        //get hours (hh)
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   255
        data.hour = parseInt(buffer, start, stop);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   256
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   257
        //get minutes (mm)
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   258
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   259
        if (buffer.charAt(stop++) != ':') {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   260
            throw new RuntimeException("Error in parsing time zone");
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   261
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   262
        start = stop;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   263
        stop = stop + 2;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   264
        data.minute = parseInt(buffer, start, stop);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   265
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   266
        //get seconds (ss)
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   267
        if (buffer.charAt(stop++) != ':') {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   268
            throw new RuntimeException("Error in parsing time zone");
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   269
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   270
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   271
        //find UTC sign if any
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   272
        int sign = findUTCSign(buffer, start, end);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   273
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   274
        //get seconds (ms)
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   275
        start = stop;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   276
        stop = sign < 0 ? end : sign;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   277
        data.second = parseSecond(buffer, start, stop);
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   278
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   279
        //parse UTC time zone (hh:mm)
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   280
        if (sign > 0) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   281
            getTimeZone(buffer, data, sign, end);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   282
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   283
    }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   284
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   285
    /**
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   286
     * Parses date CCYY-MM-DD
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   287
     *
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   288
     * @param buffer
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   289
     * @param start start position
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   290
     * @param end end position
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   291
     * @param date
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   292
     * @exception RuntimeException
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   293
     */
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   294
    protected int getDate(String buffer, int start, int end, DateTimeData date) throws RuntimeException {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   295
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   296
        start = getYearMonth(buffer, start, end, date);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   297
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   298
        if (buffer.charAt(start++) != '-') {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   299
            throw new RuntimeException("CCYY-MM must be followed by '-' sign");
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   300
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   301
        int stop = start + 2;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   302
        date.day = parseInt(buffer, start, stop);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   303
        return stop;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   304
    }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   305
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   306
    /**
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   307
     * Parses date CCYY-MM
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   308
     *
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   309
     * @param buffer
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   310
     * @param start start position
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   311
     * @param end end position
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   312
     * @param date
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   313
     * @exception RuntimeException
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   314
     */
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   315
    protected int getYearMonth(String buffer, int start, int end, DateTimeData date) throws RuntimeException {
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   316
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   317
        if (buffer.charAt(0) == '-') {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   318
            // REVISIT: date starts with preceding '-' sign
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   319
            //          do we have to do anything with it?
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   320
            //
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   321
            start++;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   322
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   323
        int i = indexOf(buffer, start, end, '-');
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   324
        if (i == -1) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   325
            throw new RuntimeException("Year separator is missing or misplaced");
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   326
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   327
        int length = i - start;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   328
        if (length < 4) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   329
            throw new RuntimeException("Year must have 'CCYY' format");
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   330
        } else if (length > 4 && buffer.charAt(start) == '0') {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   331
            throw new RuntimeException("Leading zeros are required if the year value would otherwise have fewer than four digits; otherwise they are forbidden");
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   332
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   333
        date.year = parseIntYear(buffer, i);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   334
        if (buffer.charAt(i) != '-') {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   335
            throw new RuntimeException("CCYY must be followed by '-' sign");
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   336
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   337
        start = ++i;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   338
        i = start + 2;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   339
        date.month = parseInt(buffer, start, i);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   340
        return i; //fStart points right after the MONTH
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   341
    }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   342
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   343
    /**
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   344
     * Shared code from Date and YearMonth datatypes. Finds if time zone sign is
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   345
     * present
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   346
     *
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   347
     * @param end
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   348
     * @param date
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   349
     * @exception RuntimeException
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   350
     */
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   351
    protected void parseTimeZone(String buffer, int start, int end, DateTimeData date) throws RuntimeException {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   352
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   353
        //fStart points right after the date
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   354
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   355
        if (start < end) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   356
            if (!isNextCharUTCSign(buffer, start, end)) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   357
                throw new RuntimeException("Error in month parsing");
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   358
            } else {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   359
                getTimeZone(buffer, date, start, end);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   360
            }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   361
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   362
    }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   363
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   364
    /**
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   365
     * Parses time zone: 'Z' or {+,-} followed by hh:mm
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   366
     *
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   367
     * @param data
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   368
     * @param sign
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   369
     * @exception RuntimeException
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   370
     */
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   371
    protected void getTimeZone(String buffer, DateTimeData data, int sign, int end) throws RuntimeException {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   372
        data.utc = buffer.charAt(sign);
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   373
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   374
        if (buffer.charAt(sign) == 'Z') {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   375
            if (end > (++sign)) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   376
                throw new RuntimeException("Error in parsing time zone");
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   377
            }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   378
            return;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   379
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   380
        if (sign <= (end - 6)) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   381
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   382
            int negate = buffer.charAt(sign) == '-' ? -1 : 1;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   383
            //parse hr
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   384
            int stop = ++sign + 2;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   385
            data.timezoneHr = negate * parseInt(buffer, sign, stop);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   386
            if (buffer.charAt(stop++) != ':') {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   387
                throw new RuntimeException("Error in parsing time zone");
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   388
            }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   389
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   390
            //parse min
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   391
            data.timezoneMin = negate * parseInt(buffer, stop, stop + 2);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   392
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   393
            if (stop + 2 != end) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   394
                throw new RuntimeException("Error in parsing time zone");
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   395
            }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   396
            if (data.timezoneHr != 0 || data.timezoneMin != 0) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   397
                data.normalized = false;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   398
            }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   399
        } else {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   400
            throw new RuntimeException("Error in parsing time zone");
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   401
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   402
        if (DEBUG) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   403
            System.out.println("time[hh]=" + data.timezoneHr + " time[mm]=" + data.timezoneMin);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   404
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   405
    }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   406
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   407
    /**
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   408
     * Computes index of given char within StringBuffer
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   409
     *
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   410
     * @param start
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   411
     * @param end
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   412
     * @param ch character to look for in StringBuffer
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   413
     * @return index of ch within StringBuffer
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   414
     */
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   415
    protected int indexOf(String buffer, int start, int end, char ch) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   416
        for (int i = start; i < end; i++) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   417
            if (buffer.charAt(i) == ch) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   418
                return i;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   419
            }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   420
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   421
        return -1;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   422
    }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   423
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   424
    /**
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   425
     * Validates given date/time object accoring to W3C PR Schema [D.1 ISO 8601
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   426
     * Conventions]
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   427
     *
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   428
     * @param data
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   429
     */
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   430
    protected void validateDateTime(DateTimeData data) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   431
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   432
        //REVISIT: should we throw an exception for not valid dates
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   433
        //          or reporting an error message should be sufficient?
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   434
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   435
        /**
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   436
         * XML Schema 1.1 - RQ-123: Allow year 0000 in date related types.
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   437
         */
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   438
        if (!Constants.SCHEMA_1_1_SUPPORT && data.year == 0) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   439
            throw new RuntimeException("The year \"0000\" is an illegal year value");
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   440
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   441
        }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   442
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   443
        if (data.month < 1 || data.month > 12) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   444
            throw new RuntimeException("The month must have values 1 to 12");
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   445
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   446
        }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   447
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   448
        //validate days
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   449
        if (data.day > maxDayInMonthFor(data.year, data.month) || data.day < 1) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   450
            throw new RuntimeException("The day must have values 1 to 31");
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   451
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   452
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   453
        //validate hours
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   454
        if (data.hour > 23 || data.hour < 0) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   455
            if (data.hour == 24 && data.minute == 0 && data.second == 0) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   456
                data.hour = 0;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   457
                if (++data.day > maxDayInMonthFor(data.year, data.month)) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   458
                    data.day = 1;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   459
                    if (++data.month > 12) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   460
                        data.month = 1;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   461
                        if (Constants.SCHEMA_1_1_SUPPORT) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   462
                            ++data.year;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   463
                        } else if (++data.year == 0) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   464
                            data.year = 1;
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   465
                        }
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   466
                    }
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   467
                }
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   468
            } else {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   469
                throw new RuntimeException("Hour must have values 0-23, unless 24:00:00");
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   470
            }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   471
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   472
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   473
        //validate
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   474
        if (data.minute > 59 || data.minute < 0) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   475
            throw new RuntimeException("Minute must have values 0-59");
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   476
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   477
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   478
        //validate
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   479
        if (data.second >= 60 || data.second < 0) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   480
            throw new RuntimeException("Second must have values 0-59");
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   481
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   482
        }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   483
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   484
        //validate
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   485
        if (data.timezoneHr > 14 || data.timezoneHr < -14) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   486
            throw new RuntimeException("Time zone should have range -14:00 to +14:00");
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   487
        } else {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   488
            if ((data.timezoneHr == 14 || data.timezoneHr == -14) && data.timezoneMin != 0) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   489
                throw new RuntimeException("Time zone should have range -14:00 to +14:00");
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   490
            } else if (data.timezoneMin > 59 || data.timezoneMin < -59) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   491
                throw new RuntimeException("Minute must have values 0-59");
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   492
            }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   493
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   494
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   495
    }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   496
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   497
    /**
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   498
     * Return index of UTC char: 'Z', '+', '-'
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   499
     *
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   500
     * @param start
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   501
     * @param end
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   502
     * @return index of the UTC character that was found
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   503
     */
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   504
    protected int findUTCSign(String buffer, int start, int end) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   505
        int c;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   506
        for (int i = start; i < end; i++) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   507
            c = buffer.charAt(i);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   508
            if (c == 'Z' || c == '+' || c == '-') {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   509
                return i;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   510
            }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   511
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   512
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   513
        return -1;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   514
    }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   515
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   516
    /**
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   517
     * Returns
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   518
     * <code>true</code> if the character at start is 'Z', '+' or '-'.
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   519
     */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   520
    protected final boolean isNextCharUTCSign(String buffer, int start, int end) {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   521
        if (start < end) {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   522
            char c = buffer.charAt(start);
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   523
            return (c == 'Z' || c == '+' || c == '-');
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   524
        }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   525
        return false;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   526
    }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   527
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   528
    /**
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   529
     * Given start and end position, parses string value
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   530
     *
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   531
     * @param buffer string to parse
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   532
     * @param start start position
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   533
     * @param end end position
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   534
     * @return return integer representation of characters
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   535
     */
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   536
    protected int parseInt(String buffer, int start, int end)
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   537
            throws NumberFormatException {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   538
        //REVISIT: more testing on this parsing needs to be done.
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   539
        int radix = 10;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   540
        int result = 0;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   541
        int digit = 0;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   542
        int limit = -Integer.MAX_VALUE;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   543
        int multmin = limit / radix;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   544
        int i = start;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   545
        do {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   546
            digit = getDigit(buffer.charAt(i));
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   547
            if (digit < 0) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   548
                throw new NumberFormatException("'" + buffer + "' has wrong format");
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   549
            }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   550
            if (result < multmin) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   551
                throw new NumberFormatException("'" + buffer + "' has wrong format");
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   552
            }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   553
            result *= radix;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   554
            if (result < limit + digit) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   555
                throw new NumberFormatException("'" + buffer + "' has wrong format");
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   556
            }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   557
            result -= digit;
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   558
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   559
        } while (++i < end);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   560
        return -result;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   561
    }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   562
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   563
    // parse Year differently to support negative value.
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   564
    protected int parseIntYear(String buffer, int end) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   565
        int radix = 10;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   566
        int result = 0;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   567
        boolean negative = false;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   568
        int i = 0;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   569
        int limit;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   570
        int multmin;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   571
        int digit = 0;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   572
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   573
        if (buffer.charAt(0) == '-') {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   574
            negative = true;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   575
            limit = Integer.MIN_VALUE;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   576
            i++;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   577
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   578
        } else {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   579
            limit = -Integer.MAX_VALUE;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   580
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   581
        multmin = limit / radix;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   582
        while (i < end) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   583
            digit = getDigit(buffer.charAt(i++));
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   584
            if (digit < 0) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   585
                throw new NumberFormatException("'" + buffer + "' has wrong format");
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   586
            }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   587
            if (result < multmin) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   588
                throw new NumberFormatException("'" + buffer + "' has wrong format");
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   589
            }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   590
            result *= radix;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   591
            if (result < limit + digit) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   592
                throw new NumberFormatException("'" + buffer + "' has wrong format");
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   593
            }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   594
            result -= digit;
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   595
        }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   596
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   597
        if (negative) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   598
            if (i > 1) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   599
                return result;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   600
            } else {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   601
                throw new NumberFormatException("'" + buffer + "' has wrong format");
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   602
            }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   603
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   604
        return -result;
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   605
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   606
    }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   607
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   608
    /**
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   609
     * If timezone present - normalize dateTime [E Adding durations to
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   610
     * dateTimes]
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   611
     *
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   612
     * @param date CCYY-MM-DDThh:mm:ss+03
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   613
     */
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   614
    protected void normalize(DateTimeData date) {
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   615
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   616
        // REVISIT: we have common code in addDuration() for durations
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   617
        //          should consider reorganizing it.
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   618
        //
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   619
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   620
        //add minutes (from time zone)
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   621
        int negate = -1;
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   622
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   623
        if (DEBUG) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   624
            System.out.println("==>date.minute" + date.minute);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   625
            System.out.println("==>date.timezoneMin" + date.timezoneMin);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   626
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   627
        int temp = date.minute + negate * date.timezoneMin;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   628
        int carry = fQuotient(temp, 60);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   629
        date.minute = mod(temp, 60, carry);
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   630
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   631
        if (DEBUG) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   632
            System.out.println("==>carry: " + carry);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   633
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   634
        //add hours
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   635
        temp = date.hour + negate * date.timezoneHr + carry;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   636
        carry = fQuotient(temp, 24);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   637
        date.hour = mod(temp, 24, carry);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   638
        if (DEBUG) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   639
            System.out.println("==>date.hour" + date.hour);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   640
            System.out.println("==>carry: " + carry);
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   641
        }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   642
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   643
        date.day = date.day + carry;
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   644
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   645
        while (true) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   646
            temp = maxDayInMonthFor(date.year, date.month);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   647
            if (date.day < 1) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   648
                date.day = date.day + maxDayInMonthFor(date.year, date.month - 1);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   649
                carry = -1;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   650
            } else if (date.day > temp) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   651
                date.day = date.day - temp;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   652
                carry = 1;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   653
            } else {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   654
                break;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   655
            }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   656
            temp = date.month + carry;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   657
            date.month = modulo(temp, 1, 13);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   658
            date.year = date.year + fQuotient(temp, 1, 13);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   659
            if (date.year == 0 && !Constants.SCHEMA_1_1_SUPPORT) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   660
                date.year = (date.timezoneHr < 0 || date.timezoneMin < 0) ? 1 : -1;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   661
            }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   662
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   663
        date.utc = 'Z';
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   664
    }
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   665
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   666
    /**
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   667
     * @param date
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   668
     */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   669
    protected void saveUnnormalized(DateTimeData date) {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   670
        date.unNormYear = date.year;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   671
        date.unNormMonth = date.month;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   672
        date.unNormDay = date.day;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   673
        date.unNormHour = date.hour;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   674
        date.unNormMinute = date.minute;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   675
        date.unNormSecond = date.second;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   676
    }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   677
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   678
    /**
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   679
     * Resets object representation of date/time
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   680
     *
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   681
     * @param data date/time object
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   682
     */
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   683
    protected void resetDateObj(DateTimeData data) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   684
        data.year = 0;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   685
        data.month = 0;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   686
        data.day = 0;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   687
        data.hour = 0;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   688
        data.minute = 0;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   689
        data.second = 0;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   690
        data.utc = 0;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   691
        data.timezoneHr = 0;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   692
        data.timezoneMin = 0;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   693
    }
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   694
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   695
    /**
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   696
     * Given {year,month} computes maximum number of days for given month
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   697
     *
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   698
     * @param year
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   699
     * @param month
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   700
     * @return integer containg the number of days in a given month
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   701
     */
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   702
    protected int maxDayInMonthFor(int year, int month) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   703
        //validate days
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   704
        if (month == 4 || month == 6 || month == 9 || month == 11) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   705
            return 30;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   706
        } else if (month == 2) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   707
            if (isLeapYear(year)) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   708
                return 29;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   709
            } else {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   710
                return 28;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   711
            }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   712
        } else {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   713
            return 31;
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   714
        }
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   715
    }
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   716
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   717
    private boolean isLeapYear(int year) {
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   718
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   719
        //REVISIT: should we take care about Julian calendar?
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   720
        return ((year % 4 == 0) && ((year % 100 != 0) || (year % 400 == 0)));
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   721
    }
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   722
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   723
    //
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   724
    // help function described in W3C PR Schema [E Adding durations to dateTimes]
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   725
    //
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   726
    protected int mod(int a, int b, int quotient) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   727
        //modulo(a, b) = a - fQuotient(a,b)*b
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   728
        return (a - quotient * b);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   729
    }
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   730
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   731
    //
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   732
    // help function described in W3C PR Schema [E Adding durations to dateTimes]
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   733
    //
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   734
    protected int fQuotient(int a, int b) {
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   735
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   736
        //fQuotient(a, b) = the greatest integer less than or equal to a/b
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   737
        return (int) Math.floor((float) a / b);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   738
    }
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   739
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   740
    //
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   741
    // help function described in W3C PR Schema [E Adding durations to dateTimes]
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   742
    //
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   743
    protected int modulo(int temp, int low, int high) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   744
        //modulo(a - low, high - low) + low
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   745
        int a = temp - low;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   746
        int b = high - low;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   747
        return (mod(a, b, fQuotient(a, b)) + low);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   748
    }
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   749
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   750
    //
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   751
    // help function described in W3C PR Schema [E Adding durations to dateTimes]
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   752
    //
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   753
    protected int fQuotient(int temp, int low, int high) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   754
        //fQuotient(a - low, high - low)
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   755
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   756
        return fQuotient(temp - low, high - low);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   757
    }
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   758
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   759
    protected String dateToString(DateTimeData date) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   760
        StringBuffer message = new StringBuffer(25);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   761
        append(message, date.year, 4);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   762
        message.append('-');
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   763
        append(message, date.month, 2);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   764
        message.append('-');
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   765
        append(message, date.day, 2);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   766
        message.append('T');
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   767
        append(message, date.hour, 2);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   768
        message.append(':');
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   769
        append(message, date.minute, 2);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   770
        message.append(':');
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   771
        append(message, date.second);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   772
        append(message, (char) date.utc, 0);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   773
        return message.toString();
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   774
    }
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   775
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   776
    protected final void append(StringBuffer message, int value, int nch) {
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   777
        if (value == Integer.MIN_VALUE) {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   778
            message.append(value);
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   779
            return;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   780
        }
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   781
        if (value < 0) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   782
            message.append('-');
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   783
            value = -value;
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   784
        }
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   785
        if (nch == 4) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   786
            if (value < 10) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   787
                message.append("000");
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   788
            } else if (value < 100) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   789
                message.append("00");
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   790
            } else if (value < 1000) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   791
                message.append('0');
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   792
            }
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   793
            message.append(value);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   794
        } else if (nch == 2) {
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   795
            if (value < 10) {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   796
                message.append('0');
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   797
            }
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   798
            message.append(value);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   799
        } else {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   800
            if (value != 0) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   801
                message.append((char) value);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   802
            }
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   803
        }
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   804
    }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   805
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   806
    protected final void append(StringBuffer message, double value) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   807
        if (value < 0) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   808
            message.append('-');
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   809
            value = -value;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   810
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   811
        if (value < 10) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   812
            message.append('0');
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   813
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   814
        append2(message, value);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   815
    }
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   816
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   817
    protected final void append2(StringBuffer message, double value) {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   818
        final int intValue = (int) value;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   819
        if (value == intValue) {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   820
            message.append(intValue);
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   821
        } else {
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   822
            append3(message, value);
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   823
        }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   824
    }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   825
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   826
    private void append3(StringBuffer message, double value) {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   827
        String d = String.valueOf(value);
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   828
        int eIndex = d.indexOf('E');
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   829
        if (eIndex == -1) {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   830
            message.append(d);
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   831
            return;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   832
        }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   833
        int exp;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   834
        if (value < 1) {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   835
            // Need to convert from scientific notation of the form
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   836
            // n.nnn...E-N (N >= 4) to a normal decimal value.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   837
            try {
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   838
                exp = parseInt(d, eIndex + 2, d.length());
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   839
            } // This should never happen.
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   840
            // It's only possible if String.valueOf(double) is broken.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   841
            catch (Exception e) {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   842
                message.append(d);
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   843
                return;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   844
            }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   845
            message.append("0.");
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   846
            for (int i = 1; i < exp; ++i) {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   847
                message.append('0');
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   848
            }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   849
            // Remove trailing zeros.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   850
            int end = eIndex - 1;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   851
            while (end > 0) {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   852
                char c = d.charAt(end);
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   853
                if (c != '0') {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   854
                    break;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   855
                }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   856
                --end;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   857
            }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   858
            // Now append the digits to the end. Skip over the decimal point.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   859
            for (int i = 0; i <= end; ++i) {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   860
                char c = d.charAt(i);
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   861
                if (c != '.') {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   862
                    message.append(c);
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   863
                }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   864
            }
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   865
        } else {
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   866
            // Need to convert from scientific notation of the form
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   867
            // n.nnn...EN (N >= 7) to a normal decimal value.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   868
            try {
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   869
                exp = parseInt(d, eIndex + 1, d.length());
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   870
            } // This should never happen.
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   871
            // It's only possible if String.valueOf(double) is broken.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   872
            catch (Exception e) {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   873
                message.append(d);
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   874
                return;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   875
            }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   876
            final int integerEnd = exp + 2;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   877
            for (int i = 0; i < eIndex; ++i) {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   878
                char c = d.charAt(i);
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   879
                if (c != '.') {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   880
                    if (i == integerEnd) {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   881
                        message.append('.');
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   882
                    }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   883
                    message.append(c);
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   884
                }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   885
            }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   886
            // Append trailing zeroes if necessary.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   887
            for (int i = integerEnd - eIndex; i > 0; --i) {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   888
                message.append('0');
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   889
            }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   890
        }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   891
    }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   892
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   893
    protected double parseSecond(String buffer, int start, int end)
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   894
            throws NumberFormatException {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   895
        int dot = -1;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   896
        for (int i = start; i < end; i++) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   897
            char ch = buffer.charAt(i);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   898
            if (ch == '.') {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   899
                dot = i;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   900
            } else if (ch > '9' || ch < '0') {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   901
                throw new NumberFormatException("'" + buffer + "' has wrong format");
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   902
            }
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   903
        }
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   904
        if (dot == -1) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   905
            if (start + 2 != end) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   906
                throw new NumberFormatException("'" + buffer + "' has wrong format");
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   907
            }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   908
        } else if (start + 2 != dot || dot + 1 == end) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   909
            throw new NumberFormatException("'" + buffer + "' has wrong format");
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   910
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   911
        return Double.parseDouble(buffer.substring(start, end));
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   912
    }
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   913
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   914
    //
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   915
    //Private help functions
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   916
    //
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   917
    private void cloneDate(DateTimeData finalValue, DateTimeData tempDate) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   918
        tempDate.year = finalValue.year;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   919
        tempDate.month = finalValue.month;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   920
        tempDate.day = finalValue.day;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   921
        tempDate.hour = finalValue.hour;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   922
        tempDate.minute = finalValue.minute;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   923
        tempDate.second = finalValue.second;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   924
        tempDate.utc = finalValue.utc;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   925
        tempDate.timezoneHr = finalValue.timezoneHr;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   926
        tempDate.timezoneMin = finalValue.timezoneMin;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   927
    }
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   928
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   929
    /**
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   930
     * Represents date time data
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   931
     */
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   932
    static final class DateTimeData implements XSDateTime {
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   933
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   934
        int year, month, day, hour, minute, utc;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   935
        double second;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   936
        int timezoneHr, timezoneMin;
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   937
        private String originalValue;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   938
        boolean normalized = true;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   939
        int unNormYear;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   940
        int unNormMonth;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   941
        int unNormDay;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   942
        int unNormHour;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   943
        int unNormMinute;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   944
        double unNormSecond;
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   945
        // used for comparisons - to decide the 'interesting' portions of
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   946
        // a date/time based data type.
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   947
        int position;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   948
        // a pointer to the type that was used go generate this data
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   949
        // note that this is not the actual simple type, but one of the
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   950
        // statically created XXXDV objects, so this won't cause any GC problem.
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   951
        final AbstractDateTimeDV type;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   952
        private volatile String canonical;
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   953
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   954
        public DateTimeData(String originalValue, AbstractDateTimeDV type) {
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   955
            this.originalValue = originalValue;
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   956
            this.type = type;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   957
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   958
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   959
        public DateTimeData(int year, int month, int day, int hour, int minute,
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   960
                double second, int utc, String originalValue, boolean normalized, AbstractDateTimeDV type) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   961
            this.year = year;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   962
            this.month = month;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   963
            this.day = day;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   964
            this.hour = hour;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   965
            this.minute = minute;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   966
            this.second = second;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   967
            this.utc = utc;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   968
            this.type = type;
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   969
            this.originalValue = originalValue;
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   970
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   971
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   972
        @Override
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   973
        public boolean equals(Object obj) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   974
            if (!(obj instanceof DateTimeData)) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   975
                return false;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   976
            }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   977
            return type.compareDates(this, (DateTimeData) obj, true) == 0;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   978
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   979
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   980
        // If two DateTimeData are equals - then they should have the same
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   981
        // hashcode. This means we need to convert the date to UTC before
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   982
        // we return its hashcode.
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   983
        // The DateTimeData is unfortunately mutable - so we cannot
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   984
        // cache the result of the conversion...
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   985
        //
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   986
        @Override
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   987
        public int hashCode() {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   988
            final DateTimeData tempDate = new DateTimeData(null, type);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   989
            type.cloneDate(this, tempDate);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   990
            type.normalize(tempDate);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   991
            return type.dateToString(tempDate).hashCode();
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   992
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   993
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   994
        @Override
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   995
        public String toString() {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   996
            if (canonical == null) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   997
                canonical = type.dateToString(this);
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   998
            }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
   999
            return canonical;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1000
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1001
        /* (non-Javadoc)
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1002
         * @see org.apache.xerces.xs.datatypes.XSDateTime#getYear()
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1003
         */
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1004
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1005
        @Override
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1006
        public int getYears() {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1007
            if (type instanceof DurationDV) {
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1008
                return 0;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1009
            }
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1010
            return normalized ? year : unNormYear;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1011
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1012
        /* (non-Javadoc)
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1013
         * @see org.apache.xerces.xs.datatypes.XSDateTime#getMonth()
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1014
         */
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1015
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1016
        @Override
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1017
        public int getMonths() {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1018
            if (type instanceof DurationDV) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1019
                return year * 12 + month;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1020
            }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1021
            return normalized ? month : unNormMonth;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1022
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1023
        /* (non-Javadoc)
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1024
         * @see org.apache.xerces.xs.datatypes.XSDateTime#getDay()
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1025
         */
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1026
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1027
        @Override
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1028
        public int getDays() {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1029
            if (type instanceof DurationDV) {
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1030
                return 0;
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1031
            }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1032
            return normalized ? day : unNormDay;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1033
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1034
        /* (non-Javadoc)
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1035
         * @see org.apache.xerces.xs.datatypes.XSDateTime#getHour()
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1036
         */
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1037
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1038
        @Override
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1039
        public int getHours() {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1040
            if (type instanceof DurationDV) {
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1041
                return 0;
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1042
            }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1043
            return normalized ? hour : unNormHour;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1044
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1045
        /* (non-Javadoc)
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1046
         * @see org.apache.xerces.xs.datatypes.XSDateTime#getMinutes()
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1047
         */
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1048
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1049
        @Override
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1050
        public int getMinutes() {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1051
            if (type instanceof DurationDV) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1052
                return 0;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1053
            }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1054
            return normalized ? minute : unNormMinute;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1055
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1056
        /* (non-Javadoc)
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1057
         * @see org.apache.xerces.xs.datatypes.XSDateTime#getSeconds()
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1058
         */
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1059
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1060
        @Override
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1061
        public double getSeconds() {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1062
            if (type instanceof DurationDV) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1063
                return day * 24 * 60 * 60 + hour * 60 * 60 + minute * 60 + second;
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1064
            }
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1065
            return normalized ? second : unNormSecond;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1066
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1067
        /* (non-Javadoc)
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1068
         * @see org.apache.xerces.xs.datatypes.XSDateTime#hasTimeZone()
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1069
         */
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1070
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1071
        @Override
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1072
        public boolean hasTimeZone() {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1073
            return utc != 0;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1074
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1075
        /* (non-Javadoc)
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1076
         * @see org.apache.xerces.xs.datatypes.XSDateTime#getTimeZoneHours()
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1077
         */
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1078
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1079
        @Override
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1080
        public int getTimeZoneHours() {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1081
            return timezoneHr;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1082
        }
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1083
        /* (non-Javadoc)
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1084
         * @see org.apache.xerces.xs.datatypes.XSDateTime#getTimeZoneMinutes()
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1085
         */
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1086
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1087
        @Override
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1088
        public int getTimeZoneMinutes() {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1089
            return timezoneMin;
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1090
        }
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1091
        /* (non-Javadoc)
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1092
         * @see org.apache.xerces.xs.datatypes.XSDateTime#getLexicalValue()
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1093
         */
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1094
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1095
        @Override
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1096
        public String getLexicalValue() {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1097
            return originalValue;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1098
        }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1099
        /* (non-Javadoc)
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1100
         * @see org.apache.xerces.xs.datatypes.XSDateTime#normalize()
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1101
         */
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1102
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1103
        @Override
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1104
        public XSDateTime normalize() {
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1105
            if (!normalized) {
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1106
                DateTimeData dt = (DateTimeData) this.clone();
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1107
                dt.normalized = true;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1108
                return dt;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1109
            }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1110
            return this;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1111
        }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1112
        /* (non-Javadoc)
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1113
         * @see org.apache.xerces.xs.datatypes.XSDateTime#isNormalized()
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1114
         */
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1115
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1116
        @Override
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1117
        public boolean isNormalized() {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1118
            return normalized;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1119
        }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1120
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1121
        @Override
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1122
        public Object clone() {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1123
            DateTimeData dt = new DateTimeData(this.year, this.month, this.day, this.hour,
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1124
                    this.minute, this.second, this.utc, this.originalValue, this.normalized, this.type);
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1125
            dt.canonical = this.canonical;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1126
            dt.position = position;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1127
            dt.timezoneHr = this.timezoneHr;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1128
            dt.timezoneMin = this.timezoneMin;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1129
            dt.unNormYear = this.unNormYear;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1130
            dt.unNormMonth = this.unNormMonth;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1131
            dt.unNormDay = this.unNormDay;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1132
            dt.unNormHour = this.unNormHour;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1133
            dt.unNormMinute = this.unNormMinute;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1134
            dt.unNormSecond = this.unNormSecond;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1135
            return dt;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1136
        }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1137
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1138
        /* (non-Javadoc)
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1139
         * @see org.apache.xerces.xs.datatypes.XSDateTime#getXMLGregorianCalendar()
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1140
         */
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1141
        @Override
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1142
        public XMLGregorianCalendar getXMLGregorianCalendar() {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1143
            return type.getXMLGregorianCalendar(this);
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1144
        }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1145
        /* (non-Javadoc)
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1146
         * @see org.apache.xerces.xs.datatypes.XSDateTime#getDuration()
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1147
         */
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1148
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1149
        @Override
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1150
        public Duration getDuration() {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1151
            return type.getDuration(this);
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1152
        }
17538
d8d911c4e5d4 8013900: More warnings compiling jaxp.
dfuchs
parents: 12457
diff changeset
  1153
    }
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1154
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1155
    protected XMLGregorianCalendar getXMLGregorianCalendar(DateTimeData data) {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1156
        return null;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1157
    }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1158
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1159
    protected Duration getDuration(DateTimeData data) {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1160
        return null;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1161
    }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1162
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1163
    protected final BigDecimal getFractionalSecondsAsBigDecimal(DateTimeData data) {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1164
        final StringBuffer buf = new StringBuffer();
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1165
        append3(buf, data.unNormSecond);
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1166
        String value = buf.toString();
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1167
        final int index = value.indexOf('.');
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1168
        if (index == -1) {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1169
            return null;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1170
        }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1171
        value = value.substring(index);
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1172
        final BigDecimal _val = new BigDecimal(value);
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1173
        if (_val.compareTo(BigDecimal.valueOf(0)) == 0) {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1174
            return null;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1175
        }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1176
        return _val;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1177
    }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
  1178
}