auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected Optional<C> retrieveCredentials(final WebContext context) { try { final C credentials = this.credentialsExtractor.extract(context); if (credentials == null) { return Optional.empty(); } final long t0 = System.currentTimeMillis(); try { this.authenticator.validate(credentials, context); } finally { final long t1 = System.currentTimeMillis(); logger.debug("Credentials validation took: ms", t1 - t0); } return Optional.of(credentials); } catch (CredentialsException e) { logger.info("Failed to retrieve or validate credentials: {}", e.getMessage()); logger.debug("Failed to retrieve or validate credentials", e); return Optional.empty(); } }

Target:
protected Optional<C> retrieveCredentials(final WebContext context) { try { final Optional<C> credentials = this.credentialsExtractor.extract(context); credentials.ifPresent(c -> { final long t0 = System.currentTimeMillis(); try { this.authenticator.validate(c, context); } finally { final long t1 = System.currentTimeMillis(); logger.debug("Credentials validation took: ms", t1 - t0); } }); return credentials; } catch (CredentialsException e) { logger.info("Failed to retrieve or validate credentials: {}", e.getMessage()); logger.debug("Failed to retrieve or validate credentials", e); return Optional.empty(); } }
Source:
public Properties getKafkaProducerProperties() { final Properties producerProps = getKafkaConsumerProperties(); producerProps.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer"); producerProps.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer"); producerProps.put("acks", "all"); producerProps.put("request.timeout.ms", kafkaSettings.getRequestTimeoutMs()); producerProps.put("batch.size", kafkaSettings.getBatchSize()); producerProps.put("linger.ms", kafkaSettings.getLingerMs()); producerProps.put(ProducerConfig.COMPRESSION_TYPE_CONFIG, "lz4"); return producerProps; }

Target:
public Properties getKafkaProducerProperties() { final Properties producerProps = (Properties) kafkaProperties.clone(); producerProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringSerializer"); producerProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringSerializer"); producerProps.put(ProducerConfig.ACKS_CONFIG, "all"); producerProps.put(ProducerConfig.REQUEST_TIMEOUT_MS_CONFIG, kafkaSettings.getRequestTimeoutMs()); producerProps.put(ProducerConfig.BATCH_SIZE_CONFIG, kafkaSettings.getBatchSize()); producerProps.put(ProducerConfig.LINGER_MS_CONFIG, kafkaSettings.getLingerMs()); producerProps.put(ProducerConfig.COMPRESSION_TYPE_CONFIG, "lz4"); return producerProps; }
Source:
private void removeHandlers() { if (fileEventHandlerRegistration != null) { fileEventHandlerRegistration.removeHandler(); } if (resourceChangeHandlerRegistration != null) { resourceChangeHandlerRegistration.removeHandler(); } }

Target:
private void removeHandlers() { if (fileEventHandlerRegistration != null) { fileEventHandlerRegistration.removeHandler(); fileEventHandlerRegistration = null; } if (resourceChangeHandlerRegistration != null) { resourceChangeHandlerRegistration.removeHandler(); resourceChangeHandlerRegistration = null; } }
Source:
protected void flushQueues() { long now = now(); Logger.debug(LOG_TAG, "Applying remaining insertions."); try { insertionManager.finishUp(); Logger.debug(LOG_TAG, "Done applying remaining insertions."); } catch (Exception e) { Logger.warn(LOG_TAG, "Unable to apply remaining insertions.", e); } if (enqueuedGuids.size() != insertedGuids.size()) { Logger.warn(LOG_TAG, "Enqueued " + enqueuedGuids.size() + " records, but inserted " + insertedGuids.size() + " records."); Set<String> eSet = new HashSet<String>(enqueuedGuids); Set<String> iSet = new HashSet<String>(insertedGuids); eSet.removeAll(iSet); if (eSet.isEmpty()) { Logger.debug(LOG_TAG, "All enqueued guids were inserted."); } else { Logger.warn(LOG_TAG, "Enqueued but didn't insert the following guids: " + "(" + Utils.toCommaSeparatedString(eSet) + ")"); } iSet.removeAll(new HashSet<String>(enqueuedGuids)); if (iSet.isEmpty()) { } else { Logger.warn(LOG_TAG, "Inserted but didn't enqueue the following guids: " + "(" + Utils.toCommaSeparatedString(iSet) + ")"); } } else { Logger.debug(LOG_TAG, "Enqueued and inserted " + enqueuedGuids.size() + " records."); } Logger.debug(LOG_TAG, "Applying deletions."); try { untrackGUIDs(deletionManager.flushAll(getIDForGUID("unfiled"), now)); Logger.debug(LOG_TAG, "Done applying deletions."); } catch (Exception e) { Logger.error(LOG_TAG, "Unable to apply deletions.", e); } }

Target:
protected void flushQueues() { long now = now(); Logger.debug(LOG_TAG, "Applying remaining insertions."); try { insertionManager.finishUp(); Logger.debug(LOG_TAG, "Done applying remaining insertions."); } catch (Exception e) { Logger.warn(LOG_TAG, "Unable to apply remaining insertions.", e); } Logger.debug(LOG_TAG, "Applying deletions."); try { untrackGUIDs(deletionManager.flushAll(getIDForGUID("unfiled"), now)); Logger.debug(LOG_TAG, "Done applying deletions."); } catch (Exception e) { Logger.error(LOG_TAG, "Unable to apply deletions.", e); } }
Source:
private Bitmap decodeStream(InputStream stream, Request data) throws IOException { if (stream == null) { return null; } byte[] bytes = IOUtils.toByteArray(stream); BitmapFactory.Options options = null; if (data.hasSize()) { options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeByteArray(bytes, 0, bytes.length, options); calculateInSampleSize(data.targetWidth, data.targetHeight, options); } return BitmapFactory.decodeByteArray(bytes, 0, bytes.length, options); }

