diff options
author | Noel Grandin <noel@peralex.com> | 2014-12-11 16:25:29 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2014-12-12 08:16:17 +0000 |
commit | 117a82cd090ddd8efbc500350dc6082730f04720 (patch) | |
tree | 50c07684d43c06fd54d17532caca6a3afafd6967 /qadevOOo/runner/convwatch/DB.java | |
parent | 04b183a9bc792a53a9f081353a79486faa4f3872 (diff) |
java: remove dead code in qadevOOo
found by running UCDetector over the code many times, like peeling
an onion
Change-Id: I54d5147eb1b5c921ad236331bc4c1f765b13ca83
Reviewed-on: https://gerrit.libreoffice.org/13445
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'qadevOOo/runner/convwatch/DB.java')
-rw-r--r-- | qadevOOo/runner/convwatch/DB.java | 254 |
1 files changed, 0 insertions, 254 deletions
diff --git a/qadevOOo/runner/convwatch/DB.java b/qadevOOo/runner/convwatch/DB.java index 8b4c4ff006cf..a9b2f70763c2 100644 --- a/qadevOOo/runner/convwatch/DB.java +++ b/qadevOOo/runner/convwatch/DB.java @@ -20,7 +20,6 @@ package convwatch; import java.sql.Connection; import java.util.StringTokenizer; -import java.util.ArrayList; import helper.OSHelper; public class DB extends DBHelper @@ -54,70 +53,6 @@ public class DB extends DBHelper getDB().updatestate_status("source started"); } - public static void test() - { - getDB().sql_test(); - } - - public static void source_start() - { - getDB().updatestate_status("source started"); - } - - public static void source_finished() - { - getDB().updatestate_status( "source finished"); - } - - public static void source_failed(String _sMessage) - { - getDB().updatestate_status("source failed"); - getDB().updateinfo_status(_sMessage); - } - - public static void destination_start() - { - getDB().updatestate_status("destination started"); - } - - public static void destination_finished() - { - getDB().updatestate_status("PASSED-OK"); - } - - public static void destination_failed(String _sStatus, String _sMessage) - { - getDB().updatestate_status(_sStatus); - getDB().updateinfo_status(_sMessage); - } - public static void writeNumberOfPages(int _nPages) - { - getDB().updatepagecount_documents(_nPages); - } - public static void writeErrorFile(String _sErrorFile) - { - getDB().updateerrorfile_status(_sErrorFile); - } - public static void writeHTMLFile(String _sHTMLFile) - { - getDB().updatehtmlfile_status(_sHTMLFile); - } - - public static void writeToDB(String _sFilename, - String _sBasename, - String _sFileFormat, - String _sBuildID, - String _sSourceType, - int _nResolution ) - { - GlobalLogWriter.get().println("DB: Filename:" + _sFilename); - GlobalLogWriter.get().println("DB: Basename:" + _sBasename); - GlobalLogWriter.get().println("DB: FileFormat:" + _sFileFormat); - GlobalLogWriter.get().println("DB: BuildID:" + _sBuildID); - GlobalLogWriter.get().println("DB: SourceType:" + _sSourceType); - GlobalLogWriter.get().println("DB: Resolution:" + _nResolution); - } - private String getEnvironment() { if (OSHelper.isWindows()) @@ -203,86 +138,6 @@ public class DB extends DBHelper } } - private void sql_test() - { - String sUUID = getDBDistinct(); - System.out.println("UUID: " + sUUID); - } - - private ArrayList<String> QuerySQL(Connection _aCon, String _sSQL) - { - java.sql.Statement oStmt = null; - ArrayList<String> aResultList = new ArrayList<String>(); - try - { - try - { - oStmt = _aCon.createStatement(); - java.sql.ResultSet aResultSet = null; - try - { - aResultSet = oStmt.executeQuery(_sSQL); - java.sql.ResultSetMetaData aResultSetMetaData = aResultSet.getMetaData(); - - int nColumnCount = aResultSetMetaData.getColumnCount(); // java sql starts with '1' - - while( aResultSet.next() ) - { - StringBuffer aResult = new StringBuffer(); - try - { - aResult.append("sqlresult: "); - for (int i=1;i<=nColumnCount;i++) - { - String sColumnName = aResultSetMetaData.getColumnName(i); - aResult.append(sColumnName).append("="); - String sValue; - int nSQLType = aResultSetMetaData.getColumnType(i); - switch(nSQLType) - { - case java.sql.Types.VARCHAR: - sValue = "'" + aResultSet.getString(i) + "'"; - break; - case java.sql.Types.INTEGER: - { - int nValue = aResultSet.getInt(i); - sValue = String.valueOf(nValue); - break; - } - - default: - sValue = "UNSUPPORTED TYPE"; - } - aResult.append(sValue).append(", "); - } - String sResult = aResult.toString(); - aResultList.add(sResult); - } - catch (java.sql.SQLException e) - { - } - } - } - finally - { - if (aResultSet != null) - aResultSet.close(); - } - } - finally - { - if (oStmt != null) - oStmt.close(); - } - } - catch (java.sql.SQLException e) - { - String sError = e.getMessage(); - GlobalLogWriter.get().println("DB: Original SQL error: " + sError); - } - return aResultList; - } - private void updatestate_status(String _sStatus) { Connection aCon = new ShareConnection().getConnection(); @@ -294,43 +149,6 @@ public class DB extends DBHelper SQLupdateValue( aCon, "status", sSet, sWhere ); } } - private void updateinfo_status(String _sInfo) - { - Connection aCon = new ShareConnection().getConnection(); - - String sSet = "info=" + Quote(_sInfo); - String sWhere = getWhereClause(); - SQLupdateValue( aCon, "status", sSet, sWhere ); - } - private void updateerrorfile_status(String _sErrorFile) - { - Connection aCon = new ShareConnection().getConnection(); - - String sErrorFile = _sErrorFile.replace('\\', '/'); - - String sSet = "errorfile=" + Quote(sErrorFile); - String sWhere = getWhereClause(); - SQLupdateValue( aCon, "status", sSet, sWhere ); - } - private void updatehtmlfile_status(String _sHtmlFile) - { - Connection aCon = new ShareConnection().getConnection(); - - String sHtmlFile = _sHtmlFile.replace('\\', '/'); - - String sSet = "htmlfile=" + Quote(sHtmlFile); - String sWhere = getWhereClause(); - SQLupdateValue( aCon, "status", sSet, sWhere ); - } - private void updatepagecount_documents(int _nPageCount) - { - Connection aCon = new ShareConnection().getConnection(); - - String sSet = "pagecount=" + _nPageCount; - String sWhere = getWhereClause(); - SQLupdateValue( aCon, "documents", sSet, sWhere ); - - } private String getWhereClause() @@ -353,76 +171,4 @@ public class DB extends DBHelper return aWhereClause.toString(); } - private String getDBDistinct() - { - Connection aCon = new ShareConnection().getConnection(); - - String sSQL = "SELECT uuid()"; - ArrayList<String> aResultList = QuerySQL(aCon, sSQL); - - for (int i=0;i<aResultList.size();i++) - { - String sResult = aResultList.get(i); - - StringTokenizer aTokenizer = new StringTokenizer(sResult,",",false); - if (aTokenizer.hasMoreTokens()) - { - String sToken = aTokenizer.nextToken(); - int nIndex = sToken.indexOf("uuid()="); - int nIndexTuettel = sToken.indexOf('\'', nIndex); - int nIndexTuettel2 = sToken.lastIndexOf('\''); - String sUuid = sToken.substring(nIndexTuettel + 1, nIndexTuettel2); - return sUuid; - } - } - - return "0"; - } - - public static void insertinto_documentcompare(String _sSourceVersion, String _sSourceName, String _sSourceCreatorType, - String _sDestinationVersion, String _sDestinationName, String _sDestinationCreatorType, - String _sDocumentPoolDir, String _sDocumentPoolName, String _sMailAddress, - String _sSpecial, String _sParentDistinct) - { - getDB().insertinto_documentcompare_impl( _sSourceVersion, _sSourceName, _sSourceCreatorType, - _sDestinationVersion, _sDestinationName, _sDestinationCreatorType, - _sDocumentPoolDir, _sDocumentPoolName, _sMailAddress, - _sSpecial, _sParentDistinct); - } - - private void insertinto_documentcompare_impl(String _sSourceVersion, String _sSourceName, String _sSourceCreatorType, - String _sDestinationVersion, String _sDestinationName, String _sDestinationCreatorType, - String _sDocumentPoolDir, String _sDocumentPoolName, String _sMailAddress, - String _sSpecial, String _sParentDistinct) - { - // $sSQLInsert = "INSERT INTO documentcompare - if (_sParentDistinct == null) - { - _sParentDistinct = ""; - } - - Connection aCon = new ShareConnection().getConnection(); - - String sValueLine="dbdistinct2, environment, sourceversion, sourcename, sourcecreatortype, destinationversion, destinationname, destinationcreatortype, documentpoolpath, documentpool, mailfeedback, state, special, parentdistinct, startdate"; - String sDocumentPoolDir = _sDocumentPoolDir.replace('\\', '/'); - StringBuffer aDataLine = new StringBuffer(); - aDataLine.append( Quote(getDBDistinct()) ) . append( sComma ) . - append( Quote( getEnvironment()) ) . append( sComma ) . - append( Quote( _sSourceVersion) ) . append( sComma ) . - append( Quote( _sSourceName) ) . append( sComma ) . - append( Quote( _sSourceCreatorType ) ) . append( sComma ) . - append( Quote( _sDestinationVersion) ) . append( sComma ) . - append( Quote( _sDestinationName) ) . append( sComma ) . - append( Quote( _sDestinationCreatorType ) ) . append( sComma ) . - append( Quote( sDocumentPoolDir) ) . append( sComma ) . - append( Quote( _sDocumentPoolName) ) . append( sComma ) . - append( Quote( _sMailAddress) ) . append( sComma ) . - append( Quote( "new" )) . append ( sComma ) . - append( Quote( _sSpecial ) ) . append( sComma ) . - append( Quote( _sParentDistinct ) ) . append( sComma ) . - append( Quote( today() )); - - SQLinsertValues(aCon, "documentcompare", sValueLine, aDataLine.toString()); - } - } |