You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I'm trying Java-RSRepair in my academic project to repair bugs automatically. I want to try it with a java program Syllables.java in the package introclassJava with my testcase SyllablesWhiteboxTest.java in a package called introclassJava.
I wrote all the config files following the sample config files model in your repository, but when I execute the program, I get a NullPointerException. I tried to debug it but the problem persists. Do you have any solution to resolve my problem ?
Here is the stack trace :
Running candidate 1 ...
Running generation 1 ...
Applying addition mutation...null
Applying null mutation...Error: null
Exception in thread "main" java.lang.NullPointerException
at ca.uwaterloo.ece.qhanam.jrsrepair.Statements.getRandomStatement(Statements.java:63)
at ca.uwaterloo.ece.qhanam.jrsrepair.context.MutationContext.getRandomMutation(MutationContext.java:61)
at ca.uwaterloo.ece.qhanam.jrsrepair.JRSRepair.mutationIteration(JRSRepair.java:161)
at ca.uwaterloo.ece.qhanam.jrsrepair.JRSRepair.repair(JRSRepair.java:61)
at ca.uwaterloo.ece.qhanam.jrsrepair.JRSRepairMain.main(JRSRepairMain.java:26)
Here is my jrsrepair.properties file :
# The coverage files from fault localization
faulty_coverage = ./exemple/config/faulty.cov
seed_coverage = ./exemple/config/seed.cov
# Settings for mutant generation
mutation_candidates = 10
mutation_generations = 1
mutation_attempts = 1
# Test script settings ***
# Currently there are two options for test scripts:
# 1. Ant script (uses Apache Ant)
# 2. Bash script (user defined shell script for running JUnit)
# Specify the test script. Choose from {ANT,BASH}
test_script = ANT
#1. Ant settings
ant_base_dir = ./exemple/config/
ant_path = /usr/bin/ant
ant_compile_target = compile
ant_test_target = junit
#2. Bash script
bash_script_base_dir =
bash_script_path =
# Where to put log the log files and class files
build_directory = ./exemple/config/build
class_directory = ./exemple/config/build/classes
# Path settings for parsing the AST (and resolving bindings) and compiling
sourcepath = {./exemple/src/}
classpath = {}
# Include and exclude filters for copying files from the source directory to the class directory. Default behaviour is that nothing is copied (copy_source_includes = {}).
#copy_source_includes = {.*}
#copy_source_excludes = {.*\.java,package\.html}
# Different random seeds will cause different mutation operation orders and different statement selections
random_seed = 1
# Setting to true causes JRSRepair to perform no mutations. Useful for debugging compilation.
null_mutation_only = false
Here my build.xml file :
<project name="introclassJava" default="compile" basedir=".">
<description>
Executatable build file for Syllables test program.
</description>
<!-- set global properties for this build -->
<property name="source.java" location="../src"/>
<property name="source.test" location="../test"/>
<property name="build" location="build"/>
<property name="dist" location="dist"/>
<!-- ========== Properties ================================================ -->
<!-- This can be used to define 'junit.jar' property if necessary -->
<property file="build.properties"/>
<!-- ========== Component Declarations ==================================== -->
<!-- The name of this component -->
<property name="component.name" value="syllables"/>
<!-- The primary package name of this component -->
<property name="component.package" value="introclassJava"/>
<!-- The short title of this component -->
<property name="component.title" value="Syllables"/>
<!-- The full title of this component -->
<property name="component.title.full" value="Syllables Test Program"/>
<!-- The current version number of this component -->
<property name="component.version" value="1.0"/>
<!-- The directories for compilation targets -->
<property name="build.home" value="build/"/>
<property name="build.classes" value="${build.home}/classes"/>
<property name="build.tests" value="${build.home}/tests"/>
<property name="build.test.reports" value="${build.home}/test-reports"/>
<property name="junit.jar" value="../../libs/junit-4.12.jar"/>
<property name="hamcrest-all.jar" value="../../libs/hamcrest-all-1.3.jar"/>
<!-- The name/location of the jar file to build -->
<property name="final.name" value="${component.name}-${component.version}"/>
<property name="jar.name" value="${final.name}.jar"/>
<property name="build.jar.name" value="${build.home}/${jar.name}"/>
<!-- ========== Settings ================================================== -->
<!-- Javac -->
<property name="compile.debug" value="true"/>
<property name="compile.deprecation" value="true"/>
<property name="compile.optimize" value="false"/>
<!-- JUnit -->
<property name="test.failonerror" value="true"/>
<property name="testcase" value="introclassJava.SyllablesBlackboxTest"/>
<!-- ======================================================== -->
<!-- ======= Executable Targets ============================= -->
<!-- ======================================================== -->
<target name="init"
description="Initialize and evaluate conditionals">
<echo message="------- ${component.name} ${component.version} ------"/>
</target>
<!-- ======================================================== -->
<target name="prepare" depends="init"
description="Prepare build directory">
<mkdir dir="${build.home}"/>
</target>
<!-- ======================================================== -->
<target name="compile" depends="init"
description="Compile main code">
<mkdir dir="${build.classes}" />
<javac srcdir="${source.java}"
destdir="${build.classes}"
debug="${compile.debug}"
deprecation="${compile.deprecation}"
optimize="${compile.optimize}">
</javac>
</target>
<!-- ======================================================== -->
<target name="compile.tests" depends="compile"
description="Compile unit test cases">
<mkdir dir="${build.tests}" />
<javac srcdir="${source.test}"
destdir="${build.tests}"
debug="true"
deprecation="false"
optimize="false">
<classpath>
<pathelement location="${build.classes}"/>
<pathelement location="${junit.jar}"/>
<pathelement location="${hamcrest-all.jar}"/>
</classpath>
</javac>
</target>
<!-- ======================================================== -->
<target name="jar" depends="compile"
description="Create jar" >
<tstamp/>
<jar jarfile="${build.jar.name}"
basedir="${build.classes}"/>
</target>
<!-- ======================================================== -->
<target name="junit" depends="compile.tests"
description="Run JUnit test cases.">
<mkdir dir="${build.test.reports}"/>
<tstamp>
<format property="FILE_NAME" pattern="yyyyMMddHHmmssSSS"/>
</tstamp>
<echo> the current time is ${FILE_NAME}</echo>
<junit printsummary="yes" haltonfailure="yes" showoutput="yes">
<formatter type="brief"/>
<classpath>
<pathelement location="${build.classes}"/>
<pathelement location="${build.tests}"/>
<pathelement location="${junit.jar}"/>
<pathelement location="${hamcrest-all.jar}"/>
</classpath>
<test name="${testcase}" fork="yes" todir="${build.test.reports}" outfile="TEST-${FILE_NAME}">
<formatter type="brief" usefile="false"/>
</test>
</junit>
</target>
</project>
Sounds like this.statements.ceilingEntry(random) is null?
If this is the case, then there are probably no statements in the map. It could be that the java source files are not being parsed correctly or that the statements in the source files aren't being matched to the statements in faulty.cov or seed.cov. Debug around ParserContext.buildASTs (does the parsing with JDT) and MutationASTRequestor (matches the records in faulty.cov and seed.cov to actual statements from JDT).
Hello,
I'm trying
Java-RSRepair
in my academic project to repair bugs automatically. I want to try it with a java programSyllables.java
in the packageintroclassJava
with my testcaseSyllablesWhiteboxTest.java
in a package calledintroclassJava
.I wrote all the config files following the
sample
config files model in your repository, but when I execute the program, I get a NullPointerException. I tried to debug it but the problem persists. Do you have any solution to resolve my problem ?jrsrepair.properties
file :build.xml
file :faulty.cov
file :seed.cov
file :Thank you in advance.
The text was updated successfully, but these errors were encountered: