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

Possible ArrayIndexOutOfBoundsException when reading DO part of a script #127

Closed
lgdop opened this issue Aug 22, 2018 · 10 comments
Closed
Assignees
Labels
Milestone

Comments

@lgdop
Copy link

lgdop commented Aug 22, 2018

No description provided.

@h3adache
Copy link
Member

Can you give the full stack trace and let us know steps to reproduce?

@lgdop
Copy link
Author

lgdop commented Aug 22, 2018

I suspect below is the cause, that is because of providing a comment of 345 characters length in migration script.
For example:
/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/

@harawata
Copy link
Member

Hi @lgdop ,

Adding the comment to a migration script didn't reproduce the exception with Migrations 3.3.4 and MySQL 5.7.22 (Connector/J 8.0.11).

Please add --trace command line option and it will print the stack trace.

$ migrate --trace up

We may also need the following information.

  • Migrations version. Run migrate info.
  • DB vendor and version (e.g. MySQL 5.7.22, Oracle 10g, etc.)
  • JDBC driver version.

@luryson
Copy link

luryson commented Sep 3, 2018

"java.lang.ArrayIndexOutOfBoundsException" was thrown when length of one single line of sql exceeded 1024 chars.

@harawata
Copy link
Member

harawata commented Sep 3, 2018

@luryson ,

I still could not reproduce it.
Could you provide the information I requested in my previous comment?

@luryson
Copy link

luryson commented Sep 3, 2018

@harawata

ERROR: java.lang.ArrayIndexOutOfBoundsException
org.apache.ibatis.migration.MigrationException: java.lang.ArrayIndexOutOfBoundsException
	at org.apache.ibatis.migration.CommandLine.runCommand(CommandLine.java:81)
	at org.apache.ibatis.migration.CommandLine.execute(CommandLine.java:45)
	at org.apache.ibatis.migration.Migrator.main(Migrator.java:20)
Caused by: java.lang.ArrayIndexOutOfBoundsException
	at java.lang.System.arraycopy(Native Method)
	at java.lang.AbstractStringBuilder.getChars(AbstractStringBuilder.java:388)
	at java.lang.StringBuilder.getChars(StringBuilder.java:76)
	at org.apache.ibatis.migration.MigrationReader.readFromBuffer(MigrationReader.java:175)
	at org.apache.ibatis.migration.MigrationReader.read(MigrationReader.java:127)
	at java.io.Reader.read(Reader.java:140)
	at org.apache.ibatis.migration.commands.ScriptCommand.execute(ScriptCommand.java:86)
	at org.apache.ibatis.migration.CommandLine.runCommand(CommandLine.java:75)
	... 2 more
------------------------------------------------------------------------
-- MyBatis Migrations - info
------------------------------------------------------------------------
null null (null)
Java version: 1.8.0_152, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "Mac OS X", version: "10.13.6", arch: "x86_64", family: "mac"
------------------------------------------------------------------------
-- MyBatis Migrations SUCCESS
-- Total time: 0s
-- Finished at: Mon Sep 03 21:55:28 CST 2018
-- Final Memory: 2M/123M
------------------------------------------------------------------------

Mysql version: 5.7.22

JDBC version: 5.1.43

@Anusha2605
Copy link

  1. Migrations version. Run migrate info.
  • Run Mybatis

-- MyBatis Migrations - info

null 3.3.5-SNAPSHOT (null)
Java version: 1.6.0_41, vendor: Sun Microsystems Inc.
Java home: /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.41.x86_64/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "Linux", version: "4.13.3-1.el7.elrepo.x86_64", arch: "amd64", family: "unix"
DB vendor and version (e.g. MySQL 5.7.22, Oracle 10g, etc.)
JDBC driver version.

  1. DB vendor and version (e.g. MySQL 5.7.22, Oracle 10g, etc.)
    Oracle - version varies from 8 to 12

  2. JDBC driver version.
    ojdbc14

@harawata
Copy link
Member

harawata commented Sep 3, 2018

Thanks for your help, @luryson !
I've found my mistake. :D

@harawata harawata added the bug label Sep 3, 2018
@harawata harawata self-assigned this Sep 3, 2018
@harawata harawata added this to the 3.3.5 milestone Sep 3, 2018
@harawata harawata changed the title . Cause: java.lang.ArrayIndexOutOfBoundsException - Can I know why this error comes and what is the limit? Possible ArrayIndexOutOfBoundsException when reading DO part of a script Sep 3, 2018
@luryson
Copy link

luryson commented Sep 4, 2018

@harawata cool

@harawata
Copy link
Member

harawata commented Sep 4, 2018

Reproducing the problem is always the hardest part. :)
Anyway, the fix is available in the latest 3.3.5-SNAPSHOT.
Please let us know if you find any problem.

And again, thank you both for taking the time to report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants