[
http://jira.codehaus.org/browse/MSQL-50?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=226069#action_226069
]
Johan Romme commented on MSQL-50:
---------------------------------
Hi,
Created a tiny project to reproduce this error. The script fails indeed on the
insert of a blob where binary
data (jpg/jfif, among others) is to be put in the mysql database. So it's
reproduceable.
The solution is to set escapeProcessing to false in the sql-maven-plugin
configuration part of the pom.xml.
Something like the following:
<configuration>
<username>${xxx.persistence.username}</username>
<password>${xxx.persistence.password}</password>
<driver>${xxx.persistence.driver}</driver>
<url>${xxx.persistence.url}</url>
<keepFormat>true</keepFormat>
<autocommit>true</autocommit>
<escapeProcessing>false</escapeProcessing>
</configuration>
With this workaround/solution, I assume the priority of issue MSQL-50 can be
lowered.
grtx,
Johan
> StringIndexOutOfBoundsException when importing SQL file
> -------------------------------------------------------
>
> Key: MSQL-50
> URL: http://jira.codehaus.org/browse/MSQL-50
> Project: Maven 2.x SQL Plugin
> Issue Type: Bug
> Affects Versions: 1.3
> Environment: # mvn -version
> Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01+0200)
> Java version: 1.5.0_19
> Java home: /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home
> Default locale: en_US, platform encoding: MacRoman
> OS name: "mac os x" version: "10.6.2" arch: "i386" Family: "unix"
> mysql Ver 14.12 Distrib 5.0.51b
> Reporter: Benoit Heinrich
> Priority: Critical
> Attachments: jasper-dev.sql
>
>
> Hi,
> I'm having a very bad StringIndexOutOfBoundsException when I try to import
> the attached file.
> I don't know exactly which part is causing problem, but few of the inserts
> contains binary data in blob fields.
> Maybe this is the problem?
> The given dump is a jasperserver 3.7.0 DB dump that I need to import prior to
> running a suite of tests.
> Here is the detailed configuration of the maven plugin from my pom file:
> <pre>
> <plugin>
> <groupId>org.codehaus.mojo</groupId>
> <artifactId>sql-maven-plugin</artifactId>
> <version>1.3</version>
> <dependencies>
> <!-- specify the dependent jdbc driver -->
> <dependency>
> <groupId>mysql</groupId>
> <artifactId>mysql-connector-java</artifactId>
> <version>5.1.6</version>
> </dependency>
> </dependencies>
> <!-- common configuration shared by all executions -->
> <configuration>
> <username>${xxx.persistence.username}</username>
> <password>${xxx.persistence.password}</password>
> <driver>${xxx.persistence.driver}</driver>
> <url>${xxx.persistence.url}</url>
> <keepFormat>true</keepFormat>
> <autocommit>true</autocommit>
> <srcFiles>
> <srcFile>/tmp/jasper-dev.sql</srcFile>
> </srcFiles>
> </configuration>
> <executions>
> <execution>
> <id>create-db-and-load-data</id>
> <phase>process-test-resources</phase>
> <goals>
> <goal>execute</goal>
> </goals>
> </execution>
> </executions>
> </plugin>
> </pre>
> Here is the log output from the maven command:
> <pre>
> [12:18:34]: [INFO] Executing file: /tmp/jasper-dev.sql
> [12:18:34]: [INFO]
> ------------------------------------------------------------------------
> [12:18:34]: [ERROR] FATAL ERROR
> [12:18:34]: [INFO]
> ------------------------------------------------------------------------
> [12:18:34]: [INFO] String index out of range: -1
> [12:18:34]: [INFO]
> ------------------------------------------------------------------------
> [12:18:34]: [INFO] Trace
> [12:18:34]: java.lang.StringIndexOutOfBoundsException: String index out of
> range: -1
> [12:18:34]: at java.lang.String.substring(String.java:1768)
> [12:18:34]: at
> com.mysql.jdbc.EscapeProcessor.processTimeToken(EscapeProcessor.java:353)
> [12:18:34]: at
> com.mysql.jdbc.EscapeProcessor.escapeSQL(EscapeProcessor.java:257)
> [12:18:34]: at
> com.mysql.jdbc.EscapeProcessor.escapeSQL(EscapeProcessor.java:150)
> [12:18:34]: at
> com.mysql.jdbc.EscapeProcessor.escapeSQL(EscapeProcessor.java:150)
> [12:18:34]: at
> com.mysql.jdbc.EscapeProcessor.escapeSQL(EscapeProcessor.java:150)
> [12:18:34]: at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:629)
> [12:18:34]: at
> org.codehaus.mojo.sql.SqlExecMojo.execSQL(SqlExecMojo.java:815)
> [12:18:34]: at
> org.codehaus.mojo.sql.SqlExecMojo.runStatements(SqlExecMojo.java:782)
> [12:18:34]: at
> org.codehaus.mojo.sql.SqlExecMojo.access$200(SqlExecMojo.java:53)
> [12:18:34]: at
> org.codehaus.mojo.sql.SqlExecMojo$Transaction.runTransaction(SqlExecMojo.java:992)
> [12:18:34]: at
> org.codehaus.mojo.sql.SqlExecMojo$Transaction.access$100(SqlExecMojo.java:939)
> [12:18:34]: at
> org.codehaus.mojo.sql.SqlExecMojo.execute(SqlExecMojo.java:463)
> [12:18:34]: at
> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:453)
> [12:18:34]: at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:559)
> [12:18:34]: at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:500)
> [12:18:34]: at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:479)
> [12:18:34]: at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:331)
> [12:18:34]: at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:292)
> [12:18:34]: at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
> [12:18:34]: at
> org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
> [12:18:34]: at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
> [12:18:34]: at org.apache.maven.cli.MavenCli.main(MavenCli.java:301)
> [12:18:34]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> [12:18:34]: at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> [12:18:34]: at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> [12:18:34]: at java.lang.reflect.Method.invoke(Method.java:585)
> [12:18:34]: at
> org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
> [12:18:34]: at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
> [12:18:34]: at
> org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
> [12:18:34]: at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
> </pre>
> Thanks in advance for the reply, and I hope I've done nothing wrong on my
> side.
> Cheers,
> /Benoit
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email