Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changeMetadata doesn't work if the replacement metadata is the same type #2

Open
mel-mason opened this issue May 21, 2019 · 2 comments

Comments

@mel-mason
Copy link

I think the following should be if (!oldName.equals(newName)), as the comment says 'Only metadata objects of the same type (of the same MetadataType object) can be exchanged'

        if (oldName.equals(newName)) {
            // Different metadata types.
            return false;
        }

https://github.com/intranda/ugh/blob/master/ugh/src/ugh/dl/DocStruct.java#L1649

Same bug is present in changeMetadataGroup (https://github.com/intranda/ugh/blob/master/ugh/src/ugh/dl/DocStruct.java#L1384)

I'm trying a workaround using

List<? extends Metadata> oldMetadata = docStruct.getAllMetadataByType(metadataType);
String value = newMetadata.getValue();
oldMetadata.get(0).setValue(value);

but it won't be as robust.

@opaetzel
Copy link
Contributor

This should be fixed with 542a4ef

Can you check if this is fine for you and close the issue if it is?

@mel-mason
Copy link
Author

Thanks! I'm afraid I won't be able to test it any time soon - I don't have a test deployment of goobi yet, and we're not ready for another upgrade in the near future. The fix looks correct to me, though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants