auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected MessageDigest getMd5Digest(final HttpServletRequest request) throws NoSuchAlgorithmException { MessageDigest digest = createMd5Digest(); for (MD5Attributes attribute: MD5Attributes.values()) { if (request.getAttribute(attribute.getAttributeKey()) != null) { digest.update(request.getAttribute(attribute.getAttributeKey()). toString().getBytes()); } } return digest; }

Target:
protected MessageDigest getMd5Digest(final HttpServletRequest request) throws NoSuchAlgorithmException { MessageDigest digest = createMd5Digest(); for (MD5Attributes attribute: MD5Attributes.values()) { if (request.getAttribute(attribute.getKey()) != null) { digest.update(request.getAttribute(attribute.getKey()). toString().getBytes()); } } return digest; }
Source:
public Object visitCommand(InvocationContext ctx, VisitableCommand command) { if (ctx.isOriginLocal()) { if ((command instanceof AbstractDataCommand) && ((AbstractDataCommand)command).getFlags().contains(Flag.SKIP_XSITE_BACKUP)) { int count = backupSiteInvocationCount.incrementAndGet(); log.infof("Backup Hit %d for %s", count, command); } else { int count = localSiteInvocationCount.incrementAndGet(); log.infof("Local Hit %d for %s", count, command); } } return invokeNext(ctx, command); }

Target:
public Object visitCommand(InvocationContext ctx, VisitableCommand command) { if (ctx.isOriginLocal()) { if ((command instanceof AbstractDataCommand) && ((AbstractDataCommand)command).hasAnyFlag(FlagBitSets.SKIP_XSITE_BACKUP)) { int count = backupSiteInvocationCount.incrementAndGet(); log.infof("Backup Hit %d for %s", count, command); } else { int count = localSiteInvocationCount.incrementAndGet(); log.infof("Local Hit %d for %s", count, command); } } return invokeNext(ctx, command); }
Source:
public void populatePossibleValuesForCategoricalVariates(List<MeasurementVariable> variates, String programUUID, OntologyDataManager ontologyDataManager) { for (MeasurementVariable measurementVariable : variates) { Integer standardVariableId = null; if (measurementVariable.getTermId() == 0) { standardVariableId = ontologyDataManager.getStandardVariableIdByPropertyScaleMethod(measurementVariable.getProperty(), measurementVariable.getScale(), measurementVariable.getMethod()); } else { standardVariableId = measurementVariable.getTermId(); } StandardVariable standardVariable = null; if (standardVariableId != null) { standardVariable = ontologyDataManager.getStandardVariable(standardVariableId, programUUID); } if (standardVariable != null && standardVariable.getDataType().getId() == DataType.CATEGORICAL_VARIABLE.getId()) { List<ValueReference> possibleValues = new ArrayList<>(); if (standardVariable.getEnumerations() != null && !standardVariable.getEnumerations().isEmpty()) { for (Enumeration enumeration : standardVariable.getEnumerations()) { possibleValues.add(new ValueReference(enumeration.getId(), enumeration.getName(), enumeration.getDescription())); } } measurementVariable.setPossibleValues(possibleValues); measurementVariable.setDataTypeId(standardVariable.getDataType().getId()); } } }

Target:
public void populatePossibleValuesForCategoricalVariates(List<MeasurementVariable> variates, String programUUID, OntologyDataManager ontologyDataManager) { for (MeasurementVariable measurementVariable : variates) { StandardVariable standardVariable = ontologyDataManager.findStandardVariableByTraitScaleMethodNames(measurementVariable.getProperty(), measurementVariable.getScale(), measurementVariable.getMethod(), programUUID); if (standardVariable != null && standardVariable.getDataType().getId() == DataType.CATEGORICAL_VARIABLE.getId()) { List<ValueReference> possibleValues = new ArrayList<>(); if (standardVariable.getEnumerations() != null && !standardVariable.getEnumerations().isEmpty()) { for (Enumeration enumeration : standardVariable.getEnumerations()) { possibleValues.add(new ValueReference(enumeration.getId(), enumeration.getName(), enumeration.getDescription())); } } measurementVariable.setPossibleValues(possibleValues); measurementVariable.setDataTypeId(standardVariable.getDataType().getId()); } } }
Source:
public static Node layoutEvents(Model model, TurboIssue issue, List<TurboIssueEvent> events, List<Comment> comments) { VBox result = new VBox(); result.setSpacing(3); VBox.setMargin(result, new Insets(3, 0, 0, 0)); TurboIssueEvent.createLabelUpdateEventNodes( model, events.stream() .filter(e -> e.isLabelUpdateEvent()) .collect(Collectors.toList())) .forEach(node -> result.getChildren().add(node));; events.stream() .filter(e -> !e.isLabelUpdateEvent()) .map(e -> e.display(model, issue)) .forEach(e -> result.getChildren().add(e)); if (comments.size() > 0) { String names = comments.stream() .map(comment -> comment.getUser().getLogin()) .distinct() .collect(Collectors.joining(", ")); HBox commentDisplay = new HBox(); commentDisplay.getChildren().addAll( TurboIssueEvent.octicon(TurboIssueEvent.OCTICON_QUOTE), new javafx.scene.control.Label( String.format("%d comments since, involving %s.", comments.size(), names)) ); result.getChildren().add(commentDisplay); } return result; }

Target:
private static Node layoutEvents(Model model, TurboIssue issue, List<TurboIssueEvent> events, List<Comment> comments) { VBox result = new VBox(); result.setSpacing(3); VBox.setMargin(result, new Insets(3, 0, 0, 0)); List<TurboIssueEvent> labelUpdateEvents = events.stream() .filter(TurboIssueEvent::isLabelUpdateEvent) .collect(Collectors.toList()); List<Node> labelUpdateEventNodes = TurboIssueEvent.createLabelUpdateEventNodes(model, labelUpdateEvents); labelUpdateEventNodes.forEach(node -> result.getChildren().add(node)); events.stream() .filter(e -> !e.isLabelUpdateEvent()) .map(e -> e.display(model, issue)) .forEach(e -> result.getChildren().add(e)); if (comments.size() > 0) { String names = comments.stream() .map(comment -> comment.getUser().getLogin()) .distinct() .collect(Collectors.joining(", ")); HBox commentDisplay = new HBox(); commentDisplay.getChildren().addAll( TurboIssueEvent.octicon(TurboIssueEvent.OCTICON_QUOTE), new javafx.scene.control.Label( String.format("%d comments since, involving %s.", comments.size(), names)) ); result.getChildren().add(commentDisplay); } return result; }
Source:
private Response getInvalidStatusResponse(String chargeId, ChargeStatus newChargeStatus) { logger.warn("charge with id cannot be updated to the new status: {}", chargeId, newChargeStatus.getValue()); return badRequestResponse("charge with id: " + chargeId + " cannot be updated to the new status: " + newChargeStatus.getValue()); }

Target:
private Response getInvalidStatusResponse(String chargeId, ChargeStatus newChargeStatus) { return badRequestResponse("charge with id: " + chargeId + " cannot be updated to the new status: " + newChargeStatus.getValue()); }
Source:
private Result<Subscription> createSubscriptionInternal(final SubscriptionBase subscriptionBase, final Client client) throws InternalNakadiException, DuplicatedSubscriptionException, ServiceUnavailableException { final Map<String, Optional<EventType>> eventTypeMapping = subscriptionBase.getEventTypes().stream() .collect(Collectors.toMap(Function.identity(), Try.wrap(eventTypeRepository::findByNameO).andThen(Try::getOrThrow))); final List<String> missingEventTypes = eventTypeMapping.entrySet().stream() .filter(entry -> !entry.getValue().isPresent()) .map(Map.Entry::getKey) .collect(Collectors.toList()); if (!missingEventTypes.isEmpty()) { final Problem problem = Problem.valueOf(MoreStatus.UNPROCESSABLE_ENTITY, createMissingEventsErrorMessage(missingEventTypes)); return Result.problem(problem); } eventTypeMapping.values().stream() .filter(Optional::isPresent) .map(Optional::get) .forEach(eventType -> client.checkScopes(eventType.getReadScopes())); final int totalPartitions = eventTypeMapping.values().stream() .filter(Optional::isPresent) .map(Optional::get) .map(et -> topicRepository.listPartitionNames(et.getTopic())) .mapToInt(List::size) .sum(); if (totalPartitions > maxSubscriptionPartitions) { final String message = String.format( "total partition count for subscription is %d while only %d allowed", totalPartitions, maxSubscriptionPartitions); return Result.problem(Problem.valueOf(MoreStatus.UNPROCESSABLE_ENTITY, message)); } final Subscription subscription = subscriptionRepository.createSubscription(subscriptionBase); return Result.ok(subscription); }

Target:
private Result<Subscription> createSubscriptionInternal(final SubscriptionBase subscriptionBase, final Client client) throws InternalNakadiException, DuplicatedSubscriptionException, ServiceUnavailableException { final Map<String, Optional<EventType>> eventTypeMapping = subscriptionBase.getEventTypes().stream() .collect(Collectors.toMap(Function.identity(), Try.wrap(eventTypeRepository::findByNameO).andThen(Try::getOrThrow))); final List<String> missingEventTypes = eventTypeMapping.entrySet().stream() .filter(entry -> !entry.getValue().isPresent()) .map(Map.Entry::getKey) .collect(Collectors.toList()); if (!missingEventTypes.isEmpty()) { final Problem problem = Problem.valueOf(MoreStatus.UNPROCESSABLE_ENTITY, createMissingEventsErrorMessage(missingEventTypes)); return Result.problem(problem); } eventTypeMapping.values().stream() .filter(Optional::isPresent) .map(Optional::get) .forEach(eventType -> client.checkScopes(eventType.getReadScopes())); final int totalPartitions = eventTypeMapping.values().stream() .filter(Optional::isPresent) .map(Optional::get) .map(et -> topicRepository.listPartitionNames(et.getTopic())) .mapToInt(List::size) .sum(); if (totalPartitions > maxSubscriptionPartitions) { final String message = String.format( "total partition count for subscription is %d, but the maximum partition count is %d", totalPartitions, maxSubscriptionPartitions); return Result.problem(Problem.valueOf(MoreStatus.UNPROCESSABLE_ENTITY, message)); } final Subscription subscription = subscriptionRepository.createSubscription(subscriptionBase); return Result.ok(subscription); }
Source:
private synchronized boolean maybeCompleted() { if (!(receivers.isEmpty() && transfers.isEmpty())) return false; if (!maybeCompleted.compareAndSet(false, true)) return true; if (state == State.WAIT_COMPLETE) { if (!completeSent) { messageSender.sendMessage(new CompleteMessage()); completeSent = true; } closeSession(State.COMPLETE); } else { messageSender.sendMessage(new CompleteMessage()); completeSent = true; state(State.WAIT_COMPLETE); } return true; }

Target:
private synchronized boolean maybeCompleted() { if (!(receivers.isEmpty() && transfers.isEmpty())) return false; if (maybeCompleted) return true; maybeCompleted = true; if (!isFollower) { if (state == State.WAIT_COMPLETE) closeSession(State.COMPLETE); else state(State.WAIT_COMPLETE); } else { messageSender.sendMessage(new CompleteMessage()); closeSession(State.COMPLETE); } return true; }
Source:
public Map<String, Map<String, Integer>> dumpHashTableStats(final Operator op) { Map<String, Map<String, Integer>> ret = new HashMap<String, Map<String, Integer>>(); for (Operator o : op.getChildren()) { ret.putAll(dumpHashTableStats(o)); } ret.putAll(op.dumpHashTableStats()); return ret; }

Target:
public Map<String, Map<String, Integer>> dumpHashTableStats(final Operator op) { Map<String, Map<String, Integer>> ret = new HashMap<>(); for (Operator o : op.getChildren()) { ret.putAll(dumpHashTableStats(o)); } ret.putAll(op.dumpHashTableStats()); return ret; }
Source:
public void initialize(IProject inputProject1, IManagedBuildInfo info, IProgressMonitor newMonitor1) { this.project = inputProject1; try { this.projectResources = inputProject1.members(); } catch (CoreException e) { this.projectResources = null; } this.monitor = newMonitor1; this.buildTargetName = info.getBuildArtifactName(); this.buildTargetExt = info.getBuildArtifactExtension(); try { this.buildTargetExt = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(this.buildTargetExt, "", " ", IBuildMacroProvider.CONTEXT_CONFIGURATION, info.getDefaultConfiguration()); } catch (BuildMacroException e) { } try { String resolved = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(this.buildTargetName, "", " ", IBuildMacroProvider.CONTEXT_CONFIGURATION, info.getDefaultConfiguration()); resolved = resolved.trim(); if (resolved != null && resolved.length() > 0) this.buildTargetName = resolved; } catch (BuildMacroException e) { } if (this.buildTargetExt == null) { this.buildTargetExt = new String(); } this.config = info.getDefaultConfiguration(); this.builder = this.config.getEditableBuilder(); initToolInfos(); this.topBuildDir = inputProject1.getFolder(info.getConfigurationName()).getFullPath(); }

