Hi, 

i'm new to jenkins development and tried to extend the plot-plugin (
http://wiki.jenkins-ci.org/display/JENKINS/Plot+Plugin) 

Therefore i made a copy of Plot.java and named it Config.java, so i just 
renamed it, it's ctor etc.. 

Everytime, saveInstance is called and i try to bind my Config.java to the 
FormData, i get a InvocationTargetException, while binding Plot.java works. 
I don't know, whats the Problem? 

public static class DescriptorImpl extends BuildStepDescriptor<Publisher>
        { 

/** 
 * Called when the user saves the project configuration. 
 */ 
@Override 
public Publisher newInstance(StaplerRequest req, JSONObject formData) 
throws FormException 
{ 
/* NEW */ 
for (Object data: SeriesFactory.getArray(formData.get("configuration"))) 
{ 
   publisher.addConfiguration(bindConfig((JSONObject) data, req)); 
   break; //only save first 
} 
/* /NEW */ 
                        
// go on with orig stuff 
for (Object data : SeriesFactory.getArray(formData.get("configuration"))) 
{ 
  publisher.addPlot(bindPlot((JSONObject) data, req)); 
 } 

} 

private static Plot bindPlot(JSONObject data, StaplerRequest req) 
{ 
   Plot plots = req.bindJSON(Plot.class, data); 
   plots.series = SeriesFactory.createSeriesList(data.get("series"), req); 
   return plots; 
} 
                
/** 
* NEW: save config to Config.java, which is the same as Plot.java 
* @param req 
* @param jsonPlotArray 
*/ 
private static Configuration bindConfig(JSONObject data, StaplerRequest 
req) 
{ 
  Configuration c = req.bindJSON(Configuration.class, data); //bindJSON 
fails. 
  return c; 
} 

..... 
} 



*Jenkins is 1.539 and pom.xml:*
  <parent>
    <groupId>org.jenkins-ci.plugins</groupId>
    <artifactId>plugin</artifactId>
    <version>1.539</version>
  </parent> 

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to