Skip to content

Commit

Permalink
Move EntityNotFoundException
Browse files Browse the repository at this point in the history
We were holding off moving EntityNotFoundException since we had a binary
dependency from a legacy cypher version. However that is fixed now and we
are free to move.
  • Loading branch information
pontusmelke committed Feb 23, 2018
1 parent ea90e6c commit dbc1952
Show file tree
Hide file tree
Showing 52 changed files with 119 additions and 119 deletions.
Expand Up @@ -25,10 +25,10 @@
import org.neo4j.internal.kernel.api.PropertyCursor;
import org.neo4j.internal.kernel.api.Read;
import org.neo4j.internal.kernel.api.RelationshipScanCursor;
import org.neo4j.internal.kernel.api.exceptions.EntityNotFoundException;
import org.neo4j.internal.kernel.api.helpers.RelationshipSelectionCursor;
import org.neo4j.internal.kernel.api.helpers.RelationshipSelections;
import org.neo4j.kernel.api.StatementConstants;
import org.neo4j.kernel.api.exceptions.EntityNotFoundException;
import org.neo4j.storageengine.api.EntityType;
import org.neo4j.values.storable.Value;
import org.neo4j.values.storable.Values;
Expand Down
Expand Up @@ -23,9 +23,9 @@
import org.neo4j.internal.kernel.api.CursorFactory;
import org.neo4j.internal.kernel.api.NodeCursor;
import org.neo4j.internal.kernel.api.Read;
import org.neo4j.internal.kernel.api.exceptions.EntityNotFoundException;
import org.neo4j.internal.kernel.api.helpers.RelationshipSelectionCursor;
import org.neo4j.kernel.api.ReadOperations;
import org.neo4j.kernel.api.exceptions.EntityNotFoundException;

public abstract class CompiledExpandUtils
{
Expand Down
Expand Up @@ -41,13 +41,13 @@ import org.neo4j.graphdb.RelationshipType._
import org.neo4j.graphdb._
import org.neo4j.graphdb.security.URLAccessValidationError
import org.neo4j.graphdb.traversal.{Evaluators, TraversalDescription, Uniqueness}
import org.neo4j.internal.kernel.api
import org.neo4j.internal.kernel.api.{IndexQuery, InternalIndexState}
import org.neo4j.kernel.GraphDatabaseQueryService
import org.neo4j.kernel.api.exceptions.schema.{AlreadyConstrainedException, AlreadyIndexedException}
import org.neo4j.kernel.api.schema.SchemaDescriptorFactory
import org.neo4j.kernel.api.schema.constaints.ConstraintDescriptorFactory
import org.neo4j.kernel.api.schema.index.IndexDescriptorFactory
import org.neo4j.kernel.api.{exceptions, _}
import org.neo4j.kernel.impl.core.EmbeddedProxySPI
import org.neo4j.values.storable.Values

Expand Down Expand Up @@ -273,15 +273,15 @@ final class TransactionBoundQueryContext(tc: TransactionalContextWrapper)
try {
tc.statement.dataWriteOperations().nodeDelete(obj.getId)
} catch {
case _: exceptions.EntityNotFoundException => // node has been deleted by another transaction, oh well...
case _: api.exceptions.EntityNotFoundException => // node has been deleted by another transaction, oh well...
}
}

def detachDelete(obj: Node): Int = {
try {
tc.statement.dataWriteOperations().nodeDetachDelete(obj.getId)
} catch {
case _: exceptions.EntityNotFoundException => // the node has been deleted by another transaction, oh well...
case _: api.exceptions.EntityNotFoundException => // the node has been deleted by another transaction, oh well...
0
}
}
Expand All @@ -297,35 +297,35 @@ final class TransactionBoundQueryContext(tc: TransactionalContextWrapper)
override def next(): Int = try {
inner.next()
} catch {
case _: exceptions.EntityNotFoundException => null.asInstanceOf[Int]
case _: api.exceptions.EntityNotFoundException => null.asInstanceOf[Int]
}
}
} catch {
case _: exceptions.EntityNotFoundException => Iterator.empty
case _: api.exceptions.EntityNotFoundException => Iterator.empty
}

def getProperty(id: Long, propertyKeyId: Int): Any = try {
tc.statement.readOperations().nodeGetProperty(id, propertyKeyId).asObject()
} catch {
case _: exceptions.EntityNotFoundException => null.asInstanceOf[Int]
case _: api.exceptions.EntityNotFoundException => null.asInstanceOf[Int]
}