Target:
public void initialize(IProject inputProject1, IManagedBuildInfo info, IProgressMonitor newMonitor1) { this.project = inputProject1; try { this.projectResources = inputProject1.members(); } catch (CoreException e) { this.projectResources = null; } this.monitor = newMonitor1; this.buildTargetName = info.getBuildArtifactName(); this.buildTargetExt = info.getBuildArtifactExtension(); try { this.buildTargetExt = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(this.buildTargetExt, "", " ", IBuildMacroProvider.CONTEXT_CONFIGURATION, info.getDefaultConfiguration()); } catch (BuildMacroException e) { } try { String resolved = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(this.buildTargetName, "", " ", IBuildMacroProvider.CONTEXT_CONFIGURATION, info.getDefaultConfiguration()); if (resolved != null && (resolved = resolved.trim()).length() > 0) this.buildTargetName = resolved; } catch (BuildMacroException e) { } if (this.buildTargetExt == null) { this.buildTargetExt = new String(); } this.config = info.getDefaultConfiguration(); this.builder = this.config.getEditableBuilder(); initToolInfos(); this.topBuildDir = inputProject1.getFolder(info.getConfigurationName()).getFullPath(); }
Source:
protected void doGetText(HttpServletRequest req, HttpServletResponse res) throws IOException { GitilesView view = ViewFilter.getView(req); Repository repo = ServletUtils.getRepository(req); ObjectReader reader = repo.newObjectReader(); try (Writer writer = startRenderText(req, res); OutputStream out = BaseEncoding.base64().encodingStream(writer)) { ObjectLoader loader = reader.open(view.getRevision().getId()); if (loader.getType() != OBJ_COMMIT) { res.setStatus(SC_NOT_FOUND); } else { loader.copyTo(out); } } finally { reader.release(); } }

Target:
protected void doGetText(HttpServletRequest req, HttpServletResponse res) throws IOException { GitilesView view = ViewFilter.getView(req); Repository repo = ServletUtils.getRepository(req); ObjectReader reader = repo.newObjectReader(); try { ObjectLoader loader = reader.open(view.getRevision().getId()); if (loader.getType() != OBJ_COMMIT) { res.setStatus(SC_NOT_FOUND); } else { try (Writer writer = startRenderText(req, res); OutputStream out = BaseEncoding.base64().encodingStream(writer)) { loader.copyTo(out); } } } finally { reader.release(); } }
Source:
public static void writeTelemetryData(JsonWriter json, TelemetryData statistics) { json.beginObject(); json.prop("id", statistics.getServerId()); json.prop("version", statistics.getVersion()); json.name("database"); json.beginObject(); json.prop("name", statistics.getDatabase().getName()); json.prop("version", statistics.getDatabase().getVersion()); json.endObject(); json.name("plugins"); json.beginArray(); statistics.getPlugins().forEach((plugin, version) -> { json.beginObject(); json.prop("name", plugin); json.prop("version", version); json.endObject(); }); json.endArray(); json.prop("userCount", statistics.getUserCount()); json.prop("projectCount", statistics.getProjectCount()); json.prop(LINES_KEY, statistics.getLines()); json.prop(NCLOC_KEY, statistics.getNcloc()); json.name("projectCountByLanguage"); json.beginArray(); statistics.getProjectCountByLanguage().forEach((language, count) -> { json.beginObject(); json.prop("language", language); json.prop("count", count); json.endObject(); }); json.endArray(); json.name("nclocByLanguage"); json.beginArray(); statistics.getNclocByLanguage().forEach((language, ncloc) -> { json.beginObject(); json.prop("language", language); json.prop("ncloc", ncloc); json.endObject(); }); json.endArray(); json.endObject(); }

Target:
public static void writeTelemetryData(JsonWriter json, TelemetryData statistics) { json.beginObject(); json.prop("id", statistics.getServerId()); json.prop("version", statistics.getVersion()); json.name("database"); json.beginObject(); json.prop("name", statistics.getDatabase().getName()); json.prop("version", statistics.getDatabase().getVersion()); json.endObject(); json.name("plugins"); json.beginArray(); statistics.getPlugins().forEach((plugin, version) -> { json.beginObject(); json.prop("name", plugin); json.prop("version", version); json.endObject(); }); json.endArray(); json.prop("userCount", statistics.getUserCount()); json.prop("projectCount", statistics.getProjectCount()); json.prop("usingBranches", statistics.isUsingBranches()); json.prop(LINES_KEY, statistics.getLines()); json.prop(NCLOC_KEY, statistics.getNcloc()); json.name("projectCountByLanguage"); json.beginArray(); statistics.getProjectCountByLanguage().forEach((language, count) -> { json.beginObject(); json.prop("language", language); json.prop("count", count); json.endObject(); }); json.endArray(); json.name("nclocByLanguage"); json.beginArray(); statistics.getNclocByLanguage().forEach((language, ncloc) -> { json.beginObject(); json.prop("language", language); json.prop("ncloc", ncloc); json.endObject(); }); json.endArray(); json.endObject(); }
Source:
public Response postUzytkownicy(Uzytkownicy uzytkownicy) { Statement statement; try { connection.establishConnection(); statement = connection.getConnection().createStatement(); statement.executeQuery("SELECT adduzytkownik('" + uzytkownicy.getNick() + "', '" + uzytkownicy.getEmail() + "', '" + uzytkownicy.getHaslo() + "')"); } catch (Exception ex) { System.err.println(ex); if (ex.toString().contains("(email)=") && ex.toString().contains("już istnieje")) { return Response.ok("Podany email jest juz zajety").build(); } else if (ex.toString().contains("(nick)=") && ex.toString().contains("już istnieje")) { return Response.ok("Podany nick jest juz zajety").build(); } else if (ex.toString().contains("Brak funkcji")) { return Response.ok("Brakuje odpowiedniej funkcji w bazie danych").build(); } connection.closeConnection(); return Response.ok("Wystapil nieznany blad").build(); } connection.closeConnection(); return Response.ok("OK").build(); }

