下面列出了java.nio.BufferOverflowException#getLocalizedMessage ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* Note that this method does the access / request exception processing here rather
* than passing things up the stack; we may introduce an extended version of this
* method to take the map array as an output parameter in later releases.
*/
protected InputStream execStreamCmd(String cmdName, String[] cmdArgs, Map<String, Object> inMap, String inString, boolean ignoreCallbacks)
throws ConnectionException, RequestException, AccessException {
RpcPacketDispatcher dispatcher = null;
RpcConnection rpcConnection = null;
if (cmdName == null) {
throw new NullPointerError(
"Null command name passed to execStreamCmd");
}
if (!this.connected) {
throw new ConnectionNotConnectedException(
"Not currently connected to a Perforce server");
}
try {
int cmdCallBackKey = this.nextCmdCallBackKey.incrementAndGet();
long startTime = System.currentTimeMillis();
dispatcher = new RpcPacketDispatcher(props, this);
rpcConnection = new RpcStreamConnection(serverHost, serverPort,
props, this.serverStats, this.charset, null, this.socketPool,
this.secure, this.rsh);
ProtocolCommand protocolSpecs = new ProtocolCommand();
if (inMap != null && ClientLineEnding.CONVERT_TEXT) {
ClientLineEnding.convertMap(inMap);
}
ExternalEnv env = setupCmd(dispatcher, rpcConnection, protocolSpecs,
cmdName.toLowerCase(Locale.ENGLISH),cmdArgs, inMap, ignoreCallbacks, cmdCallBackKey, true);
CommandEnv cmdEnv = new CommandEnv(
this,
new RpcCmdSpec(
cmdName.toLowerCase(Locale.ENGLISH),
cmdArgs,
getAuthTicket(),
inMap,
inString,
env),
rpcConnection,
protocolSpecs,
this.serverProtocolMap,
this.progressCallback,
cmdCallBackKey,
writeInPlace(cmdName),
this.isNonCheckedSyncs());
cmdEnv.setDontWriteTicket(isDontWriteTicket(cmdName.toLowerCase(Locale.ENGLISH), cmdArgs));
cmdEnv.setFieldRule(getRpcPacketFieldRule(inMap, CmdSpec.getValidP4JCmdSpec(cmdName)));
cmdEnv.setStreamCmd(true);
List<Map<String, Object>> retMapList = dispatcher.dispatch(cmdEnv);
long endTime = System.currentTimeMillis();
if (!ignoreCallbacks && (this.commandCallback != null)) {
this.processCmdCallbacks(cmdCallBackKey, endTime - startTime, retMapList);
}
if ((retMapList != null) && (retMapList.size() != 0)) {
for (Map<String, Object> map : retMapList) {
ResultMapParser.handleErrorStr(map);
ResultMapParser.handleWarningStr(map);
}
}
RpcOutputStream outStream = (RpcOutputStream) cmdEnv.getStateMap().get(
RpcServer.RPC_TMP_OUTFILE_STREAM_KEY);
if (outStream != null) {
outStream.close();
TempFileInputStream inStream
= new TempFileInputStream(outStream.getFile());
return inStream;
}
return null;
} catch (BufferOverflowException exc) {
Log.error("RPC Buffer overflow: " + exc.getLocalizedMessage());
Log.exception(exc);
throw new P4JavaError("RPC Buffer overflow: " + exc.getLocalizedMessage());
} catch (ConnectionNotConnectedException cnce) {
this.connected = false;
this.status = ServerStatus.ERROR;
throw cnce;
} catch (IOException ioexc) {
Log.error("RPC I/O error: " + ioexc.getLocalizedMessage());
Log.exception(ioexc);
throw new RequestException(
"I/O error encountered in stream command: "
+ ioexc.getLocalizedMessage(), ioexc);
} finally {
if (rpcConnection != null) {
rpcConnection.disconnect(dispatcher);
}
}
}
/**
* Note that this method does the access / request exception processing here rather
* than passing things up the stack; we may introduce an extended version of this
* method to take the map array as an output parameter in later releases.
*/
protected InputStream execStreamCmd(String cmdName, String[] cmdArgs, Map<String, Object> inMap, String inString, boolean ignoreCallbacks)
throws ConnectionException, RequestException, AccessException {
RpcPacketDispatcher dispatcher = null;
RpcConnection rpcConnection = null;
if (cmdName == null) {
throw new NullPointerError(
"Null command name passed to execStreamCmd");
}
if (!this.connected) {
throw new ConnectionNotConnectedException(
"Not currently connected to a Perforce server");
}
try {
int cmdCallBackKey = this.nextCmdCallBackKey.incrementAndGet();
long startTime = System.currentTimeMillis();
dispatcher = new RpcPacketDispatcher(props, this);
rpcConnection = new RpcStreamConnection(serverHost, serverPort,
props, this.serverStats, this.p4Charset, null, this.socketPool,
this.secure, this.rsh);
ProtocolCommand protocolSpecs = new ProtocolCommand();
if (inMap != null && ClientLineEnding.CONVERT_TEXT) {
ClientLineEnding.convertMap(inMap);
}
ExternalEnv env = setupCmd(dispatcher, rpcConnection, protocolSpecs,
cmdName.toLowerCase(Locale.ENGLISH),cmdArgs, inMap, ignoreCallbacks, cmdCallBackKey, true);
CommandEnv cmdEnv = new CommandEnv(
this,
new RpcCmdSpec(
cmdName.toLowerCase(Locale.ENGLISH),
cmdArgs,
getAuthTicket(),
inMap,
inString,
env),
rpcConnection,
protocolSpecs,
this.serverProtocolMap,
this.progressCallback,
cmdCallBackKey,
writeInPlace(cmdName),
this.isNonCheckedSyncs());
cmdEnv.setDontWriteTicket(isDontWriteTicket(cmdName.toLowerCase(Locale.ENGLISH), cmdArgs));
cmdEnv.setFieldRule(getRpcPacketFieldRule(inMap, CmdSpec.getValidP4JCmdSpec(cmdName)));
cmdEnv.setStreamCmd(true);
List<Map<String, Object>> retMapList = dispatcher.dispatch(cmdEnv);
long endTime = System.currentTimeMillis();
if (!ignoreCallbacks && (this.commandCallback != null)) {
this.processCmdCallbacks(cmdCallBackKey, endTime - startTime, retMapList);
}
if ((retMapList != null) && (retMapList.size() != 0)) {
for (Map<String, Object> map : retMapList) {
// p4ic4idea: use IServerMessage
IServerMessage msg = ResultMapParser.toServerMessage(map);
ResultMapParser.handleErrors(msg);
ResultMapParser.handleWarnings(msg);
}
}
RpcOutputStream outStream = (RpcOutputStream) cmdEnv.getStateMap().get(
RpcServer.RPC_TMP_OUTFILE_STREAM_KEY);
if (outStream != null) {
outStream.close();
TempFileInputStream inStream
= new TempFileInputStream(outStream.getFile());
return inStream;
}
return null;
} catch (BufferOverflowException exc) {
Log.error("RPC Buffer overflow: " + exc.getLocalizedMessage());
Log.exception(exc);
throw new P4JavaError("RPC Buffer overflow: " + exc.getLocalizedMessage());
} catch (ConnectionNotConnectedException cnce) {
this.connected = false;
this.status = ServerStatus.ERROR;
throw cnce;
} catch (IOException ioexc) {
Log.error("RPC I/O error: " + ioexc.getLocalizedMessage());
Log.exception(ioexc);
throw new RequestException(
"I/O error encountered in stream command: "
+ ioexc.getLocalizedMessage(), ioexc);
} finally {
if (rpcConnection != null) {
rpcConnection.disconnect(dispatcher);
}
}
}
/**
* Note that this method does the access / request exception processing here rather
* than passing things up the stack; we may introduce an extended version of this
* method to take the map array as an output parameter in later releases.
*/
protected InputStream execStreamCmd(String cmdName, String[] cmdArgs, Map<String, Object> inMap, String inString, boolean ignoreCallbacks)
throws ConnectionException, RequestException, AccessException {
RpcPacketDispatcher dispatcher = null;
RpcConnection rpcConnection = null;
if (cmdName == null) {
throw new NullPointerError(
"Null command name passed to execStreamCmd");
}
if (!this.connected) {
throw new ConnectionNotConnectedException(
"Not currently connected to a Perforce server");
}
try {
int cmdCallBackKey = this.nextCmdCallBackKey.incrementAndGet();
long startTime = System.currentTimeMillis();
dispatcher = new RpcPacketDispatcher(props, this);
rpcConnection = new RpcStreamConnection(serverHost, serverPort,
props, this.serverStats, this.p4Charset, null, this.socketPool,
this.secure, this.rsh);
ProtocolCommand protocolSpecs = new ProtocolCommand();
if (inMap != null && ClientLineEnding.CONVERT_TEXT) {
ClientLineEnding.convertMap(inMap);
}
ExternalEnv env = setupCmd(dispatcher, rpcConnection, protocolSpecs,
cmdName.toLowerCase(Locale.ENGLISH),cmdArgs, inMap, ignoreCallbacks, cmdCallBackKey, true);
CommandEnv cmdEnv = new CommandEnv(
this,
new RpcCmdSpec(
cmdName.toLowerCase(Locale.ENGLISH),
cmdArgs,
getAuthTicket(),
inMap,
inString,
env),
rpcConnection,
protocolSpecs,
this.serverProtocolMap,
this.progressCallback,
cmdCallBackKey,
writeInPlace(cmdName),
this.isNonCheckedSyncs());
cmdEnv.setDontWriteTicket(isDontWriteTicket(cmdName.toLowerCase(Locale.ENGLISH), cmdArgs));
cmdEnv.setFieldRule(getRpcPacketFieldRule(inMap, CmdSpec.getValidP4JCmdSpec(cmdName)));
cmdEnv.setStreamCmd(true);
List<Map<String, Object>> retMapList = dispatcher.dispatch(cmdEnv);
long endTime = System.currentTimeMillis();
if (!ignoreCallbacks && (this.commandCallback != null)) {
this.processCmdCallbacks(cmdCallBackKey, endTime - startTime, retMapList);
}
if ((retMapList != null) && (retMapList.size() != 0)) {
for (Map<String, Object> map : retMapList) {
ResultMapParser.handleErrorStr(map);
ResultMapParser.handleWarningStr(map);
}
}
RpcOutputStream outStream = (RpcOutputStream) cmdEnv.getStateMap().get(
RpcServer.RPC_TMP_OUTFILE_STREAM_KEY);
if (outStream != null) {
outStream.close();
TempFileInputStream inStream
= new TempFileInputStream(outStream.getFile());
return inStream;
}
return null;
} catch (BufferOverflowException exc) {
Log.error("RPC Buffer overflow: " + exc.getLocalizedMessage());
Log.exception(exc);
throw new P4JavaError("RPC Buffer overflow: " + exc.getLocalizedMessage());
} catch (ConnectionNotConnectedException cnce) {
this.connected = false;
this.status = ServerStatus.ERROR;
throw cnce;
} catch (IOException ioexc) {
Log.error("RPC I/O error: " + ioexc.getLocalizedMessage());
Log.exception(ioexc);
throw new RequestException(
"I/O error encountered in stream command: "
+ ioexc.getLocalizedMessage(), ioexc);
} finally {
if (rpcConnection != null) {
rpcConnection.disconnect(dispatcher);
}
}
}