Decompile the plugin and find some low level bug like this:
FileContentTypeManager.java function createOrUpdateFileContentTypeEntity
final List<Attachment> attachments = fileContentEntity.getAttachments();
for (int i = 0; i < attachments.size(); ++i) {
final Attachment attachment = attachments.get(i);
fileContentEntity.removeAttachment(attachment);
}
ContentEntityObject.java
public List<Attachment> getAttachments() {
return this.attachments;
}
the list doesn‘t clone that make this code can only remove just one attachment
that cause Database foreignkey ERROR ,then cause the save error
just clone and do the right cycle fix the low level bug
final List<Attachment> attachments = new ArrayList<>(fileContentEntity.getAttachments());
for (int i = 0; i < attachments.size(); i++) {
final Attachment attachment = attachments.get(i);
fileContentEntity.removeAttachment(attachment);
}
same with the tempEntityAttachments
final List<Attachment> tempEntityAttachments = new ArrayList<>(tempEntity.getAttachments());
for (int i = 0; i < tempEntityAttachments.size(); i++) {
final Attachment attachment = tempEntityAttachments.get(i);
tempEntity.removeAttachment(attachment);
}