auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private ClientMessage createAuthenticationMessage(HazelcastInstance hz, String clientName) { return ClientAuthenticationCodec.encodeRequest(hz.getConfig().getClusterName(), null, null, UUID.randomUUID(), "FOO", (byte) 1, clientName, "xxx", new ArrayList<>(), -1, null); }

Target:
private ClientMessage createAuthenticationMessage(HazelcastInstance hz, String clientName) { return ClientAuthenticationCodec.encodeRequest(hz.getConfig().getClusterName(), null, null, UUID.randomUUID(), "FOO", (byte) 1, clientName, "xxx", emptyList(), -1, null); }
Source:
public AmazonS3Client getS3Client() { if (s3Client == null) { clientConfig = new ClientConfiguration(); clientConfig.setMaxErrorRetry(3); s3Client = new AmazonS3Client(new AnonymousAWSCredentials()); } return s3Client; }

Target:
public AmazonS3Client getS3Client() { if (s3Client == null) { clientConfig = new ClientConfiguration(); clientConfig.setMaxErrorRetry(3); s3Client = new AmazonS3Client(new DefaultAWSCredentialsProviderChain()); } return s3Client; }
Source:
public int compare(SingleBenchmarkResult a, SingleBenchmarkResult b) { return new CompareToBuilder() .append(b.isFailure(), a.isFailure()) .append(b.getAverageUninitializedVariableCount(), a.getAverageUninitializedVariableCount()) .append(a.getAverageScore(), b.getAverageScore(), resilientScoreComparator) .toComparison(); }

Target:
public int compare(SingleBenchmarkResult a, SingleBenchmarkResult b) { return new CompareToBuilder() .append(b.hasAnyFailure(), a.hasAnyFailure()) .append(b.getAverageUninitializedVariableCount(), a.getAverageUninitializedVariableCount()) .append(a.getAverageScore(), b.getAverageScore(), resilientScoreComparator) .toComparison(); }
Source:
public String getSampleType() { return sampleType; }

Target:
public String getSampleType() { return this.sampleType; }
Source:
public void setDbxState(DbxState dbxState) { editorState.setStateDbxState(dbxState); }

Target:
public void setDbxState(DbxState dbxState) { this.dbxState = dbxState; }
Source:
public static Properties defaultProperties() { final Properties properties = AzureManagementApiMetadata.defaultProperties(); properties.setProperty(OPERATION_TIMEOUT, "60000"); properties.setProperty(OPERATION_POLL_INITIAL_PERIOD, "5"); properties.setProperty(OPERATION_POLL_MAX_PERIOD, "15"); properties.setProperty(TCP_RULE_FORMAT, "tcp_%s-%s"); properties.setProperty(TCP_RULE_REGEXP, "tcp_\\d{1,5}-\\d{1,5}"); properties.put("oauth.endpoint", "<LINK_0>"); properties.put(JWS_ALG, "RS256"); properties.put(AUDIENCE, "<LINK_0>"); properties.put(RESOURCE, "<LINK_1>"); properties.put(CREDENTIAL_TYPE, CLIENT_CREDENTIALS_SECRET.toString()); return properties; }

Target:
public static Properties defaultProperties() { final Properties properties = AzureManagementApiMetadata.defaultProperties(); properties.setProperty(OPERATION_TIMEOUT, "60000"); properties.setProperty(OPERATION_POLL_INITIAL_PERIOD, "5"); properties.setProperty(OPERATION_POLL_MAX_PERIOD, "15"); properties.setProperty(TCP_RULE_FORMAT, "tcp_%s-%s"); properties.setProperty(TCP_RULE_REGEXP, "tcp_\\d{1,5}-\\d{1,5}"); properties.put("oauth.endpoint", "<LINK_0>"); properties.put(RESOURCE, "<LINK_1>"); properties.put(CREDENTIAL_TYPE, CLIENT_CREDENTIALS_SECRET.toString()); return properties; }
Source:
public GitHubSCMBuilder(@NonNull GitHubSCMSource source, @NonNull SCMHead head, @CheckForNull SCMRevision revision) { super(head, revision, guessRemote(source), source.getCredentialsId()); this.context = source.getOwner(); apiUri = StringUtils.defaultIfBlank(source.getApiUri(), GitHubServerConfig.GITHUB_URL); GitHubSCMSourceHelper helper = GitHubSCMSourceHelper.build(source); repoOwner = StringUtils.defaultIfBlank(source.getRepoOwner(), helper.owner); repository = StringUtils.defaultIfBlank(source.getRepository(), helper.repoName); repositoryUrl = source.getRepositoryUrl()!=null?source.getRepositoryUrl() : helper.url; withoutRefSpecs(); String repoUrl; if (head instanceof PullRequestSCMHead) { PullRequestSCMHead h = (PullRequestSCMHead) head; withRefSpec("+refs/pull/" + h.getId() + "/head:refs/remotes/@{remote}/" + head .getName()); repoUrl = repositoryUrl(h.getSourceOwner(), h.getSourceRepo()); } else if (head instanceof TagSCMHead) { withRefSpec("+refs/tags/" + head.getName() + ":refs/tags/" + head.getName()); repoUrl = repositoryUrl(repoOwner, repository); } else { withRefSpec("+refs/heads/" + head.getName() + ":refs/remotes/@{remote}/" + head.getName()); repoUrl = repositoryUrl(repoOwner, repository); } if (repoUrl != null) { withBrowser(new GithubWeb(repoUrl)); } withCredentials(credentialsId(), null); }

Target:
public GitHubSCMBuilder(@NonNull GitHubSCMSource source, @NonNull SCMHead head, @CheckForNull SCMRevision revision) { super(head, revision, guessRemote(source), source.getCredentialsId()); this.context = source.getOwner(); apiUri = StringUtils.defaultIfBlank(source.getApiUri(), GitHubServerConfig.GITHUB_URL); repoOwner = source.getRepoOwner(); repository = source.getRepository(); repositoryUrl = source.getRepositoryUrl(); withoutRefSpecs(); String repoUrl; if (head instanceof PullRequestSCMHead) { PullRequestSCMHead h = (PullRequestSCMHead) head; withRefSpec("+refs/pull/" + h.getId() + "/head:refs/remotes/@{remote}/" + head .getName()); repoUrl = repositoryUrl(h.getSourceOwner(), h.getSourceRepo()); } else if (head instanceof TagSCMHead) { withRefSpec("+refs/tags/" + head.getName() + ":refs/tags/" + head.getName()); repoUrl = repositoryUrl(repoOwner, repository); } else { withRefSpec("+refs/heads/" + head.getName() + ":refs/remotes/@{remote}/" + head.getName()); repoUrl = repositoryUrl(repoOwner, repository); } if (repoUrl != null) { withBrowser(new GithubWeb(repoUrl)); } withCredentials(credentialsId(), null); }
Source:
public static ColumnResolver getResolverForCompiledDerivedTable(PhoenixConnection connection, TableRef tableRef, RowProjector projector) throws SQLException { List<PColumn> projectedColumns = new ArrayList<PColumn>(); List<Expression> sourceExpressions = new ArrayList<Expression>(); PTable table = tableRef.getTable(); for (PColumn column : table.getColumns()) { Expression sourceExpression = projector.getColumnProjector(column.getPosition()).getExpression(); PColumnImpl projectedColumn = new PColumnImpl(column.getName(), column.getFamilyName(), sourceExpression.getDataType(), sourceExpression.getMaxLength(), sourceExpression.getScale(), sourceExpression.isNullable(), column.getPosition(), sourceExpression.getSortOrder(), column.getArraySize(), column.getViewConstant(), column.isViewReferenced(), null); projectedColumns.add(projectedColumn); sourceExpressions.add(sourceExpression); } PTable t = PTableImpl.makePTable(table, projectedColumns); return new SingleTableColumnResolver(connection, new TableRef(tableRef.getTableAlias(), t, tableRef.getLowerBoundTimeStamp(), tableRef.hasDynamicCols())); }

Target:
public static ColumnResolver getResolverForCompiledDerivedTable(PhoenixConnection connection, TableRef tableRef, RowProjector projector) throws SQLException { List<PColumn> projectedColumns = new ArrayList<PColumn>(); List<Expression> sourceExpressions = new ArrayList<Expression>(); PTable table = tableRef.getTable(); for (PColumn column : table.getColumns()) { Expression sourceExpression = projector.getColumnProjector(column.getPosition()).getExpression(); PColumnImpl projectedColumn = new PColumnImpl(column.getName(), column.getFamilyName(), sourceExpression.getDataType(), sourceExpression.getMaxLength(), sourceExpression.getScale(), sourceExpression.isNullable(), column.getPosition(), sourceExpression.getSortOrder(), column.getArraySize(), column.getViewConstant(), column.isViewReferenced(), column.getExpressionStr()); projectedColumns.add(projectedColumn); sourceExpressions.add(sourceExpression); } PTable t = PTableImpl.makePTable(table, projectedColumns); return new SingleTableColumnResolver(connection, new TableRef(tableRef.getTableAlias(), t, tableRef.getLowerBoundTimeStamp(), tableRef.hasDynamicCols())); }
Source:
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) throws InterruptedException { checkQueue(); return super.invokeAll(tasks); }

Target:
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) throws InterruptedException { checkQueue(tasks.size()); return super.invokeAll(tasks); }
Source:
private String locateTool(String tool) { String[] roots = { "/usr/bin/", "/usr/local/bin/", "/Users/christian/.nvm/versions/node/v6.6.0/bin/" }; for (String root : roots) { if (new File(root + tool).exists()) { return root + tool; } } return null; }

Target:
private String locateTool(String tool) { String[] roots = { "/usr/bin/", "/usr/local/bin/" }; for (String root : roots) { if (new File(root + tool).exists()) { return root + tool; } } return null; }
Source:
List<JournalEntry> getAllEntries() { List<JournalEntry> result = new ArrayList<>(); Offset lastOffset = getLastOffset(); if (lastOffset != null) { NavigableMap<Offset, StoreKey> journalView = journal.headMap(lastOffset, true); for (Map.Entry<Offset, StoreKey> entry : journalView.entrySet()) { result.add(new JournalEntry(entry.getKey(), entry.getValue())); } } return result; }

Target:
List<JournalEntry> getAllEntries() { List<JournalEntry> result = new ArrayList<>(); Offset lastOffset = getLastOffset(); journal.entrySet(); if (lastOffset != null) { NavigableMap<Offset, StoreKey> journalView = journal.headMap(lastOffset, true); for (Map.Entry<Offset, StoreKey> entry : journalView.entrySet()) { result.add(new JournalEntry(entry.getKey(), entry.getValue())); } } return result; }
Source:
private void checkStatusCode(HttpURLConnection connection) throws Exception{ try { int responseCode = connection.getResponseCode(); if (responseCode != HttpURLConnection.HTTP_OK) { switch (responseCode) { case 401: case 403: throw new RCException(RCClient.ErrorCodes.ERROR_DEVICE_PUSH_NOTIFICATION_AUTHENTICATION_FORBIDDEN); case 404: throw new RCException(RCClient.ErrorCodes.ERROR_DEVICE_PUSH_NOTIFICATION_HTTP_NOT_FOUND); case 408: throw new RCException(RCClient.ErrorCodes.ERROR_DEVICE_PUSH_NOTIFICATION_TIMED_OUT); default: throw new RCException(RCClient.ErrorCodes.ERROR_DEVICE_PUSH_NOTIFICATION_UNKNOWN_ERROR); } } } catch (Exception e) { throw e; } }

Target:
private void checkStatusCode(HttpURLConnection connection) throws Exception{ int responseCode = connection.getResponseCode(); if (responseCode != HttpURLConnection.HTTP_OK) { switch (responseCode) { case 401: case 403: throw new RCException(RCClient.ErrorCodes.ERROR_DEVICE_PUSH_NOTIFICATION_AUTHENTICATION_FORBIDDEN); case 404: throw new RCException(RCClient.ErrorCodes.ERROR_DEVICE_PUSH_NOTIFICATION_HTTP_NOT_FOUND); case 408: throw new RCException(RCClient.ErrorCodes.ERROR_DEVICE_PUSH_NOTIFICATION_TIMED_OUT); default: throw new RCException(RCClient.ErrorCodes.ERROR_DEVICE_PUSH_NOTIFICATION_UNKNOWN_ERROR); } } }
Source:
public Authenticated authenticate(AuthenticationScheme authenticationScheme, Credentials credentials) throws ContextAuthenticationException { if (log.isDebugEnabled()) { log.debug("Authenticating with sheme: " + credentials.getAuthenticationScheme()); } Authenticated authenticated = null; try { authenticated = authenticationScheme.authenticate(credentials); this.user = authenticated.getUser(); notifyUserSessionListener(this.user, Event.LOGIN, Status.SUCCESS); } catch(ContextAuthenticationException e) { User loggingInUser = new User(); loggingInUser.setUsername(credentials.getClientName()); notifyUserSessionListener(loggingInUser, Event.LOGIN, Status.FAIL); throw e; } setUserLocation(); if (log.isDebugEnabled()) { log.debug("Authenticated as: " + this.user); } return authenticated; }

Target:
public Authenticated authenticate(AuthenticationScheme authenticationScheme, Credentials credentials) throws ContextAuthenticationException { if (log.isDebugEnabled()) { log.debug("Authenticating client '" + credentials.getClientName() + "' with sheme: " + credentials.getAuthenticationScheme()); } Authenticated authenticated = null; try { authenticated = authenticationScheme.authenticate(credentials); this.user = authenticated.getUser(); notifyUserSessionListener(this.user, Event.LOGIN, Status.SUCCESS); } catch(ContextAuthenticationException e) { User loggingInUser = new User(); loggingInUser.setUsername(credentials.getClientName()); notifyUserSessionListener(loggingInUser, Event.LOGIN, Status.FAIL); throw e; } setUserLocation(); if (log.isDebugEnabled()) { log.debug("Authenticated as: " + this.user); } return authenticated; }
Source:
public void clickOnAdImage(String slotName){ wait.forElementVisible(By.cssSelector(AdsContent.getSlotSelector(slotName))); driver.findElement(By.cssSelector(AdsContent.getSlotSelector(slotName))).click(); PageObjectLogging.log("clickOnAdImage", slotName + " is clicked", true); }

Target:
public void clickOnAdImage(String slotName){ adSelector(slotName); adSelector(slotName).click(); PageObjectLogging.log("clickOnAdImage", slotName + " is clicked", true); }
Source:
private JsonNode asJson(Object target) throws AccessException { if (target instanceof ContainerNode) { return (ContainerNode<?>) target; } else if (target instanceof JsonNodeWrapper && ((JsonNodeWrapper) target).getTarget() instanceof JsonNode) { JsonNodeWrapper wrapper = (JsonNodeWrapper) target; return assertContainerNode((JsonNode) wrapper.getTarget()); } else if (target instanceof String) { try { JsonNode json = this.objectMapper.readTree((String) target); return assertContainerNode(json); } catch (JsonProcessingException e) { throw new AccessException("Exception while trying to deserialize String", e); } } else { throw new IllegalStateException("Can't happen. Check SUPPORTED_CLASSES"); } }

Target:
private JsonNode asJson(Object target) throws AccessException { if (target instanceof ContainerNode) { return (ContainerNode<?>) target; } else if (target instanceof JsonNodeWrapper && ((JsonNodeWrapper<?>) target).getRealNode() instanceof JsonNode) { return ((JsonNodeWrapper<?>) target).getRealNode(); } else if (target instanceof String) { try { return this.objectMapper.readTree((String) target); } catch (JsonProcessingException e) { throw new AccessException("Exception while trying to deserialize String", e); } } else { throw new IllegalStateException("Can't happen. Check SUPPORTED_CLASSES"); } }
Source:
private IFrameDMContext createFrameContext(IExecutionDMContext execCtx, String frameNum) { assert execCtx != null && frameNum != null; if (execCtx == null || frameNum == null) {return null;} int intFrameNum = 0; try { intFrameNum = Integer.parseInt(frameNum); } catch (NumberFormatException e){ GdbPlugin.log(e); } return ((MIStack)(stackService)).createFrameDMContext(execCtx, intFrameNum); }

Target:
private IFrameDMContext createFrameContext(IExecutionDMContext execCtx, String frameNum) { assert execCtx != null && frameNum != null; if (execCtx == null || frameNum == null) { return null; } int intFrameNum = 0; try { intFrameNum = Integer.parseInt(frameNum); } catch (NumberFormatException e){ GdbPlugin.log(e); } return fStackService.createFrameDMContext(execCtx, intFrameNum); }
Source:
private Set<GlusterVolumeEntity> getExistingSessionSlaveVolumes() { Set<GlusterVolumeEntity> volumesAlreadySlaveOfGeoRepSessions = new HashSet<GlusterVolumeEntity>(); for(GlusterGeoRepSession session : getDbFacade().getGlusterGeoRepDao().getAllSessions()) { String slaveVolumeName = session.getSlaveVolumeName(); String slaveHostName = session.getSlaveHostName(); GlusterVolumeEntity slaveVolume = getGlusterVolumeDao().getByName(getVdsDao().getByName(slaveHostName).getVdsGroupId(), slaveVolumeName); volumesAlreadySlaveOfGeoRepSessions.add(slaveVolume); } return volumesAlreadySlaveOfGeoRepSessions; }

Target:
private Set<GlusterVolumeEntity> getExistingSessionSlaveVolumes() { Set<GlusterVolumeEntity> volumesAlreadySlaveOfGeoRepSessions = new HashSet<GlusterVolumeEntity>(); for(GlusterGeoRepSession session : getDbFacade().getGlusterGeoRepDao().getAllSessions()) { Guid slaveVolumeId = session.getSlaveVolumeId(); if(slaveVolumeId != null) { GlusterVolumeEntity slaveVolume = getGlusterVolumeDao().getById(slaveVolumeId); volumesAlreadySlaveOfGeoRepSessions.add(slaveVolume); } } return volumesAlreadySlaveOfGeoRepSessions; }
Source:
public void basicCancel(final String consumerTag) throws IOException { final Consumer originalConsumer = _consumers.get(consumerTag); if (originalConsumer == null) throw new IOException("Unknown consumerTag"); BlockingRpcContinuation<Consumer> k = new BlockingRpcContinuation<Consumer>() { @Override public Consumer transformReply(AMQCommand replyCommand) { ((Basic.CancelOk) replyCommand.getMethod()).getConsumerTag(); _consumers.remove(consumerTag); dispatcher.handleCancelOk(originalConsumer, consumerTag); return originalConsumer; } }; final Method m = new Basic.Cancel(consumerTag, false); rpc(m, k); try { if(_rpcTimeout == NO_RPC_TIMEOUT) { k.getReply(); } else { try { k.getReply(_rpcTimeout); } catch (TimeoutException e) { throw wrapTimeoutException(m, e); } } } catch(ShutdownSignalException ex) { throw wrap(ex); } metricsCollector.basicCancel(this, consumerTag); }

Target:
public void basicCancel(final String consumerTag) throws IOException { final Consumer originalConsumer = _consumers.get(consumerTag); if (originalConsumer == null) throw new IOException("Unknown consumerTag"); BlockingRpcContinuation<Consumer> k = new BlockingRpcContinuation<Consumer>() { @Override public Consumer transformReply(AMQCommand replyCommand) { if (!(replyCommand.getMethod() instanceof Basic.CancelOk)) LOGGER.warn("Received reply was not of expected method Basic.CancelOk", replyCommand.getMethod()); _consumers.remove(consumerTag); dispatcher.handleCancelOk(originalConsumer, consumerTag); return originalConsumer; } }; final Method m = new Basic.Cancel(consumerTag, false); rpc(m, k); try { if(_rpcTimeout == NO_RPC_TIMEOUT) { k.getReply(); } else { try { k.getReply(_rpcTimeout); } catch (TimeoutException e) { throw wrapTimeoutException(m, e); } } } catch(ShutdownSignalException ex) { throw wrap(ex); } metricsCollector.basicCancel(this, consumerTag); }
Source:
public ModifiableRealmIdentity getRealmIdentityForUpdate(Principal principal) throws RealmUnavailableException { removeFromCache(principal); return getModifiableSecurityRealm().getRealmIdentityForUpdate(principal); }

