output
stringlengths
64
73.2k
input
stringlengths
208
73.3k
instruction
stringclasses
1 value
#fixed code public static void displayDifferences(PrintStream out, Context context, String actionStr, List<Difference> differences, Consumer<Difference> displayOneDifference) { int truncateOutput = context.getTruncateOutput(); if ...
#vulnerable code public static void displayDifferences(PrintStream out, Context context, String actionStr, List<Difference> differences, Consumer<Difference> displayOneDifference) { int truncateOutput = context.getTruncateOutput(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public State loadState(int stateNumber) throws IOException { File stateFile = getStateFile(stateNumber); if (!stateFile.exists()) { throw new IllegalStateException(String.format("Unable to load State file %d from directory %s", stateNumber, stateDir)); } State sta...
#vulnerable code public State loadState(int stateNumber) throws IOException { File stateFile = getStateFile(stateNumber); if (!stateFile.exists()) { throw new IllegalStateException(String.format("Unable to load State file %d from directory %s", stateNumber, stateDir)); } Sta...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public CompareResult displayChanges() { if (lastState != null) { System.out.printf("Comparing with the last committed state from %s%n", formatDate(lastState.getTimestamp())); if (lastState.getComment().length() > 0) { System.out.println("Comment: " + lastState....
#vulnerable code public CompareResult displayChanges() { if (lastState != null) { System.out.printf("Comparing with the last committed state from %s%n", formatDate(lastState.getTimestamp())); if (lastState.getComment().length() > 0) { System.out.println("Comment: " + last...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public State generateState(String comment, File fimRepositoryRootDir) throws IOException, NoSuchAlgorithmException { Logger.info(String.format("Scanning recursively local files, %s, using %d thread", hashModeToString(), parameters.getThreadCount())); System.out.printf(" ...
#vulnerable code public State generateState(String comment, File fimRepositoryRootDir) throws IOException, NoSuchAlgorithmException { Logger.info(String.format("Scanning recursively local files, %s, using %d thread", hashModeToString(), parameters.getThreadCount())); System.out.printf...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public CompareResult displayChanges() { if (lastState != null) { System.out.printf("Comparing with the last committed state from %s%n", formatDate(lastState.getTimestamp())); if (lastState.getComment().length() > 0) { System.out.println("Comment: " + lastState....
#vulnerable code public CompareResult displayChanges() { if (lastState != null) { System.out.printf("Comparing with the last committed state from %s%n", formatDate(lastState.getTimestamp())); if (lastState.getComment().length() > 0) { System.out.println("Comment: " + last...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void outputInit() { progressLock.lock(); try { summedFileLength = 0; fileCount = 0; } finally { progressLock.unlock(); } }
#vulnerable code public void outputInit() { summedFileLength = 0; fileCount = 0; } #location 2 #vulnerability type THREAD_SAFETY_VIOLATION
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static void main(String[] args) throws IOException { String[] filteredArgs = filterEmptyArgs(args); if (filteredArgs.length < 1) { youMustSpecifyACommandToRun(); } Command command = Command.fromName(filteredArgs[0]); if (command == null) { youMustSpe...
#vulnerable code public static void main(String[] args) throws IOException { String[] filteredArgs = filterEmptyArgs(args); if (filteredArgs.length < 1) { youMustSpecifyACommandToRun(); } Command command = Command.fromName(filteredArgs[0]); if (command == null) { youM...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public int getNumberOfFeatures(){ List<? extends HasArray> coefs = getCoefs(); return NeuralNetworkUtil.getNumberOfFeatures(coefs); }
#vulnerable code @Override public int getNumberOfFeatures(){ List<?> coefs = getCoefs(); NDArray input = (NDArray)coefs.get(0); int[] shape = NDArrayUtil.getShape(input); return shape[0]; } #location 5 #vulnerability ty...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public Expression encode(int index, FieldName name){ Expression expression = new FieldRef(name); if(getWithMean()){ Number mean = Iterables.get(getMean(), index); if(Double.compare(mean.doubleValue(), 0d) != 0){ expression = PMMLUtil.createApply("-", e...
#vulnerable code @Override public Expression encode(int index, FieldName name){ Expression expression = new FieldRef(name); if(withMean()){ Number mean = Iterables.get(getMean(), index); if(Double.compare(mean.doubleValue(), 0d) != 0){ expression = PMMLUtil.createApply("-"...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private List<? extends Number> getNodeAttribute(String key){ List<? extends Number> nodeAttributes = (List<? extends Number>)ClassDictUtil.getArray(this, "nodes", key); return nodeAttributes; }
#vulnerable code private List<? extends Number> getNodeAttribute(String key){ NDArrayWrapper nodes = (NDArrayWrapper)get("nodes"); Map<String, ?> content = (Map<String, ?>)nodes.getContent(); return (List<? extends Number>)content.get(key); } #location...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code static public List<?> getArray(ClassDict dict, String name, String key){ Object object = dict.get(name); if(object instanceof NDArrayWrapper){ NDArrayWrapper arrayWrapper = (NDArrayWrapper)object; NDArray array = arrayWrapper.getContent(); return NDArrayUtil.get...
#vulnerable code static public List<?> getArray(ClassDict dict, String name, String key){ NDArrayWrapper arrayWrapper = (NDArrayWrapper)dict.get(name); NDArray array = arrayWrapper.getContent(); return NDArrayUtil.getData(array, key); } #location 5 ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public Expression encode(int index, FieldName name){ Expression expression = new FieldRef(name); if(getWithMean()){ Number mean = Iterables.get(getMean(), index); if(Double.compare(mean.doubleValue(), 0d) != 0){ expression = PMMLUtil.createApply("-", e...
#vulnerable code @Override public Expression encode(int index, FieldName name){ Expression expression = new FieldRef(name); if(withMean()){ Number mean = Iterables.get(getMean(), index); if(Double.compare(mean.doubleValue(), 0d) != 0){ expression = PMMLUtil.createApply("-"...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected Object[] getEstimatorStep(){ List<Object[]> steps = getSteps(); if(steps == null || steps.size() < 1){ throw new IllegalArgumentException("Missing estimator step"); } return steps.get(steps.size() - 1); }
#vulnerable code protected Object[] getEstimatorStep(){ List<Object[]> steps = getSteps(); if(steps.size() < 1){ throw new IllegalArgumentException("Missing estimator step"); } return steps.get(steps.size() - 1); } #location 4 ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public Object getFill(){ return getScalar("fill_"); }
#vulnerable code public Object getFill(){ return asJavaObject(get("fill_")); } #location 2 #vulnerability type NULL_DEREFERENCE
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public PMML encodePMML(){ List<DataField> dataFields = new ArrayList<>(); dataFields.add(encodeTargetField()); int features = getNumberOfFeatures(); for(int i = 0; i < features; i++){ dataFields.add(encodeActiveField(i)); } DataDictionary dataDictionary = new Da...
#vulnerable code public PMML encodePMML(){ List<DataField> dataFields = new ArrayList<>(); DataField targetDataField = encodeTarget(); dataFields.add(targetDataField); Integer features = getFeatures(); for(int i = 0; i < features.intValue(); i++){ DataField dataField = new D...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public int getNumberOfFeatures(){ int[] shape = getCoefShape(); if(shape.length != 1){ throw new IllegalArgumentException(); } return shape[0]; }
#vulnerable code @Override public int getNumberOfFeatures(){ return (Integer)get("rank_"); } #location 3 #vulnerability type NULL_DEREFERENCE
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code static public int[] getShape(NDArray array){ Object[] shape = array.getShape(); List<? extends Number> values = (List)Arrays.asList(shape); return Ints.toArray(ValueUtil.asIntegers(values)); }
#vulnerable code static public int[] getShape(NDArray array){ Object[] shape = array.getShape(); int[] result = new int[shape.length]; for(int i = 0; i < shape.length; i++){ result[i] = ValueUtil.asInteger((Number)shape[i]); } return result; } ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void encodeFeatures(SkLearnEncoder encoder){ Object _default = getDefault(); List<Object[]> rows = getFeatures(); if(!(Boolean.FALSE).equals(_default)){ throw new IllegalArgumentException(); } for(Object[] row : rows){ List<String> ids = new ArrayList<>(...
#vulnerable code public void encodeFeatures(SkLearnEncoder encoder){ List<Object[]> steps = getFeatures(); for(int row = 0; row < steps.size(); row++){ Object[] step = steps.get(row); List<String> ids = new ArrayList<>(); List<Feature> features = new ArrayList<>(); List<...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public Expression encode(int index, FieldName name){ List<?> classes = getClasses(); Object value = classes.get(index); Number posLabel = getPosLabel(); Number negLabel = getNegLabel(); if(ValueUtil.isOne(posLabel) && ValueUtil.isZero(negLabel)){ NormD...
#vulnerable code @Override public Expression encode(int index, FieldName name){ List<?> classes = getClasses(); Object value = classes.get(index); Number posLabel = getPosLabel(); Number negLabel = getNegLabel(); if(Double.compare(posLabel.doubleValue(), 1d) == 0 && Double.co...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public Object getMissingValues(){ return getScalar("missing_values"); }
#vulnerable code public Object getMissingValues(){ return asJavaObject(get("missing_values")); } #location 2 #vulnerability type NULL_DEREFERENCE
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public int getNumberOfFeatures(){ return ValueUtil.asInteger((Number)get("n_features")); }
#vulnerable code @Override public int getNumberOfFeatures(){ return (Integer)get("n_features"); } #location 3 #vulnerability type NULL_DEREFERENCE
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private Object loadContent(){ Object[] shape = getShape(); Object descr = getDescr(); byte[] data = (byte[])getData(); if(descr instanceof DType){ DType dType = (DType)descr; descr = dType.toDescr(); } try { InputStream is = new ByteArrayInputStream(data)...
#vulnerable code private Object loadContent(){ Object[] shape = getShape(); Object descr = getDescr(); byte[] data = (byte[])getData(); try { InputStream is = new ByteArrayInputStream(data); try { return NDArrayUtil.parseData(is, descr, shape); } finally { is.clo...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public Number getWeight(int index){ CSRMatrix idfDiag = get("_idf_diag", CSRMatrix.class); List<?> data = idfDiag.getData(); return (Number)data.get(index); }
#vulnerable code public Number getWeight(int index){ CSRMatrix idfDiag = (CSRMatrix)get("_idf_diag"); List<?> data = idfDiag.getData(); return (Number)data.get(index); } #location 4 #vulnerability type NULL_DEREFERENCE
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public int getNumberOfFeatures(){ List<? extends HasArray> coefs = getCoefs(); return NeuralNetworkUtil.getNumberOfFeatures(coefs); }
#vulnerable code @Override public int getNumberOfFeatures(){ List<?> coefs = getCoefs(); NDArray input = (NDArray)coefs.get(0); int[] shape = NDArrayUtil.getShape(input); return shape[0]; } #location 5 #vulnerability ty...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public Expression encode(int index, FieldName name){ List<?> classes = getClasses(); Object value = classes.get(index); Number posLabel = getPosLabel(); Number negLabel = getNegLabel(); if(ValueUtil.isOne(posLabel) && ValueUtil.isZero(negLabel)){ NormD...
#vulnerable code @Override public Expression encode(int index, FieldName name){ List<?> classes = getClasses(); Object value = classes.get(index); Number posLabel = getPosLabel(); Number negLabel = getNegLabel(); if(Double.compare(posLabel.doubleValue(), 1d) == 0 && Double.co...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public DefineFunction encodeDefineFunction(){ String analyzer = getAnalyzer(); Boolean binary = getBinary(); Object preprocessor = getPreprocessor(); String stripAccents = getStripAccents(); Splitter tokenizer = getTokenizer(); switch(analyzer){ case "word": ...
#vulnerable code public DefineFunction encodeDefineFunction(){ String analyzer = getAnalyzer(); Boolean binary = getBinary(); String stripAccents = getStripAccents(); String tokenPattern = getTokenPattern(); switch(analyzer){ case "word": break; default: throw new ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public ContinuousOutputFeature toContinuousFeature(){ PMMLEncoder encoder = ensureEncoder(); Output output = getOutput(); OutputField outputField = getField(); DataType dataType = outputField.getDataType(); switch(dataType){ case INTEGER: case FLOAT...
#vulnerable code @Override public ContinuousOutputFeature toContinuousFeature(){ PMMLEncoder encoder = ensureEncoder(); Output output = getOutput(); OutputField outputField = OutputUtil.getOutputField(output, getName()); DataType dataType = outputField.getDataType(); switch(d...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public int getNumberOfFeatures(){ return ValueUtil.asInteger((Number)get("n_features")); }
#vulnerable code @Override public int getNumberOfFeatures(){ return (Integer)get("n_features"); } #location 3 #vulnerability type NULL_DEREFERENCE
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private List<?> loadContent(){ DType dtype = getDType(); byte[] obj = getObj(); try { InputStream is = new ByteArrayInputStream(obj); try { return (List<?>)NDArrayUtil.parseData(is, dtype, new Object[0]); } finally { is.close(); } } catch(IOExceptio...
#vulnerable code private List<?> loadContent(){ DType dtype = getDType(); byte[] obj = getObj(); try { InputStream is = new ByteArrayInputStream(obj); try { return (List<?>)NDArrayUtil.parseData(is, dtype.toDescr(), new Object[0]); } finally { is.close(); } } ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public List<Feature> encodeFeatures(List<String> ids, List<Feature> features, SkLearnEncoder encoder){ List<? extends Number> dataMin = getDataMin(); List<? extends Number> dataMax = getDataMax(); ClassDictUtil.checkSize(ids, features, dataMin, dataMax); Lis...
#vulnerable code @Override public List<Feature> encodeFeatures(List<String> ids, List<Feature> features, SkLearnEncoder encoder){ List<? extends Number> dataMin = getDataMin(); List<? extends Number> dataMax = getDataMax(); ClassDictUtil.checkSize(ids, features, dataMin, dataMax); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public List<Feature> encodeFeatures(List<String> ids, List<Feature> features, SkLearnEncoder encoder){ int[] shape = getComponentsShape(); int numberOfComponents = shape[0]; int numberOfFeatures = shape[1]; List<? extends Number> components = getComponents()...
#vulnerable code @Override public List<Feature> encodeFeatures(List<String> ids, List<Feature> features, SkLearnEncoder encoder){ int[] shape = getComponentsShape(); int numberOfComponents = shape[0]; int numberOfFeatures = shape[1]; if(ids.size() != numberOfFeatures || features...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public List<Feature> encodeFeatures(List<Feature> features, SkLearnEncoder encoder){ String function = getFunction(); if(features.size() <= 1){ return features; } Apply apply = new Apply(translateFunction(function)); for(Feature feature : features){ ...
#vulnerable code @Override public List<Feature> encodeFeatures(List<Feature> features, SkLearnEncoder encoder){ String function = translateFunction(getFunction()); if(features.size() <= 1){ return features; } FieldName name = FieldName.create(function + "(" + FeatureUtil.form...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private int[] getCoefShape(){ return ClassDictUtil.getShape(this, "coef_"); }
#vulnerable code private int[] getCoefShape(){ NDArrayWrapper arrayWrapper = (NDArrayWrapper)get("coef_"); NDArray array = arrayWrapper.getContent(); return NDArrayUtil.getShape(array); } #location 4 #vulnerability type NUL...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code static public List<?> getArray(ClassDict dict, String name, String key){ Object object = dict.get(name); if(object instanceof NDArrayWrapper){ NDArrayWrapper arrayWrapper = (NDArrayWrapper)object; object = arrayWrapper.getContent(); } // End if if(object instan...
#vulnerable code static public List<?> getArray(ClassDict dict, String name, String key){ Object object = unwrap(dict.get(name)); if(object instanceof NDArray){ NDArray array = (NDArray)object; return NDArrayUtil.getContent(array, key); } throw new IllegalArgumentExceptio...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public int getNumberOfFeatures(){ return ValueUtil.asInteger((Number)get("n_features_")); }
#vulnerable code public int getNumberOfFeatures(){ return (Integer)get("n_features_"); } #location 2 #vulnerability type NULL_DEREFERENCE
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code static public List<?> getContent(NDArray array, String key){ Map<String, ?> content = (Map<String, ?>)array.getContent(); return asJavaList(array, (List<?>)content.get(key)); }
#vulnerable code static public List<?> getContent(NDArray array, String key){ Map<String, ?> data = (Map<String, ?>)array.getContent(); return asJavaList(array, (List<?>)data.get(key)); } #location 5 #vulnerability type NULL_...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public List<Transformer> getTransformers(){ List<Object[]> steps = getSteps(); return TransformerUtil.asTransformerList(TupleUtil.extractElementList(steps, 1)); }
#vulnerable code public List<Transformer> getTransformers(){ List<Object[]> steps = getSteps(); boolean flexible = isFlexible(); if(flexible && steps.size() > 0){ Estimator estimator = getEstimator(); if(estimator != null){ steps = steps.subList(0, steps.size() - 1); }...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public List<Feature> initializeFeatures(SkLearnEncoder encoder){ List<? extends String> featureNames = getFeatureNames(); String separator = getSeparator(); Map<String, Integer> vocabulary = getVocabulary(); Feature[] featureArray = new Feature[featureNames.s...
#vulnerable code @Override public List<Feature> initializeFeatures(SkLearnEncoder encoder){ List<String> featureNames = getFeatureNames(); String separator = getSeparator(); Map<String, Integer> vocabulary = getVocabulary(); Feature[] featureArray = new Feature[featureNames.size(...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code static public List<?> getArray(ClassDict dict, String name){ Object object = dict.get(name); if(object instanceof HasArray){ HasArray hasArray = (HasArray)object; return hasArray.getArrayContent(); } // End if if(object instanceof Number){ return Collections...
#vulnerable code static public List<?> getArray(ClassDict dict, String name){ Object object = unwrap(dict.get(name)); if(object instanceof NDArray){ NDArray array = (NDArray)object; return NDArrayUtil.getContent(array); } else if(object instanceof CSRMatrix){ CSRMatrix...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public List<?> getClasses(){ LabelEncoder labelEncoder = getLabelEncoder(); return labelEncoder.getClasses(); }
#vulnerable code @Override public List<?> getClasses(){ List<Object> result = new ArrayList<>(); List<?> values = (List<?>)get("classes_"); for(Object value : values){ if(value instanceof HasArray){ HasArray hasArray = (HasArray)value; result.addAll(hasArray.getArrayCo...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public double[] getValues(){ List<? extends Number> values = (List<? extends Number>)ClassDictUtil.getArray(this, "values"); return Doubles.toArray(values); }
#vulnerable code public double[] getValues(){ NDArrayWrapper values = (NDArrayWrapper)get("values"); return Doubles.toArray((List<? extends Number>)values.getContent()); } #location 4 #vulnerability type NULL_DEREFERENCE
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code static public MiningModel encodeBooster(HasBooster hasBooster, Schema schema){ Booster booster = hasBooster.getBooster(); Learner learner = booster.getLearner(); Schema xgbSchema = XGBoostUtil.toXGBoostSchema(schema); // XXX List<Feature> features = xgbSchema.getFe...
#vulnerable code static public MiningModel encodeBooster(HasBooster hasBooster, Schema schema){ Booster booster = hasBooster.getBooster(); Learner learner = booster.getLearner(); Schema xgbSchema = XGBoostUtil.toXGBoostSchema(schema); MiningModel miningModel = learner.encodeMin...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public List<Feature> encodeFeatures(List<Feature> features, SkLearnEncoder encoder){ Object func = getFunc(); if(func == null){ return features; } UFunc ufunc; try { ufunc = (UFunc)func; } catch(ClassCastException cce){ throw new IllegalArgumen...
#vulnerable code @Override public List<Feature> encodeFeatures(List<Feature> features, SkLearnEncoder encoder){ Object func = getFunc(); UFunc ufunc; try { ufunc = (UFunc)func; } catch(ClassCastException cce){ throw new IllegalArgumentException("The function object (" + Cl...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void test_dispatcher_local_greeting_request_completes_before_timeout() { Microservices gateway = Microservices.builder() .discoveryPort(port.incrementAndGet()) .services(new GreetingServiceImpl()) .build(); Call service = gateway...
#vulnerable code @Test public void test_dispatcher_local_greeting_request_completes_before_timeout() { Microservices gateway = Microservices.builder() .services(new GreetingServiceImpl()) .build(); Call service = gateway.call(); Publisher<ServiceMessage> r...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public ServiceMessage decodeMessage(Payload payload) { Builder builder = ServiceMessage.builder(); if (payload.getData().hasRemaining()) { try { builder.data(payload.sliceData()); } catch (Throwable ex) { LOGGER.error("Failed to ...
#vulnerable code @Override public ServiceMessage decodeMessage(Payload payload) { Builder builder = ServiceMessage.builder(); if (payload.getData().hasRemaining()) { try { builder.data(payload.sliceData()); } catch (Throwable ex) { LOGGER.error("...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void test_local_quotes_service() throws InterruptedException { Microservices node = Microservices.builder() .discoveryPort(port.incrementAndGet()) .services(new SimpleQuoteService()).build(); QuoteService service = node.call().api(QuoteSe...
#vulnerable code @Test public void test_local_quotes_service() throws InterruptedException { Microservices node = Microservices.builder().services(new SimpleQuoteService()).build(); QuoteService service = node.call().api(QuoteService.class); CountDownLatch latch = new Coun...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public ServiceMessage decodeData(ServiceMessage message, Class type) { if (message.data() != null && message.data() instanceof ByteBuf) { try (ByteBufInputStream inputStream = new ByteBufInputStream(message.data(), true)) { return ServiceMessage.fr...
#vulnerable code @Override public ServiceMessage decodeData(ServiceMessage message, Class type) { if (message.data() != null && message.data() instanceof ByteBuf) { ByteBufInputStream inputStream = new ByteBufInputStream(message.data()); try { return ServiceMessa...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void importNodeIndexes(File file, String indexName, String indexType) throws IOException { BatchInserterIndex index; if (indexType.equals("fulltext")) { index = lucene.nodeIndex( indexName, FULLTEXT_CONFIG ); } else { index = lucene.nodeInde...
#vulnerable code private void importNodeIndexes(File file, String indexName, String indexType) throws IOException { BatchInserterIndex index; if (indexType.equals("fulltext")) { index = lucene.nodeIndex( indexName, stringMap( "type", "fulltext" ) ); } else { i...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void importNodes(File file) throws IOException { BufferedReader bf = new BufferedReader(new FileReader(file)); final Data data = new Data(bf.readLine(), "\t", 0); String line; report.reset(); while ((line = bf.readLine()) != nul...
#vulnerable code private void importNodes(File file) throws IOException { BufferedReader bf = new BufferedReader(new FileReader(file)); final Data data = new Data(bf.readLine(), "\t", 0); String line; report.reset(); while ((line = bf.readLine()) ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void importRelationshipIndexes(File file, String indexName, String indexType) throws IOException { BatchInserterIndex index; if (indexType.equals("fulltext")) { index = lucene.relationshipIndex( indexName, FULLTEXT_CONFIG ); } else { index =...
#vulnerable code private void importRelationshipIndexes(File file, String indexName, String indexType) throws IOException { BatchInserterIndex index; if (indexType.equals("fulltext")) { index = lucene.relationshipIndex( indexName, stringMap( "type", "fulltext" ) ); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void importRelationships(File file) throws IOException { BufferedReader bf = new BufferedReader(new FileReader(file)); final Data data = new Data(bf.readLine(), "\t", 3); Object[] rel = new Object[3]; final RelType relType = new RelType...
#vulnerable code private void importRelationships(File file) throws IOException { BufferedReader bf = new BufferedReader(new FileReader(file)); final Data data = new Data(bf.readLine(), "\t", 3); Object[] rel = new Object[3]; final Type type = new Type();...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testCache() { long start1 = System.currentTimeMillis(); int size = 10000; for (int i = 0; i < size; i++) { userDetailsService.loadUserByUsername("admin"); } long end1 = System.currentTimeMillis(); ...
#vulnerable code @Test public void testCache() { long start1 = System.currentTimeMillis(); for (int i = 0; i < size; i++) { userDetailsService.loadUserByUsername("admin"); } long end1 = System.currentTimeMillis(); //关闭缓存 us...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private static List<String> readSqlList(File sqlFile) throws Exception { List<String> sqlList = Lists.newArrayList(); StringBuilder sb = new StringBuilder(); try (BufferedReader reader = new BufferedReader(new InputStreamReader( new FileInputStream(sqlFile), StandardCh...
#vulnerable code private static List<String> readSqlList(File sqlFile) throws Exception { List<String> sqlList = Lists.newArrayList(); StringBuilder sb = new StringBuilder(); BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader( new FileInpu...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void test1() { long l = System.currentTimeMillis() / 1000; LocalDateTime localDateTime = DateUtil.fromTimeStamp(l); System.out.print(DateUtil.localDateTimeFormatyMdHms(localDateTime)); }
#vulnerable code @Test public void test1() { long l = System.currentTimeMillis() / 1000; LocalDateTime localDateTime = DateUtil.fromTimeStamp(l); System.out.printf(DateUtil.localDateTimeFormatyMdHms(localDateTime)); } #locatio...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static void upZipFile(File zipFile, String folderPath) throws ZipException, IOException { File desDir = new File(folderPath); if (!desDir.exists()) { if (!desDir.mkdirs()) { System.out.println("was not successful."); } } ZipFile zf = new ZipFile(zipFile)...
#vulnerable code public static void upZipFile(File zipFile, String folderPath) throws ZipException, IOException { File desDir = new File(folderPath); if (!desDir.exists()) { desDir.mkdirs(); } ZipFile zf = new ZipFile(zipFile); for (Enumeration<?> entries = zf.entries(); entri...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test() public void testSizeControl() throws IOException, InterruptedException, ExecutionException { runSizeControl("scaling-avl.tsv", new AvlDigestFactory()); }
#vulnerable code @Test() public void testSizeControl() throws IOException, InterruptedException, ExecutionException { // very slow running data generator. Don't want to run this normally. To run slow tests use // mvn test -DrunSlowTests=true assumeTrue(Bool...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test() public void testSizeControl() throws IOException, InterruptedException, ExecutionException { // very slow running data generator. Don't want to run this normally. To run slow tests use // mvn test -DrunSlowTests=true // assumeTrue(Boolean....
#vulnerable code @Test() public void testSizeControl() throws IOException, InterruptedException, ExecutionException { // very slow running data generator. Don't want to run this normally. To run slow tests use // mvn test -DrunSlowTests=true assumeTrue(Bool...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code static void whitelistVerify( final String remoteHost, final WhitelistItem whitelistItem, final Map<String, List<String>> headers, final String postContent) throws WhitelistException { WhitelistHost whitelistHost = new WhitelistHost(whitelistIt...
#vulnerable code static void whitelistVerify( final String remoteHost, final WhitelistItem whitelistItem, final Map<String, List<String>> headers, final String postContent) throws WhitelistException { String whitelistHost = whitelistItem.getHost(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { if (roundEnv.processingOver()) { return false; } final DslJson<Object> dslJson = new DslJson<>(Settings.withRuntime().includeServiceLoader()); Set<Type> knownEncoder...
#vulnerable code @Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { if (roundEnv.processingOver()) { return false; } Set<? extends Element> compiledJsons = roundEnv.getElementsAnnotatedWith(analysis.compiledJsonElement); Set<? ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { if (roundEnv.processingOver() || annotations.isEmpty()) { return false; } final DslJson<Object> dslJson = new DslJson<>(Settings.withRuntime().includeServiceLoader(get...
#vulnerable code @Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { if (roundEnv.processingOver() || annotations.isEmpty()) { return false; } final DslJson<Object> dslJson = new DslJson<>(Settings.withRuntime().includeServiceLoad...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { if (roundEnv.processingOver()) { return false; } Set<? extends Element> jsonAnnotated = roundEnv.getElementsAnnotatedWith(jsonTypeElement); if (!jsonAnnotated.isEmpt...
#vulnerable code @Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { if (roundEnv.processingOver()) { return false; } Set<? extends Element> jsonAnnotated = roundEnv.getElementsAnnotatedWith(jsonTypeElement); if (!jsonAnnotated....
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @ApiMethod(name = "processSignResponse") public List<String> processSignResponse( @Named("responseData") String responseData, User user) throws OAuthRequestException, ResponseException { if (user == null) { throw new OAuthRequestException("User is not au...
#vulnerable code @ApiMethod(name = "processSignResponse") public List<String> processSignResponse( @Named("responseData") String responseData, User user) throws OAuthRequestException, ResponseException { if (user == null) { throw new OAuthRequestException("User is ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @ApiMethod(name = "processRegistrationResponse") public List<String> processRegistrationResponse( @Named("responseData") String responseData, User user) throws OAuthRequestException, ResponseException { if (user == null) { throw new OAuthRequestException...
#vulnerable code @ApiMethod(name = "processRegistrationResponse") public List<String> processRegistrationResponse( @Named("responseData") String responseData, User user) throws OAuthRequestException, ResponseException { if (user == null) { throw new OAuthRequestExc...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @ApiMethod(name = "processSignResponse") public List<String> processSignResponse( @Named("responseData") String responseData, User user) throws OAuthRequestException, ResponseException { if (user == null) { throw new OAuthRequestException("User is not au...
#vulnerable code @ApiMethod(name = "processSignResponse") public List<String> processSignResponse( @Named("responseData") String responseData, User user) throws OAuthRequestException, ResponseException { if (user == null) { throw new OAuthRequestException("User is ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testRoot() throws IOException { try (CompoundDocument document = createTestDocument()) { Entry root = document.getRootEntry(); assertNotNull(root); assertEquals("Root Entry", root.getName()); asser...
#vulnerable code @Test public void testRoot() throws IOException { CompoundDocument document = createTestDocument(); Entry root = document.getRootEntry(); assertNotNull(root); assertEquals("Root Entry", root.getName()); assertTrue(root.isRoo...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public int getHeight() throws IOException { if (compression == 1) { // 1 = no compression Entry height = ifd.getEntryById(TIFF.TAG_IMAGE_HEIGHT); if (height == null) { throw new IIOException("Missing dimensions fo...
#vulnerable code @Override public int getHeight() throws IOException { if (compression == 1) { // 1 = no compression Entry height = ifd.getEntryById(TIFF.TAG_IMAGE_HEIGHT); if (height == null) { throw new IIOException("Missing dimensi...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private DataOutput createCompressorStream(final RenderedImage image, final ImageWriteParam param, final Map<Integer, Entry> entries) { /* 36 MB test data: No compression: Write time: 450 ms output.length: 36000226 PackBits: ...
#vulnerable code private DataOutput createCompressorStream(final RenderedImage image, final ImageWriteParam param, final Map<Integer, Entry> entries) { /* 36 MB test data: No compression: Write time: 450 ms output.length: 36000226 PackBi...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void writeBody(ByteArrayOutputStream pImageData) throws IOException { imageOutput.writeInt(IFF.CHUNK_BODY); imageOutput.writeInt(pImageData.size()); // NOTE: This is much faster than imageOutput.write(pImageData.toByteArray()) // as th...
#vulnerable code private void writeBody(ByteArrayOutputStream pImageData) throws IOException { imageOutput.writeInt(IFF.CHUNK_BODY); imageOutput.writeInt(pImageData.size()); // NOTE: This is much faster than mOutput.write(pImageData.toByteArray()) // as ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testRoot() throws IOException { try (CompoundDocument document = createTestDocument()) { Entry root = document.getRootEntry(); assertNotNull(root); assertEquals("Root Entry", root.getName()); asser...
#vulnerable code @Test public void testRoot() throws IOException { CompoundDocument document = createTestDocument(); Entry root = document.getRootEntry(); assertNotNull(root); assertEquals("Root Entry", root.getName()); assertTrue(root.isRoo...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override protected IIOMetadataNode getStandardChromaNode() { IIOMetadataNode chroma = new IIOMetadataNode("Chroma"); // Handle ColorSpaceType (RGB/CMYK/YCbCr etc)... Entry photometricTag = ifd.getEntryById(TIFF.TAG_PHOTOMETRIC_INTERPRETATION); ...
#vulnerable code @Override protected IIOMetadataNode getStandardChromaNode() { IIOMetadataNode chroma = new IIOMetadataNode("Chroma"); // Handle ColorSpaceType (RGB/CMYK/YCbCr etc)... Entry photometricTag = ifd.getEntryById(TIFF.TAG_PHOTOMETRIC_INTERPRETATIO...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testEOFExceptionInSegmentParsingShouldNotCreateBadState() throws IOException { ImageInputStream iis = new JPEGSegmentImageInputStream(ImageIO.createImageInputStream(getClassLoaderResource("/broken-jpeg/broken-no-sof-ascii-transfer-mode.jpg"))); ...
#vulnerable code @Test public void testEOFExceptionInSegmentParsingShouldNotCreateBadState() throws IOException { ImageInputStream iis = new JPEGSegmentImageInputStream(ImageIO.createImageInputStream(getClassLoaderResource("/broken-jpeg/broken-no-sof-ascii-transfer-mode.jpg"...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testReadThumbsCatalogFile() throws IOException { try (CompoundDocument document = createTestDocument()) { Entry root = document.getRootEntry(); assertNotNull(root); assertEquals(25, root.getChildEntries().size...
#vulnerable code @Test public void testReadThumbsCatalogFile() throws IOException { CompoundDocument document = createTestDocument(); Entry root = document.getRootEntry(); assertNotNull(root); assertEquals(25, root.getChildEntries().size()); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testContents() throws IOException { try (CompoundDocument document = createTestDocument()) { Entry root = document.getRootEntry(); assertNotNull(root); SortedSet<Entry> children = new TreeSet<Entry>(root.getC...
#vulnerable code @Test public void testContents() throws IOException { CompoundDocument document = createTestDocument(); Entry root = document.getRootEntry(); assertNotNull(root); SortedSet<Entry> children = new TreeSet<Entry>(root.getChildEntries(...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test(expected = UnsupportedOperationException.class) public void testChildEntriesUnmodifiable() throws IOException { try (CompoundDocument document = createTestDocument()) { Entry root = document.getRootEntry(); assertNotNull(root); ...
#vulnerable code @Test(expected = UnsupportedOperationException.class) public void testChildEntriesUnmodifiable() throws IOException { CompoundDocument document = createTestDocument(); Entry root = document.getRootEntry(); assertNotNull(root); Sort...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private DataOutput createCompressorStream(final RenderedImage image, final ImageWriteParam param, final Map<Integer, Entry> entries) { /* 36 MB test data: No compression: Write time: 450 ms output.length: 36000226 PackBits: ...
#vulnerable code private DataOutput createCompressorStream(final RenderedImage image, final ImageWriteParam param, final Map<Integer, Entry> entries) { /* 36 MB test data: No compression: Write time: 450 ms output.length: 36000226 PackBi...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testContents() throws IOException { try (CompoundDocument document = createTestDocument()) { Entry root = document.getRootEntry(); assertNotNull(root); SortedSet<Entry> children = new TreeSet<Entry>(root.getC...
#vulnerable code @Test public void testContents() throws IOException { CompoundDocument document = createTestDocument(); Entry root = document.getRootEntry(); assertNotNull(root); SortedSet<Entry> children = new TreeSet<Entry>(root.getChildEntries(...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static ColorSpace getColorSpace(int colorSpace) { ICC_Profile profile; switch (colorSpace) { case CS_ADOBE_RGB_1998: synchronized (ColorSpaces.class) { profile = adobeRGB1998.get(); i...
#vulnerable code public static ColorSpace getColorSpace(int colorSpace) { ICC_Profile profile; switch (colorSpace) { case CS_ADOBE_RGB_1998: synchronized (ColorSpaces.class) { profile = adobeRGB1998.get(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private DataOutput createCompressorStream(final RenderedImage image, final ImageWriteParam param, final Map<Integer, Entry> entries) { /* 36 MB test data: No compression: Write time: 450 ms output.length: 36000226 PackBits: ...
#vulnerable code private DataOutput createCompressorStream(final RenderedImage image, final ImageWriteParam param, final Map<Integer, Entry> entries) { /* 36 MB test data: No compression: Write time: 450 ms output.length: 36000226 PackBi...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private CompoundDirectory getExif() throws IOException { List<Application> exifSegments = getAppSegments(JPEG.APP1, "Exif"); if (!exifSegments.isEmpty()) { Application exif = exifSegments.get(0); int offset = exif.identifier.length() +...
#vulnerable code private CompoundDirectory getExif() throws IOException { List<Application> exifSegments = getAppSegments(JPEG.APP1, "Exif"); if (!exifSegments.isEmpty()) { Application exif = exifSegments.get(0); InputStream data = exif.data(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test(expected = UnsupportedOperationException.class) public void testChildEntriesUnmodifiable() throws IOException { try (CompoundDocument document = createTestDocument()) { Entry root = document.getRootEntry(); assertNotNull(root); ...
#vulnerable code @Test(expected = UnsupportedOperationException.class) public void testChildEntriesUnmodifiable() throws IOException { CompoundDocument document = createTestDocument(); Entry root = document.getRootEntry(); assertNotNull(root); Sort...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static ICC_ColorSpace createColorSpace(final ICC_Profile profile) { Validate.notNull(profile, "profile"); // Fix profile before lookup/create profileCleaner.fixProfile(profile); byte[] profileHeader = getProfileHeaderWithProfileId(prof...
#vulnerable code public static ICC_ColorSpace createColorSpace(final ICC_Profile profile) { Validate.notNull(profile, "profile"); byte[] profileHeader = profile.getData(ICC_Profile.icSigHead); ICC_ColorSpace cs = getInternalCS(profile.getColorSpaceType(), profi...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testReadThumbsCatalogFile() throws IOException { try (CompoundDocument document = createTestDocument()) { Entry root = document.getRootEntry(); assertNotNull(root); assertEquals(25, root.getChildEntries().size...
#vulnerable code @Test public void testReadThumbsCatalogFile() throws IOException { CompoundDocument document = createTestDocument(); Entry root = document.getRootEntry(); assertNotNull(root); assertEquals(25, root.getChildEntries().size()); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override public int getWidth() throws IOException { if (compression == 1) { // 1 = no compression Entry width = ifd.getEntryById(TIFF.TAG_IMAGE_WIDTH); if (width == null) { throw new IIOException("Missing dimensions for un...
#vulnerable code @Override public int getWidth() throws IOException { if (compression == 1) { // 1 = no compression Entry width = ifd.getEntryById(TIFF.TAG_IMAGE_WIDTH); if (width == null) { throw new IIOException("Missing dimensi...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @DELETE @Path("/reports/{name}") public void deleteReport(@PathParam("name") String name) { try { ItemCollection itemCol = reportService.findReport(name); entityService.remove(itemCol); } catch (Exception e) { e.printStackTrace(); } }
#vulnerable code @DELETE @Path("/reports/{name}") public void deleteReport(@PathParam("name") String name) { try { ItemCollection itemCol = reportService.getReport(name); entityService.remove(itemCol); } catch (Exception e) { e.printStackTrace(); } } ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private void printVersionTable(OutputStream out) { try { StringBuffer buffer = new StringBuffer(); List<String> modelVersionList = modelService.getAllModelVersions(); buffer.append("<table>"); buffer.append("<tr><th>Version</th><th>Workflow Group</th><th>Uploaded<...
#vulnerable code private void printVersionTable(OutputStream out) { try { StringBuffer buffer = new StringBuffer(); List<String> col = modelService.getAllModelVersions(); buffer.append("<table>"); buffer.append("<tr><th>Version</th><th>Workflow Group</th><th>Updated</th></tr...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testAddWorkdaysFromSaturday() { Calendar startDate = Calendar.getInstance(); // adjust to SATURDAY startDate.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY); System.out.println("Startdate=" + startDate.getTime()); // adjust -1 Workdays -> TUESDAY As...
#vulnerable code @Test public void testAddWorkdaysFromSaturday() { Calendar startDate = Calendar.getInstance(); // adjust to SATURDAY startDate.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY); System.out.println("Startdate=" + startDate.getTime()); // adjust -1 Workdays -> TUESDA...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testComplexWorkitem() throws ParseException { InputStream inputStream = getClass() .getResourceAsStream("/json/workitem.json"); ItemCollection itemCol = null; try { itemCol = JSONParser.parseWorkitem(inputStream,"UTF-8"); } catch (UnsupportedE...
#vulnerable code @Test public void testComplexWorkitem() throws ParseException { InputStream inputStream = getClass() .getResourceAsStream("/json/workitem.json"); ItemCollection itemCol = JSONParser.parseWorkitem(inputStream); Assert.assertNotNull(itemCol); Assert.assertEq...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testComplexPluginException() throws ScriptException { ItemCollection adocumentContext = new ItemCollection(); ItemCollection adocumentActivity = new ItemCollection(); // 1) invalid returning one messsage String script = "var a=1;var b=2;var isValid =...
#vulnerable code @Test public void testComplexPluginException() throws ScriptException { ItemCollection adocumentContext = new ItemCollection(); ItemCollection adocumentActivity = new ItemCollection(); // 1) invalid returning one messsage String script = "var a=1;var b=2;var is...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testParseResult() { List<ItemCollection> result=null; String testString = "{\n" + " \"responseHeader\":{\n" + " \"status\":0,\n" + " \"QTime\":4,\n" + " \"params\":{\n" + " \"q\":\"*:*\",\n" + " \"_\":\"156...
#vulnerable code @Test public void testParseResult() { List<ItemCollection> result=null; String testString = "{\n" + " \"responseHeader\":{\n" + " \"status\":0,\n" + " \"QTime\":4,\n" + " \"params\":{\n" + " \"q\":\"*:*\",\n" + " \"_\"...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code Timer createTimerOnInterval(ItemCollection configItemCollection) { // Create an interval timer Date startDate = configItemCollection.getItemValueDate("datstart"); Date endDate = configItemCollection.getItemValueDate("datstop"); long interval = configItemCollection.getIt...
#vulnerable code void processWorkList(ItemCollection activityEntity) throws Exception { // get processID int iProcessID = activityEntity.getItemValueInteger("numprocessid"); // get Modelversion String sModelVersion = activityEntity .getItemValueString("$modelversion"); // if...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public int run(ItemCollection adocumentContext, ItemCollection adocumentActivity) throws PluginException { documentContext = adocumentContext; // evaluate new items.... ItemCollection evalItemCollection = new ItemCollection(); evalItemCollection=adocumentContext=evaluate...
#vulnerable code public int run(ItemCollection adocumentContext, ItemCollection adocumentActivity) throws PluginException { documentContext = adocumentContext; // evaluate new items.... ItemCollection evalItemCollection = new ItemCollection(); evalItemCollection=adocumentContext=ev...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testAddWorkdaysFromMonday() { Calendar startDate = Calendar.getInstance(); // adjust to FRIDAY startDate.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); System.out.println("Startdate=" + startDate.getTime()); Assert.assertEquals(Calendar.TUESDAY, ...
#vulnerable code @Test public void testAddWorkdaysFromMonday() { Calendar startDate = Calendar.getInstance(); // adjust to FRIDAY startDate.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); System.out.println("Startdate=" + startDate.getTime()); Assert.assertEquals(Calendar.TUESD...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code boolean flushEventLogByCount(int count) { Date lastEventDate = null; boolean cacheIsEmpty = true; IndexWriter indexWriter = null; long l = System.currentTimeMillis(); logger.finest("......flush eventlog cache...."); List<EventLogEntry> events = eventLogService.findE...
#vulnerable code boolean flushEventLogByCount(int count) { Date lastEventDate = null; boolean cacheIsEmpty = true; IndexWriter indexWriter = null; long l = System.currentTimeMillis(); logger.finest("......flush eventlog cache...."); List<org.imixs.workflow.engine.jpa.Document>...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testAddWorkdaysFromMonday() { Calendar startDate = Calendar.getInstance(); // adjust to FRIDAY startDate.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); System.out.println("Startdate=" + startDate.getTime()); Assert.assertEquals(Calendar.TUESDAY, ...
#vulnerable code @Test public void testAddWorkdaysFromMonday() { Calendar startDate = Calendar.getInstance(); // adjust to FRIDAY startDate.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); System.out.println("Startdate=" + startDate.getTime()); Assert.assertEquals(Calendar.TUESD...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testMinusWorkdaysFromFriday() { Calendar startDate = Calendar.getInstance(); // adjust to FRIDAY startDate.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY); System.out.println("Startdate=" + startDate.getTime()); // adjust -3 Workdays -> THUSEDAY Asser...
#vulnerable code @Test public void testMinusWorkdaysFromFriday() { Calendar startDate = Calendar.getInstance(); // adjust to FRIDAY startDate.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY); System.out.println("Startdate=" + startDate.getTime()); // adjust -3 Workdays -> THUSEDAY ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testParseResult() { List<ItemCollection> result=null; String testString = "{\n" + " \"responseHeader\":{\n" + " \"status\":0,\n" + " \"QTime\":4,\n" + " \"params\":{\n" + " \"q\":\"*:*\",\n" + " \"_\":\"156...
#vulnerable code @Test public void testParseResult() { List<ItemCollection> result=null; String testString = "{\n" + " \"responseHeader\":{\n" + " \"status\":0,\n" + " \"QTime\":4,\n" + " \"params\":{\n" + " \"q\":\"*:*\",\n" + " \"_\"...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testComplexPluginException() throws ScriptException { ItemCollection adocumentContext = new ItemCollection(); ItemCollection adocumentActivity = new ItemCollection(); // 1) invalid returning one messsage String script = "var a=1;var b=2;var isValid =...
#vulnerable code @Test public void testComplexPluginException() throws ScriptException { ItemCollection adocumentContext = new ItemCollection(); ItemCollection adocumentActivity = new ItemCollection(); // 1) invalid returning one messsage String script = "var a=1;var b=2;var is...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testAddWorkdaysFromSaturday() { Calendar startDate = Calendar.getInstance(); // adjust to SATURDAY startDate.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY); System.out.println("Startdate=" + startDate.getTime()); // adjust -1 Workdays -> TUESDAY As...
#vulnerable code @Test public void testAddWorkdaysFromSaturday() { Calendar startDate = Calendar.getInstance(); // adjust to SATURDAY startDate.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY); System.out.println("Startdate=" + startDate.getTime()); // adjust -1 Workdays -> TUESDA...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void removeWorkitem(String uniqueID) throws PluginException { IndexWriter awriter = null; try { awriter = createIndexWriter(); Term term = new Term("$uniqueid", uniqueID); awriter.deleteDocuments(term); } catch (CorruptIndexException e) { throw new Plug...
#vulnerable code public void removeWorkitem(String uniqueID) throws PluginException { IndexWriter awriter = null; Properties prop = propertyService.getProperties(); if (!prop.isEmpty()) { try { awriter = createIndexWriter(prop); Term term = new Term("$uniqueid", uniqueID);...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public void endElement(String uri, String localName, String qName) throws SAXException { // end of bpmn2:process if (qName.equalsIgnoreCase("bpmn2:process")) { if (currentWorkflowGroup != null) { currentWorkf...
#vulnerable code @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public void endElement(String uri, String localName, String qName) throws SAXException { // end of bpmn2:process if (qName.equalsIgnoreCase("bpmn2:process")) { if (currentWorkflowGroup != null) { curren...
Below is the vulnerable code, please generate the patch based on the following information.