[JIRA] (JENKINS-55559) net.sf.json.JSONException: Invalid JSON String with Octopus Deploy Deployment plugin

2020-02-21 Thread alexpo...@gmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 alex poole commented on  JENKINS-9  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: net.sf.json.JSONException: Invalid JSON String with Octopus Deploy Deployment plugin   
 

  
 
 
 
 

 
 Big help thanks David, thought I was going mad with my sample JSON refusing to parse. NB to others, same issue when using readJSON() in the Pipeline Utility plugin: https://jenkins.io/doc/pipeline/steps/pipeline-utility-steps/ Instead of trusting others' JSON to come pre-trimmed, just read it in and trim it as David suggests; 

 

def configString = readFile("userfile.json") 
configString = configString.trim()
def configJSON = readJSON text: configString

 

 The "file" version of readJSON is unusable unless you can guarantee no top/tail whitespace and/or you don't care if it breaks the pipeline Cheers Alex  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)  
 
 

 
   
 

  
 

  
 

   





-- 
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.196721.1547427129000.4406.1582304640189%40Atlassian.JIRA.


[JIRA] (JENKINS-55559) net.sf.json.JSONException: Invalid JSON String with Octopus Deploy Deployment plugin

2019-10-15 Thread da...@madlnet.net (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 David Madl commented on  JENKINS-9  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: net.sf.json.JSONException: Invalid JSON String with Octopus Deploy Deployment plugin   
 

  
 
 
 
 

 
 I've found that readJSON (net.sf.json.JSONSerializer.toJSON()), at least in json-lib-2.4-jdk15.jar, may fail due to leading and trailing whitespace. For example, the following is broken: 

 

import net.sf.json.JSONSerializer
demo = JSONSerializer.toJSON("""
{}
""") // fails with net.sf.json.JSONException: Invalid JSON String 

 Whereas the following works: 

 

demo = JSONSerializer.toJSON("""{}""")
 

 You may want to trim() your strings before passing into readJSON / JSONSerializer.toJSON().   Hope this helps.  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)  
 
 

 
   
 

  
 

  
 

   





-- 
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 

[JIRA] (JENKINS-55559) net.sf.json.JSONException: Invalid JSON String with Octopus Deploy Deployment plugin

2019-01-13 Thread arun.sudarsa...@accenture.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Arun Sudarsanam created an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Jenkins /  JENKINS-9  
 
 
  net.sf.json.JSONException: Invalid JSON String with Octopus Deploy Deployment plugin   
 

  
 
 
 
 

 
Issue Type: 
  Bug  
 
 
Assignee: 
 Brian Adriance  
 
 
Components: 
 octopusdeploy-plugin  
 
 
Created: 
 2019-01-14 00:52  
 
 
Environment: 
 Octopusdeploy-plugin version 1.90  Jenkins version 2.150.1  JDK-1.8.0  OS-Linux  Octopus version v2018.4.12  
 
 
Priority: 
  Major  
 
 
Reporter: 
 Arun Sudarsanam  
 

  
 
 
 
 

 
     When we provide values for Project name and environment  under Octopusdeploy post build step, we are getting below error. Tried reinstalling Octopusdeploy plugin. Still below error occurs.   Stack trace net.sf.json.JSONException: Invalid JSON String at net.sf.json.JSONSerializer.toJSON(JSONSerializer.java:143) at net.sf.json.JSONSerializer.toJSON(JSONSerializer.java:103) at net.sf.json.JSONSerializer.toJSON(JSONSerializer.java:84) at com.octopusdeploy.api.ProjectsApi.getAllProjects(ProjectsApi.java:31) at com.octopusdeploy.api.ProjectsApi.getProjectByName(ProjectsApi.java:62) at hudson.plugins.octopusdeploy.OctopusValidator.validateProject(OctopusValidator.java:34) at hudson.plugins.octopusdeploy.OctopusDeployDeploymentRecorder$DescriptorImpl.doCheckProject(OctopusDeployDeploymentRecorder.java:362) at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627) at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:396) at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:408) at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:212) at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:145) at org.kohsuke.stapler.MetaClass$11.doDispatch(MetaClass.java:537) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58) at