Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
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
  • Loading branch information
pesse authored and Samuel Nitsche committed Nov 10, 2017
commit 5401f35cc3c70a8cf2f21e5fe25f42751a46c449
4 changes: 4 additions & 0 deletions .travis/create_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ VERSION=`date +%Y%m%d%H%M`

mkdir dist
mv target/appassembler utPLSQL-cli
# Remove Oracle libraries du to licensing problems
rm utPLSQL-cli/lib/ojdbc8*
rm utPLSQL-cli/lib/orai18n*

zip -r -q dist/utPLSQL-cli-${TRAVIS_BRANCH}-${VERSION}.zip utPLSQL-cli

cat > bintray.json <<EOF
Expand Down
39 changes: 39 additions & 0 deletions src/main/java/org/utplsql/cli/OracleLibraryChecker.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package org.utplsql.cli;

/** Simple class to check whether needed Oracle libraries are on classpath or not
*
* @author pesse
*/
class OracleLibraryChecker {

private static boolean classExists( String classFullName ){
try
{
Class.forName(classFullName);

return true;
}
catch ( ClassNotFoundException e )
{
return false;
}
}

/** Checks if OJDBC library is on the classpath by searching for oracle.jdbc.OracleDriver class
*
* @return true or false
*/
public static boolean checkOjdbcExists() {
return classExists("oracle.jdbc.OracleDriver");
}

/** Checks if Orai18n library is on the classpath by searching for oracle.i18n.text.OraCharset
*
* @return true or false
*/
public static boolean checkOrai18nExists() {
return classExists("oracle.i18n.text.OraCharset");
}


}
26 changes: 26 additions & 0 deletions src/main/java/org/utplsql/cli/RunCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ public List<String> getTestPaths() {
}

public int run() throws Exception {

checkOracleLibrariesExist();

final ConnectionInfo ci = getConnectionInfo();

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


/** Checks that necessary oracle libraries exist
*
*/
private void checkOracleLibrariesExist()
{
if ( !OracleLibraryChecker.checkOjdbcExists() )
{
System.out.println("Could not find Oracle JDBC driver in classpath. Please download the jar from Oracle website" +
" and copy it to the 'lib' folder of your utPLSQL-cli installation.");
System.out.println("Download from http://www.oracle.com/technetwork/database/features/jdbc/jdbc-ucp-122-3110062.html");

throw new RuntimeException("Can't run utPLSQL-cli without Oracle JDBC driver");
}

if ( !OracleLibraryChecker.checkOrai18nExists() )
{
System.out.println("Warning: Could not find Oracle i18n driver in classpath. Depending on your database " +
"version (11g) and used charset utPLSQL-cli might not run properly. It is recommended you download " +
"the i18n driver from the Oracle website and copy it to the 'lib' folder of your utPLSQL-cli installation.");
System.out.println("Download from http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-112010-090769.html");
}
}
}