• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Limit类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.sun.org.apache.xerces.internal.utils.XMLSecurityManager.Limit的典型用法代码示例。如果您正苦于以下问题:Java Limit类的具体用法?Java Limit怎么用?Java Limit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Limit类属于com.sun.org.apache.xerces.internal.utils.XMLSecurityManager包,在下文中一共展示了Limit类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: resetCommon

import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager.Limit; //导入依赖的package包/类
void resetCommon() {
    // initialize vars
    fMarkupDepth = 0;
    fCurrentElement = null;
    fElementStack.clear();
    fHasExternalDTD = false;
    fStandaloneSet = false;
    fStandalone = false;
    fInScanContent = false;
    //skipping algorithm
    fShouldSkip = false;
    fAdd = false;
    fSkip = false;

    fEntityStore = fEntityManager.getEntityStore();
    dtdGrammarUtil = null;

    if (fSecurityManager != null) {
        fElementAttributeLimit = fSecurityManager.getLimit(XMLSecurityManager.Limit.ELEMENT_ATTRIBUTE_LIMIT);
    } else {
        fElementAttributeLimit = 0;
    }
    fLimitAnalyzer = new XMLLimitAnalyzer();
    fEntityManager.setLimitAnalyzer(fLimitAnalyzer);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:XMLDocumentFragmentScannerImpl.java


示例2: checkLimit

import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager.Limit; //导入依赖的package包/类
/**
 * Add the count of the content buffer and check if the accumulated
 * value exceeds the limit
 * @param buffer content buffer
 */
protected void checkLimit(XMLStringBuffer buffer) {
    if (fLimitAnalyzer.isTracking(fCurrentEntityName)) {
        fLimitAnalyzer.addValue(Limit.GENERAL_ENTITY_SIZE_LIMIT, fCurrentEntityName, buffer.length);
        if (fSecurityManager.isOverLimit(Limit.GENERAL_ENTITY_SIZE_LIMIT, fLimitAnalyzer)) {
            fSecurityManager.debugPrint(fLimitAnalyzer);
            reportFatalError("MaxEntitySizeLimit", new Object[]{fCurrentEntityName,
                fLimitAnalyzer.getValue(Limit.GENERAL_ENTITY_SIZE_LIMIT),
                fSecurityManager.getLimit(Limit.GENERAL_ENTITY_SIZE_LIMIT),
                fSecurityManager.getStateLiteral(Limit.GENERAL_ENTITY_SIZE_LIMIT)});
        }
        if (fSecurityManager.isOverLimit(Limit.TOTAL_ENTITY_SIZE_LIMIT, fLimitAnalyzer)) {
            fSecurityManager.debugPrint(fLimitAnalyzer);
            reportFatalError("TotalEntitySizeLimit",
                new Object[]{fLimitAnalyzer.getTotalValue(Limit.TOTAL_ENTITY_SIZE_LIMIT),
                fSecurityManager.getLimit(Limit.TOTAL_ENTITY_SIZE_LIMIT),
                fSecurityManager.getStateLiteral(Limit.TOTAL_ENTITY_SIZE_LIMIT)});
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:XMLDocumentFragmentScannerImpl.java


示例3: checkLimit

import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager.Limit; //导入依赖的package包/类
/**
 * Checks whether the value of the specified Limit exceeds its limit
 *
 * @param limit The Limit to be checked
 * @param entity The current entity
 * @param offset The index of the first byte
 * @param length The length of the entity scanned
 */
protected void checkLimit(Limit limit, ScannedEntity entity, int offset, int length) {
    fLimitAnalyzer.addValue(limit, entity.name, length);
    if (fSecurityManager.isOverLimit(limit, fLimitAnalyzer)) {
        fSecurityManager.debugPrint(fLimitAnalyzer);
        Object[] e = (limit == Limit.ENTITY_REPLACEMENT_LIMIT) ?
                new Object[]{fLimitAnalyzer.getValue(limit),
                    fSecurityManager.getLimit(limit), fSecurityManager.getStateLiteral(limit)} :
                new Object[]{entity.name, fLimitAnalyzer.getValue(limit),
                    fSecurityManager.getLimit(limit), fSecurityManager.getStateLiteral(limit)};
        fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, limit.key(),
                e, XMLErrorReporter.SEVERITY_FATAL_ERROR);
    }
    if (fSecurityManager.isOverLimit(Limit.TOTAL_ENTITY_SIZE_LIMIT, fLimitAnalyzer)) {
        fSecurityManager.debugPrint(fLimitAnalyzer);
        fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, "TotalEntitySizeLimit",
                new Object[]{fLimitAnalyzer.getTotalValue(Limit.TOTAL_ENTITY_SIZE_LIMIT),
            fSecurityManager.getLimit(Limit.TOTAL_ENTITY_SIZE_LIMIT),
            fSecurityManager.getStateLiteral(Limit.TOTAL_ENTITY_SIZE_LIMIT)},
                XMLErrorReporter.SEVERITY_FATAL_ERROR);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:30,代码来源:XMLEntityScanner.java


示例4: resetCommon

import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager.Limit; //导入依赖的package包/类
void resetCommon() {
    // initialize vars
    fMarkupDepth = 0;
    fCurrentElement = null;
    fElementStack.clear();
    fHasExternalDTD = false;
    fStandaloneSet = false;
    fStandalone = false;
    fInScanContent = false;
    //skipping algorithm
    fShouldSkip = false;
    fAdd = false;
    fSkip = false;

    fEntityStore = fEntityManager.getEntityStore();
    dtdGrammarUtil = null;

    if (fSecurityManager != null) {
        fElementAttributeLimit = fSecurityManager.getLimit(XMLSecurityManager.Limit.ELEMENT_ATTRIBUTE_LIMIT);
        fXMLNameLimit = fSecurityManager.getLimit(XMLSecurityManager.Limit.MAX_NAME_LIMIT);
    } else {
        fElementAttributeLimit = 0;
        fXMLNameLimit = XMLSecurityManager.Limit.MAX_NAME_LIMIT.defaultValue();
    }
    fLimitAnalyzer = fEntityManager.fLimitAnalyzer;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:XMLDocumentFragmentScannerImpl.java


示例5: checkLimit

import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager.Limit; //导入依赖的package包/类
/**
 * Add the count of the content buffer and check if the accumulated
 * value exceeds the limit
 * @param buffer content buffer
 */
protected void checkLimit(XMLStringBuffer buffer) {
    if (fLimitAnalyzer.isTracking(fCurrentEntityName)) {
        fLimitAnalyzer.addValue(Limit.GENEAL_ENTITY_SIZE_LIMIT, fCurrentEntityName, buffer.length);
        if (fSecurityManager.isOverLimit(Limit.GENEAL_ENTITY_SIZE_LIMIT)) {
            fSecurityManager.debugPrint();
            reportFatalError("MaxEntitySizeLimit", new Object[]{fCurrentEntityName,
                fLimitAnalyzer.getValue(Limit.GENEAL_ENTITY_SIZE_LIMIT),
                fSecurityManager.getLimit(Limit.GENEAL_ENTITY_SIZE_LIMIT),
                fSecurityManager.getStateLiteral(Limit.GENEAL_ENTITY_SIZE_LIMIT)});
        }
        if (fSecurityManager.isOverLimit(Limit.TOTAL_ENTITY_SIZE_LIMIT)) {
            fSecurityManager.debugPrint();
            reportFatalError("TotalEntitySizeLimit",
                new Object[]{fLimitAnalyzer.getTotalValue(Limit.TOTAL_ENTITY_SIZE_LIMIT),
                fSecurityManager.getLimit(Limit.TOTAL_ENTITY_SIZE_LIMIT),
                fSecurityManager.getStateLiteral(Limit.TOTAL_ENTITY_SIZE_LIMIT)});
        }
    }
}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:25,代码来源:XMLDocumentFragmentScannerImpl.java


示例6: XMLLimitAnalyzer

import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager.Limit; //导入依赖的package包/类
/**
 * Default constructor. Establishes default values for known security
 * vulnerabilities.
 */
public XMLLimitAnalyzer() {
    values = new int[Limit.values().length];
    totalValue = new int[Limit.values().length];
    names = new String[Limit.values().length];
    caches = new Map[Limit.values().length];
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:XMLLimitAnalyzer.java


示例7: addValue

import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager.Limit; //导入依赖的package包/类
/**
 * Add the value to the current count by the index of the property
 * @param index the index of the property
 * @param entityName the name of the entity
 * @param value the value of the entity
 */
public void addValue(int index, String entityName, int value) {
    if (index == Limit.ENTITY_EXPANSION_LIMIT.ordinal() ||
            index == Limit.MAX_OCCUR_NODE_LIMIT.ordinal() ||
            index == Limit.ELEMENT_ATTRIBUTE_LIMIT.ordinal()) {
        totalValue[index] += value;
        return;
    }
    if (index == Limit.MAX_ELEMENT_DEPTH_LIMIT.ordinal()) {
        totalValue[index] = value;
        return;
    }

    Map<String, Integer> cache;
    if (caches[index] == null) {
        cache = new HashMap<String, Integer>(10);
        caches[index] = cache;
    } else {
        cache = caches[index];
    }

    int accumulatedValue = value;
    if (cache.containsKey(entityName)) {
        accumulatedValue += cache.get(entityName).intValue();
        cache.put(entityName, Integer.valueOf(accumulatedValue));
    } else {
        cache.put(entityName, Integer.valueOf(value));
    }

    if (accumulatedValue > values[index]) {
        values[index] = accumulatedValue;
        names[index] = entityName;
    }


    if (index == Limit.GENERAL_ENTITY_SIZE_LIMIT.ordinal() ||
            index == Limit.PARAMETER_ENTITY_SIZE_LIMIT.ordinal()) {
        totalValue[Limit.TOTAL_ENTITY_SIZE_LIMIT.ordinal()] += value;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:46,代码来源:XMLLimitAnalyzer.java


示例8: endEntity

import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager.Limit; //导入依赖的package包/类
/**
 * Stop tracking the entity
 * @param limit the limit property
 * @param name the name of an entity
 */
public void endEntity(Limit limit, String name) {
    entityStart = "";
    Map<String, Integer> cache = caches[limit.ordinal()];
    if (cache != null) {
        cache.remove(name);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:XMLLimitAnalyzer.java


示例9: checkDepth

import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager.Limit; //导入依赖的package包/类
/**
 * Check if the depth exceeds the maxElementDepth limit
 * @param elementName name of the current element
 */
void checkDepth(String elementName) {
    fLimitAnalyzer.addValue(Limit.MAX_ELEMENT_DEPTH_LIMIT, elementName, fElementStack.fDepth);
    if (fSecurityManager.isOverLimit(Limit.MAX_ELEMENT_DEPTH_LIMIT,fLimitAnalyzer)) {
        fSecurityManager.debugPrint(fLimitAnalyzer);
        reportFatalError("MaxElementDepthLimit", new Object[]{elementName,
            fLimitAnalyzer.getTotalValue(Limit.MAX_ELEMENT_DEPTH_LIMIT),
            fSecurityManager.getLimit(Limit.MAX_ELEMENT_DEPTH_LIMIT),
            "maxElementDepth"});
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:XMLDocumentFragmentScannerImpl.java


示例10: reset

import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager.Limit; //导入依赖的package包/类
/**
 * Resets the current value of the specified limit.
 * @param limit The limit to be reset.
 */
public void reset(Limit limit) {
    if (limit.ordinal() == Limit.TOTAL_ENTITY_SIZE_LIMIT.ordinal()) {
        totalValue[limit.ordinal()] = 0;
    } else if (limit.ordinal() == Limit.GENERAL_ENTITY_SIZE_LIMIT.ordinal()) {
        names[limit.ordinal()] = null;
        values[limit.ordinal()] = 0;
        caches[limit.ordinal()] = null;
        totalValue[limit.ordinal()] = 0;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:XMLLimitAnalyzer.java


示例11: checkBeforeLoad

import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager.Limit; //导入依赖的package包/类
/**
 * Checks whether the end of the entity buffer has been reached. If yes,
 * checks against the limit and buffer size before loading more characters.
 *
 * @param entity the current entity
 * @param offset the offset from which the current read was started
 * @param nameOffset the offset from which the current name starts
 * @return the length of characters scanned before the end of the buffer,
 * zero if there is more to be read in the buffer
 */
protected int checkBeforeLoad(Entity.ScannedEntity entity, int offset,
        int nameOffset) throws IOException {
    int length = 0;
    if (++entity.position == entity.count) {
        length = entity.position - offset;
        int nameLength = length;
        if (nameOffset != -1) {
            nameOffset = nameOffset - offset;
            nameLength = length - nameOffset;
        } else {
            nameOffset = offset;
        }
        //check limit before loading more data
        checkLimit(Limit.MAX_NAME_LIMIT, entity, nameOffset, nameLength);
        invokeListeners(length);
        if (length == entity.ch.length) {
            // bad luck we have to resize our buffer
            char[] tmp = new char[entity.fBufferSize * 2];
            System.arraycopy(entity.ch, offset, tmp, 0, length);
            entity.ch = tmp;
            entity.fBufferSize *= 2;
        }
        else {
            System.arraycopy(entity.ch, offset, entity.ch, 0, length);
        }
    }
    return length;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:39,代码来源:XMLEntityScanner.java


示例12: checkEntityLimit

import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager.Limit; //导入依赖的package包/类
/**
 * If the current entity is an Entity reference, check the accumulated size
 * against the limit.
 *
 * @param nt type of name (element, attribute or entity)
 * @param entity The current entity
 * @param offset The index of the first byte
 * @param length The length of the entity scanned
 */
protected void checkEntityLimit(NameType nt, ScannedEntity entity, int offset, int length) {
    if (entity == null || !entity.isGE) {
        return;
    }

    if (nt != NameType.REFERENCE) {
        checkLimit(Limit.GENERAL_ENTITY_SIZE_LIMIT, entity, offset, length);
    }
    if (nt == NameType.ELEMENTSTART || nt == NameType.ATTRIBUTENAME) {
        checkNodeCount(entity);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:XMLEntityScanner.java


示例13: debugPrint

import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager.Limit; //导入依赖的package包/类
public void debugPrint(XMLSecurityManager securityManager) {
    Formatter formatter = new Formatter();
    System.out.println(formatter.format("%30s %15s %15s %15s %30s",
            "Property","Limit","Total size","Size","Entity Name"));

    for (Limit limit : Limit.values()) {
        formatter = new Formatter();
        System.out.println(formatter.format("%30s %15d %15d %15d %30s",
                limit.name(),
                securityManager.getLimit(limit),
                totalValue[limit.ordinal()],
                values[limit.ordinal()],
                names[limit.ordinal()]));
    }
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:16,代码来源:XMLLimitAnalyzer.java


示例14: checkLimit

import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager.Limit; //导入依赖的package包/类
/**
 * Checks whether the value of the specified Limit exceeds its limit
 *
 * @param limit The Limit to be checked.
 * @param entity The current entity.
 * @param offset The index of the first byte
 * @param length The length of the entity scanned.
 */
protected void checkLimit(Limit limit, ScannedEntity entity, int offset, int length) {
    fLimitAnalyzer.addValue(limit, null, length);
    if (fSecurityManager.isOverLimit(limit, fLimitAnalyzer)) {
        fSecurityManager.debugPrint(fLimitAnalyzer);
        fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, limit.key(),
                new Object[]{new String(entity.ch, offset, length),
            fLimitAnalyzer.getTotalValue(limit),
            fSecurityManager.getLimit(limit),
            fSecurityManager.getStateLiteral(limit)},
                XMLErrorReporter.SEVERITY_FATAL_ERROR);
    }
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:21,代码来源:XMLEntityScanner.java



注:本文中的com.sun.org.apache.xerces.internal.utils.XMLSecurityManager.Limit类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DumpState类代码示例发布时间:2022-05-23
下一篇:
Java WSHTTPConnection类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap