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

ISPN-12592 Improve error message when XML element is removed #8949

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -329,4 +329,13 @@ public static void ignoreAttribute(XMLExtendedStreamReader reader, Enum<?> attri
public static void ignoreElement(XMLExtendedStreamReader reader, Enum<?> element) {
CONFIG.ignoreXmlElement(element, reader.getLocation().getLineNumber(), reader.getLocation().getColumnNumber());
}

public static XMLStreamException elementRemovedUseOther(XMLExtendedStreamReader reader, String newElementName) {
return CONFIG.elementRemovedUseOther(reader.getLocalName(), newElementName, reader.getLocation());
}

public static XMLStreamException attributeRemovedUseOther(XMLExtendedStreamReader reader, Enum<?> attribute,
String newAttributeName) {
return CONFIG.attributeRemovedUseOther(attribute.toString(), newAttributeName, reader.getLocation());
}
}
Expand Up @@ -142,7 +142,7 @@ private void parseSerialization(final XMLExtendedStreamReader reader, final Conf
}
case WHITE_LIST:
if (reader.getSchema().since(12, 0)) {
throw ParseUtils.unexpectedElement(reader, element);
throw ParseUtils.elementRemovedUseOther(reader, element.getLocalName());
} else {
CONFIG.elementDeprecatedUseOther(Element.WHITE_LIST, Element.ALLOW_LIST);
}
Expand Down
8 changes: 8 additions & 0 deletions core/src/main/java/org/infinispan/util/logging/Log.java
Expand Up @@ -23,6 +23,8 @@
import javax.transaction.TransactionManager;
import javax.transaction.xa.XAResource;
import javax.xml.namespace.QName;
import javax.xml.stream.Location;
import javax.xml.stream.XMLStreamException;

import org.infinispan.commands.ReplicableCommand;
import org.infinispan.commons.CacheConfigurationException;
Expand Down Expand Up @@ -2102,4 +2104,10 @@ CacheConfigurationException storeConfiguredHasBothReadAndWriteOnly(String storeC

@Message(value = "Unable to migrate data across multiple major versions", id = 616)
PersistenceException persistedDataMigrationAcrossMajorVersions();

@Message(value = "Element '%s' has been removed. Please use element '%s' instead", id = 617)
XMLStreamException elementRemovedUseOther(String elementName, String newElementName, @Param Location location);

@Message(value = "Attribute '%s' has been removed. Please use attribute '%s' instead", id = 618)
XMLStreamException attributeRemovedUseOther(String attributeName, String newAttributeName, @Param Location location);
}