auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static void main(final String... args) throws IOException { cliThread = new CLIThread(); new Thread(cliThread, "CLIThread").start(); log("Type \"stop\" or \"q\" to exit."); try (ServerSocket sock = new ServerSocket(PORT)) { serverSocket = sock; log("Server is now accepting clients."); Socket socket; while (running) { socket = serverSocket.accept(); new Thread(new HighscoreServerThread(socket), "HsServerThread" + socket.getRemoteSocketAddress().toString()).start(); } } catch (IOException e) { if (running) { logError("Could not listen on port " + PORT + ", exiting!"); cliThread.handleCommand("stop"); } } }

Target:
public static void main(final String... args) throws IOException { cliThread = new CLIThread(); new Thread(cliThread, "CLIThread").start(); log("Type \"stop\" or \"q\" to exit."); try (ServerSocket sock = new ServerSocket(PORT)) { serverSocket = sock; log("Server is now accepting clients."); while (running) { final Socket socket = serverSocket.accept(); new Thread(new HighscoreServerThread(socket), "HsServerThread" + socket.getRemoteSocketAddress().toString()).start(); } } catch (IOException e) { if (running) { logError("Could not listen on port " + PORT + ", exiting!"); cliThread.handleCommand("stop"); } } }
Source:
public Response getTechnologies() throws InternalServerErrorException, NotFoundException { List<Technology> techEntities = technologyDAO.findAll(); if (techEntities == null) { throw new NotFoundException("Não foi encontrado nenhuma tecnologia!"); } else { TechnologiesResponse response = new TechnologiesResponse(); List<TechnologyResponse> internList = new ArrayList<TechnologyResponse>(); for (int i = 0; i < techEntities.size(); i++) { Technology tech = techEntities.get(i); TechnologyResponse techResponseItem = new TechnologyResponse(); techResponseItem.setId(tech.getId()); techResponseItem.setName(tech.getName()); internList.add(techResponseItem); } response.setTechnologies(internList); return response; } }

Target:
public Response getTechnologies() throws InternalServerErrorException, NotFoundException { List<Technology> techEntities = technologyDAO.findAll(); if (techEntities == null) { throw new NotFoundException("No technology was found."); } else { TechnologiesResponse response = new TechnologiesResponse(); List<TechnologyResponse> internList = new ArrayList<TechnologyResponse>(); for (int i = 0; i < techEntities.size(); i++) { Technology tech = techEntities.get(i); TechnologyResponse techResponseItem = new TechnologyResponse(); techResponseItem.setId(tech.getId()); techResponseItem.setName(tech.getName()); internList.add(techResponseItem); } response.setTechnologies(internList); return response; } }
Source:
public void testGetAnalysisRequirements() { Iterable<TmfAnalysisRequirement> requirements = fKernelAnalysisModule.getAnalysisRequirements(); assertNotNull(requirements); assertTrue(requirements.iterator().hasNext()); TmfAnalysisRequirement eventReq = null; TmfAnalysisRequirement domainReq = null; int numberOfRequirement = 0; for (TmfAnalysisRequirement requirement : requirements) { ++numberOfRequirement; if (requirement.getType().equals(SessionConfigStrings.CONFIG_ELEMENT_EVENT)) { eventReq = requirement; } else if (requirement.getType().equals(SessionConfigStrings.CONFIG_ELEMENT_DOMAIN)) { domainReq = requirement; } } assertNotNull(eventReq); assertNotNull(domainReq); assertEquals(2, numberOfRequirement); assertEquals(1, domainReq.getValues().size()); for (String domain : domainReq.getValues()) { assertEquals(SessionConfigStrings.CONFIG_DOMAIN_TYPE_KERNEL, domain); } List<String> expectedEvents = ImmutableList.of( LttngStrings.EXIT_SYSCALL, LttngStrings.IRQ_HANDLER_ENTRY, LttngStrings.IRQ_HANDLER_EXIT, LttngStrings.SOFTIRQ_ENTRY, LttngStrings.SOFTIRQ_EXIT, LttngStrings.SOFTIRQ_RAISE, LttngStrings.SCHED_SWITCH, LttngStrings.SCHED_PROCESS_FORK, LttngStrings.SCHED_PROCESS_EXIT, LttngStrings.SCHED_PROCESS_FREE, LttngStrings.STATEDUMP_PROCESS_STATE, LttngStrings.SCHED_WAKEUP, LttngStrings.SCHED_WAKEUP_NEW, LttngStrings.SYSCALL_PREFIX ); assertEquals(14, eventReq.getValues().size()); for (String event : eventReq.getValues()) { assertTrue("Unexpected event " + event, expectedEvents.contains(event)); } }

Target:
public void testGetAnalysisRequirements() { Iterable<TmfAnalysisRequirement> requirements = fKernelAnalysisModule.getAnalysisRequirements(); assertNotNull(requirements); assertTrue(requirements.iterator().hasNext()); TmfAnalysisRequirement eventReq = null; TmfAnalysisRequirement domainReq = null; int numberOfRequirement = 0; for (TmfAnalysisRequirement requirement : requirements) { ++numberOfRequirement; if (requirement.getType().equals(SessionConfigStrings.CONFIG_ELEMENT_EVENT)) { eventReq = requirement; } else if (requirement.getType().equals(SessionConfigStrings.CONFIG_ELEMENT_DOMAIN)) { domainReq = requirement; } } assertNotNull(eventReq); assertNotNull(domainReq); assertEquals(2, numberOfRequirement); assertEquals(1, domainReq.getValues().size()); for (String domain : domainReq.getValues()) { assertEquals(SessionConfigStrings.CONFIG_DOMAIN_TYPE_KERNEL, domain); } Set<String> expectedEvents = ImmutableSet.of( LttngStrings.EXIT_SYSCALL, LttngStrings.IRQ_HANDLER_ENTRY, LttngStrings.IRQ_HANDLER_EXIT, LttngStrings.SOFTIRQ_ENTRY, LttngStrings.SOFTIRQ_EXIT, LttngStrings.SOFTIRQ_RAISE, LttngStrings.SCHED_SWITCH, LttngStrings.SCHED_PROCESS_FORK, LttngStrings.SCHED_PROCESS_EXIT, LttngStrings.SCHED_PROCESS_FREE, LttngStrings.STATEDUMP_PROCESS_STATE, LttngStrings.SCHED_WAKEUP, LttngStrings.SCHED_WAKEUP_NEW, LttngStrings.SYSCALL_PREFIX ); assertEquals(14, eventReq.getValues().size()); for (String event : eventReq.getValues()) { assertTrue("Unexpected event " + event, expectedEvents.contains(event)); } }
Source:
public TaskResult runTask() { try (TDOperator op = TDOperator.fromConfigWithRetries(params)) { if (!existingDomainKey.isPresent()) { String domainKey = UUID.randomUUID().toString(); state.set(DOMAIN_KEY, domainKey); throw TaskExecutionException.ofNextPolling(0, ConfigElement.copyOf(state.deepCopy())); } if (!existingJobId.isPresent()) { String jobId = startJob(op); state.set(JOB_ID, jobId); state.set(POLL_INTERVAL, INITIAL_POLL_INTERVAL); throw TaskExecutionException.ofNextPolling(INITIAL_POLL_INTERVAL, ConfigElement.copyOf(state.deepCopy())); } String jobId = existingJobId.get(); TDJobOperator job = op.newJobOperator(jobId); TDJobSummary status = checkJobStatus(job); boolean done = status.getStatus().isFinished(); if (!done) { int prevPollInterval = state.get(POLL_INTERVAL, int.class, INITIAL_POLL_INTERVAL); int nextPollInterval = Math.min(MAX_POLL_INTERVAL, prevPollInterval * 2); state.set(POLL_INTERVAL, nextPollInterval); throw TaskExecutionException.ofNextPolling(INITIAL_POLL_INTERVAL, ConfigElement.copyOf(state.deepCopy())); } return processJobResult(op, job, status); } }

