GWT how to set gwt.imageResource.maxBundleSize? (or any System Property's to Integer)

StackOverflow https://stackoverflow.com/questions/19696022

  •  02-07-2022
  •  | 
  •  

Question

I need to change the system property

gwt.imageResource.maxBundleSize

to 1000. How would I do this?

The property exists as I see it here; https://code.google.com/p/google-web-toolkit/source/browse/releases/2.5/user/src/com/google/gwt/resources/rg/ImageBundleBuilder.java#471

Yet I cant figure out how to set this in the GWT.XML:

<set-property name="gwt.imageResource.maxBundleSize" value="1000" />

results in;

[ERROR] Property 'gwt.imageResource.maxBundleSize' not found

so I tried creating the property;

<define-property name="gwt.imageResource.maxBundleSize" values="1000" />

but that gets me;

[ERROR] Invalid property value '1000'

In fact, any numerical values results in this error. The only things it accepts are strings starting with letters.....but thats obviously useless as Googles code is;

private static final int IMAGE_MAX_SIZE = Integer.getInteger(
  "gwt.imageResource.maxBundleSize", 256);

So I am stumped how I am supposed to set this property.

Was it helpful?

Solution

<define-property name="gwt.imageResource.maxBundleSize" values="1000" />

You are creating a new property here, not assigning a value to an existing property. I don't know why the error is happening, but rest assured that even if the error wasn't happening, you'd still not be setting the value you are trying to set. Because...

private static final int IMAGE_MAX_SIZE = Integer.getInteger(
   "gwt.imageResource.maxBundleSize", 256);

that code doesn't read from your gwt.xml file. From the javadoc for Integer.getInteger:

/**
 * Determines the integer value of the system property with the
 * specified name.

According to this, you should be setting a system property when you run the compiler (or dev mode). Adding this to the JVM args might look something like this:

-Dgwt.imageResource.maxBundleSize=1000
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top