-
-
Notifications
You must be signed in to change notification settings - Fork 95
Some static code analysis results #1290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 10 commits
df91e30
bf20442
f77fc0a
1c41644
2870787
81976b1
f1002ce
d874a61
2fd9d09
268fe8c
c7d9542
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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? | ||
|
||
| bucketObj = db.getSchema().getBucketByName(bucket.getBucketName()); | ||
| else | ||
| bucketObj = db.getSchema().getBucketById(bucket.getBucketNumber()); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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?) | ||
|
||
| if (Boolean.TRUE.equals(orderByRidAsc)) { | ||
| step.setOrder(FetchFromClusterExecutionStep.ORDER_ASC); | ||
| } else if (Boolean.FALSE.equals(orderByRidAsc)) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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! | ||
|
||
|
|
||
| final Property property = typez.getProperty(propertyName.getStringValue()); | ||
| if (property == null) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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? | ||
|
||
|
|
||
| if (!idx.isAutomatic()) | ||
| throw new CommandExecutionException( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -623,9 +623,8 @@ public Collection<TypeIndex> getAllIndexes(final boolean polymorphic) { | |
|
|
||
| final List<TypeIndex> list = new ArrayList<>(indexesByProperties.values()); | ||
|
|
||
| if (polymorphic) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct |
||
| } | ||
|
|
||
| @Test | ||
|
|
@@ -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 | ||
|
|
@@ -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 | ||
|
|
@@ -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 | ||
|
|
@@ -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 | ||
|
|
@@ -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 | ||
|
|
@@ -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 | ||
|
|
||
There was a problem hiding this comment.
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