[JIRA] (JENKINS-49732) java.util.LinkedHashMap$Entry not serializable in Pipeline
Title: Message Title Ulad Muraveika commented on JENKINS-49732 Re: java.util.LinkedHashMap$Entry not serializable in Pipeline Fabian Holler, please use my small cheat sheet below for all fine points in the pipelines code. Quick answer - you can use .each due to closed JENKINS-26481(https://issues.jenkins-ci.org/browse/JENKINS-26481) Example of code Can it be used in the pipeline code? Iterator from plain C-style for-loop Yes Iterator from Groovy each - JENKINS-26481(https://issues.jenkins-ci.org/browse/JENKINS-26481) Yes Java 5-style for loop for (data_type item : collection) - JENKINS-27421(https://issues.jenkins-ci.org/browse/JENKINS-27421) Yes *WARNING - if you are using : Java 5-style for loop for (data_type item : collection) for ANY implementation of Map interface - and want to work with Map Entries you will have java.io.NotSerializableException - java.util.LinkedHashMap$Entry - JENKINS-49732(https://issues.jenkins-ci.org/browse/JENKINS-49732). Fix will be to use groovy each data.each closure or use visibly entrySet with Java for loop for (def foo : data.entrySet()) No Any code connected with a regex like code - find, replace, split, groovy syntax sugar =~ and ==~, because all of them have non Serializable java.util.regex.Matcher inside No JSONSlupper with groovy.json.internal.LazyMap inside. Please use groovy.json.JsonSlurperClassic with java.util.HashMap instead or better use [builtin Jenkins step ](https://jenkins.io/doc/pipeline/steps/pipeline-utility-steps/#readjson-read-json-from-files-in-the-workspace) - readJSON No
[JIRA] (JENKINS-26481) Mishandling of binary methods accepting Closure
Title: Message Title Ulad Muraveika commented on JENKINS-26481 Re: Mishandling of binary methods accepting Closure Baptiste Mathus, I'll do this, because I had funny time with digging around NonSerializable exceptions and have created small documentation file with all such cases for my team. Now it is time to share it Thanks for additional info and reminder! Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-issues/JIRA.160147.1421607875000.13683.1563352502888%40Atlassian.JIRA. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-26481) Mishandling of binary methods accepting Closure
Title: Message Title Ulad Muraveika commented on JENKINS-26481 Re: Mishandling of binary methods accepting Closure Guys, it will be cool if you update documentation on https://jenkins.io/doc/pipeline/examples/ page, because bug was fixed and doc right now is confusing novice users >Due to limitations in Workflow - i.e., JENKINS-26481 - it's not really possible to use Groovy closures or syntax that depends on closures, so you can't do the Groovy standard of using .collectEntries on a list and generating the steps as values for the resulting entries. You also can't use the standard Java syntax for For loops - i.e., "for (String s: strings)" - and instead have to use old school counter-based for loops. Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-issues/JIRA.160147.1421607875000.6944.1562769243301%40Atlassian.JIRA. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-49732) java.util.LinkedHashMap$Entry not serializable in Pipeline
Title: Message Title Ulad Muraveika edited a comment on JENKINS-49732 Re: java.util.LinkedHashMap$Entry not serializable in Pipeline Hi [~abayer],It will be very helpful, if you explain why your workaround with groovy closure will work, because I've tried to debug similar code and can see {{java.util.LinkedHashMap$Entry}} variables as well.Does serialization works in different way for variables in closures?My answer: yes, it is working different and it can be used as workaround per fixed https://issues.jenkins-ci.org/browse/JENKINS-26481 Thanks in advance! Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-issues/JIRA.188674.1519637279000.6938.1562768880454%40Atlassian.JIRA. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-49732) java.util.LinkedHashMap$Entry not serializable in Pipeline
Title: Message Title Ulad Muraveika commented on JENKINS-49732 Re: java.util.LinkedHashMap$Entry not serializable in Pipeline Hi Andrew Bayer, It will be very helpful, if you explain why your workaround with groovy closure will work, because I've tried to debug similar code and can see java.util.LinkedHashMap$Entry variables as well. Does serialization works in different way for variables in closures? Thanks in advance! Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-issues/JIRA.188674.1519637279000.2240.1562318820202%40Atlassian.JIRA. For more options, visit https://groups.google.com/d/optout.