auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { GlStateManager.disableLighting(); fontRenderer.drawString(LangUtils.localize("container.repair"), 60, 6, 0x404040); if (repairContainer.maximumCost > 0) { int k = 8453920; boolean flag = true; String s = LangUtils.localizeWithFormat("container.repair.cost", repairContainer.maximumCost); if (repairContainer.maximumCost >= 40 && !mc.player.capabilities.isCreativeMode) { s = LangUtils.localize("container.repair.expensive"); k = 16736352; } else if (!repairContainer.getSlot(2).getHasStack()) { flag = false; } else if (!repairContainer.getSlot(2).canTakeStack(playerInventory.player)) { k = 16736352; } if (flag) { int l = -16777216 | (k & 16579836) >> 2 | k & -16777216; int i1 = xSize - 25 - 8 - fontRenderer.getStringWidth(s); byte b0 = 67; if (fontRenderer.getUnicodeFlag()) { drawRect(i1 - 3, b0 - 2, xSize - 25 - 7, b0 + 10, 0xFF000000); drawRect(i1 - 2, b0 - 1, xSize - 25 - 8, b0 + 9, 0xFF3B3B3B); } else { fontRenderer.drawString(s, i1, b0 + 1, l); fontRenderer.drawString(s, i1 + 1, b0, l); fontRenderer.drawString(s, i1 + 1, b0 + 1, l); } fontRenderer.drawString(s, i1, b0, k); } } GlStateManager.enableLighting(); super.drawGuiContainerForegroundLayer(mouseX, mouseY); }

Target:
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { GlStateManager.disableLighting(); fontRenderer.drawString(LangUtils.localize("container.repair"), 60, 6, 0x404040); if (repairContainer.maximumCost > 0) { int k = 8453920; boolean flag = true; String s = I18n.format("container.repair.cost", repairContainer.maximumCost); if (repairContainer.maximumCost >= 40 && !mc.player.capabilities.isCreativeMode) { s = LangUtils.localize("container.repair.expensive"); k = 16736352; } else if (!repairContainer.getSlot(2).getHasStack()) { flag = false; } else if (!repairContainer.getSlot(2).canTakeStack(playerInventory.player)) { k = 16736352; } if (flag) { int l = -16777216 | (k & 16579836) >> 2 | k & -16777216; int i1 = xSize - 25 - 8 - fontRenderer.getStringWidth(s); byte b0 = 67; if (fontRenderer.getUnicodeFlag()) { drawRect(i1 - 3, b0 - 2, xSize - 25 - 7, b0 + 10, 0xFF000000); drawRect(i1 - 2, b0 - 1, xSize - 25 - 8, b0 + 9, 0xFF3B3B3B); } else { fontRenderer.drawString(s, i1, b0 + 1, l); fontRenderer.drawString(s, i1 + 1, b0, l); fontRenderer.drawString(s, i1 + 1, b0 + 1, l); } fontRenderer.drawString(s, i1, b0, k); } } GlStateManager.enableLighting(); super.drawGuiContainerForegroundLayer(mouseX, mouseY); }
Source:
private ApplicationReportModel createApplicationReport(GraphContext context, ProjectModel projectModel) { ApplicationReportService applicationReportService = new ApplicationReportService(context); ApplicationReportModel applicationReportModel = applicationReportService.create(); applicationReportModel.setReportPriority(10000); applicationReportModel.setDisplayInApplicationReportIndex(true); applicationReportModel.setReportName(REPORT_NAME); applicationReportModel.setReportIconClass("glyphicon glyphicon-info-sign"); applicationReportModel.setMainApplicationReport(true); applicationReportModel.setProjectModel(projectModel); applicationReportModel.setTemplatePath(TEMPLATE_APPLICATION_REPORT); applicationReportModel.setTemplateType(TemplateType.FREEMARKER); Map<String, WindupVertexFrame> related = new HashMap<String, WindupVertexFrame>(); AboutWindupModel aboutWindupModel = context.getFramed().addVertex(null, AboutWindupModel.class); aboutWindupModel.setWindupRuntimeVersion("2.3.0.SNAPSHOT"); related.put("windupAbout", aboutWindupModel); applicationReportModel.setRelatedResource(related); ReportService reportService = new ReportService(context); reportService.setUniqueFilename(applicationReportModel, "about_"+projectModel.getName(), "html"); return applicationReportModel; }

Target:
private ApplicationReportModel createApplicationReport(GraphContext context, ProjectModel projectModel) { ApplicationReportService applicationReportService = new ApplicationReportService(context); ApplicationReportModel applicationReportModel = applicationReportService.create(); applicationReportModel.setReportPriority(10000); applicationReportModel.setDisplayInApplicationReportIndex(true); applicationReportModel.setReportName(REPORT_NAME); applicationReportModel.setReportIconClass("glyphicon glyphicon-info-sign"); applicationReportModel.setMainApplicationReport(true); applicationReportModel.setProjectModel(projectModel); applicationReportModel.setTemplatePath(TEMPLATE_APPLICATION_REPORT); applicationReportModel.setTemplateType(TemplateType.FREEMARKER); Map<String, WindupVertexFrame> related = new HashMap<String, WindupVertexFrame>(); AboutWindupModel aboutWindupModel = context.getFramed().addVertex(null, AboutWindupModel.class); aboutWindupModel.setWindupRuntimeVersion(addon.getId().getVersion().toString()); related.put("windupAbout", aboutWindupModel); applicationReportModel.setRelatedResource(related); ReportService reportService = new ReportService(context); reportService.setUniqueFilename(applicationReportModel, "about_"+projectModel.getName(), "html"); return applicationReportModel; }
Source:
public boolean isEnabled(ThingUID thingUID) { Thing thing = getThing(thingUID); if (thing == null) { throw new IllegalArgumentException( String.format("Thing with the UID '%s' is unknown, cannot get its enabled status.", thingUID)); } return thing.isEnabled(); }

Target:
public boolean isEnabled(ThingUID thingUID) { Thing thing = getThing(thingUID); if (thing != null) { return thing.isEnabled(); } logger.debug("Thing with UID is unknown. Will try to get the enabled status from the persistent storage."); return !isDisabledByStorage(thingUID); }
Source:
public int run() throws IOException { int length = 0; if (in != null) { byte[] buf = new byte[8192]; while ((length = in.read(buf)) != -1) { out.write(buf, 0, length); } in.close(); } out.close(); return length; }

