auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public IResource getResource() { ByteArrayOutputStream webResponse = new ByteArrayOutputStream(); AbstractSelect2Choice.generateJSON(getChoiceProvider(), webResponse); StringResourceStream resourceStream = new StringResourceStream(webResponse.toString(), "application/json"); return new ResourceStreamResource(resourceStream); }

Target:
public IResource getResource() { ByteArrayOutputStream webResponse = new ByteArrayOutputStream(); AbstractSelect2Choice.generateJSON(getChoiceProvider(), webResponse); StringResourceStream resourceStream; try { resourceStream = new StringResourceStream(webResponse.toString("UTF-8"), "application/json"); } catch (UnsupportedEncodingException e) { logger.error("getResource", e); throw new WicketRuntimeException(e); } return new ResourceStreamResource(resourceStream); }
Source:
protected void doFullEntryScan(Predicate predicate, Set<Map.Entry<K, V>> resultingSet) { InternalSerializationService serializationService = this.serializationService; CachedQueryEntry queryEntry = new CachedQueryEntry(); Set<Map.Entry<Data, QueryCacheRecord>> entries = recordStore.entrySet(); for (Map.Entry<Data, QueryCacheRecord> entry : entries) { Data keyData = entry.getKey(); QueryCacheRecord record = entry.getValue(); Object value = record.getValue(); queryEntry.init(serializationService, keyData, value, extractors); boolean valid = predicate.apply(queryEntry); if (valid) { Object keyObject = queryEntry.getKey(); Object valueObject = toObject(queryEntry.getValueData()); Map.Entry simpleEntry = new AbstractMap.SimpleEntry(keyObject, valueObject); resultingSet.add(simpleEntry); } } }

Target:
protected void doFullEntryScan(Predicate predicate, Set<Map.Entry<K, V>> resultingSet) { InternalSerializationService serializationService = this.serializationService; CachedQueryEntry queryEntry = new CachedQueryEntry(); Set<Map.Entry<Data, QueryCacheRecord>> entries = recordStore.entrySet(); for (Map.Entry<Data, QueryCacheRecord> entry : entries) { Data keyData = entry.getKey(); QueryCacheRecord record = entry.getValue(); Object value = record.getValue(); queryEntry.init(serializationService, keyData, value, extractors); boolean valid = predicate.apply(queryEntry); if (valid) { Map.Entry simpleEntry = new LazyMapEntry(queryEntry.getKeyData(), queryEntry.getValueData(), serializationService); resultingSet.add(simpleEntry); } } }
Source:
public void visit(ClassVisitor visitor) { String signature = null; boolean isInterface = access.contains(INTERFACE); if (superClass.isGeneric() || any(interfaces, ParameterizedType::isGeneric)) { signature = genericClassSignature(superClass, interfaces); } String[] interfaces = new String[this.interfaces.size()]; for (int i = 0; i < interfaces.length; i++) { interfaces[i] = this.interfaces.get(i).getClassName(); } int accessModifier = toAccessModifier(access); visitor.visit(V1_7, isInterface ? accessModifier : accessModifier | ACC_SUPER, type.getClassName(), signature, superClass.getClassName(), interfaces); if (source != null) { visitor.visitSource(source, debug); } for (AnnotationDefinition annotation : annotations) { annotation.visitClassAnnotation(visitor); } for (FieldDefinition field : fields) { field.visit(visitor); } if (!isInterface) { classInitializer.visit(visitor, true); } for (MethodDefinition method : methods) { method.visit(visitor); } visitor.visitEnd(); }

Target:
public void visit(ClassVisitor visitor) { String signature = null; if (superClass.isGeneric() || any(interfaces, ParameterizedType::isGeneric)) { signature = genericClassSignature(superClass, interfaces); } String[] interfaces = new String[this.interfaces.size()]; for (int i = 0; i < interfaces.length; i++) { interfaces[i] = this.interfaces.get(i).getClassName(); } int accessModifier = toAccessModifier(access); visitor.visit(V1_7, isInterface() ? accessModifier : accessModifier | ACC_SUPER, type.getClassName(), signature, superClass.getClassName(), interfaces); if (source != null) { visitor.visitSource(source, debug); } for (AnnotationDefinition annotation : annotations) { annotation.visitClassAnnotation(visitor); } for (FieldDefinition field : fields) { field.visit(visitor); } if (!isInterface()) { classInitializer.visit(visitor, true); } for (MethodDefinition method : methods) { method.visit(visitor); } visitor.visitEnd(); }
Source:
public long getLastModified(ResourceInfo src) { if (src.url != null) { URLConnection conn = null; try { conn = src.url.openConnection(); final long v = conn.getLastModified(); return v != -1 ? v : 0; } catch (Throwable ex) { return -1; } finally { if (conn != null) { try { conn.getInputStream().close(); } catch (Exception ignored) { } } } } final long v = src.file.lastModified(); return v == -1 ? 0 : v == 0 ? -1 : v; }

Target:
public long getLastModified(ResourceInfo src) { if (src.url != null) { URLConnection conn = null; try { conn = src.url.openConnection(); final long v = conn.getLastModified(); return v != -1 ? v : 0; } catch (Throwable ex) { return -1; } finally { if (conn != null) { try { conn.getInputStream().close(); } catch (Throwable e) { log.warn("The connection cannot be closed", e); } } } } final long v = src.file.lastModified(); return v == -1 ? 0 : v == 0 ? -1 : v; }
Source:
public void removeRecipe(IItemStack output) { throw new IllegalArgumentException( "The Pure daisy does not output IItemStacks, use removeRecipeByBlock(MCBlockState)!"); }

Target:
public void removeRecipe(IItemStack output) { throw new IllegalArgumentException( "The Pure Daisy does not output IItemStacks, use removeRecipeByBlock(MCBlockState)!"); }
Source:
public LayoutElementParcelable(Parcel im) { filetype = im.readInt(); iconData = im.readParcelable(IconDataParcelable.class.getClassLoader()); title = im.readString(); desc = im.readString(); permissions = im.readString(); symlink = im.readString(); int j = im.readInt(); date = im.readLong(); dateModification = im.readString(); int i = im.readInt(); header = i != 0; isDirectory = j != 0; size = im.readString(); longSize=im.readLong(); }

