auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.player_skin_multiaudio_layout); completePlayerSetup(asked); Button setTrackButton = findViewById(R.id.setTrackButton); setTrackButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (player != null && currentAudioTrack != null) { setAudioTrack(); } } }); }

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.player_skin_multiaudio_layout); completePlayerSetup(asked); initButtonListener(); }
Source:
protected boolean canDoAction() { if (getVdsGroup() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_CLUSTER_CAN_NOT_BE_EMPTY); } if (!FeatureSupported.vmSlaPolicy(getVdsGroup().getcompatibility_version())) { return failCanDoAction(VdcBllMessages.VM_SLA_POLICY_NOT_SUPPORTED); } if (getVm() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_EXIST); } if (getVm().getStatus() != VMStatus.Up || getVm().getRunOnVds() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_STATUS_ILLEGAL, LocalizedVmStatus.from(getVm().getStatus())); } return true; }

Target:
protected boolean canDoAction() { if (getVm() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_EXIST); } if (getVm().getStatus() != VMStatus.Up) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_STATUS_ILLEGAL, LocalizedVmStatus.from(getVm().getStatus())); } if (!FeatureSupported.vmSlaPolicy(getVm().getVdsGroupCompatibilityVersion())) { return failCanDoAction(VdcBllMessages.VM_SLA_POLICY_NOT_SUPPORTED); } return true; }
Source:
public void testSort() { ArrayList<SessionAttributes> testList = new ArrayList<SessionAttributes>(); ArrayList<SessionAttributes> expected = new ArrayList<SessionAttributes>(); Calendar cal = Calendar.getInstance(); cal.set(2014, 0, 1); Date time1 = cal.getTime(); cal.set(2014, 1, 1); Date time2 = cal.getTime(); cal.set(2014, 2, 1); Date time3 = cal.getTime(); SessionAttributes s1; SessionAttributes s2; SessionAttributes s3; SessionAttributes s4; SessionAttributes s5; s1 = new miniFeedback(time1, time2, "Session 1"); s2 = new miniEval(time2, time3, "Session 2"); s3 = new miniFeedback(time1, time2, "Session 3"); s4 = new miniEval(time1, time3, "Session 4"); s5 = new miniFeedback(time2, time3, "Session 5"); testList.add(s1); testList.add(s2); testList.add(s3); testList.add(s4); testList.add(s5); expected.add(s1); expected.add(s3); expected.add(s4); expected.add(s2); expected.add(s5); Collections.sort(testList, SessionAttributes.ASCENDING_ORDER); for (int i = 0; i < testList.size(); i++) { assertEquals(expected.get(i), testList.get(i)); } testList.clear(); testList.add(s1); testList.add(s2); testList.add(s3); testList.add(s4); testList.add(s5); expected.clear(); expected.add(s2); expected.add(s5); expected.add(s4); expected.add(s1); expected.add(s3); Collections.sort(testList, SessionAttributes.DESCENDING_ORDER); for (int i = 0; i < testList.size(); i++) { assertEquals(expected.get(i), testList.get(i)); } }

Target:
public void testSort() { ArrayList<SessionAttributes> testList = new ArrayList<SessionAttributes>(); ArrayList<SessionAttributes> expected = new ArrayList<SessionAttributes>(); Calendar cal = Calendar.getInstance(); cal.set(2014, 0, 1); Date time1 = cal.getTime(); cal.set(2014, 1, 1); Date time2 = cal.getTime(); cal.set(2014, 2, 1); Date time3 = cal.getTime(); SessionAttributes s1 = new miniFeedback(time1, time2, "Session 1"); SessionAttributes s2 = new miniEval(time2, time3, "Session 2"); SessionAttributes s3 = new miniFeedback(time1, time2, "Session 3"); SessionAttributes s4 = new miniEval(time1, time3, "Session 4"); SessionAttributes s5 = new miniFeedback(time2, time3, "Session 5"); testList.add(s1); testList.add(s2); testList.add(s3); testList.add(s4); testList.add(s5); expected.add(s1); expected.add(s3); expected.add(s4); expected.add(s2); expected.add(s5); Collections.sort(testList, SessionAttributes.ASCENDING_ORDER); for (int i = 0; i < testList.size(); i++) { assertEquals(expected.get(i), testList.get(i)); } testList.clear(); testList.add(s1); testList.add(s2); testList.add(s3); testList.add(s4); testList.add(s5); expected.clear(); expected.add(s2); expected.add(s5); expected.add(s4); expected.add(s1); expected.add(s3); Collections.sort(testList, SessionAttributes.DESCENDING_ORDER); for (int i = 0; i < testList.size(); i++) { assertEquals(expected.get(i), testList.get(i)); } }
Source:
public static <T> Pair<String, String> getDataSourceAndIntervalStrings(final Query<T> query) { final List<String> datasourceNames = new ArrayList<>(); final List<String> intervals = new ArrayList<>(); query.getDataSources().forEach(spec -> { datasourceNames.addAll(spec.getDataSource().getNames()); intervals.addAll( spec.getQuerySegmentSpec().getIntervals().stream().map(Interval::toString).collect(Collectors.toList()) ); }); return new Pair<>( datasourceNames.stream().collect(Collectors.joining(",", "[", "]")), intervals.stream().collect(Collectors.joining(",", "[", "]")) ); }

Target:
public static <T> Pair<String, String> getDataSourceAndIntervalStrings(final Query<T> query) { final List<String> datasourceNames = new ArrayList<>(); final List<String> intervals = new ArrayList<>(); query.getDataSources().forEach(spec -> { datasourceNames.addAll(spec.getDataSource().getNames()); spec.getQuerySegmentSpec().getIntervals().stream().map(Interval::toString).forEach(intervals::add); }); return new Pair<>(datasourceNames.toString(), intervals.toString()); }
Source:
public HandlerResult handle(ProcessState state, ProcessInstance process) { Instance instance = (Instance) state.getResource(); List<InstanceHostMap> instanceHostMappings = objectManager.find(InstanceHostMap.class, INSTANCE_HOST_MAP.INSTANCE_ID, instance.getId()); if (instanceHostMappings.size() == 0) { return null; } InstanceHostMap mapping = instanceHostMappings.get(0); CacheManager cm = CacheManager.getCacheManagerInstance(this.objectManager); HostInfo hostInfo = cm.getHostInfo(mapping.getHostId()); hostInfo.removeInstance(mapping.getInstanceId()); log.debug("removed instance info from host info in cache manager", instance.getId(), mapping.getHostId()); return null; }

