auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void propogateInputChange() { if (!inputChangeListeners.isEmpty()) { Object[] allListeners = inputChangeListeners.getListeners(); final ICompareInput compareResult = (ICompareInput) getCompareResult(); for (Object allListener : allListeners) { final ICompareInputChangeListener listener = (ICompareInputChangeListener) allListener; SafeRunner.run(new ISafeRunnable() { @Override public void run() throws Exception { listener.compareInputChanged(compareResult); } @Override public void handleException(Throwable exception) { } }); } } }

Target:
private void propogateInputChange() { if (!inputChangeListeners.isEmpty()) { Object[] allListeners = inputChangeListeners.getListeners(); final ICompareInput compareResult = (ICompareInput) getCompareResult(); for (Object l : allListeners) { final ICompareInputChangeListener listener = (ICompareInputChangeListener) l; SafeRunner.run(new ISafeRunnable() { @Override public void run() throws Exception { listener.compareInputChanged(compareResult); } @Override public void handleException(Throwable exception) { } }); } } }
Source:
void setOperationExceptionAndComplete(Exception exception) { if (exception instanceof RouterException) { RouterErrorCode routerErrorCode = ((RouterException) exception).getErrorCode(); if (operationException.get() == null) { operationException.set(exception); } else { if (getPrecedenceLevel(routerErrorCode) < getPrecedenceLevel( ((RouterException) operationException.get()).getErrorCode())) { operationException.set(exception); } } } else { operationException.set(exception); } operationCompleted = true; }

Target:
void setOperationExceptionAndComplete(Exception exception) { if (exception instanceof RouterException) { RouterErrorCode routerErrorCode = ((RouterException) exception).getErrorCode(); if (operationException.get() == null) { operationException.set(exception); } else { Integer currentOperationExceptionLevel = null; if (operationException.get() instanceof RouterException) { currentOperationExceptionLevel = getPrecedenceLevel( ((RouterException) operationException.get()).getErrorCode()); } else { currentOperationExceptionLevel = getPrecedenceLevel(RouterErrorCode.UnexpectedInternalError); } if (getPrecedenceLevel(routerErrorCode) < currentOperationExceptionLevel) { operationException.set(exception); } } } else { operationException.set(exception); } operationCompleted = true; }
Source:
public void onPlayerDisconnect() { this.player = null; }

Target:
public void onPlayerDisconnect() { ((Player) this.player).getWorldBorder().ifPresent(border -> ((WorldBorder) border).listeners.remove(this)); }
Source:
public void removeDisk() { VdcReturnValueBase vdcReturnValue = Backend.getInstance().runInternalAction(VdcActionType.RemoveDisk, new RemoveDiskParameters(getParameters().getImageGroupID())); getReturnValue().getVdsmTaskIdList().addAll(vdcReturnValue.getInternalVdsmTaskIdList()); }

Target:
public void removeDisk() { VdcReturnValueBase vdcReturnValue = Backend.getInstance().runInternalAction(VdcActionType.RemoveDisk, new RemoveDiskParameters(getParameters().getImageGroupID())); }
Source:
public ServerIdleDetector(WorkspaceManager workspaceManager, EventService eventService, @Named("che.openshift.server.inactive.stop.timeout.ms") long timeout) { this.timeout = timeout; this.eventService = eventService; this.workspaceManager = workspaceManager; if (timeout > 0) { this.executor = Executors.newSingleThreadScheduledExecutor(); this.future = executor.schedule(this::run, timeout, TimeUnit.MILLISECONDS); LOG.info("Idling che server scheduled [timeout=" + timeout/1000 + " seconds]"); } }

Target:
public ServerIdleDetector(WorkspaceManager workspaceManager, EventService eventService, @Named("che.openshift.server.inactive.stop.timeout.ms") long timeout) { this.timeout = timeout; this.eventService = eventService; this.workspaceManager = workspaceManager; if (timeout > 0) { this.executor = Executors.newSingleThreadScheduledExecutor(); this.future = executor.schedule(this::run, timeout, TimeUnit.MILLISECONDS); LOG.info(String.format(IDLING_CHE_SERVER_SCHEDULED, timeout/1000)); } }
Source:
public void encodeToStream(final Document document, final DataOutputStream daos) { try { final List<Integer> words = document.getWords(); daos.writeInt(words.size()); for (final int word : words) { daos.writeInt(word); } for (int wordIdx = 0; wordIdx < words.size(); wordIdx++) { daos.writeInt(document.getAssignment(wordIdx)); } final Map<Integer, Integer> topicCounts = document.getTopicCounts(); daos.writeInt(topicCounts.size()); topicCounts.forEach((key, value) -> { try { daos.writeInt(key); } catch (IOException e) { throw new RuntimeException(e); } }); } catch (final IOException e) { throw new RuntimeException(e); } }

Target:
public void encodeToStream(final Document document, final DataOutputStream daos) { try { final List<Integer> words = document.getWords(); daos.writeInt(words.size()); for (final int word : words) { daos.writeInt(word); } for (int wordIdx = 0; wordIdx < words.size(); wordIdx++) { daos.writeInt(document.getAssignment(wordIdx)); } final Map<Integer, Integer> topicCounts = document.getTopicCounts(); daos.writeInt(topicCounts.size()); topicCounts.forEach((topicIdx, topicCount) -> { try { daos.writeInt(topicIdx); daos.writeInt(topicCount); } catch (IOException e) { throw new RuntimeException(e); } }); } catch (final IOException e) { throw new RuntimeException(e); } }
Source:
public Response scan(@PathParam("bindingId") @ApiParam(value = "bindingId") final String bindingId) { discoveryServiceRegistry.startScan(bindingId, new ScanListener() { @Override public void onErrorOccurred(Exception exception) { logger.error("Error occured while scanning for binding '{}': {}", bindingId, exception.getMessage(), exception); } @Override public void onFinished() { logger.debug("Scan for binding '{}' successfully finished.", bindingId); } }); DiscoveryServiceDTO dto = new DiscoveryServiceDTO(); dto.timeout = discoveryServiceRegistry.getMaxScanTimeout(bindingId); return JSONResponse.createResponse(Status.OK, dto, ""); }

Target:
public Response scan(@PathParam("bindingId") @ApiParam(value = "bindingId") final String bindingId) { discoveryServiceRegistry.startScan(bindingId, new ScanListener() { @Override public void onErrorOccurred(Exception exception) { logger.error("Error occured while scanning for binding '{}': {}", bindingId, exception.getMessage(), exception); } @Override public void onFinished() { logger.debug("Scan for binding '{}' successfully finished.", bindingId); } }); DiscoveryBindingDTO dto = new DiscoveryBindingDTO(); dto.timeout = discoveryServiceRegistry.getMaxScanTimeout(bindingId); return JSONResponse.createResponse(Status.OK, dto, ""); }
Source:
public void setShooter(ProjectileSource source) { this.shooter = source; ((GlowPlayer) source).playSound(location, Sound.ENTITY_ENDERPEARL_THROW, 3, 1); }

Target:
public void setShooter(ProjectileSource source) { this.shooter = source; }
Source:
public RequestMatcher param(String parameter, Matcher<Iterable<? extends String>> matchers) { return new AbstractFormDataRequestMatcher() { @Override protected void matchInternal(MultipartHttpServletRequest request) { Map<String, String[]> requestParams = request.getParameterMap(); assertValueCount(parameter, requestParams, 1); String[] values = requestParams.get(parameter); assertThat("Request parameter [" + parameter + "]", Arrays.asList(values), matchers); } }; }

Target:
public RequestMatcher param(String parameter, Matcher<Iterable<? extends String>> matchers) { return request -> { Map<String, String[]> requestParams = MultipartRequestParser.parameterMap(request); assertValueCount(parameter, requestParams, 1); String[] values = requestParams.get(parameter); assertThat("Request parameter [" + parameter + "]", Arrays.asList(values), matchers); }; }
Source:
public static AtBScenarioModifier Deserialize(String fileName) { AtBScenarioModifier resultingList = null; try { JAXBContext context = JAXBContext.newInstance(AtBScenarioModifier.class); Unmarshaller um = context.createUnmarshaller(); File xmlFile = new File(fileName); if(!xmlFile.exists()) { MekHQ.getLogger().warning(AtBScenarioModifier.class, "Deserialize", String.format("Specified file %s does not exist", fileName)); return null; } try (FileInputStream fileStream = new FileInputStream(xmlFile)) { Source inputSource = MekHqXmlUtil.createSafeXmlSource(fileStream); JAXBElement<AtBScenarioModifier> templateElement = um.unmarshal(inputSource, AtBScenarioModifier.class); resultingList = templateElement.getValue(); } } catch(Exception e) { MekHQ.getLogger().error(ScenarioModifierManifest.class, "Deserialize", "Error Deserializing Scenario Modifier" + fileName, e); } return resultingList; }

Target:
public static AtBScenarioModifier Deserialize(String fileName) { AtBScenarioModifier resultingList = null; try { JAXBContext context = JAXBContext.newInstance(AtBScenarioModifier.class); Unmarshaller um = context.createUnmarshaller(); File xmlFile = new File(fileName); if(!xmlFile.exists()) { MekHQ.getLogger().warning(AtBScenarioModifier.class, "Deserialize", String.format("Specified file %s does not exist", fileName)); return null; } try (FileInputStream fileStream = new FileInputStream(xmlFile)) { Source inputSource = MekHqXmlUtil.createSafeXmlSource(fileStream); JAXBElement<AtBScenarioModifier> templateElement = um.unmarshal(inputSource, AtBScenarioModifier.class); resultingList = templateElement.getValue(); } } catch(Exception e) { MekHQ.getLogger().error(ScenarioModifierManifest.class, "Deserialize", "Error Deserializing Scenario Modifier: " + fileName, e); } return resultingList; }
Source:
public ServiceAccountWithToken createService(HttpServletRequest request, HttpServletResponse response) throws IOException, NotFoundException, UnauthorizedException { final Session session = getSessionsService().get(request); PermissionDefinition permissionDefinition = getPermissionsService().userPermissions(session.getEmail(), session); if (BooleanUtils.isTrue(permissionDefinition.admin)) { final ServiceStore serviceStoreImpl = getServiceStore(); final String token = randomIdGenerator.get(); ServiceAccount service = serviceStoreImpl.store(token, request.getInputStream()); logInfo("new service account created").addParameter("id", service.getId()).log(); response.setStatus(HttpServletResponse.SC_CREATED); return new ServiceAccountWithToken(token, service.getId()); } response.setStatus(HttpServletResponse.SC_FORBIDDEN); return null; }

Target:
public void createService(HttpServletRequest request, HttpServletResponse response) throws IOException, NotFoundException, UnauthorizedException { final Session session = getSessionsService().get(request); if (session != null && getPermissionsService().isAdministrator(session)) { final ServiceStore serviceStoreImpl = getServiceStore(); final String token = randomIdGenerator.get(); ServiceAccount service = serviceStoreImpl.store(token, request.getInputStream()); logInfo("new service account created").addParameter("id", service.getId()).log(); writeResponse(response, new ServiceAccountWithToken(token, service.getId()), SC_CREATED); return; } response.setStatus(HttpServletResponse.SC_FORBIDDEN); }
Source:
@Override public void drive() { PLANNING: for (VolcanoPlannerPhase phase : VolcanoPlannerPhase.values()) { while (true) { LOGGER.debug("PLANNER = {}; PHASE = {}; COST = {}", this, phase.toString(), planner.root.bestCost); VolcanoRuleMatch match = ruleQueue.popMatch(phase); if (match == null) { break; } assert match.getRule().matches(match); try { match.onMatch(); } catch (VolcanoTimeoutException e) { planner.canonize(); ruleQueue.phaseCompleted(phase); break PLANNING; } planner.canonize(); } ruleQueue.phaseCompleted(phase); } }

Target:
@Override public void drive() { PLANNING: for (VolcanoPlannerPhase phase : VolcanoPlannerPhase.values()) { while (true) { LOGGER.debug("PLANNER = {}; PHASE = {}; COST = {}", this, phase.toString(), planner.root.bestCost); VolcanoRuleMatch match = ruleQueue.popMatch(phase); if (match == null) { break; } assert match.getRule().matches(match); try { match.onMatch(); } catch (VolcanoTimeoutException e) { LOGGER.warn("Volcano planning times out, cancels the subsequent optimization."); planner.canonize(); ruleQueue.phaseCompleted(phase); break PLANNING; } planner.canonize(); } ruleQueue.phaseCompleted(phase); } }
Source:
static Brave registerTracers(Environment environment, Configuration config, String tracerName) { Brave brave = createBraveTracer(config, tracerName); environment.jersey().register(new BraveContainerRequestFilter( new ServerRequestInterceptor(brave.serverTracer()), new DefaultSpanNameProvider() )); environment.jersey().register(new BraveContainerResponseFilter( new ServerResponseInterceptor(brave.serverTracer()) )); environment.servlets() .addFilter(TraceIdLoggingFilter.class.getSimpleName(), TraceIdLoggingFilter.INSTANCE) .addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "/*"); return brave; }

Target:
static void registerTracers(Environment environment, Configuration config, String tracerName) { ServerTracer serverTracer = getServerTracer(extractIp(config), extractPort(config), tracerName); environment.jersey().register(new BraveContainerRequestFilter( new ServerRequestInterceptor(serverTracer), new DefaultSpanNameProvider() )); environment.jersey().register(new BraveContainerResponseFilter( new ServerResponseInterceptor(serverTracer) )); environment.servlets() .addFilter(TraceIdLoggingFilter.class.getSimpleName(), TraceIdLoggingFilter.INSTANCE) .addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "/*"); }
Source:
public void setEnvironment(final Environment environment) { if (environment instanceof ConfigurableEnvironment) { ConfigurableEnvironment configurableEnvironment = (ConfigurableEnvironment) environment; Map<String, Object> map = new HashMap<>(); MapPropertySource fakeValues = new MapPropertySource("Implicit expressions", map); for (Map.Entry<String, ConfigurationMetadataProperty> entry : allProperties.entrySet()) { String raw = environment.getProperty(entry.getKey()); if (raw != null) { String type = entry.getValue().getType(); map.put(entry.getKey() + "-expression", literalExpression(raw, type)); } } configurableEnvironment.getPropertySources().addLast(fakeValues); } }

Target:
public void setEnvironment(final Environment environment) { if (environment instanceof ConfigurableEnvironment) { ConfigurableEnvironment configurableEnvironment = (ConfigurableEnvironment) environment; Map<String, Object> map = new HashMap<>(); for (Map.Entry<String, ConfigurationMetadataProperty> entry : allProperties.entrySet()) { String raw = environment.getProperty(entry.getKey()); if (raw != null) { String type = entry.getValue().getType(); map.put(entry.getKey() + "-expression", literalExpression(raw, type)); } } configurableEnvironment.getPropertySources().addLast(new MapPropertySource("Implicit expressions", map)); } }
Source:
public String commitMessage(GitRepositoryManager repoManager, Provider<ReviewDb> db) { if (commitMessage == null) { PatchSet.Id psId = null; String sha1 = null; Project.NameKey name = null; Repository repo = null; try { psId = change(db).currentPatchSetId(); sha1 = db.get().patchSets().get(psId).getRevision().get(); name = change.getProject(); repo = repoManager.openRepository(name); RevWalk walk = new RevWalk(repo); try { RevCommit c = walk.parseCommit(ObjectId.fromString(sha1)); commitMessage = c.getFullMessage(); } finally { walk.release(); } } catch (RepositoryNotFoundException e) { log.error("Repository not found: " + name.toString(), e); } catch (IOException e) { if(repo == null) { log.error("Problem opening repository: " + name.toString(), e); } else { log.error("Problem parsing commit: " + sha1, e); } } catch (OrmException e) { if (psId != null) { log.error("Problem requesting sha1 from database for patchSetId: " + psId.toString(), e); } else { log.error("Problem requesting change from database for change: " + legacyId.toString(), e); } } finally { if(repo != null) { repo.close(); } } } return commitMessage; }

Target:
public String commitMessage(GitRepositoryManager repoManager, Provider<ReviewDb> db) throws IOException, OrmException { if (commitMessage == null) { PatchSet.Id psId = null; String sha1 = null; Project.NameKey name = null; Repository repo = null; psId = change(db).currentPatchSetId(); sha1 = db.get().patchSets().get(psId).getRevision().get(); name = change.getProject(); repo = repoManager.openRepository(name); RevWalk walk = new RevWalk(repo); try { RevCommit c = walk.parseCommit(ObjectId.fromString(sha1)); commitMessage = c.getFullMessage(); } finally { walk.release(); repo.close(); } } return commitMessage; }
Source:
public void update(IncomingMessageEnvelope envelope, TaskCoordinator coordinator) { EndOfStreamState state = eosStates.get(envelope.getSystemStreamPartition()); EndOfStreamMessage message = (EndOfStreamMessage) envelope.getMessage(); state.update(message.getTaskName(), message.getTaskCount()); log.info("Received end-of-stream from task " + message.getTaskName() + " in " + envelope.getSystemStreamPartition()); SystemStream systemStream = envelope.getSystemStreamPartition().getSystemStream(); if (isEndOfStream(systemStream)) { log.info("End-of-stream of input " + systemStream + " for " + systemStream); ioGraph.getNodesOfInput(systemStream).forEach(node -> { if (node.isOutputIntermediate()) { boolean inputsEndOfStream = node.getInputs().stream().allMatch(spec -> isEndOfStream(spec.toSystemStream())); if (inputsEndOfStream) { SystemStream outputStream = node.getOutput().toSystemStream(); sendEndOfStream(outputStream, upstreamTaskCounts.get(outputStream)); } } }); boolean allEndOfStream = eosStates.values().stream().allMatch(EndOfStreamState::isEndOfStream); if (allEndOfStream) { log.info("All input streams have reached the end for task " + taskName); coordinator.shutdown(TaskCoordinator.RequestScope.CURRENT_TASK); } } }

Target:
public void update(IncomingMessageEnvelope envelope, TaskCoordinator coordinator) { EndOfStreamState state = eosStates.get(envelope.getSystemStreamPartition()); EndOfStreamMessage message = (EndOfStreamMessage) envelope.getMessage(); state.update(message.getTaskName(), message.getTaskCount()); log.info("Received end-of-stream from task " + message.getTaskName() + " in " + envelope.getSystemStreamPartition()); SystemStream systemStream = envelope.getSystemStreamPartition().getSystemStream(); if (isEndOfStream(systemStream)) { log.info("End-of-stream of input " + systemStream + " for " + systemStream); listener.getIOGraph().getNodesOfInput(systemStream).forEach(node -> { if (node.isOutputIntermediate()) { boolean inputsEndOfStream = node.getInputs().stream().allMatch(spec -> isEndOfStream(spec.toSystemStream())); if (inputsEndOfStream) { SystemStream outputStream = node.getOutput().toSystemStream(); sendEndOfStream(outputStream, upstreamTaskCounts.get(outputStream)); } } }); boolean allEndOfStream = eosStates.values().stream().allMatch(EndOfStreamState::isEndOfStream); if (allEndOfStream) { log.info("All input streams have reached the end for task " + taskName); coordinator.shutdown(TaskCoordinator.RequestScope.CURRENT_TASK); } } }
Source:
private boolean filterImage() throws IOException, DataFilterException { final int imageLeft = readShort(); final int imageTop = readShort(); final int imageWidth = readShort(); final int imageHeight = readShort(); final int imageFlags = readByte(); final boolean hasLocalColorMap = (imageFlags & 0x80) == 0x80; final byte[] localColorMap; if (hasLocalColorMap) { final int bitsPerPixel = (imageFlags & 0x07) + 1; final int imageColors = 1 << bitsPerPixel; localColorMap = readBytes(3 * imageColors); } else { localColorMap = new byte[0]; } final int lzwCodeSize = readByte(); if (imageLeft + imageWidth > screenWidth || imageTop + imageHeight > screenHeight || lzwCodeSize < 2 || lzwCodeSize >= 12 || !validateImageFlags(imageFlags)) { foundImageData(false); skipSubBlocks(); return false; } else { foundImageData(true); writeByte(0x2c); writeShort(imageLeft); writeShort(imageTop); writeShort(imageWidth); writeShort(imageHeight); writeByte(imageFlags); writeBytes(localColorMap); writeByte(lzwCodeSize); copySubBlocks(); return true; } }

Target:
private boolean filterImage() throws IOException, DataFilterException { final int imageLeft = readShort(); final int imageTop = readShort(); final int imageWidth = readShort(); final int imageHeight = readShort(); final int imageFlags = readByte(); final boolean hasLocalColorMap = (imageFlags & 0x80) == 0x80; final byte[] localColorMap; if (hasLocalColorMap) { final int bitsPerPixel = (imageFlags & 0x07) + 1; final int imageColors = 1 << bitsPerPixel; localColorMap = readBytes(3 * imageColors); } else { localColorMap = new byte[0]; } final int lzwCodeSize = readByte(); if (imageLeft + imageWidth > screenWidth || imageTop + imageHeight > screenHeight || lzwCodeSize < 2 || lzwCodeSize >= 12 || !validateImageFlags(imageFlags)) { foundImageData(false); skipSubBlocks(); return false; } else { foundImageData(true); writeByte(IMAGE_SEPARATOR); writeShort(imageLeft); writeShort(imageTop); writeShort(imageWidth); writeShort(imageHeight); writeByte(imageFlags); writeBytes(localColorMap); writeByte(lzwCodeSize); copySubBlocks(); return true; } }
Source:
private RexNode simplifyArithmetic(RexCall e) { if (e.getType().getSqlTypeName().getFamily() != SqlTypeFamily.NUMERIC || e.getOperands().stream() .anyMatch(o -> e.getType().getSqlTypeName().getFamily() != SqlTypeFamily.NUMERIC)) { return simplifyGenericNode(e); } assert e.getOperands().size() == 2; if (RexUtil.isNullLiteral(e.operands.get(0), true) || RexUtil.isNullLiteral(e.operands.get(1), true)) { return rexBuilder.makeNullLiteral(e.type); } switch (e.getKind()) { case PLUS: return simplifyPlus(e); case MINUS: return simplifyMinus(e); case TIMES: return simplifyMultiply(e); case DIVIDE: return simplifyDivide(e); default: throw new IllegalArgumentException("Unsupported arithmeitc operation " + e.getKind()); } }

Target:
private RexNode simplifyArithmetic(RexCall e) { if (e.getType().getSqlTypeName().getFamily() != SqlTypeFamily.NUMERIC || e.getOperands().stream().anyMatch( o -> e.getType().getSqlTypeName().getFamily() != SqlTypeFamily.NUMERIC)) { return simplifyGenericNode(e); } assert e.getOperands().size() == 2; switch (e.getKind()) { case PLUS: return simplifyPlus(e); case MINUS: return simplifyMinus(e); case TIMES: return simplifyMultiply(e); case DIVIDE: return simplifyDivide(e); default: throw new IllegalArgumentException("Unsupported arithmeitc operation " + e.getKind()); } }
Source:
public void resetAfterClearHistory() { while (getTopFragment() != null) { getSupportFragmentManager().popBackStackImmediate(); } Prefs.clearTabs(); displayMainPageIfNoTabs(); }

Target:
public void resetAfterClearHistory() { getSupportFragmentManager().popBackStackImmediate(null, FragmentManager.POP_BACK_STACK_INCLUSIVE); Prefs.clearTabs(); displayMainPageIfNoTabs(); }
Source:
public void closesStream() throws IOException { final InputStream stream = Mockito.mock(InputStream.class); final CapInputStream wrapper = new CapInputStream( stream, 0L ); wrapper.close(); Mockito.verify(stream, Mockito.times(1)).close(); }

Target:
public void closesStream() throws Exception { final InputStream stream = Mockito.mock(InputStream.class); final CapInputStream wrapper = new CapInputStream(stream, 0L); wrapper.close(); Mockito.verify(stream, Mockito.times(1)).close(); }
Source:
public void validateParameter(final String parameterName, final ModelNode value) throws OperationFailedException { super.validateParameter(parameterName, value); if (value.isDefined()) { ModelNode clonedValue = null; StringBuilder allowed = new StringBuilder(); if (value.getType() == ModelType.OBJECT) { clonedValue = value.clone(); } for (AttributeDefinition ad : allowedValues.values()) { String key = ad.getName(); allowed.append(key).append(' '); ModelNode toTest = value.has(key) ? value.get(key) : new ModelNode(); ad.getValidator().validateParameter(key, toTest); if (clonedValue != null && clonedValue.has(key)) { clonedValue.remove(key); } } if (clonedValue != null && !clonedValue.asList().isEmpty()) { Iterator<ModelNode> it = clonedValue.asList().iterator(); StringBuilder sb = new StringBuilder(); while(it.hasNext()) { sb.append(it.next().asString()); if (it.hasNext()) sb.append(' '); } ControllerLogger.ROOT_LOGGER.unknownAttribute(sb, allowed); } } }

Target:
public void validateParameter(final String parameterName, final ModelNode value) throws OperationFailedException { super.validateParameter(parameterName, value); if (value.isDefined()) { Set<String> keys = value.getType() == ModelType.OBJECT ? new HashSet<>(value.keys()): Collections.emptySet(); for (AttributeDefinition ad : allowedValues.values()) { String key = ad.getName(); ModelNode toTest = value.has(key) ? value.get(key) : new ModelNode(); ad.getValidator().validateParameter(key, toTest); if (keys.contains(key)) { keys.remove(key); } } if (!keys.isEmpty()) { Iterator<String> it = keys.iterator(); StringBuilder sb = new StringBuilder(); while (it.hasNext()) { sb.append(it.next()); if (it.hasNext()) sb.append(' '); } StringBuilder allowed = new StringBuilder(); for (AttributeDefinition ad : allowedValues.values()) { allowed.append(ad.getName()).append(' '); } ControllerLogger.ROOT_LOGGER.unknownAttribute(sb, allowed); } } }
Source:
public CaffeineDnsCache(int minTtl, int maxTtl, int negativeTtl, long maxSize) { this.minTtl = Math.min(MAX_SUPPORTED_TTL_SECS, checkPositiveOrZero(minTtl, "minTtl")); this.maxTtl = Math.min(MAX_SUPPORTED_TTL_SECS, checkPositiveOrZero(maxTtl, "maxTtl")); if (minTtl > maxTtl) { throw new IllegalArgumentException( "minTtl: " + minTtl + ", maxTtl: " + maxTtl + " (expected: 0 <= minTtl <= maxTtl)"); } this.negativeTtl = checkPositiveOrZero(negativeTtl, "negativeTtl"); this.maxSize = checkPositiveOrZero(maxSize, "maxSize"); resolveCache = new CaffeineCache<ExtendedDnsCacheEntry>(maxSize) { @Override protected boolean shouldReplaceAll(ExtendedDnsCacheEntry entry) { return entry.cause() != null; } }; }