Target:
public LayoutElementParcelable(Parcel im) { filetype = im.readInt(); iconData = im.readParcelable(IconDataParcelable.class.getClassLoader()); title = im.readString(); desc = im.readString(); permissions = im.readString(); symlink = im.readString(); int j = im.readInt(); date = im.readLong(); int i = im.readInt(); header = i != 0; isDirectory = j != 0; dateModification = im.readString(); size = im.readString(); longSize=im.readLong(); }
Source:
protected void newSelection(ISelection selection) { List<IStoreItem> res = new ArrayList<IStoreItem>(); if (selection instanceof StructuredSelection) { StructuredSelection str = (StructuredSelection) selection; Iterator<?> iter = str.iterator(); while (iter.hasNext()) { Object object = (Object) iter.next(); if (object instanceof IAdaptable) { IAdaptable ad = (IAdaptable) object; IStoreItem coll = (IStoreItem) ad.getAdapter(IStoreItem.class); if (coll != null) { res.add(coll); } } } } clearChangeListeners(); if (res.size() > 0) { if (appliesToMe(res, aTests)) { curList.addAll(res); Iterator<IStoreItem> iter = curList.iterator(); while (iter.hasNext()) { IStoreItem iC = iter.next(); iC.addChangeListener(changeListener); } } } display(res); }

Target:
protected void newSelection(ISelection selection) { List<IStoreItem> res = new ArrayList<IStoreItem>(); if (selection instanceof StructuredSelection) { StructuredSelection str = (StructuredSelection) selection; Iterator<?> iter = str.iterator(); while (iter.hasNext()) { Object object = (Object) iter.next(); if (object instanceof IAdaptable) { IAdaptable ad = (IAdaptable) object; IStoreItem coll = (IStoreItem) ad.getAdapter(IStoreItem.class); if (coll != null) { res.add(coll); } } } } clearChangeListeners(); if (res.size() > 0) { if (appliesToMe(res, aTests)) { curList.addAll(res); Iterator<IStoreItem> iter = curList.iterator(); while (iter.hasNext()) { IStoreItem iC = iter.next(); iC.addChangeListener(changeListener); } display(res); } } }
Source:
public List<String> getPushOptions() throws RequestNotYetReadException { if (enabledCapabilities == null) throw new RequestNotYetReadException(); return Collections.unmodifiableList(pushOptions); }

Target:
public List<String> getPushOptions() throws RequestNotYetReadException { if (enabledCapabilities == null) { throw new RequestNotYetReadException(); } return Collections.unmodifiableList(pushOptions); }
Source:
public Dataset<Row> apply(Dataset<Row> df) { df = mergeAlgorithms(df); df = withSuggestionScore(df); df = filterToBestSuggestions(df); df = df.select( col("algos").alias(METHOD), col("wikiid").alias(WIKI), col(SUGGESTION_SCORE), col(QUERY), col(DYM)); if (!df.schema().sameType(SCHEMA_OUT)) { df.printSchema(); throw new SchemaInconsistencyException("Output does not match expected schema!"); } return df; }

Target:
public Dataset<Row> apply(Dataset<Row> df) { df = mergeAlgorithms(df); df = withSuggestionScore(df); df = filterToBestSuggestions(df); df = df.select( col("algos").alias("method"), col("wikiid").alias("wiki"), col("suggestion_score"), col("query"), col("dym")); StructType schema = df.schema(); if (!schema.sameType(SCHEMA_OUT)) { throw new SchemaInconsistencyException( "Output does not match expected schema!", schema); } return df; }
Source:
public void traceRangeUpdated(TmfTraceRangeUpdatedSignal signal) { ITmfTrace trace = signal.getTrace(); if (!isListeningTo(trace)) { return; } synchronized (fStatisticsRangeUpdateSyncObj) { if (fSendRangeRequest) { fSendRangeRequest = false; requestTimeRangeData(trace, signal.getRange()); } } requestData(trace, signal.getRange()); }

Target:
public void traceRangeUpdated(TmfTraceRangeUpdatedSignal signal) { ITmfTrace trace = signal.getTrace(); if (!isListeningTo(trace)) { return; } synchronized (fStatisticsRangeUpdateSyncObj) { if (fSendRangeRequest) { fSendRangeRequest = false; requestTimeRangeData(trace, fTrace.getCurrentRange()); } } requestData(trace, signal.getRange()); }
Source:
public void searchPayments_errorWhenCardDigitsAreInvalid() throws Exception { InputStream body = searchPayments(API_KEY, ImmutableMap.<String, String>builder() .put("reference", VALID_REFERENCE) .put("email", VALID_EMAIL) .put("state", VALID_STATE) .put("first_digits_card_number", "4242") .put("last_digits_card_number", "423") .put("from_date", VALID_FROM_DATE) .put("to_date", VALID_TO_DATE) .build() ) .statusCode(422) .contentType(JSON).extract() .body().asInputStream(); String json = IOUtils.toString(body, "UTF-8"); JsonAssert.with(json) .assertThat("$.*", hasSize(2)) .assertThat("$.code", is("P0401")) .assertThat("$.description", is("Invalid parameters: first_digits_card_number, last_digits_card_number. See Public API documentation for the correct data formats")); }

Target:
public void searchPayments_errorWhenCardDigitsAreInvalid() throws Exception { InputStream body = searchPayments(API_KEY, ImmutableMap.<String, String>builder() .put("reference", VALID_REFERENCE) .put("email", VALID_EMAIL) .put("state", VALID_STATE) .put("first_digits_card_number", "4a4234") .put("last_digits_card_number", "423") .put("from_date", VALID_FROM_DATE) .put("to_date", VALID_TO_DATE) .build() ) .statusCode(422) .contentType(JSON).extract() .body().asInputStream(); String json = IOUtils.toString(body, "UTF-8"); JsonAssert.with(json) .assertThat("$.*", hasSize(2)) .assertThat("$.code", is("P0401")) .assertThat("$.description", is("Invalid parameters: first_digits_card_number, last_digits_card_number. See Public API documentation for the correct data formats")); }
Source:
public final void start(LeaderContender contender) throws Exception { Preconditions.checkNotNull(contender, "Contender must not be null."); Preconditions.checkState(leaderContender == null, "Contender was already set."); LOG.info("Starting LeaderElectionService {}.", this); synchronized (lock) { leaderContender = contender; running = true; leaderElectionDriver.start(leaderElectionStateHandle); } }

Target:
public final void start(LeaderContender contender) throws Exception { checkNotNull(contender, "Contender must not be null."); Preconditions.checkState(leaderContender == null, "Contender was already set."); synchronized (lock) { leaderContender = contender; leaderElectionDriver = leaderElectionDriverFactory.createLeaderElectionDriver( this, new LeaderElectionFatalErrorHandler(), leaderContender.getDescription()); LOG.info("Starting DefaultLeaderElectionService with {}.", leaderElectionDriver); running = true; } }
Source:
public static void bindCompletionProcessor(final AbstractPropertySection section, IAssistContentProvider assistContentProvider, final Text text) { List<IAssistContentProvider> extension = EclipseUtil.getExtensionPlugins(IAssistContentProvider.class, IAssistContentProvider.ID, IAssistContentProvider.CLASS_ATTRIBUTE); if (!(extension.size() == 0)) { assistContentProvider.setView(section); IBindingService bindingService = PlatformUI.getWorkbench().getService(IBindingService.class); TriggerSequence[] activeBindinds = bindingService.getActiveBindingsFor(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); if (activeBindinds != null && activeBindinds.length > 0) { TriggerSequence sequence = activeBindinds[0]; KeyStroke keyStroke = getKeyStroke(sequence); TextContentAdapter textContentAdapter = new TextContentAdapter(); ContentProposalAdapter adapter = new ContentProposalAdapter(text, textContentAdapter, assistContentProvider, keyStroke, IAssistContentProvider.AUTO_ACTIVATION_CHARACTERS); adapter.setPopupSize(new Point(500, 300)); adapter.addContentProposalListener(assistContentProvider); } } }

Target:
public static void bindCompletionProcessor(final AbstractPropertySection section, IAssistContentProvider assistContentProvider, final Text text) { IAssistContentProvider contentProposalAdapter = Optional.ofNullable(assistContentProvider).orElseGet(TypeContentProposalProvider::getIAssistContentProvider); if (contentProposalAdapter != null) { contentProposalAdapter.setView(section); IBindingService bindingService = PlatformUI.getWorkbench().getService(IBindingService.class); TriggerSequence[] activeBindinds = bindingService.getActiveBindingsFor(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS); if (activeBindinds != null && activeBindinds.length > 0) { TriggerSequence sequence = activeBindinds[0]; KeyStroke keyStroke = getKeyStroke(sequence); TextContentAdapter textContentAdapter = new TextContentAdapter(); ContentProposalAdapter adapter = new ContentProposalAdapter(text, textContentAdapter, contentProposalAdapter, keyStroke, IAssistContentProvider.AUTO_ACTIVATION_CHARACTERS); adapter.setPopupSize(new Point(500, 300)); adapter.addContentProposalListener(contentProposalAdapter); } } }
Source:
public void setup() { argument = new ShardConsumerArgument(shardInfo, STREAM_NAME, leaseRefresher, executorService, recordsPublisher, shardRecordProcessor, checkpointer, recordProcessorCheckpointer, parentShardPollIntervalMillis, taskBackoffTimeMillis, skipShardSyncAtWorkerInitializationIfLeasesExist, listShardsBackoffTimeInMillis, maxListShardsRetryAttempts, shouldCallProcessRecordsEvenForEmptyRecordList, idleTimeInMillis, INITIAL_POSITION_IN_STREAM, cleanupLeasesOfCompletedShards, ignoreUnexpectedChildShards, shardDetector, new AggregatorUtil(), new HierarchichalShardSyncer(), metricsFactory); consumer = spy( new ShardConsumer(recordsPublisher, executorService, shardInfo, logWarningForTaskAfterMillis, argument)); when(shardInfo.shardId()).thenReturn("shardId-000000000000"); when(recordProcessorCheckpointer.checkpointer()).thenReturn(checkpointer); }

Target:
public void setup() { argument = new ShardConsumerArgument(shardInfo, STREAM_NAME, leaseRefresher, executorService, recordsPublisher, shardRecordProcessor, checkpointer, recordProcessorCheckpointer, parentShardPollIntervalMillis, taskBackoffTimeMillis, skipShardSyncAtWorkerInitializationIfLeasesExist, listShardsBackoffTimeInMillis, maxListShardsRetryAttempts, shouldCallProcessRecordsEvenForEmptyRecordList, idleTimeInMillis, INITIAL_POSITION_IN_STREAM, cleanupLeasesOfCompletedShards, ignoreUnexpectedChildShards, shardDetector, new AggregatorUtil(), hierarchicalShardSyncer, metricsFactory); consumer = spy( new ShardConsumer(recordsPublisher, executorService, shardInfo, logWarningForTaskAfterMillis, argument)); when(shardInfo.shardId()).thenReturn("shardId-000000000000"); when(recordProcessorCheckpointer.checkpointer()).thenReturn(checkpointer); }
Source:
public void afterPropertiesSet() throws Exception { if (workingDir == null) { String apacheWorkDir = System.getProperty("apacheDSWorkDir"); if (apacheWorkDir == null) { apacheWorkDir = createTempDirectory("apacheds-spring-security-"); } setWorkingDirectory(new File(apacheWorkDir)); } if (this.ldapOverSslEnabled && this.keyStoreFile == null) { throw new IllegalArgumentException("When LdapOverSsl is enabled, the keyStoreFile property must be set."); } server = new LdapServer(); server.setDirectoryService(service); if (this.port == 0) { this.port = getRandomPort(); } TcpTransport transport = new TcpTransport(port); if (ldapOverSslEnabled) { transport.setEnableSSL(true); server.setKeystoreFile(this.keyStoreFile.getAbsolutePath()); server.setCertificatePassword(this.certificatePassord); } server.setTransports(transport); start(); }

Target:
public void afterPropertiesSet() throws Exception { if (workingDir == null) { String apacheWorkDir = System.getProperty("apacheDSWorkDir"); if (apacheWorkDir == null) { apacheWorkDir = createTempDirectory("apacheds-spring-security-"); } setWorkingDirectory(new File(apacheWorkDir)); } if (this.ldapOverSslEnabled && this.keyStoreFile == null) { throw new IllegalArgumentException("When LdapOverSsl is enabled, the keyStoreFile property must be set."); } server = new LdapServer(); server.setDirectoryService(service); this.transport = new TcpTransport(port); if (ldapOverSslEnabled) { transport.setEnableSSL(true); server.setKeystoreFile(this.keyStoreFile.getAbsolutePath()); server.setCertificatePassword(this.certificatePassord); } server.setTransports(transport); start(); }
Source:
public IPAddress getAllocatedTask(final String appId) { final List<IPAddress> copiedList = new ArrayList<>(taskList); Collections.shuffle(copiedList); final IPAddress task0 = copiedList.get(0); final IPAddress task1 = copiedList.get(1); if (this.taskInfoMap.get(task0).getCpuLoad() < this.taskInfoMap.get(task1).getCpuLoad()) { return task0; } else { return task1; } }

Target:
public IPAddress getAllocatedTask(final String appId) { int index0, index1; index0 = random.nextInt(taskList.size()); index1 = random.nextInt(taskList.size()); while (index1 == index0) { index1 = random.nextInt(taskList.size()); } final IPAddress task0 = taskList.get(index0); final IPAddress task1 = taskList.get(index1); if (this.taskInfoMap.get(task0).getCpuLoad() < this.taskInfoMap.get(task1).getCpuLoad()) { return task0; } else { return task1; } }
Source:
public void setUp() { when(timeProvider.elapsedRealtime()).thenReturn((long) 0); }

