> `DTD.getElement(String)` is not thread safe. If there are 2 parallel parser > threads which call with the same new name then in the Vector there can be 2 > identical elements. These unsynchronized elementHash.get(name) calls can both > observe null before either thread creates and puts the `Element` which will > then have duplicates. The index from elements.size() can also be wrong under > races. > > The block needs to be synchronized to prevent this > > --------- > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai).
Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision: Make other methods thread safe ------------- Changes: - all: https://git.openjdk.org/jdk/pull/31568/files - new: https://git.openjdk.org/jdk/pull/31568/files/9100a951..fae615ed Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=31568&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=31568&range=00-01 Stats: 13 lines in 1 file changed: 2 ins; 3 del; 8 mod Patch: https://git.openjdk.org/jdk/pull/31568.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/31568/head:pull/31568 PR: https://git.openjdk.org/jdk/pull/31568