Target:
public HandlerResult handle(ProcessState state, ProcessInstance process) { Instance instance = (Instance) state.getResource(); if (instance == null) { return null; } List<InstanceHostMap> instanceHostMappings = objectManager.find(InstanceHostMap.class, INSTANCE_HOST_MAP.INSTANCE_ID, instance.getId()); for (InstanceHostMap mapping : instanceHostMappings) { CacheManager cm = CacheManager.getCacheManagerInstance(this.objectManager); HostInfo hostInfo = cm.getHostInfo(mapping.getHostId(), false); if (hostInfo == null) { return null; } InstanceInfo instanceInfo = hostInfo.removeInstance(mapping.getInstanceId()); if (instanceInfo != null) { log.debug("removed instance info from host info in cache manager", instance.getId(), mapping.getHostId()); } } return null; }
Source:
public void checkAttributeSyntax(PerunSessionImpl perunSession, String key, Attribute attribute) throws InternalErrorException, WrongAttributeValueException { Integer maxUID = attribute.valueAsInteger(); if(maxUID != null && maxUID < 1) throw new WrongAttributeValueException(attribute, "Attribute value must be min 1."); }

Target:
public void checkAttributeSyntax(PerunSessionImpl perunSession, String key, Attribute attribute) throws InternalErrorException, WrongAttributeValueException { Integer maxUID = attribute.valueAsInteger(); if(maxUID != null && maxUID < 1) throw new WrongAttributeValueException(attribute, "Attribute value must be bigger than 0."); }
Source:
public static Mono<byte[]> downloadFileAsync(String url, HttpPipeline httpPipeline) { FileService service = RestProxy.create(FileService.class, httpPipeline); try { return stringResponse(service.download(getHost(url), getPathAndQuery(url))) .map(simpleResponse -> simpleResponse.getValue().getBytes(Charset.defaultCharset())); } catch (MalformedURLException ex) { return Mono.empty(); } }

Target:
public static Mono<byte[]> downloadFileAsync(String url, HttpPipeline httpPipeline) { FileService service = RestProxy.create(FileService.class, httpPipeline); try { return service.download(getHost(url), getPathAndQuery(url)) .flatMap(response -> FluxUtil.collectBytesInByteBufferStream(response.getValue())); } catch (MalformedURLException ex) { return Mono.error(() -> ex); } }
Source:
private List<String> takeOpenFiles(Collection<String> files, Map<FileSKVIterator,String> readersReserved) { List<String> filesToOpen = Collections.emptyList(); for (String file : files) { List<OpenReader> ofl = openFiles.get(file); if (ofl != null && ofl.size() > 0) { OpenReader openReader = ofl.remove(ofl.size() - 1); readersReserved.put(openReader.reader, file); if (ofl.size() == 0) { openFiles.remove(file); } } else { if(filesToOpen.size() == 0) { filesToOpen = new ArrayList<>(files.size()); } filesToOpen.add(file); } } return filesToOpen; }

Target:
private List<String> takeOpenFiles(Collection<String> files, Map<FileSKVIterator,String> readersReserved) { List<String> filesToOpen = Collections.emptyList(); for (String file : files) { List<OpenReader> ofl = openFiles.get(file); if (ofl != null && ofl.size() > 0) { OpenReader openReader = ofl.remove(ofl.size() - 1); readersReserved.put(openReader.reader, file); if (ofl.size() == 0) { openFiles.remove(file); } } else { if (filesToOpen.isEmpty()) { filesToOpen = new ArrayList<>(files.size()); } filesToOpen.add(file); } } return filesToOpen; }
Source:
public void beginReleasePhoneNumbers(HttpClient httpClient) { PhoneNumber phoneNumber = new PhoneNumber(PHONENUMBER_TO_RELEASE); List<PhoneNumber> phoneNumbers = new ArrayList<>(); phoneNumbers.add(phoneNumber); Duration pollInterval = Duration.ofSeconds(5); PollerFlux<PhoneNumberRelease, PhoneNumberRelease> poller = this.getClient(httpClient).beginReleasePhoneNumbers(phoneNumbers, pollInterval); AsyncPollResponse<PhoneNumberRelease, PhoneNumberRelease> asyncRes = poller.takeUntil(apr -> apr.getStatus() == LongRunningOperationStatus.SUCCESSFULLY_COMPLETED). blockLast(); PhoneNumberRelease testResult = asyncRes.getValue(); assertEquals(ReleaseStatus.COMPLETE, testResult.getStatus()); }

Target:
public void beginReleasePhoneNumbers(HttpClient httpClient) { PhoneNumber phoneNumber = new PhoneNumber(PHONENUMBER_TO_RELEASE); List<PhoneNumber> phoneNumbers = new ArrayList<>(); phoneNumbers.add(phoneNumber); Duration pollInterval = Duration.ofSeconds(1); PollerFlux<PhoneNumberRelease, PhoneNumberRelease> poller = this.getClient(httpClient).beginReleasePhoneNumbers(phoneNumbers, pollInterval); Mono<AsyncPollResponse<PhoneNumberRelease, PhoneNumberRelease>> asyncRes = poller.last(); StepVerifier.create(asyncRes) .assertNext(item -> { assertEquals(ReleaseStatus.COMPLETE, item.getValue().getStatus()); }) .verifyComplete(); }
Source:
public void onMessageReceived(RemoteMessage remoteMessage) { CloudMessaging cloudMessaging = new CloudMessaging(); cloudMessaging.initialize(remoteMessage); String title = cloudMessaging.getTitle(); String message = cloudMessaging.getMessage(); String webPageUrl = cloudMessaging.getWebPageUrl(); if (!cloudMessaging.isValidData()) { return; } showNotification(title, message, webPageUrl); }

Target:
public void onMessageReceived(RemoteMessage remoteMessage) { CloudMessaging cloudMessaging = new CloudMessaging(this, new NotificationBuilderProvider(this), (NotificationManager) getSystemService(NOTIFICATION_SERVICE)); cloudMessaging.showNotification(new CloudMessage(remoteMessage)); }
Source:
private List<Instant> deserializeListOfInstant(Message amqpMessage) { List<Instant> listInstant = new ArrayList<>(); if (amqpMessage.getBody() instanceof AmqpValue) { AmqpValue amqpValue = ((AmqpValue) amqpMessage.getBody()); if (amqpValue.getValue() instanceof Map) { @SuppressWarnings("unchecked") Map<String, Object> responseBody = (Map<String, Object>) amqpValue.getValue(); Object expirationListObj = responseBody.get(REQUEST_RESPONSE_EXPIRATIONS); if (expirationListObj instanceof Date[]) { listInstant = Arrays.stream((Date[]) expirationListObj) .map(Date::toInstant) .collect(Collectors.toList()); } } } return listInstant; }

Target:
private List<Instant> deserializeListOfInstant(Message amqpMessage) { if (amqpMessage.getBody() instanceof AmqpValue) { AmqpValue amqpValue = ((AmqpValue) amqpMessage.getBody()); if (amqpValue.getValue() instanceof Map) { @SuppressWarnings("unchecked") Map<String, Object> responseBody = (Map<String, Object>) amqpValue.getValue(); Object expirationListObj = responseBody.get(REQUEST_RESPONSE_EXPIRATIONS); if (expirationListObj instanceof Date[]) { return Arrays.stream((Date[]) expirationListObj) .map(Date::toInstant) .collect(Collectors.toList()); } } } return Collections.emptyList(); }
Source:
protected void logSlowLockAcquisition(String lockId, LockClient currentHolder, long durationMillis) { final String slowLockLogMessage = "Blocked for ms to acquire lock {}."; Object[] messageParams = ImmutableList.of( SafeArg.of("durationMillis", durationMillis), UnsafeArg.of("lockId", lockId), SafeArg.of("outcome", currentHolder == null ? "successfully" : "unsuccessfully")).toArray(); if (isSlowLogEnabled() && durationMillis >= slowLogTriggerMillis) { SlowLockLogger.logger.info(slowLockLogMessage, messageParams); } else if (log.isDebugEnabled() && durationMillis > DEBUG_SLOW_LOG_TRIGGER_MILLIS) { log.debug(slowLockLogMessage, messageParams); } }

Target:
protected void logSlowLockAcquisition(String lockId, LockClient currentHolder, long durationMillis) { final String slowLockLogMessage = "Blocked for ms to acquire lock {}."; if (isSlowLogEnabled() && durationMillis >= slowLogTriggerMillis) { SlowLockLogger.logger.info(slowLockLogMessage, constructSlowLockLogParams(lockId, currentHolder, durationMillis)); } else if (log.isDebugEnabled() && durationMillis > DEBUG_SLOW_LOG_TRIGGER_MILLIS) { log.debug(slowLockLogMessage, constructSlowLockLogParams(lockId, currentHolder, durationMillis)); } }
Source:
public void handleRetry(MotechEvent event) { LOGGER.info("Handling the motech event with subject: {}", event.getSubject()); Map<String, Object> eventParams = event.getParameters(); Task task = taskService.getTask((Long) eventParams.get(TASK_ID)); if (task == null) { unscheduleTaskRetries((String) eventParams.get(JOB_SUBJECT)); } else if (task.isEnabled()) { handleTask(task, eventParams); } }

Target:
public void handleRetry(MotechEvent event) { LOGGER.info("Handling the motech event with subject: for task retry", event.getSubject()); Map<String, Object> eventParams = event.getParameters(); Task task = taskService.getTask((Long) eventParams.get(TASK_ID)); if (task == null) { unscheduleTaskRetry((String) eventParams.get(JOB_SUBJECT)); } else if (task.isEnabled()) { handleTask(task, eventParams); } }
Source:
public void processLeftData(final MistDataEvent input) { if (input.getValue() instanceof WindowData) { final WindowData<Tuple2<T, U>> window = (WindowData)input.getValue(); final Collection<T> firstInputList = new LinkedList<>(); final Collection<U> secondInputList = new LinkedList<>(); final Collection<Tuple2<T, U>> outputList = new LinkedList<>(); final Iterator<Tuple2<T, U>> inputIterator = window.getDataCollection().iterator(); while (inputIterator.hasNext()) { final Tuple2<T, U> tuple = inputIterator.next(); if (tuple.get(0) != null) { firstInputList.add((T)tuple.get(0)); } else { secondInputList.add((U)tuple.get(1)); } } final Iterator<T> firstInputIterator = firstInputList.iterator(); while (firstInputIterator.hasNext()) { final T firstInput = firstInputIterator.next(); final Iterator<U> secondInputIterator = secondInputList.iterator(); while (secondInputIterator.hasNext()) { final U secondInput = secondInputIterator.next(); if (joinBiPredicate.test(firstInput, secondInput)) { outputList.add(new Tuple2<>(firstInput, secondInput)); } } } window.setDataCollection(outputList); input.setValue(window); outputEmitter.emitData(input); } else { throw new TypeMismatchException( "The input value for join operator is not an instance implementing Window."); } }

Target:
public void processLeftData(final MistDataEvent input) { try { final WindowData<Tuple2<T, U>> windowData = (WindowData)input.getValue(); final Collection<T> firstInputList = new LinkedList<>(); final Collection<U> secondInputList = new LinkedList<>(); final Collection<Tuple2<T, U>> outputList = new LinkedList<>(); final Iterator<Tuple2<T, U>> inputIterator = windowData.getDataCollection().iterator(); while (inputIterator.hasNext()) { final Tuple2<T, U> tuple = inputIterator.next(); if (tuple.get(0) != null) { firstInputList.add((T)tuple.get(0)); } else { secondInputList.add((U)tuple.get(1)); } } final Iterator<T> firstInputIterator = firstInputList.iterator(); while (firstInputIterator.hasNext()) { final T firstInput = firstInputIterator.next(); final Iterator<U> secondInputIterator = secondInputList.iterator(); while (secondInputIterator.hasNext()) { final U secondInput = secondInputIterator.next(); if (joinBiPredicate.test(firstInput, secondInput)) { outputList.add(new Tuple2<>(firstInput, secondInput)); } } } final long windowStart = windowData.getStart(); final long windowSize = windowData.getEnd() - windowStart + 1; final WindowImpl<Tuple2<T, U>> window = new WindowImpl<>(windowStart, windowSize, outputList); input.setValue(window); outputEmitter.emitData(input); } catch (final ClassCastException e) { throw e; } }
Source:
Object[][] data_lengthOfMonth() { return new Object[][] { { 1900, 1, 28 }, { 1900, 2, 28 }, { 1900, 3, 28 }, { 1900, 4, 28 }, { 1900, 5, 28 }, { 1900, 6, 28 }, { 1900, 7, 28 }, { 1900, 8, 28 }, { 1900, 9, 28 }, { 1900, 10, 28 }, { 1900, 11, 28 }, { 1900, 12, 28 }, { 1900, 13, 28 }, { 1901, 13, 28 }, { 1902, 13, 28 }, { 1903, 13, 28 }, { 1904, 13, 28 }, { 1905, 13, 28 }, { 1906, 13, 28 }, { 2000, 13, 28 }, { 2100, 13, 28 }, }; }

Target:
Object[][] data_lengthOfMonth() { return new Object[][] { {1900, 1, 28}, {1900, 2, 28}, {1900, 3, 28}, {1900, 4, 28}, {1900, 5, 28}, {1900, 6, 28}, {1900, 7, 28}, {1900, 8, 28}, {1900, 9, 28}, {1900, 10, 28}, {1900, 11, 28}, {1900, 12, 28}, {1900, 13, 28}, }; }
Source:
public static Map<String, Object> getVariablesPojo(String basePath) throws ProcessingException, IOException { String filePath = basePath + VARIABLE_CONFIG_PATH; File variableFile = new File(filePath); if (variableFile.exists()) { return stringToVariablesPojo(readConfigFile(variableFile)); } else { log.info("Variables config file not found at " + filePath); } return null; }

