lines.add(line);
totalLength += line.length();
count++;
}
if(timedStreamCloser.timedOut()) {
throw new PerforceException("Perforce operation timed out after " + timeout + " seconds.");
}
}
catch(IOException ioe)
{
//this is generally not anything to worry about. The underlying
//perforce process terminated and that causes java to be angry
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw, true);
ioe.printStackTrace(pw);
pw.flush();
sw.flush();
getLogger().warn("Perforce process terminated suddenly");
getLogger().warn(sw.toString());
}
finally{
if(timedStreamCloser!=null) timedStreamCloser.interrupt();
try{
p4.getWriter().close();
} catch (IOException e) {
getLogger().warn("Write pipe failed to close.");
}
try{
p4.getReader().close();
} catch (IOException e) {
getLogger().warn("Read pipe failed to close.");
}
p4.close();
}
loop = false;
// If we failed to execute because of an authentication issue, try a p4 login.
if(attemptLogin && (mesgIndex == 1 || mesgIndex == 2 || mesgIndex == 6 || mesgIndex == 9)) {
// password is unset means that perforce isn't using the environment var P4PASSWD
// Instead it is using tickets. We must attempt to login via p4 login, then
// retry this cmd.
p4.close();
trustIfSSL();
login();
loop = true;
attemptLogin = false;
continue;
}
// We aren't using the exact message because we want to add the username for more info
if(mesgIndex == 4)
throw new PerforceException("Access for user '" + depot.getUser() + "' has not been enabled by 'p4 protect'");
if(mesgIndex != -1)
throw new PerforceException(p4errors[mesgIndex]);
if(count == 0)
throw new PerforceException("No output for: " + debugCmd);
} while(loop);
StringBuilder response = new StringBuilder(totalLength + lines.size());
for (String line : lines)
{