mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-25 18:05:33 +02:00
patch for defect 147531
This commit is contained in:
parent
e896d33266
commit
cdf07cd4b3
4 changed files with 50 additions and 17 deletions
|
@ -197,7 +197,7 @@ public class UniversalProcessMiner extends Miner implements IUniversalProcessDat
|
|||
{
|
||||
try
|
||||
{
|
||||
HostProcessFilterImpl pfs = new HostProcessFilterImpl(subject.getSource());
|
||||
HostProcessFilterImpl pfs = new HostProcessFilterImpl(subject.getSource(), true);
|
||||
lookupProcesses(pfs, subject);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -49,22 +49,24 @@ public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable, ISy
|
|||
protected boolean anystatus;
|
||||
protected String status;
|
||||
protected HashMap states;
|
||||
protected boolean _resolveVariables;
|
||||
|
||||
/**
|
||||
* Constructor to use when there is no existing filter string.
|
||||
*/
|
||||
public HostProcessFilterImpl()
|
||||
{
|
||||
name = ALL;
|
||||
username = ALL;
|
||||
gid = ALL;
|
||||
ppid = ALL;
|
||||
pid = ALL;
|
||||
minVM = 0;
|
||||
maxVM = -1;
|
||||
anystatus = true;
|
||||
initStates();
|
||||
status = "";
|
||||
_resolveVariables = false;
|
||||
init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor to use when there is no existing filter string.
|
||||
*/
|
||||
public HostProcessFilterImpl(boolean resolveVariables)
|
||||
{
|
||||
_resolveVariables = resolveVariables;
|
||||
init();
|
||||
}
|
||||
|
||||
protected void initStates()
|
||||
|
@ -80,6 +82,35 @@ public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable, ISy
|
|||
* Constructor to use when filter string already exists.
|
||||
*/
|
||||
public HostProcessFilterImpl(String input)
|
||||
{
|
||||
_resolveVariables = false;
|
||||
initInput(input);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor to use when filter string already exists.
|
||||
*/
|
||||
public HostProcessFilterImpl(String input, boolean resolveVariables)
|
||||
{
|
||||
_resolveVariables = resolveVariables;
|
||||
initInput(input);
|
||||
}
|
||||
|
||||
protected void init()
|
||||
{
|
||||
name = ALL;
|
||||
username = ALL;
|
||||
gid = ALL;
|
||||
ppid = ALL;
|
||||
pid = ALL;
|
||||
minVM = 0;
|
||||
maxVM = -1;
|
||||
anystatus = true;
|
||||
initStates();
|
||||
status = "";
|
||||
}
|
||||
|
||||
protected void initInput(String input)
|
||||
{
|
||||
anystatus = true;
|
||||
StringTokenizer tz = new StringTokenizer(input, "|");
|
||||
|
@ -178,7 +209,6 @@ public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable, ISy
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public HashMap getStates()
|
||||
{
|
||||
return states;
|
||||
|
@ -197,11 +227,11 @@ public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable, ISy
|
|||
*/
|
||||
public String getUsername()
|
||||
{
|
||||
if (username.equals("${user.id}"))
|
||||
if (_resolveVariables && username.equals("${user.id}"))
|
||||
{
|
||||
return System.getProperty("user.name");
|
||||
}
|
||||
return username;
|
||||
else return username;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -387,7 +417,10 @@ public class HostProcessFilterImpl implements IHostProcessFilter, Cloneable, ISy
|
|||
String state = tokens[PROCESS_ATTRIBUTES_INDEX_STATUS].trim();
|
||||
if (!satisfiesState(state)) return false;
|
||||
|
||||
matcher = new NamePatternMatcher(getUsername(), true, false);
|
||||
if (getUsername().equals("${user.id}"))
|
||||
matcher = new NamePatternMatcher(ALL, true, false);
|
||||
else
|
||||
matcher = new NamePatternMatcher(getUsername(), true, false);
|
||||
if (!matcher.matches(tokens[PROCESS_ATTRIBUTES_INDEX_USERNAME])) return false;
|
||||
matcher = new NamePatternMatcher(ppid, true, false);
|
||||
if (!matcher.matches(tokens[PROCESS_ATTRIBUTES_INDEX_PPID])) return false;
|
||||
|
|
|
@ -180,7 +180,7 @@ public class UniversalAIXProcessHandler implements ProcessHandler, ISystemProces
|
|||
|
||||
// after the kill command is executed, the process might have changed
|
||||
// attributes, or might be gone, so requery
|
||||
HostProcessFilterImpl rpfs = new HostProcessFilterImpl();
|
||||
HostProcessFilterImpl rpfs = new HostProcessFilterImpl(true);
|
||||
rpfs.setPid("" + process.getPid());
|
||||
SortedSet results = lookupProcesses(rpfs);
|
||||
if (results == null || results.size() == 0) return null;
|
||||
|
|
|
@ -64,7 +64,7 @@ public class UniversalLinuxProcessHandler implements ProcessHandler, IServiceCon
|
|||
|
||||
// after the kill command is executed, the process might have changed
|
||||
// attributes, or might be gone, so requery
|
||||
HostProcessFilterImpl rpfs = new HostProcessFilterImpl();
|
||||
HostProcessFilterImpl rpfs = new HostProcessFilterImpl(true);
|
||||
rpfs.setPid("" + process.getPid());
|
||||
SortedSet results = lookupProcesses(rpfs);
|
||||
if (results == null || results.size() == 0) return null;
|
||||
|
|
Loading…
Add table
Reference in a new issue