java: these fields can become local variables
found by PMD Change-Id: Id852cfec984a181b91aca1c00a41e342b720a4bf
This commit is contained in:
@@ -34,17 +34,15 @@ public class DatabaseApplication
|
||||
|
||||
private final XOfficeDatabaseDocument databaseDocument;
|
||||
private final XDatabaseDocumentUI documentUI;
|
||||
private final DatabaseAccess db;
|
||||
|
||||
public DatabaseApplication(final DatabaseAccess _db) throws Exception
|
||||
{
|
||||
db = _db;
|
||||
databaseDocument = db.getDatabaseDocument();
|
||||
databaseDocument = _db.getDatabaseDocument();
|
||||
|
||||
// load it into a frame
|
||||
final Object object = db.getORB().createInstance("com.sun.star.frame.Desktop");
|
||||
final Object object = _db.getORB().createInstance("com.sun.star.frame.Desktop");
|
||||
final XComponentLoader xComponentLoader = UnoRuntime.queryInterface(XComponentLoader.class, object);
|
||||
final XComponent loadedComponent = xComponentLoader.loadComponentFromURL(db.getDocumentURL(), "_blank", FrameSearchFlag.ALL, new PropertyValue[0]);
|
||||
final XComponent loadedComponent = xComponentLoader.loadComponentFromURL(_db.getDocumentURL(), "_blank", FrameSearchFlag.ALL, new PropertyValue[0]);
|
||||
|
||||
// get the controller, which provides access to various UI operations
|
||||
final XModel docModel = UnoRuntime.queryInterface(XModel.class, loadedComponent);
|
||||
|
@@ -38,7 +38,6 @@ import com.sun.star.util.XStringSubstitution;
|
||||
public class PathSubstitutionTest
|
||||
{
|
||||
|
||||
private XMultiServiceFactory xMSF;
|
||||
// all substitution variables
|
||||
private VariableContainer substVars = null;
|
||||
|
||||
@@ -66,7 +65,7 @@ public class PathSubstitutionTest
|
||||
*/
|
||||
@Test public void checkXStringSubstitution()
|
||||
{
|
||||
xMSF = getMSF();
|
||||
XMultiServiceFactory xMSF = getMSF();
|
||||
System.out.println("---- Testing the XStringSubstitution interface ----");
|
||||
System.out.println("Create intance of test object.\n");
|
||||
XStringSubstitution oObj = null;
|
||||
|
@@ -45,10 +45,7 @@ import com.sun.star.lang.XMultiServiceFactory;
|
||||
public class java_fat implements TestBase
|
||||
{
|
||||
|
||||
private boolean m_isDebug = false;
|
||||
private boolean keepdocument = false;
|
||||
private boolean logging = true;
|
||||
private boolean newOffice = false;
|
||||
private DynamicClassLoader m_aDynamicClassLoader = null;
|
||||
|
||||
private lib.TestParameters m_aParams;
|
||||
@@ -65,21 +62,21 @@ public class java_fat implements TestBase
|
||||
String ExclusionFile = (String) m_aParams.get("ExclusionList");
|
||||
ArrayList<String> exclusions = null;
|
||||
boolean retValue = true;
|
||||
m_isDebug = m_aParams.getBool("DebugIsActive");
|
||||
boolean isDebug = m_aParams.getBool("DebugIsActive");
|
||||
logging = m_aParams.getBool("LoggingIsActive");
|
||||
keepdocument = m_aParams.getBool("KeepDocument");
|
||||
newOffice = m_aParams.getBool(util.PropertyName.NEW_OFFICE_INSTANCE);
|
||||
boolean keepdocument = m_aParams.getBool("KeepDocument");
|
||||
boolean newOffice = m_aParams.getBool(util.PropertyName.NEW_OFFICE_INSTANCE);
|
||||
if (keepdocument)
|
||||
{
|
||||
System.setProperty("KeepDocument", "true");
|
||||
}
|
||||
if (ExclusionFile != null)
|
||||
{
|
||||
exclusions = getExclusionList(ExclusionFile, m_isDebug);
|
||||
exclusions = getExclusionList(ExclusionFile, isDebug);
|
||||
}
|
||||
|
||||
String sDescriptionPath = (String) m_aParams.get("DescriptionPath");
|
||||
DescEntry[] entries = dg.getDescriptionFor(job, sDescriptionPath, m_isDebug);
|
||||
DescEntry[] entries = dg.getDescriptionFor(job, sDescriptionPath, isDebug);
|
||||
|
||||
if (entries == null)
|
||||
{
|
||||
|
@@ -17,6 +17,10 @@
|
||||
*/
|
||||
package org.libreoffice.report.pentaho;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.libreoffice.report.DataSourceFactory;
|
||||
import org.libreoffice.report.ImageService;
|
||||
import org.libreoffice.report.InputRepository;
|
||||
@@ -25,14 +29,6 @@ import org.libreoffice.report.ReportEngineMetaData;
|
||||
import org.libreoffice.report.ReportEngineParameterNames;
|
||||
import org.libreoffice.report.ReportJobFactory;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.pentaho.reporting.libraries.base.util.HashNMap;
|
||||
|
||||
|
||||
public class PentahoReportEngineMetaData
|
||||
implements ReportEngineMetaData
|
||||
@@ -41,31 +37,11 @@ public class PentahoReportEngineMetaData
|
||||
public static final String OPENDOCUMENT_TEXT = "application/vnd.oasis.opendocument.text";
|
||||
public static final String OPENDOCUMENT_SPREADSHEET = "application/vnd.oasis.opendocument.spreadsheet";
|
||||
public static final String OPENDOCUMENT_CHART = "application/vnd.oasis.opendocument.chart";
|
||||
private final static String CONTENT_TYPE = "content-type";
|
||||
public static final String DEBUG = "raw/text+xml";
|
||||
private final Set<String> mandatoryParameters;
|
||||
private final Map<String,Class<?>> parameterTypes;
|
||||
private final HashNMap enumerationValues;
|
||||
|
||||
public PentahoReportEngineMetaData()
|
||||
{
|
||||
mandatoryParameters = new HashSet<String>();
|
||||
mandatoryParameters.add(ReportEngineParameterNames.CONTENT_TYPE);
|
||||
mandatoryParameters.add(ReportEngineParameterNames.INPUT_NAME);
|
||||
mandatoryParameters.add(ReportEngineParameterNames.INPUT_REPOSITORY);
|
||||
mandatoryParameters.add(ReportEngineParameterNames.OUTPUT_NAME);
|
||||
mandatoryParameters.add(ReportEngineParameterNames.OUTPUT_REPOSITORY);
|
||||
mandatoryParameters.add(ReportEngineParameterNames.INPUT_DATASOURCE_FACTORY);
|
||||
mandatoryParameters.add(ReportEngineParameterNames.IMAGE_SERVICE);
|
||||
mandatoryParameters.add(ReportEngineParameterNames.INPUT_REPORTJOB_FACTORY);
|
||||
mandatoryParameters.add(ReportEngineParameterNames.INPUT_MASTER_COLUMNS);
|
||||
mandatoryParameters.add(ReportEngineParameterNames.INPUT_MASTER_VALUES);
|
||||
mandatoryParameters.add(ReportEngineParameterNames.INPUT_DETAIL_COLUMNS);
|
||||
mandatoryParameters.add(ReportEngineParameterNames.AUTHOR);
|
||||
mandatoryParameters.add(ReportEngineParameterNames.TITLE);
|
||||
mandatoryParameters.add(ReportEngineParameterNames.MAXROWS);
|
||||
|
||||
|
||||
parameterTypes = new HashMap<String,Class<?>>();
|
||||
parameterTypes.put(ReportEngineParameterNames.CONTENT_TYPE, String.class);
|
||||
parameterTypes.put(ReportEngineParameterNames.INPUT_NAME, String.class);
|
||||
@@ -81,15 +57,6 @@ public class PentahoReportEngineMetaData
|
||||
parameterTypes.put(ReportEngineParameterNames.AUTHOR, String.class);
|
||||
parameterTypes.put(ReportEngineParameterNames.TITLE, String.class);
|
||||
parameterTypes.put(ReportEngineParameterNames.MAXROWS, Integer.class);
|
||||
|
||||
enumerationValues = new HashNMap();
|
||||
enumerationValues.add(CONTENT_TYPE,
|
||||
PentahoReportEngineMetaData.OPENDOCUMENT_TEXT);
|
||||
enumerationValues.add(CONTENT_TYPE,
|
||||
PentahoReportEngineMetaData.OPENDOCUMENT_SPREADSHEET);
|
||||
enumerationValues.add(CONTENT_TYPE,
|
||||
PentahoReportEngineMetaData.OPENDOCUMENT_CHART);
|
||||
enumerationValues.add(CONTENT_TYPE, PentahoReportEngineMetaData.DEBUG);
|
||||
}
|
||||
|
||||
public Class getParameterType(final String parameter)
|
||||
|
@@ -100,10 +100,6 @@ public class CheckMemoryUsage
|
||||
private String[][] sDocuments;
|
||||
private static final int iAllowMemoryIncrease = 10;
|
||||
private int iExportDocCount = 25;
|
||||
/**
|
||||
* The test parameters
|
||||
*/
|
||||
private TestParameters param = null;
|
||||
|
||||
/**
|
||||
* Collect all documents to load and all filters used for export.
|
||||
@@ -115,7 +111,7 @@ public class CheckMemoryUsage
|
||||
final XMultiServiceFactory xMsf = getMSF();
|
||||
|
||||
// some Tests need the qadevOOo TestParameters, it is like a Hashmap for Properties.
|
||||
param = new TestParameters();
|
||||
TestParameters param = new TestParameters();
|
||||
param.put("ServiceFactory", xMsf); // some qadevOOo functions need the ServiceFactory
|
||||
|
||||
// test does definitely not run on Windows.
|
||||
|
@@ -127,7 +127,6 @@ public class DBMetaData
|
||||
};
|
||||
|
||||
private int iMaxColumnsInSelect;
|
||||
private int iMaxColumnsInGroupBy;
|
||||
private int iMaxColumnNameLength = -1;
|
||||
private int iMaxTableNameLength = -1;
|
||||
private boolean bPasswordIsRequired;
|
||||
@@ -419,15 +418,6 @@ public class DBMetaData
|
||||
}
|
||||
}
|
||||
|
||||
private void setMaxColumnsInGroupBy() throws SQLException
|
||||
{
|
||||
iMaxColumnsInGroupBy = xDBMetaData.getMaxColumnsInGroupBy();
|
||||
if (iMaxColumnsInGroupBy == 0)
|
||||
{
|
||||
iMaxColumnsInGroupBy = DBMetaData.NOLIMIT;
|
||||
}
|
||||
}
|
||||
|
||||
public int getMaxColumnsInTable() throws SQLException
|
||||
{
|
||||
int iMaxColumnsInTable = xDBMetaData.getMaxColumnsInTable();
|
||||
@@ -444,7 +434,6 @@ public class DBMetaData
|
||||
{
|
||||
xDBMetaData = DBConnection.getMetaData();
|
||||
getDataSourceInterfaces();
|
||||
setMaxColumnsInGroupBy();
|
||||
setMaxColumnsInSelect();
|
||||
}
|
||||
catch (SQLException e)
|
||||
|
@@ -40,7 +40,6 @@ public class FieldColumn
|
||||
|
||||
// field meta data
|
||||
private int FieldWidth;
|
||||
private int StandardFormatKey;
|
||||
private boolean bIsNumberFormat;
|
||||
|
||||
private static boolean bFormatKeysInitialized = false;
|
||||
@@ -223,6 +222,7 @@ public class FieldColumn
|
||||
|
||||
private void getTyperelatedFieldData()
|
||||
{
|
||||
int StandardFormatKey = 0;
|
||||
try
|
||||
{
|
||||
switch ( getFieldType() )
|
||||
|
@@ -63,7 +63,6 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen
|
||||
private TextStyleHandler oTextStyleHandler;
|
||||
public TextFieldHandler oTextFieldHandler;
|
||||
public ViewHandler oViewHandler;
|
||||
private NumberFormatter oNumberFormatter;
|
||||
public static final String TBLRECORDSECTION = "Tbl_RecordSection";
|
||||
public static final String TBLGROUPSECTION = "Tbl_GroupField";
|
||||
public static final String RECORDSECTION = "RecordSection";
|
||||
@@ -96,7 +95,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen
|
||||
oViewHandler = new ViewHandler(xTextDocument);
|
||||
oTextFieldHandler = new TextFieldHandler(xMSFDoc, xTextDocument);
|
||||
DBColumnsVector = new java.util.ArrayList<DBColumn>();
|
||||
oNumberFormatter = oTextTableHandler.getNumberFormatter();
|
||||
NumberFormatter oNumberFormatter = oTextTableHandler.getNumberFormatter();
|
||||
CurDBMetaData = _aRecordParser;
|
||||
long lDateCorrection = oNumberFormatter.getNullDateCorrection();
|
||||
oNumberFormatter.setBooleanReportDisplayNumberFormat();
|
||||
|
@@ -101,7 +101,6 @@ public class FilterComponent
|
||||
private static final int SO_FOURTHBOOLFIELDNAME = 256 + 4;
|
||||
private int SOI_MATCHALL = 0;
|
||||
private int SOI_MATCHANY = 1;
|
||||
private int curHelpID;
|
||||
|
||||
class ItemListenerImpl implements com.sun.star.awt.XItemListener
|
||||
{
|
||||
@@ -364,7 +363,7 @@ public class FilterComponent
|
||||
*/
|
||||
public FilterComponent(WizardDialog CurUnoDialog, int iStep, int iPosX, int iPosY, int FilterCount, QueryMetaData _oQueryMetaData, int _firstHelpID)
|
||||
{
|
||||
this.curHelpID = _firstHelpID;
|
||||
int curHelpID = _firstHelpID;
|
||||
this.IStep = Integer.valueOf(iStep);
|
||||
|
||||
curtabindex = UnoDialog.setInitialTabindex(iStep);
|
||||
@@ -440,7 +439,7 @@ public class FilterComponent
|
||||
for (int i = 0; i < FilterCount; i++)
|
||||
{
|
||||
bEnabled = (i == 0);
|
||||
oControlRows[i] = new ControlRow(iPosX, iPosY + 20, i, bEnabled, (this.curHelpID + (i * 3)));
|
||||
oControlRows[i] = new ControlRow(iPosX, iPosY + 20, i, bEnabled, (curHelpID + (i * 3)));
|
||||
iPosY += 43;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user