auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void init() throws URISyntaxException, IOException { mapper = TestSyncUtils.getTestSyncUtils(new MapConfiguration( new HashMap<String, String>() { { put(ConfigProperties.FAIL_ON_UNKNOWN_IMPORT_PROPERTIES, "false"); } } )); i18n = I18nFactory.getI18n(getClass(), Locale.US, I18nFactory.FALLBACK); config = new CandlepinCommonTestConfig(); pc = Mockito.mock(ProductCurator.class); ec = Mockito.mock(EntitlementCurator.class); this.environmentCurator = Mockito.mock(EnvironmentCurator.class); ProductCachedSerializationModule productCachedModule = new ProductCachedSerializationModule(pc); su = new SyncUtils(config, productCachedModule); PrintStream ps = new PrintStream( new File(this.getClass().getClassLoader().getResource("version.properties").toURI())); ps.println("version=0.0.3"); ps.println("release=1"); ps.close(); mockJsPath = new File(folder.getRoot(), "empty.js").getPath(); this.mockSubReconciler = Mockito.mock(SubscriptionReconciler.class); this.consumerTypeCurator = Mockito.mock(ConsumerTypeCurator.class); oc = mock(OwnerCurator.class); entitlementCurator = mock(EntitlementCurator.class); this.translator = new StandardTranslator(this.consumerTypeCurator, this.environmentCurator, this.oc , this.entitlementCurator); }

Target:
public void init() throws URISyntaxException, IOException { mapper = TestSyncUtils.getTestSyncUtils(new MapConfiguration( new HashMap<String, String>() { { put(ConfigProperties.FAIL_ON_UNKNOWN_IMPORT_PROPERTIES, "false"); } } )); i18n = I18nFactory.getI18n(getClass(), Locale.US, I18nFactory.FALLBACK); config = new CandlepinCommonTestConfig(); pc = Mockito.mock(ProductCurator.class); ec = Mockito.mock(EntitlementCurator.class); this.environmentCurator = Mockito.mock(EnvironmentCurator.class); ProductCachedSerializationModule productCachedModule = new ProductCachedSerializationModule(pc); su = new SyncUtils(config, productCachedModule); PrintStream ps = new PrintStream( new File(this.getClass().getClassLoader().getResource("version.properties").toURI())); ps.println("version=0.0.3"); ps.println("release=1"); ps.close(); mockJsPath = new File(folder.getRoot(), "empty.js").getPath(); this.mockSubReconciler = Mockito.mock(SubscriptionReconciler.class); this.consumerTypeCurator = Mockito.mock(ConsumerTypeCurator.class); oc = mock(OwnerCurator.class); this.translator = new StandardTranslator(this.consumerTypeCurator, this.environmentCurator, this.oc); }
Source:
public Map<String, Object> getStats() throws IOException { final Object result = this.client.call( LuaCommand.STATS.toString(), this.name, ClientHelper.getCurrentSeconds()); final JavaType javaType = new ObjectMapper().getTypeFactory().constructMapType( HashMap.class, String.class, Object.class); return JsonUtils.parse(result.toString(), javaType); }

Target:
public Map<String, Object> getStats() throws IOException { return this.getStats(new Date()); }
Source:
protected void showPageRec(PageRec pageRec) { IDebuggerConsole recConsole = fPartToConsole.get(pageRec.part); if (recConsole != null && recConsole.equals(getCurrentConsole())) { return; } super.showPageRec(pageRec); fActiveConsole = recConsole; activateParticipants(fActiveConsole); updateTitle(); }

Target:
protected void showPageRec(PageRec pageRec) { IDebuggerConsole recConsole = fPartToConsole.get(pageRec.part); if (recConsole != null && recConsole.equals(getCurrentConsole())) { return; } super.showPageRec(pageRec); fActiveConsole = recConsole; IDebuggerConsole topOfStack = null; if (!fStack.isEmpty()) { topOfStack = fStack.get(0); } if (topOfStack != null && !topOfStack.equals(fActiveConsole) && fActive) { deactivateParticipants(topOfStack); } if (fActiveConsole != null && !fActiveConsole.equals(topOfStack)) { fStack.remove(fActiveConsole); fStack.add(0, fActiveConsole); activateParticipants(fActiveConsole); } updateTitle(); }
Source:
public void createControl(Composite parent) { Composite comp = new Composite(parent, SWT.NONE); comp.setLayout(new GridLayout()); this.createProjectGroup(comp, 4); createVerticalSpacer(comp, 1); this.createExeFileGroup(comp, 4); createVerticalSpacer(comp, 1); createRemoteConfigurationGroup(comp); createVerticalSpacer(comp, 1); setControl(comp); PlatformUI .getWorkbench() .getHelpSystem() .setHelp(getControl(), Activator.PLUGIN_ID + ".launchgroup"); }

Target:
public void createControl(Composite parent) { Composite comp = new Composite(parent, SWT.NONE); comp.setLayout(new GridLayout()); createProjectGroup(comp, 4); createVerticalSpacer(comp, 1); createExeFileGroup(comp, 4); createVerticalSpacer(comp, 1); createRemoteConfigurationGroup(comp); createVerticalSpacer(comp, 1); setControl(comp); PlatformUI .getWorkbench() .getHelpSystem() .setHelp(getControl(), Activator.PLUGIN_ID + ".launchgroup"); }
Source:
private static boolean equals(String i, String j) { if (Objects.equals(i, j)) { return true; } Number number1 = toNumber(i); Number number2 = toNumber(j); if (number1 == null || number2 == null) { return false; } if (number1 instanceof Double || number2 instanceof Double || number1 instanceof Float || number2 instanceof Float) { return number1.doubleValue() == number2.doubleValue(); } return number1.longValue() == number2.longValue(); }

Target:
private static boolean equals(String i, String j) { if (Objects.equals(i, j)) { return true; } Number number1 = toNumber(i); if (number1 == null) { return false; } Number number2 = toNumber(j); if (number2 == null) { return false; } if (number1 instanceof Double || number2 instanceof Double || number1 instanceof Float || number2 instanceof Float) { return number1.doubleValue() == number2.doubleValue(); } return number1.longValue() == number2.longValue(); }
Source:
final Map<ChannelOption<?>, Object> options() { return Collections.unmodifiableMap(options); }

Target:
final Map<ChannelOption<?>, Object> options() { return copiedMap(options); }
Source:
@NonNull public PreparedPutObjects<T> prepare() { Checks.checkNotNull(mapFunc, "Please specify map function"); Checks.checkNotNull(putResolver, "Please specify put resolver"); return new PreparedPutObjects<>( storIOSQLiteDb, putResolver, objects, mapFunc, useTransactionIfPossible); }

Target:
@NonNull public PreparedPutObjects<T> prepare() { checkNotNull(mapFunc, "Please specify map function"); checkNotNull(putResolver, "Please specify put resolver"); return new PreparedPutObjects<>( storIOSQLiteDb, putResolver, objects, mapFunc, useTransactionIfPossible); }
Source:
public static Map<String, String> getTags(String key, String entityId, Map<String, String> entity) { Map<String, String> tags = new HashMap<>(); tags.put("entity", entityId.replace("[", "_").replace("]", "_").replace(":", "_").replace("@", "_")); for (String field : TAG_FIELDS) { if (entity.containsKey(field)) { String fieldValue = entity.get(field); if (null != fieldValue && !"".equals(fieldValue)) { tags.put(field, entity.get(field)); } } } if (null != key && !"".equals(key)) { tags.put("key", key.replace(":", "_").replace("@", "_").replace("?","_").replace("=","_")); } String metricName = extractMetricName(key); if (null != metricName) { tags.put("metric", metricName.replace(":", "_").replace("@", "_").replace("?","_").replace("=","_")); } return tags; }

Target:
public static Map<String, String> getTags(String key, String entityId, Map<String, String> entity) { Map<String, String> tags = new HashMap<>(); tags.put("entity", KAIROSDB_INVALID_TAG_CHARS.matcher(entityId).replaceAll(REPLACE_CHAR)); for (String field : TAG_FIELDS) { if (entity.containsKey(field)) { String fieldValue = entity.get(field); if (null != fieldValue && !"".equals(fieldValue)) { tags.put(field, entity.get(field)); } } } if (null != key && !"".equals(key)) { tags.put("key", KAIROSDB_INVALID_TAG_CHARS.matcher(key).replaceAll(REPLACE_CHAR)); } String metricName = extractMetricName(key); if (null != metricName) { tags.put("metric", KAIROSDB_INVALID_TAG_CHARS.matcher(metricName).replaceAll(REPLACE_CHAR)); } return tags; }
Source:
private void trySaveNoteIfNotAlreadyInBucket(Bundle data) { if (SimperiumUtils.getNotesBucket() != null) { String noteId = data.getString(PUSH_ARG_NOTE_ID, ""); try { SimperiumUtils.getNotesBucket().get(noteId); } catch (BucketObjectMissingException e) { AppLog.e(T.NOTIFS, e); SimperiumUtils.trackBucketObjectMissingWarning(e.getMessage(), noteId); if (data.containsKey(PUSH_ARG_NOTE_FULL_DATA)) { String base64FullData = data.getString(PUSH_ARG_NOTE_FULL_DATA); Note note = new Note.Schema().buildFromBase64EncodedData(noteId, base64FullData); SimperiumUtils.saveNote(note); } } } }

Target:
private void trySaveNoteIfNotAlreadyInBucket(Bundle data) { if (SimperiumUtils.getNotesBucket() != null) { if (data == null) { AppLog.e(T.NOTIFS, "Bundle is null! Cannot read '" + PUSH_ARG_NOTE_ID +"'."); return; } String noteId = data.getString(PUSH_ARG_NOTE_ID, ""); try { SimperiumUtils.getNotesBucket().get(noteId); } catch (BucketObjectMissingException e) { AppLog.e(T.NOTIFS, e); SimperiumUtils.trackBucketObjectMissingWarning(e.getMessage(), noteId); if (data.containsKey(PUSH_ARG_NOTE_FULL_DATA)) { String base64FullData = data.getString(PUSH_ARG_NOTE_FULL_DATA); Note note = new Note.Schema().buildFromBase64EncodedData(noteId, base64FullData); SimperiumUtils.saveNote(note); } } } }
Source:
public void testForceDeleteArtifactNotAllowed(@MavenRepository(repositoryId = REPOSITORY_WITH_TRASH_1) @RepositoryAttributes(trashEnabled = true) Repository repository, @MavenTestArtifact(repositoryId = REPOSITORY_WITH_TRASH_1, id = "org.carlspring.strongbox:test-artifact-to-trash", versions = "1.0") Path artifactPath) throws IOException { final String storageId = repository.getStorage().getId(); final String repositoryId = repository.getId(); final RootRepositoryPath repositoryPath = repositoryPathResolver.resolve(repository); final String artifactPathStr = repositoryPath.relativize(artifactPath).toString(); final RepositoryPath artifactRepositoryPath = repositoryPathResolver.resolve(repository, artifactPathStr); client.delete(storageId, repositoryId, artifactPathStr, false); final Path artifactFile = RepositoryFiles.trash(artifactRepositoryPath); logger.debug("Artifact file: {}", artifactFile.toAbsolutePath()); assertTrue(Files.exists(artifactFile), "Should have moved the artifact to the trash during a force delete operation, " + "when allowsForceDeletion is not enabled!"); final Path repositoryIndexDir = repositoryPath.resolve(".index"); assertTrue(Files.exists(repositoryIndexDir), "Should not have deleted .index directory!"); }

Target:
public void testForceDeleteArtifactNotAllowed(@MavenRepository(repositoryId = REPOSITORY_WITH_TRASH_1) @RepositoryAttributes(trashEnabled = true) Repository repository, @MavenTestArtifact(repositoryId = REPOSITORY_WITH_TRASH_1, id = "org.carlspring.strongbox:test-artifact-to-trash", versions = "1.0") Path artifactPath) throws IOException { final String storageId = repository.getStorage().getId(); final String repositoryId = repository.getId(); final RepositoryPath artifactRepositoryPath = (RepositoryPath) artifactPath.normalize(); final String artifactRepositoryPathStr = RepositoryFiles.relativizePath(artifactRepositoryPath); client.delete(storageId, repositoryId, artifactRepositoryPathStr, false); final Path artifactFile = RepositoryFiles.trash(artifactRepositoryPath); logger.debug("Artifact file: {}", artifactFile.toAbsolutePath()); assertTrue(Files.exists(artifactFile), "Should have moved the artifact to the trash during a force delete operation, " + "when allowsForceDeletion is not enabled!"); final RootRepositoryPath repositoryPath = repositoryPathResolver.resolve(repository); final Path repositoryIndexDir = repositoryPath.resolve(LayoutFileSystem.INDEX); assertTrue(Files.exists(repositoryIndexDir), "Should not have deleted .index directory!"); }
Source:
public ProductBodyguard() { super("SoapUIOSPluginSignChecker", 1.0, "The new plugin framework restriction"); }

Target:
public ProductBodyguard() { super("SoapUIOSPluginSignChecker", 1.0, "Plugin signature validity checker"); }
Source:
private static ImmutableList<Arguments> getRequiredArgs(final Ds3Request ds3Request) { final ImmutableList.Builder<Arguments> requiredArgsBuilder = ImmutableList.builder(); LOG.debug("Getting required args..."); if (ds3Request.getBucketRequirement() == Requirement.REQUIRED) { LOG.debug("bucket name REQUIRED."); requiredArgsBuilder.add(new Arguments("String", "bucketName")); if (ds3Request.getObjectRequirement() == Requirement.REQUIRED) { LOG.debug("object name REQUIRED."); requiredArgsBuilder.add(new Arguments("String", "objectName")); } } LOG.debug("Getting required query params..."); if (ds3Request.getRequiredQueryParams() != null) { for (final Ds3Param ds3Param : ds3Request.getRequiredQueryParams()) { if (ds3Param == null) { break; } LOG.debug(indent(1) + "query param " + ds3Param.getType().toString()); final String paramType = ds3Param.getType().substring(ds3Param.getType().lastIndexOf(".") + 1); LOG.debug("param " + paramType + " is required."); requiredArgsBuilder.add(new Arguments(paramType, ds3Param.getName())); } } return requiredArgsBuilder.build(); }

Target:
private static ImmutableList<Arguments> getRequiredArgs(final Ds3Request ds3Request) { final ImmutableList.Builder<Arguments> requiredArgsBuilder = ImmutableList.builder(); LOG.debug("Getting required args..."); if (ds3Request.getBucketRequirement() == Requirement.REQUIRED) { LOG.debug("bucket name REQUIRED."); requiredArgsBuilder.add(new Arguments("String", "bucketName")); if (ds3Request.getObjectRequirement() == Requirement.REQUIRED) { LOG.debug("object name REQUIRED."); requiredArgsBuilder.add(new Arguments("String", "objectName")); } } LOG.debug("Getting required query params..."); if (ds3Request.getRequiredQueryParams() != null) { for (final Ds3Param ds3Param : ds3Request.getRequiredQueryParams()) { if (ds3Param == null) { break; } LOG.debug("query param " + ds3Param.getType().toString()); final String paramType = ds3Param.getType().substring(ds3Param.getType().lastIndexOf(".") + 1); LOG.debug("param " + paramType + " is required."); requiredArgsBuilder.add(new Arguments(paramType, ds3Param.getName())); } } return requiredArgsBuilder.build(); }
Source:
public void endWindow() { HashMap<K, Integer> tuple = new HashMap<>(); for (Map.Entry<K, MutableInt> e : map.entrySet()) { if (tuple == null) { tuple = new HashMap<>(); } if (!oldMap.containsKey(e.getKey())) { tuple.put(e.getKey(), e.getValue().toInteger()); oldMap.put(e.getKey(), e.getValue().toInteger()); } else { tuple.put(e.getKey(), e.getValue().toInteger()); oldMap.put(e.getKey(), e.getValue().toInteger() + oldMap.get(e.getKey())); } } count.emit(tuple); }

Target:
public void endWindow() { HashMap<K, Integer> tuple = new HashMap<>(); for (K key: inputSet) { tuple.put(key, map.get(key).toInteger()); } count.emit(tuple); if (!cumulative) { map.clear(); } inputSet.clear(); }
Source:
public void run() { thread = Thread.currentThread(); while (shouldKeepRunning()) { long startRun = System.currentTimeMillis(); poll(); boolean rejected = false; while (context.hasScheduled() && !rejected && active) { final SlotKey slotKey = context.getNextScheduled(); if (slotKey == null) { continue; } try { UpdateStamp stamp = shardStateManager.getUpdateStamp(slotKey); long currentTimeMillis = context.getCurrentTimeMillis(); final long timeElapsedSinceLastRollup = currentTimeMillis - stamp.getLastRollupTimestamp(); boolean isReroll = timeElapsedSinceLastRollup < ShardStateManager.DELAYED_METRICS_MAX_ALLOWED_DELAY; log.info("Scheduling slotKey @ last ingest: last rollup time: isReroll: {}", new Object[]{slotKey, currentTimeMillis, stamp.getTimestamp(), stamp.getLastRollupTimestamp(), isReroll}); locatorFetchExecutors.execute(new LocatorFetchRunnable(context, slotKey, rollupReadExecutors, rollupWriteExecutors, enumValidatorExecutor)); } catch (RejectedExecutionException ex) { rejectedSlotChecks.mark(); context.pushBackToScheduled(slotKey, true); rejected = true; } } long endRun = System.currentTimeMillis(); if (endRun - startRun > pollerPeriod) log.error("It took longer than to poll for rollups.", pollerPeriod); else try { thread.sleep(Math.max(0, pollerPeriod - endRun + startRun)); } catch (Exception ex) { log.debug("RollupService poller woke up"); } } }

Target:
public void run() { thread = Thread.currentThread(); while (shouldKeepRunning()) { long startRun = System.currentTimeMillis(); poll(); boolean rejected = false; while (context.hasScheduled() && !rejected && active) { final SlotKey slotKey = context.getNextScheduled(); if (slotKey == null) { continue; } try { UpdateStamp stamp = shardStateManager.getUpdateStamp(slotKey); long currentTimeMillis = context.getCurrentTimeMillis(); final long timeElapsedSinceLastRollup = currentTimeMillis - stamp.getLastRollupTimestamp(); boolean isReroll = timeElapsedSinceLastRollup < ShardStateManager.REROLL_TIME_SPAN_ASSUMED_VALUE; log.info("Scheduling slotKey @ last ingest: last rollup time: isReroll: {}", new Object[]{slotKey, currentTimeMillis, stamp.getTimestamp(), stamp.getLastRollupTimestamp(), isReroll}); locatorFetchExecutors.execute(new LocatorFetchRunnable(context, slotKey, rollupReadExecutors, rollupWriteExecutors, enumValidatorExecutor)); } catch (RejectedExecutionException ex) { rejectedSlotChecks.mark(); context.pushBackToScheduled(slotKey, true); rejected = true; } } long endRun = System.currentTimeMillis(); if (endRun - startRun > pollerPeriod) log.error("It took longer than to poll for rollups.", pollerPeriod); else try { thread.sleep(Math.max(0, pollerPeriod - endRun + startRun)); } catch (Exception ex) { log.debug("RollupService poller woke up"); } } }
Source:
public void testFilteringNonVisible() throws Exception { when(cqlClient.executeQuery(any())) .thenReturn(Futures.immediateFuture(Optional.empty())) .thenReturn(Futures.immediateFuture(Optional.of(Value.create(PtBytes.toBytes("dummy"), 13)))); Map<Cell, Long> request = ImmutableMap.of(NON_VISIBLE_CELL, TIMESTAMP, VISIBLE_CELL_1, TIMESTAMP); AsyncCellLoader asyncCellLoader = AsyncCellLoader.create(cqlClient, testExecutor, DEFAULT_KEYSPACE); Map<Cell, Value> result = asyncCellLoader.loadAllWithTimestamp(DEFAULT_TABLE, request).get(); assertThat(result.isEmpty()).isFalse(); assertThat(result.containsKey(VISIBLE_CELL_1)).isTrue(); assertThat(result.containsKey(NON_VISIBLE_CELL)).isFalse(); }

Target:
public void testFilteringNonVisible() throws Exception { setUpVisibleCells(VISIBLE_CELL_1); setUpNonVisibleCells(NON_VISIBLE_CELL); Map<Cell, Long> request = ImmutableMap.of( NON_VISIBLE_CELL, TIMESTAMP, VISIBLE_CELL_1, TIMESTAMP); Map<Cell, Value> result = asyncCellLoader.loadAllWithTimestamp(TABLE, request).get(); assertThat(result) .containsOnlyKeys(VISIBLE_CELL_1); }
Source:
public static Collection<InetAddress> toInetAddresses(Collection<String> addrs, Collection<String> hostNames) throws IgniteCheckedException { Set<InetAddress> res = new HashSet<>(addrs.size()); Iterator<String> hostNamesIt = hostNames.iterator(); for (String addr : addrs) { String hostName = hostNamesIt.hasNext() ? hostNamesIt.next() : null; InetAddress inetAddr = null; if (!F.isEmpty(hostName)) { try { if (IgniteSystemProperties.getBoolean(IgniteSystemProperties.IGNITE_TEST_ENV)) { String ipString = hostName.substring(0, hostName.length() - ".hostname".length()); inetAddr = InetAddress.getByAddress(hostName, InetAddress.getByName(ipString).getAddress()); } else inetAddr = InetAddress.getByName(hostName); } catch (UnknownHostException ignored) { } } if (inetAddr == null || inetAddr.isLoopbackAddress()) { try { if (IgniteSystemProperties.getBoolean(IgniteSystemProperties.IGNITE_TEST_ENV)) inetAddr = InetAddress.getByAddress(addr + ".hostname", InetAddress.getByName(addr).getAddress()); else inetAddr = InetAddress.getByName(addr); } catch (UnknownHostException ignored) { } } if (inetAddr != null) res.add(inetAddr); } if (res.isEmpty()) throw new IgniteCheckedException("Addresses can not be resolved [addr=" + addrs + ", hostNames=" + hostNames + ']'); return res; }

Target:
public static Collection<InetAddress> toInetAddresses(Collection<String> addrs, Collection<String> hostNames) throws IgniteCheckedException { Set<InetAddress> res = new HashSet<>(addrs.size()); Iterator<String> hostNamesIt = hostNames.iterator(); for (String addr : addrs) { String hostName = hostNamesIt.hasNext() ? hostNamesIt.next() : null; InetAddress inetAddr = null; if (!F.isEmpty(hostName)) { try { inetAddr = InetAddress.getByName(hostName); } catch (UnknownHostException ignored) { } } if (inetAddr == null || inetAddr.isLoopbackAddress()) { try { inetAddr = InetAddress.getByName(addr); } catch (UnknownHostException ignored) { } } if (inetAddr != null) res.add(inetAddr); } if (res.isEmpty()) throw new IgniteCheckedException("Addresses can not be resolved [addr=" + addrs + ", hostNames=" + hostNames + ']'); return res; }
Source:
public RTrim() { super(new Column[] { new Column("org/apache/tajo/storage/text", TajoDataTypes.Type.TEXT), }); }

Target:
public RTrim() { super(new Column[] { new Column("text", TajoDataTypes.Type.TEXT), }); }
Source:
protected void postExecute(IRequest request, Object[] targets) { super.postExecute(request, targets); new WorkbenchJob("") { @Override public IStatus runInUIThread(IProgressMonitor monitor) { ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class); if (commandService != null) { commandService.refreshElements(REVERSE_TOGGLE_COMMAND_ID, null); } return Status.OK_STATUS; } }.schedule(); }

Target:
protected void postExecute(IRequest request, Object[] targets) { super.postExecute(request, targets); new WorkbenchJob("") { @Override public IStatus runInUIThread(IProgressMonitor monitor) { IEvaluationService exprService = (IEvaluationService) PlatformUI.getWorkbench().getService(IEvaluationService.class); if (exprService != null) { exprService.requestEvaluation("org.eclipse.cdt.debug.ui.isReverseDebuggingEnabled"); } ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class); if (commandService != null) { commandService.refreshElements(REVERSE_TOGGLE_COMMAND_ID, null); } return Status.OK_STATUS; } }.schedule(); }
Source:
void reportInternal(ReportPoint point) { if (validationConfig.get() == null) { validatePoint(point, handle, Validation.Level.NUMERIC_ONLY); } else { validatePoint(point, validationConfig.get()); } if (DeltaCounter.isDelta(point.getMetric())) { refreshValidPointsLoggerState(); if ((logData || logPointsFlag) && (logSampleRate >= 1.0d || (logSampleRate > 0.0d && RANDOM.nextDouble() < logSampleRate))) { String strPoint = serializer.apply(point); validPointsLogger.info(strPoint); } getReceivedCounter().inc(); double pvalue = Double.parseDouble(String.valueOf(point.getValue())); receivedPointLag.update(Clock.now() - point.getTimestamp()); HostMetricTagsPair hostMetricTagsPair = new HostMetricTagsPair(point.getHost(), point.getMetric(), point.getAnnotations()); metricCache.get(hostMetricTagsPair, key -> new AtomicDouble(0)).getAndAdd(pvalue); getReceivedCounter().inc(); } else { reject(point, "Port is not configured to accept non-delta counter data!"); } }

Target:
void reportInternal(ReportPoint point) { if (validationConfig.get() == null) { validatePoint(point, handle, Validation.Level.NUMERIC_ONLY); } else { validatePoint(point, validationConfig.get()); } if (DeltaCounter.isDelta(point.getMetric())) { refreshValidPointsLoggerState(); if ((logData || logPointsFlag) && (logSampleRate >= 1.0d || (logSampleRate > 0.0d && RANDOM.nextDouble() < logSampleRate))) { String strPoint = serializer.apply(point); validPointsLogger.info(strPoint); } getReceivedCounter().inc(); double deltaValue = (double) point.getValue(); receivedPointLag.update(Clock.now() - point.getTimestamp()); HostMetricTagsPair hostMetricTagsPair = new HostMetricTagsPair(point.getHost(), point.getMetric(), point.getAnnotations()); aggregatedDeltas.get(hostMetricTagsPair, key -> new AtomicDouble(0)).getAndAdd(deltaValue); getReceivedCounter().inc(); } else { reject(point, "Port is not configured to accept non-delta counter data!"); } }
Source:
private void runChildren(final RunNotifier notifier) { final RunnerScheduler scheduler = this.scheduler; try { for (final T each : getFilteredChildren()) { scheduler.schedule(new Runnable() { public void run() { ParentRunner.this.runChild(each, notifier); } }); } } finally { scheduler.finished(); } }

Target:
private void runChildren(final RunNotifier notifier) { final RunnerScheduler currentScheduler = scheduler; try { for (final T each : getFilteredChildren()) { currentScheduler.schedule(new Runnable() { public void run() { ParentRunner.this.runChild(each, notifier); } }); } } finally { currentScheduler.finished(); } }
Source:
public void testMmsDelete() { final ContentValues mmsValues = new ContentValues(2); mmsValues.put(Telephony.Mms.TEXT_ONLY, 1); mmsValues.put(Telephony.Mms.MESSAGE_TYPE, 128); mmsValues.put(Telephony.Mms.SUBJECT, mmsSubject); final Uri mmsUri = mContentResolver.insert(Telephony.Mms.CONTENT_URI, mmsValues); assertThat(mmsUri).isNotNull(); final long mmsId = ContentUris.parseId(mmsUri); final String srcName = String.format("text.%06d.txt", 0); final Uri partUri = Telephony.Mms.CONTENT_URI.buildUpon() .appendPath(String.valueOf(mmsId)).appendPath("part").build(); final ContentValues values = new ContentValues(8); values.put(Telephony.Mms.Part.MSG_ID, mmsId); values.put(Telephony.Mms.Part.SEQ, 0); values.put(Telephony.Mms.Part.CONTENT_TYPE, TEXT_PLAIN); values.put(Telephony.Mms.Part.NAME, srcName); values.put(Telephony.Mms.Part.CONTENT_ID, "<"+srcName+">"); values.put(Telephony.Mms.Part.CONTENT_LOCATION, srcName); values.put(Telephony.Mms.Part.CHARSET, 111); values.put(Telephony.Mms.Part.TEXT, mmsBody); Uri insertPartUri = mContentResolver.insert(partUri, values); assertThat(insertPartUri).isNotNull(); int deletedRows = mContentResolver.delete(partUri, null, null); assertThat(deletedRows).isEqualTo(1); int deletedRow = mContentResolver.delete(mmsUri, null, null); assertThat(deletedRow).isEqualTo(1); }

Target:
public void testMmsDelete() { cleanup(); Uri mmsUri = insertInToMmsTable(false, MMS_SUBJECT_ONE); assertThat(mmsUri).isNotNull(); int deletedRow = mContentResolver.delete(mmsUri, null, null); assertThat(deletedRow).isEqualTo(1); }
Source:
public void doPolling(Guid cmdId, List<Guid> childCmdIds) { super.doPolling(cmdId, childCmdIds); if (!getCinderBroker().isSnapshotExist(getDiskId())) { getCommand().setCommandStatus(CommandStatus.SUCCEEDED); return; } ImageStatus imageStatus = getCinderBroker().getSnapshotStatus(getDiskId()); DiskImage disk = getDisk(); if (imageStatus != null && imageStatus != disk.getImageStatus()) { switch (imageStatus) { case ILLEGAL: getCommand().getParameters().setShouldBeLogged(true); getCommand().setCommandStatus(CommandStatus.FAILED); break; } } }

Target:
public void doPolling(Guid cmdId, List<Guid> childCmdIds) { super.doPolling(cmdId, childCmdIds); if (!getCinderBroker().isSnapshotExist(getDiskId())) { getCommand().setCommandStatus(CommandStatus.SUCCEEDED); return; } ImageStatus imageStatus = getCinderBroker().getSnapshotStatus(getDiskId()); DiskImage disk = getDisk(); if (imageStatus != null && imageStatus != disk.getImageStatus()) { switch (imageStatus) { case ILLEGAL: getCommand().setCommandStatus(CommandStatus.FAILED); break; } } }
Source:
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) { if (event.getEntity() instanceof Player) { if (event.getDamager() instanceof Player) { Player player = (Player) event.getDamager(); if (player.getGameMode() == GameMode.CREATIVE) { TFM_Util.playerMsg(player, "NO GM / GOD PVP!", ChatColor.DARK_RED); event.setCancelled(true); } } if (event.getDamager() instanceof Arrow) { Arrow arrow = (Arrow) event.getDamager(); if (arrow.getShooter() instanceof Player) { Player player = (Player) arrow.getShooter(); if (player.getGameMode() == GameMode.CREATIVE) { TFM_Util.playerMsg(player, "NO GM / GOD PVP!", ChatColor.DARK_RED); event.setCancelled(true); } } } } }

Target:
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) { if (event.getEntity() instanceof Player) { if (event.getDamager() instanceof Player) { Player player = (Player) event.getDamager(); if (player.getGameMode() == GameMode.CREATIVE) { TFM_Util.playerMsg(player, "Creative pvp is prohibited!", ChatColor.DARK_RED); event.setCancelled(true); } } if (event.getDamager() instanceof Arrow) { Arrow arrow = (Arrow) event.getDamager(); if (arrow.getShooter() instanceof Player) { Player player = (Player) arrow.getShooter(); if (player.getGameMode() == GameMode.CREATIVE) { TFM_Util.playerMsg(player, "Creative pvp is prohibited!", ChatColor.DARK_RED); event.setCancelled(true); } } } } }
Source:
static boolean recentlyModified(Item item, int days) { String accDate = itemService.getMetadata(item, "dc.date.accessioned"); if (accDate == null) { return false; } Calendar cal = Calendar.getInstance(); cal.add(Calendar.DATE, -days); SimpleDateFormat sdf = new SimpleDateFormat("YYYY-MM-dd"); String cmp = sdf.format(cal.getTime()); return accDate.compareTo(cmp) >= 0; }

Target:
static boolean recentlyModified(Item item, int days) { Calendar cal = Calendar.getInstance(); cal.add(Calendar.DATE, -days); return cal.getTime().before(item.getLastModified()); }
Source:
@Override protected void onPreExecute() { super.onPreExecute(); if (getActivity() != null) getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); }

Target:
@Override protected void onPreExecute() { super.onPreExecute(); A activity = getActivity(); if (activity != null) activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); }
Source:
public boolean equals(Object obj) { return (obj instanceof SetFboWriteMask) && fbo == ((SetFboWriteMask) obj).fbo && renderToColorBuffer == ((SetFboWriteMask) obj).renderToColorBuffer && renderToDepthBuffer == ((SetFboWriteMask) obj).renderToDepthBuffer && renderToLightBuffer == ((SetFboWriteMask) obj).renderToLightBuffer; }

Target:
public boolean equals(Object obj) { return (obj instanceof SetFboWriteMask) && fbo.equals(((SetFboWriteMask) obj).fbo) && renderToColorBuffer == ((SetFboWriteMask) obj).renderToColorBuffer && renderToDepthBuffer == ((SetFboWriteMask) obj).renderToDepthBuffer && renderToLightBuffer == ((SetFboWriteMask) obj).renderToLightBuffer; }
Source:
public TestUser(String name) { super(new Principal() { @Override public String getName() { return name; } }); }

Target:
public TestUser(String name) { super(() -> name); }
Source:
public void compareTimeZone() throws SQLException { TimeZone serverTimeZone = null; try { serverTimeZone = getServerTimeZone(); } catch (SQLException ex) { logger.error(String.format(Locale.ENGLISH, "SQLException raised %s", ex.toString())); } if (serverTimeZone == null) { logger.warn("Can't get server TimeZone."); return; } TimeZone clientTimeZone = TimeZone.getDefault(); Date today = new Date(); int clientOffset = clientTimeZone.getRawOffset(); if (clientTimeZone.inDaylightTime(today)) { clientOffset += clientTimeZone.getDSTSavings(); } if (clientOffset != serverTimeZone.getRawOffset()) { logger.warn(String.format(Locale.ENGLISH, "The client timezone(%s) is different from the server timezone(%s). The plugin will fetch wrong datetime values.", clientTimeZone.getID(), serverTimeZone.getID())); logger.warn(String.format(Locale.ENGLISH, "Use You may need to set options `useLegacyDatetimeCode` and `serverTimeZone`")); logger.warn(String.format(Locale.ENGLISH, "Ex. `options: { useLegacyDatetimeCode: false, serverTimeZone: UTC }`")); } logger.warn(String.format(Locale.ENGLISH, "The plugin will set `useLegacyDatetimeCode=false` by default in future.")); }

Target:
public void compareTimeZone() throws SQLException { TimeZone serverTimeZone = null; try { serverTimeZone = getServerTimeZone(); } catch (SQLException ex) { logger.warn("Can't get server TimeZone."); logger.warn(String.format(Locale.ENGLISH, "SQLException raised %s", ex.toString())); } TimeZone clientTimeZone = TimeZone.getDefault(); Date today = new Date(); int clientOffset = clientTimeZone.getRawOffset(); if (clientTimeZone.inDaylightTime(today)) { clientOffset += clientTimeZone.getDSTSavings(); } if (clientOffset != serverTimeZone.getRawOffset()) { logger.warn(String.format(Locale.ENGLISH, "The client timezone(%s) is different from the server timezone(%s). The plugin will fetch wrong datetime values.", clientTimeZone.getID(), serverTimeZone.getID())); logger.warn(String.format(Locale.ENGLISH, "You may need to set options `useLegacyDatetimeCode` and `serverTimezone`")); logger.warn(String.format(Locale.ENGLISH, "Example. `options: { useLegacyDatetimeCode: false, serverTimezone: UTC }`")); } logger.warn(String.format(Locale.ENGLISH, "The plugin will set `useLegacyDatetimeCode=false` by default in future.")); }
Source:
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { final S3Configuration configuration = this.configuration.copy(); setProperties(configuration, parameters); if (remaining == null || remaining.trim().length() == 0) { throw new IllegalArgumentException("Bucket name must be specified."); } if (remaining.startsWith("arn:")) { remaining = remaining.substring(remaining.lastIndexOf(":") + 1, remaining.length()); } configuration.setBucketName(remaining); if (ObjectHelper.isEmpty(configuration.getAccessKey())) { setAccessKey(accessKey); } if (ObjectHelper.isEmpty(configuration.getSecretKey())) { setSecretKey(secretKey); } if (ObjectHelper.isEmpty(configuration.getRegion())) { setRegion(region); } if (configuration.isUseIAMCredentials() == false && configuration.getAmazonS3Client() == null && (configuration.getAccessKey() == null || configuration.getSecretKey() == null)) { throw new IllegalArgumentException("useIAMCredentials is set to false, AmazonS3Client or accessKey and secretKey must be specified"); } S3Endpoint endpoint = new S3Endpoint(uri, this, configuration); setProperties(endpoint, parameters); return endpoint; }

Target:
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { final S3Configuration configuration = this.configuration.copy(); setProperties(configuration, parameters); if (remaining == null || remaining.trim().length() == 0) { throw new IllegalArgumentException("Bucket name must be specified."); } if (remaining.startsWith("arn:")) { remaining = remaining.substring(remaining.lastIndexOf(":") + 1, remaining.length()); } configuration.setBucketName(remaining); if (ObjectHelper.isEmpty(configuration.getAccessKey())) { setAccessKey(accessKey); } if (ObjectHelper.isEmpty(configuration.getSecretKey())) { setSecretKey(secretKey); } if (ObjectHelper.isEmpty(configuration.getRegion())) { setRegion(region); } if (!configuration.isUseIAMCredentials() && configuration.getAmazonS3Client() == null && (configuration.getAccessKey() == null || configuration.getSecretKey() == null)) { throw new IllegalArgumentException("useIAMCredentials is set to false, AmazonS3Client or accessKey and secretKey must be specified"); } S3Endpoint endpoint = new S3Endpoint(uri, this, configuration); setProperties(endpoint, parameters); return endpoint; }
Source:
private void getChildrenImpl() { ObjectWalk ow = new ObjectWalk(repo); List<GitModelCommit> result = new ArrayList<GitModelCommit>(); try { RevCommit ancestorCommit = RevUtils.getCommonAncestor(repo, srcRev, dstRev); ow.parseAny(ancestorCommit); ow.reset(); ow.markStart(ow.parseAny(dstRev)); RevCommit remoteCommit = ow.next(); ow.reset(); ow.markStart(ow.parseAny(srcRev)); RevCommit baseCommit = ow.next(); ow.reset(); ow.setRevFilter(getRevFilter(ancestorCommit, baseCommit, remoteCommit)); ow.markStart(ancestorCommit); ow.markStart(baseCommit); ow.markStart(remoteCommit); RevCommit commit; while ((commit = ow.next()) != null) result.add(new GitModelCommit(this, commit)); } catch (IOException e) { Activator.logError(e.getMessage(), e); } childrens = result.toArray(new GitModelCommit[result.size()]); }

Target:
private void getChildrenImpl() { List<GitModelCommit> result = new ArrayList<GitModelCommit>(); try { RevCommit ancestorCommit = RevUtils.getCommonAncestor(repo, srcRev, dstRev); RevCommitList<RevCommit> commits = getRevCommits(ancestorCommit, dstRev); commits.addAll(getRevCommits(ancestorCommit, srcRev)); for (RevCommit commit : commits) result.add(new GitModelCommit(this, commit)); } catch (IOException e) { Activator.logError(e.getMessage(), e); } childrens = result.toArray(new GitModelCommit[result.size()]); }
Source:
public void onFailure(WorkflowExecutionContext context) throws FalconException{ onSuccess(context); }

Target:
public void onFailure(WorkflowExecutionContext context) throws FalconException{ onEnd(context); }
Source:
public static Map<String, IAnalysisModuleHelper> getAnalysisModules() { synchronized (fAnalysisModules) { if (fAnalysisModules.isEmpty()) { for (IAnalysisModuleSource source : fSources) { fAnalysisModules.putAll(source.getAnalysisModules()); } } } return Collections.unmodifiableMap(fAnalysisModules); }

Target:
public static Map<String, IAnalysisModuleHelper> getAnalysisModules() { synchronized (fAnalysisModules) { if (fAnalysisModules.isEmpty()) { for (IAnalysisModuleSource source : fSources) { for (IAnalysisModuleHelper helper : source.getAnalysisModules()) { fAnalysisModules.put(helper.getId(), helper); } } } } return Collections.unmodifiableMap(fAnalysisModules); }
Source:
private void cleanupOldBundles(File bundleDir, File justGenerated) { thread.setName(String.format("%s periodic bundle generator: tidying old bundles since %s", SupportPlugin.class.getSimpleName(), new Date())); File[] files = bundleDir.listFiles(new FilenameFilter() { public boolean accept(File dir, String name) { return name.startsWith(SupportPlugin.getBundlePrefix()) && name.endsWith(".zip"); } }); long pivot = System.currentTimeMillis(); for (long l = 1; l * 2 > 0; l *= 2) { boolean seen = false; for (File f : files) { if (!f.isFile() || f == justGenerated) { continue; } long age = pivot - f.lastModified(); if (l <= age && age < l * 2) { if (seen) { f.delete(); } else { seen = true; } } } } }

Target:
private void cleanupOldBundles(File bundleDir, File justGenerated) { thread.setName(String.format("%s periodic bundle generator: tidying old bundles since %s", SupportPlugin.class.getSimpleName(), new Date())); File[] files = bundleDir.listFiles(new FilenameFilter() { public boolean accept(File dir, String name) { return name.endsWith(".zip"); } }); long pivot = System.currentTimeMillis(); for (long l = 1; l * 2 > 0; l *= 2) { boolean seen = false; for (File f : files) { if (!f.isFile() || f == justGenerated) { continue; } long age = pivot - f.lastModified(); if (l <= age && age < l * 2) { if (seen) { f.delete(); } else { seen = true; } } } } }
Source:
public List<MentionNotificationParameters> analyze(XWikiDocument doc, DocumentReference documentReference, String version, String authorReference) { Syntax syntax = doc.getSyntax(); List<MentionNotificationParameters> ret = new ArrayList<>(); handleContentOnCreate(doc.getXDOM(), documentReference, version, authorReference, DOCUMENT) .ifPresent(ret::add); ret.addAll(traverseXObjectsOnCreate(doc.getXObjects(), version, authorReference, syntax)); return ret; }

Target:
public List<MentionNotificationParameters> analyze(XWikiDocument doc, DocumentReference documentReference, String version, String authorReference) { Syntax syntax = doc.getSyntax(); List<MentionNotificationParameters> mentionNotificationParametersList = new ArrayList<>(); handleContentOnCreate(doc.getXDOM(), documentReference, version, authorReference, DOCUMENT) .ifPresent(mentionNotificationParametersList::add); mentionNotificationParametersList .addAll(traverseXObjectsOnCreate(doc.getXObjects(), version, authorReference, syntax)); return mentionNotificationParametersList; }
Source:
WorkerPerformanceMonitor(Collection<TestContainer<TestContext>> testContainers) { this(testContainers, 5); }

Target:
WorkerPerformanceMonitor(Collection<TestContainer<TestContext>> testContainers) { this(testContainers, DEFAULT_MONITORING_INTERVAL_SECONDS); }
Source:
private void initUsingAppLogMessage(String[] tokens) { servletName = tokens[1]; action = tokens[2]; toShow = Boolean.parseBoolean(tokens[3]); role = tokens[4]; name = tokens[5]; googleId = tokens[6]; email = tokens[7]; message = tokens[8]; url = tokens[9]; boolean isLogWithoutTimeTakenAndId = tokens.length < 11; if (!isLogWithoutTimeTakenAndId) { boolean isOldLog = !(tokens[10].contains(googleId) || tokens[10].contains("%")); if (isOldLog) { timeTaken = Long.parseLong(tokens[10].trim()); } else { id = tokens[10]; timeTaken = tokens.length == 12 ? Long.parseLong(tokens[11].trim()) : null; } } }

Target:
private void initUsingAppLogMessage(String[] tokens) { servletName = tokens[POSITION_OF_SERVLETNAME]; action = tokens[POSITION_OF_ACTION]; toShow = Boolean.parseBoolean(tokens[POSITION_OF_TOSHOW]); role = tokens[POSITION_OF_ROLE]; name = tokens[POSITION_OF_NAME]; googleId = tokens[POSITION_OF_GOOGLEID]; email = tokens[POSITION_OF_EMAIL]; message = tokens[POSITION_OF_MESSAGE]; url = tokens[POSITION_OF_URL]; boolean isLogWithTimeTakenAndId = tokens.length >= (POSITION_OF_ID + 1); if (isLogWithTimeTakenAndId) { boolean isOldLog = !(tokens[POSITION_OF_ID].contains(googleId) || tokens[POSITION_OF_ID].contains("%")); if (isOldLog) { timeTaken = Long.parseLong(tokens[POSITION_OF_TIMETAKEN_IN_OLD_LOGS].trim()); } else { id = tokens[POSITION_OF_ID]; timeTaken = tokens.length == 12 ? Long.parseLong(tokens[POSITION_OF_TIMETAKEN].trim()) : null; } } }
Source:
public boolean ceationCommandClassExists(DiagnosticChain diagnostics, Map<Object, Object> context) { if (creationCommandClass != null) { Class<?> theClass = ClassLoaderHelper.loadClass(creationCommandClass); if (theClass == null) { if (diagnostics != null) { diagnostics.add(new BasicDiagnostic(Diagnostic.ERROR, RepresentationValidator.DIAGNOSTIC_SOURCE, RepresentationValidator.PAPYRUS_DIAGRAM__CEATION_COMMAND_CLASS_EXISTS, EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "ceationCommandClassExists " + creationCommandClass + " cannot be loaded", EObjectValidator.getObjectLabel(this, context) }), new Object[] { this })); } return false; } } return true; }

Target:
public boolean ceationCommandClassExists(DiagnosticChain diagnostics, Map<Object, Object> context) { if (creationCommandClass != null) { Class<?> theClass = ClassLoaderHelper.loadClass(creationCommandClass); if (theClass == null) { if (diagnostics != null) { diagnostics.add(new BasicDiagnostic(Diagnostic.ERROR, RepresentationValidator.DIAGNOSTIC_SOURCE, RepresentationValidator.PAPYRUS_DIAGRAM__CEATION_COMMAND_CLASS_EXISTS, EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "creationCommandClassExists " + creationCommandClass + " cannot be loaded", EObjectValidator.getObjectLabel(this, context) }), new Object[] { this })); } return false; } } return true; }
Source:
private UserAttributes convertToUserAttributes(ReadableMap readableMap) { Map<String, Object> map = recursivelyDeconstructReadableMap(readableMap); UserAttributes.Builder builder = new UserAttributes.Builder(); for (Map.Entry<String, Object> entry : map.entrySet()) { String key = entry.getKey(); Object value = entry.getValue(); if (key.equals("email")) { builder.withEmail((String)value); } else if (key.equals("user_id")) { builder.withUserId((String)value); } else if (key.equals("name")) { builder.withName((String)value); } else if (key.equals("phone")) { builder.withPhone((String)value); } else if (key.equals("language_override")) { builder.withLanguageOverride((String)value); } else if (key.equals("signed_up_at")) { Date dateSignedUpAt = new Date((long)value); builder.withSignedUpAt(dateSignedUpAt); } else if (key.equals("unsubscribed_from_emails")) { builder.withUnsubscribedFromEmails((Boolean)value); } else if (key.equals("companies")) { Log.w(TAG, "Not implemented yet"); } builder.withCustomAttribute(key, value); } return builder.build(); }

Target:
private UserAttributes convertToUserAttributes(ReadableMap readableMap) { Map<String, Object> map = recursivelyDeconstructReadableMap(readableMap); UserAttributes.Builder builder = new UserAttributes.Builder(); for (Map.Entry<String, Object> entry : map.entrySet()) { String key = entry.getKey(); Object value = entry.getValue(); if (key.equals("email")) { builder.withEmail((String)value); } else if (key.equals("user_id")) { builder.withUserId((String)value); } else if (key.equals("name")) { builder.withName((String)value); } else if (key.equals("phone")) { builder.withPhone((String)value); } else if (key.equals("language_override")) { builder.withLanguageOverride((String)value); } else if (key.equals("signed_up_at")) { Date dateSignedUpAt = new Date((long)value); builder.withSignedUpAt(dateSignedUpAt); } else if (key.equals("unsubscribed_from_emails")) { builder.withUnsubscribedFromEmails((Boolean)value); } else if (key.equals("custom_attributes")) { builder.withCustomAttributes((Map)value); } else if (key.equals("companies")) { Log.w(TAG, "Not implemented yet"); } } return builder.build(); }
Source:
public Image getColumnImage(Object element, int columnIndex) { if (columnIndex == 1 && element instanceof CounterTreeViewerEntry && fCheckboxTree.getChecked(element)) { Image image = new Image(Display.getDefault(), IMG_WIDTH, IMG_HEIGHT); GC gc = new GC(image); Color prevBackground = gc.getBackground(); gc.setBackground(new Color(Display.getDefault(), 247, 247, 247)); gc.fillRectangle(0, 0, IMG_WIDTH, IMG_HEIGHT); String seriesName = ((CounterTreeViewerEntry) element).getFullPath(); IYAppearance appearance = fPresentationProvider.getAppearance(seriesName, IYAppearance.Type.LINE); RGBColor rgb = appearance.getColor(); Color lineColor = new Color(Display.getDefault(), rgb.getRed(), rgb.getGreen(), rgb.getBlue()); Color prevForeground = gc.getForeground(); gc.setForeground(lineColor); gc.setLineWidth(LINE_WIDTH); gc.setLineStyle(SWT.LINE_SOLID); gc.drawLine(0, IMG_HEIGHT / 2, IMG_WIDTH, IMG_HEIGHT / 2); gc.setForeground(prevForeground); gc.setBackground(prevBackground); gc.dispose(); return image; } return null; }

Target:
public Image getColumnImage(Object element, int columnIndex) { if (columnIndex == 1 && element instanceof CounterTreeViewerEntry && fCheckboxTree.getChecked(element)) { int imageWidth = getTreeViewer().getTree().getColumn(columnIndex).getWidth(); int imageHeight = getTreeViewer().getTree().getItemHeight(); Image image = new Image(Display.getDefault(), imageWidth, imageHeight); GC gc = new GC(image); gc.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); gc.fillRectangle(0, 0, imageWidth, imageHeight); String seriesName = ((CounterTreeViewerEntry) element).getFullPath(); IYAppearance appearance = fCounterChartViewer.getAppearance(Objects.requireNonNull(seriesName)); RGBColor rgb = appearance.getColor(); Color lineColor = new Color(Display.getDefault(), rgb.getRed(), rgb.getGreen(), rgb.getBlue()); gc.setForeground(lineColor); gc.setLineWidth(LINE_WIDTH); gc.setLineStyle(LineStyle.valueOf(appearance.getStyle()).ordinal()); gc.drawLine(0, imageHeight / 2, imageWidth, imageHeight / 2); gc.dispose(); lineColor.dispose(); return image; } return null; }
Source:
private boolean branchExists(String branchName) throws GerritException { assertTrue("Branch requests are not supported in this version of Gerrit", reviewHarness.getClient() .isVersion29OrLater(new NullProgressMonitor())); BranchInfo[] branches = reviewHarness.getAdminClient().getRemoteProjectBranches("org.eclipse.mylyn.test", new NullProgressMonitor()); for (BranchInfo branch : branches) { String branchRef = StringUtils.trimToEmpty(StringUtils.substringAfterLast(branch.getRef(), "/")); if (branchRef.equals(branchName)) { return true; } } return false; }

Target:
private boolean branchExists(String branchName) throws GerritException { BranchInfo[] branches = reviewHarness.getAdminClient().getRemoteProjectBranches("org.eclipse.mylyn.test", new NullProgressMonitor()); for (BranchInfo branch : branches) { String branchRef = StringUtils.trimToEmpty(StringUtils.substringAfterLast(branch.getRef(), "/")); if (branchRef.equals(branchName)) { return true; } } return false; }
Source:
public void onClick(View view){ switch(view.getId()){ case (R.id.field_report_button): fieldReportButtonPressed(view); } }

Target:
public void onClick(View view){ switch(view.getId()){ case (R.id.field_report_button): fieldReportButtonPressed(view); break; default: break; } }