input stringlengths 205 73.3k | output stringlengths 64 73.2k | instruction stringclasses 1
value |
|---|---|---|
#vulnerable code
private BuildStrategy createBuildStrategy(ImageConfiguration imageConfig, OpenShiftBuildStrategy osBuildStrategy) {
if (osBuildStrategy == OpenShiftBuildStrategy.docker) {
return new BuildStrategyBuilder().withType("Docker").build();
} else i... | #fixed code
private BuildStrategy createBuildStrategy(ImageConfiguration imageConfig, OpenShiftBuildStrategy osBuildStrategy) {
if (osBuildStrategy == OpenShiftBuildStrategy.docker) {
return new BuildStrategyBuilder().withType("Docker").build();
} else if (osB... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public WatcherContext getWatcherContext() throws MojoExecutionException {
try {
BuildService.BuildContext buildContext = getBuildContext();
WatchService.WatchContext watchContext = getWatchContext(hub);
return new WatcherCon... | #fixed code
public WatcherContext getWatcherContext() throws MojoExecutionException {
try {
BuildService.BuildContext buildContext = getBuildContext();
WatchService.WatchContext watchContext = hub != null ? getWatchContext(hub) : null;
return ... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private void assertApplicationEndpoint(String key, String value) throws Exception {
int nTries = 0;
Response readResponse = null;
String responseContent = null;
Route applicationRoute = getApplicationRouteWithName(testsuiteRepositoryArtif... | #fixed code
private void assertApplicationEndpoint(String key, String value) throws Exception {
int nTries = 0;
Response readResponse = null;
String responseContent = null;
Route applicationRoute = getApplicationRouteWithName(testsuiteRepositoryArtifactId)... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
protected void applyEntities(Controller controller, KubernetesClient kubernetes, String namespace, String fileName, Set<HasMetadata> entities) throws Exception {
// Apply all items
for (HasMetadata entity : entities) {
if (entity instanceof P... | #fixed code
protected void applyEntities(Controller controller, KubernetesClient kubernetes, String namespace, String fileName, Set<HasMetadata> entities) throws Exception {
// Apply all items
for (HasMetadata entity : entities) {
if (entity instanceof Pod) {
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void executeInternal() throws MojoExecutionException, MojoFailureException {
if (!basedir.isDirectory() || !basedir.exists()) {
throw new MojoExecutionException("No directory for base directory: " + basedir);
}
/... | #fixed code
@Override
public void executeInternal() throws MojoExecutionException, MojoFailureException {
if (!basedir.isDirectory() || !basedir.exists()) {
throw new MojoExecutionException("No directory for base directory: " + basedir);
}
// lets... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
protected Fabric8ServiceHub getFabric8ServiceHub() {
return new Fabric8ServiceHub.Builder()
.log(log)
.clusterAccess(clusterAccess)
.dockerServiceHub(hub)
.platformMode(mode)
.build(... | #fixed code
protected Fabric8ServiceHub getFabric8ServiceHub() {
return new Fabric8ServiceHub.Builder()
.log(log)
.clusterAccess(clusterAccess)
.dockerServiceHub(hub)
.platformMode(mode)
.repositorySy... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static int runCommand(final Logger log, File command, List<String> args, boolean withShutdownHook) throws IOException {
String[] commandWithArgs = prepareCommandArray(command.getAbsolutePath(), args);
Process process = Runtime.getRuntime().exec(co... | #fixed code
public static int runCommand(final Logger log, File command, List<String> args, boolean withShutdownHook) throws IOException {
return runAsyncCommand(log, command, args, withShutdownHook).await();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private void portForward(Controller controller, String podName) throws MojoExecutionException {
try {
getFabric8ServiceHub().getPortForwardService()
.forwardPort(controller, createExternalProcessLogger("[[B]]port-forward[[B]] "), ... | #fixed code
private void portForward(Controller controller, String podName) throws MojoExecutionException {
try {
getFabric8ServiceHub(controller).getPortForwardService()
.forwardPort(createExternalProcessLogger("[[B]]port-forward[[B]] "), podName,... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
protected FilterWatchListDeletable<Pod, PodList, Boolean, Watch, Watcher<Pod>> withSelector(ClientNonNamespaceOperation<Pod, PodList, DoneablePod, ClientPodResource<Pod, DoneablePod>> pods, LabelSelector selector) {
FilterWatchListDeletable<Pod, PodList, Boolean... | #fixed code
protected FilterWatchListDeletable<Pod, PodList, Boolean, Watch, Watcher<Pod>> withSelector(ClientNonNamespaceOperation<Pod, PodList, DoneablePod, ClientPodResource<Pod, DoneablePod>> pods, LabelSelector selector) {
FilterWatchListDeletable<Pod, PodList, Boolean, Watc... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
Result scan() throws MojoExecutionException {
// Scanning is lazy ...
if (result == null) {
if (!directory.exists()) {
// No directory to check found so we return null here ...
return null;
}
... | #fixed code
FatJarDetector(String dir) {
this.directory = new File(dir);
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private Probe discoverSpringBootHealthCheck(int initialDelay) {
try {
if (hasClass(this.getProject(), "org.springframework.boot.actuate.health.HealthIndicator")) {
Properties properties = SpringBootUtil.getSpringBootApplicationPropert... | #fixed code
private Probe discoverSpringBootHealthCheck(int initialDelay) {
try {
if (hasAllClasses(this.getProject(), REQUIRED_CLASSES)) {
Properties properties = SpringBootUtil.getSpringBootApplicationProperties(this.getProject());
In... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private String getPortForwardUrl(final Set<HasMetadata> resources) throws Exception {
LabelSelector selector = KubernetesResourceUtil.getPodLabelSelector(resources);
if (selector == null) {
log.warn("Unable to determine a selector for applica... | #fixed code
private String getPortForwardUrl(final Set<HasMetadata> resources) throws Exception {
LabelSelector selector = KubernetesResourceUtil.getPodLabelSelector(resources);
if (selector == null) {
log.warn("Unable to determine a selector for application p... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
protected void applyEntities(Controller controller, KubernetesClient kubernetes, String namespace, String fileName, Set<HasMetadata> entities) throws Exception {
// Apply all items
for (HasMetadata entity : entities) {
if (entity instanceof P... | #fixed code
protected void applyEntities(Controller controller, KubernetesClient kubernetes, String namespace, String fileName, Set<HasMetadata> entities) throws Exception {
// Apply all items
for (HasMetadata entity : entities) {
if (entity instanceof Pod) {
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void executeInternal() throws MojoExecutionException, MojoFailureException {
if (!basedir.isDirectory() || !basedir.exists()) {
throw new MojoExecutionException("No directory for base directory: " + basedir);
}
/... | #fixed code
@Override
public void executeInternal() throws MojoExecutionException, MojoFailureException {
if (!basedir.isDirectory() || !basedir.exists()) {
throw new MojoExecutionException("No directory for base directory: " + basedir);
}
// lets... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void watch(List<ImageConfiguration> configs, Set<HasMetadata> resources, PlatformMode mode) throws Exception {
KubernetesClient kubernetes = getContext().getKubernetesClient();
PodLogService.PodLogServiceContext logContext = new Pod... | #fixed code
@Override
public void watch(List<ImageConfiguration> configs, Set<HasMetadata> resources, PlatformMode mode) throws Exception {
KubernetesClient kubernetes = getContext().getKubernetesClient();
PodLogService.PodLogServiceContext logContext = new PodLogSer... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public WatcherContext getWatcherContext() throws MojoExecutionException {
try {
BuildService.BuildContext buildContext = getBuildContext();
WatchService.WatchContext watchContext = getWatchContext(hub);
return new WatcherCon... | #fixed code
public WatcherContext getWatcherContext() throws MojoExecutionException {
try {
BuildService.BuildContext buildContext = getBuildContext();
WatchService.WatchContext watchContext = hub != null ? getWatchContext(hub) : null;
return ... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void enrich(KubernetesListBuilder builder) {
final ServiceConfiguration defaultServiceConfig = extractDefaultServiceConfig();
final Service defaultService = serviceHandler.getService(defaultServiceConfig,null);
if (hasServic... | #fixed code
@Override
public void enrich(KubernetesListBuilder builder) {
final ServiceConfiguration defaultServiceConfig = extractDefaultServiceConfig();
final Service defaultService = serviceHandler.getService(defaultServiceConfig,null);
if (hasServices(bui... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void triggerJob(String jobKey, JobDataMap data) throws SchedulerException {
validateState();
OperableTrigger operableTrigger = TriggerBuilder.newTriggerBuilder().withIdentity(jobKey + "-trigger").forJob(jobKey)
.withTriggerImplementati... | #fixed code
@Override
public void triggerJob(String jobKey, JobDataMap data) throws SchedulerException {
validateState();
OperableTrigger operableTrigger = simpleScheduleBuilderBuilder().withIdentity(jobKey + "-trigger").forJob(jobKey).startAt(new Date()).build();
// Op... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public Job findByJobClass(Long appId, String clazz) {
return findById(findIdByJobClass(appId, clazz));
}
#location 3
#vulnerability type NULL_DEREFERENCE | #fixed code
@Override
public Job findByJobClass(Long appId, String clazz) {
Long jobId = findIdByJobClass(appId, clazz);
return jobId == null ? null : findById(jobId);
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public void execute(final JobDetail jobDetail, JobTriggerType triggerType, JobExecutionContext context) {
final String appName = jobDetail.getApp().getAppName();
final String jobClass = jobDetail.getJob().getClazz();
JobInstance i... | #fixed code
@Override
public void execute(final JobDetail jobDetail, JobTriggerType triggerType, JobExecutionContext context) {
final String appName = jobDetail.getApp().getAppName();
final String jobClass = jobDetail.getJob().getClazz();
JobInstance instanc... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
protected static void denormalizeY(Dataset data, Map<Object, Double> minColumnValues, Map<Object, Double> maxColumnValues) {
if(data.isEmpty()) {
return;
}
if(data.getYDataType()==TypeInference.DataType.NUMERICAL) {
... | #fixed code
protected static void denormalizeY(Dataset data, Map<Object, Double> minColumnValues, Map<Object, Double> maxColumnValues) {
if(data.isEmpty()) {
return;
}
TypeInference.DataType dataType = data.getYDataType();
if(... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testValidate() {
TestUtils.log(this.getClass(), "validate");
/*
Example from http://www.inf.u-szeged.hu/~ormandi/ai2/06-naiveBayes-example.pdf
FeatureList:
- 0: red
- 1: yellow
... | #fixed code
@Test
public void testValidate() {
TestUtils.log(this.getClass(), "validate");
/*
Example from http://www.inf.u-szeged.hu/~ormandi/ai2/06-naiveBayes-example.pdf
FeatureList:
- 0: red
- 1: yellow
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testValidate() {
TestUtils.log(this.getClass(), "validate");
RandomValue.randomGenerator = new Random(42);
/*
Example from http://www.inf.u-szeged.hu/~ormandi/ai2/06-naiveBayes-example.pdf
FeatureLis... | #fixed code
@Test
public void testValidate() {
TestUtils.log(this.getClass(), "validate");
RandomValue.randomGenerator = new Random(42);
/*
Example from http://www.inf.u-szeged.hu/~ormandi/ai2/06-naiveBayes-example.pdf
FeatureList:
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testValidate() {
TestUtils.log(this.getClass(), "validate");
/*
Example from http://www.inf.u-szeged.hu/~ormandi/ai2/06-naiveBayes-example.pdf
FeatureList:
- 0: red
- 1: yellow
... | #fixed code
@Test
public void testValidate() {
TestUtils.log(this.getClass(), "validate");
/*
Example from http://www.inf.u-szeged.hu/~ormandi/ai2/06-naiveBayes-example.pdf
FeatureList:
- 0: red
- 1: yellow
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testTrainAndValidate() {
TestUtils.log(this.getClass(), "testTrainAndValidate");
RandomValue.setRandomGenerator(new Random(TestConfiguration.RANDOM_SEED));
DatabaseConfiguration dbConf = TestUtils.getDBConfig();
... | #fixed code
@Test
public void testTrainAndValidate() {
TestUtils.log(this.getClass(), "testTrainAndValidate");
RandomValue.setRandomGenerator(new Random(TestConfiguration.RANDOM_SEED));
DatabaseConfiguration dbConf = TestUtils.getDBConfig();
D... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testValidate() {
TestUtils.log(this.getClass(), "validate");
RandomValue.randomGenerator = new Random(42);
/*
Example from http://www.inf.u-szeged.hu/~ormandi/ai2/06-naiveBayes-example.pdf
FeatureLis... | #fixed code
@Test
public void testValidate() {
TestUtils.log(this.getClass(), "validate");
RandomValue.randomGenerator = new Random(42);
/*
Example from http://www.inf.u-szeged.hu/~ormandi/ai2/06-naiveBayes-example.pdf
FeatureList:
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testSelectFeatures() {
TestUtils.log(this.getClass(), "selectFeatures");
RandomValue.setRandomGenerator(new Random(42));
String dbName = "JUnitChisquareFeatureSelection";
TFIDF.Tra... | #fixed code
@Test
public void testSelectFeatures() {
TestUtils.log(this.getClass(), "selectFeatures");
RandomValue.setRandomGenerator(new Random(42));
String dbName = "JUnitChisquareFeatureSelection";
TFIDF.TrainingP... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private double calculateError(Dataframe trainingData, Map<List<Object>, Double> thitas) {
//The cost function as described on http://ufldl.stanford.edu/wiki/index.php/Softmax_Regression
//It is optimized for speed to reduce the amount of loops
do... | #fixed code
private double calculateError(Dataframe trainingData, Map<List<Object>, Double> thitas) {
//The cost function as described on http://ufldl.stanford.edu/wiki/index.php/Softmax_Regression
//It is optimized for speed to reduce the amount of loops
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
protected void predictDataset(Dataframe newData) {
Map<List<Object>, Double> similarities = knowledgeBase.getModelParameters().getSimilarities();
//generate recommendation for each record in the list
for(Map.Entry<Integer, ... | #fixed code
@Override
protected void predictDataset(Dataframe newData) {
_predictDataset(newData, false);
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private double calculateError(Dataframe trainingData, Map<Object, Object> previousThitaMapping, Map<Object, Double> weights, Map<Object, Double> thitas) {
double error=0.0;
for(Record r : trainingData) {
double xTw = xTw(r.getX(), w... | #fixed code
private double calculateError(Dataframe trainingData, Map<Object, Object> previousThitaMapping, Map<Object, Double> weights, Map<Object, Double> thitas) {
double error = StreamMethods.stream(trainingData.stream(), isParallelized()).mapToDouble(r -> {
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
protected static void extractDummies(Dataset data, Map<Object, Object> referenceLevels) {
Map<Object, Dataset.ColumnType> columnTypes = data.getColumns();
if(referenceLevels.isEmpty()) {
//Training Mode
//find the re... | #fixed code
protected static void extractDummies(Dataset data, Map<Object, Object> referenceLevels) {
Map<Object, Dataset.ColumnType> columnTypes = data.getColumns();
if(referenceLevels.isEmpty()) {
//Training Mode
//find the referenc... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static double median(AssociativeArray2D survivalFunction) {
Double ApointTi = null;
Double BpointTi = null;
int n = survivalFunction.size();
if(n==0) {
throw new IllegalArgumentException("The provided collectio... | #fixed code
public static double median(AssociativeArray2D survivalFunction) {
Double ApointTi = null;
Double BpointTi = null;
int n = survivalFunction.size();
if(n==0) {
throw new IllegalArgumentException("The provided collection can'... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private void batchGradientDescent(Dataframe trainingData, Map<List<Object>, Double> newThitas, double learningRate) {
//NOTE! This is not the stochastic gradient descent. It is the batch gradient descent optimized for speed (despite it looks more than the stocha... | #fixed code
private void batchGradientDescent(Dataframe trainingData, Map<List<Object>, Double> newThitas, double learningRate) {
//NOTE! This is not the stochastic gradient descent. It is the batch gradient descent optimized for speed (despite it looks more than the stochastic).... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
protected static void denormalizeX(Dataset data, Map<Object, Double> minColumnValues, Map<Object, Double> maxColumnValues) {
for(Integer rId : data) {
Record r = data.get(rId);
for(Object column : minColumnValues.keySet()) {
... | #fixed code
protected static void denormalizeX(Dataset data, Map<Object, Double> minColumnValues, Map<Object, Double> maxColumnValues) {
for(Integer rId : data) {
Record r = data.get(rId);
AssociativeArray xData = new AssociativeArray(r.getX());
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
protected static void extractDummies(Dataset data, Map<Object, Object> referenceLevels) {
Map<Object, Dataset.ColumnType> columnTypes = data.getColumns();
if(referenceLevels.isEmpty()) {
//Training Mode
//find the re... | #fixed code
protected static void extractDummies(Dataset data, Map<Object, Object> referenceLevels) {
Map<Object, Dataset.ColumnType> columnTypes = data.getColumns();
if(referenceLevels.isEmpty()) {
//Training Mode
//find the referenc... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private double calculateError(Dataframe trainingData, Map<Object, Double> thitas) {
//The cost function as described on http://ufldl.stanford.edu/wiki/index.php/Softmax_Regression
//It is optimized for speed to reduce the amount of loops
double e... | #fixed code
private double calculateError(Dataframe trainingData, Map<Object, Double> thitas) {
//The cost function as described on http://ufldl.stanford.edu/wiki/index.php/Softmax_Regression
//It is optimized for speed to reduce the amount of loops
doubl... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
protected void filterFeatures(Dataframe newData) {
ModelParameters modelParameters = kb().getModelParameters();
//convert data into matrix
Map<Object, Integer> featureIds= modelParameters.getFeatureIds();
M... | #fixed code
@Override
protected void filterFeatures(Dataframe newData) {
ModelParameters modelParameters = kb().getModelParameters();
//convert data into matrix
Map<Object, Integer> featureIds= modelParameters.getFeatureIds();
Map<Int... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
protected static void normalizeX(Dataset data, Map<Object, Double> minColumnValues, Map<Object, Double> maxColumnValues) {
for(Integer rId : data) {
Record r = data.get(rId);
for(Object column : minColumnValues.keySet()) {
... | #fixed code
protected static void normalizeX(Dataset data, Map<Object, Double> minColumnValues, Map<Object, Double> maxColumnValues) {
for(Integer rId : data) {
Record r = data.get(rId);
AssociativeArray xData = new AssociativeArray(r.getX());
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private void batchGradientDescent(Dataframe trainingData, Map<Object, Double> newThitas, double learningRate) {
//NOTE! This is not the stochastic gradient descent. It is the batch gradient descent optimized for speed (despite it looks more than the stochastic).... | #fixed code
private void batchGradientDescent(Dataframe trainingData, Map<Object, Double> newThitas, double learningRate) {
//NOTE! This is not the stochastic gradient descent. It is the batch gradient descent optimized for speed (despite it looks more than the stochastic).
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void testValidate() {
TestUtils.log(this.getClass(), "validate");
/*
Example from http://www.inf.u-szeged.hu/~ormandi/ai2/06-naiveBayes-example.pdf
FeatureList:
- 0: red
- 1: yellow
... | #fixed code
@Test
public void testValidate() {
TestUtils.log(this.getClass(), "validate");
/*
Example from http://www.inf.u-szeged.hu/~ormandi/ai2/06-naiveBayes-example.pdf
FeatureList:
- 0: red
- 1: yellow
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static void main(String[] args) {
final JFrame frame = new JFrame();
final Provider provider = Provider.getCurrentProvider(true);
if (provider == null) {
System.exit(1);
}
frame.add(new JLabel("Press hotkey co... | #fixed code
public static void main(String[] args) {
final JFrame frame = new JFrame();
final Provider provider = Provider.getCurrentProvider(true);
if (provider == null) {
System.exit(1);
}
frame.add(new JLabel("Press hotkey combinat... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static void main(String[] args) {
final JFrame frame = new JFrame();
final Provider provider = Provider.getCurrentProvider();
provider.init();
final JTextField textField = new JTextField();
textField.setEditable(false);
... | #fixed code
public static void main(String[] args) {
final JFrame frame = new JFrame();
final Provider provider = Provider.getCurrentProvider(true);
final JTextField textField = new JTextField();
textField.setEditable(false);
textField.addKeyListe... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static void main(String[] args) {
final JFrame frame = new JFrame();
final Provider provider = Provider.getCurrentProvider(true);
if (provider == null) {
System.exit(1);
}
frame.add(new JLabel("Press hotkey co... | #fixed code
public static void main(String[] args) {
final JFrame frame = new JFrame();
final Provider provider = Provider.getCurrentProvider(true);
if (provider == null) {
System.exit(1);
}
frame.add(new JLabel("Press hotkey combinat... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static void main(String[] args) {
final JFrame frame = new JFrame();
final Provider provider = Provider.getCurrentProvider(true);
if (provider == null) {
System.exit(1);
}
frame.add(new JLabel("Press hotkey co... | #fixed code
public static void main(String[] args) {
final JFrame frame = new JFrame();
final Provider provider = Provider.getCurrentProvider(true);
if (provider == null) {
System.exit(1);
}
frame.add(new JLabel("Press hotkey combinat... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
private Node parseASTFilter() {
Token token = expect(Filter.class);
Filter filterToken = (Filter) token;
Attribute attr = (Attribute) accept(Attribute.class);
token = expect(Colon.class);
FilterNode node = new FilterNode();
node.setValue(filterToken.getValue(... | #fixed code
private Node parseASTFilter() {
Token token = expect(Filter.class);
Filter filterToken = (Filter) token;
Attribute attr = (Attribute) accept(Attribute.class);
token = expect(Colon.class);
FilterNode node = new FilterNode();
node.setValue(filterToken.getValue());
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void shouldCompileJadeToHtmlWithReaderTemplateLoader() throws Exception {
List<String> additionalIgnoredCases = Arrays.asList("52", "74", "100", "104a", "104b", "123", "135");
if (additionalIgnoredCases.contains(file.replace(".jade", "")... | #fixed code
@Test
public void shouldCompileJadeToHtmlWithReaderTemplateLoader() throws Exception {
List<String> additionalIgnoredCases = Arrays.asList("52", "74", "100", "104a", "104b", "123", "135");
if (additionalIgnoredCases.contains(file.replace(".jade", ""))) {
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public CHConnection connect(String url, Properties info) throws SQLException {
logger.info("Creating connection");
return LogProxy.wrap(CHConnection.class, new CHConnectionImpl(url));
}
#location 4
... | #fixed code
@Override
public CHConnection connect(String url, Properties info) throws SQLException {
logger.info("Creating connection");
return LogProxy.wrap(CHConnection.class, new CHConnectionImpl(url, info));
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public CHConnection connect(String url, CHProperties properties) throws SQLException {
logger.info("Creating connection");
return LogProxy.wrap(CHConnection.class, new CHConnectionImpl(url, properties));
}
#location 3
... | #fixed code
public CHConnection connect(String url, CHProperties properties) throws SQLException {
logger.info("Creating connection");
CHConnectionImpl connection = new CHConnectionImpl(url, properties);
connections.put(connection, true);
return LogProxy.w... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public ResultSet executeQuery(String sql) throws SQLException {
String csql = clickhousifySql(sql, "TabSeparatedWithNamesAndTypes");
CountingInputStream is = getInputStream(csql);
try {
return new HttpResult(properties.i... | #fixed code
@Override
public ResultSet executeQuery(String sql) throws SQLException {
String csql = clickhousifySql(sql);
CountingInputStream is = getInputStream(csql);
try {
return new CHResultSet(properties.isCompress()
? new ... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public CHConnection connect(String url, Properties info) throws SQLException {
logger.info("Creating connection");
return LogProxy.wrap(CHConnection.class, new CHConnectionImpl(url, info));
}
#location 4
... | #fixed code
@Override
public CHConnection connect(String url, Properties info) throws SQLException {
logger.info("Creating connection");
CHConnectionImpl connection = new CHConnectionImpl(url, info);
connections.put(connection, true);
return LogProxy.w... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
public ResultSet executeQuery(String sql) throws SQLException {
String csql = clickhousifySql(sql, "TabSeparatedWithNamesAndTypes");
CountingInputStream is = getInputStream(csql);
try {
return new HttpResult(properties.i... | #fixed code
@Override
public ResultSet executeQuery(String sql) throws SQLException {
String csql = clickhousifySql(sql);
CountingInputStream is = getInputStream(csql);
try {
return new CHResultSet(properties.isCompress()
? new ... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public byte[] downloadObject(DownloadInstructions downloadInstructions) {
return new DownloadObjectAsByteArrayCommand(getAccount(), getClient(), getAccess(), this, downloadInstructions).call();
}
#location 2
... | #fixed code
public byte[] downloadObject(DownloadInstructions downloadInstructions) {
return commandFactory.createDownloadObjectAsByteArrayCommand(getAccount(), getClient(), getAccess(), this, downloadInstructions).call();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
protected void saveMetadata() {
new ContainerMetadataCommand(getAccount(), getClient(), getAccess(), this, info.getMetadata()).call();
}
#location 3
#vulnerability type RESOURCE_LEAK | #fixed code
@Override
protected void saveMetadata() {
commandFactory.createContainerMetadataCommand(getAccount(), getClient(), getAccess(), this, info.getMetadata()).call();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static void main(String args[]) throws IOException {
if (args.length != 4) {
System.out.println("Use syntax: <TENANT> <USERNAME> <PASSWORD> <URL>");
return;
}
String tenant = args[0];
String username = args... | #fixed code
public static void main(String args[]) throws IOException {
if (args.length != 4) {
System.out.println("Use syntax: <TENANT> <USERNAME> <PASSWORD> <URL>");
return;
}
String tenant = args[0];
String username = args[1];
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
protected void getInfo() {
ContainerInformation info = new ContainerInformationCommand(getAccount(), getClient(), getAccess(), this).call();
this.bytesUsed = info.getBytesUsed();
this.objectCount = info.getObjectCount();
this.publicContai... | #fixed code
protected void getInfo() {
this.info = new ContainerInformationCommand(getAccount(), getClient(), getAccess(), this).call();
this.setInfoRetrieved();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static void main(String args[]) throws IOException {
if (args.length != 3) {
System.out.println("Use syntax: <USERNAME> <PASSWORD> <URL>");
return;
}
String username = args[0];
String password = args[1];
... | #fixed code
public static void main(String args[]) throws IOException {
if (args.length != 3) {
System.out.println("Use syntax: <USERNAME> <PASSWORD> <URL>");
return;
}
String username = args[0];
String password = args[1];
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void delete() {
new DeleteContainerCommand(getAccount(), getClient(), getAccess(), this).call();
}
#location 2
#vulnerability type RESOURCE_LEAK | #fixed code
public void delete() {
commandFactory.createDeleteContainerCommand(getAccount(), getClient(), getAccess(), this).call();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void setPreferredRegion(String preferredRegion) {
this.currentEndPoint = getObjectStoreCatalog().getRegion(preferredRegion);
}
#location 2
#vulnerability type NULL_DEREFERENCE | #fixed code
public void setPreferredRegion(String preferredRegion) {
this.preferredRegion = preferredRegion;
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test (expected = CommandException.class )
public void getSegmentationPlanThrowsIOException() throws Exception {
UploadPayloadFile uploadPayload = mock(UploadPayloadFile.class);
whenNew(UploadPayloadFile.class).withArguments(null).thenReturn(uploadPa... | #fixed code
@Test (expected = CommandException.class )
public void getSegmentationPlanThrowsIOException() throws Exception {
new Expectations() {
@Mocked UploadPayloadFile uploadPayload; {
new UploadPayloadFile(null);
result = uploadPayload... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void pushAndUpdate() throws IOException, URISyntaxException {
Swift swift = new Swift()
.setOnFileObjectStore("websites");
website = new WebsiteMock(new AccountMock(swift), "website");
website.pushDirectory(FileAc... | #fixed code
@Test
public void pushAndUpdate() throws IOException, URISyntaxException {
Swift swift = new Swift()
.setOnFileObjectStore("websites", false);
website = new WebsiteMock(new AccountMock(swift), "website");
website.pushDirectory(FileA... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
protected void getInfo() {
AccountInformation info = new AccountInformationCommand(this, httpClient, access).call();
this.bytesUsed = info.getBytesUsed();
this.containerCount = info.getContainerCount();
this.objectCount = info.getObjectCo... | #fixed code
protected void getInfo() {
this.info = new AccountInformationCommand(this, httpClient, access).call();
this.setInfoRetrieved();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public Container create() {
new CreateContainerCommand(getAccount(), getClient(), getAccess(), this).call();
return this;
}
#location 2
#vulnerability type RESOURCE_LEAK | #fixed code
public Container create() {
commandFactory.createCreateContainerCommand(getAccount(), getClient(), getAccess(), this).call();
return this;
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test(expected = UnauthorizedException.class)
public void reauthenticateFailTwice() {
when(statusLine.getStatusCode()).thenReturn(401);
when(authCommand.call()).thenReturn(new AccessImpl());
this.account = new AccountImpl(authCommand, httpCli... | #fixed code
@Test(expected = UnauthorizedException.class)
public void reauthenticateFailTwice() {
when(statusLine.getStatusCode()).thenReturn(401);
when(authCommand.call()).thenReturn(new AccessImpl());
this.account = new AccountImpl(authCommand, httpClient, d... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void pushToEmptyWebsite() throws IOException, URISyntaxException {
Swift swift = new Swift()
.setOnFileObjectStore("websites");
website = new WebsiteMock(new AccountMock(swift), "website");
website.pushDirectory(F... | #fixed code
@Test
public void pushToEmptyWebsite() throws IOException, URISyntaxException {
Swift swift = new Swift()
.setOnFileObjectStore("websites", false);
website = new WebsiteMock(new AccountMock(swift), "website");
website.pushDirectory(... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
protected void getInfo() {
this.info = new ContainerInformationCommand(getAccount(), getClient(), getAccess(), this).call();
this.setInfoRetrieved();
}
#location 2
#vulnerability type RESOURCE... | #fixed code
protected void getInfo() {
this.info = commandFactory.createContainerInformationCommand(getAccount(), getClient(), getAccess(), this).call();
this.setInfoRetrieved();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@SuppressWarnings("ConstantConditions")
@Test
public void pullWebsite() throws IOException, URISyntaxException {
Swift swift = new Swift()
.setOnFileObjectStore("websites");
website = new WebsiteMock(new AccountMock(swift), "websi... | #fixed code
@SuppressWarnings("ConstantConditions")
@Test
public void pullWebsite() throws IOException, URISyntaxException {
Swift swift = new Swift()
.setOnFileObjectStore("websites", false);
website = new WebsiteMock(new AccountMock(swift), "webs... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void delete() {
new DeleteObjectCommand(getAccount(), getClient(), getAccess(), this).call();
}
#location 2
#vulnerability type RESOURCE_LEAK | #fixed code
public void delete() {
commandFactory.createDeleteObjectCommand(getAccount(), getClient(), getAccess(), this).call();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void downloadObject(File targetFile, DownloadInstructions downloadInstructions) {
new DownloadObjectToFileCommand(getAccount(), getClient(), getAccess(), this, downloadInstructions, targetFile).call();
}
#location 2
... | #fixed code
public void downloadObject(File targetFile, DownloadInstructions downloadInstructions) {
commandFactory.createDownloadObjectToFileCommand(getAccount(), getClient(), getAccess(), this, downloadInstructions, targetFile).call();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void reauthenticateSuccess() {
when(statusLine.getStatusCode()).thenReturn(401).thenReturn(201);
when(authCommand.call()).thenReturn(new AccessImpl());
this.account = new AccountImpl(authCommand, httpClient, defaultAccess, true);... | #fixed code
@Test
public void reauthenticateSuccess() {
when(statusLine.getStatusCode()).thenReturn(401).thenReturn(201);
when(authCommand.call()).thenReturn(new AccessImpl());
this.account = new AccountImpl(authCommand, httpClient, defaultAccess, true);
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void makePublic() {
new ContainerRightsCommand(getAccount(), getClient(), getAccess(), this, true).call();
}
#location 2
#vulnerability type RESOURCE_LEAK | #fixed code
public void makePublic() {
commandFactory.createContainerRightsCommand(getAccount(), getClient(), getAccess(), this, true).call();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public StoredObject setContentType(String contentType) {
checkForInfo();
info.setContentType(new ObjectContentType(contentType));
new ObjectMetadataCommand(
getAccount(), getClient(), getAccess(), this,
info.getHea... | #fixed code
public StoredObject setContentType(String contentType) {
checkForInfo();
info.setContentType(new ObjectContentType(contentType));
commandFactory.createObjectMetadataCommand(
getAccount(), getClient(), getAccess(), this,
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@SuppressWarnings("ConstantConditions")
@Test
public void ignoreFileOnPulling() throws IOException, URISyntaxException {
Swift swift = new Swift()
.setOnFileObjectStore("object-store");
website = new WebsiteMock(new AccountMock(sw... | #fixed code
@SuppressWarnings("ConstantConditions")
@Test
public void ignoreFileOnPulling() throws IOException, URISyntaxException {
Swift swift = new Swift()
.setOnFileObjectStore("object-store", false);
website = new WebsiteMock(new AccountMock(s... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public InputStream downloadObjectAsInputStream(DownloadInstructions downloadInstructions) {
return new DownloadObjectAsInputStreamCommand(getAccount(), getClient(), getAccess(), this, downloadInstructions).call();
}
#location 2
... | #fixed code
public InputStream downloadObjectAsInputStream(DownloadInstructions downloadInstructions) {
return commandFactory.createDownloadObjectAsInputStreamCommand(getAccount(), getClient(), getAccess(), this, downloadInstructions).call();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test (expected = CommandException.class)
public void unknownError() throws IOException {
checkForError(500, new ContainerInformationCommand(this.account, httpClient, defaultAccess, account.getContainer("containerName")));
}
... | #fixed code
@Test (expected = CommandException.class)
public void unknownError() throws IOException {
checkForError(500, new ContainerInformationCommandImpl(this.account, httpClient, defaultAccess, account.getContainer("containerName")));
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Override
protected void saveMetadata() {
new ObjectMetadataCommand(getAccount(), getClient(), getAccess(), this, info.getHeaders()).call();
}
#location 3
#vulnerability type RESOURCE_LEAK | #fixed code
@Override
protected void saveMetadata() {
commandFactory.createObjectMetadataCommand(getAccount(), getClient(), getAccess(), this, info.getHeaders()).call();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@SuppressWarnings("ConstantConditions")
@Test
public void pullDifferentWebsites() throws IOException, URISyntaxException {
Swift swift = new Swift()
.setOnFileObjectStore("object-store");
website = new WebsiteMock(new AccountMock(... | #fixed code
@SuppressWarnings("ConstantConditions")
@Test
public void pullDifferentWebsites() throws IOException, URISyntaxException {
Swift swift = new Swift()
.setOnFileObjectStore("object-store", false);
website = new WebsiteMock(new AccountMock... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test(expected = UnauthorizedException.class)
public void reauthenticateNotAllowed() {
when(statusLine.getStatusCode()).thenReturn(401);
this.account.setAllowReauthenticate(false);
new CreateContainerCommand(this.account, httpClient, defaultA... | #fixed code
@Test(expected = UnauthorizedException.class)
public void reauthenticateNotAllowed() {
when(statusLine.getStatusCode()).thenReturn(401);
this.account.setAllowReauthenticate(false);
new CreateContainerCommandImpl(this.account, httpClient, defaultAcc... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public Collection<StoredObject> list(String prefix, String marker, int pageSize) {
ListInstructions listInstructions = new ListInstructions()
.setPrefix(prefix)
.setMarker(marker)
.setLimit(pageSize);
retur... | #fixed code
public Collection<StoredObject> list(String prefix, String marker, int pageSize) {
ListInstructions listInstructions = new ListInstructions()
.setPrefix(prefix)
.setMarker(marker)
.setLimit(pageSize);
return comm... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
protected void getInfo() {
this.info = new ObjectInformationCommand(getAccount(), getClient(), getAccess(), this).call();
this.setInfoRetrieved();
}
#location 2
#vulnerability type RESOURCE_LE... | #fixed code
protected void getInfo() {
this.info = commandFactory.createObjectInformationCommand(getAccount(), getClient(), getAccess(), this).call();
this.setInfoRetrieved();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void copyObject(Container targetContainer, StoredObject targetObject) {
new CopyObjectCommand(getAccount(), getClient(), getAccess(), this, targetObject).call();
}
#location 2
#vulnerability ty... | #fixed code
public void copyObject(Container targetContainer, StoredObject targetObject) {
commandFactory.createCopyObjectCommand(getAccount(), getClient(), getAccess(), this, targetObject).call();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void pushAndUpdate() throws IOException, URISyntaxException {
Swift swift = new Swift()
.setOnFileObjectStore("websites");
website = new WebsiteMock(new AccountMock(swift), "website");
website.pushDirectory(FileAc... | #fixed code
@Test
public void pushAndUpdate() throws IOException, URISyntaxException {
Swift swift = new Swift()
.setOnFileObjectStore("websites", false);
website = new WebsiteMock(new AccountMock(swift), "website");
website.pushDirectory(FileA... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
protected void getInfo() {
ObjectInformation info = new ObjectInformationCommand(getAccount(), getClient(), getAccess(), getContainer(), this).call();
this.lastModified = info.getLastModified();
this.etag = info.getEtag();
this.contentLen... | #fixed code
protected void getInfo() {
this.info = new ObjectInformationCommand(getAccount(), getClient(), getAccess(), getContainer(), this).call();
this.setInfoRetrieved();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test(expected = CommandException.class)
public void httpClientThrowsAnExceptionWithRootCause() throws IOException {
IOException exc = new IOException("Mocked HTTP client error");
when(httpClient.execute(any(HttpRequestBase.class))).thenThrow(new Co... | #fixed code
@Test(expected = CommandException.class)
public void httpClientThrowsAnExceptionWithRootCause() throws IOException {
IOException exc = new IOException("Mocked HTTP client error");
when(httpClient.execute(any(HttpRequestBase.class))).thenThrow(new CommandE... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void checkAuthenticationToken() {
when(statusLine.getStatusCode()).thenReturn(201);
CreateContainerCommand command =
new CreateContainerCommand(this.account, httpClient, defaultAccess, account.getContainer("containerName"));
... | #fixed code
@Test
public void checkAuthenticationToken() {
when(statusLine.getStatusCode()).thenReturn(201);
CreateContainerCommandImpl command =
new CreateContainerCommandImpl(this.account, httpClient, defaultAccess, account.getContainer("containerName"))... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void makePrivate() {
new ContainerRightsCommand(getAccount(), getClient(), getAccess(), this, false).call();
}
#location 2
#vulnerability type RESOURCE_LEAK | #fixed code
public void makePrivate() {
commandFactory.createContainerRightsCommand(getAccount(), getClient(), getAccess(), this, false).call();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void pushTwiceToWebsite() throws IOException, URISyntaxException {
Swift swift = new Swift()
.setOnFileObjectStore("websites");
website = new WebsiteMock(new AccountMock(swift), "website");
website.pushDirectory(F... | #fixed code
@Test
public void pushTwiceToWebsite() throws IOException, URISyntaxException {
Swift swift = new Swift()
.setOnFileObjectStore("websites", false);
website = new WebsiteMock(new AccountMock(swift), "website");
website.pushDirectory(... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void ignoreFoldersOnPushing() throws IOException, URISyntaxException {
Swift swift = new Swift()
.setOnFileObjectStore("websites");
website = new WebsiteMock(new AccountMock(swift), "website")
.setIgnoreFi... | #fixed code
@Test
public void ignoreFoldersOnPushing() throws IOException, URISyntaxException {
Swift swift = new Swift()
.setOnFileObjectStore("websites", false);
website = new WebsiteMock(new AccountMock(swift), "website")
.setIgnoreF... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test(expected = CommandException.class)
public void httpClientThrowsAnException() throws IOException {
when(httpClient.execute(any(HttpRequestBase.class))).thenThrow(new IOException("Mocked HTTP client error"));
new AuthenticationCommand(httpClient,... | #fixed code
@Test(expected = CommandException.class)
public void httpClientThrowsAnException() throws IOException {
when(httpClient.execute(any(HttpRequestBase.class))).thenThrow(new IOException("Mocked HTTP client error"));
new AuthenticationCommandImpl(httpClient, "... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void directlyUploadObject(UploadInstructions uploadInstructions) {
new UploadObjectCommand(getAccount(), getClient(), getAccess(), this, uploadInstructions).call();
}
#location 2
#vulnerability... | #fixed code
public void directlyUploadObject(UploadInstructions uploadInstructions) {
commandFactory.createUploadObjectCommand(getAccount(), getClient(), getAccess(), this, uploadInstructions).call();
} | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public static void main(String args[]) throws IOException {
if (args.length != 3) {
System.out.println("Use syntax: <USERNAME> <PASSWORD> <URL>");
return;
}
String username = args[0];
String password = args[1];
... | #fixed code
public static void main(String args[]) throws IOException {
if (args.length != 3) {
System.out.println("Use syntax: <USERNAME> <PASSWORD> <URL>");
return;
}
String username = args[0];
String password = args[1];
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public StoredObject setDeleteAfter(long seconds) {
checkForInfo();
info.setDeleteAt(null);
info.setDeleteAfter(new DeleteAfter(seconds));
new ObjectMetadataCommand(
getAccount(), getClient(), getAccess(), this,
... | #fixed code
public StoredObject setDeleteAfter(long seconds) {
checkForInfo();
info.setDeleteAt(null);
info.setDeleteAfter(new DeleteAfter(seconds));
commandFactory.createObjectMetadataCommand(
getAccount(), getClient(), getAccess(), this,
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
@Test
public void pushTwiceToWebsite() throws IOException, URISyntaxException {
Swift swift = new Swift()
.setOnFileObjectStore("websites");
website = new WebsiteMock(new AccountMock(swift), "website");
website.pushDirectory(F... | #fixed code
@Test
public void pushTwiceToWebsite() throws IOException, URISyntaxException {
Swift swift = new Swift()
.setOnFileObjectStore("websites", false);
website = new WebsiteMock(new AccountMock(swift), "website");
website.pushDirectory(... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void testWrite() throws Exception {
final File out1 = File.createTempFile("jdeb", ".ar");
final ArOutputStream os = new ArOutputStream(new FileOutputStream(out1));
os.putNextEntry(new ArEntry("data", 4));
os.write("data".getBytes(... | #fixed code
public void testWrite() throws Exception {
final File out1 = File.createTempFile("jdeb", ".ar");
final ArArchiveOutputStream os = new ArArchiveOutputStream(new FileOutputStream(out1));
os.putArchiveEntry(new ArArchiveEntry("data", 4));
os.writ... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void testCreation() throws Exception {
final Processor processor = new Processor(new Console() {
public void println(String s) {
}
}, null);
final File control = new File(getClass().getResource("deb/control/control").toURI());
final File archive1 =... | #fixed code
public void testCreation() throws Exception {
final Processor processor = new Processor(new Console() {
public void println(String s) {
}
}, null);
final File control = new File(getClass().getResource("deb/control/control").toURI());
final File archive1 = new F... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
protected void parse( final InputStream pInput ) throws IOException, ParseException {
final BufferedReader br = new BufferedReader(new InputStreamReader(pInput));
StringBuffer buffer = new StringBuffer();
String key = null;
int linenr = 0;
while(true) {
final ... | #fixed code
protected void parse( final InputStream pInput ) throws IOException, ParseException {
final BufferedReader br = new BufferedReader(new InputStreamReader(pInput));
StringBuffer buffer = new StringBuffer();
String key = null;
int linenr = 0;
while(true) {
final String... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
String toString( final String[] pKeys ) {
final StringBuffer s = new StringBuffer();
for (int i = 0; i < pKeys.length; i++) {
final String key = pKeys[i];
final String value = (String) values.get(key);
if (value != null) {
s.append(key).append(": ");
... | #fixed code
String toString( final String[] pKeys ) {
final StringBuffer s = new StringBuffer();
for (int i = 0; i < pKeys.length; i++) {
final String key = pKeys[i];
final String value = (String) values.get(key);
if (value != null) {
s.append(key).append(":");
try {
... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void execute() {
if (control == null || !control.isDirectory()) {
throw new BuildException("You need to point the 'control' attribute to the control directory.");
}
if (changes != null && !changes.isFile()) {
throw new BuildException("If you want the... | #fixed code
public void execute() {
if (control == null || !control.isDirectory()) {
throw new BuildException("You need to point the 'control' attribute to the control directory.");
}
if (changes != null && changes.isDirectory()) {
throw new BuildException("If you want the c... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void testRead() throws Exception {
final File archive = new File(getClass().getResource("data.ar").toURI());
final ArInputStream ar = new ArInputStream(new FileInputStream(archive));
final ArEntry entry1 = ar.getNextEntry();
assertEquals("data.tgz", entry1... | #fixed code
public void testRead() throws Exception {
final File archive = new File(getClass().getResource("data.ar").toURI());
final ArInputStream ar = new ArInputStream(new FileInputStream(archive));
final ArEntry entry1 = ar.getNextEntry();
assertEquals("data.tgz", entry1.getNa... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void testTarFileSet() throws Exception {
project.executeTarget("tarfileset");
File deb = new File("target/test-classes/test.deb");
assertTrue("package not build", deb.exists());
ArArchiveInputStream in = new ArArchiveInputStream(... | #fixed code
public void testTarFileSet() throws Exception {
project.executeTarget("tarfileset");
File deb = new File("target/test-classes/test.deb");
assertTrue("package not build", deb.exists());
ArchiveWalker.walkData(deb, new ArchiveVisitor<TarArchive... | Below is the vulnerable code, please generate the patch based on the following information. |
#vulnerable code
public void testTarFileSet() throws Exception {
project.executeTarget("tarfileset");
File deb = new File("target/test-classes/test.deb");
assertTrue("package not build", deb.exists());
ArArchiveInputStream in = new ArArchiveInputStream(... | #fixed code
public void testTarFileSet() throws Exception {
project.executeTarget("tarfileset");
File deb = new File("target/test-classes/test.deb");
assertTrue("package not build", deb.exists());
ArchiveWalker.walkData(deb, new ArchiveVisitor<TarArchive... | Below is the vulnerable code, please generate the patch based on the following information. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.