What steps will reproduce the problem?
1. Add two SccpAddresses with similar patterns like "1/????" and "2/????".
2. Number of the "?" must be equal after separator "/"
What is the expected output? What do you see instead?
Expected: Rule added.
Instead: java.lang.StackOverflowError.
What version of the product are you using? On what operating system?
jSS7 2.1.0.FINAL, Windows 8.1 x64
Please provide any additional information below.
Stack trace:
Exception in thread "main" java.lang.StackOverflowError
at org.mobicents.protocols.ss7.sccp.impl.router.RuleComparator.compareQuestionMarksIndex(RuleComparator.java:135)
at org.mobicents.protocols.ss7.sccp.impl.router.RuleComparator.compareQuestionMarksIndex(RuleComparator.java:144)
at org.mobicents.protocols.ss7.sccp.impl.router.RuleComparator.compareQuestionMarksIndex(RuleComparator.java:144)
at org.mobicents.protocols.ss7.sccp.impl.router.RuleComparator.compareQuestionMarksIndex(RuleComparator.java:144)
at org.mobicents.protocols.ss7.sccp.impl.router.RuleComparator.compareQuestionMarksIndex(RuleComparator.java:144)
at org.mobicents.protocols.ss7.sccp.impl.router.RuleComparator.compareQuestionMarksIndex(RuleComparator.java:144)
at org.mobicents.protocols.ss7.sccp.impl.router.RuleComparator.compareQuestionMarksIndex(RuleComparator.java:144)
at org.mobicents.protocols.ss7.sccp.impl.router.RuleComparator.compareQuestionMarksIndex(RuleComparator.java:144)
at org.mobicents.protocols.ss7.sccp.impl.router.RuleComparator.compareQuestionMarksIndex(RuleComparator.java:144)
at org.mobicents.protocols.ss7.sccp.impl.router.RuleComparator.compareQuestionMarksIndex(RuleComparator.java:144)
Found cause in method:
private int compareQuestionMarksIndex(String digits1, int fromIndex1, String
digits2, int fromIndex2){
...
// Keep comparing occurrence of "?" till difference is reached
line 144: compareQuestionMarksIndex(digits1, index1, digits2,
index2);
Solution is to change it to:
// Keep comparing occurrence of "?" till difference is reached
compareQuestionMarksIndex(digits1, index1 + 1, digits2, index2 + 1);
Because:
int index1 = digits1.indexOf(WILDCARD_SINGLE, fromIndex1);
int index2 = digits2.indexOf(WILDCARD_SINGLE, fromIndex2);
will produce the same indexes:
index1 = fromIndex1
and
index2 = fromIndex2
and call of the compareQuestionMarksIndex will enter in infinite loop -
compareQuestionMarksIndex will be called with the same index values.
After correction no exception is thrown and rule is successfully added.
Original issue reported on code.google.com by asimil...@gmail.com on 18 Feb 2015 at 1:39
Original issue reported on code.google.com by
asimil...@gmail.com
on 18 Feb 2015 at 1:39