Target:
public ModifiableRealmIdentity getRealmIdentityForUpdate(Principal principal) throws RealmUnavailableException { return wrap(getModifiableSecurityRealm().getRealmIdentityForUpdate(principal)); }
Source:
private void fetchRemoteData() { WordPress.getRestClientUtils().getGeneralSettings( String.valueOf(mBlog.getRemoteBlogId()), new RestRequest.Listener() { @Override public void onResponse(JSONObject response) { handleResponseToGeneralSettingsRequest(response); } }, new RestRequest.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { AppLog.w(AppLog.T.API, "Error GETing site settings: " + error); if (isAdded()) { ToastUtils.showToast(getActivity(), getString(R.string.error_fetch_remote_site_settings)); getActivity().finish(); } } }); }

Target:
private void fetchRemoteData() { if (mBlog.isDotcomFlag()) { WordPress.getRestClientUtils().getGeneralSettings( String.valueOf(mBlog.getRemoteBlogId()), new RestRequest.Listener() { @Override public void onResponse(JSONObject response) { if (isAdded()) { handleResponseToWPComSettingsRequest(response); } } }, new RestRequest.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { handleSettingsFetchError(error.toString()); } }); } else { Object[] params = { mBlog.getRemoteBlogId(), mBlog.getUsername(), mBlog.getPassword() }; instantiateInterface().callAsync(mXmlRpcFetchCallback, ApiHelper.Methods.GET_OPTIONS, params); } }
Source:
public Optional<Group> getGroupById(long id) { GroupsRecord r = dslContext.fetchOne(GROUPS, GROUPS.ID.eq(Math.toIntExact(id))); if (r != null) { return Optional.of(r.map(new GroupMapper())); } return Optional.empty(); }

Target:
public Optional<Group> getGroupById(long id) { GroupsRecord r = dslContext.fetchOne(GROUPS, GROUPS.ID.eq(Math.toIntExact(id))); return Optional.ofNullable(r).map( (rec) -> rec.map(new GroupMapper())); }
Source:
public void create(final Scenario scenario) { try { verifyPreCondition(scenario); resetMail(); RpslObject objectForScenario = objectForScenario(scenario); logEvent("Creating", objectForScenario); WhoisResources whoisResourcesResp = RestTest.target(context.getRestPort(), "whois/test/mntner?password=123") .request() .post(Entity.entity(context.getWhoisObjectMapper().mapRpslObjects(FormattedClientAttributeMapper.class, objectForScenario), MediaType.APPLICATION_XML), WhoisResources.class); logEvent("Created", whoisResourcesResp); RpslObject resp = context.getWhoisObjectMapper().map(whoisResourcesResp.getWhoisObjects().get(0), FormattedClientAttributeMapper.class); verifyPostCondition(scenario, resp, Scenario.Result.SUCCESS); verifyNotificationEmail(scenario); } catch (ClientErrorException exc) { logEvent("Create", exc.getResponse().readEntity(WhoisResources.class)); verifyPostCondition(scenario, Scenario.Result.FAILURE); verifyNotificationEmail(scenario); } }

Target:
public void create(final Scenario scenario) { try { verifyPreCondition(scenario); resetMail(); RpslObject objectForScenario = objectForScenario(scenario); logEvent("Creating", objectForScenario); WhoisResources whoisResources = RestTest.target(context.getRestPort(), "whois/test/mntner?password=123") .request() .post(Entity.entity(context.getWhoisObjectMapper().mapRpslObjects(FormattedClientAttributeMapper.class, objectForScenario), MediaType.APPLICATION_XML), WhoisResources.class); logEvent("Created", whoisResources); verifyPostCondition(scenario, Scenario.Result.SUCCESS, whoisResources); verifyNotificationEmail(scenario); } catch (ClientErrorException exc) { logEvent("Create", exc.getResponse().readEntity(WhoisResources.class)); verifyPostCondition(scenario, Scenario.Result.FAILURE); verifyNotificationEmail(scenario); } }
Source:
public void testStartpointTimestampVisitorShouldUpdateTheFetchOffsetInConsumer() { final Long testTimeStamp = 10L; final KafkaConsumer consumer = Mockito.mock(KafkaConsumer.class); final KafkaConsumerProxy kafkaConsumerProxy = Mockito.mock(KafkaConsumerProxy.class); KafkaSystemConsumer kafkaSystemConsumer = new KafkaSystemConsumer(consumer, TEST_SYSTEM, new MapConfig(), TEST_CLIENT_ID, kafkaConsumerProxy, Mockito.mock(KafkaSystemConsumerMetrics.class), new TestClock(), REGISTRATION_HANDLER); KafkaStartpointRegistrationHandler kafkaStartpointRegistrationHandler = kafkaSystemConsumer.new KafkaStartpointRegistrationHandler(); final StartpointTimestamp startpointTimestamp = new StartpointTimestamp(testTimeStamp); final Map<TopicPartition, OffsetAndTimestamp> offsetForTimesResult = ImmutableMap.of( TEST_TOPIC_PARTITION, new OffsetAndTimestamp(Long.valueOf(TEST_OFFSET), testTimeStamp)); Mockito.when(consumer.offsetsForTimes(Mockito.anyMap())).thenReturn(offsetForTimesResult); Mockito.doNothing().when(consumer).seek(TEST_TOPIC_PARTITION, Long.valueOf(TEST_OFFSET)); kafkaStartpointRegistrationHandler.visit(TEST_SYSTEM_STREAM_PARTITION, startpointTimestamp); Mockito.verify(consumer).seek(TEST_TOPIC_PARTITION, Long.valueOf(TEST_OFFSET)); Mockito.verify(consumer).offsetsForTimes(Mockito.anyMap()); Mockito.verify(kafkaConsumerProxy).addTopicPartition(Mockito.any(SystemStreamPartition.class), Mockito.anyLong()); }

