input
stringlengths
205
73.3k
output
stringlengths
64
73.2k
instruction
stringclasses
1 value
#vulnerable code private long loadPredictionModel(Map<Object, PredictionModel> label2model, File file, PrimitiveObjectInspector labelOI, PrimitiveObjectInspector featureOI, WritableFloatObjectInspector weightOI) throws IOException, SerDeException { long count = 0L; ...
#fixed 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.
#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,...
#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....
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#fixed code private static double evalPredict(RegressionTree tree, double[] x) throws HiveException, IOException { TreePredictByStackMachineUDF udf = new TreePredictByStackMachineUDF(); String opScript = tree.predictOpCodegen(StackMachine.SEP); debugPr...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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(); ...
#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();...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public static void readObject(@Nonnull final byte[] src, @Nonnull final Externalizable dst) throws IOException, ClassNotFoundException { readObject(new FastByteArrayInputStream(src), dst); } #location 3 ...
#fixed code public static void readObject(@Nonnull final byte[] src, @Nonnull final Externalizable dst) throws IOException, ClassNotFoundException { readObject(src, src.length, dst); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Nonnull public byte[] predictSerCodegen(boolean compress) throws HiveException { FastMultiByteArrayOutputStream bos = new FastMultiByteArrayOutputStream(); OutputStream wrapped = compress ? new DeflaterOutputStream(bos) : bos; ObjectOutputSt...
#fixed code @Nonnull public byte[] predictSerCodegen(boolean compress) throws HiveException { try { if (compress) { return ObjectUtils.toCompressedBytes(_root); } else { return ObjectUtils.toBytes(_root); } ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Nonnull public byte[] predictSerCodegen(boolean compress) throws HiveException { FastMultiByteArrayOutputStream bos = new FastMultiByteArrayOutputStream(); OutputStream wrapped = compress ? new DeflaterOutputStream(bos) : bos; ObjectOutputSt...
#fixed code @Nonnull public byte[] predictSerCodegen(boolean compress) throws HiveException { try { if (compress) { return ObjectUtils.toCompressedBytes(_root); } else { return ObjectUtils.toBytes(_root); } ...
Below is the vulnerable code, please generate the patch based on the following information.
#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....
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#fixed code @Override public float getCovariance(float scale) { return 1.f / (sum_inv_covar * scale); }
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public final short getClock() { return totalClock; } #location 2 #vulnerability type UNSAFE_GUARDED_BY_ACCESS
#fixed code public final short getClock() { return globalClock; }
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Nonnull public static FinishableOutputStream createOutputStream(@Nonnull final OutputStream out, @Nonnull final CompressionAlgorithm algo) { switch (algo) { case deflate: { final DeflaterOutputStream deflate = new Def...
#fixed code @Nonnull public static FinishableOutputStream createOutputStream(@Nonnull final OutputStream out, @Nonnull final CompressionAlgorithm algo) { return createOutputStream(out, algo, DEFAULT_COMPRESSION_LEVEL); }
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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); ...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Nonnull public byte[] predictSerCodegen(boolean compress) throws HiveException { final Attribute[] attrs = _attributes; assert (attrs != null); FastMultiByteArrayOutputStream bos = new FastMultiByteArrayOutputStream(); OutputStream ...
#fixed code @Nonnull public byte[] predictSerCodegen(boolean compress) throws HiveException { try { if (compress) { return ObjectUtils.toCompressedBytes(_root); } else { return ObjectUtils.toBytes(_root); } ...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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()....
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void setV(int i, int f, float nextVif) { assert (i >= 1) : i; float[] vi = _V.get(i); vi[f] = nextVif; } #location 5 #vulnerability type NULL_DEREFERENCE
#fixed code @Override public void setV(int i, int f, float nextVif) { assert (i >= 0) : i; float[] vi = _V.get(i); assert (vi != null) : "V[" + i + "] was null"; vi[f] = nextVif; }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private static int evalPredict(DecisionTree tree, double[] x) throws HiveException, IOException { ArrayList<String> opScript = tree.predictOpCodegen(); debugPrint(opScript); TreePredictByStackMachineUDF udf = new TreePredictByStackMachineUDF(); ...
#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(...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#fixed code @Override public float getCovariance(float scale) { return 1.f / (sum_inv_covar * scale); }
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testLargeOpcodes() throws IOException, ParseException, HiveException, VMRuntimeException { URL url = new URL("https://gist.githubusercontent.com/myui/b1a8e588f5750e3b658c/raw/a4074d37400dab2b13a2f43d81f5166188d3461a/vmtest01.txt...
#fixed code @Test public void testLargeOpcodes() throws IOException, ParseException, HiveException, VMRuntimeException { URL url = new URL("https://gist.githubusercontent.com/myui/b1a8e588f5750e3b658c/raw/a4074d37400dab2b13a2f43d81f5166188d3461a/vmtest01.txt"); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Nonnull public byte[] predictSerCodegen(boolean compress) throws HiveException { FastMultiByteArrayOutputStream bos = new FastMultiByteArrayOutputStream(); OutputStream wrapped = compress ? new DeflaterOutputStream(bos) : bos; ObjectOutputSt...
#fixed code @Nonnull public byte[] predictSerCodegen(boolean compress) throws HiveException { try { if (compress) { return ObjectUtils.toCompressedBytes(_root); } else { return ObjectUtils.toBytes(_root); } ...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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; ...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public BinaryData download( String resourceId ) throws ResourcesException { String resourcePath = getResourcePath( resourceId ); File file = new File( getRootFolder(), resourcePath ); try { FileInputStream input = new...
#fixed code public BinaryData download( String resourceId ) throws ResourcesException { String resourcePath = getResourcePath( resourceId ); File file = new File( getRootFolder(), resourcePath ); try { FileInputStream input = new FileI...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testBoldWithB() throws Exception { IContext context = null; BufferedElement parent = null; ITextStylingTransformer formatter = HTMLTextStylingTransformer.INSTANCE; IDocumentHandler handler = new DocxDocu...
#fixed code @Test public void testBoldWithB() throws Exception { IContext context = new MockContext(); BufferedElement parent = null; ITextStylingTransformer formatter = HTMLTextStylingTransformer.INSTANCE; IDocumentHandler handler = new D...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private static void processUpload( ResourcesService client, String resourceId, File out ) throws ResourcesException, IOException { FileInputStream input= new FileInputStream(out); byte[] content=IOUtils.toByteArray(input); // BinaryData da...
#fixed code private static void processUpload( ResourcesService client, String resourceId, File out ) throws ResourcesException, IOException { FileInputStream input= new FileInputStream(out); byte[] content=IOUtils.toByteArray(input); // BinaryData data = n...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void processReportWithOptions() throws IOException { WebClient client = WebClient.create( BASE_ADDRESS ); client.path( "processReport" ); client.accept( MediaType.APPLICATION_XML ); ReportAndDataRepresentati...
#fixed code @Test public void processReportWithOptions() throws IOException { WebClient client = WebClient.create( BASE_ADDRESS ); client.path( "processReport" ); client.accept( MediaType.APPLICATION_XML ); ReportAndDataRepresentation rep...
Below is the vulnerable code, please generate the patch based on the following information.
#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" ); ...
#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" ); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void applyStyles( Style style ) { this.lastStyleApplied = style; // width StyleTableProperties tableProperties = style.getTableProperties(); if ( tableProperties != null ) { if ( tableProperties.getWidth() ...
#fixed code public void applyStyles( Style style ) { this.lastStyleApplied = style; StyleTableProperties tableProperties = style.getTableProperties(); if ( tableProperties != null ) { // width if ( tableProperties.getWidth() !=...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testItalicWithI() throws Exception { IContext context = null; BufferedElement parent = null; ITextStylingTransformer formatter = HTMLTextStylingTransformer.INSTANCE; IDocumentHandler handler = new DocxDo...
#fixed code @Test public void testItalicWithI() throws Exception { IContext context = new MockContext(); BufferedElement parent = null; ITextStylingTransformer formatter = HTMLTextStylingTransformer.INSTANCE; IDocumentHandler handler = new...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void loadPNGWithoutUsingImageSizeAndForceWidth() throws Exception { IImageProvider imageProvider = new ByteArrayImageProvider( ByteArrayImageProviderTestCase.class.getResourceAsStream( "logo.png" ) ); imageProvide...
#fixed code @Test public void loadPNGWithoutUsingImageSizeAndForceWidth() throws Exception { IImageProvider imageProvider = new ByteArrayImageProvider( ByteArrayImageProviderTestCase.class.getResourceAsStream( "logo.png" ) ); imageProvider.setW...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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 ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void visit( StyleColumnElement ele ) { StyleSectionProperties sectionProperties = currentStyle.getSectionProperties(); if ( sectionProperties == null ) { // style:column outside style:section-properties, ignor...
#fixed code @Override public void visit( StyleColumnElement ele ) { List<StyleColumnProperties> styleColumnPropertiesList = currentStyle.getColumnPropertiesList(); if ( styleColumnPropertiesList == null ) { styleColumnPropertiesList = new Array...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testBoldWithStrong() throws Exception { IContext context = null; BufferedElement parent = null; ITextStylingTransformer formatter = HTMLTextStylingTransformer.INSTANCE; IDocumentHandler handler = new Doc...
#fixed code @Test public void testBoldWithStrong() throws Exception { IContext context = new MockContext(); BufferedElement parent = null; ITextStylingTransformer formatter = HTMLTextStylingTransformer.INSTANCE; IDocumentHandler handler = ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void loadPNGWithoutUsingImageSizeAndForceWidth() throws Exception { IImageProvider imageProvider = new ClassPathImageProvider( ClassPathImageProviderTestCase.class, "logo.png" ); imageProvider.setWidth( 100f ); Assert...
#fixed code @Test public void loadPNGWithoutUsingImageSizeAndForceWidth() throws Exception { IImageProvider imageProvider = new ClassPathImageProvider( ClassPathImageProviderTestCase.class, "logo.png" ); imageProvider.setWidth( 100f ); Assert.asser...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testItalicWithEm() throws Exception { IContext context = null; BufferedElement parent = null; ITextStylingTransformer formatter = HTMLTextStylingTransformer.INSTANCE; IDocumentHandler handler = new DocxD...
#fixed code @Test public void testItalicWithEm() throws Exception { IContext context = new MockContext(); BufferedElement parent = null; ITextStylingTransformer formatter = HTMLTextStylingTransformer.INSTANCE; IDocumentHandler handler = ne...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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]); }...
#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 ...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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",...
#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)...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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)); ...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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(); } ...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code Optional<Chunk> chunk(BoundedInputStream bis, ChunkServer.ChunkInfo chunkInfo, int index) throws IOException { byte[] checksum = chunkInfo.getChunkChecksum().toByteArray(); return store.chunk(checksum) .<IOSupplier<Optional<Chunk>>>map(u ...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public final List/* <AttachedNarArtifact> */getAttachedNarDependencies( List/* <NarArtifacts> */narArtifacts, AOL archOsLinker, String type ) throws MojoExecutionException, MojoFailureEx...
#fixed code public final List/* <AttachedNarArtifact> */getAttachedNarDependencies( List/* <NarArtifacts> */narArtifacts, AOL archOsLinker, String type ) throws MojoExecutionException, MojoFailureExceptio...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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 = {...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void open(Map stormConf, TopologyContext context, SpoutOutputCollector collector) { indexName = ConfUtils.getString(stormConf, ESStatusIndexNameParamName, "status"); docType = ConfUtils.getString(stormCon...
#fixed code @Override public void open(Map stormConf, TopologyContext context, SpoutOutputCollector collector) { partitionField = ConfUtils.getString(stormConf, ESStatusRoutingFieldParamName); bucketSortField = ConfUtils.getString(stormCo...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void open(Map stormConf, TopologyContext context, SpoutOutputCollector collector) { indexName = ConfUtils.getString(stormConf, ESStatusIndexNameParamName, "status"); docType = ConfUtils.getString(stormCon...
#fixed code @Override public void open(Map stormConf, TopologyContext context, SpoutOutputCollector collector) { partitionField = ConfUtils.getString(stormConf, ESStatusRoutingFieldParamName); bucketSortField = ConfUtils.getString(stormCo...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void nextTuple() { if (!active) return; // synchronize access to buffer needed in case of asynchronous // queries to the backend synchronized (buffer) { if (!buffer.isEmpty()) { ...
#fixed code @Override public void nextTuple() { if (!active) return; // synchronize access to buffer needed in case of asynchronous // queries to the backend synchronized (buffer) { // force the refresh of the buffer even if t...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void onResponse(SearchResponse response) { long timeTaken = System.currentTimeMillis() - timeStartESQuery; Aggregations aggregs = response.getAggregations(); SingleBucketAggregation sample = aggregs.get("sample"); i...
#fixed code @Override public void onResponse(SearchResponse response) { long timeTaken = System.currentTimeMillis() - timeStartESQuery; Aggregations aggregs = response.getAggregations(); SingleBucketAggregation sample = aggregs.get("sample"); if (sam...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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....
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void open(Map stormConf, TopologyContext context, SpoutOutputCollector collector) { indexName = ConfUtils.getString(stormConf, ESStatusIndexNameParamName, "status"); docType = ConfUtils.getString(stormCon...
#fixed code @Override public void open(Map stormConf, TopologyContext context, SpoutOutputCollector collector) { partitionField = ConfUtils.getString(stormConf, ESStatusRoutingFieldParamName); bucketSortField = ConfUtils.getString(stormCo...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void open(Map stormConf, TopologyContext context, SpoutOutputCollector collector) { indexName = ConfUtils.getString(stormConf, ESStatusIndexNameParamName, "status"); docType = ConfUtils.getString(stormCon...
#fixed code @Override public void open(Map stormConf, TopologyContext context, SpoutOutputCollector collector) { maxInFlightURLsPerBucket = ConfUtils.getInt(stormConf, ESStatusMaxInflightParamName, 1); maxBufferSize = ConfUtils.getInt(stor...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void open(Map stormConf, TopologyContext context, SpoutOutputCollector collector) { super.open(stormConf, context, collector); indexName = ConfUtils.getString(stormConf, ESStatusIndexNameParamName, "stat...
#fixed code @Override public void open(Map stormConf, TopologyContext context, SpoutOutputCollector collector) { super.open(stormConf, context, collector); indexName = ConfUtils.getString(stormConf, ESStatusIndexNameParamName, "status"); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void open(Map stormConf, TopologyContext context, SpoutOutputCollector collector) { indexName = ConfUtils.getString(stormConf, ESStatusIndexNameParamName, "status"); docType = ConfUtils.getString(stormCon...
#fixed code @Override public void open(Map stormConf, TopologyContext context, SpoutOutputCollector collector) { maxInFlightURLsPerBucket = ConfUtils.getInt(stormConf, ESStatusMaxInflightParamName, 1); maxBufferSize = ConfUtils.getInt(stor...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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: ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override protected void populateBuffer() { if (lastDate == null) { lastDate = String.format(DATEFORMAT, new Date()); } LOG.info("{} Populating buffer with nextFetchDate <= {}", logIdprefix, lastDate); Q...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void open(Map stormConf, TopologyContext context, SpoutOutputCollector collector) { indexName = ConfUtils.getString(stormConf, ESStatusIndexNameParamName, "status"); docType = ConfUtils.getString(stormCon...
#fixed code @Override public void open(Map stormConf, TopologyContext context, SpoutOutputCollector collector) { maxInFlightURLsPerBucket = ConfUtils.getInt(stormConf, ESStatusMaxInflightParamName, 1); maxBufferSize = ConfUtils.getInt(stor...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void onResponse(SearchResponse response) { long timeTaken = System.currentTimeMillis() - timeLastQuery; Aggregations aggregs = response.getAggregations(); if (aggregs == null) { isInQuery.set(false); ...
#fixed code @Override public void onResponse(SearchResponse response) { long timeTaken = System.currentTimeMillis() - timeLastQuery; Aggregations aggregs = response.getAggregations(); if (aggregs == null) { isInQuery.set(false); retur...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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? ...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void open(Map stormConf, TopologyContext context, SpoutOutputCollector collector) { indexName = ConfUtils.getString(stormConf, ESStatusIndexNameParamName, "status"); docType = ConfUtils.getString(stormCon...
#fixed code @Override public void open(Map stormConf, TopologyContext context, SpoutOutputCollector collector) { partitionField = ConfUtils.getString(stormConf, ESStatusRoutingFieldParamName); bucketSortField = ConfUtils.getString(stormCo...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void open(Map stormConf, TopologyContext context, SpoutOutputCollector collector) { indexName = ConfUtils.getString(stormConf, ESStatusIndexNameParamName, "status"); docType = ConfUtils.getString(stormCon...
#fixed code @Override public void open(Map stormConf, TopologyContext context, SpoutOutputCollector collector) { partitionField = ConfUtils.getString(stormConf, ESStatusRoutingFieldParamName); bucketSortField = ConfUtils.getString(stormCo...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void open(Map stormConf, TopologyContext context, SpoutOutputCollector collector) { indexName = ConfUtils.getString(stormConf, ESStatusIndexNameParamName, "status"); docType = ConfUtils.getString(stormCon...
#fixed code @Override public void open(Map stormConf, TopologyContext context, SpoutOutputCollector collector) { maxInFlightURLsPerBucket = ConfUtils.getInt(stormConf, ESStatusMaxInflightParamName, 1); maxBufferSize = ConfUtils.getInt(stor...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void open(Map stormConf, TopologyContext context, SpoutOutputCollector collector) { indexName = ConfUtils.getString(stormConf, ESStatusIndexNameParamName, "status"); docType = ConfUtils.getString(stormCon...
#fixed code @Override public void open(Map stormConf, TopologyContext context, SpoutOutputCollector collector) { partitionField = ConfUtils.getString(stormConf, ESStatusRoutingFieldParamName); bucketSortField = ConfUtils.getString(stormCo...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void open(Map stormConf, TopologyContext context, SpoutOutputCollector collector) { indexName = ConfUtils.getString(stormConf, ESStatusIndexNameParamName, "status"); docType = ConfUtils.getString(stormCon...
#fixed code @Override public void open(Map stormConf, TopologyContext context, SpoutOutputCollector collector) { maxInFlightURLsPerBucket = ConfUtils.getInt(stormConf, ESStatusMaxInflightParamName, 1); maxBufferSize = ConfUtils.getInt(stor...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void nextTuple() { // inactive? if (active == false) return; // have anything in the buffer? if (!buffer.isEmpty()) { Values fields = buffer.remove(); String url = fields.get(0)....
#fixed code @Override public void nextTuple() { // inactive? if (active == false) return; // have anything in the buffer? if (!buffer.isEmpty()) { Values fields = buffer.remove(); String url = fields.get(0).toStri...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void open(Map stormConf, TopologyContext context, SpoutOutputCollector collector) { indexName = ConfUtils.getString(stormConf, ESStatusIndexNameParamName, "status"); docType = ConfUtils.getString(stormCon...
#fixed code @Override public void open(Map stormConf, TopologyContext context, SpoutOutputCollector collector) { partitionField = ConfUtils.getString(stormConf, ESStatusRoutingFieldParamName); bucketSortField = ConfUtils.getString(stormCo...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override protected void populateBuffer() { if (scrollId == null) { // scrollID is null because all the documents have been exhausted if (hasStarted) { Utils.sleep(10); return; } ...
#fixed code @Override protected void populateBuffer() { if (hasFinished) { Utils.sleep(10); return; } // initial request if (scrollId == null) { SearchSourceBuilder searchSourceBuilder = new SearchSourceBuil...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override protected void populateBuffer() { if (lastDate == null) { lastDate = new Date(); } String formattedLastDate = ISODateTimeFormat.dateTimeNoMillis().print( lastDate.getTime()); LOG.info("{} Popul...
#fixed code @Override protected void populateBuffer() { if (queryDate == null) { queryDate = new Date(); lastTimeResetToNOW = Instant.now(); } String formattedLastDate = ISODateTimeFormat.dateTimeNoMillis().print( quer...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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? ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void open(Map stormConf, TopologyContext context, SpoutOutputCollector collector) { indexName = ConfUtils.getString(stormConf, ESStatusIndexNameParamName, "status"); docType = ConfUtils.getString(stormCon...
#fixed code @Override public void open(Map stormConf, TopologyContext context, SpoutOutputCollector collector) { partitionField = ConfUtils.getString(stormConf, ESStatusRoutingFieldParamName); bucketSortField = ConfUtils.getString(stormCo...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private List<RegexRule> readRules(String rulesFile) { List<RegexRule> rules = new ArrayList<RegexRule>(); try { InputStream regexStream = getClass().getClassLoader() .getResourceAsStream(rulesFile); Reader re...
#fixed code private List<RegexRule> readRules(String rulesFile) { List<RegexRule> rules = new ArrayList<RegexRule>(); try { InputStream regexStream = getClass().getClassLoader() .getResourceAsStream(rulesFile); Reader reader =...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void nextTuple() { // inactive? if (active == false) return; // have anything in the buffer? if (!buffer.isEmpty()) { Values fields = buffer.remove(); String url = fields.get(0)....
#fixed code @Override public void nextTuple() { // inactive? if (active == false) return; // have anything in the buffer? if (!buffer.isEmpty()) { Values fields = buffer.remove(); String url = fields.get(0).toStri...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void open(Map stormConf, TopologyContext context, SpoutOutputCollector collector) { indexName = ConfUtils.getString(stormConf, ESStatusIndexNameParamName, "status"); docType = ConfUtils.getString(stormCon...
#fixed code @Override public void open(Map stormConf, TopologyContext context, SpoutOutputCollector collector) { maxInFlightURLsPerBucket = ConfUtils.getInt(stormConf, ESStatusMaxInflightParamName, 1); maxBufferSize = ConfUtils.getInt(stor...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void open(Map stormConf, TopologyContext context, SpoutOutputCollector collector) { indexName = ConfUtils.getString(stormConf, ESStatusIndexNameParamName, "status"); docType = ConfUtils.getString(stormCon...
#fixed code @Override public void open(Map stormConf, TopologyContext context, SpoutOutputCollector collector) { partitionField = ConfUtils.getString(stormConf, ESStatusRoutingFieldParamName); bucketSortField = ConfUtils.getString(stormCo...
Below is the vulnerable code, please generate the patch based on the following information.