eo-yaml: & char cannot read in folded scalar contents.

Reading a yml file that contains folded scalar throws java.lang.StringIndexOutOfBoundsException: String index out of range: -1 the file;

"help-messages": >
  &a====== %prefix% Player Commands &a======
  &7/rank &r> &eShows help message.
  &7/rank help &r> &eShows help message.
  &7/rank menu &r> &eOpens your profile menu.
  &7/rank check &r> &eCheck and promote your rank.
  &7/rank list &r> &eShows all ranks.
  &a====== %prefix% Admin Commands &a======
  &7/rank reload &r> &eReloads the plugin.
  &7/rank version &r> &eChecks for update.
  &7/rank promote <player> &r> &eInstantly promote the player.
  &7/rank set <player> <rank> &r> &eChange the player rank.
  &7/rank menu <target> &r> &eShows profile menu of the target.

the method that I use: Yaml.createYamlInput(contents).readYamlMapping() and full error message

java.lang.StringIndexOutOfBoundsException: String index out of range: -1

	at java.base/java.lang.String.substring(String.java:1837)
	at com.amihaiemil.eoyaml.RtYamlLine.requireNestedIndentation(RtYamlLine.java:152)
	at com.amihaiemil.eoyaml.WellIndented.iterator(WellIndented.java:125)
	at com.amihaiemil.eoyaml.SameIndentationLevel.iterator(SameIndentationLevel.java:74)
	at com.amihaiemil.eoyaml.ReadYamlMapping.lambda$comment$6(ReadYamlMapping.java:199)
	at com.amihaiemil.eoyaml.Skip.iterator(Skip.java:74)
	at com.amihaiemil.eoyaml.Backwards.iterator(Backwards.java:69)
	at com.amihaiemil.eoyaml.FirstCommentFound.iterator(FirstCommentFound.java:83)
	at com.amihaiemil.eoyaml.Backwards.iterator(Backwards.java:69)
	at com.amihaiemil.eoyaml.ReadComment.value(ReadComment.java:66)
	at com.amihaiemil.eoyaml.RtYamlPrinter.printPossibleComment(RtYamlPrinter.java:298)
	at com.amihaiemil.eoyaml.RtYamlPrinter.print(RtYamlPrinter.java:69)
	at com.amihaiemil.eoyaml.BaseYamlNode.toString(BaseYamlNode.java:104)
	at java.base/java.lang.String.valueOf(String.java:2951)
	at java.base/java.lang.StringBuilder.append(StringBuilder.java:168)
	at io.github.portlek.configs.files.yaml.Helper.loadFromString(Helper.java:52)
	at io.github.portlek.configs.files.yaml.YamlConfiguration.loadFromString(YamlConfiguration.java:62)
	at io.github.portlek.configs.configuration.FileConfiguration.load(FileConfiguration.java:77)
	at io.github.portlek.configs.configuration.FileConfiguration.load(FileConfiguration.java:59)
	at io.github.portlek.configs.files.yaml.YamlConfiguration.loadConfiguration(YamlConfiguration.java:41)
	at io.github.portlek.configs.files.FileType.load(FileType.java:53)
	at io.github.portlek.configs.processors.ConfigProceed.load(ConfigProceed.java:77)
	at java.base/java.util.Optional.ifPresent(Optional.java:183)
	at io.github.portlek.configs.processors.LinkedConfigProceed.load(LinkedConfigProceed.java:50)
	at io.github.portlek.configs.structure.linked.LnkdManaged.load(LnkdManaged.java:52)
	at io.github.portlek.configs.structure.RunnerTest.before(RunnerTest.java:38)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:686)
	at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
	at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptLifecycleMethod(TimeoutExtension.java:126)
	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptBeforeAllMethod(TimeoutExtension.java:68)
	at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeBeforeAllMethods$8(ClassBasedTestDescriptor.java:375)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeBeforeAllMethods(ClassBasedTestDescriptor.java:373)
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:193)
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:78)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:132)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1540)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:248)
	at org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$5(DefaultLauncher.java:211)
	at org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:226)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:199)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:132)
	at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:69)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (14 by maintainers)

Commits related to this issue

Most upvoted comments

@portlek 5.1.3 is out, with the workaround. I will fix this Issue, probably in the weekend, with the correct, escaping solution.

@portlek I’m pretty sure the problem is here. Everything after & gets cut off – the intent was to eliminate aliases and achors (which are not yet supported).

I’ll fix it asap.

Yea i did;

"help-messages": >
  test
  test

this is working but this is not;

"help-messages": >
  &test
  test&