Target:
private Bitmap decodeStream(InputStream stream, Request data) throws IOException { if (stream == null) { return null; } MarkableInputStream markStream = new MarkableInputStream(stream); stream = markStream; long mark = markStream.savePosition(1024); byte[] fileHeaderBytes = new byte[WEBP_FILE_HEADER_SIZE]; boolean isWebPFile = false; if (stream.read(fileHeaderBytes, 0, WEBP_FILE_HEADER_SIZE) == WEBP_FILE_HEADER_SIZE) { isWebPFile = WEBP_FILE_HEADER_RIFF.equals(new String(fileHeaderBytes, 0, 4)) && WEBP_FILE_HEADER_WEBP.equals(new String(fileHeaderBytes, 8, 4)); } markStream.reset(mark); if (isWebPFile) { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); byte[] buffer = new byte[1024 * 4]; int n = 0; while (-1 != (n = stream.read(buffer))) { byteArrayOutputStream.write(buffer, 0, n); } byte[] bytes = byteArrayOutputStream.toByteArray(); BitmapFactory.Options options = new BitmapFactory.Options(); options.inPurgeable = true; options.inInputShareable = true; if (data.hasSize()) { options.inJustDecodeBounds = true; BitmapFactory.decodeByteArray(bytes, 0, bytes.length, options); calculateInSampleSize(data.targetWidth, data.targetHeight, options); } return BitmapFactory.decodeByteArray(bytes, 0, bytes.length, options); } else { BitmapFactory.Options options = null; if (data.hasSize()) { options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeStream(stream, null, options); calculateInSampleSize(data.targetWidth, data.targetHeight, options); markStream.reset(mark); } return BitmapFactory.decodeStream(stream, null, options); } }
Source:
public void catchEmailLinkSignIn() { String link = getIntent().getExtras().getString(ExtraConstants.EMAIL_LINK_SIGN_IN); if (link != null) { signInWithEmailLink(link); } }

Target:
public void catchEmailLinkSignIn() { if (getIntent().getExtras() == null) { return; } String link = getIntent().getExtras().getString(ExtraConstants.EMAIL_LINK_SIGN_IN); if (link != null) { signInWithEmailLink(link); } }
Source:
private static long combineFilters(long[] filters) { if (filters == null) { return 0; } int combined = 0; for (int i = 0; i < filters.length; i++) { combined |= filters[i]; } return combined; }

Target:
private static long combineFilters(long[] filters) { if (filters == null) { return 0; } int combined = 0; for (long filter : filters) { combined |= filter; } return combined; }
Source:
private Map<Integer, Long> loadOffsetFromPreviousMetaData(Object lastCommit) { Map<Integer, Long> offsetMap = Maps.newHashMap(); if (lastCommit == null) { return offsetMap; } Map<Object, Object> lastCommitMap = (Map) lastCommit; for (Map.Entry<Object, Object> entry : lastCommitMap.entrySet()) { try { int partitionId = Integer.parseInt(entry.getKey().toString()); long offset = Long.parseLong(entry.getValue().toString()); log.debug("Recover last commit information partitionId [%s], offset [%s]", partitionId, offset); offsetMap.put(partitionId, offset); } catch (NumberFormatException e) { log.error(e, "Fail to load offset from previous meta data [%s]", entry); } } log.info("Loaded offset map[%s]", offsetMap); return offsetMap; }

Target:
private Map<Integer, Long> loadOffsetFromPreviousMetaData(Object lastCommit) { Map<Integer, Long> offsetMap = Maps.newHashMap(); if (lastCommit == null) { return offsetMap; } if (lastCommit instanceof Map) { Map<Object, Object> lastCommitMap = (Map) lastCommit; for (Map.Entry<Object, Object> entry : lastCommitMap.entrySet()) { try { int partitionId = Integer.parseInt(entry.getKey().toString()); long offset = Long.parseLong(entry.getValue().toString()); log.debug("Recover last commit information partitionId [%s], offset [%s]", partitionId, offset); offsetMap.put(partitionId, offset); } catch (NumberFormatException e) { log.error(e, "Fail to load offset from previous meta data [%s]", entry); } } log.info("Loaded offset map[%s]", offsetMap); } else { log.error("Unable to cast lastCommit to Map"); } return offsetMap; }
Source:
public Set<AuditActionContext> getAuditRecordsSince(final LocalDate localDate) { return Sets.newHashSet(couchDb.findAuditRecordsSince(localDate)); }

Target:
public Set<? extends AuditActionContext> getAuditRecordsSince(final LocalDate localDate) { return CollectionUtils.wrapHashSet(couchDb.findAuditRecordsSince(localDate)); }
Source:
protected void initUnregisteredDisksToDB(Guid storageDomainId) { Set<DiskImage> existingDisks = new HashSet<>(diskImageDao.getAllForStorageDomain(storageDomainId)); for (Object unregisteredDiskObj : unregisteredDisks) { UnregisteredDisk unregisteredDisk = (UnregisteredDisk) unregisteredDiskObj; if (existingDisks.contains(unregisteredDisk.getDiskImage())) { log.info("Disk with id '{}' already exists in the engine, therefore will not be " + "part of the unregistered disks.", unregisteredDisk.getDiskAlias(), unregisteredDisk.getDiskImage().getId()); continue; } unregisteredDisksDao.removeUnregisteredDisk(unregisteredDisk.getId().getDiskId(), storageDomainId); unregisteredDisksDao.saveUnregisteredDisk(unregisteredDisk); log.info("Adding unregistered disk of disk id '{}' and disk alias '{}'", unregisteredDisk.getDiskImage().getId(), unregisteredDisk.getDiskAlias()); } }

Target:
protected void initUnregisteredDisksToDB(Guid storageDomainId) { Set<Guid> existingDiskIds = diskImageDao.getAllForStorageDomain(storageDomainId) .stream() .map(DiskImage::getId) .collect(Collectors.toSet()); for (UnregisteredDisk unregisteredDisk: unregisteredDisks) { if (existingDiskIds.contains(unregisteredDisk.getDiskImage())) { log.info("Disk with id '{}' already exists in the engine, therefore will not be " + "part of the unregistered disks.", unregisteredDisk.getDiskAlias(), unregisteredDisk.getDiskId()); continue; } unregisteredDisksDao.removeUnregisteredDisk(unregisteredDisk.getDiskId(), storageDomainId); unregisteredDisksDao.saveUnregisteredDisk(unregisteredDisk); log.info("Adding unregistered disk of disk id '{}' and disk alias '{}'", unregisteredDisk.getDiskId(), unregisteredDisk.getDiskAlias()); } }
Source:
public void testGetHTMLEmpty() { DoorsTableRowCollector dtc = new DoorsTableRowCollector(extractor); DoorsTableRow dtr = new DoorsTableRow(); dtc.getHTML(dtr, DoorsColumnType.OBJECT_TEXT); Assert.fail(); }

