auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
void closeSocket() { if (sock != null && !sock.isClosed() && sockBeingClosed.compareAndSet(false, true)) { LOG.error("Unexpected exception causing shutdown while sock is still open"); if (closeSocketAsync) { closeSockAsync(); } else { closeSockSync(); } } }

Target:
void closeSocket() { if (sock != null && !sock.isClosed() && sockBeingClosed.compareAndSet(false, true)) { if (closeSocketAsync) { LOG.info("Asynchronously closing socket to learner {}.", getSid()); closeSockAsync(); } else { LOG.info("Synchronously closing socket to learner {}.", getSid()); closeSockSync(); } } }
Source:
public Object execute(final ExecutionEvent event) throws ExecutionException { final RepositoryTreeNode node = getSelectedNodes(event).get(0); if (!(node.getObject() instanceof Ref)) return null; final Ref ref = (Ref) node.getObject(); Repository repo = node.getRepository(); String refName = ref.getLeaf().getName(); final BranchOperationUI op; if (refName.startsWith(Constants.R_HEADS)) op = new BranchOperationUI(repo, ref.getName()); else op = new BranchOperationUI(repo, ref.getLeaf().getObjectId()); op.start(); return null; }

Target:
public Object execute(final ExecutionEvent event) throws ExecutionException { final RepositoryTreeNode node = getSelectedNodes(event).get(0); if (!(node.getObject() instanceof Ref)) return null; final Ref ref = (Ref) node.getObject(); Repository repo = node.getRepository(); String refName = ref.getLeaf().getName(); final BranchOperationUI op; if (refName.startsWith(Constants.R_REFS)) op = new BranchOperationUI(repo, ref.getName()); else op = new BranchOperationUI(repo, ref.getLeaf().getObjectId()); op.start(); return null; }
Source:
public void twoLaunchesTerminate() throws Throwable { Assume.assumeFalse("Test framework only supports multiple launches for non-remote", remote); doLaunch(EXEC_PATH + EXEC_NAME); GdbLaunch launch1 = getGDBLaunch(); GdbLaunch launch2 = doLaunchInner(); launch1.terminate(); launch2.terminate(); long endTime = System.currentTimeMillis() + TestsPlugin.massageTimeout(2000); boolean allTerminated = false; try { while (System.currentTimeMillis() < endTime) { if (launch1.isTerminated() && launch2.isTerminated()) { allTerminated = true; GdbDebugOptions.trace("Both launches terminated\n"); } assertSessionExecutorResponsive(launch1, "launch1", endTime - System.currentTimeMillis(), TimeUnit.MILLISECONDS); assertSessionExecutorResponsive(launch2, "launch2", endTime - System.currentTimeMillis(), TimeUnit.MILLISECONDS); if (allTerminated) { break; } } } catch (TimeoutException te) { throw new Exception("Timeout while trying to access executor thread", te); } assertTrue("Timeout waiting for launches to terminate", allTerminated); }

Target:
public void twoLaunchesTerminate() throws Throwable { Assume.assumeFalse("Test framework only supports multiple launches for non-remote", remote); doLaunch(EXEC_PATH + EXEC_NAME); GdbLaunch launch1 = getGDBLaunch(); GdbLaunch launch2 = doLaunchInner(); launch1.terminate(); launch2.terminate(); long endTime = System.currentTimeMillis() + TestsPlugin.massageTimeout(2000); boolean allTerminated = false; try { while (System.currentTimeMillis() < endTime) { if (launch1.isTerminated() && launch2.isTerminated()) { allTerminated = true; GdbDebugOptions.trace("Both launches terminated\n"); } assertSessionExecutorResponsive(launch1, "launch1", endTime - System.currentTimeMillis(), TimeUnit.MILLISECONDS); assertSessionExecutorResponsive(launch2, "launch2", endTime - System.currentTimeMillis(), TimeUnit.MILLISECONDS); if (allTerminated) { break; } Thread.sleep(100); } } catch (TimeoutException te) { throw new Exception("Timeout while trying to access executor thread", te); } assertTrue("Timeout waiting for launches to terminate", allTerminated); }
Source:
public void setNamedParams(Map<String, String> params) { if (params != null) { List<Map<String, String>> paramsProperty = getPropertyValue(SavedSearchConstants.NAMED_PARAMS_PROPERTY_NAME); if (paramsProperty == null) { paramsProperty = new ArrayList<>(); } Map<String, String> variable; for (String key : params.keySet()) { String value = params.get(key); variable = new HashMap<>(1); variable.put("key", key); variable.put("value", value); paramsProperty.add(variable); } doc.setPropertyValue(SavedSearchConstants.NAMED_PARAMS_PROPERTY_NAME, (Serializable) paramsProperty); } }

Target:
public void setNamedParams(Map<String, String> params) { if (params != null) { List<Map<String, String>> paramsProperty = getPropertyValue(SavedSearchConstants.NAMED_PARAMS_PROPERTY_NAME); if (paramsProperty == null) { paramsProperty = new ArrayList<>(); } Map<String, String> variable; for (String key : params.keySet()) { String value = params.get(key); variable = new HashMap<>(2); variable.put("key", key); variable.put("value", value); paramsProperty.add(variable); } doc.setPropertyValue(SavedSearchConstants.NAMED_PARAMS_PROPERTY_NAME, (Serializable) paramsProperty); } }
Source:
public ComputerLauncher getDelegatedLauncher() { ComputerLauncher l = launcher; while (l instanceof DelegatingComputerLauncher) { l = ((DelegatingComputerLauncher)l).getLauncher(); } return l; }

