Trivadis / plsql-cop-cli

db* CODECOP Command Line

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

StringIndexOutOfBoundsException when analysing an empty file

PhilippSalvisberg opened this issue · comments

db* CODECOP Version 4.4.0 (2023-10-04 16:38:00 +0200) crashes with the following error stack when an empty file is processed (test.sql has a size of 0 bytes):

processing file 'test.sql'... 0    [main] ERROR      com.trivadis.tvdcc.CodeChecker  - java.util.concurrent.ExecutionException: java.lang.StringIndexOutOfBoundsException: index 0, length 0
java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.StringIndexOutOfBoundsException: index 0, length 0
	at com.trivadis.tvdcc.process.TimingOutResourceValidator.validate(TimingOutResourceValidator.java:43)
	at com.trivadis.tvdcc.process.ValidationTask.analyze(ValidationTask.java:146)
	at com.trivadis.tvdcc.process.ValidationTask.process(ValidationTask.java:126)
	at com.trivadis.tvdcc.CodeChecker.validateFiles(CodeChecker.java:253)
	at com.trivadis.tvdcc.CodeChecker.doCodeCheck(CodeChecker.java:155)
	at com.trivadis.tvdcc.CodeChecker.mainFunction(CodeChecker.java:67)
	at com.trivadis.tvdcc.CodeChecker.main(CodeChecker.java:46)
Caused by: java.util.concurrent.ExecutionException: java.lang.StringIndexOutOfBoundsException: index 0, length 0
	at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
	at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
	at com.trivadis.tvdcc.process.TimingOutResourceValidator.validate(TimingOutResourceValidator.java:41)
	... 6 more
Caused by: java.lang.StringIndexOutOfBoundsException: index 0, length 0
	at java.base/java.lang.String.checkIndex(String.java:4565)
	at java.base/java.lang.AbstractStringBuilder.charAt(AbstractStringBuilder.java:351)
	at java.base/java.lang.StringBuilder.charAt(StringBuilder.java:91)
	at com.trivadis.oracle.sqlplus.SqlPlusResource.isMarkdown(SqlPlusResource.java:77)
	at com.trivadis.oracle.sqlplus.SqlPlusResource.doLoad(SqlPlusResource.java:123)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1563)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1342)
	at com.trivadis.tvdcc.process.ResourceHandler$1.load(ResourceHandler.java:21)
	at com.trivadis.tvdcc.process.ResourceValidatorImpl.performValidation(ResourceValidatorImpl.java:49)
	at com.trivadis.tvdcc.process.ResourceValidatorImpl.validate(ResourceValidatorImpl.java:40)
	at com.trivadis.tvdcc.process.TimingOutResourceValidator.lambda$validate$0(TimingOutResourceValidator.java:34)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:840)

closed with db* CODECOP 4.4.2