added image url checking, removed redundant url type
This commit is contained in:
parent
6904663e59
commit
73b74bcee3
@ -169,7 +169,9 @@ public class TopAlbumController {
|
|||||||
|
|
||||||
Album album = (Album) obj;
|
Album album = (Album) obj;
|
||||||
|
|
||||||
GetFXImageService service = new GetFXImageService(album.getImageURL().toString(), counter);
|
if (album.getImageURL() != null) {
|
||||||
|
|
||||||
|
GetFXImageService service = new GetFXImageService(album.getImageURL(), counter);
|
||||||
|
|
||||||
service.setOnSucceeded(new EventHandler<WorkerStateEvent>() {
|
service.setOnSucceeded(new EventHandler<WorkerStateEvent>() {
|
||||||
|
|
||||||
@ -189,6 +191,7 @@ public class TopAlbumController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ public class Album extends FMObj implements Serializable, Cacheable{
|
|||||||
protected ArrayList<Tag> tagList;
|
protected ArrayList<Tag> tagList;
|
||||||
protected ArrayList<Track> trackList;
|
protected ArrayList<Track> trackList;
|
||||||
|
|
||||||
protected URL imageUrl;
|
protected String imageUrl;
|
||||||
protected BufferedImage image;
|
protected BufferedImage image;
|
||||||
|
|
||||||
private Album(AlbumBuilder builder) {
|
private Album(AlbumBuilder builder) {
|
||||||
@ -42,13 +42,13 @@ public class Album extends FMObj implements Serializable, Cacheable{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public URL getImageURL() {
|
public String getImageURL() {
|
||||||
return imageUrl;
|
return imageUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadImage() {
|
public void loadImage() {
|
||||||
try {
|
try {
|
||||||
image = ImageIO.read(imageUrl);
|
image = ImageIO.read(new URL(imageUrl));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -113,8 +113,7 @@ public class Album extends FMObj implements Serializable, Cacheable{
|
|||||||
protected ArrayList<Tag> tagList;
|
protected ArrayList<Tag> tagList;
|
||||||
protected ArrayList<Track> trackList;
|
protected ArrayList<Track> trackList;
|
||||||
|
|
||||||
protected URL imageUrl;
|
protected String imageUrl;
|
||||||
|
|
||||||
|
|
||||||
public AlbumBuilder(String name, Artist artist) {
|
public AlbumBuilder(String name, Artist artist) {
|
||||||
|
|
||||||
@ -163,11 +162,7 @@ public class Album extends FMObj implements Serializable, Cacheable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public AlbumBuilder setImageUrl(String url) {
|
public AlbumBuilder setImageUrl(String url) {
|
||||||
try {
|
this.imageUrl = url;
|
||||||
this.imageUrl = new URL(url);
|
|
||||||
} catch (MalformedURLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user