org.apache.xalan.transformer
Class StackGuard

java.lang.Object
  extended by org.apache.xalan.transformer.StackGuard

public class StackGuard
extends java.lang.Object

Class to guard against recursion getting too deep.


Field Summary
private  int m_recursionLimit
          Used for infinite loop check.
(package private)  TransformerImpl m_transformer
           
 
Constructor Summary
StackGuard(TransformerImpl transformerImpl)
          Constructor StackGuard
 
Method Summary
 void checkForInfinateLoop()
          Check if we are in an infinite loop
 int countLikeTemplates(ElemTemplate templ, int pos)
          Overide equal method for StackGuard objects
private  ElemTemplate getNextMatchOrNamedTemplate(int pos)
          Get the next named or match template down from and including the given position.
 int getRecursionLimit()
          Get the recursion limit.
 void setRecursionLimit(int limit)
          Set the recursion limit.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_recursionLimit

private int m_recursionLimit
Used for infinite loop check. If the value is -1, do not check for infinite loops. Anyone who wants to enable that check should change the value of this variable to be the level of recursion that they want to check. Be careful setting this variable, if the number is too low, it may report an infinite loop situation, when there is none. Post version 1.0.0, we'll make this a runtime feature.


m_transformer

TransformerImpl m_transformer
Constructor Detail

StackGuard

public StackGuard(TransformerImpl transformerImpl)
Constructor StackGuard

Method Detail

getRecursionLimit

public int getRecursionLimit()
Get the recursion limit. Used for infinite loop check. If the value is -1, do not check for infinite loops. Anyone who wants to enable that check should change the value of this variable to be the level of recursion that they want to check. Be careful setting this variable, if the number is too low, it may report an infinite loop situation, when there is none. Post version 1.0.0, we'll make this a runtime feature.

Returns:
The recursion limit.

setRecursionLimit

public void setRecursionLimit(int limit)
Set the recursion limit. Used for infinite loop check. If the value is -1, do not check for infinite loops. Anyone who wants to enable that check should change the value of this variable to be the level of recursion that they want to check. Be careful setting this variable, if the number is too low, it may report an infinite loop situation, when there is none. Post version 1.0.0, we'll make this a runtime feature.

Parameters:
limit - The recursion limit.

countLikeTemplates

public int countLikeTemplates(ElemTemplate templ,
                              int pos)
Overide equal method for StackGuard objects


getNextMatchOrNamedTemplate

private ElemTemplate getNextMatchOrNamedTemplate(int pos)
Get the next named or match template down from and including the given position.

Parameters:
pos - the current index position in the stack.
Returns:
null if no matched or named template found, otherwise the next named or matched template at or below the position.

checkForInfinateLoop

public void checkForInfinateLoop()
                          throws javax.xml.transform.TransformerException
Check if we are in an infinite loop

Throws:
javax.xml.transform.TransformerException