Target:
public static Map<String, Object> getVariablesPojo(String basePath) throws IOException { String filePath = basePath + VARIABLE_CONFIG_PATH; File variableFile = new File(filePath); if (variableFile.exists()) { return stringToVariablesPojo(readConfigFile(variableFile)); } else { log.info("Variables config file not found at " + filePath); } return new HashMap<>(); }
Source:
public static void onBlockPlaced(BlockEvent.EntityPlaceEvent event) { if(event.getEntity() instanceof ServerPlayerEntity) { ServerPlayerEntity player = (ServerPlayerEntity) event.getEntity(); if(getData(player) != null) { EditData data = getData(player); if(event.isCanceled()) { data.sendGivenItemsToEditor(); return; } ItemStack stack = player.getHeldItemMainhand(); SburbConnection c = data.connection; DeployEntry entry = DeployList.getEntryForItem(stack, c, player.world); if(entry != null) { GristSet cost = entry.getCurrentCost(c); c.setHasGivenItem(entry); if(!c.isMain()) SkaianetHandler.get(player.server).giveItems(c.getClientIdentifier()); if(!cost.isEmpty()) { GristHelper.notifyEditPlayer(player.world.getServer(), c.getClientIdentifier(), cost, false); GristHelper.decrease(player.world, c.getClientIdentifier(), cost); } player.inventory.mainInventory.set(player.inventory.currentItem, ItemStack.EMPTY); } else { GristHelper.notifyEditPlayer(player.world.getServer(), data.connection.getClientIdentifier(), GristCostRecipe.findCostForItem(stack, null, false, player.getEntityWorld()), false); GristHelper.decrease(player.world, data.connection.getClientIdentifier(), GristCostRecipe.findCostForItem(stack, null, false, player.getEntityWorld())); } } } }

Target:
public static void onBlockPlaced(BlockEvent.EntityPlaceEvent event) { if(event.getEntity() instanceof ServerPlayerEntity) { ServerPlayerEntity player = (ServerPlayerEntity) event.getEntity(); if(getData(player) != null) { EditData data = getData(player); if(event.isCanceled()) { data.sendGivenItemsToEditor(); return; } ItemStack stack = player.getHeldItemMainhand(); SburbConnection c = data.connection; DeployEntry entry = DeployList.getEntryForItem(stack, c, player.world); if(entry != null) { GristSet cost = entry.getCurrentCost(c); c.setHasGivenItem(entry); if(!c.isMain()) SkaianetHandler.get(player.server).giveItems(c.getClientIdentifier()); if(!cost.isEmpty()) { GristHelper.decrease(player.world, c.getClientIdentifier(), cost); GristHelper.notifyEditPlayer(player.world.getServer(), c.getClientIdentifier(), cost, false); } player.inventory.mainInventory.set(player.inventory.currentItem, ItemStack.EMPTY); } else { GristHelper.decrease(player.world, data.connection.getClientIdentifier(), GristCostRecipe.findCostForItem(stack, null, false, player.getEntityWorld())); GristHelper.notifyEditPlayer(player.world.getServer(), data.connection.getClientIdentifier(), GristCostRecipe.findCostForItem(stack, null, false, player.getEntityWorld()), false); } } } }
Source:
public int hashCode() { if (this.components == null || this.components.size() == 0) { return 0; } int ordinals = new int[this.components.size()]; for (int i = 0; i < this.components.size(); i++) { ordinals[i] = this.components.get(i).GetTypeOrdinal(); } return Objects.hashCode(ordinals); }

Target:
public int hashCode() { return super.hashCode(); }
Source:
public String call() throws IOException { NetworkPeerManager peerManager = NetworkPeerManager.getInstanceOrNull(); AsyncPrettyPrinterSchemaFileManager schemaFileManager = peerManager.getAsyncPrettyPrinterSchemaFileManager(); String cacheSchema = schemaFileManager.readCache(url); if (cacheSchema != null) { return cacheSchema; } else { InputStream urlStream = url.openStream(); String result = Util.readAsUTF8(urlStream); urlStream.close(); OutputStream cacheSchemaOutputStream = schemaFileManager.openNewSchemaCache(url); cacheSchemaOutputStream.write(result.getBytes()); cacheSchemaOutputStream.close(); return result; } }

Target:
public String call() throws IOException { HttpURLConnection connection = (HttpURLConnection)url.openConnection(); int statusCode = connection.getResponseCode(); if (statusCode != 200) { throw new IOException("Got status code: " + statusCode + " while downloading " + "schema with url: " + url.toString()); } InputStream urlStream = connection.getInputStream(); try { AsyncPrettyPrinterSchemaManager schemaFileManager = AsyncPrettyPrinterSchemaManager.getInstance(); String result = Util.readAsUTF8(urlStream); schemaFileManager.put(url, result); return result; } finally { urlStream.close(); } }
Source:
public void testNotNotifiedOfExtraTrackedSensorsIfNonDuplicate() throws Exception { TestEntity e1 = createAndManageChildOf(group); RecordingMembershipTrackingPolicy nonDuplicateTrackingPolicy = app.addPolicy(PolicySpec.create(RecordingMembershipTrackingPolicy.class) .configure(AbstractMembershipTrackingPolicy.SENSORS_TO_TRACK, ImmutableSet.<Sensor<?>>of(TestEntity.NAME)) .configure(AbstractMembershipTrackingPolicy.NOTIFY_ON_DUPLICATES, false) .configure("group", group)); e1.setAttribute(TestEntity.NAME, "myname"); assertRecordsEventually(nonDuplicateTrackingPolicy, Record.newAdded(e1), Record.newChanged(e1)); e1.setAttribute(TestEntity.NAME, "myname"); assertRecordsContinually(nonDuplicateTrackingPolicy, Record.newAdded(e1), Record.newChanged(e1)); e1.setAttribute(TestEntity.NAME, "mynewname"); assertRecordsEventually(nonDuplicateTrackingPolicy, Record.newAdded(e1), Record.newChanged(e1), Record.newChanged(e1)); }

