auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void checkSuperInvokedBeforeThisOrSuper(SuperTreeImpl superTree) { if (isInConstructor(superTree)) { int line = superTree.getFirstToken().line(); int column = superTree.getFirstToken().column(); MethodDeclarationTree method = getEnclosingConstructor(superTree); Set<IssueLocation> secondaryLocations = new HashSet<>(); Set<SuperTreeImpl> superTrees = new SuperDetector().detectIn(method); superTrees.stream() .filter(s -> !s.getParent().is(Kind.CALL_EXPRESSION)) .filter(s -> isBefore(s.getFirstToken(), line, column)) .map(IssueLocation::new) .forEach(secondaryLocations::add); Set<IdentifierTree> thisTrees = new ThisDetector().detectIn(method); thisTrees.stream() .filter(s -> isBefore(s.identifierToken(), line, column)) .map(IssueLocation::new) .forEach(secondaryLocations::add); if (!secondaryLocations.isEmpty()) { PreciseIssue issue = addIssue(superTree, MESSAGE_SUPER_BEFORE_THIS_OR_SUPER); secondaryLocations.forEach(issue::secondary); } } }

Target:
private void checkSuperInvokedBeforeThisOrSuper(SuperTreeImpl superTree) { int line = superTree.getFirstToken().line(); int column = superTree.getFirstToken().column(); MethodDeclarationTree method = getEnclosingConstructor(superTree); Set<IssueLocation> secondaryLocations = new HashSet<>(); Set<SuperTreeImpl> superTrees = new SuperDetector().detectIn(method); superTrees.stream() .filter(s -> !s.getParent().is(Kind.CALL_EXPRESSION)) .filter(s -> isBefore(s.getFirstToken(), line, column)) .map(IssueLocation::new) .forEach(secondaryLocations::add); Set<IdentifierTree> thisTrees = new ThisDetector().detectIn(method); thisTrees.stream() .filter(s -> isBefore(s.identifierToken(), line, column)) .map(IssueLocation::new) .forEach(secondaryLocations::add); if (!secondaryLocations.isEmpty()) { PreciseIssue issue = addIssue(superTree, MESSAGE_SUPER_BEFORE_THIS_OR_SUPER); secondaryLocations.forEach(issue::secondary); } }
Source:
public void allSessions() { String url1 = "realm://objectserver.realm.io/default"; String url2 = "realm://objectserver.realm.io/~/default"; SyncUser user = createTestUser(); assertEquals(0, user.allSessions().size()); SyncConfiguration configuration1 = new SyncConfiguration.Builder(user, url1).build(); Realm realm1 = Realm.getInstance(configuration1); assertEquals(1, user.allSessions().size()); List<SyncSession> allSessions = user.allSessions(); Iterator<SyncSession> iter = allSessions.iterator(); SyncSession session = iter.next(); assertEquals(user, session.getUser()); assertEquals(url1, session.getServerUrl().toString()); SyncConfiguration configuration2 = new SyncConfiguration.Builder(user, url2).build(); Realm realm2 = Realm.getInstance(configuration2); assertEquals(2, user.allSessions().size()); allSessions = user.allSessions(); iter = allSessions.iterator(); String indivisualUrl = url2.replace("~", user.getIdentity()); int foundCount = 0; while (iter.hasNext()) { session = iter.next(); assertEquals(user, session.getUser()); if (indivisualUrl.equals(session.getServerUrl().toString())) { foundCount++; } } assertEquals(1, foundCount); realm1.close(); assertEquals(1, user.allSessions().size()); allSessions = user.allSessions(); iter = allSessions.iterator(); session = iter.next(); assertEquals(user, session.getUser()); assertEquals(indivisualUrl, session.getServerUrl().toString()); realm2.close(); assertEquals(0, user.allSessions().size()); }

Target:
public void allSessions() { String url1 = "realm://objectserver.realm.io/default"; String url2 = "realm://objectserver.realm.io/~/default"; SyncUser user = createTestUser(); assertEquals(0, user.allSessions().size()); SyncConfiguration configuration1 = new SyncConfiguration.Builder(user, url1).build(); Realm realm1 = Realm.getInstance(configuration1); List<SyncSession> allSessions = user.allSessions(); assertEquals(1, allSessions.size()); Iterator<SyncSession> iter = allSessions.iterator(); SyncSession session = iter.next(); assertEquals(user, session.getUser()); assertEquals(url1, session.getServerUrl().toString()); SyncConfiguration configuration2 = new SyncConfiguration.Builder(user, url2).build(); Realm realm2 = Realm.getInstance(configuration2); allSessions = user.allSessions(); assertEquals(2, allSessions.size()); iter = allSessions.iterator(); String individualUrl = url2.replace("~", user.getIdentity()); int foundCount = 0; while (iter.hasNext()) { session = iter.next(); assertEquals(user, session.getUser()); if (individualUrl.equals(session.getServerUrl().toString())) { foundCount++; } } assertEquals(1, foundCount); realm1.close(); allSessions = user.allSessions(); assertEquals(1, allSessions.size()); iter = allSessions.iterator(); session = iter.next(); assertEquals(user, session.getUser()); assertEquals(individualUrl, session.getServerUrl().toString()); realm2.close(); assertEquals(0, user.allSessions().size()); }
Source:
public void addSections(Collection<String> sections) { for (String section : sections) { if (!this.sections.contains(section)) { this.sections.add(section); } } }

Target:
public void addSections(Collection<String> sections) { for (String section : sections) { addSection(section); } }
Source:
public Iterable<String> getEdgeIds(final Vertex otherVertex, final Direction direction, final String[] labels, final Authorizations authorizations) { getFetchHints().validateHasEdgeFetchHints(direction); return getEdgeIdsWithOtherVertexId(otherVertex.getId(), direction, labels, authorizations); }

Target:
public Iterable<String> getEdgeIds(final Vertex otherVertex, final Direction direction, final String[] labels, final Authorizations authorizations) { getFetchHints().validateHasEdgeFetchHints(direction, labels); return getEdgeIdsWithOtherVertexId(otherVertex.getId(), direction, labels, authorizations); }
Source:
public boolean canExecute(ITmfTrace trace) { if (!(trace instanceof TmfExperiment)) { throw new IllegalStateException(); } return super.canExecute(trace); }

Target:
public boolean canExecute(ITmfTrace trace) { return (trace instanceof TmfExperiment) && super.canExecute(trace); }
Source:
public ExtendedPluginFQN evaluateFqn(String reference, FileContentProvider fileContentProvider) throws InfrastructureException { try { String pluginMetaContent = fileContentProvider.fetchContent(reference); JsonNode contentNode = yamlReader.readTree(pluginMetaContent); String publisher = contentNode.get("publisher").textValue(); String name = contentNode.get("name").textValue(); String version = contentNode.get("version").textValue(); return new ExtendedPluginFQN(reference, publisher, name, version); } catch (DevfileException | IOException e) { throw new InfrastructureException(format("Plugin reference URL '%s' is invalid.", reference)); } }

Target:
public ExtendedPluginFQN evaluateFqn(String reference, FileContentProvider fileContentProvider) throws InfrastructureException { JsonNode contentNode; try { String pluginMetaContent = fileContentProvider.fetchContent(reference); contentNode = yamlReader.readTree(pluginMetaContent); } catch (DevfileException | IOException e) { throw new InfrastructureException( format("Plugin reference URL '%s' is invalid.", reference), e); } JsonNode publisher = contentNode.path("publisher"); if (publisher.isMissingNode()) { throw new InfrastructureException(formatMessage(reference, "publisher")); } JsonNode name = contentNode.get("name"); if (name.isMissingNode()) { throw new InfrastructureException(formatMessage(reference, "name")); } JsonNode version = contentNode.get("version"); if (version.isMissingNode()) { throw new InfrastructureException(formatMessage(reference, "version")); } return new ExtendedPluginFQN( reference, publisher.textValue(), name.textValue(), version.textValue()); }
Source:
String getFullyQualifiedNamespace() { return connection.getFullyQualifiedDomainName(); }

Target:
String getFullyQualifiedNamespace() { return connection.getFullyQualifiedNamespace(); }
Source:
public List getClients() { final Query query = em.createNamedQuery("getClients"); return query.getResultList(); }

Target:
public List<ClientEntity> getClients() { return em.createNamedQuery("getClients", ClientEntity.class).getResultList(); }
Source:
public void alwaysDisplayInAccountConsole() { driver.navigate().refresh(); waitForPageToLoad(); newClient = createClientRep("always-display-in-console", OIDC); createClient(newClient); newClient.setRedirectUris(TEST_REDIRECT_URIs); newClient.setAlwaysDisplayInConsole(true); assertFalse(clientSettingsPage.form().isAlwaysDisplayInConsole()); clientSettingsPage.form().setAlwaysDisplayInConsole(true); clientSettingsPage.form().setRedirectUris(TEST_REDIRECT_URIs); clientSettingsPage.form().save(); assertTrue(clientSettingsPage.form().isAlwaysDisplayInConsole()); ClientRepresentation found = findClientByClientId(newClient.getClientId()); assertNotNull("Client " + newClient.getClientId() + " was not found.", found); assertClientSettingsEqual(newClient, found); clientSettingsPage.form().setAccessType(BEARER_ONLY); assertFalse(clientSettingsPage.form().isAlwaysDisplayInConsoleVisible()); clientSettingsPage.form().setProtocol(SAML); assertTrue(clientSettingsPage.form().isAlwaysDisplayInConsoleVisible()); }

Target:
public void alwaysDisplayInAccountConsole() { refreshPageAndWaitForLoad(); newClient = createClientRep("always-display-in-console", OIDC); createClient(newClient); newClient.setRedirectUris(TEST_REDIRECT_URIs); newClient.setAlwaysDisplayInConsole(true); assertFalse(clientSettingsPage.form().isAlwaysDisplayInConsole()); clientSettingsPage.form().setAlwaysDisplayInConsole(true); clientSettingsPage.form().setRedirectUris(TEST_REDIRECT_URIs); clientSettingsPage.form().save(); assertTrue(clientSettingsPage.form().isAlwaysDisplayInConsole()); ClientRepresentation found = findClientByClientId(newClient.getClientId()); assertNotNull("Client " + newClient.getClientId() + " was not found.", found); assertClientSettingsEqual(newClient, found); clientSettingsPage.form().setAccessType(BEARER_ONLY); assertFalse(clientSettingsPage.form().isAlwaysDisplayInConsoleVisible()); clientSettingsPage.form().setProtocol(SAML); assertTrue(clientSettingsPage.form().isAlwaysDisplayInConsoleVisible()); }
Source:
public static List<FilterEntry> parse(String filters) { List<FilterEntry> ret = new LinkedList<>(); if (!PATTERN_BLANK.matcher(filters).matches()) { Matcher m = PATTERN_PARSE.matcher(filters); boolean ok = false; int expectedStart = 0; while (m.find()) { log.debug(String.format("parse: handling '%s'", m.group(0))); if (m.start() != expectedStart) { throw new RuntimeException("Cannot parse filters"); } expectedStart = m.end(); ok = m.end() == m.regionEnd(); ret.add( new FilterEntry( m.group("anymsg") != null ? null : m.group("message"), m.group("exclude") != null, m.group("anyrecipient") != null ? null : m.group("transport"), m.group("name") ) ); } if (!ok) { throw new IllegalArgumentException("Cannot parse filters"); } } return Collections.unmodifiableList(ret); }

