@@ -116,27 +116,7 @@ public Object propertyValue(CloudObject obj, String propertyName) {
116116 }
117117 final ReplaceableImage rp = ReplaceableImage .create (placeholderImage );
118118 inProgress .put (key , rp );
119- ConnectionRequest cr = new ConnectionRequest () {
120- private EncodedImage e ;
121-
122- protected void readResponse (InputStream input ) throws IOException {
123- e = EncodedImage .create (input );
124- if (e .getWidth () != placeholderImage .getWidth () || e .getHeight () != placeholderImage .getHeight ()) {
125- ImageIO io = ImageIO .getImageIO ();
126- if (io != null ) {
127- ByteArrayOutputStream bo = new ByteArrayOutputStream ();
128- io .save (new ByteArrayInputStream (e .getImageData ()), bo , ImageIO .FORMAT_JPEG , placeholderImage .getWidth (), placeholderImage .getHeight (), 0.9f );
129- e = EncodedImage .create (bo .toByteArray ());
130- }
131- }
132- }
133-
134- protected void postResponse () {
135- rp .replace (e );
136- getCache ().put (key , e );
137- inProgress .remove (key );
138- }
139- };
119+ ConnectionRequest cr = new CloudImageRequest (rp , key );
140120 cr .setPost (false );
141121 cr .setUrl (CloudStorage .getInstance ().getUrlForCloudFileId (key ));
142122 NetworkManager .getInstance ().addToQueue (cr );
@@ -145,4 +125,47 @@ protected void postResponse() {
145125 return image ;
146126 }
147127
128+ private class CloudImageRequest extends ConnectionRequest {
129+ private EncodedImage e ;
130+ private final ReplaceableImage rp ;
131+ private final String key ;
132+
133+ public CloudImageRequest (ReplaceableImage rp , String key ) {
134+ this .rp = rp ;
135+ this .key = key ;
136+ }
137+
138+ protected void readResponse (InputStream input ) throws IOException {
139+ e = EncodedImage .create (input );
140+ if (e .getWidth () != placeholderImage .getWidth () || e .getHeight () != placeholderImage .getHeight ()) {
141+ ImageIO io = ImageIO .getImageIO ();
142+ if (io != null ) {
143+ ByteArrayOutputStream bo = new ByteArrayOutputStream ();
144+ io .save (new ByteArrayInputStream (e .getImageData ()), bo , ImageIO .FORMAT_JPEG , placeholderImage .getWidth (), placeholderImage .getHeight (), 0.9f );
145+ e = EncodedImage .create (bo .toByteArray ());
146+ }
147+ }
148+ }
149+
150+ protected void postResponse () {
151+ rp .replace (e );
152+ getCache ().put (key , e );
153+ inProgress .remove (key );
154+ }
155+
156+ /**
157+ * {@inheritDoc}
158+ */
159+ public boolean equals (Object o ) {
160+ return super .equals (o );
161+ }
162+
163+ /**
164+ * {@inheritDoc}
165+ */
166+ public int hashCode () {
167+ return super .hashCode ();
168+ }
169+ }
170+
148171}
0 commit comments