java.lang.IllegalArgumentException: Error writeComponents { 24576, 1 }
at com.jme3.texture.image.MipMapImageRaster.setPixel(MipMapImageRaster.java:134)
at com.jme3.environment.util.CubeMapWrapper.setPixel(CubeMapWrapper.java:230)
at com.jme3.environment.generation.PrefilteredEnvMapFaceGenerator.generatePrefilteredEnvMap(PrefilteredEnvMapFaceGenerator.java:188)
at com.jme3.environment.generation.PrefilteredEnvMapFaceGenerator.run(PrefilteredEnvMapFaceGenerator.java:135)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalArgumentException: Error setting position { 30276, 32760, 32760 }
at com.jme3.texture.image.ByteAlignedImageCodec.writePixelRaw(ByteAlignedImageCodec.java:71)
at com.jme3.texture.image.ByteAlignedImageCodec.writeComponents(ByteAlignedImageCodec.java:131)
at com.jme3.texture.image.MipMapImageRaster.setPixel(MipMapImageRaster.java:132)
... 10 more
Caused by: java.lang.IllegalArgumentException
at java.nio.Buffer.position(Unknown Source)
at com.jme3.texture.image.ByteAlignedImageCodec.writePixelRaw(ByteAlignedImageCodec.java:69)
... 12 more
While java.lang.IllegalArgumentException: Error writeComponents { 24576, 1 }
at com.jme3.texture.image.MipMapImageRaster.setPixel(MipMapImageRaster.java:134)
at com.jme3.environment.util.CubeMapWrapper.setPixel(CubeMapWrapper.java:230)
at com.jme3.environment.generation.PrefilteredEnvMapFaceGenerator.generatePrefilteredEnvMap(PrefilteredEnvMapFaceGenerator.java:188)
at com.jme3.environment.generation.PrefilteredEnvMapFaceGenerator.run(PrefilteredEnvMapFaceGenerator.java:135)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalArgumentException: Error setting position { 30276, 32760, 32760 }
at com.jme3.texture.image.ByteAlignedImageCodec.writePixelRaw(ByteAlignedImageCodec.java:71)
at com.jme3.texture.image.ByteAlignedImageCodec.writeComponents(ByteAlignedImageCodec.java:131)
at com.jme3.texture.image.MipMapImageRaster.setPixel(MipMapImageRaster.java:132)
... 10 more
Caused by: java.lang.IllegalArgumentException
at java.nio.Buffer.position(Unknown Source)
at com.jme3.texture.image.ByteAlignedImageCodec.writePixelRaw(ByteAlignedImageCodec.java:69)
... 12 more
@nehon following our discussion i’ve made some additional exception handling to find the reason for this (already in the exception above)
In MipMapImageRaster.java:
try {
codec.writeComponents(getBuffer(), x, y, width[mipLevel], offsets[mipLevel], components, temp);
} catch (IllegalArgumentException iae) {
throw new IllegalArgumentException("Error writeComponents { " + offsets[mipLevel] + ", " + mipLevel + " }", iae);
}
And in ByteAlignedImageCodec.java
try {
buf.position(idx);
} catch (IllegalArgumentException iae) {
throw new IllegalArgumentException("Error setting position { " + idx + ", " + buf.limit() + ", " + buf.capacity() + " }", iae);
}
So if i am not mistaken we get an IllegalArgumentException when setting position 30276 even if the limit and the capacity is both 32760 for the buffer
So 30276 < 32760, right? What other reasons are there for position() to cause an IllegalArgumentException?
Anyway, because you’ve asked. This is the way the probe is updated:
public void updateProbe(final JobProgressAdapter<LightProbe> progressAdapter) {
final LightProbe lightProbe = getLightProbe();
if (lightProbe == null) {
progressAdapter.done(null);
return;
}
LightProbeFactory.updateProbe(lightProbe, getEnvironmentCamera(), rootNode, progressAdapter);
}
Like said before, this only happens in my complete application and i cannot make a simple test-case - so i am pretty sure the root is somewhere in my code, which you cannot see;) But maybe you have a clue and we can improve exception handling to make it more obvious the next time somebody gets this kind of stacktrace.