Package org.yaml.snakeyaml
Class LoaderOptions
java.lang.Object
org.yaml.snakeyaml.LoaderOptions
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
private boolean
private int
private boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
int
boolean
boolean
void
setAllowDuplicateKeys
(boolean allowDuplicateKeys) Allow/Reject duplicate map keys in the YAML file.void
setAllowRecursiveKeys
(boolean allowRecursiveKeys) Allow recursive keys for mappings.void
setMaxAliasesForCollections
(int maxAliasesForCollections) Restrict the amount of aliases for collections (sequences and mappings) to avoid https://en.wikipedia.org/wiki/Billion_laughs_attackvoid
setWrappedToRootException
(boolean wrappedToRootException) Wrap runtime exception to YAMLException during parsing or leave them as they are Default is to leave original exceptions
-
Field Details
-
allowDuplicateKeys
private boolean allowDuplicateKeys -
wrappedToRootException
private boolean wrappedToRootException -
maxAliasesForCollections
private int maxAliasesForCollections -
allowRecursiveKeys
private boolean allowRecursiveKeys
-
-
Constructor Details
-
LoaderOptions
public LoaderOptions()
-
-
Method Details
-
isAllowDuplicateKeys
public boolean isAllowDuplicateKeys() -
setAllowDuplicateKeys
public void setAllowDuplicateKeys(boolean allowDuplicateKeys) Allow/Reject duplicate map keys in the YAML file. Default is to allow. YAML 1.1 is slightly vague around duplicate entries in the YAML file. The best reference is 3.2.1.3. Nodes Comparison where it hints that a duplicate map key is an error. For future reference, YAML spec 1.2 is clear. The keys MUST be unique. 1.3. Relation to JSON- Parameters:
allowDuplicateKeys
- false to reject duplicate mapping keys
-
isWrappedToRootException
public boolean isWrappedToRootException() -
setWrappedToRootException
public void setWrappedToRootException(boolean wrappedToRootException) Wrap runtime exception to YAMLException during parsing or leave them as they are Default is to leave original exceptions- Parameters:
wrappedToRootException
- - true to convert runtime exception to YAMLException
-
getMaxAliasesForCollections
public int getMaxAliasesForCollections() -
setMaxAliasesForCollections
public void setMaxAliasesForCollections(int maxAliasesForCollections) Restrict the amount of aliases for collections (sequences and mappings) to avoid https://en.wikipedia.org/wiki/Billion_laughs_attack- Parameters:
maxAliasesForCollections
- set max allowed value (50 by default)
-
setAllowRecursiveKeys
public void setAllowRecursiveKeys(boolean allowRecursiveKeys) Allow recursive keys for mappings. By default it is not allowed. This setting only prevents the case when the key is the value. If the key is only a part of the value (the value is a sequence or a mapping) then this case is not recognized and always allowed.- Parameters:
allowRecursiveKeys
- - false to disable recursive keys
-
getAllowRecursiveKeys
public boolean getAllowRecursiveKeys()
-