Kaydet (Commit) a2586823 authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#1399440 Dm: Dubious method used

Change-Id: Ied0a5218b4f95a300d09483315d577b5bdf01bae
Reviewed-on: https://gerrit.libreoffice.org/43135Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst e1261e6e
......@@ -23,6 +23,7 @@ import static org.junit.Assert.fail;
import helper.OfficeProvider;
import helper.ProcessHandler;
import java.io.UnsupportedEncodingException;
import java.util.StringTokenizer;
import lib.TestParameters;
......@@ -110,14 +111,18 @@ public class CheckAPI {
handler.kill();
util.utils.pause(10000);
OfficeProvider op = new OfficeProvider();
xMSF = (XMultiServiceFactory)op.getManager(param);
param.put("ServiceFactory",xMSF);
try {
xMSF = (XMultiServiceFactory)op.getManager(param);
param.put("ServiceFactory",xMSF);
oObj = xMSF.createInstance("org.openoffice.RunnerService");
}
catch(com.sun.star.uno.Exception e) {
fail("Could not create Instance of 'org.openoffice.RunnerService'");
}
catch (UnsupportedEncodingException e) {
fail("Could not get Manager'");
}
}
System.out.println(erg);
String processedErg = parseResult(erg);
......
......@@ -29,6 +29,7 @@ import share.LogWriter;
import stats.Summarizer;
import lib.TestParameters;
import util.PropertyName;
import java.io.UnsupportedEncodingException;
/**
* Test base for executing a java complex test.
......@@ -110,6 +111,10 @@ public class java_complex implements TestBase
{
office = null;
}
catch (UnsupportedEncodingException e)
{
office = null;
}
}
log.initialize(entries[i], param.getBool(PropertyName.LOGGING_IS_ACTIVE));
entries[i].Logger = log;
......
......@@ -24,6 +24,7 @@ import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import lib.MultiMethodTest;
import lib.TestCase;
......@@ -446,7 +447,7 @@ public class java_fat implements TestBase {
return ifc.run(entry, tEnv, param);
}
private AppProvider startOffice(lib.TestParameters param) {
private AppProvider startOffice(lib.TestParameters param) throws UnsupportedEncodingException {
if (m_aDynamicClassLoader == null) {
m_aDynamicClassLoader = new DynamicClassLoader();
}
......
......@@ -18,6 +18,8 @@
package helper;
import java.io.UnsupportedEncodingException;
/**
*
* Interface to get a Manager to access the application to check
......@@ -27,7 +29,7 @@ public interface AppProvider {
/**
* Method to get the desired Manager
*/
Object getManager(lib.TestParameters param);
Object getManager(lib.TestParameters param) throws UnsupportedEncodingException;
/**
* Method to dispose the desired Manager
......
......@@ -31,6 +31,7 @@ import com.sun.star.util.XStringSubstitution;
import java.io.File;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import lib.TestParameters;
......@@ -146,7 +147,7 @@ public class OfficeProvider implements AppProvider
/**
* Method to get the ServiceManager of an Office
*/
public Object getManager(lib.TestParameters param)
public Object getManager(lib.TestParameters param) throws UnsupportedEncodingException
{
String errorMessage = null;
boolean bAppExecutionHasWarning = false;
......
......@@ -19,6 +19,8 @@ package helper;
import java.io.InputStream;
import java.io.File;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.io.PrintWriter;
import java.io.PrintStream;
import java.io.LineNumberReader;
......@@ -128,7 +130,7 @@ public class ProcessHandler
* log stream where debug info and output
* of external command is printed out.
*/
public ProcessHandler(String cmdLine, PrintWriter log)
public ProcessHandler(String cmdLine, PrintWriter log) throws UnsupportedEncodingException
{
this(cmdLine, log, null, null);
}
......@@ -157,7 +159,7 @@ public class ProcessHandler
* Waits for the process to end regulary
*
*/
private ProcessHandler(String cmdLine, PrintWriter log, File workDir, String[] envVars)
private ProcessHandler(String cmdLine, PrintWriter log, File workDir, String[] envVars) throws UnsupportedEncodingException
{
this.cmdLine = cmdLine;
this.workDir = workDir;
......@@ -165,7 +167,7 @@ public class ProcessHandler
this.envVars = envVars;
if (log == null)
{
this.log = new PrintWriter(System.out);
this.log = new PrintWriter(new OutputStreamWriter(System.out, "UTF-8"));
}
else
{
......
......@@ -29,6 +29,8 @@ import com.sun.star.beans.PropertyValue;
import com.sun.star.lang.XTypeProvider;
import com.sun.star.lang.XServiceInfo;
import java.io.PrintWriter;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Method;
/**
......@@ -125,8 +127,8 @@ public class dbg {
* @param name The name of the property.
* @see com.sun.star.beans.XPropertySet
*/
public static void printPropertyInfo(XPropertySet PS, String name) {
printPropertyInfo(PS, name, new PrintWriter(System.out)) ;
public static void printPropertyInfo(XPropertySet PS, String name) throws UnsupportedEncodingException {
printPropertyInfo(PS, name, new PrintWriter(new OutputStreamWriter(System.out, "UTF-8")));
}
/**
......
......@@ -23,6 +23,7 @@ import util.dbg;
import com.sun.star.form.TabulatorCycle;
import com.sun.star.uno.Enum;
import java.io.UnsupportedEncodingException;
/**
* Testing <code>com.sun.star.form.component.DatabaseForm</code>
......@@ -45,7 +46,7 @@ public class _DatabaseForm extends MultiPropertyTest {
* In this property test only debugging information output
* is customized.
*/
public void _NavigationBarMode() {
public void _NavigationBarMode() throws UnsupportedEncodingException {
dbg.printPropertyInfo(oObj, "NavigationBarMode");
testProperty("NavigationBarMode", new PropertyTester() {
@Override
......@@ -64,7 +65,7 @@ public class _DatabaseForm extends MultiPropertyTest {
* This property new value is always fixed and debugging
* information output is customized.
*/
public void _Cycle() {
public void _Cycle() throws UnsupportedEncodingException {
dbg.printPropertyInfo(oObj, "Cycle");
testProperty("Cycle", new PropertyTester() {
@Override
......
......@@ -20,7 +20,9 @@ package mod._dbaccess;
import ifc.sdb._XCompletedExecution;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import lib.StatusException;
import lib.TestCase;
......@@ -535,8 +537,13 @@ public class ORowSet extends TestCase {
* @see ifc.sdb._XCompletedExecution
*/
private static class InteractionHandlerImpl implements _XCompletedExecution.CheckInteractionHandler {
private boolean handlerWasUsed = false;
private PrintWriter log = new PrintWriter(System.out);
private PrintWriter log;
InteractionHandlerImpl() throws UnsupportedEncodingException {
log = new PrintWriter(new OutputStreamWriter(System.out, "UTF-8"));
}
public boolean checkInteractionHandler() {
return handlerWasUsed;
......
......@@ -20,7 +20,9 @@ package mod._forms;
import ifc.form._XDatabaseParameterBroadcaster;
import ifc.sdb._XCompletedExecution;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import lib.StatusException;
import lib.TestCase;
......@@ -756,7 +758,12 @@ public class ODatabaseForm extends TestCase {
*/
private static class ParameterListenerImpl implements _XDatabaseParameterBroadcaster.CheckParameterListener {
private boolean listenerWasCalled = false;
private PrintWriter log = new PrintWriter(System.out);
private PrintWriter log;
ParameterListenerImpl() throws UnsupportedEncodingException {
log = new PrintWriter(new OutputStreamWriter(System.out, "UTF-8"));
}
/**
* Return true, if the listener was called, false otherwise.
......@@ -818,7 +825,11 @@ public class ODatabaseForm extends TestCase {
*/
private static class InteractionHandlerImpl implements _XCompletedExecution.CheckInteractionHandler {
private boolean handlerWasUsed = false;
private PrintWriter log = new PrintWriter(System.out);
private PrintWriter log;
InteractionHandlerImpl() throws UnsupportedEncodingException {
log = new PrintWriter(new OutputStreamWriter(System.out, "UTF-8"));
}
public boolean checkInteractionHandler() {
return handlerWasUsed;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment