@@ -30,6 +30,11 @@ public PicardWrapper(@Nullable Logger logger)
3030
3131 public String getVersion () throws PipelineJobException
3232 {
33+ if (!jarExists ())
34+ {
35+ throw new PipelineJobException ("Unable to find picard.jar" );
36+ }
37+
3338 List <String > params = new LinkedList <>();
3439 params .add (SequencePipelineService .get ().getJava8FilePath ());
3540 params .add ("-jar" );
@@ -49,26 +54,20 @@ public String getVersion() throws PipelineJobException
4954 return ret ;
5055 }
5156
52- public static File getPicardJar ()
57+ public static @ Nullable File getPicardJar (boolean throwIfNotFound )
5358 {
54- String path = PipelineJobService .get ().getConfigProperties ().getSoftwarePackagePath ("PICARDPATH" );
55- if (path != null )
56- {
57- return new File (path );
58- }
59-
60- path = PipelineJobService .get ().getConfigProperties ().getSoftwarePackagePath (SequencePipelineService .SEQUENCE_TOOLS_PARAM );
61- if (path == null )
62- {
63- path = PipelineJobService .get ().getAppProperties ().getToolsDirectory ();
64- }
59+ return resolveFileInPath ("picard.jar" , "PICARDPATH" , throwIfNotFound );
60+ }
6561
66- return path == null ? null : new File (path , "picard.jar" );
62+ public boolean jarExists ()
63+ {
64+ File jar = getPicardJar (false );
65+ return jar != null && jar .exists ();
6766 }
6867
6968 protected File getJar ()
7069 {
71- return getPicardJar ();
70+ return getPicardJar (false );
7271 }
7372
7473 public ValidationStringency getStringency ()
@@ -83,13 +82,18 @@ public void setStringency(ValidationStringency stringency)
8382
8483 abstract protected String getToolName ();
8584
86- protected List <String > getBaseArgs ()
85+ protected List <String > getBaseArgs () throws PipelineJobException
8786 {
8887 return getBaseArgs (false );
8988 }
9089
91- protected List <String > getBaseArgs (boolean basicArgsOnly )
90+ protected List <String > getBaseArgs (boolean basicArgsOnly ) throws PipelineJobException
9291 {
92+ if (!jarExists ())
93+ {
94+ throw new PipelineJobException ("Unable to find picard.jar" );
95+ }
96+
9397 List <String > params = new LinkedList <>();
9498 params .add (SequencePipelineService .get ().getJava8FilePath ());
9599 params .addAll (SequencePipelineService .get ().getJavaOpts ());
0 commit comments