input stringlengths 205 73.3k | output stringlengths 64 73.2k | instruction stringclasses 1
value |
|---|---|---|
#vulnerable code
@Test
public void TestEscCloseLast() throws IOException {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc4.json", 0, 44)));
Assert.assertArray... | #fixed code
@Test
public void TestEscCloseLast() throws Exception {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc4.json", 0, 44)));
Assert.assertArrayEquals(n... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestArbitrarySplitLocations() throws IOException {
//int totalSize = 415;
//int [] recordBreaks = new int[] { 0, 40, 80, 120, 160, 200, 240, 280, 320, 372 };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor... | #fixed code
@Test
public void TestArbitrarySplitLocations() throws Exception {
//int totalSize = 415;
//int [] recordBreaks = new int[] { 0, 40, 80, 120, 160, 200, 240, 280, 320, 372 };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEachOnce() throws IOException {
//Each record exactly once - see commit b8f6d6dfaf11cce7d8cba54e6011e8684ade0e85, issue #68
Assert.assertArrayEquals(new int[] { 0, 1 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-simple.json", 0, 63)))... | #fixed code
@Test
public void TestEachOnce() throws Exception {
//Each record exactly once - see commit b8f6d6dfaf11cce7d8cba54e6011e8684ade0e85, issue #68
Assert.assertArrayEquals(new int[] { 0, 1 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-simple.json", 0, 63)));
Asse... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Ignore // May not be guaranteed behavior
public void TestComma() throws IOException {
//int [] recordBreaks = new int[] { 0, 57, 111, , };
int[] rslt = getRecordIndexesInReader(getReaderFor("unenclosed-json-comma.json", 0, 222), true);
Assert.assertEquals(4, rslt... | #fixed code
@Ignore // May not be guaranteed behavior
public void TestComma() throws Exception {
//int [] recordBreaks = new int[] { 0, 57, 111, , };
int[] rslt = getRecordIndexesInReader(getReaderFor("unenclosed-json-comma.json", 0, 222), true);
Assert.assertEquals(4, rslt.length)... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestArbitrarySplitLocations() throws IOException {
//int totalSize = 415;
//int [] recordBreaks = new int[] { 0, 40, 80, 120, 160, 200, 240, 280, 320, 372 };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor... | #fixed code
@Test
public void TestArbitrarySplitLocations() throws Exception {
//int totalSize = 415;
//int [] recordBreaks = new int[] { 0, 40, 80, 120, 160, 200, 240, 280, 320, 372 };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEscape() throws IOException { // Issue #68
//int [] recordBreaks = new int[] { 0, 44, 88, 137, 181, 229, 270, 311, 354 }; //length 395
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-escape.json"... | #fixed code
@Test
public void TestEscape() throws Exception { // Issue #68
//int [] recordBreaks = new int[] { 0, 44, 88, 137, 181, 229, 270, 311, 354 }; //length 395
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-escape.json", 0, 44)... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestWhitespace() throws IOException {
//int [] recordBreaks = new int[] { 0, 57, 111, , };
int[] rslt = getRecordIndexesInReader(getReaderFor("unenclosed-json-return.json", 0, 222), true);
Assert.assertEquals(4, rslt.length);
int[] before = null... | #fixed code
@Test
public void TestWhitespace() throws Exception {
//int [] recordBreaks = new int[] { 0, 57, 111, , };
int[] rslt = getRecordIndexesInReader(getReaderFor("unenclosed-json-return.json", 0, 222), true);
Assert.assertEquals(4, rslt.length);
int[] before = null, after ... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestWhitespace() throws IOException {
//int [] recordBreaks = new int[] { 0, 57, 111, , };
int[] rslt = getRecordIndexesInReader(getReaderFor("unenclosed-json-return.json", 0, 222), true);
Assert.assertEquals(4, rslt.length);
int[] before = null... | #fixed code
@Test
public void TestWhitespace() throws Exception {
//int [] recordBreaks = new int[] { 0, 57, 111, , };
int[] rslt = getRecordIndexesInReader(getReaderFor("unenclosed-json-return.json", 0, 222), true);
Assert.assertEquals(4, rslt.length);
int[] before = null, after ... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestNullAttr() throws Exception {
Configuration config = new Configuration();
Text value = new Text();
SerDe jserde = new GeoJsonSerDe();
Properties proptab = new Properties();
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS, "num");... | #fixed code
@Test
public void TestNullAttr() throws Exception {
ArrayList<Object> stuff = new ArrayList<Object>();
Properties proptab = new Properties();
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS, "num");
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUM... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEscCloseLast() throws IOException {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc4.json", 0, 44)));
Assert.assertArray... | #fixed code
@Test
public void TestEscCloseLast() throws Exception {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc4.json", 0, 44)));
Assert.assertArrayEquals(n... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEscAposLast() throws IOException {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc2.json", 0, 44)));
Assert.assertArrayE... | #fixed code
@Test
public void TestEscAposLast() throws Exception {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc2.json", 0, 44)));
Assert.assertArrayEquals(ne... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEscQuoteLast() throws IOException {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc1.json", 0, 44)));
Assert.assertArray... | #fixed code
@Test
public void TestEscQuoteLast() throws Exception {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc1.json", 0, 44)));
Assert.assertArrayEquals(n... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEachOnce() throws IOException {
//Each record exactly once - see commit b8f6d6dfaf11cce7d8cba54e6011e8684ade0e85, issue #68
Assert.assertArrayEquals(new int[] { 0, 1 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-simple.json", 0, 63)))... | #fixed code
@Test
public void TestEachOnce() throws Exception {
//Each record exactly once - see commit b8f6d6dfaf11cce7d8cba54e6011e8684ade0e85, issue #68
Assert.assertArrayEquals(new int[] { 0, 1 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-simple.json", 0, 63)));
Asse... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestArbitrarySplitLocations() throws Exception {
//int totalSize = 415;
//int [] recordBreaks = new int[] { 0, 40, 80, 120, 160, 200, 240, 280, 320, 372 };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("... | #fixed code
@Test
public void TestArbitrarySplitLocations() throws Exception {
//int totalSize = 415;
//int [] recordBreaks = new int[] { 0, 40, 80, 120, 160, 200, 240, 280, 320, 372 };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestWhitespace() throws IOException {
//int [] recordBreaks = new int[] { 0, 57, 111, , };
int[] rslt = getRecordIndexesInReader(getReaderFor("unenclosed-json-return.json", 0, 222), true);
Assert.assertEquals(4, rslt.length);
int[] before = null... | #fixed code
@Test
public void TestWhitespace() throws Exception {
//int [] recordBreaks = new int[] { 0, 57, 111, , };
int[] rslt = getRecordIndexesInReader(getReaderFor("unenclosed-json-return.json", 0, 222), true);
Assert.assertEquals(4, rslt.length);
int[] before = null, after ... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEscSlashLast() throws IOException {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc3.json", 0, 44)));
Assert.assertArray... | #fixed code
@Test
public void TestEscSlashLast() throws Exception {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc3.json", 0, 44)));
Assert.assertArrayEquals(n... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEscape() throws IOException { // Issue #68
//int [] recordBreaks = new int[] { 0, 44, 88, 137, 181, 229, 270, 311, 354 }; //length 395
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-escape.json"... | #fixed code
@Test
public void TestEscape() throws Exception { // Issue #68
//int [] recordBreaks = new int[] { 0, 44, 88, 137, 181, 229, 270, 311, 354 }; //length 395
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-escape.json", 0, 44)... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEachOnce() throws IOException {
//Each record exactly once - see commit b8f6d6dfaf11cce7d8cba54e6011e8684ade0e85, issue #68
Assert.assertArrayEquals(new int[] { 0, 1 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-simple.json", 0, 63)))... | #fixed code
@Test
public void TestEachOnce() throws Exception {
//Each record exactly once - see commit b8f6d6dfaf11cce7d8cba54e6011e8684ade0e85, issue #68
Assert.assertArrayEquals(new int[] { 0, 1 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-simple.json", 0, 63)));
Asse... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEscAposLast() throws IOException {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc2.json", 0, 44)));
Assert.assertArrayE... | #fixed code
@Test
public void TestEscAposLast() throws Exception {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc2.json", 0, 44)));
Assert.assertArrayEquals(ne... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestGeomFirst() throws IOException {
Assert.assertArrayEquals(new int[] { 1 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-geom-first.json", 32, 54)));
Assert.assertArrayEquals(new int[] { 1 }, getRecordIndexesInReader(getReaderFor("unencl... | #fixed code
@Test
public void TestGeomFirst() throws Exception {
Assert.assertArrayEquals(new int[] { 1 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-geom-first.json", 32, 54)));
Assert.assertArrayEquals(new int[] { 1 }, getRecordIndexesInReader(getReaderFor("unenclosed-jso... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEscSlashLast() throws IOException {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc3.json", 0, 44)));
Assert.assertArray... | #fixed code
@Test
public void TestEscSlashLast() throws Exception {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc3.json", 0, 44)));
Assert.assertArrayEquals(n... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestArbitrarySplitLocations() throws IOException {
//int totalSize = 415;
//int [] recordBreaks = new int[] { 0, 40, 80, 120, 160, 200, 240, 280, 320, 372 };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor... | #fixed code
@Test
public void TestArbitrarySplitLocations() throws Exception {
//int totalSize = 415;
//int [] recordBreaks = new int[] { 0, 40, 80, 120, 160, 200, 240, 280, 320, 372 };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestWhitespace() throws IOException {
//int [] recordBreaks = new int[] { 0, 57, 111, , };
int[] rslt = getRecordIndexesInReader(getReaderFor("unenclosed-json-return.json", 0, 222), true);
Assert.assertEquals(4, rslt.length);
int[] before = null... | #fixed code
@Test
public void TestWhitespace() throws Exception {
//int [] recordBreaks = new int[] { 0, 57, 111, , };
int[] rslt = getRecordIndexesInReader(getReaderFor("unenclosed-json-return.json", 0, 222), true);
Assert.assertEquals(4, rslt.length);
int[] before = null, after ... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEscape() throws IOException { // Issue #68
//int [] recordBreaks = new int[] { 0, 44, 88, 137, 181, 229, 270, 311, 354 }; //length 395
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-escape.json"... | #fixed code
@Test
public void TestEscape() throws Exception { // Issue #68
//int [] recordBreaks = new int[] { 0, 44, 88, 137, 181, 229, 270, 311, 354 }; //length 395
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-escape.json", 0, 44)... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEscOpenLast() throws IOException {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc5.json", 0, 44)));
Assert.assertArrayE... | #fixed code
@Test
public void TestEscOpenLast() throws Exception {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc5.json", 0, 44)));
Assert.assertArrayEquals(ne... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEscOpenLast() throws IOException {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc5.json", 0, 44)));
Assert.assertArrayE... | #fixed code
@Test
public void TestEscOpenLast() throws Exception {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc5.json", 0, 44)));
Assert.assertArrayEquals(ne... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEscPoints() throws IOException {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc-points.json", 0, 74), true));
Assert.as... | #fixed code
@Test
public void TestEscPoints() throws Exception {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc-points.json", 0, 74), true));
Assert.assertArra... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEscAposLast() throws IOException {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc2.json", 0, 44)));
Assert.assertArrayE... | #fixed code
@Test
public void TestEscAposLast() throws Exception {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc2.json", 0, 44)));
Assert.assertArrayEquals(ne... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEscSlashLast() throws IOException {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc3.json", 0, 44)));
Assert.assertArray... | #fixed code
@Test
public void TestEscSlashLast() throws Exception {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc3.json", 0, 44)));
Assert.assertArrayEquals(n... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEscOpenLast() throws IOException {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc5.json", 0, 44)));
Assert.assertArrayE... | #fixed code
@Test
public void TestEscOpenLast() throws Exception {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc5.json", 0, 44)));
Assert.assertArrayEquals(ne... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEachOnce() throws IOException {
//Each record exactly once - see commit b8f6d6dfaf11cce7d8cba54e6011e8684ade0e85, issue #68
Assert.assertArrayEquals(new int[] { 0, 1 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-simple.json", 0, 63)))... | #fixed code
@Test
public void TestEachOnce() throws Exception {
//Each record exactly once - see commit b8f6d6dfaf11cce7d8cba54e6011e8684ade0e85, issue #68
Assert.assertArrayEquals(new int[] { 0, 1 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-simple.json", 0, 63)));
Asse... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestArbitrarySplitLocations() throws IOException {
//int totalSize = 415;
//int [] recordBreaks = new int[] { 0, 40, 80, 120, 160, 200, 240, 280, 320, 372 };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor... | #fixed code
@Test
public void TestArbitrarySplitLocations() throws Exception {
//int totalSize = 415;
//int [] recordBreaks = new int[] { 0, 40, 80, 120, 160, 200, 240, 280, 320, 372 };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestGeomFirst() throws IOException {
Assert.assertArrayEquals(new int[] { 1 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-geom-first.json", 32, 54)));
Assert.assertArrayEquals(new int[] { 1 }, getRecordIndexesInReader(getReaderFor("unencl... | #fixed code
@Test
public void TestGeomFirst() throws Exception {
Assert.assertArrayEquals(new int[] { 1 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-geom-first.json", 32, 54)));
Assert.assertArrayEquals(new int[] { 1 }, getRecordIndexesInReader(getReaderFor("unenclosed-jso... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEscCloseLast() throws IOException {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc4.json", 0, 44)));
Assert.assertArray... | #fixed code
@Test
public void TestEscCloseLast() throws Exception {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc4.json", 0, 44)));
Assert.assertArrayEquals(n... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Ignore // May not be guaranteed behavior
public void TestComma() throws IOException {
//int [] recordBreaks = new int[] { 0, 57, 111, , };
int[] rslt = getRecordIndexesInReader(getReaderFor("unenclosed-json-comma.json", 0, 222), true);
Assert.assertEquals(4, rslt... | #fixed code
@Ignore // May not be guaranteed behavior
public void TestComma() throws Exception {
//int [] recordBreaks = new int[] { 0, 57, 111, , };
int[] rslt = getRecordIndexesInReader(getReaderFor("unenclosed-json-comma.json", 0, 222), true);
Assert.assertEquals(4, rslt.length)... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEscQuoteLast() throws IOException {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc1.json", 0, 44)));
Assert.assertArray... | #fixed code
@Test
public void TestEscQuoteLast() throws Exception {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc1.json", 0, 44)));
Assert.assertArrayEquals(n... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestWhitespace() throws IOException {
//int [] recordBreaks = new int[] { 0, 57, 111, , };
int[] rslt = getRecordIndexesInReader(getReaderFor("unenclosed-json-return.json", 0, 222), true);
Assert.assertEquals(4, rslt.length);
int[] before = null... | #fixed code
@Test
public void TestWhitespace() throws Exception {
//int [] recordBreaks = new int[] { 0, 57, 111, , };
int[] rslt = getRecordIndexesInReader(getReaderFor("unenclosed-json-return.json", 0, 222), true);
Assert.assertEquals(4, rslt.length);
int[] before = null, after ... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Ignore // May not be guaranteed behavior
public void TestComma() throws IOException {
//int [] recordBreaks = new int[] { 0, 57, 111, , };
int[] rslt = getRecordIndexesInReader(getReaderFor("unenclosed-json-comma.json", 0, 222), true);
Assert.assertEquals(4, rslt... | #fixed code
@Ignore // May not be guaranteed behavior
public void TestComma() throws Exception {
//int [] recordBreaks = new int[] { 0, 57, 111, , };
int[] rslt = getRecordIndexesInReader(getReaderFor("unenclosed-json-comma.json", 0, 222), true);
Assert.assertEquals(4, rslt.length)... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestArbitrarySplitLocations() throws Exception {
//int totalSize = 415;
//int [] recordBreaks = new int[] { 0, 40, 80, 120, 160, 200, 240, 280, 320, 372 };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("... | #fixed code
@Test
public void TestArbitrarySplitLocations() throws Exception {
//int totalSize = 415;
//int [] recordBreaks = new int[] { 0, 40, 80, 120, 160, 200, 240, 280, 320, 372 };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private static void validatePoint(Point point, BytesWritable geometryAsWritable) {
ST_X getX = new ST_X();
DoubleWritable xAsWritable = getX.evaluate(geometryAsWritable);
assertNotNull("The x writable must not be null!", xAsWritable);
ST_Y getY = new ST_Y();
Dou... | #fixed code
private static void validatePoint(Point point, BytesWritable geometryAsWritable) {
ST_X getX = new ST_X();
ST_Y getY = new ST_Y();
DoubleWritable xAsWritable = getX.evaluate(geometryAsWritable);
DoubleWritable yAsWritable = getY.evaluate(geometryAsWritable);
if (null ... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEachOnce() throws IOException {
//Each record exactly once - see commit b8f6d6dfaf11cce7d8cba54e6011e8684ade0e85, issue #68
Assert.assertArrayEquals(new int[] { 0, 1 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-simple.json", 0, 63)))... | #fixed code
@Test
public void TestEachOnce() throws Exception {
//Each record exactly once - see commit b8f6d6dfaf11cce7d8cba54e6011e8684ade0e85, issue #68
Assert.assertArrayEquals(new int[] { 0, 1 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-simple.json", 0, 63)));
Asse... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestArbitrarySplitLocations() throws IOException {
//int totalSize = 415;
//int [] recordBreaks = new int[] { 0, 40, 80, 120, 160, 200, 240, 280, 320, 372 };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor... | #fixed code
@Test
public void TestArbitrarySplitLocations() throws Exception {
//int totalSize = 415;
//int [] recordBreaks = new int[] { 0, 40, 80, 120, 160, 200, 240, 280, 320, 372 };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEscOpenLast() throws IOException {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc5.json", 0, 44)));
Assert.assertArrayE... | #fixed code
@Test
public void TestEscOpenLast() throws Exception {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc5.json", 0, 44)));
Assert.assertArrayEquals(ne... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private UnenclosedJsonRecordReader getReaderFor(String resource, int start, int end) throws IOException {
Path path = new Path(this.getClass().getResource(resource).getFile());
JobConf conf = new JobConf();
FileSplit split = new FileSplit(path, start, end - sta... | #fixed code
private UnenclosedJsonRecordReader getReaderFor(String resource, int start, int end) throws Exception {
Path path = new Path(this.getClass().getResource(resource).getFile());
FileSplit split = new FileSplit(path, start, end - start, new String[0]);
UnenclosedJsonRecordRe... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEscape() throws IOException { // Issue #68
//int [] recordBreaks = new int[] { 0, 44, 88, 137, 181, 229, 270, 311, 354 }; //length 395
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-escape.json"... | #fixed code
@Test
public void TestEscape() throws Exception { // Issue #68
//int [] recordBreaks = new int[] { 0, 44, 88, 137, 181, 229, 270, 311, 354 }; //length 395
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-escape.json", 0, 44)... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEscAposLast() throws IOException {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc2.json", 0, 44)));
Assert.assertArrayE... | #fixed code
@Test
public void TestEscAposLast() throws Exception {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc2.json", 0, 44)));
Assert.assertArrayEquals(ne... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEscape() throws IOException { // Issue #68
//int [] recordBreaks = new int[] { 0, 44, 88, 137, 181, 229, 270, 311, 354 }; //length 395
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-escape.json"... | #fixed code
@Test
public void TestEscape() throws Exception { // Issue #68
//int [] recordBreaks = new int[] { 0, 44, 88, 137, 181, 229, 270, 311, 354 }; //length 395
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-escape.json", 0, 44)... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEscOpenLast() throws IOException {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc5.json", 0, 44)));
Assert.assertArrayE... | #fixed code
@Test
public void TestEscOpenLast() throws Exception {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc5.json", 0, 44)));
Assert.assertArrayEquals(ne... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEscCloseLast() throws IOException {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc4.json", 0, 44)));
Assert.assertArray... | #fixed code
@Test
public void TestEscCloseLast() throws Exception {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc4.json", 0, 44)));
Assert.assertArrayEquals(n... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEscAposLast() throws IOException {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc2.json", 0, 44)));
Assert.assertArrayE... | #fixed code
@Test
public void TestEscAposLast() throws Exception {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc2.json", 0, 44)));
Assert.assertArrayEquals(ne... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEscPoints() throws IOException {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc-points.json", 0, 74), true));
Assert.as... | #fixed code
@Test
public void TestEscPoints() throws Exception {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc-points.json", 0, 74), true));
Assert.assertArra... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEscQuoteLast() throws IOException {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc1.json", 0, 44)));
Assert.assertArray... | #fixed code
@Test
public void TestEscQuoteLast() throws Exception {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc1.json", 0, 44)));
Assert.assertArrayEquals(n... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Ignore // May not be guaranteed behavior
public void TestComma() throws IOException {
//int [] recordBreaks = new int[] { 0, 57, 111, , };
int[] rslt = getRecordIndexesInReader(getReaderFor("unenclosed-json-comma.json", 0, 222), true);
Assert.assertEquals(4, rslt... | #fixed code
@Ignore // May not be guaranteed behavior
public void TestComma() throws Exception {
//int [] recordBreaks = new int[] { 0, 57, 111, , };
int[] rslt = getRecordIndexesInReader(getReaderFor("unenclosed-json-comma.json", 0, 222), true);
Assert.assertEquals(4, rslt.length)... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEscOpenLast() throws IOException {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc5.json", 0, 44)));
Assert.assertArrayE... | #fixed code
@Test
public void TestEscOpenLast() throws Exception {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc5.json", 0, 44)));
Assert.assertArrayEquals(ne... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEscape() throws IOException { // Issue #68
//int [] recordBreaks = new int[] { 0, 44, 88, 137, 181, 229, 270, 311, 354 }; //length 395
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-escape.json"... | #fixed code
@Test
public void TestEscape() throws Exception { // Issue #68
//int [] recordBreaks = new int[] { 0, 44, 88, 137, 181, 229, 270, 311, 354 }; //length 395
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-escape.json", 0, 44)... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestIntPoint() throws Exception {
Configuration config = new Configuration();
Text value = new Text();
SerDe jserde = new GeoJsonSerDe();
Properties proptab = new Properties();
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS, "num,sh... | #fixed code
@Test
public void TestIntPoint() throws Exception {
ArrayList<Object> stuff = new ArrayList<Object>();
Properties proptab = new Properties();
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS, "num,shape");
proptab.setProperty(HiveShims.serdeConstants.LIST... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEscSlashLast() throws IOException {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc3.json", 0, 44)));
Assert.assertArray... | #fixed code
@Test
public void TestEscSlashLast() throws Exception {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc3.json", 0, 44)));
Assert.assertArrayEquals(n... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEachOnce() throws IOException {
//Each record exactly once - see commit b8f6d6dfaf11cce7d8cba54e6011e8684ade0e85, issue #68
Assert.assertArrayEquals(new int[] { 0, 1 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-simple.json", 0, 63)))... | #fixed code
@Test
public void TestEachOnce() throws Exception {
//Each record exactly once - see commit b8f6d6dfaf11cce7d8cba54e6011e8684ade0e85, issue #68
Assert.assertArrayEquals(new int[] { 0, 1 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-simple.json", 0, 63)));
Asse... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestWhitespace() throws IOException {
//int [] recordBreaks = new int[] { 0, 57, 111, , };
int[] rslt = getRecordIndexesInReader(getReaderFor("unenclosed-json-return.json", 0, 222), true);
Assert.assertEquals(4, rslt.length);
int[] before = null... | #fixed code
@Test
public void TestWhitespace() throws Exception {
//int [] recordBreaks = new int[] { 0, 57, 111, , };
int[] rslt = getRecordIndexesInReader(getReaderFor("unenclosed-json-return.json", 0, 222), true);
Assert.assertEquals(4, rslt.length);
int[] before = null, after ... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestArbitrarySplitLocations() throws Exception {
//int totalSize = 415;
//int [] recordBreaks = new int[] { 0, 40, 80, 120, 160, 200, 240, 280, 320, 372 };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("... | #fixed code
@Test
public void TestArbitrarySplitLocations() throws Exception {
//int totalSize = 415;
//int [] recordBreaks = new int[] { 0, 40, 80, 120, 160, 200, 240, 280, 320, 372 };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestNullGeom() throws Exception {
Configuration config = new Configuration();
Text value = new Text();
SerDe jserde = new GeoJsonSerDe();
Properties proptab = new Properties();
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS, "shape"... | #fixed code
@Test
public void TestNullGeom() throws Exception {
ArrayList<Object> stuff = new ArrayList<Object>();
Properties proptab = new Properties();
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS, "shape");
proptab.setProperty(HiveShims.serdeConstants.LIST_COL... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestWhitespace() throws IOException {
//int [] recordBreaks = new int[] { 0, 57, 111, , };
int[] rslt = getRecordIndexesInReader(getReaderFor("unenclosed-json-return.json", 0, 222), true);
Assert.assertEquals(4, rslt.length);
int[] before = null... | #fixed code
@Test
public void TestWhitespace() throws Exception {
//int [] recordBreaks = new int[] { 0, 57, 111, , };
int[] rslt = getRecordIndexesInReader(getReaderFor("unenclosed-json-return.json", 0, 222), true);
Assert.assertEquals(4, rslt.length);
int[] before = null, after ... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Ignore // May not be guaranteed behavior
public void TestComma() throws IOException {
//int [] recordBreaks = new int[] { 0, 57, 111, , };
int[] rslt = getRecordIndexesInReader(getReaderFor("unenclosed-json-comma.json", 0, 222), true);
Assert.assertEquals(4, rslt... | #fixed code
@Ignore // May not be guaranteed behavior
public void TestComma() throws Exception {
//int [] recordBreaks = new int[] { 0, 57, 111, , };
int[] rslt = getRecordIndexesInReader(getReaderFor("unenclosed-json-comma.json", 0, 222), true);
Assert.assertEquals(4, rslt.length)... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private static void validatePoint(Point point, BytesWritable geometryAsWritable) {
ST_X getX = new ST_X();
DoubleWritable xAsWritable = getX.evaluate(geometryAsWritable);
assertNotNull("The x writable must not be null!", xAsWritable);
ST_Y getY = new ST_Y();
Dou... | #fixed code
private static void validatePoint(Point point, BytesWritable geometryAsWritable) {
ST_X getX = new ST_X();
ST_Y getY = new ST_Y();
DoubleWritable xAsWritable = getX.evaluate(geometryAsWritable);
DoubleWritable yAsWritable = getY.evaluate(geometryAsWritable);
if (null ... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestPointOnly() throws Exception {
Configuration config = new Configuration();
Text value = new Text();
SerDe jserde = new GeoJsonSerDe();
Properties proptab = new Properties();
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS, "shape... | #fixed code
@Test
public void TestPointOnly() throws Exception {
ArrayList<Object> stuff = new ArrayList<Object>();
Properties proptab = new Properties();
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS, "shape");
proptab.setProperty(HiveShims.serdeConstants.LIST_CO... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void TestEscOpenLast() throws IOException {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc5.json", 0, 44)));
Assert.assertArrayE... | #fixed code
@Test
public void TestEscOpenLast() throws Exception {
//int [] recordBreaks = new int[] { 0, 75, 146, 218, 290, 362, , , };
Assert.assertArrayEquals(new int[] { 0 }, getRecordIndexesInReader(getReaderFor("unenclosed-json-esc5.json", 0, 44)));
Assert.assertArrayEquals(ne... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private PackrOutput buildMacBundle(PackrOutput output) throws IOException {
if (config.platform != PackrConfig.Platform.MacOS) {
return output;
}
// replacement strings for Info.plist
Map<String, String> values = new HashMap<>();
values.put("${executable}",... | #fixed code
private PackrOutput buildMacBundle(PackrOutput output) throws IOException {
if (config.platform != PackrConfig.Platform.MacOS) {
return output;
}
// replacement strings for Info.plist
Map<String, String> values = new HashMap<>();
values.put("${executable}", confi... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private void copyExecutableAndClasspath(PackrOutput output) throws IOException {
byte[] exe = null;
String extension = "";
switch (config.platform) {
case Windows32:
exe = readResource("/packr-windows.exe");
extension = ".exe";
break;
case Windows6... | #fixed code
private void copyExecutableAndClasspath(PackrOutput output) throws IOException {
byte[] exe = null;
String extension = "";
switch (config.platform) {
case Windows32:
exe = readResource("/packr-windows.exe");
extension = ".exe";
break;
case Windows64:
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private void writeConfig(PackrOutput output) throws IOException {
StringBuilder builder = new StringBuilder();
builder.append("{\n");
builder.append(" \"classPath\": [");
String delim = "\n";
for (String f : config.classpath) {
builder.append(delim).append(... | #fixed code
private void writeConfig(PackrOutput output) throws IOException {
StringBuilder builder = new StringBuilder();
builder.append("{\n");
builder.append(" \"classPath\": [");
String delim = "\n";
for (String f : config.classpath) {
builder.append(delim).append(" \... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public Promise synwrite(BaseMessage message){
Channel ch = fetchOneWritable();
AbstractSessionStateManager session = (AbstractSessionStateManager)ch.pipeline().get(sessionHandler);
return session.writeMessagesync( message);
}
#location 3... | #fixed code
public Promise synwrite(BaseMessage message){
Channel ch = fetchOneWritable();
if(ch == null) return null;
AbstractSessionStateManager session = (AbstractSessionStateManager)ch.pipeline().get(sessionHandler);
return session.writeMessagesync( message);
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public SmsAlphabet getAlphabet()
{
switch (getGroup())
{
case GENERAL_DATA_CODING:
// General Data Coding Indication
if (dcs_ == 0x00)
{
return SmsAlphabet.ASCII;
}
... | #fixed code
public SmsAlphabet getAlphabet()
{
switch (getGroup())
{
case GENERAL_DATA_CODING:
// General Data Coding Indication
if (dcs_ == 0x00)
{
return SmsAlphabet.ASCII;
}
switch... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public ChannelFuture asynwrite(Object msg){
Channel ch = fetchOneWritable();
ChannelFuture future = ch.writeAndFlush(msg);
return future;
}
#location 3
#vulnerability type NULL_DEREFERENCE | #fixed code
public ChannelFuture asynwrite(Object msg){
Channel ch = fetchOneWritable();
if(ch == null) return null;
ChannelFuture future = ch.writeAndFlush(msg);
return future;
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private Class<?> loadTestClassWithDistinctClassLoader() throws Exception {
URL[] classpath = {temp.getRoot().toURI().toURL()};
URLClassLoader loader = new URLClassLoader(classpath);
return loader.loadClass(CLASS_NAME);
}
#locatio... | #fixed code
private Class<?> loadTestClassWithDistinctClassLoader() throws Exception {
URL[] classpath = {temp.getRoot().toURI().toURL()};
URLClassLoader loader = new URLClassLoader(classpath);
Class<?> clazz = loader.loadClass(CLASS_NAME);
loader.close();
return clazz;... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void disconnect()
{
if (!isConnected())
{
logger.warn("ClusterManager " + _instanceName + " already disconnected");
return;
}
logger.info("disconnect " + _instanceName + "(" + _instanceType + ") from "
+ _clusterN... | #fixed code
@Override
public void disconnect()
{
if (!isConnected())
{
logger.error("ClusterManager " + _instanceName + " already disconnected");
return;
}
disconnectInternal();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test (groups = {"integrationTest"})
public void testFileBasedClusterManager() throws Exception
{
List<FileBasedClusterManager.DBParam> dbParams = new ArrayList<FileBasedClusterManager.DBParam>();
dbParams.add(new FileBasedClusterManager.DBParam("BizFollow", 1... | #fixed code
@Test (groups = {"integrationTest"})
public void testFileBasedClusterManager() throws Exception
{
List<FileBasedClusterManager.DBParam> dbParams = new ArrayList<FileBasedClusterManager.DBParam>();
dbParams.add(new FileBasedClusterManager.DBParam("BizFollow", 1));
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testZkClientMonitor() throws Exception {
final String TEST_TAG = "test_monitor";
final String TEST_KEY = "test_key";
final String TEST_DATA = "testData";
final String TEST_ROOT = "/my_cluster/IDEALSTATES";
final String TEST_NODE = "... | #fixed code
@Test
public void testZkClientMonitor() throws Exception {
final String TEST_TAG = "test_monitor";
final String TEST_KEY = "test_key";
final String TEST_DATA = "testData";
final String TEST_ROOT = "/my_cluster/IDEALSTATES";
final String TEST_NODE = "/test_... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void disconnect() {
if (_zkclient == null || _zkclient.isClosed()) {
LOG.info("instanceName: " + _instanceName + " already disconnected");
return;
}
LOG.info("disconnect " + _instanceName + "(" + _instanceType + ") from " + _clu... | #fixed code
@Override
public void disconnect() {
if (_zkclient == null || _zkclient.isClosed()) {
LOG.info("instanceName: " + _instanceName + " already disconnected");
return;
}
LOG.info("disconnect " + _instanceName + "(" + _instanceType + ") from " + _clusterNa... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void setRequestedState(String partitionName, String state) {
Map<String, Map<String, String>> mapFields = _record.getMapFields();
if (mapFields.get(partitionName) == null) {
mapFields.put(partitionName, new TreeMap<String, String>());
}
mapFie... | #fixed code
public void setRequestedState(String partitionName, String state) {
setProperty(partitionName, CurrentStateProperty.REQUESTED_STATE, state);
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void process(ClusterEvent event) throws Exception
{
ClusterManager manager = event.getAttribute("clustermanager");
if (manager == null)
{
throw new StageException("ClusterManager attribute value is null");
}
ClusterDataAccess... | #fixed code
@Override
public void process(ClusterEvent event) throws Exception
{
ClusterManager manager = event.getAttribute("clustermanager");
if (manager == null)
{
throw new StageException("ClusterManager attribute value is null");
}
ClusterDataAccessor dat... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testInvocationAnnotated() throws Exception
{
System.out.println("TestCMTaskHandler.testInvocationAnnotated()");
Message message = new Message(MessageType.STATE_TRANSITION);
message.setSrcName("cm-instance-0");
message.setTgtSessionId(... | #fixed code
@Test
public void testInvocationAnnotated() throws Exception
{
System.out.println("TestCMTaskHandler.testInvocationAnnotated()");
Message message = new Message(MessageType.STATE_TRANSITION);
message.setSrcName("cm-instance-0");
message.setTgtSessionId("1234"... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void handleDataDeleted(String dataPath) {
if (_zkClientForListener == null || _zkClientForListener.isClosed()) {
return;
}
// Resubscribe
_zkClientForListener.unsubscribeAll();
_zkClientForListener.subscribeRoutingDataChanges(t... | #fixed code
@Override
public void handleDataDeleted(String dataPath) {
if (_zkClientForRoutingDataListener == null || _zkClientForRoutingDataListener.isClosed()) {
return;
}
// Resubscribe
_zkClientForRoutingDataListener.unsubscribeAll();
_zkClientForRoutingData... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testSimpleCS() {
// setup resource
Map<String, Resource> resourceMap = getResourceMap();
setupLiveInstances(5);
event.addAttribute(AttributeName.RESOURCES.name(), resourceMap);
CurrentStateComputationStage stage = new CurrentState... | #fixed code
@Test
public void testSimpleCS() {
// setup resource
Map<String, Resource> resourceMap = getResourceMap();
setupLiveInstances(5);
event.addAttribute(AttributeName.RESOURCES.name(), resourceMap);
event.addAttribute(AttributeName.RESOURCES_TO_REBALANCE.nam... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
void VerifyEmptyCurrentState(ClusterDataAccessor accessor, ZkClient client, String clusterName, String instanceName, String dbName)
{
String path = CMUtil.getInstancePropertyPath(clusterName, instanceName, InstancePropertyType.CURRENTSTATES);
List<String> subPat... | #fixed code
void verifyEmptyCurrentState(ClusterDataAccessor accessor, ZkClient client, String clusterName, String instanceName, String dbName)
{
String path = CMUtil.getInstancePropertyPath(clusterName, instanceName, InstancePropertyType.CURRENTSTATES);
List<String> subPaths = a... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void disconnect() {
if (_zkclient == null || _zkclient.isClosed()) {
LOG.info("instanceName: " + _instanceName + " already disconnected");
return;
}
LOG.info("disconnect " + _instanceName + "(" + _instanceType + ") from " + _clu... | #fixed code
@Override
public void disconnect() {
if (_zkclient == null || _zkclient.isClosed()) {
LOG.info("instanceName: " + _instanceName + " already disconnected");
return;
}
LOG.info("disconnect " + _instanceName + "(" + _instanceType + ") from " + _clusterNa... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void testSimpleCS()
{
// setup resource group
Map<String, ResourceGroup> resourceGroupMap = getResourceGroupMap();
setupLiveInstances(5);
event.addAttribute(AttributeName.RESOURCE_GROUPS.toString(),
resourceGroupMap);
CurrentStateCom... | #fixed code
public void testSimpleCS()
{
// setup resource group
Map<String, ResourceGroup> resourceGroupMap = getResourceGroupMap();
setupLiveInstances(5);
event.addAttribute(AttributeName.RESOURCE_GROUPS.toString(),
resourceGroupMap);
CurrentStateComputati... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void download(String zkPath, String fsPath) throws Exception
{
List<String> children = client.getChildren(zkPath);
if (children != null && children.size() > 0)
{
new File(fsPath).mkdirs();
for (String child : children)
{
... | #fixed code
public void download(String zkPath, String fsPath) throws Exception {
List<String> children = client.getChildren(zkPath);
if (children != null && children.size() > 0) {
new File(fsPath).mkdirs();
for (String child : children) {
String childPath = zk... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
void stopRebalancingTimer() {
if (_rebalanceTimer != null) {
_rebalanceTimer.cancel();
_rebalanceTimer = null;
}
_timerPeriod = Integer.MAX_VALUE;
}
#location 6
#vulnerability type THREAD_... | #fixed code
void startRebalancingTimer(long period, HelixManager manager) {
if (period != _timerPeriod) {
logger.info("Controller starting timer at period " + period);
if (_rebalanceTimer != null) {
_rebalanceTimer.cancel();
}
_rebalanceTimer = new Timer... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
protected void handleNewSession()
{
boolean isConnected = _zkClient.waitUntilConnected(CONNECTIONTIMEOUT, TimeUnit.MILLISECONDS);
while (!isConnected)
{
logger.error("Could NOT connect to zk server in " + CONNECTIONTIMEOUT + "ms. zkServer: "
... | #fixed code
protected void handleNewSession()
{
boolean isConnected = _zkClient.waitUntilConnected(CONNECTIONTIMEOUT, TimeUnit.MILLISECONDS);
while (!isConnected)
{
logger.error("Could NOT connect to zk server in " + CONNECTIONTIMEOUT + "ms. zkServer: "
+ _zkC... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private BestPossibleStateOutput compute(ClusterEvent event, Map<String, Resource> resourceMap,
CurrentStateOutput currentStateOutput) {
ClusterDataCache cache = event.getAttribute(AttributeName.ClusterDataCache.name());
BestPossibleStateOutput output = new B... | #fixed code
private BestPossibleStateOutput compute(ClusterEvent event, Map<String, Resource> resourceMap,
CurrentStateOutput currentStateOutput) {
ClusterDataCache cache = event.getAttribute(AttributeName.ClusterDataCache.name());
BestPossibleStateOutput output = new BestPos... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
void createClient() throws Exception {
final RealmAwareZkClient newClient = createSingleRealmZkClient();
synchronized (this) {
if (_zkclient != null) {
_zkclient.close();
}
_zkclient = newClient;
_baseDataAccessor = createBaseData... | #fixed code
void checkConnected() {
checkConnected(-1);
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void setInfo(String partitionName, String info) {
Map<String, Map<String, String>> mapFields = _record.getMapFields();
if (mapFields.get(partitionName) == null) {
mapFields.put(partitionName, new TreeMap<String, String>());
}
mapFields.get(par... | #fixed code
public void setInfo(String partitionName, String info) {
setProperty(partitionName, CurrentStateProperty.INFO, info);
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public Object deserialize(byte[] bytes) throws ZkMarshallingError {
if (bytes == null || bytes.length == 0) {
LOG.error("ZNode is empty.");
return null;
}
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
ZNRecord record... | #fixed code
@Override
public Object deserialize(byte[] bytes) throws ZkMarshallingError {
if (bytes == null || bytes.length == 0) {
LOG.error("ZNode is empty.");
return null;
}
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
ZNRecord record = nu... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public boolean waitForKeeperState(KeeperState keeperState, long time, TimeUnit timeUnit)
throws ZkInterruptedException {
if (_zookeeperEventThread != null && Thread.currentThread() == _zookeeperEventThread) {
throw new IllegalArgumentException("Must not be... | #fixed code
public boolean waitForKeeperState(KeeperState keeperState, long time, TimeUnit timeUnit)
throws ZkInterruptedException {
validateCurrentThread();
Date timeout = new Date(System.currentTimeMillis() + timeUnit.toMillis(time));
LOG.debug("Waiting for keeper stat... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void onControllerChange(NotificationContext changeContext) {
logger.info("START: GenericClusterController.onControllerChange() for cluster " + _clusterName);
_cache.requireFullRefresh();
if (changeContext != null && changeContext.getType() =... | #fixed code
@Override
public void onControllerChange(NotificationContext changeContext) {
logger.info("START: GenericClusterController.onControllerChange() for cluster " + _clusterName);
_cache.requireFullRefresh();
_taskCache.requireFullRefresh();
if (changeContext != nu... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testInvocation() throws Exception
{
System.out.println("TestCMTaskHandler.testInvocation()");
Message message = new Message(MessageType.STATE_TRANSITION);
message.setSrcName("cm-instance-0");
message.setTgtSessionId("1234");
messa... | #fixed code
@Test
public void testInvocation() throws Exception
{
System.out.println("TestCMTaskHandler.testInvocation()");
Message message = new Message(MessageType.STATE_TRANSITION);
message.setSrcName("cm-instance-0");
message.setTgtSessionId("1234");
message.set... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
void checkRebalancingTimer(HelixManager manager, List<IdealState> idealStates) {
if (manager.getConfigAccessor() == null) {
logger.warn(manager.getInstanceName()
+ " config accessor doesn't exist. should be in file-based mode.");
return;
}
... | #fixed code
void startRebalancingTimer(long period, HelixManager manager) {
if (period != _timerPeriod) {
logger.info("Controller starting timer at period " + period);
if (_rebalanceTimer != null) {
_rebalanceTimer.cancel();
}
_rebalanceTimer = new Timer... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void execute(final ClusterEvent event) throws Exception {
_eventId = event.getEventId();
HelixManager manager = event.getAttribute(AttributeName.helixmanager.name());
Map<String, Resource> resourceMap = event.getAttribute(AttributeName.RESOU... | #fixed code
@Override
public void execute(final ClusterEvent event) throws Exception {
_eventId = event.getEventId();
HelixManager manager = event.getAttribute(AttributeName.helixmanager.name());
Map<String, Resource> resourceMap = event.getAttribute(AttributeName.RESOURCES.n... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test(groups = { "unitTest" })
public void testStaticFileCM()
{
final String clusterName = "TestSTaticFileCM";
final String controllerName = "controller_0";
ClusterView view;
String[] illegalNodesInfo = {"localhost_8900", "localhost_8901"};
Li... | #fixed code
@Test(groups = { "unitTest" })
public void testStaticFileCM()
{
final String clusterName = "TestSTaticFileCM";
final String controllerName = "controller_0";
ClusterView view;
String[] illegalNodesInfo = {"localhost_8900", "localhost_8901"};
List<DBP... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void process(ClusterEvent event) throws Exception
{
ClusterDataCache cache = event.getAttribute("ClusterDataCache");
Map<String, IdealState> idealStates = cache.getIdealStates();
Map<String, ResourceGroup> resourceGroupMap = new LinkedHas... | #fixed code
@Override
public void process(ClusterEvent event) throws Exception
{
ClusterDataCache cache = event.getAttribute("ClusterDataCache");
if (cache == null)
{
throw new StageException("Missing attributes in event:" + event
+ ". Requires DataCache");
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void onExternalViewChange(ExternalView externalView, IdealState idealState) {
try {
String resourceName = externalView.getId();
if (!_resourceMbeanMap.containsKey(resourceName)) {
synchronized (this) {
if (!_resourceMbeanMap.contai... | #fixed code
public void onExternalViewChange(ExternalView externalView, IdealState idealState) {
try {
String resourceName = externalView.getId();
if (!_resourceMbeanMap.containsKey(resourceName)) {
synchronized (this) {
if (!_resourceMbeanMap.containsKey(... | 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.