input
stringlengths
205
73.3k
output
stringlengths
64
73.2k
instruction
stringclasses
1 value
#vulnerable code @Test(expected = UnsupportedOperationException.class) public void testChildEntriesUnmodifiable() throws IOException { CompoundDocument document = createTestDocument(); Entry root = document.getRootEntry(); assertNotNull(root); Sort...
#fixed code @Test(expected = UnsupportedOperationException.class) public void testChildEntriesUnmodifiable() throws IOException { try (CompoundDocument document = createTestDocument()) { Entry root = document.getRootEntry(); assertNotNull(root); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private DataOutput createCompressorStream(final RenderedImage image, final ImageWriteParam param, final Map<Integer, Entry> entries) { /* 36 MB test data: No compression: Write time: 450 ms output.length: 36000226 PackBi...
#fixed code private DataOutput createCompressorStream(final RenderedImage image, final ImageWriteParam param, final Map<Integer, Entry> entries) { /* 36 MB test data: No compression: Write time: 450 ms output.length: 36000226 PackBits: ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testContents() throws IOException { CompoundDocument document = createTestDocument(); Entry root = document.getRootEntry(); assertNotNull(root); SortedSet<Entry> children = new TreeSet<Entry>(root.getChildEntries(...
#fixed code @Test public void testContents() throws IOException { try (CompoundDocument document = createTestDocument()) { Entry root = document.getRootEntry(); assertNotNull(root); SortedSet<Entry> children = new TreeSet<Entry>(root.getC...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testReadThumbsCatalogFile() throws IOException { CompoundDocument document = createTestDocument(); Entry root = document.getRootEntry(); assertNotNull(root); assertEquals(25, root.getChildEntries().size()); ...
#fixed code @Test public void testReadThumbsCatalogFile() throws IOException { try (CompoundDocument document = createTestDocument()) { Entry root = document.getRootEntry(); assertNotNull(root); assertEquals(25, root.getChildEntries().size...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public static ColorSpace getColorSpace(int colorSpace) { ICC_Profile profile; switch (colorSpace) { case CS_ADOBE_RGB_1998: synchronized (ColorSpaces.class) { profile = adobeRGB1998.get(); ...
#fixed code public static ColorSpace getColorSpace(int colorSpace) { ICC_Profile profile; switch (colorSpace) { case CS_ADOBE_RGB_1998: synchronized (ColorSpaces.class) { profile = adobeRGB1998.get(); i...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private DataOutput createCompressorStream(final RenderedImage image, final ImageWriteParam param, final Map<Integer, Entry> entries) { /* 36 MB test data: No compression: Write time: 450 ms output.length: 36000226 PackBi...
#fixed code private DataOutput createCompressorStream(final RenderedImage image, final ImageWriteParam param, final Map<Integer, Entry> entries) { /* 36 MB test data: No compression: Write time: 450 ms output.length: 36000226 PackBits: ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private CompoundDirectory getExif() throws IOException { List<Application> exifSegments = getAppSegments(JPEG.APP1, "Exif"); if (!exifSegments.isEmpty()) { Application exif = exifSegments.get(0); InputStream data = exif.data(); ...
#fixed code private CompoundDirectory getExif() throws IOException { List<Application> exifSegments = getAppSegments(JPEG.APP1, "Exif"); if (!exifSegments.isEmpty()) { Application exif = exifSegments.get(0); int offset = exif.identifier.length() +...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test(expected = UnsupportedOperationException.class) public void testChildEntriesUnmodifiable() throws IOException { CompoundDocument document = createTestDocument(); Entry root = document.getRootEntry(); assertNotNull(root); Sort...
#fixed code @Test(expected = UnsupportedOperationException.class) public void testChildEntriesUnmodifiable() throws IOException { try (CompoundDocument document = createTestDocument()) { Entry root = document.getRootEntry(); assertNotNull(root); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public static ICC_ColorSpace createColorSpace(final ICC_Profile profile) { Validate.notNull(profile, "profile"); byte[] profileHeader = profile.getData(ICC_Profile.icSigHead); ICC_ColorSpace cs = getInternalCS(profile.getColorSpaceType(), profi...
#fixed code public static ICC_ColorSpace createColorSpace(final ICC_Profile profile) { Validate.notNull(profile, "profile"); // Fix profile before lookup/create profileCleaner.fixProfile(profile); byte[] profileHeader = getProfileHeaderWithProfileId(prof...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testReadThumbsCatalogFile() throws IOException { CompoundDocument document = createTestDocument(); Entry root = document.getRootEntry(); assertNotNull(root); assertEquals(25, root.getChildEntries().size()); ...
#fixed code @Test public void testReadThumbsCatalogFile() throws IOException { try (CompoundDocument document = createTestDocument()) { Entry root = document.getRootEntry(); assertNotNull(root); assertEquals(25, root.getChildEntries().size...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public int getWidth() throws IOException { if (compression == 1) { // 1 = no compression Entry width = ifd.getEntryById(TIFF.TAG_IMAGE_WIDTH); if (width == null) { throw new IIOException("Missing dimensi...
#fixed code @Override public int getWidth() throws IOException { if (compression == 1) { // 1 = no compression Entry width = ifd.getEntryById(TIFF.TAG_IMAGE_WIDTH); if (width == null) { throw new IIOException("Missing dimensions for un...
Below is the vulnerable code, please generate the patch based on the following information.
#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(); } } ...
#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(); } }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private void printVersionTable(OutputStream out) { try { StringBuffer buffer = new StringBuffer(); List<String> col = modelService.getAllModelVersions(); buffer.append("<table>"); buffer.append("<tr><th>Version</th><th>Workflow Group</th><th>Updated</th></tr...
#fixed code private void printVersionTable(OutputStream out) { try { StringBuffer buffer = new StringBuffer(); List<String> modelVersionList = modelService.getAllModelVersions(); buffer.append("<table>"); buffer.append("<tr><th>Version</th><th>Workflow Group</th><th>Uploaded<...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testAddWorkdaysFromSaturday() { Calendar startDate = Calendar.getInstance(); // adjust to SATURDAY startDate.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY); System.out.println("Startdate=" + startDate.getTime()); // adjust -1 Workdays -> TUESDA...
#fixed code @Test public void testAddWorkdaysFromSaturday() { Calendar startDate = Calendar.getInstance(); // adjust to SATURDAY startDate.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY); System.out.println("Startdate=" + startDate.getTime()); // adjust -1 Workdays -> TUESDAY As...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testComplexWorkitem() throws ParseException { InputStream inputStream = getClass() .getResourceAsStream("/json/workitem.json"); ItemCollection itemCol = JSONParser.parseWorkitem(inputStream); Assert.assertNotNull(itemCol); Assert.assertEq...
#fixed code @Test public void testComplexWorkitem() throws ParseException { InputStream inputStream = getClass() .getResourceAsStream("/json/workitem.json"); ItemCollection itemCol = null; try { itemCol = JSONParser.parseWorkitem(inputStream,"UTF-8"); } catch (UnsupportedE...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testComplexPluginException() throws ScriptException { ItemCollection adocumentContext = new ItemCollection(); ItemCollection adocumentActivity = new ItemCollection(); // 1) invalid returning one messsage String script = "var a=1;var b=2;var is...
#fixed code @Test public void testComplexPluginException() throws ScriptException { ItemCollection adocumentContext = new ItemCollection(); ItemCollection adocumentActivity = new ItemCollection(); // 1) invalid returning one messsage String script = "var a=1;var b=2;var isValid =...
Below is the vulnerable code, please generate the patch based on the following information.
#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" + " \"_\"...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code void processWorkList(ItemCollection activityEntity) throws Exception { // get processID int iProcessID = activityEntity.getItemValueInteger("numprocessid"); // get Modelversion String sModelVersion = activityEntity .getItemValueString("$modelversion"); // if...
#fixed code Timer createTimerOnInterval(ItemCollection configItemCollection) { // Create an interval timer Date startDate = configItemCollection.getItemValueDate("datstart"); Date endDate = configItemCollection.getItemValueDate("datstop"); long interval = configItemCollection.getIt...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public int run(ItemCollection adocumentContext, ItemCollection adocumentActivity) throws PluginException { documentContext = adocumentContext; // evaluate new items.... ItemCollection evalItemCollection = new ItemCollection(); evalItemCollection=adocumentContext=ev...
#fixed code public int run(ItemCollection adocumentContext, ItemCollection adocumentActivity) throws PluginException { documentContext = adocumentContext; // evaluate new items.... ItemCollection evalItemCollection = new ItemCollection(); evalItemCollection=adocumentContext=evaluate...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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, ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code boolean flushEventLogByCount(int count) { Date lastEventDate = null; boolean cacheIsEmpty = true; IndexWriter indexWriter = null; long l = System.currentTimeMillis(); logger.finest("......flush eventlog cache...."); List<org.imixs.workflow.engine.jpa.Document>...
#fixed code boolean flushEventLogByCount(int count) { Date lastEventDate = null; boolean cacheIsEmpty = true; IndexWriter indexWriter = null; long l = System.currentTimeMillis(); logger.finest("......flush eventlog cache...."); List<EventLogEntry> events = eventLogService.findE...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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, ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testAddWorkdaysFromSaturday() { Calendar startDate = Calendar.getInstance(); // adjust to SATURDAY startDate.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY); System.out.println("Startdate=" + startDate.getTime()); // adjust -1 Workdays -> TUESDA...
#fixed code @Test public void testAddWorkdaysFromSaturday() { Calendar startDate = Calendar.getInstance(); // adjust to SATURDAY startDate.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY); System.out.println("Startdate=" + startDate.getTime()); // adjust -1 Workdays -> TUESDAY As...
Below is the vulnerable code, please generate the patch based on the following information.
#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 ...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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" + " \"_\"...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testComplexPluginException() throws ScriptException { ItemCollection adocumentContext = new ItemCollection(); ItemCollection adocumentActivity = new ItemCollection(); // 1) invalid returning one messsage String script = "var a=1;var b=2;var is...
#fixed code @Test public void testComplexPluginException() throws ScriptException { ItemCollection adocumentContext = new ItemCollection(); ItemCollection adocumentActivity = new ItemCollection(); // 1) invalid returning one messsage String script = "var a=1;var b=2;var isValid =...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testAddWorkdaysFromSaturday() { Calendar startDate = Calendar.getInstance(); // adjust to SATURDAY startDate.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY); System.out.println("Startdate=" + startDate.getTime()); // adjust -1 Workdays -> TUESDA...
#fixed code @Test public void testAddWorkdaysFromSaturday() { Calendar startDate = Calendar.getInstance(); // adjust to SATURDAY startDate.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY); System.out.println("Startdate=" + startDate.getTime()); // adjust -1 Workdays -> TUESDAY As...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void removeWorkitem(String uniqueID) throws PluginException { IndexWriter awriter = null; Properties prop = propertyService.getProperties(); if (!prop.isEmpty()) { try { awriter = createIndexWriter(prop); Term term = new Term("$uniqueid", uniqueID);...
#fixed code public void removeWorkitem(String uniqueID) throws PluginException { IndexWriter awriter = null; try { awriter = createIndexWriter(); Term term = new Term("$uniqueid", uniqueID); awriter.deleteDocuments(term); } catch (CorruptIndexException e) { throw new Plug...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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 ...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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 ...
Below is the vulnerable code, please generate the patch based on the following information.
#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 ...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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)); ...
Below is the vulnerable code, please generate the patch based on the following information.
#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(); } } ...
#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(); } }
Below is the vulnerable code, please generate the patch based on the following information.
#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" + " \"_\"...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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"); ...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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 ...
Below is the vulnerable code, please generate the patch based on the following information.
#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" + " \"_\"...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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 ...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @SuppressWarnings("unchecked") public void replaceAllItems(Map<String, List<Object>> map) { // make a deep copy of the map Map<String, List<Object>> clonedMap = (Map<String, List<Object>>) deepCopyOfMap(map); Iterator<?> it = clonedMap.entrySet().iterator(); while...
#fixed code @SuppressWarnings("unchecked") public void replaceAllItems(Map<String, List<Object>> map) { if (map == null) { return; } // make a deep copy of the map Map<String, List<Object>> clonedMap = (Map<String, List<Object>>) deepCopyOfMap(map); if (clonedMap != null) { ...
Below is the vulnerable code, please generate the patch based on the following information.
#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 ...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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 ...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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, ...
Below is the vulnerable code, please generate the patch based on the following information.
#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 ...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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 ...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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" + " \"_\"...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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, ...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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)); ...
Below is the vulnerable code, please generate the patch based on the following information.
#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 ...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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"))) ...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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) { ...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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 ...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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) { ...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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 ...
Below is the vulnerable code, please generate the patch based on the following information.
#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 ...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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 ...
Below is the vulnerable code, please generate the patch based on the following information.
#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 ...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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 ...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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" + " \"_\"...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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)); ...
Below is the vulnerable code, please generate the patch based on the following information.
#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"...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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, ...
Below is the vulnerable code, please generate the patch based on the following information.
#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 ...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code void handleNewChannelEvent(NewChannelEvent event) { final AsteriskChannelImpl channel = getChannelImplById(event.getUniqueId()); if (channel == null) { if (event.getChannel() == null) { logger.info("Ig...
#fixed code ChannelManager(AsteriskServerImpl server) { this.server = server; this.channels = new HashSet<AsteriskChannelImpl>(); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public int[] getVersion(String file) throws ManagerCommunicationException { String fileVersion = null; String[] parts; int[] intParts; initializeIfNeeded(); if (versions == null) { Map<String, String> map;...
#fixed 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.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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())...
#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()); ...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public ManagerResponse sendAction(ManagerAction action, long timeout) throws IOException, TimeoutException, IllegalArgumentException, IllegalStateException { long start; long timeSpent; ResponseHandlerResult result; ...
#fixed code public ManagerResponse sendAction(ManagerAction action, long timeout) throws IOException, TimeoutException, IllegalArgumentException, IllegalStateException { ResponseHandlerResult result; ManagerResponseHandler callbackHandler; ...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void redirectBothLegs(String context, String exten, int priority) throws ManagerCommunicationException, NoSuchChannelException { ManagerResponse response; if (linkedChannel == null) { response = server.sendActi...
#fixed code public void redirectBothLegs(String context, String exten, int priority) throws ManagerCommunicationException, NoSuchChannelException { ManagerResponse response; if (linkedChannels.isEmpty()) { response = server.sendAction(...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public AsteriskChannel getLinkedChannel() { return linkedChannel; } #location 3 #vulnerability type THREAD_SAFETY_VIOLATION
#fixed code public AsteriskChannel getLinkedChannel() { synchronized(linkedChannels) { if (linkedChannels.isEmpty()) return null; return linkedChannels.get(0); } }
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public ManagerResponse sendAction(ManagerAction action, long timeout) throws IOException, TimeoutException, IllegalArgumentException, IllegalStateException { ResponseHandlerResult result; SendActionCallback callbackHandler; resul...
#fixed code public ManagerResponse sendAction(ManagerAction action, long timeout) throws IOException, TimeoutException, IllegalArgumentException, IllegalStateException { ResponseHandlerResult result = new ResponseHandlerResult(); SendActionCallback callbac...
Below is the vulnerable code, please generate the patch based on the following information.
#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())...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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 (...
#fixed code ChannelManager(AsteriskServerImpl server) { this.server = server; this.channels = new HashSet<AsteriskChannelImpl>(); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void shutdown() { if (eventConnection != null && (eventConnection.getState() == ManagerConnectionState.CONNECTED || eventConnection.getState() == ManagerConnectionState.RECONNECTING)) { try { eventConnection.logoff(); } catch ...
#fixed code @Override public void shutdown() { if (eventConnection != null && (eventConnection.getState() == ManagerConnectionState.CONNECTED || eventConnection.getState() == ManagerConnectionState.RECONNECTING)) { try { eventConnection.logoff(); } catch (Excep...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public String getProtocolIdentifier() { return protocolIdentifier.value; } #location 3 #vulnerability type THREAD_SAFETY_VIOLATION
#fixed code public String getProtocolIdentifier() { return protocolIdentifier.getValue(); }
Below is the vulnerable code, please generate the patch based on the following information.
#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 (...
#fixed code ChannelManager(AsteriskServerImpl server) { this.server = server; this.channels = new HashSet<AsteriskChannelImpl>(); }
Below is the vulnerable code, please generate the patch based on the following information.
#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 (...
#fixed code ChannelManager(AsteriskServerImpl server) { this.server = server; this.channels = new HashSet<AsteriskChannelImpl>(); }
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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 (...
#fixed code ChannelManager(AsteriskServerImpl server) { this.server = server; this.channels = new HashSet<AsteriskChannelImpl>(); }
Below is the vulnerable code, please generate the patch based on the following information.
#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); } ...
#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)...
Below is the vulnerable code, please generate the patch based on the following information.
#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 (...
#fixed code ChannelManager(AsteriskServerImpl server) { this.server = server; }
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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 ...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#fixed code ChannelManager(AsteriskServerImpl server) { this.server = server; }
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public boolean getPaused() { return paused; } #location 3 #vulnerability type THREAD_SAFETY_VIOLATION
#fixed code public boolean getPaused() { return isPaused(); }
Below is the vulnerable code, please generate the patch based on the following information.