Validating A Data Target Object.
@param connections
@param dataTarget
@param cb
341098
function validateDataTarget(connections, dataTarget, cb) {
  var DataTarget = models.get(connections.mongooseConnection, models.MODELNAMES.DATA_TARGET);
  var testDataTarget = new DataTarget(dataTarget);
  //Validating Without Saving
  testDataTarget.validate(function(err) {
    if (err) {
      return cb(buildErrorResponse({
        error: err,
        userDetail: "Invalid Data Target Creation Data.",
        systemDetail: err.errors,
        code: ERROR_CODES.FH_FORMS_INVALID_PARAMETERS
      }));
    }

    return cb(undefined, dataTarget);
  });
}
451065
@Override
    public String validate(DTDValidatorBase v, char[] cbuf, int start, int end, boolean normalize)
        throws XMLStreamException
    {
        //int origStart = start;

        /* First things first; let's ensure value is not empty (all
         * white space)...
         */
        while (start < end && WstxInputData.isSpaceChar(cbuf[start])) {
            ++start;
        }
        // Empty value?
        if (start >= end) {
            return reportValidationProblem(v, "Empty NMTOKENS value");
        }

        /* Then, let's have separate handling for normalizing and
         * non-normalizing case, since latter is trivially easy case:
         */
        if (!normalize) {
            for (; start < end; ++start) {
                char c = cbuf[start];
                if (!WstxInputData.isSpaceChar(c) 
                    && !WstxInputData.isNameChar(c, mCfgNsAware, mCfgXml11)) {
                    return reportInvalidChar(v, c, "not valid as NMTOKENS character");
                }
            }
            return null; // ok, all good
        }

        //boolean trimmed = (origStart != start);
        //origStart = start;

        --end; // so that it now points to the last char
        // Wouldn't absolutely have to trim trailing... but is easy to do
        while (end > start && WstxInputData.isSpaceChar(cbuf[end])) {
            --end;
            //trimmed = true;
        }

        /* Ok, now, need to check we only have valid chars, and maybe
         * also coalesce multiple spaces, if any.
         */
        StringBuilder sb = null;

        while (start <= end) {
            int i = start;
            for (; i <= end; ++i) {
                char c = cbuf[i];
                if (WstxInputData.isSpaceChar(c)) {
                    break;
                }
                if (!WstxInputData.isNameChar(c, mCfgNsAware, mCfgXml11)) {
                    return reportInvalidChar(v, c, "not valid as an NMTOKENS character");
                }
            }

            if (sb == null) {
                sb = new StringBuilder(end - start + 1);
            } else {
                sb.append(' ');
            }
            sb.append(cbuf, start, (i - start));

            start = i + 1;
            // Ok, any white space to skip?
            while (start <= end && WstxInputData.isSpaceChar(cbuf[start])) {
                ++start;
            }
        }

        /* 27-Nov-2005, TSa: Could actually optimize trimming, and often
         *   avoid using StringBuilder... but let's only do it if it turns
         *   out dealing with NMTOKENS normalization shows up on profiling...
         */
        return sb.toString();
    }
186686
public void setData(final String path, byte data[], int version,
            StatCallback cb, Object ctx) {
        verbotenThreadCheck();
        final String clientPath = path;
        PathUtils.validatePath(clientPath);

        final String serverPath = prependChroot(clientPath);

        RequestHeader h = new RequestHeader();
        h.setType(ZooDefs.OpCode.setData);
        SetDataRequest request = new SetDataRequest();
        request.setPath(serverPath);
        request.setData(data);
        request.setVersion(version);
        SetDataResponse response = new SetDataResponse();
        cnxn.queuePacket(h, new ReplyHeader(), request, response, cb,
                clientPath, serverPath, ctx, null);
    }