Target:
public void setUp() { when(motionEvent.getDownTime()).thenReturn((long) 0); }
Source:
private Flux<PartitionEvent> createConsumer(String linkName, String partitionId, EventPosition startingPosition, ReceiveOptions receiveOptions) { return openPartitionConsumers .computeIfAbsent(linkName, name -> { logger.info("{}: Creating receive consumer for partition '{}'", linkName, partitionId); return createPartitionConsumer(name, partitionId, startingPosition, receiveOptions); }) .receive() .doFinally(signalType -> { logger.info("{}: Receiving completed. Signal: {}", linkName, signalType); final EventHubPartitionAsyncConsumer consumer = openPartitionConsumers.remove(linkName); if (consumer != null) { try { consumer.close(); } catch (IOException e) { logger.warning("Exception occurred while closing consumer {}", linkName, e); } } }); }

Target:
private Flux<PartitionEvent> createConsumer(String linkName, String partitionId, EventPosition startingPosition, ReceiveOptions receiveOptions) { return openPartitionConsumers .computeIfAbsent(linkName, name -> { logger.info("{}: Creating receive consumer for partition '{}'", linkName, partitionId); return createPartitionConsumer(name, partitionId, startingPosition, receiveOptions); }) .receive() .doFinally(signalType -> { logger.info("{}: Receiving completed. Partition: '{}'. Signal: '{}'", linkName, partitionId, signalType); final EventHubPartitionAsyncConsumer consumer = openPartitionConsumers.remove(linkName); if (consumer != null) { try { consumer.close(); } catch (IOException e) { logger.warning("Exception occurred while closing consumer {}", linkName, e); } } }); }
Source:
public MesosSlaveInfo getMesosSlaveInfoForLabel(Label label) { if (!matchesLabel(label)) { return null; } if (label.matches(Label.parse(getLabelString()))) { return this; } if (!containerInfo.getDockerImageCustomizable()) { return null; } String customImage = getCustomImage(label); if (customImage == null) { return null; } return copyWithDockerImage(label.toString(), customImage); }

Target:
public MesosSlaveInfo getMesosSlaveInfoForLabel(Label label) { if (!matchesLabel(label)) { return null; } if (label == null) { if (getLabelString() == null) { return this; } else { return null; } } if (label.matches(Label.parse(getLabelString()))) { return this; } if (!containerInfo.getDockerImageCustomizable()) { return null; } String customImage = getCustomImage(label); if (customImage == null) { return null; } return copyWithDockerImage(label.toString(), customImage); }
Source:
public void testSetTagsOnVirtualGuest() throws Exception { ImmutableSet<String> tags = ImmutableSet.of("test", "jclouds"); assertTrue(virtualGuestApi.setTags(virtualGuest.getId(), tags)); VirtualGuest found = virtualGuestApi.getVirtualGuest(virtualGuest.getId()); Set<TagReference> tagReferences = found.getTagReferences(); assertNotNull(tagReferences); for (String tag : tags) { assertThat(Iterables.contains(tagReferences, tag)).isTrue(); } }

Target:
public void testSetTagsOnVirtualGuest() throws Exception { ImmutableSet<String> tags = ImmutableSet.of("test", "jclouds"); assertTrue(virtualGuestApi.setTags(virtualGuest.getId(), tags)); VirtualGuest found = virtualGuestApi.getVirtualGuest(virtualGuest.getId()); Set<TagReference> tagReferences = found.getTagReferences(); assertNotNull(tagReferences); ImmutableSet.Builder<String> actualTagsBuilder = ImmutableSet.builder(); for (TagReference ref : tagReferences) { actualTagsBuilder.add(ref.getTag().getName()); } Set<String> actualTags = actualTagsBuilder.build(); assertThat(actualTags).containsAll(tags); }
Source:
private int setWifiTethering(final boolean enable) { int rval = TETHER_ERROR_MASTER_ERROR; final long ident = Binder.clearCallingIdentity(); try { synchronized (mPublicSync) { final WifiManager mgr = getWifiManager(); if (mgr == null) { mLog.e("setWifiTethering: failed to get WifiManager!"); return TETHER_ERROR_SERVICE_UNAVAIL; } if ((enable && mgr.startSoftAp(null )) || (!enable && mgr.stopSoftAp())) { mWifiTetherRequested = enable; return TETHER_ERROR_NO_ERROR; } return TETHER_ERROR_MASTER_ERRROR; } } finally { Binder.restoreCallingIdentity(ident); } if (rval != TETHER_ERROR_NO_ERROR) { mWifiTetherRequested = false; } return rval; }

Target:
private int setWifiTethering(final boolean enable) { int rval = TETHER_ERROR_MASTER_ERROR; final long ident = Binder.clearCallingIdentity(); try { synchronized (mPublicSync) { final WifiManager mgr = getWifiManager(); if (mgr == null) { mLog.e("setWifiTethering: failed to get WifiManager!"); return TETHER_ERROR_SERVICE_UNAVAIL; } if ((enable && mgr.startSoftAp(null )) || (!enable && mgr.stopSoftAp())) { mWifiTetherRequested = enable; return TETHER_ERROR_NO_ERROR; } return TETHER_ERROR_MASTER_ERRROR; } } finally { Binder.restoreCallingIdentity(ident); } return rval; }
Source:
private <T> T resolveSchedulerBean(Class<T> schedulerType) { try { return resolveSchedulerBean(schedulerType, false); } catch (NoUniqueBeanDefinitionException ex) { return resolveSchedulerBean(schedulerType, true); } catch (NoSuchBeanDefinitionException ex2) { return null; } }

