Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
gboissinot committed Feb 26, 2012
1 parent 4199b27 commit db8e61f
Showing 1 changed file with 19 additions and 21 deletions.
40 changes: 19 additions & 21 deletions src/main/java/org/jenkinsci/plugins/envinject/EnvInjectInfo.java
Expand Up @@ -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;

/**
Expand All @@ -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.