Processes arguments to determine invalid references.

@throws RuntimeException When an invalid reference is found
326012
private function processValue($value, $rootLevel = 0, $level = 0)
    {
        if ($value instanceof ServiceClosureArgument) {
            $value->setValues($this->processValue($value->getValues(), 1, 1));
        } elseif ($value instanceof ArgumentInterface) {
            $value->setValues($this->processValue($value->getValues(), $rootLevel, 1 + $level));
        } elseif ($value instanceof Definition) {
            if ($value->isSynthetic() || $value->isAbstract()) {
                return $value;
            }
            $value->setArguments($this->processValue($value->getArguments(), 0));
            $value->setProperties($this->processValue($value->getProperties(), 1));
            $value->setMethodCalls($this->processValue($value->getMethodCalls(), 2));
        } elseif (\is_array($value)) {
            $i = 0;

            foreach ($value as $k => $v) {
                if (!$rootLevel) {
                    $this->currentId = $k;
                }
                try {
                    if (false !== $i && $k !== $i++) {
                        $i = false;
                    }
                    if ($v !== $processedValue = $this->processValue($v, $rootLevel, 1 + $level)) {
                        $value[$k] = $processedValue;
                    }
                } catch (RuntimeException $e) {
                    if ($rootLevel < $level || ($rootLevel && !$level)) {
                        unset($value[$k]);
                    } elseif ($rootLevel) {
                        throw $e;
                    } else {
                        $value[$k] = null;
                    }
                }
            }

            // Ensure numerically indexed arguments have sequential numeric keys.
            if (false !== $i) {
                $value = array_values($value);
            }
        } elseif ($value instanceof Reference) {
            if ($this->container->has($id = (string) $value)) {
                return $value;
            }
            $invalidBehavior = $value->getInvalidBehavior();

            if (ContainerInterface::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE === $invalidBehavior && $value instanceof TypedReference && !$this->container->has($id)) {
                $e = new ServiceNotFoundException($id, $this->currentId);

                // since the error message varies by $id and $this->currentId, so should the id of the dummy errored definition
                $this->container->register($id = sprintf('.errored.%s.%s', $this->currentId, $id), $value->getType())
                    ->addError($e->getMessage());

                return new TypedReference($id, $value->getType(), $value->getInvalidBehavior());
            }

            // resolve invalid behavior
            if (ContainerInterface::NULL_ON_INVALID_REFERENCE === $invalidBehavior) {
                $value = null;
            } elseif (ContainerInterface::IGNORE_ON_INVALID_REFERENCE === $invalidBehavior) {
                if (0 < $level || $rootLevel) {
                    throw $this->signalingException;
                }
                $value = null;
            }
        }

        return $value;
    }
1249747
private void process() {
    Entity entity = entityClass.getAnnotation(Entity.class);
    ProjectedEntity projectedEntity = entityClass.getAnnotation(ProjectedEntity.class);
    if (entity != null) {
      initEntityMetadata(entity);
    } else if (projectedEntity != null) {
      initEntityMetadata(projectedEntity);
    } else {
      String message = String.format("Class %s must either have %s or %s annotation",
          entityClass.getName(), Entity.class.getName(), ProjectedEntity.class.getName());
      throw new EntityManagerException(message);
    }

    processPropertyOverrides();

    processFields();
    // If we did not find valid Identifier...
    if (entityMetadata.getIdentifierMetadata() == null) {
      throw new EntityManagerException(
          String.format("Class %s requires a field with annotation of %s", entityClass.getName(),
              Identifier.class.getName()));
    }
    entityMetadata.setEntityListenersMetadata(EntityListenersIntrospector.introspect(entityClass));
    entityMetadata.ensureUniqueProperties();
    entityMetadata.cleanup();
  }
1326529
protected function cleanup()
    {
        if ($this->running) {
            throw new RuntimeException(sprintf('Cleanup error - process still running: %s', is_scalar($this->command) ? $this->command : $this->command->serialize()));
        }

        if (!isset($this->resource)) {
            return;
        }

        $this->pid = -1;
        $this->read();

        foreach ($this->pipes as $index => $pipe) {
            if (!$this->interactive && $index === static::STDIN) {
                continue;
            }

            fclose($pipe);
        }

        proc_close($this->resource);
        unset($this->resource, $this->pipes);

        $this->running = false;

        if (in_array($this->exitcode, $this->getExpectedExitcodes())) {
            if (isset($this->onSuccess)) {
                call_user_func($this->onSuccess);
            }
        } else {
            if (isset($this->onError)) {
                call_user_func($this->onError, $this);
            } else {
                throw new ProcessException(sprintf('Error executing process: %s', is_scalar($this->command) ? $this->command : $this->command->serialize()), $this);
            }
        }
    }