Target:
public int run() throws IOException { int totalRead = 0; int length = 0; if (in != null) { byte[] buf = new byte[8192]; while ((length = in.read(buf)) != -1) { out.write(buf, 0, length); totalRead += length; if (totalRead >= MAX_COPY_BYTES) { return totalRead; } } } if (totalRead == 0 && length == -1) { in.close(); out.close(); return length; } return totalRead; }
Source:
private void injectsPreviewUrlToCommands(E env, KubernetesNamespace namespace) throws InfrastructureException { if (env.getCommands() == null) { return; } for (CommandImpl command : env.getCommands() .stream() .filter(c -> c.getPreviewUrl() != null) .collect(Collectors.toList())) { Optional<Service> foundService = Services.findServiceWithPort( namespace.services().get(), command.getPreviewUrl().getPort()); if (foundService.isPresent()) { Optional<String> foundHost = findHostForServicePort( namespace, foundService.get(), command.getPreviewUrl().getPort()); if (foundHost.isPresent()) { command.getAttributes().put(PREVIEW_URL_ATTRIBUTE, foundHost.get()); } else { LOG.warn( "unable to find ingress for service and port [{}]", foundService.get(), command.getPreviewUrl().getPort()); } } else { LOG.warn( "unable to find service for port for command [{}]", command.getPreviewUrl().getPort(), command.getName()); } } }

Target:
private void injectsPreviewUrlToCommands(E env, KubernetesNamespace namespace) throws InfrastructureException { if (env.getCommands() == null) { return; } List<T> exposureObjects = loadExposureObjects(namespace); List<Service> services = namespace.services().get(); for (CommandImpl command : env.getCommands() .stream() .filter(c -> c.getPreviewUrl() != null) .collect(Collectors.toList())) { Optional<Service> foundService = Services.findServiceWithPort(services, command.getPreviewUrl().getPort()); if (!foundService.isPresent()) { String message = String.format( "unable to find service for port '%s' for command '%s'", command.getPreviewUrl().getPort(), command.getName()); LOG.warn(message); env.addWarning( new WarningImpl( NOT_ABLE_TO_PROVISION_OBJECTS_FOR_PREVIEW_URL, String.format(NOT_ABLE_TO_PROVISION_OBJECTS_FOR_PREVIEW_URL_MESSAGE, message))); continue; } Optional<String> foundHost = findHostForServicePort( exposureObjects, foundService.get(), command.getPreviewUrl().getPort()); if (foundHost.isPresent()) { command.getAttributes().put(PREVIEW_URL_ATTRIBUTE, foundHost.get()); } else { String message = String.format( "unable to find ingress for service '%s' and port '%s'", foundService.get(), command.getPreviewUrl().getPort()); LOG.warn(message); env.addWarning( new WarningImpl( NOT_ABLE_TO_PROVISION_OBJECTS_FOR_PREVIEW_URL, String.format(NOT_ABLE_TO_PROVISION_OBJECTS_FOR_PREVIEW_URL_MESSAGE, message))); } } }
Source:
public I id() { return id; }

Target:
public final I id() { return id; }
Source:
public void updateSitesStatus(Study s) { String query = "from "+ getDomainClassName() +" s WHERE s.study.studyId = :parentStudyId"; Query q=getCurrentSession().createQuery(query); q.setParameter("parentStudyId", s.getStudyId()); List<Study> slist = q.getResultList(); for(Study s1:slist) { s1.setStatus(s.getStatus()); s1.setOldStatusId(s.getOldStatusId()); getCurrentSession().update(s1); } }

Target:
public void updateSitesStatus(Study s) { String query = "update "+ getDomainClassName() +" s set status=:parentStatus,oldStatusId=:parentOldStatusId WHERE s.study.studyId = :parentStudyId"; Query q=getCurrentSession().createQuery(query); q.setParameter("parentStatus", s.getStatus()); q.setParameter("parentOldStatusId", s.getOldStatusId()); q.setParameter("parentStudyId", s.getStudyId()); int result = q.executeUpdate(); }
Source:
public void load() throws IOException, ConfigInvalidException { int maxStaleRetries = 5; int retries = 0; while (true) { final FileSnapshot oldSnapshot = snapshot; final FileSnapshot newSnapshot = FileSnapshot.save(getFile()); try { final byte[] in = IO.readFully(getFile()); final ObjectId newHash = hash(in); if (hash.equals(newHash)) { if (oldSnapshot.equals(newSnapshot)) oldSnapshot.setClean(newSnapshot); else snapshot = newSnapshot; } else { final String decoded; if (isUtf8(in)) { decoded = RawParseUtils.decode( RawParseUtils.UTF8_CHARSET, in, 3, in.length); utf8Bom = true; } else { decoded = RawParseUtils.decode(in); } fromText(decoded); snapshot = newSnapshot; hash = newHash; } return; } catch (FileNotFoundException noFile) { if (configFile.exists()) { throw noFile; } clear(); snapshot = newSnapshot; return; } catch (IOException e) { if (FileUtils.isStaleFileHandle(e) && retries < maxStaleRetries) { if (LOG.isDebugEnabled()) { LOG.debug(MessageFormat.format( JGitText.get().configHandleIsStale, Integer.valueOf(retries)), e); } retries++; continue; } throw new IOException(MessageFormat .format(JGitText.get().cannotReadFile, getFile()), e); } catch (ConfigInvalidException e) { throw new ConfigInvalidException(MessageFormat .format(JGitText.get().cannotReadFile, getFile()), e); } } }

Target:
public void load() throws IOException, ConfigInvalidException { final int maxStaleRetries = 5; int retries = 0; while (true) { final FileSnapshot oldSnapshot = snapshot; final FileSnapshot newSnapshot = FileSnapshot.save(getFile()); try { final byte[] in = IO.readFully(getFile()); final ObjectId newHash = hash(in); if (hash.equals(newHash)) { if (oldSnapshot.equals(newSnapshot)) { oldSnapshot.setClean(newSnapshot); } else { snapshot = newSnapshot; } } else { final String decoded; if (isUtf8(in)) { decoded = RawParseUtils.decode( RawParseUtils.UTF8_CHARSET, in, 3, in.length); utf8Bom = true; } else { decoded = RawParseUtils.decode(in); } fromText(decoded); snapshot = newSnapshot; hash = newHash; } return; } catch (FileNotFoundException noFile) { if (configFile.exists()) { throw noFile; } clear(); snapshot = newSnapshot; return; } catch (IOException e) { if (FileUtils.isStaleFileHandle(e) && retries < maxStaleRetries) { if (LOG.isDebugEnabled()) { LOG.debug(MessageFormat.format( JGitText.get().configHandleIsStale, Integer.valueOf(retries)), e); } retries++; continue; } throw new IOException(MessageFormat .format(JGitText.get().cannotReadFile, getFile()), e); } catch (ConfigInvalidException e) { throw new ConfigInvalidException(MessageFormat .format(JGitText.get().cannotReadFile, getFile()), e); } } }
Source:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((capacityInfo == null) ? 0 : capacityInfo.hashCode()); result = prime * result + ((serviceInfo == null) ? 0 : serviceInfo.hashCode()); result = prime * result + ((volumeId == null) ? 0 : volumeId.hashCode()); return result; }

Target:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((capacityInfo == null) ? 0 : capacityInfo.hashCode()); result = prime * result + ((serviceInfo == null) ? 0 : serviceInfo.hashCode()); result = prime * result + ((brickDetails == null) ? 0 : brickDetails.hashCode()); result = prime * result + ((volumeId == null) ? 0 : volumeId.hashCode()); result = prime * result + ((updatedAt == null) ? 0 : updatedAt.hashCode()); return result; }
Source:
public UserDetails myUserDetailsService() { ExtendedInMemoryUserDetailsManager extendedInMemoryUserDetailsManager = new ExtendedInMemoryUserDetailsManager(); List<GrantedAuthority> salaboyAuthorities = new ArrayList<>(); salaboyAuthorities.add(new SimpleGrantedAuthority("ROLE_ACTIVITI_USER")); salaboyAuthorities.add(new SimpleGrantedAuthority("GROUP_activitiTeam")); salaboyAuthorities.add(new SimpleGrantedAuthority("GROUP_developers")); extendedInMemoryUserDetailsManager.createUser(new User("salaboy", "password", salaboyAuthorities)); List<GrantedAuthority> adminAuthorities = new ArrayList<>(); adminAuthorities.add(new SimpleGrantedAuthority("ROLE_ACTIVITI_ADMIN")); extendedInMemoryUserDetailsManager.createUser(new User("admin", "password", adminAuthorities)); List<GrantedAuthority> garthAuthorities = new ArrayList<>(); garthAuthorities.add(new SimpleGrantedAuthority("ROLE_ACTIVITI_USER")); garthAuthorities.add(new SimpleGrantedAuthority("GROUP_doctor")); extendedInMemoryUserDetailsManager.createUser(new User("garth", "password", garthAuthorities)); return (UserDetails) extendedInMemoryUserDetailsManager; }

Target:
public UserDetailsService myUserDetailsService() { ExtendedInMemoryUserDetailsManager extendedInMemoryUserDetailsManager = new ExtendedInMemoryUserDetailsManager(); List<GrantedAuthority> salaboyAuthorities = new ArrayList<>(); salaboyAuthorities.add(new SimpleGrantedAuthority("ROLE_ACTIVITI_USER")); salaboyAuthorities.add(new SimpleGrantedAuthority("GROUP_activitiTeam")); salaboyAuthorities.add(new SimpleGrantedAuthority("GROUP_developers")); extendedInMemoryUserDetailsManager.createUser(new User("salaboy", "password", salaboyAuthorities)); List<GrantedAuthority> adminAuthorities = new ArrayList<>(); adminAuthorities.add(new SimpleGrantedAuthority("ROLE_ACTIVITI_ADMIN")); extendedInMemoryUserDetailsManager.createUser(new User("admin", "password", adminAuthorities)); List<GrantedAuthority> garthAuthorities = new ArrayList<>(); garthAuthorities.add(new SimpleGrantedAuthority("ROLE_ACTIVITI_USER")); garthAuthorities.add(new SimpleGrantedAuthority("GROUP_doctor")); extendedInMemoryUserDetailsManager.createUser(new User("garth", "password", garthAuthorities)); return extendedInMemoryUserDetailsManager; }
Source:
public <Q, I, U> SubscriptionQueryResult<QueryResponseMessage<I>, SubscriptionQueryUpdateMessage<U>> subscriptionQuery( SubscriptionQueryMessage<Q, I, U> query, SubscriptionQueryBackpressure backpressure, int updateBufferSize) { boolean alreadyExists = updateHandlers.keySet() .stream() .anyMatch(m -> m.getIdentifier().equals(query.getIdentifier())); if(alreadyExists) { throw new IllegalArgumentException("There is already a subscription with the same message identifier"); } MonoWrapper<QueryResponseMessage<I>> initialResult = MonoWrapper.create(monoSink -> query(query) .thenAccept(monoSink::success) .exceptionally(t -> { monoSink.error(t.getCause()); return null; })); EmitterProcessor<SubscriptionQueryUpdateMessage<U>> processor = EmitterProcessor.create(updateBufferSize); FluxSink<SubscriptionQueryUpdateMessage<U>> sink = processor.sink(backpressure.getOverflowStrategy()); sink.onDispose(() -> updateHandlers.remove(query)); FluxSinkWrapper<SubscriptionQueryUpdateMessage<U>> fluxSinkWrapper = new FluxSinkWrapper<>(sink); updateHandlers.put(query, fluxSinkWrapper); Registration registration = () -> { fluxSinkWrapper.complete(); return true; }; return new DefaultSubscriptionQueryResult<>(initialResult.getMono(), processor.replay(updateBufferSize).autoConnect(), registration); }

Target:
public <Q, I, U> SubscriptionQueryResult<QueryResponseMessage<I>, SubscriptionQueryUpdateMessage<U>> subscriptionQuery( SubscriptionQueryMessage<Q, I, U> query, SubscriptionQueryBackpressure backpressure, int updateBufferSize) { boolean alreadyExists = updateHandlers.keySet() .stream() .anyMatch(m -> m.getIdentifier().equals(query.getIdentifier())); if (alreadyExists) { throw new IllegalArgumentException("There is already a subscription with the given message identifier"); } MonoWrapper<QueryResponseMessage<I>> initialResult = MonoWrapper.create(monoSink -> query(query) .thenAccept(monoSink::success) .exceptionally(t -> { logger.error(format("An error happened while trying to report an initial result. Query: %s", query), t); monoSink.error(t.getCause()); return null; })); EmitterProcessor<SubscriptionQueryUpdateMessage<U>> processor = EmitterProcessor.create(updateBufferSize); FluxSink<SubscriptionQueryUpdateMessage<U>> sink = processor.sink(backpressure.getOverflowStrategy()); sink.onDispose(() -> updateHandlers.remove(query)); FluxSinkWrapper<SubscriptionQueryUpdateMessage<U>> fluxSinkWrapper = new FluxSinkWrapper<>(sink); updateHandlers.put(query, fluxSinkWrapper); Registration registration = () -> { fluxSinkWrapper.complete(); return true; }; return new DefaultSubscriptionQueryResult<>(initialResult.getMono(), processor.replay(updateBufferSize).autoConnect(), registration); }
Source:
public static FeignException errorStatus(String methodKey, Response response) { byte[] body = {}; try { if (response.body() != null) { body = Util.toByteArray(response.body().asInputStream()); } } catch (IOException ignored) { } String message = new FeignExceptionMessageBuilder() .withResponse(response) .withRequestMethod(response.request().httpMethod()) .withBody(body).build(); return errorStatus(response.status(), message, response.request(), body); }

Target:
public static FeignException errorStatus(String methodKey, Response response) { byte[] body = {}; try { if (response.body() != null) { body = Util.toByteArray(response.body().asInputStream()); } } catch (IOException ignored) { } String message = new FeignExceptionMessageBuilder() .withResponse(response) .withMethodKey(methodKey) .withBody(body).build(); return errorStatus(response.status(), message, response.request(), body); }
Source:
public static void main(String[] args) throws Exception { long start = System.nanoTime(); TicTacToeData data = new TicTacToeData(); log.debug("Data Processing Started"); final List<String> strings = data.generatePossibleGames(); log.debug("All possible game state sequence generated, Finished"); String path = ClassLoader.getSystemClassLoader().getResource("AllMoveWithReward.txt").getPath(); try (BufferedWriter writer = Files.newBufferedWriter(Paths.get(path))) { Set<String> uniqueValues = new HashSet<>(); for (String string : strings) { if (uniqueValues.add(string)) { writer.write(string + "\r\n"); } } } log.debug("Total time = " + (System.nanoTime() - start)/1_000_000); }

Target:
public static void main(String[] args) throws Exception { long start = System.nanoTime(); try { TicTacToeData data = new TicTacToeData(); log.info("Data Processing Started"); final String allMoves = data.generatePossibleGames(); log.info("All possible game state sequence generated, Finished"); final Path dataFile = Paths.get(System.getProperty("user.home") + "/AllMoveWithReward.txt"); Files.deleteIfExists(dataFile); final Path dataFilePath = Files.createFile(dataFile); try (BufferedWriter writer = Files.newBufferedWriter(dataFilePath)) { writer.write(allMoves); } } catch (Exception e) { log.error(e); } log.info("Total time = " + (System.nanoTime() - start)/1_000_000); }
Source:
public void channelInactive(ChannelHandlerContext ctx) throws Exception { final Channel channel = ctx.channel(); ClientHead client = clientsBox.get(channel); if (client != null && client.isTransportChannel(ctx.channel(), Transport.POLLING)) { log.debug("channel inactive {}", client.getSessionId()); client.onChannelDisconnect(); } channel.close(); super.channelInactive(ctx); }

Target:
public void channelInactive(ChannelHandlerContext ctx) throws Exception { final Channel channel = ctx.channel(); ClientHead client = clientsBox.get(channel); if (client != null && client.isTransportChannel(ctx.channel(), Transport.POLLING)) { log.debug("channel inactive {}", client.getSessionId()); client.releasePollingChannel(channel); } super.channelInactive(ctx); }
Source:
void clear() { chunkIndex = -1; chunkBlobId = null; chunkException = null; state = ChunkState.Free; failedAttempts = 0; partitionId = null; correlationIdToChunkPutRequest.clear(); }

Target:
void clear() { chunkIndex = -1; chunkBlobId = null; chunkException = null; state = ChunkState.Free; failedAttempts = 0; partitionId = null; correlationIdToChunkPutRequestInfo.clear(); attemptedPartitionIds.clear(); }
Source:
protected ICommand getAfterConfigureCommand(ConfigureRequest request) { final Connector connector = (Connector) request.getElementToConfigure(); final View sourceView = (View) request.getParameter(RequestParameterConstants.EDGE_CREATE_REQUEST_SOURCE_VIEW); final View targetView = (View) request.getParameter(RequestParameterConstants.EDGE_CREATE_REQUEST_TARGET_VIEW); return new ConfigureElementCommand(request) { @Override protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException { if (null != connector && null != sourceView && null != targetView && null != sourceView.getElement() && null != targetView.getElement()) { final ISpecializationType constraintPropertyElementType = (ISpecializationType) ElementTypeRegistry.getInstance().getType(SysMLServiceTypeUtil.ORG_ECLIPSE_PAPYRUS_SYSML14_CONSTRAINTBLOCK); if (null != constraintPropertyElementType) { final EObject sourceElementContainer = sourceView.getElement().eContainer(); if (null != sourceElementContainer && constraintPropertyElementType.getMatcher().matches(sourceElementContainer)) { if (utils.isNestedConnectableElement(sourceView, targetView)) { final List<Property> nestedPath = utils.getNestedPropertyPath(sourceView, targetView); setNestedPathToConnectorEnd(connector, nestedPath, 0); } } final EObject targetElementContainer = targetView.getElement().eContainer(); if (null != targetElementContainer && constraintPropertyElementType.getMatcher().matches(targetElementContainer)) { if (utils.isNestedConnectableElement(targetView, sourceView)) { final List<Property> nestedPath = utils.getNestedPropertyPath(targetView, sourceView); setNestedPathToConnectorEnd(connector, nestedPath, 1); } } } } return CommandResult.newOKCommandResult(connector); } }; }

