PDA

View Full Version : [OPEN] Theme Build fails with NegativeArraySizeException if components are hidden by CSS



davestar
8 Oct 2012, 3:19 AM
Hello all,

I'm attempting to fix up the IE and older browser compatibility for our app. To that end, I've been using Sencha cmd to put together a theme.html and then slice sprites from it, as covered at http://docs.sencha.com/ext-js/4-1/#!/guide/command_theme. I'm using a fresh install of 4.1.1a as my SDK, and generated a new app with cmd before adding the paths to .js and .css files to the created theme.html.

However, when I run the following command:

sencha theme build -page theme\default\theme.html -out temp\theme-output -image temp\image.png -data temp\data.json

I receive [ERROR] null in the output, after [INFO ] Slicing theme. Running with debug gives the following stacktrace:

com.sencha.exceptions.BasicException
at com.sencha.exceptions.BasicException.wrap(BasicException.java:43)
at com.sencha.cli.Command.dispatch(Command.java:104)
at com.sencha.cli.Commands.dispatch(Commands.java:49)
at com.sencha.cli.Commands.dispatch(Commands.java:49)
at com.sencha.cli.AbstractCommand.dispatch(AbstractCommand.java:184)
at com.sencha.command.Sencha.main(Sencha.java:58)
Caused by: java.lang.NegativeArraySizeException
at java.awt.image.BufferedImage.getRGB(BufferedImage.java:935)
at com.sencha.tools.slicer.Slicer.simpleCopy(Slicer.java:123)
at com.sencha.tools.slicer.Slicer.copyPixels(Slicer.java:86)
at com.sencha.tools.slicer.Sprite.addVerticalSide(Sprite.java:67)
at com.sencha.tools.slicer.data.Widget.slice(Widget.java:134)
at com.sencha.tools.slicer.Slicer.sliceWidgets(Slicer.java:77)
at com.sencha.command.theme.ThemeCommands$SliceCommand.execute(ThemeComm
ands.java:239)
at com.sencha.command.theme.ThemeCommands$BuildCommand.execute(ThemeComm
ands.java:143)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sencha.cli.Command.dispatch(Command.java:78)
... 4 more

A number of sliced pngs, plus the output image and json files, are correctly created (by the look of it), but I'm not sure it's the full set I need. I'd be grateful for any pointers on where to look to resolve this.

Many thanks

mitchellsimoens
10 Oct 2012, 7:43 AM
Can you post the results when you run the command and add the -d flag for debug info?

davestar
10 Oct 2012, 7:54 AM
Hi Mitchell, this is the full script output with the -d switch.


