You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@slider.apache.org by "Gour Saha (JIRA)" <ji...@apache.org> on 2016/07/25 17:48:20 UTC

[jira] [Comment Edited] (SLIDER-1153) Code issues - 14 null pointer deferences found

    [ https://issues.apache.org/jira/browse/SLIDER-1153?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15392340#comment-15392340 ] 

Gour Saha edited comment on SLIDER-1153 at 7/25/16 5:47 PM:
------------------------------------------------------------

[~jianhe] thank you for the .3 patch. It looks good. I added just one more fix in line 241 in RoleHistoryWriter.java -

{code}
@@ -238,6 +241,9 @@ public class RoleHistoryWriter {
       try {
         while (footer == null) {
           record = reader.read(null, decoder);
+          if (record == null) {
+            throw new IOException("Null record after " + records + " records");
+          }
           entry = record.getEntry();
 
           if (entry instanceof RoleHistoryHeader) {
{code}

Committing this patch now.



was (Author: gsaha):
[~jianhe] that you for the .3 patch. It looks good. I added just one more fix in line 241 in RoleHistoryWriter.java -

{code}
@@ -238,6 +241,9 @@ public class RoleHistoryWriter {
       try {
         while (footer == null) {
           record = reader.read(null, decoder);
+          if (record == null) {
+            throw new IOException("Null record after " + records + " records");
+          }
           entry = record.getEntry();
 
           if (entry instanceof RoleHistoryHeader) {
{code}

Committing this patch now.


> Code issues - 14 null pointer deferences found
> ----------------------------------------------
>
>                 Key: SLIDER-1153
>                 URL: https://issues.apache.org/jira/browse/SLIDER-1153
>             Project: Slider
>          Issue Type: Bug
>          Components: other
>    Affects Versions: Slider 0.91
>            Reporter: Gour Saha
>            Assignee: Jian He
>             Fix For: Slider 1.0.0
>
>         Attachments: SLIDER-1153.1.patch, SLIDER-1153.2.patch, SLIDER-1153.3.patch
>
>
> Following possible null pointer dereferences found in the code needs to be fixed.
> h6. slider-core/src/main/java/org/apache/slider/server/appmaster/state/AppState.java
> {code}
> 819          ProviderRole dynamicRole = createDynamicProviderRole(newName, name, component);
> {code}
> dereference: Dereferencing a pointer that might be null component when calling createDynamicProviderRole
> {code}
>  836        roleHistory.addNewRole(roleStatus);
> {code}
> null_method_call: Calling a method on null object roleHistory
> {code}
> 1290      return roleHistory.requestContainerForRole(role).getIssuedRequest();
> {code}
> null_method_call: Calling a method on null object roleHistory.requestContainerForRole(role)
> h6. slider-core/src/main/java/org/apache/slider/client/SliderClient.java
> {code}
> 960      char[] newPassword2 = br.readLine().toCharArray();
> {code}
> null_method_call: Calling a method on null object br.readLine()
> {code}
> 3679        Path subPath = new Path(path1, appReport.getApplicationId().toString()
> 3680            + "/agent");
> {code}
> null_method_call: Calling a method on null object appReport.
> {code}
> 3795      Path subPath = new Path(path1, appReport.getApplicationId().toString()
> 3796          + "/agent");
> 3797      imagePath = subPath.toString();
> {code}
> null_method_call: Calling a method on null object appReport.
> h6. slider-core/src/main/java/org/apache/slider/common/tools/SliderUtils.java
> {code}
> 1035    return !(address.getHostString().equals("0.0.0.0"));
> {code}
> null_method_call: Calling a method on null object address.getHostString()
> {code}
> 1422    for (String entry : confDirEntries) {
> {code}
> null_array_length: Accessing length of null array confDirEntries
> h6. slider-core/src/main/java/org/apache/slider/common/tools/CoreFileSystem.java
> {code}
> 682      Path[] localFilePaths = new Path[localFiles.length];
> {code}
> null_array_length: Accessing length of null array localFiles
> h6. slider-core/src/main/java/org/apache/slider/server/services/security/FsDelegationTokenManager.java
> {code}
> 159            tokenExpiryTime = CredentialUtils.getTokenExpiryTime(token);
> {code}
> dereference: Dereferencing a pointer that might be null token when calling getTokenExpiryTime
> {code}
> 237        currentUser.addToken(token.getService(), token);
> {code}
> null_method_call: Calling a method on null object token
> h6. slider-core/src/main/java/org/apache/slider/server/appmaster/rpc/SliderIPCService.java
> {code}
> 237    result = cd.toJsonString();
> {code}
> null_method_call: Calling a method on null object cd
> h6. slider-core/src/main/java/org/apache/slider/server/appmaster/actions/RenewingAction.java
> {code}
>  66    Preconditions.checkArgument(action != null, "null actions");
> {code}
> check_after_deref: Null-checking action suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
> h6. slider-core/src/main/java/org/apache/slider/core/launch/SerializedApplicationReport.java
> {code}
> 70    this.applicationAttemptId = report.getCurrentApplicationAttemptId().toString();
> {code}
> null_method_call: Calling a method on null object report.getCurrentApplicationAttemptId()



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)