ContainX / openstack4j

A Fluent OpenStack SDK / Client Library for Java
http://openstack4j.com
Other
290 stars 367 forks source link

org.openstack4j.openstack.image.v2.domain.GlanceImage should use Long instead of Integer #875

Open whaon opened 8 years ago

whaon commented 8 years ago

the field minDisk,minRam,size,virtualSize should be Long rather than Integer because it is easy to exceed the of maximum of Integer

by the way,the fields in org.openstack4j.openstack.image.domain.GlanceImage are all Long.

lorenzotomasini commented 7 years ago

I think we too hit this bug when having a "big" image size:

17-1-2017 12:32:42 [pool-1-thread-9] [ERROR] org.openbaton.drivers.openstack4j.OpenStack4JDriver - com.fasterxml.jackson.databind.JsonMappingException: Numeric value (3352625152) out of range of int
 at [Source: org.jboss.resteasy.client.core.SelfExpandingBufferredInputStream@41afff44; line: 1, column: 1392]
 at [Source: org.jboss.resteasy.client.core.SelfExpandingBufferredInputStream@41afff44; line: 1, column: 1382] (through reference chain: org.openstack4j.openstack.image.v2.domain.Images["images"]->java.util.ArrayList[2]->org.openstack4j.openstack.image.v2.domain.GlanceImage["size"])
org.jboss.resteasy.spi.ReaderException: com.fasterxml.jackson.databind.JsonMappingException: Numeric value (3352625152) out of range of int
 at [Source: org.jboss.resteasy.client.core.SelfExpandingBufferredInputStream@41afff44; line: 1, column: 1392]
 at [Source: org.jboss.resteasy.client.core.SelfExpandingBufferredInputStream@41afff44; line: 1, column: 1382] (through reference chain: org.openstack4j.openstack.image.v2.domain.Images["images"]->java.util.ArrayList[2]->org.openstack4j.openstack.image.v2.domain.GlanceImage["size"])
    at org.jboss.resteasy.client.core.BaseClientResponse.readFrom(BaseClientResponse.java:469)
    at org.jboss.resteasy.client.core.BaseClientResponse.getEntity(BaseClientResponse.java:377)
    at org.jboss.resteasy.client.core.BaseClientResponse.getEntity(BaseClientResponse.java:350)
    at org.jboss.resteasy.client.core.BaseClientResponse.getEntity(BaseClientResponse.java:344)
    at org.openstack4j.connectors.resteasy.HttpResponseImpl.readEntity(HttpResponseImpl.java:116)
    at org.openstack4j.core.transport.HttpEntityHandler.handle(HttpEntityHandler.java:66)
    at org.openstack4j.connectors.resteasy.HttpResponseImpl.getEntity(HttpResponseImpl.java:64)
    at org.openstack4j.openstack.internal.BaseOpenStackService$Invocation.execute(BaseOpenStackService.java:220)
    at org.openstack4j.openstack.internal.BaseOpenStackService$Invocation.execute(BaseOpenStackService.java:202)
    at org.openstack4j.openstack.image.v2.internal.ImageServiceImpl.list(ImageServiceImpl.java:45)
    at org.openbaton.drivers.openstack4j.OpenStack4JDriver.listImages(OpenStack4JDriver.java:312)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.openbaton.plugin.PluginListener.executeMethod(PluginListener.java:204)
    at org.openbaton.plugin.PluginListener.run(PluginListener.java:126)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Numeric value (3352625152) out of range of int
 at [Source: org.jboss.resteasy.client.core.SelfExpandingBufferredInputStream@41afff44; line: 1, column: 1392]
 at [Source: org.jboss.resteasy.client.core.SelfExpandingBufferredInputStream@41afff44; line: 1, column: 1382] (through reference chain: org.openstack4j.openstack.image.v2.domain.Images["images"]->java.util.ArrayList[2]->org.openstack4j.openstack.image.v2.domain.GlanceImage["size"])
    at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:339)
    at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:299)
    at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.wrapAndThrow(BeanDeserializerBase.java:1511)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:262)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:125)
    at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:277)
    at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:249)
    at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:26)
    at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:490)
    at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:101)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:260)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:125)
    at com.fasterxml.jackson.databind.ObjectReader._bind(ObjectReader.java:1534)
    at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:944)
    at com.fasterxml.jackson.jaxrs.base.ProviderBase.readFrom(ProviderBase.java:811)
    at org.jboss.resteasy.core.interception.MessageBodyReaderContextImpl.proceed(MessageBodyReaderContextImpl.java:105)
    at org.jboss.resteasy.client.core.BaseClientResponse.readFrom(BaseClientResponse.java:433)
    ... 19 more
Caused by: com.fasterxml.jackson.core.JsonParseException: Numeric value (3352625152) out of range of int
 at [Source: org.jboss.resteasy.client.core.SelfExpandingBufferredInputStream@41afff44; line: 1, column: 1392]
    at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1586)
    at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:521)
    at com.fasterxml.jackson.core.base.ParserBase.convertNumberToInt(ParserBase.java:938)
    at com.fasterxml.jackson.core.base.ParserBase._parseIntValue(ParserBase.java:876)
    at com.fasterxml.jackson.core.base.ParserBase.getIntValue(ParserBase.java:704)
    at com.fasterxml.jackson.databind.deser.std.NumberDeserializers$IntegerDeserializer.deserialize(NumberDeserializers.java:313)
    at com.fasterxml.jackson.databind.deser.std.NumberDeserializers$IntegerDeserializer.deserialize(NumberDeserializers.java:293)
    at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:490)
    at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:101)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:260)
    ... 32 more

is this fixed in the SNAPSHOT version? Thanks

vinodborole commented 7 years ago

@whaon will you be able to take this now as we have our 3.0.3 release in place

lorenzotomasini commented 7 years ago

we, @mpauls and me, can confirm that this issue is not existing in the V3 list images. But we were not aware of the limitation in the number of results:

Map<String, String> map = new HashMap<>();
map.put("limit", "100");
List<? extends Image> images = os.images().list(map);

that is the reason why we tried V2 and the getting the error.

lorenzotomasini commented 7 years ago

Hi!

Is there any update on this issue?

vinodborole commented 7 years ago

876 I have reopened the pull request for this issue, lets review it

vinodborole commented 7 years ago

@lorenzotomasini Its merged, use the snapshot version

lorenzotomasini commented 7 years ago

Thanks!