Target:
public ComputerLauncher getDelegatedLauncher() { ComputerLauncher l = launcher; while (true) { if (l instanceof DelegatingComputerLauncher) { l = ((DelegatingComputerLauncher) l).getLauncher(); } else if (l instanceof ComputerLauncherFilter) { l = ((ComputerLauncherFilter) l).getCore(); } else { break; } } return l; }
Source:
private void checkServiceInterface(DetailAST interfaceDefToken) { DetailAST serviceInterfaceAnnotationNode = null; String nameValue = null; DetailAST modifiersToken = interfaceDefToken.findFirstToken(TokenTypes.MODIFIERS); for (DetailAST ast = modifiersToken.getFirstChild(); ast != null; ast = ast.getNextSibling()) { if (ast.getType() != TokenTypes.ANNOTATION) { continue; } for (DetailAST annotationChild = ast.getFirstChild(); annotationChild != null; annotationChild = annotationChild.getNextSibling()) { if (annotationChild.getType() == TokenTypes.IDENT) { if (!"ServiceInterface".equals(annotationChild.getText())) { break; } else { serviceInterfaceAnnotationNode = ast; } } if (annotationChild.getType() == TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR) { if ("name".equals(annotationChild.findFirstToken(TokenTypes.IDENT).getText())) { nameValue = getNamePropertyValue(annotationChild.findFirstToken(TokenTypes.EXPR)); } } } } if (serviceInterfaceAnnotationNode == null) { return; } if (nameValue.isEmpty()) { log(serviceInterfaceAnnotationNode, String.format("The ''name'' property of @ServiceInterface, ''%s'' should not be empty.", nameValue)); } if (nameValue.contains(" ")) { log(serviceInterfaceAnnotationNode, String.format("The ''name'' property of @ServiceInterface, ''%s'' should not contain white space.", nameValue)); } if (nameValue.length() > 10) { log(serviceInterfaceAnnotationNode, "[DEBUG] length = " + nameValue.length() + ", name = " + nameValue); log(serviceInterfaceAnnotationNode, String.format("The ''name'' property of @ServiceInterface ''%s'' should not have a length > 10.", nameValue)); } }

Target:
private void checkServiceInterface(DetailAST interfaceDefToken) { DetailAST serviceInterfaceAnnotationNode = null; String nameValue = null; DetailAST modifiersToken = interfaceDefToken.findFirstToken(TokenTypes.MODIFIERS); for (DetailAST ast = modifiersToken.getFirstChild(); ast != null; ast = ast.getNextSibling()) { if (ast.getType() != TokenTypes.ANNOTATION) { continue; } if (!"ServiceInterface".equals(ast.findFirstToken(TokenTypes.IDENT).getText())) { continue; } serviceInterfaceAnnotationNode = ast; DetailAST annotationMemberValuePairToken = ast.findFirstToken(TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR); if ("name".equals(annotationMemberValuePairToken.findFirstToken(TokenTypes.IDENT).getText())) { nameValue = getNamePropertyValue(annotationMemberValuePairToken.findFirstToken(TokenTypes.EXPR)); break; } } if (serviceInterfaceAnnotationNode == null) { return; } Pattern serviceNamePattern = Pattern.compile("^[a-zA-Z0-9]{1,20}$"); if (!serviceNamePattern.matcher(nameValue).find()) { log(serviceInterfaceAnnotationNode, String.format( "The ''name'' property of @ServiceInterface, ''%s'' should be non-empty, alphanumeric and not more than 10 characters", nameValue)); } }
Source:
private void getJobXML(HttpServletRequest request, HttpServletResponse response) throws IOException { String jobId = request.getParameter("jobId"); String sessionId = request.getParameter("sessionId"); String fileName = "job_" + jobId + ".xml"; try (ServletOutputStream out = response.getOutputStream(); InputStream is = new ByteArrayInputStream(((SchedulerServiceImpl) Service.get()).getJobXML(sessionId, jobId) .getBytes(StandardCharsets.UTF_8))) { response.setContentType("application/xml"); response.setHeader("Content-disposition", "attachment; filename=" + fileName); response.setHeader("Location", fileName); int buffer; while ((buffer = is.read()) != -1) { out.write(buffer); out.flush(); } LOGGER.debug("Successfully downloaded job XML for job: {}", jobId); } catch (RestServerException e) { LOGGER.debug("Failed to download workflow. User permission not granted: ", e); response.addHeader("proactive_error", "User permission not granted: HTTP status code " + e.getStatus()); response.sendError(HttpServletResponse.SC_FORBIDDEN, e.getMessage()); } catch (IOException | ServiceException e) { LOGGER.warn("Failed to download workflow", e); response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Failed to download workflow: " + e.getMessage()); } }

Target:
private void getJobXML(HttpServletRequest request, HttpServletResponse response) throws IOException { String jobId = request.getParameter("jobId"); String sessionId = request.getParameter("sessionId"); String fileName = "job_" + jobId + ".xml"; try (ServletOutputStream out = response.getOutputStream(); InputStream is = new ByteArrayInputStream(((SchedulerServiceImpl) Service.get()).getJobXML(sessionId, jobId) .getBytes(StandardCharsets.UTF_8))) { response.setContentType("application/xml"); response.setHeader("Content-disposition", "attachment; filename=" + fileName); response.setHeader("Location", fileName); int buffer; while ((buffer = is.read()) != -1) { out.write(buffer); } out.flush(); LOGGER.debug("Successfully downloaded job XML for job: {}", jobId); } catch (RestServerException e) { if (e.getStatus() == HttpServletResponse.SC_FORBIDDEN) { LOGGER.debug("Failed to download workflow. User permission not granted: ", e); response.addHeader("proactive_error", "User permission not granted: HTTP status code " + e.getStatus()); } else { LOGGER.warn("Failed to download workflow", e); } response.sendError(e.getStatus(), e.getMessage()); } catch (IOException | ServiceException e) { LOGGER.warn("Failed to download workflow", e); response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Failed to download workflow: " + e.getMessage()); } }
Source:
protected void initDiskVmElement() { setDiskVmElement(new DiskVmElement(new VmDeviceId(null, null))); }

Target:
protected void initDiskVmElement() { setDiskVmElement(new DiskVmElement()); }
Source:
void connectionFailure() throws Exception { givenWebSocketConnects(false); webSocketConnection.connect(errorHandler); Thread.sleep(50L); verifyPingerNotStarted(); verifyErrorHandlerWasCalled(); }

Target:
void connectionFailure() throws Exception { givenWebSocketConnects(false); final boolean connected = webSocketConnection.connect(errorHandler).get(); assertThat(connected, is(false)); verifyPingerNotStarted(); verifyErrorHandlerWasCalled(); }
Source:
public void testConstructProcessWithGivenPid() { SystemInfo si = new SystemInfo(); OperatingSystem os = si.getOperatingSystem(); OSProcess oldProcess = os.getProcess(os.getProcessId()); int givenPid = oldProcess.getProcessID(); OSProcess newProcess = new OSProcess(givenPid); assertEquals(oldProcess.getPath(), newProcess.getPath()); assertEquals(oldProcess.getProcessID(), newProcess.getProcessID()); }

Target:
public void testConstructProcessWithGivenPid() throws InstantiationException { SystemInfo si = new SystemInfo(); OperatingSystem os = si.getOperatingSystem(); int givenPid = os.getProcessId(); OSProcess oldProcess = os.getProcess(givenPid); OSProcess newProcess = new OSProcess(os, givenPid); assertEquals(oldProcess.getPath(), newProcess.getPath()); assertEquals(oldProcess.getProcessID(), newProcess.getProcessID()); assertTrue(newProcess.updateAttributes()); oldProcess.setProcessID(-1); assertFalse(oldProcess.updateAttributes()); try { newProcess = new OSProcess(os, -1); fail("Expected an InstantiationException"); } catch (InstantiationException expected) { assertEquals("A process with ID -1 does not exist.", expected.getMessage()); } }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Mapbox.getInstance(this, getString(R.string.access_token)); setContentView(R.layout.activity_extrusion_light); mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(@NonNull final MapboxMap map) { mapboxMap = map; map.setStyle(Style.DARK, new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { setupBuildings(); setupLight(); } }); } }); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Mapbox.getInstance(this, getString(R.string.access_token)); setContentView(R.layout.activity_extrusion_light); mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(@NonNull final MapboxMap map) { map.setStyle(Style.DARK, new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { setupBuildings(style); setupLight(style); } }); } }); }
Source:
private void validateIndexSpecs( SchemaDefinitionContext context ) { indexSpecs= new ArrayList<>(); Database database = context.getDatabase(); for(Table table : database.getDefaultNamespace().getTables()) { Iterator<UniqueKey> keys = table.getUniqueKeyIterator(); while(keys.hasNext()) { IndexSpec indexSpec = new IndexSpec( keys.next() ); validateIndexSpec(indexSpec); indexSpecs.add(indexSpec); } Iterator<Index> indexes = table.getIndexIterator(); while(indexes.hasNext()) { IndexSpec indexSpec = new IndexSpec( indexes.next() ); validateIndexSpec(indexSpec); indexSpecs.add(indexSpec); } } }

Target:
private void validateIndexSpecs( SchemaDefinitionContext context ) { indexSpecs = new ArrayList<>(); Database database = context.getDatabase(); for ( Table table : database.getDefaultNamespace().getTables() ) { Iterator<UniqueKey> keys = table.getUniqueKeyIterator(); while ( keys.hasNext() ) { IndexSpec indexSpec = new IndexSpec( keys.next() ); if ( validateIndexSpec( indexSpec ) ) { indexSpecs.add( indexSpec ); } } Iterator<Index> indexes = table.getIndexIterator(); while ( indexes.hasNext() ) { IndexSpec indexSpec = new IndexSpec( indexes.next() ); validateIndexSpec( indexSpec ); if ( validateIndexSpec( indexSpec ) ) { indexSpecs.add( indexSpec ); } } } }
Source:
public void dispose() { subscriberRegistrationManager.deinitialize(); super.dispose(); }

Target:
public void dispose() { deinitializeSubscribers(); super.dispose(); }
Source:
private Account findByUserName(final String userName) throws OrmException { AccountExternalId.Key key = new AccountExternalId.Key(SCHEME_USERNAME, userName); AccountExternalId externalId = schema.get().accountExternalIds().get(key); if (externalId == null) return null; return byId.get(externalId.getAccountId()).getAccount(); }

Target:
private Account findByUserName(final String userName) throws OrmException { AccountState as = byId.getByUsername(userName); return as != null ? as.getAccount() : null; }
Source:
public void queryDocuments() { boolean qmEnabled = true; String query = "SELECT sum(c.age) as sum_age, c.city FROM c group by c.city"; QueryRequestOptions options = new QueryRequestOptions(); ModelBridgeInternal.setQueryRequestOptionsMaxItemCount(options, 35); options.setQueryMetricsEnabled(qmEnabled); options.setMaxDegreeOfParallelism(2); CosmosPagedFlux<JsonNode> queryObservable = createdCollection.queryItems(query, options, JsonNode.class); Map<City, Integer> resultMap = personList.stream() .collect(Collectors.groupingBy(Person::getCity, Collectors.summingInt(Person::getAge))); List<Document> expectedDocumentsList = new ArrayList<>(); resultMap.forEach((city, sum) -> { Document d = new Document(); d.set("sum_age", sum); d.set("city", city); expectedDocumentsList.add(d); }); List<FeedResponse<JsonNode>> queryResultPages = queryObservable.byPage().collectList().block(); List<JsonNode> queryResults = new ArrayList<>(); queryResultPages .forEach(feedResponse -> queryResults.addAll(feedResponse.getResults())); assertThat(expectedDocumentsList.size()).isEqualTo(queryResults.size()); for (int i = 0; i < expectedDocumentsList.size(); i++) { assertThat(expectedDocumentsList.get(i).toString().equals(queryResults.get(i).toString())); } }

Target:
public void queryDocuments() { boolean qmEnabled = true; String query = "SELECT sum(c.age) as sum_age, c.city FROM c group by c.city"; CosmosQueryRequestOptions options = new CosmosQueryRequestOptions(); ModelBridgeInternal.setQueryRequestOptionsMaxItemCount(options, 35); options.setQueryMetricsEnabled(qmEnabled); options.setMaxDegreeOfParallelism(2); CosmosPagedFlux<JsonNode> queryObservable = createdCollection.queryItems(query, options, JsonNode.class); Map<City, Integer> resultMap = personList.stream() .collect(Collectors.groupingBy(Person::getCity, Collectors.summingInt(Person::getAge))); List<Document> expectedDocumentsList = new ArrayList<>(); resultMap.forEach((city, sum) -> { Document d = new Document(); d.set("sum_age", sum); d.set("city", city); expectedDocumentsList.add(d); }); List<FeedResponse<JsonNode>> queryResultPages = queryObservable.byPage().collectList().block(); List<JsonNode> queryResults = new ArrayList<>(); queryResultPages .forEach(feedResponse -> queryResults.addAll(feedResponse.getResults())); assertThat(expectedDocumentsList.size()).isEqualTo(queryResults.size()); for (int i = 0; i < expectedDocumentsList.size(); i++) { assertThat(expectedDocumentsList.get(i).toString().equals(queryResults.get(i).toString())); } }
Source:
public void testManyFiles() throws Exception { final String table = getUniqueNames(1)[0]; Connector c = getConnector(); NewTableConfiguration ntc = new NewTableConfiguration(); ntc.enableSummarization(SummarizerConfiguration.builder(FamilySummarizer.class).build()); c.tableOperations().create(table, ntc); Random rand = new Random(42); int q = 0; SortedSet<Text> partitionKeys = new TreeSet<>(); for (int split = 100000; split < 1000000; split += 100000) { partitionKeys.add(new Text(String.format("%06d", split))); } c.tableOperations().addSplits(table, partitionKeys); Map<String,Long> famCounts = new HashMap<>(); for (int t = 0; t < 20; t++) { try (BatchWriter bw = c.createBatchWriter(table, new BatchWriterConfig())) { for (int i = 0; i < 10000; i++) { String row = String.format("%06d", rand.nextInt(1000000)); String fam = String.format("%03d", rand.nextInt(100)); String qual = String.format("%06d", q++); write(bw, row, fam, qual, "val"); famCounts.merge(fam, 1L, Long::sum); } } List<Summary> summaries = c.tableOperations().getSummaries(table).flush(true).retrieve(); Assert.assertEquals(1, summaries.size()); CounterSummary cs = new CounterSummary(summaries.get(0)); Assert.assertEquals(famCounts, cs.getCounters()); FileStatistics fileStats = summaries.get(0).getFileStatistics(); Assert.assertEquals(0, fileStats.getInaccurate()); Assert.assertTrue("Saw " + fileStats.getTotal() + " files expected >=10", fileStats.getTotal() >= 10); } }