1214807
private int extractValidIndex(ElementReference ref) {
        Reference<E> iRef = asIndexedRef(ref);
        int idx = iRef.index;
        if (idx < 0 || idx >= size) {
            throw new InvalidReferenceException(
                    "Index " + idx + " is not valid for collection with size " + size + ".");
        }
        return idx;
    }
765788
@GuardedBy("evictionLock")
  void drainValueReferences() {
    if (!collectValues()) {
      return;
    }
    Reference<? extends V> valueRef;
    while ((valueRef = valueReferenceQueue().poll()) != null) {
      @SuppressWarnings("unchecked")
      InternalReference<V> ref = (InternalReference<V>) valueRef;
      Node<K, V> node = data.get(ref.getKeyReference());
      if ((node != null) && (valueRef == node.getValueReference())) {
        evictEntry(node, RemovalCause.COLLECTED, 0L);
      }
    }
  }
1305402
protected function checkEndpoint()
    {
        if ($this->endpoint == '' || null === $this->endpoint || empty($this->endpoint)) {
            throw new \RunTimeException('No endpoint defined.');
        }
    }
422461
public function processResources()
    {
        // Fetching the sources iterator
        $errors = array();
        foreach($this->sourcesIterator as $source) {
            // Processing all resources associated to the current source object
            if ($source instanceof SourceInterface) {
                try {
                    $this->processResourcesBySource($source);
                } catch (Exception\PostParseException $e) {
                    array_push($errors, $e);
                } catch (Exception\ResourceProxyExceptionInterface $e) {
                    $msg = sprintf(
                        'General proxy error caught for the following source: \'%s\'. Error is: \'%s\'.',
                        $source->getName(),
                        $e->getMessage()
                    );
                    array_push($errors, $msg);
                } catch (\Exception $e) {
                    $msg = sprintf(
                        'General error caught for the following source: \'%s\'. Error is: \'%s\'.',
                        $source->getName(),
                        $e->getMessage()
                    );
                    array_push($errors, $msg);
                }
            }
        }

        // If errors, we throw a global process exception
        if (count($errors) > 0) {
            throw new Exception\GlobalProcessException(
                $errors,
                sprintf(
                    'Errors while processing the sources for the following proxy: \'%s\'.',
                    $this->getProxyName()
                )
            );
        }
    }
53774
public function process()
    {
        parent::process();

        try {
            $value = $this->getNumericValue($this->value);
        } catch (SwatIntegerOverflowException $e) {
            $value = null;
        }

        if ($value !== null) {
            if (
                $this->minimum_value !== null &&
                $value < $this->minimum_value
            ) {
                $message = $this->getValidationMessage('below-minimum');
                $minimum_value = str_replace(
                    '%',
                    '%%',
                    $this->getDisplayValue($this->minimum_value)
                );

                $message->primary_content = sprintf(
                    $message->primary_content,
                    $minimum_value
                );

                $this->addMessage($message);
            }
            if (
                $this->maximum_value !== null &&
                $value > $this->maximum_value
            ) {
                $message = $this->getValidationMessage('above-maximum');
                $maximum_value = str_replace(
                    '%',
                    '%%',
                    $this->getDisplayValue($this->maximum_value)
                );

                $message->primary_content = sprintf(
                    $message->primary_content,
                    $maximum_value
                );

                $this->addMessage($message);
            }
        }
    }
1371523
protected function exceptionIfFetchedAlready()
    {
        if ($this->fetched) {
            throw new RuntimeException(
                Message::get(Message::DB_RESULT_FETCHED),
                Message::DB_RESULT_FETCHED
            );
        }
    }
533740
void invalidate()
    {
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this, cclass
                        , "invalidate"
                            );

        // Prevent any attempt to load the object.
        objectStore = null;

        // If the ManagedObject is already in memory access it, otherwise there is nothing
        // we need to do to it.
        if (managedObjectReference != null) {
            ManagedObject managedObject = (ManagedObject) managedObjectReference.get();
            if (managedObject != null)
                managedObject.state = ManagedObject.stateError;
        } // if (managedObjectReference != null).

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this, cclass
                       , "invalidate"
                            );
    }
276294
protected function validateArgs()
    {
        $message = null;
        foreach ($this->getMandatoryArgs() as $arg) {
            if (!isset($this->args[$arg])) {
                $message = "Argument $arg was not present in supplied job args for job " . get_class($this);
                $this->errorLog($message);
                throw new \Exception($message);
            }
        }
        if ($this->configRequired) {
            $this->ensureConfig();
        }
    }