Target:
public void testNotNotifiedOfExtraTrackedSensorsIfNonDuplicate() throws Exception { TestEntity e1 = createAndManageChildOf(group); RecordingMembershipTrackingPolicy nonDuplicateTrackingPolicy = app.addPolicy(PolicySpec.create(RecordingMembershipTrackingPolicy.class) .configure(AbstractMembershipTrackingPolicy.SENSORS_TO_TRACK, ImmutableSet.<Sensor<?>>of(TestEntity.NAME)) .configure(AbstractMembershipTrackingPolicy.NOTIFY_ON_DUPLICATES, false) .configure(AbstractMembershipTrackingPolicy.GROUP, group)); e1.setAttribute(TestEntity.NAME, "myname"); assertRecordsEventually(nonDuplicateTrackingPolicy, Record.newAdded(e1), Record.newChanged(e1)); e1.setAttribute(TestEntity.NAME, "myname"); assertRecordsContinually(nonDuplicateTrackingPolicy, Record.newAdded(e1), Record.newChanged(e1)); e1.setAttribute(TestEntity.NAME, "mynewname"); assertRecordsEventually(nonDuplicateTrackingPolicy, Record.newAdded(e1), Record.newChanged(e1), Record.newChanged(e1)); }
Source:
public void testRecoveryAfterBookieCrash() throws Exception { String name = "txnid-after-crash"; DistributedLogConfiguration conf = new DistributedLogConfiguration() .setEnsembleSize(5) .setWriteQuorumSize(5) .setAckQuorumSize(5); long entryId = 0; List<BookieServer> extraBookies = new ArrayList<>(); try { extraBookies.add(startExtraBookie()); extraBookies.add(startExtraBookie()); try (BKDistributedLogManager dlm = (BKDistributedLogManager) createNewDLM(conf, name); BKAsyncLogWriter writer = dlm.startAsyncLogSegmentNonPartitioned()) { writer.write(DLMTestUtil.getLogRecordInstance(1, 100000)).join(); writer.write(DLMTestUtil.getLogRecordInstance(2, 100000)).join(); extraBookies.forEach(b -> b.shutdown()); writer.write(DLMTestUtil.getLogRecordInstance(3, 100000)); Thread.sleep(1000); writer.write(DLMTestUtil.getLogRecordInstance(4, 100000)).join(); Assert.fail("Shouldn't be able to write"); } catch (Exception e) { } extraBookies.add(startExtraBookie()); extraBookies.add(startExtraBookie()); try (BKDistributedLogManager dlm = (BKDistributedLogManager) createNewDLM(conf, name); LogWriter writer = dlm.startLogSegmentNonPartitioned()) { writer.write(DLMTestUtil.getLogRecordInstance(dlm.getLastTxId() + 1, 100000)); writer.commit(); } } finally { extraBookies.forEach(b -> b.shutdown()); } }

Target:
public void testRecoveryAfterBookieCrash() throws Exception { String name = "txnid-after-crash"; DistributedLogConfiguration conf = new DistributedLogConfiguration() .setEnsembleSize(5) .setWriteQuorumSize(5) .setAckQuorumSize(5) .setLogSegmentRollingIntervalMinutes(0) .setLogSegmentRollingConcurrency(-1) .setMaxLogSegmentBytes(400000); long entryId = 0; List<BookieServer> extraBookies = new ArrayList<>(); try { extraBookies.add(startExtraBookie()); extraBookies.add(startExtraBookie()); try (BKDistributedLogManager dlm = (BKDistributedLogManager) createNewDLM(conf, name); BKAsyncLogWriter writer = dlm.startAsyncLogSegmentNonPartitioned()) { writer.write(DLMTestUtil.getLogRecordInstance(1, 100000)).join(); writer.write(DLMTestUtil.getLogRecordInstance(2, 100000)).join(); extraBookies.forEach(b -> b.shutdown()); try { writer.write(DLMTestUtil.getLogRecordInstance(3, 100000)).join(); Assert.fail("Shouldn't have succeeded"); } catch (Exception e) { } writer.write(DLMTestUtil.getLogRecordInstance(4, 100000)).join(); Assert.fail("Shouldn't be able to write"); } catch (Exception e) { } extraBookies.add(startExtraBookie()); extraBookies.add(startExtraBookie()); try (BKDistributedLogManager dlm = (BKDistributedLogManager) createNewDLM(conf, name); BKAsyncLogWriter writer = dlm.startAsyncLogSegmentNonPartitioned()) { long firstTxid = dlm.getLastTxId() + 1; for (int i = 0; i < 20; i++) { logger.info("Writing entry {}", i); writer.write(DLMTestUtil.getLogRecordInstance(firstTxid + i, 100000)).join(); Thread.sleep(100); } } } finally { extraBookies.forEach(b -> b.shutdown()); } }
Source:
public void testSTIsSimple() { assertFunction("ST_IsSimple(ST_GeometryFromText('POLYGON EMPTY'))", BOOLEAN, true); assertFunction("ST_IsSimple(ST_GeometryFromText('POINT (1.5 2.5)'))", BOOLEAN, true); assertFunction("ST_IsSimple(ST_GeometryFromText('MULTIPOINT (1 2, 2 4, 3 6, 4 8)'))", BOOLEAN, true); assertFunction("ST_IsSimple(ST_GeometryFromText('LINESTRING (8 4, 5 7)'))", BOOLEAN, true); assertFunction("ST_IsSimple(ST_GeometryFromText('LINESTRING (0 0, 1 1, 1 0, 0 1)'))", BOOLEAN, false); assertFunction("ST_IsSimple(ST_GeometryFromText('LINESTRING (0 0, 1 1, 1 0, 0 1)'))", BOOLEAN, false); assertFunction("ST_IsSimple(ST_GeometryFromText('LINESTRING (1 1, 2 2, 1 3, 1 1)'))", BOOLEAN, true); assertFunction("ST_IsSimple(ST_GeometryFromText('MULTILINESTRING ((1 1, 5 1), (2 4, 4 4))'))", BOOLEAN, true); assertFunction("ST_IsSimple(ST_GeometryFromText('MULTILINESTRING ((1 1, 5 1), (2 4, 4 0))'))", BOOLEAN, false); assertFunction("ST_IsSimple(ST_GeometryFromText('POLYGON ((2 0, 2 1, 3 1))'))", BOOLEAN, true); assertFunction("ST_IsSimple(ST_GeometryFromText('MULTIPOLYGON (((1 1, 1 3, 3 3, 3 1)), ((2 4, 2 6, 6 6, 6 4)))'))", BOOLEAN, true); }

