auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Collection<PackFile> repack(ProgressMonitor pm) throws IOException { PackConfig packConfig = new PackConfig(repo); if (packConfig.getIndexVersion() != 2) throw new IllegalStateException("Only index version 2"); Map<String, Ref> refsBefore = repo.getAllRefs(); HashSet<ObjectId> allHeads = new HashSet<ObjectId>(); HashSet<ObjectId> nonHeads = new HashSet<ObjectId>(); HashSet<ObjectId> tagTargets = new HashSet<ObjectId>(); HashSet<ObjectId> indexObjects = listNonHEADIndexObjects(); for (Ref ref : refsBefore.values()) { if (ref.isSymbolic() || ref.getObjectId() == null) continue; if (isHead(ref)) allHeads.add(ref.getObjectId()); else nonHeads.add(ref.getObjectId()); if (ref.getPeeledObjectId() != null) tagTargets.add(ref.getPeeledObjectId()); } tagTargets.addAll(allHeads); nonHeads.addAll(indexObjects); List<PackFile> ret = new ArrayList<PackFile>(2); ret.add(packHeads(pm, allHeads)); if (!nonHeads.isEmpty()) ret.add(packRest(pm, nonHeads, allHeads)); return ret; }

Target:
public Collection<PackFile> repack(ProgressMonitor pm) throws IOException { PackConfig packConfig = new PackConfig(repo); if (packConfig.getIndexVersion() != 2) throw new IllegalStateException("Only index version 2"); Map<String, Ref> refsBefore = repo.getAllRefs(); for (Ref ref : repo.getRefDatabase().getAdditionalRefs()) refsBefore.put(ref.getName(), ref); HashSet<ObjectId> allHeads = new HashSet<ObjectId>(); HashSet<ObjectId> nonHeads = new HashSet<ObjectId>(); HashSet<ObjectId> tagTargets = new HashSet<ObjectId>(); HashSet<ObjectId> indexObjects = listNonHEADIndexObjects(); for (Ref ref : refsBefore.values()) { if (ref.isSymbolic() || ref.getObjectId() == null) continue; if (isHead(ref)) allHeads.add(ref.getObjectId()); else nonHeads.add(ref.getObjectId()); if (ref.getPeeledObjectId() != null) tagTargets.add(ref.getPeeledObjectId()); } tagTargets.addAll(allHeads); nonHeads.addAll(indexObjects); List<PackFile> ret = new ArrayList<PackFile>(2); ret.add(packHeads(pm, allHeads)); if (!nonHeads.isEmpty()) { PackFile rest = packRest(pm, nonHeads, allHeads); if (rest!=null) ret.add(rest); } return ret; }
Source:
private void loadPageFromCache() { app.getPageCache() .get(model.getTitleOriginal(), currentSequenceNum, new PageCache.CacheGetListener() { @Override public void onGetComplete(Page page, int sequence) { if (sequence != currentSequenceNum) { return; } if (page != null) { Log.d(TAG, "Using page from cache: " + model.getTitleOriginal().getDisplayText()); Log.v(TAG, "ETag of cached page: " + page.getPageProperties().getEtag()); model.setPage(page); model.setTitle(page.getTitle()); final HistoryEntry curEntry = model.getCurEntry(); model.setCurEntry( new HistoryEntry(model.getTitle(), curEntry.getSource())); updateThumbnail(PageImage.PERSISTENCE_HELPER.getImageUrlForTitle(app, model.getTitle())); new SaveHistoryTask(model.getCurEntry(), app).execute(); cacheOnComplete = false; state = STATE_COMPLETE_FETCH; setState(state); performActionForState(state); if (fragment.isAdded()) { fragment.onPageLoadComplete(); } } else { Log.d(TAG, "Could not page in cache, loading from network"); loadPageFromNetwork(); } } @Override public void onGetError(Throwable e, int sequence) { Log.e(TAG, "Failed to get page from cache.", e); if (sequence != currentSequenceNum) { return; } loadPageFromNetwork(); } }); }

Target:
private void loadPageFromCache() { app.getPageCache() .get(model.getTitleOriginal(), currentSequenceNum, new PageCache.CacheGetListener() { @Override public void onGetComplete(Page page, int sequence) { if (sequence != currentSequenceNum) { return; } if (page != null) { Log.d(TAG, "Using page from cache: " + model.getTitleOriginal().getDisplayText()); Log.v(TAG, "ETag of cached page: " + page.getPageProperties().getEtag()); model.setPage(page); model.setTitle(page.getTitle()); final HistoryEntry curEntry = model.getCurEntry(); model.setCurEntry( new HistoryEntry(model.getTitle(), curEntry.getSource())); updateThumbnail(PageImage.PERSISTENCE_HELPER.getImageUrlForTitle(app, model.getTitle())); new SaveHistoryTask(model.getCurEntry(), app).execute(); cacheOnComplete = false; state = STATE_COMPLETE_FETCH; setState(state); performActionForState(state); if (fragment.isAdded()) { fragment.onPageLoadComplete(); } } else { Log.d(TAG, "Page not in cache, loading from network"); loadPageFromNetwork(); } } @Override public void onGetError(Throwable e, int sequence) { Log.e(TAG, "Failed to get page from cache.", e); if (sequence != currentSequenceNum) { return; } loadPageFromNetwork(); } }); }
Source:
public void minimalConfig() { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("outbound-gateway-parser-config.xml", this.getClass()); MongoDbOutboundGateway gateway = TestUtils.getPropertyValue(context.getBean("minimalConfig"), "handler", MongoDbOutboundGateway.class); assertNotNull(TestUtils.getPropertyValue(gateway, "mongoTemplate")); assertEquals(context.getBean("mongoDbFactory"), TestUtils.getPropertyValue(gateway, "mongoDbFactory")); assertNotNull(TestUtils.getPropertyValue(gateway, "evaluationContext")); assertTrue(TestUtils.getPropertyValue(gateway, "collectionNameExpression") instanceof LiteralExpression); assertEquals("data", TestUtils.getPropertyValue(gateway, "collectionNameExpression.literalValue")); context.close(); }

