Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public static void validateField(final MutableDocument document, final Property
} else if (item instanceof EmbeddedDocument) {
if (!((EmbeddedDocument) item).getType().instanceOf(ofType))
throwValidationException(p,
"has been declared as LIST of '" + ofType + "' but an embedded document of type '" + embType + "' is used. Value: " + fieldValue);
"has been declared as LIST of '" + ofType + "' but an embedded document of type '" + embType + "' is used. Value: " + fieldValue); // TODO: potential null pointer dereference
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirm, this could lead to a NPE

} else if (item instanceof Identifiable) {
final RID rid = ((Identifiable) item).getIdentity();
final DocumentType embSchemaType = document.getDatabase().getSchema().getTypeByBucketId(rid.getBucketId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public ResultSet syncPull(final CommandContext context, final int nRecords) thro

if (bucketName != null)
bucketObj = db.getSchema().getBucketByName(bucketName);
else if (bucket.getBucketName() != null)
else if (bucket.getBucketName() != null) // TODO: potential null pointer dereference?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirm, this could lead to a NPE

bucketObj = db.getSchema().getBucketByName(bucket.getBucketName());
else
bucketObj = db.getSchema().getBucketById(bucket.getBucketNumber());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ private void handleClustersAsTarget(final SelectExecutionPlan plan, final List<B
}

final FetchFromClusterExecutionStep step = new FetchFromClusterExecutionStep(bucketId, context, profilingEnabled);
// TODO: THIS SEEMS A BUG
// TODO: THIS SEEMS A BUG (maybe because if null is passed equals always returns false?)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is the same in OrientDB: the support for the order by was never implemented in this class

if (Boolean.TRUE.equals(orderByRidAsc)) {
step.setOrder(FetchFromClusterExecutionStep.ORDER_ASC);
} else if (Boolean.FALSE.equals(orderByRidAsc)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public ResultSet executeDDL(final CommandContext context) {
final DocumentType typez = db.getSchema().getType(typeName.getStringValue());

if (typez == null)
throw new CommandExecutionException("Invalid type name or type not found: " + typez);
throw new CommandExecutionException("Invalid type name or type not found: " + typez); // TODO: typez is always null here!
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirm.


final Property property = typez.getProperty(propertyName.getStringValue());
if (property == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ else if (entry.getKey().toString().equalsIgnoreCase("maxAttempts"))
private static void buildIndex(final int maxAttempts, Database database, Index.BuildIndexCallback callback, Index idx,
final int batchSize) {
if (idx == null)
throw new CommandExecutionException("Index '" + idx.getName() + "' not found");
throw new CommandExecutionException("Index '" + idx.getName() + "' not found"); // TODO: Null pointer derefence?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirm


if (!idx.isAutomatic())
throw new CommandExecutionException(
Expand Down
5 changes: 2 additions & 3 deletions engine/src/main/java/com/arcadedb/schema/DocumentType.java
Original file line number Diff line number Diff line change
Expand Up @@ -623,9 +623,8 @@ public Collection<TypeIndex> getAllIndexes(final boolean polymorphic) {

final List<TypeIndex> list = new ArrayList<>(indexesByProperties.values());

if (polymorphic)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct

for (final DocumentType t : superTypes)
list.addAll(t.getAllIndexes(true));
for (final DocumentType t : superTypes)
list.addAll(t.getAllIndexes(true));

return Collections.unmodifiableCollection(list);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void testPositiveInteger() {
public void testNegativeInteger() {
function.execute(null, null, null, new Object[]{-4}, null);
final Object result = function.getResult();
assertEquals(result, null);
assertNull(result);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct

}

@Test
Expand All @@ -80,7 +80,7 @@ public void testPositiveLong() {
public void testNegativeLong() {
function.execute(null, null, null, new Object[]{-4L}, null);
final Object result = function.getResult();
assertEquals(result, null);
assertNull(result);
}

@Test
Expand All @@ -95,7 +95,7 @@ public void testPositiveShort() {
public void testNegativeShort() {
function.execute(null, null, null, new Object[]{(short) -4}, null);
final Object result = function.getResult();
assertEquals(result, null);
assertNull(result);
}

@Test
Expand All @@ -110,7 +110,7 @@ public void testPositiveDouble() {
public void testNegativeDouble() {
function.execute(null, null, null, new Object[]{-4.0D}, null);
final Object result = function.getResult();
assertEquals(result, null);
assertNull(result);
}

@Test
Expand All @@ -125,7 +125,7 @@ public void testPositiveFloat() {
public void testNegativeFloat() {
function.execute(null, null, null, new Object[]{-4.0F}, null);
final Object result = function.getResult();
assertEquals(result, null);
assertNull(result);
}

@Test
Expand All @@ -140,7 +140,7 @@ public void testPositiveBigDecimal() {
public void testNegativeBigDecimal() {
function.execute(null, null, null, new Object[]{BigDecimal.valueOf(-4.0D)}, null);
final Object result = function.getResult();
assertEquals(result, null);
assertNull(result);
}

@Test
Expand All @@ -155,7 +155,7 @@ public void testPositiveBigInteger() {
public void testNegativeBigInteger() {
function.execute(null, null, null, new Object[]{new BigInteger("-4")}, null);
final Object result = function.getResult();
assertEquals(result, null);
assertNull(result);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ protected void parseParameters(final String[] args) {

if (file == null) {
final DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd-HHmmssSSS");
file = String.format(file, dateFormat.format(System.currentTimeMillis()));
file = String.format(file, dateFormat.format(System.currentTimeMillis())); // TODO: null parameter not allowed?
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public ExecutionResponse execute(final HttpServerExchange exchange, final Server

final Deque<String> userNamePar = exchange.getQueryParameters().get("userName");
String userName = userNamePar.isEmpty() ? null : userNamePar.getFirst().trim();
if (userName.isEmpty())
if (userName.isEmpty()) // TODO: Null pointer dereference?
userName = null;

if (userName == null)
Expand Down