Target:
public void testManyFiles() throws Exception { final String table = getUniqueNames(1)[0]; Connector c = getConnector(); NewTableConfiguration ntc = new NewTableConfiguration(); ntc.enableSummarization(SummarizerConfiguration.builder(FamilySummarizer.class).build()); c.tableOperations().create(table, ntc); Random rand = new Random(42); int q = 0; SortedSet<Text> partitionKeys = new TreeSet<>(); for (int split = 100_000; split < 1_000_000; split += 100_000) { partitionKeys.add(new Text(String.format("%06d", split))); } c.tableOperations().addSplits(table, partitionKeys); Map<String,Long> famCounts = new HashMap<>(); for (int t = 0; t < 20; t++) { try (BatchWriter bw = c.createBatchWriter(table, new BatchWriterConfig())) { for (int i = 0; i < 10000; i++) { String row = String.format("%06d", rand.nextInt(1_000_000)); String fam = String.format("%03d", rand.nextInt(100)); String qual = String.format("%06d", q++); write(bw, row, fam, qual, "val"); famCounts.merge(fam, 1L, Long::sum); } } List<Summary> summaries = c.tableOperations().summarize(table).flush(true).retrieve(); Assert.assertEquals(1, summaries.size()); CounterSummary cs = new CounterSummary(summaries.get(0)); Assert.assertEquals(famCounts, cs.getCounters()); FileStatistics fileStats = summaries.get(0).getFileStatistics(); Assert.assertEquals(0, fileStats.getInaccurate()); Assert.assertTrue("Saw " + fileStats.getTotal() + " files expected >=10", fileStats.getTotal() >= 10); } }
Source:
public String toString() { ToStringHelper stringHelper = toStringHelper(this) .add("tableId", tableId) .add("shardId", shardId) .add("shardUuid", shardUuid) .add("isDelta", isDelta) .add("rowCount", rowCount) .add("compressedSize", DataSize.succinctBytes(compressedSize)) .add("uncompressedSize", DataSize.succinctBytes(uncompressedSize)); if (deltaUuid.isPresent()) { stringHelper.add("deltaUuid", deltaUuid.get()); } if (bucketNumber.isPresent()) { stringHelper.add("bucketNumber", bucketNumber.getAsInt()); } if (xxhash64.isPresent()) { stringHelper.add("xxhash64", format("%16x", xxhash64.getAsLong())); } if (rangeStart.isPresent()) { stringHelper.add("rangeStart", rangeStart.getAsLong()); } if (rangeEnd.isPresent()) { stringHelper.add("rangeEnd", rangeEnd.getAsLong()); } return stringHelper.toString(); }

Target:
public String toString() { ToStringHelper stringHelper = toStringHelper(this) .add("tableId", tableId) .add("shardId", shardId) .add("shardUuid", shardUuid) .add("isDelta", isDelta) .add("rowCount", rowCount) .add("compressedSize", DataSize.succinctBytes(compressedSize)) .add("uncompressedSize", DataSize.succinctBytes(uncompressedSize)); deltaUuid.ifPresent(uuid -> stringHelper.add("deltaUuid", uuid)); if (bucketNumber.isPresent()) { stringHelper.add("bucketNumber", bucketNumber.getAsInt()); } if (xxhash64.isPresent()) { stringHelper.add("xxhash64", format("%16x", xxhash64.getAsLong())); } if (rangeStart.isPresent()) { stringHelper.add("rangeStart", rangeStart.getAsLong()); } if (rangeEnd.isPresent()) { stringHelper.add("rangeEnd", rangeEnd.getAsLong()); } return stringHelper.toString(); }
Source:
NullableRowBasedKeySerdeHelper(RowBasedKeySerdeHelper delegate, int keyBufferPosition) { this.delegate = delegate; this.keyBufferPosition = keyBufferPosition; BufferComparator delegateBufferComparator = this.delegate.getBufferComparator(); this.comparator = (lhsBuffer, rhsBuffer, lhsPosition, rhsPosition) -> { boolean isLhsNull = (lhsBuffer.get(lhsPosition + keyBufferPosition) == NullHandling.IS_NULL_BYTE); boolean isrhsNull = (rhsBuffer.get(rhsPosition + keyBufferPosition) == NullHandling.IS_NULL_BYTE); if (isLhsNull && isrhsNull) { return 0; } if (isLhsNull) { return -1; } if (isrhsNull) { return 1; } return delegateBufferComparator.compare( lhsBuffer, rhsBuffer, lhsPosition, rhsPosition ); }; }

Target:
NullableRowBasedKeySerdeHelper(RowBasedKeySerdeHelper delegate, int keyBufferPosition) { this.delegate = delegate; this.keyBufferPosition = keyBufferPosition; BufferComparator delegateBufferComparator = this.delegate.getBufferComparator(); this.comparator = (lhsBuffer, rhsBuffer, lhsPosition, rhsPosition) -> { boolean isLhsNull = (lhsBuffer.get(lhsPosition + keyBufferPosition) == NullHandling.IS_NULL_BYTE); boolean isRhsNull = (rhsBuffer.get(rhsPosition + keyBufferPosition) == NullHandling.IS_NULL_BYTE); if (isLhsNull && isRhsNull) { return 0; } if (isLhsNull) { return -1; } if (isRhsNull) { return 1; } return delegateBufferComparator.compare( lhsBuffer, rhsBuffer, lhsPosition, rhsPosition ); }; }
Source:
protected Collection<String> getInAppFrames(Dsn dsn) { String inAppFramesOption = Lookup.lookup(IN_APP_FRAMES_OPTION, dsn); if (Util.isNullOrEmpty(inAppFramesOption)) { logger.warn("No '" + IN_APP_FRAMES_OPTION + "' was configured, this option is highly recommended " + "as it affects stacktrace grouping and display on Sentry. See documentation: " + "<LINK_0>"); return Collections.emptyList(); } List<String> inAppPackages = new ArrayList<>(); for (String inAppPackage : inAppFramesOption.split(",")) { if (!inAppPackage.trim().equals("")) { inAppPackages.add(inAppPackage); } } for (String inAppPackage : inAppPackages) { FrameCache.addAppPackage(inAppPackage); } return inAppPackages; }

Target:
protected Collection<String> getInAppFrames(Dsn dsn) { String inAppFramesOption = Lookup.lookup(IN_APP_FRAMES_OPTION, dsn); if (Util.isNullOrEmpty(inAppFramesOption)) { logger.warn("No '" + IN_APP_FRAMES_OPTION + "' was configured, this option is highly recommended " + "as it affects stacktrace grouping and display on Sentry. See documentation: " + "<LINK_0>"); return Collections.emptyList(); } List<String> inAppPackages = new ArrayList<>(); for (String inAppPackage : inAppFramesOption.split(",")) { if (!inAppPackage.trim().equals("")) { inAppPackages.add(inAppPackage); } } return inAppPackages; }
Source:
private void refreshOnUpdate(String path) { try { Map<String, Map<String, Long>> storageUsage = fetchContainerStorageUsageFromPath(path); System.out.println("Getting this from update: " + storageUsage); containerStorageUsageRef.set(storageUsage); if (callback.get() != null) { callback.get().onNewContainerStorageUsage(Collections.unmodifiableMap(storageUsage)); } } catch (Exception e) { logger.error("Failed to refresh storage usage on update of path = {}", path, e); containerStorageUsageRef.compareAndSet(null, Collections.EMPTY_MAP); } }

Target:
private void refreshOnUpdate(String path) { try { Map<String, Map<String, Long>> storageUsage = fetchContainerStorageUsageFromPath(path); containerStorageUsageRef.set(storageUsage); if (callback.get() != null) { callback.get().onNewContainerStorageUsage(Collections.unmodifiableMap(storageUsage)); } } catch (Exception e) { logger.error("Failed to refresh storage usage on update of path = {}", path, e); containerStorageUsageRef.compareAndSet(null, Collections.EMPTY_MAP); } }
Source:
public void testListDeployments() { List<Deployment> deployments = api().list(); assertTrue(deployments.size() > 0); }

Target:
public void testListDeployments() { List<Deployment> deployments = api().list(); assertTrue(deployments.size() > 0); boolean deploymentFound = false; for (Deployment d : deployments) { if (d.name().equals(deploymentName)) { deploymentFound = true; break; } } assertTrue(deploymentFound); }
Source:
public void setUp() throws Exception { File genomeFile = new File(this.getClass() .getResource(testGenomeFilename + ".gff").toURI()); genomes = GeneAnnotationParser.parseGeneAnnotations(genomeFile); }

Target:
public void setUp() throws Exception { File genomesFile = new File(this.getClass() .getResource(testGenomesFilename).toURI()); File genomeFile = new File(this.getClass() .getResource(testGenomeFilename).toURI()); genomes = GeneAnnotationParser.parseGeneAnnotations(genomesFile); genome = GeneAnnotationParser.parseGeneAnnotations(genomeFile); }
Source:
public boolean matchesSafely(PostDonationCounselling actual) { return Objects.equals(actual.getId(), expected.getId()) && actual.isFlaggedForCounselling() == expected.isFlaggedForCounselling() && actual.isIsDeleted() == expected.isIsDeleted() && Objects.equals(actual.getCreatedBy(), expected.getCreatedBy()) && actual.getCreatedDate() == expected.getCreatedDate() && Objects.equals(actual.getLastUpdatedBy(), expected.getLastUpdatedBy()) && actual.getLastUpdated() == expected.getLastUpdated() && Objects.equals(actual.getDonation(), expected.getDonation()) && Objects.equals(actual.getCounsellingDate(), expected.getCounsellingDate()) && Objects.equals(actual.getCounsellingStatus(), expected.getCounsellingStatus()); }

Target:
public boolean matchesSafely(PostDonationCounselling actual) { return Objects.equals(actual.getId(), expected.getId()) && Objects.equals(actual.isFlaggedForCounselling(), expected.isFlaggedForCounselling()) && Objects.equals(actual.isIsDeleted(), expected.isIsDeleted()) && Objects.equals(actual.getCreatedBy(), expected.getCreatedBy()) && Objects.equals(actual.getCreatedDate(), expected.getCreatedDate()) && Objects.equals(actual.getLastUpdatedBy(), expected.getLastUpdatedBy()) && Objects.equals(actual.getLastUpdated(), expected.getLastUpdated()) && Objects.equals(actual.getDonation(), expected.getDonation()) && Objects.equals(actual.getCounsellingDate(), expected.getCounsellingDate()) && Objects.equals(actual.getCounsellingStatus(), expected.getCounsellingStatus()); }
Source:
public void test(Container container, PackingPlan.InstancePlan instancePlan) throws ResourceExceededException { Resource usedResource = container.getTotalUsedResources(); Resource newUsedResource = usedResource.plus(instancePlan.getResource()); Resource capacity = container.getCapacity(); if (Double.compare(capacity.getCpu(), newUsedResource.getCpu()) < 0) { throw new ResourceExceededException(String.format("Adding instance %s with %.3f cores " + "to container %d with existing %.3f cores " + "would exceed its capacity of %.3f cores", instancePlan.getComponentName(), instancePlan.getResource().getCpu(), container.getContainerId(), usedResource.getCpu(), capacity.getCpu())); } if (capacity.getRam().lessThan(newUsedResource.getRam())) { throw new ResourceExceededException(String.format("Adding instance %s with %s RAM " + "to container %d with existing %s RAM " + "would exceed its capacity of %s RAM", instancePlan.getComponentName(), instancePlan.getResource().getRam().toString(), container.getContainerId(), usedResource.getRam().toString(), capacity.getRam().toString())); } if (capacity.getDisk().lessThan(newUsedResource.getDisk())) { throw new ResourceExceededException(String.format("Adding instance %s with %s disk " + "to container %d with existing %s disk " + "would exceed its capacity of %s disk", instancePlan.getComponentName(), instancePlan.getResource().getDisk().toString(), container.getContainerId(), usedResource.getDisk().toString(), capacity.getDisk().toString())); } }

