ws-security-common/src/main/java/org/apache/wss4j/common/util/NSStack.java [183:224]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public String getPrefix(String namespaceURI, boolean noDefault) {
        if (namespaceURI == null || namespaceURI.isEmpty()) {
            return null;
        }
        int hash = namespaceURI.hashCode();

        // If defaults are OK, and the given NS is the current default,
        // return "" as the prefix to favor defaults where possible.
        if (!noDefault && currentDefaultNS > 0 && stack[currentDefaultNS] != null
            && namespaceURI.equals(stack[currentDefaultNS].getNamespaceURI())) {
            return "";
        }
        for (int cursor = top; cursor > 0; cursor--) {
            Mapping map = stack[cursor];
            if (map == null) {
                continue;
            }
            if (map.getNamespaceHash() == hash && map.getNamespaceURI().equals(namespaceURI)) {
                String possiblePrefix = map.getPrefix();
                if (noDefault && possiblePrefix.length() == 0) {
                    continue;
                }

                // now make sure that this is the first occurance of this
                // particular prefix
                int ppHash = possiblePrefix.hashCode();
                for (int cursor2 = top; true; cursor2--) {
                    if (cursor2 == cursor) {
                        return possiblePrefix;
                    }
                    map = stack[cursor2];
                    if (map == null) {
                        continue;
                    }
                    if (ppHash == map.getPrefixHash() && possiblePrefix.equals(map.getPrefix())) {
                        break;
                    }
                }
            }
        }
        return null;
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



policy/src/main/java/org/apache/wss4j/policy/model/NSStack.java [173:214]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public String getPrefix(String namespaceURI, boolean noDefault) {
        if (namespaceURI == null || namespaceURI.isEmpty()) {
            return null;
        }
        int hash = namespaceURI.hashCode();

        // If defaults are OK, and the given NS is the current default,
        // return "" as the prefix to favor defaults where possible.
        if (!noDefault && currentDefaultNS > 0 && stack[currentDefaultNS] != null
            && namespaceURI.equals(stack[currentDefaultNS].getNamespaceURI())) {
            return "";
        }
        for (int cursor = top; cursor > 0; cursor--) {
            Mapping map = stack[cursor];
            if (map == null) {
                continue;
            }
            if (map.getNamespaceHash() == hash && map.getNamespaceURI().equals(namespaceURI)) {
                String possiblePrefix = map.getPrefix();
                if (noDefault && possiblePrefix.length() == 0) {
                    continue;
                }

                // now make sure that this is the first occurance of this
                // particular prefix
                int ppHash = possiblePrefix.hashCode();
                for (int cursor2 = top; true; cursor2--) {
                    if (cursor2 == cursor) {
                        return possiblePrefix;
                    }
                    map = stack[cursor2];
                    if (map == null) {
                        continue;
                    }
                    if (ppHash == map.getPrefixHash() && possiblePrefix.equals(map.getPrefix())) {
                        break;
                    }
                }
            }
        }
        return null;
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