Target:
public Response postUzytkownicy(Uzytkownicy uzytkownicy) { Statement statement; try { connection.establishConnection(); statement = connection.getConnection().createStatement(); statement.executeQuery("SELECT adduzytkownik('" + uzytkownicy.getNick() + "', '" + uzytkownicy.getEmail() + "', '" + uzytkownicy.getHaslo() + "')"); } catch (Exception ex) { System.err.println(ex); if (ex.toString().contains("(email)=") && ex.toString().contains("już istnieje")) { return Response.serverError().entity("Podany email jest juz zajety").build(); } else if (ex.toString().contains("(nick)=") && ex.toString().contains("już istnieje")) { return Response.serverError().entity("Podany nick jest juz zajety").build(); } else if (ex.toString().contains("Brak funkcji")) { return Response.serverError().entity("Brakuje odpowiedniej funkcji w bazie danych").build(); } connection.closeConnection(); return Response.serverError().entity("Wystapil nieznany blad").build(); } connection.closeConnection(); return Response.ok("OK").build(); }
Source:
public void setup() { TimeZone.setDefault(TimeZone.getTimeZone("Europe/Helsinki")); baseConfig = MySQLTests.baseConfig(); execute(readResource("setup.sql")); }

Target:
public void setup() { baseConfig = MySQLTests.baseConfig(); execute(readResource("setup.sql")); }
Source:
public boolean supportsAggregatesMin() { return false; }

Target:
public boolean supportsAggregatesMin() { return true; }
Source:
public void deregisterPlugin(String pluginId) { pluginToConfigurationMap.remove(pluginId); pluginsThatSupportsWebBasedAuthentication.remove(pluginId); pluginsThatSupportsPasswordBasedAuthentication.remove(pluginId); pluginsThatSupportsUserSearch.remove(pluginId); }

Target:
public void deregisterPlugin(String pluginId) { pluginToConfigurationMap.remove(pluginId); pluginsThatSupportsWebBasedAuthentication.remove(pluginId); pluginsThatSupportsPasswordBasedAuthentication.remove(pluginId); }
Source:
public static DatabaseDialect findBestFor( String jdbcUrl, AbstractConfig config ) throws ConnectException { final JdbcUrlInfo info = extractJdbcUrlInfo(jdbcUrl); LOG.debug("Finding best dialect for {}", info); int bestScore = DatabaseDialectProvider.MINIMUM_MATCHING_SCORE - 1; DatabaseDialectProvider bestMatch = null; for (DatabaseDialectProvider provider : REGISTRY.values()) { int score = provider.score(info); LOG.debug("Dialect scored against {}", provider, score, info); if (score > bestScore) { bestMatch = provider; bestScore = score; } } LOG.debug("Using dialect with score against {}", bestMatch, bestScore, info); return bestMatch.create(config); }

Target:
public static DatabaseDialect findBestFor( String jdbcUrl, AbstractConfig config ) throws ConnectException { final JdbcUrlInfo info = extractJdbcUrlInfo(jdbcUrl); LOG.debug("Finding best dialect for {}", info); int bestScore = DatabaseDialectProvider.NO_MATCH_SCORE; DatabaseDialectProvider bestMatch = null; for (DatabaseDialectProvider provider : REGISTRY.values()) { int score = provider.score(info); LOG.debug("Dialect scored against {}", provider, score, info); if (score > bestScore) { bestMatch = provider; bestScore = score; } } LOG.debug("Using dialect with score against {}", bestMatch, bestScore, info); return bestMatch.create(config); }
Source:
private X509CertificateHolder resolveIssuerCertificate(Certificate cert) throws OcspCheckerException { X500Name issuerName = cert.getIssuer(); String trustStorePath = AccessController.doPrivileged( (PrivilegedAction<String>) SecurityConstants::getTruststorePath); String trustStorePass = AccessController.doPrivileged( (PrivilegedAction<String>) SecurityConstants::getTruststorePassword); if (isBlank(trustStorePath) || isBlank(trustStorePass)) { throw new OcspCheckerException("Problem retrieving truststore properties."); } KeyStore truststore; try (InputStream truststoreInputStream = new FileInputStream(trustStorePath)) { truststore = SecurityConstants.newTruststore(); truststore.load(truststoreInputStream, trustStorePass.toCharArray()); } catch (CertificateException | IOException | KeyStoreException | NoSuchAlgorithmException e) { throw new OcspCheckerException( String.format("Problem loading truststore on path %s", trustStorePath)); } try { return getCertFromTruststoreWithX500Name(issuerName, truststore); } catch (OcspCheckerException e) { throw new OcspCheckerException("Problem finding issuer in truststore.", e); } }

Target:
private X509CertificateHolder resolveIssuerCertificate(Certificate cert) throws OcspCheckerException { X500Name issuerName = cert.getIssuer(); String trustStorePath = AccessController.doPrivileged( (PrivilegedAction<String>) SecurityConstants::getTruststorePath); String trustStorePass = AccessController.doPrivileged( (PrivilegedAction<String>) SecurityConstants::getTruststorePassword); if (isBlank(trustStorePath) || isBlank(trustStorePass)) { throw new OcspCheckerException( "Problem retrieving truststore properties." + NOT_VERIFIED_MSG); } KeyStore truststore; try (InputStream truststoreInputStream = new FileInputStream(trustStorePath)) { truststore = SecurityConstants.newTruststore(); truststore.load(truststoreInputStream, trustStorePass.toCharArray()); SecurityLogger.audit( "Truststore on path was read by {}.", trustStorePath, this.getClass().getSimpleName()); } catch (CertificateException | IOException | KeyStoreException | NoSuchAlgorithmException e) { throw new OcspCheckerException( String.format("Problem loading truststore on path %s", trustStorePath), e); } try { return getCertFromTruststoreWithX500Name(issuerName, truststore); } catch (OcspCheckerException e) { throw new OcspCheckerException( "Problem finding the certificate issuer in truststore." + NOT_VERIFIED_MSG, e); } }
Source:
protected void init() { String id = api.statisticsApi().self().id(); assertNotNull(id); selfID = id; }

Target:
protected void init() { selfID = api.statisticsApi().self().id(); assertNotNull(selfID); }
Source:
public void tree() { String componentId = randomAlphanumeric(20); String componentKey = randomAlphanumeric(20); String strategy = randomAlphanumeric(20); int page = 17; int pageSize = 39; String query = randomAlphanumeric(20); underTest.tree(new TreeWsRequest() .setBaseComponentId(componentId) .setBaseComponentKey(componentKey) .setQualifiers(asList("q1", "q2")) .setStrategy(strategy) .setPage(page) .setPageSize(pageSize) .setQuery(query) .setSort(asList("sort1", "sort2"))); serviceTester.assertThat(serviceTester.getGetRequest()) .hasPath("tree") .hasParam("componentId", componentId) .hasParam("component", componentKey) .hasParam("qualifiers", "q1,q2") .hasParam("strategy", strategy) .hasParam("p", page) .hasParam("ps", pageSize) .hasParam("q", query) .hasParam("s", "sort1,sort2") .andNoOtherParam(); }

Target:
public void tree() { String componentId = randomAlphanumeric(20); String componentKey = randomAlphanumeric(20); String strategy = randomAlphanumeric(20); int page = 17; int pageSize = 39; String query = randomAlphanumeric(20); underTest.tree(new TreeWsRequest() .setBaseComponentId(componentId) .setBaseComponentKey(componentKey) .setQualifiers(asList("q1", "q2")) .setStrategy(strategy) .setPage(page) .setPageSize(pageSize) .setQuery(query) .setSort(asList("sort1", "sort2"))); assertThat(serviceTester.getGetParser()).isSameAs(WsComponents.TreeWsResponse.parser()); serviceTester.assertThat(serviceTester.getGetRequest()) .hasPath("tree") .hasParam("componentId", componentId) .hasParam("component", componentKey) .hasParam("qualifiers", "q1,q2") .hasParam("strategy", strategy) .hasParam("p", page) .hasParam("ps", pageSize) .hasParam("q", query) .hasParam("s", "sort1,sort2") .andNoOtherParam(); }
Source:
private void setWaypoints(ViewConnector<? extends BPMNViewDefinition> connector) { BPMNEdge bpmnEdge = di.createBPMNEdge(); bpmnEdge.setId("edge_"+source.getShape().getId()+"_to_"+target.getShape().getId()); bpmnEdge.setBpmnElement(sequenceFlow); Point2D sourcePt = connector.getSourceConnection().get().getLocation(); Point2D targetPt = connector.getTargetConnection().get().getLocation(); org.eclipse.dd.dc.Point sourcePoint = dc.createPoint(); sourcePoint.setX( source.getShape().getBounds().getX() + (float) sourcePt.getX()); sourcePoint.setY( source.getShape().getBounds().getY() + (float) sourcePt.getY()); org.eclipse.dd.dc.Point targetPoint = dc.createPoint(); targetPoint.setX( target.getShape().getBounds().getX() + (float) targetPt.getX()); targetPoint.setY( target.getShape().getBounds().getY() + (float) targetPt.getY()); bpmnEdge.getWaypoint().add(sourcePoint); bpmnEdge.getWaypoint().add(targetPoint); this.bpmnEdge = bpmnEdge; }

Target:
private void setWaypoints(ViewConnector<? extends BPMNViewDefinition> connector) { BPMNEdge bpmnEdge = di.createBPMNEdge(); bpmnEdge.setId(Ids.bpmnEdge(source.getShape().getId(), target.getShape().getId())); bpmnEdge.setBpmnElement(sequenceFlow); Point2D sourcePt = connector.getSourceConnection().get().getLocation(); Point2D targetPt = connector.getTargetConnection().get().getLocation(); org.eclipse.dd.dc.Point sourcePoint = dc.createPoint(); sourcePoint.setX( source.getShape().getBounds().getX() + (float) sourcePt.getX()); sourcePoint.setY( source.getShape().getBounds().getY() + (float) sourcePt.getY()); org.eclipse.dd.dc.Point targetPoint = dc.createPoint(); targetPoint.setX( target.getShape().getBounds().getX() + (float) targetPt.getX()); targetPoint.setY( target.getShape().getBounds().getY() + (float) targetPt.getY()); bpmnEdge.getWaypoint().add(sourcePoint); bpmnEdge.getWaypoint().add(targetPoint); this.bpmnEdge = bpmnEdge; }
Source:
public boolean canHideLabel() { boolean canHideLabel = false; if (!isLabelEmpty()) { if (element instanceof DEdge) { canHideLabel = true; } else if (element instanceof DNode) { canHideLabel = true; } else if (element instanceof DDiagramElementContainer) { canHideLabel = true; } } return canHideLabel; }

Target:
public boolean canHideLabel() { boolean canHideLabel = false; if (!isLabelEmpty()) { if (element instanceof DEdge || element instanceof DNode || element instanceof DDiagramElementContainer) { canHideLabel = true; } } return canHideLabel; }
Source:
private static boolean isPipVersionGreaterEqual( String pipVersion, String pythonExecutable, Map<String, String> environmentVariables) throws IOException, InterruptedException { String[] commands = new String[] { pythonExecutable, "-c", CHECK_PIP_VERSION_SCRIPT, pipVersion }; String out = execute(commands, environmentVariables, false); return Boolean.parseBoolean(out.trim()); }

Target:
private static boolean isPipVersionGreaterEqual( String pipVersion, String pythonExecutable, Map<String, String> environmentVariables) throws IOException { String[] commands = new String[] { pythonExecutable, "-c", CHECK_PIP_VERSION_SCRIPT, pipVersion }; String out = execute(commands, environmentVariables, false); return Boolean.parseBoolean(out.trim()); }
Source:
public void init() { lblTooltipValue.style.visibility = "hidden"; }

Target:
public void init() { mapTooltipContainer.style.visibility = "hidden"; }
Source:
void testCrossrefAndInAuthorNames() throws Exception { BibDatabase database = new BibDatabase(); BibEntry entry1 = new BibEntry(); entry1.setField(StandardField.CROSSREF, "entry2"); BibEntry entry2 = new BibEntry(); entry2.setCiteKey("entry2"); entry2.setField(StandardField.AUTHOR, "Simon Holland"); database.insertEntry(entry1); database.insertEntry(entry2); assertEquals("Holland", BibtexKeyGenerator.cleanKey(BibtexKeyGenerator.generateKey(entry1, "auth", database), "-`ʹ:!;?^+")); }