Target:
public void testGetHTMLEmpty() { DoorsTableRowCollector dtc = new DoorsTableRowCollector(extractor); DoorsTableRow dtr = new DoorsTableRow(); dtc.getHTML(dtr, DoorsColumnType.OBJECT_TEXT); }
Source:
protected void testPutBlobTierHelper(Tier tier, PutOptions options) throws Exception { if (!isMacOSX()) { super.testPutBlobTierHelper(tier, options); } }

Target:
protected void testPutBlobTierHelper(Tier tier, PutOptions options) throws Exception { checkExtendedAttributesSupport(); super.testPutBlobTierHelper(tier, options); }
Source:
protected String worklogInSec(final Long worklog) { DurationFormatter durationFormatter = new DurationFormatter(); isWorklogInSec = true; if ("false".equals( pluginSettings.get(GlobalSettingsKey.JTTP_PLUGIN_REPORTING_SETTINGS_WORKLOG_IN_SEC))) { isWorklogInSec = false; } if (worklog != null) { if (isWorklogInSec) { return worklog.toString(); } return durationFormatter.exactDuration(worklog); } return ""; }

Target:
protected String worklogInSec(final Long worklog) { DurationFormatter durationFormatter = new DurationFormatter(); isWorklogInSec = true; if (!userReportingSettingsHelper.getWorklogTimeInSeconds()) { isWorklogInSec = false; } if (worklog != null) { if (isWorklogInSec) { return worklog.toString(); } return durationFormatter.exactDuration(worklog); } return ""; }
Source:
private void init() { D2.init(this); SdkQueries.createDBIndexes(); PopulateDB.initDBQuery(); try { PostMigration.launchPostMigration(); }catch (PostMigrationException e){ new AlertDialog.Builder(this) .setTitle(getApplicationContext().getString(R.string.error_message)) .setCancelable(false) .setMessage(getApplicationContext().getString(R.string.db_migration_error)) .setNeutralButton(android.R.string.ok, null).create().show(); } if (!BuildConfig.multiuser) { Log.i(TAG, "Pull on SplashScreen ..."); PullController pullController = new PullController( getApplication().getApplicationContext()); IAsyncExecutor asyncExecutor = new AsyncExecutor(); IMainExecutor mainExecutor = new UIThreadExecutor(); PullUseCase pullUseCase = new PullUseCase(pullController, asyncExecutor, mainExecutor); PullFilters pullFilters = new PullFilters(); splashActivityStrategy.initPullFilters(pullFilters); splashActivityStrategy.executePull(pullUseCase, pullFilters); } SurveyDB.deleteOlderSentSurveys(); }

Target:
private void init() { D2.init(this); SdkQueries.createDBIndexes(); PopulateDB.initDBQuery(); try { PostMigration.launchPostMigration(); }catch (PostMigrationException e){ new AlertDialog.Builder(this) .setTitle(getApplicationContext().getString(R.string.error_message)) .setCancelable(false) .setMessage(getApplicationContext().getString(R.string.db_migration_error)) .setNeutralButton(android.R.string.ok, null).create().show(); } if (!BuildConfig.multiuser) { Log.i(TAG, "Pull on SplashScreen ..."); PullController pullController = new PullController( getApplication().getApplicationContext()); IAsyncExecutor asyncExecutor = new AsyncExecutor(); IMainExecutor mainExecutor = new UIThreadExecutor(); PullUseCase pullUseCase = new PullUseCase(pullController, asyncExecutor, mainExecutor); PullFilters pullFilters = new PullFilters(); splashActivityStrategy.initPullFilters(pullFilters); splashActivityStrategy.executePull(pullUseCase, pullFilters); } if(BuildConfig.performMaintenanceTasks) { performMaintenanceTasks(); } }
Source:
public void showSuccess() { Toast.makeText(getContext(), getStringMessage(R.string.collectionsheet_submit_success), Toast.LENGTH_LONG).show(); }

Target:
public void showSuccess() { Toaster.show(rootView, getStringMessage(R.string.collectionsheet_submit_success)); }
Source:
private ExtensionContext.Store getStore(ExtensionContext context) { return context.getStore(ExtensionContext.Namespace.create(getClass(), context)); }

Target:
private static ExtensionContext.Store getStore(ExtensionContext context) { return context.getStore(ExtensionContext.Namespace.create(AzureTestWatcher.class, context)); }
Source:
public boolean isAuthzClient(String id) { ClientRegistration client = findByRegistrationId(id); return client != null && isAuthzClient(client) && !authorizationProperties.get(id).getOnDemand(); }

Target:
public boolean isAuthzClient(String id) { ClientRegistration client = findByRegistrationId(id); return client != null && isAuthzClient(client); }
Source:
public static String getRemainderOfLineAfter(String context, String phrase) { if (context == null || phrase == null) return null; int index = context.indexOf(phrase); if (index < 0) return null; int lineEndIndex = context.indexOf("\n", index); if (lineEndIndex <= 0) { return trim(context.substring(index + phrase.length())); } else { return trim(context.substring(index + phrase.length(), lineEndIndex)); } }

Target:
public static String getRemainderOfLineAfter(String context, String phrase) { if (context == null || phrase == null) return null; int index = context.indexOf(phrase); if (index < 0) return null; int lineEndIndex = context.indexOf("\n", index); if (lineEndIndex <= 0) { return context.substring(index + phrase.length()); } else { return context.substring(index + phrase.length(), lineEndIndex); } }
Source:
public static boolean isValidIds(String gameId, String placementId) { if (TextUtils.isEmpty(gameId) || TextUtils.isEmpty(placementId)) { String ids = TextUtils.isEmpty(gameId) ? TextUtils.isEmpty(placementId) ? "Game ID and Placement ID" : "Game ID" : "Placement ID"; Log.w(TAG, "Unity Ads failed to load interstitial ad: " + ids + " cannot be empty."); return false; } return true; }

Target:
public static boolean isValidIds(String gameId, String placementId) { if (TextUtils.isEmpty(gameId) || TextUtils.isEmpty(placementId)) { return false; } return true; }
Source:
private void open() { while (!isOpened()) { BusyPopup.retryClickUntilPopupDisappears(dropdownToggle); } }

Target:
private void open() { Waits.elementClickable(By.cssSelector(DROPDOWN_TOGGLE)); BusyPopup.retryClickUntilPopupDisappears(dropdownToggle); }
Source:
FileMeta getMetadata( final File target, final LocalLockOwner owner ) throws IOException { String path = target.getAbsolutePath(); try { return lockManager.reentrantSynchronous( path, ( opLock ) -> { FileMeta meta = metadataCache.computeIfAbsent( path, ( p ) -> new FileMeta( p, target.isDirectory(), owner ) ); return meta; } ); } catch ( InterruptedException e ) { throw new IOException( "Thread interrupted while retrieving / creating file metadata : " + path, e ); } }