Target:
public void testStartpointTimestampVisitorShouldUpdateTheFetchOffsetInConsumer() { final Long testTimeStamp = 10L; final KafkaConsumer consumer = Mockito.mock(KafkaConsumer.class); final KafkaConsumerProxy kafkaConsumerProxy = Mockito.mock(KafkaConsumerProxy.class); final KafkaStartpointRegistrationHandler kafkaStartpointRegistrationHandler = new KafkaStartpointRegistrationHandler(consumer, kafkaConsumerProxy); final StartpointTimestamp startpointTimestamp = new StartpointTimestamp(testTimeStamp); final Map<TopicPartition, OffsetAndTimestamp> offsetForTimesResult = ImmutableMap.of( TEST_TOPIC_PARTITION, new OffsetAndTimestamp(Long.valueOf(TEST_OFFSET), testTimeStamp)); Mockito.when(consumer.offsetsForTimes(ImmutableMap.of(TEST_TOPIC_PARTITION, testTimeStamp))).thenReturn(offsetForTimesResult); Mockito.doNothing().when(consumer).seek(TEST_TOPIC_PARTITION, Long.valueOf(TEST_OFFSET)); Mockito.when(consumer.position(TEST_TOPIC_PARTITION)).thenReturn(Long.valueOf(TEST_OFFSET)); kafkaStartpointRegistrationHandler.visit(TEST_SYSTEM_STREAM_PARTITION, startpointTimestamp); Mockito.verify(consumer).seek(TEST_TOPIC_PARTITION, Long.valueOf(TEST_OFFSET)); Mockito.verify(consumer).offsetsForTimes(ImmutableMap.of(TEST_TOPIC_PARTITION, testTimeStamp)); Mockito.verify(kafkaConsumerProxy).addTopicPartition(TEST_SYSTEM_STREAM_PARTITION, Long.valueOf(TEST_OFFSET)); }
Source:
public void testAfterSessionExpiration() throws Exception { TestingServer oldServer = server; Semaphore counter = new Semaphore(0); final CuratorFramework client = newClient(counter); try { client.start(); final CountDownLatch connectedLatch = new CountDownLatch(1); final CountDownLatch lostLatch = new CountDownLatch(1); final CountDownLatch reconnectedLatch = new CountDownLatch(1); ConnectionStateListener listener = new ConnectionStateListener() { @Override public void stateChanged(CuratorFramework client, ConnectionState newState) { if ( newState == ConnectionState.CONNECTED ) { connectedLatch.countDown(); } if ( newState == ConnectionState.LOST ) { lostLatch.countDown(); } if ( newState == ConnectionState.RECONNECTED ) { reconnectedLatch.countDown(); } } }; client.getConnectionStateListenable().addListener(listener); Assert.assertTrue(timing.awaitLatch(connectedLatch)); server.stop(); Assert.assertTrue(timing.awaitLatch(lostLatch)); counter.drainPermits(); for ( int i = 0; i < 5; ++i ) { Assert.assertTrue(timing.acquireSemaphore(counter), "Failed when i is: " + i); } server = new TestingServer(); Assert.assertTrue(timing.awaitLatch(reconnectedLatch)); } finally { CloseableUtils.closeQuietly(client); CloseableUtils.closeQuietly(oldServer); } }

Target:
public void testAfterSessionExpiration() throws Exception { TestingServer oldServer = server; Semaphore counter = new Semaphore(0); final CuratorFramework client = newClient(counter); try { final CountDownLatch connectedLatch = new CountDownLatch(1); final CountDownLatch lostLatch = new CountDownLatch(1); final CountDownLatch reconnectedLatch = new CountDownLatch(1); ConnectionStateListener listener = new ConnectionStateListener() { @Override public void stateChanged(CuratorFramework client, ConnectionState newState) { if ( newState == ConnectionState.CONNECTED ) { connectedLatch.countDown(); } if ( newState == ConnectionState.LOST ) { lostLatch.countDown(); } if ( newState == ConnectionState.RECONNECTED ) { reconnectedLatch.countDown(); } } }; client.getConnectionStateListenable().addListener(listener); client.start(); Assert.assertTrue(timing.awaitLatch(connectedLatch)); server.stop(); Assert.assertTrue(timing.awaitLatch(lostLatch)); counter.drainPermits(); for ( int i = 0; i < 5; ++i ) { Assert.assertTrue(timing.acquireSemaphore(counter), "Failed when i is: " + i); } server = new TestingServer(); Assert.assertTrue(timing.awaitLatch(reconnectedLatch)); } finally { CloseableUtils.closeQuietly(client); CloseableUtils.closeQuietly(oldServer); } }
Source:
public QProfileComparisonResult compare(DbSession dbSession, QualityProfileDto left, QualityProfileDto right) { QProfileComparisonResult result = new QProfileComparisonResult(); result.left = left; result.right = right; Map<RuleKey, ActiveRuleDto> leftActiveRulesByRuleKey = loadActiveRules(dbSession, left); Map<RuleKey, ActiveRuleDto> rightActiveRulesByRuleKey = loadActiveRules(dbSession, right); Set<RuleKey> allRules = Sets.newHashSet(); allRules.addAll(leftActiveRulesByRuleKey.keySet()); allRules.addAll(rightActiveRulesByRuleKey.keySet()); for (RuleKey ruleKey : allRules) { if (!leftActiveRulesByRuleKey.containsKey(ruleKey)) { result.inRight.put(ruleKey, rightActiveRulesByRuleKey.get(ruleKey)); } else if (!rightActiveRulesByRuleKey.containsKey(ruleKey)) { result.inLeft.put(ruleKey, leftActiveRulesByRuleKey.get(ruleKey)); } else { compareActivationParams(dbSession, leftActiveRulesByRuleKey.get(ruleKey), rightActiveRulesByRuleKey.get(ruleKey), result); } } return result; }

Target:
public QProfileComparisonResult compare(DbSession dbSession, QualityProfileDto left, QualityProfileDto right) { Map<RuleKey, ActiveRuleDto> leftActiveRulesByRuleKey = loadActiveRules(dbSession, left); Map<RuleKey, ActiveRuleDto> rightActiveRulesByRuleKey = loadActiveRules(dbSession, right); Set<RuleKey> allRules = Sets.newHashSet(); allRules.addAll(leftActiveRulesByRuleKey.keySet()); allRules.addAll(rightActiveRulesByRuleKey.keySet()); QProfileComparisonResult result = new QProfileComparisonResult(left, right); for (RuleKey ruleKey : allRules) { if (!leftActiveRulesByRuleKey.containsKey(ruleKey)) { result.inRight.put(ruleKey, rightActiveRulesByRuleKey.get(ruleKey)); } else if (!rightActiveRulesByRuleKey.containsKey(ruleKey)) { result.inLeft.put(ruleKey, leftActiveRulesByRuleKey.get(ruleKey)); } else { compareActivationParams(dbSession, leftActiveRulesByRuleKey.get(ruleKey), rightActiveRulesByRuleKey.get(ruleKey), result); } } return result; }
Source:
public String toString() { StringBuilder buf = new StringBuilder(); if (approximate && distinct) { buf.append("APPROX_COUNT_DISTINCT"); } else { buf.append(aggFunction.toString()); } buf.append("("); if (distinct && !approximate) { buf.append((argList.size() == 0) ? "DISTINCT" : "DISTINCT "); } int i = -1; for (Integer arg : argList) { if (++i > 0) { buf.append(", "); } buf.append("$"); buf.append(arg); } buf.append(")"); if (!collation.equals(RelCollations.EMPTY)) { buf.append(" WITHIN GROUP ("); buf.append(collation); buf.append(")"); } if (hasFilter()) { buf.append(" FILTER $"); buf.append(filterArg); } return buf.toString(); }

