i have been working on an assignment on my own PC using JDK v1.7, and i have to submit my assignment on my uni's Unix computer with java version 1.6.
All of my code executes fine on my machine, and when i SSH into my uni's computer and transfer my code across, it compiles fine, too. however, when I go to run it, i receive a
NoSuchElementException: No line found
about 1000-1200 characters into the .xml file I need to read (the file is much longer than this).
the offending method is
private CDAlbum CDread(Scanner inLine) {
String tempTitle = "Unknown CD";
String tempGenre = "Unknown Genre";
String tempArtist = "Unknown Artist";
ArrayList<String> tempTracks = new ArrayList<String>();
do {
lineBuffer = inLine.nextLine();
if (lineBuffer.equals("<Title>")) {
tempTitle = inLine.nextLine();
System.out.println("reading in a CD, just read title: " + tempTitle);
} else if (lineBuffer.equals("<Genre>")) {
tempGenre = inLine.nextLine();
} else if (lineBuffer.equals("<Artist>")) {
tempArtist = inLine.nextLine();
//System.out.println("Which has artist: " + tempArtist);
} else if (lineBuffer.equals("<Tracks>")) {
//populate tracks array
lineBuffer = inLine.nextLine();
while (!(lineBuffer.equals("</Tracks>"))) {
tempTracks.add(lineBuffer);
//System.out.println("Read track: " + lineBuffer);
lineBuffer = inLine.nextLine();
}
}
} while (!(lineBuffer.equals("</CD>")));
System.out.println(tempTracks);
CDAlbum tempdisc = new CDAlbum(tempTitle, tempGenre, tempArtist, tempTracks);
return tempdisc;
}
with the error occurring at
lineBuffer = inLine.nextLine();
I'm a bit out of my debugging depth here, and any suggestions as to what could be causing this are welcome.
screenshot of console output: http://puu.sh/YXKN
entire source code (just in case, and because it's easy to do with dropbox): https://www.dropbox.com/sh/zz8vdzqgw296s3d/v_cfW5svHG