auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void execute() { final int initialNotificationResend = 1; final List<ResponseData> notificationsToResend = this.responseDataRepository .findByNumberOfNotificationsSentLessThan(this.resendNotificationMaximum); for (final ResponseData responseData : notificationsToResend) { final int multiplier = (int) Math.pow(this.resendNotificationMultiplier, responseData.getNumberOfNotificationsSent()); final Date currentDate = new Date(); final long previousModificationTimeInterval = currentDate.getTime() - responseData.getModificationTime().getTime(); final long creationTimeInterval = currentDate.getTime() - responseData.getCreationTime().getTime(); if (TimeUnit.MINUTES.toMillis(this.resendThresholdInHours) < creationTimeInterval) { if (multiplier == initialNotificationResend) { this.resendNotification(responseData); } else if ((TimeUnit.HOURS.toMillis(this.resendThresholdInHours) * multiplier) < previousModificationTimeInterval) { this.resendNotification(responseData); } } } }

Target:
public void execute() { final long[] resendDelays = this.calculateResendDelays(this.resendNotificationMaximum); for (int notificationsResent = this.resendNotificationMaximum - 1; notificationsResent > -1; notificationsResent--) { final long delay = resendDelays[notificationsResent]; final DateTime createdBefore = DateTime.now(DateTimeZone.UTC).minus(delay); this.resendNotifications((short) notificationsResent, createdBefore); } }
Source:
protected void configure() { Multibinder<ServicePlugin> plugins = Multibinder.newSetBinder(binder(), ServicePlugin.class); plugins.addBinding().toInstance(Plugins.of(new HttpBackend(port))); bind(ObjectValidator.class).to(ApacheObjectValidator.class).in(Singleton.class); install(new ServletModule() { @Override protected void configureServlets() { bind(TestServlet.class).in(Singleton.class); serve("/test").with(TestServlet.class); } }); install(new SitebricksModule() { @Override protected void configureSitebricks() { at("/testservice").serve(ExampleService.class); at("/r/controllers").serve(ApControllerEndpoint.class); at("/r/aps").serve(AccessPointEndpoint.class); at("/r/operators").serve(OperatorEndpoint.class); at("/r/roaming-groups").serve(RoamingGroupEndpoint.class); at("/r/venues").serve(VenueEndpoint.class); at("/r/ip-types").serve(IpTypeService.class); at("/r/auth-types").serve(AuthTypeEndpoint.class); at("/r/service-providers").serve(ServiceProviderEndpoint.class); at("/r/nai-realm").serve(NaiRealmEndpoint.class); } }); bindInterceptor(annotatedWith(Service.class), returns(only(Reply.class)), new HttpRequestErrorReporter("Internal Server Error")); }

Target:
protected void configure() { Multibinder<ServicePlugin> plugins = Multibinder.newSetBinder(binder(), ServicePlugin.class); plugins.addBinding().toInstance(Plugins.of(new HttpBackend(port))); bind(ObjectValidator.class).to(ApacheObjectValidator.class).in(Singleton.class); install(new ServletModule() { @Override protected void configureServlets() { bind(TestServlet.class).in(Singleton.class); serve("/test").with(TestServlet.class); } }); install(new SitebricksModule() { @Override protected void configureSitebricks() { at("/testservice").serve(ExampleService.class); at("/r/controllers").serve(ApControllerEndpoint.class); at("/r/aps").serve(AccessPointEndpoint.class); at("/r/operators").serve(OperatorEndpoint.class); at("/r/roaming-groups").serve(RoamingGroupEndpoint.class); at("/r/venues").serve(VenueEndpoint.class); at("/r/ip-types").serve(IpTypeService.class); at("/r/auth-types").serve(AuthTypeEndpoint.class); at("/r/service-providers").serve(ServiceProviderEndpoint.class); at("/r/capabilities").serve(CapabilityEndpoint.class); at("/r/nai-realms").serve(NaiRealmEndpoint.class); } }); bindInterceptor(annotatedWith(Service.class), returns(only(Reply.class)), new HttpRequestErrorReporter("Internal Server Error")); }
Source:
public synchronized void commit() throws SQLException { if (activeConnection != null && activeConnection.isValid(5)) { activeConnection.commit(); } else { logger.debug("Connection to MySql DB is not available"); } }

Target:
public synchronized void commit() throws SQLException { activeConnection.commit(); }
Source:
public String getWorkingDirectory(CommandLine cl) { String[] args = cl.getArgs(); String baseDirPath = args[1]; String workingDirPath = Paths.get(baseDirPath, this.getCommandName()).toString(); LOG.debug("Command %s works in %s", this.getCommandName(), workingDirPath); File workingDir = new File(workingDirPath); if (!workingDir.exists()) { System.out.format("Working path %s does not exist. mkdir first%n", workingDirPath); workingDir.mkdirs(); } return workingDirPath; }

Target:
public String getWorkingDirectory(CommandLine cl) { String[] args = cl.getArgs(); String baseDirPath = args[1]; String workingDirPath = Paths.get(baseDirPath, this.getCommandName()).toString(); LOG.debug("Command %s works in %s", this.getCommandName(), workingDirPath); File workingDir = new File(workingDirPath); if (!workingDir.exists()) { System.out.format("Creating working directory: %s%n", workingDirPath); workingDir.mkdirs(); } return workingDirPath; }
Source:
public void activate(Context context) { for (String s : lookupFields) { lookupFieldInfo.add(new FieldInfo(s, s, SupportType.getFromJavaType(getLookupFieldType(s)))); } if (includeFields != null) { for (String s : includeFields) { includeFieldInfo.add(new FieldInfo(s, s, SupportType.getFromJavaType(getIncludeFieldType(s)))); } } store.setFieldInfo(lookupFieldInfo, includeFieldInfo); try { cacheManager.initialize(); } catch (IOException e) { throw new RuntimeException("Unable to initialize cache store", e); } }

Target:
public void activate(Context context) { for (String s : lookupFields) { lookupFieldInfo.add(new FieldInfo(s, s, SupportType.getFromJavaType(getLookupFieldType(s)))); } if (includeFields != null) { for (String s : includeFields) { includeFieldInfo.add(new FieldInfo(s, s, SupportType.getFromJavaType(getIncludeFieldType(s)))); } } store.setFieldInfo(lookupFieldInfo, includeFieldInfo); try { cacheManager.initialize(); } catch (IOException e) { throw new RuntimeException("Unable to initialize cache manager", e); } }
Source:
public void emptyClassNotEmptyMethodEmptyRule() throws IOException { final ExcludesXml xml = new ExcludesXml(":toString"); xml.assertXpath("count( xml.assertXpath("count( final ExcludesXml same = new ExcludesXml(":toString:"); same.assertXpath("count( same.assertXpath("count( }

Target:
public void emptyClassNotEmptyMethodEmptyRule() throws Exception { final Document xml = new FindBugsExcludes( new Environment.Mock().withExcludes(":equals:") ).asXml(); MatcherAssert.assertThat( xml, Matchers.allOf( new HasXPath( FindBugsExcludesTest.COUNT_MATCH, new IsEqual<>("1") ), new HasXPath( "count( new IsEqual<>("1") ) ) ); }
Source:
public Iterable<AccountGroup.UUID> getAllOwners() { Set<AccountGroup.UUID> result = new HashSet<AccountGroup.UUID>(); Iterable<ProjectState> tree = tree(); for (ProjectState p : tree) { result.addAll(p.localOwners); } return result; }

Target:
public Set<AccountGroup.UUID> getAllOwners() { Set<AccountGroup.UUID> result = new HashSet<AccountGroup.UUID>(); for (ProjectState p : tree()) { result.addAll(p.localOwners); } return result; }
Source:
public KeyPairCredential clone() { return this; }

Target:
public KeyPairCredential clone() { final PrivateKey privateKey = keyPair.getPrivate(); final PrivateKey clone = KeyUtil.cloneKey(PrivateKey.class, privateKey); return privateKey == clone ? this : new KeyPairCredential(new KeyPair(keyPair.getPublic(), clone)); }
Source:
public static void GET_REPLICATION_PROGRESS(ResultSet[] resultSets) throws StandardException, SQLException { ReplicationManager replicationManager = EngineDriver.driver().manager().getReplicationManager(); long ts = replicationManager.getReplicationProgress(); if (ts > 0) { DateTime dateTime = new DateTime(ts); resultSets[0] = ProcedureUtils.generateResult( "Replication progress", dateTime.toString()); } else { resultSets[0] = ProcedureUtils.generateResult("Error", "Information for available"); } }

Target:
public static void GET_REPLICATION_PROGRESS(ResultSet[] resultSets) throws StandardException, SQLException { ReplicationManager replicationManager = EngineDriver.driver().manager().getReplicationManager(); long ts = replicationManager.getReplicationProgress(); if (ts > 0) { DateTime dateTime = new DateTime(ts); resultSets[0] = ProcedureUtils.generateResult( "Replication progress", dateTime.toString()); } else { resultSets[0] = ProcedureUtils.generateResult("Error", "Information not available"); } }
Source:
public Bundle getAuthToken(AccountAuthenticatorResponse accountAuthenticatorResponse, Account account, String authTokenType, Bundle options) { try { validateAccountType(account.type); validateAuthTokenType(authTokenType); } catch (AuthenticatorException e) { Timber.e(e, "Failed to validate account type %s", account.type); return e.getFailureBundle(); } String accessToken = ""; final AccountManager accountManager = AccountManager.get(mContext); if (authTokenType.equals(AccountTypeUtils.getAuthTokenTypePass(MainApp.Companion.getAccountType()))) { accessToken = accountManager.getPassword(account); } else { accessToken = accountManager.peekAuthToken(account, authTokenType); if (accessToken == null && canBeRefreshed(authTokenType)) { refreshToken(account, authTokenType, accountManager, accountAuthenticatorResponse); return null; } } if (accessToken != null) { final Bundle result = new Bundle(); result.putString(AccountManager.KEY_ACCOUNT_NAME, account.name); result.putString(AccountManager.KEY_ACCOUNT_TYPE, MainApp.Companion.getAccountType()); result.putString(AccountManager.KEY_AUTHTOKEN, accessToken); return result; } final Intent intent = new Intent(mContext, AuthenticatorActivity.class); intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, accountAuthenticatorResponse); intent.putExtra(KEY_AUTH_TOKEN_TYPE, authTokenType); intent.putExtra(KEY_LOGIN_OPTIONS, options); intent.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, account); intent.putExtra(AuthenticatorActivity.EXTRA_ACTION, AuthenticatorActivity.ACTION_UPDATE_EXPIRED_TOKEN); final Bundle bundle = new Bundle(); bundle.putParcelable(AccountManager.KEY_INTENT, intent); return bundle; }

Target:
public Bundle getAuthToken(AccountAuthenticatorResponse accountAuthenticatorResponse, Account account, String authTokenType, Bundle options) { try { validateAccountType(account.type); validateAuthTokenType(authTokenType); } catch (AuthenticatorException e) { Timber.e(e, "Failed to validate account type %s", account.type); return e.getFailureBundle(); } String accessToken; final AccountManager accountManager = AccountManager.get(mContext); if (authTokenType.equals(AccountTypeUtils.getAuthTokenTypePass(MainApp.Companion.getAccountType()))) { accessToken = accountManager.getPassword(account); } else { accessToken = accountManager.peekAuthToken(account, authTokenType); if (accessToken == null && canBeRefreshed(authTokenType)) { refreshToken(accountAuthenticatorResponse, account, authTokenType, accountManager, options); return null; } } if (accessToken != null) { final Bundle result = new Bundle(); result.putString(AccountManager.KEY_ACCOUNT_NAME, account.name); result.putString(AccountManager.KEY_ACCOUNT_TYPE, MainApp.Companion.getAccountType()); result.putString(AccountManager.KEY_AUTHTOKEN, accessToken); return result; } return prepareBundleToAccessAuthenticatorActivity(accountAuthenticatorResponse, account, authTokenType, options); }
Source:
public Set<StandardDrive> apply(HttpResponse response) { String text = returnStringIf200.apply(response); if (text == null || text.trim().equals("")) return ImmutableSet.<StandardDrive> of(); return ImmutableSet.copyOf(Iterables.transform(mapConverter.apply(text), mapToStandardDrive)); }

Target:
public Set<StandardDrive> apply(HttpResponse response) { String text = nullToEmpty(returnStringIf2xx.apply(response)); if (text.trim().equals("")) { return ImmutableSet.<StandardDrive> of(); } return ImmutableSet.copyOf(Iterables.transform(mapConverter.apply(text), mapToStandardDrive)); }
Source:
public Object execute(ExecutionEvent event) throws ExecutionException { List<RepositoryTreeNode> nodes = getSelectedNodes(event); RepositoryTreeNode node = nodes.get(0); WizardDialog wizardDialog = null; try { switch (node.getType()) { case REF: Ref ref = (Ref) node.getObject(); wizardDialog = new PushBranchDialog(getShell(event), new PushBranchWizard(node.getRepository(), ref)); break; case TAG: wizardDialog = new WizardDialog(getShell(event), createPushTagsWizard(nodes)); break; case REPO: wizardDialog = new WizardDialog(getShell(event), new PushWizard(node.getRepository())); break; default: throw new UnsupportedOperationException("type not supported!"); } } catch (URISyntaxException e1) { Activator.handleError(e1.getMessage(), e1, true); return null; } wizardDialog.setHelpAvailable(true); wizardDialog.open(); return null; }

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { List<RepositoryTreeNode> nodes = getSelectedNodes(event); RepositoryTreeNode node = nodes.get(0); IWizard pushWiz = null; try { switch (node.getType()) { case REF: Ref ref = (Ref) node.getObject(); pushWiz = new PushBranchWizard(node.getRepository(), ref); break; case TAG: pushWiz = createPushTagsWizard(nodes); break; case REPO: pushWiz = new PushWizard(node.getRepository()); break; default: throw new UnsupportedOperationException("type not supported!"); } } catch (URISyntaxException e1) { Activator.handleError(e1.getMessage(), e1, true); return null; } WizardDialog dlg = new PushBranchDialog(getShell(event), pushWiz); dlg.setHelpAvailable(pushWiz.isHelpAvailable()); dlg.open(); return null; }
Source:
public ExtendManagedBlockStorageDiskSizeParameters() { super(); }

Target:
public ExtendManagedBlockStorageDiskSizeParameters() { }
Source:
public void search_shouldSearchForDiagnosesFromSpecifiedDiagnosisConceptSources() throws Exception { controller.search(context, uiUtils, emrApiProperties, emrConceptService, conceptService, queryString, null, "ICRC,ICD-10-WHO", null, null); verify(emrApiProperties, never()).getConceptSourcesForDiagnosisSearch(); }

Target:
public void search_shouldSearchForDiagnosesFromSpecifiedDiagnosisConceptSources() throws Exception { controller.search(context, uiUtils, emrApiProperties, emrConceptService, conceptService, queryString, null, "CIEL,ICD-10-WHO", null, null); verify(emrApiProperties, never()).getConceptSourcesForDiagnosisSearch(); }
Source:
public String toString() { final StringBuilder sb = new StringBuilder(super.toString()); sb.append("AbfsInputStream@(").append(this.hashCode()).append("){"); sb.append(streamStatistics.toString()); sb.append("}"); return sb.toString(); }

Target:
public String toString() { final StringBuilder sb = new StringBuilder(super.toString()); if (streamStatistics != null) { sb.append("AbfsInputStream@(").append(this.hashCode()).append("){"); sb.append(streamStatistics.toString()); sb.append("}"); } return sb.toString(); }
Source:
public byte[] getDataFromService(String service) { byte[] responseBodyB64 = null; int maxNbrGets = 3; int statusCode = 0; if (client == null) { client = new HttpClient(); } synchronized (client) { GetMethod method = new GetMethod("http://" + device.getIP4Address() + service); method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false)); method.setRequestHeader("Accept", "application/json"); method.addRequestHeader("User-Agent", "TeleHeater/2.2.3"); try { for (int i = 0; i < maxNbrGets && statusCode != HttpStatus.SC_OK; i++) { statusCode = client.executeMethod(method); if (statusCode != HttpStatus.SC_OK) { String statusLine = method.getStatusLine().toString(); if (statusLine.contains(" 500 ")) { logger.warn("HTTP GET failed mit error 500, try Again"); Thread.sleep(2000L); continue; } else if (statusLine.contains(" 403 ")) { byte[] test = new byte[1]; return test; } else { logger.error("HTTP GET failed: {}", method.getStatusLine()); return null; } } } device.setCharSet(method.getResponseCharSet()); responseBodyB64 = ByteStreams.toByteArray(method.getResponseBodyAsStream()); } catch (HttpException e) { logger.error("Fatal protocol violation: {}", e); e.printStackTrace(); } catch (InterruptedException e) { logger.error("Sleep was interrupted: {}", e); e.printStackTrace(); } catch (IOException e) { logger.error("Fatal transport error: {}", e); e.printStackTrace(); } finally { method.releaseConnection(); } return responseBodyB64; } }

Target:
public byte[] getDataFromService(String service) { byte[] responseBodyB64 = null; int maxNbrGets = 3; int statusCode = 0; if (client == null) { client = new HttpClient(); } synchronized (client) { GetMethod method = new GetMethod("http://" + device.getIP4Address() + service); method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false)); method.setRequestHeader("Accept", "application/json"); method.addRequestHeader("User-Agent", "TeleHeater/2.2.3"); try { for (int i = 0; i < maxNbrGets && statusCode != HttpStatus.SC_OK; i++) { statusCode = client.executeMethod(method); switch (statusCode) { case HttpStatus.SC_OK: break; case HttpStatus.SC_INTERNAL_SERVER_ERROR: logger.warn("HTTP GET failed: 500, internal server error, repeating.. "); Thread.sleep(2000L); continue; case HttpStatus.SC_FORBIDDEN: byte[] test = new byte[1]; return test; default: logger.error("HTTP GET failed: {}", method.getStatusLine()); return null; } } device.setCharSet(method.getResponseCharSet()); responseBodyB64 = ByteStreams.toByteArray(method.getResponseBodyAsStream()); } catch (HttpException e) { logger.error("Fatal protocol violation: {}", e.getMessage()); } catch (InterruptedException e) { logger.error("Sleep was interrupted: {}", e.getMessage()); } catch (IOException e) { logger.error("Fatal transport error: {}", e.getMessage()); } finally { method.releaseConnection(); } return responseBodyB64; } }
Source:
public PartitionQC get(Run run, Partition partition) throws IOException { authorizationManager.throwIfNotReadable(run); return partitionQcDao.get(run, partition); }

Target:
public PartitionQC get(Run run, Partition partition) throws IOException { Run managedRun = runService.get(run.getId()); authorizationManager.throwIfNotReadable(managedRun); return partitionQcDao.get(managedRun, partition); }
Source:
public AccountBuilder(Account origin) { if (origin == null) { throw new IllegalArgumentException("origin cannot be null."); } this.id = origin.getId(); this.name = origin.getName(); this.status = origin.getStatus(); for (Container container : origin.getAllContainers()) { idToContainerMetadataMap.put(container.getId(), container); } this.version = ACCOUNT_METADATA_VERSION_1; }

Target:
public AccountBuilder(Account origin) { if (origin == null) { throw new IllegalArgumentException("origin cannot be null."); } id = origin.getId(); name = origin.getName(); status = origin.getStatus(); for (Container container : origin.getAllContainers()) { idToContainerMetadataMap.put(container.getId(), container); } }
Source:
public Object create(String type, ApiRequest request, ResourceManager next) { Credential credential = request.proxyRequestObject(Credential.class); if (StringUtils.isBlank(credential.getKind())) { credential.setKind(request.getType()); } LocalAuthPasswordValidator.validatePassword(credential.getSecretValue(), jsonMapper); boolean isUnique = passwordDao.isUnique(credential); if (!isUnique) { throw new ValidationErrorException(ValidationErrorCodes.NOT_UNIQUE, CredentialConstants.PUBLIC_VALUE); } return super.create(type, request, next); }

Target:
public Object create(String type, ApiRequest request, ResourceManager next) { Credential credential = request.proxyRequestObject(Credential.class); if (StringUtils.isBlank(credential.getKind())) { credential.setKind(request.getType()); } if (StringUtils.equals(credential.getKind(), CredentialConstants.KIND_PASSWORD)) { LocalAuthPasswordValidator.validatePassword(credential.getSecretValue(), jsonMapper); String clearSecret = credential.getSecretValue(); credential.setSecretValue(ApiContext.getContext().getTransformationService().transform(clearSecret, "HASH")); boolean isUnique = passwordDao.isUnique(credential); if (!isUnique) { throw new ValidationErrorException(ValidationErrorCodes.NOT_UNIQUE, CredentialConstants.PUBLIC_VALUE); } credential = (Credential) super.create(type, request, next); credential.setSecretValue(clearSecret); return credential; } boolean isUnique = passwordDao.isUnique(credential); if (!isUnique) { throw new ValidationErrorException(ValidationErrorCodes.NOT_UNIQUE, CredentialConstants.PUBLIC_VALUE); } return super.create(type, request, next); }
Source:
private void processIndexSegmentEntriesBackward(IndexSegment indexSegment, List<IndexEntry> indexEntries, Map<StoreKey, Long> deletedKeys) throws StoreException { logger.trace("Processing index entries backward by IndexScanner for segment " + indexSegment); List<IndexEntry> validIndexEntries = getValidIndexEntries(indexSegment, indexEntries, newScanResults.containerForecastStartTimeMs, deletedKeys); processEntriesForContainerBucket(newScanResults, validIndexEntries, deletedKeys); validIndexEntries = getValidIndexEntries(indexSegment, indexEntries, newScanResults.logSegmentForecastStartTimeMs, deletedKeys); processEntriesForLogSegmentBucket(newScanResults, validIndexEntries, deletedKeys); }

Target:
private void processIndexSegmentEntriesBackward(IndexSegment indexSegment, List<IndexEntry> indexEntries, Map<StoreKey, Long> deletedKeys) throws StoreException { logger.trace("Processing index entries backward by IndexScanner for segment {}", indexSegment); List<IndexEntry> validIndexEntries = getValidIndexEntries(indexSegment, indexEntries, newScanResults.containerForecastStartTimeMs, deletedKeys); processEntriesForContainerBucket(newScanResults, validIndexEntries, deletedKeys); validIndexEntries = getValidIndexEntries(indexSegment, indexEntries, newScanResults.logSegmentForecastStartTimeMs, deletedKeys); processEntriesForLogSegmentBucket(newScanResults, validIndexEntries, deletedKeys); }
Source:
public final void refreshItems() { final HashSet<Integer> issuesWithNewComments = updateIssueCommentCounts(Qualifier.hasUpdatedQualifier(getCurrentFilterExpression())); listView.setCellFactory(list -> new ListPanelCell(this, panelIndex, issuesWithNewComments)); listView.saveSelection(); listView.setItems(null); listView.setItems(getElementsList()); issuesCount = getElementsList().size(); closedIssuesCount = getClosedIssuesCount(); openIssuesCount = issuesCount - closedIssuesCount; updateFooter(); listView.restoreSelection(); this.setId(IdGenerator.getPanelId(panelIndex)); }

Target:
public final void refreshItems() { final HashSet<Integer> issuesWithNewComments = updateIssueCommentCounts(Qualifier.hasUpdatedQualifier(getCurrentFilterExpression())); listView.setCellFactory(list -> new ListPanelCell(this, panelIndex, issuesWithNewComments)); listView.saveSelection(); listView.setItems(null); listView.setItems(getElementsList()); issuesCount = getElementsList().size(); closedIssuesCount = getClosedIssuesCount(); openIssuesCount = issuesCount - closedIssuesCount; listView.restoreSelection(); this.setId(IdGenerator.getPanelId(panelIndex)); updateFooter(); }
Source:
ListenableFuture<Void> setZoomPercentage(@FloatRange(from = 0f, to = 1f) float percentage) { if (!mIsActive) { throw new IllegalStateException("Camera is not active. Please bind use cases first."); } if (percentage > 1.0f || percentage < 0f) { Log.d(TAG, "invalid zoomPercentage: not in [0..1] range"); } percentage = rangeLimit(percentage, 1.0f, 0f); float ratio = getRatioByPercentage(percentage); setLiveDataValue(mZoomPercentageLiveData, percentage); return setZoomRatioInternal(ratio, false); }

Target:
ListenableFuture<Void> setZoomPercentage(@FloatRange(from = 0f, to = 1f) float percentage) { synchronized (mActiveLock) { if (!mIsActive) { throw new IllegalStateException( "Camera is not active."); } if (percentage > 1.0f || percentage < 0f) { Log.d(TAG, "invalid zoomPercentage: not in [0..1] range"); } percentage = rangeLimit(percentage, 1.0f, 0f); if (getMaxDigitalZoom() == MIN_ZOOM) { percentage = 0.0f; } float ratio = getRatioByPercentage(percentage); setLiveDataValue(mZoomPercentageLiveData, percentage); return setZoomRatioInternal(ratio, false); } }
Source:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { if (getActionBar() != null) { getActionBar().setDisplayHomeAsUpEnabled(true); } } }

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { getActionBar().setDisplayHomeAsUpEnabled(true); } }
Source:
public void generateTestData() { Random rand = new Random(); ObjectMapper mapper = new ObjectMapper(); for (int i = 0; i < 40; i++) { Person person = getRandomPerson(rand); try { docs.add(new CosmosItemProperties(mapper.writeValueAsString(person))); } catch (JsonProcessingException e) { e.printStackTrace(); } } }

Target:
public void generateTestData() { Random rand = new Random(); ObjectMapper mapper = new ObjectMapper(); for (int i = 0; i < 40; i++) { Person person = getRandomPerson(rand); try { docs.add(new CosmosItemProperties(mapper.writeValueAsString(person))); } catch (JsonProcessingException e) { logger.error(e.getMessage()); } } String resourceJson = String.format("{ " + "\"id\": \"%s\", \"intprop\": %d }", UUID.randomUUID().toString(), 5); String resourceJson2 = String.format("{ " + "\"id\": \"%s\", \"intprop\": %f }", UUID.randomUUID().toString(), 5.0f); docs.add(new CosmosItemProperties(resourceJson)); docs.add(new CosmosItemProperties(resourceJson2)); }
Source:
public static String determineDomainID(URI uri) { if (URIConverter.INSTANCE.exists(uri, null)) { try { return DomainIDParser.parse(uri); } catch (SAXException e) { return ""; } catch (Exception e) { e.printStackTrace(); } } return BasePackage.Literals.DOMAIN_ELEMENT__DOMAIN_ID.getDefaultValueLiteral(); }

Target:
public static String determineDomainID(URI uri) { if (URIConverter.INSTANCE.exists(uri, null)) { try { return DomainIDParser.parse(uri); } catch (SAXException e) { return getDefaultDomain(); } catch (Exception e) { e.printStackTrace(); } } return getDefaultDomain(); }
Source:
private void logInvalidFileNameFormat(String cur) { LOGGER.warn("Invalid file name format for mount-table version file: " + cur + ". The valid file name format is " + "mount-table-name.<versionNumber>.xml"); }

Target:
private void logInvalidFileNameFormat(String cur) { LOGGER.warn("Invalid file name format for mount-table version file: {}. " + "The valid file name format is mount-table-name.<versionNumber>.xml", cur); }
Source:
public MultipartUpload initiateMultipartUpload(String container, BlobMetadata blobMetadata, PutOptions options) { String uploadId = UUID.randomUUID().toString(); Blob blob = blobBuilder(MULTIPART_PREFIX + uploadId + "-" + blobMetadata.getName() + "-0").payload(ByteSource.empty()).build(); putBlob(container, blob); return MultipartUpload.create(container, blobMetadata.getName(), uploadId, blobMetadata, options); }

Target:
public MultipartUpload initiateMultipartUpload(String container, BlobMetadata blobMetadata, PutOptions options) { String uploadId = UUID.randomUUID().toString(); Blob blob = blobBuilder(MULTIPART_PREFIX + uploadId + "-" + blobMetadata.getName() + "-stub").payload(ByteSource.empty()).build(); putBlob(container, blob); return MultipartUpload.create(container, blobMetadata.getName(), uploadId, blobMetadata, options); }
Source:
public void increaseCapacity() { int created = 1; boolean create = true; while (create && !pool.isFull()) { if (pool.isShutdown()) { return; } int currentSize = listeners.size(); create = pool.getCapacity().getIncrementer() .shouldCreate(currentSize, pool.getConfiguration().getMaxSize(), created); if (create) { try { ConnectionListener cl = pool.createConnectionListener(credential, this); if (Tracer.isEnabled()) Tracer.createConnectionListener(pool.getType(), this, cl, cl.getManagedConnection(), false, false, true, Tracer.isRecordCallstacks() ? new Throwable("CALLSTACK") : null); boolean added = false; if (listeners.size() < pool.getConfiguration().getMaxSize()) { listeners.add(cl); created++; added = true; } if (!added) { if (Tracer.isEnabled()) Tracer.destroyConnectionListener(pool.getType(), this, cl, false, false, true, false, false, false, true, Tracer.isRecordCallstacks() ? new Throwable("CALLSTACK") : null); pool.destroyConnectionListener(cl); return; } } catch (ResourceException re) { return; } } } }

Target:
public void increaseCapacity() { if (!credential.equals(pool.getPrefillCredential())) return; int created = 1; boolean create = true; while (create && !pool.isFull()) { if (pool.isShutdown()) { return; } int currentSize = listeners.size(); create = pool.getCapacity().getIncrementer() .shouldCreate(currentSize, pool.getConfiguration().getMaxSize(), created); if (create) { try { ConnectionListener cl = pool.createConnectionListener(credential, this); if (Tracer.isEnabled()) Tracer.createConnectionListener(pool.getConfiguration().getId(), this, cl, cl.getManagedConnection(), false, false, true, Tracer.isRecordCallstacks() ? new Throwable("CALLSTACK") : null); boolean added = false; if (listeners.size() < pool.getConfiguration().getMaxSize()) { listeners.add(cl); created++; added = true; } if (!added) { if (Tracer.isEnabled()) Tracer.destroyConnectionListener(pool.getConfiguration().getId(), this, cl, false, false, true, false, false, false, true, Tracer.isRecordCallstacks() ? new Throwable("CALLSTACK") : null); pool.destroyConnectionListener(cl); return; } } catch (ResourceException re) { return; } } } }
Source:
public Query build() { String entityName = entityClass.getCanonicalName(); String entityAlias = FilterPredicate.getTypeAlias(entityClass); Query query; if (filterExpression.isPresent()) { PredicateExtractionVisitor extractor = new PredicateExtractionVisitor(); Collection<FilterPredicate> predicates = filterExpression.get().accept(extractor); String filterClause = new HQLFilterOperation().apply(filterExpression.get(), true); String joinClause = getJoinClauseFromFilters(filterExpression.get()); query = session.createQuery( SELECT + entityAlias + FROM + entityName + AS + entityAlias + SPACE + joinClause + SPACE + filterClause + SPACE + getSortClause(sorting, entityClass, true) ); supplyFilterQueryParameters(query, predicates); } else { query = session.createQuery(SELECT + entityAlias + FROM + entityName + AS + entityAlias + SPACE + getSortClause(sorting, entityClass, true)); } addPaginationToQuery(query); return query; }

Target:
public Query build() { String entityName = entityClass.getCanonicalName(); String entityAlias = FilterPredicate.getTypeAlias(entityClass); Query query; if (filterExpression.isPresent()) { PredicateExtractionVisitor extractor = new PredicateExtractionVisitor(); Collection<FilterPredicate> predicates = filterExpression.get().accept(extractor); String filterClause = new HQLFilterOperation().apply(filterExpression.get(), true); String joinClause = getJoinClauseFromFilters(filterExpression.get()); query = session.createQuery( SELECT + entityAlias + FROM + entityName + AS + entityAlias + SPACE + joinClause + SPACE + filterClause + SPACE + getSortClause(sorting, entityClass, USE_ALIAS) ); supplyFilterQueryParameters(query, predicates); } else { query = session.createQuery(SELECT + entityAlias + FROM + entityName + AS + entityAlias + SPACE + getSortClause(sorting, entityClass, USE_ALIAS)); } addPaginationToQuery(query); return query; }
Source:
public boolean tryLock(Set<T> ids) throws InterruptedException { synchronized (locked) { List<T> orderedIds = ordering.sortedCopy(ids); idsLocked.update(ids.size()); for (T id : orderedIds) { if (!tryLock(id)) { unlockTill(orderedIds, id); return false; } } return true; } }

Target:
public boolean tryLock(Set<T> ids) throws InterruptedException { threadsLocked.inc(); try { idsLocked.update(ids.size()); List<T> orderedIds = ordering.sortedCopy(ids); for (T id : orderedIds) { if(!tryLockInternal(id)) { unlockTill(orderedIds, id); return false; } } return true; } finally { threadsLocked.dec(); } }
Source:
String getParcelableCode(Context context, String className, String classToExtend, Map<String, ExecutableElement> properties) { validateProperties(context.processingEnvironment(), properties); Map<String, TypeName> types = convertPropertiesToTypes(properties); FieldSpec classLoader = FieldSpec .builder(ClassName.get(ClassLoader.class), "CL", Modifier.PRIVATE, Modifier.FINAL, Modifier.STATIC) .initializer("$N.class.getClassLoader()", className) .build(); MethodSpec constructor = generateConstructor(types); MethodSpec parcelConstructor = generateParcelConstructor(types, classLoader); MethodSpec writeToParcel = generateWriteToParcel(types); MethodSpec describeContents = generateDescribeContents(); FieldSpec creator = generateCreator(className, classLoader); TypeSpec subclass = TypeSpec.classBuilder(className) .addModifiers(Modifier.FINAL) .superclass(TypeVariableName.get(classToExtend)) .addMethod(constructor) .addField(classLoader) .addField(creator) .addMethod(writeToParcel) .addMethod(describeContents) .addMethod(parcelConstructor) .build(); JavaFile javaFile = JavaFile.builder(context.packageName(), subclass).build(); return javaFile.toString(); }

Target:
String getParcelableCode(Context context, String className, String classToExtend, Map<String, ExecutableElement> properties) { validateProperties(context.processingEnvironment(), properties); Map<String, TypeName> types = convertPropertiesToTypes(properties); FieldSpec classLoader = FieldSpec .builder(ClassName.get(ClassLoader.class), "CL", Modifier.PRIVATE, Modifier.FINAL, Modifier.STATIC) .initializer("$T.class.getClassLoader()", className) .build(); MethodSpec constructor = generateConstructor(types); MethodSpec parcelConstructor = generateParcelConstructor(types, classLoader); MethodSpec writeToParcel = generateWriteToParcel(types); MethodSpec describeContents = generateDescribeContents(); FieldSpec creator = generateCreator(className, classLoader); TypeSpec subclass = TypeSpec.classBuilder(className) .addModifiers(Modifier.FINAL) .superclass(TypeVariableName.get(classToExtend)) .addMethod(constructor) .addField(classLoader) .addField(creator) .addMethod(writeToParcel) .addMethod(describeContents) .addMethod(parcelConstructor) .build(); JavaFile javaFile = JavaFile.builder(context.packageName(), subclass).build(); return javaFile.toString(); }
Source:
protected void verify_internal_effects() { assertThat(iterablesBefore).isNotSameAs(getIterables(assertions)); assertThat(getIterables(assertions).getComparisonStrategy() instanceof ComparatorBasedComparisonStrategy).isTrue(); assertThat(getObjects(assertions).getComparisonStrategy() instanceof IterableElementComparisonStrategy).isTrue(); }

Target:
protected void verify_internal_effects() { assertThat(iterablesBefore).isNotSameAs(getIterables(assertions)); assertThat(getIterables(assertions).getComparisonStrategy()).isInstanceOf(ComparatorBasedComparisonStrategy.class); assertThat(getObjects(assertions).getComparisonStrategy()).isInstanceOf(IterableElementComparisonStrategy.class); }
Source:
public void setServerName(String serverName) { if (serverName == null || serverName.equals("")) { this.serverNames = new String[] {"localhost"}; } else { this.serverNames = new String[] {serverName}; } }

Target:
public void setServerName(String serverName) { this.setServerNames(new String[] { serverName }); }
Source:
private void handlePathRequest(SlingHttpServletRequest request, SlingHttpServletResponse response, DumplibsParams p) throws IOException { HtmlLibrary lib = libraryManager.getLibrary(p.getType(), p.getPath()); try { JSONObject libJSON = htmlLibraryToJSON(lib); response.setContentType(CONTENT_TYPE_JSON); response.getWriter().print(libJSON.toString()); } catch (JSONException e) { log.error("JSON Exception while building ClientLib JSON for clientlib path:" + p.getPath(), e.getMessage()); response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } }

Target:
private void handlePathRequest(SlingHttpServletRequest request, SlingHttpServletResponse response, DumplibsParams p) throws IOException { HtmlLibrary lib = libraryManager.getLibrary(p.getType(), p.getPath()); response.setContentType(CONTENT_TYPE_JSON); JsonObject jsonObject = lib == null ? new JsonObject() : (JsonObject) htmlLibraryToJSON(lib); response.getWriter().print(jsonObject.toString()); }
Source:
void setOnTop() { System.out.println("set on top!!"); setAlwaysOnTop(false); repaint(); setAlwaysOnTop(true); repaint(); }

Target:
void setOnTop() { setAlwaysOnTop(false); repaint(); setAlwaysOnTop(true); repaint(); }
Source:
protected String getSubnetBadFormatMessage() { return isPrefixSupported ? ConstantsManager.getInstance() .getConstants() .thisFieldMustContainSubnetFormatAsNetmaskOrPrefixMsg() : ConstantsManager.getInstance() .getConstants() .thisFieldMustContainSubnetFormatAsNetmaskOrPrefixFreeMsg(); }

