From 3851ef08bb57cf59850b167580896ec23ff26e29 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sun, 10 Apr 2011 13:01:03 +0200 Subject: [PATCH] Instantiate album via caching mechanism. --- src/main/java/net/pterodactylus/sone/core/Core.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index 6a90c7a..3a0a722 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -1320,7 +1320,6 @@ public class Core implements IdentityListener, UpdateListener { } /* load albums. */ - Map albums = new HashMap(); List topLevelAlbums = new ArrayList(); while (true) { String albumPrefix = sonePrefix + "/Albums/" + albums.size(); @@ -1335,10 +1334,9 @@ public class Core implements IdentityListener, UpdateListener { logger.log(Level.WARNING, "Invalid album found, aborting load!"); return; } - Album album = new Album(albumId).setSone(sone).setName(albumName).setDescription(albumDescription); - albums.put(albumId, album); + Album album = getAlbum(albumId).setSone(sone).setName(albumName).setDescription(albumDescription); if (albumParentId != null) { - Album parentAlbum = albums.get(albumParentId); + Album parentAlbum = getAlbum(albumParentId, false); if (parentAlbum == null) { logger.log(Level.WARNING, "Invalid parent album ID: " + albumParentId); return; -- 2.7.4