Target:
public static List<FilterEntry> parse(String filters) { List<FilterEntry> ret = new LinkedList<>(); if (!PATTERN_BLANK.matcher(filters).matches()) { Matcher m = PATTERN_PARSE.matcher(filters); boolean ok = false; int expectedStart = 0; while (m.find()) { log.debug(String.format("parse: handling '%s'", m.group(0))); if (m.start() != expectedStart) { throw new RuntimeException("Cannot parse filters"); } expectedStart = m.end(); ok = m.end() == m.regionEnd(); ret.add( new FilterEntry( m.group("anymsg") != null ? null : m.group("message"), m.group("exclude") != null, m.group("recipient") == null || m.group("anyrecipient") != null ? null : new Recipient( m.group("transport"), m.group("name") ) ) ); } if (!ok) { throw new IllegalArgumentException("Cannot parse filters"); } } return ret; }
Source:
protected void doFilterInternal(final HttpServletRequest request, final HttpServletResponse response, final FilterChain filterChain) throws IOException, ServletException { openHttpConnectionsCounter.inc(); final Timer.Context timerContext = httpConnectionsTimer.time(); final String clientId = Optional.ofNullable(request.getUserPrincipal()) .map(Principal::getName) .orElse("unauthenticated"); final String perPathMetricKey = MetricRegistry.name( clientId, request.getMethod(), request.getServletPath()); final Timer.Context perPathTimerContext = perPathMetricRegistry.timer(perPathMetricKey).time(); try { filterChain.doFilter(request, response); } finally { if (perPathTimerContext != null) { perPathTimerContext.stop(); } timerContext.stop(); openHttpConnectionsCounter.dec(); } }

Target:
protected void doFilterInternal(final HttpServletRequest request, final HttpServletResponse response, final FilterChain filterChain) throws IOException, ServletException { openHttpConnectionsCounter.inc(); final Timer.Context timerContext = httpConnectionsTimer.time(); final String clientId = Optional.ofNullable(request.getUserPrincipal()) .map(Principal::getName) .orElse("unauthenticated"); final String perPathMetricKey = MetricRegistry.name( clientId, request.getMethod(), request.getServletPath()); final Timer.Context perPathTimerContext = perPathMetricRegistry.timer(perPathMetricKey).time(); try { filterChain.doFilter(request, response); } finally { perPathTimerContext.stop(); timerContext.stop(); openHttpConnectionsCounter.dec(); } }
Source:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((key == null) ? 0 : key.hashCode()); result = prime * result + ((samzaSqlRelRecord == null) ? 0 : samzaSqlRelRecord.hashCode()); return result; }