Target:
public TaskResult runTask() { try (TDOperator op = TDOperator.fromConfig(params)) { if (!existingDomainKey.isPresent()) { String domainKey = UUID.randomUUID().toString(); state.set(DOMAIN_KEY, domainKey); throw TaskExecutionException.ofNextPolling(0, ConfigElement.copyOf(state)); } if (!existingJobId.isPresent()) { String jobId = startJob(op); state.set(JOB_ID, jobId); state.set(POLL_ITERATION, 1); throw TaskExecutionException.ofNextPolling(INITIAL_POLL_INTERVAL, ConfigElement.copyOf(state)); } String jobId = existingJobId.get(); TDJobOperator job = op.newJobOperator(jobId); TDJobSummary status = checkJobStatus(job); boolean done = status.getStatus().isFinished(); if (!done) { int pollIteration = state.get(POLL_ITERATION, int.class, 1); state.set(POLL_ITERATION, pollIteration + 1); int pollInterval = (int) Math.min(INITIAL_POLL_INTERVAL * Math.pow(2, pollIteration), MAX_POLL_INTERVAL); throw TaskExecutionException.ofNextPolling(pollInterval, ConfigElement.copyOf(state)); } return processJobResult(op, job, status); } }
Source:
private Map<String, Object> getAssertionAttributes(Assertion assertion) { Map<String, Object> attributeMap = new HashMap<>(); for (AttributeStatement attributeStatement : assertion.getAttributeStatements()) { for (Attribute attribute : attributeStatement.getAttributes()) { List<String> attributeValues = new ArrayList<>(); for (XMLObject xmlObject : attribute.getAttributeValues()) { attributeValues.add(getXmlObjectValue(xmlObject)); } attributeMap.put(attribute.getName(), attributeValues); } } return attributeMap; }

Target:
private Map<String, List<Object>> getAssertionAttributes(Assertion assertion) { Map<String, List<Object>> attributeMap = new LinkedHashMap<>(); for (AttributeStatement attributeStatement : assertion.getAttributeStatements()) { for (Attribute attribute : attributeStatement.getAttributes()) { List<Object> attributeValues = new ArrayList<>(); for (XMLObject xmlObject : attribute.getAttributeValues()) { Object attributeValue = getXmlObjectValue(xmlObject); if (attributeValue != null) { attributeValues.add(attributeValue); } } attributeMap.put(attribute.getName(), attributeValues); } } return attributeMap; }
Source:
private void assertSetAuthorAttributionText(TextView textView, DiscussionTextUtils.AuthorAttributionLabel type, IAuthorData input, long now, String expectedOutput) { Runnable listener = Mockito.mock(Runnable.class); DiscussionTextUtils.setAuthorAttributionText(textView, type, input, now, listener); if (expectedOutput == null) { assertTrue(textView.getVisibility() == View.GONE); } else { String output = textView.getText().toString(); assertEquals(expectedOutput, output); if (!input.isAuthorAnonymous()) { int start = output.indexOf(input.getAuthor()); int end = start + input.getAuthor().length(); SpannableString spannableString = (SpannableString) textView.getText(); ClickableSpan[] spans = spannableString.getSpans(start, end, ClickableSpan.class); if (config.isUserProfilesEnabled()) { assertTrue(spans.length == 1); spans[0].onClick(textView); Mockito.verify(listener).run(); } else { assertTrue(spans.length == 0); } } } }

Target:
private void assertSetAuthorAttributionText(TextView textView, DiscussionTextUtils.AuthorAttributionLabel type, IAuthorData input, long now, String expectedOutput) { final Runnable listener = Mockito.mock(Runnable.class); DiscussionTextUtils.setAuthorAttributionText(textView, type, input, now, listener); if (expectedOutput == null) { assertTrue(textView.getVisibility() == View.GONE); } else { String output = textView.getText().toString(); assertEquals(expectedOutput, output); if (!input.isAuthorAnonymous()) { int start = output.indexOf(input.getAuthor()); int end = start + input.getAuthor().length(); Spanned text = (Spanned) textView.getText(); StyleSpan[] styleSpans = text.getSpans(start, end, StyleSpan.class); ForegroundColorSpan[] colorSpans = text.getSpans(start, end, ForegroundColorSpan.class); if (config.isUserProfilesEnabled()) { assertEquals(1, styleSpans.length); assertEquals(start, text.getSpanStart(styleSpans[0])); assertEquals(end, text.getSpanEnd(styleSpans[0])); assertEquals(Typeface.BOLD, styleSpans[0].getStyle()); assertEquals(1, colorSpans.length); assertEquals(start, text.getSpanStart(colorSpans[0])); assertEquals(end, text.getSpanEnd(colorSpans[0])); assertEquals(context.getResources().getColor(R.color.edx_brand_primary_base), colorSpans[0].getForegroundColor()); textView.performClick(); Mockito.verify(listener).run(); } else { assertEquals(0, styleSpans.length); assertEquals(0, colorSpans.length); assertFalse(textView.isClickable()); } } } }
Source:
public void should_wait_for_contact_points_if_reconnection_enabled() throws Exception { simulacronRule.cluster().rejectConnections(0, RejectScope.STOP); DriverConfigLoader loader = SessionUtils.configLoaderBuilder() .withBoolean(DefaultDriverOption.RECONNECT_ON_INIT, true) .withString( DefaultDriverOption.RECONNECTION_POLICY_CLASS, InitOnlyReconnectionPolicy.class.getName()) .withDuration(DefaultDriverOption.RECONNECTION_BASE_DELAY, Duration.ofMillis(500)) .build(); CompletableFuture<? extends Session> sessionFuture = newSessionAsync(simulacronRule, loader).toCompletableFuture(); TimeUnit.SECONDS.sleep(2); assertThat(sessionFuture).isNotCompleted(); simulacronRule.cluster().acceptConnections(); Session session = sessionFuture.get(2, TimeUnit.SECONDS); session.close(); }

Target:
public void should_wait_for_contact_points_if_reconnection_enabled() throws Exception { simulacronRule.cluster().rejectConnections(0, RejectScope.STOP); DriverConfigLoader loader = SessionUtils.configLoaderBuilder() .withBoolean(DefaultDriverOption.RECONNECT_ON_INIT, true) .withClass( DefaultDriverOption.RECONNECTION_POLICY_CLASS, InitOnlyReconnectionPolicy.class) .withDuration(DefaultDriverOption.RECONNECTION_BASE_DELAY, Duration.ofMillis(500)) .build(); CompletableFuture<? extends Session> sessionFuture = newSessionAsync(simulacronRule, loader).toCompletableFuture(); TimeUnit.SECONDS.sleep(2); assertThat(sessionFuture).isNotCompleted(); simulacronRule.cluster().acceptConnections(); Session session = sessionFuture.get(2, TimeUnit.SECONDS); session.close(); }
Source:
private void executeAndSetReturnValue(String volumeName) { VDSReturnValue returnValue = executeCommand(volumeName); getQueryReturnValue().setReturnValue(returnValue.getReturnValue()); return; }

Target:
private void executeAndSetReturnValue(String volumeName) { VDSReturnValue returnValue = executeCommand(volumeName); getQueryReturnValue().setReturnValue(returnValue.getReturnValue()); }
Source:
private int receiveCommand(String commandId, Writer out, Writer err) { while(true) { Receive receive = new Receive(); DesiredStreamType stream = new DesiredStreamType(); stream.setCommandId(commandId); stream.setValue("stdout stderr"); receive.setDesiredStream(stream); setActionToContext((BindingProvider) winrm, "<LINK_1>"); try { numberOfReceiveCalls++; ReceiveResponse receiveResponse = winrm.receive(receive, RESOURCE_URI, MAX_ENVELOPER_SIZE, operationTimeout, locale, shellSelector); getStreams(receiveResponse, out, err); System.out.println(String.format("receiveResponse: %s", receiveResponse.toString())); CommandStateType state = receiveResponse.getCommandState(); if (COMMAND_STATE_DONE.equals(state.getState())) { return state.getExitCode().intValue(); } } catch (SOAPFaultException e) { if(e.getFault().getDetail().getFirstChild().getAttributes().getNamedItem("Code").getNodeValue().equals("2150858793")) { LOG.debug("Re-polling a receive request", this); } else { throw e; } } } }

Target:
private int receiveCommand(String commandId, Writer out, Writer err) { while(true) { Receive receive = new Receive(); DesiredStreamType stream = new DesiredStreamType(); stream.setCommandId(commandId); stream.setValue("stdout stderr"); receive.setDesiredStream(stream); setActionToContext((BindingProvider) winrm, "<LINK_1>"); try { numberOfReceiveCalls++; ReceiveResponse receiveResponse = winrm.receive(receive, RESOURCE_URI, MAX_ENVELOPER_SIZE, operationTimeout, locale, shellSelector); getStreams(receiveResponse, out, err); CommandStateType state = receiveResponse.getCommandState(); if (COMMAND_STATE_DONE.equals(state.getState())) { return state.getExitCode().intValue(); } else { LOG.debug("{} is not done. Response it received: {}", this, receiveResponse); } } catch (SOAPFaultException soapFault) { try { if (soapFault.getFault().getDetail().getFirstChild().getAttributes().getNamedItem("Code").getNodeValue().equals(WSMAN_FAULT_CODE_OPERATION_TIMEOUT_EXPIRED)) { LOG.trace("winrm client received an operation response {}", this, soapFault); } else { throw soapFault; } } catch (NullPointerException e) { throw soapFault; } } } }
Source:
protected Map<String, Set<Watcher>> getWatches(int rc) { return getWatchManager().dataWatches; }

Target:
protected Map<String, Set<Watcher>> getWatches(int rc) { return getWatchManager().getDataWatches(); }
Source:
protected void initializeDataSource() { ITmfTrace trace = getTrace(); fXYDataProvider = DisksIODataProvider.create(trace); }

Target:
protected void initializeDataSource() { ITmfTrace trace = getTrace(); setDataProvider(DisksIODataProvider.create(trace)); }
Source:
public void multiWikiFinderTests_002_maxAmoutOfLinksOnPage() { SpecialUserLoginPageObject login = new SpecialUserLoginPageObject(driver); login.openWikiPage(); login.loginAndVerify(Properties.userNameStaff, Properties.passwordStaff); SpecialMultiWikiFinderPageObject multiWikiFinder = new SpecialMultiWikiFinderPageObject(driver); multiWikiFinder.openSpecialMultiWikiFinderPage(); multiWikiFinder.findPageName(pageName); for(int element : SearchDataProvider.getSearchLimits()){ multiWikiFinder.limitResults(pageName, element); multiWikiFinder.compareResultsCount(element); } }

Target:
public void multiWikiFinderTests_002_maxAmoutOfLinksOnPage() { SpecialMultiWikiFinderPageObject multiWikiFinder = new SpecialMultiWikiFinderPageObject(driver); multiWikiFinder.logInCookie(credentials.userNameStaff, credentials.passwordStaff, wikiURL); multiWikiFinder.openSpecialMultiWikiFinderPage(wikiURL); multiWikiFinder.findPageName(pageName); multiWikiFinder.checkAllLimits(); }
Source:
public Builder compactOnLaunch(CompactOnLaunchCallback compactOnLaunch) { this.compactOnLaunch = compactOnLaunch; return this; }

Target:
public Builder compactOnLaunch(CompactOnLaunchCallback compactOnLaunch) { if (compactOnLaunch == null) { throw new IllegalArgumentException("A non-null compactOnLaunch must be provided"); } this.compactOnLaunch = compactOnLaunch; return this; }
Source:
private KfsVendorDataWrapper populateFirstLastLegalName(PaymentWorksVendor pmwVendor, KfsVendorDataWrapper kfsVendorDataWrapper) { kfsVendorDataWrapper.getVendorDetail().setVendorFirstLastNameIndicator(true); kfsVendorDataWrapper.getVendorDetail().setVendorLastName(truncateValueToMaxLength(pmwVendor.getRequestingCompanyLegalLastName(), VendorConstants.MAX_VENDOR_NAME_LENGTH)); kfsVendorDataWrapper.getVendorDetail().setVendorFirstName(truncateLegalFirstNameToMaximumAllowedLengthWhenFormattedWithLegalLastName(pmwVendor.getRequestingCompanyLegalLastName(), pmwVendor.getRequestingCompanyLegalFirstName())); return kfsVendorDataWrapper; }

Target:
private KfsVendorDataWrapper populateFirstLastLegalName(PaymentWorksVendor pmwVendor, KfsVendorDataWrapper kfsVendorDataWrapper) { kfsVendorDataWrapper.getVendorDetail().setVendorFirstLastNameIndicator(true); String vendorLastName = truncateValueToMaxLength(pmwVendor.getRequestingCompanyLegalLastName(), VendorConstants.MAX_VENDOR_NAME_LENGTH); kfsVendorDataWrapper.getVendorDetail().setVendorLastName(vendorLastName); kfsVendorDataWrapper.getVendorDetail().setVendorFirstName(truncateLegalFirstNameToMaximumAllowedLengthWhenFormattedWithLegalLastName(vendorLastName, pmwVendor.getRequestingCompanyLegalFirstName(), VendorConstants.NAME_DELIM, VendorConstants.MAX_VENDOR_NAME_LENGTH)); return kfsVendorDataWrapper; }
Source:
public DeleteRequest(int correlationId, String clientId, BlobId blobId) { super(RequestOrResponseType.DeleteRequest, currentVersion, correlationId, clientId); this.blobId = blobId; sizeSent = 0; }

Target:
public DeleteRequest(int correlationId, String clientId, BlobId blobId) { this(correlationId, clientId, blobId, Utils.Infinite_Time, CURRENT_VERSION); }
Source:
@Override public ResultSet getTables(String catalog, String schemaPtrn, String tblNamePtrn, String[] tblTypes) throws SQLException { conn.ensureNotClosed(); List<List<?>> rows = Collections.emptyList(); boolean areTypesValid = tblTypes == null || Arrays.asList(tblTypes).contains(TYPE_TABLE); if (isValidCatalog(catalog) && areTypesValid) { List<JdbcTableMeta> tabMetas = meta.getTablesMeta(schemaPtrn, tblNamePtrn, tblTypes); rows = new ArrayList<>(tabMetas.size()); for (JdbcTableMeta m : tabMetas) rows.add(tableRow(m)); } return new JdbcResultSet(true, null, conn.createStatement0(), Collections.<String>emptyList(), Arrays.asList("TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "TABLE_TYPE", "REMARKS", "TYPE_CAT", "TYPE_SCHEM", "TYPE_NAME", "SELF_REFERENCING_COL_NAME", "REF_GENERATION"), Arrays.asList(String.class.getName(), String.class.getName(), String.class.getName(), String.class.getName(), String.class.getName(), String.class.getName(), String.class.getName(), String.class.getName(), String.class.getName(), String.class.getName()), rows, true ); }

Target:
@Override public ResultSet getTables(String catalog, String schemaPtrn, String tblNamePtrn, String[] tblTypes) throws SQLException { conn.ensureNotClosed(); List<List<?>> rows = Collections.emptyList(); boolean areTypesValid = false; if(tblTypes == null) areTypesValid = true; else { for (String type : tblTypes) { if (TYPE_TABLE.equals(type) || TYPE_VIEW.equals(type)) { areTypesValid = true; break; } } } if (isValidCatalog(catalog) && areTypesValid) { List<JdbcTableMeta> tabMetas = meta.getTablesMeta(schemaPtrn, tblNamePtrn, tblTypes); rows = new ArrayList<>(tabMetas.size()); for (JdbcTableMeta m : tabMetas) rows.add(tableRow(m)); } return new JdbcResultSet(true, null, conn.createStatement0(), Collections.<String>emptyList(), asList("TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "TABLE_TYPE", "REMARKS", "TYPE_CAT", "TYPE_SCHEM", "TYPE_NAME", "SELF_REFERENCING_COL_NAME", "REF_GENERATION"), asList(String.class.getName(), String.class.getName(), String.class.getName(), String.class.getName(), String.class.getName(), String.class.getName(), String.class.getName(), String.class.getName(), String.class.getName(), String.class.getName()), rows, true ); }
Source:
public ClientCnxnSocketNIO(ZKClientConfig clientConfig) throws IOException { this.clientConfig = clientConfig; initProperties(); }

Target:
ClientCnxnSocketNIO(ZKClientConfig clientConfig) throws IOException { this.clientConfig = clientConfig; initProperties(); }
Source:
public ObservableToMessageChannelResultAdapter( FluxToMessageChannelResultAdapter fluxToMessageChannelResultAdapter) { this.fluxToMessageChannelResultAdapter = fluxToMessageChannelResultAdapter; }

Target:
public ObservableToMessageChannelResultAdapter( FluxToMessageChannelResultAdapter fluxToMessageChannelResultAdapter) { Assert.notNull(fluxToMessageChannelResultAdapter, "cannot be null"); this.fluxToMessageChannelResultAdapter = fluxToMessageChannelResultAdapter; }
Source:
public static boolean isJsonScalar(@SqlType(StandardTypes.JSON) Slice json) { try (JsonParser parser = createJsonParser(JSON_FACTORY, json)) { JsonToken nextToken = parser.nextToken(); checkCondition(nextToken != null, INVALID_FUNCTION_ARGUMENT, "Bad JSON value: %s", truncateIfNecessaryForErrorMessage(json)); if (nextToken == START_ARRAY || nextToken == START_OBJECT) { parser.skipChildren(); checkCondition(parser.nextToken() == null, INVALID_FUNCTION_ARGUMENT, "Bad JSON value: %s", truncateIfNecessaryForErrorMessage(json)); return false; } checkCondition(parser.nextToken() == null, INVALID_FUNCTION_ARGUMENT, "Bad JSON value: %s", truncateIfNecessaryForErrorMessage(json)); return true; } catch (IOException e) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, format("Bad JSON value: %s", truncateIfNecessaryForErrorMessage(json))); } }

Target:
public static boolean isJsonScalar(@SqlType(StandardTypes.JSON) Slice json) { try (JsonParser parser = createJsonParser(JSON_FACTORY, json)) { JsonToken nextToken = parser.nextToken(); if (nextToken == null) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Invalid JSON value: " + truncateIfNecessaryForErrorMessage(json)); } if (nextToken == START_ARRAY || nextToken == START_OBJECT) { parser.skipChildren(); if (parser.nextToken() != null) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Invalid JSON value: " + truncateIfNecessaryForErrorMessage(json)); } return false; } if (parser.nextToken() != null) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Invalid JSON value: " + truncateIfNecessaryForErrorMessage(json)); } return true; } catch (IOException e) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Invalid JSON value: " + truncateIfNecessaryForErrorMessage(json)); } }
Source:
protected void setVmLeaseDefaultStorageDomain(Guid defaultStorageDomainId) { Collection<StorageDomain> domains = getModel().getLease().getItems(); domains.stream() .filter(Objects::nonNull) .filter(sd -> sd.getId().equals(defaultStorageDomainId)) .findFirst().ifPresent(d -> getModel().getLease().setSelectedItem(d)); }