Target:
public String toString() { StringBuilder buf = new StringBuilder(aggFunction.toString()); buf.append("("); if (approximate) { buf.append("APPROXIMATE "); } if (distinct) { buf.append((argList.size() == 0) ? "DISTINCT" : "DISTINCT "); } int i = -1; for (Integer arg : argList) { if (++i > 0) { buf.append(", "); } buf.append("$"); buf.append(arg); } buf.append(")"); if (!collation.equals(RelCollations.EMPTY)) { buf.append(" WITHIN GROUP ("); buf.append(collation); buf.append(")"); } if (hasFilter()) { buf.append(" FILTER $"); buf.append(filterArg); } return buf.toString(); }
Source:
private TreeLayer getTreeLayer() { NatTable natTable = (NatTable) getTableManager().getAdapter(NatTable.class); ILayer layer = natTable.getLayer(); if (layer instanceof PapyrusGridLayer) { PapyrusGridLayer gridLayer = (PapyrusGridLayer) layer; ILayer rowLayer = gridLayer.getRowHeaderLayer(); if (rowLayer instanceof RowHeaderHierarchicalLayerStack) { return ((RowHeaderHierarchicalLayerStack) rowLayer).getTreeLayer(); } } throw new UnknownError("TreeLayer has not been found"); }

Target:
private TreeLayer getTreeLayer() throws Exception { NatTable natTable = (NatTable) getTableManager().getAdapter(NatTable.class); ILayer layer = natTable.getLayer(); if (layer instanceof PapyrusGridLayer) { PapyrusGridLayer gridLayer = (PapyrusGridLayer) layer; ILayer rowLayer = gridLayer.getRowHeaderLayer(); if (rowLayer instanceof RowHeaderHierarchicalLayerStack) { return ((RowHeaderHierarchicalLayerStack) rowLayer).getTreeLayer(); } } throw new UnknownError("TreeLayer has not been found"); }
Source:
public ColumnGetter newColumnGetter(JdbcInputConnection con, PluginTask task, JdbcColumn column, JdbcColumnOption option) { ColumnGetter getter = super.newColumnGetter(con, task, column, option); switch (column.getTypeName()) { case "DATETIME": case "TIMESTAMP": int index = task.getQuerySchema().findColumn(column.getName()).get(); if (!task.getIncremental() || !task.getIncrementalColumnIndexes().contains(index)) { return getter; } MySQLInputConnection mysqlInputConnection = (MySQLInputConnection) con; if (mysqlInputConnection.getUseLegacyDatetimeCode()) { throw new ConfigException("Must use 'useLegacyDatetimeCode=false' if 'DATETIME' or 'TIMESTAMP' typed columns are used as incremental_columns:"); } TimeZone timeZone = mysqlInputConnection.getServerTimezoneTZ(); final ZoneId sessionTimeZone = checkNotNull(timeZone.toZoneId()); if (column.getTypeName().equals("DATETIME")) { return new MySQLDateTimeTimestampIncrementalHandler(sessionTimeZone, getter); } else { return new MySQLTimestampTimestampIncrementalHandler(sessionTimeZone, getter); } case "JSON": return new JsonColumnGetter(to, Types.JSON); default: return getter; } }

Target:
public ColumnGetter newColumnGetter(JdbcInputConnection con, PluginTask task, JdbcColumn column, JdbcColumnOption option) { ColumnGetter getter = super.newColumnGetter(con, task, column, option); switch (column.getTypeName()) { case "DATETIME": case "TIMESTAMP": int index = task.getQuerySchema().findColumn(column.getName()).get(); if (!task.getIncremental() || !task.getIncrementalColumnIndexes().contains(index)) { return getter; } MySQLInputConnection mysqlInputConnection = (MySQLInputConnection) con; if (mysqlInputConnection.getUseLegacyDatetimeCode()) { throw new ConfigException("Must use 'useLegacyDatetimeCode=false' if 'DATETIME' or 'TIMESTAMP' typed columns are used as incremental_columns:"); } TimeZone timeZone = mysqlInputConnection.getServerTimezoneTZ(); final ZoneId sessionTimeZone = timeZone.toZoneId(); if (column.getTypeName().equals("DATETIME")) { return new MySQLDateTimeTimestampIncrementalHandler(sessionTimeZone, getter); } else { return new MySQLTimestampTimestampIncrementalHandler(sessionTimeZone, getter); } case "JSON": return new JsonColumnGetter(to, Types.JSON); default: return getter; } }
Source:
protected static void batchRemoveDocuments(CoreSession adminSession, List<DocumentRef> ids) { List<DocumentRef> deferredIds = new ArrayList<>(); for (DocumentRef id : ids) { if (!adminSession.exists(id)) { continue; } if (adminSession.canRemoveDocument(id)) { adminSession.removeDocument(id); } else { deferredIds.add(id); } } adminSession.removeDocuments(deferredIds.toArray(new DocumentRef[0])); }

Target:
protected void batchRemoveDocuments(CoreSession adminSession, List<DocumentRef> ids) { List<DocumentRef> deferredIds = new ArrayList<>(); for (DocumentRef id : ids) { if (!adminSession.exists(id)) { continue; } if (adminSession.canRemoveDocument(id)) { adminSession.removeDocument(id); } else { deferredIds.add(id); } } adminSession.removeDocuments(deferredIds.toArray(new DocumentRef[0])); }
Source:
private void deductCreditAmountsFromDebitTransactions(PdpFeedDetailEntry newDetailEntry, KualiDecimal originalCreditTotal) { KualiDecimal totalDeductionsLeft = new KualiDecimal(originalCreditTotal.doubleValue()); for (PdpFeedAccountingEntry accountingEntry : newDetailEntry.getAccounting()) { if (accountingEntry.getAmount().isPositive() && totalDeductionsLeft.isNegative()) { KualiDecimal newTransactionAmount = accountingEntry.getAmount().add(totalDeductionsLeft); if (newTransactionAmount.isNegative()) { totalDeductionsLeft = new KualiDecimal(newTransactionAmount.doubleValue()); newTransactionAmount = KualiDecimal.ZERO; } else { totalDeductionsLeft = KualiDecimal.ZERO; } LOG.info("deductCreditAmountsFromDebitTransactions, Editing transction " + accountingEntry.toString() + ". changing the amount to " + newTransactionAmount); accountingEntry.setAmount(newTransactionAmount); } } }

Target:
private void deductCreditAmountsFromDebitTransactions(PdpFeedDetailEntry newDetailEntry, KualiDecimal originalCreditTotal) { KualiDecimal totalDeductionsLeft = originalCreditTotal; for (PdpFeedAccountingEntry accountingEntry : newDetailEntry.getAccounting()) { if (accountingEntry.getAmount().isPositive() && totalDeductionsLeft.isNegative()) { KualiDecimal newTransactionAmount = accountingEntry.getAmount().add(totalDeductionsLeft); if (newTransactionAmount.isNegative()) { totalDeductionsLeft = newTransactionAmount; newTransactionAmount = KualiDecimal.ZERO; } else { totalDeductionsLeft = KualiDecimal.ZERO; } LOG.info("deductCreditAmountsFromDebitTransactions, Editing transction " + accountingEntry.toString() + ". changing the amount to " + newTransactionAmount); accountingEntry.setAmount(newTransactionAmount); } } }
Source:
public static void main(String[] args) throws IOException { JobParameters params = new JobParameters(); JCommander jcommander = new JCommander(params); jcommander.parse(args); try (JavaSparkContext sc = JavaSparkContextFactory.withConfAndKryo(new SparkConf())) { HdfsUtils.remove(sc.hadoopConfiguration(), params.outputPath); JavaPairRDD<CharSequence, ImportedPatent> importedPatentsById = avroLoader .loadJavaRDD(sc, params.inputImportedPatentPath, ImportedPatent.class) .mapToPair(x -> new Tuple2<CharSequence, ImportedPatent>(x.getApplnNr(), x)); JavaPairRDD<CharSequence, Boolean> matchedDedupedPatentsById = avroLoader .loadJavaRDD(sc, params.inputMatchedPatentPath, DocumentToPatent.class).map(x -> x.getApplnNr()) .distinct().mapToPair(x -> new Tuple2<CharSequence, Boolean>(x, true)); JavaRDD<ImportedPatent> filteredPatents = matchedDedupedPatentsById.join(importedPatentsById).values().map(x -> x._2); avroSaver.saveJavaRDD(filteredPatents, ImportedPatent.SCHEMA$, params.outputPath); } }