Target:
void testCrossrefAndInAuthorNames() throws Exception { BibDatabase database = new BibDatabase(); BibEntry entry1 = new BibEntry(); entry1.setField(StandardField.CROSSREF, "entry2"); BibEntry entry2 = new BibEntry(); entry2.setCiteKey("entry2"); entry2.setField(StandardField.AUTHOR, "Simon Holland"); database.insertEntry(entry1); database.insertEntry(entry2); assertEquals("Holland", BibtexKeyGenerator.cleanKey(BibtexKeyGenerator.generateKey(entry1, "auth", database), DEFAULT_UNWANTED_CHARACTERS)); }
Source:
public BinaryContent buildSpreadSheet(List<Metacard> metacards) { Set<AttributeDescriptor> attributeDescriptors = metacards.get(0).getMetacardType().getAttributeDescriptors(); int rowIndex = 0; int cellIndex = 0; Workbook workbook = new XSSFWorkbook(); Sheet sheet = workbook.createSheet(); Row row = sheet.createRow(rowIndex++); CellStyle style = workbook.createCellStyle(); Font font = workbook.createFont(); font.setBold(true); style.setFont(font); for (AttributeDescriptor attributeDescriptor : attributeDescriptors) { String attributeName = attributeDescriptor.getName(); Cell cell = row.createCell(cellIndex++); cell.setCellValue(attributeName); cell.setCellStyle(style); } for (Metacard metacard : metacards) { List<String> values = getMetacardValues(attributeDescriptors, metacard); row = sheet.createRow(rowIndex++); cellIndex = 0; for (String value : values) { row.createCell(cellIndex++).setCellValue(value); } } return writeWorkbook(workbook); }

Target:
public static BinaryContent buildSpreadSheet(List<Metacard> metacards) { if (metacards.isEmpty()) { return null; } Set<AttributeDescriptor> attributeDescriptors = metacards.get(0).getMetacardType().getAttributeDescriptors(); int rowIndex = 0; int cellIndex = 0; Workbook workbook = new XSSFWorkbook(); Sheet sheet = workbook.createSheet(); Row row = sheet.createRow(rowIndex++); CellStyle style = workbook.createCellStyle(); Font font = workbook.createFont(); font.setBold(true); style.setFont(font); for (AttributeDescriptor attributeDescriptor : attributeDescriptors) { String attributeName = attributeDescriptor.getName(); Cell cell = row.createCell(cellIndex++); cell.setCellValue(attributeName); cell.setCellStyle(style); } for (Metacard metacard : metacards) { List<String> values = getMetacardValues(metacard); row = sheet.createRow(rowIndex++); cellIndex = 0; for (String value : values) { row.createCell(cellIndex++).setCellValue(value); } } return writeWorkbook(workbook); }
Source:
private LinkedList<GraphNode> spawnChildren(GraphNode parent) { LinkedList<GraphNode> children = new LinkedList<GraphNode>(); for (int activityNumber = 0; activityNumber < activities.size(); activityNumber++) { Activity a = activities.get(activityNumber); double value = 0; if (!a.checkActivity()) continue; GraphNode newChild = new GraphNode(totalAdded, parent); totalSpawned++; SpawnStatus spawnStatus = SpawnStatus.NEW; if (a.applyMoment == Activity.ApplyMoment.before) value = a.calculateValue(); newChild.state = parent.state.copy(); newChild.state.deploy(); Rule executed = a.executeActivity(); newChild.activityInfo = new ActivityInfo(activityNumber, executed); if (a.applyMoment == Activity.ApplyMoment.after) value = a.calculateValue(); newChild.g = parent.g + value; newChild.h = evaluateBy.get(); add_child: { compare_tops: if (compareTops) { for (Collection<GraphNode> nodesList : Arrays.asList(nodesOpen, nodesClosed)) { for (GraphNode open : nodesList) { if (newChild.state.checkEqual(open.state)) { if (newChild.g < open.g) { nodesList.remove(open); spawnStatus = SpawnStatus.BETTER; break compare_tops; } else { spawnStatus = SpawnStatus.WORSE; break add_child; } } } } } children.add(newChild); totalAdded++; } serializeTops(newChild, spawnStatus, newChild.activityInfo, value); Simulator.getExecutionStateNotifier().notifySubscribers( ExecutionState.SEARCH_STEP); parent.state.deploy(); } return children; }

Target:
private LinkedList<GraphNode> spawnChildren(GraphNode parent) { LinkedList<GraphNode> children = new LinkedList<GraphNode>(); for (int activityNumber = 0; activityNumber < activities.size(); activityNumber++) { Activity a = activities.get(activityNumber); double value = 0; if (!a.checkActivity()) continue; GraphNode newChild = new GraphNode(totalAdded, parent); totalSpawned++; SpawnStatus spawnStatus = SpawnStatus.NEW; if (a.applyMoment == Activity.ApplyMoment.before) value = a.calculateValue(); newChild.state = parent.state.copy(); newChild.state.deploy(); Rule executed = a.executeActivity(); newChild.activityInfo = new ActivityInfo(activityNumber, executed); if (a.applyMoment == Activity.ApplyMoment.after) value = a.calculateValue(); newChild.g = parent.g + value; newChild.h = evaluateBy.get(); add_child: { compare_tops: if (compareTops) { for (Collection<GraphNode> nodesList : Arrays.asList(nodesOpen, nodesClosed)) { for (GraphNode node : nodesList) { if (newChild.state.checkEqual(node.state)) { if (newChild.g < node.g) { nodesList.remove(node); spawnStatus = SpawnStatus.BETTER; break compare_tops; } else { spawnStatus = SpawnStatus.WORSE; break add_child; } } } } } children.add(newChild); totalAdded++; } serializeTops(newChild, spawnStatus, newChild.activityInfo, value); Simulator.getExecutionStateNotifier().notifySubscribers( ExecutionState.SEARCH_STEP); parent.state.deploy(); } return children; }
Source:
private void createOrUpdateIntercomCompany(final MetricOrganisation organisation) { if (organisation == null) { return; } final Company company = new Company(); final String companyID = organisation.id; final String name = organisation.name; company.setCompanyID(companyID); company.setName(name); try { Company.create(company); } catch (final Exception e) { logger.warn("Error creating/updating a Intercom company - " + company + " - " + e.getLocalizedMessage()); } }

