Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 326141

Summary: Building SWT package fails on target replace64 with java.lang.StringIndexOutOfBoundsException: start > length()
Product: [Eclipse Project] Platform Reporter: Missing name Mising name <turbors>
Component: SWTAssignee: Felipe Heidrich <eclipse.felipe>
Status: CLOSED WONTFIX QA Contact: Scott Kovatch <skovatch>
Severity: normal    
Priority: P3 CC: eclipse.felipe, skovatch, turbors
Version: 3.6   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS X   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=312597
Whiteboard: stalebug

Description Missing name Mising name CLA 2010-09-24 09:07:04 EDT
Hello,

I'm running a Eclipse 3.6 (Helios) IDE on Mac with 64 bit VM and the coupled ant version 1.7.1.

Now I tried to build the swt package in the following steps:
A) checking them out via Anonymous CVS access: :pserver:anonymous@dev.eclipse.org:/cvsroot/eclipse
according the description of http://www.eclipse.org/swt/cvs.php (checked out TRUNK)

All steps work fine, additionally I also follwed the notes according to http://www.eclipse.org/swt/faq.php#cocoa64launch

B) Now according point 4. in http://www.eclipse.org/swt/faq.php#howbuildjar I started running Ant from the context menu.

But then the build stops because of the  java.lang.StringIndexOutOfBoundsException.

In Bugzilla I looked for similar occurences and I found the bug 312597 that seems to be similar to what I have got.
Maybe this might help you.
Besides checking out Trunk I tried some other Branches like v3655 or R3_6maintenance branch but all resulted in the same error.

Below are the output of Ant log and an extract of .metadata/.log file:

Buildfile: /Users/ralfschukey/Desktop/SW/eclipse/workspace/org.eclipse.swt.cocoa.macosx.x86_64/build.xml

properties:

init:

build.jars:

properties:

init:

@dot:
      [delete] Deleting directory /Users/ralfschukey/Desktop/SW/eclipse/workspace/org.eclipse.swt.cocoa.macosx.x86_64/temp.folder/@dot.bin
       [mkdir] Created dir: /Users/ralfschukey/Desktop/SW/eclipse/workspace/org.eclipse.swt.cocoa.macosx.x86_64/temp.folder/@dot.bin

copy.cocoa.src:
      [delete] Deleting directory /Users/ralfschukey/Desktop/SW/eclipse/workspace/org.eclipse.swt.cocoa.macosx.x86_64/temp.folder/@dot.src
        [copy] Copying 764 files to /Users/ralfschukey/Desktop/SW/eclipse/workspace/org.eclipse.swt.cocoa.macosx.x86_64/temp.folder/@dot.src

copy.translationfiles:

is64:
        [echo] Is64=true

replace64:
        [echo] Converting java files to 64 bit

BUILD FAILED
/Users/ralfschukey/Desktop/SW/eclipse/workspace/org.eclipse.swt/buildFragment.xml:95: The following error occurred while executing this line:
/Users/ralfschukey/Desktop/SW/eclipse/workspace/org.eclipse.swt/buildFragment.xml:74: The following error occurred while executing this line:
/Users/ralfschukey/Desktop/SW/eclipse/workspace/org.eclipse.swt/buildFragment.xml:197: The following error occurred while executing this line:
/Users/ralfschukey/Desktop/SW/eclipse/workspace/org.eclipse.swt/buildFragment.xml:423: java.lang.StringIndexOutOfBoundsException: start > length()

Total time: 2 seconds

extracts from .log - file:

/Users/ralfschukey/Desktop/SW/eclipse/workspace/org.eclipse.swt/buildFragment.xml:74: The following error occurred while executing this line:
/Users/ralfschukey/Desktop/SW/eclipse/workspace/org.eclipse.swt/buildFragment.xml:197: The following error occurred while executing this line:
/Users/ralfschukey/Desktop/SW/eclipse/workspace/org.eclipse.swt/buildFragment.xml:423: java.lang.StringIndexOutOfBoundsException: start > length()
	at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:508)
	at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:418)
	at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
	at sun.reflect.GeneratedMethodAccessor83.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:357)
	at org.apache.tools.ant.Target.performTasks(Target.java:385)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
	at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
	at org.eclipse.ant.internal.core.ant.EclipseSingleCheckExecutor.executeTargets(EclipseSingleCheckExecutor.java:30)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
	at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
	at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
	at sun.reflect.GeneratedMethodAccessor83.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:357)
	at org.apache.tools.ant.Target.performTasks(Target.java:385)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
	at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
	at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
	at org.eclipse.ant.internal.core.ant.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
	at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:662)
	at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:495)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.ant.core.AntRunner.run(AntRunner.java:378)
	at org.eclipse.ant.internal.launching.launchConfigurations.AntLaunchDelegate$1.run(AntLaunchDelegate.java:298)
	at java.lang.Thread.run(Thread.java:637)
Caused by: /Users/ralfschukey/Desktop/SW/eclipse/workspace/org.eclipse.swt/buildFragment.xml:197: The following error occurred while executing this line:
/Users/ralfschukey/Desktop/SW/eclipse/workspace/org.eclipse.swt/buildFragment.xml:423: java.lang.StringIndexOutOfBoundsException: start > length()
	at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:508)
	....

-- Configuration Details --
Product: Eclipse 1.3.0.20100617-0521 (org.eclipse.epp.package.jee.product)
Installed Features:
 org.eclipse.platform 3.6.0.v20100602-9gF78GpqFt6trOGhL60z0oEx3fz-JKNwxPY
Comment 1 Felipe Heidrich CLA 2010-10-13 12:58:57 EDT
This is how I do it:

check out org.eclipse.swt and org.eclipse.swt.cocoa.macosx.x86_64
select org.eclipse.swt.cocoa.macosx.x86_64
run menu bar > File > Export
choose Deployable plugin and fragments

Does that work for you ?
Comment 2 Missing name Mising name CLA 2010-10-14 04:58:10 EDT
Hello Felipe,

Maybe you misunderstood me.
I didn't want to export the packages / plug-ins but I wanted to build them after checking them out within Eclipse. During build I got the errors I described above.

If I'm exporting the selected package you mentioned what else should I do to let them build?

Cheers
Ralf
Comment 3 Felipe Heidrich CLA 2010-10-14 10:34:37 EDT
Eclipse runs the correct build script before exporting the packages, so it will include any code changes you did to the jar file.
Comment 4 Missing name Mising name CLA 2010-11-15 04:32:02 EST
Felipe,

Doing the Export you described succeeded. I got a plugin.jar, as destination I used a directory.

But does this solve the problem I described? 

Cheers, Ralf
Comment 5 Felipe Heidrich CLA 2010-11-15 09:54:04 EST
(In reply to comment #4)
> But does this solve the problem I described? 

I'm not sure the if regular build process is expected to work for SWT.
We always had a special build process to handle different platforms and native code.
Comment 6 Scott Kovatch CLA 2010-12-13 20:25:43 EST
Over to Felipe. Please triage or close.
Comment 7 Felipe Heidrich CLA 2010-12-14 12:07:01 EST
Looking at the initial description I would expect the steps you followed to work.
The only part that is not clear to me is:
>and the coupled ant version 1.7.1.

What do you mean by that ? Are you using some other Ant rather than the one that comes with Eclipse ?

Does it work if you use the regular Eclipse Ant (starting from a fresh workspace) ?
Comment 8 Missing name Mising name CLA 2010-12-15 10:37:14 EST
No, with coupled ant version 1.7.1 I mean that ant version that was shipped with the Helios Eclipse Release.
Sorry if I did not express this clearly enough. It's that in my eclipse/plugins directory: org.apache.ant_1.7.1.v20100518-1145

So I only used this ant version where I got the failures I described above.
Comment 9 Lars Vogel CLA 2019-11-14 02:14:51 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

If the bug is still relevant, please remove the "stalebug" whiteboard tag.