This is an automated email from the ASF dual-hosted git repository.

liuxun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/submarine.git


The following commit(s) were added to refs/heads/master by this push:
     new 99109b9  SUBMARINE-79. Solve potential NPE for 
MockRemoteDirectoryManager
99109b9 is described below

commit 99109b999f2dc2d6765405fc443fc3fb3a77a10b
Author: cchung100m <[email protected]>
AuthorDate: Tue Mar 10 20:05:02 2020 +0800

    SUBMARINE-79. Solve potential NPE for MockRemoteDirectoryManager
    
    ### What is this PR for?
    
    Solve potential NPE for MockRemoteDirectoryManager
    
    MockRemoteDirectoryManager#getModelDir:
    
    `File modelDir = new File(modelParentDir.getAbsolutePath(), modelName);`
    
    If modelParentDir is null, we could have an NPE easily.
    
    ### What type of PR is it?
    [Bug Fix | Improvement ]
    
    ### What is the Jira issue?
    
    https://issues.apache.org/jira/browse/SUBMARINE-79
    
    ### How should this be tested?
    
    https://travis-ci.com/cchung100m/submarine/builds/152619875
    
    ### Screenshots (if appropriate)
    
    ### Questions:
    * Does the licenses files need update? No
    * Is there breaking changes for older versions? No
    * Does this needs documentation? No
    
    Author: cchung100m <[email protected]>
    
    Closes #223 from cchung100m/SUBMARINE-79 and squashes the following commits:
    
    f66faee [cchung100m] SUBMARINE-79. Solve potential NPE for 
MockRemoteDirectoryManager
---
 .../apache/submarine/commons/runtime/fs/MockRemoteDirectoryManager.java  | 1 +
 1 file changed, 1 insertion(+)

diff --git 
a/submarine-commons/commons-runtime/src/test/java/org/apache/submarine/commons/runtime/fs/MockRemoteDirectoryManager.java
 
b/submarine-commons/commons-runtime/src/test/java/org/apache/submarine/commons/runtime/fs/MockRemoteDirectoryManager.java
index abc0bf7..13fa78e 100644
--- 
a/submarine-commons/commons-runtime/src/test/java/org/apache/submarine/commons/runtime/fs/MockRemoteDirectoryManager.java
+++ 
b/submarine-commons/commons-runtime/src/test/java/org/apache/submarine/commons/runtime/fs/MockRemoteDirectoryManager.java
@@ -113,6 +113,7 @@ public class MockRemoteDirectoryManager implements 
RemoteDirectoryManager {
   @Override
   public Path getModelDir(String modelName, boolean create)
       throws IOException {
+    Objects.requireNonNull(modelParentDir, "Model parent dir must not be 
null!");
     File modelDir = new File(modelParentDir.getAbsolutePath(), modelName);
     if (create) {
       if (!modelDir.exists() && !modelDir.mkdirs()) {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to