java.lang.UnsupportedOperationException: Refusing to marshal org.codehaus.groovy.runtime.GStringImpl for security reasons

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

java.lang.UnsupportedOperationException: Refusing to marshal org.codehaus.groovy.runtime.GStringImpl for security reasons

Peter Berghold
what on earth does that message mean? 

Here is the code this seems to be happening to:

class Notifications implements Serializable {
    def context
    def dataBlocks
    def mailLists
    def workspace
    
    // emailext body: 'my email body', subject: 'email subject', to: '[hidden email]', replyTo: '[hidden email]', mimeType: 'text/html';  
    Notifications(ctx,workspace){
        context=ctx;
        dataBlocks = new Data(context,workspace)
        mailLists = this.loadJSON('data/email-lists.json')
        
    }
    def loadJSON(fname){
        def retval
        context.dir(workspace){
            retval = jsonParse(context.readFile(fname)) 
        }
        return retval
    }
------------8< snip 8<-----------------------------------------

in particular in the loading of the JSON file.  

It is laid out as 
{
    "list1" :: [
            "member1" ...etc.
     ]


thoughts?

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAArvnv0QNjMYO2m2n1RNnXzGOK%2BhZ%2BQuATXD8frtDMAwg8tL9A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: java.lang.UnsupportedOperationException: Refusing to marshal org.codehaus.groovy.runtime.GStringImpl for security reasons

Ramanathan Muthaiah
what on earth does that message mean? 

Here is the code this seems to be happening to:

class Notifications implements Serializable {
    def context
    def dataBlocks
    def mailLists
    def workspace
    
    // emailext body: 'my email body', subject: 'email subject', to: '[hidden email]', replyTo: '[hidden email]', mimeType: 'text/html';  
    Notifications(ctx,workspace){
        context=ctx;
        dataBlocks = new Data(context,workspace)
        mailLists = this.loadJSON('data/email-lists.json')
        
    }
    def loadJSON(fname){
        def retval
        context.dir(workspace){
            retval = jsonParse(context.readFile(fname)) 
        }
        return retval
    }
------------8< snip 8<-----------------------------------------

in particular in the loading of the JSON file.  

It is laid out as 
{
    "list1" :: [
            "member1" ...etc.
     ]


thoughts?

I guess this kind of operation is not whitelisted to run in the Groovy sandbox.

Did you try using this step to read JSON accessible in your workspace ?

https://jenkins.io/doc/pipeline/steps/pipeline-utility-steps/#readjson-read-json-from-files-in-the-workspace 

/Ram

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/8d61f2f0-0b5f-4b34-9957-54bf9786dd09%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.