Target:
protected void setVmLeaseDefaultStorageDomain(Guid defaultStorageDomainId) { Collection<StorageDomain> domains = getModel().getLease().getItems(); domains.stream() .filter(Objects::nonNull) .filter(sd -> sd.getId().equals(defaultStorageDomainId)) .findFirst().ifPresent(sd -> getModel().getLease().setSelectedItem(sd)); }
Source:
protected PreparedStatement getUpdateCommand() { PreparedStatement statement; if (query != null) { statement = store.getSession().prepare(query); } else { statement = super.getUpdateCommand(); } LOG.info("Operator query: " + statement.getQueryString()); return statement; }

Target:
protected PreparedStatement getUpdateCommand() { PreparedStatement statement; if (query != null) { statement = store.getSession().prepare(query); } else { statement = super.getUpdateCommand(); } LOG.debug("Operator query: " + statement.getQueryString()); return statement; }
Source:
public String getAppID() { return thingIfApi.getAppID(); }

Target:
public String getAppID() { return this.thingIfApi.getAppID(); }
Source:
public void lock() { this.delegate.lock(); try { boolean acquired = this.mutex.acquire(this.path); if (acquired) { this.lastUsed = System.currentTimeMillis(); } } catch (Exception e) { this.delegate.unlock(); throw new RuntimeException("Failed to aquire mutex at " + this.path, e); } }

Target:
public void lock() { this.delegate.lock(); boolean locked = false; try { while (!locked) { try { locked = doLock(); } catch (TransactionTimedOutException e) { } catch (DuplicateKeyException e) { } catch (RuntimeException e) { this.delegate.unlock(); throw e; } } } catch (Exception e) { this.delegate.unlock(); throw new RuntimeException("Failed to acquire mutex at " + this.path, e); } }
Source:
public boolean applies(Ability abilityToModify, Ability source, Game game) { return abilityToModify instanceof CyclingAbility && filter.match(abilityToModify, game) && abilityToModify.getControllerId().equals(source.getControllerId()); }

Target:
public boolean applies(Ability abilityToModify, Ability source, Game game) { GaviNestWardenWatcher watcher = game.getState().getWatcher(GaviNestWardenWatcher.class); return abilityToModify instanceof CyclingAbility && watcher != null && watcher.cyclingActivationsThisTurn(abilityToModify.getControllerId()) == 0 && abilityToModify.getControllerId().equals(source.getControllerId()); }
Source:
public void shouldExecuteTestMethodsSuccessfully() { projectExplorer.openItemByPath(PATH_TO_ANOTHER_TEST_CLASS); editor.waitActive(); editor.goToCursorPositionVisible(25, 17); menu.runCommand(RUN_MENU, TEST, TEST_NG_TEST_DROP_DAWN_ITEM); notifications.waitExpectedMessageOnProgressPanelAndClosed("Test runner executed successfully."); pluginConsole.waitMethodMarkedAsPassed("shouldSuccessOfAppAnother"); assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(PASSED).size() == 1); editor.goToCursorPositionVisible(30, 17); menu.runCommand(RUN_MENU, TEST, TEST_NG_TEST_DROP_DAWN_ITEM); try { pluginConsole.waitMethodMarkedAsFailed("shouldFailOfAppAnother"); } catch (TimeoutException ex) { fail("Known issue <LINK_0>"); } assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(FAILED).size() == 1); String testErrorMessage = pluginConsole.getTestErrorMessage(); assertTrue( testErrorMessage.startsWith(APP_TEST_ANOTHER_FAIL_OUTPUT_TEMPLATE), "Actual message was: " + testErrorMessage); assertTrue( testErrorMessage.endsWith(END_OF_FAILED_TEST), "Actual message was: " + testErrorMessage); }

Target:
public void shouldExecuteTestMethodsSuccessfully() { projectExplorer.openItemByPath(PATH_TO_ANOTHER_TEST_CLASS); editor.waitActive(); editor.goToCursorPositionVisible(25, 17); menu.runCommand(RUN_MENU, TEST, TEST_NG_TEST_DROP_DAWN_ITEM); notifications.waitExpectedMessageOnProgressPanelAndClosed("Test runner executed successfully."); pluginConsole.waitMethodMarkedAsPassed("shouldSuccessOfAppAnother"); assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(PASSED).size() == 1); editor.goToCursorPositionVisible(30, 17); menu.runCommand(RUN_MENU, TEST, TEST_NG_TEST_DROP_DAWN_ITEM); try { pluginConsole.waitMethodMarkedAsFailed("shouldFailOfAppAnother"); } catch (TimeoutException ex) { fail("Known issue <LINK_0>", ex); } assertTrue(pluginConsole.getAllNamesOfMethodsMarkedDefinedStatus(FAILED).size() == 1); String testErrorMessage = pluginConsole.getTestErrorMessage(); assertTrue( testErrorMessage.startsWith(APP_TEST_ANOTHER_FAIL_OUTPUT_TEMPLATE), "Actual message was: " + testErrorMessage); assertTrue( testErrorMessage.endsWith(END_OF_FAILED_TEST), "Actual message was: " + testErrorMessage); }
Source:
public void endWindow() { super.endWindow(); if (responseCounterForThisWindow < requestCounterForThisWindow) { LOG.info("Detected stragglers and configured flag/state for blocking at end of window is " + blockAtEndOfWindowForStragglers); if (blockAtEndOfWindowForStragglers) { while (responseCounterForThisWindow < requestCounterForThisWindow) { LOG.debug("Trying to emit all stragglers before the next window can be processed"); emitStragglers(); } } } }

Target:
public void endWindow() { super.endWindow(); if (responseCounterForThisWindow < requestCounterForThisWindow) { LOG.debug("Detected stragglers and configured flag/state for blocking at end of window is " + blockAtEndOfWindowForStragglers); if (blockAtEndOfWindowForStragglers) { LOG.debug("Trying to emit all stragglers before the next window can be processed"); while (responseCounterForThisWindow < requestCounterForThisWindow) { emitStragglers(); try { Thread.sleep(50); } catch (InterruptedException e) { LOG.debug("Thread interrupted while trying to emit all stragglers"); throw new RuntimeException(e); } } } } }
Source:
public void testGetVariableListOutputBusinessRule() { when(definition.getDefinition()).thenReturn(businessRuleTask); Collection<String> delete = bpmnProcessVariableDeleteHandler.delete(graphInstance.graph, VARIABLE_ID_OUTPUT); assertTrue(delete.size() == 1); }

