Skip to content

Commit

Permalink
Fix Findbugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Dohbedoh committed Jan 23, 2018
1 parent 0d53e71 commit 1c6e554
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class Messages {
public static final String SEMANTIC_VERSION_COLUMN_DISPLAY_NAME = "Semantic Version";
public static final String UNKNOWN_VERSION = "Unknown";

public class Parsers {
public static class Parsers {
public static final String SBT_BUILD_SBT_PARSER = "SBT build.sbt parser";
public static final String MAVEN_POM_PARSER = "Maven Pom Parser";
public static final String SBT_BUILD_SCALA_PARSER = "SBT Build.scala Parser";
Expand All @@ -39,14 +39,14 @@ public class Parsers {
public static final String COMPOSER_JSON_PARSER = "Composer composer.json Parser";
}

public class ColumnDisplayStrategies {
public static class ColumnDisplayStrategies {
public static final String LAST_JENKINS_BUILD_NUMBER_STRATEGY = "Show Last Jenkins Build Number";
public static final String LAST_SUCCESSFUL_JENKINS_BUILD_NUMBER_STRATEGY = "Show Last Successful Jenkins Build Number";
public static final String LAST_SUCCESSFUL_BUILD_VERSION_STRATEGY = "Show Last Successful Semantic Version";
public static final String NA_STRATEGY = "Show 'N/A'";
}

public class NamingStrategies {
public static class NamingStrategies {
public static final String NOOP_NAMING = "none";
public static final String MAVEN_RELEASE_DEVELOPMENT = "Maven, release and development version";
public static final String UNTOUCHED = "As found";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class SemanticVersionColumn extends ListViewColumn {
@DataBoundConstructor
public SemanticVersionColumn(String displayStrategyName) {
try {
this.displayStrategy = (ColumnDisplayStrategy) Jenkins.getInstance().getExtensionList(displayStrategyName).iterator().next();
this.displayStrategy = (ColumnDisplayStrategy) Jenkins.getActiveInstance().getExtensionList(displayStrategyName).iterator().next();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ public SemanticVersioningBuilder(String parser, String namingStrategy, boolean u
this.useJenkinsBuildNumber = useJenkinsBuildNumber;
this.envVariable = envVariable;
try {
this.parser = (BuildDefinitionParser) Jenkins.getInstance().getExtensionList(parser).iterator().next();
this.parser = (BuildDefinitionParser) Jenkins.getActiveInstance().getExtensionList(parser).iterator().next();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
try {
this.namingStrategy = (NamingStrategy) Jenkins.getInstance().getExtensionList(namingStrategy).iterator().next();
this.namingStrategy = (NamingStrategy) Jenkins.getActiveInstance().getExtensionList(namingStrategy).iterator().next();
} catch (ClassNotFoundException e) {
e.printStackTrace();
this.namingStrategy = new NoopNamingStrategy();
Expand Down Expand Up @@ -182,7 +182,7 @@ public SemanticVersioningBuilderDescriptor() {
*/
public ListBoxModel doFillParserItems() {
ListBoxModel parsersModel = new ListBoxModel();
for (BuildDefinitionParser parser : Jenkins.getInstance()
for (BuildDefinitionParser parser : Jenkins.getActiveInstance()
.getExtensionList(BuildDefinitionParser.class)) {
parsersModel.add(parser.getDescriptor().getDisplayName(), parser
.getClass().getCanonicalName());
Expand All @@ -192,7 +192,7 @@ public ListBoxModel doFillParserItems() {

public ListBoxModel doFillNamingStrategyItems() {
ListBoxModel namingStrategiesModel = new ListBoxModel();
for (NamingStrategy namingStrategy : Jenkins.getInstance()
for (NamingStrategy namingStrategy : Jenkins.getActiveInstance()
.getExtensionList(NamingStrategy.class)) {
namingStrategiesModel.add(namingStrategy.getDescriptor().getDisplayName(), namingStrategy.getClass().getCanonicalName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@

public abstract class AbstractColumnDisplayStrategy extends ExtensionPoint implements ColumnDisplayStrategy {
public static ExtensionList<ColumnDisplayStrategy> getStrategies() {
return Jenkins.getInstance().getExtensionList(ColumnDisplayStrategy.class);
return Jenkins.getActiveInstance().getExtensionList(ColumnDisplayStrategy.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
*/

public abstract class AbstractBuildDefinitionParser extends ExtensionPoint implements BuildDefinitionParser, Serializable {
protected static Logger logger = Logger.getLogger(String.valueOf(AbstractBuildDefinitionParser.class));
static final Logger logger = Logger.getLogger(String.valueOf(AbstractBuildDefinitionParser.class));
public static ExtensionList<BuildDefinitionParser> getParsers() {
return Jenkins.getInstance().getExtensionList(BuildDefinitionParser.class);
return Jenkins.getActiveInstance().getExtensionList(BuildDefinitionParser.class);
}
}
1 change: 1 addition & 0 deletions src/main/resources/index.jelly
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!--
This view is used to render the installed plugins page.
-->
<?jelly escape-by-default='true'?>
<div>
Jenkins Plugin that generates a semantic version from a build definition file (SBT, POM, Bower, Scala.build). Includes a Dashboard column plugin that displays the semantic version of the last successful build.
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core"
xmlns:f="/lib/form">
<f:entry title="Display Strategy (for unsuccessful previous builds)" field="displayStrategy">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->

<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<f:entry title="Version Number Parser" field="parser">
<f:select />
Expand Down

0 comments on commit 1c6e554

Please sign in to comment.