Target:
public void test(Container container, PackingPlan.InstancePlan instancePlan) throws ResourceExceededException { Resource usedResource = container.getTotalUsedResources(); Resource newUsedResource = usedResource.plus(instancePlan.getResource()); Resource capacity = container.getCapacity(); if (capacity.getCpu() < newUsedResource.getCpu()) { throw new ResourceExceededException(String.format("Adding instance %s with %.3f cores " + "to container %d with existing %.3f cores " + "would exceed its capacity of %.3f cores", instancePlan.getComponentName(), instancePlan.getResource().getCpu(), container.getContainerId(), usedResource.getCpu(), capacity.getCpu())); } if (capacity.getRam().lessThan(newUsedResource.getRam())) { throw new ResourceExceededException(String.format("Adding instance %s with %s RAM " + "to container %d with existing %s RAM " + "would exceed its capacity of %s RAM", instancePlan.getComponentName(), instancePlan.getResource().getRam().toString(), container.getContainerId(), usedResource.getRam().toString(), capacity.getRam().toString())); } if (capacity.getDisk().lessThan(newUsedResource.getDisk())) { throw new ResourceExceededException(String.format("Adding instance %s with %s disk " + "to container %d with existing %s disk " + "would exceed its capacity of %s disk", instancePlan.getComponentName(), instancePlan.getResource().getDisk().toString(), container.getContainerId(), usedResource.getDisk().toString(), capacity.getDisk().toString())); } }
Source:
public void updateStorageUsage(short partitionId, short accountId, short containerId, long storageUsage) { try { long startTimeMs = System.currentTimeMillis(); PreparedStatement insertStatement = dataAccessor.getPreparedStatement(insertSql, true); insertStatement.setString(1, clustername); insertStatement.setString(2, hostname); insertStatement.setInt(3, partitionId); insertStatement.setInt(4, accountId); insertStatement.setInt(5, containerId); insertStatement.setLong(6, storageUsage); insertStatement.executeUpdate(); dataAccessor.onSuccess(Write, System.currentTimeMillis() - startTimeMs); } catch (SQLException e) { dataAccessor.onException(e, Write); logger.error(String.format("Failed to execute updated on %s, with parameter %d %d %d %d", ACCOUNT_REPORTS_TABLE, partitionId, accountId, containerId, storageUsage), e); } }

Target:
public void updateStorageUsage(short partitionId, short accountId, short containerId, long storageUsage) throws SQLException { try { long startTimeMs = System.currentTimeMillis(); PreparedStatement insertStatement = dataAccessor.getPreparedStatement(insertSql, true); insertStatement.setString(1, clusterName); insertStatement.setString(2, hostname); insertStatement.setInt(3, partitionId); insertStatement.setInt(4, accountId); insertStatement.setInt(5, containerId); insertStatement.setLong(6, storageUsage); insertStatement.executeUpdate(); dataAccessor.onSuccess(Write, System.currentTimeMillis() - startTimeMs); } catch (SQLException e) { dataAccessor.onException(e, Write); logger.error(String.format("Failed to execute updated on %s, with parameter %d %d %d %d", ACCOUNT_REPORTS_TABLE, partitionId, accountId, containerId, storageUsage), e); throw e; } }
Source:
protected void executeCommand() { getSnapshotsNames(); if (isLiveMerge()) { getParameters().setLiveMerge(true); persistCommand(getParameters().getParentCommand(), true); } removeCinderSnapshotDisks(); setSucceeded(true); }

Target:
protected void executeCommand() { if (isLiveMerge()) { getParameters().setLiveMerge(true); persistCommand(getParameters().getParentCommand(), true); } removeCinderSnapshotDisks(); setSucceeded(true); }
Source:
public void testAlterTableOnGlobalIndex() throws Exception { try (Connection conn = DriverManager.getConnection(getUrl())) { conn.setAutoCommit(false); Statement stmt = conn.createStatement(); String tableName = generateUniqueName(); String globalIndexTableName = generateUniqueName(); stmt.execute("CREATE TABLE " + tableName + "(k VARCHAR PRIMARY KEY, v1 VARCHAR, v2 VARCHAR)"); stmt.execute("DROP TABLE " + tableName); Admin admin = conn.unwrap(PhoenixConnection.class).getQueryServices().getAdmin(); admin.disableTable(TableName.valueOf(tableName)); admin.deleteTable(TableName.valueOf(tableName)); conn.createStatement().execute("CREATE TABLE " + tableName + " (ID INTEGER PRIMARY KEY, COL1 VARCHAR(10), COL2 BOOLEAN)"); conn.createStatement().execute("CREATE INDEX " + globalIndexTableName + " on " + tableName + " (COL2)"); TableDescriptor originalDesc = admin.getDescriptor(TableName.valueOf(globalIndexTableName)); int expectedErrorCode = 0; try { conn.createStatement().execute("ALTER TABLE " + globalIndexTableName + " ADD CF1.AGE INTEGER "); conn.commit(); } catch (SQLException e) { expectedErrorCode = e.getErrorCode(); } assertEquals(expectedErrorCode, CANNOT_MUTATE_TABLE.getErrorCode()); TableDescriptor finalDesc = admin.getDescriptor(TableName.valueOf(globalIndexTableName)); assertTrue(finalDesc.equals(originalDesc)); } }