Target:
public void testGetVariableListOutputBusinessRule() { when(definition.getDefinition()).thenReturn(businessRuleTask); boolean isVariableBound = bpmnProcessVariableDeleteHandler.isVariableBoundToNodes(graphInstance.graph, VARIABLE_ID_OUTPUT); assertTrue(isVariableBound); }
Source:
private void performActionForServicesOfServer() { List<String> serviceList = getServiceList(); VDSReturnValue returnValue = null; returnValue = runVdsCommand(VDSCommandType.ManageGlusterService, new GlusterServiceVDSParameters(serverId, serviceList, actionType)); setSucceeded(returnValue.getSucceeded()); if (!getSucceeded()) { handleVdsError(manageActionDetailsMap.get(getParameters().getActionType()).getActionFailedActionLog(), returnValue.getVdsError().getMessage()); } else { updateService(serverId, (List<GlusterServerService>) returnValue.getReturnValue()); } }

Target:
private void performActionForServicesOfServer() { List<String> serviceList = getServiceList(); VDSReturnValue returnValue = null; returnValue = runVdsCommand(VDSCommandType.ManageGlusterService, new GlusterServiceVDSParameters(serverId, serviceList, actionType)); setSucceeded(returnValue.getSucceeded()); if (!getSucceeded()) { handleVdsError(getAuditLogTypeValue(), returnValue.getVdsError().getMessage()); } else { updateService(serverId, (List<GlusterServerService>) returnValue.getReturnValue()); } }
Source:
public RemoveMemoryVolumesParameters() { this.memoryVolumes = ""; this.vmId = Guid.Empty; this.forceRemove = false; }

Target:
public RemoveMemoryVolumesParameters() { this.memoryVolumes = ""; this.vmId = Guid.Empty; }
Source:
private String charsetFix(String s) { if (s != null && !enc.canEncode(s)) { return new String(s.getBytes(Charsets.UTF_8), Charsets.UTF_8); } else { return s; } }

Target:
private String charsetFix(String s) { if (s != null && !enc.canEncode(s)) { return StringUtils.fromUtf8(StringUtils.toUtf8(s)); } else { return s; } }
Source:
public Object readResolve() throws ObjectStreamException { try { Constructor<? extends SerializableObject> constructor = this.getClass().getConstructor(this.getClass()); try { constructor.setAccessible(true); } catch (SecurityException ex) { logger.warn("Accessing copy constructor failed.", constructor, ex); } try { return constructor.newInstance(this); } catch (InstantiationException ex) { throw new RuntimeException("Instantiation using copy constructor failed!", ex); } catch (IllegalAccessException ex) { throw new RuntimeException("Instantiation using copy constructor failed!", ex); } catch (IllegalArgumentException ex) { throw new RuntimeException("Instantiation using copy constructor failed!", ex); } catch (InvocationTargetException ex) { throw new RuntimeException("Instantiation using copy constructor failed!", ex); } } catch (NoSuchMethodException snme) { logger.debug("No copy constructor detected for class {}, trying default constructor.", this.getClass().getSimpleName()); try { SerializableObject newInstance = this.getClass().newInstance(); transferStateTo(newInstance); return newInstance; } catch (IllegalAccessException ex) { throw new RuntimeException("Deserialization using default constructor failed!", ex); } catch (InstantiationException ex) { throw new RuntimeException("Deserialization using default constructor failed!", ex); } } }

Target:
public Object readResolve() throws ObjectStreamException { try { Constructor<? extends SerializableObject> constructor = this.getClass().getConstructor(this.getClass()); try { constructor.setAccessible(true); } catch (SecurityException ex) { logger.warn("Accessing copy constructor failed.", constructor, ex); } try { return constructor.newInstance(this); } catch (ReflectiveOperationException | IllegalArgumentException ex) { throw new RuntimeException("Instantiation using copy constructor failed!", ex); } } catch (NoSuchMethodException snme) { logger.debug("No copy constructor detected for class {}, trying default constructor.", this.getClass().getSimpleName()); try { SerializableObject newInstance = this.getClass().newInstance(); transferStateTo(newInstance); return newInstance; } catch (ReflectiveOperationException ex) { throw new RuntimeException("Deserialization using default constructor failed!", ex); } } }
Source:
public static void reportPrivilegeEnabled(String privilegeName, String username) { reportEvent(GoogleAnalyticsFields.CATEGORY_PRIVILEGE_ENABLED, privilegeName, Base64.encode(username.getBytes())); }

Target:
public static void reportPrivilegeEnabled(String privilegeName, String username) { reportEvent(GoogleAnalyticsFields.CATEGORY_PRIVILEGE_ENABLED, privilegeName, EncryptionUtils.getMD5HashAsString(username)); }
Source:
public SiteMapTreeCellRenderer(List<SiteMapListener> listeners) { this.listeners = listeners; this.component = new JPanel(); }

Target:
public SiteMapTreeCellRenderer(List<SiteMapListener> listeners) { this.listeners = listeners; this.component = new JPanel(new FlowLayout(FlowLayout.CENTER, 4, 2)); component.setOpaque(false); this.putClientProperty("html.disable", Boolean.TRUE); }
Source:
private ComponentImplementation getComponentImplFromString(String qualifiedName) { IResourceDescriptions resourceDescriptions = resourceDescriptionsProvider .getResourceDescriptions(OsateResourceUtil.getResourceSet()); for (IEObjectDescription eobjDesc : resourceDescriptions .getExportedObjectsByType( Aadl2Package.eINSTANCE.getComponentImplementation())) { if (eobjDesc.getName().toString("::").equalsIgnoreCase(qualifiedName)) { EObject res = eobjDesc.getEObjectOrProxy(); res = EcoreUtil.resolve(res, OsateResourceUtil.getResourceSet()); if (!Aadl2Util.isNull(res)) { return (ComponentImplementation) res; } } } throw new TcgException("Error: test suite implementation under test: [" + qualifiedName + "] does not correspond to any " + "system implementation in the workspace.\n"); }

Target:
private ComponentImplementation getComponentImplFromString(String qualifiedName) { IResourceDescriptions resourceDescriptions = resourceDescriptionsProvider .getResourceDescriptions(new XtextResourceSet()); for (IEObjectDescription eobjDesc : resourceDescriptions .getExportedObjectsByType( Aadl2Package.eINSTANCE.getComponentImplementation())) { if (eobjDesc.getName().toString("::").equalsIgnoreCase(qualifiedName)) { EObject res = eobjDesc.getEObjectOrProxy(); res = EcoreUtil.resolve(res, new XtextResourceSet()); if (!Aadl2Util.isNull(res)) { return (ComponentImplementation) res; } } } throw new TcgException("Error: test suite implementation under test: [" + qualifiedName + "] does not correspond to any " + "system implementation in the workspace.\n"); }
Source:
public static List<BlockFace> calculateConnections(GlowBlock block) { List<BlockFace> value = new ArrayList<>(); List<BlockFace> connections = new ArrayList<>(); value.add(BlockFace.DOWN); for (BlockFace face : SIDES) { GlowBlock target = block.getRelative(face); switch (target.getType()) { case REDSTONE_BLOCK: case REDSTONE_TORCH_ON: case REDSTONE_TORCH_OFF: case REDSTONE_WIRE: connections.add(face); break; default: if (target.getType().isSolid() && !block.getRelative(BlockFace.UP).getType().isSolid() && target.getRelative(BlockFace.UP).getType() == Material.REDSTONE_WIRE) { connections.add(face); } else if (!target.getType().isSolid() && target.getRelative(BlockFace.DOWN).getType() == Material.REDSTONE_WIRE) { connections.add(face); } break; } } if (connections.isEmpty()) { value.addAll(Arrays.asList(SIDES)); } else { value.addAll(connections); if (connections.size() == 1) { value.add(connections.get(0).getOppositeFace()); } } return value; }

Target:
public static List<BlockFace> calculateConnections(GlowBlock block) { List<BlockFace> value = new ArrayList<>(); List<BlockFace> connections = new ArrayList<>(); value.add(BlockFace.DOWN); for (BlockFace face : SIDES) { GlowBlock target = block.getRelative(face); switch (target.getType()) { case DIODE_BLOCK_ON: case DIODE_BLOCK_OFF: Diode diode = (Diode) target.getState().getData(); if (face == diode.getFacing() || face == diode.getFacing().getOppositeFace()) { connections.add(face); } break; case REDSTONE_BLOCK: case REDSTONE_TORCH_ON: case REDSTONE_TORCH_OFF: case REDSTONE_WIRE: case WOOD_BUTTON: case STONE_BUTTON: case LEVER: connections.add(face); break; default: if (target.getType().isSolid() && !block.getRelative(BlockFace.UP).getType().isSolid() && target.getRelative(BlockFace.UP).getType() == Material.REDSTONE_WIRE) { connections.add(face); } else if (!target.getType().isSolid() && target.getRelative(BlockFace.DOWN).getType() == Material.REDSTONE_WIRE) { connections.add(face); } break; } } if (connections.isEmpty()) { value.addAll(Arrays.asList(SIDES)); } else { value.addAll(connections); if (connections.size() == 1) { value.add(connections.get(0).getOppositeFace()); } } return value; }
Source:
private List<Disk> getDiskCandidatesForPartition(int replicaCountPerDatacenter, long replicaCapacityInBytes, Datacenter datacenter, boolean rackAware) { ArrayList<Disk> disksToAllocate = new ArrayList<Disk>(); Set<DataNode> nodesToExclude = new HashSet<>(); List<DataNode> dataNodes = new ArrayList<>(datacenter.getDataNodes()); for (int i = 0; i < replicaCountPerDatacenter; i++) { Disk diskCandidate = getBestDiskCandidate(dataNodes, nodesToExclude, replicaCapacityInBytes, rackAware, NUM_CHOICES); if (diskCandidate != null) { disksToAllocate.add(diskCandidate); nodesToExclude.add(diskCandidate.getDataNode()); } else { break; } } return disksToAllocate; }

Target:
private List<Disk> getDiskCandidatesForPartition(int replicaCountPerDatacenter, long replicaCapacityInBytes, Datacenter datacenter, boolean rackAware) { ArrayList<Disk> disksToAllocate = new ArrayList<Disk>(); Set<DataNode> nodesToExclude = new HashSet<>(); List<DataNode> dataNodes = new ArrayList<>(datacenter.getDataNodes()); for (int i = 0; i < replicaCountPerDatacenter; i++) { Disk bestDisk = getBestDiskCandidate(dataNodes, nodesToExclude, replicaCapacityInBytes, rackAware, NUM_CHOICES); if (bestDisk != null) { disksToAllocate.add(bestDisk); nodesToExclude.add(bestDisk.getDataNode()); } else { break; } } return disksToAllocate; }
Source:
public void runSample() { List<LoadBalancerMetadata> loadBalancerMetadataList = searchLoadBalancers( new LoadBalancerFilter().dataCenters(DataCenter.US_EAST_STERLING) ); assertEquals(loadBalancerMetadataList.size(), 0); LoadBalancer loadBalancer1 = createLoadBalancer("LB1"); LoadBalancer loadBalancer2 = createLoadBalancer("LB2"); LoadBalancerMetadata loadBalancer1Metadata = fetchLoadBalancerMetadata(loadBalancer1); LoadBalancerMetadata loadBalancer2Metadata = fetchLoadBalancerMetadata(loadBalancer2); assertNotNull(loadBalancer1Metadata); assertNotNull(loadBalancer2Metadata); loadBalancerMetadataList = searchLoadBalancers( new LoadBalancerFilter().dataCenters(DataCenter.US_EAST_STERLING) ); assertEquals(loadBalancerMetadataList.size(), 2); LoadBalancerPool pool1 = createLoadBalancerPool(loadBalancer1, 80); LoadBalancerPool pool2 = createLoadBalancerPool(loadBalancer1, 443); LoadBalancerPoolMetadata pool1Metadata = fetchLoadBalancerPoolMetadata(pool1); LoadBalancerPoolMetadata pool2Metadata = fetchLoadBalancerPoolMetadata(pool2); assertNotNull(pool1Metadata); assertNotNull(pool2Metadata); assertEquals(pool1Metadata.getPort(), Integer.valueOf(80)); assertEquals(pool2Metadata.getPort(), Integer.valueOf(443)); assertEquals(pool1Metadata.getNodes().size(), 0); setLoadBalancerNodes(pool1, composeNodeList()); pool1Metadata = loadBalancerPoolService.findByRef(pool1); assertEquals(pool1Metadata.getNodes().size(), 2); }

Target:
public void runSample() { List<LoadBalancerMetadata> loadBalancerMetadataList = searchLoadBalancers( new LoadBalancerFilter().dataCenters(DataCenter.US_EAST_STERLING) ); assertEquals(loadBalancerMetadataList.size(), 0); LoadBalancer loadBalancer1 = createLoadBalancer("LB1"); LoadBalancer loadBalancer2 = createLoadBalancer("LB2"); LoadBalancerMetadata loadBalancer1Metadata = fetchLoadBalancerMetadata(loadBalancer1); LoadBalancerMetadata loadBalancer2Metadata = fetchLoadBalancerMetadata(loadBalancer2); assertNotNull(loadBalancer1Metadata); assertNotNull(loadBalancer2Metadata); loadBalancerMetadataList = searchLoadBalancers( new LoadBalancerFilter().dataCenters(DataCenter.US_EAST_STERLING) ); assertEquals(loadBalancerMetadataList.size(), 2); LoadBalancerPool pool1 = createLoadBalancerPool(loadBalancer1, 80); LoadBalancerPool pool2 = createLoadBalancerPool(loadBalancer1, 443); LoadBalancerPoolMetadata pool1Metadata = fetchLoadBalancerPoolMetadata(pool1); LoadBalancerPoolMetadata pool2Metadata = fetchLoadBalancerPoolMetadata(pool2); assertNotNull(pool1Metadata); assertNotNull(pool2Metadata); assertEquals(pool1Metadata.getPort(), Integer.valueOf(80)); assertEquals(pool2Metadata.getPort(), Integer.valueOf(443)); assertEquals(pool1Metadata.getNodes().size(), 0); setLoadBalancerNodes(pool1, composeNodeList()); pool1Metadata = fetchLoadBalancerPoolMetadata(pool1); assertEquals(pool1Metadata.getNodes().size(), 2); }
Source:
public Response getClusterFaultZoneMap(@PathParam("clusterId") String clusterId) { HelixAdmin admin = getHelixAdmin(); Map<String, List<String>> topologyMap = admin.getClusterTopology(clusterId).getTopologyMap(); return JSONRepresentation(topologyMap); }

