Skip to content

Concrete execution fails when Fuzzing tries to initialize Date with String #739

Closed
@alisevych

Description

@alisevych

Description

IllegalArgumentException is thrown from Date. when a String is passed as a parameter.

To Reproduce

Steps to reproduce the behavior:

  1. UTBotJava project is opened in IDEA with UTBot plugin installed
  2. Check that fuzzing is turned on (Settings -> Tools -> UTBot, Code analysis - leftmost position)
  3. Open utbot-sample/src/main/java/org/utbot/examples/stdlib/DateExample.java
  4. Generate tests for it
  5. Open the generated test

Expected behavior

Tests are supposed to be generated without errors.

Actual behavior

There is the Errors report for getTime.

Visual proofs (screenshots, logs, images)

    public void testGetTime_errors() {
        // Couldn't generate some tests. List of errors:
        // 
        // 1 occurrences of:
        // Default concrete execution failed

    }

The following exception is in the logs:

java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
	at org.utbot.framework.concrete.MockValueConstructor.call(MockValueConstructor.kt:446)
	at org.utbot.framework.concrete.MockValueConstructor.updateWithExecutableCallModel(MockValueConstructor.kt:372)
	at org.utbot.framework.concrete.MockValueConstructor.constructFromAssembleModel(MockValueConstructor.kt:351)
	at org.utbot.framework.concrete.MockValueConstructor.construct(MockValueConstructor.kt:129)
	at org.utbot.framework.concrete.MockValueConstructor.constructMethodParameters(MockValueConstructor.kt:104)
	at org.utbot.framework.concrete.UtExecutionInstrumentation.invoke(UtExecutionInstrumentation.kt:143)
	at org.utbot.framework.concrete.UtExecutionInstrumentation.invoke(UtExecutionInstrumentation.kt:106)
	at org.utbot.instrumentation.process.ChildProcessKt.loop(ChildProcess.kt:133)
	at org.utbot.instrumentation.process.ChildProcessKt.main(ChildProcess.kt:77)
	at org.utbot.instrumentation.process.ChildProcessKt.main(ChildProcess.kt)
Caused by: java.lang.IllegalArgumentException
	at java.base/java.util.Date.parse(Date.java:616)
	at java.base/java.util.Date.<init>(Date.java:274)
	... 14 more

Environment

Windows 10 Pro
Gradle project
JDK 8 / 11

Additional context

Symbolic analysis only mode doesn't produce this error.

Metadata

Metadata

Assignees

Labels

comp-fuzzingIssue is related to the fuzzingctg-bugIssue is a bug

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions