output
stringlengths
64
73.2k
input
stringlengths
208
73.3k
instruction
stringclasses
1 value
#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(...
#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) { ...
Below is the vulnerable code, please generate the patch based on the following information.
#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 ...
#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 ...
Below is the vulnerable code, please generate the patch based on the following information.
#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 ...
#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 ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testTrainAndValidate() { TestUtils.log(this.getClass(), "testTrainAndValidate"); RandomValue.setRandomGenerator(new Random(TestConfiguration.RANDOM_SEED)); DatabaseConfiguration dbConf = TestUtils.getDBConfig(); D...
#vulnerable code @Test public void testTrainAndValidate() { TestUtils.log(this.getClass(), "testTrainAndValidate"); RandomValue.setRandomGenerator(new Random(TestConfiguration.RANDOM_SEED)); DatabaseConfiguration dbConf = TestUtils.getDBConfig(); ...
Below is the vulnerable code, please generate the patch based on the following information.
#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: ...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void testSelectFeatures() { TestUtils.log(this.getClass(), "selectFeatures"); RandomValue.setRandomGenerator(new Random(42)); String dbName = "JUnitChisquareFeatureSelection"; TFIDF.TrainingP...
#vulnerable code @Test public void testSelectFeatures() { TestUtils.log(this.getClass(), "selectFeatures"); RandomValue.setRandomGenerator(new Random(42)); String dbName = "JUnitChisquareFeatureSelection"; TFIDF.Tra...
Below is the vulnerable code, please generate the patch based on the following information.
#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 ...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override protected void predictDataset(Dataframe newData) { _predictDataset(newData, false); }
#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, ...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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'...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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)....
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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()); ...
#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()) { ...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override protected void filterFeatures(Dataframe newData) { ModelParameters modelParameters = kb().getModelParameters(); //convert data into matrix Map<Object, Integer> featureIds= modelParameters.getFeatureIds(); Map<Int...
#vulnerable code @Override protected void filterFeatures(Dataframe newData) { ModelParameters modelParameters = kb().getModelParameters(); //convert data into matrix Map<Object, Integer> featureIds= modelParameters.getFeatureIds(); M...
Below is the vulnerable code, please generate the patch based on the following information.
#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()); ...
#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()) { ...
Below is the vulnerable code, please generate the patch based on the following information.
#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). ...
#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)....
Below is the vulnerable code, please generate the patch based on the following information.
#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 ...
#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 ...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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); ...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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()); ...
#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(...
Below is the vulnerable code, please generate the patch based on the following information.
#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", ""))) { ...
#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", "")...
Below is the vulnerable code, please generate the patch based on the following information.
#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)); }
#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 ...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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 ...
Below is the vulnerable code, please generate the patch based on the following information.
#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 ...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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 ...
Below is the vulnerable code, please generate the patch based on the following information.
#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 ...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public byte[] downloadObject(DownloadInstructions downloadInstructions) { return commandFactory.createDownloadObjectAsByteArrayCommand(getAccount(), getClient(), getAccess(), this, downloadInstructions).call(); }
#vulnerable code public byte[] downloadObject(DownloadInstructions downloadInstructions) { return new DownloadObjectAsByteArrayCommand(getAccount(), getClient(), getAccess(), this, downloadInstructions).call(); } #location 2 ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override protected void saveMetadata() { commandFactory.createContainerMetadataCommand(getAccount(), getClient(), getAccess(), this, info.getMetadata()).call(); }
#vulnerable code @Override protected void saveMetadata() { new ContainerMetadataCommand(getAccount(), getClient(), getAccess(), this, info.getMetadata()).call(); } #location 3 #vulnerability type RESOURCE_LEAK
Below is the vulnerable code, please generate the patch based on the following information.
#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]; ...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void getInfo() { this.info = new ContainerInformationCommand(getAccount(), getClient(), getAccess(), this).call(); this.setInfoRetrieved(); }
#vulnerable code protected void getInfo() { ContainerInformation info = new ContainerInformationCommand(getAccount(), getClient(), getAccess(), this).call(); this.bytesUsed = info.getBytesUsed(); this.objectCount = info.getObjectCount(); this.publicContai...
Below is the vulnerable code, please generate the patch based on the following information.
#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]; ...
#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]; ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void delete() { commandFactory.createDeleteContainerCommand(getAccount(), getClient(), getAccess(), this).call(); }
#vulnerable code public void delete() { new DeleteContainerCommand(getAccount(), getClient(), getAccess(), this).call(); } #location 2 #vulnerability type RESOURCE_LEAK
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void setPreferredRegion(String preferredRegion) { this.preferredRegion = preferredRegion; }
#vulnerable code public void setPreferredRegion(String preferredRegion) { this.currentEndPoint = getObjectStoreCatalog().getRegion(preferredRegion); } #location 2 #vulnerability type NULL_DEREFERENCE
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test (expected = CommandException.class ) public void getSegmentationPlanThrowsIOException() throws Exception { new Expectations() { @Mocked UploadPayloadFile uploadPayload; { new UploadPayloadFile(null); result = uploadPayload...
#vulnerable code @Test (expected = CommandException.class ) public void getSegmentationPlanThrowsIOException() throws Exception { UploadPayloadFile uploadPayload = mock(UploadPayloadFile.class); whenNew(UploadPayloadFile.class).withArguments(null).thenReturn(uploadPa...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void getInfo() { this.info = new AccountInformationCommand(this, httpClient, access).call(); this.setInfoRetrieved(); }
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public Container create() { commandFactory.createCreateContainerCommand(getAccount(), getClient(), getAccess(), this).call(); return this; }
#vulnerable code public Container create() { new CreateContainerCommand(getAccount(), getClient(), getAccess(), this).call(); return this; } #location 2 #vulnerability type RESOURCE_LEAK
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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(...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void getInfo() { this.info = commandFactory.createContainerInformationCommand(getAccount(), getClient(), getAccess(), this).call(); this.setInfoRetrieved(); }
#vulnerable code protected void getInfo() { this.info = new ContainerInformationCommand(getAccount(), getClient(), getAccess(), this).call(); this.setInfoRetrieved(); } #location 2 #vulnerability type RESOURCE...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#vulnerable code @SuppressWarnings("ConstantConditions") @Test public void pullWebsite() throws IOException, URISyntaxException { Swift swift = new Swift() .setOnFileObjectStore("websites"); website = new WebsiteMock(new AccountMock(swift), "websi...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void delete() { commandFactory.createDeleteObjectCommand(getAccount(), getClient(), getAccess(), this).call(); }
#vulnerable code public void delete() { new DeleteObjectCommand(getAccount(), getClient(), getAccess(), this).call(); } #location 2 #vulnerability type RESOURCE_LEAK
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void downloadObject(File targetFile, DownloadInstructions downloadInstructions) { commandFactory.createDownloadObjectToFileCommand(getAccount(), getClient(), getAccess(), this, downloadInstructions, targetFile).call(); }
#vulnerable code public void downloadObject(File targetFile, DownloadInstructions downloadInstructions) { new DownloadObjectToFileCommand(getAccount(), getClient(), getAccess(), this, downloadInstructions, targetFile).call(); } #location 2 ...
Below is the vulnerable code, please generate the patch based on the following information.
#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); ...
#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);...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void makePublic() { commandFactory.createContainerRightsCommand(getAccount(), getClient(), getAccess(), this, true).call(); }
#vulnerable code public void makePublic() { new ContainerRightsCommand(getAccount(), getClient(), getAccess(), this, true).call(); } #location 2 #vulnerability type RESOURCE_LEAK
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public StoredObject setContentType(String contentType) { checkForInfo(); info.setContentType(new ObjectContentType(contentType)); commandFactory.createObjectMetadataCommand( getAccount(), getClient(), getAccess(), this, ...
#vulnerable code public StoredObject setContentType(String contentType) { checkForInfo(); info.setContentType(new ObjectContentType(contentType)); new ObjectMetadataCommand( getAccount(), getClient(), getAccess(), this, info.getHea...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#vulnerable code @SuppressWarnings("ConstantConditions") @Test public void ignoreFileOnPulling() throws IOException, URISyntaxException { Swift swift = new Swift() .setOnFileObjectStore("object-store"); website = new WebsiteMock(new AccountMock(sw...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public InputStream downloadObjectAsInputStream(DownloadInstructions downloadInstructions) { return commandFactory.createDownloadObjectAsInputStreamCommand(getAccount(), getClient(), getAccess(), this, downloadInstructions).call(); }
#vulnerable code public InputStream downloadObjectAsInputStream(DownloadInstructions downloadInstructions) { return new DownloadObjectAsInputStreamCommand(getAccount(), getClient(), getAccess(), this, downloadInstructions).call(); } #location 2 ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test (expected = CommandException.class) public void unknownError() throws IOException { checkForError(500, new ContainerInformationCommandImpl(this.account, httpClient, defaultAccess, account.getContainer("containerName"))); }
#vulnerable code @Test (expected = CommandException.class) public void unknownError() throws IOException { checkForError(500, new ContainerInformationCommand(this.account, httpClient, defaultAccess, account.getContainer("containerName"))); } ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Override protected void saveMetadata() { commandFactory.createObjectMetadataCommand(getAccount(), getClient(), getAccess(), this, info.getHeaders()).call(); }
#vulnerable code @Override protected void saveMetadata() { new ObjectMetadataCommand(getAccount(), getClient(), getAccess(), this, info.getHeaders()).call(); } #location 3 #vulnerability type RESOURCE_LEAK
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @SuppressWarnings("ConstantConditions") @Test public void pullDifferentWebsites() throws IOException, URISyntaxException { Swift swift = new Swift() .setOnFileObjectStore("object-store", false); website = new WebsiteMock(new AccountMock...
#vulnerable code @SuppressWarnings("ConstantConditions") @Test public void pullDifferentWebsites() throws IOException, URISyntaxException { Swift swift = new Swift() .setOnFileObjectStore("object-store"); website = new WebsiteMock(new AccountMock(...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test(expected = UnauthorizedException.class) public void reauthenticateNotAllowed() { when(statusLine.getStatusCode()).thenReturn(401); this.account.setAllowReauthenticate(false); new CreateContainerCommandImpl(this.account, httpClient, defaultAcc...
#vulnerable code @Test(expected = UnauthorizedException.class) public void reauthenticateNotAllowed() { when(statusLine.getStatusCode()).thenReturn(401); this.account.setAllowReauthenticate(false); new CreateContainerCommand(this.account, httpClient, defaultA...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public Collection<StoredObject> list(String prefix, String marker, int pageSize) { ListInstructions listInstructions = new ListInstructions() .setPrefix(prefix) .setMarker(marker) .setLimit(pageSize); return comm...
#vulnerable code public Collection<StoredObject> list(String prefix, String marker, int pageSize) { ListInstructions listInstructions = new ListInstructions() .setPrefix(prefix) .setMarker(marker) .setLimit(pageSize); retur...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void getInfo() { this.info = commandFactory.createObjectInformationCommand(getAccount(), getClient(), getAccess(), this).call(); this.setInfoRetrieved(); }
#vulnerable code protected void getInfo() { this.info = new ObjectInformationCommand(getAccount(), getClient(), getAccess(), this).call(); this.setInfoRetrieved(); } #location 2 #vulnerability type RESOURCE_LE...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void copyObject(Container targetContainer, StoredObject targetObject) { commandFactory.createCopyObjectCommand(getAccount(), getClient(), getAccess(), this, targetObject).call(); }
#vulnerable code public void copyObject(Container targetContainer, StoredObject targetObject) { new CopyObjectCommand(getAccount(), getClient(), getAccess(), this, targetObject).call(); } #location 2 #vulnerability ty...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void getInfo() { this.info = new ObjectInformationCommand(getAccount(), getClient(), getAccess(), getContainer(), this).call(); this.setInfoRetrieved(); }
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void checkAuthenticationToken() { when(statusLine.getStatusCode()).thenReturn(201); CreateContainerCommandImpl command = new CreateContainerCommandImpl(this.account, httpClient, defaultAccess, account.getContainer("containerName"))...
#vulnerable code @Test public void checkAuthenticationToken() { when(statusLine.getStatusCode()).thenReturn(201); CreateContainerCommand command = new CreateContainerCommand(this.account, httpClient, defaultAccess, account.getContainer("containerName")); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void makePrivate() { commandFactory.createContainerRightsCommand(getAccount(), getClient(), getAccess(), this, false).call(); }
#vulnerable code public void makePrivate() { new ContainerRightsCommand(getAccount(), getClient(), getAccess(), this, false).call(); } #location 2 #vulnerability type RESOURCE_LEAK
Below is the vulnerable code, please generate the patch based on the following information.
#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(...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code @Test public void ignoreFoldersOnPushing() throws IOException, URISyntaxException { Swift swift = new Swift() .setOnFileObjectStore("websites", false); website = new WebsiteMock(new AccountMock(swift), "website") .setIgnoreF...
#vulnerable code @Test public void ignoreFoldersOnPushing() throws IOException, URISyntaxException { Swift swift = new Swift() .setOnFileObjectStore("websites"); website = new WebsiteMock(new AccountMock(swift), "website") .setIgnoreFi...
Below is the vulnerable code, please generate the patch based on the following information.
#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, "...
#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,...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void directlyUploadObject(UploadInstructions uploadInstructions) { commandFactory.createUploadObjectCommand(getAccount(), getClient(), getAccess(), this, uploadInstructions).call(); }
#vulnerable code public void directlyUploadObject(UploadInstructions uploadInstructions) { new UploadObjectCommand(getAccount(), getClient(), getAccess(), this, uploadInstructions).call(); } #location 2 #vulnerability...
Below is the vulnerable code, please generate the patch based on the following information.
#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]; ...
#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]; ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public StoredObject setDeleteAfter(long seconds) { checkForInfo(); info.setDeleteAt(null); info.setDeleteAfter(new DeleteAfter(seconds)); commandFactory.createObjectMetadataCommand( getAccount(), getClient(), getAccess(), this, ...
#vulnerable code public StoredObject setDeleteAfter(long seconds) { checkForInfo(); info.setDeleteAt(null); info.setDeleteAfter(new DeleteAfter(seconds)); new ObjectMetadataCommand( getAccount(), getClient(), getAccess(), this, ...
Below is the vulnerable code, please generate the patch based on the following information.
#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(...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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(...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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 =...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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 ...
Below is the vulnerable code, please generate the patch based on the following information.
#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 { ...
#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(": "); ...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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(...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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(...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private PackageDescriptor createPackageDescriptor(File file, BigInteger pDataSize) throws IOException, ParseException { FilteredConfigurationFile controlFile = new FilteredConfigurationFile(file.getName(), new FileInputStream(file), resolver); PackageDescripto...
#vulnerable code private PackageDescriptor createPackageDescriptor(File file, BigInteger pDataSize) throws IOException, ParseException { PackageDescriptor packageDescriptor = new PackageDescriptor(new FileInputStream(file), resolver); if (packageDescriptor.get("Date") =...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void produce( final DataConsumer receiver ) { TarInputStream archiveInputStream = null; try { archiveInputStream = new TarInputStream(getCompressedInputStream(new FileInputStream(archive))); while(true) { TarEntry entry = archiveInputStream.getNextEnt...
#vulnerable code public void produce( final DataConsumer receiver ) { TarInputStream archiveInputStream = null; try { archiveInputStream = new TarInputStream(new GZIPInputStream(new FileInputStream(archive))); while(true) { TarEntry entry = archiveInputStream.getNextEn...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void testNoCompression() throws Exception { project.executeTarget("no-compression"); File deb = new File("target/test-classes/test.deb"); assertTrue("package not build", deb.exists()); boolean found = false; ArInputStream in = new ArInputStream(new FileInputS...
#vulnerable code public void testNoCompression() throws Exception { project.executeTarget("no-compression"); File deb = new File("target/test-classes/test.deb"); assertTrue("package not build", deb.exists()); boolean found = false; ArInputStream in = new ArInputStream(new File...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void testBZip2Compression() throws Exception { project.executeTarget("bzip2-compression"); File deb = new File("target/test-classes/test.deb"); assertTrue("package not build", deb.exists()); boolean found = false; ArArchiveInp...
#vulnerable code public void testBZip2Compression() throws Exception { project.executeTarget("bzip2-compression"); File deb = new File("target/test-classes/test.deb"); assertTrue("package not build", deb.exists()); boolean found = false; ArInpu...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void testBZip2Compression() throws Exception { project.executeTarget("bzip2-compression"); File deb = new File("target/test-classes/test.deb"); assertTrue("package not build", deb.exists()); final AtomicBoolean found = new AtomicBoolea...
#vulnerable code public void testBZip2Compression() throws Exception { project.executeTarget("bzip2-compression"); File deb = new File("target/test-classes/test.deb"); assertTrue("package not build", deb.exists()); boolean found = false; ArArch...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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 =...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public BinaryPackageControlFile createDeb(Compression compression) throws PackagingException { File tempData = null; File tempControl = null; try { tempData = File.createTempFile("deb", "data"); tempControl = File.createTempFi...
#vulnerable code public BinaryPackageControlFile createDeb(Compression compression) throws PackagingException { File tempData = null; File tempControl = null; try { tempData = File.createTempFile("deb", "data"); tempControl = File.create...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void produce( final DataConsumer pReceiver ) throws IOException { InputStream is = new BufferedInputStream(new FileInputStream(archive)); CompressorInputStream compressorInputStream = null; try { // FIXME remove once commons 1.1 is o...
#vulnerable code public void produce( final DataConsumer pReceiver ) throws IOException { TarInputStream archiveInputStream = null; try { archiveInputStream = new TarInputStream(getCompressedInputStream(new FileInputStream(archive))); while(true...
Below is the vulnerable code, please generate the patch based on the following information.
#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()); ArArchiveInputStream in = new ArArchiveInputStream(new Fi...
#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()); ArInputStream in = new ArInputStream(new FileInputS...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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 =...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code private PackageDescriptor buildControl( final File[] pControlFiles, final BigInteger pDataSize, final StringBuilder pChecksums, final File pOutput ) throws IOException, ParseException { final File dir = pOutput.getParentFile(); if (dir != null && (!dir.exists...
#vulnerable code private PackageDescriptor buildControl( final File[] pControlFiles, final BigInteger pDataSize, final StringBuilder pChecksums, final File pOutput ) throws IOException, ParseException { final File dir = pOutput.getParentFile(); if (dir != null && (!dir....
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void clearSign(InputStream input, OutputStream output) throws IOException, PGPException, GeneralSecurityException { int digest = PGPUtil.SHA1; PGPSignatureGenerator signatureGenerator = new PGPSignatureGenerator(new BcPGPContentSignerBuilder(pr...
#vulnerable code public void clearSign(InputStream input, OutputStream output) throws IOException, PGPException, GeneralSecurityException { int digest = PGPUtil.SHA1; PGPSignatureGenerator signatureGenerator = new PGPSignatureGenerator(new BcPGPContentSignerBuil...
Below is the vulnerable code, please generate the patch based on the following information.
#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...
#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(...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void testNoCompression() throws Exception { project.executeTarget("no-compression"); File deb = new File("target/test-classes/test.deb"); assertTrue("package not build", deb.exists()); boolean found = false; ArInputStream in = new ArInputStream(new FileInputS...
#vulnerable code public void testNoCompression() throws Exception { project.executeTarget("no-compression"); File deb = new File("target/test-classes/test.deb"); assertTrue("package not build", deb.exists()); boolean found = false; ArInputStream in = new ArInputStream(new File...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void testControlFilesPermissions() throws Exception { File deb = new File("target/test-classes/test-control.deb"); if (deb.exists() && !deb.delete()) { fail("Couldn't delete " + deb); } Processor processor = new Proc...
#vulnerable code public void testControlFilesPermissions() throws Exception { File deb = new File("target/test-classes/test-control.deb"); if (deb.exists() && !deb.delete()) { fail("Couldn't delete " + deb); } Processor processor = ne...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void testCreateParentDirectories() throws Exception { File archive = new File("target/data.tar"); if (archive.exists()) { archive.delete(); } DataBuilder builder = new DataBuilder(new NullConsole()); ...
#vulnerable code public void testCreateParentDirectories() throws Exception { File archive = new File("target/data.tar"); if (archive.exists()) { archive.delete(); } DataBuilder builder = new DataBuilder(new NullConsole()); ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void testBZip2Compression() throws Exception { project.executeTarget("bzip2-compression"); File deb = new File("target/test-classes/test.deb"); assertTrue("package not build", deb.exists()); boolean found = false; ArArchiveInp...
#vulnerable code public void testBZip2Compression() throws Exception { project.executeTarget("bzip2-compression"); File deb = new File("target/test-classes/test.deb"); assertTrue("package not build", deb.exists()); boolean found = false; ArInpu...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void testBZip2Compression() throws Exception { project.executeTarget("bzip2-compression"); File deb = new File("target/test-classes/test.deb"); assertTrue("package not build", deb.exists()); boolean found = false; ArInputStream in = new ArInputStream(new File...
#vulnerable code public void testBZip2Compression() throws Exception { project.executeTarget("bzip2-compression"); File deb = new File("target/test-classes/test.deb"); assertTrue("package not build", deb.exists()); boolean found = false; ArInputStream in = new ArInputStream(ne...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public static byte[] toUnixLineEndings(InputStream input) throws IOException { String encoding = "ISO-8859-1"; FixCrLfFilter filter = new FixCrLfFilter(new InputStreamReader(input, encoding)); filter.setEol(FixCrLfFilter.CrLf.newInstance("unix")); ...
#vulnerable code public static byte[] toUnixLineEndings(InputStream input) throws IOException { final Charset UTF8 = Charset.forName("UTF-8"); final BufferedReader reader = new BufferedReader(new InputStreamReader(input)); final ByteArrayOutputStream dataStream ...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code protected void parse( final InputStream pInput ) throws IOException, ParseException { final BufferedReader br = new BufferedReader(new InputStreamReader(pInput, "UTF-8")); StringBuilder buffer = new StringBuilder(); String key = null; int linen...
#vulnerable code protected void parse( final InputStream pInput ) throws IOException, ParseException { final BufferedReader br = new BufferedReader(new InputStreamReader(pInput)); StringBuilder buffer = new StringBuilder(); String key = null; int linenr =...
Below is the vulnerable code, please generate the patch based on the following information.
#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 (changesIn != null) { if (!changesIn.isFile() || !changesIn.canRead()) { throw n...
#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 (changesIn != null) { if (!changesIn.isFile() || !changesIn.canRead()) { t...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public void testRead() throws Exception { final File archive = new File(getClass().getResource("data.ar").toURI()); final ArArchiveInputStream ar = new ArArchiveInputStream(new FileInputStream(archive)); final ArArchiveEntry entry1 = ar.getNextArEntry...
#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(); asse...
Below is the vulnerable code, please generate the patch based on the following information.
#fixed code public PackageDescriptor createDeb( final File[] pControlFiles, final DataProducer[] pData, final File pOutput, String compression ) throws PackagingException, InvalidDescriptorException { File tempData = null; File tempControl = null; try { ...
#vulnerable code public PackageDescriptor createDeb( final File[] pControlFiles, final DataProducer[] pData, final File pOutput, String compression ) throws PackagingException, InvalidDescriptorException { File tempData = null; File tempControl = null; try { ...
Below is the vulnerable code, please generate the patch based on the following information.