Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry BLIND2018-12-27 10:37:55 -0500
committerThierry BLIND2018-12-27 10:37:55 -0500
commit7fc07d98183ce62586a7a77a03646449e43047f1 (patch)
tree2654e4672c9d3846c219665bce081b3a05b05035
parentb3bb3cb08dcc0ebd2766eaa4f456ff6fe11296ef (diff)
downloadorg.eclipse.pdt-7fc07d98183ce62586a7a77a03646449e43047f1.tar.gz
org.eclipse.pdt-7fc07d98183ce62586a7a77a03646449e43047f1.tar.xz
org.eclipse.pdt-7fc07d98183ce62586a7a77a03646449e43047f1.zip
Bug 543062 - NPE when using Zend profiler and function invocation
statistics Signed-off-by: Thierry BLIND <thierryblind@msn.com>
-rw-r--r--plugins/org.eclipse.php.profile.ui/src/org/eclipse/php/profile/ui/views/FunctionInvocationStatisticsView.java107
1 files changed, 56 insertions, 51 deletions
diff --git a/plugins/org.eclipse.php.profile.ui/src/org/eclipse/php/profile/ui/views/FunctionInvocationStatisticsView.java b/plugins/org.eclipse.php.profile.ui/src/org/eclipse/php/profile/ui/views/FunctionInvocationStatisticsView.java
index 71de3fb09..72eb5ee35 100644
--- a/plugins/org.eclipse.php.profile.ui/src/org/eclipse/php/profile/ui/views/FunctionInvocationStatisticsView.java
+++ b/plugins/org.eclipse.php.profile.ui/src/org/eclipse/php/profile/ui/views/FunctionInvocationStatisticsView.java
@@ -717,34 +717,36 @@ public class FunctionInvocationStatisticsView extends ViewPart {
// callers
ProfilerCallTrace callTrace = fProfilerDB.getCallTrace();
- ProfilerCallTraceLayer[] layers = callTrace.getLayers();
- if (layers.length > 0) {
- callerIDs.add(layers[0].getCalledID()); // store
- // first
- // caller
- for (int i = 1; i < layers.length; ++i) {
- if (layers[i].getType() == ProfilerCallTraceLayer.EXIT && callerIDs.size() > 0) {
- callerIDs.removeElementAt(callerIDs.size() - 1);
- continue;
- }
- if (layers[i].getCalledID() == function.getID() && callerIDs.size() > 0) { // this
- // function
- // is
- // called
- int id = callerIDs.lastElement().intValue(); // get
- // last
- // caller
- if (invokers.containsKey(id)) {
- InvokeFunctionTableElement invoker = (InvokeFunctionTableElement) invokers.get(id);
- invoker.setInvokesNumber(invoker.getInvokesNumber() + 1);
- } else {
- InvokeFunctionTableElement invoker = new InvokeFunctionTableElement();
- invoker.setFunctionData(fProfilerDB.getFunctionData(id));
- invoker.setInvokesNumber(1);
- invokers.put(id, invoker);
+ if (callTrace != null) {
+ ProfilerCallTraceLayer[] layers = callTrace.getLayers();
+ if (layers.length > 0) {
+ callerIDs.add(layers[0].getCalledID()); // store
+ // first
+ // caller
+ for (int i = 1; i < layers.length; ++i) {
+ if (layers[i].getType() == ProfilerCallTraceLayer.EXIT && callerIDs.size() > 0) {
+ callerIDs.removeElementAt(callerIDs.size() - 1);
+ continue;
+ }
+ if (layers[i].getCalledID() == function.getID() && callerIDs.size() > 0) { // this
+ // function
+ // is
+ // called
+ int id = callerIDs.lastElement().intValue(); // get
+ // last
+ // caller
+ if (invokers.containsKey(id)) {
+ InvokeFunctionTableElement invoker = (InvokeFunctionTableElement) invokers.get(id);
+ invoker.setInvokesNumber(invoker.getInvokesNumber() + 1);
+ } else {
+ InvokeFunctionTableElement invoker = new InvokeFunctionTableElement();
+ invoker.setFunctionData(fProfilerDB.getFunctionData(id));
+ invoker.setInvokesNumber(1);
+ invokers.put(id, invoker);
+ }
}
+ callerIDs.add(layers[i].getCalledID());
}
- callerIDs.add(layers[i].getCalledID());
}
}
Object[] elements = new Object[invokers.size()];
@@ -778,34 +780,37 @@ public class FunctionInvocationStatisticsView extends ViewPart {
// callers
ProfilerCallTrace callTrace = fProfilerDB.getCallTrace();
- ProfilerCallTraceLayer[] layers = callTrace.getLayers();
- if (layers.length > 0) {
- callerIDs.add(layers[0].getCalledID()); // store
- // first
- // caller
- for (int i = 1; i < layers.length; ++i) {
- if (layers[i].getType() == ProfilerCallTraceLayer.EXIT && callerIDs.size() > 0) {
- callerIDs.removeElementAt(callerIDs.size() - 1);
- continue;
- }
- if (callerIDs.size() > 0) {
- if (callerIDs.lastElement().intValue() == function.getID()) { // this
- // function
- // calls
- // somebody
- int id = layers[i].getCalledID();
- if (invokees.containsKey(id)) {
- InvokeFunctionTableElement invokee = (InvokeFunctionTableElement) invokees.get(id);
- invokee.setInvokesNumber(invokee.getInvokesNumber() + 1);
- } else {
- InvokeFunctionTableElement invokee = new InvokeFunctionTableElement();
- invokee.setFunctionData(fProfilerDB.getFunctionData(id));
- invokee.setInvokesNumber(1);
- invokees.put(id, invokee);
+ if (callTrace != null) {
+ ProfilerCallTraceLayer[] layers = callTrace.getLayers();
+ if (layers.length > 0) {
+ callerIDs.add(layers[0].getCalledID()); // store
+ // first
+ // caller
+ for (int i = 1; i < layers.length; ++i) {
+ if (layers[i].getType() == ProfilerCallTraceLayer.EXIT && callerIDs.size() > 0) {
+ callerIDs.removeElementAt(callerIDs.size() - 1);
+ continue;
+ }
+ if (callerIDs.size() > 0) {
+ if (callerIDs.lastElement().intValue() == function.getID()) { // this
+ // function
+ // calls
+ // somebody
+ int id = layers[i].getCalledID();
+ if (invokees.containsKey(id)) {
+ InvokeFunctionTableElement invokee = (InvokeFunctionTableElement) invokees
+ .get(id);
+ invokee.setInvokesNumber(invokee.getInvokesNumber() + 1);
+ } else {
+ InvokeFunctionTableElement invokee = new InvokeFunctionTableElement();
+ invokee.setFunctionData(fProfilerDB.getFunctionData(id));
+ invokee.setInvokesNumber(1);
+ invokees.put(id, invokee);
+ }
}
}
+ callerIDs.add(layers[i].getCalledID());
}
- callerIDs.add(layers[i].getCalledID());
}
}
Object[] elements = new Object[invokees.size()];

Back to the top