Hi,

In a shared library, in a groovy script in /vars, the following code is 
working perfectly:

String call(String stageName) {
  String cowMsg = libraryResource 'cow.txt'
  if (cowMsg != null) {
    def vars = [:]
    vars['MESSAGE'] = "BEGIN STAGE: ${stageName}"
    def engine = new StreamingTemplateEngine()
    def asciiArtMsg = engine.createTemplate(cowMsg).make(vars).toString()
    echo "${asciiArtMsg}"
} else {
    echo "I never see that because cowMsg is not null..."
}

This prints my file cow.txt as expected, because cowMsg is NOT null.

BUT : if I remove the "if", I have this error :
  No such library resource null could be found.

It is like my resource suddenly became null !

I load some other files without the need of this mysterious "if".

Is that a Groovy bug ?



-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/bc886d97-b820-4999-91c1-44cfcffac138n%40googlegroups.com.

Reply via email to