Skip to content
Browse files

Merge pull request #26 from milkboy/JENKINS-18229

[JENKINS-18229] Add hack to get around the "" -> exception 
Yup hack but no other way to fix that :-)
  • Loading branch information
olamy committed Jun 21, 2013
2 parents deb1d45 + 815c453 commit ffd843ecc3f935ccf22ca1e354bd78d19af69327
Showing with 22 additions and 1 deletion.
  1. +22 −1 src/main/java/hudson/plugins/jira/
@@ -7,9 +7,13 @@
import hudson.model.JobPropertyDescriptor;
import hudson.util.CopyOnWriteList;
import net.sf.json.JSONObject;
import org.apache.commons.beanutils.Converter;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.Stapler;
import org.kohsuke.stapler.StaplerRequest;

import java.util.logging.Logger;

@@ -102,7 +106,24 @@ public void setSites(JiraSite site) {

public boolean configure(StaplerRequest req, JSONObject formData) {
sites.replaceBy(req.bindJSONToList(JiraSite.class, formData.get("sites")));
//Fix^H^H^HDirty hack for empty string to URL conversion error
//Should check for existing handler etc, but since this is a dirty hack,
//we won't
Stapler.CONVERT_UTILS.register(new Converter() {
public Object convert(Class aClass, Object o) {
if(o == null || "".equals(o) || "null".equals(o)) return null;
try {
return new URL((String) o);
} catch (MalformedURLException e) {
LOGGER.warning(String.format("%s is not a valid URL.", o.toString()));
return null;
//End hack

sites.replaceBy(req.bindJSONToList(JiraSite.class, formData.get("sites")));
return true;

0 comments on commit ffd843e

Please sign in to comment.
You can’t perform that action at this time.