Package net.sf.freecol
Class FreeCol
- java.lang.Object
-
- net.sf.freecol.FreeCol
-
public final class FreeCol extends java.lang.Object
This class is responsible for handling the command-line arguments and starting either the stand-alone server or the client-GUI.- See Also:
FreeColClient
,FreeColServer
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
FreeCol.LogLevel
The levels of logging in this game.
-
Field Summary
Fields Modifier and Type Field Description private static NationOptions.Advantages
advantages
The type of advantages.private static NationOptions.Advantages
ADVANTAGES_DEFAULT
private static java.lang.String
argDir
Definitions for all the options.private static java.lang.String
argFile
private static boolean
checkIntegrity
static java.lang.String
CLIENT_THREAD
private static boolean
consoleLogging
private static boolean
debugStart
private static java.lang.String[]
DIFFICULTIES
The difficulty levels.private static java.lang.String
difficulty
The difficulty level id.private static java.lang.String
DIFFICULTY_DEFAULT
private static int
europeanCount
The number of European nations to enable by default.private static int
EUROPEANS_DEFAULT
private static int
EUROPEANS_MIN
private static boolean
fastStart
private static java.lang.String
fontName
A font override.static java.lang.String
FREECOL_MAP_EXTENSION
The extension for FreeCol maps.private static java.lang.String
FREECOL_PROTOCOL_VERSION
The FreeCol protocol version number.static java.lang.String
FREECOL_SAVE_EXTENSION
The extension for FreeCol saved games.private static java.lang.String
FREECOL_VERSION
The FreeCol release version number.private static java.lang.String
freeColRevision
Specific revision number (currently the git tag of trunk at release)static float
GUI_SCALE_DEFAULT
static float
GUI_SCALE_MAX
private static int
GUI_SCALE_MAX_PCT
static float
GUI_SCALE_MIN
private static int
GUI_SCALE_MIN_PCT
static float
GUI_SCALE_STEP
private static int
GUI_SCALE_STEP_PCT
private static boolean
headless
private static boolean
introVideo
private static java.lang.String
JAVA_VERSION
The Java version.private static java.lang.String
JAVA_VERSION_MIN
private static boolean
javaCheck
private static java.util.Locale
locale
The locale, either default or command-line specified.private static java.util.logging.Logger
logger
private static java.util.logging.Level
LOGLEVEL_DEFAULT
private static java.util.List<FreeCol.LogLevel>
logLevels
private static long
MEGA
private static long
MEMORY_MAX
The maximum available memory.private static long
MEMORY_MIN
private static boolean
memoryCheck
private static java.lang.String
META_SERVER_ADDRESS
private static int
META_SERVER_PORT
static java.lang.String
METASERVER_THREAD
private static java.lang.String
metaServerAddress
Meta-server location.private static int
metaServerPort
private static java.lang.String
name
The client player name.private static java.lang.String[][]
optionsTable
private static int
PORT_DEFAULT
private static boolean
publicServer
static java.lang.String
SERVER_THREAD
private static java.net.InetAddress
serverAddress
How to name and configure the server.private static java.lang.String
serverName
private static int
serverPort
private static boolean
sound
private static java.util.Map<java.lang.String,java.lang.String>
specialOptions
The special client options that must be processed early.private static java.lang.String
SPLASH_DEFAULT
private static java.io.InputStream
splashStream
A stream to get the splash image from.private static boolean
standAloneServer
private static java.lang.String
tc
The TotalConversion / ruleset in play, defaults to "freecol".private static java.lang.String
TC_DEFAULT
private static long
timeout
The time out (seconds) for otherwise blocking commands.static long
TIMEOUT_DEFAULT
static long
TIMEOUT_MAX
static long
TIMEOUT_MIN
private static java.awt.Dimension
windowSize
The size of window to create, defaults to impossible dimensions to require windowed mode with best determined screen size.private static java.awt.Dimension
WINDOWSIZE_FALLBACK
-
Constructor Summary
Constructors Modifier Constructor Description private
FreeCol()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringTemplate
badFile(java.lang.String messageId, java.io.File file)
Generate a failure message depending on a file parameter.private static void
checkServerIntegrity(FreeColServer freeColServer)
Check the integrity of a FreeCol server.private static SplashScreen
createSplashScreen()
static StringTemplate
errorFromException(java.lang.Exception ex, java.lang.String fallbackKey)
Build an error template from an exception.static StringTemplate
errorFromException(java.lang.Exception ex, StringTemplate fallback)
Build an error template from an exception.private static void
fatal(java.lang.String err)
Exit printing fatal error message.static void
fatal(java.util.logging.Logger logger, java.lang.String err)
Quit and exit with an error.private static void
fatal(StringTemplate template)
Exit printing fatal error message.private static java.lang.String
findArg(java.lang.String option, java.lang.String[] args)
Find an option before the real option handling can get started.static NationOptions.Advantages
getAdvantages()
Gets the default advantages type.private static java.lang.String
getAdvantagesDescription()
Get a description for the advantages argument.static java.lang.StringBuilder
getConfiguration()
We get a lot of lame bug reports with insufficient configuration information.private static java.lang.String
getDebugDescription()
Get a description for the debug argument.private static java.io.InputStream
getDefaultSplashStream(java.net.JarURLConnection juc)
Get a stream for the default splash file.static java.lang.String
getDifficulty()
Gets the difficulty level.static int
getEuropeanCount()
Get the number of European nations to enable by default.static java.lang.String
getFreeColProtocolVersion()
Gets the current version of the FreeCol protocol.static boolean
getHeadless()
Are we in headless mode, either externally true or explicitly from the command line.private static java.net.JarURLConnection
getJarURLConnection(java.lang.Class c)
Get the JarURLConnection from a class.static java.util.Locale
getLocale()
Get the selected locale.static java.lang.String
getMetaServerAddress()
Get the meta-server address.static int
getMetaServerPort()
Get the meta-server port.static java.lang.String
getName()
Gets the user name.static java.lang.String
getRevision()
Gets the current revision of game.static java.lang.String
getServerHost()
Get the default server host name.static java.net.InetAddress
getServerName()
Gets the server address.static int
getServerPort()
Gets the server network port.static java.lang.String
getTC()
Gets the current Total-Conversion.static FreeColTcFile
getTCFile()
Gets the FreeColTcFile for the current TC.private static Specification
getTCSpecification()
Get the specification from the specified TC.static long
getTimeout(boolean singlePlayer)
Gets the timeout.private static java.lang.String
getValidAdvantages()
Gets a comma separated list of localized advantage type names.static java.lang.String
getValidDifficulties()
Gets the names of the valid difficulty levels.static java.lang.String
getValidGUIScales()
Gets the valid scale factors for the GUI.static java.lang.String
getVersion()
Gets the current version of game.private static void
gripe(java.lang.String key)
Just gripe to System.err.private static void
gripe(StringTemplate template)
Just gripe to System.err.private static void
handleArgs(java.lang.String[] args)
Processes the command-line arguments and takes appropriate actions for each of them.static Specification
loadSpecification(FreeColTcFile tcf, NationOptions.Advantages advantages, java.lang.String difficulty)
Get the specification from a given TC file.static void
main(java.lang.String[] args)
The entrypoint.private static void
printUsage(org.apache.commons.cli.Options options, int status)
Prints the usage message and exits.private static void
processSpecialOptions()
Handle the special options that need to be processed early.static void
quit(int status)
Quit FreeCol.private static java.lang.String
readVersion(java.net.JarURLConnection juc)
Extract the package version from the class.private static NationOptions.Advantages
selectAdvantages(java.lang.String as)
Sets the advantages type.private static java.lang.String
selectDifficulty(java.lang.String arg)
Selects a difficulty level.private static int
selectEuropeanCount(java.lang.String arg)
Selects a European nation count.static void
setAdvantages(NationOptions.Advantages advantages)
Sets the advantages type.static void
setDifficulty(java.lang.String difficulty)
Sets the difficulty level.static void
setDifficulty(OptionGroup difficulty)
Sets the difficulty level.static void
setEuropeanCount(int n)
Sets the number of enabled European nations.static void
setHeadless(boolean newHeadless)
Set the headless state.static boolean
setLocale(java.lang.String localeArg)
Set the locale.private static boolean
setMetaServer(java.lang.String arg)
Set the meta-server location.static void
setName(java.lang.String name)
Sets the user name.private static boolean
setServerAddress(java.lang.String arg)
Sets the server address.private static boolean
setServerPort(java.lang.String arg)
Sets the server port.static void
setTC(java.lang.String tc)
Sets the Total-Conversion.static void
setTimeout(java.lang.String timeout)
Sets the timeout.private static void
setWindowSize(java.lang.String arg)
Sets the window size.private static void
startClient()
Start a client.private static void
startServer()
Start the server.static FreeColClient
startTestClient(Specification spec)
Wrapper for the test suite to start a test client.static void
trace(java.util.logging.Logger logger, java.lang.String warn)
Log a warning with a stack trace.
-
-
-
Field Detail
-
logger
private static final java.util.logging.Logger logger
-
FREECOL_VERSION
private static final java.lang.String FREECOL_VERSION
The FreeCol release version number.- See Also:
- Constant Field Values
-
FREECOL_PROTOCOL_VERSION
private static final java.lang.String FREECOL_PROTOCOL_VERSION
The FreeCol protocol version number.- See Also:
- Constant Field Values
-
DIFFICULTIES
private static final java.lang.String[] DIFFICULTIES
The difficulty levels.
-
FREECOL_SAVE_EXTENSION
public static final java.lang.String FREECOL_SAVE_EXTENSION
The extension for FreeCol saved games.- See Also:
- Constant Field Values
-
FREECOL_MAP_EXTENSION
public static final java.lang.String FREECOL_MAP_EXTENSION
The extension for FreeCol maps.- See Also:
- Constant Field Values
-
JAVA_VERSION
private static final java.lang.String JAVA_VERSION
The Java version.
-
MEMORY_MAX
private static final long MEMORY_MAX
The maximum available memory.
-
MEGA
private static final long MEGA
- See Also:
- Constant Field Values
-
CLIENT_THREAD
public static final java.lang.String CLIENT_THREAD
- See Also:
- Constant Field Values
-
SERVER_THREAD
public static final java.lang.String SERVER_THREAD
- See Also:
- Constant Field Values
-
METASERVER_THREAD
public static final java.lang.String METASERVER_THREAD
- See Also:
- Constant Field Values
-
freeColRevision
private static java.lang.String freeColRevision
Specific revision number (currently the git tag of trunk at release)
-
locale
private static java.util.Locale locale
The locale, either default or command-line specified.
-
ADVANTAGES_DEFAULT
private static final NationOptions.Advantages ADVANTAGES_DEFAULT
-
DIFFICULTY_DEFAULT
private static final java.lang.String DIFFICULTY_DEFAULT
- See Also:
- Constant Field Values
-
EUROPEANS_DEFAULT
private static final int EUROPEANS_DEFAULT
- See Also:
- Constant Field Values
-
EUROPEANS_MIN
private static final int EUROPEANS_MIN
- See Also:
- Constant Field Values
-
GUI_SCALE_DEFAULT
public static final float GUI_SCALE_DEFAULT
- See Also:
- Constant Field Values
-
GUI_SCALE_MIN_PCT
private static final int GUI_SCALE_MIN_PCT
- See Also:
- Constant Field Values
-
GUI_SCALE_MAX_PCT
private static final int GUI_SCALE_MAX_PCT
- See Also:
- Constant Field Values
-
GUI_SCALE_MIN
public static final float GUI_SCALE_MIN
- See Also:
- Constant Field Values
-
GUI_SCALE_MAX
public static final float GUI_SCALE_MAX
- See Also:
- Constant Field Values
-
GUI_SCALE_STEP_PCT
private static final int GUI_SCALE_STEP_PCT
- See Also:
- Constant Field Values
-
GUI_SCALE_STEP
public static final float GUI_SCALE_STEP
- See Also:
- Constant Field Values
-
LOGLEVEL_DEFAULT
private static final java.util.logging.Level LOGLEVEL_DEFAULT
-
JAVA_VERSION_MIN
private static final java.lang.String JAVA_VERSION_MIN
- See Also:
- Constant Field Values
-
MEMORY_MIN
private static final long MEMORY_MIN
- See Also:
- Constant Field Values
-
META_SERVER_ADDRESS
private static final java.lang.String META_SERVER_ADDRESS
- See Also:
- Constant Field Values
-
META_SERVER_PORT
private static final int META_SERVER_PORT
- See Also:
- Constant Field Values
-
PORT_DEFAULT
private static final int PORT_DEFAULT
- See Also:
- Constant Field Values
-
SPLASH_DEFAULT
private static final java.lang.String SPLASH_DEFAULT
- See Also:
- Constant Field Values
-
TC_DEFAULT
private static final java.lang.String TC_DEFAULT
- See Also:
- Constant Field Values
-
TIMEOUT_DEFAULT
public static final long TIMEOUT_DEFAULT
- See Also:
- Constant Field Values
-
TIMEOUT_MIN
public static final long TIMEOUT_MIN
- See Also:
- Constant Field Values
-
TIMEOUT_MAX
public static final long TIMEOUT_MAX
- See Also:
- Constant Field Values
-
WINDOWSIZE_FALLBACK
private static final java.awt.Dimension WINDOWSIZE_FALLBACK
-
checkIntegrity
private static boolean checkIntegrity
-
consoleLogging
private static boolean consoleLogging
-
debugStart
private static boolean debugStart
-
fastStart
private static boolean fastStart
-
headless
private static boolean headless
-
introVideo
private static boolean introVideo
-
javaCheck
private static boolean javaCheck
-
memoryCheck
private static boolean memoryCheck
-
publicServer
private static boolean publicServer
-
sound
private static boolean sound
-
standAloneServer
private static boolean standAloneServer
-
advantages
private static NationOptions.Advantages advantages
The type of advantages.
-
difficulty
private static java.lang.String difficulty
The difficulty level id.
-
europeanCount
private static int europeanCount
The number of European nations to enable by default.
-
fontName
private static java.lang.String fontName
A font override.
-
logLevels
private static final java.util.List<FreeCol.LogLevel> logLevels
-
metaServerAddress
private static java.lang.String metaServerAddress
Meta-server location.
-
metaServerPort
private static int metaServerPort
-
name
private static java.lang.String name
The client player name.
-
serverAddress
private static java.net.InetAddress serverAddress
How to name and configure the server.
-
serverPort
private static int serverPort
-
serverName
private static java.lang.String serverName
-
splashStream
private static java.io.InputStream splashStream
A stream to get the splash image from.
-
tc
private static java.lang.String tc
The TotalConversion / ruleset in play, defaults to "freecol".
-
timeout
private static long timeout
The time out (seconds) for otherwise blocking commands.
-
windowSize
private static java.awt.Dimension windowSize
The size of window to create, defaults to impossible dimensions to require windowed mode with best determined screen size.
-
specialOptions
private static java.util.Map<java.lang.String,java.lang.String> specialOptions
The special client options that must be processed early.
-
argDir
private static java.lang.String argDir
Definitions for all the options.
-
argFile
private static java.lang.String argFile
-
optionsTable
private static java.lang.String[][] optionsTable
-
-
Method Detail
-
main
public static void main(java.lang.String[] args)
The entrypoint.- Parameters:
args
- The command-line arguments.
-
processSpecialOptions
private static void processSpecialOptions()
Handle the special options that need to be processed early.
-
getJarURLConnection
private static java.net.JarURLConnection getJarURLConnection(java.lang.Class c) throws java.io.IOException
Get the JarURLConnection from a class.- Parameters:
c
- TheClass
to get the connection for.- Returns:
- The
JarURLConnection
. - Throws:
java.io.IOException
- if the connection fails to open.
-
readVersion
private static java.lang.String readVersion(java.net.JarURLConnection juc) throws java.io.IOException
Extract the package version from the class.- Parameters:
juc
- TheJarURLConnection
to extract from.- Returns:
- A value of the package version attribute.
- Throws:
java.io.IOException
- if the manifest is not available.
-
getDefaultSplashStream
private static java.io.InputStream getDefaultSplashStream(java.net.JarURLConnection juc) throws java.io.IOException
Get a stream for the default splash file. Note: Not bothering to check for nulls as this is called in try block that ignores all exceptions.- Parameters:
juc
- TheJarURLConnection
to extract from.- Returns:
- A suitable
InputStream
, or null on error. - Throws:
java.io.IOException
- if the connection fails to open.
-
quit
public static void quit(int status)
Quit FreeCol. Route all exits through here.- Parameters:
status
- Exit status.
-
fatal
public static void fatal(java.util.logging.Logger logger, java.lang.String err)
Quit and exit with an error.- Parameters:
logger
- An optionalLogger
to log to.err
- The error message.
-
fatal
private static void fatal(StringTemplate template)
Exit printing fatal error message.- Parameters:
template
- AStringTemplate
to print.
-
fatal
private static void fatal(java.lang.String err)
Exit printing fatal error message.- Parameters:
err
- The error message to print.
-
gripe
private static void gripe(StringTemplate template)
Just gripe to System.err.- Parameters:
template
- AStringTemplate
to print.
-
gripe
private static void gripe(java.lang.String key)
Just gripe to System.err.- Parameters:
key
- A message key.
-
trace
public static void trace(java.util.logging.Logger logger, java.lang.String warn)
Log a warning with a stack trace.- Parameters:
logger
- TheLogger
to log to.warn
- The warning message.
-
findArg
private static java.lang.String findArg(java.lang.String option, java.lang.String[] args)
Find an option before the real option handling can get started. Takes care to use the *last* instance.- Parameters:
option
- The option to find.args
- The command-line arguments.- Returns:
- The option's parameter.
-
handleArgs
private static void handleArgs(java.lang.String[] args)
Processes the command-line arguments and takes appropriate actions for each of them.- Parameters:
args
- The command-line arguments.
-
printUsage
private static void printUsage(org.apache.commons.cli.Options options, int status)
Prints the usage message and exits.- Parameters:
options
- The command lineOptions
.status
- The status to exit with.
-
loadSpecification
public static Specification loadSpecification(FreeColTcFile tcf, NationOptions.Advantages advantages, java.lang.String difficulty)
Get the specification from a given TC file.- Parameters:
tcf
- TheFreeColTcFile
to load.advantages
- An optionalAdvantages
setting.difficulty
- An optional difficulty level.- Returns:
- A
Specification
.
-
getTCSpecification
private static Specification getTCSpecification()
Get the specification from the specified TC.- Returns:
- A
Specification
, quits on error.
-
getHeadless
public static boolean getHeadless()
Are we in headless mode, either externally true or explicitly from the command line.- Returns:
- True if in headless mode.
-
setHeadless
public static void setHeadless(boolean newHeadless)
Set the headless state. Used by the test suite.- Parameters:
newHeadless
- The new headless state.
-
getAdvantages
public static NationOptions.Advantages getAdvantages()
Gets the default advantages type.- Returns:
- Usually Advantages.SELECTABLE, but can be overridden at the command line.
-
selectAdvantages
private static NationOptions.Advantages selectAdvantages(java.lang.String as)
Sets the advantages type. Called from NewPanel when a selection is made.- Parameters:
as
- The name of the new advantages type.- Returns:
- The type of advantages set, or null if none.
-
setAdvantages
public static void setAdvantages(NationOptions.Advantages advantages)
Sets the advantages type.- Parameters:
advantages
- The newAdvantages
type.
-
getValidAdvantages
private static java.lang.String getValidAdvantages()
Gets a comma separated list of localized advantage type names.- Returns:
- A list of advantage types.
-
getAdvantagesDescription
private static java.lang.String getAdvantagesDescription()
Get a description for the advantages argument.- Returns:
- A suitable description.
-
getDebugDescription
private static java.lang.String getDebugDescription()
Get a description for the debug argument.- Returns:
- A suitable description.
-
getDifficulty
public static java.lang.String getDifficulty()
Gets the difficulty level.- Returns:
- The name of a difficulty level.
-
selectDifficulty
private static java.lang.String selectDifficulty(java.lang.String arg)
Selects a difficulty level.- Parameters:
arg
- The supplied difficulty argument.- Returns:
- The name of the selected difficulty, or null if none.
-
setDifficulty
public static void setDifficulty(OptionGroup difficulty)
Sets the difficulty level.- Parameters:
difficulty
- The actualOptionGroup
containing the difficulty level.
-
setDifficulty
public static void setDifficulty(java.lang.String difficulty)
Sets the difficulty level.- Parameters:
difficulty
- The new difficulty.
-
getValidDifficulties
public static java.lang.String getValidDifficulties()
Gets the names of the valid difficulty levels.- Returns:
- The valid difficulty levels, comma separated.
-
getEuropeanCount
public static int getEuropeanCount()
Get the number of European nations to enable by default.- Returns:
- The default European nation count.
-
setEuropeanCount
public static void setEuropeanCount(int n)
Sets the number of enabled European nations.- Parameters:
n
- The number of nations to enable.
-
getValidGUIScales
public static java.lang.String getValidGUIScales()
Gets the valid scale factors for the GUI.- Returns:
- A string containing these.
-
selectEuropeanCount
private static int selectEuropeanCount(java.lang.String arg)
Selects a European nation count.- Parameters:
arg
- The supplied count argument.- Returns:
- A valid nation number, or negative on error.
-
getMetaServerAddress
public static java.lang.String getMetaServerAddress()
Get the meta-server address.- Returns:
- The current meta-server address.
-
getMetaServerPort
public static int getMetaServerPort()
Get the meta-server port.- Returns:
- The current meta-server port.
-
setMetaServer
private static boolean setMetaServer(java.lang.String arg)
Set the meta-server location.- Parameters:
arg
- The new meta-server location in HOST:PORT format.- Returns:
- True if the location was set.
-
getName
public static java.lang.String getName()
Gets the user name.- Returns:
- The user name, defaults to the user.name property, then to the "main.defaultPlayerName" message value.
-
setName
public static void setName(java.lang.String name)
Sets the user name.- Parameters:
name
- The new user name.
-
getLocale
public static java.util.Locale getLocale()
Get the selected locale.- Returns:
- The
Locale
currently in use.
-
setLocale
public static boolean setLocale(java.lang.String localeArg)
Set the locale. Public for the test suite.- Parameters:
localeArg
- The locale specification, null implies the default locale.- Returns:
- True if the
Locale
changed.
-
getRevision
public static java.lang.String getRevision()
Gets the current revision of game.- Returns:
- The current version and SVN Revision of the game.
-
getServerHost
public static java.lang.String getServerHost()
Get the default server host name.- Returns:
- The host name.
-
getServerPort
public static int getServerPort()
Gets the server network port.- Returns:
- The port number the server will be listening on.
-
getServerName
public static java.net.InetAddress getServerName()
Gets the server address.- Returns:
- The
InetAddress
the server will be listening on.
-
setServerPort
private static boolean setServerPort(java.lang.String arg)
Sets the server port.- Parameters:
arg
- The server port number.- Returns:
- True if the port was set.
-
setServerAddress
private static boolean setServerAddress(java.lang.String arg)
Sets the server address.- Parameters:
arg
- The server address.- Returns:
- True if the address was set.
-
getTC
public static java.lang.String getTC()
Gets the current Total-Conversion.- Returns:
- Usually TC_DEFAULT, but can be overridden at the command line.
-
setTC
public static void setTC(java.lang.String tc)
Sets the Total-Conversion. Called from NewPanel when a selection is made.- Parameters:
tc
- The name of the new total conversion.
-
getTCFile
public static FreeColTcFile getTCFile()
Gets the FreeColTcFile for the current TC.- Returns:
- The
FreeColTcFile
.
-
getTimeout
public static long getTimeout(boolean singlePlayer)
Gets the timeout. Use the command line specified one if any, otherwise default to `infinite' in single player and the TIMEOUT_DEFAULT for multiplayer.- Parameters:
singlePlayer
- True if this is a single player game.- Returns:
- A suitable timeout value.
-
setTimeout
public static void setTimeout(java.lang.String timeout)
Sets the timeout.- Parameters:
timeout
- A string containing the new timeout.
-
getVersion
public static java.lang.String getVersion()
Gets the current version of game.- Returns:
- The current version of the game using the format "x.y.z", where "x" is major, "y" is minor and "z" is revision.
-
getFreeColProtocolVersion
public static java.lang.String getFreeColProtocolVersion()
Gets the current version of the FreeCol protocol.- Returns:
- The version of the FreeCol protocol.
-
setWindowSize
private static void setWindowSize(java.lang.String arg)
Sets the window size. Does not fail because any empty or invalid value is interpreted as `windowed but use as much screen as possible'.- Parameters:
arg
- The window size specification.
-
badFile
public static StringTemplate badFile(java.lang.String messageId, java.io.File file)
Generate a failure message depending on a file parameter.- Parameters:
messageId
- The failure message identifier.file
- TheFile
that caused the failure.- Returns:
- A
StringTemplate
with the error message.
-
errorFromException
public static StringTemplate errorFromException(java.lang.Exception ex, java.lang.String fallbackKey)
Build an error template from an exception.- Parameters:
ex
- TheException
to make an error from.fallbackKey
- A message key to use to make a fallback message if the exception is unsuitable.- Returns:
- An error
StringTemplate
.
-
errorFromException
public static StringTemplate errorFromException(java.lang.Exception ex, StringTemplate fallback)
Build an error template from an exception.- Parameters:
ex
- TheException
to make an error from.fallback
- AStringTemplate
to use as a fall back if the exception is unsuitable.- Returns:
- An error
StringTemplate
.
-
getConfiguration
public static java.lang.StringBuilder getConfiguration()
We get a lot of lame bug reports with insufficient configuration information. Get a buffer containing as much information as we can to embed in the log file and saved games.- Returns:
- A
StringBuilder
full of configuration information.
-
startClient
private static void startClient()
Start a client.
-
createSplashScreen
private static SplashScreen createSplashScreen()
-
startTestClient
public static FreeColClient startTestClient(Specification spec)
Wrapper for the test suite to start a test client.- Parameters:
spec
- TheSpecification
to use in the new client.- Returns:
- The new
FreeColClient
.
-
checkServerIntegrity
private static void checkServerIntegrity(FreeColServer freeColServer)
Check the integrity of a FreeCol server.- Parameters:
freeColServer
- The server to check.
-
startServer
private static void startServer()
Start the server.
-
-