IndexOutOfBoundsException:索引:15,大小:19 [英] IndexOutOfBoundsException: Index: 15, Size: 19

查看:368
本文介绍了IndexOutOfBoundsException:索引:15,大小:19的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,前几天,当我发现一些奇怪的东西时,我正在浏览Web服务器上的一些日志(寻找其他东西).

So I was combing through some logs from our web server the other day (looking for something else), when something peculiar caught my eye.

java.lang.IndexOutOfBoundsException: Index: 15, Size: 19
    at java.util.ArrayList.rangeCheck(Unknown Source)
    at java.util.ArrayList.get(Unknown Source)

这对我来说似乎是不可能的.

This seemed impossible to me.

我查找了基于收到的消息,我永远都不会发生.

Based on the the message that I received should never have happened.

不幸的是,我目前不知道确切的内容(这是从用于很多事情的代码中调用的).而且我一直无法复制它.我什至不知道该从哪里开始.

Unfortunately I don't know what the contents were exactly at this time (this is called from code that's used for a lot of things). And I have been unable to reproduce it. I don't even know where I'd start.

问题:这应该能够发生吗?这是Java中的一个小故障吗?或只是一次怪胎事故.

The question: Should this be able to happen? Is this a glitch in Java? Or just a freak accident.

我认识到这可能不合时宜.我希望我有更多有关发生的事情的信息,但我没有.

I recognize that this may be off topic. I wish I had more information about what happened, but I don't.

推荐答案

ArrayList不是多线程安全的.如果在一个线程访问另一个线程时对其进行了修改,则index >= size在运行测试时可能为true,但在生成消息时为false.

ArrayList is not multithread safe. If it were being modified by one thread at about the time of an access by another thread, index >= size could have been true when the test was run, but false by the time the message was built.

这篇关于IndexOutOfBoundsException:索引:15,大小:19的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