Sencha Cmd v3.0.0.190
[INFO ] Building theme
[INFO ] Capturing theme image
[DEBUG] runngin script at C:\Users\xx\bin\Sencha\Cmd\3.0.0.190\
screenshot-runner.js
[DEBUG] using path C:\Users\xx\bin\Sencha\Cmd\3.0.0.190\phantom
js;C:\Users\xx\bin\Sencha\Cmd\3.0.0.190\phantomjs\bin;C:\Users\david.wr
agg\bin\Sencha\Cmd\3.0.0.190;C:\Users\xx\bin\Sencha\Cmd\3.0.0.181;C:\Pr
ogram Files (x86)\SenchaSDKTools-2.0.0-beta3;C:\Program Files (x86)\Intel\iCLS C
lient\;C:\Program Files\Intel\iCLS Client\;C:\Program Files (x86)\NVIDIA Corpora
tion\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Win
dows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Microsoft SQL Serve
r\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Progr
am Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL
Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86)\Microsoft SQL
Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages
\v1.0\;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\;C:\P
rogram Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microso
ft Team Foundation Server 2010 Power Tools\;C:\Program Files (x86)\Microsoft Tea
m Foundation Server 2010 Power Tools\Best Practices Analyzer\;C:\Program Files\S
ourceGear\Common\DiffMerge\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Progra
m Files (x86)\Intel\OpenCL SDK\1.5\bin\x86;C:\Program Files (x86)\Intel\OpenCL S
DK\1.5\bin\x64;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;
C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program File
s (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\I
ntel\Intel(R) Management Engine Components\IPT;C:\Ruby192\bin;C:\Program Files (
x86)\Android\android-sdk\platform-tools;C:\apache-ant-1.8.4\bin;C:\Program Files
(x86)\Android\android-sdk\tools;C:\Program Files\Java\jdk1.6.0_35\bin
[DEBUG] executable located at C:\Users\xx\bin\Sencha\Cmd\3.0.0.
190\phantomjs\phantomjs.exe
[DEBUG] using workding directory .
loading page ../../../Dev/app/spec/resources/theme/default/theme.html
capturing screenshot
capturing widget location data
widget capture complete
[DEBUG] exit code was : 0
[DEBUG] exit code was : 0
[INFO ] Capture complete
[INFO ] Slicing theme
[DEBUG] Saving sprite ..\..\theme-output2\menu\menu-item-active-corners
[DEBUG] Saving sprite ..\..\theme-output2\menu\menu-item-active-sides
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-small-corners
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-small-sides
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-small-over-cor
ners
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-small-over-sid
es
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-small-focus-co
rners
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-small-focus-si
des
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-small-pressed-
corners
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-small-pressed-
sides
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-small-disabled
-corners
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-small-disabled
-sides
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-medium-corners


[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-medium-sides
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-medium-over-co
rners
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-medium-over-si
des
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-medium-focus-c
orners
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-medium-focus-s
ides
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-medium-pressed
-corners
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-medium-pressed
-sides
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-medium-disable
d-corners
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-medium-disable
d-sides
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-large-corners
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-large-sides
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-large-over-cor
ners
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-large-over-sid
es
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-large-focus-co
rners
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-large-focus-si
des
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-large-pressed-
corners
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-large-pressed-
sides
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-large-disabled
-corners
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-large-disabled
-sides
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-toolbar-small-
corners
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-toolbar-small-
sides
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-toolbar-small-
over-corners
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-toolbar-small-
over-sides
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-toolbar-small-
focus-corners
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-toolbar-small-
focus-sides
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-toolbar-small-
pressed-corners
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-toolbar-small-
pressed-sides
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-toolbar-small-
disabled-corners
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-toolbar-small-
disabled-sides
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-toolbar-medium
-corners
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-toolbar-medium
-sides
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-toolbar-medium
-over-corners
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-toolbar-medium
-over-sides
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-toolbar-medium
-focus-corners
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-toolbar-medium
-focus-sides
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-toolbar-medium
-pressed-corners
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-toolbar-medium
-pressed-sides
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-toolbar-medium
-disabled-corners
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-toolbar-medium
-disabled-sides
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-toolbar-large-
corners
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-toolbar-large-
sides
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-toolbar-large-
over-corners
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-toolbar-large-
over-sides
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-toolbar-large-
focus-corners
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-toolbar-large-
focus-sides
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-toolbar-large-
pressed-corners
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-toolbar-large-
pressed-sides
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-toolbar-large-
disabled-corners
[DEBUG] Saving sprite ..\..\theme-output2\btn\btn-default-toolbar-large-
disabled-sides
[DEBUG] Saving sprite ..\..\theme-output2\toolbar\toolbar-default-bg
[DEBUG] Saving sprite ..\..\theme-output2\panel-header\panel-header-defa
ult-framed-bottom-corners
[DEBUG] Saving sprite ..\..\theme-output2\panel-header\panel-header-defa
ult-framed-bottom-sides
[DEBUG] Saving sprite ..\..\theme-output2\panel-header\panel-header-defa
ult-framed-left-corners
[DEBUG] Saving sprite ..\..\theme-output2\panel-header\panel-header-defa
ult-framed-left-sides
[DEBUG] Saving sprite ..\..\theme-output2\panel-header\panel-header-defa
ult-framed-right-corners
[DEBUG] Saving sprite ..\..\theme-output2\panel-header\panel-header-defa
ult-framed-right-sides
[DEBUG] Saving sprite ..\..\theme-output2\panel-header\panel-header-defa
ult-framed-collapsed-top-corners
[DEBUG] Saving sprite ..\..\theme-output2\panel-header\panel-header-defa
ult-framed-collapsed-top-sides
[DEBUG] Saving sprite ..\..\theme-output2\panel-header\panel-header-defa
ult-framed-collapsed-bottom-corners
[DEBUG] Saving sprite ..\..\theme-output2\panel-header\panel-header-defa
ult-framed-collapsed-bottom-sides
[DEBUG] Saving sprite ..\..\theme-output2\panel-header\panel-header-defa
ult-framed-collapsed-left-corners
[DEBUG] Saving sprite ..\..\theme-output2\panel-header\panel-header-defa
ult-framed-collapsed-left-sides
[DEBUG] Saving sprite ..\..\theme-output2\panel-header\panel-header-defa
ult-framed-collapsed-right-corners
[DEBUG] Saving sprite ..\..\theme-output2\panel-header\panel-header-defa
ult-framed-collapsed-right-sides
[DEBUG] Saving sprite ..\..\theme-output2\tab\tab-default-top-corners
[DEBUG] Saving sprite ..\..\theme-output2\tab\tab-default-top-sides
[DEBUG] Saving sprite ..\..\theme-output2\tab\tab-default-top-active-cor
ners
[DEBUG] Saving sprite ..\..\theme-output2\tab\tab-default-top-active-sid
es
[DEBUG] Saving sprite ..\..\theme-output2\tab\tab-default-top-over-corne
rs
[DEBUG] Saving sprite ..\..\theme-output2\tab\tab-default-top-over-sides


[DEBUG] Saving sprite ..\..\theme-output2\tab\tab-default-top-disabled-c
orners
[DEBUG] Saving sprite ..\..\theme-output2\tab\tab-default-top-disabled-s
ides
[DEBUG] Saving sprite ..\..\theme-output2\tab\tab-default-bottom-corners


[DEBUG] Saving sprite ..\..\theme-output2\tab\tab-default-bottom-sides
[DEBUG] Saving sprite ..\..\theme-output2\tab\tab-default-bottom-bg
[DEBUG] Saving sprite ..\..\theme-output2\tab\tab-default-bottom-active-
corners
[DEBUG] Saving sprite ..\..\theme-output2\tab\tab-default-bottom-active-
sides
[DEBUG] Saving sprite ..\..\theme-output2\tab\tab-default-bottom-active-
bg
[DEBUG] Saving sprite ..\..\theme-output2\tab\tab-default-bottom-over-co
rners
[DEBUG] Saving sprite ..\..\theme-output2\tab\tab-default-bottom-over-si
des
[DEBUG] Saving sprite ..\..\theme-output2\tab\tab-default-bottom-over-bg


[DEBUG] Saving sprite ..\..\theme-output2\tab\tab-default-bottom-disable
d-corners
[DEBUG] Saving sprite ..\..\theme-output2\tab\tab-default-bottom-disable
d-sides
[DEBUG] Saving sprite ..\..\theme-output2\tab\tab-default-bottom-disable
d-bg
[DEBUG] Saving sprite ..\..\theme-output2\progress\progress-default-bg
[DEBUG] Saving sprite ..\..\theme-output2\btn-group\btn-group-default-fr
amed-notitle-corners
[DEBUG] Saving sprite ..\..\theme-output2\btn-group\btn-group-default-fr
amed-notitle-sides
[DEBUG] Saving sprite ..\..\theme-output2\btn-group\btn-group-default-fr
amed-corners
[DEBUG] Saving sprite ..\..\theme-output2\btn-group\btn-group-default-fr
amed-sides
[DEBUG] Saving sprite ..\..\theme-output2\tip\tip-corners
[DEBUG] Saving sprite ..\..\theme-output2\tip\tip-sides
[DEBUG] Saving sprite ..\..\theme-output2\form-invalid-tip\form-invalid-
tip-corners
[DEBUG] Saving sprite ..\..\theme-output2\form-invalid-tip\form-invalid-
tip-sides
[DEBUG] Saving sprite ..\..\theme-output2\datepicker\datepicker-header-c
orners
[DEBUG] Saving sprite ..\..\theme-output2\datepicker\datepicker-header-s
ides
[DEBUG] Saving sprite ..\..\theme-output2\datepicker\datepicker-header-b
g
[ERROR] null


com.sencha.exceptions.BasicException
at com.sencha.exceptions.BasicException.wrap(BasicException.java:43)
at com.sencha.cli.Command.dispatch(Command.java:104)
at com.sencha.cli.Commands.dispatch(Commands.java:49)
at com.sencha.cli.Commands.dispatch(Commands.java:49)
at com.sencha.cli.AbstractCommand.dispatch(AbstractCommand.java:184)
at com.sencha.command.Sencha.main(Sencha.java:58)
Caused by: java.lang.NegativeArraySizeException
at java.awt.image.BufferedImage.getRGB(BufferedImage.java:935)
at com.sencha.tools.slicer.Slicer.simpleCopy(Slicer.java:123)
at com.sencha.tools.slicer.Slicer.copyPixels(Slicer.java:86)
at com.sencha.tools.slicer.Sprite.addVerticalSide(Sprite.java:67)
at com.sencha.tools.slicer.data.Widget.slice(Widget.java:134)
at com.sencha.tools.slicer.Slicer.sliceWidgets(Slicer.java:77)
at com.sencha.command.theme.ThemeCommands$SliceCommand.execute(ThemeComm
ands.java:239)
at com.sencha.command.theme.ThemeCommands$BuildCommand.execute(ThemeComm
ands.java:143)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sencha.cli.Command.dispatch(Command.java:78)
... 4 more

davestar
10 Oct 2012, 8:58 AM
On further investigation, I think I've traced the issue to this selector in our scss:


.x-datepicker-footer{
display: none;
}

The lack of a visible datepicker footer seems to be knocking the tool over when it goes to render the image. Hope you can confirm.

Regards

dongryphon
12 Oct 2012, 11:42 PM
Looks like we need to improve the error reporting there.

Were you able to check the html file to see that it renders correctly before running the image slice operation?

dongryphon
12 Oct 2012, 11:45 PM
Thanks for the report! I have opened a bug in our bug tracker.

davestar
15 Oct 2012, 12:54 AM
Hi Don,

The theme.html file renders correctly beforehand, with all widgets on display. It seems its only the image slicing that is upset by the hidden component. As a workaround, I've removed the datepicker footer's entry from the theme's manifest.js file, and can now complete the theme build process successfully.

Thanks for looking into this.