Target:
protected String getSubnetBadFormatMessage() { return isPrefixSupported ? ConstantsManager.getInstance() .getConstants() .thisFieldMustContainValidMask() : ConstantsManager.getInstance() .getConstants() .thisFieldMustContainValidNetmask(); }
Source:
public void deleteOne() throws Exception { context.turnOffAuthorisationSystem(); parentCommunity = CommunityBuilder.createCommunity(context) .withName("Parent Community") .build(); Community child1 = CommunityBuilder.createSubCommunity(context, parentCommunity) .withName("Sub Community") .build(); Collection col1 = CollectionBuilder.createCollection(context, child1).withName("Collection 1").build(); Item publicItem1 = ItemBuilder.createItem(context, col1) .withTitle("Test") .withIssueDate("2010-10-17") .withAuthor("Smith, Donald") .withSubject("ExtraEntry") .build(); String bitstreamContent = "ThisIsSomeDummyText"; Bitstream bitstream = null; try (InputStream is = IOUtils.toInputStream(bitstreamContent, CharEncoding.UTF_8)) { bitstream = BitstreamBuilder. createBitstream(context, publicItem1, is) .withName("Bitstream") .withDescription("Description") .withMimeType("text/plain") .build(); } getClient().perform(get("/api/core/bitstreams/" + bitstream.getID())) .andExpect(status().is2xxSuccessful()); getClient().perform(delete("/api/core/bitstreams/" + bitstream.getID())) .andExpect(status().is2xxSuccessful()); getClient().perform(get("/api/core/bitstreams/" + bitstream.getID())) .andExpect(status().isNotFound()); }

Target:
public void deleteOne() throws Exception { context.turnOffAuthorisationSystem(); parentCommunity = CommunityBuilder.createCommunity(context) .withName("Parent Community") .build(); Community child1 = CommunityBuilder.createSubCommunity(context, parentCommunity) .withName("Sub Community") .build(); Collection col1 = CollectionBuilder.createCollection(context, child1).withName("Collection 1").build(); Item publicItem1 = ItemBuilder.createItem(context, col1) .withTitle("Test") .withIssueDate("2010-10-17") .withAuthor("Smith, Donald") .withSubject("ExtraEntry") .build(); String bitstreamContent = "ThisIsSomeDummyText"; Bitstream bitstream = null; try (InputStream is = IOUtils.toInputStream(bitstreamContent, CharEncoding.UTF_8)) { bitstream = BitstreamBuilder. createBitstream(context, publicItem1, is) .withName("Bitstream") .withDescription("Description") .withMimeType("text/plain") .build(); } makeUserAdmin(); String token = getAuthToken(eperson.getEmail(), password); getClient(token).perform(delete("/api/core/bitstreams/" + bitstream.getID())) .andExpect(status().is(204)); getClient().perform(get("/api/core/bitstreams/" + bitstream.getID())) .andExpect(status().isNotFound()); }
Source:
Map<Sprite, List<V>> cloneForScene(Scene scene, Map<K, List<V>> dataMap) { Map<Sprite, List<V>> clonedList = new HashMap<>(); for (Map.Entry<K, List<V>> entry : dataMap.entrySet()) { List<V> newList = new ArrayList<>(); for (V data : entry.getValue()) { newList.add(newInstance(getDataName(data))); } if (entry.getKey() == null) { continue; } String keyName = getKeyName(entry.getKey()); Sprite clonedInstance = scene.getSpriteBySpriteName(keyName); clonedList.put(clonedInstance, newList); } return clonedList; }

Target:
Map<Sprite, List<V>> cloneForScene(Scene scene, Map<K, List<V>> dataMap) { Map<Sprite, List<V>> clonedMap = new HashMap<>(); for (Map.Entry<K, List<V>> entry : dataMap.entrySet()) { List<V> newList = new ArrayList<>(); for (V data : entry.getValue()) { newList.add(newInstance(getDataName(data))); } String keyName = getKeyName(entry.getKey()); Sprite clonedInstanceOnStage = scene.getSpriteBySpriteName(keyName); clonedMap.put(clonedInstanceOnStage, newList); } return clonedMap; }
Source:
public boolean isEosEnabled() { return StreamsConfig.EXACTLY_ONCE.equals(config.getString(StreamsConfig.PROCESSING_GUARANTEE_CONFIG)); }

Target:
public boolean isEosEnabled() { return eosEnabled; }
Source:
public void testSelectiveRequestAggregation() { HttpObjectAggregator myPostAggregator = new HttpObjectAggregator(1024 * 1024) { @Override protected boolean isStartMessage(HttpObject msg) throws Exception { if (msg instanceof HttpRequest) { HttpRequest request = (HttpRequest) msg; HttpMethod method = request.method(); if (method.equals(HttpMethod.POST)) { return true; } } return false; } }; EmbeddedChannel channel = new EmbeddedChannel(myPostAggregator); HttpRequest request1 = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, "/"); HttpContent content1 = new DefaultHttpContent(Unpooled.copiedBuffer("Hello, World!", CharsetUtil.UTF_8)); request1.headers().set(HttpHeaderNames.CONTENT_TYPE, HttpHeaderValues.TEXT_PLAIN); channel.writeInbound(request1, content1, LastHttpContent.EMPTY_LAST_CONTENT); Object msg1 = channel.readInbound(); assertTrue(msg1 instanceof FullHttpRequest); HttpRequest request2 = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.PUT, "/"); HttpContent content2 = new DefaultHttpContent(Unpooled.copiedBuffer("Hello, World!", CharsetUtil.UTF_8)); request2.headers().set(HttpHeaderNames.CONTENT_TYPE, HttpHeaderValues.TEXT_PLAIN); channel.writeInbound(request2, content2, LastHttpContent.EMPTY_LAST_CONTENT); assertSame(request2, channel.readInbound()); assertSame(content2, channel.readInbound()); assertSame(LastHttpContent.EMPTY_LAST_CONTENT, channel.readInbound()); }

Target:
public void testSelectiveRequestAggregation() { HttpObjectAggregator myPostAggregator = new HttpObjectAggregator(1024 * 1024) { @Override protected boolean isStartMessage(HttpObject msg) throws Exception { if (msg instanceof HttpRequest) { HttpRequest request = (HttpRequest) msg; HttpMethod method = request.method(); if (method.equals(HttpMethod.POST)) { return true; } } return false; } }; EmbeddedChannel channel = new EmbeddedChannel(myPostAggregator); try { HttpRequest request1 = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, "/"); HttpContent content1 = new DefaultHttpContent(Unpooled.copiedBuffer("Hello, World!", CharsetUtil.UTF_8)); request1.headers().set(HttpHeaderNames.CONTENT_TYPE, HttpHeaderValues.TEXT_PLAIN); assertTrue(channel.writeInbound(request1, content1, LastHttpContent.EMPTY_LAST_CONTENT)); Object msg1 = channel.readInbound(); try { assertTrue(msg1 instanceof FullHttpRequest); } finally { ReferenceCountUtil.release(msg1); } HttpRequest request2 = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.PUT, "/"); HttpContent content2 = new DefaultHttpContent(Unpooled.copiedBuffer("Hello, World!", CharsetUtil.UTF_8)); request2.headers().set(HttpHeaderNames.CONTENT_TYPE, HttpHeaderValues.TEXT_PLAIN); try { assertTrue(channel.writeInbound(request2, content2, LastHttpContent.EMPTY_LAST_CONTENT)); assertSame(request2, channel.readInbound()); assertSame(content2, channel.readInbound()); assertSame(LastHttpContent.EMPTY_LAST_CONTENT, channel.readInbound()); } finally { ReferenceCountUtil.release(request2); ReferenceCountUtil.release(content2); } assertFalse(channel.finish()); } finally { channel.close(); } }
Source:
public void addToDate_shouldAddSecondsWhenUnitIsSeconds() throws ParseException { Duration duration = new Duration(30, Duration.SNOMED_CT_SECONDS_CODE); Date autoExpireDate = duration.addToDate(createDateTime("2014-07-01 10-00-00"), null); assertEquals(createDateTime("2014-07-01 10-00-29.999"), autoExpireDate); }

Target:
public void addToDate_shouldAddSecondsWhenUnitIsSeconds() throws ParseException { Duration duration = new Duration(30, Duration.SNOMED_CT_SECONDS_CODE); Date autoExpireDate = duration.addToDate(createDateTime("2014-07-01 10:00:00"), null); assertEquals(createDateTime("2014-07-01 10:00:30"), autoExpireDate); }
Source:
public Long getMegaByteMillis() { if (jobHistoryListener == null ) { LOG.error("Cannot call getMegaByteMillis before parsing the history file!"); return Constants.NOTFOUND_VALUE; } Long mapSlotMillis = jobHistoryListener.getJobDetails().getMapSlotMillis(); Long reduceSlotMillis = jobHistoryListener.getJobDetails().getReduceSlotMillis(); if (jobConf == null) { throw new ProcessingException("JobConf is null, cannot calculate megabytemillis"); } Long xmx75 = getXmxValue(jobConf.get(Constants.JAVA_CHILD_OPTS_CONF_KEY)); if (xmx75 == 0L) { xmx75 = Constants.DEFAULT_XMX_SETTING; LOG.info("Xmx value is 0, now presuming default Xmx size " + Constants.DEFAULT_XMX_SETTING); } Long xmxTotal = getXmxTotal(xmx75); LOG.trace("\n Xmx " + xmxTotal + ": " + mapSlotMillis + " \n " + ": " + reduceSlotMillis + " \n "); Long mbMillis = xmxTotal * mapSlotMillis + xmxTotal * reduceSlotMillis; return mbMillis; }

Target:
public Long getMegaByteMillis() { if (jobHistoryListener == null ) { LOG.error("Cannot call getMegaByteMillis before parsing the history file!"); return Constants.NOTFOUND_VALUE; } long mapSlotMillis = jobHistoryListener.getJobDetails().getMapSlotMillis(); long reduceSlotMillis = jobHistoryListener.getJobDetails().getReduceSlotMillis(); if (jobConf == null) { throw new ProcessingException("JobConf is null, cannot calculate megabytemillis"); } long xmx75 = getXmxValue(jobConf.get(Constants.JAVA_CHILD_OPTS_CONF_KEY)); if (xmx75 == 0L) { xmx75 = Constants.DEFAULT_XMX_SETTING; LOG.info("Xmx value is 0, now presuming default Xmx size " + Constants.DEFAULT_XMX_SETTING); } long xmxTotal = getXmxTotal(xmx75); LOG.trace("\n Xmx " + xmxTotal + ": " + mapSlotMillis + " \n " + ": " + reduceSlotMillis + " \n "); Long mbMillis = xmxTotal * mapSlotMillis + xmxTotal * reduceSlotMillis; return mbMillis; }
Source:
public boolean tick() { profiler.startSection("providerTick"); long i = System.currentTimeMillis(); int randomTickSpeed = this.world.getGameRules().getInt("randomTickSpeed"); boolean doMobSpawning = this.world.getGameRules().getBoolean("doMobSpawning"); boolean isRaining = this.world.isRaining(); boolean isThundering = this.world.isThundering(); Random rand = this.world.rand; PlayerCubeMap playerCubeMap = ((PlayerCubeMap) this.world.getPlayerChunkMap()); Iterator<Cube> watchersIterator = playerCubeMap.getCubeIterator(); while (watchersIterator.hasNext()) { Cube cube = watchersIterator.next(); cube.tickCubeServer(() -> System.currentTimeMillis() - i > 40, rand); this.profiler.startSection("thunder"); if (this.world.provider.canDoLightning((Chunk) cube.getColumn()) && isRaining && isThundering && rand.nextInt(100000) == 0) cube.updateThunder(this.world, rand, doMobSpawning); this.profiler.endStartSection("iceandsnow"); if (this.world.provider.canDoRainSnowIce((Chunk) cube.getColumn()) && rand.nextInt(16) == 0) cube.updateRainSnowIce(this.world, this, rand, isRaining); this.profiler.endStartSection("randomTick"); int randomTickCounter = randomTickSpeed; while (randomTickCounter-- > 0) cube.randomTick(this.world, rand); this.profiler.endSection(); } profiler.endSection(); return false; }

Target:
public boolean tick() { profiler.startSection("providerTick"); long i = System.currentTimeMillis(); int randomTickSpeed = this.world.getGameRules().getInt("randomTickSpeed"); Random rand = this.world.rand; PlayerCubeMap playerCubeMap = ((PlayerCubeMap) this.world.getPlayerChunkMap()); Iterator<Cube> watchersIterator = playerCubeMap.getCubeIterator(); while (watchersIterator.hasNext()) { Cube cube = watchersIterator.next(); cube.tickCubeServer(() -> System.currentTimeMillis() - i > 40, rand); if (!doRandomBlockTicksHere) continue; int randomTickCounter = randomTickSpeed; while (randomTickCounter-- > 0) cube.randomTick(this.world, rand); } profiler.endSection(); return false; }