{@inheritDoc}

@throws DcGeneralRuntimeException When an unusable object has been passed.
344796
public function delete($item)
    {
        $modelId = null;
        if (\is_numeric($item) || \is_string($item)) {
            $modelId = $item;
        } elseif (\is_object($item) && $item instanceof ModelInterface && null !== $item->getId()) {
            $modelId = $item->getId();
        } else {
            throw new DcGeneralRuntimeException("ID missing or given object not of type 'ModelInterface'.");
        }

        // Insert undo.
        $this->insertUndo(
            \sprintf(
                'DELETE FROM %1$s WHERE %1$s.id = %2$s',
                $this->source,
                $modelId
            ),
            \sprintf(
                'SELECT * FROM %1$s WHERE %1$s.id = %2$s',
                $this->source,
                $modelId
            ),
            $this->source
        );

        $this->connection->delete($this->source, [$this->source . '.id' => $modelId]);
    }
38278
function (aggregateLock) {
    if (!aggregateLock || !_.isObject(aggregateLock)) {
      var err = new Error('Please pass a valid aggregateLock!');
      debug(err);
      throw err;
    }
    this.aggregateLock = aggregateLock;
  }
185880
@FFDCIgnore(PrivilegedActionException.class)
    private Object getJNDIServiceObjectInstance(final String className, final String bindingName, final Hashtable<?, ?> envmt) throws Exception {
        try {
            return AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
                @Override
                public Object run() throws Exception {
                    return getJNDIServiceObjectInstancePrivileged(className, bindingName, envmt);
                }
            });
        } catch (PrivilegedActionException paex) {
            Throwable cause = paex.getCause();
            if (cause instanceof Exception) {
                throw (Exception) cause;
            }
            throw new Error(cause);
        }
    }
515409
public function setParent(ModelInterface $childModel, ModelInterface $parentModel)
    {
        $condition = $this->relationships->getChildCondition(
            $parentModel->getProviderName(),
            $childModel->getProviderName()
        );
        if (!$condition instanceof ParentChildConditionInterface) {
            throw new DcGeneralRuntimeException(
                'No condition defined from ' . $parentModel->getProviderName() . ' to ' . $childModel->getProviderName()
            );
        }

        $condition->applyTo($parentModel, $childModel);
    }
117261
@Override
    @FFDCIgnore(InjectionException.class)
    public T inject(ReferenceContext referenceContext) throws ManagedObjectException {
        InjectionTarget[] targets;
        try {
            targets = referenceContext.getInjectionTargets(object.getClass());
        } catch (InjectionException e) {
            throw new ManagedObjectException(e);
        }

        InjectionTargetContext injectionContext = new InjectionTargetContext() {
            @Override
            public <S> S getInjectionTargetContextData(Class<S> data) {
                return getContextData(data);
            }
        };

        T object = inject(targets, injectionContext);
        return object;
    }
912509
public void bind() throws Throwable
   {
      if (name == null)
         throw new IllegalArgumentException("Name is null");

      if (obj == null)
         throw new IllegalArgumentException("Obj is null");

      if (trace)
         log.trace("Binding " + obj.getClass().getName() + " under " + name);

      Properties properties = new Properties();
      properties.setProperty(Context.PROVIDER_URL, jndiProtocol + "://" + jndiHost + ":" + jndiPort);
      Context context = new InitialContext(properties);

      try
      {
         String className = obj.getClass().getName();
         Reference ref = new Reference(className,
                                       new StringRefAddr("class", className),
                                       JndiBinder.class.getName(),
                                       null);
         ref.add(new StringRefAddr("name", name));

         objs.put(name, obj);

         Util.bind(context, name, ref);

         if (log.isDebugEnabled())
            log.debug("Bound " + obj.getClass().getName() + " under " + name);
      }
      finally
      {
         if (context != null)
         {
            try
            {
               context.close();
            }
            catch (NamingException ne)
            {
               // Ignore
            }
         }
      }
   }
1306724
public function initialize()
    {
        if (null !== $this->collection) {
            return;
        }

        if (empty($this->dbOptions['database'])) {
            throw new \RuntimeException('The option "database" must be set');
        }
        if (empty($this->dbOptions['collection'])) {
            throw new \RuntimeException('The option "collection" must be set');
        }

        $this->collection = $this
            ->mongo
            ->selectDB($this->dbOptions['database'])
            ->selectCollection($this->dbOptions['collection']);
    }
1012020
public function setRunnable( $_runnable ) {
		if( self::runnableOk( $_runnable ) ) {
			$this->runnable = $_runnable;
		}
		else {
			throw new Exception( $this->getError( Thread::FUNCTION_NOT_CALLABLE ), Thread::FUNCTION_NOT_CALLABLE );
		}
	}