Target:
private <T> T resolveSchedulerBean(Class<T> schedulerType) { try { return resolveSchedulerBeanByType(schedulerType); } catch (NoUniqueBeanDefinitionException ex) { return resolveSchedulerBeanByName(schedulerType); } catch (NoSuchBeanDefinitionException ex2) { return null; } }
Source:
public synchronized void start() throws Exception { final File setEnvFile = new File(configuration.getDirectory(), "bin" + File.separator + (SystemUtils.IS_OS_WINDOWS ? "setenv.bat" : "setenv")); if (setEnvFile != null && setEnvFile.exists()) { final File setEnvBacFile = new File(setEnvFile.getAbsolutePath() + ".backup"); setEnvFile.renameTo(setEnvBacFile); log.info("File '{}' was renamed to '{}' to ensure the propagation of own environment properties", setEnvFile.getName(), setEnvBacFile.getName()); } if (getConfiguration().getSshPort() != KarafConfiguration.DEFAULT_SSH_PORT) { setEtcProperty("sshPort", getConfiguration().getSshPort(), "org.apache.karaf.shell"); } configuration.getEnvProps().put("KARAF_REDIRECT", getStdoutLogFile().getAbsolutePath()); super.start(); addShutdownHook(new Thread(new Runnable() { public void run() { log.debug("Start shutdown sequence."); try { final ProcessBuilder processBuilder = new ProcessBuilder(configuration.generateStopCommand()); ProcessBuilderExecutor.syncExecute(processBuilder); } catch (Exception e) { throw new IllegalStateException("Karaf container was not stopped", e); } } })); addShutdownHook(new Thread(new Runnable() { @Override public void run() { try { while (ProcessUtils.getJavaPidByContainerId(getId()) != null) { log.debug("Stopping container..."); Thread.sleep(TimeUnit.SECONDS.toMillis(1)); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } })); }

Target:
public synchronized void start() throws Exception { final File setEnvFile = new File(configuration.getDirectory(), "bin" + File.separator + (SystemUtils.IS_OS_WINDOWS ? "setenv.bat" : "setenv")); if (setEnvFile != null && setEnvFile.exists()) { final File setEnvBacFile = new File(setEnvFile.getAbsolutePath() + ".backup"); setEnvFile.renameTo(setEnvBacFile); log.info("File '{}' was renamed to '{}' to ensure the propagation of own environment properties", setEnvFile.getName(), setEnvBacFile.getName()); } if (getConfiguration().getSshPort() != KarafConfiguration.DEFAULT_SSH_PORT) { setEtcProperty("sshPort", getConfiguration().getSshPort(), "org.apache.karaf.shell"); } configuration.getEnvProps().put("KARAF_REDIRECT", getStdoutLogFile().getAbsolutePath()); super.start(); addShutdownHook(new Thread(new Runnable() { public void run() { log.debug("Start shutdown sequence."); try { final ProcessBuilder processBuilder = new ProcessBuilder(configuration.generateStopCommand()); ProcessBuilderExecutor.syncExecute(processBuilder); } catch (Exception e) { throw new IllegalStateException("Karaf container was not stopped", e); } } })); }
Source:
private void updateQualityConditionsIfRequired(DbSession dbSession, QualityGateDto builtin) { List<QualityGateCondition> qualityGateConditions = qualityGateConditionDao.selectForQualityGate(dbSession, builtin.getId()) .stream() .map(dto -> { MetricDto metricDto = dbClient.metricDao().selectById(dbSession, dto.getMetricId()); if (metricDto != null) { dto.setMetricKey(metricDto.getKey()); } return QualityGateCondition.from(dto); }) .collect(MoreCollectors.toList()); List<QualityGateCondition> qgConditionsToBeDeleted = new ArrayList<>(qualityGateConditions); qgConditionsToBeDeleted.removeAll(QUALITY_GATE_CONDITIONS); qgConditionsToBeDeleted.stream() .forEach(qgc -> qualityGateConditionDao.delete(qgc.toQualityGateDto(builtin.getId()), dbSession)); List<QualityGateCondition> qgConditionsToBeCreated = new ArrayList<>(QUALITY_GATE_CONDITIONS); qgConditionsToBeCreated.removeAll(qualityGateConditions); qgConditionsToBeCreated.stream() .forEach(qgc -> qualityGateConditionsUpdater.createCondition(dbSession, builtin.getId(), qgc.getMetricKey(), qgc.getOperator(), qgc.getWarningThreshold(), qgc.getErrorThreshold(), qgc.getPeriod()) ); if (!qgConditionsToBeCreated.isEmpty() || !qgConditionsToBeDeleted.isEmpty()) { LOGGER.info("Built-in qualite gate's conditions[{}] has been updated", BUILTIN_QUALITY_GATE_NAME); } }

Target:
private void updateQualityConditionsIfRequired(DbSession dbSession, QualityGateDto builtin) { Map<Long, String> idToKeyMetric = dbClient.metricDao().selectAll(dbSession).stream() .collect(toMap(metricDto -> metricDto.getId().longValue(), MetricDto::getKey)); List<QualityGateCondition> qualityGateConditions = qualityGateConditionDao.selectForQualityGate(dbSession, builtin.getId()) .stream() .map(dto -> QualityGateCondition.from(dto, idToKeyMetric)) .collect(MoreCollectors.toList()); List<QualityGateCondition> qgConditionsToBeDeleted = new ArrayList<>(qualityGateConditions); qgConditionsToBeDeleted.removeAll(QUALITY_GATE_CONDITIONS); qgConditionsToBeDeleted.stream() .forEach(qgc -> qualityGateConditionDao.delete(qgc.toQualityGateDto(builtin.getId()), dbSession)); List<QualityGateCondition> qgConditionsToBeCreated = new ArrayList<>(QUALITY_GATE_CONDITIONS); qgConditionsToBeCreated.removeAll(qualityGateConditions); qgConditionsToBeCreated.stream() .forEach(qgc -> qualityGateConditionsUpdater.createCondition(dbSession, builtin.getId(), qgc.getMetricKey(), qgc.getOperator(), qgc.getWarningThreshold(), qgc.getErrorThreshold(), qgc.getPeriod()) ); if (!qgConditionsToBeCreated.isEmpty() || !qgConditionsToBeDeleted.isEmpty()) { LOGGER.info("Built-in quality gate's conditions of has been updated", BUILTIN_QUALITY_GATE_NAME); } }
Source:
public void getAwsSecurityCredentials_fromMetadataServer() throws IOException { MockExternalAccountCredentialsTransportFactory transportFactory = new MockExternalAccountCredentialsTransportFactory(); AwsCredentials awsCredential = (AwsCredentials) AwsCredentials.newBuilder(AWS_CREDENTIAL) .setHttpTransportFactory(transportFactory) .setCredentialSource(buildAwsCredentialSource(transportFactory)) .build(); AwsSecurityCredentials credentials = awsCredential.getAwsSecurityCredentials(); assertEquals(credentials.getAccessKeyId(), "accessKeyId"); assertEquals(credentials.getSecretAccessKey(), "secretAccessKey"); assertEquals(credentials.getToken(), "token"); }

Target:
public void getAwsSecurityCredentials_fromMetadataServer() throws IOException { MockExternalAccountCredentialsTransportFactory transportFactory = new MockExternalAccountCredentialsTransportFactory(); AwsCredentials awsCredential = (AwsCredentials) AwsCredentials.newBuilder(AWS_CREDENTIAL) .setHttpTransportFactory(transportFactory) .setCredentialSource(buildAwsCredentialSource(transportFactory)) .build(); AwsSecurityCredentials credentials = awsCredential.getAwsSecurityCredentials(); assertEquals("accessKeyId", credentials.getAccessKeyId()); assertEquals("secretAccessKey", credentials.getSecretAccessKey()); assertEquals("token", credentials.getToken()); }
Source:
private static boolean isScopeSingleton(SymbolMetadata clazzMeta) { List<AnnotationValue> values = clazzMeta.valuesForAnnotation(SCOPE_ANNOTATION_FQN); for (AnnotationValue annotationValue : values) { if ("value".equals(annotationValue.name()) || "scopeName".equals(annotationValue.name())) { String scopeValue = ((LiteralTree) annotationValue.value()).value(); if (!"\"singleton\"".equals(scopeValue)) { return false; } } } return true; }

Target:
private static boolean isScopeSingleton(SymbolMetadata clazzMeta) { List<AnnotationValue> values = clazzMeta.valuesForAnnotation(SCOPE_ANNOTATION_FQN); for (AnnotationValue annotationValue : values) { if (("value".equals(annotationValue.name()) || "scopeName".equals(annotationValue.name())) && annotationValue.value() instanceof LiteralTree && !"\"singleton\"".equals(((LiteralTree) annotationValue.value()).value())) { return false; } } return true; }
Source:
private boolean writeOutput(Write write) { if (!inPlace) { synchronized (outputLock) { try { write.write(outWriter); } catch (IOException e) { errWriter.append("cannot write output: " + e.getMessage()).flush(); } outWriter.flush(); return true; } } else { String tempFileName = fileToFormat.fileName() + '#'; try (Writer writer = new OutputStreamWriter( new BufferedOutputStream(new FileOutputStream(tempFileName)), UTF_8)) { write.write(writer); outWriter.flush(); } catch (IOException e) { synchronized (outputLock) { errWriter .append(tempFileName) .append(": cannot write temp file: ") .append(e.getMessage()) .append('\n') .flush(); } return false; } try { Files.move( new File(tempFileName).toPath(), new File(fileToFormat.fileName()).toPath(), StandardCopyOption.REPLACE_EXISTING); } catch(IOException e) { synchronized (outputLock) { errWriter.append(tempFileName).append(": cannot rename temp file").append('\n').flush(); } return false; } return true; } }

Target:
private boolean writeOutput(Write write) { if (!inPlace) { synchronized (outputLock) { try { write.write(outWriter); } catch (IOException e) { errWriter.append("cannot write output: " + e.getMessage()).flush(); } outWriter.flush(); return true; } } else { String tempFileName = fileToFormat.fileName() + '#'; try (Writer writer = new OutputStreamWriter( new BufferedOutputStream(new FileOutputStream(tempFileName)), UTF_8)) { write.write(writer); outWriter.flush(); } catch (IOException e) { synchronized (outputLock) { errWriter .append(tempFileName) .append(": cannot write temp file: ") .append(e.getMessage()) .append('\n') .flush(); } return false; } try { Files.move( new File(tempFileName).toPath(), new File(fileToFormat.fileName()).toPath(), StandardCopyOption.REPLACE_EXISTING); } catch(IOException e) { synchronized (outputLock) { errWriter .append(tempFileName) .append(": cannot rename temp file: ") .append(e.getMessage()) .append('\n') .flush(); } return false; } return true; } }
Source:
public void setTasksStatusUp(Process process) throws DataException, IOException { Task currentTask = ServiceManager.getProcessService().getCurrentTask(process); setTaskStatusUp(currentTask); }

Target:
public void setTasksStatusUp(Process process) throws DataException, IOException { List<Task> currentTask = ServiceManager.getProcessService().getCurrentTasks(process); if (currentTask.isEmpty()) { activateNextTasks(process.getTasks()); return; } setTaskStatusUp(currentTask); }
Source:
public ImporterTopLevel getScope() { if (fScope instanceof ImporterTopLevel) return (ImporterTopLevel) fScope; return null; }

Target:
public ScriptableObject getScope() { return fScope; }
Source:
public HBaseDataSink(Class<? extends GenericTableOutputFormat> c, Contract input, String name) { super(c, input, name); final Random rnd = new Random(); final StringBuilder bld = new StringBuilder(); for (int i = 0; i < IDENTIFYIER_LEN; i++) { bld.append((char) (rnd.nextInt(26) + 'a')); } setParameter(GenericTableOutputFormat.JOB_ID_KEY, bld.toString()); setParameter(GenericTableOutputFormat.JOB_ID_KEY, rnd.nextInt()); }

Target:
public HBaseDataSink(Class<? extends GenericTableOutputFormat> c, Contract input, String name) { super(c, input, name); final Random rnd = new Random(); final StringBuilder bld = new StringBuilder(); for (int i = 0; i < IDENTIFYIER_LEN; i++) { bld.append((char) (rnd.nextInt(26) + 'a')); } setParameter(GenericTableOutputFormat.JT_ID_KEY, bld.toString()); setParameter(GenericTableOutputFormat.JOB_ID_KEY, rnd.nextInt()); }
Source:
public void testOpenExistingFileCompareEditor() throws Exception { editorReferences.add(getMockFileCompareEditor()); CompareEditorInput newInput = GerritCompareUi.getComparisonEditorInput( editorReferences.toArray(EMPTY_IEDITOR_REFERENCE_ARRAY), fileItemEditorInput, GerritCompareUi.getFileCompareFunction(item)); assertFalse(COMPARE_EDITOR_TITLE.equals(reviewItemSetEditorInput.getTitle())); assertTrue(COMPARE_EDITOR_TITLE.equals(newInput.getTitle())); }

Target:
public void testOpenExistingFileCompareEditor() throws Exception { editorReferences.add(getMockFileCompareEditor()); CompareEditorInput newInput = GerritCompareUi.getComparisonEditorInput( editorReferences.toArray(EMPTY_IEDITOR_REFERENCE_ARRAY), fileItemEditorInput, GerritCompareUi.getFileComparePredicate(item)); assertTrue(newInput != fileItemEditorInput); assertEquals(COMPARE_EDITOR_TITLE, newInput.getTitle()); }
Source:
public ConfigDescription getConfigDescription(URI uri, Locale locale) { if ("thing".equals(uri.getScheme()) == false) { return null; } ThingTypeUID thingTypeUID = new ThingTypeUID(uri.getSchemeSpecificPart()); ThingType thingType = thingTypeRegistry.getThingType(thingTypeUID); if (thingType == null) { return null; } URI configURI = thingType.getConfigDescriptionURI(); if (configURI == null) { return null; } ConfigDescription config = configDescriptionRegistry.getConfigDescription(configURI, locale); if (config == null) { return null; } return config; }

Target:
public ConfigDescription getConfigDescription(URI uri, Locale locale) { if ("thing".equals(uri.getScheme()) == false) { return null; } ThingUID thingUID = new ThingUID(uri.getSchemeSpecificPart()); ThingType thingType = thingTypeRegistry.getThingType(thingUID.getThingTypeUID()); if (thingType == null) { return null; } URI configURI = thingType.getConfigDescriptionURI(); if (configURI == null) { return null; } ConfigDescription config = configDescriptionRegistry.getConfigDescription(configURI, locale); if (config == null) { return null; } return config; }
Source:
public static int calculateDecodedLength(char[] encoded, int offset, int len) { if (len == 0) { return 0; } int numPaddings = 0; if (encoded[offset + len - 1] == PAD) { numPaddings = 1; if (len >= 2 && encoded[offset + len - 2] == PAD) { numPaddings = 2; } } int remainder = len % 4; if ((numPaddings == 0) && (remainder != 0)) { numPaddings = 4 - remainder; } return (((len + 3) / 4) * 3) - numPaddings; }

Target:
public static int calculateDecodedLength(char[] encoded, int offset, int len) { if (len == 0) return 0; if (len < 2) throw truncatedInput(); int numPaddings = 0; if (encoded[offset + len - 1] == PAD) { numPaddings = 1; if (encoded[offset + len - 2] == PAD) { numPaddings = 2; } } int remainder = len % 4; if ((numPaddings == 0) && (remainder != 0)) { numPaddings = 4 - remainder; } return (((len + 3) / 4) * 3) - numPaddings; }
Source:
public void testSourceStatusAvailable() throws Exception { SourceDescriptorImpl Descriptor = mock(SourceDescriptorImpl.class); when(Descriptor.isAvailable()).thenReturn(true); SourceInfoRequest Request = new SourceInfoRequestSources(false, Collections.singleton("sourceId")); SourceInfoResponse Response = new SourceInfoResponseImpl(Request, Collections.EMPTY_MAP, Descriptor); when(catalogFramework.getSourceInfo(any(SourceInfoRequest.class))).thenReturn(Response); assertThat(poller.sourceStatus(CONFIG_PID), is(true)); }

Target:
public void testSourceStatusAvailable() throws Exception { SourceDescriptor descriptor = mock(SourceDescriptor.class); when(descriptor.isAvailable()).thenReturn(true); when(descriptor.getLastAvailabilityDate()).thenReturn(new Date()); SourceInfoRequest request = new SourceInfoRequestSources(false, Collections.singleton("sourceId")); SourceInfoResponse response = new SourceInfoResponseImpl(request, Collections.EMPTY_MAP, descriptor); when(catalogFramework.getSourceInfo(any(SourceInfoRequest.class))).thenReturn(response); assertThat(poller.sourceStatus(CONFIG_PID), is(1)); }
Source:
public PrintStreamWarningsPrinter(PrintStream printStream) { this.printStream = requireNonNull(printStream, "printStream is null"); }

Target:
PrintStreamWarningsPrinter(PrintStream printStream) { super(OptionalInt.empty()); this.printStream = requireNonNull(printStream, "printStream is null"); }
Source:
private void getEligibleVolumes() { this.startProgress(constants.fetchingDataMessage()); AsyncQuery aQuery = new AsyncQuery(new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { GlusterVolumeGeoRepCreateModel.this.stopProgress(); VdcQueryReturnValue vdcReturnValue = (VdcQueryReturnValue) returnValue; if(!vdcReturnValue.getSucceeded()) { setQueryFailureMessage(vdcReturnValue.getExceptionString()); onPropertyChanged(new PropertyChangedEventArgs("queryFailed")); } else { List<GlusterVolumeEntity> eligibleVolumesList = (List<GlusterVolumeEntity>) vdcReturnValue.getReturnValue(); setVolumeList(eligibleVolumesList); getSlaveClusters().setItems(GlusterVolumeGeoRepCreateModel.this.getClusterForVolumes(eligibleVolumesList)); recommendationViolations = ""; onPropertyChanged(new PropertyChangedEventArgs("recommendationViolationVisibility")); } } }); Frontend.getInstance().runQuery(VdcQueryType.GetGlusterGeoReplicationEligibleVolumes, new IdQueryParameters(masterVolume.getId()), aQuery); }

Target:
public void getEligibleVolumes() { this.startProgress(constants.fetchingDataMessage()); AsyncQuery aQuery = new AsyncQuery(new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { GlusterVolumeGeoRepCreateModel.this.stopProgress(); VdcQueryReturnValue vdcReturnValue = (VdcQueryReturnValue) returnValue; if(!vdcReturnValue.getSucceeded()) { setQueryFailureMessage(vdcReturnValue.getExceptionString()); onPropertyChanged(new PropertyChangedEventArgs("queryFailed")); } else { List<GlusterVolumeEntity> eligibleVolumesList = (List<GlusterVolumeEntity>) vdcReturnValue.getReturnValue(); recommendationViolations = null; setVolumeList(eligibleVolumesList); getSlaveClusters().setItems(GlusterVolumeGeoRepCreateModel.this.getClusterForVolumes(eligibleVolumesList)); } } }); Frontend.getInstance().runQuery(VdcQueryType.GetGlusterGeoReplicationEligibleVolumes, new IdQueryParameters(masterVolume.getId()), aQuery); }
Source:
protected void updateSingleNic(XmlNode node, VmNetworkInterface iface) { iface.setName(node.SelectSingleNode(OvfProperties.VMD_NAME, _xmlNS).InnerText); iface.setMacAddress((node.SelectSingleNode("rasd:MACAddress", _xmlNS) != null) ? node.SelectSingleNode( "rasd:MACAddress", _xmlNS).InnerText : ""); String networkName = node.SelectSingleNode(OvfProperties.VMD_CONNECTION, _xmlNS).InnerText; if (StringUtils.isNotEmpty(networkName)) { iface.setNetworkName(networkName); } else { iface.setNetworkName(null); } XmlNode linkedNode = node.SelectSingleNode(OvfProperties.VMD_LINKED, _xmlNS); if (linkedNode != null) { iface.setLinked(Boolean.valueOf(linkedNode.InnerText)); } else { iface.setLinked(true); } String resourceSubType = node.SelectSingleNode("rasd:ResourceSubType", _xmlNS).InnerText; if (StringUtils.isNotEmpty(resourceSubType)) { iface.setType(Integer.parseInt(resourceSubType)); } XmlNode speed = node.SelectSingleNode("rasd:speed", _xmlNS); iface.setSpeed((speed != null) ? Integer.parseInt(speed.InnerText) : VmInterfaceType.forValue(iface.getType()) .getSpeed()); }

