Skip to content

DIUTILS-9: Fix IndexOutOfBoundsException on MARC 005 field replace in addOrReplaceControlField - #82

Merged
Aliaksandr-Fedasiuk merged 1 commit into
masterfrom
DIUTILS-9
Sep 30, 2026
Merged

Aliaksandr-Fedasiuk merged 1 commit into
masterfrom
DIUTILS-9

Conversation

@Aliaksandr-Fedasiuk

@Aliaksandr-Fedasiuk Aliaksandr-Fedasiuk commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Purpose

MarcFieldEditor.addOrReplaceControlField throws IndexOutOfBoundsException: Index -1 out of bounds when replacing control field 005.

Approach

Fix addOrReplaceControlField to use removeVariableField/addVariableField instead of getControlFields().set(indexOf(...)), which operated on a defensive copy and silently left the record unchanged.

Changes Checklist

  • Unit Testing: Confirm that changed classes were covered by unit tests.
  • NEWS: Confirm that the NEWS file is updated with relevant information about the changes made in this pull request.

Learning and Resources

DIUTILS-9

@sonarqubecloud

Copy link
Copy Markdown

@Aliaksandr-Fedasiuk
Aliaksandr-Fedasiuk merged commit dea8423 into master Sep 30, 2026
16 checks passed
@Aliaksandr-Fedasiuk
Aliaksandr-Fedasiuk deleted the DIUTILS-9 branch September 30, 2026 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants