Constraint that ensures that the proxy-prefetching-limit has a valid value.

@param def        The descriptor (class, reference, collection)
@param checkLevel The current check level (this constraint is checked in basic and strict)
973167
protected void checkProxyPrefetchingLimit(DefBase def, String checkLevel) throws ConstraintException
    {
        if (CHECKLEVEL_NONE.equals(checkLevel))
        {
            return;
        }
        if (def.hasProperty(PropertyHelper.OJB_PROPERTY_PROXY_PREFETCHING_LIMIT))
        {
            if (!def.hasProperty(PropertyHelper.OJB_PROPERTY_PROXY))
            {
                if (def instanceof ClassDescriptorDef)
                {
                    LogHelper.warn(true,
                                   ConstraintsBase.class,
                                   "checkProxyPrefetchingLimit",
                                   "The class "+def.getName()+" has a proxy-prefetching-limit property but no proxy property");
                }
                else
                {    
                    LogHelper.warn(true,
                                   ConstraintsBase.class,
                                   "checkProxyPrefetchingLimit",
                                   "The feature "+def.getName()+" in class "+def.getOwner().getName()+" has a proxy-prefetching-limit property but no proxy property");
                }
            }
    
            String propValue = def.getProperty(PropertyHelper.OJB_PROPERTY_PROXY_PREFETCHING_LIMIT);
    
            try
            {
                int value = Integer.parseInt(propValue);
    
                if (value < 0)
                {
                    if (def instanceof ClassDescriptorDef)
                    {
                        throw new ConstraintException("The proxy-prefetching-limit value of class "+def.getName()+" must be a non-negative number");
                    }
                    else
                    {    
                        throw new ConstraintException("The proxy-prefetching-limit value of the feature "+def.getName()+" in class "+def.getOwner().getName()+" must be a non-negative number");
                    }
                }
            }
            catch (NumberFormatException ex)
            {
                if (def instanceof ClassDescriptorDef)
                {
                    throw new ConstraintException("The proxy-prefetching-limit value of the class "+def.getName()+" is not a number");
                }
                else
                {    
                    throw new ConstraintException("The proxy-prefetching-limit value of the feature "+def.getName()+" in class "+def.getOwner().getName()+" is not a number");
                }
            }
        }
    }
429828
private void validateBlockSize(byte[] descriptor) throws IOException {
        int blockSize = Util.getUInt16Both(descriptor, 129);
        if (blockSize != Constants.DEFAULT_BLOCK_SIZE) {
            throw new LoopFileSystemException("Invalid block size: " + blockSize);
        }
    }
425755
@Override public CheckLevel level(JSError error) {
    return error.sourceName != null && error.sourceName.contains(part)
        ? super.level(error) /** suppress */
        : null /** proceed */;
  }
268746
public void defineFrom(InputProblemReporter rep, DTDElement definedElem,
                           boolean fullyValidate)
        throws XMLStreamException
    {
        if (fullyValidate) {
            verifyUndefined();
        }
        mValidator = definedElem.mValidator;
        mAllowedContent = definedElem.mAllowedContent;
        mergeMissingAttributesFrom(rep, definedElem, fullyValidate);
    }
266061
private void checkCollectionForeignkeys(ModelDef modelDef, String checkLevel) throws ConstraintException
    {
        if (CHECKLEVEL_NONE.equals(checkLevel))
        {
            return;
        }

        ClassDescriptorDef      classDef;
        CollectionDescriptorDef collDef;

        for (Iterator it = modelDef.getClasses(); it.hasNext();)
        {
            classDef = (ClassDescriptorDef)it.next();
            for (Iterator collIt = classDef.getCollections(); collIt.hasNext();)
            {
                collDef = (CollectionDescriptorDef)collIt.next();
                if (!collDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_IGNORE, false))
                {
                    if (collDef.hasProperty(PropertyHelper.OJB_PROPERTY_INDIRECTION_TABLE))
                    {
                        checkIndirectionTable(modelDef, collDef);
                    }
                    else
                    {    
                        checkCollectionForeignkeys(modelDef, collDef);
                    }
                }
            }
        }
    }
143428
private void checkInheritedForeignkey(CollectionDescriptorDef collDef, String checkLevel) throws ConstraintException
    {
        if (CHECKLEVEL_NONE.equals(checkLevel))
        {
            return;
        }
        if (!collDef.isInherited() && !collDef.isNested())
        {
            return;
        }
        if (!collDef.hasProperty(PropertyHelper.OJB_PROPERTY_INDIRECTION_TABLE))
        {
            return;
        }

        String localFk     = collDef.getProperty(PropertyHelper.OJB_PROPERTY_FOREIGNKEY);
        String inheritedFk = collDef.getOriginal().getProperty(PropertyHelper.OJB_PROPERTY_FOREIGNKEY);

        if (!CommaListIterator.sameLists(localFk, inheritedFk))
        {
            throw new ConstraintException("The foreignkey property has been changed for the m:n collection "+collDef.getName()+" in class "+collDef.getOwner().getName());
        }
    }
983655
@Override
    public void validateDefault(InputProblemReporter rep, boolean normalize)
        throws XMLStreamException
    {
        // First, basic checks that it's a valid non-empty name:
        String def = validateDefaultName(rep, normalize);

        // And then that it's one of listed values:
        String shared = mEnumValues.find(def);
        if (shared == null) {
            reportValidationProblem(rep, "Invalid default value '"+def+"': has to be one of ("
                                    +mEnumValues+")");
        }

        // Ok, cool it's ok...
        if (normalize) {
            mDefValue.setValue(shared);
        }
    }
