`YAMLSchema.CORE` decodes YAML 1.2 base-10 integers with leading zeros as legacy octals
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 58/100
Research direction
Start by tracing YAML integer parsing under YAMLSchema.CORE in the YAML dataformat module; the issue does not name implementation files or tests. Reproduce with the provided YAMLMapper example using val: 0640, then find or add a focused regression test. Done means the parsed value is decimal 640 under the Core Schema while other integer formats remain correct.
Written by the indexing model from the issue text.
Description
When using Jackson 3.x with YAMLSchema.CORE (which implements YAML 1.2 Core Schema rules), numbers with leading zeros (e.g., 0640) are correctly classified as numbers, since YAML 1.2 dropped the YAML 1.1 leading zero requirement for octals (octals in 1.2 use 0o). However, Jackson subsequently decodes the number using legacy Java octal rules, resulting in the decimal value 416 instead of 640.
In the YAML 1.2 Core Schema, the integer regex is [-+]? [0-9]+. Therefore, 0640 is a valid base-10 integer and should evaluate to 640.
Reproducing the Issue
pom.xml
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>yamltest</artifactId>
<version>1.0.0</version>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>tools.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>3.2.3</version>
</dependency>
<dependency>
<groupId>tools.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
<version>3.2.3</version>
</dependency>
</dependencies>
</project>
Main.java
import tools.jackson.databind.JsonNode;
import tools.jackson.dataformat.yaml.YAMLMapper;
import tools.jackson.dataformat.yaml.YAMLSchema;
import tools.jackson.dataformat.yaml.YAMLFactory;
public class Main {
public static void main(String[] args) throws Exception {
YAMLMapper mapper = YAMLMapper.builder(
YAMLFactory.builder().yamlSchema(YAMLSchema.CORE).build()
).build();
JsonNode node = mapper.readTree("val: 0640");
System.out.println("Parsed Value: " + node.get("val").asInt());
// Expected: 640
// Actual: 416
}
}
Expected Behavior
The node should evaluate to the base-10 integer 640.
Actual Behavior
The node evaluates to 416 (octal conversion of 0640).
- Dominant language
- Java
- Stars
- 454
- Forks
- 176
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 16
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from FasterXML/jackson-dataformats-text
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
FasterXML/jackson-dataformats-text#741 · 1 comment ·
Maintainers usually reply within 1 day
-
`TomlGenerator` writes date/time values without seconds (`LocalTime.of(10, 0)` as `10:00`)Possibly taken @JimmyLiuJia claimed this 34 days ago. OpenTOML
Difficulty 1/5 Under an hour Newbie friendliness 20/100
FasterXML/jackson-dataformats-text#780 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
FasterXML/jackson-dataformats-text#733 ·
Maintainers usually reply within 1 day
-
yaml
Difficulty 3/5 1-2 days Newbie friendliness 48/100
FasterXML/jackson-dataformats-text#661 · 6 comments ·
Maintainers usually reply within 1 day
-
yaml
Difficulty 5/5 Over a week Newbie friendliness 25/100
FasterXML/jackson-dataformats-text#612 · 1 comment ·
Maintainers usually reply within 1 day
All issues in FasterXML/jackson-dataformats-text
Similar issues
-
Cleanup: restore the interrupt flag in AiFailureAnalyzerPossibly taken @Rishankgupta08 claimed this today. Opengood first issue
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
seleniumboot/selenium-boot#258 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
dense-analysis/ale#5181 ·
-
bug subsystem:agent-harness triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
ShaftHQ/SHAFT_ENGINE#8043 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
johanhaleby/occurrent#1505 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day