Target:
public void testAlterTableOnGlobalIndex() throws Exception { try (Connection conn = DriverManager.getConnection(getUrl()); Statement stmt = conn.createStatement()) { conn.setAutoCommit(false); Admin admin = conn.unwrap(PhoenixConnection.class).getQueryServices().getAdmin(); String tableName = generateUniqueName(); String globalIndexTableName = generateUniqueName(); stmt.execute("CREATE TABLE " + tableName + " (ID INTEGER PRIMARY KEY, COL1 VARCHAR(10), COL2 BOOLEAN)"); stmt.execute("CREATE INDEX " + globalIndexTableName + " on " + tableName + " (COL2)"); TableDescriptor originalDesc = admin.getDescriptor(TableName.valueOf(globalIndexTableName)); int expectedErrorCode = 0; try { stmt.execute("ALTER TABLE " + globalIndexTableName + " ADD CF1.AGE INTEGER "); conn.commit(); fail("The alter table did not fail as expected"); } catch (SQLException e) { assertEquals(e.getErrorCode(), CANNOT_MUTATE_TABLE.getErrorCode()); } TableDescriptor finalDesc = admin.getDescriptor(TableName.valueOf(globalIndexTableName)); assertTrue(finalDesc.equals(originalDesc)); stmt.execute("DROP TABLE " + tableName); } }
Source:
public CouponModel(CouponDto couponDto) { this.shared = couponDto.isShared(); this.amount = AmountConverter.convertStringToCent(couponDto.getAmount()); this.startTime = couponDto.getStartTime() != null ? new DateTime(couponDto.getStartTime()).withTimeAtStartOfDay().toDate() : null; this.endTime = couponDto.getEndTime() != null ? new DateTime(couponDto.getEndTime()).withTimeAtStartOfDay().plusDays(1).minusSeconds(1).toDate() : null; this.deadline = couponDto.getDeadline() != null ? couponDto.getDeadline() : 0; this.totalCount = couponDto.getTotalCount() != null ? couponDto.getTotalCount() : 0; this.productTypes = couponDto.getProductTypes(); this.couponType = couponDto.getCouponType(); this.investLowerLimit = AmountConverter.convertStringToCent(couponDto.getInvestLowerLimit()); this.smsAlert = couponDto.isSmsAlert(); this.userGroup = couponDto.getUserGroup(); this.rate = couponDto.getRate() == null ? 0 : new BigDecimal(couponDto.getRate()).divide(new BigDecimal(100), 3, BigDecimal.ROUND_HALF_UP).doubleValue(); this.birthdayBenefit = couponDto.getBirthdayBenefit() == null ? 0 : new BigDecimal(couponDto.getBirthdayBenefit()).subtract(new BigDecimal(1)).doubleValue(); this.agents = couponDto.getAgents(); this.channels = couponDto.getChannels(); this.multiple = (couponDto.getCouponType() == CouponType.BIRTHDAY_COUPON || couponDto.getUserGroup() == UserGroup.FIRST_INVEST_ACHIEVEMENT || couponDto.getUserGroup() == UserGroup.MAX_AMOUNT_ACHIEVEMENT || couponDto.getUserGroup() == UserGroup.LAST_INVEST_ACHIEVEMENT || couponDto.getMultiple()); }

Target:
public CouponModel(CouponDto couponDto){ this.shared = couponDto.isShared(); this.amount = AmountConverter.convertStringToCent(couponDto.getAmount()); this.startTime = couponDto.getStartTime() != null ? new DateTime(couponDto.getStartTime()).withTimeAtStartOfDay().toDate() : null; this.endTime = couponDto.getEndTime() != null ? new DateTime(couponDto.getEndTime()).withTimeAtStartOfDay().plusDays(1).minusSeconds(1).toDate() : null; this.deadline = couponDto.getDeadline() != null ? couponDto.getDeadline() : 0; this.totalCount = couponDto.getTotalCount() != null ? couponDto.getTotalCount() : 0; this.productTypes = couponDto.getProductTypes() ; this.couponType = couponDto.getCouponType(); this.investLowerLimit = AmountConverter.convertStringToCent(couponDto.getInvestLowerLimit()); this.smsAlert = couponDto.isSmsAlert(); this.userGroup = couponDto.getUserGroup(); this.rate = couponDto.getRate() == null ? 0 : new BigDecimal(couponDto.getRate()).divide(new BigDecimal(100), 3, BigDecimal.ROUND_HALF_UP).doubleValue(); this.birthdayBenefit = couponDto.getBirthdayBenefit() == null ? 0 : new BigDecimal(couponDto.getBirthdayBenefit()).subtract(new BigDecimal(1)).doubleValue(); this.agents = couponDto.getAgents(); this.channels = couponDto.getChannels(); this.multiple = Lists.newArrayList(CouponType.BIRTHDAY_COUPON,UserGroup.FIRST_INVEST_ACHIEVEMENT,UserGroup.MAX_AMOUNT_ACHIEVEMENT,UserGroup.LAST_INVEST_ACHIEVEMENT).contains(couponDto.getUserGroup()); }
Source:
protected void executeQueryCommand() { Map<Guid, List<GraphicsDevice>> result = new HashMap<>(); mapDevices(result, VmDeviceType.SPICE); mapDevices(result, VmDeviceType.VNC); setReturnValue(result); }

Target:
protected void executeQueryCommand() { Map<Guid, List<GraphicsDevice>> result = new HashMap<>(); List<VmDevice> devicesList = getDbFacade().getVmDeviceDao().getVmGraphicsDevices( getUserID(), getParameters().isFiltered()); for (VmDevice device : devicesList) { result.computeIfAbsent(device.getVmId(), guid -> new ArrayList<>()).add(new GraphicsDevice(device)); } setReturnValue(result); }
Source:
public Object execute(final ExecutionEvent event) throws ExecutionException { IResource[] selected = getSelectedResources(); if (selected.length != 1 || !(selected[0] instanceof IStorage)) return null; Repository repository = getRepository(); if (repository == null) return null; RepositoryMapping mapping = RepositoryMapping.getMapping(selected[0] .getProject()); if (mapping == null) return null; String path = mapping.getRepoRelativePath(selected[0]); IStorage storage = (IStorage) selected[0]; Shell shell = HandlerUtil.getActiveShell(event); IWorkbenchPage page = HandlerUtil.getActiveSite(event).getPage(); JobUtil.scheduleUserJob(new BlameOperation(repository, storage, path, null, shell, page), UIText.ShowBlameHandler_JobName, null); return null; }

Target:
public Object execute(final ExecutionEvent event) throws ExecutionException { IResource[] selected = getSelectedResources(); if (selected.length != 1 || !(selected[0] instanceof IStorage)) return null; Repository repository = getRepository(); if (repository == null) return null; RepositoryMapping mapping = RepositoryMapping.getMapping(selected[0] .getProject()); if (mapping == null) return null; String path = mapping.getRepoRelativePath(selected[0]); IStorage storage = (IStorage) selected[0]; Shell shell = HandlerUtil.getActiveShell(event); IWorkbenchPage page = HandlerUtil.getActiveSite(event).getPage(); JobUtil.scheduleUserJob(new BlameOperation(repository, storage, path, null, shell, page), UIText.ShowBlameHandler_JobName, JobFamilies.BLAME); return null; }
Source:
public int hashCode() { int result = 17; result = 31 * result + id.hashCode(); result = 31 * result + Long.hashCode(period); result = 31 * result + this.periodTimeUnit.hashCode(); result = 31 * result + Long.hashCode(initialDelay); return result; }