Target:
protected ICommand getAfterConfigureCommand(ConfigureRequest request) { final Connector connector = (Connector) request.getElementToConfigure(); final View sourceView = (View) request.getParameter(RequestParameterConstants.EDGE_CREATE_REQUEST_SOURCE_VIEW); final View targetView = (View) request.getParameter(RequestParameterConstants.EDGE_CREATE_REQUEST_TARGET_VIEW); return new SetNestedConnectorEndCommand(request, connector, sourceView, targetView); }
Source:
public void geoLocation() { Collection<String> names = new ArrayList<String>(); names.add("Indian Institute of Information Technology Vadodara"); final double lat = 23.259104; final double lon = 72.650406; final String iso3166cc = "IN-GJ"; long population = 400; int kmValue = 2589; GeoLocation geoLocation = new GeoLocation(lat, lon, names, iso3166cc); geoLocation.setPopulation(population); Collection<String> returnedNames = geoLocation.getNames(); String returnedISO3166cc = geoLocation.getISO3166cc(); long returnedPopulation = geoLocation.getPopulation(); int returnedKmValue = geoLocation.degreeToKm(23.259104); String returnedString = geoLocation.toString(); assertNotNull(returnedNames); assertNotNull(returnedISO3166cc); assertNotNull(returnedPopulation); assertNotNull(returnedKmValue); assertNotNull(returnedString); assertEquals(names, returnedNames); assertEquals(iso3166cc, returnedISO3166cc); assertEquals(population, returnedPopulation); assertEquals(kmValue, returnedKmValue); }

Target:
public void geoLocation() { Collection<String> names = new ArrayList<String>(); names.add("Taj Mahal"); final double lat = 27.175015; final double lon = 78.042155; final String iso3166cc = "IN-UP"; long population = 400; int kmValue = 3025; GeoLocation geoLocation = new GeoLocation(lat, lon, names, iso3166cc); geoLocation.setPopulation(population); Collection<String> returnedNames = geoLocation.getNames(); String returnedISO3166cc = geoLocation.getISO3166cc(); long returnedPopulation = geoLocation.getPopulation(); int returnedKmValue = geoLocation.degreeToKm(27.175015); String returnedString = geoLocation.toString(); assertNotNull(returnedNames); assertNotNull(returnedISO3166cc); assertNotNull(returnedPopulation); assertNotNull(returnedKmValue); assertNotNull(returnedString); assertEquals(names, returnedNames); assertEquals(iso3166cc, returnedISO3166cc); assertEquals(population, returnedPopulation); assertEquals(kmValue, returnedKmValue); }
Source:
public void testDriverRegistration() throws Exception { Class.forName("io.crate.client.jdbc.CrateDriver"); Connection c1 = DriverManager.getConnection("crate://" + hostAndPort); assertThat(c1, instanceOf(CrateConnection.class)); Connection c2 = DriverManager.getConnection("jdbc:crate://" + hostAndPort); assertThat(c2, instanceOf(CrateConnection.class)); expectedException.expect(SQLException.class); expectedException.expectMessage(String.format("No suitable driver found for %s", "jdbc-crate://" + hostAndPort)); DriverManager.getConnection("jdbc-crate://" + hostAndPort); }

Target:
public void testDriverRegistration() throws Exception { Class.forName("io.crate.client.jdbc.CrateDriver"); Connection c1 = DriverManager.getConnection("crate://" + hostAndPort); assertThat(c1, instanceOf(CrateConnection.class)); Connection c2 = DriverManager.getConnection("jdbc:crate://" + hostAndPort); assertThat(c2, instanceOf(CrateConnection.class)); expectedException.expect(SQLException.class); expectedException.expectMessage(String.format("No suitable driver found for %s", "jdbc:mysql://" + hostAndPort)); DriverManager.getConnection("jdbc:mysql://" + hostAndPort); }
Source:
public Response transformCsar(@ApiParam(required = true) final CsarTransformRequest request) { String sourceCsarName = request.getSourceCsarName(); String targetCsarName = request.getTargetCsarName(); CSARID csarId = this.csarService.generateTransformationPlans(new CSARID(sourceCsarName), new CSARID(targetCsarName)); this.controlService.setDeploymentProcessStateStored(csarId); boolean success = this.controlService.invokeTOSCAProcessing(csarId); if (success) { final List<QName> serviceTemplates = this.engineService.getToscaReferenceMapper().getServiceTemplateIDsContainedInCSAR(csarId); for (final QName serviceTemplate : serviceTemplates) { logger.info("Invoke plan deployment for service template \"{}\" of CSAR \"{}\"", serviceTemplate, csarId.getFileName()); if (!this.controlService.invokePlanDeployment(csarId, serviceTemplate)) { logger.error("Error deploying plan for service template \"{}\" of CSAR \"{}\"", serviceTemplate, csarId.getFileName()); success = false; } } } return Response.ok().build(); }

Target:
public Response transformCsar(@ApiParam(required = true) final CsarTransformRequest request) { String sourceCsarName = request.getSourceCsarName(); String targetCsarName = request.getTargetCsarName(); CSARID csarId = this.csarService.generateTransformationPlans(new CSARID(sourceCsarName), new CSARID(targetCsarName)); this.controlService.setDeploymentProcessStateStored(csarId); boolean success = this.controlService.invokeTOSCAProcessing(csarId); if (success) { final List<QName> serviceTemplates = this.engineService.getToscaReferenceMapper().getServiceTemplateIDsContainedInCSAR(csarId); for (final QName serviceTemplate : serviceTemplates) { logger.info("Invoke plan deployment for service template \"{}\" of CSAR \"{}\"", serviceTemplate, csarId.getFileName()); if (!this.controlService.invokePlanDeployment(csarId, serviceTemplate)) { logger.error("Error deploying plan for service template \"{}\" of CSAR \"{}\"", serviceTemplate, csarId.getFileName()); success = false; } } } if(success) { return Response.ok().build(); } else { return Response.serverError().build(); } }
Source:
private static void copyFile(File from, File to) throws IOException { FileInputStream in = new FileInputStream(from); FileOutputStream out = new FileOutputStream(to); try { byte[] buffer = new byte[1024]; int count = -1; while ((count = in.read(buffer)) > 0) { out.write(buffer, 0, count); } } finally { IOUtils.closeQuietly(out); IOUtils.closeQuietly(in); } }

Target:
private static void copyFile(File from, File to) throws IOException { FileInputStream in = new FileInputStream(from); FileOutputStream out = new FileOutputStream(to); try { byte[] buffer = new byte[1024]; int count; while ((count = in.read(buffer)) > 0) { out.write(buffer, 0, count); } out.close(); } finally { IOUtils.closeQuietly(in); IOUtils.closeQuietly(out); } }
Source:
public UriTemplate(String template) { Assert.hasText(template, "Template must not be null or empty!"); Matcher matcher = VARIABLE_REGEX.matcher(template); int baseUriEndIndex = template.length(); List<TemplateVariable> variables = new ArrayList<TemplateVariable>(); while (matcher.find()) { int start = matcher.start(0); VariableType type = VariableType.from(matcher.group(1)); String[] names = matcher.group(2).split(","); for (String name : names) { name = name.endsWith("*")? name.substring(0, name.length() - 1) : name; TemplateVariable variable = new TemplateVariable(name, type); if (!variable.isRequired() && start < baseUriEndIndex) { baseUriEndIndex = start; } variables.add(variable); } } this.variables = variables.isEmpty() ? TemplateVariables.NONE : new TemplateVariables(variables); this.baseUri = template.substring(0, baseUriEndIndex); }

Target:
public UriTemplate(String template) { Assert.hasText(template, "Template must not be null or empty!"); Matcher matcher = VARIABLE_REGEX.matcher(template); int baseUriEndIndex = template.length(); List<TemplateVariable> variables = new ArrayList<TemplateVariable>(); while (matcher.find()) { int start = matcher.start(0); VariableType type = VariableType.from(matcher.group(1)); String[] names = matcher.group(2).split(","); for (String name : names) { boolean isCompositeValue = name.endsWith("*"); TemplateVariable variable; if (isCompositeValue) { variable = new TemplateVariable(name.substring(0, name.length() - 1), VariableType.COMPOSITE_PARAM); } else { variable = new TemplateVariable(name, type); } if (!variable.isRequired() && start < baseUriEndIndex) { baseUriEndIndex = start; } variables.add(variable); } } this.variables = variables.isEmpty() ? TemplateVariables.NONE : new TemplateVariables(variables); this.baseUri = template.substring(0, baseUriEndIndex); }
Source:
void nonSessionScheduleMessage(MessagingEntityType entityType) { setSenderAndReceiver(entityType); final Instant scheduledEnqueueTime = Instant.now().plusSeconds(10); final String messageId = UUID.randomUUID().toString(); final String contents = "Some-contents"; final ServiceBusMessage message = TestUtils.getServiceBusMessage(contents, messageId); long sequenceNumber = sender.scheduleMessage(message, scheduledEnqueueTime); Assertions.assertTrue(sequenceNumber > 0); messagesPending.incrementAndGet(); }

Target:
void nonSessionScheduleMessage(MessagingEntityType entityType) { setSenderAndReceiver(entityType); final Instant scheduledEnqueueTime = Instant.now().plusSeconds(10); final String messageId = UUID.randomUUID().toString(); final String contents = "Some-contents"; final ServiceBusMessage message = TestUtils.getServiceBusMessage(contents, messageId); long sequenceNumber = sender.scheduleMessage(message, scheduledEnqueueTime); Assertions.assertTrue(sequenceNumber >= 0); messagesPending.incrementAndGet(); }
Source:
public void givenLongResponseWhenTimeoutThenHandle() throws InterruptedException { WSClient ws = play.test.WSTestClient.newClient(port); Futures futures = app.injector() .instanceOf(Futures.class); CompletionStage<Result> f = futures.timeout(ws.url(url) .setRequestTimeout(Duration.of(1, SECONDS)) .get() .thenApply(result -> { try { Thread.sleep(2000L); return Results.ok(); } catch (InterruptedException e) { return Results.status( SERVICE_UNAVAILABLE); } }), 1L, TimeUnit.SECONDS); CompletionStage<Object> res = f.handleAsync((result, e) -> { if (e != null) { log.error("Exception thrown", e); return e.getCause(); } else { return result; } }); res.thenAccept(result -> assertEquals(TimeoutException.class, result) ); Thread.sleep(2500); }

Target:
public void givenLongResponseWhenTimeoutThenHandle() throws Exception { CountDownLatch latch = new CountDownLatch(1); WSClient ws = play.test.WSTestClient.newClient(port); Futures futures = app.injector() .instanceOf(Futures.class); CompletionStage<Result> f = futures.timeout( ws.url(url) .setRequestTimeout(Duration.of(1, SECONDS)) .get() .thenApply(result -> { try { Thread.sleep(2000L); return Results.ok(); } catch (InterruptedException e) { return Results.status( SERVICE_UNAVAILABLE); } }), 1L, TimeUnit.SECONDS ); CompletionStage<Object> res = f.handleAsync((result, e) -> { if (e != null) { log.error("Exception thrown", e); latch.countDown(); return e.getCause(); } else { return result; } }); res.thenAccept(result -> assertEquals(TimeoutException.class, result)); log.debug( "Waiting for requests to be completed. Current Time: " + System.currentTimeMillis()); latch.await(5, TimeUnit.SECONDS ); assertEquals(0, latch.getCount()); log.debug("All requests have been completed. Exiting test."); }
Source:
private MoveOrCopyImageGroupParameters buildMoveOrCopyImageGroupParametersForDisk(DiskImage disk, Guid containerID) { Guid originalDiskId = newDiskIdForDisk.get(disk.getId()).getId(); Guid destinationDomain = imageToDestinationDomainMap.get(originalDiskId); MoveOrCopyImageGroupParameters params = new MoveOrCopyImageGroupParameters(containerID, originalDiskId, newDiskIdForDisk.get(disk.getId()).getImageId(), disk.getId(), disk.getImageId(), destinationDomain, getMoveOrCopyImageOperation()); params.setParentCommand(getActionType()); params.setUseCopyCollapse(getParameters().getCopyCollapse()); params.setCopyVolumeType(CopyVolumeType.LeafVol); params.setForceOverride(getParameters().getForceOverride()); params.setSourceDomainId(getParameters().getSourceDomainId()); params.setStoragePoolId(getParameters().getStoragePoolId()); params.setImportEntity(true); params.setEntityInfo(new EntityInfo(VdcObjectType.VM, getVm().getId())); params.setRevertDbOperationScope(ImageDbOperationScope.IMAGE); params.setQuotaId(disk.getQuotaId() != null ? disk.getQuotaId() : getParameters().getQuotaId()); params.setDiskProfileId(disk.getDiskProfileId() != null ? disk.getDiskProfileId() : getParameters().getDiskProfileId()); if (getParameters().getVm().getDiskMap() != null && getParameters().getVm().getDiskMap().containsKey(originalDiskId)) { DiskImageBase diskImageBase = (DiskImageBase) getParameters().getVm().getDiskMap().get(originalDiskId); params.setVolumeType(diskImageBase.getVolumeType()); params.setVolumeFormat(diskImageBase.getVolumeFormat()); } params.setParentParameters(getParameters()); return params; }