Target:
private void createOrUpdateIntercomCompany(final MetricOrganisation organisation) { if (organisation == null) { return; } final Company company = new Company(); final String companyId = organisation.id; final String name = organisation.name; company.setCompanyID(companyId); company.setName(name); try { Company.create(company); } catch (final Exception e) { logger.debug("Error creating/updating a Intercom company: " + company + " - " + e.getMessage()); } }
Source:
public void ovfUpdate_timer() { itemsCountPerUpdate = reloadConfigValue(); log.info("OvfDataUpdater: Attempting to update VMs/Templates Ovf."); List<storage_pool> storagePools = getStoragePoolDao().getAllByStatus(StoragePoolStatus.Up); for (storage_pool pool : storagePools) { try { log.infoFormat("OvfDataUpdater: Attempting to update VM OVFs in Data Center {0}", pool.getname()); initProccessedInfoLists(); updateOvfForVmsOfStoragePool(pool.getId()); log.infoFormat("OvfDataUpdater: Successfully updated VM OVFs in Data Center {0}", pool.getname()); log.infoFormat("OvfDataUpdater: Attempting to update template OVFs in Data Center {0}", pool.getname()); updateOvfForTemplatesOfStoragePool(pool.getId()); log.infoFormat("OvfDataUpdater: Succesfully updated templates OVFs in Data Center {0}", pool.getname()); log.infoFormat("OvfDataUpdater: Attempting to remove uneeded template/vm OVFs in Data Center {0}", pool.getname()); removeOvfForTemplatesAndVmsOfStoragePool(pool.getId()); log.infoFormat("OvfDataUpdater: Succesfully removed uneeded template/vm OVFs in Data Center {0}", pool.getname()); } catch (Exception ex) { addAuditLogError(pool.getname()); log.errorFormat("Exception while trying to update VMs/Templates ovf in Data Center {0}, the exception is {1}", pool.getname(), ex.getMessage()); log.debug(ex.getStackTrace()); } } proccessedIdsInfo = null; proccessedOvfGenerationsInfo = null; }

Target:
public void ovfUpdate_timer() { itemsCountPerUpdate = reloadConfigValue(); log.info("OvfDataUpdater: Attempting to update VMs/Templates Ovf."); List<storage_pool> storagePools = getStoragePoolDao().getAllByStatus(StoragePoolStatus.Up); for (storage_pool pool : storagePools) { try { log.infoFormat("Attempting to update VM OVFs in Data Center {0}", pool.getname()); initProccessedInfoLists(); updateOvfForVmsOfStoragePool(pool.getId()); log.infoFormat("Successfully updated VM OVFs in Data Center {0}", pool.getname()); log.infoFormat("Attempting to update template OVFs in Data Center {0}", pool.getname()); updateOvfForTemplatesOfStoragePool(pool.getId()); log.infoFormat("Succesfully updated templates OVFs in Data Center {0}", pool.getname()); log.infoFormat("Attempting to remove uneeded template/vm OVFs in Data Center {0}", pool.getname()); removeOvfForTemplatesAndVmsOfStoragePool(pool.getId()); log.infoFormat("Succesfully removed unneeded template/vm OVFs in Data Center {0}", pool.getname()); } catch (Exception ex) { addAuditLogError(pool.getname()); log.errorFormat("Exception while trying to update or remove VMs/Templates ovf in Data Center {0}, the exception is {1}", pool.getname(), ex.getMessage()); log.debug(ex.getStackTrace()); } } proccessedIdsInfo = null; proccessedOvfGenerationsInfo = null; }
Source:
private IRegion computeHeaderComment(FoldingStructureComputationContext ctx) throws JavaModelException { ISourceRange range= ctx.getFirstType().getSourceRange(); if (range == null) return null; int start= 0; int end= range.getOffset(); IScanner scanner= ctx.getScanner(); scanner.resetTo(start, end); int headerStart= -1; int headerEnd= -1; try { boolean foundComment= false; int terminal= scanner.getNextToken(); while (terminal != ITerminalSymbols.TokenNameEOF && ((((terminal != ITerminalSymbols.TokenNameclass) && (terminal != ITerminalSymbols.TokenNameinterface)) && (terminal != ITerminalSymbols.TokenNameenum)) && (!foundComment || ((terminal != ITerminalSymbols.TokenNameimport) && (terminal != ITerminalSymbols.TokenNamepackage))))) { if (terminal == ITerminalSymbols.TokenNameCOMMENT_JAVADOC || terminal == ITerminalSymbols.TokenNameCOMMENT_BLOCK || terminal == ITerminalSymbols.TokenNameCOMMENT_LINE) { if (!foundComment) headerStart= scanner.getCurrentTokenStartPosition(); headerEnd= scanner.getCurrentTokenEndPosition(); foundComment= true; } terminal= scanner.getNextToken(); } } catch (InvalidInputException ex) { return null; } if (headerEnd != -1) { return new Region(headerStart, headerEnd - headerStart); } return null; }

Target:
private IRegion computeHeaderComment(FoldingStructureComputationContext ctx) throws JavaModelException { ISourceRange range= ctx.getFirstType().getSourceRange(); if (range == null) return null; int start= 0; int end= range.getOffset(); IScanner scanner= ctx.getScanner(); scanner.resetTo(start, end); int headerStart= -1; int headerEnd= -1; try { boolean foundComment= false; int terminal= scanner.getNextToken(); while (terminal != ITerminalSymbols.TokenNameEOF && (terminal != ITerminalSymbols.TokenNameclass) && (terminal != ITerminalSymbols.TokenNameinterface) && (terminal != ITerminalSymbols.TokenNameenum) && (!foundComment || ((terminal != ITerminalSymbols.TokenNameimport) && (terminal != ITerminalSymbols.TokenNamepackage)))) { if (terminal == ITerminalSymbols.TokenNameCOMMENT_JAVADOC || terminal == ITerminalSymbols.TokenNameCOMMENT_BLOCK || terminal == ITerminalSymbols.TokenNameCOMMENT_LINE) { if (!foundComment) headerStart= scanner.getCurrentTokenStartPosition(); headerEnd= scanner.getCurrentTokenEndPosition(); foundComment= true; } terminal= scanner.getNextToken(); } } catch (InvalidInputException ex) { return null; } if (headerEnd != -1) { return new Region(headerStart, headerEnd - headerStart); } return null; }
Source:
private boolean appendValue(final StringBuilder rval, final Long value, final String key, final boolean nonzeroFragmentVisited) { boolean append = nonzeroFragmentVisited; if (value == null) { return nonzeroFragmentVisited; } if (!nonzeroFragmentVisited && value.longValue() > 0) { append = true; } if (append) { rval.append(value.longValue()).append(key); return true; } return false; }