Target:
FileMeta getMetadata( final File target, final LocalLockOwner owner ) throws IOException { String path = target.getAbsolutePath(); try { return lockManager.reentrantSynchronous( path, ( opLock ) -> { FileMeta meta = null; TransactionManager transactionManager = metadataCache.getAdvancedCache().getTransactionManager(); try { transactionManager.begin(); meta = metadataCache.computeIfAbsent( path, ( p ) -> new FileMeta( p, target.isDirectory() ) ); LockLevel currentLockLevel = meta.getLockLevel( this.nodeKey ); if ( currentLockLevel == null || currentLockLevel != owner.getLockLevel() ) { meta.setLock( this.nodeKey, owner.getLockLevel() ); metadataCache.put( path, meta ); } } catch ( NotSupportedException | SystemException e ) { try { transactionManager.rollback(); throw new PartylineException( "Failed to begin transaction. Rolling back. Path: " + path, e ); } catch ( SystemException e1 ) { LoggerFactory.getLogger( getClass().getName() ) .error( "System Exception during transaction rollback involving path: " + path, e1 ); } } finally { try { transactionManager.commit(); } catch ( RollbackException | HeuristicMixedException | HeuristicRollbackException | SystemException e ) { LoggerFactory.getLogger( getClass().getName() ) .error( "Exception during transaction commit involving path: " + path, e ); } } return meta; } ); } catch ( InterruptedException e ) { LoggerFactory.getLogger( getClass().getName() ).error( "Problem retrieving metadata for path: " + path, e ); } return null; }
Source:
protected static List<IArtifactKey> getArtifactKeys(IQueryResult<IInstallableUnit> ius) { List<IArtifactKey> keys = new ArrayList<>(); for (IInstallableUnit iInstallableUnit : ius) keys.addAll(iInstallableUnit.getArtifacts()); return keys; }

Target:
protected static List<IArtifactKey> getArtifactKeys(IQueryResult<IInstallableUnit> ius) { List<IArtifactKey> keys = new ArrayList<>(); for (IInstallableUnit iu : ius) keys.addAll(iu.getArtifacts()); return keys; }
Source:
public boolean isPage500(HttpMessage msg) { if (isCustomPage(msg, CustomPage.Type.OK_200) || isCustomPage(msg, CustomPage.Type.NOTFOUND_404)) { return false; } return isCustomPage(msg, CustomPage.Type.ERROR_500) ? true : msg.getResponseHeader().getStatusCode() == HttpStatusCode.INTERNAL_SERVER_ERROR; }

Target:
public boolean isPage500(HttpMessage msg) { if (isCustomPage(msg, CustomPage.Type.OK_200) || isCustomPage(msg, CustomPage.Type.NOTFOUND_404)) { return false; } if (isCustomPage(msg, CustomPage.Type.ERROR_500)) { return true; } return msg.getResponseHeader().getStatusCode() == HttpStatusCode.INTERNAL_SERVER_ERROR; }
Source:
public void testServicePostSimpleServerError() throws IOException { expectLifecycleServerError(HttpPost.class, BASE_URL); replayAll(); PostService service = injector.getInstance(PostService.class); service.post(mockCallback); verifyAll(); }

Target:
@SuppressWarnings("unchecked") public void testServicePostSimpleServerError() throws IOException { expectLifecycleServerError(HttpPost.class, BASE_URL); replayAll(); PostService service = injector.getInstance(PostService.class); service.post(mockCallback); verifyAll(); }
Source:
public int run(String[] argv) throws Exception { String description = "hdfs lsSnapshot <snapshotDir>: \n" + "\tGet the list of snapshots for a snapshottable directory.\n"; if(argv.length != 1) { System.err.println("Usage: \n" + description); return 1; } FileSystem fs = FileSystem.get(getConf()); if (! (fs instanceof DistributedFileSystem)) { System.err.println( "lsSnapshot can only be used in DistributedFileSystem"); return 1; } DistributedFileSystem dfs = (DistributedFileSystem) fs; Path snapshotRoot = new Path(argv[0]); try { SnapshotStatus[] stats = dfs.getSnapshotListing(snapshotRoot); SnapshotStatus.print(stats, System.out); } catch (IOException e) { String[] content = e.getLocalizedMessage().split("\n"); System.err.println("lsSnapshot: " + content[0]); e.printStackTrace(System.err); return 1; } return 0; }

Target:
public int run(String[] argv) throws Exception { String description = "hdfs lsSnapshot <snapshotDir>: \n" + "\tGet the list of snapshots for a snapshottable directory.\n"; if(argv.length != 1) { System.err.println("Invalid no of arguments"); System.err.println("Usage: \n" + description); return 1; } Path snapshotRoot = new Path(argv[0]); try { DistributedFileSystem dfs = AdminHelper.getDFS(getConf()); SnapshotStatus[] stats = dfs.getSnapshotListing(snapshotRoot); SnapshotStatus.print(stats, System.out); } catch (Exception e) { String[] content = e.getLocalizedMessage().split("\n"); System.err.println("lsSnapshot: " + content[0]); return 1; } return 0; }
Source:
public void onJobUpdate() { if(itemPanel!=null) { long now = System.currentTimeMillis(); if(now - lastTimeUpdatedItem > updateLabelInterval) { lastTimeUpdatedItem = now; itemPanel.readJob(); setLabel(itemPanel.getText()); } } }

Target:
public void onJobUpdate() { if(!awaitingItemUpdate.getAndSet(true)) { SwingUtilities.invokeLater(new UpdateItemProperties()); } }
Source:
protected static String objectWithPrecisionToString(String value, Timestamp t, Long columnLength) { int fraction = truncateNanosToColumnLength(t.getNanos(), columnLength); if (fraction == 0) return value; String strFormat = "%0" + columnLength + "d"; StringBuilder result = threadLocalBuilder.get(); result.append(value); result.append("."); result.append(String.format(strFormat, fraction)); return result.toString(); }