Target:
public void minimalConfig() { MongoDbOutboundGateway gateway = TestUtils.getPropertyValue(context.getBean("minimalConfig"), "handler", MongoDbOutboundGateway.class); assertNotNull(TestUtils.getPropertyValue(gateway, "mongoTemplate")); assertEquals(context.getBean("mongoDbFactory"), TestUtils.getPropertyValue(gateway, "mongoDbFactory")); assertNotNull(TestUtils.getPropertyValue(gateway, "evaluationContext")); assertTrue(TestUtils.getPropertyValue(gateway, "collectionNameExpression") instanceof LiteralExpression); assertEquals("foo", TestUtils.getPropertyValue(gateway, "collectionNameExpression.literalValue")); }
Source:
public abstract long length() throws IOException; public abstract long lastModified() throws IOException; public int mode() throws IOException { return -1; }

Target:
public abstract long length() throws IOException; public abstract long lastModified() throws IOException; @Restricted(Beta.class) public int mode() throws IOException { return -1; }
Source:
public Optional<ExternalDataObject> getExternalDataObject(String id) { HttpGet method = null; SHERPAResponse sherpaResponse = null; int timeout = 5000; URIBuilder uriBuilder = null; try { uriBuilder = new URIBuilder(url); uriBuilder.addParameter("jtitle", id); if (StringUtils.isNotBlank(apiKey)) { uriBuilder.addParameter("ak", apiKey); } method = new HttpGet(uriBuilder.build()); method.setConfig(RequestConfig.custom() .setConnectionRequestTimeout(timeout) .setConnectTimeout(timeout) .setSocketTimeout(timeout) .build()); HttpResponse response = client.execute(method); int statusCode = response.getStatusLine().getStatusCode(); if (statusCode != HttpStatus.SC_OK) { sherpaResponse = new SHERPAResponse("SHERPA/RoMEO return not OK status: " + statusCode); } HttpEntity responseBody = response.getEntity(); if (null != responseBody) { sherpaResponse = new SHERPAResponse(responseBody.getContent()); } else { sherpaResponse = new SHERPAResponse("SHERPA/RoMEO returned no response"); } } catch (Exception e) { log.error(e.getMessage(), e); } if (sherpaResponse == null) { sherpaResponse = new SHERPAResponse( "Error processing the SHERPA/RoMEO answer"); } if (CollectionUtils.isNotEmpty(sherpaResponse.getJournals())) { SHERPAJournal sherpaJournal = sherpaResponse.getJournals().get(0); ExternalDataObject externalDataObject = constructExternalDataObjectFromSherpaJournal(sherpaJournal); return Optional.of(externalDataObject); } return null; }

Target:
public Optional<ExternalDataObject> getExternalDataObject(String id) { HttpGet method = null; SHERPAResponse sherpaResponse = null; int timeout = 5000; URIBuilder uriBuilder = null; try { uriBuilder = new URIBuilder(url); uriBuilder.addParameter("jtitle", id); if (StringUtils.isNotBlank(apiKey)) { uriBuilder.addParameter("ak", apiKey); } method = new HttpGet(uriBuilder.build()); method.setConfig(RequestConfig.custom() .setConnectionRequestTimeout(timeout) .setConnectTimeout(timeout) .setSocketTimeout(timeout) .build()); HttpResponse response = client.execute(method); int statusCode = response.getStatusLine().getStatusCode(); if (statusCode != HttpStatus.SC_OK) { sherpaResponse = new SHERPAResponse("SHERPA/RoMEO return not OK status: " + statusCode); } HttpEntity responseBody = response.getEntity(); if (null != responseBody) { sherpaResponse = new SHERPAResponse(responseBody.getContent()); } else { sherpaResponse = new SHERPAResponse("SHERPA/RoMEO returned no response"); } } catch (Exception e) { log.error("SHERPA/RoMEO query failed: ", e); } if (sherpaResponse == null) { sherpaResponse = new SHERPAResponse( "Error processing the SHERPA/RoMEO answer"); } if (CollectionUtils.isNotEmpty(sherpaResponse.getJournals())) { SHERPAJournal sherpaJournal = sherpaResponse.getJournals().get(0); ExternalDataObject externalDataObject = constructExternalDataObjectFromSherpaJournal(sherpaJournal); return Optional.of(externalDataObject); } return null; }
Source:
private static void fetchRequestProcessorMetrics(long now, MBeanServer mbs, List<Metric> metrics) throws JMException { final ObjectName globalName = new ObjectName("Catalina:type=GlobalRequestProcessor,*"); final Set<ObjectName> names = mbs.queryNames(globalName, null); if (names == null) { return; } for (ObjectName name : names) { AttributeList list = mbs.getAttributes(name, GLOBAL_REQ_ATTRS); for (Attribute a : list.asList()) { if (!a.getName().equals("maxTime")) { metrics.add(toCounter(now, name, a)); } else { metrics.add(toGauge(now, name, a)); } } } LOGGER.info("GlobalReqProc={}", metrics); }

Target:
private static void fetchRequestProcessorMetrics(long now, MBeanServer mbs, List<Metric> metrics) throws JMException { final ObjectName globalName = new ObjectName("Catalina:type=GlobalRequestProcessor,*"); final Set<ObjectName> names = mbs.queryNames(globalName, null); if (names == null) { return; } for (ObjectName name : names) { AttributeList list = mbs.getAttributes(name, GLOBAL_REQ_ATTRS); for (Attribute a : list.asList()) { addMetric(metrics, a.getName().equals("maxTime") ? toGauge(now, name, a) : toCounter(now, name, a)); } } }
Source:
public void testSpecialCharacterNames() throws Exception { XMLUnit.setXpathNamespaceContext(NS_XML); Document doc = getAsDOM("/rest/resource/po%c3%abzie?format=xml"); XMLAssert.assertXpathEvaluatesTo("http://localhost:8080/geoserver/rest/resource/po%c3%abzie/caf%c3%a9", "/ResourceDirectory/children/child/atom:link/@href", doc); MockHttpServletResponse response = getAsServletResponse("/rest/resource/po%c3%abzie/caf%c3%a9"); Assert.assertEquals(200, response.getStatusCode()); Assert.assertEquals("resource", response.getHeader("Resource-Type")); Assert.assertEquals("http://localhost:8080/geoserver/rest/resource/po%c3%abzie", response.getHeader("Resource-Parent")); }

Target:
public void testSpecialCharacterNames() throws Exception { XMLUnit.setXpathNamespaceContext(NS_XML); Document doc = getAsDOM("/rest/resource/po%c3%abzie?format=xml"); XMLAssert.assertXpathEvaluatesTo("http://localhost:8080/geoserver/rest/resource/po%C3%ABzie/caf%C3%A9", "/ResourceDirectory/children/child/atom:link/@href", doc); MockHttpServletResponse response = getAsServletResponse("/rest/resource/po%c3%abzie/caf%c3%a9?format=xml"); Assert.assertEquals(200, response.getStatusCode()); Assert.assertEquals("resource", response.getHeader("Resource-Type")); Assert.assertEquals("http://localhost:8080/geoserver/rest/resource/po%C3%ABzie", response.getHeader("Resource-Parent")); }
Source:
public void getObjectWithSyncNoUpdate() throws Exception { final String bucketName = "test_get_object_with_sync_no_update"; final String objectName = "beowulf.txt"; try { Util.copyFile(objectName, Util.RESOURCE_BASE_NAME, Util.DOWNLOAD_BASE_NAME); File newFile = new File(Util.DOWNLOAD_BASE_NAME + "/" + objectName); DateTime now = new DateTime(); newFile.setLastModified(now.getMillis()); Util.createBucket(client, bucketName); Util.loadBookTestData(client, bucketName); final Arguments args = new Arguments(new String[]{"--http", "-c", "get_object", "-b", bucketName, "-o", objectName, "-d", Util.DOWNLOAD_BASE_NAME, "--sync"}); CommandResponse response = Util.command(client, args); assertThat(response.getMessage(), is("SUCCESS: No need to sync " + objectName)); } finally { Util.deleteBucket(client, bucketName); Util.deleteLocalFile(objectName); } }

Target:
public void getObjectWithSyncNoUpdate() throws Exception { final String bucketName = "test_get_object_with_sync_no_update"; final String objectName = "beowulf.txt"; try { Util.copyFile(objectName, Util.RESOURCE_BASE_NAME, Util.DOWNLOAD_BASE_NAME); final File newFile = new File(Util.DOWNLOAD_BASE_NAME + File.separator + objectName); final DateTime now = new DateTime(); newFile.setLastModified(now.getMillis()); Util.createBucket(client, bucketName); Util.loadBookTestData(client, bucketName); final Arguments args = new Arguments(new String[]{"--http", "-c", "get_object", "-b", bucketName, "-o", objectName, "-d", Util.DOWNLOAD_BASE_NAME, "--sync"}); final CommandResponse response = Util.command(client, args); assertThat(response.getMessage(), is("SUCCESS: No need to sync " + objectName)); } finally { Util.deleteBucket(client, bucketName); Util.deleteLocalFile(objectName); } }
Source:
public Hashtable<String, String> getPathStatus(final Path path) throws AzureBlobFileSystemException { try (AbfsPerfInfo tracker = startTracking("getPathStatus", "getPathStatus")){ LOG.debug("getPathStatus for filesystem: path: {}", client.getFileSystem(), path); final Hashtable<String, String> parsedXmsProperties; final AbfsRestOperation op = client.getPathStatus(AbfsHttpConstants.FORWARD_SLASH + getRelativePath(path)); tracker.registerResult(op.getResult()); final String xMsProperties = op.getResult().getResponseHeader(HttpHeaderConfigurations.X_MS_PROPERTIES); parsedXmsProperties = parseCommaSeparatedXmsProperties(xMsProperties); tracker.registerSuccess(true); return parsedXmsProperties; } }

Target:
public Hashtable<String, String> getPathStatus(final Path path) throws AzureBlobFileSystemException { try (AbfsPerfInfo perfInfo = startTracking("getPathStatus", "getPathStatus")){ LOG.debug("getPathStatus for filesystem: path: {}", client.getFileSystem(), path); final Hashtable<String, String> parsedXmsProperties; final AbfsRestOperation op = client.getPathStatus(AbfsHttpConstants.FORWARD_SLASH + getRelativePath(path)); perfInfo.registerResult(op.getResult()); final String xMsProperties = op.getResult().getResponseHeader(HttpHeaderConfigurations.X_MS_PROPERTIES); parsedXmsProperties = parseCommaSeparatedXmsProperties(xMsProperties); perfInfo.registerSuccess(true); return parsedXmsProperties; } }
Source:
private ResponseEntity<?> sendRequest(String url, Object requestData, Method method, RestTemplate restTemplate, int retryCount, long retryInterval) { ResponseEntity<?> retValue = null; Callable<ResponseEntity<?>> task = new Callable<ResponseEntity<?>>() { public ResponseEntity<?> call() throws HttpException { LOGGER.info("Posting Http request -- Url: {}, Data: {}", url, String.valueOf(requestData)); ResponseEntity<?> response = null; String errorMessage = null; try { response = doExecuteForReturnType(url, requestData, method, restTemplate); } catch (Exception e) { errorMessage = e.getMessage(); throw (e instanceof HttpException) ? (HttpException) e : new HttpException("HTTP error when executing task", e); } finally { if (response != null) { sendAuditLog(url, requestData, response.getBody().toString(), response.getStatusCode().toString()); } else { sendAuditLog(url, requestData, errorMessage.substring(4), errorMessage.substring(0, 4)); } } if (response.getStatusCode().value() / HUNDRED == 2) { return response; } else { throw new HttpException(); } } }; RetriableTask<ResponseEntity<?>> r = new RetriableTask<>( retryCount, retryInterval, task); try { retValue = r.call(); } catch (Exception e) { LOGGER.error("Posting Http request -- Url: {}, Data: failed after retries at interval of ms.", url, String.valueOf(requestData), String.valueOf(retryCount), String.valueOf(retryInterval), e); } return retValue; }

Target:
private ResponseEntity<?> sendRequest(String url, Object requestData, Method method, RestTemplate restTemplate, int retryCount, long retryInterval) { ResponseEntity<?> retValue = null; Callable<ResponseEntity<?>> task = new Callable<ResponseEntity<?>>() { public ResponseEntity<?> call() throws HttpException { LOGGER.info("Posting Http request -- Url: {}, Data: {}", url, String.valueOf(requestData)); ResponseEntity<?> response = null; String errorMessage = null; response = doExecuteForReturnType(url, requestData, method, restTemplate); if(response != null) { return response; } else { throw new HttpException(); } } }; RetriableTask<ResponseEntity<?>> r = new RetriableTask<>( retryCount, retryInterval, task); try { retValue = r.call(); } catch (Exception e) { LOGGER.error("Posting Http request -- Url: {}, Data: failed after retries at interval of ms.", url, String.valueOf(requestData), String.valueOf(retryCount), String.valueOf(retryInterval), e); } return retValue; }
Source:
public void whenSerializingJava8DateAndReadingValue_thenCorrect() throws IOException { final String stringDate = "\"2014-12-20\""; final ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new JavaTimeModule()); mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); final String result2 = mapper.readValue(stringDate, LocalDate.class) .toString(); assertThat(result2, containsString("2014-12-20")); }

Target:
public void whenSerializingJava8DateAndReadingValue_thenCorrect() throws IOException { String stringDate = "\"2014-12-20\""; ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new JavaTimeModule()); mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); LocalDate result = mapper.readValue(stringDate, LocalDate.class); assertThat(result.toString(), containsString("2014-12-20")); }
Source:
private HighResolutionClock createHighResClock(Config config) { MetricsConfig metricsConfig = new MetricsConfig(config); if (metricsConfig.getMetricsTimerDebugEnabled()) { return System::nanoTime; } else { return () -> 0; } }

Target:
private HighResolutionClock createHighResClock(Config config) { MetricsConfig metricsConfig = new MetricsConfig(config); if (metricsConfig.getMetricsTimerEnabled() && metricsConfig.getMetricsTimerDebugEnabled()) { return System::nanoTime; } else { return () -> 0; } }
Source:
public ConfigureLocalStorageModel() { setStorage(new LocalStorageModel()); setDataCenter(new DataCenterModel()); getDataCenter().getVersion().getSelectedItemChangedEvent().addListener(this); setCluster(new ClusterModel()); getCluster().init(false); getCluster().setIsNew(true); UIConstants constants = ConstantsManager.getInstance().getConstants(); getCluster().getCPU().setIsChangeable(false, constants.cpuAutoDetect()); setFormattedStorageName(new EntityModel<String>()); for (Boolean bool : getDataCenter().getStoragePoolType().getItems()) { if (bool) { getDataCenter().getStoragePoolType().setSelectedItem(bool); break; } } setValidTab(TabName.GENERAL_TAB, true); }

Target:
public ConfigureLocalStorageModel() { setStorage(new LocalStorageModel()); setDataCenter(new DataCenterModel()); getDataCenter().getVersion().getSelectedItemChangedEvent().addListener(this); setCluster(new ClusterModel()); getCluster().init(false); getCluster().setIsNew(true); getCluster().getCPU().setIsChangeable(false, constants.cpuAutoDetect()); setFormattedStorageName(new EntityModel<String>()); for (Boolean bool : getDataCenter().getStoragePoolType().getItems()) { if (bool) { getDataCenter().getStoragePoolType().setSelectedItem(bool); break; } } setValidTab(TabName.GENERAL_TAB, true); }
Source:
public CommandCallback getCallback() { return isCinderDisksExist() ? null : new ConcurrentChildCommandsExecutionCallback(); }

Target:
public CommandCallback getCallback() { return isCinderDisksExist() ? new ConcurrentChildCommandsExecutionCallback() : null; }
Source:
public RepoStatistics getStatistics() throws IOException { RepoStatistics ret = new RepoStatistics(); Set<ObjectId> packedObjects = new HashSet<ObjectId>(); for (PackFile f : repo.getObjectDatabase().getPacks()) { for (MutableEntry e : f.getIndex()) packedObjects.add(e.toObjectId()); } ret.numberOfPackedObjects = packedObjects.size(); ret.numberOfPackFiles = repo.getObjectDatabase().getPacks().size(); ret.numberOfLooseObjects = 0; File objDir = repo.getObjectsDirectory(); String[] fanout = objDir.list(); if (fanout != null && fanout.length > 0) { for (String d : fanout) { if (d.length() != 2) continue; String[] entries = new File(objDir, d).list(); if (entries == null) continue; for (String e : entries) { if (e.length() != Constants.OBJECT_ID_STRING_LENGTH - 2) continue; ret.numberOfLooseObjects++; } } } return ret; }

Target:
public RepoStatistics getStatistics() throws IOException { RepoStatistics ret = new RepoStatistics(); Collection<PackFile> packs = repo.getObjectDatabase().getPacks(); for (PackFile f : packs) ret.numberOfPackedObjects += f.getIndex().getObjectCount(); ret.numberOfPackFiles = packs.size(); File objDir = repo.getObjectsDirectory(); String[] fanout = objDir.list(); if (fanout != null && fanout.length > 0) { for (String d : fanout) { if (d.length() != 2) continue; String[] entries = new File(objDir, d).list(); if (entries == null) continue; for (String e : entries) { if (e.length() != Constants.OBJECT_ID_STRING_LENGTH - 2) continue; ret.numberOfLooseObjects++; } } } return ret; }
Source:
private synchronized OutputStream addPostSteps(ProcessingStepHandler handler, IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) { ArrayList<ProcessingStep> steps = new ArrayList<ProcessingStep>(); steps.add(new SignatureVerifier()); List<ChecksumVerifier> checksumVerifiers = ChecksumUtilities.getChecksumVerifiers(descriptor); for (ChecksumVerifier checksumVerifier : checksumVerifiers) { steps.add(checksumVerifier); } if (steps.isEmpty()) return destination; ProcessingStep[] stepArray = steps.toArray(new ProcessingStep[steps.size()]); return handler.link(stepArray, destination, monitor); }

Target:
private synchronized OutputStream addPostSteps(ProcessingStepHandler handler, IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) { ArrayList<ProcessingStep> steps = new ArrayList<ProcessingStep>(); steps.add(new SignatureVerifier()); Iterable<ChecksumVerifier> checksumVerifiers = ChecksumUtilities.getChecksumVerifiers(descriptor); for (ChecksumVerifier checksumVerifier : checksumVerifiers) { steps.add(checksumVerifier); } if (steps.isEmpty()) return destination; ProcessingStep[] stepArray = steps.toArray(new ProcessingStep[steps.size()]); return handler.link(stepArray, destination, monitor); }
Source:
private void restartIfRequestTimerExpired(long maxTimeBetweenRequests) { synchronized (lockObject) { if (lastRequestTime != null) { Instant now = Instant.now(); Duration timeSinceLastResponse = Duration.between(lastRequestTime, now); if (timeSinceLastResponse.toMillis() > maxTimeBetweenRequests) { log.error( "{}: Last request was dispatched at {}, but no response as of ({}). Cancelling subscription, and restarting.", shardConsumer.shardInfo().shardId(), lastRequestTime, now, timeSinceLastResponse, recordsPublisher.getLastRequestId()); cancel(); startSubscriptions(); } } } }

Target:
private void restartIfRequestTimerExpired(long maxTimeBetweenRequests) { synchronized (lockObject) { if (lastRequestTime != null) { Instant now = Instant.now(); Duration timeSinceLastResponse = Duration.between(lastRequestTime, now); if (timeSinceLastResponse.toMillis() > maxTimeBetweenRequests) { log.error( "{}: Last request was dispatched at {}, but no response as of ({}). Cancelling subscription, and restarting. Last successful request details -- {}", shardConsumer.shardInfo().shardId(), lastRequestTime, now, timeSinceLastResponse, recordsPublisher.getLastSuccessfulRequestDetails()); cancel(); startSubscriptions(); } } } }
Source:
public Object execute(ExecutionEvent event) throws ExecutionException { if (fRoot == null) { throw new ExecutionException("root is null"); } IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window == null) { return false; } IRemoteConnection connection = getConnection(event.getParameters()); if (connection != null) { fLock.lock(); try { if (fRoot == null) { return null; } TargetNodeComponent node = null; if (!fRoot.containsChild(connection.getName())) { node = new TargetNodeComponent(connection.getName(), fRoot, connection); fRoot.addChild(node); } else { node = (TargetNodeComponent)fRoot.getChild(connection.getName()); } node.connect(); } finally { fLock.unlock(); } } return null; }

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { if (fRoot == null) { return false; } IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window == null) { return false; } IRemoteConnection connection = getConnection(event.getParameters()); if (connection != null) { fLock.lock(); try { if (fRoot == null) { return null; } TargetNodeComponent node = null; if (!fRoot.containsChild(connection.getName())) { node = new TargetNodeComponent(connection.getName(), fRoot, connection); fRoot.addChild(node); } else { node = (TargetNodeComponent)fRoot.getChild(connection.getName()); } node.connect(); } finally { fLock.unlock(); } } return null; }
Source:
public Position scrollToRowHeader(Position position, int scrollableRow, int headerColumn) { int row = scrollViewport(position, scrollableRow, position.column).row; return new Position(row, headerColumn); }

Target:
public Position scrollToRowHeader(Position position, int scrollableRow, int headerColumn) { Position viewportPosition = new Position(position); ViewportLayer viewportLayer = getViewportLayer(viewportPosition); if (viewportLayer == null) { throw new IllegalArgumentException("No viewport layer found at position " + position); } int scrollableColumn = viewportLayer.localToUnderlyingColumnPosition(viewportPosition.column); int row = scrollViewport(position, scrollableRow, scrollableColumn).row; return new Position(row, headerColumn); }
Source:
public int onStartCommand(Intent intent, int flags, int startId) { Logger.d(TAG, "SchedulerService started"); super.onStartCommand(intent, flags, startId); statusManager.setLatestSchedulerServiceSystemTimestampToNow(); statusManager.checkLatestLocationPointServiceWasAgesAgo(); startSyncService(); if (!statusManager.areParametersUpdated()) { Logger.d(TAG, "Parameters not updated yet. aborting scheduling."); } else { scheduleProbe(intent.getBooleanExtra(SCHEDULER_DEBUGGING, false)); } if (!statusManager.areBeginQuestionnairesCompleted()) { scheduleBeginQuestionnaire(intent.getBooleanExtra(SCHEDULER_DEBUGGING, true)); } else { Logger.d(TAG, "BeginQuestionnaire all answered . no need to schedule notif."); } stopSelf(); return START_REDELIVER_INTENT; }

Target:
public int onStartCommand(Intent intent, int flags, int startId) { Logger.d(TAG, "SchedulerService started"); super.onStartCommand(intent, flags, startId); statusManager.setLatestSchedulerServiceSystemTimestampToNow(); statusManager.checkLatestLocationPointServiceWasAgesAgo(); startSyncService(); if (!statusManager.areParametersUpdated()) { Logger.d(TAG, "Parameters not updated yet. aborting scheduling."); return START_REDELIVER_INTENT; } scheduleProbe(intent.getBooleanExtra(SCHEDULER_DEBUGGING, false)); if (!statusManager.areBeginQuestionnairesCompleted()) { scheduleBeginQuestionnaire(intent.getBooleanExtra(SCHEDULER_DEBUGGING, false)); } else { Logger.d(TAG, "BeginQuestionnaire all answered . no need to schedule notif."); } stopSelf(); return START_REDELIVER_INTENT; }
Source:
public GenericItem createItem(String itemTypeName, String itemName) { if (itemTypeName != null) { switch (itemTypeName) { case CALL: return new CallItem(itemName); case COLOR: return new ColorItem(itemName); case CONTACT: return new ContactItem(itemName); case DATETIME: return new DateTimeItem(itemName); case DIMMER: return new DimmerItem(itemName); case IMAGE: return new ImageItem(itemName); case LOCATION: return new LocationItem(itemName); case NUMBER: return new NumberItem(itemName); case PLAYER: return new PlayerItem(itemName); case ROLLERSHUTTER: return new RollershutterItem(itemName); case STRING: return new StringItem(itemName); case SWITCH: return new SwitchItem(itemName); } } return null; }

Target:
public GenericItem createItem(String itemTypeName, String itemName) { if (itemTypeName == null) { return null; } switch (itemTypeName) { case CALL: return new CallItem(itemName); case COLOR: return new ColorItem(itemName); case CONTACT: return new ContactItem(itemName); case DATETIME: return new DateTimeItem(itemName); case DIMMER: return new DimmerItem(itemName); case IMAGE: return new ImageItem(itemName); case LOCATION: return new LocationItem(itemName); case NUMBER: return new NumberItem(itemName); case PLAYER: return new PlayerItem(itemName); case ROLLERSHUTTER: return new RollershutterItem(itemName); case STRING: return new StringItem(itemName); case SWITCH: return new SwitchItem(itemName); default: return null; } }
Source:
public boolean isChanged() { return this.changed; }

Target:
boolean isChanged() { return this.changed; }
Source:
public EncryptedSageFile(SageFileSource sageFileSource, byte crypt[]) throws IOException { if (sageFileSource instanceof EncryptedSageFile) throw new IOException("Cannot layer the same encryption on top of itself."); this.sageFileSource = sageFileSource; cryptoKeys = crypt; System.out.println("Opening encrypted IO: crypt.length=" + crypt.length); }

Target:
public EncryptedSageFile(SageFileSource sageFileSource, byte crypt[]) throws IOException { if (getEncryptedRandomFile(sageFileSource) != null) throw new IOException("Cannot layer the same encryption on top of itself."); this.sageFileSource = sageFileSource; cryptoKeys = crypt; }
Source:
public SavedRow(Page page, int position, long joinPositionWithinPartition, boolean currentProbePositionProducedRow, int joinSourcePositions) { this.row = mask(page, new int[] {position}); this.row.compact(); this.joinPositionWithinPartition = joinPositionWithinPartition; this.currentProbePositionProducedRow = currentProbePositionProducedRow; this.joinSourcePositions = joinSourcePositions; }

Target:
public SavedRow(Page page, int position, long joinPositionWithinPartition, boolean currentProbePositionProducedRow, int joinSourcePositions) { this.row = page.mask(new int[] {position}); this.row.compact(); this.joinPositionWithinPartition = joinPositionWithinPartition; this.currentProbePositionProducedRow = currentProbePositionProducedRow; this.joinSourcePositions = joinSourcePositions; }
Source:
private ObservableList<Label> generateLabels() { ObservableList<Label> sequenceItems = FXCollections .observableArrayList(); for (final Sequence sequence : sequences.values()) { String ident = sequence.getIdentifier(); Label label = new Label(ident); Color color = SequenceColor.getColor(sequence); label.setStyle("-fx-background-color: rgba(" + ColorUtils.rgbaFormat(color) + ")"); String styleClassFilter = "filtered"; if (getVisible().contains(sequence)) { label.getStyleClass().add(styleClassFilter); } label.setOnMouseClicked((mouseEvent) -> { Set<Sequence> visible = getVisible(); if (label.getStyleClass().contains(styleClassFilter)) { visible.remove(sequence); label.getStyleClass().remove(styleClassFilter); } else { visible.add(sequence); label.getStyleClass().add(styleClassFilter); } setVisible(visible, true); }); sequenceItems.add(label); } return sequenceItems; }

Target:
private ObservableList<Label> generateLabels() { ObservableList<Label> sequenceItems = FXCollections .observableArrayList(); for (final Sequence sequence : sequences.values()) { String identifier = sequence.getIdentifier(); Label label = new Label(identifier); Color color = SequenceColor.getColor(sequence); label.setStyle("-fx-background-color: rgba(" + ColorUtils.rgbaFormat(color) + ")"); String styleClassFilter = "filtered"; if (getVisible().contains(sequence)) { label.getStyleClass().add(styleClassFilter); } label.setOnMouseClicked((mouseEvent) -> { Set<Sequence> visible = getVisible(); if (label.getStyleClass().contains(styleClassFilter)) { visible.remove(sequence); label.getStyleClass().remove(styleClassFilter); } else { visible.add(sequence); label.getStyleClass().add(styleClassFilter); } setVisible(visible, true); }); sequenceItems.add(label); } return sequenceItems; }
Source:
private static final IModelAccessFacade getModelAccess() { return Utils.getComponent(IModelAccessFacade.class); }

Target:
private final IModelAccessFacade getModelAccess() { return Utils.getComponent(IModelAccessFacade.class); }
Source:
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns) { KafkaTableHandle handle = convertTableHandle(table); Long startTs = null; Long endTs = null; Optional<Map<ColumnHandle, Domain>> domains = constraint.getSummary().getDomains(); if (domains.isPresent()) { Map<ColumnHandle, Domain> columnHandleDomainMap = domains.get(); for (Map.Entry<ColumnHandle, Domain> entry : columnHandleDomainMap.entrySet()) { if (entry.getKey() instanceof KafkaColumnHandle && ((KafkaColumnHandle) entry.getKey()).getName().equals(KafkaInternalFieldDescription.OFFSET_TIMESTAMP_FIELD.getColumnName())) { Range span = entry.getValue().getValues().getRanges().getSpan(); Marker low = span.getLow(); Marker high = span.getHigh(); if (!low.isLowerUnbounded()) { startTs = (Long) low.getValue(); } if (!high.isUpperUnbounded()) { endTs = (Long) high.getValue(); } } } } ConnectorTableLayout layout = new ConnectorTableLayout(new KafkaTableLayoutHandle(handle, startTs, endTs)); return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary())); }

Target:
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns) { KafkaTableHandle handle = convertTableHandle(table); long startTimestamp = 0; long endTimestamp = 0; Optional<Map<ColumnHandle, Domain>> domains = constraint.getSummary().getDomains(); if (domains.isPresent()) { Map<ColumnHandle, Domain> columnHandleDomainMap = domains.get(); for (Map.Entry<ColumnHandle, Domain> entry : columnHandleDomainMap.entrySet()) { if (entry.getKey() instanceof KafkaColumnHandle && ((KafkaColumnHandle) entry.getKey()).getName().equals(KafkaInternalFieldDescription.OFFSET_TIMESTAMP_FIELD.getColumnName())) { Range span = entry.getValue().getValues().getRanges().getSpan(); Marker low = span.getLow(); Marker high = span.getHigh(); if (!low.isLowerUnbounded()) { startTimestamp = (long) low.getValue(); } if (!high.isUpperUnbounded()) { endTimestamp = (long) high.getValue(); } } } } ConnectorTableLayout layout = new ConnectorTableLayout(new KafkaTableLayoutHandle(handle, startTimestamp, endTimestamp)); return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary())); }
Source:
private boolean addStyleToTemplate( final VTStyleSelector styleSelector, final TemplateModelEditorPart templateEditor) { final VTViewTemplate template = templateEditor.getTemplate(); if (template == null) { return false; } final TreeIterator<EObject> templateContents = EcoreUtil.getAllContents(template, true); while (templateContents.hasNext()) { final EObject next = templateContents.next(); if (!VTStyleSelector.class.isInstance(next)) { continue; } if (EcoreUtil.equals(next, styleSelector)) { templateEditor.reveal(next); return true; } } final VTStyle style = VTTemplateFactory.eINSTANCE.createStyle(); style.setSelector(styleSelector); final EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor(template); Command command = AddCommand.create(domain, template, VTTemplatePackage.eINSTANCE.getViewTemplate_Styles(), style); if (VTDomainModelReferenceSelector.class.isInstance(styleSelector)) { EObject view = vElement.get(); while (!VView.class.isInstance(view) && view != null) { view = view.eContainer(); } if (view != null) { final String ecorePath = VView.class.cast(view).getEcorePath(); if (!template.getReferencedEcores().contains(ecorePath)) { final Command ecorePathCommand = AddCommand.create(domain, template, VTTemplatePackage.eINSTANCE.getViewTemplate_ReferencedEcores(), ecorePath); command = new CompoundCommand(Arrays.asList(command, ecorePathCommand)); } } } if (!command.canExecute()) { return false; } domain.getCommandStack().execute(command); templateEditor.reveal(styleSelector); return true; }