902349
void doInvalidations(Connection nukerCon) throws SQLException {
        //create local variable - JIT performance improvement
        final boolean isTraceOn = com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
            LoggingUtil.SESSION_LOGGER_WAS.entering(methodClassName, methodNames[DO_INVALIDATIONS]);
        }
        String id = null;
        long lastAccessTime = 0;
        long createTime = 0;
        ResultSet rs = null;
        PreparedStatement delNukeStatement = null;
        PreparedStatement scanPropPs = null;
        PreparedStatement delNuke2 = null;
        PreparedStatement subDel = null;
        ResultSet rs2 = null;
        boolean delClose = false;
        boolean scanClose = false;
        boolean subClose = false;
        boolean del2Close = false;

        try {
            int oldIsolationLevel = 0;

            long now = System.currentTimeMillis();
            String appName = getIStore().getId();

            String selDelNoListener = this.selDelNoListener;

            if (usingDB2 || usingDerby) {
                selDelNoListener = selDelNoListener + " for read only";
                oldIsolationLevel = nukerCon.getTransactionIsolation();
                nukerCon.setTransactionIsolation(java.sql.Connection.TRANSACTION_READ_UNCOMMITTED);
            }

            delNukeStatement = nukerCon.prepareStatement(selDelNoListener);
            delNukeStatement.setString(1, appName);
            setPSLong(delNukeStatement, 2, now);

            if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[DO_INVALIDATIONS], "executing read/uncom scan");
            }

            rs = delNukeStatement.executeQuery();

            if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[DO_INVALIDATIONS], "after uncom query ");
            }

            //get all the candidates eligible for invalidation
            Hashtable primaryRows = new Hashtable();
            Hashtable creationTimes = new Hashtable();
            while (rs.next()) {
                id = rs.getString(1);
                lastAccessTime = rs.getLong(2);
                createTime = rs.getLong(3);
                primaryRows.put(id, new Long(lastAccessTime));
                creationTimes.put(id, new Long(createTime));
                if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                    LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[DO_INVALIDATIONS], "executing read/uncom scan, recording " + id);
                }
                if ((now + _smc.getInvalidationCheckInterval() * 1000) <= System.currentTimeMillis()) {
                    //If the scan is taking more than pollInterval,just break and
                    //invalidate the sessions so far determined
                    break;
                }
            }

            rs.close();
            delNukeStatement.close();
            delClose = true;

            /*
             * PK71265: Remove the section retrieving attribute rows as session manager
             * will remove the attribute rows in a single query.
             *
             *
             * if (isTraceOn&&LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
             * LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[DO_INVALIDATIONS], "before read of ucom scan results ");
             * }
             *
             * Enumeration enum1 = primaryRows.keys();
             *
             *
             * Hashtable multiRowProps = new Hashtable();
             * while (_smc.isUsingMultirow() && enum1.hasMoreElements()) {
             * scanPropPs = null;
             * scanPropPs = nukerCon.prepareStatement(findAllKeys);
             * id = (String) enum1.nextElement();
             * scanPropPs.setString(1, id);
             * scanPropPs.setString(2, appName);
             * rs2 = scanPropPs.executeQuery();
             * Vector propVec = new Vector();
             * while (rs2.next()) {
             * String propid = rs2.getString(propCol);
             * propVec.addElement(propid);
             * if (isTraceOn&&LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
             * LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[DO_INVALIDATIONS], "executing read/uncom scan," + "recording for " + id + " prop " +
             * propid);
             * LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[DO_INVALIDATIONS], "propVec currently " + propVec.toString());
             * }
             * }
             * multiRowProps.put(id, propVec);
             * if (isTraceOn&&LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
             * LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[DO_INVALIDATIONS], "ht currently " + multiRowProps.toString());
             * }
             * rs2.close();
             * scanPropPs.close();
             * scanClose = true;
             * }
             *
             * if (isTraceOn&&LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
             * LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[DO_INVALIDATIONS], "after read of ucom scan results, befor commit ");
             * }
             */

            if (usingDB2) {
                nukerCon.setTransactionIsolation(oldIsolationLevel);
            }

            if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[DO_INVALIDATIONS], "delete primary row vector " + primaryRows);
                if (primaryRows != null) {
                    LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[DO_INVALIDATIONS], "with size reported " + primaryRows.size());
                }
            }
            //loop through each eligible candidate
            Enumeration enum1 = primaryRows.keys();
            int deleteCount = 0;
            BackedSession pmiStatSession = null; // fake session for pmi stats
            SessionStatistics pmiStats = null;
            while (enum1.hasMoreElements()) {
                id = (String) enum1.nextElement();
                if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                    LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[DO_INVALIDATIONS], "current index into delete primary row vector " + id);
                }

                now = System.currentTimeMillis();
                long lastAccess = ((Long) primaryRows.get(id)).longValue();
                delNuke2 = nukerCon.prepareStatement(delPrimaryRowInval);
                delNuke2.setString(1, id);
                delNuke2.setString(2, appName);
                setPSLong(delNuke2, 3, lastAccess);

                if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                    LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[DO_INVALIDATIONS], "delete for " + id);
                }

                int rc = delNuke2.executeUpdate();
                if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                    LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[DO_INVALIDATIONS], "after del of  " + id);
                }

                delNuke2.close();
                del2Close = true;

                if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                    LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[DO_INVALIDATIONS], "num of rows deleted " + rc);
                }

                if (rc > 0) {
                    //delete sub rows
                    if (_smc.isUsingMultirow()) {

                        /*
                         * PK71265 : Rather than removing the associated rows which persists the attributes individually.
                         * We will remove all associated rows in one query for an invalid non-listeners sessions, which
                         * is the same way we handle assoicated rows for invalid listeners sessions
                         *
                         * Vector vec2 = (Vector) multiRowProps.get(id);
                         * if (isTraceOn&&LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                         * LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[DO_INVALIDATIONS], "delete vector for sub rows " + vec2);
                         * if (vec2 != null) {
                         * LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[DO_INVALIDATIONS], "delete vector for sub rows " + " with reported size " +
                         * vec2.size());
                         * }
                         * }
                         * if (vec2 != null) {
                         * for (int i2 = 0; i2 < vec2.size(); i2++) {
                         * if (isTraceOn&&LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                         * LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[DO_INVALIDATIONS], "current index in delete sub rows is " + i2);
                         * }
                         * String propid = (String) vec2.elementAt(i2);
                         * subDel = nukerCon.prepareStatement(delProp);
                         * subDel.setString(1, id);
                         * subDel.setString(2, propid);
                         * subDel.setString(3, appName);
                         * if (isTraceOn&&LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                         * LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[DO_INVALIDATIONS], "before deleting subrow " + propid + " for session " +
                         * id);
                         * }
                         *
                         * subDel.executeUpdate();
                         * subDel.close();
                         * subClose = true;
                         * }
                         * }
                         * }
                         *
                         * }
                         */
                        //PK71265 starts
                        subDel = nukerCon.prepareStatement(delPropall);
                        subDel.setString(1, id);
                        subDel.setString(2, appName);

                        int rc1 = subDel.executeUpdate();
                        subDel.close();
                        subClose = true;

                        if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                            LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[DO_INVALIDATIONS], "DatabaseHashMap:doInvalidations - for session: " + id +
                                                                                                                            " appName: " + appName + "number of rows deleted: "
                                                                                                                            + rc1);
                        }
                        //PK71265 ends

                    } //if (_smc.isUsingMultirow())
                }// if (rc>0)

                /*
                 * We already did cleanUpCache during the invalidation processing. Therefore, the session is no longer
                 * in our cache, and superRemove should return null. We need to create a temporary Session with an
                 * accurate Id and creationTime to send to the PMI counters.
                 */
                superRemove(id);
                createTime = ((Long) creationTimes.get(id)).longValue();
                //we don't want to retrieve session, so use a fake one for pmi
                if (pmiStatSession == null)
                    pmiStatSession = new DatabaseSession();
                if (pmiStats == null)
                    pmiStats = _iStore.getSessionStatistics();
                pmiStatSession.setId(id);
                pmiStatSession.setCreationTime(createTime);
                if (pmiStats != null) {
                    pmiStats.sessionDestroyed(pmiStatSession);
                    pmiStats.sessionDestroyedByTimeout(pmiStatSession);
                }
                deleteCount++;

            }
        } catch (SQLException se) {
            //            if (isStaleConnectionException(se)) {
            //                com.ibm.ws.ffdc.FFDCFilter.processException(se, "com.ibm.ws.session.store.db.DatabaseHashMap.doInvalidations", "867", this);
            //                if (isTraceOn&&LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
            //                    LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[DO_INVALIDATIONS], "StaleConnectionException");
            //                }
            //                throw se;
            //            } else {
            com.ibm.ws.ffdc.FFDCFilter.processException(se, "com.ibm.ws.session.store.db.DatabaseHashMap.doInvalidations", "872", this);
            LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[DO_INVALIDATIONS], "DatabaseHashMap.doInvalidationsError");
            LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[DO_INVALIDATIONS], "CommonMessage.sessionid", id);
            LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[DO_INVALIDATIONS], "CommonMessage.exception", se);
            throw se;
            //            }
        } catch (Exception e) {
            com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ws.session.store.db.DatabaseHashMap.doInvalidations", "877", this);
            LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[DO_INVALIDATIONS], "DatabaseHashMap.doInvalidationsError");
            LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[DO_INVALIDATIONS], "CommonMessage.exception", e);
        } finally {
            if (!delClose && delNukeStatement != null) {
                closeResultSet(rs);
                closeStatement(delNukeStatement);
            }
            if (!scanClose && scanPropPs != null) {
                closeResultSet(rs2);
                closeStatement(scanPropPs);
            }
            if (!del2Close && delNuke2 != null) {
                closeStatement(delNuke2);
            }
            if (!subClose && subDel != null) {
                closeStatement(subDel);
            }
        }
    }
1355712
protected void validateTargetType(Object entity) throws ODataProcessorException, ODataTargetTypeException {
        if (!getEntityDataModel().getType(
                entity.getClass()).getFullyQualifiedName().equals(getTargetType().typeName())) {
            throw new ODataProcessorException(PROCESSOR_ERROR,
                    "Entity to persist does not match specified Resource name");
        }
    }
683730
@Autowired(required = false)
    public void setDataExporters(Collection<IDataExporter<? extends Object>> dataExporters) {
        this.dataExporters = dataExporters;
    }
280814
@Override
    public void validate() {
        String target = getTargetName();
        //validate the parameters
        if (value() < 0) {
            throw new FaultToleranceDefinitionException(Tr.formatMessage(tc, "timeout.parameter.invalid.value.CWMFT5011E", value(), target));
        }

    }
1350273
function validateDataSource(connections, dataSource, cb) {
  var dataSourceToValidate = _.clone(dataSource);
  var DataSource = models.get(connections.mongooseConnection, models.MODELNAMES.DATA_SOURCE);

  //Expect The Data Source To Have Data
  var failure = validate(dataSourceToValidate).has(CONSTANTS.DATA_SOURCE_DATA);

  if (failure) {
    return cb(buildErrorResponse({
      error: new Error("No Data Passed To Validate"),
      code: ERROR_CODES.FH_FORMS_INVALID_PARAMETERS
    }));
  }

  //Generate A Hash
  var hash = misc.generateHash(dataSourceToValidate.data);

  //Populate A Cache Object
  //LastRefreshed is populated just for the cache mongoose schema
  var cache = {
    dataHash: hash,
    currentStatus: {
      status: "ok"
    },
    data: dataSourceToValidate.data,
    lastRefreshed: new Date().getTime(),
    updateTimestamp: new Date().getTime()
  };

  dataSourceToValidate.cache = [cache];

  //Create A New Mongoose. Note that this document is never saved. It is useful for consistent validation
  var testDataSource = new DataSource(dataSourceToValidate);
  //Validating Without Saving
  testDataSource.validate(function(err) {
    var valid = err ? false : true;
    var dataSourceJSON = testDataSource.toJSON();

    dataSourceJSON = processDataSourceResponse(dataSourceJSON);

    dataSourceJSON = _.omit(dataSourceJSON, "lastRefreshed", "currentStatus", "updateTimestamp", CONSTANTS.DATA_SOURCE_ID);

    dataSourceJSON.validationResult = {
      valid: valid,
      message: valid ? "Data Source Is Valid" : "Invalid Data Source Update Data."
    };

    return cb(undefined, dataSourceJSON);
  });
}
367896
public FluentValidator doValidate(ValidateCallback cb) {
        Preconditions.checkNotNull(cb, "ValidateCallback should not be NULL");
        if (validatorElementList.isEmpty()) {
            LOGGER.debug("Nothing to validate");
            return this;
        }
        context.setResult(result);

        LOGGER.debug("Start to validate through " + validatorElementList);
        long start = System.currentTimeMillis();
        try {
            GroupingHolder.setGrouping(groups);
            for (ValidatorElement element : validatorElementList.getAllValidatorElements()) {
                Object target = element.getTarget();
                Validator v = element.getValidator();
                try {
                    if (v.accept(context, target)) {
                        if (!v.validate(context, target)) {
                            result.setIsSuccess(false);
                            if (isFailFast) {
                                break;
                            }
                        }
                    }
                } catch (Exception e) {
                    try {
                        v.onException(e, context, target);
                        cb.onUncaughtException(v, e, target);
                    } catch (Exception e1) {
                        if (LOGGER.isDebugEnabled()) {
                            LOGGER.error(v + " onException or onUncaughtException throws exception due to " + e1
                                    .getMessage(), e1);
                        }
                        throw new RuntimeValidateException(e1);
                    }
                    if (LOGGER.isDebugEnabled()) {
                        LOGGER.error(v + " failed due to " + e.getMessage(), e);
                    }
                    throw new RuntimeValidateException(e);
                }
            }

            if (result.isSuccess()) {
                cb.onSuccess(validatorElementList);
            } else {
                cb.onFail(validatorElementList, result.getErrors());
            }
        } finally {
            GroupingHolder.clean();
            int timeElapsed = (int) (System.currentTimeMillis() - start);
            LOGGER.debug("End to validate through" + validatorElementList + " costing " + timeElapsed + "ms with "
                    + "isSuccess=" + result.isSuccess());
            result.setTimeElapsed(timeElapsed);
        }
        return this;
    }
839325
@Override
    public void validate(final Object targetObj, final SheetBindingErrors<?> errors, final Class<?>... groups) {
        
        ArgUtils.notNull(targetObj, "targetObj");
        ArgUtils.notNull(errors, "errors");
        
        processConstraintViolation(getTargetValidator().validate(targetObj, groups), errors);
        
    }
893627
private void validate() {

        if (host.isEmpty()) {
            throw new IllegalArgumentException("host cannot be null");
        }
        if (catalog == null) {
            throw new IllegalArgumentException("database cannot be null");
        }
        if (table == null) {
            throw new IllegalArgumentException("collection cannot be null");
        }

        concantHostPort();
    }
967103
private void validateParameterResolvers(MethodTarget methodTarget) {
		Utils.createMethodParameters(methodTarget.getMethod())
				.forEach(parameter -> {
					parameterResolvers.stream()
							.filter(resolver -> resolver.supports(parameter))
							.findFirst()
							.orElseThrow(() -> new ParameterResolverMissingException(parameter));
				});
	}
211023
protected void validateConnections(ManagedConnectionFactory managedConnectionFactory, boolean prepopulateEnabled) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(this, tc, "validateConnections", gConfigProps.cfName);
        }

        /*
         * Get all of the managed connections wrappers.
         */
        Set<ManagedConnection> mcSet = new HashSet<ManagedConnection>();
        LinkedList<MCWrapper> failedMCWList = new LinkedList<MCWrapper>();
        mcToMCWMapWrite.lock();
        try {
            Collection<MCWrapper> mcWrappers = mcToMCWMap.values();
            Iterator<MCWrapper> mcWrapperIt = mcWrappers.iterator();
            while (mcWrapperIt.hasNext()) {
                MCWrapper mcw = mcWrapperIt.next();
                if (mcw.getPoolState() == 1 && !mcw.isStale()) {
                    /*
                     * Only add valid managed connections to this set.
                     */
                    mcSet.add(mcw.getManagedConnection());
                    mcw.setPoolState(50); // set the state to 50, which basically means we are interacting with the resource adapter
                    try {
                        Set<?> set = ((ValidatingManagedConnectionFactory) managedConnectionFactory).getInvalidConnections(mcSet);
                        Iterator<?> it = set.iterator();

                        while (it.hasNext()) {
                            it.next();
                            failedMCWList.add(mcw);
                        }
                        mcSet.clear();
                    } catch (ResourceException e) {
                        Object[] parms = new Object[] { "fatalErrorNotification", CommonFunction.exceptionList(e), "ResourceException", gConfigProps.cfName };
                        Tr.error(tc, "ATTEMPT_TO_VALIDATE_MC_CONNECTIONS_J2CA0285", parms);
                    } finally {
                        // we do a check above to ensure we are in the free pool (1), therefore we shouldn't have to worry
                        // about capturing the current state and setting it back here - it is expected to be the free pool.
                        mcw.setPoolState(MCWrapper.ConnectionState_freePool);
                    }

                    if (prepopulateEnabled) {
                        // We prepopulate is enabled, we need to reset
                        // the idle time out to keep the good connections
                        // in the pool.  All of the bad connection will be
                        // destored before we leave this method.  The idle
                        // time will not matter for them.  :-)
                        ((com.ibm.ejs.j2c.MCWrapper) mcw).resetIdleTimeOut();
                    }
                }
            }
        } finally {
            mcToMCWMapWrite.unlock();
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(this, tc, "Calling getInvalidConnections on the managedConnectionFactory with " + mcSet.size()
                               + " managed connections");
        }
        /*
         * Ask the mcf to validate the managed connections and return the
         * failing managed connections
         */

        if (!failedMCWList.isEmpty()) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(this, tc, "Returned from getInvalidConnections. There are " + failedMCWList.size() + " failing connections.");
            }
            /*
             * Check for failing connections
             */
            /*
             * Transfer the failing connection to an iterator
             */
            Iterator<MCWrapper> it = failedMCWList.iterator();
            /*
             * Iterate through the failed managed connection marking the
             * associated mcw stale
             */
            while (it.hasNext()) {
                MCWrapper mcWrapper = it.next();
                if (mcWrapper != null) {
                    mcWrapper.markStale();
                    checkForConnectionInFreePool(mcWrapper);
                } else {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(this, tc, "null mc in set returned from getInvalidConnections");
                    }
                }
            }
        } else {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(this, tc, "Returned from getInvalidConnections. The returned set is null");
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(this, tc, "validateConnections");
        }
    }
