Watermark and text field lose their content after applying other annotations

Watermark and text field lose their content after applying other annotations.

Files: watermark-lose-content.7z (191.7 KB)
Git project: GitHub - groupdocs-annotation/GroupDocs.Annotation-for-Java: GroupDocs.Annotation for Java examples, plugins, and showcase
Git branch: master
Git revision: aeb3d5d9
Browser: Chrome Version 92.0.4515.159 (Official Build) (64-bit)
SO: Windows 10
Java version: 1.8.0_281
watermark-lose-content.7z (192 KB)

@john.mcqueide

This issue is under investigation with ticket ID ANNOTATIONJAVA-1336.

1 Like

@vitaliy.rezchikov

I figure out the issue cause in AnnotationMapper class, when it tries to get annotation text it didn`t check when the annotation if of the type IText, so just add new clause.

public class AnnotationMapper {
    ...
    public static AnnotationDataEntity mapAnnotationDataEntity(AnnotationBase annotationInfo, PageInfo pageInfo) {
        ...
        String text = "";
        if (annotationInfo.getMessage() == null && annotationInfo instanceof ITextToReplace) {
            text = ((ITextToReplace) annotationInfo).getTextToReplace();
        //NEW CODE
        } else if (annotationInfo instanceof IText && ((IText) annotationInfo).getText() != null) {
            text = ((IText) annotationInfo).getText();
        }else if (annotationInfo.getMessage() != null) {
            text = annotationInfo.getMessage();
        }
        annotation.setText(text);
        ...
    }
}
1 Like

@john.mcqueide

Good to know that the issue is resolved.

1 Like

The issues you have found earlier (filed as ANNOTATIONJAVA-1336) have been fixed in this update. This message was posted using Bugs notification tool by vitaliy.rezchikov