Target:
public Response getClusterFaultZoneMap(@PathParam("clusterId") String clusterId) { HelixAdmin admin = getHelixAdmin(); Map<String, List<String>> faultZoneMap; try { faultZoneMap = admin.getClusterTopology(clusterId).getFaultZoneMap(); } catch (HelixException ex) { return badRequest(ex.getMessage()); } return JSONRepresentation(faultZoneMap); }
Source:
private Object resolveParameter(Annotation[] parmAnnos, Class<?> paramType, String parameterName, int index) { Object val = null; boolean hitResolver = false; Default defAnno = null; for (Annotation anno : parmAnnos) { Class<?> annotype = anno.annotationType(); if (defAnno == null && annotype.equals(Default.class)) { defAnno = (Default) anno; continue; } ParamResolver<Annotation> resolver = _paramResolvers.get(annotype); if (resolver == null) continue; hitResolver = true; val = resolver.resolveParameter(anno, paramType, parameterName); if (val != null) { break; } } if (val == null && defAnno != null) { val = Classes.coerce(paramType, defAnno.value()); } if (_mappingType && val == null && !hitResolver && _types != null) { for (Type type : _types) { if (type != null && paramType.isAssignableFrom(type.clz)) { val = type.value; break; } } } if (val == null && _bindingArgs != null && index < _bindingArgs.size()) { int argIndex = 0; for (Map.Entry<String, Object> entry : _bindingArgs.entrySet()) { if (argIndex == index && !entry.getKey().startsWith(Parser.SIMPLIFIED_COMMAND_PARAM_PREFIX)) return null; argIndex++; } val = resolvePositionalParameter(paramType, index); } return val; }

Target:
private Object resolveParameter(Annotation[] parmAnnos, Class<?> paramType, String parameterName, int index) { Object val = null; boolean hitResolver = false; Default defAnno = null; for (Annotation anno : parmAnnos) { Class<?> annotype = anno.annotationType(); if (defAnno == null && annotype.equals(Default.class)) { defAnno = (Default) anno; continue; } ParamResolver<Annotation> resolver = _paramResolvers.get(annotype); if (resolver == null) continue; hitResolver = true; val = resolver.resolveParameter(anno, paramType, parameterName); if (val != null) { break; } } if (val == null && defAnno != null) { val = Classes.coerce(paramType, defAnno.value()); } if (_mappingType && val == null && !hitResolver && _types != null) { for (Type type : _types) { if (type != null && paramType.isAssignableFrom(type.clz)) { val = type.value; break; } } } if (val == null) val = resolvePositionalParameter(paramType, index); return val; }
Source:
private boolean hasFailed() { return totalReplicaCount - failedCount < successTarget; }

Target:
private boolean hasFailed() { return (totalReplicaCount - failedCount ) < successTarget; }
Source:
public void handlesToken() throws Exception { final MkBase base = new MkBase(); final String urn = "urn:test:5"; final User user = base.user(new URN(urn)); user.aliases().add("Jane"); final String[] msgs = { "Hello World", "I shouldn't be created as new", "I should be created as new", "I am new too", "Another new", }; final String[] tokens = { "13579", "13579", "24680", "", "", }; final long[] loc = new long[msgs.length]; for (int count = 0; count < msgs.length; count += 1) { final String head = new RsPrint( new TkForward(new TkStart(base)).act( new RqWithAuth( urn, new RqFake( RqMethod.GET, String.format( "/start?post=%s&token=%s", URLEncoder.encode( msgs[count], CharEncoding.UTF_8 ), URLEncoder.encode( tokens[count], CharEncoding.UTF_8 ) ) ) ) ) ).printHead(); final Matcher matcher = TkStartTest.LOCATION.matcher(head); MatcherAssert.assertThat( "Found matching location header", matcher.find() ); user.aliases().iterate().iterator().next().inbox() .bout(Long.parseLong(matcher.group(1))); loc[count] = Long.parseLong(matcher.group(1)); } MatcherAssert.assertThat(loc[0], Matchers.equalTo(loc[1])); MatcherAssert.assertThat(loc[0], Matchers.not(loc[2])); MatcherAssert.assertThat(loc[0], Matchers.not(loc[3])); MatcherAssert.assertThat(loc[2], Matchers.not(loc[3])); MatcherAssert.assertThat(loc[3], Matchers.not(loc[4])); }

Target:
public void handlesToken() throws Exception { final MkBase base = new MkBase(); final String urn = "urn:test:5"; final User user = base.user(new URN(urn)); user.aliases().add("Jane"); final String[] msgs = { "Hello World", "I shouldn't be created as new", "I should be created as new", "I am new too", "Another new", }; final String same = "13579"; final String[] tokens = { same, same, "24680", "", "", }; final long[] loc = new long[msgs.length]; for (int count = 0; count < msgs.length; count += 1) { final String head = new RsPrint( new TkForward(new TkStart(base)).act( new RqWithAuth( urn, new RqFake( RqMethod.GET, String.format( "/start?post=%s&token=%s", URLEncoder.encode( msgs[count], StandardCharsets.UTF_8.name() ), URLEncoder.encode( tokens[count], StandardCharsets.UTF_8.name() ) ) ) ) ) ).printHead(); final Matcher matcher = TkStartTest.LOCATION.matcher(head); MatcherAssert.assertThat( "Found matching location header", matcher.find() ); user.aliases().iterate().iterator().next().inbox() .bout(Long.parseLong(matcher.group(1))); loc[count] = Long.parseLong(matcher.group(1)); } MatcherAssert.assertThat(loc[0], Matchers.equalTo(loc[1])); MatcherAssert.assertThat(loc[0], Matchers.not(loc[2])); MatcherAssert.assertThat(loc[0], Matchers.not(loc[3])); MatcherAssert.assertThat(loc[2], Matchers.not(loc[3])); MatcherAssert.assertThat(loc[3], Matchers.not(loc[4])); }