cmd = new String[] { tempFile.getAbsolutePath() };
}
catch (final Exception ex)
{
throw new FatalError(
tsLogger.log_mesg
.getString("com.arjuna.ats.internal.arjuna.utils.ExecProcessId_2")+" "+ex, ex);
}
}
if (cmd != null)
{
Process p = null;
try
{
p = Runtime.getRuntime().exec(cmd);
}
catch (final IOException ex)
{
throw new FatalError(
tsLogger.log_mesg
.getString("com.arjuna.ats.internal.arjuna.utils.ExecProcessId_3")+" "+ex, ex);
}
ByteArrayOutputStream bstream = new ByteArrayOutputStream();
byte[] bytes = new byte[1024];
int read;
try
{
while ((read = p.getInputStream().read(bytes)) != -1)
bstream.write(bytes, 0, read);
}
catch (final Exception ex)
{
throw new FatalError(
tsLogger.log_mesg
.getString("com.arjuna.ats.internal.arjuna.utils.ExecProcessId_4")+" "+ex, ex);
}
finally
{
try
{
bstream.close();
}
catch (final Exception ex)
{
if (tsLogger.arjLoggerI18N.isWarnEnabled())
{
tsLogger.arjLoggerI18N.warn("com.arjuna.ats.internal.arjuna.utils.ExecProcessId_5", new Object[]
{ ex });
}
}
}
if (tempFile != null)
tempFile.delete();
StringTokenizer theTokenizer = new StringTokenizer(bstream.toString());
theTokenizer.nextToken();
String pid = theTokenizer.nextToken();
try
{
_pid = Integer.parseInt(pid);
}
catch (final Exception ex)
{
}
}
}
}
if (_pid == -1)
throw new FatalError(
tsLogger.log_mesg
.getString("com.arjuna.ats.internal.arjuna.utils.ExecProcessId_1"));
return _pid;
}