Не могу понять, почему не пропускает валидатор. Программа работает, выводит строку, в которой совпал id - номер.
Помогите разобраться, что не так.
package com.javarush.task.task18.task1822;
/*
Поиск данных внутри файла
*/
import java.io.*;
public class Solution {
public static void main(String[] args) throws IOException {
// /Users/maksim/Documents/JAVA/JavaRush_Study/JavaRushTasks/2.JavaCore/src/com/javarush/task/task18/task1822/goods.dat
String requiredID = args[0];
//System.out.println("Требуемый ID номер - "+requiredID);
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String fileName = reader.readLine();
reader.close();
FileInputStream fis = new FileInputStream(fileName);
BufferedInputStream bis = new BufferedInputStream(fis);
StringBuilder id = new StringBuilder();
boolean nextLine = true;
boolean isFound = false;
int nextByte;
while (bis.available() > 0) {
nextByte = bis.read();
if (!isFound && nextByte == 10) {
nextLine = true;
id.delete(0, id.length());
}
if (!isFound && nextByte == 32) {
nextLine = false;
}
if (!isFound && nextLine) {
if (nextByte != 10 && nextByte != 32) {
id.append((char)nextByte);
}
}
if (!nextLine) {
if (id.toString().startsWith(requiredID)) {
isFound = true;
if (nextByte == 10) {
nextLine = true;
}
id.append((char)nextByte);
}
}
}
if (id.toString().startsWith(requiredID + " ")) {
System.out.println(id.toString());
}
fis.close();
}
}