Target:
public void testSTIsSimple() { assertSimpleGeometry("POINT (1.5 2.5)"); assertSimpleGeometry("MULTIPOINT (1 2, 2 4, 3 6, 4 8)"); assertNotSimpleGeometry("MULTIPOINT (1 2, 2 4, 3 6, 1 2)"); assertSimpleGeometry("LINESTRING (8 4, 5 7)"); assertSimpleGeometry("LINESTRING (1 1, 2 2, 1 3, 1 1)"); assertNotSimpleGeometry("LINESTRING (0 0, 1 1, 1 0, 0 1)"); assertSimpleGeometry("MULTILINESTRING ((1 1, 5 1), (2 4, 4 4))"); assertNotSimpleGeometry("MULTILINESTRING ((1 1, 5 1), (2 4, 4 0))"); assertSimpleGeometry("POLYGON EMPTY"); assertSimpleGeometry("POLYGON ((2 0, 2 1, 3 1))"); assertSimpleGeometry("MULTIPOLYGON (((1 1, 1 3, 3 3, 3 1)), ((2 4, 2 6, 6 6, 6 4)))"); }
Source:
public void threadUsageMetrics(){ navigation.selectRow().invoke("View"); Application.waitUntilVisible(); MetricsAreaFragment metricsArea = jvmPage.getThreadUsageMetricsArea(); double expectedUsagePercentage = metricsArea.getPercentage(DAEMON, LIVE); MetricsFragment threadUsageMetrics = metricsArea.getMetricsFragment(DAEMON); assertEquals(expectedUsagePercentage, threadUsageMetrics.getPercentage(), DELTA); }

Target:
public void threadUsageMetrics(){ MetricsAreaFragment metricsArea = jvmPage.getThreadUsageMetricsArea(); double expectedUsagePercentage = metricsArea.getPercentage(DAEMON, LIVE); MetricsFragment threadUsageMetrics = metricsArea.getMetricsFragment(DAEMON); assertEquals(expectedUsagePercentage, threadUsageMetrics.getPercentage(), DELTA); }
Source:
public void clickRemoveStudentFromCourse(String courseId) { List<WebElement> instructorRows = studentTable.findElement(By.tagName("tbody")).findElements(By.tagName("tr")); WebElement deleteButton = null; for (WebElement instructorRow : instructorRows) { List<WebElement> cells = instructorRow.findElements(By.tagName("td")); if (cells.get(0).getText().startsWith("[" + courseId + "]")) { deleteButton = cells.get(1).findElement(By.className("btn-danger")); } } if (deleteButton == null) { fail("Student to be deleted is not found"); } click(deleteButton); waitForPageToLoad(true); verifyStatusMessage("Student is successfully deleted from course \"" + courseId + "\""); }

Target:
public void clickRemoveStudentFromCourse(String courseId) { List<WebElement> studentRows = studentTable.findElement(By.tagName("tbody")).findElements(By.tagName("tr")); WebElement deleteButton = null; for (WebElement studentRow : studentRows) { List<WebElement> cells = studentRow.findElements(By.tagName("td")); if (cells.get(0).getText().startsWith("[" + courseId + "]")) { deleteButton = cells.get(1).findElement(By.className("btn-danger")); } } if (deleteButton == null) { fail("Student to be deleted is not found"); } click(deleteButton); waitForPageToLoad(true); }
Source:
private boolean processInOnly(Exchange exchange, AsyncCallback callback) throws Exception { String exchangeName = getEndpoint().getExchangeName(exchange.getIn()); String key = exchange.getIn().getHeader(RabbitMQConstants.ROUTING_KEY, () -> null, String.class); if (key == null || getEndpoint().isBridgeEndpoint()) { key = getEndpoint().getRoutingKey() == null ? "" : getEndpoint().getRoutingKey(); } if (ObjectHelper.isEmpty(key) && ObjectHelper.isEmpty(exchangeName)) { throw new IllegalArgumentException("ExchangeName and RoutingKey is not provided in the endpoint: " + getEndpoint()); } basicPublish(exchange, exchangeName, key); callback.done(true); return true; }

Target:
private boolean processInOnly(Exchange exchange, AsyncCallback callback) throws Exception { String exchangeName = getEndpoint().getExchangeName(exchange.getIn()); String key = exchange.getIn().getHeader(RabbitMQConstants.ROUTING_KEY, String.class); if (key == null || getEndpoint().isBridgeEndpoint()) { key = getEndpoint().getRoutingKey() == null ? "" : getEndpoint().getRoutingKey(); } if (ObjectHelper.isEmpty(key) && ObjectHelper.isEmpty(exchangeName)) { throw new IllegalArgumentException("ExchangeName and RoutingKey is not provided in the endpoint: " + getEndpoint()); } basicPublish(exchange, exchangeName, key); callback.done(true); return true; }
Source:
@NotNull private static CacheConfiguration<Integer, double[]> createCacheConfiguration() { CacheConfiguration<Integer, double[]> trainingSetCfg = new CacheConfiguration<>(); trainingSetCfg.setName("TRAINING_SET"); trainingSetCfg.setAffinity(new RendezvousAffinityFunction(false, 1)); return trainingSetCfg; }

Target:
@NotNull private static CacheConfiguration<Integer, double[]> createCacheConfiguration() { CacheConfiguration<Integer, double[]> trainingSetCfg = new CacheConfiguration<>(); trainingSetCfg.setName("TRAINING_SET"); trainingSetCfg.setAffinity(new RendezvousAffinityFunction(false, 10)); return trainingSetCfg; }
Source:
public InputRowListPlusJson transform(@Nullable final InputRowListPlusJson row) { if (row == null) { return null; } final InputRowListPlusJson transformedRow; if (transforms.isEmpty()) { transformedRow = row; } else { transformedRow = InputRowListPlusJson.of(new TransformedInputRow(row.getInputRow(), transforms), row.getRaw()); } if (valueMatcher != null) { rowSupplierForValueMatcher.set(transformedRow.getInputRow()); if (!valueMatcher.matches()) { return null; } } return transformedRow; }

Target:
public InputRowListPlusJson transform(@Nullable final InputRowListPlusJson row) { if (row == null) { return null; } final InputRowListPlusJson transformedRow; if (transforms.isEmpty()) { transformedRow = row; } else { final List<InputRow> originalRows = Preconditions.checkNotNull(row.getInputRows(), "rows before transform"); final List<InputRow> transformedRows = new ArrayList<>(originalRows.size()); for (InputRow originalRow : originalRows) { transformedRows.add(new TransformedInputRow(originalRow, transforms)); } transformedRow = InputRowListPlusJson.of(transformedRows, row.getRawJson()); } if (valueMatcher != null) { rowSupplierForValueMatcher.set(transformedRow.getInputRow()); if (!valueMatcher.matches()) { return null; } } return transformedRow; }
Source:
public synchronized @NonNull TmfModelResponse<@NonNull List<@NonNull CriticalPathEntry>> fetchTree( @NonNull TimeQueryFilter filter, @Nullable IProgressMonitor monitor) { TmfGraph graph = fCriticalPathModule.getCriticalPath(); fCriticalPathModule.waitForCompletion(); if (graph == null) { return new TmfModelResponse<>(null, Status.RUNNING, CommonStatusMessage.RUNNING); } IGraphWorker graphWorker = getCurrent(); HorizontalLinksVisitor visitor = fCurrentVisitor; if (visitor == null || !visitor.fCurrentWorker.equals(graphWorker)) { visitor = new HorizontalLinksVisitor(graph, graphWorker); fCurrentVisitor = visitor; fLinks = null; } graph.scanLineTraverse(graph.getHead(), visitor); List<CriticalPathEntry> list = new ArrayList<>(visitor.getHostEntries()); list.addAll(visitor.getWorkers()); return new TmfModelResponse<>(list, Status.COMPLETED, CommonStatusMessage.COMPLETED); }

Target:
public synchronized @NonNull TmfModelResponse<@NonNull List<@NonNull CriticalPathEntry>> fetchTree( @NonNull TimeQueryFilter filter, @Nullable IProgressMonitor monitor) { TmfGraph graph = fCriticalPathModule.getCriticalPath(); if (graph == null) { return new TmfModelResponse<>(null, Status.RUNNING, CommonStatusMessage.RUNNING); } HorizontalLinksVisitor visitor = fHorizontalVisitorCache.getUnchecked(getCurrent()); return new TmfModelResponse<>(visitor.getEntries(), Status.COMPLETED, CommonStatusMessage.COMPLETED); }
Source:
public void testLargeSize() { try { final int size = 1 + CircularBuffer.MAX_SIZE; CircularBuffer<Integer> instance = new CircularBuffer<Integer>(size); assert false; } catch (RuntimeException e) { System.out.format("Got expected exception: %s%n", e); } }

Target:
public void testLargeSize() { CircularBuffer<Integer> instance = new CircularBuffer<Integer>(1 + MAX_SIZE); }
Source:
public boolean performNextOperation(int completedChildCount) { getParameters().setCommandStep(getParameters().getNextCommandStep()); log.info("Command '{}' id '{}' executing step '{}'", getActionType(), getCommandId(), getParameters().getCommandStep()); switch (getParameters().getCommandStep()) { case PERFORM_LEASE_OPERATION: VmLeaseParameters leaseOperaionParams = buildLeaseOperationParams(); runInternalActionWithTasksContext(ActionType.PerformLeaseOperation, leaseOperaionParams); VmLeaseStep afterAddOrRemoveNextStep = getLeaseAction() == VDSCommandType.AddVmLease ? VmLeaseStep.UPDATE_LEASE_INFO : VmLeaseStep.COMPLETE; getParameters().setNextCommandStep(afterAddOrRemoveNextStep); break; case UPDATE_LEASE_INFO: runInternalAction(ActionType.UpdateLeaseInfo, getParameters(), cloneContext().withoutCompensationContext()); VmLeaseStep afterUpdateLeaseInfoNextStep = getParameters().isHotPlugLease() ? VmLeaseStep.HOT_PLUG_LEASE : VmLeaseStep.COMPLETE; getParameters().setNextCommandStep(afterUpdateLeaseInfoNextStep); break; case HOT_PLUG_LEASE: runInternalAction(ActionType.HotPlugLease, getParameters(), cloneContext().withoutCompensationContext()); getParameters().setNextCommandStep(VmLeaseStep.COMPLETE); break; case COMPLETE: setCommandStatus(CommandStatus.SUCCEEDED); return false; } persistCommandIfNeeded(); return true; }

Target:
public boolean performNextOperation(int completedChildCount) { getParameters().setCommandStep(getParameters().getNextCommandStep()); log.info("Command '{}' id '{}' executing step '{}'", getActionType(), getCommandId(), getParameters().getCommandStep()); switch (getParameters().getCommandStep()) { case PERFORM_LEASE_OPERATION: VmLeaseParameters leaseOperationParams = buildLeaseOperationParams(); runInternalActionWithTasksContext(ActionType.PerformLeaseOperation, leaseOperationParams); VmLeaseStep afterAddOrRemoveNextStep = getLeaseAction() == VDSCommandType.AddVmLease ? VmLeaseStep.UPDATE_LEASE_INFO : VmLeaseStep.COMPLETE; getParameters().setNextCommandStep(afterAddOrRemoveNextStep); break; case UPDATE_LEASE_INFO: runInternalAction(ActionType.UpdateLeaseInfo, getParameters(), cloneContext().withoutCompensationContext()); VmLeaseStep afterUpdateLeaseInfoNextStep = getParameters().isHotPlugLease() ? VmLeaseStep.HOT_PLUG_LEASE : VmLeaseStep.COMPLETE; getParameters().setNextCommandStep(afterUpdateLeaseInfoNextStep); break; case HOT_PLUG_LEASE: runInternalAction(ActionType.HotPlugLease, getParameters(), cloneContext().withoutCompensationContext()); getParameters().setNextCommandStep(VmLeaseStep.COMPLETE); break; case COMPLETE: setCommandStatus(CommandStatus.SUCCEEDED); return false; } persistCommandIfNeeded(); return true; }
Source:
public void handleInputCommand(Command command, ChannelUID channelUID, int zone) throws IOException { if (command instanceof RefreshType) { logger.debug("handleInputCommand RefreshType {}", zone); try { SonyAudioConnection.SonyAudioInput result = input_cache[zone].getValue(); if (result != null) { if (zone > 0) { input_zone.put(zone, result.input); } updateState(channelUID, inputSource(result.input)); if (result.radio_freq.isPresent()) { updateState(SonyAudioBindingConstants.CHANNEL_RADIO_FREQ, new DecimalType(result.radio_freq.get() / 1000000.0)); } } } catch (CompletionException ex) { throw new IOException(ex.getCause()); } } if (command instanceof StringType) { logger.debug("handleInputCommand set {}", zone, command); connection.setInput(setInputCommand(command), zone); } }

Target:
public void handleInputCommand(Command command, ChannelUID channelUID, int zone) throws IOException { if (command instanceof RefreshType) { logger.debug("handleInputCommand RefreshType {}", zone); try { SonyAudioConnection.SonyAudioInput result = inputCache[zone].getValue(); if (result != null) { if (zone > 0) { input_zone.put(zone, result.input); } updateState(channelUID, inputSource(result.input)); if (result.radio_freq.isPresent()) { updateState(SonyAudioBindingConstants.CHANNEL_RADIO_FREQ, new DecimalType(result.radio_freq.get() / 1000000.0)); } } } catch (CompletionException ex) { throw new IOException(ex.getCause()); } } if (command instanceof StringType) { logger.debug("handleInputCommand set {}", zone, command); connection.setInput(setInputCommand(command), zone); } }
Source:
protected void commandFailed(ICommandToken token, int statusCode, String errorMessage) { if ( !(token instanceof CommandHandle && token.getCommand() instanceof MICommand<?>) ) return; final CommandHandle commandHandle = (CommandHandle)token; Integer tokenId = commandHandle.getTokenId(); synchronized(fRxCommands) { CommandHandle h = fRxCommands.remove(tokenId); if (h == null) return; } MIConst value = new MIConst(); value.setCString(errorMessage); MIResult result = new MIResult(); result.setVariable("msg"); result.setMIValue(value); MIResultRecord resultRecord = new MIResultRecord(); resultRecord.setToken(tokenId.intValue()); resultRecord.setResultClass(MIResultRecord.ERROR); resultRecord.setMIResults(new MIResult[] { result }); MIOutput miOutput = new MIOutput(resultRecord, new MIOOBRecord[0]); final MIInfo info = commandHandle.getCommand().getResult(miOutput); DataRequestMonitor<MIInfo> rm = commandHandle.getRequestMonitor(); if ( rm != null ) { rm.setData(info); rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, statusCode, errorMessage, null)); if (commandHandle.getRequestMonitor() != null) { commandHandle.getRequestMonitor().done(); } processCommandDone(commandHandle, info); } }

