jaxp/src/com/sun/org/apache/xerces/internal/util/SecurityManager.java
author joehw
Tue, 20 Aug 2013 09:02:25 -0700
changeset 20973 cc1cc8eb501b
child 20975 298d79f9a705
permissions -rw-r--r--
8022682: Supporting XOM Reviewed-by: alanb, chegar, lancea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
20973
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
     1
/*
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
     2
 * reserved comment block
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
     3
 * DO NOT REMOVE OR ALTER!
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
     4
 */
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
     5
/*
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
     6
 * The Apache Software License, Version 1.1
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
     7
 *
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
     8
 *
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
     9
 * Copyright (c) 2003 The Apache Software Foundation.
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    10
 * All rights reserved.
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    11
 *
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    12
 * Redistribution and use in source and binary forms, with or without
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    13
 * modification, are permitted provided that the following conditions
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    14
 * are met:
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    15
 *
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    16
 * 1. Redistributions of source code must retain the above copyright
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    17
 *    notice, this list of conditions and the following disclaimer.
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    18
 *
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    19
 * 2. Redistributions in binary form must reproduce the above copyright
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    20
 *    notice, this list of conditions and the following disclaimer in
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    21
 *    the documentation and/or other materials provided with the
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    22
 *    distribution.
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    23
 *
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    24
 * 3. The end-user documentation included with the redistribution,
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    25
 *    if any, must include the following acknowledgment:
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    26
 *       "This product includes software developed by the
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    27
 *        Apache Software Foundation (http://www.apache.org/)."
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    28
 *    Alternately, this acknowledgment may appear in the software itself,
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    29
 *    if and wherever such third-party acknowledgments normally appear.
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    30
 *
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    31
 * 4. The names "Xerces" and "Apache Software Foundation" must
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    32
 *    not be used to endorse or promote products derived from this
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    33
 *    software without prior written permission. For written
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    34
 *    permission, please contact apache@apache.org.
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    35
 *
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    36
 * 5. Products derived from this software may not be called "Apache",
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    37
 *    nor may "Apache" appear in their name, without prior written
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    38
 *    permission of the Apache Software Foundation.
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    39
 *
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    40
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    41
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    42
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    43
 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    44
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    45
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    46
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    47
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    48
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    49
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    50
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    51
 * SUCH DAMAGE.
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    52
 * ====================================================================
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    53
 *
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    54
 * This software consists of voluntary contributions made by many
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    55
 * individuals on behalf of the Apache Software Foundation and was
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    56
 * originally based on software copyright (c) 1999, International
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    57
 * Business Machines, Inc., http://www.apache.org.  For more
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    58
 * information on the Apache Software Foundation, please see
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    59
 * <http://www.apache.org/>.
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    60
 */
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    61
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    62
package com.sun.org.apache.xerces.internal.util;
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    63
import com.sun.org.apache.xerces.internal.impl.Constants;
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    64
/**
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    65
 * This class is a container for parser settings that relate to
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    66
 * security, or more specifically, it is intended to be used to prevent denial-of-service
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    67
 * attacks from being launched against a system running Xerces.
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    68
 * Any component that is aware of a denial-of-service attack that can arise
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    69
 * from its processing of a certain kind of document may query its Component Manager
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    70
 * for the property (http://apache.org/xml/properties/security-manager)
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    71
 * whose value will be an instance of this class.
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    72
 * If no value has been set for the property, the component should proceed in the "usual" (spec-compliant)
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    73
 * manner.  If a value has been set, then it must be the case that the component in
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    74
 * question needs to know what method of this class to query.  This class
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    75
 * will provide defaults for all known security issues, but will also provide
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    76
 * setters so that those values can be tailored by applications that care.
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    77
 *
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    78
 * @author  Neil Graham, IBM
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    79
 *
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    80
 */
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    81
public final class SecurityManager {
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    82
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    83
    //
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    84
    // Constants
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    85
    //
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    86
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    87
    // default value for entity expansion limit
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    88
    private final static int DEFAULT_ENTITY_EXPANSION_LIMIT = 64000;
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    89
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    90
    /** Default value of number of nodes created. **/
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    91
    private final static int DEFAULT_MAX_OCCUR_NODE_LIMIT = 5000;
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    92
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    93
    //
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    94
    // Data
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    95
    //
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    96
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    97
        private final static int DEFAULT_ELEMENT_ATTRIBUTE_LIMIT = 10000;
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    98
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
    99
    /** Entity expansion limit. **/
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   100
    private int entityExpansionLimit;
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   101
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   102
    /** W3C XML Schema maxOccurs limit. **/
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   103
    private int maxOccurLimit;
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   104
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   105
        private int fElementAttributeLimit;
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   106
    // default constructor.  Establishes default values for
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   107
    // all known security holes.
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   108
    /**
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   109
     * Default constructor.  Establishes default values
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   110
     * for known security vulnerabilities.
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   111
     */
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   112
    public SecurityManager() {
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   113
        entityExpansionLimit = DEFAULT_ENTITY_EXPANSION_LIMIT;
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   114
        maxOccurLimit = DEFAULT_MAX_OCCUR_NODE_LIMIT ;
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   115
                fElementAttributeLimit = DEFAULT_ELEMENT_ATTRIBUTE_LIMIT;
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   116
                //We are reading system properties only once ,
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   117
                //at the time of creation of this object ,
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   118
                readSystemProperties();
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   119
    }
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   120
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   121
    /**
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   122
     * <p>Sets the number of entity expansions that the
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   123
     * parser should permit in a document.</p>
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   124
     *
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   125
     * @param limit the number of entity expansions
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   126
     * permitted in a document
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   127
     */
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   128
    public void setEntityExpansionLimit(int limit) {
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   129
        entityExpansionLimit = limit;
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   130
    }
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   131
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   132
    /**
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   133
     * <p>Returns the number of entity expansions
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   134
     * that the parser permits in a document.</p>
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   135
     *
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   136
     * @return the number of entity expansions
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   137
     * permitted in a document
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   138
     */
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   139
    public int getEntityExpansionLimit() {
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   140
        return entityExpansionLimit;
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   141
    }
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   142
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   143
    /**
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   144
     * <p>Sets the limit of the number of content model nodes
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   145
     * that may be created when building a grammar for a W3C
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   146
     * XML Schema that contains maxOccurs attributes with values
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   147
     * other than "unbounded".</p>
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   148
     *
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   149
     * @param limit the maximum value for maxOccurs other
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   150
     * than "unbounded"
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   151
     */
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   152
    public void setMaxOccurNodeLimit(int limit){
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   153
        maxOccurLimit = limit;
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   154
    }
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   155
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   156
    /**
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   157
     * <p>Returns the limit of the number of content model nodes
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   158
     * that may be created when building a grammar for a W3C
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   159
     * XML Schema that contains maxOccurs attributes with values
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   160
     * other than "unbounded".</p>
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   161
     *
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   162
     * @return the maximum value for maxOccurs other
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   163
     * than "unbounded"
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   164
     */
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   165
    public int getMaxOccurNodeLimit(){
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   166
        return maxOccurLimit;
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   167
    }
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   168
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   169
    public int getElementAttrLimit(){
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   170
                return fElementAttributeLimit;
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   171
        }
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   172
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   173
        public void setElementAttrLimit(int limit){
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   174
                fElementAttributeLimit = limit;
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   175
        }
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   176
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   177
        private void readSystemProperties(){
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   178
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   179
                try {
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   180
                        String value = System.getProperty(Constants.ENTITY_EXPANSION_LIMIT);
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   181
                        if(value != null && !value.equals("")){
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   182
                                entityExpansionLimit = Integer.parseInt(value);
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   183
                                if (entityExpansionLimit < 0)
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   184
                                        entityExpansionLimit = DEFAULT_ENTITY_EXPANSION_LIMIT;
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   185
                        }
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   186
                        else
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   187
                                entityExpansionLimit = DEFAULT_ENTITY_EXPANSION_LIMIT;
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   188
                }catch(Exception ex){}
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   189
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   190
                try {
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   191
                        String value = System.getProperty(Constants.MAX_OCCUR_LIMIT);
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   192
                        if(value != null && !value.equals("")){
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   193
                                maxOccurLimit = Integer.parseInt(value);
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   194
                                if (maxOccurLimit < 0)
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   195
                                        maxOccurLimit = DEFAULT_MAX_OCCUR_NODE_LIMIT;
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   196
                        }
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   197
                        else
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   198
                                maxOccurLimit = DEFAULT_MAX_OCCUR_NODE_LIMIT;
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   199
                }catch(Exception ex){}
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   200
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   201
                try {
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   202
                        String value = System.getProperty(Constants.ELEMENT_ATTRIBUTE_LIMIT);
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   203
                        if(value != null && !value.equals("")){
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   204
                                fElementAttributeLimit = Integer.parseInt(value);
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   205
                                if ( fElementAttributeLimit < 0)
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   206
                                        fElementAttributeLimit = DEFAULT_ELEMENT_ATTRIBUTE_LIMIT;
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   207
                        }
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   208
                        else
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   209
                                fElementAttributeLimit = DEFAULT_ELEMENT_ATTRIBUTE_LIMIT;
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   210
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   211
                }catch(Exception ex){}
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   212
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   213
        }
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   214
cc1cc8eb501b 8022682: Supporting XOM
joehw
parents:
diff changeset
   215
} // class SecurityManager