objectionary / objectionary/lints
`LtInconsistentArgs` throws `NoSuchElementException` when parent object lacks `@name` attribute
Open
@h1alexbel is already working on this.
Since Jun 8, 2025.
bug
good-title
help wanted
- Dominant language
- Java
- Stars
- 14
- Forks
- 39
- Avg merge
- 22h 54m
- Merged PRs (30d)
- 90
Description
Getting this:
Caused by: java.util.NoSuchElementException: No value present
at java.util.Optional.get (Optional.java:143)
at org.eolang.lints.LtInconsistentArgs.parentTree (LtInconsistentArgs.java:296)
at org.eolang.lints.LtInconsistentArgs.voidFqn (LtInconsistentArgs.java:279)
at org.eolang.lints.LtInconsistentArgs.lambda$scanUsages$5 (LtInconsistentArgs.java:129)
at java.util.stream.ForEachOps$ForEachOp$OfRef.accept (ForEachOps.java:184)
at java.util.stream.ReferencePipeline$3$1.accept (ReferencePipeline.java:197)
at java.util.ArrayList.forEach (ArrayList.java:1596)
at java.util.stream.SortedOps$RefSortingSink.end (SortedOps.java:395)
at java.util.stream.Sink$ChainedReference.end (Sink.java:261)
at java.util.stream.AbstractPipeline.copyInto (AbstractPipeline.java:510)
at java.util.stream.AbstractPipeline.wrapAndCopyInto (AbstractPipeline.java:499)
at java.util.stream.ForEachOps$ForEachOp.evaluateSequential (ForEachOps.java:151)
at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential (ForEachOps.java:174)
at java.util.stream.AbstractPipeline.evaluate (AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.forEach (ReferencePipeline.java:596)
at org.eolang.lints.LtInconsistentArgs.lambda$scanUsages$6 (LtInconsistentArgs.java:122)
at java.util.HashMap$Values.forEach (HashMap.java:1073)
at java.util.Collections$UnmodifiableCollection.forEach (Collections.java:1116)
at org.eolang.lints.LtInconsistentArgs.scanUsages (LtInconsistentArgs.java:118)
at org.eolang.lints.LtInconsistentArgs.defects (LtInconsistentArgs.java:48)
at org.eolang.lints.LtInconsistentArgs.defects (LtInconsistentArgs.java:37)
at org.eolang.lints.LtUnlintNonExistingDefectWpa.lambda$existingDefects$10 (LtUnlintNonExistingDefectWpa.java:140)
at java.lang.Iterable.forEach (Iterable.java:75)
at org.eolang.lints.LtUnlintNonExistingDefectWpa.existingDefects (LtUnlintNonExistingDefectWpa.java:137)
at org.eolang.lints.LtUnlintNonExistingDefectWpa.defects (LtUnlintNonExistingDefectWpa.java:74)
at org.eolang.lints.LtUnlintNonExistingDefectWpa.defects (LtUnlintNonExistingDefectWpa.java:32)
at org.eolang.lints.LtWpaUnlint.defects (LtWpaUnlint.java:42)
at org.eolang.lints.LtWpaUnlint.defects (LtWpaUnlint.java:19)
at org.eolang.lints.Program.defects (Program.java:126)
at org.eolang.maven.MjLint.lintAll (MjLint.java:177)
at org.eolang.maven.MjLint.lint (MjLint.java:90)
at org.eolang.maven.MjLint.exec (MjLint.java:62)
at org.eolang.maven.MjSafe.lambda$execWithTimeout$6 (MjSafe.java:598)
at java.util.concurrent.FutureTask.run (FutureTask.java:317)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1144)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:642)
at java.lang.Thread.run (Thread.java:1583)
Looks like the problem is here:
while (!"object".equals(current.node().getNodeName())) {
tree.add(current.attribute("name").text().get());
}
If the object does not have @name, then we are getting NoSuchElementException. Let's fix this
Contributor guide
No contributing guide indexed for this repository
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.
Assessment
This issue has not been assessed yet.