Target:
private MoveOrCopyImageGroupParameters buildMoveOrCopyImageGroupParametersForDisk(DiskImage disk, Guid containerID) { Guid originalDiskId = newDiskIdForDisk.get(disk.getId()).getId(); Guid destinationDomain = imageToDestinationDomainMap.get(originalDiskId); MoveOrCopyImageGroupParameters params = new MoveOrCopyImageGroupParameters(containerID, originalDiskId, newDiskIdForDisk.get(disk.getId()).getImageId(), disk.getId(), disk.getImageId(), destinationDomain, getMoveOrCopyImageOperation()); params.setParentCommand(getActionType()); params.setUseCopyCollapse(getParameters().getCopyCollapse()); params.setCopyVolumeType(CopyVolumeType.LeafVol); params.setForceOverride(getParameters().getForceOverride()); params.setSourceDomainId(getParameters().getSourceDomainId()); params.setStoragePoolId(getParameters().getStoragePoolId()); params.setImportEntity(true); params.setEntityInfo(new EntityInfo(VdcObjectType.VM, getVm().getId())); params.setRevertDbOperationScope(ImageDbOperationScope.IMAGE); params.setQuotaId(disk.getQuotaId() != null ? disk.getQuotaId() : getParameters().getQuotaId()); params.setDiskProfileId(getParameters().getDiskProfileId()); if (getParameters().getVm().getDiskMap() != null && getParameters().getVm().getDiskMap().containsKey(originalDiskId)) { DiskImageBase diskImageBase = (DiskImageBase) getParameters().getVm().getDiskMap().get(originalDiskId); params.setVolumeType(diskImageBase.getVolumeType()); params.setVolumeFormat(diskImageBase.getVolumeFormat()); } params.setParentParameters(getParameters()); return params; }
Source:
private static int[] fuzzyArray(int size){ int[] fuzz = new int[DEFAULT_SAMPLE]; Random rng = new Random(10); for (int i = 0; i < DEFAULT_SAMPLE; i++) { fuzz[i] = rng.nextInt(); } return fuzz; }

Target:
private static int[] fuzzyArray(int size) { int[] fuzz = new int[DEFAULT_SAMPLE]; Random rng = new Random(10); for (int i = 0; i < DEFAULT_SAMPLE; i++) { fuzz[i] = rng.nextInt(DEFAULT_SAMPLE); } return fuzz; }
Source:
public String getDisplayString(EncounterProvider encounterProvider) { if (encounterProvider == null) return ""; return encounterProvider.getUuid(); }

Target:
public String getDisplayString(EncounterProvider encounterProvider) { if (encounterProvider == null) return ""; return encounterProvider.getProvider().getProviderId() + ": " + encounterProvider.getEncounterRole().getName(); }
Source:
public JsonLoader() { this(TextInputFormat.class.getName(), ""); }

Target:
public JsonLoader() { this(""); }
Source:
public void validateStudyAlreadyHasStudyEntries(final Integer studyId) { this.errors = new MapBindingResult(new HashMap<String, String>(), Integer.class.getName()); if (this.middlewareStudyEntryService.countStudyEntries(studyId) > 0) { errors.reject("study.has.existing.study.entries"); } if (this.errors.hasErrors()) { throw new ApiRequestValidationException(this.errors.getAllErrors()); } }

Target:
public void validateStudyAlreadyHasStudyEntries(final Integer studyId) { this.errors = new MapBindingResult(new HashMap<String, String>(), Integer.class.getName()); if (this.middlewareStudyEntryService.countStudyEntries(studyId) > 0) { this.errors.reject("study.has.existing.study.entries"); throw new ApiRequestValidationException(this.errors.getAllErrors()); } }
Source:
public static <T> TransformSpec fromInputRowParser(final InputRowParser<T> parser) { if (parser instanceof TransformingInputRowParser) { return ((TransformingInputRowParser) parser).getTransformSpec(); } else if (parser instanceof TransformingStringInputRowParser) { return ((TransformingStringInputRowParser) parser).getTransformSpec(); } else { return TransformSpec.NONE; } }

Target:
public static <T> TransformSpec fromInputRowParser(final InputRowParser<T> parser) { if (parser instanceof TransformingInputRowParser) { return ((TransformingInputRowParser) parser).getTransformSpec(); } else if (parser instanceof TransformingStringInputRowParser) { return ((TransformingStringInputRowParser) parser).getTransformSpec(); } else { throw new ISE("Parser was not decorated, but should have been"); } }
Source:
public void propertyChange(PropertyChangeEvent event) { if (event.getOldValue() != event.getNewValue()) { if (event.getPropertyName().equals(RenderingConfig.NORMAL_MAPPING)) { isNormalMapping = renderingConfig.isNormalMapping(); if (isNormalMapping) { addDesiredStateChange(setNormalTerrain); if (isParallaxMapping) { addDesiredStateChange(setHeightTerrain); } } else { removeDesiredStateChange(setNormalTerrain); if (isParallaxMapping) { removeDesiredStateChange(setHeightTerrain); } } } else if (event.getPropertyName().equals(RenderingConfig.PARALLAX_MAPPING)) { isParallaxMapping = renderingConfig.isParallaxMapping(); if (isNormalMapping) { if (isParallaxMapping) { addDesiredStateChange(setHeightTerrain); } else { removeDesiredStateChange(setHeightTerrain); } } } else { isAnimateWater = renderingConfig.isAnimateWater(); } worldRenderer.requestTaskListRefresh(); } }

Target:
public void propertyChange(PropertyChangeEvent event) { if (event.getPropertyName().equals(RenderingConfig.NORMAL_MAPPING)) { normalMappingIsEnabled = renderingConfig.isNormalMapping(); if (normalMappingIsEnabled) { addDesiredStateChange(setTerrainNormalsInputTexture); if (parallaxMappingIsEnabled) { addDesiredStateChange(setTerrainHeightInputTexture); } } else { removeDesiredStateChange(setTerrainNormalsInputTexture); if (parallaxMappingIsEnabled) { removeDesiredStateChange(setTerrainHeightInputTexture); } } } else if (event.getPropertyName().equals(RenderingConfig.PARALLAX_MAPPING)) { parallaxMappingIsEnabled = renderingConfig.isParallaxMapping(); if (normalMappingIsEnabled) { if (parallaxMappingIsEnabled) { addDesiredStateChange(setTerrainHeightInputTexture); } else { removeDesiredStateChange(setTerrainHeightInputTexture); } } } else if (event.getPropertyName().equals(RenderingConfig.ANIMATE_WATER)) { animatedWaterIsEnabled = renderingConfig.isAnimateWater(); } worldRenderer.requestTaskListRefresh(); }
Source:
public void dispose() { delegate.dispose(); sinks.asMap().forEach((t, sink) -> sink.complete()); }