Target:
protected static String objectWithPrecisionToString(String value, Timestamp t, Long columnLength) { if ( columnLength == 0L ) return value; int divideBy = (int) Math.pow(10, 6 + 3 - columnLength); int fractional = ((int) t.getNanos()) / divideBy; String strFractional = String.format(buildStrFormatForColLength(columnLength), fractional); StringBuilder result = threadLocalBuilder.get(); result.append(value); result.append("."); result.append(strFractional); return result.toString(); }
Source:
private void checkHelixConstraints(HelixAdmin helixAdmin) { ClusterConstraints constraints = helixAdmin.getConstraints(getHelixClusterName(), ClusterConstraints.ConstraintType.MESSAGE_CONSTRAINT); ConstraintItem item = constraints.getConstraintItem("MaxStateTransitionsPerInstance"); Assert.assertEquals(".*", item.getAttributeValue(ClusterConstraints.ConstraintAttribute.INSTANCE)); Assert .assertEquals("STATE_TRANSITION", item.getAttributeValue(ClusterConstraints.ConstraintAttribute.MESSAGE_TYPE)); Assert.assertEquals(CommonConstants.Helix.DEFAULT_HELIX_INSTANCE_MAX_STATE_TRANSITIONS, item.getConstraintValue()); }

Target:
private void checkHelixConstraints(HelixAdmin helixAdmin) { ClusterConstraints constraints = helixAdmin.getConstraints(getHelixClusterName(), ClusterConstraints.ConstraintType.MESSAGE_CONSTRAINT); ConstraintItem item = constraints.getConstraintItem("MaxStateTransitionsPerInstance"); Assert.assertEquals(item.getAttributeValue(ClusterConstraints.ConstraintAttribute.INSTANCE), ".*"); Assert.assertEquals(item.getAttributeValue(ClusterConstraints.ConstraintAttribute.MESSAGE_TYPE), Message.MessageType.STATE_TRANSITION.name()); Assert.assertEquals(item.getConstraintValue(), CommonConstants.Helix.DEFAULT_HELIX_INSTANCE_MAX_STATE_TRANSITIONS); }
Source:
public SequenceReader(List<? extends Reader> readers) { int size = readers.size(); fReaders = new Reader[size]; for (int i = 0; i < size; i++) { fReaders[i] = readers.get(i); } }

Target:
public SequenceReader(List<? extends Reader> readers) { final int size = readers.size(); fReaders = new Reader[size]; for (int i = 0; i < size; i++) { fReaders[i] = readers.get(i); } }
Source:
@Test void testEqualAsCollectionSansNullability() { final SqlTypeFactoryImpl factory = new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT); final RelDataType arrayNullable = new ArraySqlType(factory.createTypeWithNullability(f.sqlBigInt, true), false); final RelDataType arrayNotNull = new ArraySqlType(factory.createTypeWithNullability(f.sqlBigInt, false), false); assertThat(equalAsCollectionSansNullability(factory, arrayNullable, arrayNotNull), is(true)); final RelDataType setNullable = new MultisetSqlType(factory.createTypeWithNullability(f.sqlBigInt, true), false); final RelDataType setNotNull = new MultisetSqlType(factory.createTypeWithNullability(f.sqlBigInt, false), false); assertThat(equalAsCollectionSansNullability(factory, setNullable, setNotNull), is(true)); assertThat(equalAsCollectionSansNullability(factory, arrayNotNull, setNotNull), is(false)); }

Target:
@Test void testEqualAsCollectionSansNullability() { assertThat( equalAsCollectionSansNullability(f.typeFactory, f.arrayBigInt, f.arrayBigIntNullable), is(true)); assertThat( equalAsCollectionSansNullability(f.typeFactory, f.multisetBigInt, f.multisetBigIntNullable), is(true)); assertThat( equalAsCollectionSansNullability(f.typeFactory, f.arrayBigInt, f.multisetBigInt), is(false)); }
Source:
public int requestNetworkScan(int subId, NetworkScanRequest request, Messenger messenger, IBinder binder, String callingPackage) { TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege( mApp, subId, "requestNetworkScan"); final long identity = Binder.clearCallingIdentity(); try { LocationAccessPolicy.LocationPermissionResult locationResult = LocationAccessPolicy.checkLocationPermission(mApp, new LocationAccessPolicy.LocationPermissionQuery.Builder() .setCallingPackage(callingPackage) .setCallingPid(Binder.getCallingPid()) .setCallingUid(Binder.getCallingUid()) .setMethod("requestNetworkScan") .setMinSdkVersionForFine(Build.VERSION_CODES.Q) .build()); if (locationResult != LocationAccessPolicy.LocationPermissionResult.ALLOWED) { SecurityException e = checkNetworkRequestForSanitizedLocationAccess(request); if (e != null) { if (locationResult == LocationAccessPolicy.LocationPermissionResult.DENIED_HARD) { throw e; } else { loge(e.getMessage()); return TelephonyScanManager.INVALID_SCAN_ID; } } } return mNetworkScanRequestTracker.startNetworkScan( request, messenger, binder, getPhone(subId), callingPackage); } finally { Binder.restoreCallingIdentity(identity); } }

Target:
public int requestNetworkScan(int subId, NetworkScanRequest request, Messenger messenger, IBinder binder, String callingPackage) { TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege( mApp, subId, "requestNetworkScan"); LocationAccessPolicy.LocationPermissionResult locationResult = LocationAccessPolicy.checkLocationPermission(mApp, new LocationAccessPolicy.LocationPermissionQuery.Builder() .setCallingPackage(callingPackage) .setCallingPid(Binder.getCallingPid()) .setCallingUid(Binder.getCallingUid()) .setMethod("requestNetworkScan") .setMinSdkVersionForFine(Build.VERSION_CODES.Q) .build()); if (locationResult != LocationAccessPolicy.LocationPermissionResult.ALLOWED) { SecurityException e = checkNetworkRequestForSanitizedLocationAccess(request); if (e != null) { if (locationResult == LocationAccessPolicy.LocationPermissionResult.DENIED_HARD) { throw e; } else { loge(e.getMessage()); return TelephonyScanManager.INVALID_SCAN_ID; } } } final long identity = Binder.clearCallingIdentity(); try { return mNetworkScanRequestTracker.startNetworkScan( request, messenger, binder, getPhone(subId), callingPackage); } finally { Binder.restoreCallingIdentity(identity); } }
Source:
private void setBundleWFPath(Bundle... bundles) throws Exception { for (Bundle bundle : bundles) { bundle.setProcessWorkflow(WORKFLOW_PATH); } }

Target:
private void setBundleWFPath(Bundle... bundles) { for (Bundle bundle : bundles) { bundle.setProcessWorkflow(workflowPath); } }
Source:
public CompletionStage<Result> query() { final JsonNode body = request().body().asJson(); if (body == null) { return CompletableFuture.completedFuture(Results.badRequest(createErrorJson("null body for query"))); } try { final MetricsQuery query = _mapper.treeToValue(body, MetricsQuery.class); final CompletionStage<TimeSeriesResult> response = _queryExecutor.executeQuery(query.getQuery()); return response.<JsonNode>thenApply(_mapper::valueToTree).thenApply(Results::ok); } catch (final RuntimeException ex) { return CompletableFuture.completedFuture(Results.internalServerError(createErrorJson(ex))); } catch (final QueryExecutionException ex) { return CompletableFuture.completedFuture(Results.badRequest(createErrorJson(ex.getProblems()))); } catch (final JsonProcessingException e) { return CompletableFuture.completedFuture(Results.badRequest(createErrorJson(e))); } }

Target:
public CompletionStage<Result> query() { final JsonNode body = request().body().asJson(); if (body == null) { return CompletableFuture.completedFuture( Results.badRequest(createErrorJson("request.UNEXPECTED_EMPTY_BODY", Collections.emptyList()))); } try { final MetricsQuery query = _mapper.treeToValue(body, MetricsQuery.class); final QueryExecutor queryExecutor = _queryExecutorRegistry.getExecutor(query.getExecutor()); if (queryExecutor == null) { throw new QueryExecutionException( "Unknown query executor", ImmutableList.of( new QueryProblem.Builder() .setProblemCode("query_problem.UNKNOWN_EXECUTOR") .build())); } final CompletionStage<MetricsQueryResult> response = queryExecutor.executeQuery(query.toInternal()); return response .thenApply(models.view.MetricsQueryResult::fromInternal) .<JsonNode>thenApply(_mapper::valueToTree) .thenApply(Results::ok); } catch (final RuntimeException ex) { return CompletableFuture.completedFuture(Results.internalServerError(createErrorJson(ex, "request.UNKNOWN_ERROR"))); } catch (final QueryExecutionException ex) { return CompletableFuture.completedFuture(Results.badRequest(createErrorJson(ex.getProblems()))); } catch (final JsonProcessingException ex) { return CompletableFuture.completedFuture(Results.badRequest(createErrorJson(ex, "request.BAD_REQUEST"))); } }
Source:
private void verifySnapshotStatus(Client client, String expectedType, int expectCount, boolean checkVoltDBCrashed) { boolean success = true; try { int cnt = 0; VoltTable rslt = null; int matchCount = 0; while (cnt < 60) { rslt = client.callProcedure("@Statistics", "SNAPSHOTSTATUS", 0).getResults()[0]; int expectedRowCount = 3; if (expectedType.equals("COMMANDLOG")) { expectedRowCount += 3; } if (rslt.getRowCount() == expectedRowCount) { matchCount = 0; while (rslt.advanceRow()) { String type = rslt.getString("TYPE"); assertTrue(type.equals(expectedType) || type.equals("COMMANDLOG")); if (type.equals(expectedType)) { matchCount++; success &= rslt.getString("RESULT").equals("SUCCESS"); } } if (!success && !(checkVoltDBCrashed && !VoltDB.wasCrashCalled)) break; } Thread.sleep(100); cnt++; } assert(cnt < 60); assertEquals(expectCount, matchCount); } catch (Exception e) { } assertFalse(success); }

Target:
private void verifySnapshotStatus(Client client, String expectedType, int expectCount, boolean checkVoltDBCrashed) { boolean success = true; try { int cnt = 0; VoltTable rslt = null; int matchCount = 0; while (cnt < 60) { rslt = client.callProcedure("@Statistics", "SNAPSHOTSTATUS", 0).getResults()[0]; if (rslt.getRowCount() == expectCount) { matchCount = 0; while (rslt.advanceRow()) { String type = rslt.getString("TYPE"); assertTrue(type.equals(expectedType) || type.equals("COMMANDLOG")); if (type.equals(expectedType)) { matchCount++; success &= rslt.getString("RESULT").equals("SUCCESS"); } } if (!success && !(checkVoltDBCrashed && !VoltDB.wasCrashCalled)) break; } Thread.sleep(100); cnt++; } assert(cnt < 60); assertEquals(expectCount, matchCount); } catch (Exception e) { } assertFalse(success); }
Source:
public final String highlight(final String attribute, final Query parsedQuery) { UseCase uc = MonitorFactory.startUseCase("Highlight.PhraseBolder.highlight()"); StringBuilder result = new StringBuilder(); if (attribute != null && parsedQuery != null) { Highlighter highlighter = new Highlighter(this, new QueryScorer(parsedQuery)); highlighter.setTextFragmenter(getFragmenter()); try { TokenStream tokenStream = analyzer.tokenStream(this.getHighlightAttribute(), new StringReader(attribute)); UseCase ucFragments = MonitorFactory.startUseCase("Highlight.PhraseBolder.highlight()#getFragments"); TextFragment[] frags = highlighter.getBestTextFragments(tokenStream, attribute, mergeAdjacentFragments(), getMaxFragments()); ucFragments.stop(); boolean first = true; int startPosition = -1; int endPosition = -1; for (TextFragment frag : frags) { String fragment = frag.toString(); fragment = fragment.replaceAll(REMOVE_TEXT_FROM_FRAGMENT_REGEX, ""); startPosition = attribute.indexOf(fragment); endPosition = startPosition + fragment.length(); if (!first || (addSeperatorArroundAllFragments() && startPosition != 0)) { result.append(getFragmentSeperator()); } result.append(fragment); } if (addSeperatorArroundAllFragments() && endPosition != attribute.length() && result.length() != 0) { result.append(getFragmentSeperator()); } } catch (IOException e) { LOGGER.error("Error getting fragments from highlighter.", e); } catch (InvalidTokenOffsetsException e) { LOGGER.error("Error getting fragments from highlighter.", e); } } uc.stop(); return result.toString(); }

Target:
public final String highlight(final String attribute, final Query parsedQuery) { UseCase uc = MonitorFactory.startUseCase("Highlight.PhraseBolder.highlight()"); StringBuilder result = new StringBuilder(); if (attribute != null && parsedQuery != null) { Highlighter highlighter = new Highlighter(this, new QueryScorer(parsedQuery)); highlighter.setTextFragmenter(getFragmenter()); try { TokenStream tokenStream = analyzer.tokenStream(this.getHighlightAttribute(), new StringReader(attribute)); UseCase ucFragments = MonitorFactory.startUseCase("Highlight.PhraseBolder.highlight()#getFragments"); TextFragment[] frags = highlighter.getBestTextFragments(tokenStream, attribute, isMergeAdjacentFragments(), getMaxFragments()); ucFragments.stop(); boolean first = true; int startPosition = -1; int endPosition = -1; for (TextFragment frag : frags) { String fragment = frag.toString(); fragment = fragment.replaceAll(REMOVE_TEXT_FROM_FRAGMENT_REGEX, ""); startPosition = attribute.indexOf(fragment); endPosition = startPosition + fragment.length(); if (!first || (addSeperatorArroundAllFragments() && startPosition != 0)) { result.append(getFragmentSeperator()); } result.append(fragment); } if (addSeperatorArroundAllFragments() && endPosition != attribute.length() && result.length() != 0) { result.append(getFragmentSeperator()); } } catch (IOException e) { LOGGER.error("Error getting fragments from highlighter.", e); } catch (InvalidTokenOffsetsException e) { LOGGER.error("Error getting fragments from highlighter.", e); } } uc.stop(); return result.toString(); }
Source:
private List<Rule> getRulesByLength(final int length) { for (Map.Entry<Range, List<Rule>> e : rules.entrySet()) { if (e.getKey().includes(length)) { return e.getValue(); } } return null; }

Target:
private List<Rule> getRulesByLength(final int length) { final Optional<List<Rule>> match = rules.entrySet().stream().filter( e -> e.getKey().includes(length)).map(Map.Entry::getValue).findFirst(); return match.isPresent() ? match.get() : null; }
Source:
void roundNumericValues(final List<MeasurementRow> measurementRowList) { for (final MeasurementRow row : measurementRowList) { for (final MeasurementData data : row.getDataList()) { if (data.getMeasurementVariable().getVariableType().getId() == VariableType.TRAIT.getId() && data.isNumeric() && data.getValue() != null && !data.getValue().isEmpty()) { String value = StringUtils.stripEnd(String.format ("%.2f", Double.parseDouble(data.getValue())), "0"); data.setValue(StringUtils.stripEnd(value, ".")); } } } }

Target:
void roundNumericValues(final List<MeasurementRow> measurementRowList) { for (final MeasurementRow row : measurementRowList) { for (final MeasurementData data : row.getDataList()) { if (data.getMeasurementVariable().getVariableType().getId().equals(VariableType.TRAIT.getId()) && data.isNumeric() && data.getValue() != null && !data.getValue().isEmpty()) { String value = StringUtils.stripEnd(String.format ("%.2f", Double.parseDouble(data.getValue())), "0"); data.setValue(StringUtils.stripEnd(value, ".")); } } } }
Source:
public static boolean isBuildFolderInPerstentModel(IFolder folder) { try { IProject project = folder.getProject(); Optional<IPath> modelBuildDir = CorePlugin.modelPersistence().loadModel(project).getBuildDir(); if (!modelBuildDir.isPresent()) { return false; } IPath relativePath = RelativePathUtils.getRelativePath(project.getFullPath(), folder.getFullPath()); return relativePath.equals(modelBuildDir.get()); } catch (Exception e) { CorePlugin.logger().debug(String.format("Could not check whether folder %s is a build folder.", folder.getFullPath()), e); return false; } }

Target:
public static boolean isBuildFolderInPerstentModel(IFolder folder) { try { IProject project = folder.getProject(); IPath modelBuildDir = CorePlugin.modelPersistence().loadModel(project).getBuildDir(); if (modelBuildDir == null) { return false; } return folder.getProjectRelativePath().equals(modelBuildDir); } catch (Exception e) { CorePlugin.logger().debug(String.format("Could not check whether folder %s is a build folder.", folder.getFullPath()), e); return false; } }
Source:
private String getUrl(String baseUrl, String path) throws MalformedURLException { if (baseUrl.indexOf("://") > 0) { return new URL(new URL(baseUrl), path).toExternalForm(); } else { return baseUrl + trimTrailingSlash(baseUrl) + "/" + CharMatcher.is('/').trimLeadingFrom(path); } }

Target:
private String getUrl(String baseUrl, String path) { return trimTrailingSlash(baseUrl) + path; }
Source:
private boolean isVm(Guid id) { try { getEntity(org.ovirt.engine.core.common.businessentities.VM.class, VdcQueryType.GetVmByVmId, queryParams, id.toString()); return true; } catch (WebFaultException e) { return false; } }

Target:
private boolean isVm(Guid id) { return runQuery(VdcQueryType.GetVmByVmId, queryParams).getReturnValue() instanceof VM; }
Source:
ScriptIntrinsic(long id, RenderScript rs) { super(id, rs); if (id == 0) { throw new RSRuntimeException("Loading of script failed."); } }

Target:
ScriptIntrinsic(long id, RenderScript rs) { super(id, rs); if (id == 0) { throw new RSRuntimeException("Loading of ScriptIntrinsic failed."); } }
Source:
public final static Type fun(Type... elems) { final int last = elems.length-1; Type t = elems[last]; for (int n = last-1; n >= 0; n--) { t = new FunType (elems[n], t); } return t; }

Target:
public final static Type fun(Type... elems) { if (elems.length == 0) { throw new IllegalArgumentException("can not create an empty function type"); } final int last = elems.length - 1; Type t = elems[last]; for (int n = last - 1; n >= 0; n--) { t = new FunType(elems[n], t); } return t; }
Source:
@Override public Date read(JsonReader in) throws IOException { Date out; if (in.peek() == JsonToken.NULL) { in.nextNull(); out = null; } else try { out = ISO8601Utils.parse(in.nextString().replace(' ', 'T') + "Z", new ParsePosition(0)); } catch (ParseException e) { throw new IOException(e); } return out; }

Target:
@Override public Date read(JsonReader in) throws IOException { Date out; if (in.peek() == JsonToken.NULL) { in.nextNull(); out = null; } else { try { out = ISO8601Utils.parse(in.nextString().replace(' ', 'T') + "Z", new ParsePosition(0)); } catch (ParseException e) { throw new IOException(e); } } return out; }
Source:
public void configure(Map configurationValues) { if ( configurationValues == null ) { throw new IllegalArgumentException( "invalid configuration file: should not be null" ); } keyspace = (String) configurationValues.get( CASSANDRA_KEYSPACE ); url = (String) configurationValues.get( CASSANDRA_URL ); configurationMode = (String) configurationValues.get( OgmConfiguration.HIBERNATE_OGM_GENERATE_SCHEMA ); if ( !OgmConfiguration.GenerateSchemaValue.isValid( configurationMode ) ) { log.unexpectedConfiguration(OgmConfiguration.HIBERNATE_OGM_GENERATE_SCHEMA, OgmConfiguration.HIBERNATE_OGM_GENERATE_SCHEMA_DEFAULT.getValue()); configurationMode = OgmConfiguration.HIBERNATE_OGM_GENERATE_SCHEMA_DEFAULT.getValue(); } if ( keyspace == null ) { throw new HibernateException( "Unable to get keyspace value from configuration on key " + CASSANDRA_KEYSPACE ); } }

