Skip to content

Commit

Permalink
extract SystemExit class
Browse files Browse the repository at this point in the history
  • Loading branch information
ancho committed May 17, 2020
1 parent 8140f87 commit 54b8786
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 24 deletions.
2 changes: 1 addition & 1 deletion jbake-core/src/main/java/org/jbake/app/ContentStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import com.orientechnologies.orient.core.sql.OCommandSQL;
import com.orientechnologies.orient.core.sql.executor.OResultSet;
import com.orientechnologies.orient.core.sql.query.OSQLSynchQuery;
import org.jbake.app.JBakeException.SystemExit;
import org.jbake.launcher.SystemExit;
import org.jbake.model.DocumentAttributes;
import org.jbake.model.DocumentTypes;
import org.slf4j.Logger;
Expand Down
19 changes: 2 additions & 17 deletions jbake-core/src/main/java/org/jbake/app/JBakeException.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.jbake.app;

import org.jbake.launcher.SystemExit;

/**
* This runtime exception is thrown by JBake API to indicate an processing
* error.
Expand All @@ -9,23 +11,6 @@
public class JBakeException extends RuntimeException {
private static final long serialVersionUID = 1L;

public enum SystemExit {
ERROR(1),
CONFIGURATION_ERROR(2),
INIT_ERROR(3),
SERVER_ERROR(4);

private final int status;

SystemExit(int status) {
this.status = status;
}

public int getStatus() {
return status;
}

}
final private SystemExit exit;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.commons.configuration.SystemConfiguration;
import org.jbake.app.JBakeException;
import org.jbake.app.JBakeException.SystemExit;
import org.jbake.launcher.SystemExit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import org.jbake.app.FileUtil;
import org.jbake.app.JBakeException;
import org.jbake.app.JBakeException.SystemExit;
import org.jbake.launcher.SystemExit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
1 change: 0 additions & 1 deletion jbake-core/src/main/java/org/jbake/launcher/Baker.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import org.apache.commons.configuration.CompositeConfiguration;
import org.jbake.app.JBakeException;
import org.jbake.app.JBakeException.SystemExit;
import org.jbake.app.Oven;
import org.jbake.app.configuration.JBakeConfiguration;
import org.jbake.app.configuration.JBakeConfigurationFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import org.eclipse.jetty.server.handler.HandlerList;
import org.eclipse.jetty.server.handler.ResourceHandler;
import org.jbake.app.JBakeException;
import org.jbake.app.JBakeException.SystemExit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
1 change: 0 additions & 1 deletion jbake-core/src/main/java/org/jbake/launcher/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import org.apache.commons.configuration.ConfigurationException;
import org.jbake.app.FileUtil;
import org.jbake.app.JBakeException;
import org.jbake.app.JBakeException.SystemExit;
import org.jbake.app.configuration.JBakeConfiguration;
import org.jbake.app.configuration.JBakeConfigurationFactory;
import org.slf4j.Logger;
Expand Down
13 changes: 13 additions & 0 deletions jbake-core/src/main/java/org/jbake/launcher/SystemExit.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.jbake.launcher;

public enum SystemExit {
SUCCESS,
ERROR,
CONFIGURATION_ERROR,
INIT_ERROR,
SERVER_ERROR;

public int getStatus() {
return this.ordinal();
}
}
1 change: 0 additions & 1 deletion jbake-core/src/test/java/org/jbake/launcher/MainTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import org.itsallcode.junit.sysextensions.ExitGuard;
import org.jbake.TestUtils;
import org.jbake.app.JBakeException;
import org.jbake.app.JBakeException.SystemExit;
import org.jbake.app.LoggingTest;
import org.jbake.app.configuration.ConfigUtil;
import org.jbake.app.configuration.DefaultJBakeConfiguration;
Expand Down

0 comments on commit 54b8786

Please sign in to comment.