79601
@SuppressWarnings("unchecked")
   private void processQueue() {
      ValueRef<K, V> ref = (ValueRef<K, V>) queue.poll();
      while (ref != null) {
         // only remove if it is the *exact* same WeakValueRef
         if (ref == map.get(ref.getKey()))
            map.remove(ref.getKey());

         ref = (ValueRef<K, V>) queue.poll();
      }
   }
63198
public function readReference() {
            
            $refId = $this->stream->readInt();
            if (isset($this->refList[$refId])) {
                return $this->refList[$refId];
            } else {
                throw new Exception('Invalid reference offset: ' . $refId);
                return false;
            }

        }
711665
private function processingSourceFiles(): void
  {
    $this->logVerbose('Replace references to resource files with references to optimized/minimized resource files.');

    foreach ($this->sourceFilesInfo as $source_filename)
    {
      $this->logVerbose("Processing %s.", $source_filename);

      $content = file_get_contents($source_filename);
      if ($content===false) $this->logError("Unable to read file '%s'.", $source_filename);

      $new_content = $content;

      if (strncmp($content, '<?php', 5)===0)
      {
        // Source is a PHP file.
        $new_content = $this->processPhpSourceFile($source_filename, $new_content);
      }

      $new_content = strtr($new_content, $this->replacePairs);

      if ($content!=$new_content)
      {
        $time = null;

        // If required determine the latest modification time of the source file and its referenced resource files.
        if ($this->preserveModificationTime)
        {
          $time = $this->getMaxModificationTime($source_filename, $new_content);
        }

        // Write sources file with modified references to resource files.
        $status = file_put_contents($source_filename, $new_content);
        if ($status===false) $this->logError("Updating file '%s' failed.", $source_filename);
        $this->logInfo("Updated file '%s'.", $source_filename);

        // If required set the mtime to the latest modification time of the source file and its referenced resource
        // files.
        if ($this->preserveModificationTime)
        {
          $status = touch($source_filename, $time);
          if ($status===false) $this->logError("Unable to set mtime for file '%s'.", $source_filename);
        }
      }
    }
  }
903120
@Override
    protected void processAnnotations(Object instance)
            throws IllegalAccessException, InvocationTargetException, NamingException
    {

        if (context == null)
        {
            // No resource injection
            return;
        }

        checkAnnotation(instance.getClass(), instance);

        /* 
         * May be only check non private fields and methods
         * for @Resource (JSR 250), if used all superclasses MUST be examined
         * to discover all uses of this annotation.
         */

        Class superclass = instance.getClass().getSuperclass();
        while (superclass != null && (!superclass.equals(Object.class)))
        {
            checkAnnotation(superclass, instance);
            superclass = superclass.getSuperclass();
        } 
    }
833317
public function run(): void
    {
        if ('' === (string)$this->catName) {
            throw new \RuntimeException('You must call setCatName before running this action');
        }
        if ('' === (string)$this->name) {
            throw new \RuntimeException('You must call setName before running this action');
        }
        $this->fakerDataCreator->setCatName($this->catName)->setName($this->name)->createTargetFileObject()->write();
        $this->interfaceCreator->setCatName($this->catName)->setName($this->name)->createTargetFileObject()->write();
        $this->hasInterfaceCreator->setCatName($this->catName)->setName($this->name)->createTargetFileObject()->write();
        $this->embeddableCreator->setCatName($this->catName)->setName($this->name)->createTargetFileObject()->write();
        $this->hasCreator->setCatName($this->catName)->setName($this->name)->createTargetFileObject()->write();
    }
627624
void process() {
        fixImports();
        if (insertRegion != null) {
            data.ensureImport(BeanDefinition.class);
            if (properties.size() > 0) {
                data.ensureImport(PropertyDefinition.class);
            }
            removeOld();
            if (data.isRootClass() && data.isExtendsDirectBean()) {
                data.ensureImport(DirectBean.class);
            }
            generateMeta();
            generateSerializationVersionId();
            generatePropertyChangeSupportField();
            generateHashCodeField();
            generateFactory();
            generateImmutableBuilderMethod();
            generateArgBasedConstructor();
            generateBuilderBasedConstructor();
            generateMetaBean();
            generateGettersSetters();
            generateSeparator();
            generateImmutableToBuilder();
            generateClone();
            generateEquals();
            generateHashCode();
            generateToString();
            generateMetaClass();
            generateBuilderClass();
            resolveImports();
            resolveIndents();
        }
    }