Target:
private boolean appendValue(final StringBuilder rval, final Long value, final String key, final boolean nonzeroFragmentVisited) { if (value == null) { return nonzeroFragmentVisited; } if (nonzeroFragmentVisited || value.longValue() > 0) { rval.append(value.longValue()).append(key); return true; } return false; }
Source:
public void mappingFunctionReturnsIterableOfEntriesForEachInputEntry() throws Exception { Set<K> inputKeys = new HashSet<K>(); int nbElements = 10; for (long i = 0; i < nbElements; i++) { K k = factory.createKey(i); V v = factory.createValue(i); inputKeys.add(k); kvStore.put(k, v); } try { kvStore.bulkComputeIfAbsent(inputKeys, entries -> { assertThat(entries.iterator().hasNext(), is(false)); return new HashMap<K, V>().entrySet(); } ); } catch (StoreAccessException e) { throw new LegalSPITesterException("Warning, an exception is thrown due to the SPI test"); } }

Target:
public void mappingFunctionReturnsIterableOfEntriesForEachInputEntry() throws Exception { Set<K> inputKeys = new HashSet<K>(); int nbElements = 10; for (long i = 0; i < nbElements; i++) { K k = factory.createKey(i); V v = factory.createValue(i); inputKeys.add(k); kvStore.put(k, v); } try { kvStore.bulkComputeIfAbsent(inputKeys, entries -> { assertThat(entries.iterator().hasNext(), is(false)); return emptySet(); } ); } catch (StoreAccessException e) { throw new LegalSPITesterException("Warning, an exception is thrown due to the SPI test"); } }
Source:
public static ThirdPartyContext singleTenant(String name) { checkNotNull(name); return newContext(name, false); }

Target:
public static ThirdPartyContext singleTenant(String name) { return newContext(name, false); }
Source:
public View getView(int position, View convertView, ViewGroup parent) { View vwRet = convertView; if (null == vwRet) { vwRet = LayoutInflater.from(context).inflate(R.layout.list_language_row, null); } Button delBtn = (Button) vwRet.findViewById(R.id.button_delete); Button dldBtn = (Button) vwRet.findViewById(R.id.button_download); Button optBtn = (Button) vwRet.findViewById(R.id.button_options); delBtn.setText(IconFontUtils.get(IconFontUtils.REMOVE) + " " + context.getString(R.string.button_delete)); dldBtn.setText(IconFontUtils.get(IconFontUtils.DOWNLOAD) + " " + context.getString(R.string.button_download)); optBtn.setText(IconFontUtils.get(IconFontUtils.WRENCH) + " " + context.getString(R.string.button_options)); delBtn.setTypeface(Settings.iconFont); dldBtn.setTypeface(Settings.iconFont); optBtn.setTypeface(Settings.iconFont); delBtn.setOnClickListener(this); dldBtn.setOnClickListener(this); optBtn.setOnClickListener(this); delBtn.setVisibility(View.GONE); dldBtn.setVisibility(View.GONE); optBtn.setVisibility(View.GONE); delBtn.setTag(SUPPORTED_LANGUAGES[position]); dldBtn.setTag(SUPPORTED_LANGUAGES[position]); optBtn.setTag(SUPPORTED_LANGUAGES[position]); if (null != this.customizer) { this.customizer.customizeUI(vwRet, SUPPORTED_LANGUAGES[position]); } return vwRet; }

Target:
public View getView(int position, View convertView, ViewGroup parent) { View vwRet = convertView; if (null == vwRet) { vwRet = LayoutInflater.from(context).inflate(R.layout.list_language_row, null); } Button delBtn = (Button) vwRet.findViewById(R.id.button_delete); Button dldBtn = (Button) vwRet.findViewById(R.id.button_download); Button optBtn = (Button) vwRet.findViewById(R.id.button_options); delBtn.setText(IconFontUtils.get(IconFontUtils.REMOVE, context.getString(R.string.button_delete))); dldBtn.setText(IconFontUtils.get(IconFontUtils.DOWNLOAD, context.getString(R.string.button_download))); optBtn.setText(IconFontUtils.get(IconFontUtils.WRENCH, context.getString(R.string.button_options))); delBtn.setTypeface(Settings.iconFont); dldBtn.setTypeface(Settings.iconFont); optBtn.setTypeface(Settings.iconFont); delBtn.setOnClickListener(this); dldBtn.setOnClickListener(this); optBtn.setOnClickListener(this); delBtn.setVisibility(View.GONE); dldBtn.setVisibility(View.GONE); optBtn.setVisibility(View.GONE); delBtn.setTag(SUPPORTED_LANGUAGES[position]); dldBtn.setTag(SUPPORTED_LANGUAGES[position]); optBtn.setTag(SUPPORTED_LANGUAGES[position]); if (null != this.customizer) { this.customizer.customizeUI(vwRet, SUPPORTED_LANGUAGES[position]); } return vwRet; }
Source:
protected Optional<ExampleProjectError> getError(Path projectPath) { POM pom = this.getPom(pomService, projectPath); if (pom.getModules().isEmpty() || pom.getModules() == null) { return Optional.empty(); } else { return Optional.of(new ExampleProjectError(CheckModulesValidator.class.getCanonicalName(), "")); } }

Target:
protected Optional<ExampleProjectError> getError(Path projectPath) { POM pom = this.getPom(pomService, projectPath); if (pom.getModules() == null || pom.getModules().isEmpty()) { return Optional.empty(); } else { return Optional.of(new ExampleProjectError(CheckModulesValidator.class.getCanonicalName(), "")); } }