sorry if the question has been already asked, i just got a "java.lang.StringIndexOutOfBoundsException" thrown though my program was running correctly at the first try. I have tried to change the index of my substring but it's not working either. here's the full exception thrown:
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: begin 8, end 17, length 9
at java.base/java.lang.String.checkBoundsBeginEnd(Unknown Source)
at java.base/java.lang.String.substring(Unknown Source)
at platerecognition.PlateRecognition.main(PlateRecognition.java:31)
and here's the lines:
public class Asserv {
/**
 * @param args the command line arguments
 */
public static void main(String[] args) throws FileNotFoundException {
   final File folder = new File("./Verr");
   PrintWriter pw = new PrintWriter(new File("Gel.csv"));
   for (final File fileEntry : folder.listFiles()) {
    if (!fileEntry.isDirectory()) { 
        String filename = fileEntry.getName();
        String date = filename.substring(0, 8);
        System.out.println(date);
        String time = filename.substring(8,17);
        System.out.println(time);
        int index = filename.indexOf("_", 19);
        String plate = filename.substring(18,index);
        System.out.println(plate);        
        int index2 = filename.indexOf("-", index+2);
        String cam = filename.substring(index+4, index2);
        System.out.println(cam);
        String last = filename.substring(index2 + 1, filename.indexOf('.', index2 + 1));
        System.out.println(last);
        System.out.println(fileEntry.getName());
 
     
    