├── example.java ├── study.java ├── study3.java ├── detect.java ├── Test.py ├── study2.java ├── README.md ├── genBugAndFix.sh ├── LICENSE └── autoabstracts.sh /example.java: -------------------------------------------------------------------------------- 1 | if (excerpt.equals(LINE)&&0 <= charno&& 2 | charno=0){ 3 | return ListManager.getFirst(myList); 4 | } 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /study2.java: -------------------------------------------------------------------------------- 1 | 2 | if (excerpt.equals(LINE)&&0 <= && 3 | < sorceExcerpt.length()){ 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # code-source-of-defects4j 2 | this repository includes the code source(bug and fix) filtered in the defects4j projects 3 | 4 | ## filter rules 5 | we only focus on the bugs that modify 1 part of the code. 6 | -------------------------------------------------------------------------------- /genBugAndFix.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | for bug in $(seq 1 18); 6 | do 7 | defects4j checkout -p Codec -v ${bug}b -w ~/projects/codec_bug/codec_${bug}; 8 | done 9 | 10 | 11 | for bug in $(seq 1 18); 12 | do 13 | defects4j checkout -p Codec -v ${bug}f -w ~/projects/codec_fix/codec_${bug}; 14 | done 15 | 16 | 17 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 2-Clause License 2 | 3 | Copyright (c) 2022, YangPeihao1203 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 20 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 23 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 24 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | -------------------------------------------------------------------------------- /autoabstracts.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | for bug in `seq 1 18` 4 | do 5 | echo "handling ${bug}" 6 | tmp_file=patches/${bug}.src.patch 7 | #echo ${tmp_file} 8 | count=`cat ${tmp_file}|grep @@|wc -l` 9 | #echo ${count} 10 | if [ $count -gt 2 ] 11 | then 12 | echo "大于2,不要" 13 | continue 14 | elif [ $count == 2 ] 15 | then 16 | #echo "等于2" 17 | insert_count=`cat ${tmp_file}|grep '^-.*'}|wc -l` 18 | #echo $insert_count 19 | if [ $insert_count != 1 ] 20 | then 21 | #echo "虽然等于2,但是不符合条件" 22 | continue 23 | fi 24 | else 25 | echo "等于1,满足条件" 26 | fi 27 | 28 | path_prefix=`cat ${tmp_file} |grep '^---'|cut -d / -f 1` 29 | #echo ${path_prefix} 30 | if [ "${path_prefix}" != "--- a" ] 31 | then 32 | echo "前缀不符合格式,退出" 33 | continue 34 | fi 35 | 36 | path_suffix=`cat ${tmp_file} |grep '^---'|cut -d / -f 2-20` 37 | #echo $path_suffix 38 | echo "/home/yph/projects/codec_bug/codec_${bug}/${path_suffix}" 39 | echo "/home/yph/projects/codec_fix/codec_${bug}/${path_suffix}" 40 | #echo ${bug_path} 41 | #echo ${fix_path} 42 | #chmod +x ${bug_path} 43 | #chmod +x ${fix_path} 44 | cp ~/projects/codec_bug/codec_${bug}/${path_suffix} ~/projects/codec/bug/ 45 | cp ~/projects/codec_fix/codec_${bug}/${path_suffix} ~/projects/codec/fix/ 46 | file_name=`basename ~/projects/codec_bug/codec_${bug}/${path_suffix}` 47 | echo ${file_name} 48 | mv ~/projects/codec/bug/${file_name} ~/projects/codec/bug/${bug}.txt 49 | mv ~/projects/codec/fix/${file_name} ~/projects/codec/fix/${bug}.txt 50 | 51 | 52 | done 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | --------------------------------------------------------------------------------