1128844
function isFieldStillValidTarget(fieldOrPageIdToCheck, pages, cb) {
      var fieldExistsInForm = false;
      var invalidPages = _.filter(pages, function(page) {
        var currentPageId = page._id.toString();

        if (currentPageId === fieldOrPageIdToCheck) {
          fieldExistsInForm = true;
        }
        var invalidFieldList = _.filter(page.fields, function(field) {
          var currentFieldId = field._id.toString();
          if (currentFieldId === fieldOrPageIdToCheck) {
            //Current field exists
            fieldExistsInForm = true;

            //Field is admin only, therefore it is an invalid target for a rule.
            if (field.adminOnly) {
              return true;
            } else {
              return false;
            }
          } else {
            return false;
          }
        });

        //If the invalidFieldList is > 0, it means that one of the fields was invalid.
        return invalidFieldList.length > 0;
      });

      var invalidField = invalidPages.length > 0;

      //Invalid if either the field is invalid, or it does not exist in the form.
      if (invalidField === true || !fieldExistsInForm) {
        return cb(true);
      } else {
        return cb();
      }
    }
1304110
public void setConnections(java.util.Collection<ClientVpnConnection> connections) {
        if (connections == null) {
            this.connections = null;
            return;
        }

        this.connections = new com.amazonaws.internal.SdkInternalList<ClientVpnConnection>(connections);
    }
1223046
function create(connections, dataSource, callback) {
  async.waterfall([
    function validateParams(cb) {

      //If it is a deploy, the JSON can contain an _id param
      if (connections.deploy) {
        return cb(undefined, dataSource);
      }

      //Otherwise, check that it is not there.
      validate(dataSource).hasno(CONSTANTS.DATA_SOURCE_ID, function(err) {
        if (err) {
          return cb(buildErrorResponse({error: new Error("Data Source ID Should Not Be Included When Creating A Data Source"), code: ERROR_CODES.FH_FORMS_INVALID_PARAMETERS}));
        }

        cb(undefined, dataSource);
      });
    },
    function validateNameNotUsed(dataSource, cb) {
      //Duplicate Names Are Not Allowed.
      var DataSource = models.get(connections.mongooseConnection, models.MODELNAMES.DATA_SOURCE);

      DataSource.count({name: dataSource.name}, function(err, numDuplicateDSs) {
        if (numDuplicateDSs && numDuplicateDSs > 0) {
          return cb({
            userDetail: "Invalid Data To Create A Data Source" ,
            systemDetail: "A Data Source With The Name " + dataSource.name + " Already Exists",
            code: ERROR_CODES.FH_FORMS_INVALID_PARAMETERS
          });
        } else {
          return cb(err, dataSource);
        }
      });
    },
    function createDataSource(dataSourceJSON, cb) {
      dataSourceJSON = misc.sanitiseJSON(dataSourceJSON);

      var DataSource = models.get(connections.mongooseConnection, models.MODELNAMES.DATA_SOURCE);
      var newDataSource = new DataSource(dataSourceJSON);

      newDataSource.save(function(err) {
        if (err) {
          return cb(buildErrorResponse({
            error: err,
            userDetail: "Invalid Data Source Creation Data.",
            systemDetail: err.errors,
            code: ERROR_CODES.FH_FORMS_INVALID_PARAMETERS
          }));
        }

        newDataSource = processDataSourceResponse(newDataSource.toJSON());

        return cb(undefined, newDataSource);
      });

    }
  ], callback);
}
181255
@Override
    public Set<ManagedConnection> getInvalidConnections(@SuppressWarnings("rawtypes") Set connectionSet) throws ResourceException {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); 

        if (isTraceOn && tc.isEntryEnabled())
            Tr.entry(this, tc, "getInvalidConnections", connectionSet);

        Set<ManagedConnection> badSet = new HashSet<ManagedConnection>();
        WSRdbManagedConnectionImpl mc = null;

        // Loop through each ManagedConnection in the list, using each connection's
        // preTestSQLString to check validity. Different connections can
        // have different preTestSQLStrings if they were created by different
        // ManagedConnectionFactories.

        for (Iterator<?> it = connectionSet.iterator(); it.hasNext();) {
            mc = (WSRdbManagedConnectionImpl) it.next();
            if (!mc.validate())
                badSet.add(mc);
        }

        if (isTraceOn && tc.isEntryEnabled())
            Tr.exit(this, tc, "getInvalidConnections", badSet); 
        return badSet;
    }