def hasProperty(id: Long, propertyKey: Int): Boolean = try {
tc.statement.readOperations().nodeHasProperty(id, propertyKey)
} catch {
case _: exceptions.EntityNotFoundException => false
case _: api.exceptions.EntityNotFoundException => false
}

def removeProperty(id: Long, propertyKeyId: Int): Unit = try {
tc.statement.dataWriteOperations().nodeRemoveProperty(id, propertyKeyId)
} catch {
case _: exceptions.EntityNotFoundException => //ignore
case _: api.exceptions.EntityNotFoundException => //ignore
}

def setProperty(id: Long, propertyKeyId: Int, value: Any): Unit = try {
tc.statement.dataWriteOperations().nodeSetProperty(id, propertyKeyId, Values.of(value))
} catch {
case _: exceptions.EntityNotFoundException => //ignore
case _: api.exceptions.EntityNotFoundException => //ignore
}

override def getById(id: Long): Node =
Expand All @@ -352,7 +352,7 @@ final class TransactionBoundQueryContext(tc: TransactionalContextWrapper)
try {
tc.statement.dataWriteOperations().relationshipDelete(obj.getId)
} catch {
case _: exceptions.EntityNotFoundException => // node has been deleted by another transaction, oh well...
case _: api.exceptions.EntityNotFoundException => // node has been deleted by another transaction, oh well...
}
}

Expand All @@ -367,43 +367,43 @@ final class TransactionBoundQueryContext(tc: TransactionalContextWrapper)
override def next(): Int = try {
inner.next()
} catch {
case _: exceptions.EntityNotFoundException => null.asInstanceOf[Int]
case _: api.exceptions.EntityNotFoundException => null.asInstanceOf[Int]
}
}
} catch {
case _: exceptions.EntityNotFoundException => Iterator.empty
case _: api.exceptions.EntityNotFoundException => Iterator.empty
}

override def getProperty(id: Long, propertyKeyId: Int): Any = try {
tc.statement.readOperations().relationshipGetProperty(id, propertyKeyId).asObject()
} catch {
case _: exceptions.EntityNotFoundException => null
case _: api.exceptions.EntityNotFoundException => null
}

override def hasProperty(id: Long, propertyKey: Int): Boolean = try {
tc.statement.readOperations().relationshipHasProperty(id, propertyKey)
} catch {
case _: exceptions.EntityNotFoundException => false
case _: api.exceptions.EntityNotFoundException => false
}

override def removeProperty(id: Long, propertyKeyId: Int): Unit = try {
tc.statement.dataWriteOperations().relationshipRemoveProperty(id, propertyKeyId)
} catch {
case _: exceptions.EntityNotFoundException => //ignore
case _: api.exceptions.EntityNotFoundException => //ignore
}

override def setProperty(id: Long, propertyKeyId: Int, value: Any): Unit = try {
tc.statement.dataWriteOperations().relationshipSetProperty(id, propertyKeyId, Values.of(value))
} catch {
case _: exceptions.EntityNotFoundException => //ignore
case _: api.exceptions.EntityNotFoundException => //ignore
}

override def getById(id: Long): Relationship =
try {
tc.statement.readOperations().relationshipCursorById(id)
proxySpi.newRelationshipProxy(id)
} catch {
case e: exceptions.EntityNotFoundException =>
case e: api.exceptions.EntityNotFoundException =>
throw new EntityNotFoundException(s"Relationship with id $id", e)
}

