coverity#1326731 Dm: Dubious method used
and coverity#1326732 Dm: Dubious method used coverity#1326734 Dm: Dubious method used coverity#1326735 Dm: Dubious method used coverity#1326739 Dm: Dubious method used Change-Id: Id9d39decf7442b503079ebcfe8c881f0f2fe3eb3
This commit is contained in:
@@ -755,9 +755,10 @@ public class LocalOfficeConnection
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
java.io.BufferedReader r = new java.io.BufferedReader(
|
|
||||||
new java.io.InputStreamReader(m_in) );
|
|
||||||
try {
|
try {
|
||||||
|
java.io.BufferedReader r = new java.io.BufferedReader(
|
||||||
|
new java.io.InputStreamReader(m_in, "UTF-8") );
|
||||||
|
|
||||||
for ( ; ; ) {
|
for ( ; ; ) {
|
||||||
String s = r.readLine();
|
String s = r.readLine();
|
||||||
if ( s == null ) {
|
if ( s == null ) {
|
||||||
@@ -765,6 +766,8 @@ public class LocalOfficeConnection
|
|||||||
}
|
}
|
||||||
m_print.println(s);
|
m_print.println(s);
|
||||||
}
|
}
|
||||||
|
} catch ( UnsupportedEncodingException e ) {
|
||||||
|
e.printStackTrace( System.err );
|
||||||
} catch ( java.io.IOException e ) {
|
} catch ( java.io.IOException e ) {
|
||||||
e.printStackTrace( System.err );
|
e.printStackTrace( System.err );
|
||||||
}
|
}
|
||||||
|
@@ -38,6 +38,7 @@ import java.io.File;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -333,9 +334,10 @@ public class Bootstrap {
|
|||||||
new Thread( "Pipe: " + prefix) {
|
new Thread( "Pipe: " + prefix) {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
BufferedReader r = new BufferedReader(
|
|
||||||
new InputStreamReader( in ) );
|
|
||||||
try {
|
try {
|
||||||
|
BufferedReader r = new BufferedReader(
|
||||||
|
new InputStreamReader(in, "UTF-8") );
|
||||||
|
|
||||||
for ( ; ; ) {
|
for ( ; ; ) {
|
||||||
String s = r.readLine();
|
String s = r.readLine();
|
||||||
if ( s == null ) {
|
if ( s == null ) {
|
||||||
@@ -343,6 +345,8 @@ public class Bootstrap {
|
|||||||
}
|
}
|
||||||
out.println( prefix + s );
|
out.println( prefix + s );
|
||||||
}
|
}
|
||||||
|
} catch ( UnsupportedEncodingException e ) {
|
||||||
|
e.printStackTrace( System.err );
|
||||||
} catch ( java.io.IOException e ) {
|
} catch ( java.io.IOException e ) {
|
||||||
e.printStackTrace( System.err );
|
e.printStackTrace( System.err );
|
||||||
}
|
}
|
||||||
|
@@ -310,45 +310,53 @@ final class InstallationFinder {
|
|||||||
StreamGobbler gobbler = new StreamGobbler( proc.getErrorStream() );
|
StreamGobbler gobbler = new StreamGobbler( proc.getErrorStream() );
|
||||||
gobbler.start();
|
gobbler.start();
|
||||||
|
|
||||||
// read the which output from standard input stream
|
|
||||||
BufferedReader br = new BufferedReader(
|
|
||||||
new InputStreamReader( proc.getInputStream() ) );
|
|
||||||
String line = null;
|
|
||||||
try {
|
try {
|
||||||
while ( ( line = br.readLine() ) != null ) {
|
// read the which output from standard input stream
|
||||||
if ( path == null ) {
|
BufferedReader br = new BufferedReader(
|
||||||
// get the path from the which output
|
new InputStreamReader( proc.getInputStream(), "UTF-8" ) );
|
||||||
int index = line.lastIndexOf( SOFFICE );
|
String line = null;
|
||||||
if ( index != -1 ) {
|
try {
|
||||||
int end = index + SOFFICE.length();
|
while ( ( line = br.readLine() ) != null ) {
|
||||||
for ( int i = 0; i <= index; i++ ) {
|
if ( path == null ) {
|
||||||
File file = new File( line.substring( i, end ) );
|
// get the path from the which output
|
||||||
try {
|
int index = line.lastIndexOf( SOFFICE );
|
||||||
if ( file.exists() ) {
|
if ( index != -1 ) {
|
||||||
// resolve symlink
|
int end = index + SOFFICE.length();
|
||||||
path = file.getCanonicalFile().getParent();
|
for ( int i = 0; i <= index; i++ ) {
|
||||||
if ( path != null )
|
File file = new File( line.substring( i, end ) );
|
||||||
break;
|
try {
|
||||||
|
if ( file.exists() ) {
|
||||||
|
// resolve symlink
|
||||||
|
path = file.getCanonicalFile().getParent();
|
||||||
|
if ( path != null )
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} catch ( SecurityException e ) {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
} catch ( SecurityException e ) {
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch ( IOException e ) {
|
||||||
|
// if an I/O exception is thrown, return <code>null</null>
|
||||||
|
System.err.println( "com.sun.star.lib.loader." +
|
||||||
|
"InstallationFinder::getPathFromWhich: " +
|
||||||
|
"reading which command output failed: " + e );
|
||||||
|
return null;
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
br.close();
|
||||||
|
} catch ( IOException e ) {
|
||||||
|
// closing standard input stream failed, ignore
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch ( IOException e ) {
|
} catch ( UnsupportedEncodingException e ) {
|
||||||
// if an I/O exception is thrown, return <code>null</null>
|
// if an Encoding exception is thrown, return <code>null</null>
|
||||||
System.err.println( "com.sun.star.lib.loader." +
|
System.err.println( "com.sun.star.lib.loader." +
|
||||||
"InstallationFinder::getPathFromWhich: " +
|
"InstallationFinder::getPathFromWhich: " +
|
||||||
"reading which command output failed: " + e );
|
"encoding failed: " + e );
|
||||||
return null;
|
return null;
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
br.close();
|
|
||||||
} catch ( IOException e ) {
|
|
||||||
// closing standard input stream failed, ignore
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -563,12 +571,14 @@ final class InstallationFinder {
|
|||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
BufferedReader br = new BufferedReader(
|
BufferedReader br = new BufferedReader(
|
||||||
new InputStreamReader( m_istream ) );
|
new InputStreamReader( m_istream, "UTF-8" ) );
|
||||||
// read from input stream
|
// read from input stream
|
||||||
while ( br.readLine() != null ) {
|
while ( br.readLine() != null ) {
|
||||||
// don't handle line content
|
// don't handle line content
|
||||||
}
|
}
|
||||||
br.close();
|
br.close();
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
// cannot read from input stream
|
||||||
} catch ( IOException e ) {
|
} catch ( IOException e ) {
|
||||||
// stop reading from input stream
|
// stop reading from input stream
|
||||||
}
|
}
|
||||||
|
@@ -580,7 +580,7 @@ public class APIDescGetter extends DescGetter
|
|||||||
entry.endsWith(sEndsWithCSVName))
|
entry.endsWith(sEndsWithCSVName))
|
||||||
{
|
{
|
||||||
InputStream input = this.getClass().getResourceAsStream("/" + entry);
|
InputStream input = this.getClass().getResourceAsStream("/" + entry);
|
||||||
csvFile = new BufferedReader(new InputStreamReader(input));
|
csvFile = new BufferedReader(new InputStreamReader(input, "UTF-8"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -588,7 +588,7 @@ public class APIDescGetter extends DescGetter
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
InputStream in = con.getInputStream();
|
InputStream in = con.getInputStream();
|
||||||
java.io.BufferedReader buf = new java.io.BufferedReader(new InputStreamReader(in));
|
java.io.BufferedReader buf = new java.io.BufferedReader(new InputStreamReader(in, "UTF-8"));
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
String entry = buf.readLine();
|
String entry = buf.readLine();
|
||||||
@@ -602,7 +602,7 @@ public class APIDescGetter extends DescGetter
|
|||||||
module +
|
module +
|
||||||
"/" +
|
"/" +
|
||||||
entry);
|
entry);
|
||||||
csvFile = new BufferedReader(new InputStreamReader(input));
|
csvFile = new BufferedReader(new InputStreamReader(input, "UTF-8"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user