Target:
public CaffeineDnsCache(int minTtl, int maxTtl, int negativeTtl, long maxSize) { this.minTtl = Math.min(MAX_SUPPORTED_TTL_SECS, checkPositiveOrZero(minTtl, "minTtl")); this.maxTtl = Math.min(MAX_SUPPORTED_TTL_SECS, checkPositiveOrZero(maxTtl, "maxTtl")); Preconditions.checkArgument(minTtl <= maxTtl, "minTtl: " + minTtl + ", maxTtl: " + maxTtl + " (expected: 0 <= minTtl <= maxTtl)"); this.negativeTtl = checkPositiveOrZero(negativeTtl, "negativeTtl"); this.maxSize = checkPositiveOrZero(maxSize, "maxSize"); resolveCache = new CaffeineCache<ExtendedDnsCacheEntry>(maxSize) { @Override protected boolean shouldReplaceAll(ExtendedDnsCacheEntry entry) { return entry.cause() != null; } }; }
Source:
public static Iterable<Object[]> data() { return Arrays.asList( new Object[][] { {"'"}, {"\\\""}, {"\\\\"}, {">"}, {"<"}, {"&"}, {"{"}, {"}"}, {"["}, {"]"}, {":"}, {";"}, {","}, {"."}, {"?"}, {"/"}, {"|"}, {"-"}, {"_"}, {"+"}, {"="}, {"*"}, {"^"}, {"%"}, {"$"}, {"#"}, {"@"}, {"!"}, {"~"}, {"`"}, {"("}, {")"} }); }

Target:
public static Iterable<?> data() { return Arrays.asList( "'", "\\\"", "\\\\", ">", "<", "&", "{", "}", "[", "]", ":", ";", ",", ".", "?", "/", "|", "-", "_", "+", "=", "*", "^", "%", "$", "#", "@", "!", "~", "`", "(", ")"); }
Source:
public void selectionChanged(final SelectionChangedEvent event) { this.selection = event.getSelection(); Object[] listeners = getListeners(); for (Object listener2 : listeners) { final ISelectionChangedListener listener = (ISelectionChangedListener) listener2; SafeRunner.run(new SafeRunnable() { @Override public void run() { listener.selectionChanged(event); } }); } }

Target:
public void selectionChanged(final SelectionChangedEvent event) { this.selection = event.getSelection(); for (Object listener : getListeners()) { final ISelectionChangedListener selectionChangedListener = (ISelectionChangedListener) listener; SafeRunner.run(new SafeRunnable() { @Override public void run() { selectionChangedListener.selectionChanged(event); } }); } }
Source:
public String getGroupName(byte[] groupId) { return getGroup(groupId).name; }

Target:
public String getGroupName(byte[] groupId) { GroupInfo group = getGroup(groupId); if (group == null) { return ""; } else { return group.name; } }
Source:
public void process(Exchange exchange) { @SuppressWarnings("unchecked") final CamelRpcRequest<RpcRequest,RpcResponse> wrapper = exchange.getIn().getBody(CamelRpcRequest.class); final JmsQueueNameFactory queueNameFactory = new JmsQueueNameFactory(CamelRpcConstants.JMS_QUEUE_PREFIX, wrapper.getModule().getId(), wrapper.getRequest().getLocation()); exchange.getIn().setHeader(CamelRpcConstants.JMS_QUEUE_NAME_HEADER, queueNameFactory.getName()); exchange.getIn().setHeader(CamelRpcConstants.CAMEL_JMS_REQUEST_TIMEOUT_HEADER, CAMEL_JMS_REQUEST_TIMEOUT == 0 ? wrapper.getRequest().getTimeToLiveMs() : CAMEL_JMS_REQUEST_TIMEOUT); final String request = wrapper.getModule().marshalRequest((RpcRequest)wrapper.getRequest()); exchange.getIn().setBody(request); }

Target:
public void process(Exchange exchange) { @SuppressWarnings("unchecked") final CamelRpcRequest<RpcRequest,RpcResponse> wrapper = exchange.getIn().getBody(CamelRpcRequest.class); final JmsQueueNameFactory queueNameFactory = new JmsQueueNameFactory(CamelRpcConstants.JMS_QUEUE_PREFIX, wrapper.getModule().getId(), wrapper.getRequest().getLocation()); exchange.getIn().setHeader(CamelRpcConstants.JMS_QUEUE_NAME_HEADER, queueNameFactory.getName()); exchange.getIn().setHeader(CamelRpcConstants.CAMEL_JMS_REQUEST_TIMEOUT_HEADER, wrapper.getRequest().getTimeToLiveMs() != null ? wrapper.getRequest().getTimeToLiveMs() : CAMEL_JMS_REQUEST_TIMEOUT); final String request = wrapper.getModule().marshalRequest((RpcRequest)wrapper.getRequest()); exchange.getIn().setBody(request); }
Source:
public List<Interval> takeSome(final Interval interval, final long idealSplitWeight, final long currentSize, final double projectSizeOfRemaining) { final long amount = idealSplitWeight - currentSize; if (amount > 0) { return CollectionUtil.makeList(interval, null); } else { return CollectionUtil.makeList(null, interval); } }

Target:
public List<Interval> takeSome(final Interval interval, final long idealSplitWeight, final long currentSize, final double projectSizeOfRemaining) { final long amount = idealSplitWeight - currentSize; if (amount > 0) { return Arrays.asList(interval, null); } else { return Arrays.asList(null, interval); } }
Source:
public static <A> ImmutableList<A> from(@Nonnull Iterable<A> list) { ImmutableList<A> l = empty(); for (Iterator<A> iterator = list.iterator(); iterator.hasNext();) { A item = iterator.next(); l = cons(item, l); } return l.reverse(); }

Target:
public static <A> ImmutableList<A> from(@Nonnull Iterable<A> list) { if (list instanceof ArrayList) { return from((ArrayList<A>) list); } else if (list instanceof LinkedList) { return from((LinkedList<A>) list); } ArrayList<A> arrayList = new ArrayList<>(); list.forEach(arrayList::add); return from(arrayList); }
Source:
public boolean putValue(String key, String value) throws OseeCoreException { boolean wasUpdated = false; if (ResourceConstants.BINARY_DATA_PATH.equals(key)) { throw new OseeStateException( "Unsupported modification - attempt to modify binary data path. Sets are startup through -D%s=<PATH>", ResourceConstants.BINARY_DATA_PATH); } else if (SqlProvider.SQL_DATABASE_HINTS_SUPPORTED_KEY.equals(key)) { throw new OseeStateException( "Unsupported modification - attempt to modify database hints supported. This is an unmodifiable database specific setting.", SqlProvider.SQL_DATABASE_HINTS_SUPPORTED_KEY); } else if (SqlProvider.SQL_RECURSIVE_WITH_KEY.equals(key)) { throw new OseeStateException( "Unsupported modification - attempt to modify database hints supported. This is an unmodifiable database specific setting.", SqlProvider.SQL_RECURSIVE_WITH_KEY); } else if (SqlProvider.SQL_REG_EXP_PATTERN_KEY.equals(key)) { throw new OseeStateException( "Unsupported modification - attempt to modify database hints supported. This is an unmodifiable database specific setting.", SqlProvider.SQL_REG_EXP_PATTERN_KEY); } else if (DataStoreConstants.DATASTORE_INDEX_ON_START_UP.equals(key)) { throw new OseeStateException( "Unsupported modification - attempt to modify index start-up flag. This is an launch time setting.", DataStoreConstants.DATASTORE_INDEX_ON_START_UP); } else { dbService.runPreparedUpdate(DELETE_KEY_SQL, key); int updated = dbService.runPreparedUpdate(INSERT_KEY_VALUE_SQL, key, value); wasUpdated = updated == 1; } return wasUpdated; }

Target:
public boolean putValue(String key, String value) throws OseeCoreException { boolean wasUpdated = false; if (ResourceConstants.BINARY_DATA_PATH.equals(key)) { throw new OseeStateException(BINARY_DATA_ERROR_MSG, ResourceConstants.BINARY_DATA_PATH, ResourceConstants.BINARY_DATA_PATH); } else if (SqlProvider.SQL_DATABASE_HINTS_SUPPORTED_KEY.equals(key)) { throw new OseeStateException(DB_KEY_ERROR_MSG, SqlProvider.SQL_DATABASE_HINTS_SUPPORTED_KEY); } else if (SqlProvider.SQL_RECURSIVE_WITH_KEY.equals(key)) { throw new OseeStateException(DB_KEY_ERROR_MSG, SqlProvider.SQL_RECURSIVE_WITH_KEY); } else if (SqlProvider.SQL_REG_EXP_PATTERN_KEY.equals(key)) { throw new OseeStateException(DB_KEY_ERROR_MSG, SqlProvider.SQL_REG_EXP_PATTERN_KEY); } else if (DataStoreConstants.DATASTORE_INDEX_ON_START_UP.equals(key)) { throw new OseeStateException(INDEX_STARTUP_ERROR_MSG, DataStoreConstants.DATASTORE_INDEX_ON_START_UP); } else { dbService.runPreparedUpdate(DELETE_KEY_SQL, key); int updated = dbService.runPreparedUpdate(INSERT_KEY_VALUE_SQL, key, value); wasUpdated = updated == 1; } return wasUpdated; }
Source:
private static Expression boundAsExpression(Bound<?> bound) { Comparable<?> value = bound.getValue(); Expression valueExpr = null; if (value == Interval.NEG_INF) { valueExpr = JavaParser.parseExpression("Interval.NEG_INF"); } else if (value == Interval.POS_INF) { valueExpr = JavaParser.parseExpression("Interval.POS_INF"); } else if (value instanceof BigDecimal) { BigDecimal bigDecimal = (BigDecimal) value; ObjectCreationExpr newExpression = JavaParser.parseExpression("new BigDecimal()"); StringLiteralExpr stringRep = new StringLiteralExpr(bigDecimal.toString()); newExpression.addArgument(stringRep); valueExpr = newExpression; } else if (value instanceof String) { String string = (String) value; StringLiteralExpr newExpression = new StringLiteralExpr(); newExpression.setString(string); valueExpr = newExpression; } else { throw new UnsupportedOperationException("TODO"); } Expression typeExpr = null; if (bound.getBoundaryType() == RangeBoundary.OPEN) { typeExpr = JavaParser.parseExpression("RangeBoundary.OPEN"); } else if (bound.getBoundaryType() == RangeBoundary.CLOSED) { typeExpr = JavaParser.parseExpression("RangeBoundary.CLOSED"); } else { throw new IllegalStateException("??"); } ObjectCreationExpr newExpression = JavaParser.parseExpression("new Bound()"); newExpression.addArgument(valueExpr); newExpression.addArgument(typeExpr); newExpression.addArgument(new NullLiteralExpr()); return newExpression; }

Target:
private static Expression boundAsExpression(Bound<?> bound) { Comparable<?> value = bound.getValue(); Expression valueExpr = null; if (value == Interval.NEG_INF) { valueExpr = JavaParser.parseExpression("Interval.NEG_INF"); } else if (value == Interval.POS_INF) { valueExpr = JavaParser.parseExpression("Interval.POS_INF"); } else if (value instanceof BigDecimal) { BigDecimal bigDecimal = (BigDecimal) value; ObjectCreationExpr newExpression = JavaParser.parseExpression("new BigDecimal()"); StringLiteralExpr stringRep = new StringLiteralExpr(bigDecimal.toString()); newExpression.addArgument(stringRep); valueExpr = newExpression; } else if (value instanceof String) { String string = (String) value; StringLiteralExpr newExpression = new StringLiteralExpr(); newExpression.setString(string); valueExpr = newExpression; } else { throw new UnsupportedOperationException("boundAsExpression value " + value + "not supported."); } Expression typeExpr = null; if (bound.getBoundaryType() == RangeBoundary.OPEN) { typeExpr = JavaParser.parseExpression("RangeBoundary.OPEN"); } else if (bound.getBoundaryType() == RangeBoundary.CLOSED) { typeExpr = JavaParser.parseExpression("RangeBoundary.CLOSED"); } else { throw new IllegalStateException("illegal getBoundaryType"); } ObjectCreationExpr newExpression = JavaParser.parseExpression("new Bound()"); newExpression.addArgument(valueExpr); newExpression.addArgument(typeExpr); newExpression.addArgument(new NullLiteralExpr()); return newExpression; }
Source:
public boolean equals(Object o) { if (!(o instanceof Map.Entry)) return false; Map.Entry<?,?> e = (Map.Entry<?,?>)o; return ((key == null ? e.getKey() == null : key.equals(e.getKey())) && (value == null ? e.getValue() == null : value.equals(e.getValue()))); }

