Skip to content

Commit 8f4e2e0

Browse files
pesseSamuel Nitsche
authored andcommitted
Fix problem with compatibility in 3.0.2
1 parent a67ace4 commit 8f4e2e0

File tree

2 files changed

+42
-5
lines changed

2 files changed

+42
-5
lines changed

src/main/java/org/utplsql/api/Version.java

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,14 @@ public int compareTo(Version o) {
133133
return 0;
134134
}
135135

136+
private void versionsAreValid( Version v ) throws InvalidVersionException {
137+
if ( !isValid() )
138+
throw new InvalidVersionException(this);
139+
140+
if ( !v.isValid() )
141+
throw new InvalidVersionException(v);
142+
}
143+
136144
/** Compares this version to a given version and returns true if this version is greater or equal than the given one
137145
* Throws an InvalidVersionException if either this or the given version are invalid
138146
*
@@ -141,15 +149,44 @@ public int compareTo(Version o) {
141149
* @throws InvalidVersionException
142150
*/
143151
public boolean isGreaterOrEqualThan( Version v ) throws InvalidVersionException {
144-
if ( !isValid() )
145-
throw new InvalidVersionException(this);
146152

147-
if ( !v.isValid() )
148-
throw new InvalidVersionException(v);
153+
versionsAreValid(v);
149154

150155
if ( compareTo(v) >= 0 )
151156
return true;
152157
else
153158
return false;
154159
}
160+
161+
162+
public boolean isGreaterThan( Version v) throws InvalidVersionException
163+
{
164+
versionsAreValid(v);
165+
166+
if ( compareTo(v) > 0 )
167+
return true;
168+
else
169+
return false;
170+
}
171+
172+
public boolean isLessOrEqualThan( Version v ) throws InvalidVersionException
173+
{
174+
175+
versionsAreValid(v);
176+
177+
if ( compareTo(v) <= 0 )
178+
return true;
179+
else
180+
return false;
181+
}
182+
183+
public boolean isLessThan( Version v) throws InvalidVersionException
184+
{
185+
versionsAreValid(v);
186+
187+
if ( compareTo(v) < 0 )
188+
return true;
189+
else
190+
return false;
191+
}
155192
}

src/main/java/org/utplsql/api/testRunner/TestRunnerStatementProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public static TestRunnerStatement getCompatibleTestRunnerStatement(Version datab
2727
AbstractTestRunnerStatement stmt = null;
2828

2929
try {
30-
if (new Version("3.0.2").isGreaterOrEqualThan(databaseVersion))
30+
if (databaseVersion.isLessThan(new Version("3.0.3")))
3131
stmt = new Pre303TestRunnerStatement(options, conn);
3232

3333
} catch ( InvalidVersionException e ) {}

0 commit comments

Comments
 (0)