[ 
https://issues.apache.org/jira/browse/AIRAVATA-1864?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Shameera Rathnayaka updated AIRAVATA-1864:
------------------------------------------
    Fix Version/s:     (was: 0.16)
                   0.17 

> GFAC-core - fix to NPE when no DataMovementInterfaces defined
> -------------------------------------------------------------
>
>                 Key: AIRAVATA-1864
>                 URL: https://issues.apache.org/jira/browse/AIRAVATA-1864
>             Project: Airavata
>          Issue Type: Bug
>          Components: GFac
>    Affects Versions: 0.15 
>         Environment: java gfac core 
>            Reporter: Emre Brookes
>              Labels: patch
>             Fix For: 0.17 
>
>
> In BetterGfacImpl.java,  job submission protocol is being checked as part of 
> data movement protocol setting.  I believe you want to check if the data 
> movement protocol is null.  Also, the .get(0) will throw an NPE if you don't 
> check that the getHostPrioritizedDataMovementInterfaces() has at least one 
> element (in this case I'm checking for not null && not empty).
> Likely, similar code should be applied to the previous .get(0) in the job 
> submission protocol previous to this block. 
> Here's the patch as a simple diff -u
> --- BetterGfacImpl.java~        2015-10-28 12:39:17.586646368 -0500
> +++ BetterGfacImpl.java 2015-10-29 15:01:48.300713817 -0500
> @@ -345,7 +345,7 @@
>              // set gatewayUserPreferred data movement protocol and interface
> jobExecutionContext.setPreferredDataMovementProtocol(gatewayResourcePreferences.getPreferredDataMovementProtocol());
> -            if 
> (gatewayResourcePreferences.getPreferredJobSubmissionProtocol() == null) {
> +            if 
> (gatewayResourcePreferences.getPreferredDataMovementProtocol() == null && 
> jobExecutionContext.getHostPrioritizedDataMovementInterfaces() != null && 
> !jobExecutionContext.getHostPrioritizedDataMovementInterfaces().isEmpty() ) {
> jobExecutionContext.setPreferredDataMovementInterface(jobExecutionContext.getHostPrioritizedDataMovementInterfaces().get(0));
>                  if (jobExecutionContext.getPreferredDataMovementInterface() 
> != null){
> jobExecutionContext.setPreferredDataMovementProtocol(jobExecutionContext.getPreferredDataMovementInterface().getDataMovementProtocol());
>  



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

Reply via email to