Target:
public boolean equals(Object o) { if (!(o instanceof Map.Entry)) { return false; } Map.Entry<?,?> e = (Map.Entry<?,?>)o; return ((key == null ? e.getKey() == null : key.equals(e.getKey())) && (value == null ? e.getValue() == null : value.equals(e.getValue()))); }
Source:
public void testLength() { double x1 = -71.05, y1 = 42.36, x2 = -87.62, y2 = 41.87, x3 = -122.41, y3 = 37.77; double distance1 = 1365691.096620299, distance2 = 2985175.539584118; double length = distance1 + distance2; assertLength("LINESTRING EMPTY", null); assertLength(format("LINESTRING (%.2f %.2f)", x1, y1),0.0); assertLength(format("LINESTRING (%.2f %.2f, %.2f %.2f, %.2f %.2f)", x1, y1, x1, y1, x1, y1), 0.0); assertDistance(format("POINT (%.2f %.2f)", x1, y1), format("POINT (%.2f %.2f)", x2, y2), distance1); assertDistance(format("POINT (%.2f %.2f)", x2, y2), format("POINT (%.2f %.2f)", x3, y3), distance2); assertLength(format("LINESTRING (%.2f %.2f, %.2f %.2f, %.2f %.2f)", x1, y1, x2, y2, x3, y3), length); assertLength(format("LINESTRING (%.2f %.2f, %.2f %.2f, %.2f %.2f)", x3, y3, x2, y2, x1, y1), length); double earthCircumference = 4.0075e7; assertLength(format("LINESTRING (%.2f %.2f, %.2f %.2f)", 0.0, 90.0, 0.0, -90.0), earthCircumference / 2, 1e-2); }

Target:
public void testLength() { assertLength("LINESTRING EMPTY", null); assertLength("LINESTRING (0 0)", 0.0); assertLength("LINESTRING (0 0, 0 0, 0 0)", 0.0); double length = 4350866.6362; assertLength("LINESTRING (-71.05 42.36, -87.62 41.87, -122.41 37.77)", length); assertLength("LINESTRING (-122.41 37.77, -87.62 41.87, -71.05 42.36)", length); assertLength("LINESTRING (0.0 90.0, 0.0 -90.0, 0.0 90.0)", 4.003e7); assertLength("MULTILINESTRING (EMPTY)", null); assertLength("MULTILINESTRING ((-71.05 42.36, -87.62 41.87, -122.41 37.77))", length); assertLength("MULTILINESTRING ((-71.05 42.36, -87.62 41.87, -122.41 37.77), (-73.05 42.36, -89.62 41.87, -124.41 37.77))", 2 * length); assertLength("MULTILINESTRING ((-71.05 42.36, -87.62 41.87), (-87.62 41.87, -122.41 37.77))", length); }
Source:
public RelatedDRepresentationDecorator(IDiagramElementEditPart hostEditPart) { this.hostEditPart = hostEditPart; session = (DAnalysisSessionImpl) new EObjectQuery(hostEditPart.getNotationView()).getSession(); diagramEventBroker = DiagramEventBroker.getInstance(session.getTransactionalEditingDomain()); dDiagramElement = hostEditPart.resolveDiagramElement(); semanticElement = hostEditPart.resolveTargetSemanticElement(); for (DAnalysis dAnalysis : session.allAnalyses()) { diagramEventBroker.addNotificationListener(dAnalysis, ViewpointPackage.Literals.DANALYSIS__SELECTED_VIEWS, this); diagramEventBroker.addNotificationListener(dAnalysis, ViewpointPackage.Literals.DANALYSIS__REFERENCED_ANALYSIS, this); for (DView dView : dAnalysis.getSelectedViews()) { diagramEventBroker.addNotificationListener(dView, ViewpointPackage.Literals.DVIEW__OWNED_REPRESENTATIONS, this); } } refresh(); }

Target:
public RelatedDRepresentationDecorator(IDiagramElementEditPart hostEditPart) { super(new FilterRelatedDRepresentationDecorator()); this.hostEditPart = hostEditPart; session = (DAnalysisSessionImpl) new EObjectQuery(hostEditPart.getNotationView()).getSession(); diagramEventBroker = DiagramEventBroker.getInstance(session.getTransactionalEditingDomain()); dDiagramElement = hostEditPart.resolveDiagramElement(); semanticElement = hostEditPart.resolveTargetSemanticElement(); for (DAnalysis dAnalysis : session.allAnalyses()) { diagramEventBroker.addNotificationListener(dAnalysis, ViewpointPackage.Literals.DANALYSIS__SELECTED_VIEWS, this); diagramEventBroker.addNotificationListener(dAnalysis, ViewpointPackage.Literals.DANALYSIS__REFERENCED_ANALYSIS, this); for (DView dView : dAnalysis.getSelectedViews()) { diagramEventBroker.addNotificationListener(dView, ViewpointPackage.Literals.DVIEW__OWNED_REPRESENTATIONS, this); } } refresh(); }
Source:
public void triggerJob(){ ResourceBundleProvider.updateLocale(new Locale("en_US")); ArrayList<RuleSetBean> ruleSets = ruleSetDao.findAllRunOnSchedules(true); for (RuleSetBean ruleSet : ruleSets) { if (ruleSet.getStatus().AVAILABLE != null && ruleSet.isRunSchedule()) { if(ruleSet.getItemId()!=null){ System.out.println("*** Item Specific Rule ***"); ArrayList<RuleSetBean> ruleSetBeans = new ArrayList<>(); StudyBean currentStudy = (StudyBean) getStudyDao().findByPK(ruleSet.getStudyId()); ResourceBundleProvider.updateLocale(Locale.getDefault()); UserAccountBean ub = (UserAccountBean) getUserAccountDao().findByPK(1); ruleSetBeans.add(ruleSet); ruleSetService.runRulesInBulk(ruleSetBeans, false, currentStudy, ub, true); }else{ System.out.println("*** Event Specific Rule ***"); StudyEventChangeDetails studyEventChangeDetails = new StudyEventChangeDetails(true, true); ArrayList<RuleSetBean> ruleSetBeans = new ArrayList<>(); ExpressionBean eBean = new ExpressionBean(); eBean.setValue(ruleSet.getTarget().getValue()+".A.B"); ruleSet.setTarget(eBean); ruleSetBeans.add(ruleSet); ruleSetService.runRulesInBeanProperty(ruleSetBeans ,1, studyEventChangeDetails); } } } }

Target:
public void triggerJob(){ ResourceBundleProvider.updateLocale(new Locale("en_US")); ArrayList<RuleSetBean> ruleSets = ruleSetDao.findAllRunOnSchedules(true); for (RuleSetBean ruleSet : ruleSets) { if (ruleSet.getStatus().AVAILABLE != null && ruleSet.isRunSchedule()) { if(ruleSet.getItemId()!=null){ ArrayList<RuleSetBean> ruleSetBeans = new ArrayList<>(); StudyBean currentStudy = (StudyBean) getStudyDao().findByPK(ruleSet.getStudyId()); ResourceBundleProvider.updateLocale(Locale.getDefault()); UserAccountBean ub = (UserAccountBean) getUserAccountDao().findByPK(1); ruleSetBeans.add(ruleSet); ruleSetService.runRulesInBulk(ruleSetBeans, false, currentStudy, ub, true); }else{ StudyEventChangeDetails studyEventChangeDetails = new StudyEventChangeDetails(true, true); ArrayList<RuleSetBean> ruleSetBeans = new ArrayList<>(); ExpressionBean eBean = new ExpressionBean(); eBean.setValue(ruleSet.getTarget().getValue()+".A.B"); ruleSet.setTarget(eBean); ruleSetBeans.add(ruleSet); ruleSetService.runRulesInBeanProperty(ruleSetBeans ,1, studyEventChangeDetails); } } } }
Source:
protected AbstractNodeMonitorDescriptor() { this(TimeUnit.MINUTES.toMillis(PERIOD_MINUTES)); }

Target:
protected AbstractNodeMonitorDescriptor() { this(PERIOD); }
Source:
public void setWorkingSets(IWorkingSet[] workingSets) { if (workingSets == null) { throw new IllegalArgumentException(); } workingSetGroup.setWorkingSets(workingSets); }

Target:
public void setWorkingSets(IWorkingSet[] workingSets) { if (workingSets == null) { workingSetGroup.setWorkingSets(EMPTY_WORKING_SET_ARRAY); } workingSetGroup.setWorkingSets(workingSets); }
Source:
public void commit() throws IOException { if (execute != null) { long beforeWait = System.currentTimeMillis(); BulkResponse actionGet = execute.actionGet(); if (actionGet.hasFailures()) { for (BulkItemResponse item : actionGet) { if (item.isFailed()) { throw new RuntimeException("First failure in bulk: " + item.getFailureMessage()); } } } long msWaited = System.currentTimeMillis() - beforeWait; LOG.info("Previous took in ms " + actionGet.getTookInMillis() + ", including wait " + msWaited); execute = null; } if (bulk != null) { if (bulkDocs > 0) { execute = bulk.execute(); } bulk = null; } if (createNewBulk) { bulk = client.prepareBulk(); bulkDocs = 0; bulkLength = 0; } }

Target:
public void commit() throws IOException { if (execute != null) { long beforeWait = System.currentTimeMillis(); BulkResponse actionGet = execute.actionGet(); if (actionGet.hasFailures()) { for (BulkItemResponse item : actionGet) { if (item.isFailed()) { throw new RuntimeException("First failure in bulk: " + item.getFailureMessage()); } } } long msWaited = System.currentTimeMillis() - beforeWait; LOG.info("Previous took in ms {}, including wait {}", actionGet.getTookInMillis(), msWaited); execute = null; } if (bulk != null) { if (bulkDocs > 0) { execute = bulk.execute(); } bulk = null; } if (createNewBulk) { bulk = client.prepareBulk(); bulkDocs = 0; bulkLength = 0; } }
Source:
public Map<String, String> getDeploymentConfiguration() { org.wso2.carbon.kernel.utils.Utils.checkSecurity(); File configFile = ConfigurationUtils.getConfigurationFileLocation(filename).toFile(); try (FileInputStream fileInputStream = new FileInputStream(configFile)) { String xmlFileString = getDeploymentContent(fileInputStream); String jsonString = ConfigResolverUtils.convertXMLToJSON(xmlFileString); return getDeploymentConfigMap(jsonString); } catch (IOException e) { String errorMessage = "Failed populate Deployment Configuration from " + configFile.getName(); logger.error(errorMessage, e); throw new RuntimeException(errorMessage, e); } }

Target:
public Map<String, String> getDeploymentConfiguration() throws CarbonConfigurationException { org.wso2.carbon.kernel.utils.Utils.checkSecurity(); if (filename == null) { throw new CarbonConfigurationException("Error while reading the configuration file, filename is null"); } try { byte[] contentBytes = Files.readAllBytes(ConfigurationUtils.getConfigurationFileLocation(filename)); String xmlFileString = new String(contentBytes, StandardCharsets.UTF_8); String yamlString = ConfigurationUtils.convertXMLToYAML(xmlFileString); return ConfigurationUtils.getDeploymentConfigMap(yamlString); } catch (IOException e) { String errorMessage = "Failed populate deployment configuration from " + filename; logger.error(errorMessage, e); throw new CarbonConfigurationException(errorMessage, e); } }
Source:
private Boolean canDrop(List<Collaboration> droppedObjects) { return droppedObjects.stream().filter((c) -> (SystemElementsUtils.isBaseProtocol(c) || SystemElementsUtils.isSystemProtocol(c))).collect(Collectors.toList()).isEmpty(); }

Target:
private boolean canDrop(List<Collaboration> droppedObjects) { return !droppedObjects.stream().anyMatch((c) -> (SystemElementsUtils.isBaseProtocol(c) || SystemElementsUtils.isSystemProtocol(c))); }
Source:
public static Memory range(Environment env, TraceInfo trace, Memory low, Memory high, Memory step){ int err = 0; if (low.getRealType() == Memory.Type.DOUBLE || high.getRealType() == Memory.Type.DOUBLE || step.getRealType() == Memory.Type.DOUBLE) { return _range_double(env, trace, low.toDouble(), high.toDouble(), step.toDouble()); } else { return _range_long(env, trace, low.toLong(), high.toLong(), step.toLong()); } }

Target:
public static Memory range(Environment env, TraceInfo trace, Memory low, Memory high, Memory step){ if (low.getRealType() == Memory.Type.DOUBLE || high.getRealType() == Memory.Type.DOUBLE || step.getRealType() == Memory.Type.DOUBLE) { return _range_double(env, trace, low.toDouble(), high.toDouble(), step.toDouble()); } else { return _range_long(env, trace, low.toLong(), high.toLong(), step.toLong()); } }