Target:
public int hashCode() { return Objects.hash(key, samzaSqlRelRecord); }
Source:
public StompAndHowl(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{G}"); this.getSpellAbility().addTarget(new TargetPermanent(filterArtifact)); this.getSpellAbility().addTarget(new TargetPermanent(filterEnchantment)); this.getSpellAbility().addEffect(new DestroyMultiTargetEffect()); }

Target:
public StompAndHowl(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{G}"); this.getSpellAbility().addTarget(new TargetArtifactPermanent()); this.getSpellAbility().addTarget(new TargetEnchantmentPermanent()); this.getSpellAbility().addEffect(new DestroyMultiTargetEffect()); }
Source:
public MergePolicyCustomTest() { super(); this.mergePolicy = ((preferredEntry, otherEntries) -> TestInternalCacheEntryFactory.create(conflictKey, "Custom")); }

Target:
public MergePolicyCustomTest() { this.mergePolicy = ((preferredEntry, otherEntries) -> TestInternalCacheEntryFactory.create(conflictKey, "Custom")); }
Source:
private OkHttpClientBuilderProvider findProvider(DefaultServiceEndpoint service) { OkHttpClientBuilderProvider providerImpl = providers.stream() .sorted(Comparator.comparingInt(OkHttpClientBuilderProvider::priority).reversed()) .filter(provider -> provider.supports(service)) .findFirst() .orElse(null); if (providerImpl == null) { throw new SystemException( format("No client provider found for url (%s)", service.getBaseUrl())); } return providerImpl; }

Target:
private OkHttpClientBuilderProvider findProvider(DefaultServiceEndpoint service) { return providers.stream() .filter(provider -> provider.supports(service)) .findFirst() .orElseThrow( () -> new SystemException( format("No client provider found for url (%s)", service.getBaseUrl()))); }
Source:
public SecurityGroup addIpPermission(IpProtocol protocol, int startPort, int endPort, Multimap<String, String> tenantIdGroupNamePairs, Iterable<String> ipRanges, Iterable<String> groupIds, SecurityGroup group) { String zone = group.getLocation().getId(); String id = group.getId(); Optional<? extends SecurityGroupApi> sgApi = client.getSecurityGroupExtensionForZone(zone); if (!sgApi.isPresent()) { return null; } if (Iterables.size(ipRanges) > 0) { for (String cidr : ipRanges) { sgApi.get().createRuleAllowingCidrBlock(id, Ingress.builder() .ipProtocol(protocol) .fromPort(startPort) .toPort(endPort) .build(), cidr); } } if (Iterables.size(groupIds) > 0) { for (String zoneAndGroupRaw : groupIds) { ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(zoneAndGroupRaw); String groupId = zoneAndId.getId(); sgApi.get().createRuleAllowingSecurityGroupId(id, Ingress.builder() .ipProtocol(protocol) .fromPort(startPort) .toPort(endPort) .build(), groupId); } } return getSecurityGroupById(ZoneAndId.fromZoneAndId(zone, id).slashEncode()); }

Target:
public SecurityGroup addIpPermission(IpProtocol protocol, int startPort, int endPort, Multimap<String, String> tenantIdGroupNamePairs, Iterable<String> ipRanges, Iterable<String> groupIds, SecurityGroup group) { String zone = group.getLocation().getId(); String id = group.getId(); Optional<? extends SecurityGroupApi> sgApi = api.getSecurityGroupExtensionForZone(zone); if (!sgApi.isPresent()) { return null; } if (Iterables.size(ipRanges) > 0) { for (String cidr : ipRanges) { sgApi.get().createRuleAllowingCidrBlock(id, Ingress.builder() .ipProtocol(protocol) .fromPort(startPort) .toPort(endPort) .build(), cidr); } } if (Iterables.size(groupIds) > 0) { for (String zoneAndGroupRaw : groupIds) { ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(zoneAndGroupRaw); String groupId = zoneAndId.getId(); sgApi.get().createRuleAllowingSecurityGroupId(id, Ingress.builder() .ipProtocol(protocol) .fromPort(startPort) .toPort(endPort) .build(), groupId); } } return getSecurityGroupById(ZoneAndId.fromZoneAndId(zone, id).slashEncode()); }
Source:
public int sendMessage(MessageReference reference, org.apache.activemq.artemis.api.core.Message message, ServerConsumer consumer, int deliveryCount) { AMQConsumer theConsumer = (AMQConsumer) consumer.getProtocolData(); rollbackedIds.remove(message.getMessageID()); return theConsumer.handleDeliver(reference, message.toCore(), deliveryCount); }

Target:
public int sendMessage(MessageReference reference, org.apache.activemq.artemis.api.core.Message message, ServerConsumer consumer, int deliveryCount) { AMQConsumer theConsumer = (AMQConsumer) consumer.getProtocolData(); theConsumer.removeRolledback(reference); return theConsumer.handleDeliver(reference, message.toCore(), deliveryCount); }
Source:
public char getLabel() { char rv; switch (getType()) { case INPUT_VAL: rv = buttonData.inputVal; break; case AUTO_CHAR: rv = buttonData.autoChar; break; case CUSTOM: rv = buttonData.customChar; break; default: rv='*'; } return rv; }

Target:
public char getLabel() { final char rv; switch (getType()) { case INPUT_VAL: rv = buttonData.inputVal; break; case AUTO_CHAR: rv = buttonData.autoChar; break; case CUSTOM: rv = buttonData.customChar; break; default: rv = '*'; } return rv; }
Source:
public void testProcedureDetail() throws Exception { Client client = getClient(); int maxConfigValue = 1 << ProcedureDetailTestConfig.m_optionCount; for (int configValue = 0; configValue < maxConfigValue; configValue++) { ProcedureDetailTestConfig testConfig = new ProcedureDetailTestConfig(configValue); System.out.println("\n========================================================================================"); System.out.println(String.format("exec %s %d '%s'", testConfig.getNameOfProcedureToCall(), configValue, testConfig.getArgumentString())); try { client.callProcedure(testConfig.getNameOfProcedureToCall(), configValue, testConfig.getArgumentString()); } catch (ProcCallException pce) { if (! testConfig.expectsException()) { throw pce; } System.out.println("\nCaught exception as expected:\n" + pce.getMessage()); continue; } finally { VoltTable procedureDetail = client.callProcedure("@Statistics", "PROCEDUREDETAIL", 1).getResults()[0]; System.out.println(procedureDetail.toFormattedString()); validateProcedureDetail(testConfig, procedureDetail); } if (testConfig.expectsException()) { throw new Exception(String.format("Expects an exception from exec %s %d '%s', but did not get it.", testConfig.getNameOfProcedureToCall(), configValue, testConfig.getArgumentString())); } } VoltTable procedureDetail = client.callProcedure("@Statistics", "PROCEDUREDETAIL", 0).getResults()[0]; }

Target:
public void testProcedureDetail() throws Exception { Client client = getClient(); int maxConfigValue = 1 << ProcedureDetailTestConfig.m_optionCount; for (int configValue = 0; configValue < maxConfigValue; configValue++) { ProcedureDetailTestConfig testConfig = new ProcedureDetailTestConfig(configValue); System.out.println("\n========================================================================================"); System.out.println(String.format("exec %s %d '%s'", testConfig.getNameOfProcedureToCall(), configValue, testConfig.getArgumentString())); boolean caughtException = false; try { client.callProcedure(testConfig.getNameOfProcedureToCall(), configValue, testConfig.getArgumentString()); } catch (ProcCallException pce) { if (! testConfig.expectsException()) { throw pce; } System.out.println("\nCaught exception as expected:\n" + pce.getMessage()); caughtException = true; } finally { VoltTable procedureDetail = client.callProcedure("@Statistics", "PROCEDUREDETAIL", 1).getResults()[0]; System.out.println(procedureDetail.toFormattedString()); verifyProcedureDetailResult(testConfig, procedureDetail); } if (testConfig.expectsException() && ! caughtException) { fail(String.format("Expects an exception from exec %s %d '%s', but did not get it.", testConfig.getNameOfProcedureToCall(), configValue, testConfig.getArgumentString())); } } }
Source:
public void appendTextToConsole(String text, ConsoleTextType textType) { final Text commandText = new Text(text); commandText.setWrappingWidth(console.getWidth()); switch (textType) { case NORMAL: commandText.getStyleClass().addAll("consoleText", "normal"); break; case ERROR: commandText.getStyleClass().addAll("consoleText", "error"); break; case DEFAULT: default: commandText.getStyleClass().addAll("consoleText", "default"); } Platform.runLater(() -> { forceScroll = true; console.getChildren().add(commandText); console.layout(); consolePane.vvalueProperty().setValue(1.0); }); }

Target:
public void appendTextToConsole(String text, ConsoleTextType textType) { final Text commandText = new Text(text); commandText.setWrappingWidth(console.getWidth()); commandText.getStyleClass().addAll("consoleText", textType.getCssName()); Platform.runLater(() -> { forceScroll = true; console.getChildren().add(commandText); console.layout(); consolePane.vvalueProperty().setValue(1.0); }); }
Source:
private void log(Object value) { LOGGER.debug(indent() + value); }

Target:
private void log(Object value) { LOGGER.debug("{}{}", indent(), value); }
Source:
private void createNonReqChangeDemoActions() throws Exception { SkynetTransaction transaction = TransactionManager.createTransaction(AtsUtil.getAtsBranch(), "Populate Demo DB - Create Actions"); if (DEBUG) { OseeLog.log(Activator.class, Level.INFO, "createNonReqChangeDemoActions - SAW_Bld_3"); } List<ActionArtifact> actions = Collections.castAll(createActions(DemoDbActionData.getNonReqSawActionData(), DemoArtifactToken.SAW_Bld_3, null, transaction)); appendBuildNameToTitles(actions, DemoSawBuilds.SAW_Bld_3.getName(), transaction); if (DEBUG) { OseeLog.log(Activator.class, Level.INFO, "createNonReqChangeDemoActions - SAW_Bld_2"); } actions = Collections.castAll(createActions(DemoDbActionData.getNonReqSawActionData(), DemoArtifactToken.SAW_Bld_2, null, transaction)); appendBuildNameToTitles(actions, DemoSawBuilds.SAW_Bld_2.getName(), transaction); if (DEBUG) { OseeLog.log(Activator.class, Level.INFO, "createNonReqChangeDemoActions - SAW_Bld_1"); } actions = Collections.castAll(createActions(DemoDbActionData.getNonReqSawActionData(), DemoArtifactToken.SAW_Bld_1, TeamState.Completed, transaction)); appendBuildNameToTitles(actions, DemoSawBuilds.SAW_Bld_1.toString(), transaction); transaction.execute(); }

Target:
private void createNonReqChangeDemoActions() throws Exception { SkynetTransaction transaction = TransactionManager.createTransaction(AtsUtil.getAtsBranch(), "Populate Demo DB - Create Actions"); if (DEBUG) { OseeLog.log(Activator.class, Level.INFO, "createNonReqChangeDemoActions - SAW_Bld_3"); } Set<ActionArtifact> actions = createActions(DemoDbActionData.getNonReqSawActionData(), DemoArtifactToken.SAW_Bld_3, null, transaction); appendBuildNameToTitles(actions, DemoSawBuilds.SAW_Bld_3.getName(), transaction); if (DEBUG) { OseeLog.log(Activator.class, Level.INFO, "createNonReqChangeDemoActions - SAW_Bld_2"); } actions = createActions(DemoDbActionData.getNonReqSawActionData(), DemoArtifactToken.SAW_Bld_2, null, transaction); appendBuildNameToTitles(actions, DemoSawBuilds.SAW_Bld_2.getName(), transaction); if (DEBUG) { OseeLog.log(Activator.class, Level.INFO, "createNonReqChangeDemoActions - SAW_Bld_1"); } actions = createActions(DemoDbActionData.getNonReqSawActionData(), DemoArtifactToken.SAW_Bld_1, TeamState.Completed, transaction); appendBuildNameToTitles(actions, DemoSawBuilds.SAW_Bld_1.toString(), transaction); transaction.execute(); }
Source:
private void takeScreenshot(String screenshotName) { idleFor(8000); try { if (runningInTestLab()) { ScreenShotter.takeScreenshot(screenshotName, getCurrentActivity()); } else { Screengrab.screenshot(screenshotName); } } catch (RuntimeException r) { } }

Target:
private void takeScreenshot(String screenshotName) { try { if (runningInTestLab()) { ScreenShotter.takeScreenshot(screenshotName, getCurrentActivity()); } else { Screengrab.screenshot(screenshotName); } } catch (RuntimeException r) { } }
Source:
public ECTopologyVerifierResult getECTopologyResultForPolicies( final String... policyNames) throws IOException { if (this.vfs == null) { return super.getECTopologyResultForPolicies(policyNames); } throw new UnsupportedOperationException( "unsetErasureCodingPolicy is not supported in ViewDFS"); }

Target:
public ECTopologyVerifierResult getECTopologyResultForPolicies( final String... policyNames) throws IOException { if (this.vfs == null) { return super.getECTopologyResultForPolicies(policyNames); } List<IOException> failedExceptions = new ArrayList<>(); ECTopologyVerifierResult result = null; for (FileSystem fs : getChildFileSystems()) { if (!(fs instanceof DistributedFileSystem)) { continue; } DistributedFileSystem dfs = (DistributedFileSystem) fs; try { result = dfs.getECTopologyResultForPolicies(policyNames); if (!result.isSupported()) { return result; } } catch (IOException ioe) { failedExceptions.add(ioe); } } if (result == null) { throw new UnsupportedOperationException( "No DFS available in child filesystems"); } if (failedExceptions.size() > 0) { throw MultipleIOException.createIOException(failedExceptions); } return result; }
Source:
public Set<Long> getLatestActivitiesForTasks() { List<Long> activitiesIds = taskActivitiesDataService.executeQuery(new QueryExecution<List<Long>>() { @Override public List<Long> execute(Query query, InstanceSecurityRestriction restriction) { query.setResult("max(id)"); query.setGrouping("task"); return (List<Long>) query.execute(); } }); return new HashSet<>(activitiesIds); }

Target:
private Set<Long> getLatestActivitiesForTasks() { List<Long> activitiesIds = taskActivitiesDataService.executeQuery(new QueryExecution<List<Long>>() { @Override public List<Long> execute(Query query, InstanceSecurityRestriction restriction) { query.setResult("max(id)"); query.setGrouping("task"); return (List<Long>) query.execute(); } }); return new HashSet<>(activitiesIds); }
Source:
protected void doStart() throws Exception { UserServiceImp userServiceImp = new UserServiceImp(); register(UserService.class, userServiceImp); UserServiceRedisImp userServiceRedisImp = new UserServiceRedisImp(); register(UserServiceRedis.class, userServiceRedisImp); }

Target:
protected void doStart() throws Exception { UserServiceImpl userServiceImpl = new UserServiceImpl(); register(UserService.class, userServiceImpl); UserServiceRedisImpl userServiceRedisImpl = new UserServiceRedisImpl(); register(UserServiceRedis.class, userServiceRedisImpl); }
Source:
public static String getPath(RepositoryRestConfiguration configuration, ResourceMapping mapping) { BaseUri baseUri = new BaseUri(configuration.getBaseUri()); if (mapping == null) { return baseUri.getUriComponentsBuilder().path(ProfileController.PROFILE_ROOT_MAPPING).build().toString(); } else { return baseUri.getUriComponentsBuilder().path(ProfileController.PROFILE_ROOT_MAPPING + mapping.getPath()).build().toString(); } }

Target:
public static String getPath(RepositoryRestConfiguration configuration, ResourceMapping mapping) { if (mapping == null) { return getRootPath(configuration); } else { return getRootPath(configuration) + mapping.getPath(); } }
Source:
public void testConfigBuilder() { GlobalConfiguration globalConfig = new GlobalConfigurationBuilder() .globalJmxStatistics().transport().defaultTransport().build(); Configuration cacheConfig = new ConfigurationBuilder().loaders() .addLoader(LevelDBCacheStoreConfigurationBuilder.class) .location("/tmp/leveldb/fluent/data") .expiredLocation("/tmp/leveldb/fluent/expired") .build(); CacheLoaderConfiguration cacheLoaderConfig = cacheConfig.loaders().cacheLoaders().get(0); assert cacheLoaderConfig instanceof LevelDBCacheStoreConfiguration; LevelDBCacheStoreConfiguration leveldbConfig = (LevelDBCacheStoreConfiguration) cacheLoaderConfig; assert leveldbConfig.location().equals("/tmp/leveldb/fluent/data"); assert leveldbConfig.expiredLocation().equals("/tmp/leveldb/fluent/expired"); EmbeddedCacheManager cacheManager = new DefaultCacheManager( globalConfig); cacheManager.defineConfiguration("testCache", cacheConfig); cacheManager.start(); Cache<String, String> cache = cacheManager.getCache("testCache"); cache.put("hello", "there"); cache.stop(); cacheManager.stop(); TestingUtil.recursiveFileRemove("/tmp/leveldb/fluent"); }

Target:
public void testConfigBuilder() { GlobalConfiguration globalConfig = new GlobalConfigurationBuilder() .globalJmxStatistics().transport().defaultTransport().build(); Configuration cacheConfig = new ConfigurationBuilder().loaders() .addLoader(LevelDBCacheStoreConfigurationBuilder.class) .location(tmpDataDirectory) .expiredLocation(tmpExpiredDirectory) .build(); CacheLoaderConfiguration cacheLoaderConfig = cacheConfig.loaders().cacheLoaders().get(0); assertTrue(cacheLoaderConfig instanceof LevelDBCacheStoreConfiguration); LevelDBCacheStoreConfiguration leveldbConfig = (LevelDBCacheStoreConfiguration) cacheLoaderConfig; assertEquals(tmpDataDirectory, leveldbConfig.location()); assertEquals(tmpExpiredDirectory, leveldbConfig.expiredLocation()); EmbeddedCacheManager cacheManager = new DefaultCacheManager( globalConfig); cacheManager.defineConfiguration("testCache", cacheConfig); cacheManager.start(); Cache<String, String> cache = cacheManager.getCache("testCache"); cache.put("hello", "there"); cache.stop(); cacheManager.stop(); }
Source:
public void setTopItem (TreeItem item) { checkWidget(); if (item == null) error (SWT.ERROR_NULL_ARGUMENT); if (item.isDisposed ()) error(SWT.ERROR_INVALID_ARGUMENT); if (item.parent != this) return; long vAdjustment; if (OS.GTK3) { vAdjustment = OS.gtk_scrollable_get_vadjustment(handle); } else { vAdjustment = OS.gtk_tree_view_get_vadjustment(handle); } cachedAdjustment = OS.gtk_adjustment_get_value(vAdjustment); topItem= item; long path = OS.gtk_tree_model_get_path (modelHandle, item.handle); showItem (path, false); OS.gtk_tree_view_scroll_to_cell (handle, path, 0, true, 0, 0); OS.gtk_tree_path_free (path); }

Target:
public void setTopItem (TreeItem item) { if (item == null) error (SWT.ERROR_NULL_ARGUMENT); if (item.isDisposed ()) error(SWT.ERROR_INVALID_ARGUMENT); if (item.parent != this) return; long vAdjustment; if (OS.GTK3) { vAdjustment = OS.gtk_scrollable_get_vadjustment(handle); } else { vAdjustment = OS.gtk_tree_view_get_vadjustment(handle); } cachedAdjustment = OS.gtk_adjustment_get_value(vAdjustment); topItem= item; long path = OS.gtk_tree_model_get_path (modelHandle, item.handle); showItem (path, false); OS.gtk_tree_view_scroll_to_cell (handle, path, 0, true, 0, 0); OS.gtk_tree_path_free (path); }
Source:
public void copyFileToContainer(MountableFile mountableFile, String containerPath) { if (!isCreated()) { throw new IllegalStateException("copyFileToContainer can only be used with created / running container"); } try ( ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); TarArchiveOutputStream tarArchive = new TarArchiveOutputStream(byteArrayOutputStream) ) { tarArchive.setLongFileMode(TarArchiveOutputStream.LONGFILE_POSIX); File sourceFile = new File(mountableFile.getFilesystemPath()); final String destination; String remotePath; if (containerPath.endsWith("/") && sourceFile.isFile()) { logger().warn("folder-like containerPath in copyFileToContainer is deprecated, please explicitly specify a file path"); remotePath = containerPath; destination = sourceFile.getName(); } else { File containerPathFile = new File(containerPath); remotePath = containerPathFile.getParent(); destination = containerPathFile.getName(); } mountableFile.transferTo(tarArchive, destination); tarArchive.finish(); dockerClient .copyArchiveToContainerCmd(containerId) .withTarInputStream(new ByteArrayInputStream(byteArrayOutputStream.toByteArray())) .withRemotePath(remotePath) .exec(); } }

Target:
public void copyFileToContainer(MountableFile mountableFile, String containerPath) { File sourceFile = new File(mountableFile.getResolvedPath()); if (containerPath.endsWith("/") && sourceFile.isFile()) { logger().warn("folder-like containerPath in copyFileToContainer is deprecated, please explicitly specify a file path"); copyFileToContainer((Transferable) mountableFile, containerPath + sourceFile.getName()); } else { copyFileToContainer((Transferable) mountableFile, containerPath); } }
Source:
private Storage createStorage() { MutableStorage newStorage = new MutableStorage(testRepository.storageId()); configurationManagementService.addStorageIfNotExists(newStorage); ThrowingConsumer.unchecked(storageManagementService::saveStorage).accept(newStorage); return configurationManagementService.getConfiguration().getStorage(testRepository.storageId()); }

Target:
private Storage createStorage() throws IOException { StorageDto newStorage = new StorageDto(testRepository.storageId()); configurationManagementService.addStorageIfNotExists(newStorage); storageManagementService.saveStorage(newStorage); return configurationManagementService.getConfiguration().getStorage(testRepository.storageId()); }
Source:
private DatasourceInputSplit toDataSourceSplit( List<WindowedDataSegment> segments, org.apache.hadoop.mapred.InputFormat fio, JobConf conf ) { String[] locations = null; try { locations = getFrequentLocations(segments, fio, conf); } catch (Exception e) { logger.error(e, "Exception thrown finding location of splits"); throw Throwables.propagate(e); } return new DatasourceInputSplit(segments, locations); }

Target:
private DatasourceInputSplit toDataSourceSplit( List<WindowedDataSegment> segments, org.apache.hadoop.mapred.InputFormat fio, JobConf conf ) { String[] locations = null; try { locations = getFrequentLocations(segments, fio, conf); } catch (Exception e) { logger.error(e, "Exception thrown finding location of splits"); } return new DatasourceInputSplit(segments, locations); }
Source:
public void forget() throws org.omg.CORBA.SystemException { if (jtaxLogger.logger.isTraceEnabled()) { jtaxLogger.logger.trace("XAResourceRecord.forget for " + _tranID); } if (!handleForget()) throw new UNKNOWN(); destroyState(); removeConnection(); }

Target:
public void forget() throws org.omg.CORBA.SystemException { if (jtaxLogger.logger.isTraceEnabled()) { jtaxLogger.logger.trace("XAResourceRecord.forget for " + _tranID + " _forgotten=" + _forgotten); } if (!_forgotten) { handleForget(); destroyState(); removeConnection(); } }
Source:
public boolean depositAllExcept(final int... ids) { final boolean[] ret = { true }; final int count = ctx.inventory.select().count(); ctx.inventory.select(new Filter<Item>() { @Override public boolean accept(Item item) { for (int id : ids) { if (item.id() == id) { return false; } } return true; } }); if (count != ctx.inventory.count()) { ctx.inventory.shuffle().each(new Filter<Item>() { @Override public boolean accept(Item item) { if (!deposit(item.id(), Amount.ALL)) { ret[0] = false; } return true; } }); } else { return depositInventory(); } return ret[0]; }

Target:
public boolean depositAllExcept(final int... ids) { final boolean[] ret = {true}; final int count = ctx.inventory.select().count(); ctx.inventory.select(new Filter<Item>() { @Override public boolean accept(final Item item) { for (final int id : ids) { if (item.id() == id) { return false; } } return true; } }); if (count != ctx.inventory.count()) { ctx.inventory.shuffle().each(new Filter<Item>() { @Override public boolean accept(final Item item) { if (!deposit(item.id(), Amount.ALL)) { ret[0] = false; } return true; } }); } else { return depositInventory(); } return ret[0]; }
Source:
void cmnClearRegion(RegionEventImpl regionEvent, boolean cacheWrite, boolean useRVV) { synchronized (clearLock) { clearPartitionedRegion.doClear(regionEvent, cacheWrite, this); } }

Target:
void cmnClearRegion(RegionEventImpl regionEvent, boolean cacheWrite, boolean useRVV) { synchronized (clearLock) { partitionedRegionClear.doClear(regionEvent, cacheWrite, this); } }
Source:
public List<T> getSelectedItems() { if (getDataProvider().getModel().isSingleSelectionOnly()) { return (List<T>) Collections.singletonList(((SingleSelectionModel<T>)getDataProvider().getModel().getSelectionModel()).getSelectedObject()); } else { return ((OrderedMultiSelectionModel<T>)getDataProvider().getModel().getSelectionModel()).getSelectedList(); } }

Target:
public List<T> getSelectedItems() { return getDataProvider().getModel().getSelectedObjects(); }
Source:
public NatsProcessor(InboundProcessorParams params) { this.name = params.getName(); this.natsProperties = params.getProperties(); String inboundEndpointInterval = natsProperties.getProperty(PollingConstants.INBOUND_ENDPOINT_INTERVAL); if (inboundEndpointInterval != null) { try { this.interval = Long.parseLong(inboundEndpointInterval); } catch (NumberFormatException nfe) { throw new SynapseException("Invalid numeric value for interval.", nfe); } } this.sequential = true; String inboundEndpointSequential = natsProperties.getProperty(PollingConstants.INBOUND_ENDPOINT_SEQUENTIAL); if (inboundEndpointSequential != null) { this.sequential = Boolean.parseBoolean(inboundEndpointSequential); } this.coordination = true; String inboundCoordination = natsProperties.getProperty(PollingConstants.INBOUND_COORDINATION); if (inboundCoordination != null) { this.coordination = Boolean.parseBoolean(inboundCoordination); } this.injectingSeq = params.getInjectingSeq(); this.onErrorSeq = params.getOnErrorSeq(); this.synapseEnvironment = params.getSynapseEnvironment(); }

Target:
public NatsProcessor(InboundProcessorParams params) { this.name = params.getName(); this.natsProperties = params.getProperties(); String inboundEndpointInterval = natsProperties.getProperty(PollingConstants.INBOUND_ENDPOINT_INTERVAL); if (inboundEndpointInterval != null) { try { this.interval = Long.parseLong(inboundEndpointInterval); } catch (NumberFormatException nfe) { throw new SynapseException("Invalid numeric value for interval: " + inboundEndpointInterval, nfe); } } this.sequential = true; String inboundEndpointSequential = natsProperties.getProperty(PollingConstants.INBOUND_ENDPOINT_SEQUENTIAL); if (inboundEndpointSequential != null) { this.sequential = Boolean.parseBoolean(inboundEndpointSequential); } this.coordination = true; String inboundCoordination = natsProperties.getProperty(PollingConstants.INBOUND_COORDINATION); if (inboundCoordination != null) { this.coordination = Boolean.parseBoolean(inboundCoordination); } this.injectingSeq = params.getInjectingSeq(); this.onErrorSeq = params.getOnErrorSeq(); this.synapseEnvironment = params.getSynapseEnvironment(); }
Source:
public void writeToParcel(Parcel dest, int flags) { dest.writeMap(menus); dest.writeTypedList(reservationList); dest.writeParcelable(info, flags); dest.writeTypedList(orders); dest.writeTypedList(sessions); }

Target:
public void writeToParcel(Parcel dest, int flags) { dest.writeTypedList(menus); dest.writeTypedList(reservationList); dest.writeParcelable(info, flags); dest.writeTypedList(orders); dest.writeTypedList(sessions); dest.writeTypedList(customerRequests); dest.writeString(this.getObjId()); }
Source:
public PlanWithProperties visitMarkDistinct(MarkDistinctNode node, PreferredProperties preferredProperties) { PreferredProperties preferredChildProperties = PreferredProperties.partitionedWithLocal(ImmutableSet.copyOf(node.getDistinctSymbols()), grouped(node.getDistinctSymbols())) .mergeWithParent(preferredProperties); PlanWithProperties child = node.getSource().accept(this, preferredChildProperties); if (child.getProperties().isSingleNode() || !child.getProperties().isStreamPartitionedOn(node.getDistinctSymbols())) { child = withDerivedProperties(createPartitionedRemoteExchange(child.getNode(), node.getDistinctSymbols(), node.getHashSymbol()), child.getProperties()); } return rebaseAndDeriveProperties(node, child); }

Target:
public PlanWithProperties visitMarkDistinct(MarkDistinctNode node, PreferredProperties preferredProperties) { PreferredProperties preferredChildProperties = PreferredProperties.partitionedWithLocal(ImmutableSet.copyOf(node.getDistinctSymbols()), grouped(node.getDistinctSymbols())) .mergeWithParent(preferredProperties); PlanWithProperties child = node.getSource().accept(this, preferredChildProperties); if (child.getProperties().isSingleNode() || !child.getProperties().isStreamPartitionedOn(node.getDistinctSymbols())) { child = withDerivedProperties( partitionedExchange( idAllocator.getNextId(), REMOTE, child.getNode(), createPartitioning(node.getDistinctSymbols()), node.getHashSymbol()), child.getProperties()); } return rebaseAndDeriveProperties(node, child); }
Source:
private void displayPlaylist() { switchToPanel(R.id.playlist); PlaylistHolder playlistHolder = playlists.get(playlistsBar.getSelectedPlaylistType()); if (playlistHolder == null) { displayEmptyPlaylistMessage(); return; } GetPlaylist.GetPlaylistResult getPlaylistResult = playlistHolder.getPlaylistResult; if ( getPlaylistResult == null ) { displayEmptyPlaylistMessage(); return; } if (getPlaylistResult.type.contentEquals(ListType.ItemBase.TYPE_PICTURE)) playlistListView.enableItemDragging(false); else playlistListView.enableItemDragging(true); if ( ! playlistListView.isItemBeingDragged() ) { playListAdapter.setPlaylistItems(getPlaylistResult.items); } if ( isPlaying(getPlaylistResult) ) highlightCurrentlyPlayingItem(); else playlistListView.clearChoices(); }

Target:
private void displayPlaylist() { switchToPanel(R.id.playlist); PlaylistHolder playlistHolder = playlists.get(playlistsBar.getSelectedPlaylistType()); if (playlistHolder == null) { displayEmptyPlaylistMessage(); return; } GetPlaylist.GetPlaylistResult getPlaylistResult = playlistHolder.getPlaylistResult; if (getPlaylistResult == null) { displayEmptyPlaylistMessage(); return; } if (getPlaylistResult.type.contentEquals(ListType.ItemBase.TYPE_PICTURE)) playlistListView.enableItemDragging(false); else playlistListView.enableItemDragging(true); if (!playlistListView.isItemBeingDragged()) { playListAdapter.setPlaylistItems(getPlaylistResult.items); } playlistListView.setSelectionFromTop(playlistHolder.index, playlistHolder.top); }
Source:
public static void legacyFill(FileChannel fc, long newLength, long offset, boolean starting) throws IOException { MersenneTwister mt = new MersenneTwister(); byte[] b = new byte[4096]; ByteBuffer bb = ByteBuffer.wrap(b); int x = 0; while (offset < newLength) { bb.rewind(); mt.nextBytes(b); offset += fc.write(bb, offset); if (offset % (1024 * 1024 * 1024L) == 0) { mt = new MersenneTwister(); if (starting) { WrapperManager.signalStarting( (int) MINUTES.toMillis(5)); if (x++ % 32 == 0) System.err.println( "Preallocating space : " + offset + "/" + newLength); } } } }

Target:
public static void legacyFill(FileChannel fc, long newLength, long offset, boolean starting) throws IOException { MersenneTwister mt = new MersenneTwister(); byte[] b = new byte[4096]; ByteBuffer bb = ByteBuffer.wrap(b); int x = 0; while (offset < newLength) { bb.rewind(); mt.nextBytes(b); offset += fc.write(bb, offset); if (offset % (1024 * 1024 * 1024L) == 0) { mt = new MersenneTwister(); if (starting) { WrapperManager.signalStarting( (int) MINUTES.toMillis(5)); if (x++ % 32 == 1) System.err.println( "Preallocating space : " + offset + "/" + newLength); } } } }
Source:
private HeaderCacheElement getHeader() throws ExecutionException, InterruptedException, TimeoutException { final Future<HeaderCacheElement> deferredResult; synchronized (lock) { CacheState state = headerCache.getCacheState(); if (isAppEngine && state == CacheState.Stale) { state = CacheState.Good; } if (state == CacheState.Good || state == CacheState.Exception) { return headerCache; } else if (state == CacheState.Stale) { asyncRefresh(); return headerCache; } else if (state == CacheState.Expired) { deferredResult = asyncRefresh(); } else { return new HeaderCacheElement( Status.UNAUTHENTICATED .withCause(new IllegalStateException("Could not process state: " + state)) ); } } return deferredResult.get(250, TimeUnit.MILLISECONDS); }

Target:
private HeaderCacheElement getHeader() throws ExecutionException, InterruptedException { final Future<HeaderCacheElement> deferredResult; synchronized (lock) { CacheState state = headerCache.getCacheState(); if (state == CacheState.Good || state == CacheState.Exception) { return headerCache; } else if (!isAppEngine && state == CacheState.Stale) { asyncRefresh(); return headerCache; } else if (state == CacheState.Expired) { deferredResult = asyncRefresh(); } else { return new HeaderCacheElement( Status.UNAUTHENTICATED .withCause(new IllegalStateException("Could not process state: " + state)) ); } } return deferredResult.get(); }