input
stringlengths
205
73.3k
output
stringlengths
64
73.2k
instruction
stringclasses
1 value
#vulnerable code @Override public void replaceIndex(String newLuceneIndexPathString) { LOG.debug( "Replacing Lucene indexes at {} for dimension {} with new index at {}", luceneDirectory.toString(), dimension.getApiName(), ...
#fixed code @Override public void replaceIndex(String newLuceneIndexPathString) { LOG.debug( "Replacing Lucene indexes at {} for dimension {} with new index at {}", luceneDirectory.toString(), dimension.getApiName(), ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public LookbackQuery withInnerQueryPostAggregations(Collection<PostAggregation> postAggregations) { return new LookbackQuery(new QueryDataSource(getInnerQuery().withPostAggregations(postAggregations)), granularity, filter, aggregations, getLookbackPostAggregatio...
#fixed code public LookbackQuery withInnerQueryPostAggregations(Collection<PostAggregation> postAggregations) { return new LookbackQuery(new QueryDataSource(getInnerQueryUnchecked().withPostAggregations(postAggregations)), granularity, filter, aggregations, getLookbackPostAggrega...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected Pagination<DimensionRow> getResultsPage(Query query, PaginationParameters paginationParameters) throws PageNotFoundException { int perPage = paginationParameters.getPerPage(); validatePerPage(perPage); TreeSet<DimensionRow...
#fixed code protected Pagination<DimensionRow> getResultsPage(Query query, PaginationParameters paginationParameters) throws PageNotFoundException { int perPage = paginationParameters.getPerPage(); validatePerPage(perPage); TreeSet<DimensionRow> filt...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override @JsonIgnore public Granularity getGranularity() { return getInnerQuery().getGranularity(); } #location 4 #vulnerability type NULL_DEREFERENCE
#fixed code @Override @JsonIgnore public Granularity getGranularity() { return getInnerQueryUnchecked().getGranularity(); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void start(ExtendedSequenceNumber extendedSequenceNumber, InitialPositionInStreamExtended initialPositionInStreamExtended) { if (executorService.isShutdown()) { throw new IllegalStateException("ExecutorService has been shutdown."...
#fixed code @Override public void start(ExtendedSequenceNumber extendedSequenceNumber, InitialPositionInStreamExtended initialPositionInStreamExtended) { if (executorService.isShutdown()) { throw new IllegalStateException("ExecutorService has been shutdown."); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private void initialize() { boolean isDone = false; Exception lastException = null; for (int i = 0; (!isDone) && (i < MAX_INITIALIZATION_ATTEMPTS); i++) { try { LOG.info("Initialization attempt " + (i + 1)); ...
#fixed code private void initialize() { boolean isDone = false; Exception lastException = null; for (int i = 0; (!isDone) && (i < MAX_INITIALIZATION_ATTEMPTS); i++) { try { LOG.info("Initialization attempt " + (i + 1)); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public Shard getShard(String shardId) { if (this.listOfShardsSinceLastGet.get() == null) { //Update this.listOfShardsSinceLastGet as needed. this.getShardList(); } for (Shard shard : listOfShardsSinceLastGet...
#fixed code @Override public Shard getShard(String shardId) { if (this.cachedShardMap == null) { synchronized (this) { if (this.cachedShardMap == null) { this.getShardList(); } } } Sh...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void run() { if (shutdown) { return; } try { initialize(); LOG.info("Initialization complete. Starting worker loop."); } catch (RuntimeException e1) { LOG.error("Unable to initialize...
#fixed code public void run() { if (shutdown) { return; } try { initialize(); LOG.info("Initialization complete. Starting worker loop."); } catch (RuntimeException e1) { LOG.error("Unable to initialize after...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void start(ExtendedSequenceNumber extendedSequenceNumber, InitialPositionInStreamExtended initialPositionInStreamExtended) { if (executorService.isShutdown()) { throw new IllegalStateException("ExecutorService has been shutdown."...
#fixed code @Override public void start(ExtendedSequenceNumber extendedSequenceNumber, InitialPositionInStreamExtended initialPositionInStreamExtended) { if (executorService.isShutdown()) { throw new IllegalStateException("ExecutorService has been shutdown."); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public DescribeStreamResult getStreamInfo(String startShardId) throws ResourceNotFoundException, LimitExceededException { final DescribeStreamRequest describeStreamRequest = new DescribeStreamRequest(); describeStreamRequest.setRequ...
#fixed code @Override public DescribeStreamResult getStreamInfo(String startShardId) throws ResourceNotFoundException, LimitExceededException { final DescribeStreamRequest describeStreamRequest = new DescribeStreamRequest(); describeStreamRequest.setReques...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testRetryableRetrievalExceptionContinues() { GetRecordsResponse response = GetRecordsResponse.builder().millisBehindLatest(100L).records(Collections.emptyList()).build(); when(getRecordsRetrievalStrategy.getRecords(anyInt())).thenT...
#fixed code @Test public void testRetryableRetrievalExceptionContinues() { GetRecordsResponse response = GetRecordsResponse.builder().millisBehindLatest(100L).records(Collections.emptyList()).build(); when(getRecordsRetrievalStrategy.getRecords(anyInt())).thenThrow(n...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void onErrorStopsProcessingTest() throws Exception { Throwable expected = new Throwable("Wheee"); addItemsToReturn(10); recordsPublisher.add(new ResponseItem(expected)); addItemsToReturn(10); setupNotifierAnswer(...
#fixed code @Test public void onErrorStopsProcessingTest() throws Exception { Throwable expected = new Throwable("Wheee"); addItemsToReturn(10); recordsPublisher.add(new ResponseItem(expected)); addItemsToReturn(10); setupNotifierAnswer(10); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test(expected = IllegalStateException.class) public void testGetNextRecordsWithoutStarting() { verify(executorService, times(0)).execute(any()); getRecordsCache.pollNextResultAndUpdatePrefetchCounters(); } #location ...
#fixed code @Test(expected = IllegalStateException.class) public void testGetNextRecordsWithoutStarting() { verify(executorService, times(0)).execute(any()); getRecordsCache.drainQueueForRequests(); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void multipleItemTest() throws Exception { addItemsToReturn(100); setupNotifierAnswer(recordsPublisher.responses.size()); synchronized (processedNotifier) { subscriber.startSubscriptions(); processedNoti...
#fixed code @Test public void multipleItemTest() throws Exception { addItemsToReturn(100); setupNotifierAnswer(recordsPublisher.responses.size()); synchronized (processedNotifier) { subscriber.startSubscriptions(); processedNotifier.w...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test(expected = IllegalStateException.class) public void testGetNextRecordsWithoutStarting() { verify(executorService, times(0)).execute(any()); getRecordsCache.getNextResult(); } #location 4 ...
#fixed code @Test(expected = IllegalStateException.class) public void testGetNextRecordsWithoutStarting() { verify(executorService, times(0)).execute(any()); getRecordsCache.pollNextResultAndUpdatePrefetchCounters(); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test(expected = IllegalStateException.class) public void testCallAfterShutdown() { when(executorService.isShutdown()).thenReturn(true); getRecordsCache.pollNextResultAndUpdatePrefetchCounters(); } #location 4 ...
#fixed code @Test(expected = IllegalStateException.class) public void testCallAfterShutdown() { when(executorService.isShutdown()).thenReturn(true); getRecordsCache.drainQueueForRequests(); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void consumerErrorSkipsEntryTest() throws Exception { addItemsToReturn(20); Throwable testException = new Throwable("ShardConsumerError"); doAnswer(new Answer() { int expectedInvocations = recordsPublisher.responses...
#fixed code @Test public void consumerErrorSkipsEntryTest() throws Exception { addItemsToReturn(20); Throwable testException = new Throwable("ShardConsumerError"); doAnswer(new Answer() { int expectedInvocations = recordsPublisher.responses.size(...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testExpiredIteratorException() { log.info("Starting tests"); when(getRecordsRetrievalStrategy.getRecords(MAX_RECORDS_PER_CALL)).thenThrow(ExpiredIteratorException.class) .thenReturn(getRecordsResponse); getR...
#fixed code @Test public void testExpiredIteratorException() { log.info("Starting tests"); when(getRecordsRetrievalStrategy.getRecords(MAX_RECORDS_PER_CALL)).thenThrow(ExpiredIteratorException.class) .thenReturn(getRecordsResponse); getRecords...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testGetRecords() { record = Record.builder().data(createByteBufferWithSize(SIZE_512_KB)).build(); when(records.size()).thenReturn(1000); final List<KinesisClientRecord> expectedRecords = records.stream() .m...
#fixed code @Test public void testGetRecords() { record = Record.builder().data(createByteBufferWithSize(SIZE_512_KB)).build(); when(records.size()).thenReturn(1000); final List<KinesisClientRecord> expectedRecords = records.stream() .map(Kin...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void singleItemTest() throws Exception { addItemsToReturn(1); setupNotifierAnswer(1); synchronized (processedNotifier) { subscriber.startSubscriptions(); processedNotifier.wait(5000); } ...
#fixed code @Test public void singleItemTest() throws Exception { addItemsToReturn(1); setupNotifierAnswer(1); synchronized (processedNotifier) { subscriber.startSubscriptions(); processedNotifier.wait(5000); } verify...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test(expected = IllegalStateException.class) public void testCallAfterShutdown() { when(executorService.isShutdown()).thenReturn(true); getRecordsCache.getNextResult(); } #location 4 #vul...
#fixed code @Test(expected = IllegalStateException.class) public void testCallAfterShutdown() { when(executorService.isShutdown()).thenReturn(true); getRecordsCache.pollNextResultAndUpdatePrefetchCounters(); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test(timeout = 10000L) public void testNoDeadlockOnFullQueue() { // // Fixes https://github.com/awslabs/amazon-kinesis-client/issues/448 // // This test is to verify that the drain of a blocked queue no longer deadlocks. // I...
#fixed code @Test(timeout = 10000L) public void testNoDeadlockOnFullQueue() { // // Fixes https://github.com/awslabs/amazon-kinesis-client/issues/448 // // This test is to verify that the drain of a blocked queue no longer deadlocks. // If the ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void run() { if (shutdown) { return; } try { initialize(); LOG.info("Initialization complete. Starting worker loop."); } catch (RuntimeException e1) { LOG.error("Unable to initialize...
#fixed code public void run() { if (shutdown) { return; } try { initialize(); LOG.info("Initialization complete. Starting worker loop."); } catch (RuntimeException e1) { LOG.error("Unable to initialize after...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code protected void reloadConfig() throws IOException { LOGGER.log(Level.INFO, "Reloading configuration"); loadConfig(new FileReader(WebServer.configFilePath), activeConfig.client); } #location 4 ...
#fixed code protected void reloadConfig() throws IOException { LOGGER.log(Level.INFO, "Reloading configuration"); FileReader reader = null; try { reader = new FileReader(WebServer.configFilePath); loadConfig(reader, activeConfig.client); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @RequestMapping("/error") @ResponseStatus(HttpStatus.OK) public Result<String> error() { RequestContext ctx = RequestContext.getCurrentContext(); Throwable throwable = ctx.getThrowable(); if(null != throwable && throwable instanceof ZuulException ){ ZuulExcepti...
#fixed code @RequestMapping("/error") @ResponseStatus(HttpStatus.OK) public Result<String> error() { RequestContext ctx = RequestContext.getCurrentContext(); Throwable throwable = ctx.getThrowable(); if(null != throwable && throwable instanceof ZuulException ){ ZuulException e =...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void test() throws Exception { for (int i = 0; i < 5; i++) { SpecCaptcha specCaptcha = new SpecCaptcha(); //specCaptcha.setCharType(Captcha.TYPE_ONLY_NUMBER); System.out.println(specCaptcha.text()); ...
#fixed code @Test public void test() throws Exception { for (int i = 0; i < 5; i++) { SpecCaptcha specCaptcha = new SpecCaptcha(); //specCaptcha.setCharType(Captcha.TYPE_ONLY_NUMBER); System.out.println(specCaptcha.text()); //sp...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void test() throws Exception { SpecCaptcha specCaptcha = new SpecCaptcha(); System.out.println(specCaptcha.text()); specCaptcha.out(new FileOutputStream(new File("D:/a/aa.png"))); } #location 5 ...
#fixed code @Test public void test() throws Exception { SpecCaptcha specCaptcha = new SpecCaptcha(); System.out.println(specCaptcha.text()); //specCaptcha.out(new FileOutputStream(new File("D:/a/aa.png"))); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testHan() throws Exception { ChineseCaptcha chineseCaptcha = new ChineseCaptcha(); //chineseCaptcha.setFont(new Font("微软雅黑", Font.PLAIN, 25)); System.out.println(chineseCaptcha.text()); chineseCaptcha.out(new FileOut...
#fixed code @Test public void testHan() throws Exception { ChineseCaptcha chineseCaptcha = new ChineseCaptcha(); //chineseCaptcha.setFont(new Font("微软雅黑", Font.PLAIN, 25)); System.out.println(chineseCaptcha.text()); //chineseCaptcha.out(new FileOutputS...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void test() throws Exception { for (int i = 0; i < 100; i++) { SpecCaptcha specCaptcha = new SpecCaptcha(); specCaptcha.setCharType(Captcha.TYPE_ONLY_NUMBER); System.out.println(specCaptcha.text()); ...
#fixed code @Test public void test() throws Exception { for (int i = 0; i < 5; i++) { SpecCaptcha specCaptcha = new SpecCaptcha(); //specCaptcha.setCharType(Captcha.TYPE_ONLY_NUMBER); System.out.println(specCaptcha.text()); //sp...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code Map<String, List<LocalLoader>> getPathsUnchecked(final boolean export) { try { return getPaths(export); } catch (ModuleLoadException e) { throw e.toError(); } } #location 3 ...
#fixed code Module(final ConcreteModuleSpec spec, final ModuleLoader moduleLoader) { this.moduleLoader = moduleLoader; // Initialize state from the spec. identifier = spec.getModuleIdentifier(); mainClassName = spec.getMainClass(); fallbackLoader ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code boolean linkExports(final Linkage linkage) throws ModuleLoadException { final HashMap<String, List<LocalLoader>> exportsMap = new HashMap<String, List<LocalLoader>>(); final Dependency[] dependencies = linkage.getSourceList(); final long start = ...
#fixed code Module(final ConcreteModuleSpec spec, final ModuleLoader moduleLoader, final Object myKey) { this.moduleLoader = moduleLoader; this.myKey = myKey; // Initialize state from the spec. identifier = spec.getModuleIdentifier(); mainClassNam...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code void link(final Linkage linkage) throws ModuleLoadException { final HashMap<String, List<LocalLoader>> importsMap = new HashMap<String, List<LocalLoader>>(); final HashMap<String, List<LocalLoader>> exportsMap = new HashMap<String, List<LocalLoader>>(); ...
#fixed code Module(final ConcreteModuleSpec spec, final ModuleLoader moduleLoader, final Object myKey) { this.moduleLoader = moduleLoader; this.myKey = myKey; // Initialize state from the spec. identifier = spec.getModuleIdentifier(); mainClassNam...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code long addExportedPaths(Dependency[] dependencies, Map<String, List<LocalLoader>> map, FastCopyHashSet<PathFilter> filterStack, Set<Visited> visited) throws ModuleLoadException { if (!visited.add(new Visited(this, filterStack))) { return 0L; } ...
#fixed code Module(final ConcreteModuleSpec spec, final ModuleLoader moduleLoader, final Object myKey) { this.moduleLoader = moduleLoader; this.myKey = myKey; // Initialize state from the spec. identifier = spec.getModuleIdentifier(); mainClassNam...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private void buildIndex(final List<String> index, final File root, final String pathBase) { for (File file : root.listFiles()) { if (file.isDirectory()) { index.add(pathBase + file.getName()); buildIndex(index, file, p...
#fixed code private void buildIndex(final List<String> index, final File root, final String pathBase) { File[] files = root.listFiles(); if (files != null) for (File file : files) { if (file.isDirectory()) { index.add(pathBase + file.getName())...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code Map<String, List<LocalLoader>> getPathsUnchecked(final boolean export) { try { return getPaths(export); } catch (ModuleLoadException e) { throw e.toError(); } } #location 3 ...
#fixed code Module(final ConcreteModuleSpec spec, final ModuleLoader moduleLoader, final Object myKey) { this.moduleLoader = moduleLoader; this.myKey = myKey; // Initialize state from the spec. identifier = spec.getModuleIdentifier(); mainClassNam...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public static IterableResourceLoader createIterableFileResourceLoader(final String name, final File root) { return new FileResourceLoader(name, root, AccessController.getContext()); } #location 2 #vul...
#fixed code public static IterableResourceLoader createIterableFileResourceLoader(final String name, final File root) { return createFileResourceLoader(name, root); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public static FactoryPermissionCollection parsePermissionsXml(final InputStream inputStream, ModuleLoader moduleLoader, final String moduleName) throws XmlPullParserException, IOException { final MXParser mxParser = new MXParser(); mxParser.setInput(new ...
#fixed code public static FactoryPermissionCollection parsePermissionsXml(final InputStream inputStream, ModuleLoader moduleLoader, final String moduleName) throws XmlPullParserException, IOException { final MXParser mxParser = new MXParser(); mxParser.setFeature(FEATURE_...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code long addPaths(Dependency[] dependencies, Map<String, List<LocalLoader>> map, FastCopyHashSet<PathFilter> filterStack, Set<Visited> visited) throws ModuleLoadException { long subtract = 0L; moduleLoader.incScanCount(); for (Dependency dependency :...
#fixed code Module(final ConcreteModuleSpec spec, final ModuleLoader moduleLoader, final Object myKey) { this.moduleLoader = moduleLoader; this.myKey = myKey; // Initialize state from the spec. identifier = spec.getModuleIdentifier(); mainClassNam...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code Map<String, List<LocalLoader>> getPaths(final boolean exports) throws ModuleLoadException { Linkage linkage = this.linkage; Linkage.State state = linkage.getState(); if (state.compareTo(exports ? LINKED_EXPORTS : LINKED) >= 0) { retur...
#fixed code Module(final ConcreteModuleSpec spec, final ModuleLoader moduleLoader, final Object myKey) { this.moduleLoader = moduleLoader; this.myKey = myKey; // Initialize state from the spec. identifier = spec.getModuleIdentifier(); mainClassNam...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public static ModuleLoader forClass(Class<?> clazz) { return Module.forClass(clazz).getModuleLoader(); } #location 2 #vulnerability type NULL_DEREFERENCE
#fixed code public static ModuleLoader forClass(Class<?> clazz) { final Module module = Module.forClass(clazz); if (module == null) { return null; } return module.getModuleLoader(); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code void linkIfNecessary() throws ModuleLoadException { Linkage linkage = this.linkage; if (linkage.getState().compareTo(LINKING) >= 0) { return; } synchronized (this) { linkage = this.linkage; if (linkage....
#fixed code Module(final ConcreteModuleSpec spec, final ModuleLoader moduleLoader, final Object myKey) { this.moduleLoader = moduleLoader; this.myKey = myKey; // Initialize state from the spec. identifier = spec.getModuleIdentifier(); mainClassNam...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code long addExportedPaths(Dependency[] dependencies, Map<String, List<LocalLoader>> map, FastCopyHashSet<PathFilter> filterStack, FastCopyHashSet<ClassFilter> classFilterStack, final FastCopyHashSet<PathFilter> resourceFilterStack, Set<Visited> visited) throws ModuleLoadExc...
#fixed code Module(final ConcreteModuleSpec spec, final ModuleLoader moduleLoader) { this.moduleLoader = moduleLoader; // Initialize state from the spec. identifier = spec.getModuleIdentifier(); mainClassName = spec.getMainClass(); fallbackLoader ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code long addPaths(Dependency[] dependencies, Map<String, List<LocalLoader>> map, FastCopyHashSet<PathFilter> filterStack, FastCopyHashSet<ClassFilter> classFilterStack, final FastCopyHashSet<PathFilter> resourceFilterStack, Set<Visited> visited) throws ModuleLoadException {...
#fixed code Module(final ConcreteModuleSpec spec, final ModuleLoader moduleLoader) { this.moduleLoader = moduleLoader; // Initialize state from the spec. identifier = spec.getModuleIdentifier(); mainClassName = spec.getMainClass(); fallbackLoader ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code long addPaths(Dependency[] dependencies, Map<String, List<LocalLoader>> map, FastCopyHashSet<PathFilter> filterStack, Set<Visited> visited) throws ModuleLoadException { long subtract = 0L; moduleLoader.incScanCount(); for (Dependency dependency :...
#fixed code Module(final ConcreteModuleSpec spec, final ModuleLoader moduleLoader, final Object myKey) { this.moduleLoader = moduleLoader; this.myKey = myKey; // Initialize state from the spec. identifier = spec.getModuleIdentifier(); mainClassNam...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code long addPaths(Dependency[] dependencies, Map<String, List<LocalLoader>> map, FastCopyHashSet<PathFilter> filterStack, Set<Visited> visited) throws ModuleLoadException { long subtract = 0L; moduleLoader.incScanCount(); for (Dependency dependency :...
#fixed code Module(final ConcreteModuleSpec spec, final ModuleLoader moduleLoader, final Object myKey) { this.moduleLoader = moduleLoader; this.myKey = myKey; // Initialize state from the spec. identifier = spec.getModuleIdentifier(); mainClassNam...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code void link(final Linkage linkage) throws ModuleLoadException { final HashMap<String, List<LocalLoader>> importsMap = new HashMap<String, List<LocalLoader>>(); final HashMap<String, List<LocalLoader>> exportsMap = new HashMap<String, List<LocalLoader>>(); ...
#fixed code Module(final ConcreteModuleSpec spec, final ModuleLoader moduleLoader) { this.moduleLoader = moduleLoader; // Initialize state from the spec. identifier = spec.getModuleIdentifier(); mainClassName = spec.getMainClass(); fallbackLoader ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code Map<String, List<LocalLoader>> getPaths(final boolean exports) throws ModuleLoadException { Linkage oldLinkage = this.linkage; Linkage linkage; Linkage.State state = oldLinkage.getState(); if (state == Linkage.State.LINKED) { ...
#fixed code Module(final ConcreteModuleSpec spec, final ModuleLoader moduleLoader) { this.moduleLoader = moduleLoader; // Initialize state from the spec. identifier = spec.getModuleIdentifier(); mainClassName = spec.getMainClass(); fallbackLoader ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code long addPaths(Dependency[] dependencies, Map<String, List<LocalLoader>> map, FastCopyHashSet<PathFilter> filterStack, Set<Visited> visited) throws ModuleLoadException { long subtract = 0L; moduleLoader.incScanCount(); for (Dependency dependency :...
#fixed code Module(final ConcreteModuleSpec spec, final ModuleLoader moduleLoader, final Object myKey) { this.moduleLoader = moduleLoader; this.myKey = myKey; // Initialize state from the spec. identifier = spec.getModuleIdentifier(); mainClassNam...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private void addClassPath(final ModuleSpec.Builder builder, final String classPath) throws ModuleLoadException { String[] classPathEntries = (classPath == null ? NO_STRINGS : classPath.split(File.pathSeparator)); final File workingDir = new File(System.g...
#fixed code private void addClassPath(final ModuleSpec.Builder builder, final String classPath) throws ModuleLoadException { String[] classPathEntries = (classPath == null ? NO_STRINGS : classPath.split(File.pathSeparator)); final File workingDir = new File(System.getProp...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code long addExportedPaths(Dependency[] dependencies, Map<String, List<LocalLoader>> map, FastCopyHashSet<PathFilter> filterStack, Set<Visited> visited) throws ModuleLoadException { if (!visited.add(new Visited(this, filterStack))) { return 0L; } ...
#fixed code Module(final ConcreteModuleSpec spec, final ModuleLoader moduleLoader, final Object myKey) { this.moduleLoader = moduleLoader; this.myKey = myKey; // Initialize state from the spec. identifier = spec.getModuleIdentifier(); mainClassNam...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code Map<String, List<LocalLoader>> getPaths(final boolean exports) throws ModuleLoadException { Linkage linkage = this.linkage; Linkage.State state = linkage.getState(); if (state.compareTo(exports ? LINKED_EXPORTS : LINKED) >= 0) { retur...
#fixed code Module(final ConcreteModuleSpec spec, final ModuleLoader moduleLoader, final Object myKey) { this.moduleLoader = moduleLoader; this.myKey = myKey; // Initialize state from the spec. identifier = spec.getModuleIdentifier(); mainClassNam...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public static ResourceLoader createMavenArtifactLoader(final MavenResolver mavenResolver, final String name) throws IOException { File fp = mavenResolver.resolveJarArtifact(ArtifactCoordinates.fromString(name)); if (fp == null) return null; JarFi...
#fixed code public static ResourceLoader createMavenArtifactLoader(final MavenResolver mavenResolver, final String name) throws IOException { File fp = mavenResolver.resolveJarArtifact(ArtifactCoordinates.fromString(name)); if (fp == null) return null; JarFile jar...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code long addExportedPaths(Dependency[] dependencies, Map<String, List<LocalLoader>> map, FastCopyHashSet<PathFilter> filterStack, FastCopyHashSet<ClassFilter> classFilterStack, final FastCopyHashSet<PathFilter> resourceFilterStack, Set<Visited> visited) throws ModuleLoadExc...
#fixed code Module(final ConcreteModuleSpec spec, final ModuleLoader moduleLoader) { this.moduleLoader = moduleLoader; // Initialize state from the spec. identifier = spec.getModuleIdentifier(); mainClassName = spec.getMainClass(); fallbackLoader ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code void relinkIfNecessary() throws ModuleLoadException { Linkage linkage = this.linkage; if (linkage.getState() != Linkage.State.UNLINKED) { return; } synchronized (this) { linkage = this.linkage; if (link...
#fixed code Module(final ConcreteModuleSpec spec, final ModuleLoader moduleLoader, final Object myKey) { this.moduleLoader = moduleLoader; this.myKey = myKey; // Initialize state from the spec. identifier = spec.getModuleIdentifier(); mainClassNam...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code long addExportedPaths(Dependency[] dependencies, Map<String, List<LocalLoader>> map, FastCopyHashSet<PathFilter> filterStack, FastCopyHashSet<ClassFilter> classFilterStack, final FastCopyHashSet<PathFilter> resourceFilterStack, Set<Visited> visited) throws ModuleLoadExc...
#fixed code Module(final ConcreteModuleSpec spec, final ModuleLoader moduleLoader) { this.moduleLoader = moduleLoader; // Initialize state from the spec. identifier = spec.getModuleIdentifier(); mainClassName = spec.getMainClass(); fallbackLoader ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code long addExportedPaths(Dependency[] dependencies, Map<String, List<LocalLoader>> map, FastCopyHashSet<PathFilter> filterStack, Set<Visited> visited) throws ModuleLoadException { if (!visited.add(new Visited(this, filterStack))) { return 0L; } ...
#fixed code Module(final ConcreteModuleSpec spec, final ModuleLoader moduleLoader, final Object myKey) { this.moduleLoader = moduleLoader; this.myKey = myKey; // Initialize state from the spec. identifier = spec.getModuleIdentifier(); mainClassNam...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code long addExportedPaths(Dependency[] dependencies, Map<String, List<LocalLoader>> map, FastCopyHashSet<PathFilter> filterStack, Set<Visited> visited) throws ModuleLoadException { if (!visited.add(new Visited(this, filterStack))) { return 0L; } ...
#fixed code Module(final ConcreteModuleSpec spec, final ModuleLoader moduleLoader, final Object myKey) { this.moduleLoader = moduleLoader; this.myKey = myKey; // Initialize state from the spec. identifier = spec.getModuleIdentifier(); mainClassNam...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code long addPaths(Dependency[] dependencies, Map<String, List<LocalLoader>> map, FastCopyHashSet<PathFilter> filterStack, FastCopyHashSet<ClassFilter> classFilterStack, final FastCopyHashSet<PathFilter> resourceFilterStack, Set<Visited> visited) throws ModuleLoadException {...
#fixed code Module(final ConcreteModuleSpec spec, final ModuleLoader moduleLoader) { this.moduleLoader = moduleLoader; // Initialize state from the spec. identifier = spec.getModuleIdentifier(); mainClassName = spec.getMainClass(); fallbackLoader ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code long addPaths(Dependency[] dependencies, Map<String, List<LocalLoader>> map, FastCopyHashSet<PathFilter> filterStack, FastCopyHashSet<ClassFilter> classFilterStack, final FastCopyHashSet<PathFilter> resourceFilterStack, Set<Visited> visited) throws ModuleLoadException {...
#fixed code Module(final ConcreteModuleSpec spec, final ModuleLoader moduleLoader) { this.moduleLoader = moduleLoader; // Initialize state from the spec. identifier = spec.getModuleIdentifier(); mainClassName = spec.getMainClass(); fallbackLoader ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code Class<?> loadModuleClass(final String className, final boolean exportsOnly, final boolean resolve) { for (String s : systemPackages) { if (className.startsWith(s)) { try { return moduleClassLoader.loadClass(classNa...
#fixed code Module(final ConcreteModuleSpec spec, final ModuleLoader moduleLoader, final Object myKey) { this.moduleLoader = moduleLoader; this.myKey = myKey; // Initialize state from the spec. identifier = spec.getModuleIdentifier(); mainClassNam...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testSnapshotResolving()throws Exception{ ArtifactCoordinates coordinates = ArtifactCoordinates.fromString("org.wildfly.core:wildfly-version:2.0.5.Final-20151222.144931-1"); String path = MavenArtifactUtil.relativeArtifactPath('/', c...
#fixed code @Test public void testSnapshotResolving()throws Exception{ ArtifactCoordinates coordinates = ArtifactCoordinates.fromString("org.wildfly.core:wildfly-version:2.0.5.Final-20151222.144931-1"); String path = MavenArtifactUtil.relativeArtifactPath('/', coordin...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public List<String> fileToLines(String filename) { List<String> lines = new LinkedList<String>(); String line = ""; try { BufferedReader in = new BufferedReader(new FileReader(filename)); while ((line = in.readLine()) != n...
#fixed code public List<String> fileToLines(String filename) { List<String> lines = new LinkedList<String>(); String line = ""; BufferedReader in = null; try { in = new BufferedReader(new FileReader(filename)); while ((line = in.rea...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public static List<String> fileToLines(String filename) { List<String> lines = new LinkedList<String>(); String line = ""; try { BufferedReader in = new BufferedReader(new FileReader(filename)); while ((line = in.readLine(...
#fixed code public static List<String> fileToLines(String filename) { List<String> lines = new LinkedList<String>(); String line = ""; BufferedReader in = null; try { in = new BufferedReader(new FileReader(filename)); while ((line = in.readLine()) != null) { lines.add(line...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public ComparisonResult evaluate(Comparison comparison, ComparisonResult outcome) { Comparison.Detail controlDetails = comparison.getControlDetails(); Node controlTarget = controlDetails.getTarget(); Comparison.Detail testDetails = comparison.get...
#fixed code public ComparisonResult evaluate(Comparison comparison, ComparisonResult outcome) { Comparison.Detail controlDetails = comparison.getControlDetails(); Node controlTarget = controlDetails.getTarget(); Comparison.Detail testDetails = comparison.getTestDe...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public NodeAssert hasAttribute(String attributeName, String attributeValue) { isNotNull(); final Map.Entry<QName, String> attribute = requestAttributeForName(attributeName); if (!attribute.getValue().equals(attributeValue)) { throwAs...
#fixed code public NodeAssert hasAttribute(String attributeName, String attributeValue) { isNotNull(); final Map.Entry<QName, String> attribute = attributeForName(attributeName); if (attribute == null || !attribute.getValue().equals(attributeValue)) { ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void configure(Map<String, ?> operand) { super.configure(operand); if (getRowType() == null) { throw new IllegalStateException("Custom tables not yet supported for Kafka"); } int epoch = (Integer) operand....
#fixed code @Override public void configure(Map<String, ?> operand) { super.configure(operand); if (getRowType() == null) { throw new IllegalStateException("Custom tables not yet supported for Kafka"); } Map<String, Object> configs = new Ha...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override protected void sendSecureMessage( final AsyncWrite msg, final SecurityToken token, final int requestId, final int messageType, final AtomicInteger sendSequenceNumber ) { assert(token!=null); ByteBuffer chunks[], plain...
#fixed code @Override protected void sendSecureMessage( final AsyncWrite msg, final SecurityToken token, final int requestId, final int messageType, final AtomicInteger sendSequenceNumber ) { assert(token!=null); ByteBuffer chunks[], plaintexts[...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public static ExtensionObject binaryEncode(Structure encodeable, IEncodeableSerializer serializer, EncoderContext ctx) throws EncodingException { ctx.setEncodeableSerializer(serializer); int limit = ctx.getMaxByteStringLength(); if(limit == 0) { limit = ctx.ge...
#fixed code public static ExtensionObject binaryEncode(Structure encodeable, IEncodeableSerializer serializer, EncoderContext ctx) throws EncodingException { ctx.setEncodeableSerializer(serializer); int limit = ctx.getMaxByteStringLength(); if(limit == 0) { limit = ctx.getMaxMe...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private void putDecimal(String fieldName, BigDecimal bd) throws EncodingException{ int scaleInt = bd.scale(); if(scaleInt > Short.MAX_VALUE) { throw new EncodingException("Decimal scale overflow Short max value: "+scaleInt); } if(scaleInt < Short.MIN_VALUE) { ...
#fixed code private void putDecimal(String fieldName, BigDecimal bd) throws EncodingException{ ExtensionObject eo = EncoderUtils.decimalToExtensionObject(bd); putExtensionObject(fieldName, eo); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code void sendResponse(int statusCode, IEncodeable responseObject) { try { HttpResponse responseHandle = httpExchange.getResponse(); responseHandle.setHeader("Content-Type", "application/octet-stream"); responseHandle.setStatusCode( statusCode ); ...
#fixed code void sendResponse(int statusCode, IEncodeable responseObject) { try { HttpResponse responseHandle = httpExchange.getResponse(); responseHandle.setHeader("Content-Type", "application/octet-stream"); responseHandle.setStatusCode( statusCode ); ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public static String getSecurityProviderName() { if (securityProviderName == null) { Provider provider = null; if (LOGGER.isDebugEnabled()) LOGGER.debug("Providers={}", Arrays.toString(Security.getProviders())); boolean isAndroid = System.getProperty("...
#fixed code public static String getSecurityProviderName() { if (securityProviderName == null) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Providers={}", Arrays.toString(Security.getProviders())); } boolean isAndroid = System.getProperty("java.vendor") .toLowerC...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void sendRequest(ServiceRequest request, int secureChannelId, int requestId) throws ServiceResultException { if (request == null) logger.warn("sendRequest: request=null"); boolean asymm = request instanceof OpenSecureChannelRequest; final Socket s = getS...
#fixed code public void sendRequest(ServiceRequest request, int secureChannelId, int requestId) throws ServiceResultException { if (request == null) logger.warn("sendRequest: request=null"); boolean asymm = request instanceof OpenSecureChannelRequest; final Socket s = getSocket(...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override protected void sendSecureMessage( final AsyncWrite msg, final SecurityToken token, final int requestId, final int messageType, final AtomicInteger sendSequenceNumber ) { assert(token!=null); ByteBuffer chunks[], plain...
#fixed code @Override protected void sendSecureMessage( final AsyncWrite msg, final SecurityToken token, final int requestId, final int messageType, final AtomicInteger sendSequenceNumber ) { assert(token!=null); ByteBuffer chunks[], plaintexts[...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void run() { try { // Abort exit branch if ( abortCode != null ) { result.setError( new ServiceResultException( abortCode ) ); return; } // Http Post InetSocketAddress inetAddress = UriUtil.getSocketAddress( httpsClient.connec...
#fixed code @Override public void run() { try { // Abort exit branch if ( abortCode != null ) { result.setError( new ServiceResultException( abortCode ) ); return; } // Http Post InetSocketAddress inetAddress = UriUtil.getSocketAddress( httpsClient.connectUrl )...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public ByteBuffer[] call() throws RuntimeServiceResultException { try { SizeCalculationOutputStream tmp = new SizeCalculationOutputStream(); BinaryEncoder calc = new BinaryEncoder(tmp); calc.setEncoderContext(encoderCtx); if (type == MessageType.Encod...
#fixed code @Override public ByteBuffer[] call() throws RuntimeServiceResultException { try { SizeCalculationOutputStream calcBuf = new SizeCalculationOutputStream(); BinaryEncoder calc = new BinaryEncoder(calcBuf); calc.setEncoderContext(encoderCtx); if (type == MessageType.Enc...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private void putDecimal(String fieldName, BigDecimal bd) throws EncodingException{ int scaleInt = bd.scale(); if(scaleInt > Short.MAX_VALUE) { throw new EncodingException("Decimal scale overflow Short max value: "+scaleInt); } if(scaleInt < Short.MIN_VALUE) { ...
#fixed code private void putDecimal(String fieldName, BigDecimal bd) throws EncodingException{ ExtensionObject eo = EncoderUtils.decimalToExtensionObject(bd); putExtensionObject(fieldName, eo); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @EventHandler public void onStructureGrow(StructureGrowEvent event) { Location location = event.getLocation(); GWorld world = gw.getTableManager().getWorldTable().getWorld(location.getWorld().getName()); TreeTable treeTable = gw.getTableManager().getTreeTable(); ...
#fixed code @EventHandler public void onStructureGrow(StructureGrowEvent event) { Location location = event.getLocation(); GWorld world = gw.getTableManager().getWorldTable().getWorld(location.getWorld().getName()); TreeTable treeTable = gw.getTableManager().getTreeTable(); GPlayer...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @EventHandler public void blockFormEvent(BlockFormEvent event) { if (event.getBlock().getType() == Material.SNOW) { double temp = ClimateEngine.getInstance().getClimateEngine(event.getBlock().getWorld().getName()).getTemperature(); i...
#fixed code @EventHandler public void blockFormEvent(BlockFormEvent event) { if (event.getNewState().getType() == Material.ICE) { double temp = ClimateEngine.getInstance().getClimateEngine(event.getBlock().getWorld().getName()).getTemperature(); if (e...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @EventHandler public void onFurnaceSmelt(FurnaceBurnEvent event) { Location location = event.getBlock().getLocation(); GWorld world = gw.getTableManager().getWorldTable().getWorld(location.getWorld().getName()); FurnaceTable furnaceTable = gw.getTableManager().getFu...
#fixed code @EventHandler public void onFurnaceSmelt(FurnaceBurnEvent event) { Location location = event.getBlock().getLocation(); GWorld world = gw.getTableManager().getWorldTable().getWorld(location.getWorld().getName()); FurnaceTable furnaceTable = gw.getTableManager().getFurnaceT...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @EventHandler public void onStructureGrow(StructureGrowEvent event) { Location location = event.getLocation(); GWorld world = gw.getTableManager().getWorldTable().getWorld(location.getWorld().getName()); TreeTable treeTable = gw.getTableManager().getTreeTable(); ...
#fixed code @EventHandler public void onStructureGrow(StructureGrowEvent event) { Location location = event.getLocation(); GWorld world = gw.getTableManager().getWorldTable().getWorld(location.getWorld().getName()); TreeTable treeTable = gw.getTableManager().getTreeTable(); GPlayer...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override protected void loadKeys() { sensitivity = CarbonSensitivity.LOW; String carbonSensitivity = conf.getString("carbonSensitivity"); if (carbonSensitivity != null && !carbonSensitivity.isEmpty()) { try { sens...
#fixed code @Override protected void loadKeys() { sensitivity = CarbonSensitivity.LOW; String carbonSensitivity = conf.getString("carbonSensitivity"); if (carbonSensitivity != null && !carbonSensitivity.isEmpty()) { try { sensitivit...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @EventHandler public void blockFormEvent(BlockFormEvent event) { if (event.getBlock().getType() == Material.ICE) { double temp = ClimateEngine.getInstance().getClimateEngine(event.getBlock().getWorld().getName()).getTemperature(); if...
#fixed code @EventHandler public void blockFormEvent(BlockFormEvent event) { if (event.getNewState().getType() == Material.SNOW) { double temp = ClimateEngine.getInstance().getClimateEngine(event.getBlock().getWorld().getName()).getTemperature(); if (...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private void updateGlobalScores() { for (World world : Bukkit.getWorlds()) { //Do not update worlds with disabled climate-engines: WorldClimateEngine climateEngine = ClimateEngine.getInstance().getClimateEngine(world.getUID()); ...
#fixed code private void updateGlobalScores() { for (World world : Bukkit.getWorlds()) { //Do not update worlds with disabled climate-engines: WorldClimateEngine climateEngine = ClimateEngine.getInstance().getClimateEngine(world.getUID()); if (...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @EventHandler public void onFurnaceSmelt(FurnaceBurnEvent event) { Location location = event.getBlock().getLocation(); GWorld world = gw.getTableManager().getWorldTable().getWorld(location.getWorld().getName()); FurnaceTable furnaceTable = gw.getTableManager().getFu...
#fixed code @EventHandler public void onFurnaceSmelt(FurnaceBurnEvent event) { Location location = event.getBlock().getLocation(); GWorld world = gw.getTableManager().getWorldTable().getWorld(location.getWorld().getName()); FurnaceTable furnaceTable = gw.getTableManager().getFurnaceT...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code OutputStream createSortedOutputStream() { try { return new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(sortedFile))); } catch (IOException e) { throw new RuntimeException(e); } } ...
#fixed code OutputStream createUnsortedOutputStream() { try { return new BufferedOutputStream(new FileOutputStream(unsortedFile)); } catch (IOException e) { throw new RuntimeException(e); } }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code OutputStream createUnsortedOutputStream() { try { return new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(unsortedFile))); } catch (IOException e) { throw new RuntimeException(e); } } ...
#fixed code OutputStream createUnsortedOutputStream() { try { return new BufferedOutputStream(new FileOutputStream(unsortedFile)); } catch (IOException e) { throw new RuntimeException(e); } }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code public void verify() { idAndVersionFactory = createIdAndVersionFactory(); ElasticSearchIdAndVersionStream elasticSearchIdAndVersionStream = createElasticSearchIdAndVersionStream(options); JdbcIdAndVersionStream jdbcIdAndVersionStream = createJdbc...
#fixed code public void verify() { Function<Long, Object> formatter = createFormatter(); IdAndVersionStreamVerifierListener verifierListener = createVerifierListener(formatter); this.verify(verifierListener); }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code InputStream createUnSortedInputStream() { try { return new ObjectInputStream(new BufferedInputStream(new FileInputStream(unsortedFile))); } catch (IOException e) { throw new RuntimeException(e); } } ...
#fixed code OutputStream createUnsortedOutputStream() { try { return new BufferedOutputStream(new FileOutputStream(unsortedFile)); } catch (IOException e) { throw new RuntimeException(e); } }
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void parseDomainTopologyYaml() { ConfigMapHelper.DomainTopology domainTopology = ConfigMapHelper.parseDomainTopologyYaml(DOMAIN_TOPOLOGY); assertNotNull(domainTopology); assertTrue(domainTopology.getDomainValid()); WlsDomainConfig ...
#fixed code @Test public void parseDomainTopologyYaml() { ConfigMapHelper.DomainTopology domainTopology = ConfigMapHelper.parseDomainTopologyYaml(DOMAIN_TOPOLOGY); assertNotNull(domainTopology); assertTrue(domainTopology.getDomainValid()); WlsDomainConfig wlsDom...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testCustomResourceWatch() { Assume.assumeTrue(System.getProperty("os.name").toLowerCase().contains("nix")); ClientHolder client = ClientHelper.getInstance().take(); try { // create a watch Watch<Domain> watch = Watch.createWat...
#fixed code @Test public void testCustomResourceWatch() throws Exception { Assume.assumeTrue(TestUtils.isKubernetesAvailable()); ClientHolder client = ClientHelper.getInstance().take(); Watch<Domain> watch = Watch.createWatch( client.getApiClient(), cli...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void serverStartupInfo_containsEnvironmentVariable() { configureServer("ms1") .withEnvironmentVariable("item1", "value1") .withEnvironmentVariable("item2", "value2"); addWlsServer("ms1"); invokeStep(); assertThat( g...
#fixed code @Test public void serverStartupInfo_containsEnvironmentVariable() { configureServer("wls1") .withEnvironmentVariable("item1", "value1") .withEnvironmentVariable("item2", "value2"); addWlsServer("wls1"); invokeStep(); assertThat( getSe...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public void run() { // Clear the interrupted status, if present Thread.interrupted(); final Fiber oldFiber = CURRENT_FIBER.get(); CURRENT_FIBER.set(this); Container oldContainer = ContainerResolver.getDefault().enterContainer(owner.get...
#fixed code @Override public void run() { if (status.get() == NOT_COMPLETE) { // Clear the interrupted status, if present Thread.interrupted(); final Fiber oldFiber = CURRENT_FIBER.get(); CURRENT_FIBER.set(this); Container oldContainer = Container...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void whenDomainReadFromYaml_unconfiguredServerHasDomainDefaults() throws IOException { Domain domain = readDomain(DOMAIN_V2_SAMPLE_YAML); ServerSpec serverSpec = domain.getServer("server0", null); assertThat(serverSpec.getImage(), equalTo(DEFAU...
#fixed code @Test public void whenDomainReadFromYaml_unconfiguredServerHasDomainDefaults() throws IOException { Domain domain = readDomain(DOMAIN_V2_SAMPLE_YAML); ServerSpec serverSpec = domain.getServer("server0", null); assertThat(serverSpec.getImage(), equalTo(DEFAULT_IMA...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void serverStartupInfo_containsWlsServerStartupAndConfig() { configureServer("ms1").withNodePort(17); addWlsServer("ms1"); invokeStep(); assertThat(getServerStartupInfo("ms1").serverConfig, sameInstance(getWlsServer("ms1"))); assertTha...
#fixed code @Test public void serverStartupInfo_containsWlsServerStartupAndConfig() { configureServer("wls1").withNodePort(17); addWlsServer("wls1"); invokeStep(); assertThat(getServerStartupInfo("wls1").serverConfig, sameInstance(getWlsServer("wls1"))); assertThat(...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private void createLoadBalancer() throws Exception { Yaml yaml = new Yaml(); InputStream lbIs = new FileInputStream( new File( BaseTest.getProjectRoot() + "/kubernetes/samples/scripts/create-weblogic-domain-l...
#fixed code private void createLoadBalancer() throws Exception { Map<String, Object> lbMap = new HashMap<String, Object>(); lbMap.put("name", "traefik-hostrouting-" + domainUid); lbMap.put("namespace", domainNS); lbMap.put("host", domainUid + ".org"); lbMap.put("domain...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Override public NextAction apply(Packet packet) { Collection<StepAndPacket> startDetails = new ArrayList<>(); for (Map.Entry<String, ServerKubernetesObjects> entry : c) { startDetails.add( new StepAndPacket( new ServerDownStep(ent...
#fixed code @Override public NextAction apply(Packet packet) { Collection<StepAndPacket> startDetails = new ArrayList<>(); for (Map.Entry<String, ServerKubernetesObjects> entry : c) { startDetails.add( new StepAndPacket( new ServerDownStep(entry.get...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void testTwoDomainsManagedByTwoOperators() throws Exception { Assume.assumeFalse(QUICKTEST); String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName(); logTestBegin(testMethodName); logger.info("Creating Domain domain...
#fixed code @Test public void testTwoDomainsManagedByTwoOperators() throws Exception { Assume.assumeFalse(QUICKTEST); String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName(); logTestBegin(testMethodName); logger.info("Creating Domain domain4 & ve...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void whenDesiredStateIsAdmin_serverStartupAddsToJavaOptionsEnvironment() { configureServer("ms1") .withDesiredState(ADMIN_STATE) .withEnvironmentVariable("JAVA_OPTIONS", "value1"); addWlsServer("ms1"); invokeStep(); assertT...
#fixed code @Test public void whenDesiredStateIsAdmin_serverStartupAddsToJavaOptionsEnvironment() { configureServer("wls1") .withDesiredState(ADMIN_STATE) .withEnvironmentVariable("JAVA_OPTIONS", "value1"); addWlsServer("wls1"); invokeStep(); assertThat(...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code private String readEntityAsString(ContainerRequestContext req) throws Exception { LOGGER.entering(); // Read the entire input stream into a String // This should be OK since JSON input shouldn't be monstrously big BufferedReader ir = new BufferedReader(new...
#fixed code private String readEntityAsString(ContainerRequestContext req) throws Exception { LOGGER.entering(); // Read the entire input stream into a String // This should be OK since JSON input shouldn't be monstrously big try (BufferedReader ir = new BufferedReader(new ...
Below is the vulnerable code, please generate the patch based on the following information.
#vulnerable code @Test public void verifyValidateClusterStartupWarnsIfNoServersInCluster() { WlsClusterConfig wlsClusterConfig = new WlsClusterConfig("cluster1"); ClusterStartup cs = new ClusterStartup().withClusterName("cluster1").withReplicas(1); wlsClusterConfig.validateC...
#fixed code @Test public void verifyValidateClusterStartupWarnsIfNoServersInCluster() { WlsClusterConfig wlsClusterConfig = new WlsClusterConfig("cluster1"); wlsClusterConfig.validateCluster(1, null); assertThat(logRecords, containsWarning(NO_WLS_SERVER_IN_CLUSTER, "cluster...
Below is the vulnerable code, please generate the patch based on the following information.