From fe095dada4e83129d49c8cc50501aa224d61e0f9 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 18 Nov 2014 13:32:37 +0200 Subject: java,qadev: remove unused parameters and local vars MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ifb9f9374051fe88dc4cd5a7a28b2c8c992ced873 Reviewed-on: https://gerrit.libreoffice.org/13097 Tested-by: LibreOffice gerrit bot Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- qadevOOo/runner/convwatch/ConvWatch.java | 5 +- qadevOOo/runner/convwatch/ConvWatchStarter.java | 2 +- .../runner/convwatch/GraphicalTestArguments.java | 2 - qadevOOo/runner/convwatch/HTMLOutputter.java | 294 +++++++++------------ qadevOOo/runner/convwatch/INIOutputter.java | 4 +- qadevOOo/runner/convwatch/IniFile.java | 1 - qadevOOo/runner/util/DBTools.java | 35 --- qadevOOo/runner/util/SysUtils.java | 12 - qadevOOo/runner/util/UITools.java | 28 +- 9 files changed, 133 insertions(+), 250 deletions(-) (limited to 'qadevOOo/runner') diff --git a/qadevOOo/runner/convwatch/ConvWatch.java b/qadevOOo/runner/convwatch/ConvWatch.java index b1591d40ac09..1c4ac3d08e6b 100644 --- a/qadevOOo/runner/convwatch/ConvWatch.java +++ b/qadevOOo/runner/convwatch/ConvWatch.java @@ -157,7 +157,6 @@ public class ConvWatch } PRNCompare a = new PRNCompare(); - String sInputPath = FileHelper.getPath(_sAbsoluteInputFile); String sReferencePath = FileHelper.getPath(_sAbsoluteReferenceFile); a.setReferencePath( sReferencePath ); @@ -203,7 +202,7 @@ public class ConvWatch // Status end String sINIFile = _sFilenamePrefix + sNameNoSuffix + ".ini"; - INIOutputter INIoutput = INIOutputter.create(_sOutputPath, sINIFile, ""); + INIOutputter INIoutput = INIOutputter.create(_sOutputPath, sINIFile); INIoutput.createHeader(); // TODO: version info was fine @@ -265,7 +264,7 @@ public class ConvWatch String sNameNoSuffix = FileHelper.getNameNoSuffix(sBasename); String sINIFile = _sFilenamePrefix + sNameNoSuffix + ".ini"; - INIOutputter INIoutput = INIOutputter.create(_sOutputPath, sINIFile, _sFilenamePrefix); + INIOutputter INIoutput = INIOutputter.create(_sOutputPath, sINIFile); INIoutput.createHeader(); // LLA? what if the are no values in the list? true or false; INIoutput.writeSection("global"); diff --git a/qadevOOo/runner/convwatch/ConvWatchStarter.java b/qadevOOo/runner/convwatch/ConvWatchStarter.java index 9c0616252454..520f85079ca9 100644 --- a/qadevOOo/runner/convwatch/ConvWatchStarter.java +++ b/qadevOOo/runner/convwatch/ConvWatchStarter.java @@ -200,7 +200,7 @@ public class ConvWatchStarter extends EnhancedComplexTestCase sHTMLName = m_sInputPath.substring(n + 1); sHTMLName += ".html"; } - HTMLOutputter HTMLoutput = HTMLOutputter.create(m_sOutputPath, sHTMLName, ""); + HTMLOutputter HTMLoutput = HTMLOutputter.create(m_sOutputPath, sHTMLName); HTMLoutput.header( m_sOutputPath ); HTMLoutput.indexSection( m_sOutputPath ); LISTOutputter LISToutput = LISTOutputter.create(m_sOutputPath, "allfiles.txt"); diff --git a/qadevOOo/runner/convwatch/GraphicalTestArguments.java b/qadevOOo/runner/convwatch/GraphicalTestArguments.java index d5cc3c4f5800..2d35b9669eed 100644 --- a/qadevOOo/runner/convwatch/GraphicalTestArguments.java +++ b/qadevOOo/runner/convwatch/GraphicalTestArguments.java @@ -234,8 +234,6 @@ public class GraphicalTestArguments // m_tWithBorderMove = TriState.UNSET; } - String sLeaveOutNames = (String)param.get(PropertyName.DOC_COMPARATOR_LEAVE_OUT_FILES); - String sDBInfoString = (String)param.get(PropertyName.DOC_COMPARATOR_DB_INFO_STRING); if (sDBInfoString != null) { diff --git a/qadevOOo/runner/convwatch/HTMLOutputter.java b/qadevOOo/runner/convwatch/HTMLOutputter.java index 087101c97576..9f5b650ea757 100644 --- a/qadevOOo/runner/convwatch/HTMLOutputter.java +++ b/qadevOOo/runner/convwatch/HTMLOutputter.java @@ -22,197 +22,157 @@ import java.io.File; import java.io.FileWriter; import helper.OSHelper; -public class HTMLOutputter -{ +public class HTMLOutputter { private FileWriter m_aOut; private String m_sFilename; - private String m_sNamePrefix; // the HTML files used a suffix to build it's right name /** * ls is the current line separator (carridge return) */ private String ls; - HTMLOutputter() {} - public static HTMLOutputter create( String _sOutputPath, String _sHTMLFilename, String _sNamePrefix ) - { - FileHelper.makeDirectories("", _sOutputPath); - HTMLOutputter a = new HTMLOutputter(); - String fs = System.getProperty("file.separator"); - String sFilename = _sOutputPath + fs + _sHTMLFilename; - - try - { - File outputFile = new File(sFilename); - a.m_aOut = new FileWriter(outputFile.toString()); - a.ls = System.getProperty("line.separator"); - } - catch (java.io.IOException e) - { - e.printStackTrace(); - GlobalLogWriter.get().println("ERROR: Can't create HTML Outputter"); - return null; - } - a.m_sFilename = sFilename; - a.m_sNamePrefix = _sNamePrefix; - return a; + HTMLOutputter() { + } + + public static HTMLOutputter create(String _sOutputPath, + String _sHTMLFilename) { + FileHelper.makeDirectories("", _sOutputPath); + HTMLOutputter a = new HTMLOutputter(); + String fs = System.getProperty("file.separator"); + String sFilename = _sOutputPath + fs + _sHTMLFilename; + + try { + File outputFile = new File(sFilename); + a.m_aOut = new FileWriter(outputFile.toString()); + a.ls = System.getProperty("line.separator"); + } catch (java.io.IOException e) { + e.printStackTrace(); + GlobalLogWriter.get().println("ERROR: Can't create HTML Outputter"); + return null; } - public String getFilename() {return m_sFilename;} - - public void header(String _sTitle) - { - try - { - m_aOut.write( "" + ls); - m_aOut.write( "" + ls); - m_aOut.write( "" + _sTitle + "" + ls); - m_aOut.write( "" + ls); - m_aOut.write( "" + ls); - m_aOut.write( "" + ls); - m_aOut.write( "" + ls); - m_aOut.flush(); - } - catch (java.io.IOException e) - { - } + a.m_sFilename = sFilename; + return a; + } + + public String getFilename() { + return m_sFilename; + } + + public void header(String _sTitle) { + try { + m_aOut.write("" + ls); + m_aOut.write("" + ls); + m_aOut.write("" + _sTitle + "" + ls); + m_aOut.write("" + + ls); + m_aOut.write("" + + ls); + m_aOut.write("" + ls); + m_aOut.write("" + ls); + m_aOut.flush(); + } catch (java.io.IOException e) { } + } private final static String TEST_TABLETITLE = "Test"; private final static String VISUAL_STATUS_TABLETITLE = "Visual status"; private final static String VISUAL_STATUS_MESSAGE_TABLETITLE = "Message"; - public void indexSection(String _sOfficeInfo) - { - try - { - m_aOut.write( "

Results for " + _sOfficeInfo + "

" + ls); - m_aOut.write( "

Legend:
"); - m_aOut.write( stronghtml(FIRSTGFX_TABLETITLE) + " contains the output printed via 'ghostscript' as a jpeg picture.
"); - - m_aOut.write( "" + ls); - m_aOut.write( ""); - m_aOut.write( tableHeaderCell(TEST_TABLETITLE)); - m_aOut.write( tableHeaderCell(TEST_TABLETITLE)); - m_aOut.write( tableHeaderCell(VISUAL_STATUS_TABLETITLE)); - m_aOut.write( tableHeaderCell(VISUAL_STATUS_MESSAGE_TABLETITLE)); - m_aOut.write( "" + ls); - m_aOut.flush(); - } - catch (java.io.IOException e) - { - } + public void indexSection(String _sOfficeInfo) { + try { + m_aOut.write("

Results for " + _sOfficeInfo + "

" + ls); + m_aOut.write("

Legend:
"); + m_aOut.write(stronghtml(FIRSTGFX_TABLETITLE) + + " contains the output printed via 'ghostscript' as a jpeg picture.
"); + + m_aOut.write("

" + ls); + m_aOut.write(""); + m_aOut.write(tableHeaderCell(TEST_TABLETITLE)); + m_aOut.write(tableHeaderCell(TEST_TABLETITLE)); + m_aOut.write(tableHeaderCell(VISUAL_STATUS_TABLETITLE)); + m_aOut.write(tableHeaderCell(VISUAL_STATUS_MESSAGE_TABLETITLE)); + m_aOut.write("" + ls); + m_aOut.flush(); + } catch (java.io.IOException e) { } + } + + private String getHREF(String _sHREF, String _sPathInfo) { + StringBuffer a = new StringBuffer(); + if (!OSHelper.isWindows()) { + a.append(""); + a.append(_sPathInfo); + a.append(""); + } else { + // ! this should be replaced by a better method + // ! name(WIN|UNIX) + a.append(""); + a.append(_sPathInfo); + a.append(""); - private String getHREF(String _sHREF, String _sPathInfo) - { - StringBuffer a = new StringBuffer(); - if (! OSHelper.isWindows()) - { - a.append(""); - a.append(_sPathInfo); - a.append(""); - } - else - { - //! this should be replaced by a better method - //! name(WIN|UNIX) - a.append(""); - a.append(_sPathInfo); - a.append(""); - - } - return a.toString(); } + return a.toString(); + } + + private String tableDataCell(String _sValue) { + StringBuffer a = new StringBuffer(); + a.append(""); + return a.toString(); + } + + private String tableHeaderCell(String _sValue) { + StringBuffer a = new StringBuffer(); + a.append(""); + return a.toString(); + } + + public void indexLine(String _sHTMLFile, String _sHTMLName, + String _sHTMLFile2, String _sHTMLName2, String _sStatusRunThrough, + String _sStatusMessage) { + try { + m_aOut.write(""); + m_aOut.write(tableDataCell(getHREF(_sHTMLFile, _sHTMLName))); + if (_sHTMLFile2.length() > 0) { + m_aOut.write(tableDataCell(getHREF(_sHTMLFile2, _sHTMLName2))); + } else { + m_aOut.write(tableDataCell("")); + } - private String tableDataCell(String _sValue) - { - StringBuffer a = new StringBuffer(); - a.append(""); - return a.toString(); - } + m_aOut.write(tableDataCell(_sStatusRunThrough)); + m_aOut.write(tableDataCell(_sStatusMessage)); + m_aOut.write("" + ls); - private String tableHeaderCell(String _sValue) - { - StringBuffer a = new StringBuffer(); - a.append(""); - return a.toString(); - } - - public void indexLine(String _sHTMLFile, String _sHTMLName, String _sHTMLFile2, String _sHTMLName2, String _sStatusRunThrough, String _sStatusMessage) - { - try - { - m_aOut.write( ""); - m_aOut.write(tableDataCell( getHREF(_sHTMLFile, _sHTMLName) ) ); - if (_sHTMLFile2.length() > 0) - { - m_aOut.write(tableDataCell( getHREF(_sHTMLFile2, _sHTMLName2) ) ); - } - else - { - m_aOut.write(tableDataCell( "" ) ); - } - - m_aOut.write( tableDataCell(_sStatusRunThrough) ); - m_aOut.write( tableDataCell(_sStatusMessage) ); - m_aOut.write( "" + ls); - - m_aOut.flush(); - } - catch (java.io.IOException e) - { - } + m_aOut.flush(); + } catch (java.io.IOException e) { } - - public void close() - { - try - { - m_aOut.write( "
"); + a.append(_sValue); + a.append(""); + a.append(_sValue); + a.append("
"); - a.append(_sValue); - a.append("
"); - a.append(_sValue); - a.append("
" + ls); - m_aOut.write( "" + ls); - m_aOut.flush(); - m_aOut.close(); - } - catch (java.io.IOException e) - { - } + } + + public void close() { + try { + m_aOut.write("" + ls); + m_aOut.write("" + ls); + m_aOut.flush(); + m_aOut.close(); + } catch (java.io.IOException e) { } + } - - private String stronghtml(String _sValue) - { - StringBuffer a = new StringBuffer(); - a.append(""); - a.append(_sValue); - a.append(""); - return a.toString(); - } + private String stronghtml(String _sValue) { + StringBuffer a = new StringBuffer(); + a.append(""); + a.append(_sValue); + a.append(""); + return a.toString(); + } private final static String FIRSTGFX_TABLETITLE = "Original print file as jpeg"; - private final static String SECONDGFX_TABLETITLE = "New print file as jpeg"; - private final static String DIFFER_TABLETITLE = "Difference file"; - private final static String STATUS_TABLETITLE = "Status"; - private final static String PIXELDIFF_TABLETITLE = "Pixel difference in %"; - - private final static String PIXELDIFF_BM_TABLETITLE = "P.diff. in % after remove border"; - private final static String DIFFER_BM_TABLETITLE = "Diff file (RB)"; - - private final static String OK_TABLETITLE = "OK?"; - - - - - - - - } diff --git a/qadevOOo/runner/convwatch/INIOutputter.java b/qadevOOo/runner/convwatch/INIOutputter.java index 416519b33ce7..63a6eecd8335 100644 --- a/qadevOOo/runner/convwatch/INIOutputter.java +++ b/qadevOOo/runner/convwatch/INIOutputter.java @@ -28,11 +28,11 @@ public class INIOutputter /** - * ls is the current line separator (carridge return) + * ls is the current line separator (carriage return) */ private String ls; - public static INIOutputter create( String _sOutputPath, String _sHTMLFilename, String _sNamePrefix ) + public static INIOutputter create( String _sOutputPath, String _sHTMLFilename ) { FileHelper.makeDirectories("", _sOutputPath); INIOutputter a = new INIOutputter(); diff --git a/qadevOOo/runner/convwatch/IniFile.java b/qadevOOo/runner/convwatch/IniFile.java index 08e9629883ad..ddab207d1769 100644 --- a/qadevOOo/runner/convwatch/IniFile.java +++ b/qadevOOo/runner/convwatch/IniFile.java @@ -34,7 +34,6 @@ class IniFile */ private final String m_sFilename; private final ArrayList m_aList; - private final boolean m_bListContainUnsavedChanges = false; /** open a ini file by its name diff --git a/qadevOOo/runner/util/DBTools.java b/qadevOOo/runner/util/DBTools.java index 15aa1d926514..e10a896075a3 100644 --- a/qadevOOo/runner/util/DBTools.java +++ b/qadevOOo/runner/util/DBTools.java @@ -79,12 +79,6 @@ public class DBTools { null, null, null} } ; - /** - * Array of lengths of streams for each row in of the - * TST_TABLE_VALUES constants. - */ - private final static int[] TST_STREAM_LENGTHS = {0, 0, 0} ; - /** * It's just a structure with some useful methods for representing * com.sun.star.sdb.DataSource service. All this @@ -143,35 +137,6 @@ public class DBTools { { } - /** - * Creates an instance laying upon specified DataSource. - * @param dataSource All source properties are copied into - * class fields. - */ - private DataSourceInfo(Object dataSource) { - XPropertySet xProps = UnoRuntime.queryInterface(XPropertySet.class, dataSource) ; - - try { - Name = (String)xProps.getPropertyValue("Name") ; - URL = (String)xProps.getPropertyValue("URL") ; - Info = (PropertyValue[])xProps.getPropertyValue("Info") ; - User = (String)xProps.getPropertyValue("User") ; - Password = (String)xProps.getPropertyValue("Password") ; - IsPasswordRequired = (Boolean)xProps.getPropertyValue("IsPasswordRequired") ; - SuppressVersionColumns = (Boolean) - xProps.getPropertyValue("SuppressVersionColumns") ; - IsReadOnly = (Boolean)xProps.getPropertyValue("IsReadOnly") ; - TableFilter = (String[])xProps.getPropertyValue("TableFilter") ; - TableTypeFilter = (String[])xProps.getPropertyValue("TableTypeFilter") ; - } catch (com.sun.star.beans.UnknownPropertyException e) { - System.err.println("util.DBTools.DataSourceInfo: Error retrieving property") ; - e.printStackTrace(System.err) ; - } catch (com.sun.star.lang.WrappedTargetException e) { - System.err.println("util.DBTools.DataSourceInfo: Error retrieving property") ; - e.printStackTrace(System.err) ; - } - } - /** * Creates new com.sun.star.sdb.DataSource service * instance and copies all fields (which are not null) to diff --git a/qadevOOo/runner/util/SysUtils.java b/qadevOOo/runner/util/SysUtils.java index cf4b3b56cf4b..e74716f6861c 100644 --- a/qadevOOo/runner/util/SysUtils.java +++ b/qadevOOo/runner/util/SysUtils.java @@ -18,8 +18,6 @@ package util; -import java.util.ArrayList; - import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.UnoRuntime; import com.sun.star.datatransfer.clipboard.*; @@ -27,16 +25,6 @@ import com.sun.star.datatransfer.*; public class SysUtils { - - - private static ArrayList files = new ArrayList(); - - - - - - - /** * Tries to obtain text data from cliboard if such one exists. * The method iterates through all 'text/plain' supported data diff --git a/qadevOOo/runner/util/UITools.java b/qadevOOo/runner/util/UITools.java index 073b7493dde3..48ed314e0b00 100644 --- a/qadevOOo/runner/util/UITools.java +++ b/qadevOOo/runner/util/UITools.java @@ -28,12 +28,7 @@ import com.sun.star.accessibility.XAccessibleContext; import com.sun.star.accessibility.XAccessibleEditableText; import com.sun.star.accessibility.XAccessibleText; import com.sun.star.accessibility.XAccessibleValue; - import com.sun.star.awt.XWindow; -import com.sun.star.frame.XModel; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.text.XTextDocument; - import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XInterface; @@ -43,33 +38,12 @@ import com.sun.star.uno.XInterface; public class UITools { private final XAccessible mXRoot; - private final XMultiServiceFactory mMSF; - - public UITools(XMultiServiceFactory msf, XModel xModel) - { - mMSF = msf; - mXRoot = makeRoot(xModel); - } - - public UITools(XMultiServiceFactory msf, XTextDocument xTextDoc) - { - mMSF = msf; - XModel xModel = UnoRuntime.queryInterface(XModel.class, xTextDoc); - mXRoot = makeRoot(xModel); - } - public UITools(XMultiServiceFactory msf, XWindow xWindow) + public UITools(XWindow xWindow) { - mMSF = msf; mXRoot = makeRoot(xWindow); } - private static XAccessible makeRoot(XModel aModel) - { - XWindow xWindow = AccessibilityTools.getCurrentWindow(aModel); - return AccessibilityTools.getAccessibleObject(xWindow); - } - private static String getString(XInterface xInt) { XAccessibleText oText = UnoRuntime.queryInterface(XAccessibleText.class, xInt); -- cgit