Skip to content

Commit 5401f35

Browse files
pesseSamuel Nitsche
authored andcommitted
Removed Oracle libaries from release
Included check for specific classes. Needs some refactoring for we only want to check for orai18n when database is 11g
1 parent 088b130 commit 5401f35

File tree

3 files changed

+69
-0
lines changed

3 files changed

+69
-0
lines changed

.travis/create_release.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ VERSION=`date +%Y%m%d%H%M`
55

66
mkdir dist
77
mv target/appassembler utPLSQL-cli
8+
# Remove Oracle libraries du to licensing problems
9+
rm utPLSQL-cli/lib/ojdbc8*
10+
rm utPLSQL-cli/lib/orai18n*
11+
812
zip -r -q dist/utPLSQL-cli-${TRAVIS_BRANCH}-${VERSION}.zip utPLSQL-cli
913

1014
cat > bintray.json <<EOF
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package org.utplsql.cli;
2+
3+
/** Simple class to check whether needed Oracle libraries are on classpath or not
4+
*
5+
* @author pesse
6+
*/
7+
class OracleLibraryChecker {
8+
9+
private static boolean classExists( String classFullName ){
10+
try
11+
{
12+
Class.forName(classFullName);
13+
14+
return true;
15+
}
16+
catch ( ClassNotFoundException e )
17+
{
18+
return false;
19+
}
20+
}
21+
22+
/** Checks if OJDBC library is on the classpath by searching for oracle.jdbc.OracleDriver class
23+
*
24+
* @return true or false
25+
*/
26+
public static boolean checkOjdbcExists() {
27+
return classExists("oracle.jdbc.OracleDriver");
28+
}
29+
30+
/** Checks if Orai18n library is on the classpath by searching for oracle.i18n.text.OraCharset
31+
*
32+
* @return true or false
33+
*/
34+
public static boolean checkOrai18nExists() {
35+
return classExists("oracle.i18n.text.OraCharset");
36+
}
37+
38+
39+
}

src/main/java/org/utplsql/cli/RunCommand.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ public List<String> getTestPaths() {
7878
}
7979

8080
public int run() throws Exception {
81+
82+
checkOracleLibrariesExist();
83+
8184
final ConnectionInfo ci = getConnectionInfo();
8285

8386
final List<ReporterOptions> reporterOptionsList = getReporterOptionsList();
@@ -246,4 +249,27 @@ public FileMapperOptions getMapperOptions(List<String> mappingParams, List<Strin
246249
return mapperOptions;
247250
}
248251

252+
253+
/** Checks that necessary oracle libraries exist
254+
*
255+
*/
256+
private void checkOracleLibrariesExist()
257+
{
258+
if ( !OracleLibraryChecker.checkOjdbcExists() )
259+
{
260+
System.out.println("Could not find Oracle JDBC driver in classpath. Please download the jar from Oracle website" +
261+
" and copy it to the 'lib' folder of your utPLSQL-cli installation.");
262+
System.out.println("Download from http://www.oracle.com/technetwork/database/features/jdbc/jdbc-ucp-122-3110062.html");
263+
264+
throw new RuntimeException("Can't run utPLSQL-cli without Oracle JDBC driver");
265+
}
266+
267+
if ( !OracleLibraryChecker.checkOrai18nExists() )
268+
{
269+
System.out.println("Warning: Could not find Oracle i18n driver in classpath. Depending on your database " +
270+
"version (11g) and used charset utPLSQL-cli might not run properly. It is recommended you download " +
271+
"the i18n driver from the Oracle website and copy it to the 'lib' folder of your utPLSQL-cli installation.");
272+
System.out.println("Download from http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-112010-090769.html");
273+
}
274+
}
249275
}

0 commit comments

Comments
 (0)