Target:
protected void commandFailed(ICommandToken token, int statusCode, String errorMessage) { if ( !(token instanceof CommandHandle && token.getCommand() instanceof MICommand<?>) ) return; final CommandHandle commandHandle = (CommandHandle)token; Integer tokenId = commandHandle.getTokenId(); CommandHandle h = fRxCommands.remove(tokenId); if (h == null) return; MIConst value = new MIConst(); value.setCString(errorMessage); MIResult result = new MIResult(); result.setVariable("msg"); result.setMIValue(value); MIResultRecord resultRecord = new MIResultRecord(); resultRecord.setToken(tokenId.intValue()); resultRecord.setResultClass(MIResultRecord.ERROR); resultRecord.setMIResults(new MIResult[] { result }); MIOutput miOutput = new MIOutput(resultRecord, new MIOOBRecord[0]); final MIInfo info = commandHandle.getCommand().getResult(miOutput); DataRequestMonitor<MIInfo> rm = commandHandle.getRequestMonitor(); if ( rm != null ) { rm.setData(info); rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, statusCode, errorMessage, null)); rm.done(); processCommandDone(commandHandle, info); } }
Source:
public @NonNull ITmfCommonXAxisResponse fetchXY(@NonNull TimeQueryFilter filter, @Nullable IProgressMonitor monitor) { long[] xValues = filter.getTimesRequested(); int n = xValues.length; double[] y = new double[n]; long[] yLong = new long[n]; for (ITmfTrace trace : TmfTraceManager.getTraceSet(getTrace())) { final TmfStatisticsModule statsMod = TmfTraceUtils.getAnalysisModuleOfClass(trace, TmfStatisticsModule.class, TmfStatisticsModule.ID); if (statsMod == null) { continue; } statsMod.waitForInitialization(); final ITmfStatistics stats = Objects.requireNonNull(statsMod.getStatistics()); List<Long> values = stats.histogramQuery(filter.getStart(), filter.getEnd(), n); for (int i = 0; i < n; i++) { yLong[i] += values.get(i); } } for (int i = 0; i < n; i++) { y[i] = yLong[i]; } String title = Messages.HistogramDataProvider_Title; ImmutableMap.Builder<String, IYModel> ySeries = ImmutableMap.builder(); String seriesName = Messages.HistogramDataProvider_NumberOfEvent; ySeries.put(seriesName, new YModel(seriesName, y)); return TmfCommonXAxisResponseFactory.create(title, xValues, ySeries.build(), filter.getEnd(), true); }

Target:
public @NonNull ITmfCommonXAxisResponse fetchXY(@NonNull TimeQueryFilter filter, @Nullable IProgressMonitor monitor) { long[] xValues = filter.getTimesRequested(); int n = xValues.length; double[] y = new double[n]; long[] yLong = new long[n]; for (ITmfTrace trace : TmfTraceManager.getTraceSet(getTrace())) { final TmfStatisticsModule statsMod = TmfTraceUtils.getAnalysisModuleOfClass(trace, TmfStatisticsModule.class, TmfStatisticsModule.ID); if (statsMod == null) { continue; } statsMod.waitForInitialization(); final ITmfStatistics stats = Objects.requireNonNull(statsMod.getStatistics()); List<Long> values = stats.histogramQuery(filter.getStart(), filter.getEnd(), n); for (int i = 0; i < n; i++) { yLong[i] += values.get(i); } } for (int i = 0; i < n; i++) { y[i] = yLong[i]; } String title = Objects.requireNonNull(Messages.HistogramDataProvider_Title); String seriesName = Objects.requireNonNull(Messages.HistogramDataProvider_NumberOfEvent); Map<String, IYModel> ySeries = ImmutableMap.of(seriesName, new YModel(seriesName, y)); return TmfCommonXAxisResponseFactory.create(title, xValues, ySeries, filter.getEnd(), true); }
Source:
private void notifyRepoOpening(boolean isPrimaryRepository) { if (isPrimaryRepository) { Platform.runLater(() -> UI.events.triggerEvent(new PrimaryRepoOpeningEvent())); } else { Platform.runLater(() -> UI.events.triggerEvent(new FilterRepoOpeningEvent())); } }

Target:
private void notifyRepoOpening(boolean isPrimaryRepository) { Event eventToTrigger = isPrimaryRepository ? new PrimaryRepoOpeningEvent() : new FilterRepoOpeningEvent(); Platform.runLater(() -> UI.events.triggerEvent(eventToTrigger)); }
Source:
private static ServerSocketEndpointConfig createWanEndpointConfig() { ServerSocketEndpointConfig endpointConfig = new ServerSocketEndpointConfig(); endpointConfig.setName("active-wan") .setSSLConfig(new SSLConfig() .setEnabled(true) .setProperty("trustStore", "truststore") .setProperty("trustStorePassword", System.getenv("KEYSTORE_PASSWORD"))); endpointConfig.setPort(8443) .setPublicAddress("147.102.1.10:8443"); return endpointConfig; }

Target:
private static ServerSocketEndpointConfig createWanEndpointConfig() { ServerSocketEndpointConfig endpointConfig = new ServerSocketEndpointConfig(); endpointConfig.setName("active-wan") .setSSLConfig(new SSLConfig() .setEnabled(true) .setFactoryClassName("com.hazelcast.nio.ssl.BasicSSLContextFactory") .setProperty("keyStore", "/home/hazelcast/hazelcast.p12") .setProperty("keyStorePassword", System.getenv("KEYSTORE_PASSWORD"))); endpointConfig.setPort(8443) .setPublicAddress("147.102.1.10:8443"); return endpointConfig; }
Source:
public CorfuQueue(CorfuRuntime runtime, String streamName) { this(runtime, streamName, Serializers.JSON, CorfuTable.IndexRegistry.empty()); }

Target:
public CorfuQueue(CorfuRuntime runtime, String streamName) { this(runtime, streamName, Serializers.getDefaultSerializer(), IndexRegistry.empty()); }