834262
private void checkModifications(ClassDescriptorDef classDef, String checkLevel) throws ConstraintException
    {
        if (CHECKLEVEL_NONE.equals(checkLevel))
        {
            return;
        }

        HashMap              features = new HashMap();
        FeatureDescriptorDef def;

        for (Iterator it = classDef.getFields(); it.hasNext();)
        {
            def = (FeatureDescriptorDef)it.next();
            features.put(def.getName(), def);
        }
        for (Iterator it = classDef.getReferences(); it.hasNext();)
        {
            def = (FeatureDescriptorDef)it.next();
            features.put(def.getName(), def);
        }
        for (Iterator it = classDef.getCollections(); it.hasNext();)
        {
            def = (FeatureDescriptorDef)it.next();
            features.put(def.getName(), def);
        }

        // now checking the modifications
        Properties mods;
        String     modName;
        String     propName;

        for (Iterator it = classDef.getModificationNames(); it.hasNext();)
        {
            modName = (String)it.next();
            if (!features.containsKey(modName))
            {
                throw new ConstraintException("Class "+classDef.getName()+" contains a modification for an unknown feature "+modName);
            }
            def = (FeatureDescriptorDef)features.get(modName);
            if (def.getOriginal() == null)
            {
                throw new ConstraintException("Class "+classDef.getName()+" contains a modification for a feature "+modName+" that is not inherited but defined in the same class");
            }
            // checking modification
            mods = classDef.getModification(modName);
            for (Iterator propIt = mods.keySet().iterator(); propIt.hasNext();)
            {
                propName = (String)propIt.next();
                if (!PropertyHelper.isPropertyAllowed(def.getClass(), propName))
                {
                    throw new ConstraintException("The modification of attribute "+propName+" in class "+classDef.getName()+" is not applicable to the feature "+modName);
                }
            }
        }
    }
927943
@Override
    public boolean incrementAndCheckState(final Long increment) throws CircuitBreakingException {
        if (threshold == 0) {
            open();
        }

        final long used = this.used.addAndGet(increment);
        if (used > threshold) {
            open();
        }

        return checkState();
    }
442343
public static <T extends MethodDescription> ElementMatcher.Junction<T> isDefaultFinalizer() {
        return isFinalizer().and(isDeclaredBy(TypeDescription.OBJECT));
    }
1244873
private void checkReadonlyAccessForNativePKs(FieldDescriptorDef fieldDef, String checkLevel)
    {
        if (CHECKLEVEL_NONE.equals(checkLevel))
        {
            return;
        }

        String access  = fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_ACCESS);
        String autoInc = fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_AUTOINCREMENT);

        if ("database".equals(autoInc) && !"readonly".equals(access))
        {
            LogHelper.warn(true,
                           FieldDescriptorConstraints.class,
                           "checkAccess",
                           "The field "+fieldDef.getName()+" in class "+fieldDef.getOwner().getName()+" is set to database auto-increment. Therefore the field's access is set to 'readonly'.");
            fieldDef.setProperty(PropertyHelper.OJB_PROPERTY_ACCESS, "readonly");
        }
    }
910128
private T retain0(T instance, final int increment, final int rawIncrement) {
        int oldRef = updater().getAndAdd(instance, rawIncrement);
        if (oldRef != 2 && oldRef != 4 && (oldRef & 1) != 0) {
            throw new IllegalReferenceCountException(0, increment);
        }
        // don't pass 0!
        if ((oldRef <= 0 && oldRef + rawIncrement >= 0)
                || (oldRef >= 0 && oldRef + rawIncrement < oldRef)) {
            // overflow case
            updater().getAndAdd(instance, -rawIncrement);
            throw new IllegalReferenceCountException(realRefCnt(oldRef), increment);
        }
        return instance;
    }
137368
public void checkConstraints(String checkLevel) throws ConstraintException
    {
        // check constraints now after all classes have been processed
        for (Iterator it = getClasses(); it.hasNext();)
        {
            ((ClassDescriptorDef)it.next()).checkConstraints(checkLevel);
        }
        // additional model constraints that either deal with bigger parts of the model or
        // can only be checked after the individual classes have been checked (e.g. specific
        // attributes have been ensured)
        new ModelConstraints().check(this, checkLevel);
    }
1216438
private int getLevel(final Level recordLevel) {
    if (recordLevel.equals(Level.OFF)) {
      return 0;
    } else if (recordLevel.equals(Level.SEVERE)) {
      return 1;
    } else if (recordLevel.equals(Level.WARNING)) {
      return 2;
    } else if (recordLevel.equals(Level.ALL)) {
      return 4;
    } else {
      return 3;
    }
  }
1036652
public void setLocalityLevel(LocalityLevel level) {
    localityRequired = level;
    lastLocality = level;
    localityWaitStarted = false;
    localityWaitStartTime = Long.MAX_VALUE;
  }
128468
function checksDo(listChecks, cb) {
    if (listChecks.length === 0) {
      return cb();
    }

    var check = listChecks.shift();
    check.func(check.key, function () {
      // schedule the next check
      setImmediate(checksDo, listChecks, cb);
    });
  }
866098
private void checkMarkupLevel(final int markupLevel) {
        if (markupLevel >= this.matchedMarkupLevels.length) {
            final int newLen = Math.max(markupLevel + 1, this.matchedMarkupLevels.length + MATCHED_MARKUP_LEVELS_LEN);
            final boolean[] newMatchedMarkupLevels = new boolean[newLen];
            Arrays.fill(newMatchedMarkupLevels, false);
            System.arraycopy(this.matchedMarkupLevels, 0, newMatchedMarkupLevels, 0, this.matchedMarkupLevels.length);
            this.matchedMarkupLevels = newMatchedMarkupLevels;
        }
    }