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

[BUG]BaseWzElement中,children 属性作为一个map对象,使用了xml中节点的name作为key,但是部分节点中有多个名称相同的节点,导致wzData.load(),初始化子节点时错误 #27

Open
haojiumeizhaoniliaotian opened this issue Mar 31, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@haojiumeizhaoniliaotian

Describe the bug

(简洁清楚地描述 BUG 是什么)

  • 发现异常的【堆栈日志】
    ava.lang.IllegalStateException: Duplicate key com.github.mrzhqiang.maplestory.wz.element.VectorElement@6440112d

    at java.util.stream.Collectors.lambda$throwingMerger$0(Collectors.java:133)
    at java.util.HashMap.merge(HashMap.java:1254)
    at java.util.stream.Collectors.lambda$toMap$58(Collectors.java:1320)
    at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
    at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
    at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
    at com.github.mrzhqiang.maplestory.wz.element.BaseWzElement.childrenOf(BaseWzElement.java:149)
    at com.github.mrzhqiang.maplestory.wz.element.BaseWzElement.(BaseWzElement.java:61)
    at com.github.mrzhqiang.maplestory.wz.element.ExtendedElement.(ExtendedElement.java:19)
    at com.github.mrzhqiang.maplestory.wz.element.ImgdirElement.convertChildren(ImgdirElement.java:70)
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
    at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
    at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
    at com.github.mrzhqiang.maplestory.wz.element.BaseWzElement.childrenOf(BaseWzElement.java:149)
    at com.github.mrzhqiang.maplestory.wz.element.BaseWzElement.(BaseWzElement.java:61)
    at com.github.mrzhqiang.maplestory.wz.element.ImgdirElement.(ImgdirElement.java:43)
    at com.github.mrzhqiang.maplestory.wz.element.CanvasElement.convertChildren(CanvasElement.java:40)
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
    at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
    at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
    at com.github.mrzhqiang.maplestory.wz.element.BaseWzElement.childrenOf(BaseWzElement.java:149)
    at com.github.mrzhqiang.maplestory.wz.element.BaseWzElement.(BaseWzElement.java:61)
    at com.github.mrzhqiang.maplestory.wz.element.CanvasElement.(CanvasElement.java:24)
    at com.github.mrzhqiang.maplestory.wz.element.ImgdirElement.convertChildren(ImgdirElement.java:58)
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
    at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
    at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
    at com.github.mrzhqiang.maplestory.wz.element.BaseWzElement.childrenOf(BaseWzElement.java:149)
    at com.github.mrzhqiang.maplestory.wz.element.BaseWzElement.(BaseWzElement.java:61)
    at com.github.mrzhqiang.maplestory.wz.element.ImgdirElement.(ImgdirElement.java:43)
    at com.github.mrzhqiang.maplestory.wz.element.ImgdirElement.convertChildren(ImgdirElement.java:50)
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
    at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
    at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
    at com.github.mrzhqiang.maplestory.wz.element.BaseWzElement.childrenOf(BaseWzElement.java:149)
    at com.github.mrzhqiang.maplestory.wz.element.BaseWzElement.(BaseWzElement.java:61)
    at com.github.mrzhqiang.maplestory.wz.element.ImgdirElement.(ImgdirElement.java:39)
    at com.github.mrzhqiang.maplestory.wz.element.ImgdirElement.of(ImgdirElement.java:35)
    at com.github.mrzhqiang.maplestory.wz.WzFile.(WzFile.java:80)
    at com.github.mrzhqiang.maplestory.wz.WzDirectory.attemptParse(WzDirectory.java:132)
    at java.util.Iterator.forEachRemaining(Iterator.java:116)
    at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
    at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
    at com.github.mrzhqiang.maplestory.wz.WzDirectory.parse(WzDirectory.java:117)
    at com.github.mrzhqiang.maplestory.wz.WzDirectory.attemptParse(WzDirectory.java:128)
    at java.util.Iterator.forEachRemaining(Iterator.java:116)
    at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
    at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
    at com.github.mrzhqiang.maplestory.wz.WzDirectory.parse(WzDirectory.java:117)
    at com.github.mrzhqiang.maplestory.wz.WzData.load(WzData.java:46)

  • 出现问题的【屏幕截图】

  • 可以复现的【详细步骤】

  • 你所猜测的【关键因素】

  • 其他相关的【文字描述】

Expected behavior

(简洁清楚地描述期望的行为)

  1. 正常情况下,应该/不应该 发生的行为
  2. 特殊情况下,应该/不应该 发生的行为

(Optional) About information

(【可选的】相关信息)

  • OS version: Windows 10 10.0
  • Java: Oracle JDK 1.8.0_301
  • DB: MySQL 5.7.30-log
  • Branchs Tags or Commit Revision:
    • main
    • develop
    • release-[x.x]
    • tag 1.0
    • revision 1398406
  • Project version: 1.0-SNAPSHOT
  • Your customize: other information
@haojiumeizhaoniliaotian haojiumeizhaoniliaotian added the bug Something isn't working label Mar 31, 2024
@haojiumeizhaoniliaotian
Copy link
Author

目前时将 children对象调整成了List集合, 对应获取节点的方法,目前是 findFirst,不清楚是否会有某个name查询出多个结果集的需求。

@mrzhqiang
Copy link
Owner

目前时将 children对象调整成了List集合, 对应获取节点的方法,目前是 findFirst,不清楚是否会有某个name查询出多个结果集的需求。

肯定会有的,你可以看看相关的 main 测试类或者单元测试类。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants