gpt4 book ai didi

java - Jre 1.8.66 上的 jtds ArrayIndexOutOfBoundsException

转载 作者:行者123 更新时间:2023-11-30 08:38:21 24 4
gpt4 key购买 nike

在 jre-1.8_66 上运行时,我们在 JTDS 中遇到了一个奇怪的 ArrayIndexOutOfBoundsException,并且无法在网络上找到任何其他提及此问题的信息。

在使用服务器 jvmdll 运行 32 位版本的 jre-1.8_66 时,我已经能够使用 jtds 1.2.5 和 1.2.8 复制此错误。使用 64 位 JRE 或 32 位客户端 jvm.dll 时,我无法复制错误。

在 Eclipse 中运行时或尝试从 Eclipse 进行远程调试时,我也根本无法复制错误,因此我无法缩小问题的具体原因范围。

完整的堆栈跟踪如下。

java.lang.ArrayIndexOutOfBoundsException: 14
at net.sourceforge.jtds.jdbc.TdsData.readData(TdsData.java:800)
at net.sourceforge.jtds.jdbc.TdsCore.tdsRowToken(TdsCore.java:3081)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2346)
at net.sourceforge.jtds.jdbc.TdsCore.getNextRow(TdsCore.java:777)
at net.sourceforge.jtds.jdbc.JtdsResultSet.next(JtdsResultSet.java:596)
at test.jtdstest.JtdsText.main(JtdsText.java:51)

我在发生异常的地方有 jtds 代码,我看不出它有什么特别的问题,但我很容易弄错。

我为重现错误而编写的测试程序如下。

package test.jtdstest;

import java.io.File;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Properties;

public class JtdsText
{

private static PrintWriter pw;

static
{
try
{
pw = new PrintWriter(new File("c:\\temp\\jtds_trace.txt"));
DriverManager.setLogWriter(pw);
Class.forName("net.sourceforge.jtds.jdbc.Driver");
}
catch (Exception localException)
{
}
}

public static void main(String[] args)
throws Exception
{
Connection conn = null;
PreparedStatement stmt = null;
ResultSet res = null;
try
{
String sql =
"SELECT "
+ "text1, "
+ "int1, "
+ "int2, "
+ "text2 "
+ "FROM "
+ "text_test";

conn = DriverManager.getConnection("jdbc:jtds:sqlserver://localhost:1433/test;user=user1;password=aa");
stmt = conn.prepareStatement(sql);

res = stmt.executeQuery();
while (res.next())
{
int int1 = res.getInt(2);
System.out.println("int1 = " + Integer.toString(int1));
}
}
catch (Exception ex)
{
System.out.println("Error processing result set:");
ex.printStackTrace();
System.out.println();
}
finally
{
try
{
if(res != null)
{
res.close();
}

if(stmt != null)
{
stmt.close();
}

if(conn != null)
{
conn.close();
}
}
catch (Exception ex)
{
System.out.println("Error cleaning up Statement:");
ex.printStackTrace();
System.out.println();
}
}
}
}

如果需要,我也可以提供用于复制错误的数据。

我强烈怀疑这是 JRE 中的一个错误,因为这是唯一能够复制错误的变量。

有人遇到过这个吗?除了更改 JVM 之外,还有其他方法可以克服该错误吗?我是否应该针对 JVM 报告此错误?

最佳答案

原来这是 JIT 编译器中的错误。使用 -Xint 选项关闭 JIT 编译器可解决该问题。我们正在使用 Oracle 记录此问题以解决问题。

关于java - Jre 1.8.66 上的 jtds ArrayIndexOutOfBoundsException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36598783/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com