1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-04 23:55:26 +02:00

[312415] [dstore] shell service interprets < and > sequences - handle old client/new server case

This commit is contained in:
David McKnight 2010-05-11 13:33:47 +00:00
parent 6b3ffd7619
commit e35382180d
4 changed files with 34 additions and 6 deletions

View file

@ -19,6 +19,7 @@
* Noriaki Takatsu (IBM) - [230399] [multithread] changes to stop CommandMiner threads when clients disconnect
* David McKnight (IBM) - [226561] [apidoc] Add API markup to RSE Javadocs where extend / implement is allowed
* David McKnight (IBM) - [286671] Dstore shell service interprets < and > sequences - cmd descriptor to identify ability
* David McKnight (IBM) [312415] [dstore] shell service interprets < and > sequences - handle old client/new server case
*******************************************************************************/
package org.eclipse.rse.dstore.universal.miners;
@ -146,7 +147,7 @@ public class CommandMiner extends Miner
_dataStore.createReference(cancellable, shellD, "abstracts", "abstracted by"); //$NON-NLS-1$ //$NON-NLS-2$
// indicates support for char conversion in version 3.2
createCommandDescriptor(fsD, "CharConversion", "C_CHAR_CONVERSION", false);
createCommandDescriptor(fsD, "CharConversion", "C_CHAR_CONVERSION", false); //$NON-NLS-1$ //$NON-NLS-2$
// DataElement inputD = _dataStore.createObject(cmdD, "input", "Enter command");
@ -230,7 +231,16 @@ public class CommandMiner extends Miner
getPossibleCommands(status);
return status;
}
else if (name.equals("C_CHAR_CONVERSION")) //$NON-NLS-1$
{
DataElement cmdStatus = getCommandStatus(subject);
CommandMinerThread theThread = (CommandMinerThread) _threads.get(cmdStatus.getAttribute(DE.A_ID));
if (theThread != null)
{
theThread._supportsCharConversion = true;
}
}
return status;
}

View file

@ -29,6 +29,7 @@
* David McKnight (IBM) [302724] problems with environment variable substitution
* David McKnight (IBM) [302996] [dstore] null checks and performance issue with shell output
* David McKnight (IBM) [308246] [dstore] fix for Bug 287305 breaks on z/OS due to "su" usage
* David McKnight (IBM) [312415] [dstore] shell service interprets < and > sequences - handle old client/new server case
*******************************************************************************/
package org.eclipse.rse.internal.dstore.universal.miners.command;
@ -127,6 +128,8 @@ public class CommandMinerThread extends MinerThread
private DataElement _lastPrompt;
private InitRunnable _initRunnable;
private Thread _cdThread;
public boolean _supportsCharConversion = false;
public CommandMinerThread(DataElement theElement, String invocation, DataElement status, Patterns thePatterns, CommandMiner.CommandMinerDescriptors descriptors)
{
@ -653,7 +656,9 @@ public class CommandMinerThread extends MinerThread
String origInput = input;
input = convertSpecialCharacters(input);
if (_supportsCharConversion){
input = convertSpecialCharacters(input);
}
input.getBytes();
try

View file

@ -21,6 +21,7 @@
* Peter Wang (IBM) [299422] [dstore] OutputHandler.readLines() not compatible with servers that return max 1024bytes available to be read
* David McKnight (IBM) [302996] [dstore] null checks and performance issue with shell output
* David McKnight (IBM) [309338] [dstore] z/OS USS - invocation of 'env' shell command returns inconsistently organized output
* David McKnight (IBM) [312415] [dstore] shell service interprets < and > sequences - handle old client/new server case
*******************************************************************************/
package org.eclipse.rse.internal.dstore.universal.miners.command;
@ -129,8 +130,8 @@ public class OutputHandler extends Handler {
}
private String convertSpecialCharacters(String input){
// needed to ensure xml characters aren't converted in xml layer
if (_commandThread._supportsCharConversion){
// needed to ensure xml characters aren't converted in xml layer
StringBuffer output = new StringBuffer();
for (int idx = 0; idx < input.length(); idx++)
@ -151,6 +152,10 @@ public class OutputHandler extends Handler {
}
return output.toString();
}
else {
return input;
}
}
private void doPrompt() {
try {

View file

@ -15,6 +15,7 @@
* {Name} (company) - description of contribution.
* David McKnight (IBM) - [196624] dstore miner IDs should be String constants rather than dynamic lookup
* David McKnight (IBM) - [286671] Dstore shell service interprets &lt; and &gt; sequences
* David McKnight (IBM) [312415] [dstore] shell service interprets &lt; and &gt; sequences - handle old client/new server case
*******************************************************************************/
package org.eclipse.rse.internal.services.dstore.shells;
@ -46,6 +47,8 @@ public class DStoreShellThread
private DataElement _status;
private String _invocation;
private boolean _sentCharConversionCommand = false;
/**
* @param cwd initial working directory
* @param invocation launch shell command
@ -267,7 +270,12 @@ public class DStoreShellThread
// first, find out if the server support conversion
DataElement fsD= dataStore.findObjectDescriptor(DataStoreResources.model_directory);
DataElement convDes = dataStore.localDescriptorQuery(fsD, "C_CHAR_CONVERSION", 1); //$NON-NLS-1$
if (convDes != null){
if (convDes != null){
if (!_sentCharConversionCommand){
dataStore.command(convDes, _status);
_sentCharConversionCommand = true;
}
cmd = convertSpecialCharacters(cmd);
}