Expand Down Expand Up @@ -617,7 +617,7 @@ final class TransactionBoundQueryContext(tc: TransactionalContextWrapper)
try {
tc.statement.dataWriteOperations().nodeDetachDelete(node.getId)
} catch {
case _: exceptions.EntityNotFoundException => // the node has been deleted by another transaction, oh well...
case _: api.exceptions.EntityNotFoundException => // the node has been deleted by another transaction, oh well...
0
}
}
Expand Down
Expand Up @@ -44,16 +44,17 @@ import org.neo4j.graphdb.RelationshipType._
import org.neo4j.graphdb._
import org.neo4j.graphdb.security.URLAccessValidationError
import org.neo4j.graphdb.traversal.{Evaluators, TraversalDescription, Uniqueness}
import org.neo4j.internal.kernel.api
import org.neo4j.internal.kernel.api.{IndexQuery, InternalIndexState}
import org.neo4j.kernel.GraphDatabaseQueryService
import org.neo4j.kernel.api._
import org.neo4j.kernel.api.dbms.DbmsOperations
import org.neo4j.kernel.api.exceptions.ProcedureException
import org.neo4j.kernel.api.exceptions.schema.{AlreadyConstrainedException, AlreadyIndexedException}
import org.neo4j.kernel.api.proc.{QualifiedName => KernelQualifiedName}
import org.neo4j.kernel.api.schema.SchemaDescriptorFactory
import org.neo4j.kernel.api.schema.constaints.ConstraintDescriptorFactory
import org.neo4j.kernel.api.schema.index.IndexDescriptorFactory
import org.neo4j.kernel.api.{exceptions, _}
import org.neo4j.kernel.impl.core.EmbeddedProxySPI
import org.neo4j.kernel.impl.locking.ResourceTypes
import org.neo4j.kernel.impl.util.ValueUtils
Expand Down Expand Up @@ -110,7 +111,7 @@ final class TransactionBoundQueryContext(txContext: TransactionalContextWrapper)
override def getLabelsForNode(node: Long) = try {
JavaConversionSupport.asScala(txContext.statement.readOperations().nodeGetLabels(node))
} catch {
case e: exceptions.EntityNotFoundException =>
case e: api.exceptions.EntityNotFoundException =>
if (nodeOps.isDeletedInThisTx(node))
throw new EntityNotFoundException(s"Node with id $node has been deleted in this transaction", e)
else
Expand Down Expand Up @@ -297,20 +298,20 @@ final class TransactionBoundQueryContext(txContext: TransactionalContextWrapper)
try {
txContext.statement.dataWriteOperations().nodeDelete(obj.getId)
} catch {
case _: exceptions.EntityNotFoundException => // node has been deleted by another transaction, oh well...
case _: api.exceptions.EntityNotFoundException => // node has been deleted by another transaction, oh well...
}
}

override def propertyKeyIds(id: Long): Iterator[Int] = try {
JavaConversionSupport.asScalaENFXSafe(txContext.statement.readOperations().nodeGetPropertyKeys(id))
} catch {
case _: exceptions.EntityNotFoundException => Iterator.empty
case _: api.exceptions.EntityNotFoundException => Iterator.empty
}

override def getProperty(id: Long, propertyKeyId: Int): Any = try {
txContext.statement.readOperations().nodeGetProperty(id, propertyKeyId).asObject()
} catch {
case e: exceptions.EntityNotFoundException =>
case e: api.exceptions.EntityNotFoundException =>
if (isDeletedInThisTx(id))
throw new EntityNotFoundException(s"Node with id $id has been deleted in this transaction", e)
else
Expand All @@ -320,22 +321,22 @@ final class TransactionBoundQueryContext(txContext: TransactionalContextWrapper)
override def hasProperty(id: Long, propertyKey: Int): Boolean = try {
txContext.statement.readOperations().nodeHasProperty(id, propertyKey)
} catch {
case _: exceptions.EntityNotFoundException => false
case _: api.exceptions.EntityNotFoundException => false
}

override def removeProperty(id: Long, propertyKeyId: Int): Unit = {
try {
txContext.statement.dataWriteOperations().nodeRemoveProperty(id, propertyKeyId)
} catch {
case _: exceptions.EntityNotFoundException => //ignore
case _: api.exceptions.EntityNotFoundException => //ignore
}
}

override def setProperty(id: Long, propertyKeyId: Int, value: Any): Unit = {
try {
txContext.statement.dataWriteOperations().nodeSetProperty(id, propertyKeyId, Values.of(value) )
} catch {
case _: exceptions.EntityNotFoundException => //ignore
case _: api.exceptions.EntityNotFoundException => //ignore
}
}

Expand Down Expand Up @@ -372,20 +373,20 @@ final class TransactionBoundQueryContext(txContext: TransactionalContextWrapper)
try {
txContext.statement.dataWriteOperations().relationshipDelete(obj.getId)
} catch {
case _: exceptions.EntityNotFoundException => // node has been deleted by another transaction, oh well...
case _: api.exceptions.EntityNotFoundException => // node has been deleted by another transaction, oh well...
}
}

override def propertyKeyIds(id: Long): Iterator[Int] = try {
JavaConversionSupport.asScalaENFXSafe(txContext.statement.readOperations().relationshipGetPropertyKeys(id))
} catch {
case _: exceptions.EntityNotFoundException => Iterator.empty
case _: api.exceptions.EntityNotFoundException => Iterator.empty
}

