Skip to content
Snippets Groups Projects
Commit 7325dae4 authored by felmer's avatar felmer
Browse files

change getDatabaseVersion(): Returns argument if attribute does not start with a number.

SVN: 2371
parent 508e7fcb
No related branches found
No related tags found
No related merge requests found
......@@ -135,14 +135,14 @@ public class DatabaseConfigurationContext
}
/**
* Returns the database version which should be used. If not set by {@link #setDatabaseVersion(String)}
* <code>defaultDatabaseVersion</code> will be returned.
* Returns the database version which should be used. If not set by {@link #setDatabaseVersion(String)} or
* does not start with a digit <code>defaultDatabaseVersion</code> will be returned.
*
* @throws ConfigurationFailureException if the database version is beyound the default one.
*/
public final String getDatabaseVersion(String defaultDatabaseVersion)
{
if (databaseVersion == null)
if (isValidDatabaseVersion(databaseVersion) == false)
{
return defaultDatabaseVersion;
}
......@@ -153,6 +153,11 @@ public class DatabaseConfigurationContext
}
return databaseVersion;
}
private boolean isValidDatabaseVersion(String version)
{
return version != null && version.length() > 0 && Character.isDigit(version.charAt(0));
}
public final void setDatabaseVersion(String databaseVersion)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment