output stringlengths 64 73.2k | input stringlengths 208 73.3k | instruction stringclasses 1
value |
|---|---|---|
#fixed code
public Class toClass()
throws CannotCompileException
{
return toClass(Thread.currentThread().getContextClassLoader());
} | #vulnerable code
public Class toClass()
throws NotFoundException, IOException, CannotCompileException
{
return getClassPool().toClass(this);
}
#location 4
#vulnerability type NULL_DEREFERENCE | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
protected CtField fieldAccess(ASTree expr) throws CompileError {
CtField f = null;
boolean is_static = false;
if (expr instanceof Member) {
String name = ((Member)expr).get();
try {
f = thisClass.getField(name);
... | #vulnerable code
protected CtField fieldAccess(ASTree expr) throws CompileError {
CtField f = null;
boolean is_static = false;
if (expr instanceof Member) {
String name = ((Member)expr).get();
try {
f = thisClass.getField(n... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private String getUrlContents(String urlString) throws Exception {
System.setProperty ("jsse.enableSNIExtension", "false");
URL url = new URL(urlString);
URLConnection urlc = url.openConnection();
urlc.setRequestProperty("Accept", "application/json, */*");
... | #vulnerable code
private String getUrlContents(String urlString) throws Exception {
System.setProperty ("jsse.enableSNIExtension", "false");
URL url = new URL(urlString);
BufferedReader in = new BufferedReader(
new InputStreamReader(url.openStream()));
String inputL... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testParsingErrorPositionLargeInput() throws IOException {
// 2048 is the buffer size, this will allow us to test position
// information for large input that needs to be buffered
char[] in = new char[2048 + 7];
in[0] = '[';
for (int i = 1; i < 2046; ... | #vulnerable code
@Test
public void testParsingErrorPositionLargeInput() throws IOException {
// 2048 is the buffer size, this will allow us to test position
// information for large input that needs to be buffered
char[] in = new char[2048 + 7];
in[0] = '[';
for (int i = 1; i < ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test public void testIllegalReadObjectInstedOfArray() throws IOException {
String src = "[1,2]";
JsonReader reader = new JsonReader(new StringReader(src));
try {
reader.beginObject();
fail();
} catch (IllegalStateException ise) {}
reader.close();
} | #vulnerable code
@Test public void testIllegalReadObjectInstedOfArray() throws IOException {
String src = "[1,2]";
JsonReader reader = new JsonReader(new StringReader(src));
try {
reader.beginObject();
fail();
} catch (IllegalStateException ise) {}
}
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testReadMalformedJson() throws IOException {
String src = "";
JsonReader reader = new JsonReader(new StringReader(src), strictDoubleParse, readMetadata);
try {
reader.beginObject();
fail();
} catch (JsonStreamException ise) {
}
reader.close()... | #vulnerable code
@Test
public void testReadMalformedJson() throws IOException {
String src = "";
JsonReader reader = new JsonReader(new StringReader(src), strictDoubleParse, readMetadata);
try {
reader.beginObject();
fail();
} catch (IllegalStateException ise) {
}
reader... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public <T> String serialize(T o) throws TransformationException, IOException {
StringWriter sw = new StringWriter();
ObjectWriter writer = createWriter(sw);
if (o == null)
nullConverter.serialize(null, writer, null);
else
serialize(o, o.getClass(), writer, new Cont... | #vulnerable code
public <T> String serialize(T o) throws TransformationException, IOException {
JsonWriter writer = new JsonWriter(new StringWriter(), skipNull, htmlSafe);
if (o == null)
nullConverter.serialize(null, writer, null);
else
serialize(o, o.getClass(), writer, new Co... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testIllegalReadObjectInstedOfArray() throws IOException {
String src = "[1,2]";
JsonReader reader = new JsonReader(new StringReader(src), strictDoubleParse, readMetadata);
try {
reader.beginObject();
fail();
} catch (JsonStreamException ise) {
... | #vulnerable code
@Test
public void testIllegalReadObjectInstedOfArray() throws IOException {
String src = "[1,2]";
JsonReader reader = new JsonReader(new StringReader(src), strictDoubleParse, readMetadata);
try {
reader.beginObject();
fail();
} catch (IllegalStateException i... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public boolean valueAsBoolean() throws IOException {
if (BOOLEAN == valueType) {
return _booleanValue;
}
if (STRING == valueType)
return Boolean.parseBoolean(_stringValue);
if (NULL == valueType) return false;
throw new IllegalStateException("Readen value is not ... | #vulnerable code
public boolean valueAsBoolean() throws IOException {
if (BOOLEAN == valueType) {
return _booleanValue;
}
if (STRING == valueType)
return "".equals(_stringValue) ? null : Boolean.valueOf(_stringValue);
if (NULL == valueType) return false;
throw new IllegalSt... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private final void newMisplacedTokenException(int cursor) {
if (_buflen < 0)
throw new IllegalStateException(
"Incomplete data or malformed json : encoutered end of stream.");
if (cursor < 0) cursor = 0;
int pos = _position - (_buflen - cursor);
if (pos < 0) pos... | #vulnerable code
private final void newMisplacedTokenException(int cursor) {
if (_buflen < 0)
throw new IllegalStateException(
"Incomplete data or malformed json : encoutered end of stream.");
if (cursor < 0) cursor = 0;
int pos = (_position - valueAsString().length() - _buf... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public <T> String serialize(T o, Class<? extends BeanView<?>>... withViews)
throws TransformationException, IOException {
StringWriter sw = new StringWriter();
ObjectWriter writer = createWriter(sw);
if (o == null)
nullConverter.serialize(null, writer, null);
else
... | #vulnerable code
public <T> String serialize(T o, Class<? extends BeanView<?>>... withViews)
throws TransformationException, IOException {
JsonWriter writer = new JsonWriter(new StringWriter(), skipNull, htmlSafe);
if (o == null)
nullConverter.serialize(null, writer, null);
els... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private final void newWrongTokenException(String awaited, int cursor) {
// otherwise it fails when an error occurs on first character
if (cursor < 0) cursor = 0;
int pos = _position - (_buflen - cursor);
if (pos < 0) pos = 0;
if (_buflen < 0)
throw new IllegalState... | #vulnerable code
private final void newWrongTokenException(String awaited, int cursor) {
// otherwise it fails when an error occurs on first character
if (cursor < 0) cursor = 0;
int pos = (_position - valueAsString().length() - _buflen + cursor);
if (pos < 0) pos = 0;
if (_bufl... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test public void testIncompleteSource() throws IOException {
String src = "[1,";
JsonReader reader = new JsonReader(new StringReader(src));
try {
reader.beginArray();
reader.next();
reader.next();
fail();
} catch (IOException ioe) {}
reader.close();
} | #vulnerable code
@Test public void testIncompleteSource() throws IOException {
String src = "[1,";
JsonReader reader = new JsonReader(new StringReader(src));
try {
reader.beginArray();
reader.next();
reader.next();
fail();
} catch (IOException ioe) {}
}
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void run(Bootstrap bootstrap, Namespace args) {
// read and initialize arguments:
GraphHopperConfig graphHopperConfiguration = new GraphHopperConfig();
graphHopperConfiguration.setProfiles(Collections.singletonList(new ProfileConfi... | #vulnerable code
@Override
public void run(Bootstrap bootstrap, Namespace args) {
// read and initialize arguments:
GraphHopperConfig graphHopperConfiguration = new GraphHopperConfig();
graphHopperConfiguration.putObject("graph.location", "graph-cache");
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void run(Bootstrap bootstrap, Namespace args) {
// read and initialize arguments:
CmdArgs graphHopperConfiguration = new CmdArgs();
graphHopperConfiguration.put("graph.location", "graph-cache");
seed = args.getLong("seed");... | #vulnerable code
@Override
public void run(Bootstrap bootstrap, Namespace args) {
// read and initialize arguments:
CmdArgs graphHopperConfiguration = new CmdArgs();
graphHopperConfiguration.put("graph.location", "graph-cache");
seed = args.getLong("s... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void run(Bootstrap bootstrap, Namespace args) {
// read and initialize arguments:
GraphHopperConfig graphHopperConfiguration = new GraphHopperConfig();
graphHopperConfiguration.setProfiles(Collections.singletonList(new ProfileConfi... | #vulnerable code
@Override
public void run(Bootstrap bootstrap, Namespace args) {
// read and initialize arguments:
GraphHopperConfig graphHopperConfiguration = new GraphHopperConfig();
graphHopperConfiguration.putObject("graph.location", "graph-cache");
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void run(Bootstrap bootstrap, Namespace args) {
// read and initialize arguments:
CmdArgs graphHopperConfiguration = new CmdArgs();
graphHopperConfiguration.put("graph.location", "graph-cache");
seed = args.getLong("seed");... | #vulnerable code
@Override
public void run(Bootstrap bootstrap, Namespace args) {
// read and initialize arguments:
CmdArgs graphHopperConfiguration = new CmdArgs();
graphHopperConfiguration.put("graph.location", "graph-cache");
seed = args.getLong("s... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testEvaluate() throws IOException {
{
List<String> ftvec1 = Arrays.asList("bbb:1.4", "aaa:0.9", "ccc");
Assert.assertEquals(1.f, CosineSimilarityUDF.cosineSimilarity(ftvec1, ftvec1), 0.0);
}
Assert.assertE... | #vulnerable code
@Test
public void testEvaluate() {
CosineSimilarityUDF cosine = new CosineSimilarityUDF();
{
List<String> ftvec1 = Arrays.asList("bbb:1.4", "aaa:0.9", "ccc");
Assert.assertEquals(1.f, cosine.evaluate(ftvec1, ftvec1).get(), 0.... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private static int evalPredict(DecisionTree tree, double[] x) throws HiveException, IOException {
String script = tree.predictCodegen();
System.out.println(script);
TreePredictByJavascriptUDF udf = new TreePredictByJavascriptUDF();
udf.initiali... | #vulnerable code
private static int evalPredict(DecisionTree tree, double[] x) throws HiveException, IOException {
String script = tree.predictCodegen();
System.out.println(script);
TreePredictTrustedUDF udf = new TreePredictTrustedUDF();
udf.initialize(n... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private static long loadPredictionModel(PredictionModel model, File file, PrimitiveObjectInspector featureOI, WritableFloatObjectInspector weightOI, WritableFloatObjectInspector covarOI)
throws IOException, SerDeException {
long count = 0L;
if(!fil... | #vulnerable code
private static long loadPredictionModel(PredictionModel model, File file, PrimitiveObjectInspector featureOI, WritableFloatObjectInspector weightOI, WritableFloatObjectInspector covarOI)
throws IOException, SerDeException {
long count = 0L;
i... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private boolean executeOperation(Operation currentOperation) throws VMRuntimeException {
if(IP < 0) {
return false;
}
switch (currentOperation.op) {
case GOTO: {
if(isInt(currentOperation.operand)) {
... | #vulnerable code
private boolean executeOperation(Operation currentOperation) throws VMRuntimeException {
if(IP < 0)
return false;
switch (currentOperation.op) {
case GOTO:
if(isInt(currentOperation.operand))
IP... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Nonnull
public byte[] predictSerCodegen(boolean compress) throws HiveException {
try {
if (compress) {
return ObjectUtils.toCompressedBytes(_root);
} else {
return ObjectUtils.toBytes(_root);
}
... | #vulnerable code
@Nonnull
public byte[] predictSerCodegen(boolean compress) throws HiveException {
final Attribute[] attrs = _attributes;
assert (attrs != null);
FastMultiByteArrayOutputStream bos = new FastMultiByteArrayOutputStream();
OutputStream ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Nonnull
public byte[] predictSerCodegen(boolean compress) throws HiveException {
try {
if (compress) {
return ObjectUtils.toCompressedBytes(_root);
} else {
return ObjectUtils.toBytes(_root);
}
... | #vulnerable code
@Nonnull
public byte[] predictSerCodegen(boolean compress) throws HiveException {
final Attribute[] attrs = _attributes;
assert (attrs != null);
FastMultiByteArrayOutputStream bos = new FastMultiByteArrayOutputStream();
OutputStream ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static <T> T readObject(@Nonnull final byte[] obj) throws IOException,
ClassNotFoundException {
return readObject(obj, obj.length);
} | #vulnerable code
public static <T> T readObject(@Nonnull final byte[] obj) throws IOException,
ClassNotFoundException {
return readObject(new FastByteArrayInputStream(obj));
}
#location 3
#vulnerability ty... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private long loadPredictionModel(Map<Object, PredictionModel> label2model, File file, PrimitiveObjectInspector labelOI, PrimitiveObjectInspector featureOI, WritableFloatObjectInspector weightOI)
throws IOException, SerDeException {
long count = 0L;
... | #vulnerable code
private long loadPredictionModel(Map<Object, PredictionModel> label2model, File file, PrimitiveObjectInspector labelOI, PrimitiveObjectInspector featureOI, WritableFloatObjectInspector weightOI)
throws IOException, SerDeException {
long count = 0L;
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void test2() {
List<String> ftvec1 = Arrays.asList("1:1.0", "2:3.0", "3:3.0");
List<String> ftvec2 = Arrays.asList("1:2.0", "3:6.0");
double d = EuclidDistanceUDF.euclidDistance(ftvec1, ftvec2);
Assert.assertEquals(Math.sqrt(1.... | #vulnerable code
@Test
public void test2() {
EuclidDistanceUDF udf = new EuclidDistanceUDF();
List<String> ftvec1 = Arrays.asList("1:1.0", "2:3.0", "3:3.0");
List<String> ftvec2 = Arrays.asList("1:2.0", "3:6.0");
FloatWritable d = udf.evaluate(ftvec1,... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private static double evalPredict(RegressionTree tree, double[] x) throws HiveException,
IOException {
TreePredictByStackMachineUDF udf = new TreePredictByStackMachineUDF();
String opScript = tree.predictOpCodegen(StackMachine.SEP);
debugPr... | #vulnerable code
private static double evalPredict(RegressionTree tree, double[] x) throws HiveException,
IOException {
String opScript = tree.predictOpCodegen(StackMachine.SEP);
debugPrint(opScript);
DoubleWritable result = (DoubleWritable) TreePredi... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static Node deserializeNode(final byte[] serializedObj, final int length,
final boolean compressed) throws HiveException {
final Node root = new Node();
try {
if (compressed) {
ObjectUtils.readCompressedObject(ser... | #vulnerable code
public static Node deserializeNode(final byte[] serializedObj, final int length,
final boolean compressed) throws HiveException {
FastByteArrayInputStream bis = new FastByteArrayInputStream(serializedObj, length);
InputStream wrapped = compre... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private static int evalPredict(DecisionTree tree, double[] x) throws HiveException, IOException {
ArrayList<String> opScript = tree.predictOpCodegen();
System.out.println(opScript);
TreePredictByStackMachineUDF udf = new TreePredictByStackMachineUDF();... | #vulnerable code
private static int evalPredict(DecisionTree tree, double[] x) throws HiveException, IOException {
ArrayList<String> opScript = tree.predictOpCodegen();
System.out.println(opScript);
VMTreePredictTrustedUDF udf = new VMTreePredictTrustedUDF();
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Nonnull
public byte[] predictSerCodegen(boolean compress) throws HiveException {
try {
if (compress) {
return ObjectUtils.toCompressedBytes(_root);
} else {
return ObjectUtils.toBytes(_root);
}
... | #vulnerable code
@Nonnull
public byte[] predictSerCodegen(boolean compress) throws HiveException {
FastMultiByteArrayOutputStream bos = new FastMultiByteArrayOutputStream();
OutputStream wrapped = compress ? new DeflaterOutputStream(bos) : bos;
ObjectOutputSt... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Nonnull
public byte[] predictSerCodegen(boolean compress) throws HiveException {
try {
if (compress) {
return ObjectUtils.toCompressedBytes(_root);
} else {
return ObjectUtils.toBytes(_root);
}
... | #vulnerable code
@Nonnull
public byte[] predictSerCodegen(boolean compress) throws HiveException {
FastMultiByteArrayOutputStream bos = new FastMultiByteArrayOutputStream();
OutputStream wrapped = compress ? new DeflaterOutputStream(bos) : bos;
ObjectOutputSt... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testEvaluate() throws IOException {
CosineSimilarityUDF cosine = new CosineSimilarityUDF();
{
List<String> ftvec1 = Arrays.asList("bbb:1.4", "aaa:0.9", "ccc");
Assert.assertEquals(1.f, cosine.evaluate(ftvec1, ftve... | #vulnerable code
@Test
public void testEvaluate() {
CosineSimilarityUDF cosine = new CosineSimilarityUDF();
{
List<String> ftvec1 = Arrays.asList("bbb:1.4", "aaa:0.9", "ccc");
Assert.assertEquals(1.f, cosine.evaluate(ftvec1, ftvec1).get(), 0.... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public float getCovariance(float scale) {
return 1.f / (sum_inv_covar * scale);
} | #vulnerable code
@Override
public float getCovariance(float scale) {
assert (num_updates > 0) : num_updates;
return (sum_inv_covar * scale) * num_updates; // Harmonic mean
}
#location 3
#vulnerability type... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static Node deserializeNode(final byte[] serializedObj, final int length,
final boolean compressed) throws HiveException {
final Node root = new Node();
try {
if (compressed) {
ObjectUtils.readCompressedObject(ser... | #vulnerable code
public static Node deserializeNode(final byte[] serializedObj, final int length,
final boolean compressed) throws HiveException {
FastByteArrayInputStream bis = new FastByteArrayInputStream(serializedObj, length);
InputStream wrapped = compre... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private static int evalPredict(RegressionTree tree, double[] x) throws HiveException,
IOException {
ArrayList<String> opScript = tree.predictOpCodegen();
System.out.println(opScript);
TreePredictByStackMachineUDF udf = new TreePredictByStac... | #vulnerable code
private static int evalPredict(RegressionTree tree, double[] x) throws HiveException,
IOException {
ArrayList<String> opScript = tree.predictOpCodegen();
System.out.println(opScript);
VMTreePredictTrustedUDF udf = new VMTreePredictTru... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static Node deserializeNode(final byte[] serializedObj, final int length,
final boolean compressed) throws HiveException {
final Node root = new Node();
try {
if (compressed) {
ObjectUtils.readCompressedObject(ser... | #vulnerable code
public static Node deserializeNode(final byte[] serializedObj, final int length,
final boolean compressed) throws HiveException {
FastByteArrayInputStream bis = new FastByteArrayInputStream(serializedObj, length);
InputStream wrapped = compre... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Nonnull
public static FinishableOutputStream createOutputStream(@Nonnull final OutputStream out,
@Nonnull final CompressionAlgorithm algo) {
return createOutputStream(out, algo, DEFAULT_COMPRESSION_LEVEL);
} | #vulnerable code
@Nonnull
public static FinishableOutputStream createOutputStream(@Nonnull final OutputStream out,
@Nonnull final CompressionAlgorithm algo) {
switch (algo) {
case deflate: {
final DeflaterOutputStream deflate = new Def... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private static int evalPredict(DecisionTree tree, double[] x) throws HiveException, IOException {
TreePredictByStackMachineUDF udf = new TreePredictByStackMachineUDF();
String opScript = tree.predictOpCodegen(StackMachine.SEP);
debugPrint(opScript);
... | #vulnerable code
private static int evalPredict(DecisionTree tree, double[] x) throws HiveException, IOException {
String opScript = tree.predictOpCodegen(StackMachine.SEP);
debugPrint(opScript);
IntWritable result = (IntWritable) TreePredictByStackMachineUDF.eva... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void test1() {
List<String> ftvec1 = Arrays.asList("1:1.0", "2:2.0", "3:3.0");
List<String> ftvec2 = Arrays.asList("1:2.0", "2:4.0", "3:6.0");
double d = EuclidDistanceUDF.euclidDistance(ftvec1, ftvec2);
Assert.assertEquals(Mat... | #vulnerable code
@Test
public void test1() {
EuclidDistanceUDF udf = new EuclidDistanceUDF();
List<String> ftvec1 = Arrays.asList("1:1.0", "2:2.0", "3:3.0");
List<String> ftvec2 = Arrays.asList("1:2.0", "2:4.0", "3:6.0");
FloatWritable d = udf.evaluat... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static Node deserializeNode(final byte[] serializedObj, final int length,
final boolean compressed) throws HiveException {
final Node root = new Node();
try {
if (compressed) {
ObjectUtils.readCompressedObject(ser... | #vulnerable code
public static Node deserializeNode(final byte[] serializedObj, final int length,
final boolean compressed) throws HiveException {
FastByteArrayInputStream bis = new FastByteArrayInputStream(serializedObj, length);
InputStream wrapped = compre... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static Node deserializeNode(final byte[] serializedObj, final int length,
final boolean compressed) throws HiveException {
final Node root = new Node();
try {
if (compressed) {
ObjectUtils.readCompressedObject(ser... | #vulnerable code
public static Node deserializeNode(final byte[] serializedObj, final int length,
final boolean compressed) throws HiveException {
FastByteArrayInputStream bis = new FastByteArrayInputStream(serializedObj, length);
InputStream wrapped = compre... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private static void loadValues(OpenHashMap<Object, Object> map, File file, PrimitiveObjectInspector keyOI, PrimitiveObjectInspector valueOI)
throws IOException, SerDeException {
if(!file.exists()) {
return;
}
if(!file.getName().... | #vulnerable code
private static void loadValues(OpenHashMap<Object, Object> map, File file, PrimitiveObjectInspector keyOI, PrimitiveObjectInspector valueOI)
throws IOException, SerDeException {
if(!file.exists()) {
return;
}
if(!file.getN... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private static int evalPredict(DecisionTree tree, double[] x) throws HiveException, IOException {
String opScript = tree.predictOpCodegen(StackMachine.SEP);
debugPrint(opScript);
IntWritable result = (IntWritable) TreePredictByStackMachineUDF.evaluate(... | #vulnerable code
private static int evalPredict(DecisionTree tree, double[] x) throws HiveException, IOException {
ArrayList<String> opScript = tree.predictOpCodegen();
debugPrint(opScript);
TreePredictByStackMachineUDF udf = new TreePredictByStackMachineUDF();
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public float getCovariance(float scale) {
return 1.f / (sum_inv_covar * scale);
} | #vulnerable code
@Override
public float getCovariance(float scale) {
assert (num_updates > 0) : num_updates;
return (sum_inv_covar * scale) * num_updates; // Harmonic mean
}
#location 4
#vulnerability type... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static Node deserializeNode(final byte[] serializedObj, final int length,
final boolean compressed) throws HiveException {
final Node root = new Node();
try {
if (compressed) {
ObjectUtils.readCompressedObject(ser... | #vulnerable code
public static Node deserializeNode(final byte[] serializedObj, final int length,
final boolean compressed) throws HiveException {
FastByteArrayInputStream bis = new FastByteArrayInputStream(serializedObj, length);
InputStream wrapped = compre... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Nonnull
public byte[] predictSerCodegen(boolean compress) throws HiveException {
try {
if (compress) {
return ObjectUtils.toCompressedBytes(_root);
} else {
return ObjectUtils.toBytes(_root);
}
... | #vulnerable code
@Nonnull
public byte[] predictSerCodegen(boolean compress) throws HiveException {
FastMultiByteArrayOutputStream bos = new FastMultiByteArrayOutputStream();
OutputStream wrapped = compress ? new DeflaterOutputStream(bos) : bos;
ObjectOutputSt... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private static long loadPredictionModel(PredictionModel model, File file, PrimitiveObjectInspector keyOI, WritableFloatObjectInspector valueOI)
throws IOException, SerDeException {
long count = 0L;
if(!file.exists()) {
return count;
... | #vulnerable code
private static long loadPredictionModel(PredictionModel model, File file, PrimitiveObjectInspector keyOI, WritableFloatObjectInspector valueOI)
throws IOException, SerDeException {
long count = 0L;
if(!file.exists()) {
return coun... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static Node deserializeNode(final byte[] serializedObj, final int length,
final boolean compressed) throws HiveException {
final Node root = new Node();
try {
if (compressed) {
ObjectUtils.readCompressedObject(ser... | #vulnerable code
public static Node deserializeNode(final byte[] serializedObj, final int length,
final boolean compressed) throws HiveException {
FastByteArrayInputStream bis = new FastByteArrayInputStream(serializedObj, length);
InputStream wrapped = compre... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static Node deserializeNode(final byte[] serializedObj, final int length,
final boolean compressed) throws HiveException {
final Node root = new Node();
try {
if (compressed) {
ObjectUtils.readCompressedObject(ser... | #vulnerable code
public static Node deserializeNode(final byte[] serializedObj, final int length,
final boolean compressed) throws HiveException {
FastByteArrayInputStream bis = new FastByteArrayInputStream(serializedObj, length);
InputStream wrapped = compre... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public BinaryData download( String resourceId )
throws ResourcesException
{
String resourcePath = getResourcePath( resourceId );
File file = new File( getRootFolder(), resourcePath );
try
{
FileInputStream input = new FileI... | #vulnerable code
public BinaryData download( String resourceId )
throws ResourcesException
{
String resourcePath = getResourcePath( resourceId );
File file = new File( getRootFolder(), resourcePath );
try
{
FileInputStream input = new... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static void main(String[] args) throws Exception {
String fileIn = null;
String fileOut = null;
String templateEngineKind = null;
String jsonData = null;
String jsonFile = null;
String metadataFile = null;
boolean autoGenData = false;
IDataProvider dataP... | #vulnerable code
public static void main(String[] args) throws Exception {
String fileIn = null;
String fileOut = null;
String templateEngineKind = null;
String jsonData = null;
String jsonFile = null;
IPopulateContextAware contextAware = null;
String arg = null;
for (int... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testBoldWithB()
throws Exception
{
IContext context = new MockContext();
BufferedElement parent = null;
ITextStylingTransformer formatter = HTMLTextStylingTransformer.INSTANCE;
IDocumentHandler handler = new D... | #vulnerable code
@Test
public void testBoldWithB()
throws Exception
{
IContext context = null;
BufferedElement parent = null;
ITextStylingTransformer formatter = HTMLTextStylingTransformer.INSTANCE;
IDocumentHandler handler = new DocxDocu... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void process() {
Collection<BufferedElement> toRemove = new ArrayList<BufferedElement>();
int size = arBufferedRegions.size();
String s = null;
StringBuilder fullContent = new StringBuilder();
boolean fieldFound = false;
ARBufferedRegion currentAR = null;
AR... | #vulnerable code
public void process() {
Collection<BufferedElement> toRemove = new ArrayList<BufferedElement>();
int size = arBufferedRegions.size();
String s = null;
StringBuilder fullContent = new StringBuilder();
boolean fieldFound = false;
ARBufferedRegion currentAR = nul... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void processReportWithOptions()
throws IOException
{
WebClient client = WebClient.create( BASE_ADDRESS );
client.path( "processReport" );
client.accept( MediaType.APPLICATION_XML );
ReportAndDataRepresentation rep... | #vulnerable code
@Test
public void processReportWithOptions()
throws IOException
{
WebClient client = WebClient.create( BASE_ADDRESS );
client.path( "processReport" );
client.accept( MediaType.APPLICATION_XML );
ReportAndDataRepresentati... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private static void processUpload( ResourcesService client, String resources, String out )
throws IOException, ResourcesException
{
if ( StringUtils.isEmpty( resources ) )
{
throw new IOException( "resources must be not empty" );
... | #vulnerable code
private static void processUpload( ResourcesService client, String resources, String out )
throws IOException, ResourcesException
{
if ( StringUtils.isEmpty( resources ) )
{
throw new IOException( "resources must be not empty" );
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void applyStyles( Style style )
{
this.lastStyleApplied = style;
StyleTableProperties tableProperties = style.getTableProperties();
if ( tableProperties != null )
{
// width
if ( tableProperties.getWidth() !=... | #vulnerable code
public void applyStyles( Style style )
{
this.lastStyleApplied = style;
// width
StyleTableProperties tableProperties = style.getTableProperties();
if ( tableProperties != null )
{
if ( tableProperties.getWidth() ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void loadPNGWithoutUsingImageSizeAndForceWidth()
throws Exception
{
IImageProvider imageProvider =
new FileImageProvider( new File( "src/test/resources/fr/opensagres/xdocreport/document/images/logo.png" ) );
imageProvid... | #vulnerable code
@Test
public void loadPNGWithoutUsingImageSizeAndForceWidth()
throws Exception
{
IImageProvider imageProvider =
new FileImageProvider( new File( "src/test/resources/fr/opensagres/xdocreport/document/images/logo.png" ) );
image... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testItalicWithI()
throws Exception
{
IContext context = new MockContext();
BufferedElement parent = null;
ITextStylingTransformer formatter = HTMLTextStylingTransformer.INSTANCE;
IDocumentHandler handler = new... | #vulnerable code
@Test
public void testItalicWithI()
throws Exception
{
IContext context = null;
BufferedElement parent = null;
ITextStylingTransformer formatter = HTMLTextStylingTransformer.INSTANCE;
IDocumentHandler handler = new DocxDo... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private void visitHeadersFooters( IXWPFMasterPage masterPage, CTSectPr sectPr )
throws Exception
{
// see titlePg at http://officeopenxml.com/WPsection.php i
// Specifies whether the section should have a different header and
// footer
... | #vulnerable code
private void visitHeadersFooters( IXWPFMasterPage masterPage, CTSectPr sectPr )
throws Exception
{
// see titlePg at http://officeopenxml.com/WPsection.php i
// Specifies whether the section should have a different header and
// foote... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void visit( StyleColumnElement ele )
{
List<StyleColumnProperties> styleColumnPropertiesList = currentStyle.getColumnPropertiesList();
if ( styleColumnPropertiesList == null )
{
styleColumnPropertiesList = new Array... | #vulnerable code
@Override
public void visit( StyleColumnElement ele )
{
StyleSectionProperties sectionProperties = currentStyle.getSectionProperties();
if ( sectionProperties == null )
{
// style:column outside style:section-properties, ignor... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testBoldWithStrong()
throws Exception
{
IContext context = new MockContext();
BufferedElement parent = null;
ITextStylingTransformer formatter = HTMLTextStylingTransformer.INSTANCE;
IDocumentHandler handler = ... | #vulnerable code
@Test
public void testBoldWithStrong()
throws Exception
{
IContext context = null;
BufferedElement parent = null;
ITextStylingTransformer formatter = HTMLTextStylingTransformer.INSTANCE;
IDocumentHandler handler = new Doc... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void loadPNGWithoutUsingImageSizeAndForceWidth()
throws Exception
{
IImageProvider imageProvider = new ClassPathImageProvider( ClassPathImageProviderTestCase.class, "logo.png" );
imageProvider.setWidth( 100f );
Assert.asser... | #vulnerable code
@Test
public void loadPNGWithoutUsingImageSizeAndForceWidth()
throws Exception
{
IImageProvider imageProvider = new ClassPathImageProvider( ClassPathImageProviderTestCase.class, "logo.png" );
imageProvider.setWidth( 100f );
Assert... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void testItalicWithEm()
throws Exception
{
IContext context = new MockContext();
BufferedElement parent = null;
ITextStylingTransformer formatter = HTMLTextStylingTransformer.INSTANCE;
IDocumentHandler handler = ne... | #vulnerable code
@Test
public void testItalicWithEm()
throws Exception
{
IContext context = null;
BufferedElement parent = null;
ITextStylingTransformer formatter = HTMLTextStylingTransformer.INSTANCE;
IDocumentHandler handler = new DocxD... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void process() {
Collection<BufferedElement> toRemove = new ArrayList<BufferedElement>();
int size = arBufferedRegions.size();
String s = null;
StringBuilder fullContent = new StringBuilder();
boolean fieldFound = false;
ARBufferedRegion currentAR = null;
AR... | #vulnerable code
public void process() {
Collection<BufferedElement> toRemove = new ArrayList<BufferedElement>();
int size = arBufferedRegions.size();
String s = null;
StringBuilder fullContent = new StringBuilder();
boolean fieldFound = false;
ARBufferedRegion currentAR = nul... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static void main(final String[] args) throws Exception {
// Right now we accept one parameter, the number of nodes in the cluster.
final int clusterSize;
if (args.length > 0) {
clusterSize = Integer.parseInt(args[0]);
} else ... | #vulnerable code
public static void main(final String[] args) throws Exception {
// Right now we accept one parameter, the number of nodes in the cluster.
final int clusterSize;
if (args.length > 0) {
clusterSize = Integer.parseInt(args[0]);
}... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public Class<? extends Deserializer> getDeserializerClass(final String jarName, final String classpath) throws LoaderException {
try {
final String absolutePath = getPathForJar(jarName).toString();
final URL jarUrl = new URL("file://" + absolut... | #vulnerable code
public Class<? extends Deserializer> getDeserializerClass(final String jarName, final String classpath) throws LoaderException {
try {
final String absolutePath = getPathForJar(jarName).toString();
final URL jarUrl = new URL("file://" + a... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@RequestMapping(path = "/create", method = RequestMethod.GET)
public String createViewForm(final ViewForm viewForm, final Model model) {
// Setup breadcrumbs
if (!model.containsAttribute("BreadCrumbs")) {
setupBreadCrumbs(model, "Create", null)... | #vulnerable code
@RequestMapping(path = "/create", method = RequestMethod.GET)
public String createViewForm(final ViewForm viewForm, final Model model) {
// Setup breadcrumbs
if (!model.containsAttribute("BreadCrumbs")) {
setupBreadCrumbs(model, "Create",... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void drawTitle(String title, PDFont font, int fontSize, TextType textType) throws IOException {
PDPageContentStream articleTitle = createPdPageContentStream();
articleTitle.beginText();
articleTitle.setFont(font, fontSize);
articleTitle... | #vulnerable code
public void drawTitle(String title, PDFont font, int fontSize, TextType textType) throws IOException {
PDPageContentStream articleTitle = new PDPageContentStream(this.document, this.currentPage, true, true);
articleTitle.beginText();
articleTitl... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void SampleTest2() throws IOException, COSVisitorException {
//Set margins
float margin = 10;
List<String[]> facts = getFacts();
//A list of bookmarks of all the tables
List<PDOutlineItem> bookmarks = new ArrayList<P... | #vulnerable code
@Test
public void SampleTest2() throws IOException, COSVisitorException {
//Set margins
float margin = 10;
List<String[]> facts = getFacts();
//A list of bookmarks of all the tables
List<PDOutlineItem> bookmarks = new Array... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void drawTitle(String title, PDFont font, int fontSize, TextType textType) throws IOException {
PDPageContentStream articleTitle = createPdPageContentStream();
articleTitle.beginText();
articleTitle.setFont(font, fontSize);
articleTitle... | #vulnerable code
public void drawTitle(String title, PDFont font, int fontSize, TextType textType) throws IOException {
PDPageContentStream articleTitle = new PDPageContentStream(this.document, this.currentPage, true, true);
articleTitle.beginText();
articleTitl... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Test
public void Sample1 () throws IOException, COSVisitorException {
//Set margins
float margin = 10;
List<String[]> facts = getFacts();
//Initialize Document
PDDocument doc = new PDDocument();
PDPage page = ad... | #vulnerable code
@Test
public void Sample1 () throws IOException, COSVisitorException {
//Set margins
float margin = 10;
List<String[]> facts = getFacts();
//Initialize Document
PDDocument doc = new PDDocument();
PDPage pag... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public void drawTitle(String title, PDFont font, int fontSize, TextType textType) throws IOException {
PDPageContentStream articleTitle = createPdPageContentStream();
articleTitle.beginText();
articleTitle.setFont(font, fontSize);
articleTitle... | #vulnerable code
public void drawTitle(String title, PDFont font, int fontSize, TextType textType) throws IOException {
PDPageContentStream articleTitle = new PDPageContentStream(this.document, this.currentPage, true, true);
articleTitle.beginText();
articleTitl... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
Optional<Chunk> chunk(InputStream inputStream, ChunkServer.ChunkInfo chunkInfo, int index) throws IOException {
logger.trace("<< chunk() - chunkInfo: {} index: {}", chunkInfo, index);
BoundedInputStream bis = new BoundedInputStream(inputStream, chunkInfo.getC... | #vulnerable code
void store(CipherInputStream is, byte[] checksum) throws IOException {
store.outputStream(checksum)
.<IORunnable>map(u -> () -> {
logger.debug("-- store() - copying chunk into store: 0x{}", Hex.toHexString(checksum));
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
Optional<Map<ChunkReference, Chunk>>
fetch(HttpClient httpClient, ChunkKeyEncryptionKeys keks, Map<Integer, StorageHostChunkList> containers,
Asset asset) {
Map<ChunkReference, Chunk> map = new HashMap<>();
for (Map.Entry<Intege... | #vulnerable code
Optional<List<Chunk>>
assemble(Map<ChunkReference, Chunk> map, List<ChunkReference> references) {
if (map.keySet().containsAll(references)) {
logger.warn("-- assemble() - missing chunks");
return Optional.empty();
}
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
Optional<Map<ChunkReference, Chunk>>
fetch(HttpClient httpClient, ChunkKeyEncryptionKeys keks, Map<Integer, StorageHostChunkList> containers,
Asset asset) {
Map<ChunkReference, Chunk> map = new HashMap<>();
for (Map.Entry<Intege... | #vulnerable code
Optional<Map<ChunkReference, Chunk>>
fetch(HttpClient httpClient, KeyEncryptionKeys keks, Map<Integer, StorageHostChunkList> containers,
Asset asset) {
Map<ChunkReference, Chunk> map = new HashMap<>();
for (Map.Entry<Integ... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
FileGroups adjustExpiryTimestamp(FileGroups fileGroups, Optional<Long> timestampOffset) {
// We adjust the FileGroups timestamps based on machine time/ server time deltas. This allows us to function
// with inaccurate machine clocks.
List<FileChecksum... | #vulnerable code
ChunkServer.StorageHostChunkList adjustExpiryTimestamp(ChunkServer.StorageHostChunkList container, long offset) {
if (!container.getHostInfo().hasExpiry()) {
// Shouldn't happen, can probably remove this check.
logger.warn("-- adjustExpir... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
void download(HttpClient httpClient, List<Asset> assets, Path relativePath) {
if (assets.isEmpty()) {
return;
}
Path outputFolder = folder.resolve(relativePath);
keyBagManager.update(httpClient, assets);
XFileKeyFactory f... | #vulnerable code
void download(HttpClient httpClient, List<Asset> assets, Path relativePath) throws UncheckedIOException {
Path outputFolder = folder.resolve(relativePath);
keyBagManager.update(httpClient, assets);
XFileKeyFactory fileKeys = new XFileKeyFactory... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
Optional<Chunk> chunk(InputStream inputStream, ChunkServer.ChunkInfo chunkInfo, int index) throws IOException {
logger.trace("<< chunk() - chunkInfo: {} index: {}", chunkInfo, index);
BoundedInputStream bis = new BoundedInputStream(inputStream, chunkInfo.getC... | #vulnerable code
Optional<Chunk>
decrypt(BoundedInputStream bis, byte[] chunkEncryptionKey, byte[] checksum, int index) throws IOException {
unwrapKey(chunkEncryptionKey, index)
.map(u -> {
logger.debug("-- decrypt() - key unwrappe... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public static int runCommand(final CCTask task, final File workingDir, final String[] cmdline,
final boolean newEnvironment, final Environment env) throws BuildException {
try {
task.log(Commandline.toString(cmdline), task.getCommandLogLevel());
/* final E... | #vulnerable code
public static int runCommand(final CCTask task, final File workingDir, final String[] cmdline,
final boolean newEnvironment, final Environment env) throws BuildException {
try {
task.log(Commandline.toString(cmdline), task.getCommandLogLevel());
fina... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
public final List/* <AttachedNarArtifact> */getAttachedNarDependencies( List/* <NarArtifacts> */narArtifacts,
AOL archOsLinker, String type )
throws MojoExecutionException, MojoFailureExceptio... | #vulnerable code
public final List/* <AttachedNarArtifact> */getAttachedNarDependencies( List/* <NarArtifacts> */narArtifacts,
AOL archOsLinker, String type )
throws MojoExecutionException, MojoFailureEx... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
private boolean isClang() {
final String command = getCommand();
if (command == null) {
return false;
}
if (command.startsWith("clang")) {
return true;
}
if (!GPP_COMMAND.equals(command)) {
return false;
}
final String[] cmd = {... | #vulnerable code
private boolean isClang() {
final String command = getCommand();
if (command == null) {
return false;
}
if (command.startsWith("clang")) {
return true;
}
if (!GPP_COMMAND.equals(command)) {
return false;
}
final String[] c... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void open(Map stormConf, TopologyContext context,
SpoutOutputCollector collector) {
partitionField = ConfUtils.getString(stormConf,
ESStatusRoutingFieldParamName);
bucketSortField = ConfUtils.getString(stormCo... | #vulnerable code
@Override
public void open(Map stormConf, TopologyContext context,
SpoutOutputCollector collector) {
indexName = ConfUtils.getString(stormConf, ESStatusIndexNameParamName,
"status");
docType = ConfUtils.getString(stormCon... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void onResponse(SearchResponse response) {
long timeTaken = System.currentTimeMillis() - timeStartESQuery;
Aggregations aggregs = response.getAggregations();
SingleBucketAggregation sample = aggregs.get("sample");
if (sam... | #vulnerable code
@Override
public void onResponse(SearchResponse response) {
long timeTaken = System.currentTimeMillis() - timeStartESQuery;
Aggregations aggregs = response.getAggregations();
SingleBucketAggregation sample = aggregs.get("sample");
i... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void execute(Tuple input) {
// triggered by the arrival of a tuple
// be it a tick or normal one
flushQueues();
if (isTickTuple(input)) {
_collector.ack(input);
return;
}
CountMetr... | #vulnerable code
@Override
public void execute(Tuple input) {
// main thread in charge of acking and failing
// see
// https://github.com/nathanmarz/storm/wiki/Troubleshooting#nullpointerexception-from-deep-inside-storm
int acked = 0;
int fa... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void execute(Tuple tuple) {
HashMap<String, String[]> metadata = (HashMap<String, String[]>) tuple
.getValueByField("metadata");
// TODO check that we have the right number of fields ?
String isSitemap = KeyValues.... | #vulnerable code
@Override
public void execute(Tuple tuple) {
HashMap<String, String[]> metadata = (HashMap<String, String[]>) tuple
.getValueByField("metadata");
// TODO check that we have the right number of fields ?
String isBoolean = KeyV... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
protected void populateBuffer() {
// not used yet or returned empty results
if (queryDate == null) {
queryDate = new Date();
lastTimeResetToNOW = Instant.now();
lastStartOffset = 0;
}
// been ru... | #vulnerable code
@Override
protected void populateBuffer() {
// not used yet or returned empty results
if (lastDate == null) {
lastDate = new Date();
lastStartOffset = 0;
}
// been running same query for too long and paging dee... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void execute(Tuple input) {
// triggered by the arrival of a tuple
// be it a tick or normal one
flushQueues();
if (isTickTuple(input)) {
_collector.ack(input);
return;
}
CountMetr... | #vulnerable code
@Override
public void execute(Tuple input) {
// main thread in charge of acking and failing
// see
// https://github.com/nathanmarz/storm/wiki/Troubleshooting#nullpointerexception-from-deep-inside-storm
int acked = 0;
int fa... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void open(Map stormConf, TopologyContext context,
SpoutOutputCollector collector) {
partitionField = ConfUtils.getString(stormConf,
ESStatusRoutingFieldParamName);
bucketSortField = ConfUtils.getString(stormCo... | #vulnerable code
@Override
public void open(Map stormConf, TopologyContext context,
SpoutOutputCollector collector) {
indexName = ConfUtils.getString(stormConf, ESStatusIndexNameParamName,
"status");
docType = ConfUtils.getString(stormCon... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void open(Map stormConf, TopologyContext context,
SpoutOutputCollector collector) {
maxInFlightURLsPerBucket = ConfUtils.getInt(stormConf,
ESStatusMaxInflightParamName, 1);
maxBufferSize = ConfUtils.getInt(stor... | #vulnerable code
@Override
public void open(Map stormConf, TopologyContext context,
SpoutOutputCollector collector) {
indexName = ConfUtils.getString(stormConf, ESStatusIndexNameParamName,
"status");
docType = ConfUtils.getString(stormCon... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void open(Map stormConf, TopologyContext context,
SpoutOutputCollector collector) {
super.open(stormConf, context, collector);
indexName = ConfUtils.getString(stormConf, ESStatusIndexNameParamName,
"status");
... | #vulnerable code
@Override
public void open(Map stormConf, TopologyContext context,
SpoutOutputCollector collector) {
super.open(stormConf, context, collector);
indexName = ConfUtils.getString(stormConf, ESStatusIndexNameParamName,
"stat... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void open(Map stormConf, TopologyContext context,
SpoutOutputCollector collector) {
maxInFlightURLsPerBucket = ConfUtils.getInt(stormConf,
ESStatusMaxInflightParamName, 1);
maxBufferSize = ConfUtils.getInt(stor... | #vulnerable code
@Override
public void open(Map stormConf, TopologyContext context,
SpoutOutputCollector collector) {
indexName = ConfUtils.getString(stormConf, ESStatusIndexNameParamName,
"status");
docType = ConfUtils.getString(stormCon... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void store(String url, Status status, Metadata metadata,
Date nextFetch, Tuple tuple) throws Exception {
String sha256hex = org.apache.commons.codec.digest.DigestUtils
.sha256Hex(url);
// need to synchronize: ... | #vulnerable code
@Override
public void store(String url, Status status, Metadata metadata,
Date nextFetch, Tuple tuple) throws Exception {
String sha256hex = org.apache.commons.codec.digest.DigestUtils
.sha256Hex(url);
// need to synchro... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
protected void populateBuffer() {
if (lastDate == null) {
lastDate = new Date();
}
String formattedLastDate = String.format(DATEFORMAT, lastDate);
LOG.info("{} Populating buffer with nextFetchDate <= {}", logIdprefi... | #vulnerable code
@Override
protected void populateBuffer() {
if (lastDate == null) {
lastDate = String.format(DATEFORMAT, new Date());
}
LOG.info("{} Populating buffer with nextFetchDate <= {}", logIdprefix,
lastDate);
Q... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void open(Map stormConf, TopologyContext context,
SpoutOutputCollector collector) {
maxInFlightURLsPerBucket = ConfUtils.getInt(stormConf,
ESStatusMaxInflightParamName, 1);
maxBufferSize = ConfUtils.getInt(stor... | #vulnerable code
@Override
public void open(Map stormConf, TopologyContext context,
SpoutOutputCollector collector) {
indexName = ConfUtils.getString(stormConf, ESStatusIndexNameParamName,
"status");
docType = ConfUtils.getString(stormCon... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void onResponse(SearchResponse response) {
long timeTaken = System.currentTimeMillis() - timeLastQuery;
Aggregations aggregs = response.getAggregations();
if (aggregs == null) {
isInQuery.set(false);
retur... | #vulnerable code
@Override
public void onResponse(SearchResponse response) {
long timeTaken = System.currentTimeMillis() - timeLastQuery;
Aggregations aggregs = response.getAggregations();
if (aggregs == null) {
isInQuery.set(false);
... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void execute(Tuple input) {
// triggered by the arrival of a tuple
// be it a tick or normal one
flushQueues();
if (isTickTuple(input)) {
_collector.ack(input);
return;
}
CountMetr... | #vulnerable code
@Override
public void execute(Tuple input) {
// main thread in charge of acking and failing
// see
// https://github.com/nathanmarz/storm/wiki/Troubleshooting#nullpointerexception-from-deep-inside-storm
int acked = 0;
int fa... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
protected void populateBuffer() {
// not used yet or returned empty results
if (lastDate == null) {
lastDate = new Date();
lastStartOffset = 0;
}
// been running same query for too long and paging deep?
... | #vulnerable code
@Override
protected void populateBuffer() {
// not used yet or returned empty results
if (lastDate == null) {
lastDate = new Date();
lastStartOffset = 0;
}
// been running same query for too long and paging dee... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void execute(Tuple tuple) {
String url = tuple.getStringByField("url");
// Distinguish the value used for indexing
// from the one used for the status
String normalisedurl = valueForURL(tuple);
LOG.info("Indexing... | #vulnerable code
@Override
public void execute(Tuple tuple) {
String url = tuple.getStringByField("url");
// Distinguish the value used for indexing
// from the one used for the status
String normalisedurl = valueForURL(tuple);
LOG.info("In... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void open(Map stormConf, TopologyContext context,
SpoutOutputCollector collector) {
partitionField = ConfUtils.getString(stormConf,
ESStatusRoutingFieldParamName);
bucketSortField = ConfUtils.getString(stormCo... | #vulnerable code
@Override
public void open(Map stormConf, TopologyContext context,
SpoutOutputCollector collector) {
indexName = ConfUtils.getString(stormConf, ESStatusIndexNameParamName,
"status");
docType = ConfUtils.getString(stormCon... | Below is the vulnerable code, please generate the patch based on the following information. |
#fixed code
@Override
public void open(Map stormConf, TopologyContext context,
SpoutOutputCollector collector) {
maxInFlightURLsPerBucket = ConfUtils.getInt(stormConf,
ESStatusMaxInflightParamName, 1);
maxBufferSize = ConfUtils.getInt(stor... | #vulnerable code
@Override
public void open(Map stormConf, TopologyContext context,
SpoutOutputCollector collector) {
indexName = ConfUtils.getString(stormConf, ESStatusIndexNameParamName,
"status");
docType = ConfUtils.getString(stormCon... | 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.