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

Comments

Projects
None yet
5 participants
@lgdop

lgdop commented Aug 22, 2018

No description provided.

@h3adache

This comment has been minimized.

Member

h3adache commented Aug 22, 2018

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

@lgdop

This comment has been minimized.

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

This comment has been minimized.

Member

harawata commented Aug 23, 2018

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

This comment has been minimized.

luryson commented Sep 3, 2018

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

@harawata

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

Anusha2605 commented Sep 3, 2018

  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

This comment has been minimized.

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 from . Cause: java.lang.ArrayIndexOutOfBoundsException - Can I know why this error comes and what is the limit? to Possible ArrayIndexOutOfBoundsException when reading DO part of a script Sep 3, 2018

@harawata harawata closed this in 1060701 Sep 3, 2018

@luryson

This comment has been minimized.

luryson commented Sep 4, 2018

@harawata cool

@harawata

This comment has been minimized.

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