Target:
public void configure(Map configurationValues) { if ( configurationValues == null ) { throw new IllegalArgumentException( "invalid configuration file: should not be null" ); } keyspace = (String) configurationValues.get( CASSANDRA_KEYSPACE ); url = (String) configurationValues.get( CASSANDRA_URL ); configurationMode = (String) configurationValues.get( OgmConfiguration.HIBERNATE_OGM_GENERATE_SCHEMA ); if ( !OgmConfiguration.GenerateSchemaValue.isValid( configurationMode ) ) { log.unexpectedConfiguration(OgmConfiguration.HIBERNATE_OGM_GENERATE_SCHEMA, OgmConfiguration.HIBERNATE_OGM_GENERATE_SCHEMA_DEFAULT.getValue()); configurationMode = OgmConfiguration.HIBERNATE_OGM_GENERATE_SCHEMA_DEFAULT.getValue(); } if ( keyspace == null ) { log.unableToGetKeyspace( CASSANDRA_KEYSPACE ); throw log.unableToGetKeyspace( CASSANDRA_KEYSPACE ); } }
Source:
public DownloadRuntime[] findDownloadRuntimes(String pattern, IProgressMonitor monitor) { monitor.beginTask("Locating Matching Downloadable Runtimes", 1000); RuntimeRangeRepresentation rep = new RuntimeRangeRepresentation(pattern); DownloadRuntime[] arr = RuntimeCoreActivator.getDefault().getDownloadRuntimeArray(new SubProgressMonitor(monitor, 800)); IProgressMonitor subMon = new SubProgressMonitor(monitor, 200); subMon.beginTask("Filtering Downloadable Runtimes", arr.length * 100); ArrayList<DownloadRuntime> list = new ArrayList<DownloadRuntime>(arr.length); for( int i = 0; i < arr.length; i++ ) { String rtType = (String)arr[i].getProperty(DownloadRuntimesProvider.LABEL_WTP_RUNTIME); if( rep.wtpId.equals(rtType)) { if( rep.stacksRuntimeType == null ) list.add(arr[i]); else { if( rep.stacksRuntimeType.equals(arr[i].getProperty(DownloadRuntimesProvider.LABEL_RUNTIME_TYPE))) { if( rep.beginVersion == null ) { list.add(arr[i]); } else { String version = arr[i].getVersion(); if( rep.matchesVersion(version)) list.add(arr[i]); } } } } subMon.worked(100); } subMon.done(); monitor.done(); return (DownloadRuntime[]) list.toArray(new DownloadRuntime[list.size()]); }

Target:
public DownloadRuntime[] findDownloadRuntimes(String pattern, IProgressMonitor monitor) { RuntimeRangeRepresentation rep = new RuntimeRangeRepresentation(pattern); return findDownloadRuntimes(rep, monitor); }
Source:
public OutputFormatBuilder.OutputOptions<T> clientProperties(Properties clientProperties) { this.clientInfo = Objects.requireNonNull(clientInfo, "ClientInfo must not be null"); return this; }

Target:
public OutputFormatBuilder.OutputOptions<T> clientProperties(Properties clientProperties) { this.clientInfo = ClientInfo.from(Objects.requireNonNull(clientProperties, "ClientInfo must not be null")); return this; }
Source:
public void canIterate() throws Exception { final MkStorage storage = new MkStorage.InFile(); final Repo repo = repo(storage); final String[] paths = { "foo/bar/1", "foo/bar/2", "foo/baz", }; for (final String path : paths) { this.addContent(repo, path); } MatcherAssert.assertThat( repo.contents().iterate("foo/bar", "ref-1"), Matchers.<Content>iterableWithSize(2) ); }

Target:
public void canIterate() throws IOException { final MkStorage storage = new MkStorage.InFile(); final Repo repo = repo(storage); final Content[] correct = this.addContent( repo, "foo/bar/1", "foo/bar/2" ); this.addContent(repo, "foo/baz", "foo/boo"); MatcherAssert.assertThat( repo.contents().iterate("foo/bar", "ref-1"), Matchers.contains(correct) ); }
Source:
public boolean isSnapshot(String version) { return StringUtils.isNotBlank(version) && StringUtils.endsWithIgnoreCase(version, "SNAPSHOT"); }

Target:
public boolean isSnapshot(String version) { return StringUtils.isNotBlank(version) && StringUtils.endsWithIgnoreCase(version, "-SNAPSHOT"); }
Source:
public TkText(final String body) { super( new Take() { @Override @SuppressWarnings("PMD.AvoidThrowingRawExceptionTypes") public Response act(final Request req) { try { new RqPrint(req).printBody(); } catch (final IOException exc) { throw new RuntimeException(exc); } return new RsText(body); } } ); }

Target:
public TkText(final String body) { super( new Take() { @Override public Response act(final Request req) { try { new RqPrint(req).printBody(); } catch (final IOException exc) { throw new IllegalStateException(exc); } return new RsText(body); } } ); }
Source:
T[] getLeaf(int index) { if (depthShift == 0) { return (T[]) array; } else if (depthShift == BRANCHING_BASE) { return getAt(array, firstDigit(offset + index, depthShift)); } else { index += offset; Object[] leaf = getAt(array, firstDigit(index, depthShift)); for (int shift = depthShift - BRANCHING_BASE; shift > 0; shift -= BRANCHING_BASE) { leaf = getAt(leaf, digit(index, shift)); } return (T[]) leaf; } }

Target:
Object getLeaf(int index) { if (depthShift == 0) { return array; } else if (depthShift == BRANCHING_BASE) { return obj().getAt(array, firstDigit(offset + index, depthShift)); } else { index += offset; Object leaf = obj().getAt(array, firstDigit(index, depthShift)); for (int shift = depthShift - BRANCHING_BASE; shift > 0; shift -= BRANCHING_BASE) { leaf = obj().getAt(leaf, digit(index, shift)); } return leaf; } }