Target:
public int hashCode() { return Objects.hash(id, period, periodTimeUnit, initialDelay); }
Source:
public Object doWork() { Utils.regularReadableUserFile(vcfList); try ( FalsePositiveTableWriter writer = new FalsePositiveTableWriter(output) ) { List<String> vcfFilePaths = Files.readAllLines(Paths.get(vcfList.toString())); List<File> vcfFiles = vcfFilePaths.stream().map(File::new).collect(Collectors.toList()); writer.writeAllRecords(vcfFiles); } catch (IOException e){ throw new UserException(String.format("Encountered an IO exception while reading (or reading a file in) %s or %s", vcfList.toString(), output)); } return "SUCCESS"; }

Target:
public Object doWork() { Utils.regularReadableUserFile(vcfList); try ( FalsePositiveTableWriter writer = new FalsePositiveTableWriter(output) ) { List<String> vcfFilePaths = Files.readAllLines(Paths.get(vcfList.toString())); List<FalsePositiveRecord> falsePositiveRecords = vcfFilePaths.stream().map(str -> new FalsePositiveRecord(new File(str))).collect(Collectors.toList()); writer.writeAllRecords(falsePositiveRecords); } catch (IOException e){ throw new UserException(String.format("Encountered an IO exception while reading %s, %s, or files listed in them", vcfList.toString(), output)); } return "SUCCESS"; }
Source:
public Optional<String> getCommitTemplatePath() { return Optional.ofNullable(commitTemplatePath); }

Target:
public String getCommitTemplatePath() { return commitTemplatePath; }
Source:
public void testReadUnsignedShort() throws Exception { inMockedDis.readShort(); verify(mockedDis).readShort(); }

Target:
public void testReadUnsignedShort() throws Exception { inMockedDis.readUnsignedShort(); verify(mockedDis).readShort(); }
Source:
private void run(Simulation simulation, String user) { Supplier<String> otherUser = () -> fileSystems.getNextUser(user); Supplier<Path> randomFilePathForUser = () -> index.getRandomExistingFile(user); switch (simulation) { case READ: read(user, randomFilePathForUser.get()); break; case WRITE: write(user); break; case MKDIR: mkdir(user); break; case RM: rm(user); break; case RMDIR: rmdir(user); break; case GRANT: grantRead(user, otherUser.get(), randomFilePathForUser.get()); break; case REVOKE: revokeRead(user, otherUser.get(), fileSystems.getReferenceFileSystem(user).getRandomSharedPath(random, FileSystem.Permission.READ)); break; default: throw new IllegalStateException("Unexpected simulation " + simulation); } simulationRecord.add(simulation); }

Target:
private void run(Simulation simulation, String user) { Supplier<String> otherUser = () -> fileSystems.getNextUser(user); Supplier<Path> randomFilePathForUser = () -> index.getRandomExistingFile(user); Supplier<Path> randomFolderPathForUser = () -> index.getRandomExistingDirectory(user, true); switch (simulation) { case READ: read(user, randomFilePathForUser.get()); break; case WRITE: write(user); break; case MKDIR: mkdir(user); break; case RM: rm(user); break; case RMDIR: rmdir(user); break; case GRANT_READ_FILE: case GRANT_WRITE_FILE: Path grantFilePath = randomFilePathForUser.get(); String fileGrantee = otherUser.get(); log(user, simulation, grantFilePath, " with grantee "+ fileGrantee); grantPermission(user, fileGrantee, grantFilePath, simulation.permission()); break; case GRANT_READ_DIR: case GRANT_WRITE_DIR: String dirGrantee = otherUser.get(); Path grantDirPath = randomFolderPathForUser.get(); log(user, simulation, grantDirPath, " with grantee "+ dirGrantee); grantPermission(user, dirGrantee, grantDirPath, simulation.permission()); break; case REVOKE_READ: case REVOKE_WRITE: String revokee = otherUser.get(); Path revokePath = fileSystems.getReferenceFileSystem(user).getRandomSharedPath(random, simulation.permission()); log(user, simulation, revokePath, " with revokee "+ revokee); revokePermission(user, revokee, revokePath, simulation.permission()); break; default: throw new IllegalStateException("Unexpected simulation " + simulation); } simulationRecord.add(simulation); }
Source:
public void onPostReceive(ReceivePack rp, Collection<ReceiveCommand> commands) { for (PostReceiveHook hook : hooks) { hook.onPostReceive(rp, commands); } }

Target:
public void onPostReceive(ReceivePack rp, Collection<ReceiveCommand> commands) { for (int i = 0; i < count; i++) hooks[i].onPostReceive(rp, commands); }
Source:
public void close() throws IOException { for (Thread thread : threads) { if (thread != Thread.currentThread()) { thread.interrupt(); } } delegate.close(); }

Target:
public void close() throws IOException { closeResources(); delegate.close(); }
Source:
public String apply(AccountResource rsrc) throws AuthException, ResourceNotFoundException, OrmException { if (self.get() != rsrc.getUser() && !self.get().getCapabilities().canAdministrateServer()) { throw new AuthException("not allowed to get http password"); } AccountExternalId id = dbProvider.get().accountExternalIds().get( new AccountExternalId.Key(SCHEME_USERNAME, rsrc.getUser().getUserName())); if (id == null) { throw new ResourceNotFoundException(); } return Strings.nullToEmpty(id.getPassword()); }

Target:
public String apply(AccountResource rsrc) throws AuthException, ResourceNotFoundException, OrmException { if (self.get() != rsrc.getUser() && !self.get().getCapabilities().canAdministrateServer()) { throw new AuthException("not allowed to get http password"); } AccountState s = rsrc.getUser().state(); if (s.getUserName() == null) { throw new ResourceNotFoundException(); } String p = s.getPassword(s.getUserName()); if (p == null) { throw new ResourceNotFoundException(); } return p; }
Source:
public void contextDisposed() { super.contextDisposed(); eventBroker.unsubscribe(itemUpdater); eventBroker.unsubscribe(selectionUpdater); eventBroker.unsubscribe(enabledUpdater); eventBroker.unsubscribe(toBeRenderedUpdater); eventBroker.unsubscribe(childAdditionUpdater); }

Target:
public void contextDisposed() { eventBroker.unsubscribe(itemUpdater); eventBroker.unsubscribe(selectionUpdater); eventBroker.unsubscribe(enabledUpdater); eventBroker.unsubscribe(toBeRenderedUpdater); eventBroker.unsubscribe(childAdditionUpdater); super.contextDisposed(); }