Target:
public void dispose() { delegate.dispose(); sinks.asMap().forEach((t, sink) -> sink.complete()); sinks.invalidateAll(); }
Source:
private void setCharset(String charsetName) { try { if (charsetName == null) { this.charset = Charset.defaultCharset(); } else { this.charset = Charset.forName(charsetName); } logger.debug("Serial port '{}' charset '{}' set.", this.port, charsetName); } catch (IllegalCharsetNameException e) { logger.error("Serial port '{}' charset '{}' not found.", this.port, charsetName); } }

Target:
private void setCharset(String charsetName) { try { if (charsetName == null) { charset = Charset.defaultCharset(); } else { charset = Charset.forName(charsetName); } logger.debug("Serial port '{}' charset '{}' set.", port, charsetName); } catch (IllegalCharsetNameException e) { logger.warn("Serial port '{}' charset '{}' not found.", port, charsetName); charset = Charset.defaultCharset(); } }
Source:
public QuestionDB getQuestion(){ if(question==null){ if(id_question_fk==null) return null; question = new Select() .from(QuestionDB.class) .where(QuestionDB_Table.id_question .is(id_question_fk)).querySingle(); } return question; }

Target:
public QuestionDB getQuestion() { if (question == null) { if (id_question_fk == null) return null; question = QuestionDB.findByID(id_question_fk); } return question; }
Source:
public void damageD(double amount) { Living thisEntity = this; DamageSource source = DamageSource.generic; if (thisEntity instanceof Human) { source = net.minecraft.util.DamageSource.causePlayerDamage((EntityPlayer) thisEntity); } else { source = net.minecraft.util.DamageSource.causeMobDamage((EntityLivingBase) thisEntity); } if (thisEntity instanceof net.minecraft.entity.boss.EntityDragon) { ((EntityDragon) thisEntity).attackEntityFrom(source, (float) amount); } else { attackEntityFrom(source, (float) amount); } }

Target:
public void damageD(double amount) { Living thisEntity = (Living) this; DamageSource source = DamageSource.generic; if (thisEntity instanceof Human) { source = net.minecraft.util.DamageSource.causePlayerDamage((EntityPlayer) thisEntity); } else { source = net.minecraft.util.DamageSource.causeMobDamage((EntityLivingBase) thisEntity); } if (thisEntity instanceof net.minecraft.entity.boss.EntityDragon) { ((EntityDragon) thisEntity).attackEntityFrom(source, (float) amount); } else { attackEntityFrom(source, (float) amount); } }
Source:
public String getIpAddress() { return "127.0.0.1"; }

Target:
public String getIpAddress() { return LOCALHOST; }
Source:
private void validateApprovals(Version version, CloudTrailEvent event) { List<Approval> approvals = kioOperations.getApplicationApprovals(version.getApplicationId(), version.getId()); Set<String> approvalTypes = approvals.stream().collect(Collectors.groupingBy(Approval::getApprovalType)) .keySet(); if (!approvalTypes.contains("CODE_CHANGE") || !approvalTypes.contains("DEPLOY") || !approvalTypes.contains("SPECIFICATION") || !approvalTypes.contains("TEST")) { violationSink.put(new ViolationBuilder(format( "Version %s of application %s is missing one or more approvals.", version.getId(), version.getApplicationId())).withAccoundId(getCloudTrailEventAccountId(event)) .withRegion(getCloudTrailEventRegion(event)).withEventId(getCloudTrailEventId(event)).build()); } boolean doneByOne = approvals .stream() .filter(a -> a.getApprovalType() == "CODE_CHANGE" || a.getApprovalType() == "TEST" || a.getApprovalType() == "DEPLOY").map(a -> a.getUserId()).collect(Collectors.toList()).size() == 1; if (doneByOne) { violationSink .put(new ViolationBuilder( format("Code change, test and deploy approvals of version %s of application %s were done by onle one person.", version.getId(), version.getApplicationId())) .withAccoundId(getCloudTrailEventAccountId(event)) .withRegion(getCloudTrailEventRegion(event)).withEventId(getCloudTrailEventId(event)) .build()); } }

Target:
private void validateApprovals(Version version, CloudTrailEvent event) { List<Approval> approvals = kioOperations.getApplicationApprovals(version.getApplicationId(), version.getId()); Set<String> defaultApprovals = registryPluginProperties.getDefaultApprovals(); String codeApproval = registryPluginProperties.getCodeApproval(); String testApproval = registryPluginProperties.getTestApproval(); String deployApproval = registryPluginProperties.getDeployApproval(); Set<String> approvalTypes = approvals.stream().collect(Collectors.groupingBy(Approval::getApprovalType)) .keySet(); if (!approvalTypes.containsAll(defaultApprovals)) { Set<String> diff = Sets.newHashSet(defaultApprovals); diff.removeAll(approvalTypes); violationSink.put(new ViolationBuilder(format("Version %s of application %s is missing approvals: %s.", version.getId(), diff.toString(), version.getApplicationId())) .withAccoundId(getCloudTrailEventAccountId(event)).withRegion(getCloudTrailEventRegion(event)) .withEventId(getCloudTrailEventId(event)).build()); } boolean doneByOne = approvals .stream() .filter(a -> a.getApprovalType() == codeApproval || a.getApprovalType() == testApproval || a.getApprovalType() == deployApproval).map(a -> a.getUserId()).distinct() .collect(Collectors.toList()).size() == 1; if (doneByOne) { violationSink .put(new ViolationBuilder( format("Code change, test and deploy approvals of version %s of application %s were done by onle one person.", version.getId(), version.getApplicationId())) .withAccoundId(getCloudTrailEventAccountId(event)) .withRegion(getCloudTrailEventRegion(event)).withEventId(getCloudTrailEventId(event)) .build()); } }