Closed firebird-automations closed 18 years ago
Commented by: Alice F. Bird (firebirds)
Date: 2004-08-21 23:53 Sender: rrokytskyy Logged In: YES user_id=356832
Thanks for the report! The fix is a bit simpler than yours - I just reversed the loop. The reason to remove addresses from Reference is to provide a possibility to set non-standard parameters isc_* as normal addresses. See FBConnectionPoolDataSource.getObjectInstance:
if \(element\.getContent\(\) instanceof String\)
ds\.setProperty\(type,
element.getContent().toString());
Submitted by: c0s (c0s)
SFID: 1013117# Submitted By: c0s
An algorithm in this method deletes all recognized refAddrs from the given reference object and does this by index.
I don't know why it has to delete but it proceeds in a wrong way.
The documentation for the method Reference.remove(addrIndex) states: * All addresses at index greater than posn are shifted down * the list by one (towards index 0) but the existing algorithm doesn't take it into account that leads to sudden ArrayIndexOutOfBoundsException.
I solved this problem in the following way:
<...> java.util.List addressesToRemove = new java.util.ArrayList(ref.size()); <...> addressesToRemove.add(new Integer(i)); <...> // removed matched addresses for (int i = addressesToRemove.size()-1; i >= 0; i--) { int addrIndex = ((Integer) addressesToRemove.get(i)).intValue(); ref.remove(addrIndex); } <...>
but you may consider another similar approach.