auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void emitConsumerRecord(ConsumerRecord<K, V> record) { Map<String, List<Object>> tupleByStream = consumerRecordTransformer.transform(record); if (tupleByStream.isEmpty() && topologyReliabilityMode == Config.TopologyReliabilityMode.ATLEAST_ONCE) { ack(new ConsumerRecordMessageId(new TopicPartition(record.topic(), record.partition()), record.offset())); } tupleByStream.forEach((s, objects) -> { if (topologyReliabilityMode != Config.TopologyReliabilityMode.ATLEAST_ONCE) { collector.emit(s, objects); if (topologyReliabilityMode == Config.TopologyReliabilityMode.EFFECTIVELY_ONCE) { state.put(new TopicPartition(record.topic(), record.partition()), record.offset()); } } else { ConsumerRecordMessageId consumerRecordMessageId = new ConsumerRecordMessageId(new TopicPartition(record.topic(), record.partition()), record.offset()); collector.emit(s, objects, consumerRecordMessageId); } }); }

Target:
private void emitConsumerRecord(ConsumerRecord<K, V> record) { Map<String, List<Object>> tupleByStream = consumerRecordTransformer.transform(record); if (tupleByStream.isEmpty() && topologyReliabilityMode == Config.TopologyReliabilityMode.ATLEAST_ONCE) { ack(new ConsumerRecordMessageId(new TopicPartition(record.topic(), record.partition()), record.offset())); return; } tupleByStream.forEach((s, objects) -> { switch (topologyReliabilityMode) { case ATMOST_ONCE: collector.emit(s, objects); break; case ATLEAST_ONCE: ConsumerRecordMessageId consumerRecordMessageId = new ConsumerRecordMessageId(new TopicPartition(record.topic(), record.partition()), record.offset()); collector.emit(s, objects, consumerRecordMessageId); break; case EFFECTIVELY_ONCE: collector.emit(s, objects); state.put(new TopicPartition(record.topic(), record.partition()), record.offset()); break; default: LOG.warn("unsupported reliability mode {}", topologyReliabilityMode); } }); }
Source:
public void testOutstandingSplitSize() { DataSize maxOutstandingSplitsSize = new DataSize(1, MEGABYTE); HiveSplitSource hiveSplitSource = HiveSplitSource.allAtOnce( SESSION, "database", "table", TupleDomain.all(), 10, 10000, maxOutstandingSplitsSize, new TestingHiveSplitLoader(), Executors.newFixedThreadPool(5), new CounterStat()); InternalHiveSplit testSplit = new InternalHiveSplit( "partition-name", "path", 0, 100, 100, new Properties(), ImmutableList.of(new HivePartitionKey("pk_col", "pk_value")), ImmutableList.of(new InternalHiveBlock(0, 100, ImmutableList.of(HostAddress.fromString("localhost")))), OptionalInt.empty(), true, false, ImmutableMap.of(), Optional.empty(), false); int testSplitSizeInBytes = new TestSplit(0).getEstimatedSizeInBytes(); int maxSplitCount = toIntExact(maxOutstandingSplitsSize.toBytes()) / testSplitSizeInBytes; for (int i = 0; i < maxSplitCount; i++) { hiveSplitSource.addToQueue(new TestSplit(i)); assertEquals(hiveSplitSource.getBufferedInternalSplitCount(), i + 1); } assertEquals(getSplits(hiveSplitSource, maxSplitCount).size(), maxSplitCount); for (int i = 0; i < maxSplitCount; i++) { hiveSplitSource.addToQueue(new TestSplit(i)); assertEquals(hiveSplitSource.getBufferedInternalSplitCount(), i + 1); } try { hiveSplitSource.addToQueue(new TestSplit(0)); fail("expect failure"); } catch (PrestoException e) { assertContains(e.getMessage(), "Split buffering for database.table exceeded memory limit"); } }

Target:
public void testOutstandingSplitSize() { DataSize maxOutstandingSplitsSize = new DataSize(1, MEGABYTE); HiveSplitSource hiveSplitSource = HiveSplitSource.allAtOnce( SESSION, "database", "table", TupleDomain.all(), 10, 10000, maxOutstandingSplitsSize, new TestingHiveSplitLoader(), Executors.newFixedThreadPool(5), new CounterStat()); int testSplitSizeInBytes = new TestSplit(0).getEstimatedSizeInBytes(); int maxSplitCount = toIntExact(maxOutstandingSplitsSize.toBytes()) / testSplitSizeInBytes; for (int i = 0; i < maxSplitCount; i++) { hiveSplitSource.addToQueue(new TestSplit(i)); assertEquals(hiveSplitSource.getBufferedInternalSplitCount(), i + 1); } assertEquals(getSplits(hiveSplitSource, maxSplitCount).size(), maxSplitCount); for (int i = 0; i < maxSplitCount; i++) { hiveSplitSource.addToQueue(new TestSplit(i)); assertEquals(hiveSplitSource.getBufferedInternalSplitCount(), i + 1); } try { hiveSplitSource.addToQueue(new TestSplit(0)); fail("expect failure"); } catch (PrestoException e) { assertContains(e.getMessage(), "Split buffering for database.table exceeded memory limit"); } }
Source:
public void testOne() throws Exception { final File fileToProcess = new File(getPath( "SuppressionXpathRegressionAnnotationUseStyleOne.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AnnotationUseStyleCheck.class); moduleConfig.addAttribute("closingParens", "ALWAYS"); moduleConfig.addAttribute("elementStyle", "ignore"); moduleConfig.addAttribute("trailingArrayComma", "ignore"); final String[] expectedViolation = { "3:1: " + getCheckMessage(AnnotationUseStyleCheck.class, AnnotationUseStyleCheck.MSG_KEY_ANNOTATION_PARENS_MISSING), }; final List<String> expectedXpathQueries = Arrays.asList( "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionAnnotationUseStyleOne']]", "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionAnnotationUseStyleOne']]" + "/MODIFIERS", "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionAnnotationUseStyleOne']]" + "/MODIFIERS/ANNOTATION[./IDENT[@text='Deprecated']]", "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionAnnotationUseStyleOne']]" + "/MODIFIERS/ANNOTATION[./IDENT[@text='Deprecated']]/AT" ); runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); }

Target:
public void testOne() throws Exception { final File fileToProcess = new File(getPath( "SuppressionXpathRegressionAnnotationUseStyleOne.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AnnotationUseStyleCheck.class); final String[] expectedViolation = { "4:1: " + getCheckMessage(AnnotationUseStyleCheck.class, AnnotationUseStyleCheck.MSG_KEY_ANNOTATION_INCORRECT_STYLE, "COMPACT_NO_ARRAY"), }; final List<String> expectedXpathQueries = Arrays.asList( "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionAnnotationUseStyleOne']]" + "/MODIFIERS/ANNOTATION[./IDENT[@text='SuppressWarnings']]", "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionAnnotationUseStyleOne']]" + "/MODIFIERS/ANNOTATION[./IDENT[@text='SuppressWarnings']]/AT" ); runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); }
Source:
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: NavUtils.navigateUpFromSameTask(this); return true; case R.id.action_remove_all_history: new MaterialDialog.Builder(this) .title(R.string.title_clear_history_dialog) .content(R.string.text_clear_history_dialog) .onPositive((dialog, which) -> { Utils.getAppDaoSession(getParent()).getHistoryProductDao().deleteAll();; productItems.clear(); recyclerHistoryScanView.getAdapter().notifyDataSetChanged(); }) .positiveText(R.string.txtYes) .negativeText(R.string.txtNo) .show(); return true; case R.id.action_export_all_history: if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)) { new MaterialDialog.Builder(this) .title(R.string.action_about) .content(R.string.permision_write_external_storage) .neutralText(R.string.txtOk) .show(); } else { ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, Utils.MY_PERMISSIONS_REQUEST_STORAGE); } } else { exportCSV(); } return true; default: return super.onOptionsItemSelected(item); } }

Target:
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: NavUtils.navigateUpFromSameTask(this); return true; case R.id.action_remove_all_history: new MaterialDialog.Builder(this) .title(R.string.title_clear_history_dialog) .content(R.string.text_clear_history_dialog) .onPositive((dialog, which) -> { mHistoryProductDao.deleteAll();; productItems.clear(); recyclerHistoryScanView.getAdapter().notifyDataSetChanged(); }) .positiveText(R.string.txtYes) .negativeText(R.string.txtNo) .show(); return true; case R.id.action_export_all_history: if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)) { new MaterialDialog.Builder(this) .title(R.string.action_about) .content(R.string.permision_write_external_storage) .neutralText(R.string.txtOk) .show(); } else { ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, Utils.MY_PERMISSIONS_REQUEST_STORAGE); } } else { exportCSV(); } return true; default: return super.onOptionsItemSelected(item); } }
Source:
public void edit(final GlusterVolumeSnapshotModel object) { driver.edit(object); forceWarningLabel.setVisible(object.getForceCreate().getEntity()); object.getForceCreate().getEntityChangedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { forceWarningLabel.setVisible(object.getForceCreate().getEntity()); } }); }

Target:
public void edit(final GlusterVolumeSnapshotModel object) { driver.edit(object); forceWarningLabel.setVisible(object.getForceCreate().getEntity()); }
Source:
public String[] getAuthorizedGroups() { return new String[]{"administrators"}; }

Target:
protected final String[] getAuthorizedGroups() { return new String[]{"administrators"}; }
Source:
public static void setUpPerTestClass() throws Exception { System.setProperty("java.util.logging.manager", "org.apache.juli.ClassLoaderLogManager"); System.setProperty("java.util.logging.config.file", TestFileHandlerNonRotatable.class .getResource("logging-non-rotatable.properties") .getFile()); }

Target:
public static void setUpPerTestClass() throws Exception { System.setProperty("java.util.logging.manager", "org.apache.juli.ClassLoaderLogManager"); String configLoggingPath = TestFileHandlerNonRotatable.class .getResource("logging-non-rotatable.properties") .getFile(); System.setProperty("java.util.logging.config.file", URLDecoder.decode(configLoggingPath, java.nio.charset.StandardCharsets.UTF_8.toString())); }
Source:
public CloseUnrelatedProjectsAction(IShellProvider provider){ super(provider, IDEWorkbenchMessages.CloseUnrelatedProjectsAction_text); TEXT_STRING = IDEWorkbenchMessages.CloseUnrelatedProjectsAction_text; TOOLTIP_STRING = IDEWorkbenchMessages.CloseUnrelatedProjectsAction_toolTip; TEXT_PLURAL_STRING = IDEWorkbenchMessages.CloseUnrelatedProjectsAction_text_plural; TOOLTIP_PLURAL_STRING = IDEWorkbenchMessages.CloseUnrelatedProjectsAction_toolTip_plural; initAction(); }

Target:
public CloseUnrelatedProjectsAction(IShellProvider provider){ super(provider, IDEWorkbenchMessages.CloseUnrelatedProjectsAction_text, IDEWorkbenchMessages.CloseUnrelatedProjectsAction_toolTip, IDEWorkbenchMessages.CloseUnrelatedProjectsAction_text_plural, IDEWorkbenchMessages.CloseUnrelatedProjectsAction_toolTip_plural); initAction(); }
Source:
public MutationWriter(int numSendThreads) { serversMutations = new HashMap<String,TabletServerMutations<Mutation>>(); queued = new HashSet<String>(); sendThreadPool = new SimpleThreadPool(numSendThreads, this.getClass().getName()); locators = new HashMap<String,TabletLocator>(); binTimer.schedule(new TimerTask() { @Override public void run() { MutationSet m = queue.poll(); while (null != m) { try { addMutations(m); } catch (Exception e) { updateUnknownErrors("Error processing mutation set", e); } m = queue.poll(); } } }, 0, 500); }

Target:
public MutationWriter(int numSendThreads) { serversMutations = new HashMap<String,TabletServerMutations<Mutation>>(); queued = new HashSet<String>(); sendThreadPool = new SimpleThreadPool(numSendThreads, this.getClass().getName()); locators = new HashMap<String,TabletLocator>(); binningThreadPool = new SimpleThreadPool(1, "BinMutations", new SynchronousQueue<Runnable>()); binningThreadPool.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); }
Source:
public void colorSettingsChanged(StateItem[] stateItems) { updateColorMap(stateItems); }

Target:
public void colorSettingsChanged(StateItem[] stateItems) { if (stateItems != null) { fEventColorMap = new Color[stateItems.length]; for (int i = 0; i < stateItems.length; i++) { fEventColorMap[i] = fResourceManager.createColor(stateItems[i].getStateColor()); } } else { fEventColorMap = new Color[] { }; } }
Source:
String extractPatientInfo(List<SlotType1> documentSlots, String patientInfoName) { String slotValue = null; for (SlotType1 slot : documentSlots) { if (slot != null && slot.getName().equals(DocRepoConstants.XDS_SOURCE_PATIENT_INFO_SLOT) && slot.getValueList().getValue() != null) { Iterator<String> iter = slot.getValueList().getValue().iterator(); while (iter.hasNext()) { String nextSlotValue = iter.next(); if (nextSlotValue.startsWith(patientInfoName)) { slotValue = nextSlotValue.substring(patientInfoName.length() + 1); LOG.debug("{} extractionValue: {}", patientInfoName, slotValue); } } } } return slotValue; }

Target:
String extractPatientInfo(List<SlotType1> documentSlots, String patientInfoName) { String slotValue = null; for (SlotType1 slot : documentSlots) { if (slot != null && slot.getName().equals(DocRepoConstants.XDS_SOURCE_PATIENT_INFO_SLOT) && slot.getValueList() != null && slot.getValueList().getValue() != null) { Iterator<String> iter = slot.getValueList().getValue().iterator(); while (iter.hasNext()) { String nextSlotValue = iter.next(); if (nextSlotValue.startsWith(patientInfoName)) { slotValue = nextSlotValue.substring(patientInfoName.length() + 1); LOG.debug("{} extractionValue: {}", patientInfoName, slotValue); } } } } return slotValue; }
Source:
public <T> T getResource(String resourcePath, Class<? extends T> resourceClass) { return isJarResource(resourceClass) ? (T) jarFile.getJarEntry(resourcePath) : null; }

Target:
public <T> Optional<T> getResource(String resourcePath, Class<? extends T> resourceClass) { if (isJarResource(resourceClass)) { return (Optional<T>) Optional.fromNullable(jarFile .getJarEntry(resourcePath)); } else { return Optional.absent(); } }
Source:
private void push() { if (DELAY_SECONDS < 0) return; Future<?> ns = nextSave; if (ns != null && !(ns.isDone() || ns.isCancelled())) return; nextSave = Timer.get().schedule(this, DELAY_SECONDS, TimeUnit.SECONDS); }

Target:
private void push() { if (DELAY_SECONDS < 0) return; synchronized (lock) { if (nextSave != null && !(nextSave.isDone() || nextSave.isCancelled())) return; nextSave = Timer.get().schedule(this, DELAY_SECONDS, TimeUnit.SECONDS); } }
Source:
public void changeDiscoveryMode(){ validationProvider = new InterceptorValidationProviderCDI11(); prepareBeanXml("all", true); }

Target:
public void changeDiscoveryMode(){ validationProvider = new InterceptorValidationProvider("JSR-365"); prepareBeanXml("all", true); }
Source:
public String getValueAt(int column) { String value = getColumns().get(column); if (value.equals(StringConstants.UNICODE_NULL)) { return null; } return value; }

Target:
public String getValueAt(int column) { String value = getColumns().get(column); if (StringConstants.UNICODE_NULL.equals(value)) { return null; } return value; }
Source:
public void addLogo(View view) { Intent i = new Intent(this, LogoActivity.class); i.putExtra("photoByteArray", byteArray); i.putExtra("companyTag", companyTag); i.putExtra("filePath", fileUri.getPath()); i.putExtra("accessToken", getIntent().getExtras().getString("accessToken")); startActivity(i); }

Target:
public void addLogo(View view) { Intent i = new Intent(this, LogoActivity.class); i.putExtra("photoByteArray", byteArray); i.putExtra("filePath", fileUri.getPath()); startActivity(i); }
Source:
public List<String> getSelectNestedColPathsFromChildren( SelectOperator op, List<String> paths) { List<String> groups = new ArrayList<>(); SelectDesc conf = op.getConf(); if (paths != null && conf.isSelStarNoCompute()) { groups.addAll(paths); return groups; } List<ExprNodeDesc> selectDescs = conf.getColList(); List<String> outputColumnNames = conf.getOutputColumnNames(); for (int i = 0; i < outputColumnNames.size(); i++) { if (paths == null || paths.contains(outputColumnNames.get(i))) { ExprNodeDesc desc = selectDescs.get(i); List<String> gp = getNestedColPathByDesc(desc); if (!gp.isEmpty()) { groups.addAll(gp); } } } return groups; }

Target:
public List<String> getSelectNestedColPathsFromChildren( SelectOperator op, List<String> paths) { List<String> groups = new ArrayList<>(); SelectDesc conf = op.getConf(); if (paths != null && conf.isSelStarNoCompute()) { groups.addAll(paths); return groups; } List<ExprNodeDesc> selectDescs = conf.getColList(); List<String> outputColumnNames = conf.getOutputColumnNames(); for (int i = 0; i < outputColumnNames.size(); i++) { if (paths == null || paths.contains(outputColumnNames.get(i))) { ExprNodeDesc desc = selectDescs.get(i); List<String> gp = getNestedColPathByDesc(desc); groups.addAll(gp); } } return groups; }
Source:
public byte[] apply(RuntimeEnvironment env) throws IOException { if (hasTag("reindex")) { env.applyConfig(this, true); } else { env.applyConfig(this, false); } return null; }

Target:
public byte[] apply(RuntimeEnvironment env) throws IOException { env.applyConfig(this, hasTag("reindex")); return null; }
Source:
public ResultSet<ChangeData> read() throws OrmException { ChangeDataSource source = source(); if (source == null) { throw new OrmException("No ChangeDataSource: " + this); } ArrayList<ChangeData> r = new ArrayList<ChangeData>(); ChangeData last = null; boolean skipped = false; for (ChangeData cd : prefetchData(source)) { if (match(cd)) { r.add(cd); } else { skipped = true; } last = cd; } if (skipped && last != null && source instanceof Paginated) { Paginated p = (Paginated) source; while (skipped && r.size() < p.limit()) { ChangeData lastBeforeRestart = last; skipped = false; last = null; for (ChangeData cd : p.restart(lastBeforeRestart)) { if (match(cd)) { r.add(cd); } else { skipped = true; } last = cd; } } } return new ListResultSet<ChangeData>(r); }

Target:
public ResultSet<ChangeData> read() throws OrmException { ChangeDataSource source = source(); if (source == null) { throw new OrmException("No ChangeDataSource: " + this); } ArrayList<ChangeData> r = new ArrayList<ChangeData>(); ChangeData last = null; boolean skipped = false; for (ChangeData cd : prefetchData(source.read())) { if (match(cd)) { r.add(cd); } else { skipped = true; } last = cd; } if (skipped && last != null && source instanceof Paginated) { Paginated p = (Paginated) source; while (skipped && r.size() < p.limit()) { ChangeData lastBeforeRestart = last; skipped = false; last = null; for (ChangeData cd : prefetchData(p.restart(lastBeforeRestart))) { if (match(cd)) { r.add(cd); } else { skipped = true; } last = cd; } } } return new ListResultSet<ChangeData>(r); }
Source:
public Resource<Task> getTaskById(@PathVariable String taskId) { return resourceAssembler.toResource(dao.findById(taskId).get()); }

Target:
public Resource<Task> getTaskById(@PathVariable String taskId) { return resourceAssembler.toResource(entityFinder.findById(dao, taskId, "Unable to find task: " + taskId)); }
Source:
public Server createHttpServerInstance(int port) throws IOException { Server server = getServerWithContext(port); HttpConfiguration http = new HttpConfiguration(); http.addCustomizer(new SecureRequestCustomizer()); http.setSecurePort(port); http.setSecureScheme("https"); ServerConnector connector = new ServerConnector(server); connector.addConnectionFactory(new HttpConnectionFactory(http)); connector.setPort(80); HttpConfiguration https = new HttpConfiguration(); https.addCustomizer(new SecureRequestCustomizer()); ServerConnector sslConnector = new ServerConnector(server, new SslConnectionFactory(sslContextFactory, "http/1.1"), new HttpConnectionFactory(https)); sslConnector.setPort(port); server.setConnectors(new Connector[]{connector, sslConnector}); return server; }

Target:
public Server createHttpServerInstance(int port) throws IOException { Server server = new Server(port); HttpConfiguration http = new HttpConfiguration(); http.addCustomizer(new SecureRequestCustomizer()); http.setSecurePort(port); http.setSecureScheme("https"); ServerConnector connector = new ServerConnector(server); connector.addConnectionFactory(new HttpConnectionFactory(http)); connector.setPort(httpPort); HttpConfiguration https = new HttpConfiguration(); https.addCustomizer(new SecureRequestCustomizer()); ServerConnector sslConnector = new ServerConnector(server, new SslConnectionFactory(sslContextFactory, "http/1.1"), new HttpConnectionFactory(https)); sslConnector.setPort(port); server.setConnectors(new Connector[]{connector, sslConnector}); return server; }
Source:
public TcpReplicationHandler(WriteServerConfig config, SelfInfoResolver selfIdentityService, SourcedEurekaRegistry registry, WriteServerMetricFactory metricFactory) { this.config = config; this.selfIdentityService = selfIdentityService; this.registry = registry; this.metricFactory = metricFactory; this.channelSubject = BehaviorSubject.create(); channelSubject .scan(new Func2<ReceiverReplicationChannel, ReceiverReplicationChannel, ReceiverReplicationChannel>() { @Override public ReceiverReplicationChannel call(ReceiverReplicationChannel prev, ReceiverReplicationChannel curr) { setUpEviction(prev, curr).subscribe(new Subscriber<Long>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { } @Override public void onNext(Long aLong) { logger.info("Evicted instances in one round of eviction due to a new receiverReplicationChannel creation", aLong); } }); return curr; } }) .subscribe(new NoOpSubscriber<ReceiverReplicationChannel>()); }

Target:
public TcpReplicationHandler(WriteServerConfig config, SelfInfoResolver selfIdentityService, SourcedEurekaRegistry registry, WriteServerMetricFactory metricFactory) { this.config = config; this.selfIdentityService = selfIdentityService; this.registry = registry; this.metricFactory = metricFactory; }
Source:
public void aggregate() { if (foundValue == null) { final Object object = valueSelector.getObject(); if (object != null) { foundValue = DimensionHandlerUtils.convertObjectToString(object); if (foundValue != null && foundValue.length() > maxStringBytes) { foundValue = foundValue.substring(0, maxStringBytes); } } } }

Target:
public void aggregate() { if (foundValue == null) { final Object object = valueSelector.getObject(); foundValue = DimensionHandlerUtils.convertObjectToString(object); if (foundValue != null && foundValue.length() > maxStringBytes) { foundValue = foundValue.substring(0, maxStringBytes); } } }
Source:
private boolean hardDelete() { if (indexes.size() > 0) { final Timer.Context context = metrics.hardDeleteTime.time(); try { FindInfo info = findDeletedEntriesSince(startToken, scanSizeInBytes, SystemTime.getInstance().milliseconds() / 1000 - config.storeDeletedMessageRetentionDays * 24 * 60 * 60); endToken = info.getFindToken(); if (!endToken.equals(startToken)) { persistCleanupToken(); if (!info.getMessageEntries().isEmpty()) { performHardDeletes(info.getMessageEntries()); } startToken = endToken; return true; } } catch (Exception e) { logger.error("Index : " + dataDir + " error while performing hard deletes ", e); } finally { context.stop(); } } return false; }

Target:
private boolean hardDelete() { if (indexes.size() > 0) { final Timer.Context context = metrics.hardDeleteTime.time(); try { FindInfo info = findDeletedEntriesSince(startToken, scanSizeInBytes, SystemTime.getInstance().seconds() - messageRetentionSeconds); endToken = info.getFindToken(); if (!endToken.equals(startToken)) { persistCleanupToken(); if (!info.getMessageEntries().isEmpty()) { performHardDeletes(info.getMessageEntries()); } startToken = endToken; return true; } } catch (Exception e) { logger.error("Index : " + dataDir + " error while performing hard deletes ", e); } finally { context.stop(); } } return false; }
Source:
public void onRemoval() { monitoring.get().unregister(provider.getId()); List<Network> networks = networkDao.getAllForCluster(provider.getId()); networks.stream() .filter(n -> !managementNetworkUtil.getDefaultManagementNetworkName().equals(n.getName())) .forEach(n -> deleteNetwork(n, provider.getId())); ClusterParametersBase parameters = new ClusterParametersBase(provider.getId()); parameters.setForce(true); backend.runInternalAction(ActionType.RemoveCluster, parameters); Optional<StoragePool> kubevirtDc = findKubevirtDataCenter(); Guid storagePoolId = kubevirtDc.get().getId(); List<Cluster> clusters = clusterDao.getAllForStoragePool(storagePoolId); if (clusters.isEmpty()) { StoragePoolParametersBase sp = new StoragePoolParametersBase(storagePoolId); backend.runInternalAction(ActionType.RemoveStoragePool, sp); } }

Target:
public void onRemoval() { monitoring.get().unregister(provider.getId()); List<Network> networks = networkDao.getAllForCluster(provider.getId()); networks.stream() .filter(n -> !managementNetworkUtil.getDefaultManagementNetworkName().equals(n.getName())) .forEach(n -> deleteNetwork(n, provider.getId())); ClusterParametersBase parameters = new ClusterParametersBase(provider.getId()); parameters.setForce(true); backend.runInternalAction(ActionType.RemoveCluster, parameters); Optional<StoragePool> kubevirtDc = findKubevirtDataCenter(); if (kubevirtDc.isPresent()) { Guid storagePoolId = kubevirtDc.get().getId(); List<Cluster> clusters = clusterDao.getAllForStoragePool(storagePoolId); if (clusters.isEmpty()) { StoragePoolParametersBase sp = new StoragePoolParametersBase(storagePoolId); backend.runInternalAction(ActionType.RemoveStoragePool, sp); } } }
Source:
public void play(boolean tut, String shipName, boolean isNewGame) { if (isNewGame) { beforeNewGame(); solGame = new SolGame(this, shipName, tut, isNewGame, commonDrawer); } else { beforeLoadGame(); solGame = new SolGame(this, shipName, tut, isNewGame, commonDrawer); } inputManager.setScreen(this, solGame.getScreens().mainScreen); musicManager.playGameMusic(options); }

Target:
public void play(boolean tut, String shipName, boolean isNewGame) { if (isNewGame) { beforeNewGame(); } else { beforeLoadGame(); } solGame = new SolGame(this, shipName, tut, isNewGame, commonDrawer); inputManager.setScreen(this, solGame.getScreens().mainScreen); musicManager.playGameMusic(options); }
Source:
public void onBindViewHolder(StockViewHolder holder, int position) { StockMediaModel media = mItems.get(position); String imageUrl = PhotonUtils.getPhotonImageUrl(media.getThumbnail(), mThumbWidth, mThumbHeight); holder.mImageView.setImageUrl(imageUrl, WPNetworkImageView.ImageType.PHOTO); boolean isSelected = isItemSelected(position); holder.mSelectionCountTextView.setSelected(isSelected); if (isSelected) { int count = mSelectedItems.indexOf(position) + 1; String label = Integer.toString(count); holder.mSelectionCountTextView.setText(label); } else { holder.mSelectionCountTextView.setText(null); } float scale = isSelected ? SCALE_SELECTED : SCALE_NORMAL; if (holder.mImageView.getScaleX() != scale) { holder.mImageView.setScaleX(scale); holder.mImageView.setScaleY(scale); } if (!mIsFetching && mCanLoadMore && position == getItemCount() - 1) { fetchStockMedia(mSearchQuery, mNextPage); } }

Target:
public void onBindViewHolder(StockViewHolder holder, int position) { StockMediaModel media = mItems.get(position); String imageUrl = PhotonUtils.getPhotonImageUrl(media.getThumbnail(), mThumbWidth, mThumbHeight); holder.mImageView.setImageUrl(imageUrl, WPNetworkImageView.ImageType.PHOTO); boolean isSelected = isItemSelected(position); holder.mSelectionCountTextView.setSelected(isSelected); if (isSelected) { int count = mSelectedItems.indexOf(position) + 1; String label = Integer.toString(count); holder.mSelectionCountTextView.setText(label); } else { holder.mSelectionCountTextView.setText(null); } float scale = isSelected ? SCALE_SELECTED : SCALE_NORMAL; if (holder.mImageView.getScaleX() != scale) { holder.mImageView.setScaleX(scale); holder.mImageView.setScaleY(scale); } if (mCanLoadMore && position == getItemCount() - 1) { fetchStockMedia(mSearchQuery, mNextPage); } }
Source:
protected void safeRun(IProgressMonitor progressMonitor) throws Exception { target.delete(CDOAdmin.TYPE_DEFAULT); }

Target:
protected void safeRun(IProgressMonitor progressMonitor) throws Exception { target.delete(CDOAdmin.DEFAULT_TYPE); }
Source:
private void declareMetadata(OperationDeclarer operation, ClassTypeLoader loader) { Map<String, Supplier<? extends InputTypeResolver>> inputResolver = ImmutableMap.<String, Supplier<? extends InputTypeResolver>>builder() .put(BODY_PARAM, InvokeRequestTypeResolver::new) .put(HEADERS_PARAM, InvokeInputHeadersTypeResolver::new) .put(ATTACHMENTS_PARAM, InvokeInputAttachmentsTypeResolver::new) .build(); Supplier<TypeKeysResolver> keysResolverSupplier = InvokeKeysResolver::new; Supplier<OutputTypeResolver> outputResolverSupplier = InvokeOutputTypeResolver::new; DefaultMetadataResolverFactory factory = new DefaultMetadataResolverFactory(keysResolverSupplier, inputResolver, outputResolverSupplier, NullMetadataResolver::new); operation.withModelProperty(new MetadataResolverFactoryModelProperty(() -> factory)); operation.withModelProperty(new MetadataKeyIdModelProperty(loader.load(WebServiceTypeKey.class), KEYS_GROUP, SOAP_INVOKE_METADATA_CATEGORY)); Map<String, String> inputResolversByParam = inputResolver .entrySet().stream() .collect(Collectors.toImmutableMap(Map.Entry::getKey, e -> e.getValue().get().getResolverName())); String outputResolver = outputResolverSupplier.get().getResolverName(); String attributesResolver = NULL_RESOLVER_NAME; String keysResolver = keysResolverSupplier.get().getResolverName(); operation.withModelProperty(new TypeResolversInformationModelProperty(SOAP_INVOKE_METADATA_CATEGORY, inputResolversByParam, outputResolver, attributesResolver, keysResolver, true, true)); }

Target:
private void declareMetadata(OperationDeclarer operation, ClassTypeLoader loader) { Map<String, Supplier<? extends InputTypeResolver>> inputResolver = ImmutableMap.<String, Supplier<? extends InputTypeResolver>>builder() .put(BODY_PARAM, InvokeRequestTypeResolver::new) .put(HEADERS_PARAM, InvokeInputHeadersTypeResolver::new) .put(ATTACHMENTS_PARAM, InvokeInputAttachmentsTypeResolver::new) .build(); TypeKeysResolver keysResolver = new InvokeKeysResolver(); OutputTypeResolver outputResolver = new InvokeOutputTypeResolver(); DefaultMetadataResolverFactory factory = new DefaultMetadataResolverFactory(() -> keysResolver, inputResolver, () -> outputResolver, NullMetadataResolver::new); operation.withModelProperty(new MetadataResolverFactoryModelProperty(() -> factory)); operation.withModelProperty(new MetadataKeyIdModelProperty(loader.load(WebServiceTypeKey.class), KEYS_GROUP, keysResolver.getCategoryName())); Map<String, String> inputResolversByParam = inputResolver .entrySet().stream() .collect(toImmutableMap(Map.Entry::getKey, e -> e.getValue().get().getResolverName())); operation.withModelProperty(new TypeResolversInformationModelProperty(keysResolver.getCategoryName(), inputResolversByParam, outputResolver.getResolverName(), NULL_RESOLVER_NAME, keysResolver.getResolverName(), true, true)); }
Source:
catch (final SQLException | ClassNotFoundException e) { throw new RuntimeException(e); }

Target:
} catch (final SQLException | ClassNotFoundException e) { throw new RuntimeException(e); }
Source:
private Set<String> validateForCreate(FilterDTO filterDTO) { if (filterDTO == null) { Set<String> errors = new HashSet<String>(); errors.add("No filter object was present to be saved."); return errors; } return validate(filterDTO); }

Target:
private Set<String> validateForCreate(FilterDTO filterDTO) { if (filterDTO == null) { Set<String> errors = new HashSet<String>(); errors.add(errorMessageUtil.getMessage("filter.notPresent")); return errors; } return validate(filterDTO); }
Source:
public void run() { try { init(); } catch (Exception e) { throw new RuntimeException("Failed to initialize the consumer", e); } long nMessages = 0; long lastChecked = System.currentTimeMillis(); try { while (true) { boolean hasMoreMessages = consumeNextMessage(); if (!hasMoreMessages) { return; } long now = System.currentTimeMillis(); if (nMessages++ % 10000 == 0 || (now - lastChecked) > 10 * 60 * 1000) { lastChecked = now; checkUploadPolicy(); } } } finally { checkUploadPolicy(); } }

Target:
public void run() { try { init(); } catch (Exception e) { throw new RuntimeException("Failed to initialize the consumer", e); } long checkEveryNSeconds = Math.min(10 * 60, mConfig.getMaxFileAgeSeconds() / 2); long nMessages = 0; long lastChecked = System.currentTimeMillis(); while (true) { boolean hasMoreMessages = consumeNextMessage(); if (!hasMoreMessages) { break; } long now = System.currentTimeMillis(); if (nMessages++ % 10000 == 0 || (now - lastChecked) > checkEveryNSeconds * 1000) { lastChecked = now; checkUploadPolicy(); } } checkUploadPolicy(); }
Source:
public String jsonify(List<Long> records, boolean includePrimaryKey, AccessToken creds, TransactionToken transaction, String env) throws TSecurityException, TException { checkAccess(creds, transaction); try { Compoundable store = getStore(transaction, env); boolean nullOk = true; boolean retryable = store instanceof Engine; AtomicOperation operation = null; StringBuilder jsonResult = new StringBuilder(); while((operation == null && nullOk) || operation != null && !operation.commit() && retryable) { nullOk = false; operation = doJsonify(records, includePrimaryKey, store, jsonResult); } if (operation == null) { throw new TTransactionException(); } return jsonResult.toString(); } catch (TransactionStateException e) { throw new TTransactionException(); } }

Target:
public String jsonify(List<Long> records, boolean includePrimaryKey, AccessToken creds, TransactionToken transaction, String env) throws TSecurityException, TException { checkAccess(creds, transaction); try { Compoundable store = getStore(transaction, env); boolean nullOk = true; boolean retryable = store instanceof Engine; AtomicOperation operation = null; StringBuilder jsonResult = new StringBuilder(); while((operation == null && nullOk) || operation != null && !operation.commit() && retryable) { jsonResult = new StringBuilder(); nullOk = false; operation = doJsonify(records, includePrimaryKey, store, jsonResult); } if (operation == null) { throw new TTransactionException(); } return jsonResult.toString(); } catch (TransactionStateException e) { throw new TTransactionException(); } }
Source:
public FacetDescriptor getFacetDescriptor(String name) { FacetDescriptor desc = allFacets.stream().filter(f -> f.name.equals(name)).reduce((a, b) -> b).get(); return desc; }

Target:
public FacetDescriptor getFacetDescriptor(String name) { return allFacets.stream().filter(f -> f.getName().equals(name)).reduce((a, b) -> b).orElse(null); }
Source:
protected void refreshPieCharts(final boolean refreshGlobal, final boolean refreshSelection) { final Control viewerControl = getControl(); if (viewerControl.isDisposed()) { return; } if (fPieChartModel == null || fPieChartModel.getPieChartGlobalModel() == null) { return; } boolean moreThanOne = false; for (Entry<ITmfTrace, Map<String, Long>> entry : fPieChartModel.getPieChartGlobalModel().entrySet()) { if(entry.getValue() != null && entry.getValue().size() > 1) { moreThanOne = true; break; } } if (!moreThanOne) { setPieChartsVisible(false); } else { setPieChartsVisible(true); } Display.getDefault().asyncExec(new Runnable() { @Override public void run() { if (!viewerControl.isDisposed()) { fPieChartViewer.refresh(refreshGlobal, refreshSelection); } } }); }

Target:
protected void refreshPieCharts(final boolean refreshGlobal, final boolean refreshSelection) { final Control viewerControl = getControl(); if (viewerControl.isDisposed()) { return; } TmfPieChartStatisticsModel pieChartModel = getPieChartModel(); if (pieChartModel == null || pieChartModel.getPieChartGlobalModel() == null) { return; } boolean moreThanOne = false; for (Entry<ITmfTrace, Map<String, Long>> entry : pieChartModel.getPieChartGlobalModel().entrySet()) { if(entry.getValue() != null && entry.getValue().size() > 1) { moreThanOne = true; break; } } if (!moreThanOne) { setPieChartsVisible(false); } else { setPieChartsVisible(true); } Display.getDefault().asyncExec(new Runnable() { @Override public void run() { if (!viewerControl.isDisposed()) { fPieChartViewer.refresh(refreshGlobal, refreshSelection); } } }); }
Source:
public DatabaseDataType toDatabaseDataType(Database database) { String originalDefinition = StringUtils.trimToEmpty(getRawDefinition()); if (database instanceof DB2Database || database instanceof FirebirdDatabase) { return new DatabaseDataType("SMALLINT"); } else if (database instanceof MSSQLDatabase) { return new DatabaseDataType(database.escapeDataTypeName("bit")); } else if (database instanceof MySQLDatabase) { if (originalDefinition.toLowerCase().startsWith("bit")) { return new DatabaseDataType("BIT", getParameters()); } return new DatabaseDataType("BIT", 1); } else if (database instanceof OracleDatabase) { return new DatabaseDataType("NUMBER", 1); } else if (database instanceof SybaseASADatabase || database instanceof SybaseDatabase) { return new DatabaseDataType("BIT"); } else if (database instanceof DerbyDatabase) { if (((DerbyDatabase) database).supportsBooleanDataType()) { return new DatabaseDataType("BOOLEAN"); } else { return new DatabaseDataType("SMALLINT"); } } else if (database instanceof HsqlDatabase) { return new DatabaseDataType("BOOLEAN"); } else if (database instanceof PostgresDatabase) { if (originalDefinition.toLowerCase().startsWith("bit")) { return new DatabaseDataType("BIT", getParameters()); } } else if (database instanceof H2Database) { return new DatabaseDataType("CHAR(5)"); } return super.toDatabaseDataType(database); }

Target:
public DatabaseDataType toDatabaseDataType(Database database) { if (database instanceof H2Database) { return new DatabaseDataType("CHAR(5)"); } return super.toDatabaseDataType(database); }
Source:
public static boolean textIs(String actual, String text, boolean ignoreCase) { return ignoreCase ? StringUtils.equalsIgnoreCase(actual, text) : StringUtils.equals(actual, text); }

Target:
private boolean textIs(String actual, String text, boolean ignoreCase) { return ignoreCase ? StringUtils.equalsIgnoreCase(actual, text) : StringUtils.equals(actual, text); }
Source:
public void set(String dataPath, JsonElement newValue, int childIndex) { if (dataPath == null) { return; } String aliasedDataPath = DataContext.getAliasedDataPath(dataPath, parserContext.getDataContext().getReverseScopeMap(), true); Result result = Utils.getElementFromData(aliasedDataPath.substring(0, aliasedDataPath.lastIndexOf(".")), parserContext.getDataContext().getDataProvider(), childIndex); JsonElement parent = result.element; if (parent == null || !parent.isJsonObject()) { return; } String propertyName = aliasedDataPath.substring(aliasedDataPath.lastIndexOf(".") + 1, aliasedDataPath.length()); parent.getAsJsonObject().add(propertyName, newValue); updateView(aliasedDataPath); }

Target:
public void set(String dataPath, JsonElement newValue, int childIndex) { if (dataPath == null) { return; } String aliasedDataPath = DataContext.getAliasedDataPath(dataPath, parserContext.getDataContext().getReverseScopeMap(), true); Result result = Utils.getElementFromData(aliasedDataPath.substring(0, aliasedDataPath.lastIndexOf(DELIMITER)), parserContext.getDataContext().getDataProvider(), childIndex); JsonElement parent = result.element; if (parent == null || !parent.isJsonObject()) { return; } String propertyName = aliasedDataPath.substring(aliasedDataPath.lastIndexOf(DELIMITER) + 1, aliasedDataPath.length()); parent.getAsJsonObject().add(propertyName, newValue); updateView(aliasedDataPath); }
Source:
private static ComponentDto asDto(Component component) { return newDto(ComponentDto.class) .withId(component.getId()) .withAlias(component.getAlias()) .withType(component.getType()); }

Target:
private static ComponentDto asDto(Component component) { return newDto(ComponentDto.class) .withType(component.getType()) .withAlias(component.getAlias()) .withId(component.getId()) .withImage(component.getImage()) .withMemoryLimit(component.getMemoryLimit()) .withCommand(component.getCommand()) .withArgs(component.getArgs()) .withEndpoints(component.getEndpoints().stream().map(DtoConverter::asDto).collect(toList())) .withEnv(component.getEnv().stream().map(DtoConverter::asDto).collect(toList())) .withMountSources(component.getMountSources()) .withVolumes(component.getVolumes().stream().map(DtoConverter::asDto).collect(toList())) .withReference(component.getReference()) .withReferenceContent(component.getReferenceContent()) .withSelector(component.getSelector()) .withEntrypoints( component.getEntrypoints().stream().map(DtoConverter::asDto).collect(toList())); }
Source:
public void givenChargeCapturedNotification_chargeNotificationProcessorShouldBeInvokedIfChargeIsHistoric() { final String payload = notificationPayloadForTransaction( payId, EPDQ_PAYMENT_REQUESTED); charge = Charge.from(ChargeEntityFixture.aValidChargeEntity() .withGatewayAccountEntity(gatewayAccountEntity) .build()); charge.setHistoric(true); when(mockGatewayAccountService.getGatewayAccount(charge.getGatewayAccountId())).thenReturn(Optional.of(gatewayAccountEntity)); when(mockChargeService.findByProviderAndTransactionIdFromDbOrLedger(EPDQ.getName(), payId)).thenReturn(Optional.of(charge)); ArgumentCaptor<ZonedDateTime> eventTimeStamp = ArgumentCaptor.forClass(ZonedDateTime.class); notificationService.handleNotificationFor(payload); verifyNoInteractions(mockRefundNotificationProcessor); verify(mockChargeNotificationProcessor).processCaptureNotificationForExpungedCharge(eq(gatewayAccountEntity), eq(payId), eq(charge), eq(CAPTURED), eventTimeStamp.capture()); }

Target:
public void givenChargeCapturedNotification_chargeNotificationProcessorShouldBeInvokedIfChargeIsHistoric() { final String payload = notificationPayloadForTransaction( payId, EPDQ_PAYMENT_REQUESTED); charge = Charge.from(ChargeEntityFixture.aValidChargeEntity() .withGatewayAccountEntity(gatewayAccountEntity) .build()); charge.setHistoric(true); when(mockGatewayAccountService.getGatewayAccount(charge.getGatewayAccountId())).thenReturn(Optional.of(gatewayAccountEntity)); when(mockChargeService.findByProviderAndTransactionIdFromDbOrLedger(EPDQ.getName(), payId)).thenReturn(Optional.of(charge)); notificationService.handleNotificationFor(payload); verifyNoInteractions(mockRefundNotificationProcessor); verify(mockChargeNotificationProcessor).processCaptureNotificationForExpungedCharge(gatewayAccountEntity, payId, charge, CAPTURED); }
Source:
public void onCommit(@Nonnull NodeProvisioner.PlannedNode plannedNode, @Nonnull Node node) { ; }

Target:
public void onCommit(@Nonnull NodeProvisioner.PlannedNode plannedNode, @Nonnull Node node) { }
Source:
public Accessibility getAccessibility() { return Accessibility.PUBLIC; }

Target:
public Accessibility getAccessibility() { return Accessibility.PROTECTED; }
Source:
public static List<Pair<String, Map<String, Object>>> edgeStatements(Activity activity) { List<Pair<String, Map<String, Object>>> statements = new ArrayList<>();; ActivityObject actor = activity.getActor(); ActivityObject object = activity.getObject(); ActivityObject target = activity.getTarget(); if (StringUtils.isNotBlank(actor.getId()) && object != null && StringUtils.isNotBlank(object.getId())) { Pair<String, Map<String, Object>> actorObjectEdgeStatement = helper.createActorObjectEdge(activity); HashMap<String, Object> props = new HashMap<>(); props.put("props", actorObjectEdgeStatement.getValue1()); actorObjectEdgeStatement = actorObjectEdgeStatement.setAt1(props); statements.add(actorObjectEdgeStatement); } if (StringUtils.isNotBlank(actor.getId()) && target != null && StringUtils.isNotBlank(target.getId())) { Pair<String, Map<String, Object>> actorTargetEdgeStatement = helper.createActorTargetEdge(activity); HashMap<String, Object> props = new HashMap<>(); props.put("props", actorTargetEdgeStatement.getValue1()); actorTargetEdgeStatement = actorTargetEdgeStatement.setAt1(props); statements.add(actorTargetEdgeStatement); } return statements; }

Target:
public static List<Pair<String, Map<String, Object>>> edgeStatements(Activity activity) { List<Pair<String, Map<String, Object>>> statements = new ArrayList<>();; ActivityObject actor = activity.getActor(); ActivityObject object = activity.getObject(); ActivityObject target = activity.getTarget(); if (StringUtils.isNotBlank(actor.getId()) && object != null && StringUtils.isNotBlank(object.getId())) { Pair<String, Map<String, Object>> actorObjectEdgeStatement = helper.createActorObjectEdge(activity); Map<String, Object> props = new HashMap<>(); props.put("props", actorObjectEdgeStatement.getValue1()); actorObjectEdgeStatement = actorObjectEdgeStatement.setAt1(props); statements.add(actorObjectEdgeStatement); } if (StringUtils.isNotBlank(actor.getId()) && target != null && StringUtils.isNotBlank(target.getId())) { Pair<String, Map<String, Object>> actorTargetEdgeStatement = helper.createActorTargetEdge(activity); Map<String, Object> props = new HashMap<>(); props.put("props", actorTargetEdgeStatement.getValue1()); actorTargetEdgeStatement = actorTargetEdgeStatement.setAt1(props); statements.add(actorTargetEdgeStatement); } return statements; }
Source:
public void load(LazyBlock lazyBlock) { if (block == null) { return; } while (block instanceof LazyBlock) { block = ((LazyBlock) block).getBlock(); } Block coercedBlock = coercer.apply(block); lazyBlock.setBlock(coercedBlock); block = null; }

Target:
public void load(LazyBlock lazyBlock) { if (block == null) { return; } if (block instanceof LazyBlock) { block = ((LazyBlock) block).getBlock(); } Block coercedBlock = coercer.apply(block); lazyBlock.setBlock(coercedBlock); block = null; }
Source:
void insert(BranchInfo info) { if (match != null && !match.equals("") && !info.getShortName().contains(match)) { return; } if (table.getRowCount() <= pageSize || pageSize == 0) { Comparator<BranchInfo> c = new Comparator<BranchInfo>() { @Override public int compare(BranchInfo a, BranchInfo b) { return a.ref().compareTo(b.ref()); } }; int insertPos = getInsertRow(c, info); if (insertPos >= 0) { table.insertRow(insertPos); applyDataRowStyle(insertPos); populate(insertPos, info); } } else { setupNavigationLink(next, match, ProjectBranchesScreen.this.start + pageSize); } }

Target:
void insert(BranchInfo info) { if (table.getRowCount() <= pageSize) { Comparator<BranchInfo> c = new Comparator<BranchInfo>() { @Override public int compare(BranchInfo a, BranchInfo b) { return a.ref().compareTo(b.ref()); } }; int insertPos = getInsertRow(c, info); if (insertPos >= 0) { table.insertRow(insertPos); applyDataRowStyle(insertPos); populate(insertPos, info); } } else { setupNavigationLink(next, match, ProjectBranchesScreen.this.start + pageSize); } }
Source:
public void validate() { for (Agency agency : feed.agencies) { validateFieldLength(agency, agency.agency_id, 50); validateFieldLength(agency, agency.agency_name, 50); validateFieldLength(agency, agency.agency_url, 500); } for (Stop stop : feed.stops) { validateFieldLength(stop, stop.stop_name, 100); } for (Trip trip : feed.trips) { validateFieldLength(trip, trip.trip_headsign, 120); validateFieldLength(trip, trip.trip_short_name, 50); } for (Calendar calendar : feed.calendars) { validateCalendarDays(calendar); } }

Target:
public void validate() { for (Agency agency : feed.agencies) { validateFieldLength(agency, agency.agency_id, 50); validateFieldLength(agency, agency.agency_name, 50); validateFieldLength(agency, agency.agency_url, 500); } for (Stop stop : feed.stops) { validateFieldLength(stop, stop.stop_name, 100); } for (Trip trip : feed.trips) { validateFieldLength(trip, trip.trip_headsign, 120); validateFieldLength(trip, trip.trip_short_name, 50); } }