Fix StAX parser

This commit is contained in:
Tanguy Herbron 2018-10-12 16:23:53 +02:00
parent b00913cb2f
commit c35879a65f
4 changed files with 34 additions and 24 deletions

View File

@ -1 +1,2 @@
/.DS_Store
/fr/

View File

@ -30,10 +30,10 @@ public class Album {
}
public void setTracks(List<Track> tracks) {
this.tracks = tracks;
}
this.tracks = tracks;
}
public Artist getArtist() {
public Artist getArtist() {
return artist;
}
@ -42,14 +42,14 @@ public class Album {
}
public String getCover() {
return cover;
}
return cover;
}
public void setCover(String cover) {
this.cover = cover;
}
public void setCover(String cover) {
this.cover = cover;
}
public String getId() {
public String getId() {
return id;
}

View File

@ -95,8 +95,14 @@ public class StAXSearchAlbums extends AbstractSearchAlbum {
switch(element)
{
case "id":
if(isArtist) buildingArtist.setId(reader.getText());
else buildingAlbum.setId(reader.getText());
if(isArtist)
{
buildingArtist.setId(reader.getText());
}
else
{
buildingAlbum.setId(reader.getText());
}
break;
case "title":
buildingAlbum.setTitle(reader.getText());
@ -125,6 +131,8 @@ public class StAXSearchAlbums extends AbstractSearchAlbum {
buildingAlbum.setArtist(buildingArtist);
isArtist = false;
break;
default:
element = "";
}
}
}

View File

@ -1,7 +1,8 @@
12:30:47,649 DEBUG fr.ensim.xml.deezer.stax.StAXSearchAlbumsTest - >>testCount
12:30:47,657 DEBUG fr.ensim.xml.deezer.stax.StAXSearchAlbums - >>count
12:30:47,677 DEBUG fr.ensim.xml.deezer.stax.StAXSearchAlbums - <<count 10
12:30:47,677 DEBUG fr.ensim.xml.deezer.stax.StAXSearchAlbumsTest - <<testCount
12:30:47,677 DEBUG fr.ensim.xml.deezer.stax.StAXSearchAlbumsTest - >>testParse
12:30:47,681 DEBUG fr.ensim.xml.deezer.stax.StAXSearchAlbums - >>readAlbums
12:30:47,689 DEBUG fr.ensim.xml.deezer.stax.StAXSearchAlbums - <<readAlbums
16:23:10,446 DEBUG fr.ensim.xml.deezer.stax.StAXSearchAlbumsTest - >>testCount
16:23:10,449 DEBUG fr.ensim.xml.deezer.stax.StAXSearchAlbums - >>count
16:23:10,460 DEBUG fr.ensim.xml.deezer.stax.StAXSearchAlbums - <<count 10
16:23:10,461 DEBUG fr.ensim.xml.deezer.stax.StAXSearchAlbumsTest - <<testCount
16:23:10,462 DEBUG fr.ensim.xml.deezer.stax.StAXSearchAlbumsTest - >>testParse
16:23:10,462 DEBUG fr.ensim.xml.deezer.stax.StAXSearchAlbums - >>readAlbums
16:23:10,467 DEBUG fr.ensim.xml.deezer.stax.StAXSearchAlbums - <<readAlbums
16:23:10,468 DEBUG fr.ensim.xml.deezer.stax.StAXSearchAlbumsTest - <<testParse