auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void runTestWithRenderDelay(final Duration renderDelay) throws Exception { final Config config = CHROME_RENDERER_CONFIG; final MockRenderedReportBuilder builder = Mockito.mock(MockRenderedReportBuilder.class); _wireMock.givenThat( get(urlEqualTo("/")) .willReturn(aResponse() .withHeader("Content-Type", "text/html") .withBody(Utils.mockGrafanaReportPanelPage(renderDelay)) ) ); final HtmlReportFormat format = new HtmlReportFormat.Builder().build(); final HtmlGrafanaScreenshotRenderer renderer = new HtmlGrafanaScreenshotRenderer(config, new ScheduledThreadPoolExecutor(1)); final GrafanaReportPanelReportSource source = new GrafanaReportPanelReportSource.Builder() .setWebPageReportSource( TestBeanFactory.createWebPageReportSourceBuilder() .setUri(URI.create("http://localhost:" + _wireMock.port())) .build()) .build(); final CompletionStage<MockRenderedReportBuilder> stage = renderer.render( source, format, new TimeRange(Instant.EPOCH, Instant.EPOCH), builder, Duration.ofSeconds(15) ); stage.toCompletableFuture().get(20, TimeUnit.SECONDS); final ArgumentCaptor<byte[]> bytes = ArgumentCaptor.forClass(byte[].class); Mockito.verify(builder).setBytes(bytes.capture()); final String response = Strings.stringFromBytes(bytes.getValue(), StandardCharsets.UTF_8); assertEquals(response, "content we care about"); }

Target:
private void runTestWithRenderDelay(final Duration renderDelay) throws Exception { final Config config = CHROME_RENDERER_CONFIG; final MockRenderedReportBuilder builder = Mockito.mock(MockRenderedReportBuilder.class); _wireMock.givenThat( get(urlEqualTo("/")) .willReturn(aResponse() .withHeader("Content-Type", "text/html") .withBody(Utils.mockGrafanaReportPanelPage(renderDelay)) ) ); final HtmlReportFormat format = new HtmlReportFormat.Builder().build(); final HtmlGrafanaScreenshotRenderer renderer = new HtmlGrafanaScreenshotRenderer(config, new ScheduledThreadPoolExecutor(1)); final GrafanaReportPanelReportSource source = new GrafanaReportPanelReportSource.Builder() .setWebPageReportSource( TestBeanFactory.createWebPageReportSourceBuilder() .setUri(URI.create("http://localhost:" + _wireMock.port())) .build()) .build(); final CompletionStage<MockRenderedReportBuilder> stage = renderer.render( source, format, DEFAULT_TIME_RANGE, builder, DEFAULT_TIMEOUT ); stage.toCompletableFuture().get(); final ArgumentCaptor<byte[]> bytes = ArgumentCaptor.forClass(byte[].class); Mockito.verify(builder).setBytes(bytes.capture()); final String response = Strings.stringFromBytes(bytes.getValue(), StandardCharsets.UTF_8); assertEquals(response, "content we care about"); }
Source:
int instanceCacheResizeCount() { Object instanceCache = ReflectionUtil .getValue(this, "instanceCache"); return (int) ReflectionUtil .getValue(instanceCache, "resizeCount"); }

Target:
int instanceCacheResizeCount() { Object instanceCache = ReflectionUtil .getValue(this, "instanceCache"); final Object[] keys = (Object[]) ReflectionUtil .getValue(instanceCache, "keys"); return keys.length; }
Source:
public String getText(Object element) { if (element instanceof Report<?>) { return ((Report<?>) element).getTaskName(); } else if (element instanceof ReportSession) { long id = ((ReportSession) element).getId(); if (id == 0) { return "Import"; } return df.format(new Date(id)); } return "Unhandled type"; }

Target:
public String getText(Object element) { if (element instanceof Report<?>) { return ((Report<?>) element).getTaskName(); } else if (element instanceof ReportSession) { long id = ((ReportSession) element).getId(); if (id == ReportReader.UNKNOWN_SESSION) { return "Import"; } return df.format(new Date(id)); } return "Unhandled type"; }
Source:
private BuddyDto getBuddy(Buddy buddyEntity) { if (canIncludePrivateData(buddyEntity)) { return BuddyDto.createInstance(buddyEntity); } return BuddyDto.createInstance(buddyEntity); }

Target:
private BuddyDto getBuddy(Buddy buddyEntity) { return BuddyDto.createInstance(buddyEntity); }
Source:
public static void logCredInformation(Credentials credentials2) { LOG.info("credentials:" + credentials2); for (int i =0 ; i < credentials2.getAllSecretKeys().size(); i++) { LOG.info("getAllSecretKeys:" + i + ":" + credentials2.getAllSecretKeys().get(i)); } Iterator it = credentials2.getAllTokens().iterator(); while (it.hasNext()) { LOG.info("getAllTokens:" + it.next()); } }

Target:
public static void logCredInformation(Credentials credentials2) { if (LOG.isDebugEnabled()) { LOG.debug("credentials:" + credentials2); for (int i = 0; i < credentials2.getAllSecretKeys().size(); i++) { LOG.debug("getAllSecretKeys:" + i + ":" + credentials2.getAllSecretKeys().get(i)); } Iterator it = credentials2.getAllTokens().iterator(); while (it.hasNext()) { LOG.debug("getAllTokens:" + it.next()); } } }
Source:
public void initialize() { this.view.init(this); newFileUploader.acceptContext(new Callback<Boolean, Void>() { @Override public void onFailure(Void reason) { } @Override public void onSuccess(Boolean result) { view.enableImportButton(); } }); }

Target:
public void initialize() { this.view.init(this); this.enableButtons(canUpdateProject()); newFileUploader.acceptContext(new Callback<Boolean, Void>() { @Override public void onFailure(Void reason) { view.enableImportButton(false); } @Override public void onSuccess(Boolean result) { view.enableImportButton(result); } }); }
Source:
public Object execute(ExecutionEvent event) throws ExecutionException { List<RepositoryTreeNode> nodes = getSelectedNodes(); Ref ref1 = getRef(nodes.get(0)); Ref ref2 = getRef(nodes.get(1)); if (ref1 != null && ref2 != null) { Repository repo = (nodes.get(0).getRepository()); try { RevCommit commit1 = repo.parseCommit(ref1.getObjectId()); RevCommit commit2 = repo.parseCommit(ref2.getObjectId()); if (commit1.getCommitTime() <= commit2.getCommitTime()) { compare(event, repo, commit1.getName(), commit2.getName()); } else { compare(event, repo, commit2.getName(), commit1.getName()); } } catch (IOException e) { throw new ExecutionException(e.getMessage(), e); } } return null; }

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { List<RepositoryTreeNode> nodes = getSelectedNodes(); Ref ref1 = getRef(nodes.get(0)); Ref ref2 = getRef(nodes.get(1)); if (ref1 != null && ref2 != null) { Repository repo = (nodes.get(0).getRepository()); IWorkbenchPage workbenchPage = HandlerUtil .getActiveWorkbenchWindowChecked(event).getActivePage(); try { RevCommit a = repo.parseCommit(ref1.getObjectId()); RevCommit b = repo.parseCommit(ref2.getObjectId()); if (a.getCommitTime() <= b.getCommitTime()) { compare(workbenchPage, repo, b.getName(), a.getName()); } else { compare(workbenchPage, repo, a.getName(), b.getName()); } } catch (IOException e) { throw new ExecutionException(e.getLocalizedMessage(), e); } } return null; }
Source:
public void shouldConfigureInsertOptions() { Instant now = LocalDateTime.now().toInstant(ZoneOffset.UTC); InsertOptions insertOptions = InsertOptions.builder() .ttl(10) .timestamp(now) .withIfNotExists() .build(); assertThat(insertOptions.getTtl()).isEqualTo(Duration.ofSeconds(10)); assertThat(insertOptions.getTimestamp() == now.toEpochMilli() * 1000); assertThat(insertOptions.isIfNotExists()).isTrue(); }

Target:
public void shouldConfigureInsertOptions() { Instant now = LocalDateTime.now().toInstant(ZoneOffset.UTC); InsertOptions insertOptions = InsertOptions.builder() .ttl(10) .timestamp(now) .withIfNotExists() .build(); assertThat(insertOptions.getTtl()).isEqualTo(Duration.ofSeconds(10)); assertThat(insertOptions.getTimestamp()).isEqualTo(now.toEpochMilli() * 1000); assertThat(insertOptions.isIfNotExists()).isTrue(); }
Source:
public void reIndex() { driver.findElement(by.xpath(" driver.findElement(by.xpath(" }

Target:
public void reIndex() { final List<WebElement> scanRepoNow = driver.findElements(by.xpath(" if (scanRepoNow.size() > 0) { scanRepoNow.get(0).click(); } else { find(by.xpath(" find(by.xpath(" } }
Source:
private void execute(ApacheHttpRequest request) throws Exception { byte[] bytes = StringUtils.getBytesUtf8("abc"); request.setStreamingContent(new ByteArrayStreamingContent(bytes)); request.setContentType("text/html"); request.setContentLength(bytes.length); request.execute(); }

Target:
private void execute(ApacheHttpRequest request) throws IOException { byte[] bytes = "abc".getBytes(StandardCharsets.UTF_8); request.setStreamingContent(new ByteArrayStreamingContent(bytes)); request.setContentType("text/html"); request.setContentLength(bytes.length); request.execute(); }
Source:
public void createControl(Composite parent, FormToolkit toolkit) { super.createControl(parent, toolkit, (isMultiSelect && !isMultiSingleLineSelect ? SWT.WRAP : SWT.NONE)); if (!isReadOnly() && isMultiSelect) { getText().setToolTipText("Separate multiple values with a comma"); } }

Target:
public void createControl(Composite parent, FormToolkit toolkit) { super.createControl(parent, toolkit, (getLayoutHint().rowSpan == RowSpan.MULTIPLE ? SWT.WRAP : SWT.NONE)); if (!isReadOnly() && isMultiSelect) { getText().setToolTipText("Separate multiple values with a comma"); } }
Source:
private void buildApiConfigTest() throws UserStoreException { PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain("test"); ServletContext servletContext = new MockServletContext(); APIResourceConfiguration apiDef = new APIResourceConfiguration(); List<APIResource> resources = new ArrayList<>(); apiDef.setResources(resources); APIConfig apiConfig = buildApiConfig(servletContext, apiDef); Assert.assertNotNull(apiConfig, "API configuration is null."); }

Target:
private void buildApiConfigTest() throws UserStoreException, RegistryException { try { startTenantFlowAsTestTenant(); ServletContext servletContext = new MockServletContext(); APIResourceConfiguration apiDef = new APIResourceConfiguration(); List<APIResource> resources = new ArrayList<>(); apiDef.setResources(resources); APIConfig apiConfig = buildApiConfig(servletContext, apiDef); Assert.assertNotNull(apiConfig, "API configuration is null."); } finally { PrivilegedCarbonContext.endTenantFlow(); } }
Source:
public Emailer(Props props) { super(props); this.azkabanName = props.getString("azkaban.name", "azkaban"); this.mailHost = props.getString("mail.host", "localhost"); this.mailUser = props.getString("mail.user", ""); this.mailPassword = props.getString("mail.password", ""); this.mailSender = props.getString("mail.sender", ""); this.tls = props.getString("mail.tls", "false"); this.usesAuth = props.getBoolean("mail.useAuth", true); int mailTimeout = props.getInt("mail.timeout.millis", 10000); EmailMessage.setTimeout(mailTimeout); int connectionTimeout = props.getInt("mail.connection.timeout.millis", 10000); EmailMessage.setConnectionTimeout(connectionTimeout); this.clientHostname = props.getString("jetty.hostname", "localhost"); if (props.getBoolean("jetty.use.ssl", true)) { this.scheme = HTTPS; this.clientPortNumber = props.getString("jetty.ssl.port"); } else { this.scheme = HTTP; this.clientPortNumber = props.getString("jetty.port"); } testMode = props.getBoolean("test.mode", false); }

Target:
public Emailer(Props props) { super(props); this.azkabanName = props.getString("azkaban.name", "azkaban"); this.mailHost = props.getString("mail.host", "localhost"); this.mailUser = props.getString("mail.user", ""); this.mailPassword = props.getString("mail.password", ""); this.mailSender = props.getString("mail.sender", ""); this.tls = props.getString("mail.tls", "false"); int mailTimeout = props.getInt("mail.timeout.millis", 10000); EmailMessage.setTimeout(mailTimeout); int connectionTimeout = props.getInt("mail.connection.timeout.millis", 10000); EmailMessage.setConnectionTimeout(connectionTimeout); this.clientHostname = props.getString("jetty.hostname", "localhost"); if (props.getBoolean("jetty.use.ssl", true)) { this.scheme = HTTPS; this.clientPortNumber = props.getString("jetty.ssl.port"); } else { this.scheme = HTTP; this.clientPortNumber = props.getString("jetty.port"); } testMode = props.getBoolean("test.mode", false); }
Source:
public void setData(HistogramBucket[] buckets, long[] lostEvents, long startTime, long duration) { if (buckets.length != fNbBuckets) { throw new IllegalArgumentException(); } fNbEvents = 0; for (int i = 0; i < buckets.length; i++) { fBuckets[i] = buckets[i]; fNbEvents += buckets[i].getNbEvents(); } if (lostEvents != null) { for (int i = 0; i < lostEvents.length; i++) { fLostEventsBuckets[i] = lostEvents[i]; } } fFirstBucketTime = startTime; fFirstEventTime = startTime; fBucketDuration = duration; fLastBucket = buckets.length - 1; fEndTime = fFirstBucketTime + fLastBucket * fBucketDuration; fireModelUpdateNotification(); }

Target:
public void setData(HistogramBucket[] buckets, long[] lostEvents, long startTime, long duration) { if (buckets.length != fNbBuckets) { throw new IllegalArgumentException("Wrong number of buckets, excepted " + fNbBuckets + " was " + buckets.length); } fNbEvents = 0; for (int i = 0; i < buckets.length; i++) { fBuckets[i] = buckets[i]; fNbEvents += buckets[i].getNbEvents(); } if (lostEvents != null) { Arrays.setAll(fLostEventsBuckets, i -> lostEvents[i]); } fFirstBucketTime = startTime; fFirstEventTime = startTime; fBucketDuration = duration; fLastBucket = buckets.length - 1; fEndTime = fFirstBucketTime + fLastBucket * fBucketDuration; fireModelUpdateNotification(); }
Source:
public static String execute(String str, Repository db) throws Exception { String[] args = str.split(" "); String[] argv = new String[args.length - 1]; System.arraycopy(args, 1, argv, 0, args.length - 1); CLIGitCommand bean = new CLIGitCommand(); final CmdLineParser clp = new CmdLineParser(bean); clp.parseArgument(argv); final TextBuiltin cmd = bean.getSubcommand(); if (cmd.requiresRepository()) cmd.init(db, null); else cmd.init(null, null); ByteArrayOutputStream baos = new ByteArrayOutputStream(); cmd.out = new PrintWriter(new BufferedWriter(new OutputStreamWriter( baos))); try { cmd.execute(bean.getArguments().toArray( new String[bean.getArguments().size()])); } finally { if (cmd.out != null) cmd.out.flush(); } return baos.toString(); }

Target:
public static String[] execute(String str, Repository db) throws Exception { String[] args = str.split(" "); String[] argv = new String[args.length - 1]; System.arraycopy(args, 1, argv, 0, args.length - 1); CLIGitCommand bean = new CLIGitCommand(); final CmdLineParser clp = new CmdLineParser(bean); clp.parseArgument(argv); final TextBuiltin cmd = bean.getSubcommand(); if (cmd.requiresRepository()) cmd.init(db, null); else cmd.init(null, null); ByteArrayOutputStream baos = new ByteArrayOutputStream(); cmd.out = new PrintWriter(new BufferedWriter(new OutputStreamWriter( baos))); try { cmd.execute(bean.getArguments().toArray( new String[bean.getArguments().size()])); } finally { if (cmd.out != null) cmd.out.flush(); } return IO.readLines(baos.toString()); }
Source:
public void onNext(final ContextStop contextStop) { LOG.log(Level.INFO, "Wait {0} milliseconds at maximum for the PS service to be closed", TIMEOUT_MS); try { parameterWorker.close(TIMEOUT_MS); LOG.info("Succeed to close PS worker cleanly"); } catch (InterruptedException | TimeoutException | ExecutionException e) { LOG.info("Fail to close PS worker cleanly"); } psNetworkSetup.unregisterConnectionFactory(); }

Target:
public void onNext(final ContextStop contextStop) { LOG.log(Level.FINE, "Wait {0} milliseconds at maximum for the PS service to be closed", TIMEOUT_MS); try { parameterWorker.close(TIMEOUT_MS); LOG.fine("Succeed to close PS worker cleanly"); } catch (InterruptedException | TimeoutException | ExecutionException e) { LOG.log(Level.INFO, "Fail to close PS worker cleanly", e); } psNetworkSetup.unregisterConnectionFactory(); }
Source:
ObjectRemoteQueryEngine(AdvancedCache<?, ?> cache, boolean isIndexed, Class<? extends Matcher> matcherImplClass) { super(cache, isIndexed, matcherImplClass); }

Target:
ObjectRemoteQueryEngine(AdvancedCache<?, ?> cache, boolean isIndexed, Class<? extends Matcher> matcherImplClass) { super(cache.getAdvancedCache().withEncoding(IdentityEncoder.class), isIndexed, matcherImplClass); }
Source:
public void registerSqlTypeToSqlTypeNameOverrides(Map<Integer, String> overrides) { overrides.put(4, "int4"); overrides.put(Types.VARCHAR, "VARCHAR"); overrides.put(Types.BOOLEAN, "BOOL"); overrides.put(Types.BLOB, "BYTEA"); }

Target:
public void registerSqlTypeToSqlTypeNameOverrides(Map<Integer, String> overrides) { overrides.put(Types.VARCHAR, "VARCHAR"); overrides.put(Types.BOOLEAN, "BOOL"); overrides.put(Types.BLOB, "BYTEA"); }
Source:
private WorkObject ingestFileObjectAsWork(ContentContainerObject parent, Resource parentResc, Resource childResc) throws DepositException { if (skipResumed(childResc)) { return null; } PID childPid = PIDs.get(childResc.getURI()); PID workPid = repository.mintContentPid(); Model workModel = ModelFactory.createDefaultModel(); String label = getPropertyValue(childResc, CdrDeposit.label); if (label == null) { label = getPropertyValue(childResc, CdrDeposit.stagingLocation); if (label == null) { throw new DepositException("No staging location provided for file object (" + childResc.getURI() + ")"); } label = new File(label).getName(); } Resource workResc = workModel.createResource(workPid.getRepositoryPath()); workResc.addProperty(DC.title, label); WorkObject newWork = null; FedoraTransaction tx = repository.startTransaction(); try { newWork = repository.createWorkObject(workPid, workModel); addDescription(newWork); FileObject fileObj = addFileToWork(newWork, childResc); addIngestionEventForContainer(newWork, parentResc); newWork.setPrimaryObject(childPid); parent.addMember(newWork); addClicks(1); addPremisEvents(fileObj); addPremisEvents(newWork); log.info("Created work for file object for deposit {}", new Object[] {workPid, childPid, getDepositPID()}); } catch(Exception e) { tx.cancel(e); } finally { tx.close(); } return newWork; }

Target:
private void ingestFileObjectAsWork(ContentContainerObject parent, Resource parentResc, Resource childResc) throws DepositException { if (skipResumed(childResc)) { return; } PID childPid = PIDs.get(childResc.getURI()); PID workPid = repository.mintContentPid(); Model workModel = ModelFactory.createDefaultModel(); String label = getPropertyValue(childResc, CdrDeposit.label); if (label == null) { label = getPropertyValue(childResc, CdrDeposit.stagingLocation); if (label == null) { throw new DepositException("No staging location provided for file object (" + childResc.getURI() + ")"); } label = new File(label).getName(); } Resource workResc = workModel.createResource(workPid.getRepositoryPath()); workResc.addProperty(DC.title, label); WorkObject newWork = null; FedoraTransaction tx = repository.startTransaction(); try { newWork = repository.createWorkObject(workPid, workModel); addDescription(newWork); parent.addMember(newWork); FileObject fileObj = addFileToWork(newWork, childResc); addIngestionEventForContainer(newWork, parentResc); newWork.setPrimaryObject(childPid); addClicks(1); addPremisEvents(fileObj); addPremisEvents(newWork); log.info("Created work for file object for deposit {}", new Object[] {workPid, childPid, getDepositPID()}); } catch(Exception e) { tx.cancel(e); } finally { tx.close(); } }
Source:
public static boolean compareSnmpV3UsersMap(Map<String, SnmpV3User> existingSnmpV3UserMap, Map<String, SnmpV3User> updatedSnmpV3Usermap) { if ((existingSnmpV3UserMap.isEmpty() && updatedSnmpV3Usermap.isEmpty()) || (!existingSnmpV3UserMap.isEmpty() && updatedSnmpV3Usermap.isEmpty())) { return false; } else if (existingSnmpV3UserMap.isEmpty() && !updatedSnmpV3Usermap.isEmpty()) { return true; } for (String securityName : existingSnmpV3UserMap.keySet()) { if ( compareSnmpV3UsersAttributes(existingSnmpV3UserMap.get(securityName).getAuthPassPhrase(), updatedSnmpV3Usermap.get(securityName).getAuthPassPhrase()) || compareSnmpV3UsersAttributes(existingSnmpV3UserMap.get(securityName).getAuthProtocol(), updatedSnmpV3Usermap.get(securityName).getAuthProtocol()) || compareSnmpV3UsersAttributes(existingSnmpV3UserMap.get(securityName).getEngineId(), updatedSnmpV3Usermap.get(securityName).getEngineId()) || compareSnmpV3UsersAttributes(existingSnmpV3UserMap.get(securityName).getPrivPassPhrase(), updatedSnmpV3Usermap.get(securityName).getPrivPassPhrase()) || compareSnmpV3UsersAttributes(existingSnmpV3UserMap.get(securityName).getPrivProtocol(), updatedSnmpV3Usermap.get(securityName).getPrivProtocol()) ) { return true; } } return false; }

Target:
public static boolean compareSnmpV3UsersMap(Map<String, SnmpV3User> existingSnmpV3UserMap, Map<String, SnmpV3User> updatedSnmpV3Usermap) { if (updatedSnmpV3Usermap.isEmpty()) { return false; } else if (existingSnmpV3UserMap.isEmpty()) { return true; } for (String securityName : existingSnmpV3UserMap.keySet()) { if(existingSnmpV3UserMap.get(securityName).equals(updatedSnmpV3Usermap.get(securityName))) return true; } return false; }
Source:
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { final Map<String, HealthCheck.Result> results; String name = getHealthCheckName(req); if (name != null) { results = Collections.singletonMap(name, registry.runHealthCheck(name)); } else { results = runHealthChecks(); } resp.setContentType(CONTENT_TYPE); resp.setHeader("Cache-Control", "must-revalidate,no-cache,no-store"); if (results.isEmpty()) { resp.setStatus(HttpServletResponse.SC_NOT_IMPLEMENTED); } else { if (isAllHealthy(results)) { resp.setStatus(HttpServletResponse.SC_OK); } else { resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } } final OutputStream output = resp.getOutputStream(); try { getWriter(req).writeValue(output, results); } finally { output.close(); } }

Target:
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { Map<String, HealthCheck.Result> results; String name = getHealthCheckName(req); if (name != null) { try { results = Collections.singletonMap(name, registry.runHealthCheck(name)); } catch (NoSuchElementException e) { results = Collections.emptyMap(); } } else { results = runHealthChecks(); } resp.setContentType(CONTENT_TYPE); resp.setHeader("Cache-Control", "must-revalidate,no-cache,no-store"); if (results.isEmpty()) { resp.setStatus(HttpServletResponse.SC_NOT_IMPLEMENTED); } else { if (isAllHealthy(results)) { resp.setStatus(HttpServletResponse.SC_OK); } else { resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } } final OutputStream output = resp.getOutputStream(); try { getWriter(req).writeValue(output, results); } finally { output.close(); } }
Source:
private static Request addSocketHeaders(final Request req, final Socket socket) { Request mreq = req; mreq = new RqWithHeader( mreq, "X-Takes-LocalAddress", socket.getLocalAddress().toString() ); mreq = new RqWithHeader( mreq, "X-Takes-LocalPort", Integer.toString(socket.getLocalPort()) ); mreq = new RqWithHeader( mreq, "X-Takes-RemoteAddress", socket.getInetAddress().toString() ); mreq = new RqWithHeader( mreq, "X-Takes-RemotePort", Integer.toString(socket.getPort()) ); return mreq; }

Target:
private static Request addSocketHeaders(final Request req, final Socket socket) { return new RqWithHeaders( req, String.format("X-Takes-LocalAddress: %s", socket.getLocalAddress()), String.format("X-Takes-LocalPort: %d", socket.getLocalPort()), String.format("X-Takes-RemoteAddress: %s", socket.getInetAddress()), String.format("X-Takes-RemotePort: %d", socket.getPort()) ); }
Source:
public void getRadiologyReports_shouldReturnAListOfRadiologyReportsBeingWithinTheDateRange() throws Exception { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); RadiologyReportSearchCriteria radiologyReportSearchCriteria = new RadiologyReportSearchCriteria.Builder().setFromDate(format.parse("2016-05-28")) .setToDate(format.parse("2016-07-01")) .build(); List<RadiologyReport> radiologyReports = radiologyReportService.getRadiologyReports(radiologyReportSearchCriteria); assertThat(radiologyReports.size(), is(3)); }

Target:
public void getRadiologyReports_shouldReturnAListOfRadiologyReportsBeingWithinTheDateRange() throws Exception { final DateFormat format = new SimpleDateFormat("yyyy-MM-dd"); RadiologyReportSearchCriteria radiologyReportSearchCriteria = new RadiologyReportSearchCriteria.Builder().setFromDate(format.parse("2016-05-28")) .setToDate(format.parse("2016-07-01")) .build(); List<RadiologyReport> radiologyReports = radiologyReportService.getRadiologyReports(radiologyReportSearchCriteria); assertThat(radiologyReports.size(), is(3)); }
Source:
public static Object[][] interstitialOasis() { return new Object[][]{ { new Page("project43", "SyntheticTests/Slots/InvisibleHighImpact/Interstitial"), "#INVISIBLE_HIGH_IMPACT_2 .provider-container iframe", new Dimension(728, 90) }, }; }

Target:
public static Object[][] interstitialOasis() { return new Object[][]{ { new Page("project43", "SyntheticTests/Slots/InvisibleHighImpact/Interstitial"), new Dimension(728, 90) }, }; }
Source:
protected void executeCommand() { ManagedBlockStorage managedBlockStorage = cinderStorageDao.get(getParameters().getStorageDomainId()); try { List<String> extraParams = new ArrayList<>(); extraParams.add(getParameters().getDiskId().toString()); extraParams.add(JsonHelper.mapToJson(getParameters().getConnectorInfo(), false)); Map<String, Object> driverOptions = new HashMap<>(managedBlockStorage.getDriverOptions()); if (managedBlockStorage.getDriverSensitiveOptions() != null) { driverOptions.putAll(managedBlockStorage.getDriverSensitiveOptions()); } CinderlibCommandParameters params = new CinderlibCommandParameters(JsonHelper.mapToJson(driverOptions, false), extraParams); CinderlibReturnValue returnValue = cinderlibExecutor.runCommand(CinderlibExecutor.CinderlibCommand.CONNECT_VOLUME, params); getReturnValue().setActionReturnValue(JsonHelper.jsonToMap(returnValue.getOutput())); } catch (Exception e) { log.error("Failed executing volume creation", e); return; } setSucceeded(true); }

Target:
protected void executeCommand() { ManagedBlockStorage managedBlockStorage = cinderStorageDao.get(getParameters().getStorageDomainId()); Map<String, Object> driverOptions = new HashMap<>(managedBlockStorage.getDriverOptions()); if (managedBlockStorage.getDriverSensitiveOptions() != null) { driverOptions.putAll(managedBlockStorage.getDriverSensitiveOptions()); } try { List<String> extraParams = new ArrayList<>(); extraParams.add(getParameters().getDiskId().toString()); extraParams.add(JsonHelper.mapToJson(getParameters().getConnectorInfo(), false)); CinderlibCommandParameters params = new CinderlibCommandParameters(JsonHelper.mapToJson(driverOptions, false), extraParams); CinderlibReturnValue returnValue = cinderlibExecutor.runCommand(CinderlibExecutor.CinderlibCommand.CONNECT_VOLUME, params); getReturnValue().setActionReturnValue(JsonHelper.jsonToMap(returnValue.getOutput())); } catch (Exception e) { log.error("Failed executing volume creation", e); return; } setSucceeded(true); }
Source:
public void testProtectBranch() throws GitLabApiException { Project project = gitLabApi.getProjectApi().getProject(TEST_NAMESPACE, TEST_PROJECT_NAME); assertNotNull(project); ProtectedBranch branch = gitLabApi.getProtectedBranchesApi().protectBranch(project.getId(), TEST_BRANCH_NAME); List<ProtectedBranch> branches = gitLabApi.getProtectedBranchesApi().getProtectedBranches(project.getId()); assertNotNull(branches); assertTrue(branches.stream() .anyMatch((protectedBranch) -> branch.getName().equals(TEST_BRANCH_NAME))); }

Target:
public void testProtectBranch() throws GitLabApiException { Project project = gitLabApi.getProjectApi().getProject(TEST_NAMESPACE, TEST_PROJECT_NAME); assertNotNull(project); ProtectedBranch branch = gitLabApi.getProtectedBranchesApi().protectBranch(project.getId(), TEST_BRANCH_NAME); assertNotNull(branch); assertEquals(TEST_BRANCH_NAME, branch.getName()); List<ProtectedBranch> branches = gitLabApi.getProtectedBranchesApi().getProtectedBranches(project.getId()); assertNotNull(branches); assertTrue(branches.stream() .anyMatch((protectedBranch) -> protectedBranch.getName().equals(TEST_BRANCH_NAME))); }
Source:
private String getErrorMessage( List<MissingTrans> missingTrans ) { StringBuilder entries = new StringBuilder(); for ( MissingTrans entry : missingTrans ) { if ( missingTrans.indexOf( entry ) == missingTrans.size() - 1 ) { entries.append( "- " + entry.getStepName() + " - " + entry.getMissingPluginId() + "\n\n" ); } else { entries.append( "- " + entry.getStepName() + " - " + entry.getMissingPluginId() + "\n" ); } } return BaseMessages.getString( PKG, "MissingTransDialog.MissingTransSteps", entries.toString() ); }

Target:
private String getErrorMessage( List<MissingTrans> missingTrans ) { StringBuilder entries = new StringBuilder(); for ( MissingTrans entry : missingTrans ) { entries.append( "- " + entry.getStepName() + " - " + entry.getMissingPluginId() + "\n" ); if ( missingTrans.indexOf( entry ) == missingTrans.size() - 1 ) { entries.append( '\n' ); } } return BaseMessages.getString( PKG, "MissingTransDialog.MissingTransSteps", entries.toString() ); }
Source:
public void vmTypeChanged(VmType vmType) { if (basedOnCustomInstanceType()) { getModel().getIsSoundcardEnabled().setEntity(vmType == VmType.Desktop && !clusterHasPpcArchitecture()); } getModel().getAllowConsoleReconnect().setEntity(vmType == VmType.Server); if (vmType == VmType.Server) { getModel().getIoThreadsEnabled().setEntity(true); } if (vmType == VmType.HighPerformance) { getModel().getIsHeadlessModeEnabled().setEntity(true); getModel().getIsConsoleDeviceEnabled().setEntity(true); getModel().getUsbPolicy().setSelectedItem(UsbPolicy.DISABLED); getModel().getIsSmartcardEnabled().setEntity(false); getModel().getWatchdogModel().setSelectedItem(null); getModel().getWatchdogAction().setSelectedItem(getModel().getWatchdogAction().getItems().iterator().next()); getModel().getIsRngEnabled().setEntity(true); if (!clusterHasPpcArchitecture()) { getModel().getHostCpu().setEntity(true); } getModel().getMemoryBalloonDeviceEnabled().setEntity(false); getModel().getIoThreadsEnabled().setEntity(true); if (getModel().getMultiQueues().getIsAvailable()) { getModel().getMultiQueues().setEntity(true); } } else { getModel().getHostCpu().setEntity(false); } if (vmType == VmType.HighPerformance || isVmPinningConfigurationEnabled()) { getModel().getMigrationMode().setSelectedItem(MigrationSupport.IMPLICITLY_NON_MIGRATABLE); } else { getModel().getMigrationMode().setSelectedItem(MigrationSupport.MIGRATABLE); } }

Target:
public void vmTypeChanged(VmType vmType) { if (basedOnCustomInstanceType()) { getModel().getIsSoundcardEnabled().setEntity(vmType == VmType.Desktop && !clusterHasPpcArchitecture()); } getModel().getAllowConsoleReconnect().setEntity(vmType == VmType.Server); if (vmType == VmType.Server) { getModel().getIoThreadsEnabled().setEntity(true); } if (vmType == VmType.HighPerformance) { getModel().getIsHeadlessModeEnabled().setEntity(true); getModel().getIsConsoleDeviceEnabled().setEntity(true); getModel().getUsbPolicy().setSelectedItem(UsbPolicy.DISABLED); getModel().getIsSmartcardEnabled().setEntity(false); getModel().getWatchdogModel().setSelectedItem(null); getModel().getWatchdogAction().setSelectedItem(getModel().getWatchdogAction().getItems().iterator().next()); getModel().getIsRngEnabled().setEntity(true); if (!clusterHasPpcArchitecture()) { getModel().getHostCpu().setEntity(true); } getModel().getMemoryBalloonDeviceEnabled().setEntity(false); getModel().getIoThreadsEnabled().setEntity(true); if (getModel().getMultiQueues().getIsAvailable()) { getModel().getMultiQueues().setEntity(true); } } else { getModel().getHostCpu().setEntity(false); } if (isVmHpOrPinningConfigurationEnabled()) { getModel().getMigrationMode().setSelectedItem(MigrationSupport.IMPLICITLY_NON_MIGRATABLE); } else { getModel().getMigrationMode().setSelectedItem(MigrationSupport.MIGRATABLE); } }
Source:
private TimePartitionedShardReaderPolicy(Factory.Builder builder, MessageQueueMetadata metadata) { this.settings = metadata; this.pollingInterval = builder.pollingInterval; catchupPollingInterval = builder.catchupPollingInterval; shards = Lists.newArrayListWithCapacity(metadata.getPartitionCount() * metadata.getShardCount()); for (int i = 0; i < metadata.getPartitionCount(); i++) { for (int j = 0; j < metadata.getShardCount(); j++) { shards.add(new MessageQueueShard(metadata.getQueueName() + SEPARATOR + i + SEPARATOR + j, i, j)); } } List<MessageQueueShard> queues = Lists.newArrayList(); shardStats = Maps.newHashMapWithExpectedSize(shards.size()); for (MessageQueueShard shard : shards) { queues.add(shard); shardStats.put(shard.getName(), shard); } Collections.shuffle(queues); workQueue.addAll(queues); }

Target:
private TimePartitionedShardReaderPolicy(Factory.Builder builder, MessageQueueMetadata metadata) { this.settings = metadata; this.pollingInterval = builder.pollingInterval; this.catchupPollingInterval = builder.catchupPollingInterval; shards = Lists.newArrayListWithCapacity(metadata.getPartitionCount() * metadata.getShardCount()); for (int i = 0; i < metadata.getPartitionCount(); i++) { for (int j = 0; j < metadata.getShardCount(); j++) { shards.add(new MessageQueueShard(metadata.getQueueName() + SEPARATOR + i + SEPARATOR + j, i, j)); } } List<MessageQueueShard> queues = Lists.newArrayList(); shardStats = Maps.newHashMapWithExpectedSize(shards.size()); for (MessageQueueShard shard : shards) { queues.add(shard); shardStats.put(shard.getName(), shard); } Collections.shuffle(queues); workQueue.addAll(queues); }
Source:
public Value nodeGetProperty( long nodeId, int propertyKeyId ) throws EntityNotFoundException { statement.assertOpen(); if ( propertyKeyId == StatementConstants.NO_SUCH_PROPERTY_KEY ) { return Values.NO_VALUE; } try ( Cursor<NodeItem> node = dataRead().nodeCursorById( statement, nodeId ) ) { if ( propertyIsAllowed( propertyKeyId ) ) { return dataRead().nodeGetProperty( statement, node.get(), propertyKeyId ); } else { return Values.NO_VALUE; } } }

Target:
public Value nodeGetProperty( long nodeId, int propertyKeyId ) throws EntityNotFoundException { statement.assertOpen(); if ( propertyKeyId == StatementConstants.NO_SUCH_PROPERTY_KEY ) { return Values.NO_VALUE; } try ( Cursor<NodeItem> node = dataRead().nodeCursorById( statement, nodeId ) ) { return dataRead().nodeGetProperty( statement, node.get(), propertyKeyId ); } }
Source:
private void connectAllPlayersAndMonitors() { logger.debug("MPD testing"); for (String playerId : playerConfigCache.keySet()) { connect(playerId); } }

Target:
private void connectAllPlayersAndMonitors() { logger.debug("MPD binding connecting to players"); for (String playerId : playerConfigCache.keySet()) { connect(playerId); } }
Source:
private static boolean derivesFrom(ICPPClassType derived, ICPPClassType target, IASTNode point, int maxdepth) { if (derived == target || derived.isSameType(target)) { return true; } if (maxdepth > 0) { for (ICPPBase cppBase : ClassTypeHelper.getBases(derived, point)) { IBinding base = cppBase.getBaseClass(); if (!(target instanceof ICPPSpecialization) && (base instanceof ICPPSpecialization)) { base = ((ICPPSpecialization) base).getSpecializedBinding(); } if (base instanceof ICPPClassType) { ICPPClassType tbase = (ICPPClassType) base; if (tbase.isSameType(target)) { return true; } if (derivesFrom(tbase, target, point, maxdepth - 1)) return true; } } } return false; }

Target:
private static boolean derivesFrom(ICPPClassType derived, ICPPClassType target, IASTNode point, int maxdepth) { if (derived == target || derived.isSameType(target)) { return true; } if (maxdepth > 0) { for (ICPPBase cppBase : ClassTypeHelper.getBases(derived, point)) { IBinding base = cppBase.getBaseClass(); if (!(target instanceof ICPPSpecialization) && base instanceof ICPPSpecialization) { base = ((ICPPSpecialization) base).getSpecializedBinding(); } if (base instanceof ICPPClassType) { ICPPClassType tbase = (ICPPClassType) base; if (tbase.isSameType(target)) { return true; } if (derivesFrom(tbase, target, point, maxdepth - 1)) return true; } } } return false; }
Source:
@Test public void worksWithOldSchema() throws Exception { Schema.applyCqlFile(keyspace(), session(), "/zipkin2-schema.cql"); Schema.applyCqlFile(keyspace(), session(), "/zipkin2-schema-indexes-original.cql"); InetSocketAddress contactPoint = contactPoint(); try (CassandraStorage storage = CassandraStorage.newBuilder() .contactPoints(contactPoint.getHostString() + ":" + contactPoint.getPort()) .ensureSchema(false) .autocompleteKeys(asList("environment")) .keyspace(keyspace()).build()) { storage.spanConsumer().accept(TestObjects.TRACE).execute(); assertThat(storage.spanStore().getTrace(TestObjects.TRACE.get(0).traceId()).execute()) .containsExactlyInAnyOrderElementsOf(TestObjects.TRACE); assertThat(storage.autocompleteTags().getValues("environment").execute()) .isEmpty(); String serviceName = TestObjects.TRACE.get(0).localServiceName(); assertThat(storage.serviceAndSpanNames().getRemoteServiceNames(serviceName).execute()) .isEmpty(); } }

Target:
@Test public void worksWithOldSchema() throws Exception { Schema.applyCqlFile(keyspace(), session(), "/zipkin2-schema.cql"); Schema.applyCqlFile(keyspace(), session(), "/zipkin2-schema-indexes-original.cql"); InetSocketAddress contactPoint = contactPoint(); try (CassandraStorage storage = CassandraStorage.newBuilder() .contactPoints(contactPoint.getHostString() + ":" + contactPoint.getPort()) .ensureSchema(false) .autocompleteKeys(asList("environment")) .keyspace(keyspace()).build()) { storage.spanConsumer().accept(TestObjects.TRACE).execute(); assertThat(storage.spanStore().getTrace(TestObjects.TRACE.get(0).traceId()).execute()) .containsExactlyInAnyOrderElementsOf(TestObjects.TRACE); assertThat(storage.autocompleteTags().getValues("environment").execute()) .isEmpty(); String serviceName = TestObjects.TRACE.get(0).localServiceName(); assertThat(storage.serviceAndSpanNames().getRemoteServiceNames(serviceName).execute()) .isEmpty(); try { storage.spanStore().getTraces(QueryRequest.newBuilder() .endTs(TODAY) .lookback(DAY) .limit(10) .serviceName(serviceName) .remoteServiceName(CLIENT_SPAN.remoteServiceName()).build()).execute(); failBecauseExceptionWasNotThrown(IllegalArgumentException.class); } catch (IllegalArgumentException e) { assertThat(e).hasMessage( "remoteService=backend unsupported due to missing table remote_service_by_service"); } } }
Source:
private void split() { mChildren = new ArrayList<PointQuadTree<T>>(); mChildren.add(new PointQuadTree<T>(mBounds.minX, mBounds.midX, mBounds.minY, mBounds.midY, mDepth + 1)); mChildren.add(new PointQuadTree<T>(mBounds.midX, mBounds.maxX, mBounds.minY, mBounds.midY, mDepth + 1)); mChildren.add(new PointQuadTree<T>(mBounds.minX, mBounds.midX, mBounds.midY, mBounds.maxY, mDepth + 1)); mChildren.add(new PointQuadTree<T>(mBounds.midX, mBounds.maxX, mBounds.midY, mBounds.maxY, mDepth + 1)); List<T> items = mItems; mItems = null; for (T item : items) { add(item); } }

Target:
private void split() { mChildren = new ArrayList<PointQuadTree<T>>(4); mChildren.add(new PointQuadTree<T>(mBounds.minX, mBounds.midX, mBounds.minY, mBounds.midY, mDepth + 1)); mChildren.add(new PointQuadTree<T>(mBounds.midX, mBounds.maxX, mBounds.minY, mBounds.midY, mDepth + 1)); mChildren.add(new PointQuadTree<T>(mBounds.minX, mBounds.midX, mBounds.midY, mBounds.maxY, mDepth + 1)); mChildren.add(new PointQuadTree<T>(mBounds.midX, mBounds.maxX, mBounds.midY, mBounds.maxY, mDepth + 1)); List<T> items = mItems; mItems = null; for (T item : items) { add(item); } }
Source:
public void test() throws Exception { TestSupportBinder binder = (TestSupportBinder) this.binderFactory.getBinder(null); Message<?> message = MessageBuilder.withPayload("hello").setHeader("route", "baz").build(); this.channels.input().send(message); MessageChannel baz = binder.getChannelForName("baz"); assertNotNull(baz); assertThat(collector.forChannel(baz), receivesPayloadThat(is("hello"))); message = MessageBuilder.withPayload("world").setHeader("route", "qux").build(); this.channels.input().send(message); MessageChannel qux = binder.getChannelForName("qux"); assertNotNull(qux); assertThat(collector.forChannel(qux), receivesPayloadThat(is("world"))); }

Target:
public void test() throws Exception { TestSupportBinder binder = (TestSupportBinder) this.binderFactory.getBinder(null); Message<?> message = MessageBuilder.withPayload("hello").setHeader("routeTo", "baz").build(); this.channels.input().send(message); MessageChannel baz = binder.getChannelForName("baz"); assertNotNull(baz); assertThat(collector.forChannel(baz), receivesPayloadThat(is("hello"))); message = MessageBuilder.withPayload("world").setHeader("routeTo", "qux").build(); this.channels.input().send(message); MessageChannel qux = binder.getChannelForName("qux"); assertNotNull(qux); assertThat(collector.forChannel(qux), receivesPayloadThat(is("world"))); }
Source:
public void testPackageWithMainlineNetworkStackPermission() throws Exception { final PackageManager packageManager = mContext.getPackageManager(); assertNotNull(packageManager); int packageCount = 0; final PermissionInfo permissioninfo = packageManager.getPermissionInfo(PERMISSION_MAINLINE_NETWORK_STACK, 0); assertNotNull(permissioninfo); PackageInfo packageInfo = packageManager.getPackageInfo(permissioninfo.packageName, PackageManager.MATCH_SYSTEM_ONLY | PackageManager.GET_PERMISSIONS); assertNotNull(packageInfo.permissions); for (PermissionInfo permission : packageInfo.permissions) { if (PERMISSION_MAINLINE_NETWORK_STACK.equals(permission.name)) { packageCount++; } } assertTrue("Package count that declares " + PERMISSION_MAINLINE_NETWORK_STACK + " should be " + EXPECTED_DECLARATION_PERMISSION_COUNT + " but " + packageCount, (packageCount == EXPECTED_DECLARATION_PERMISSION_COUNT)); }

Target:
public void testPackageWithMainlineNetworkStackPermission() throws Exception { final PackageManager packageManager = mContext.getPackageManager(); assertNotNull("Network stack permission is not defined.", packageManager); final PermissionInfo permissioninfo = packageManager.getPermissionInfo(PERMISSION_MAINLINE_NETWORK_STACK, 0); assertNotNull("Package defining the network stack permission is not a system package.", permissioninfo); PackageInfo packageInfo = packageManager.getPackageInfo(permissioninfo.packageName, PackageManager.MATCH_SYSTEM_ONLY | PackageManager.GET_PERMISSIONS); assertNotNull(packageInfo.permissions); for (PermissionInfo permission : packageInfo.permissions) { if (PERMISSION_MAINLINE_NETWORK_STACK.equals(permission.name)) { return; } } fail("Expect a system package defining " + PERMISSION_MAINLINE_NETWORK_STACK + " is installed."); }
Source:
public String answeredBy(Actor actor) { String results = Text.of(Results.RESULT_FIELD).viewedBy(actor).asString(); ReadCacheResult readCacheResult = ResultsMapper.GetReadCacheResultFromString(results); String accessToken = null; if (readCacheResult != null) { User user = (User) actor; for (TokenCacheItemReadResult readResult : readCacheResult.tokenCacheItems) { if (readResult.accessToken != null) { if (TextUtils.isEmpty(clientId) || (!TextUtils.isEmpty(clientId) && clientId.equals(readResult.clientId))) { accessToken = readResult.accessToken; user.setCacheResult(readResult); break; } } } } return accessToken; }

Target:
public String answeredBy(Actor actor) { String results = Text.of(Results.RESULT_FIELD).viewedBy(actor).asString(); ReadCacheResult readCacheResult = ResultsMapper.GetReadCacheResultFromString(results); String accessToken = null; if (readCacheResult != null) { for (TokenCacheItemReadResult readResult : readCacheResult.tokenCacheItems) { if (readResult.accessToken != null) { if (TextUtils.isEmpty(clientId) || (!TextUtils.isEmpty(clientId) && clientId.equals(readResult.clientId))) { accessToken = readResult.accessToken; break; } } } } return accessToken; }
Source:
public FacebookProvider(Context appContext, IdpConfig idpConfig) { mCallbackManager = CallbackManager.Factory.create(); if (appContext.getResources().getIdentifier( "google_permissions", "array", appContext.getPackageName()) != 0) { Log.w(TAG, "DEVELOPER WARNING: You have defined R.array.facebook_permissions but that" + " is no longer respected as of FirebaseUI 1.0.0. Please see README for IDP" + " scope configuraton instructions."); } List<String> scopes = idpConfig.getScopes(); if (scopes == null) { mScopes = new ArrayList<>(); } else { mScopes = scopes; } String applicationId = appContext.getString(R.string.facebook_application_id); FacebookSdk.sdkInitialize(appContext); FacebookSdk.setApplicationId(applicationId); }

Target:
public FacebookProvider(Context appContext, IdpConfig idpConfig) { mCallbackManager = CallbackManager.Factory.create(); if (appContext.getResources().getIdentifier( "facebook_permissions", "array", appContext.getPackageName()) != 0) { Log.w(TAG, "DEVELOPER WARNING: You have defined R.array.facebook_permissions but that" + " is no longer respected as of FirebaseUI 1.0.0. Please see README for IDP" + " scope configuration instructions."); } List<String> scopes = idpConfig.getScopes(); if (scopes == null) { mScopes = new ArrayList<>(); } else { mScopes = scopes; } String applicationId = appContext.getString(R.string.facebook_application_id); FacebookSdk.sdkInitialize(appContext); FacebookSdk.setApplicationId(applicationId); }
Source:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((getVolumeId() == null) ? 0 : getVolumeId().hashCode()); return result; }

Target:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((getVolumeId() == null) ? 0 : getVolumeId().hashCode()); result = prime * result + ((getBrickProfileDetails() == null) ? 0 : getBrickProfileDetails().hashCode()); result = prime * result + ((getNfsProfileDetails() == null) ? 0 : getNfsProfileDetails().hashCode()); return result; }
Source:
public String formatPerformanceNumbers(String testCaseId) { PerformanceState performanceState = get(testCaseId); if (performanceState.isEmpty() || performanceState.getOperationCount() < 1) { return ""; } String latencyUnit = "µs"; long avgLatencyValue = round(performanceState.getIntervalAvgLatency() / MICROSECONDS.toNanos(1)); long percentileLatencyValue = performanceState.getIntervalPercentileLatency() / MICROSECONDS.toNanos(1); long maxLatencyValue = performanceState.getIntervalMaxLatency() / MICROSECONDS.toNanos(1); if (avgLatencyValue > DISPLAY_LATENCY_AS_MICROS_MAX_VALUE) { latencyUnit = "ms"; avgLatencyValue = MICROSECONDS.toMillis(avgLatencyValue); percentileLatencyValue = MICROSECONDS.toMillis(percentileLatencyValue); maxLatencyValue = MICROSECONDS.toMillis(maxLatencyValue); } return String.format("%s ops %s ops/s %s %s (avg) %s %s (%sth) %s %s (max)", formatLong(performanceState.getOperationCount(), OPERATION_COUNT_FORMAT_LENGTH), formatDouble(performanceState.getIntervalThroughput(), THROUGHPUT_FORMAT_LENGTH), formatLong(avgLatencyValue, LATENCY_FORMAT_LENGTH), latencyUnit, formatLong(percentileLatencyValue, LATENCY_FORMAT_LENGTH), latencyUnit, INTERVAL_LATENCY_PERCENTILE, formatLong(maxLatencyValue, LATENCY_FORMAT_LENGTH), latencyUnit ); }

Target:
public String formatPerformanceNumbers(String testCaseId) { PerformanceState performanceState = get(testCaseId); if (performanceState.isEmpty() || performanceState.getOperationCount() < 1) { return ""; } String latencyUnit = "µs"; long latencyAvg = NANOSECONDS.toMicros(round(performanceState.getIntervalLatencyAvgNanos())); long latency999Percentile = NANOSECONDS.toMicros(performanceState.getIntervalLatency999PercentileNanos()); long latencyMax = NANOSECONDS.toMicros(performanceState.getIntervalLatencyMaxNanos()); if (latencyAvg > DISPLAY_LATENCY_AS_MICROS_MAX_VALUE) { latencyUnit = "ms"; latencyAvg = MICROSECONDS.toMillis(latencyAvg); latency999Percentile = MICROSECONDS.toMillis(latency999Percentile); latencyMax = MICROSECONDS.toMillis(latencyMax); } return String.format("%s ops %s ops/s %s %s (avg) %s %s (%sth) %s %s (max)", formatLong(performanceState.getOperationCount(), OPERATION_COUNT_FORMAT_LENGTH), formatDouble(performanceState.getIntervalThroughput(), THROUGHPUT_FORMAT_LENGTH), formatLong(latencyAvg, LATENCY_FORMAT_LENGTH), latencyUnit, formatLong(latency999Percentile, LATENCY_FORMAT_LENGTH), latencyUnit, INTERVAL_LATENCY_PERCENTILE, formatLong(latencyMax, LATENCY_FORMAT_LENGTH), latencyUnit ); }
Source:
public DbStoredProcedureCall newStoredProcedureCall(String name, DbParameterAccessor[] accessors) { return new DefaultDbStoredProcedureCall(this, name, accessors); }

Target:
public DbCommand newStoredProcedureCall(String name, DbParameterAccessor[] accessors) throws SQLException { return new DbStoredProcedureCall(this, name, accessors).toStatementExecution(); }