Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 94684 Details for
Bug 225510
[api][breaking] RSE ServiceCommandShell leaks non-API OutputRefreshJob
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch fixing the issue
bug225510_OutputRefreshJobLeakage.diff.txt (text/plain), 30.97 KB, created by
Martin Oberhuber
on 2008-04-03 05:47:02 EDT
(
hide
)
Description:
Patch fixing the issue
Filename:
MIME Type:
Creator:
Martin Oberhuber
Created:
2008-04-03 05:47:02 EDT
Size:
30.97 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.rse.subsystems.shells.local >Index: src/org/eclipse/rse/internal/subsystems/shells/local/model/LocalServiceCommandShell.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.subsystems.shells.local/src/org/eclipse/rse/internal/subsystems/shells/local/model/LocalServiceCommandShell.java,v >retrieving revision 1.4 >diff -u -r1.4 LocalServiceCommandShell.java >--- src/org/eclipse/rse/internal/subsystems/shells/local/model/LocalServiceCommandShell.java 5 Jun 2007 11:03:38 -0000 1.4 >+++ src/org/eclipse/rse/internal/subsystems/shells/local/model/LocalServiceCommandShell.java 3 Apr 2008 09:44:30 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2006, 2007 IBM Corporation and others. >+ * Copyright (c) 2006, 2008 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -7,12 +7,12 @@ > * > * Initial Contributors: > * The following IBM employees contributed to the Remote System Explorer >- * component that contains this file: David McKnight, Kushal Munir, >- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, >+ * component that contains this file: David McKnight, Kushal Munir, >+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, > * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. >- * >+ * > * Contributors: >- * {Name} (company) - description of contribution. >+ * Martin Oberhuber (Wind River) - [225510][api] Fix OutputRefreshJob API leakage > *******************************************************************************/ > > package org.eclipse.rse.internal.subsystems.shells.local.model; >@@ -22,7 +22,6 @@ > > import org.eclipse.core.runtime.NullProgressMonitor; > import org.eclipse.rse.core.subsystems.ISubSystem; >-import org.eclipse.rse.internal.subsystems.shells.servicesubsystem.OutputRefreshJob; > import org.eclipse.rse.services.shells.IHostOutput; > import org.eclipse.rse.services.shells.IHostShell; > import org.eclipse.rse.services.shells.IHostShellChangeEvent; >@@ -41,7 +40,7 @@ > private Patterns _patterns; > private String _workingDir; > private IRemoteFileSubSystem _fs; >- >+ > public LocalServiceCommandShell(IRemoteCmdSubSystem cmdSS, IHostShell hostShell) > { > super(cmdSS, hostShell); >@@ -67,19 +66,19 @@ > return _fs.getRemoteFileObject(workingDir, new NullProgressMonitor()); > } > catch (Exception e) >- { >+ { > } > } > return null; > } >- >+ > public String getContextString() > { > return _workingDir; > } > > >- >+ > public void shellOutputChanged(IHostShellChangeEvent event) > { > IHostOutput[] lines = event.getLines(); >@@ -88,16 +87,16 @@ > { > String line = lines[i].getString(); > ParsedOutput parsedMsg = null; >- >+ > try > { > parsedMsg = _patterns.matchLine(line); > } >- catch (Throwable e) >+ catch (Throwable e) > { > e.printStackTrace(); > } >- >+ > RemoteOutput output = null; > String type = "stdout"; //$NON-NLS-1$ > if (parsedMsg != null) >@@ -111,7 +110,7 @@ > if (event.isError()) > { > output = new RemoteError(this, type); >- } >+ } > else > { > output = new RemoteOutput(this, type); >@@ -119,7 +118,7 @@ > > output.setText(line); > if (parsedMsg != null) >- { >+ { > String file = parsedMsg.file; > if (type.equals(ISystemOutputRemoteTypes.TYPE_PROMPT)) > { >@@ -137,29 +136,18 @@ > output.setAbsolutePath(_workingDir + File.separatorChar + file); > } > } >- >+ > addOutput(output); > outputs[i] = output; > } >- //if (_lastRefreshJob == null || _lastRefreshJob.isComplete()) >- { >- _lastRefreshJob = new OutputRefreshJob(this, outputs, false); >- _lastRefreshJob.schedule(); >- } >- /* >- else >- { >- _lastRefreshJob.addOutputs(outputs); >- _lastRefreshJob.schedule(); >- } >- */ >+ notifyOutputChanged(outputs, false); > } >- >+ > public void writeToShell(String cmd) > { > _patterns.update(cmd); > super.writeToShell(cmd); > > } >- >+ > } >#P org.eclipse.rse.subsystems.shells.dstore >Index: src/org/eclipse/rse/internal/subsystems/shells/dstore/DStoreServiceCommandShell.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.subsystems.shells.dstore/src/org/eclipse/rse/internal/subsystems/shells/dstore/DStoreServiceCommandShell.java,v >retrieving revision 1.10 >diff -u -r1.10 DStoreServiceCommandShell.java >--- src/org/eclipse/rse/internal/subsystems/shells/dstore/DStoreServiceCommandShell.java 5 Nov 2007 21:12:16 -0000 1.10 >+++ src/org/eclipse/rse/internal/subsystems/shells/dstore/DStoreServiceCommandShell.java 3 Apr 2008 09:44:32 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2006, 2007 IBM Corporation and others. >+ * Copyright (c) 2006, 2008 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -7,13 +7,13 @@ > * > * Initial Contributors: > * The following IBM employees contributed to the Remote System Explorer >- * component that contains this file: David McKnight, Kushal Munir, >- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, >+ * component that contains this file: David McKnight, Kushal Munir, >+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, > * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. >- * >+ * > * Contributors: >- * {Name} (company) - description of contribution. >- * David McKnight (IBM) - [202822] cleanup output datalements after use >+ * David McKnight (IBM) - [202822] cleanup output datalements after use >+ * Martin Oberhuber (Wind River) - [225510][api] Fix OutputRefreshJob API leakage > *******************************************************************************/ > > package org.eclipse.rse.internal.subsystems.shells.dstore; >@@ -26,7 +26,6 @@ > import org.eclipse.rse.internal.services.dstore.shells.DStoreHostOutput; > import org.eclipse.rse.internal.services.dstore.shells.DStoreHostShell; > import org.eclipse.rse.internal.services.dstore.shells.DStoreShellOutputReader; >-import org.eclipse.rse.internal.subsystems.shells.servicesubsystem.OutputRefreshJob; > import org.eclipse.rse.services.shells.IHostOutput; > import org.eclipse.rse.services.shells.IHostShell; > import org.eclipse.rse.services.shells.IHostShellChangeEvent; >@@ -45,21 +44,21 @@ > private DataElement _status; > private DataStore _ds; > private boolean _done = false; >- >+ > public CleanUpSpirited(DataElement status, String name) > { > _status = status; > _ds = status.getDataStore(); > _ds.getDomainNotifier().addDomainListener(this); > } >- >- public void domainChanged(DomainEvent e) >+ >+ public void domainChanged(DomainEvent e) > { > deleteElements(); > } >- >+ > public void run() >- { >+ { > while (!_done) > { > try >@@ -67,12 +66,12 @@ > Thread.sleep(10000); > } > catch (Exception e) >- { >+ { > } > deleteElements(); > } > } >- >+ > private void deleteElements() > { > if (_status.getNestedSize() > 0) >@@ -84,13 +83,13 @@ > { > // delete > _ds.deleteObjects(_status); >- _ds.refresh(_status); >- >+ _ds.refresh(_status); >+ > _ds.getDomainNotifier().removeDomainListener(this); > _done = true; > } > } >- } >+ } > } > > public Shell getShell() { >@@ -103,9 +102,9 @@ > return true; > return false; > } >- >+ > } >- >+ > public DStoreServiceCommandShell(IRemoteCmdSubSystem cmdSS, IHostShell hostShell) > { > super(cmdSS, hostShell); >@@ -127,12 +126,12 @@ > } > } > catch (Exception e) >- { >+ { > } > } > return null; > } >- >+ > public String getContextString() > { > DStoreHostShell shell = (DStoreHostShell)getHostShell(); >@@ -155,20 +154,20 @@ > String src = line.getSource(); > if (event.isError()) > { >- output = new RemoteError(this, type); >- >+ output = new RemoteError(this, type); >+ > } > else > { > output = new RemoteOutput(this, type); > } >- output.setText(line.getName()); >- >+ output.setText(line.getName()); >+ > int colonSep = src.indexOf(':'); > // line numbers > if (colonSep > 0) > { >- >+ > String lineNo = src.substring(colonSep + 1); > String file = src.substring(0, colonSep); > int linen = 0; >@@ -178,7 +177,7 @@ > } > catch (Exception e) > { >- >+ > } > if (linen != 0) > { >@@ -188,33 +187,22 @@ > else > { > output.setAbsolutePath(src); >- } >+ } > } > else > { >- output.setAbsolutePath(src); >+ output.setAbsolutePath(src); > } >- >- >+ >+ > addOutput(output); > outputs[i] = output; > } > } >- //if (_lastRefreshJob == null || _lastRefreshJob.isComplete()) >- { >- _lastRefreshJob = new OutputRefreshJob(this, outputs, false); >- _lastRefreshJob.schedule(); >- } >- /* >- else >- { >- _lastRefreshJob.addOutputs(outputs); >- _lastRefreshJob.schedule(); >- } >- */ >+ notifyOutputChanged(outputs, false); > } > >- public boolean isActive() >+ public boolean isActive() > { > boolean activeShell = _hostShell.isActive(); > if (!activeShell) >@@ -223,13 +211,13 @@ > if (_output.size() < status.getNestedSize()) > { > return true; >- } >+ } > } > return activeShell; > } >- >+ > public void removeOutput() >- { >+ { > DStoreHostShell shell = (DStoreHostShell)getHostShell(); > DataElement status = shell.getStatus(); > DataStore ds = status.getDataStore(); >@@ -240,8 +228,8 @@ > if (!ds.isConnected()) > { > status.removeNestedData(); >- } >- else if (status.get(ssize - 1).isSpirit() || !ds.isDoSpirit()) >+ } >+ else if (status.get(ssize - 1).isSpirit() || !ds.isDoSpirit()) > { > // objects can be deleted directly at this point since there will be no more updates from the server > ds.deleteObjects(status); >@@ -252,19 +240,19 @@ > // cleanup later > // objects need to be deleted later since the server will still be sending spirited update > // if we don't defer this, then the deleted elements would get recreated when the spirits are updated >- CleanUpSpirited cleanUp = new CleanUpSpirited(status, getId()); >+ CleanUpSpirited cleanUp = new CleanUpSpirited(status, getId()); > cleanUp.start(); > } > } >- > >- >- >+ >+ >+ > synchronized(_output) > { >- _output.clear(); >+ _output.clear(); > } > > } >- >+ > } >#P org.eclipse.rse.subsystems.shells.core >Index: src/org/eclipse/rse/subsystems/shells/core/subsystems/servicesubsystem/ServiceCommandShell.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.subsystems.shells.core/src/org/eclipse/rse/subsystems/shells/core/subsystems/servicesubsystem/ServiceCommandShell.java,v >retrieving revision 1.8 >diff -u -r1.8 ServiceCommandShell.java >--- src/org/eclipse/rse/subsystems/shells/core/subsystems/servicesubsystem/ServiceCommandShell.java 5 Jun 2007 11:03:35 -0000 1.8 >+++ src/org/eclipse/rse/subsystems/shells/core/subsystems/servicesubsystem/ServiceCommandShell.java 3 Apr 2008 09:44:33 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2006, 2007 IBM Corporation and others. >+ * Copyright (c) 2006, 2008 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -7,12 +7,12 @@ > * > * Initial Contributors: > * The following IBM employees contributed to the Remote System Explorer >- * component that contains this file: David McKnight, Kushal Munir, >- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, >+ * component that contains this file: David McKnight, Kushal Munir, >+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, > * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. >- * >+ * > * Contributors: >- * {Name} (company) - description of contribution. >+ * Martin Oberhuber (Wind River) - [225510][api] Fix OutputRefreshJob API leakage > *******************************************************************************/ > > package org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem; >@@ -34,14 +34,14 @@ > public class ServiceCommandShell extends RemoteCommandShell implements IServiceCommandShell > { > protected IHostShell _hostShell; >- protected OutputRefreshJob _lastRefreshJob; >+ private OutputRefreshJob _lastRefreshJob; > public ServiceCommandShell(IRemoteCmdSubSystem cmdSS, IHostShell hostShell) > { > super(cmdSS); > _hostShell = hostShell; > setType(ShellStrings.RESID_SHELLS_COMMAND_SHELL_LABEL); > } >- >+ > public String getTitle() > { > return getId(); >@@ -57,7 +57,7 @@ > { > return _hostShell; > } >- >+ > > > public void shellOutputChanged(IHostShellChangeEvent event) >@@ -75,7 +75,7 @@ > String type = event.isError() ? "stderr" : "stdout"; //$NON-NLS-1$ //$NON-NLS-2$ > if (event.isError()) > { >- output = new RemoteError(this, type); >+ output = new RemoteError(this, type); > } > else > { >@@ -83,11 +83,12 @@ > } > String str = line.getString(); > output.setText(str); >- >+ > addOutput(output); >- outputs[i] = output; >+ outputs[i] = output; > } > } >+ // FIXME unify with notifyListeners() below? > if (_lastRefreshJob == null || _lastRefreshJob.isComplete()) > { > _lastRefreshJob = new OutputRefreshJob(this, outputs, false); >@@ -98,7 +99,26 @@ > _lastRefreshJob.addOutputs(outputs); > } > } >- >+ >+ /** >+ * Notify listeners about new outputs. This will update any shell views with >+ * the new data. >+ * >+ * @param outputs the output objects to notify >+ * @param cwdChanged <code>true</code> if the current directory changed >+ * @since org.eclipse.rse.subsystems.shells.core 3.0 >+ */ >+ protected void notifyOutputChanged(IRemoteOutput[] outputs, boolean cwdChanged) { >+ // if (_lastRefreshJob == null || _lastRefreshJob.isComplete()) >+ { >+ _lastRefreshJob = new OutputRefreshJob(this, outputs, cwdChanged); >+ _lastRefreshJob.schedule(); >+ } >+ /* >+ * else { _lastRefreshJob.addOutputs(outputs); >+ * _lastRefreshJob.schedule(); } >+ */ >+ } > > public ICandidateCommand[] getCandidateCommands() > { >Index: src/org/eclipse/rse/subsystems/shells/core/model/RemoteCommandShell.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.subsystems.shells.core/src/org/eclipse/rse/subsystems/shells/core/model/RemoteCommandShell.java,v >retrieving revision 1.9 >diff -u -r1.9 RemoteCommandShell.java >--- src/org/eclipse/rse/subsystems/shells/core/model/RemoteCommandShell.java 12 Sep 2007 20:20:48 -0000 1.9 >+++ src/org/eclipse/rse/subsystems/shells/core/model/RemoteCommandShell.java 3 Apr 2008 09:44:33 -0000 >@@ -1,18 +1,18 @@ > /******************************************************************************** >- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. >+ * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved. > * This program and the accompanying materials are made available under the terms >- * of the Eclipse Public License v1.0 which accompanies this distribution, and is >+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is > * available at http://www.eclipse.org/legal/epl-v10.html >- * >+ * > * Initial Contributors: > * The following IBM employees contributed to the Remote System Explorer >- * component that contains this file: David McKnight, Kushal Munir, >- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, >+ * component that contains this file: David McKnight, Kushal Munir, >+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, > * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. >- * >+ * > * Contributors: >- * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType >- * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty() >+ * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType >+ * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty() > * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry > ********************************************************************************/ > >@@ -46,7 +46,7 @@ > protected IRemoteCmdSubSystem _cmdSubSystem; > protected ArrayList _cmdHistory; > protected IProject _project; >- >+ > public RemoteCommandShell(IRemoteCmdSubSystem cmdSubSystem) > { > _output = new ArrayList(); >@@ -61,13 +61,13 @@ > > public String getName() > { >- return _name; >+ return _name; > } >- > >- >+ >+ > public String getId() >- { >+ { > if (_id == null) > { > IRemoteCmdSubSystem subSystem = getCommandSubSystem(); >@@ -75,12 +75,12 @@ > String name = connection.getAliasName(); > > IRemoteCommandShell[] shells = subSystem.getShells(); >- >+ > List currentNames = new ArrayList(); > for (int i = 0; i < shells.length; i++) > { > IRemoteCommandShell shell = shells[i]; >- if (shell != this) >+ if (shell != this) > { > // DKM - noticed that this caused a stack overflow in one scenario > if (shell instanceof RemoteCommandShell) >@@ -89,7 +89,7 @@ > } > } > } >- if (currentNames.size() > 0) >+ if (currentNames.size() > 0) > { > int number = 2; > String newName = name + " " + number; //$NON-NLS-1$ >@@ -180,7 +180,7 @@ > public IRemoteCmdSubSystem getCommandSubSystem() > { > if (_cmdSubSystem == null) >- { >+ { > if (_fileSubSystem != null) > { > try >@@ -190,7 +190,7 @@ > ISubSystem[] sses = sr.getSubSystems(host); > for (int i = 0; i < sses.length; i++) > { >- if (sses[i] instanceof IRemoteCmdSubSystem) >+ if (sses[i] instanceof IRemoteCmdSubSystem) > { > IRemoteCmdSubSystem cmdSubSystem = (RemoteCmdSubSystem)sses[i]; > _cmdSubSystem = cmdSubSystem; >@@ -221,7 +221,7 @@ > public abstract boolean isActive(); > > public void updateHistory(String cmd) >- { >+ { > /* > String text = cmd; > int tagIndex = text.indexOf("BEGIN-END-TAG"); >@@ -249,7 +249,7 @@ > } > return cmds; > } >- >+ > > /** > * Get the current working directory for this command >@@ -259,7 +259,7 @@ > { > return _cwd; > } >- >+ > /** > * Returns the context of this Shell as a String for persistence. > * The context is typically the current working directory. >@@ -275,7 +275,7 @@ > } > return ""; //$NON-NLS-1$ > } >- >+ > /** > * Get the current working directory for this command > * @return the current working directory >@@ -284,38 +284,39 @@ > { > return _cwd; > } >- >+ > /** > * Set the current working directory for this command >- * @param file >+ * >+ * @param file the working directory. > */ > public void setWorkingDirectory(IRemoteFile file) > { > _cwd = file; > } >- >+ > protected boolean isWindows() > { > return getCommandSubSystem().getHost().getSystemType().isWindows(); > } > >- >- >+ >+ > /** > * Override to provide a list of possible commands > */ > public abstract ICandidateCommand[] getCandidateCommands(); > >- >+ > public void associateProject(IProject project) > { > _project = project; > } >- >- >+ >+ > public IProject getAssociatedProject() > { > return _project; > } >- >+ > } >\ No newline at end of file >#P org.eclipse.rse.subsystems.shells.telnet >Index: src/org/eclipse/rse/internal/subsystems/shells/telnet/TelnetServiceCommandShell.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.subsystems.shells.telnet/src/org/eclipse/rse/internal/subsystems/shells/telnet/TelnetServiceCommandShell.java,v >retrieving revision 1.2 >diff -u -r1.2 TelnetServiceCommandShell.java >--- src/org/eclipse/rse/internal/subsystems/shells/telnet/TelnetServiceCommandShell.java 17 Aug 2007 11:17:07 -0000 1.2 >+++ src/org/eclipse/rse/internal/subsystems/shells/telnet/TelnetServiceCommandShell.java 3 Apr 2008 09:44:35 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2006, 2007 IBM Corporation and others. >+ * Copyright (c) 2006, 2008 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -7,13 +7,14 @@ > * > * Initial Contributors: > * The following IBM employees contributed to the Remote System Explorer >- * component that contains this file: David McKnight, Kushal Munir, >- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, >+ * component that contains this file: David McKnight, Kushal Munir, >+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, > * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. >- * >+ * > * Contributors: > * Martin Oberhuber (Wind River) - Adapted from LocalServiceCommandShell > * Sheldon D'souza (Celunite) - Adapted from SshServiceCommandShell >+ * Martin Oberhuber (Wind River) - [225510][api] Fix OutputRefreshJob API leakage > *******************************************************************************/ > package org.eclipse.rse.internal.subsystems.shells.telnet; > >@@ -25,7 +26,6 @@ > import org.eclipse.core.runtime.Path; > import org.eclipse.rse.core.subsystems.ISubSystem; > import org.eclipse.rse.internal.services.telnet.shell.TelnetHostShell; >-import org.eclipse.rse.internal.subsystems.shells.servicesubsystem.OutputRefreshJob; > import org.eclipse.rse.services.shells.IHostOutput; > import org.eclipse.rse.services.shells.IHostShell; > import org.eclipse.rse.services.shells.IHostShellChangeEvent; >@@ -45,7 +45,7 @@ > private String _curCommand; > private String _workingDir; > private IRemoteFileSubSystem _fs; >- >+ > public TelnetServiceCommandShell(IRemoteCmdSubSystem cmdSS, IHostShell hostShell) { > super(cmdSS, hostShell); > _patterns = new Patterns(); >@@ -70,7 +70,7 @@ > return _fs.getRemoteFileObject(workingDir, new NullProgressMonitor()); > } > catch (Exception e) >- { >+ { > } > } > return null; >@@ -88,27 +88,27 @@ > if (line.endsWith(getPromptCommand())) { > continue; //ignore our synthetic prompt command > } >- >+ > ParsedOutput parsedMsg = null; > if (!gotCommand && line.equals(_curCommand)) { > gotCommand = true; > continue; //ignore remote command echo > } else { > try { >- >+ > // Bug 160202: Remote shell dies. > if ((_curCommand == null) || (!_curCommand.trim().equals("ls"))) { //$NON-NLS-1$ > parsedMsg = _patterns.matchLine(line); >- >+ > // Bug 160202: Remote shell dies. > if (_curCommand != null) { > String temp = _curCommand.trim(); > StringTokenizer tokenizer = new StringTokenizer(temp); >- >+ > if (tokenizer.countTokens() == 2) { > String token1 = tokenizer.nextToken(); > String token2 = tokenizer.nextToken(); >- >+ > if ((token1.equals("ls")) && (token2.indexOf('-') == 0) && (token2.indexOf('l') > 0)) { //$NON-NLS-1$ > if (line.startsWith("total")) { //$NON-NLS-1$ > parsedMsg = null; >@@ -122,25 +122,25 @@ > e.printStackTrace(); > } > } >- >+ > RemoteOutput output = null; >- >+ > String type = "stdout"; //$NON-NLS-1$ >- >+ > if (parsedMsg != null) { > type = parsedMsg.type; > } >- >+ > if (event.isError()) { > output = new RemoteError(this, type); >- } >+ } > else { > output = new RemoteOutput(this, type); > } > > output.setText(line); > if (parsedMsg != null) >- { >+ { > String file = parsedMsg.file; > if (type.equals(ISystemOutputRemoteTypes.TYPE_PROMPT)) > { >@@ -157,29 +157,18 @@ > output.setAbsolutePath(file); > } > } >- >+ > addOutput(output); > outputs.add(output); > } > IRemoteOutput[] remoteOutputs = (IRemoteOutput[])outputs.toArray(new IRemoteOutput[outputs.size()]); >- //if (_lastRefreshJob == null || _lastRefreshJob.isComplete()) >- { >- _lastRefreshJob = new OutputRefreshJob(this, remoteOutputs, false); >- _lastRefreshJob.schedule(); >- } >- /* >- else >- { >- _lastRefreshJob.addOutputs(remoteOutputs); >- _lastRefreshJob.schedule(); >- } >- */ >+ notifyOutputChanged(remoteOutputs, false); > } >- >+ > /** > * Return the prompt command, such that lines ending with the > * prompt command can be removed from output. >- * Should be overridden in case the IHostShell used for this >+ * Should be overridden in case the IHostShell used for this > * service is not an TelnetHostShell. > * @return String promptCommand > */ >#P org.eclipse.rse.subsystems.shells.ssh >Index: src/org/eclipse/rse/internal/subsystems/shells/ssh/SshServiceCommandShell.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.subsystems.shells.ssh/src/org/eclipse/rse/internal/subsystems/shells/ssh/SshServiceCommandShell.java,v >retrieving revision 1.4 >diff -u -r1.4 SshServiceCommandShell.java >--- src/org/eclipse/rse/internal/subsystems/shells/ssh/SshServiceCommandShell.java 27 Apr 2007 12:25:12 -0000 1.4 >+++ src/org/eclipse/rse/internal/subsystems/shells/ssh/SshServiceCommandShell.java 3 Apr 2008 09:44:36 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2006, 2007 IBM Corporation and others. >+ * Copyright (c) 2006, 2008 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -7,12 +7,13 @@ > * > * Initial Contributors: > * The following IBM employees contributed to the Remote System Explorer >- * component that contains this file: David McKnight, Kushal Munir, >- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, >+ * component that contains this file: David McKnight, Kushal Munir, >+ * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, > * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. >- * >+ * > * Contributors: > * Martin Oberhuber (Wind River) - Adapted from LocalServiceCommandShell >+ * Martin Oberhuber (Wind River) - [225510][api] Fix OutputRefreshJob API leakage > *******************************************************************************/ > > package org.eclipse.rse.internal.subsystems.shells.ssh; >@@ -26,7 +27,6 @@ > > import org.eclipse.rse.core.subsystems.ISubSystem; > import org.eclipse.rse.internal.services.ssh.shell.SshHostShell; >-import org.eclipse.rse.internal.subsystems.shells.servicesubsystem.OutputRefreshJob; > import org.eclipse.rse.services.shells.IHostOutput; > import org.eclipse.rse.services.shells.IHostShell; > import org.eclipse.rse.services.shells.IHostShellChangeEvent; >@@ -46,7 +46,7 @@ > private String _curCommand; > private String _workingDir; > private IRemoteFileSubSystem _fs; >- >+ > public SshServiceCommandShell(IRemoteCmdSubSystem cmdSS, IHostShell hostShell) > { > super(cmdSS, hostShell); >@@ -72,13 +72,13 @@ > return _fs.getRemoteFileObject(workingDir, new NullProgressMonitor()); > } > catch (Exception e) >- { >+ { > } > } > return null; > > } >- >+ > public String getContextString() > { > return _workingDir; >@@ -95,27 +95,27 @@ > if (line.endsWith(getPromptCommand())) { > continue; //ignore our synthetic prompt command > } >- >+ > ParsedOutput parsedMsg = null; > if (!gotCommand && line.equals(_curCommand)) { > gotCommand = true; > continue; //ignore remote command echo > } else { > try { >- >+ > // Bug 160202: Remote shell dies. > if ((_curCommand == null) || (!_curCommand.trim().equals("ls"))) { //$NON-NLS-1$ > parsedMsg = _patterns.matchLine(line); >- >+ > // Bug 160202: Remote shell dies. > if (_curCommand != null) { > String temp = _curCommand.trim(); > StringTokenizer tokenizer = new StringTokenizer(temp); >- >+ > if (tokenizer.countTokens() == 2) { > String token1 = tokenizer.nextToken(); > String token2 = tokenizer.nextToken(); >- >+ > if ((token1.equals("ls")) && (token2.indexOf('-') == 0) && (token2.indexOf('l') > 0)) { //$NON-NLS-1$ > if (line.startsWith("total")) { //$NON-NLS-1$ > parsedMsg = null; >@@ -129,25 +129,25 @@ > e.printStackTrace(); > } > } >- >+ > RemoteOutput output = null; >- >+ > String type = "stdout"; //$NON-NLS-1$ >- >+ > if (parsedMsg != null) { > type = parsedMsg.type; > } >- >+ > if (event.isError()) { > output = new RemoteError(this, type); >- } >+ } > else { > output = new RemoteOutput(this, type); > } > > output.setText(line); > if (parsedMsg != null) >- { >+ { > String file = parsedMsg.file; > if (type.equals(ISystemOutputRemoteTypes.TYPE_PROMPT)) > { >@@ -164,29 +164,18 @@ > output.setAbsolutePath(file); > } > } >- >+ > addOutput(output); > outputs.add(output); > } > IRemoteOutput[] remoteOutputs = (IRemoteOutput[])outputs.toArray(new IRemoteOutput[outputs.size()]); >- //if (_lastRefreshJob == null || _lastRefreshJob.isComplete()) >- { >- _lastRefreshJob = new OutputRefreshJob(this, remoteOutputs, false); >- _lastRefreshJob.schedule(); >- } >- /* >- else >- { >- _lastRefreshJob.addOutputs(remoteOutputs); >- _lastRefreshJob.schedule(); >- } >- */ >+ notifyOutputChanged(remoteOutputs, false); > } >- >+ > /** > * Return the prompt command, such that lines ending with the > * prompt command can be removed from output. >- * Should be overridden in case the IHostShell used for this >+ * Should be overridden in case the IHostShell used for this > * service is not an SshHostShell. > * @return String promptCommand > */ >@@ -207,5 +196,5 @@ > super.writeToShell(cmd); > > } >- >+ > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 225510
: 94684