1005518
static void loadFromIterable(Context cx, Scriptable scope, ScriptableObject map, Object arg1)
    {
        if ((arg1 == null) || Undefined.instance.equals(arg1)) {
            return;
        }

        // Call the "[Symbol.iterator]" property as a function.
        final Object ito = ScriptRuntime.callIterator(arg1, cx, scope);
        if (Undefined.instance.equals(ito)) {
            // Per spec, ignore if the iterator is undefined
            return;
        }

        // Find the "add" function of our own prototype, since it might have
        // been replaced. Since we're not fully constructed yet, create a dummy instance
        // so that we can get our own prototype.
        ScriptableObject dummy = ensureScriptableObject(cx.newObject(scope, map.getClassName()));
        final Callable set =
                ScriptRuntime.getPropFunctionAndThis(dummy.getPrototype(), "set", cx, scope);
        ScriptRuntime.lastStoredScriptable(cx);

        // Finally, run through all the iterated values and add them!
        try (IteratorLikeIterable it = new IteratorLikeIterable(cx, scope, ito)) {
            for (Object val : it) {
                Scriptable sVal = ScriptableObject.ensureScriptable(val);
                if (sVal instanceof Symbol) {
                    throw ScriptRuntime.typeError1("msg.arg.not.object", ScriptRuntime.typeof(sVal));
                }
                Object finalKey = sVal.get(0, sVal);
                if (finalKey == NOT_FOUND) {
                    finalKey = Undefined.instance;
                }
                Object finalVal = sVal.get(1, sVal);
                if (finalVal == NOT_FOUND) {
                    finalVal = Undefined.instance;
                }
                set.call(cx, scope, map, new Object[] { finalKey, finalVal });
            }
        }
    }
1151198
public function offsetUnset($offset)
    {
        if ($this->offsetExists($offset)) {
            $removed_item = $this->items[$offset];
            unset($this->items[$offset]);
            $this->propagateCollectionChangedEvent(
                new CollectionChangedEvent($removed_item, CollectionChangedEvent::ITEM_REMOVED)
            );
        } elseif ($this instanceof MandatoryKeyInterface) {
            throw new RuntimeException('Item to be unset not found at key: ' . $offset);
        }
    }
1249234
public function rollback()
    {
        try {
            $this->persistenceHandler->rollback();
        } catch (Exception $e) {
            throw new RuntimeException($e->getMessage(), 0, $e);
        }
    }
11679
protected void dispatch(Throwable object, boolean child) {
        if (object instanceof CompilationFailedException) {
            report((CompilationFailedException) object, child);
        } else if (object instanceof GroovyExceptionInterface) {
            report((GroovyExceptionInterface) object, child);
        } else if (object instanceof GroovyRuntimeException) {
            report((GroovyRuntimeException) object, child);
        } else if (object instanceof Exception) {
            report((Exception) object, child);
        } else {
            report(object, child);
        }

    }
135196
@Override
    public final void run() {
        try {
            this.runWithException();
        } catch (RuntimeException e) {
            throw e;
        } catch (Error e) {
            throw e;
        } catch (Throwable t) {
            throw new RuntimeException(t);
        }
    }
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"
                            );
    }
714254
protected function addPropertyCondition(PropertyConditionInterface $condition, $scope = self::VISIBLE)
    {
        if (!$this->property) {
            throw new DcGeneralRuntimeException('Property is missing, please create a property first');
        }

        $properties = \is_object($this->property) ? [$this->property] : $this->property;

        foreach ($properties as $property) {
            /** @var PropertyInterface $property */
            $event = new AddConditionEvent($condition, $property, $this);
            $this->dispatchEvent($event);
            $condition = $event->getCondition();

            $previousCondition = self::EDITABLE === $scope
                ? $property->getEditableCondition()
                : $property->getVisibleCondition();

            if (!$previousCondition) {
                if (self::EDITABLE === $scope) {
                    $property->setEditableCondition($condition);
                } else {
                    $property->setVisibleCondition($condition);
                }
            } elseif ($previousCondition instanceof PropertyConditionChain) {
                $previousCondition->addCondition($condition);
            } else {
                $chain = $this->propertyConditionChainClass->newInstance();
                $chain->addCondition($previousCondition);
                $chain->addCondition($condition);

                if (self::EDITABLE === $scope) {
                    $property->setEditableCondition($chain);
                } else {
                    $property->setVisibleCondition($chain);
                }
            }
        }
    }
1340583
public static RuntimeException propagate(Throwable throwable) {
    final Throwable t = Preconditions.checkNotNull(throwable, "throwable");
    if (t instanceof Error) {
      throw (Error) t;
    }
    if (t instanceof RuntimeException) {
      throw (RuntimeException) t;
    }

    throw new RuntimeException(t);
  }
612599
public static RuntimeException rethrow(RequestExecutionException e) throws UnavailableException, TimedOutException
    {
        if (e instanceof RequestTimeoutException)
            throw toThrift((RequestTimeoutException)e);
        else
            throw new UnavailableException();
    }