Every time a Sone is fetched, see if it can be unshelled.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 14 Oct 2010 14:13:11 +0000 (16:13 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 14 Oct 2010 14:13:11 +0000 (16:13 +0200)
src/main/java/net/pterodactylus/sone/core/Core.java

index d0d585f..211a76e 100644 (file)
@@ -128,7 +128,11 @@ public class Core extends AbstractService {
         * @return The Sone, or a {@link Shell} around one
         */
        public Sone getSone(String soneId) {
-               return soneCache.get(soneId);
+               Sone sone = soneCache.get(soneId);
+               if (sone instanceof SoneShell) {
+                       soneCache.put(soneId, sone = ((SoneShell) sone).getShelled());
+               }
+               return sone;
        }
 
        //