Target:
public static void main(String[] args) throws IOException { JobParameters params = new JobParameters(); JCommander jcommander = new JCommander(params); jcommander.parse(args); try (JavaSparkContext sc = JavaSparkContextFactory.withConfAndKryo(new SparkConf())) { HdfsUtils.remove(sc.hadoopConfiguration(), params.outputPath); JavaPairRDD<CharSequence, ImportedPatent> importedPatentsById = avroLoader .loadJavaRDD(sc, params.inputImportedPatentPath, ImportedPatent.class) .mapToPair(x -> new Tuple2<>(x.getApplnNr(), x)); JavaPairRDD<CharSequence, Boolean> matchedDedupedPatentsById = avroLoader .loadJavaRDD(sc, params.inputMatchedPatentPath, DocumentToPatent.class).map(DocumentToPatent::getApplnNr) .distinct().mapToPair(x -> new Tuple2<>(x, true)); JavaRDD<ImportedPatent> filteredPatents = matchedDedupedPatentsById.join(importedPatentsById).values().map(x -> x._2); avroSaver.saveJavaRDD(filteredPatents, ImportedPatent.SCHEMA$, params.outputPath); } }
Source:
public List<Entity> getEntities(ClassLoader extensionClassloader, String extensionName, String jobName, InputStream configStream) throws IOException, FalconException { Thread.currentThread().setContextClassLoader(extensionClassloader); ServiceLoader<ExtensionBuilder> extensionBuilders = ServiceLoader.load(ExtensionBuilder.class); List<Class<? extends ExtensionBuilder>> result = new ArrayList<>(); for (ExtensionBuilder extensionBuilder : extensionBuilders) { result.add(extensionBuilder.getClass()); } if (result.isEmpty()) { throw new FalconException("Extension Implementation not found in the package of : " + extensionName); } else if (result.size() > 1) { throw new FalconException("Found more than one extension Implementation in the package of : " + extensionName); } ExtensionBuilder extensionBuilder; try { Class<ExtensionBuilder> clazz = (Class<ExtensionBuilder>) extensionClassloader .loadClass(result.get(0).getCanonicalName()); extensionBuilder = clazz.newInstance(); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { throw new FalconCLIException("Failed to instantiate extension implementation " + extensionName, e); } extensionBuilder.validateExtensionConfig(extensionName, configStream); List<Entity> entities = extensionBuilder.getEntities(jobName, configStream); return entities; }

Target:
public List<Entity> getEntities(ClassLoader extensionClassloader, String extensionName, String jobName, InputStream configStream) throws IOException, FalconException { Thread.currentThread().setContextClassLoader(extensionClassloader); ServiceLoader<ExtensionBuilder> extensionBuilders = ServiceLoader.load(ExtensionBuilder.class); List<Class<? extends ExtensionBuilder>> result = new ArrayList<>(); for (ExtensionBuilder extensionBuilder : extensionBuilders) { result.add(extensionBuilder.getClass()); } if (result.isEmpty()) { throw new FalconException("Extension Implementation not found in the package of : " + extensionName); } else if (result.size() > 1) { throw new FalconException("Found more than one extension Implementation in the package of : " + extensionName); } ExtensionBuilder extensionBuilder = null; try { Class<ExtensionBuilder> clazz = (Class<ExtensionBuilder>) extensionClassloader .loadClass(result.get(0).getCanonicalName()); extensionBuilder = clazz.newInstance(); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { throw new FalconCLIException("Failed to instantiate extension implementation " + extensionName, e); } extensionBuilder.validateExtensionConfig(extensionName, configStream); List<Entity> entities = extensionBuilder.getEntities(jobName, configStream); return entities; }
Source:
public FileSingleStreamSpiller( PagesSerde serde, ListeningExecutorService executor, Path spillPath, SpillerStats spillerStats, SpillContext spillContext, LocalMemoryContext memoryContext) { this.serde = requireNonNull(serde, "serde is null"); this.executor = requireNonNull(executor, "executor is null"); this.spillerStats = requireNonNull(spillerStats, "spillerStats is null"); this.localSpillContext = spillContext.newLocalSpillContext(); this.memoryContext = requireNonNull(memoryContext, "memoryContext can not be null"); try { targetFileName = Files.createTempFile(spillPath, SPILL_FILE_PREFIX, SPILL_FILE_SUFFIX); } catch (IOException e) { throw new PrestoException(GENERIC_INTERNAL_ERROR, "Failed to create spill file", e); } }

Target:
public FileSingleStreamSpiller( PagesSerde serde, ListeningExecutorService executor, Path spillPath, SpillerStats spillerStats, SpillContext spillContext, LocalMemoryContext memoryContext) { this.serde = requireNonNull(serde, "serde is null"); this.executor = requireNonNull(executor, "executor is null"); this.spillerStats = requireNonNull(spillerStats, "spillerStats is null"); this.localSpillContext = spillContext.newLocalSpillContext(); this.memoryContext = requireNonNull(memoryContext, "memoryContext can not be null"); try { this.targetFile = closer.register(new FileHolder(Files.createTempFile(spillPath, SPILL_FILE_PREFIX, SPILL_FILE_SUFFIX))); } catch (IOException e) { throw new PrestoException(GENERIC_INTERNAL_ERROR, "Failed to create spill file", e); } }
Source:
public String getRawMethod() { throw new UnsupportedOperationException("todo"); }

Target:
public String getRawMethod() { return rawMethod; }
Source:
public void testInvertSortKey() { assertEquals("ffffffffffffffff", ChangeUtil.invertSortKey( "0000000000000000").toLowerCase()); assertEquals("0000000000000001", ChangeUtil .invertSortKey("FFFFFFFFFFFFFFFE")); assertEquals("0001600000000000", ChangeUtil .invertSortKey("FFFE9FFFFFFFFFFF")); assertEquals("/", ChangeUtil.invertSortKey("z")); assertEquals("z", ChangeUtil.invertSortKey("/")); }

Target:
public void testInvertSortKey() { assertEquals("ffffffffffffffff", ChangeUtil .invertSortKey("0000000000000000")); assertEquals("0000000000000001", ChangeUtil .invertSortKey("fffffffffffffffe")); assertEquals("0001600000000000", ChangeUtil .invertSortKey("fffe9fffffffffff")); assertEquals("/", ChangeUtil.invertSortKey("z")); assertEquals("z", ChangeUtil.invertSortKey("/")); }
Source:
public void export(final DRepresentation representation, final Session session, final IPath path, final ExportFormat format, final IProgressMonitor monitor) throws SizeTooLargeException { export(representation, session, path, format, monitor, true); }

Target:
public void export(final DRepresentation representation, final Session session, final IPath path, final ExportFormat format, final IProgressMonitor monitor) { export(representation, session, path, format, monitor, true); }
Source:
public void run() { final List<Media> medias = MediaRepository.getAllMedia(); if (medias != null && !medias.isEmpty()) { mMainExecutor.run(new Runnable() { @Override public void run() { mCallback.onSuccess(medias); } }); } else { mMainExecutor.run(new Runnable() { @Override public void run() { mCallback.onError(); } }); } }

Target:
public void run() { final List<Media> medias = mMediaRepository.getAll(); if (medias != null && !medias.isEmpty()) { mMainExecutor.run(new Runnable() { @Override public void run() { mCallback.onSuccess(medias); } }); } else { mMainExecutor.run(new Runnable() { @Override public void run() { mCallback.onError(); } }); } }
Source:
private static synchronized Schedulers getInstance() { if (INSTANCE == null) { INSTANCE = new Schedulers(); } return INSTANCE; }

Target:
private static Schedulers getInstance() { for (;;) { Schedulers current = INSTANCE.get(); if (current != null) { return current; } current = new Schedulers(); if (INSTANCE.compareAndSet(null, current)) { return current; } else { shutdown(); } } }
Source:
public long readLimit(String client) { QosClientLimitsConfig qosClientLimitsConfig = qosClientConfigLoader.getConfigForClient(client); readLimitMultiplier = this.clientLimitMultiplier.getClientLimitMultiplier( qosClientLimitsConfig.clientPriority()); return (long) (readLimitMultiplier * qosClientLimitsConfig.limits().readBytesPerSecond()); }

Target:
public long readLimit(String client) { QosClientLimitsConfig qosClientLimitsConfig = qosClientConfigLoader.getConfigForClient(client); readLimitMultiplier = this.clientLimitMultiplier.getClientLimitMultiplier( ); return (long) (readLimitMultiplier * qosClientLimitsConfig.limits().readBytesPerSecond()); }
Source:
private Tag validateTagDescriptorType(Tag tag, SourceFile.FileType fileType, String primaryDescriptorPath) { LanguageHandlerInterface.VersionTypeValidation isValidDescriptor = LanguageHandlerFactory.getInterface(fileType) .validateToolSet(tag.getSourceFiles(), primaryDescriptorPath); Validation descriptorValidation = new Validation(fileType, isValidDescriptor); tag.addOrUpdateValidation(descriptorValidation); SourceFile.FileType testParamType = Objects.equals(fileType, SourceFile.FileType.DOCKSTORE_WDL) ? SourceFile.FileType.WDL_TEST_JSON : SourceFile.FileType.CWL_TEST_JSON; LanguageHandlerInterface.VersionTypeValidation isValidTestParameter = LanguageHandlerFactory.getInterface(fileType) .validateTestParameterSet(tag.getSourceFiles()); Validation testParameterValidation = new Validation(testParamType, isValidTestParameter); tag.addOrUpdateValidation(testParameterValidation); return tag; }

Target:
private Tag validateTagDescriptorType(Tag tag, SourceFile.FileType fileType, String primaryDescriptorPath) { LanguageHandlerInterface.VersionTypeValidation isValidDescriptor = LanguageHandlerFactory.getInterface(fileType) .validateToolSet(tag.getSourceFiles(), primaryDescriptorPath); Validation descriptorValidation = new Validation(fileType, isValidDescriptor); tag.addOrUpdateValidation(descriptorValidation); SourceFile.FileType testParamType = null; switch (fileType) { case DOCKSTORE_CWL: testParamType = SourceFile.FileType.CWL_TEST_JSON; break; case DOCKSTORE_WDL: testParamType = SourceFile.FileType.WDL_TEST_JSON; break; case NEXTFLOW_CONFIG: break; default: throw new CustomWebApplicationException(fileType + " is not a valid tool type.", HttpStatus.SC_BAD_REQUEST); } if (testParamType != null) { LanguageHandlerInterface.VersionTypeValidation isValidTestParameter = LanguageHandlerFactory.getInterface(fileType).validateTestParameterSet(tag.getSourceFiles()); Validation testParameterValidation = new Validation(testParamType, isValidTestParameter); tag.addOrUpdateValidation(testParameterValidation); } return tag; }