Skip to content

Fix problem with compatibility in 3.0.2 #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 41 additions & 4 deletions src/main/java/org/utplsql/api/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ public int compareTo(Version o) {
return 0;
}

private void versionsAreValid( Version v ) throws InvalidVersionException {
if ( !isValid() )
throw new InvalidVersionException(this);

if ( !v.isValid() )
throw new InvalidVersionException(v);
}

/** Compares this version to a given version and returns true if this version is greater or equal than the given one
* Throws an InvalidVersionException if either this or the given version are invalid
*
Expand All @@ -141,15 +149,44 @@ public int compareTo(Version o) {
* @throws InvalidVersionException
*/
public boolean isGreaterOrEqualThan( Version v ) throws InvalidVersionException {
if ( !isValid() )
throw new InvalidVersionException(this);

if ( !v.isValid() )
throw new InvalidVersionException(v);
versionsAreValid(v);

if ( compareTo(v) >= 0 )
return true;
else
return false;
}


public boolean isGreaterThan( Version v) throws InvalidVersionException
{
versionsAreValid(v);

if ( compareTo(v) > 0 )
return true;
else
return false;
}

public boolean isLessOrEqualThan( Version v ) throws InvalidVersionException
{

versionsAreValid(v);

if ( compareTo(v) <= 0 )
return true;
else
return false;
}

public boolean isLessThan( Version v) throws InvalidVersionException
{
versionsAreValid(v);

if ( compareTo(v) < 0 )
return true;
else
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static TestRunnerStatement getCompatibleTestRunnerStatement(Version datab
AbstractTestRunnerStatement stmt = null;

try {
if (new Version("3.0.2").isGreaterOrEqualThan(databaseVersion))
if (databaseVersion.isLessThan(new Version("3.0.3")))
stmt = new Pre303TestRunnerStatement(options, conn);

} catch ( InvalidVersionException e ) {}
Expand Down