output stringlengths 64 73.2k | input stringlengths 208 73.3k | instruction stringclasses 1
value |
|---|---|---|
#fixed code
@Test
public void testAddWorkdaysFromFriday() {
Calendar startDate = Calendar.getInstance();
// adjust to FRIDAY
startDate.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY);
System.out.println("Startdate=" + startDate.getTime());
// adjust -3 Workdays -> THUSEDAY
Asser... | #vulnerable code
@Test
public void testAddWorkdaysFromFriday() {
Calendar startDate = Calendar.getInstance();
// adjust to FRIDAY
startDate.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY);
System.out.println("Startdate=" + startDate.getTime());
// adjust -3 Workdays -> THUSEDAY
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void removeDocument(String uniqueID) throws LuceneException {
IndexWriter awriter = null;
long ltime = System.currentTimeMillis();
try {
awriter = createIndexWriter();
Term term = new Term("$uniqueid", uniqueID);
awriter.deleteDocuments(term);
} catch ... | #vulnerable code
public void removeDocument(String uniqueID) throws LuceneException {
IndexWriter awriter = null;
try {
awriter = createIndexWriter();
Term term = new Term("$uniqueid", uniqueID);
awriter.deleteDocuments(term);
} catch (CorruptIndexException e) {
throw new... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testMinusWorkdaysFromFriday() {
Calendar startDate = Calendar.getInstance();
// adjust to FRIDAY
startDate.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY);
System.out.println("Startdate=" + startDate.getTime());
// adjust -3 Workdays -> THUSEDAY
Asser... | #vulnerable code
@Test
public void testMinusWorkdaysFromFriday() {
Calendar startDate = Calendar.getInstance();
// adjust to FRIDAY
startDate.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY);
System.out.println("Startdate=" + startDate.getTime());
// adjust -3 Workdays -> THUSEDAY
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
@Category(org.imixs.workflow.ItemCollection.class)
public void testFileData() {
ItemCollection itemColSource = new ItemCollection();
// add a dummy file
byte[] empty = { 0 };
itemColSource.addFileData(new FileData( "test1.txt", empty,"application/xml",null));
... | #vulnerable code
@Test
@Category(org.imixs.workflow.ItemCollection.class)
public void testFileData() {
ItemCollection itemColSource = new ItemCollection();
// add a dummy file
byte[] empty = { 0 };
itemColSource.addFile(empty, "test1.txt", "application/xml");
ItemCollection i... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@DELETE
@Path("/reports/{name}")
public void deleteReport(@PathParam("name") String name) {
try {
ItemCollection itemCol = reportService.findReport(name);
entityService.remove(itemCol);
} catch (Exception e) {
e.printStackTrace();
}
} | #vulnerable code
@DELETE
@Path("/reports/{name}")
public void deleteReport(@PathParam("name") String name) {
try {
ItemCollection itemCol = reportService.getReport(name);
entityService.remove(itemCol);
} catch (Exception e) {
e.printStackTrace();
}
}
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testParseResult() {
List<ItemCollection> result=null;
String testString = "{\n" +
" \"responseHeader\":{\n" +
" \"status\":0,\n" +
" \"QTime\":4,\n" +
" \"params\":{\n" +
" \"q\":\"*:*\",\n" +
" \"_\":\"156... | #vulnerable code
@Test
public void testParseResult() {
List<ItemCollection> result=null;
String testString = "{\n" +
" \"responseHeader\":{\n" +
" \"status\":0,\n" +
" \"QTime\":4,\n" +
" \"params\":{\n" +
" \"q\":\"*:*\",\n" +
" \"_\"... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testMinusWorkdaysFromSunday() {
Calendar startDate = Calendar.getInstance();
// adjust to SATURDAY
startDate.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
System.out.println("Startdate=" + startDate.getTime());
// adjust -1 Workdays -> THURSDAY
Ass... | #vulnerable code
@Test
public void testMinusWorkdaysFromSunday() {
Calendar startDate = Calendar.getInstance();
// adjust to SATURDAY
startDate.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
System.out.println("Startdate=" + startDate.getTime());
// adjust -1 Workdays -> THURSDAY... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void endElement(String uri, String localName, String qName) throws SAXException {
// end of bpmn2:process
if (qName.equalsIgnoreCase("bpmn2:process")) {
if (currentWorkflowGroup != null) {
currentWorkf... | #vulnerable code
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void endElement(String uri, String localName, String qName) throws SAXException {
// end of bpmn2:process
if (qName.equalsIgnoreCase("bpmn2:process")) {
if (currentWorkflowGroup != null) {
curren... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public List<ItemCollection> getActivities() {
if (activityList != null)
return activityList;
activityList = new ArrayList<ItemCollection>();
if (getWorkitem() == null)
return activityList;
int processId = getWorkitem().getItemValueInteger("$processid");
if (p... | #vulnerable code
public List<ItemCollection> getActivities() {
if (activityList != null)
return activityList;
activityList = new ArrayList<ItemCollection>();
if (getWorkitem() == null)
return activityList;
int processId = getWorkitem().getItemValueInteger("$processid");
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public ItemCollection load(String id) {
long lLoadTime = System.currentTimeMillis();
Document persistedDocument = null;
if (id == null || id.isEmpty()) {
return null;
}
persistedDocument = manager.find(Document.class, id);
// create instance of ItemCollection
... | #vulnerable code
public ItemCollection load(String id) {
long lLoadTime = System.currentTimeMillis();
Document persistedDocument = null;
if (id==null || id.isEmpty()) {
return null;
}
persistedDocument = manager.find(Document.class, id);
// create instance of ItemCollect... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testParseResult() {
List<ItemCollection> result=null;
String testString = "{\n" +
" \"responseHeader\":{\n" +
" \"status\":0,\n" +
" \"QTime\":4,\n" +
" \"params\":{\n" +
" \"q\":\"*:*\",\n" +
" \"_\":\"156... | #vulnerable code
@Test
public void testParseResult() {
List<ItemCollection> result=null;
String testString = "{\n" +
" \"responseHeader\":{\n" +
" \"status\":0,\n" +
" \"QTime\":4,\n" +
" \"params\":{\n" +
" \"q\":\"*:*\",\n" +
" \"_\"... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testMinusWorkdaysFromFriday() {
Calendar startDate = Calendar.getInstance();
// adjust to FRIDAY
startDate.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY);
System.out.println("Startdate=" + startDate.getTime());
// adjust -3 Workdays -> THUSEDAY
Asser... | #vulnerable code
@Test
public void testMinusWorkdaysFromFriday() {
Calendar startDate = Calendar.getInstance();
// adjust to FRIDAY
startDate.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY);
System.out.println("Startdate=" + startDate.getTime());
// adjust -3 Workdays -> THUSEDAY
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testAddWorkdaysFromSunday() {
Calendar startDate = Calendar.getInstance();
// adjust to SATURDAY
startDate.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
System.out.println("Startdate=" + startDate.getTime());
// adjust -1 Workdays -> TUESDAY
Assert... | #vulnerable code
@Test
public void testAddWorkdaysFromSunday() {
Calendar startDate = Calendar.getInstance();
// adjust to SATURDAY
startDate.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
System.out.println("Startdate=" + startDate.getTime());
// adjust -1 Workdays -> TUESDAY
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@GET
@Path("/{name}.ixr")
public Response getExcecuteReport(@PathParam("name") String name, @DefaultValue("0") @QueryParam("start") int start,
@DefaultValue("10") @QueryParam("count") int count,
@DefaultValue("") @QueryParam("encoding") String encoding, @Context UriInfo ... | #vulnerable code
@GET
@Path("/{name}.ixr")
public Response getExcecuteReport(@PathParam("name") String name, @DefaultValue("0") @QueryParam("start") int start,
@DefaultValue("10") @QueryParam("count") int count,
@DefaultValue("") @QueryParam("encoding") String encoding, @Context Ur... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testAddWorkdaysFromMonday() {
Calendar startDate = Calendar.getInstance();
// adjust to FRIDAY
startDate.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
System.out.println("Startdate=" + startDate.getTime());
Assert.assertEquals(Calendar.TUESDAY,
... | #vulnerable code
@Test
public void testAddWorkdaysFromMonday() {
Calendar startDate = Calendar.getInstance();
// adjust to FRIDAY
startDate.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
System.out.println("Startdate=" + startDate.getTime());
Assert.assertEquals(Calendar.TUESD... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testMinusWorkdaysFromFriday() {
Calendar startDate = Calendar.getInstance();
// adjust to FRIDAY
startDate.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY);
System.out.println("Startdate=" + startDate.getTime());
// adjust -3 Workdays -> THUSEDAY
Asser... | #vulnerable code
@Test
public void testMinusWorkdaysFromFriday() {
Calendar startDate = Calendar.getInstance();
// adjust to FRIDAY
startDate.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY);
System.out.println("Startdate=" + startDate.getTime());
// adjust -3 Workdays -> THUSEDAY
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testAddWorkdaysFromSunday() {
Calendar startDate = Calendar.getInstance();
// adjust to SATURDAY
startDate.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
System.out.println("Startdate=" + startDate.getTime());
// adjust -1 Workdays -> TUESDAY
Assert... | #vulnerable code
@Test
public void testAddWorkdaysFromSunday() {
Calendar startDate = Calendar.getInstance();
// adjust to SATURDAY
startDate.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
System.out.println("Startdate=" + startDate.getTime());
// adjust -1 Workdays -> TUESDAY
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testParseResult() {
List<ItemCollection> result=null;
String testString = "{\n" +
" \"responseHeader\":{\n" +
" \"status\":0,\n" +
" \"QTime\":4,\n" +
" \"params\":{\n" +
" \"q\":\"*:*\",\n" +
" \"_\":\"156... | #vulnerable code
@Test
public void testParseResult() {
List<ItemCollection> result=null;
String testString = "{\n" +
" \"responseHeader\":{\n" +
" \"status\":0,\n" +
" \"QTime\":4,\n" +
" \"params\":{\n" +
" \"q\":\"*:*\",\n" +
" \"_\"... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void endElement(String uri, String localName, String qName) throws SAXException {
// end of bpmn2:process
if (qName.equalsIgnoreCase("bpmn2:process")) {
if (currentWorkflowGroup != null) {
currentWorkf... | #vulnerable code
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void endElement(String uri, String localName, String qName) throws SAXException {
// end of bpmn2:process
if (qName.equalsIgnoreCase("bpmn2:process")) {
if (currentWorkflowGroup != null) {
curren... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public Object[] evaluateScriptObject(ScriptEngine engine, String expression) {
Object[] params = null;
if (engine == null) {
logger.severe("RulePlugin evaluateScritpObject error: no script engine! - call run()");
return null;
}
// first test if expression is a ba... | #vulnerable code
public Object[] evaluateScriptObject(ScriptEngine engine, String expression) {
Object[] params = null;
if (engine == null) {
logger.severe("RulePlugin evaluateScritpObject error: no script engine! - call run()");
return null;
}
// first test if expression i... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testAddWorkdaysFromMonday() {
Calendar startDate = Calendar.getInstance();
// adjust to FRIDAY
startDate.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
System.out.println("Startdate=" + startDate.getTime());
Assert.assertEquals(Calendar.TUESDAY,
... | #vulnerable code
@Test
public void testAddWorkdaysFromMonday() {
Calendar startDate = Calendar.getInstance();
// adjust to FRIDAY
startDate.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
System.out.println("Startdate=" + startDate.getTime());
Assert.assertEquals(Calendar.TUESD... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testMinusWorkdaysFromSunday() {
Calendar startDate = Calendar.getInstance();
// adjust to SATURDAY
startDate.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
System.out.println("Startdate=" + startDate.getTime());
// adjust -1 Workdays -> THURSDAY
Ass... | #vulnerable code
@Test
public void testMinusWorkdaysFromSunday() {
Calendar startDate = Calendar.getInstance();
// adjust to SATURDAY
startDate.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
System.out.println("Startdate=" + startDate.getTime());
// adjust -1 Workdays -> THURSDAY... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
@Category(org.imixs.workflow.ItemCollection.class)
public void testFileData() {
ItemCollection itemColSource = new ItemCollection();
// add a dummy file
byte[] empty = { 0 };
itemColSource.addFileData(new FileData( "test1.txt", empty,"application/xml",null));
... | #vulnerable code
@Test
@Category(org.imixs.workflow.ItemCollection.class)
public void testFileData() {
ItemCollection itemColSource = new ItemCollection();
// add a dummy file
byte[] empty = { 0 };
itemColSource.addFile(empty, "test1.txt", "application/xml");
ItemCollection i... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testAddWorkdaysFromFriday() {
Calendar startDate = Calendar.getInstance();
// adjust to FRIDAY
startDate.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY);
System.out.println("Startdate=" + startDate.getTime());
// adjust -3 Workdays -> THUSEDAY
Asser... | #vulnerable code
@Test
public void testAddWorkdaysFromFriday() {
Calendar startDate = Calendar.getInstance();
// adjust to FRIDAY
startDate.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY);
System.out.println("Startdate=" + startDate.getTime());
// adjust -3 Workdays -> THUSEDAY
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@SuppressWarnings({ "rawtypes" })
public int run(ItemCollection documentContext,
ItemCollection documentActivity) throws PluginException {
mailMessage = null;
// check if mail is active?
if ("1".equals(documentActivity.getItemValueString("keyMailInactive")))
retur... | #vulnerable code
@SuppressWarnings({ "rawtypes" })
public int run(ItemCollection documentContext,
ItemCollection documentActivity) throws PluginException {
mailMessage = null;
// check if mail is active?
if ("1".equals(documentActivity.getItemValueString("keyMailInactive")))
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
// @Ignore
public void testWrite() {
List<ItemCollection> col = null;
// read default content
try {
col = XMLItemCollectionAdapter
.readCollectionFromInputStream(getClass().getResourceAsStream("/document-example.xml"));
} catch (JAXBException e) {
Asse... | #vulnerable code
@Test
// @Ignore
public void testWrite() {
List<ItemCollection> col = null;
// read default content
try {
col = XMLItemCollectionAdapter
.readCollectionFromInputStream(getClass().getResourceAsStream("/document-example.xml"));
} catch (JAXBException e) {
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@SuppressWarnings("unchecked")
@Test
public void testUpdateOriginProcess() throws ModelException {
String orignUniqueID = documentContext.getUniqueID();
/*
* 1.) create test result for new subprcoess.....
*/
try {
documentActivity = this.getModel().getEvent(10... | #vulnerable code
@SuppressWarnings("unchecked")
@Test
public void testUpdateOriginProcess() throws ModelException {
String orignUniqueID = documentContext.getUniqueID();
/*
* 1.) create test result for new subprcoess.....
*/
try {
documentActivity = this.getModel().getEv... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public Object[] evaluateScriptObject(ScriptEngine engine, String expression) {
Object[] params = null;
if (engine == null) {
logger.severe("RulePlugin evaluateScritpObject error: no script engine! - call run()");
return null;
}
// first test if expression is a ba... | #vulnerable code
public Object[] evaluateScriptObject(ScriptEngine engine, String expression) {
Object[] params = null;
if (engine == null) {
logger.severe("RulePlugin evaluateScritpObject error: no script engine! - call run()");
return null;
}
// first test if expression i... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testMinusWorkdaysFromMonday() {
Calendar startDate = Calendar.getInstance();
// adjust to FRIDAY
startDate.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
System.out.println("Startdate=" + startDate.getTime());
// adjust -3 Workdays -> THUSEDAY
Asser... | #vulnerable code
@Test
public void testMinusWorkdaysFromMonday() {
Calendar startDate = Calendar.getInstance();
// adjust to FRIDAY
startDate.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
System.out.println("Startdate=" + startDate.getTime());
// adjust -3 Workdays -> THUSEDAY
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public int compare(ItemCollection a, ItemCollection b) {
// date compare?
if (a.isItemValueDate(itemName)) {
Date dateA = a.getItemValueDate(itemName);
Date dateB = b.getItemValueDate(itemName);
if (dateA==null && dateB !=null) {
return 1;
}
if (dateB==n... | #vulnerable code
public int compare(ItemCollection a, ItemCollection b) {
// date compare?
if (a.isItemValueDate(itemName)) {
Date dateA = a.getItemValueDate(itemName);
Date dateB = b.getItemValueDate(itemName);
int result = dateB.compareTo(dateA);
if (!this.ascending) {
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testMinusWorkdaysFromSaturday() {
Calendar startDate = Calendar.getInstance();
// adjust to SATURDAY
startDate.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY);
System.out.println("Startdate=" + startDate.getTime());
// adjust -1 Workdays -> THURSDAY
... | #vulnerable code
@Test
public void testMinusWorkdaysFromSaturday() {
Calendar startDate = Calendar.getInstance();
// adjust to SATURDAY
startDate.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY);
System.out.println("Startdate=" + startDate.getTime());
// adjust -1 Workdays -> THUR... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testAddWorkdaysFromSunday() {
Calendar startDate = Calendar.getInstance();
// adjust to SATURDAY
startDate.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
System.out.println("Startdate=" + startDate.getTime());
// adjust -1 Workdays -> TUESDAY
Assert... | #vulnerable code
@Test
public void testAddWorkdaysFromSunday() {
Calendar startDate = Calendar.getInstance();
// adjust to SATURDAY
startDate.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
System.out.println("Startdate=" + startDate.getTime());
// adjust -1 Workdays -> TUESDAY
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testMinusWorkdaysFromSaturday() {
Calendar startDate = Calendar.getInstance();
// adjust to SATURDAY
startDate.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY);
System.out.println("Startdate=" + startDate.getTime());
// adjust -1 Workdays -> THURSDAY
... | #vulnerable code
@Test
public void testMinusWorkdaysFromSaturday() {
Calendar startDate = Calendar.getInstance();
// adjust to SATURDAY
startDate.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY);
System.out.println("Startdate=" + startDate.getTime());
// adjust -1 Workdays -> THUR... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testAddWorkdaysFromFriday() {
Calendar startDate = Calendar.getInstance();
// adjust to FRIDAY
startDate.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY);
System.out.println("Startdate=" + startDate.getTime());
// adjust -3 Workdays -> THUSEDAY
Asser... | #vulnerable code
@Test
public void testAddWorkdaysFromFriday() {
Calendar startDate = Calendar.getInstance();
// adjust to FRIDAY
startDate.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY);
System.out.println("Startdate=" + startDate.getTime());
// adjust -3 Workdays -> THUSEDAY
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testMinusWorkdaysFromFriday() {
Calendar startDate = Calendar.getInstance();
// adjust to FRIDAY
startDate.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY);
System.out.println("Startdate=" + startDate.getTime());
// adjust -3 Workdays -> THUSEDAY
Asser... | #vulnerable code
@Test
public void testMinusWorkdaysFromFriday() {
Calendar startDate = Calendar.getInstance();
// adjust to FRIDAY
startDate.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY);
System.out.println("Startdate=" + startDate.getTime());
// adjust -3 Workdays -> THUSEDAY
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testParseResult() {
List<ItemCollection> result=null;
String testString = "{\n" +
" \"responseHeader\":{\n" +
" \"status\":0,\n" +
" \"QTime\":4,\n" +
" \"params\":{\n" +
" \"q\":\"*:*\",\n" +
" \"_\":\"156... | #vulnerable code
@Test
public void testParseResult() {
List<ItemCollection> result=null;
String testString = "{\n" +
" \"responseHeader\":{\n" +
" \"status\":0,\n" +
" \"QTime\":4,\n" +
" \"params\":{\n" +
" \"q\":\"*:*\",\n" +
" \"_\"... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private void readResponse(URLConnection urlConnection) throws IOException {
// get content of result
logger.finest("...... readResponse....");
StringWriter writer = new StringWriter();
BufferedReader in = null;
try {
// test if content encoding is provided
String... | #vulnerable code
private void readResponse(URLConnection urlConnection) throws IOException {
// get content of result
logger.fine("[RestClient] readResponse....");
StringWriter writer = new StringWriter();
BufferedReader in = null;
try {
// test if content encoding is provided... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testSimple() throws ParseException {
InputStream inputStream = getClass()
.getResourceAsStream("/json/simple.json");
ItemCollection itemCol=null;
try {
itemCol = JSONParser.parseWorkitem(inputStream,"UTF-8");
} catch (UnsupportedEncodingExcept... | #vulnerable code
@Test
public void testSimple() throws ParseException {
InputStream inputStream = getClass()
.getResourceAsStream("/json/simple.json");
ItemCollection itemCol = JSONParser.parseWorkitem(inputStream);
Assert.assertNotNull(itemCol);
Assert.assertEquals("Anna"... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testAddWorkdaysFromMonday() {
Calendar startDate = Calendar.getInstance();
// adjust to FRIDAY
startDate.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
System.out.println("Startdate=" + startDate.getTime());
Assert.assertEquals(Calendar.TUESDAY,
... | #vulnerable code
@Test
public void testAddWorkdaysFromMonday() {
Calendar startDate = Calendar.getInstance();
// adjust to FRIDAY
startDate.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
System.out.println("Startdate=" + startDate.getTime());
Assert.assertEquals(Calendar.TUESD... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testAddWorkdaysFromFriday() {
Calendar startDate = Calendar.getInstance();
// adjust to FRIDAY
startDate.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY);
System.out.println("Startdate=" + startDate.getTime());
// adjust -3 Workdays -> THUSEDAY
Asser... | #vulnerable code
@Test
public void testAddWorkdaysFromFriday() {
Calendar startDate = Calendar.getInstance();
// adjust to FRIDAY
startDate.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY);
System.out.println("Startdate=" + startDate.getTime());
// adjust -3 Workdays -> THUSEDAY
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
ChannelManager(AsteriskServerImpl server)
{
this.server = server;
this.channels = new HashSet<AsteriskChannelImpl>();
} | #vulnerable code
void handleNewChannelEvent(NewChannelEvent event)
{
final AsteriskChannelImpl channel = getChannelImplById(event.getUniqueId());
if (channel == null)
{
if (event.getChannel() == null)
{
logger.info("Ig... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public int[] getVersion(String file) throws ManagerCommunicationException
{
String fileVersion = null;
String[] parts;
int[] intParts;
initializeIfNeeded();
if (versions == null)
{
Map<String, String> map;
... | #vulnerable code
public int[] getVersion(String file) throws ManagerCommunicationException
{
String fileVersion = null;
String[] parts;
int[] intParts;
initializeIfNeeded();
if (versions == null)
{
Map<String, String> map;... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void onManagerEvent(final org.asteriskjava.manager.event.ManagerEvent event)
{
// logger.error(event);
boolean wanted = false;
/**
* Dump any events we arn't interested in ASAP to minimise the
* processing ov... | #vulnerable code
@Override
public void onManagerEvent(final org.asteriskjava.manager.event.ManagerEvent event)
{
// logger.error(event);
boolean wanted = false;
/**
* Dump any events we arn't interested in ASAP to minimise the
* process... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void dispatchEvent(ManagerEvent event)
{
// shouldn't happen
if (event == null)
{
logger.error("Unable to dispatch null event");
return;
}
logger.debug("Dispatching event:\n" + event.toString());
... | #vulnerable code
public void dispatchEvent(ManagerEvent event)
{
// shouldn't happen
if (event == null)
{
logger.error("Unable to dispatch null event");
return;
}
logger.debug("Dispatching event:\n" + event.toString())... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public int[] getVersion(String file)
{
String fileVersion = null;
String[] parts;
int[] intParts;
if (versions == null)
{
Map<String, String> map;
ManagerResponse response;
map = new HashMap<Str... | #vulnerable code
public int[] getVersion(String file)
{
String fileVersion = null;
String[] parts;
int[] intParts;
if (versions == null)
{
Map<String, String> map;
ManagerResponse response;
map = new HashM... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public ManagerResponse sendAction(ManagerAction action, long timeout)
throws IOException, TimeoutException, IllegalArgumentException,
IllegalStateException
{
ResponseHandlerResult result;
ManagerResponseHandler callbackHandler;
... | #vulnerable code
public ManagerResponse sendAction(ManagerAction action, long timeout)
throws IOException, TimeoutException, IllegalArgumentException,
IllegalStateException
{
long start;
long timeSpent;
ResponseHandlerResult result;
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void dispatchEvent(ManagerEvent event)
{
// shouldn't happen
if (event == null)
{
logger.error("Unable to dispatch null event. This should never happen. Please file a bug.");
return;
}
logger.debug("D... | #vulnerable code
public void dispatchEvent(ManagerEvent event)
{
// shouldn't happen
if (event == null)
{
logger.error("Unable to dispatch null event. This should never happen. Please file a bug.");
return;
}
logger.de... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void redirectBothLegs(String context, String exten, int priority) throws ManagerCommunicationException,
NoSuchChannelException
{
ManagerResponse response;
if (linkedChannels.isEmpty())
{
response = server.sendAction(... | #vulnerable code
public void redirectBothLegs(String context, String exten, int priority) throws ManagerCommunicationException,
NoSuchChannelException
{
ManagerResponse response;
if (linkedChannel == null)
{
response = server.sendActi... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
OriginateResult originate(final EndPoint local, final EndPoint target, final HashMap<String, String> myVars,
final CallerID callerID, final Integer timeout, final boolean hideCallerId, final String context)
{
OriginateBaseClass.logger.info("originate c... | #vulnerable code
OriginateResult originate(final EndPoint local, final EndPoint target, final HashMap<String, String> myVars,
final CallerID callerID, final Integer timeout, final boolean hideCallerId, final String context)
{
OriginateBaseClass.logger.warn("origi... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public AsteriskChannel getLinkedChannel()
{
synchronized(linkedChannels) {
if (linkedChannels.isEmpty()) return null;
return linkedChannels.get(0);
}
} | #vulnerable code
public AsteriskChannel getLinkedChannel()
{
return linkedChannel;
}
#location 3
#vulnerability type THREAD_SAFETY_VIOLATION | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void onManagerEvent(final org.asteriskjava.manager.event.ManagerEvent event)
{
// logger.error(event);
boolean wanted = false;
/**
* Dump any events we arn't interested in ASAP to minimise the
* processing ov... | #vulnerable code
@Override
public void onManagerEvent(final org.asteriskjava.manager.event.ManagerEvent event)
{
// logger.error(event);
boolean wanted = false;
/**
* Dump any events we arn't interested in ASAP to minimise the
* process... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public ManagerResponse sendAction(ManagerAction action, long timeout)
throws IOException, TimeoutException, IllegalArgumentException, IllegalStateException
{
ResponseHandlerResult result = new ResponseHandlerResult();
SendActionCallback callbac... | #vulnerable code
public ManagerResponse sendAction(ManagerAction action, long timeout)
throws IOException, TimeoutException, IllegalArgumentException, IllegalStateException
{
ResponseHandlerResult result;
SendActionCallback callbackHandler;
resul... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void dispatchEvent(ManagerEvent event)
{
// shouldn't happen
if (event == null)
{
logger.error("Unable to dispatch null event. This should never happen. Please file a bug.");
return;
}
logger.debug("D... | #vulnerable code
public void dispatchEvent(ManagerEvent event)
{
// shouldn't happen
if (event == null)
{
logger.error("Unable to dispatch null event");
return;
}
logger.debug("Dispatching event:\n" + event.toString())... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void onManagerEvent(final org.asteriskjava.manager.event.ManagerEvent event)
{
// logger.error(event);
boolean wanted = false;
/**
* Dump any events we arn't interested in ASAP to minimise the
* processing ov... | #vulnerable code
@Override
public void onManagerEvent(final org.asteriskjava.manager.event.ManagerEvent event)
{
// logger.error(event);
boolean wanted = false;
/**
* Dump any events we arn't interested in ASAP to minimise the
* process... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void dispatchEvent(ManagerEvent event)
{
// shouldn't happen
if (event == null)
{
logger.error("Unable to dispatch null event. This should never happen. Please file a bug.");
return;
}
logger.debug("D... | #vulnerable code
public void dispatchEvent(ManagerEvent event)
{
// shouldn't happen
if (event == null)
{
logger.error("Unable to dispatch null event. This should never happen. Please file a bug.");
return;
}
logger.de... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
ChannelManager(AsteriskServerImpl server)
{
this.server = server;
this.channels = new HashSet<AsteriskChannelImpl>();
} | #vulnerable code
void handleNewStateEvent(NewStateEvent event)
{
AsteriskChannelImpl channel = getChannelImplById(event.getUniqueId());
if (channel == null)
{
// NewStateEvent can occur for an existing channel that now has a different unique id (... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override public void shutdown() {
if (eventConnection != null && (eventConnection.getState() == ManagerConnectionState.CONNECTED || eventConnection.getState() == ManagerConnectionState.RECONNECTING)) {
try {
eventConnection.logoff();
} catch (Excep... | #vulnerable code
@Override public void shutdown() {
if (eventConnection != null && (eventConnection.getState() == ManagerConnectionState.CONNECTED || eventConnection.getState() == ManagerConnectionState.RECONNECTING)) {
try {
eventConnection.logoff();
} catch ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private synchronized Map<String, String[]> parseParameters(String s)
{
Map<String, List<String>> parameterMap;
Map<String, String[]> result;
StringTokenizer st;
parameterMap = new HashMap<String, List<String>>();
result = new HashM... | #vulnerable code
private synchronized Map<String, String[]> parseParameters(String s)
{
Map<String, List<String>> parameterMap;
Map<String, String[]> result;
StringTokenizer st;
parameterMap = new HashMap<String, List<String>>();
result = new... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public String getProtocolIdentifier()
{
return protocolIdentifier.getValue();
} | #vulnerable code
public String getProtocolIdentifier()
{
return protocolIdentifier.value;
}
#location 3
#vulnerability type THREAD_SAFETY_VIOLATION | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
ChannelManager(AsteriskServerImpl server)
{
this.server = server;
this.channels = new HashSet<AsteriskChannelImpl>();
} | #vulnerable code
void handleNewStateEvent(NewStateEvent event)
{
AsteriskChannelImpl channel = getChannelImplById(event.getUniqueId());
if (channel == null)
{
// NewStateEvent can occur for an existing channel that now has a different unique id (... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
ChannelManager(AsteriskServerImpl server)
{
this.server = server;
this.channels = new HashSet<AsteriskChannelImpl>();
} | #vulnerable code
void handleNewStateEvent(NewStateEvent event)
{
AsteriskChannelImpl channel = getChannelImplById(event.getUniqueId());
if (channel == null)
{
// NewStateEvent can occur for an existing channel that now has a different unique id (... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void onManagerEvent(final org.asteriskjava.manager.event.ManagerEvent event)
{
// logger.error(event);
boolean wanted = false;
/**
* Dump any events we arn't interested in ASAP to minimise the
* processing ov... | #vulnerable code
@Override
public void onManagerEvent(final org.asteriskjava.manager.event.ManagerEvent event)
{
// logger.error(event);
boolean wanted = false;
/**
* Dump any events we arn't interested in ASAP to minimise the
* process... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
ChannelManager(AsteriskServerImpl server)
{
this.server = server;
this.channels = new HashSet<AsteriskChannelImpl>();
} | #vulnerable code
void handleNewStateEvent(NewStateEvent event)
{
AsteriskChannelImpl channel = getChannelImplById(event.getUniqueId());
if (channel == null)
{
// NewStateEvent can occur for an existing channel that now has a different unique id (... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public AsteriskChannel originateToExtension(String channel, String context, String exten, int priority, long timeout) throws ManagerCommunicationException, NoSuchChannelException
{
return originateToExtension(channel, context, exten, priority, timeout, null, null)... | #vulnerable code
public AsteriskChannel originateToExtension(String channel, String context, String exten, int priority, long timeout) throws ManagerCommunicationException
{
return originateToExtension(channel, context, exten, priority, timeout, null, null);
}
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
ChannelManager(AsteriskServerImpl server)
{
this.server = server;
} | #vulnerable code
void handleNewStateEvent(NewStateEvent event)
{
AsteriskChannelImpl channel = getChannelImplById(event.getUniqueId());
if (channel == null)
{
// NewStateEvent can occur for an existing channel that now has a different unique id (... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
OriginateResult originate(final EndPoint local, final EndPoint target, final HashMap<String, String> myVars,
final CallerID callerID, final Integer timeout, final boolean hideCallerId, final String context)
{
OriginateBaseClass.logger.debug("originate ... | #vulnerable code
OriginateResult originate(final EndPoint local, final EndPoint target, final HashMap<String, String> myVars,
final CallerID callerID, final Integer timeout, final boolean hideCallerId, final String context)
{
OriginateBaseClass.logger.debug("orig... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
ChannelManager(AsteriskServerImpl server)
{
this.server = server;
} | #vulnerable code
void handleNewCallerIdEvent(NewCallerIdEvent event)
{
AsteriskChannelImpl channel = getChannelImplById(event.getUniqueId());
if (channel == null)
{
// NewCallerIdEvent can occur for an existing channel that now has a different un... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
OriginateResult originate(final EndPoint local, final EndPoint target, final HashMap<String, String> myVars,
final CallerID callerID, final Integer timeout, final boolean hideCallerId, final String context)
{
OriginateBaseClass.logger.info("originate c... | #vulnerable code
OriginateResult originate(final EndPoint local, final EndPoint target, final HashMap<String, String> myVars,
final CallerID callerID, final Integer timeout, final boolean hideCallerId, final String context)
{
OriginateBaseClass.logger.warn("origi... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public boolean getPaused()
{
return isPaused();
} | #vulnerable code
public boolean getPaused()
{
return paused;
}
#location 3
#vulnerability type THREAD_SAFETY_VIOLATION | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public AsteriskChannel getDialedChannel()
{
synchronized(dialedChannels) {
for (AsteriskChannel channel:dialedChannels) {
if (channel != null) return channel;
}
}
return null;
} | #vulnerable code
public AsteriskChannel getDialedChannel()
{
return dialedChannel;
}
#location 3
#vulnerability type THREAD_SAFETY_VIOLATION | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
protected AsteriskVersion determineVersion() throws IOException, TimeoutException
{
int attempts = 0;
logger.info("Got asterisk protocol identifier version " + protocolIdentifier.getValue());
while (attempts++ < MAX_VERSION_ATTEMPTS)
{
... | #vulnerable code
protected AsteriskVersion determineVersion() throws IOException, TimeoutException
{
int attempts = 0;
// if ("Asterisk Call Manager/1.1".equals(protocolIdentifier.value))
// {
// return AsteriskVersion.ASTERISK_1_6;
// }
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
OriginateResult originate(final EndPoint local, final EndPoint target, final HashMap<String, String> myVars,
final CallerID callerID, final Integer timeout, final boolean hideCallerId, final String context)
{
OriginateBaseClass.logger.info("originate c... | #vulnerable code
OriginateResult originate(final EndPoint local, final EndPoint target, final HashMap<String, String> myVars,
final CallerID callerID, final Integer timeout, final boolean hideCallerId, final String context)
{
OriginateBaseClass.logger.warn("origi... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
ChannelManager(AsteriskServerImpl server)
{
this.server = server;
this.channels = new HashSet<AsteriskChannelImpl>();
} | #vulnerable code
void handleNewCallerIdEvent(NewCallerIdEvent event)
{
AsteriskChannelImpl channel = getChannelImplById(event.getUniqueId());
if (channel == null)
{
// NewCallerIdEvent can occur for an existing channel that now has a different un... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public String toString()
{
final StringBuffer sb;
sb = new StringBuffer("AsteriskAgent[");
sb.append("agentId='").append(getAgentId()).append("',");
sb.append("name='").append(getName()).append("',");
sb.append("state... | #vulnerable code
@Override
public String toString()
{
final StringBuffer sb;
sb = new StringBuffer("AsteriskAgent[");
sb.append("agentId='").append(getAgentId()).append("',");
sb.append("name='").append(getName()).append("',");
sb.append(... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public AsteriskChannel getDialingChannel()
{
synchronized(dialingChannels) {
if (dialingChannels.isEmpty()) return null;
return dialingChannels.get(0);
}
} | #vulnerable code
public AsteriskChannel getDialingChannel()
{
return dialingChannel;
}
#location 3
#vulnerability type THREAD_SAFETY_VIOLATION | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void onManagerEvent(final org.asteriskjava.manager.event.ManagerEvent event)
{
// logger.error(event);
boolean wanted = false;
/**
* Dump any events we arn't interested in ASAP to minimise the
* processing ov... | #vulnerable code
@Override
public void onManagerEvent(final org.asteriskjava.manager.event.ManagerEvent event)
{
// logger.error(event);
boolean wanted = false;
/**
* Dump any events we arn't interested in ASAP to minimise the
* process... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
ChannelManager(AsteriskServerImpl server)
{
this.server = server;
this.channels = new HashSet<AsteriskChannelImpl>();
} | #vulnerable code
void handleNewCallerIdEvent(NewCallerIdEvent event)
{
AsteriskChannelImpl channel = getChannelImplById(event.getUniqueId());
if (channel == null)
{
// NewCallerIdEvent can occur for an existing channel that now has a different un... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
ChannelManager(AsteriskServerImpl server)
{
this.server = server;
} | #vulnerable code
void handleNewStateEvent(NewStateEvent event)
{
AsteriskChannelImpl channel = getChannelImplById(event.getUniqueId());
if (channel == null)
{
// NewStateEvent can occur for an existing channel that now has a different unique id (... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
ChannelManager(AsteriskServerImpl server)
{
this.server = server;
this.channels = new HashSet<AsteriskChannelImpl>();
} | #vulnerable code
void handleNewChannelEvent(NewChannelEvent event)
{
final AsteriskChannelImpl channel = getChannelImplById(event.getUniqueId());
if (channel == null)
{
if (event.getChannel() == null)
{
logger.info("Ig... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public AsteriskChannel originateToApplication(String channel, String application, String data, long timeout) throws ManagerCommunicationException, NoSuchChannelException
{
return originateToApplication(channel, application, data, timeout, null, null);
} | #vulnerable code
public AsteriskChannel originateToApplication(String channel, String application, String data, long timeout) throws ManagerCommunicationException
{
return originateToApplication(channel, application, data, timeout, null, null);
}
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
OriginateResult originate(final EndPoint local, final EndPoint target, final HashMap<String, String> myVars,
final CallerID callerID, final Integer timeout, final boolean hideCallerId, final String context)
{
OriginateBaseClass.logger.debug("originate ... | #vulnerable code
OriginateResult originate(final EndPoint local, final EndPoint target, final HashMap<String, String> myVars,
final CallerID callerID, final Integer timeout, final boolean hideCallerId, final String context)
{
OriginateBaseClass.logger.debug("orig... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private void fastScannerSpeedTest(Pattern pattern) throws Exception
{
try
{
for (int i = 10; i-- > 0;)
{
Socket echoSocket = new Socket("127.0.0.1", FastScannerTestSocketSource.portNumber);
InputStre... | #vulnerable code
private void fastScannerSpeedTest(Pattern pattern) throws Exception
{
try
{
for (int i = 10; i-- > 0;)
{
InputStreamReader reader = getReader();
System.out.print("Fast " + i + ":\t");
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
OriginateResult originate(final EndPoint local, final EndPoint target, final HashMap<String, String> myVars,
final CallerID callerID, final Integer timeout, final boolean hideCallerId, final String context)
{
OriginateBaseClass.logger.debug("originate ... | #vulnerable code
OriginateResult originate(final EndPoint local, final EndPoint target, final HashMap<String, String> myVars,
final CallerID callerID, final Integer timeout, final boolean hideCallerId, final String context)
{
OriginateBaseClass.logger.debug("orig... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
ChannelManager(AsteriskServerImpl server)
{
this.server = server;
this.channels = new HashSet<AsteriskChannelImpl>();
} | #vulnerable code
void handleNewCallerIdEvent(NewCallerIdEvent event)
{
AsteriskChannelImpl channel = getChannelImplById(event.getUniqueId());
if (channel == null)
{
// NewCallerIdEvent can occur for an existing channel that now has a different un... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
ChannelManager(AsteriskServerImpl server)
{
this.server = server;
this.channels = new HashSet<AsteriskChannelImpl>();
} | #vulnerable code
void handleNewCallerIdEvent(NewCallerIdEvent event)
{
AsteriskChannelImpl channel = getChannelImplById(event.getUniqueId());
if (channel == null)
{
// NewCallerIdEvent can occur for an existing channel that now has a different un... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public ResponseEvents sendEventGeneratingAction(
EventGeneratingAction action, long timeout) throws IOException,
EventTimeoutException, IllegalArgumentException,
IllegalStateException
{
ResponseEventsImpl responseEvents;
... | #vulnerable code
public ResponseEvents sendEventGeneratingAction(
EventGeneratingAction action, long timeout) throws IOException,
EventTimeoutException, IllegalArgumentException,
IllegalStateException
{
ResponseEventsImpl responseEvents;
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
ChannelManager(AsteriskServerImpl server)
{
this.server = server;
} | #vulnerable code
void handleNewCallerIdEvent(NewCallerIdEvent event)
{
AsteriskChannelImpl channel = getChannelImplById(event.getUniqueId());
if (channel == null)
{
// NewCallerIdEvent can occur for an existing channel that now has a different un... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public ReadablePeriod deserialize(JsonParser p, DeserializationContext ctxt)
throws IOException
{
JsonToken t = p.currentToken();
if (t == JsonToken.VALUE_STRING) {
return _fromString(p, ctxt, p.getText());
}
... | #vulnerable code
@Override
public ReadablePeriod deserialize(JsonParser p, DeserializationContext ctxt)
throws IOException
{
JsonToken t = p.currentToken();
if (t == JsonToken.VALUE_STRING) {
String str = p.getText().trim();
if (st... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private boolean isZipFile(final File file) {
DataInputStream in = null;
try {
in = new DataInputStream(new FileInputStream(file));
final int n = in.readInt();
return n == 0x504b0304;
} catch (IOException ex) {
... | #vulnerable code
private boolean isZipFile(final File file) throws IOException {
final DataInputStream in = new DataInputStream(new FileInputStream(file));
final int n = in.readInt();
in.close();
return n == 0x504b0304;
}
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private void updateTranslationProgressMap(String langCode, int value) {
if (getDefaultLanguageCode().equals(langCode)) {
return;
}
double defsize = getDefaultLanguage().size();
double approved = value;
Map<String, Integer> progress = getTranslationProgressMap();
... | #vulnerable code
private void updateTranslationProgressMap(String langCode, int value) {
if (getDefaultLanguageCode().equals(langCode)) {
return;
}
double defsize = getDefaultLanguage().size();
double approved = value;
Map<String, Integer> progress = getTranslationProgressMa... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testTaskCreate() {
setupContextForTaskExecutionListener();
DefaultTaskListenerConfiguration.TestTaskExecutionListener taskExecutionListener =
context.getBean(DefaultTaskListenerConfiguration.TestTaskExecutionListener.class);
TaskExecution taskExecuti... | #vulnerable code
@Test
public void testTaskCreate() {
setupContextForTaskExecutionListener();
DefaultTaskListenerConfiguration.TestTaskExecutionListener taskExecutionListener =
context.getBean(DefaultTaskListenerConfiguration.TestTaskExecutionListener.class);
TaskExecution taskE... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testAnnotationCreate() throws Exception {
setupContextForAnnotatedListener();
DefaultAnnotationConfiguration.AnnotatedTaskListener annotatedListener =
context.getBean(DefaultAnnotationConfiguration.AnnotatedTaskListener.class);
TaskExecution taskExec... | #vulnerable code
@Test
public void testAnnotationCreate() throws Exception {
setupContextForAnnotatedListener();
DefaultAnnotationConfiguration.AnnotatedTaskListener annotatedListener =
context.getBean(DefaultAnnotationConfiguration.AnnotatedTaskListener.class);
TaskExecution ta... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
File getImage() {
//获取当前时间作为名字
Date current = new Date();
SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
String curDate = df.format(current);
File curPhoto = new File(HERO_PATH, curDate + ".png");
//截屏存到手机本地
... | #vulnerable code
File getImage() {
//获取当前时间作为名字
Date current = new Date();
SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
String curDate = df.format(current);
File curPhoto = new File(HERO_PATH, curDate + ".png");
//截屏存到手机本地... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
Search(String question) {
this.question = question;
} | #vulnerable code
Long search(String question) throws IOException {
String path = "http://www.baidu.com/s?tn=ichuner&lm=-1&word=" +
URLEncoder.encode(question, "gb2312") + "&rn=1";
boolean findIt = false;
String line = null;
while (!findIt)... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private Long searchAndOpen(String question) throws IOException {
String path = null;
try {
path = "http://www.baidu.com/s?tn=ichuner&lm=-1&word=" +
URLEncoder.encode(question, "gb2312") + "&rn=20";
//获取操作系统的名字
... | #vulnerable code
private Long searchAndOpen(String question) throws IOException {
String path = "http://www.baidu.com/s?tn=ichuner&lm=-1&word=" +
URLEncoder.encode(question, "gb2312") + "&rn=20";
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHan... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
Search(String question) {
this.question = question;
} | #vulnerable code
Long search(String question) throws IOException {
String path = "http://www.baidu.com/s?tn=ichuner&lm=-1&word=" +
URLEncoder.encode(question, "gb2312") + "&rn=1";
boolean findIt = false;
String line = null;
while (!findIt)... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static void main(String[] args) throws IOException {
// Setting the width and height of frame
frame.setSize(500, 800);
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
try{
loadConfig();
}catch (Exceptio... | #vulnerable code
public static void main(String[] args) throws IOException {
// Setting the width and height of frame
frame.setSize(500, 800);
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
String path=MainGUI.class.getProtectionDomain().g... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
File getImage() {
//获取当前时间作为名字
Date current = new Date();
SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
String curDate = df.format(current);
File curPhoto = new File(HERO_PATH, curDate + ".png");
//截屏存到手机本地
... | #vulnerable code
File getImage() {
//获取当前时间作为名字
Date current = new Date();
SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
String curDate = df.format(current);
File curPhoto = new File(HERO_PATH, curDate + ".png");
//截屏存到手机本地... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public String tamper(String sqlQueryDefault) {
String lead = null;
String sqlQuery = null;
String trail = null;
// Transform only SQL query without HTTP parameters and syntax changed, like p=1'+[sql]
Matcher matcherSql... | #vulnerable code
public String tamper(String sqlQueryDefault) {
String lead = null;
String sqlQuery = null;
String trail = null;
Matcher matcherSql = Pattern.compile("(?s)(.*<tampering>)(.*)(</tampering>.*)").matcher(sqlQueryDefault);
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public String tamper(String sqlQueryDefault) {
String lead = null;
String sqlQuery = null;
String trail = null;
// Transform only SQL query without HTTP parameters and syntax changed, like p=1'+[sql]
Matcher matcherSql... | #vulnerable code
public String tamper(String sqlQueryDefault) {
String lead = null;
String sqlQuery = null;
String trail = null;
Matcher matcherSql = Pattern.compile("(?s)(.*<tampering>)(.*)(</tampering>.*)").matcher(sqlQueryDefault);
... | 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.