Skip to content
Permalink
Browse files

Fix JENKINS-12876

  • Loading branch information...
gboissinot committed Feb 26, 2012
1 parent 4199b27 commit db8e61f83fafc1d183735b6ab7d03b3caf5ac3e0
Showing with 19 additions and 21 deletions.
  1. +19 −21 src/main/java/org/jenkinsci/plugins/envinject/EnvInjectInfo.java
@@ -2,12 +2,11 @@

import hudson.Util;
import org.jenkinsci.lib.envinject.EnvInjectException;
import org.jenkinsci.plugins.envinject.service.PropertiesGetter;
import org.jenkinsci.plugins.envinject.service.PropertiesLoader;
import org.kohsuke.stapler.DataBoundConstructor;

import java.io.IOException;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
@@ -16,49 +15,48 @@
public class EnvInjectInfo implements Serializable {

protected String propertiesFilePath;
protected String propertiesContent;

private Map<String, String> propertiesContentMap;
@Deprecated
private transient Map<String, String> propertiesContentMap;

protected transient String propertiesContent;
@Deprecated
protected transient boolean populateTriggerCause;

@DataBoundConstructor
public EnvInjectInfo(String propertiesFilePath, String propertiesContent) {
this.propertiesFilePath = Util.fixEmpty(propertiesFilePath);
PropertiesLoader loader = new PropertiesLoader();
try {
propertiesContentMap = loader.getVarsFromPropertiesContent(propertiesContent);
} catch (EnvInjectException e) {
e.printStackTrace();
}
this.propertiesContent = Util.fixEmpty(propertiesContent);
}

public String getPropertiesFilePath() {
return propertiesFilePath;
}

public Map<String, String> getPropertiesContentMap() {
return propertiesContentMap;
}

@SuppressWarnings("unused")
public String getPropertiesContent() {
return propertiesContent;
}

@SuppressWarnings("deprecation")
public Map<String, String> getPropertiesContentMap() {

if (propertiesContentMap != null) {
PropertiesGetter propertiesGetter = new PropertiesGetter();
return propertiesGetter.getPropertiesContent(propertiesContentMap);
return propertiesContentMap;
}
return null;
}

private Object readResolve() throws IOException {
if (propertiesContent != null) {
Map<String, String> contentMap = new HashMap<String, String>();
PropertiesLoader loader = new PropertiesLoader();
try {
propertiesContentMap = loader.getVarsFromPropertiesContent(propertiesContent);
contentMap = loader.getVarsFromPropertiesContent(propertiesContent);
} catch (EnvInjectException e) {
e.printStackTrace();
}
return contentMap;
}
return this;

return null;
}

}

0 comments on commit db8e61f

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