egulias / EmailValidator4J

Java RFC strict EmailValidator
MIT License
25 stars 8 forks source link

Possible Exception in thread "main" java.lang.StackOverflowError #13

Open ea234 opened 5 years ago

ea234 commented 5 years ago

This one is more or less there. Before I programmed the sample Code, I got the same Result with only a lenght of 1300 characters ... still a little bit long.

You might want to add something like this: if ( ( laenge_eingabe_string < 6 ) || ( laenge_eingabe_string > 254 ) ) { return 12; // Laenge: Laengenbegrenzungen stimmen nicht }

private static EmailValidator m_email4j_v = new EmailValidator();

public static void main( String[] args ) { try { String z = "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ";

  String my_z_email_adress = FkString.left( z + z + z + z + z + z + z + z + z + z + z + z + z + z + z, 1000 ) + "@could.be.tolong.who.cares.info";

  System.out.println( "Length " + my_z_email_adress.length() );
  System.out.println( "Test 1 " + m_email4j_v.isValid( my_z_email_adress ) );

  my_z_email_adress = FkString.left( z + z + z + z + z + z + z + z + z + z + z + z + z +  z + z + z + z + z + z + z + z + z + z + z + z + z + z + z , 1500 ) + "@could.be.tolong.who.cares.info";

  System.out.println( "Length " + my_z_email_adress.length() );
  System.out.println( "Test 2 " + m_email4j_v.isValid( my_z_email_adress ) );

  my_z_email_adress = FkString.left( z + z + z + z + z + z + z + z + z + z + z + z + z +  z + z + z + z + z + z + z + z + z + z + z + z + z + z + z , 2000 ) + "@could.be.tolong.who.cares.info";

  System.out.println( "Length " + my_z_email_adress.length() );
  System.out.println( "Test 3 " + m_email4j_v.isValid( my_z_email_adress ) );
}
catch ( Exception err_inst )
{
  System.out.println( "MyTest"  + err_inst.getMessage() );
}

System.exit( 0 );

}

Results in: Length 1031 Test 1 true Length 1531 Test 2 true Length 2031 Exception in thread "main" java.lang.StackOverflowError at java.base/java.lang.Character.codePointAt(Character.java:8265) at java.base/java.util.regex.Pattern$CharProperty.match(Pattern.java:3925) at java.base/java.util.regex.Pattern$Branch.match(Pattern.java:4736) at java.base/java.util.regex.Pattern$GroupHead.match(Pattern.java:4791) at java.base/java.util.regex.Pattern$Loop.match(Pattern.java:4928) at java.base/java.util.regex.Pattern$GroupTail.match(Pattern.java:4850) at java.base/java.util.regex.Pattern$BranchConn.match(Pattern.java:4700) at java.base/java.util.regex.Pattern$CharProperty.match(Pattern.java:3927) at java.base/java.util.regex.Pattern$Branch.match(Pattern.java:4736) at java.base/java.util.regex.Pattern$GroupHead.match(Pattern.java:4791) at java.base/java.util.regex.Pattern$Loop.match(Pattern.java:4928)