override def getProperty(id: Long, propertyKeyId: Int): Any = try {
txContext.statement.readOperations().relationshipGetProperty(id, propertyKeyId).asObject()
} catch {
case e: exceptions.EntityNotFoundException =>
case e: api.exceptions.EntityNotFoundException =>
if (isDeletedInThisTx(id))
throw new EntityNotFoundException(s"Relationship with id $id has been deleted in this transaction", e)
else
Expand All @@ -395,22 +396,22 @@ final class TransactionBoundQueryContext(txContext: TransactionalContextWrapper)
override def hasProperty(id: Long, propertyKey: Int): Boolean = try {
txContext.statement.readOperations().relationshipHasProperty(id, propertyKey)
} catch {
case _: exceptions.EntityNotFoundException => false
case _: api.exceptions.EntityNotFoundException => false
}

override def removeProperty(id: Long, propertyKeyId: Int): Unit = {
try {
txContext.statement.dataWriteOperations().relationshipRemoveProperty(id, propertyKeyId)
} catch {
case _: exceptions.EntityNotFoundException => //ignore
case _: api.exceptions.EntityNotFoundException => //ignore
}
}

override def setProperty(id: Long, propertyKeyId: Int, value: Any): Unit = {
try {
txContext.statement.dataWriteOperations().relationshipSetProperty(id, propertyKeyId, Values.of(value) )
} catch {
case _: exceptions.EntityNotFoundException => //ignore
case _: api.exceptions.EntityNotFoundException => //ignore
}
}

Expand All @@ -419,7 +420,7 @@ final class TransactionBoundQueryContext(txContext: TransactionalContextWrapper)
txContext.statement.readOperations().relationshipCursorById(id)
entityAccessor.newRelationshipProxy(id)
} catch {
case e: exceptions.EntityNotFoundException =>
case e: api.exceptions.EntityNotFoundException =>
throw new EntityNotFoundException(s"Relationship with id $id", e)
}

Expand Down Expand Up @@ -706,7 +707,7 @@ final class TransactionBoundQueryContext(txContext: TransactionalContextWrapper)
try {
txContext.statement.dataWriteOperations().nodeDetachDelete(node.getId)
} catch {
case _: exceptions.EntityNotFoundException => 0 // node has been deleted by another transaction, oh well...
case _: api.exceptions.EntityNotFoundException => 0 // node has been deleted by another transaction, oh well...
}
}

Expand Down
Expand Up @@ -25,8 +25,8 @@
import org.neo4j.internal.kernel.api.CursorFactory;
import org.neo4j.internal.kernel.api.NodeCursor;
import org.neo4j.internal.kernel.api.Read;
import org.neo4j.internal.kernel.api.exceptions.EntityNotFoundException;
import org.neo4j.kernel.api.ReadOperations;
import org.neo4j.kernel.api.exceptions.EntityNotFoundException;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
Expand Down
Expand Up @@ -22,8 +22,8 @@ package org.neo4j.cypher.internal.codegen
import org.mockito.Mockito.when
import org.neo4j.cypher.internal.codegen.CompiledCursorUtils.{nodeGetProperty, nodeHasLabel, relationshipGetProperty}
import org.neo4j.cypher.internal.util.v3_4.test_helpers.CypherFunSuite
import org.neo4j.internal.kernel.api.exceptions.EntityNotFoundException
import org.neo4j.internal.kernel.api.{NodeCursor, PropertyCursor, Read, RelationshipScanCursor}
import org.neo4j.kernel.api.exceptions.EntityNotFoundException
import org.neo4j.kernel.impl.newapi.Labels
import org.neo4j.values.storable.Values.{NO_VALUE, stringValue}

Expand Down
Expand Up @@ -21,7 +21,7 @@ package org.neo4j.cypher.internal.runtime.interpreted

import org.neo4j.collection.primitive.{PrimitiveIntIterator, PrimitiveLongIterator}
import org.neo4j.cypher.internal.util.v3_4.EntityNotFoundException
import org.neo4j.kernel.api
import org.neo4j.internal.kernel.api.exceptions

object JavaConversionSupport {

Expand All @@ -45,7 +45,7 @@ object JavaConversionSupport {
try {
_next = Some(f(more()))
} catch {
case _: api.exceptions.EntityNotFoundException => // IGNORE
case _: exceptions.EntityNotFoundException => // IGNORE
case _: EntityNotFoundException => // IGNORE
}
}
Expand Down

0 comments on commit dbc1952

Please sign in to comment.