Target:
protected void updateSingleNic(XmlNode node, VmNetworkInterface iface) { iface.setName(node.SelectSingleNode(OvfProperties.VMD_NAME, _xmlNS).InnerText); iface.setMacAddress((node.SelectSingleNode("rasd:MACAddress", _xmlNS) != null) ? node.SelectSingleNode( "rasd:MACAddress", _xmlNS).InnerText : ""); String networkName = node.SelectSingleNode(OvfProperties.VMD_CONNECTION, _xmlNS).InnerText; iface.setNetworkName(StringUtils.defaultIfEmpty(networkName, null)); XmlNode linkedNode = node.SelectSingleNode(OvfProperties.VMD_LINKED, _xmlNS); iface.setLinked(linkedNode == null ? true : Boolean.valueOf(linkedNode.InnerText)); String resourceSubType = node.SelectSingleNode("rasd:ResourceSubType", _xmlNS).InnerText; if (StringUtils.isNotEmpty(resourceSubType)) { iface.setType(Integer.parseInt(resourceSubType)); } XmlNode speed = node.SelectSingleNode("rasd:speed", _xmlNS); iface.setSpeed((speed != null) ? Integer.parseInt(speed.InnerText) : VmInterfaceType.forValue(iface.getType()) .getSpeed()); }
Source:
private Credential getCredential( Configuration config, GoogleCloudStorageFileSystemOptions gcsFsOptions) throws IOException, GeneralSecurityException { Credential credential = null; ImmutableList<String> scopes = isImpersonatingServiceAccount(config) ? CredentialFactory.CLOUD_SCOPES : CredentialFactory.GCS_SCOPES; if (delegationTokens != null) { AccessTokenProvider atp = delegationTokens.getAccessTokenProvider(); if (atp != null) { atp.setConf(config); credential = CredentialFromAccessTokenProviderClassFactory.credential(atp, scopes); } } else { credential = CredentialFromAccessTokenProviderClassFactory.credential( config, ImmutableList.of(GCS_CONFIG_PREFIX), scopes); if (credential == null) { credential = HadoopCredentialConfiguration.getCredentialFactory(config, GCS_CONFIG_PREFIX) .getCredential(scopes); } } return getImpersonatedCredential(config, gcsFsOptions, credential).orElse(credential); }

Target:
private Credential getCredential( Configuration config, GoogleCloudStorageFileSystemOptions gcsFsOptions) throws IOException, GeneralSecurityException { Credential credential = null; if (delegationTokens != null) { AccessTokenProvider atp = delegationTokens.getAccessTokenProvider(); if (atp != null) { atp.setConf(config); credential = CredentialFromAccessTokenProviderClassFactory.credential( atp, CredentialFactory.GCS_SCOPES); } } else { credential = CredentialFromAccessTokenProviderClassFactory.credential( config, ImmutableList.of(GCS_CONFIG_PREFIX), CredentialFactory.GCS_SCOPES); if (credential == null) { credential = HadoopCredentialConfiguration.getCredentialFactory(config, GCS_CONFIG_PREFIX) .getCredential(CredentialFactory.GCS_SCOPES); } } return getImpersonatedCredential(config, gcsFsOptions, credential).orElse(credential); }
Source:
public void zoomToUser(GoogleMap map) { User myUser = User.getCurrentUser(); Location location = locationClient.getLastLocation(); if (location != null) { myUser.setLocation(location.getLatitude(), location.getLongitude()); myUser.saveEventually(); map.moveCamera(CameraUpdateFactory.newLatLngZoom( myUser.getGoogleMapsLocation(), 15)); } }

Target:
public void zoomToUser(GoogleMap map) { User myUser = User.getCurrentUser(); Location location = locationClient.getLastLocation(); if (location != null) { myUser.setLocation(location.getLatitude(), location.getLongitude()); myUser.saveEventually(); map.moveCamera(CameraUpdateFactory.newLatLngZoom( myUser.getGoogleMapsLocation(), USER_ZOOM_LEVEL)); } }
Source:
private CompletableFuture<?> waitForBookieInSet(BookieSocketAddress b, boolean writable) { log.info("Wait for to become {}", b, writable ? "writable" : "readonly"); CompletableFuture<Void> readOnlyFuture = new CompletableFuture<>(); CompletableFuture<Void> writableFuture = new CompletableFuture<>(); RegistrationListener readOnlyListener = (bookies) -> { boolean contains = bookies.getValue().contains(b); if ((!writable && contains) || (writable && !contains)) { readOnlyFuture.complete(null); } }; RegistrationListener writableListener = (bookies) -> { boolean contains = bookies.getValue().contains(b); if ((writable && contains) || (!writable && !contains)) { writableFuture.complete(null); } }; regClient.watchWritableBookies(writableListener); regClient.watchReadOnlyBookies(readOnlyListener); return CompletableFuture.allOf(writableFuture, readOnlyFuture); }

Target:
private Future<?> waitForBookieInSet(BookieSocketAddress b, boolean writable) { log.info("Wait for to become {}", b, writable ? "writable" : "readonly"); CompletableFuture<Void> readOnlyFuture = new CompletableFuture<>(); CompletableFuture<Void> writableFuture = new CompletableFuture<>(); RegistrationListener readOnlyListener = (bookies) -> { boolean contains = bookies.getValue().contains(b); if ((!writable && contains) || (writable && !contains)) { readOnlyFuture.complete(null); } }; RegistrationListener writableListener = (bookies) -> { boolean contains = bookies.getValue().contains(b); if ((writable && contains) || (!writable && !contains)) { writableFuture.complete(null); } }; regClient.watchWritableBookies(writableListener); regClient.watchReadOnlyBookies(readOnlyListener); return CompletableFuture.allOf(writableFuture, readOnlyFuture); }
Source:
public DecimalData next() { String value = String.format(fmt, ThreadLocalRandom.current().nextDouble(min, max)); BigDecimal decimal = new BigDecimal(value.trim(), new MathContext(precision, RoundingMode.DOWN)); return DecimalData.fromBigDecimal(decimal, precision, scale); }

Target:
public DecimalData next() { BigDecimal decimal = new BigDecimal( ThreadLocalRandom.current().nextDouble(min, max), new MathContext(precision, RoundingMode.DOWN)); return DecimalData.fromBigDecimal(decimal, precision, scale); }
Source:
public EnrichedSequenceNode createSequenceNode(Node node) { if (node == null) { return null; } return new Neo4jSequenceNode(service, node); }

Target:
public EnrichedSequenceNode createSequenceNode(Node node) { return new Neo4jSequenceNode(service, node); }