Target:
private boolean addStyleToTemplate( final VTStyleSelector styleSelector, final TemplateModelEditorPart templateEditor) { final VTViewTemplate template = templateEditor.getTemplate(); if (template == null) { return false; } final TreeIterator<EObject> templateContents = EcoreUtil.getAllContents(template, true); while (templateContents.hasNext()) { final EObject next = templateContents.next(); if (!VTStyleSelector.class.isInstance(next)) { continue; } if (EcoreUtil.equals(next, styleSelector)) { templateEditor.reveal(next); return true; } } final VTStyle style = VTTemplateFactory.eINSTANCE.createStyle(); style.setSelector(styleSelector); final EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor(template); Command command = AddCommand.create(domain, template, VTTemplatePackage.eINSTANCE.getViewTemplate_Styles(), style); if (VTDomainModelReferenceSelector.class.isInstance(styleSelector)) { EObject view = vElement.get(); while (!VView.class.isInstance(view) && view != null) { view = view.eContainer(); } command = addEcorePathIfRequired(template, domain, command, view); } if (!command.canExecute()) { return false; } domain.getCommandStack().execute(command); templateEditor.reveal(styleSelector); return true; }
Source:
private synchronized boolean addToSubIdList(int slotIndex, int subId) { if (slotIndex > 0) { ArrayList<Integer> singleSubIdList = new ArrayList<>(Arrays.asList(subid)); sSlotIndexToSubIds.put(slotIndex, singleSubIdList); return true; } ArrayList<Integer> subIdsList = sSlotIndexToSubIds.get(slotIndex); if (subIdsList == null) { subIdsList = new ArrayList<>(); sSlotIndexToSubIds.put(slotIndex, subIdsList); } if (!subIdsList.contains(subId)) { subIdsList.add(subId); return true; } return false; }

Target:
private synchronized boolean addToSubIdList(int slotIndex, int subId) { if (slotIndex >= 0) { ArrayList<Integer> singleSubIdList = new ArrayList<>(Arrays.asList(subid)); sSlotIndexToSubIds.put(slotIndex, singleSubIdList); return true; } ArrayList<Integer> subIdsList = sSlotIndexToSubIds.get(slotIndex); if (subIdsList == null) { subIdsList = new ArrayList<>(); sSlotIndexToSubIds.put(slotIndex, subIdsList); } if (!subIdsList.contains(subId)) { subIdsList.add(subId); return true; } return false; }
Source:
public void onInstanceConfigChange(List<InstanceConfig> configs, NotificationContext changeContext) { try { synchronized (notificationLock) { if (!instanceConfigInitialized.get()) { logger.info("Received initial notification for instance config change from {}", dcName); } else { logger.info("Instance config change triggered from {}", dcName); } logger.debug("Detailed instance configs in are: {}", dcName, configs); try { addOrUpdateInstanceInfos(configs); instanceConfigInitialized.set(true); } catch (Exception e) { if (!instanceConfigInitialized.get()) { logger.error("Exception occurred when initializing instances in {}: ", dcName, e); initializationFailureMap.putIfAbsent(dcName, e); instanceConfigInitialized.set(true); } else { logger.error("Exception occurred at runtime when handling instance config changes in {}: ", dcName, e); } } sealedStateChangeCounter.incrementAndGet(); helixClusterManagerMetrics.instanceConfigChangeTriggerCount.inc(); } } catch (Throwable t) { errorCount.incrementAndGet(); throw t; } }

Target:
public void onInstanceConfigChange(List<InstanceConfig> configs, NotificationContext changeContext) { try { synchronized (notificationLock) { if (!instanceConfigInitialized) { logger.info("Received initial notification for instance config change from {}", dcName); } else { logger.info("Instance config change triggered from {}", dcName); } logger.debug("Detailed instance configs in are: {}", dcName, configs); try { addOrUpdateInstanceInfos(configs); } catch (Exception e) { if (!instanceConfigInitialized) { logger.error("Exception occurred when initializing instances in {}: ", dcName, e); initializationFailureMap.putIfAbsent(dcName, e); } else { logger.error("Exception occurred at runtime when handling instance config changes in {}: ", dcName, e); } } finally { instanceConfigInitialized = true; } sealedStateChangeCounter.incrementAndGet(); helixClusterManagerMetrics.instanceConfigChangeTriggerCount.inc(); } } catch (Throwable t) { errorCount.incrementAndGet(); throw t; } }
Source:
private HandlerMethod findHandlerMethodForParameters(ParametersWrapper parameters) { final Class<?> payloadType = parameters.getFirstParameterType(); HandlerMethod closestMatch = this.findClosestMatch(payloadType); if (closestMatch != null) { return closestMatch; } else if (this.handlerMethods.size() == 1) { return this.handlerMethods.values().iterator().next(); } else { return this.handlerMethods.get(Void.class); } }

Target:
private HandlerMethod findHandlerMethodForParameters(ParametersWrapper parameters) { if (this.handlerMethod != null) { return this.handlerMethod; } final Class<?> payloadType = parameters.getFirstParameterType(); HandlerMethod closestMatch = this.findClosestMatch(payloadType); if (closestMatch != null) { return closestMatch; } if (Iterable.class.isAssignableFrom(payloadType) && this.handlerMethods.containsKey(Iterator.class)) { return this.handlerMethods.get(Iterator.class); } else { return this.handlerMethods.get(Void.class); } }
Source:
private static List<HttpSessionActivationListener> findListeners(ImmutableSession session) { ImmutableSessionAttributes attributes = session.getAttributes(); List<HttpSessionActivationListener> list = new ArrayList<>(); for (String name : attributes.getAttributeNames()) { Object attribute = attributes.getAttribute(name); if (attribute instanceof HttpSessionActivationListener) { HttpSessionActivationListener httpSessionActivationListener = (HttpSessionActivationListener) attribute; list.add(httpSessionActivationListener); } } return list; }

Target:
private static List<HttpSessionActivationListener> findListeners(ImmutableSession session) { ImmutableSessionAttributes attributes = session.getAttributes(); final Set<String> names = attributes.getAttributeNames(); List<HttpSessionActivationListener> list = new ArrayList<>(names.size()); for (String name : names) { Object attribute = attributes.getAttribute(name); if (attribute instanceof HttpSessionActivationListener) { HttpSessionActivationListener httpSessionActivationListener = (HttpSessionActivationListener) attribute; list.add(httpSessionActivationListener); } } return list; }
Source:
private boolean canBeLeaked(Tree exp) { AnnotatedTypeMirror type = atypeFactory.getAnnotatedType(exp); boolean isMethodInvocation = exp.getKind() == Kind.METHOD_INVOCATION; boolean isNewClass = exp.getKind() == Kind.NEW_CLASS; boolean isArray = type.getUnderlyingType().getKind().toString().equalsIgnoreCase("array"); boolean isNull = exp.getKind() == Kind.NULL_LITERAL; if (type.getUnderlyingType().toString().startsWith("java.lang") || isArray || isNull) { return type.hasExplicitAnnotation(Unique.class) && !isMethodInvocation && !isNewClass; } else { return type.hasAnnotation(Unique.class) && !isMethodInvocation && !isNewClass; } }

Target:
private boolean canBeLeaked(Tree exp) { AnnotatedTypeMirror type = atypeFactory.getAnnotatedType(exp); boolean isMethodInvocation = exp.getKind() == Kind.METHOD_INVOCATION; boolean isNewClass = exp.getKind() == Kind.NEW_CLASS; boolean isUniqueType = isUniqueClass(type) || type.hasExplicitAnnotation(Unique.class); return isUniqueType && !isMethodInvocation && !isNewClass; }
Source:
public void testEmptyIfRootIsEmpty() throws Exception { final File r = new File(trash, "not-existing-file"); assertFalse(r.exists()); assertTrue(r.mkdir()); assertTrue(r.isDirectory()); final FileTreeIterator fti = new FileTreeIterator(r, db.getFS(), db.getConfig().get(WorkingTreeOptions.KEY)); assertTrue(fti.first()); assertTrue(fti.eof()); }

Target:
public void testEmptyIfRootIsEmpty() throws Exception { final File r = new File(trash, "not-existing-file"); assertFalse(r.exists()); FileUtils.mkdir(r); final FileTreeIterator fti = new FileTreeIterator(r, db.getFS(), db.getConfig().get(WorkingTreeOptions.KEY)); assertTrue(fti.first()); assertTrue(fti.eof()); }
Source:
private UrlBuilder(String wiki, String env, Boolean forceHttps, Boolean forceLanguageInPath, String language) { super(env); areLanguageTestsEnabled = (Configuration.getForceLanguageInPath() && "szl".equals(Configuration.getWikiLanguage())); if (FANDOM_EXCLUDED_WIKIS.contains(wiki) || areLanguageTestsEnabled) { this.wikiName = wiki; } else { this.wikiName = Configuration.getForceFandomDomain() ? wiki + WIKI_NAME_FANDOM_SUFFIX : wiki; } this.forceHttps = forceHttps; this.forceLanguageInPath = forceLanguageInPath; this.language = language; }

Target:
private UrlBuilder(String wiki, String env, Boolean forceHttps, Boolean forceLanguageInPath, String language) { super(env); areLanguageTestsEnabled = Configuration.getForceLanguageInPath() && "szl".equals(Configuration.getWikiLanguage()); if (FANDOM_EXCLUDED_WIKIS.contains(wiki) || areLanguageTestsEnabled) { this.wikiName = wiki; } else { this.wikiName = Configuration.getForceFandomDomain() ? wiki + WIKI_NAME_FANDOM_SUFFIX : wiki; } this.forceHttps = forceHttps; this.forceLanguageInPath = forceLanguageInPath; this.language = language; }
Source:
private void parseRewindOrDelete(final ReceiveCommand cmd) { if (isHead(cmd) && cmd.getType() == Type.DELETE && projectControl.canDeleteRef(cmd.getRefName())) { } else if (isHead(cmd) && canPerform(PUSH_HEAD, PUSH_HEAD_REPLACE) && projectControl.canUploadToRef(cmd.getRefName())) { } else if (isHead(cmd) && cmd.getType() == Type.UPDATE_NONFASTFORWARD) { cmd.setResult(ReceiveCommand.Result.REJECTED_NONFASTFORWARD); } else { reject(cmd); } }

Target:
private void parseRewindOrDelete(final ReceiveCommand cmd) { RefControl refControl = projectControl.controlForRef(cmd.getRefName()); if (isHead(cmd) && cmd.getType() == Type.DELETE && projectControl.canDeleteRef(cmd.getRefName())) { } else if (isHead(cmd) && refControl.canPerform(PUSH_HEAD, PUSH_HEAD_REPLACE)) { } else if (isHead(cmd) && cmd.getType() == Type.UPDATE_NONFASTFORWARD) { cmd.setResult(ReceiveCommand.Result.REJECTED_NONFASTFORWARD); } else { reject(cmd); } }
Source:
public static String normalizePath(String pathname) { if (pathname == null || pathname.length() == 0) { return "/"; } StringBuilder ibuf = new StringBuilder(pathname.length() + 1); if (pathname.charAt(0) != '/') { ibuf.append('/'); } ibuf.append(pathname); int i = 0; while (i < ibuf.length()) { if (ibuf.charAt(i) == '%') { decodeUnreserved(ibuf, i); } i++; } return removeDots(ibuf); }

Target:
public static String normalizePath(String pathname) { if (pathname == null) { return null; } if (pathname.length() == 0) { return "/"; } StringBuilder ibuf = new StringBuilder(pathname.length() + 1); if (pathname.charAt(0) != '/') { ibuf.append('/'); } ibuf.append(pathname); int i = 0; while (i < ibuf.length()) { if (ibuf.charAt(i) == '%') { decodeUnreserved(ibuf, i); } i++; } return removeDots(ibuf); }