input stringlengths 205 73.3k | output stringlengths 64 73.2k | instruction stringclasses 1
value |
|---|---|---|
#vulnerable code
@Test(expected = Exception.class)
public void testParse_Integer_Exception_NotTerminated() {
BEParser parser = new BEParser("i1");
assertEquals(BEType.INTEGER, parser.readType());
parser.readInteger();
}
#locat... | #fixed code
@Test(expected = Exception.class)
public void testParse_Integer_Exception_NotTerminated() {
BEParser parser = new BEParser("i1".getBytes());
assertEquals(BEType.INTEGER, parser.readType());
parser.readInteger();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test(expected = Exception.class)
public void testParse_String_Exception_InsufficientContent() {
new BEParser("7:abcdef").readString();
}
#location 3
#vulnerability type RESOURCE_LEAK | #fixed code
@Test(expected = Exception.class)
public void testParse_String_Exception_InsufficientContent() {
new BEParser("7:abcdef".getBytes()).readString(charset);
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
protected void doExecute(MagnetContext context) {
TorrentId torrentId = context.getMagnetUri().getTorrentId();
MetadataFetcher metadataFetcher = new MetadataFetcher(metadataService, torrentId);
context.getRouter().registerMessaging... | #fixed code
@Override
protected void doExecute(MagnetContext context) {
TorrentId torrentId = context.getMagnetUri().getTorrentId();
MetadataConsumer metadataConsumer = new MetadataConsumer(metadataService, torrentId, config);
context.getRouter().registerMess... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testParse_List1() {
BEParser parser = new BEParser("l4:spam4:eggsi1ee");
assertEquals(BEType.LIST, parser.readType());
assertArrayEquals(
new Object[] {"spam", "eggs", BigInteger.ONE},
parser.... | #fixed code
@Test
public void testParse_List1() {
BEParser parser = new BEParser("l4:spam4:eggsi1ee".getBytes());
assertEquals(BEType.LIST, parser.readType());
assertArrayEquals(
new Object[] {"spam".getBytes(charset), "eggs".getBytes(charset),... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test//(expected = Exception.class)
public void testParse_Integer_Exception_NegativeZero() {
// not sure why the protocol spec forbids negative zeroes,
// so let it be for now
BEParser parser = new BEParser("i-0e");
assertEquals(BETyp... | #fixed code
@Test//(expected = Exception.class)
public void testParse_Integer_Exception_NegativeZero() {
// not sure why the protocol spec forbids negative zeroes,
// so let it be for now
BEParser parser = new BEParser("i-0e".getBytes());
assertEquals(... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test(expected = Exception.class)
public void testParse_Integer_Exception_NotTerminated() {
BEParser parser = new BEParser("i1");
assertEquals(BEType.INTEGER, parser.readType());
parser.readInteger();
}
#locat... | #fixed code
@Test(expected = Exception.class)
public void testParse_Integer_Exception_NotTerminated() {
BEParser parser = new BEParser("i1".getBytes());
assertEquals(BEType.INTEGER, parser.readType());
parser.readInteger();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testParse_Integer1() {
BEParser parser = new BEParser("i1e");
assertEquals(BEType.INTEGER, parser.readType());
assertEquals(BigInteger.ONE, parser.readInteger());
}
#location 5
... | #fixed code
@Test
public void testParse_Integer1() {
BEParser parser = new BEParser("i1e".getBytes());
assertEquals(BEType.INTEGER, parser.readType());
assertEquals(BigInteger.ONE, parser.readInteger());
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testConnection() throws InvalidMessageException, IOException {
PeerConnection connection = new PeerConnection(mock(Peer.class), clientChannel);
Message message;
server.writeMessage(new Handshake(new byte[20], new byte[20])... | #fixed code
@Test
public void testConnection() throws InvalidMessageException, IOException {
IPeerConnection connection = new PeerConnection(mock(Peer.class), clientChannel);
Message message;
server.writeMessage(new Handshake(new byte[20], new byte[20]));
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test(expected = Exception.class)
public void testParse_String_Exception_LengthStartsWithZero() {
new BEParser("0:").readString();
}
#location 3
#vulnerability type RESOURCE_LEAK | #fixed code
@Test(expected = Exception.class)
public void testParse_String_Exception_LengthStartsWithZero() {
new BEParser("0:".getBytes()).readString(charset);
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testParse_List1() {
BEParser parser = new BEParser("l4:spam4:eggsi1ee");
assertEquals(BEType.LIST, parser.readType());
assertArrayEquals(
new Object[] {"spam", "eggs", BigInteger.ONE},
parser.... | #fixed code
@Test
public void testParse_List1() {
BEParser parser = new BEParser("l4:spam4:eggsi1ee".getBytes());
assertEquals(BEType.LIST, parser.readType());
assertArrayEquals(
new Object[] {"spam".getBytes(charset), "eggs".getBytes(charset),... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test//(expected = Exception.class)
public void testParse_Integer_Exception_NegativeZero() {
// not sure why the protocol spec forbids negative zeroes,
// so let it be for now
BEParser parser = new BEParser("i-0e");
assertEquals(BETyp... | #fixed code
@Test//(expected = Exception.class)
public void testParse_Integer_Exception_NegativeZero() {
// not sure why the protocol spec forbids negative zeroes,
// so let it be for now
BEParser parser = new BEParser("i-0e".getBytes());
assertEquals(... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testParse_Integer1() {
BEParser parser = new BEParser("i1e");
assertEquals(BEType.INTEGER, parser.readType());
assertEquals(BigInteger.ONE, parser.readInteger());
}
#location 3
... | #fixed code
@Test
public void testParse_Integer1() {
BEParser parser = new BEParser("i1e".getBytes());
assertEquals(BEType.INTEGER, parser.readType());
assertEquals(BigInteger.ONE, parser.readInteger());
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test(expected = Exception.class)
public void testParse_Integer_Exception_UnexpectedTokens() {
BEParser parser = new BEParser("i-1-e");
assertEquals(BEType.INTEGER, parser.readType());
parser.readInteger();
}
... | #fixed code
@Test(expected = Exception.class)
public void testParse_Integer_Exception_UnexpectedTokens() {
BEParser parser = new BEParser("i-1-e".getBytes());
assertEquals(BEType.INTEGER, parser.readType());
parser.readInteger();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testDescriptors_WriteSingleFile() {
String fileName = "1-single.bin";
long chunkSize = 16;
long fileSize = chunkSize * 4;
Torrent torrent = mockTorrent(fileName, fileSize, chunkSize,
new byte[][] {... | #fixed code
@Test
public void testDescriptors_WriteSingleFile() {
String fileName = "1-single.bin";
IDataDescriptor descriptor = createDataDescriptor_SingleFile(fileName);
List<IChunkDescriptor> chunks = descriptor.getChunkDescriptors();
chunks.get(0... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testParse_String1() {
BEParser parser = new BEParser("1:s");
assertEquals(BEType.STRING, parser.readType());
assertEquals("s", parser.readString());
}
#location 5
... | #fixed code
@Test
public void testParse_String1() {
BEParser parser = new BEParser("1:s".getBytes());
assertEquals(BEType.STRING, parser.readType());
assertEquals("s", parser.readString(charset));
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static void delete(String key) throws IOException {
Properties props = getProperty();
OutputStream fos = new FileOutputStream(propertyFile);
props.remove(key);
props.store(fos, "Delete '" + key + "' value");
}
#location 6
... | #fixed code
public static void delete(String key) throws IOException {
delete(propertyFile, key);
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private void serverTreeItemSelected(TreeItem selectedItem, boolean refresh) {
this.itemSelected = selectedItem;
tree.setSelection(selectedItem);
text.setText(selectedItem.getText() + ":");
table.removeAll();
serverItemSelected();
if (refresh)
selectedItem.... | #fixed code
private void serverTreeItemSelected(TreeItem selectedItem, boolean refresh) {
this.itemSelected = selectedItem;
tree.setSelection(selectedItem);
text.setText(selectedItem.getText() + ":");
table.removeAll();
serverItemSelected();
int amount = service1.listDBs((Inte... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void execute() {
try {
server = service.listById(id);
jedis = new Jedis(server.getHost(), Integer.parseInt(server
.getPort()));
if (commands.size() > 0) {
RedisVersion version;
if (serverVersion.containsKey(String.valueOf(id))) {
version... | #fixed code
public void execute() {
try {
server = service.listById(id);
jedis = new Jedis(server.getHost(), Integer.parseInt(server.getPort()));
command();
jedis.close();
} catch (IOException e) {
e.printStackTrace();
}
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void pasteContainer(int sourceId, int sourceDb, String sourceContainer, int targetId, int targetDb, String targetContainer, boolean copy, boolean overwritten) {
ListContainerAllKeys command = new ListContainerAllKeysFactory(sourceId, sourceDb, sourceContainer).get... | #fixed code
public void pasteContainer(int sourceId, int sourceDb, String sourceContainer, int targetId, int targetDb, String targetContainer, boolean copy, boolean overwritten) {
Set<Node> nodes = listContainerAllKeys(sourceId, sourceDb, sourceContainer);
for(Node node: nodes) {
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static void write(String key, String value) throws IOException {
Properties props = getProperty();
OutputStream fos = new FileOutputStream(propertyFile);
props.setProperty(key, value);
props.store(fos, "Update '" + key + "' value");
}
... | #fixed code
public static void write(String key, String value) throws IOException {
write(propertyFile, key, value);
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public boolean execute(DiagnosticContext context) {
if (context.getInputParams().isSkipLogs()) {
return true;
}
JsonNode diagNode = context.getTypedAttribute("diagNode", JsonNode.class);
boolean getAccess = context.getInputParams().isAc... | #fixed code
public boolean execute(DiagnosticContext context) {
if (context.getInputParams().isSkipLogs() || ! context.isProcessLocal()) {
return true;
}
JsonNode diagNode = context.getTypedAttribute("diagNode", JsonNode.class);
if(diagNode == null){
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void extractDiagnosticArchive(String sourceInput) throws Exception {
TarArchiveInputStream archive = readDiagArchive(sourceInput);
logger.info("Extracting archive...");
try {
// Base archive name - it's not redundant like Intellij is c... | #fixed code
public void extractDiagnosticArchive(String sourceInput) throws Exception {
logger.info("Extracting archive...");
try {
ZipFile zf = new ZipFile(new File(sourceInput));
archiveProcessor.init(zf);
Enumeration<ZipArchiveEntry> entries = ... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void zipResults(String dir) {
try {
File srcDir = new File(dir);
ZipOutputStream out = new ZipOutputStream(new FileOutputStream(dir + ".zip"));
out.setLevel(ZipOutputStream.DEFLATED);
SystemUtils.zipDir("",... | #fixed code
public void zipResults(String dir) {
try {
File srcDir = new File(dir);
FileOutputStream fout = new FileOutputStream(dir + ".tar.gz");
GZIPOutputStream gzout = new GZIPOutputStream(fout);
TarArchiveOutputStream taos = n... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void createArchive(String dir, String archiveFileName) {
try {
File srcDir = new File(dir);
String filename = dir + "-" + archiveFileName + ".tar.gz";
FileOutputStream fout = new FileOutputStream(filename);
CompressorOu... | #fixed code
public void createArchive(String dir, String archiveFileName) {
if(! createZipArchive(dir, archiveFileName)){
logger.info("Couldn't create zip archive. Trying tar.gz");
if(! createTarArchive(dir, archiveFileName)){
logger.info("Couldn't crea... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void submitRequest(String url, String queryName, String destination){
HttpResponse response = null;
InputStream responseStream = null;
try{
FileOutputStream fos = new FileOutputStream(destination);
HttpGet httpget = new HttpGe... | #fixed code
public void submitRequest(String url, String queryName, String destination){
HttpResponse response = null;
InputStream responseStream = null;
try{
HttpClient client = getClient();
FileOutputStream fos = new FileOutputStream(destination);
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private List<Issue> parse(File report) throws IOException {
List<Issue> issues = new LinkedList<>();
PylintReportParser parser = new PylintReportParser();
for (Scanner sc = new Scanner(report.toPath(), fileSystem.encoding().name()); sc.hasNext(); ) {
St... | #fixed code
private List<Issue> parse(File report) throws IOException {
List<Issue> issues = new LinkedList<>();
PylintReportParser parser = new PylintReportParser();
Scanner sc;
for (sc = new Scanner(report.toPath(), fileSystem.encoding().name()); sc.hasNext(); ) {
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void while_statement() {
setRootRule(PythonGrammar.WHILE_STMT);
WhileStatementImpl tree = parse("while foo:\n pass\nelse:\n pass", treeMaker::whileStatement);
FirstLastTokenVerifierVisitor visitor = spy(FirstLastTokenVerifierVisitor.class);
... | #fixed code
@Test
public void while_statement() {
setRootRule(PythonGrammar.WHILE_STMT);
WhileStatementImpl tree = parse("while foo:\n pass\nelse:\n pass", treeMaker::whileStatement);
FirstLastTokenVerifierVisitor visitor = spy(FirstLastTokenVerifierVisitor.class);
visi... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static List<String> callCommand(String command, String[] environ) {
List<String> lines = new LinkedList<String>();
PythonPlugin.LOG.debug("Calling command: '{}'", command);
BufferedReader stdInput = null;
try {
Process p = null;
if(env... | #fixed code
public static List<String> callCommand(String command, String[] environ) {
List<String> lines = new LinkedList<String>();
PythonPlugin.LOG.debug("Calling command: '{}'", command);
BufferedReader stdInput = null;
Process process = null;
try {
if(envir... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public ForStatement forStatement(AstNode astNode) {
AstNode forStatementNode = astNode;
Token asyncToken = null;
if (astNode.is(PythonGrammar.ASYNC_STMT)) {
asyncToken = toPyToken(astNode.getFirstChild().getToken());
forStatementNode = astNode.getF... | #fixed code
public ForStatement forStatement(AstNode astNode) {
AstNode forStatementNode = astNode;
Token asyncToken = null;
if (astNode.is(PythonGrammar.ASYNC_STMT)) {
asyncToken = toPyToken(astNode.getFirstChild().getToken());
forStatementNode = astNode.getFirstCh... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void definition_callee_symbol() {
FileInput tree = parse(
"def fn(): pass",
"fn('foo')"
);
// TODO: create a symbol for function declaration
CallExpression callExpression = getCallExpression(tree);
assertThat(callExpression.c... | #fixed code
@Test
public void definition_callee_symbol() {
FileInput tree = parse(
"def fn(): pass",
"fn('foo')"
);
assertNameAndQualifiedName(tree, "fn", null);
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void no_field() {
ClassDef empty = parseClass(
"class C: ",
" pass");
assertThat(empty.classFields()).isEmpty();
assertThat(empty.instanceFields()).isEmpty();
ClassDef empty2 = parseClass(
"class C:",
" def f(): pa... | #fixed code
@Test
public void no_field() {
ClassDef empty = parseClass(
"class C: ",
" pass");
assertThat(empty.classFields()).isEmpty();
assertThat(empty.instanceFields()).isEmpty();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void relative_import_symbols() {
FileInput tree = parse(
new SymbolTableBuilder("my_package.my_module"),
"from . import b"
);
Name b = getFirstChild(tree, t -> t.is(Tree.Kind.NAME));
assertThat(b.symbol().fullyQualifiedName()).is... | #fixed code
@Test
public void relative_import_symbols() {
FileInput tree = parse(
new SymbolTableBuilder("my_package", "my_module.py"),
"from . import b"
);
Name b = getFirstChild(tree, t -> t.is(Tree.Kind.NAME));
assertThat(b.symbol().fullyQualifiedName()).is... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private List<Issue> parse(File report) throws java.io.FileNotFoundException {
List<Issue> issues = new LinkedList<Issue>();
PylintReportParser parser = new PylintReportParser();
for(Scanner sc = new Scanner(report); sc.hasNext(); ) {
String line = sc.ne... | #fixed code
private List<Issue> parse(File report) throws IOException {
List<Issue> issues = new LinkedList<Issue>();
PylintReportParser parser = new PylintReportParser();
for(Scanner sc = new Scanner(report.toPath(), fileSystem.encoding().name()); sc.hasNext(); ) {
Stri... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public int size() {
Long size = JedisUtil.getJedis().dbSize();
return size.intValue();
}
#location 3
#vulnerability type NULL_DEREFERENCE | #fixed code
@Override
public int size() {
Long size = Objects.requireNonNull(JedisUtil.getJedis()).dbSize();
return size.intValue();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken auth) throws AuthenticationException {
String token = (String) auth.getCredentials();
// 解密获得account,用于和数据库进行对比
String account = JWTUtil.getClaim(token, "accou... | #fixed code
@Override
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken auth) throws AuthenticationException {
String token = (String) auth.getCredentials();
// 解密获得account,用于和数据库进行对比
String account = JWTUtil.getClaim(token, "account");
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public Set keys() {
Set<byte[]> keys = JedisUtil.getJedis().keys(new String("*").getBytes());
Set<Object> set = new HashSet<Object>();
for (byte[] bs : keys) {
set.add(SerializableUtil.unserializable(bs));
}
... | #fixed code
@Override
public Set keys() {
Set<byte[]> keys = Objects.requireNonNull(JedisUtil.getJedis()).keys("*".getBytes());
Set<Object> set = new HashSet<Object>();
for (byte[] bs : keys) {
set.add(SerializableUtil.unserializable(bs));
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void clear() throws CacheException {
JedisUtil.getJedis().flushDB();
}
#location 3
#vulnerability type NULL_DEREFERENCE | #fixed code
@Override
public void clear() throws CacheException {
Objects.requireNonNull(JedisUtil.getJedis()).flushDB();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private HashSet<String> extractOutputVariables(String stateMachineText) throws IOException {
InputStream is = new ByteArrayInputStream(stateMachineText.getBytes());
BufferedReader bReader = new BufferedReader(new InputStreamReader(is));
HashSet<... | #fixed code
private HashSet<String> extractOutputVariables(String stateMachineText) throws IOException {
Set<String> names = ScXmlUtils.getAttributesValues(stateMachineText, "assign", "name");
return (HashSet<String>) names;
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testDefaultDataConsumerAccess(){
DataPipe thePipe = new DataPipe();
DataConsumer dc = thePipe.getDataConsumer();
Assert.assertNotNull(dc);
Assert.assertNotNull(dc.getFlags());
Assert.assertFalse(dc.getFlags(... | #fixed code
@Test
public void testDefaultDataConsumerAccess() {
DataPipe thePipe = new DataPipe();
DataConsumer dc = thePipe.getDataConsumer();
dc.setFlags(new Hashtable<String, AtomicBoolean>());
Assert.assertNotNull(dc);
Assert.assertNotNull... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public String getProperty(String name) {
Properties properties = new Properties();
Resource resource = new ClassPathResource("server.properties");
FileInputStream fileInputStream = null;
String value = null;
try {
fileInputStream = new FileInputStream(resource... | #fixed code
public String getProperty(String name) {
Properties properties = new Properties();
FileInputStream fileInputStream = null;
String value = null;
try {
fileInputStream = new FileInputStream(this.getProperties());
properties.load(fileInputStream);
value = propertie... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@RequestMapping("/file/downloadFile")
@ResponseBody
public void downloadFile(String path, String name, HttpServletRequest request, HttpServletResponse response) {
response.setHeader("Content-Disposition", "attachment;filename=" + name);
response.... | #fixed code
@RequestMapping("/file/downloadFile")
@ResponseBody
public void downloadFile(String path, String name, HttpServletRequest request, HttpServletResponse response) {
response.setHeader("Content-Disposition", "attachment;filename=" + name);
response.setCon... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void addSuper(@NotNull Type superclass) {
this.superclass = superclass;
table.addSuper(superclass.table);
}
#location 3
#vulnerability type NULL_DEREFERENCE | #fixed code
public void addSuper(@NotNull Type superclass) {
this.superclass = superclass;
table.setSuper(superclass.table);
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Nullable
public String extendPath(@NotNull String name) {
if (name.endsWith(".py")) {
name = Util.moduleNameFor(name);
}
if (path.equals("")) {
return name;
}
String sep;
switch (scopeType) {
... | #fixed code
@Nullable
public String extendPath(@NotNull String name) {
if (name.endsWith(".py")) {
name = Util.moduleNameFor(name);
}
if (path.equals("")) {
return name;
}
String sep;
switch (scopeType) {
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@NotNull
public List<Entry> generate(@NotNull Scope scope, @NotNull String path) {
List<Entry> result = new ArrayList<Entry>();
Set<Binding> entries = new TreeSet<Binding>();
for (Binding b : scope.values()) {
if (!b.isSynthetic(... | #fixed code
@NotNull
public List<Entry> generate(@NotNull Scope scope, @NotNull String path) {
List<Entry> result = new ArrayList<Entry>();
Set<Binding> entries = new TreeSet<Binding>();
for (Binding b : scope.values()) {
if (!b.isSynthetic()
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
void buildTupleType() {
Scope bt = BaseTuple.getTable();
String[] tuple_methods = {
"__add__", "__contains__", "__eq__", "__ge__", "__getnewargs__",
"__gt__", "__iter__", "__le__", "__len__", "__lt__", "__mul__",
"__ne... | #fixed code
String[] list(String... names) {
return names;
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private void setAttrType(@NotNull Type targetType, @NotNull Type v) {
if (targetType.isUnknownType()) {
Analyzer.self.putProblem(this, "Can't set attribute for UnknownType");
return;
}
// new attr, mark the type as "mutate... | #fixed code
private void setAttrType(@NotNull Type targetType, @NotNull Type v) {
if (targetType.isUnknownType()) {
Analyzer.self.putProblem(this, "Can't set attribute for UnknownType");
return;
}
// new attr, mark the type as "mutated"
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public int compareTo(@NotNull Object o) {
return getFirstNode().getStart() - ((Binding)o).getFirstNode().getStart();
}
#location 2
#vulnerability type NULL_DEREFERENCE | #fixed code
public int compareTo(@NotNull Object o) {
return getSingle().getStart() - ((Binding)o).getSingle().getStart();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public boolean equals(Object obj) {
if (obj instanceof Function) {
Function fo = (Function) obj;
return (fo.getFile().equals(getFile()) && fo.start == start);
} else {
return false;
}
}
... | #fixed code
@Override
public boolean equals(Object obj) {
if (obj instanceof Function) {
Function fo = (Function) obj;
return (fo.file.equals(file) && fo.start == start);
} else {
return false;
}
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private static void writeSymJson(@NotNull Binding binding, JsonGenerator json) throws IOException {
if (binding.start < 0) {
return;
}
String name = binding.node.name;
boolean isExported = !(
Binding.Kind.VARI... | #fixed code
private static void writeSymJson(@NotNull Binding binding, JsonGenerator json) throws IOException {
if (binding.start < 0) {
return;
}
String name = binding.node.name;
boolean isExported = !(
Binding.Kind.VARIABLE =... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void restrictNumType(Compare compare, Scope s1, Scope s2) {
List<Node> ops = compare.ops;
if (ops.size() > 0 && ops.get(0) instanceof Op) {
String opname = ((Op) ops.get(0)).name;
Node left = compare.left;
Node... | #fixed code
public void restrictNumType(Compare compare, Scope s1, Scope s2) {
List<Node> ops = compare.ops;
if (ops.size() > 0 && ops.get(0) instanceof Op) {
Op op = ((Op) ops.get(0));
String opname = op.name;
if (op.isNumberCompariso... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@NotNull
@Override
public Type transform(@NotNull State s) {
ClassType classType = new ClassType(getName().id, s);
List<Type> baseTypes = new ArrayList<>();
for (Node base : bases) {
Type baseType = transformExpr(base, s);
... | #fixed code
@NotNull
@Override
public Type transform(@NotNull State s) {
if (locator != null) {
Type existing = transformExpr(locator, s);
if (existing instanceof ClassType) {
if (body != null) {
transformExpr(bo... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static void bindIter(@NotNull Scope s, Node target, @NotNull Node iter, Binding.Kind kind) {
Type iterType = Node.resolveExpr(iter, s);
if (iterType.isListType()) {
bind(s, target, iterType.asListType().getElementType(), kind);
... | #fixed code
public static void bindIter(@NotNull Scope s, Node target, @NotNull Node iter, Binding.Kind kind) {
Type iterType = Node.resolveExpr(iter, s);
if (iterType.isListType()) {
bind(s, target, iterType.asListType().getElementType(), kind);
} el... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@NotNull
@Override
public Type transform(State s) {
Type ltype = transformExpr(left, s);
Type rtype;
// boolean operations
if (op == Op.And) {
if (ltype.isUndecidedBool()) {
rtype = transformExpr(righ... | #fixed code
@NotNull
@Override
public Type transform(State s) {
Type ltype = transformExpr(left, s);
Type rtype;
// boolean operations
if (op == Op.And) {
if (ltype.isUndecidedBool()) {
rtype = transformExpr(right, lty... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
void buildFunctionType() {
Scope t = BaseFunction.getTable();
for (String s : list("func_doc", "__doc__", "func_name", "__name__", "__module__")) {
t.update(s, new Url(DATAMODEL_URL), BaseStr, ATTRIBUTE);
}
Binding b = synth... | #fixed code
String[] list(String... names) {
return names;
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private void createStreams(final String host) throws Exception {
appServerPort = randomFreeLocalPort();
streams = KafkaMusicExample.createChartsStreams(CLUSTER.bootstrapServers(),
CLUSTER.schemaRegistryUrl(),
... | #fixed code
private void createStreams(final String host) throws Exception {
appServerPort = randomFreeLocalPort();
streams = KafkaMusicExample.createChartsStreams(CLUSTER.bootstrapServers(),
CLUSTER.schemaRegistryUrl(),
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public ReturnT<String> add(XxlConfNode xxlConfNode, XxlConfUser loginUser, String loginEnv) {
// valid
if (StringUtils.isBlank(xxlConfNode.getAppname())) {
return new ReturnT<String>(500, "AppName不可为空");
}
// project permission
if (!ifHasProjectPe... | #fixed code
@Override
public ReturnT<String> add(XxlConfNode xxlConfNode, XxlConfUser loginUser, String loginEnv) {
// valid
if (StringUtils.isBlank(xxlConfNode.getAppname())) {
return new ReturnT<String>(500, "AppName不可为空");
}
// project permission
if (!ifHasProjectPermissi... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public ZooKeeper getClient(){
if (zooKeeper==null) {
try {
if (INSTANCE_INIT_LOCK.tryLock(2, TimeUnit.SECONDS)) {
if (zooKeeper==null) { // 二次校验,防止并发创建client
try {
zooKeeper = new ZooKeeper(zkaddress, 10000, watcher); // TODO,本地变量方式,成功才会赋值
... | #fixed code
public ZooKeeper getClient(){
if (zooKeeper == null) {
try {
zooKeeper = new ZooKeeper(zkaddress, 10000, watcher); // TODO,本地变量方式,成功才会赋值
if (zkdigest != null && zkdigest.trim().length() > 0) {
zooKeep... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public ZooKeeper getClient(){
if (zooKeeper==null) {
try {
if (INSTANCE_INIT_LOCK.tryLock(2, TimeUnit.SECONDS)) {
if (zooKeeper==null) { // 二次校验,防止并发创建client
try {
zooKeeper = new ZooKeeper(zkaddress, 10000, watcher); // TODO,本地变量方式,成功才会赋值
... | #fixed code
public ZooKeeper getClient(){
if (zooKeeper==null) {
try {
if (INSTANCE_INIT_LOCK.tryLock(2, TimeUnit.SECONDS)) {
if (zooKeeper==null) { // 二次校验,防止并发创建client
// init new-client
ZooKeeper newZk = null;
try {
newZk = new ZooKeeper(zkaddress... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testUnwrapConnection() throws SQLException
{
HikariConfig config = new HikariConfig();
config.setMinimumIdle(1);
config.setMaximumPoolSize(1);
config.setInitializationFailFast(true);
config.setConnectionT... | #fixed code
@Test
public void testUnwrapConnection() throws SQLException
{
HikariConfig config = new HikariConfig();
config.setMinimumIdle(1);
config.setMaximumPoolSize(1);
config.setInitializationFailFast(true);
config.setConnectionTestQue... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testShutdown2() throws SQLException
{
Assert.assertSame("StubConnection count not as expected", 0, StubConnection.count.get());
StubConnection.slowCreate = true;
HikariConfig config = new HikariConfig();
config... | #fixed code
@Test
public void testShutdown2() throws SQLException
{
Assert.assertSame("StubConnection count not as expected", 0, StubConnection.count.get());
StubConnection.slowCreate = true;
HikariConfig config = new HikariConfig();
config.setMi... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private long runAndMeasure(Measurable[] runners, CountDownLatch latch, String timeUnit)
{
for (int i = 0; i < runners.length; i++)
{
Thread t = new Thread(runners[i]);
t.start();
}
try
{
la... | #fixed code
private long runAndMeasure(Measurable[] runners, CountDownLatch latch, String timeUnit)
{
for (int i = 0; i < runners.length; i++)
{
Thread t = new Thread(runners[i]);
t.start();
}
try
{
latch.aw... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testOverflow()
{
FastStatementList list = new FastStatementList();
for (int i = 0; i < 100; i++)
{
list.add(new StubStatement());
}
for (int i = 0; i < 100; i++)
{
Assert.... | #fixed code
@Test
public void testOverflow()
{
ArrayList<Statement> verifyList = new ArrayList<>();
FastStatementList list = new FastStatementList();
for (int i = 0; i < 100; i++)
{
StubStatement statement = new StubStatement();
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@HikariInject
public ResultSet executeQuery() throws SQLException
{
IHikariResultSetProxy resultSet = (IHikariResultSetProxy) __executeQuery();
resultSet.setProxyStatement(this);
return (ResultSet) resultSet;
}
... | #fixed code
@HikariInject
public ResultSet executeQuery() throws SQLException
{
try
{
IHikariResultSetProxy resultSet = (IHikariResultSetProxy) __executeQuery();
if (resultSet == null)
{
return null;
}
resultSet.setProxyStatement... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testShutdown1() throws SQLException
{
Assert.assertSame("StubConnection count not as expected", 0, StubConnection.count.get());
StubConnection.slowCreate = true;
HikariConfig config = new HikariConfig();
config... | #fixed code
@Test
public void testShutdown1() throws SQLException
{
Assert.assertSame("StubConnection count not as expected", 0, StubConnection.count.get());
StubConnection.slowCreate = true;
HikariConfig config = new HikariConfig();
config.setMi... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private long runAndMeasure(Measurable[] runners, CountDownLatch latch, String timeUnit)
{
for (int i = 0; i < runners.length; i++)
{
Thread t = new Thread(runners[i]);
t.start();
}
try
{
la... | #fixed code
private long runAndMeasure(Measurable[] runners, CountDownLatch latch, String timeUnit)
{
for (int i = 0; i < runners.length; i++)
{
Thread t = new Thread(runners[i]);
t.start();
}
try
{
latch.aw... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void rampUpDownTest() throws SQLException, InterruptedException
{
HikariConfig config = new HikariConfig();
config.setMinimumIdle(5);
config.setMaximumPoolSize(60);
config.setInitializationFailFast(true);
conf... | #fixed code
@Test
public void rampUpDownTest() throws SQLException, InterruptedException
{
HikariConfig config = new HikariConfig();
config.setMinimumIdle(5);
config.setMaximumPoolSize(60);
config.setInitializationFailFast(true);
config.set... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testMaxLifetime() throws Exception
{
HikariConfig config = new HikariConfig();
config.setMinimumIdle(0);
config.setMaximumPoolSize(1);
config.setInitializationFailFast(true);
config.setConnectionTestQuery... | #fixed code
@Test
public void testMaxLifetime() throws Exception
{
HikariConfig config = new HikariConfig();
config.setMinimumIdle(0);
config.setMaximumPoolSize(1);
config.setInitializationFailFast(true);
config.setConnectionTestQuery("VALU... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testShutdown3() throws SQLException
{
Assert.assertSame("StubConnection count not as expected", 0, StubConnection.count.get());
StubConnection.slowCreate = true;
HikariConfig config = new HikariConfig();
config... | #fixed code
@Test
public void testShutdown3() throws SQLException
{
Assert.assertSame("StubConnection count not as expected", 0, StubConnection.count.get());
StubConnection.slowCreate = true;
HikariConfig config = new HikariConfig();
config.setMi... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public Connection getConnection() throws SQLException
{
final long start = System.currentTimeMillis();
final MetricsContext context = (isRecordMetrics ? metricsTracker.recordConnectionRequest(start) : MetricsTracker.NO_CONTEXT);
long timeout = connec... | #fixed code
public Connection getConnection() throws SQLException
{
final long start = System.currentTimeMillis();
final MetricsContext context = (isRecordMetrics ? metricsTracker.recordConnectionRequest(start) : MetricsTracker.NO_CONTEXT);
long timeout = connectionTi... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testConnectionIdleFill() throws Exception
{
HikariConfig config = new HikariConfig();
config.setMinimumIdle(5);
config.setMaximumPoolSize(10);
config.setConnectionTimeout(1000);
config.setConnectionTestQu... | #fixed code
@Test
public void testConnectionIdleFill() throws Exception
{
HikariConfig config = new HikariConfig();
config.setMinimumIdle(5);
config.setMaximumPoolSize(10);
config.setConnectionTimeout(1000);
config.setConnectionTestQuery("V... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testAutoCommit() throws SQLException
{
HikariDataSource ds = new HikariDataSource();
ds.setAutoCommit(true);
ds.setMinimumIdle(1);
ds.setMaximumPoolSize(1);
ds.setConnectionTestQuery("VALUES 1");
... | #fixed code
@Test
public void testAutoCommit() throws SQLException
{
HikariDataSource ds = new HikariDataSource();
ds.setAutoCommit(true);
ds.setMinimumIdle(1);
ds.setMaximumPoolSize(1);
ds.setConnectionTestQuery("VALUES 1");
ds.set... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testBackfill() throws Exception
{
HikariConfig config = new HikariConfig();
config.setMinimumIdle(1);
config.setMaximumPoolSize(4);
config.setConnectionTimeout(500);
config.setInitializationFailFast(true)... | #fixed code
@Test
public void testBackfill() throws Exception
{
HikariConfig config = new HikariConfig();
config.setMinimumIdle(1);
config.setMaximumPoolSize(4);
config.setConnectionTimeout(500);
config.setInitializationFailFast(true);
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testShutdown4() throws SQLException
{
StubConnection.slowCreate = true;
HikariConfig config = new HikariConfig();
config.setMinimumIdle(10);
config.setMaximumPoolSize(10);
config.setInitializatio... | #fixed code
@Test
public void testShutdown4() throws SQLException
{
StubConnection.slowCreate = true;
HikariConfig config = new HikariConfig();
config.setMinimumIdle(10);
config.setMaximumPoolSize(10);
config.setInitializationFailF... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testCreate() throws SQLException
{
HikariConfig config = new HikariConfig();
config.setMinimumIdle(1);
config.setMaximumPoolSize(1);
config.setInitializationFailFast(true);
config.setConnectionTestQuery("... | #fixed code
@Test
public void testCreate() throws SQLException
{
HikariConfig config = new HikariConfig();
config.setMinimumIdle(1);
config.setMaximumPoolSize(1);
config.setInitializationFailFast(true);
config.setConnectionTestQuery("VALUES... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testCatalog() throws SQLException
{
HikariDataSource ds = new HikariDataSource();
ds.setCatalog("test");
ds.setMinimumIdle(1);
ds.setMaximumPoolSize(1);
ds.setConnectionTestQuery("VALUES 1");
ds.s... | #fixed code
@Test
public void testCatalog() throws SQLException
{
HikariDataSource ds = new HikariDataSource();
ds.setCatalog("test");
ds.setMinimumIdle(1);
ds.setMaximumPoolSize(1);
ds.setConnectionTestQuery("VALUES 1");
ds.setData... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testOverflow()
{
FastStatementList list = new FastStatementList();
for (int i = 0; i < 100; i++)
{
list.add(new StubStatement());
}
for (int i = 0; i < 100; i++)
{
Assert.... | #fixed code
@Test
public void testOverflow()
{
ArrayList<Statement> verifyList = new ArrayList<>();
FastStatementList list = new FastStatementList();
for (int i = 0; i < 100; i++)
{
StubStatement statement = new StubStatement();
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testDoubleClose() throws Exception
{
HikariConfig config = new HikariConfig();
config.setMinimumIdle(1);
config.setMaximumPoolSize(1);
config.setInitializationFailFast(true);
config.setConnectionTestQuery... | #fixed code
@Test
public void testDoubleClose() throws Exception
{
HikariConfig config = new HikariConfig();
config.setMinimumIdle(1);
config.setMaximumPoolSize(1);
config.setInitializationFailFast(true);
config.setConnectionTestQuery("VALU... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testConnectionRetries3() throws SQLException
{
HikariConfig config = new HikariConfig();
config.setMinimumIdle(0);
config.setMaximumPoolSize(2);
config.setConnectionTimeout(2800);
config.setConnectionTest... | #fixed code
@Test
public void testConnectionRetries3() throws SQLException
{
HikariConfig config = new HikariConfig();
config.setMinimumIdle(0);
config.setMaximumPoolSize(2);
config.setConnectionTimeout(2800);
config.setConnectionTestQuery(... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testTransactionIsolation() throws SQLException
{
HikariDataSource ds = new HikariDataSource();
ds.setTransactionIsolation("TRANSACTION_READ_COMMITTED");
ds.setMinimumIdle(1);
ds.setMaximumPoolSize(1);
ds.... | #fixed code
@Test
public void testTransactionIsolation() throws SQLException
{
HikariDataSource ds = new HikariDataSource();
ds.setTransactionIsolation("TRANSACTION_READ_COMMITTED");
ds.setMinimumIdle(1);
ds.setMaximumPoolSize(1);
ds.setCon... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testMaxLifetime2() throws Exception
{
HikariConfig config = new HikariConfig();
config.setMinimumIdle(0);
config.setMaximumPoolSize(1);
config.setInitializationFailFast(true);
config.setConnectionTestQuer... | #fixed code
@Test
public void testMaxLifetime2() throws Exception
{
HikariConfig config = new HikariConfig();
config.setMinimumIdle(0);
config.setMaximumPoolSize(1);
config.setInitializationFailFast(true);
config.setConnectionTestQuery("VAL... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static void main(String... args)
{
if (args.length < 3)
{
System.err.println("Usage: <poolname> <threads> <poolsize>");
System.err.println(" <poolname> 'hikari' or 'bone'");
System.exit(0);
}
... | #fixed code
public static void main(String... args)
{
if (args.length < 3)
{
System.err.println("Usage: <poolname> <threads> <poolsize>");
System.err.println(" <poolname> 'hikari' or 'bone'");
System.exit(0);
}
TH... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void startCrackedSession(ProtocolLibLoginSource source, StoredProfile profile, String username) {
BukkitLoginSession loginSession = new BukkitLoginSession(username, profile);
plugin.getLoginSessions().put(player.getAddress().toString... | #fixed code
@Override
public void startCrackedSession(ProtocolLibLoginSource source, StoredProfile profile, String username) {
BukkitLoginSession loginSession = new BukkitLoginSession(username, profile);
plugin.putSession(player.getAddress(), loginSession);
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onSessionRestore(RestoreSessionEvent restoreSessionEvent) {
Player player = restoreSessionEvent.getPlayer();
String id = '/' + player.getAddress().getAddress().getHo... | #fixed code
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onSessionRestore(RestoreSessionEvent restoreSessionEvent) {
Player player = restoreSessionEvent.getPlayer();
BukkitLoginSession session = plugin.getSession(player.getAddre... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void run() {
try {
BukkitLoginSession session = plugin.getLoginSessions().get(player.getAddress().toString());
if (session == null) {
disconnect("invalid-request", true
, "GameP... | #fixed code
@Override
public void run() {
try {
BukkitLoginSession session = plugin.getSession(player.getAddress());
if (session == null) {
disconnect("invalid-request", true
, "GameProfile {0} tried to send encr... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private void readMessage(Player player, LoginActionMessage message) {
String playerName = message.getPlayerName();
Type type = message.getType();
InetSocketAddress address = player.getAddress();
String id = '/' + address.getAddress().get... | #fixed code
private void readMessage(Player player, LoginActionMessage message) {
String playerName = message.getPlayerName();
Type type = message.getType();
InetSocketAddress address = player.getAddress();
if (type == Type.LOGIN) {
BukkitLogi... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
protected static String rootPath() {
String path = System.getProperty("java.io.tmpdir");
String sep = System.getProperty("file.separator");
if (!path.endsWith(sep)) {
path += sep;
}
return path + "chronicle-jul";
... | #fixed code
protected static String rootPath() {
String path = OS.getTarget();
String sep = System.getProperty("file.separator");
if (!path.endsWith(sep)) {
path += sep;
}
return path + "chronicle-jul" + Time.uniqueId();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
static String rootPath() {
String path = System.getProperty("java.io.tmpdir");
String sep = System.getProperty("file.separator");
if (!path.endsWith(sep)) {
path += sep;
}
return path + "chronicle-log4j1";
}
... | #fixed code
static String rootPath() {
String path = OS.getTarget();
String sep = System.getProperty("file.separator");
if (!path.endsWith(sep)) {
path += sep;
}
return path + "chronicle-log4j1" + Time.uniqueId();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private String basePath() {
String path = System.getProperty("java.io.tmpdir");
String sep = System.getProperty("file.separator");
if (!path.endsWith(sep)) {
path += sep;
}
return path + "chronicle-logger" + sep;
... | #fixed code
private String basePath() {
String path = OS.getTarget();
String sep = System.getProperty("file.separator");
if (!path.endsWith(sep)) {
path += sep;
}
return path + "chronicle-logger-" + Time.uniqueId() + sep;
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
static String basePath() {
String path = System.getProperty("java.io.tmpdir");
String sep = System.getProperty("file.separator");
if (!path.endsWith(sep)) {
path += sep;
}
return path + "chronicle-jul-api";
}
... | #fixed code
static String basePath() {
String path = OS.getTarget();
String sep = System.getProperty("file.separator");
if (!path.endsWith(sep)) {
path += sep;
}
return path + "chronicle-jul-api" + Time.uniqueId();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
static String rootPath() {
String path = System.getProperty("java.io.tmpdir");
String sep = System.getProperty("file.separator");
if (!path.endsWith(sep)) {
path += sep;
}
return path + "chronicle-logback";
}
... | #fixed code
static String rootPath() {
String path = OS.getTarget();
String sep = System.getProperty("file.separator");
if (!path.endsWith(sep)) {
path += sep;
}
return path + "chronicle-logback" + Time.uniqueId();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
static String rootPath() {
String path = System.getProperty("java.io.tmpdir");
String sep = System.getProperty("file.separator");
if (!path.endsWith(sep)) {
path += sep;
}
return path + "chronicle-log4j2";
}
... | #fixed code
static String rootPath() {
String path = OS.getTarget();
String sep = System.getProperty("file.separator");
if (!path.endsWith(sep)) {
path += sep;
}
return path + "chronicle-log4j2" + Time.uniqueId();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
static String basePath() {
String path = System.getProperty("java.io.tmpdir");
String sep = System.getProperty("file.separator");
if (!path.endsWith(sep)) {
path += sep;
}
return path + "chronicle-slf4j";
}
... | #fixed code
static String basePath() {
String path = OS.getTarget();
String sep = System.getProperty("file.separator");
if (!path.endsWith(sep)) {
path += sep;
}
return path + "chronicle-slf4j" + Time.uniqueId();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
static String basePath() {
String path = System.getProperty("java.io.tmpdir");
String sep = System.getProperty("file.separator");
if (!path.endsWith(sep)) {
path += sep;
}
return path + "chronicle-jcl";
}
... | #fixed code
static String basePath() {
String path = OS.getTarget();
String sep = System.getProperty("file.separator");
if (!path.endsWith(sep)) {
path += sep;
}
return path + "chronicle-jcl-" + Time.uniqueId();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest httpRequest = (HttpServletRequest) request;
String path = httpRequest.getServletPath();
... | #fixed code
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest httpRequest = (HttpServletRequest) request;
String path = httpRequest.getServletPath();
i... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static void main(String[] args){
FullAPI test = null;
ProblemSet ps = new ProblemSet();
File parent = new File("/Users/tdutko200/git/jstylo/jsan_resources/corpora/drexel_1");
try {
for (File author : parent.listFiles())... | #fixed code
public static void main(String[] args){
FullAPI test = null;
try {
test = new FullAPI.Builder()
.cfdPath("jsan_resources/feature_sets/writeprints_feature_set_limited.xml")
.psPath("jsan_resources/proble... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static void main(String[] args){
ProblemSet ps = new ProblemSet();
File sourceDir = new File("jsan_resources/corpora/drexel_1");
System.out.println(sourceDir.getAbsolutePath());
for (File author : sourceDir.listFiles()){
for ... | #fixed code
public static void main(String[] args){
FullAPI test = new FullAPI.Builder()
.cfdPath("jsan_resources/feature_sets/writeprints_feature_set_limited.xml")
.psPath("./jsan_resources/problem_sets/drexel_1_small.xml")
.classifierPath("weka.classifiers.... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static void saveMeBackup(File f, String toWrite) throws IOException
{
String backup = "/Users/bekahoverdorf/btbackup/timestamp" + BekahUtil.getNow();
String path = f.getAbsolutePath();
Scanner pathScanner = new Scanner(path).useDelimi... | #fixed code
public static void saveMeBackup(File f, String toWrite) throws IOException
{
String backup = "/Users/bekahoverdorf/btbackup/timestamp" + BekahUtil.getNow();
String path = f.getAbsolutePath();
Scanner baseScanner = new Scanner(path);
Scanne... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
protected void checkProviderInfo(ProviderGroup providerGroup) {
List<ProviderInfo> providerInfos = providerGroup == null ? null : providerGroup.getProviderInfos();
if (CommonUtils.isEmpty(providerInfos)) {
return;
}
Iterator<P... | #fixed code
protected void checkProviderInfo(ProviderGroup providerGroup) {
List<ProviderInfo> providerInfos = providerGroup == null ? null : providerGroup.getProviderInfos();
if (CommonUtils.isEmpty(providerInfos)) {
return;
}
Iterator<Provide... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void stop() {
if (!started) {
return;
}
try {
// 关闭端口,不关闭线程池
if (LOGGER.isInfoEnabled()) {
LOGGER.info("Stop the http rest server at port {}", serverConfig.getPort());
... | #fixed code
@Override
public void stop() {
if (!started) {
return;
}
try {
// 关闭端口,不关闭线程池
if (LOGGER.isInfoEnabled()) {
LOGGER.info("Stop the http rest server at port {}", serverConfig.getPort());
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
protected void decorateRequest(SofaRequest request) {
// 公共的设置
super.decorateRequest(request);
// 缓存是为了加快速度
request.setTargetServiceUniqueName(serviceName);
request.setSerializeType(serializeType);
if (!con... | #fixed code
@Override
protected void decorateRequest(SofaRequest request) {
// 公共的设置
super.decorateRequest(request);
// 缓存是为了加快速度
request.setTargetServiceUniqueName(serviceName);
request.setSerializeType(serializeType == null ? 0 : serializeTy... | Below is the vulnerable code, please generate the patch based on the following information. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.