auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) { String keyPath = System.getProperty("user.dir") + "/target/mini-tests/WriteAheadLogEncryptedIT-testkeyfile"; cfg.setProperty(Property.TABLE_CRYPTO_SERVICE, "org.apache.accumulo.core.security.crypto.impl.AESCryptoService"); cfg.setProperty(TABLE_CRYPTO_PREFIX.getKey() + "kekId", keyPath); cfg.setProperty(TABLE_CRYPTO_PREFIX.getKey() + "keyManager", "uri"); cfg.setProperty(Property.TSERV_WALOG_MAX_SIZE, "2M"); cfg.setProperty(Property.GC_CYCLE_DELAY, "1"); cfg.setProperty(Property.GC_CYCLE_START, "1"); cfg.setProperty(Property.MASTER_RECOVERY_DELAY, "1s"); cfg.setProperty(Property.TSERV_MAJC_DELAY, "1"); cfg.setProperty(Property.INSTANCE_ZK_TIMEOUT, "15s"); hadoopCoreSite.set("fs.file.impl", RawLocalFileSystem.class.getName()); try { Path keyFile = new Path(keyPath); FileSystem fs = FileSystem.getLocal(CachedConfiguration.getInstance()); fs.delete(keyFile, true); if (fs.createNewFile(keyFile)) log.info("Created keyfile at {}", keyPath); else log.error("Failed to create key file at {}", keyPath); try (FSDataOutputStream out = fs.create(keyFile)) { out.writeUTF("sixteenbytekey"); } } catch (Exception e) { log.error("Exception during configure", e); } }

Target:
public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) { String keyPath = System.getProperty("user.dir") + "/target/mini-tests/WriteAheadLogEncryptedIT-testkeyfile"; cfg.setProperty(Property.INSTANCE_CRYPTO_SERVICE, "org.apache.accumulo.core.security.crypto.impl.AESCryptoService"); cfg.setProperty(INSTANCE_CRYPTO_PREFIX.getKey() + "kekId", keyPath); cfg.setProperty(INSTANCE_CRYPTO_PREFIX.getKey() + "keyManager", "uri"); cfg.setProperty(Property.TSERV_WALOG_MAX_SIZE, "2M"); cfg.setProperty(Property.GC_CYCLE_DELAY, "1"); cfg.setProperty(Property.GC_CYCLE_START, "1"); cfg.setProperty(Property.MASTER_RECOVERY_DELAY, "1s"); cfg.setProperty(Property.TSERV_MAJC_DELAY, "1"); cfg.setProperty(Property.INSTANCE_ZK_TIMEOUT, "15s"); hadoopCoreSite.set("fs.file.impl", RawLocalFileSystem.class.getName()); try { Path keyFile = new Path(keyPath); FileSystem fs = FileSystem.getLocal(CachedConfiguration.getInstance()); fs.delete(keyFile, true); if (fs.createNewFile(keyFile)) log.info("Created keyfile at {}", keyPath); else log.error("Failed to create key file at {}", keyPath); try (FSDataOutputStream out = fs.create(keyFile)) { out.writeUTF("sixteenbytekey"); } } catch (Exception e) { log.error("Exception during configure", e); } }
Source:
public static Set<FieldDeclaration> mergeFDs( DirectCompilerResult... sets ) { Set<FieldDeclaration> result = new HashSet<>(); for ( DirectCompilerResult fs : sets ) { result.addAll(fs.getFieldDeclarations()); } return result; }

Target:
public static Set<FieldDeclaration> mergeFDs( DirectCompilerResult... sets ) { return mergeFDs(Arrays.asList(sets)); }
Source:
private void removeAllAnnotations() { final Set<IAnnotationModel> annotationModels = new HashSet<>(); for (final History history : sourceToHistory.values()) while (!history.entries.isEmpty()) annotationModels.add(history.entries.peek().annotation.getModel()); for (final IAnnotationModel annotationModel : annotationModels) annotationModelHelper.removeAnnotationsFromModel( annotationModel, (a) -> a instanceof ContributionAnnotation); }

Target:
private void removeAllAnnotations() { removeFromHistoryAndAnnotationModel(sourceToHistory.values()); }
Source:
public List<Cookie> getAll() { try { lock.lock(); final boolean[] removeExpired = {false}; List<Cookie> result = cookieJar .entrySet() .parallelStream() .filter(pair -> { boolean hasCookieExpired = hasCookieExpired(pair.getValue().cookie, pair.getValue().createdAt); if (hasCookieExpired && !removeExpired[0]) removeExpired[0] = true; return !hasCookieExpired; }) .map(pair -> pair.getValue().cookie) .collect(Collectors.toList()); if (removeExpired[0]) removeExpired(); return result; } finally { lock.unlock(); } }

Target:
public List<Cookie> getAll() { final boolean[] removeExpired = {false}; List<Cookie> result = cookieJar .entrySet() .stream() .filter(pair -> { boolean hasCookieExpired = hasCookieExpired(pair.getValue().cookie, pair.getValue().createdAt); if (hasCookieExpired && !removeExpired[0]) removeExpired[0] = true; return !hasCookieExpired; }) .map(pair -> pair.getValue().cookie) .collect(Collectors.toList()); if (removeExpired[0]) removeExpired(); return result; }
Source:
public Object getObjectProperty(String key) { if (key.startsWith(AMQPMessageSupport.JMS_AMQP_MESSAGE_ANNOTATION_PREFIX)) { return getMessageAnnotation(key.substring(AMQPMessageSupport.JMS_AMQP_MESSAGE_ANNOTATION_PREFIX.length() - 1)); } else if (key.equals(MessageUtil.TYPE_HEADER_NAME.toString())) { if (properties != null) { return properties.getSubject(); } } else if (key.equals(MessageUtil.CONNECTION_ID_PROPERTY_NAME.toString())) { return getConnectionID(); } else if (key.equals(MessageUtil.JMSXGROUPID)) { return getGroupID(); } else if (key.equals(MessageUtil.JMSXGROUPSEQ)) { return getGroupSequence(); } else if (key.equals(MessageUtil.JMSXUSERID)) { return getAMQPUserID(); } else if (key.equals(MessageUtil.CORRELATIONID_HEADER_NAME.toString())) { if (properties != null && properties.getCorrelationId() != null) { return AMQPMessageIdHelper.INSTANCE.toCorrelationIdString(properties.getCorrelationId()); } } else { Object value = getApplicationPropertiesMap(false).get(key); if (value instanceof UnsignedInteger || value instanceof UnsignedByte || value instanceof UnsignedLong || value instanceof UnsignedShort) { return ((Number)value).longValue(); } else { return value; } } return null; }

Target:
public final Object getObjectProperty(String key) { if (key.equals(MessageUtil.TYPE_HEADER_NAME.toString())) { if (properties != null) { return properties.getSubject(); } } else if (key.equals(MessageUtil.CONNECTION_ID_PROPERTY_NAME.toString())) { return getConnectionID(); } else if (key.equals(MessageUtil.JMSXGROUPID)) { return getGroupID(); } else if (key.equals(MessageUtil.JMSXGROUPSEQ)) { return getGroupSequence(); } else if (key.equals(MessageUtil.JMSXUSERID)) { return getAMQPUserID(); } else if (key.equals(MessageUtil.CORRELATIONID_HEADER_NAME.toString())) { if (properties != null && properties.getCorrelationId() != null) { return AMQPMessageIdHelper.INSTANCE.toCorrelationIdString(properties.getCorrelationId()); } } else { Object value = getApplicationPropertiesMap(false).get(key); if (value instanceof UnsignedInteger || value instanceof UnsignedByte || value instanceof UnsignedLong || value instanceof UnsignedShort) { return ((Number)value).longValue(); } else { return value; } } return null; }
Source:
public Href path(final String suffix) { final String slash = "/"; final StringBuilder sbr = new StringBuilder(this.uri.toString()); if ( !this.uri.toString().endsWith(slash) && !suffix.startsWith(slash) ) { sbr.append(slash); } sbr.append(Href.encode(suffix)); return new Href( URI.create(sbr.toString()), this.params ); }

Target:
public Href path(final String suffix) { return new Href( URI.create( new StringBuilder(this.uri.toString().replaceAll("/$", "")) .append('/') .append(Href.encode(suffix)).toString() ), this.params ); }
Source:
private void receiveCommandsToOutputPort() { readerThread = new Thread(new Runnable() { @Override public void run() { try { tcpSocketRead = initTcpSocket(tcpSocketRead); while (!readerThread.isInterrupted()) { String result = readFromSocket(tcpSocketRead, 0); opOutput.sendData(ConversionUtils.stringToBytes(result)); logger.log(Level.INFO, "IRTrans received: " + result); } } catch (Exception e) { logger.log(Level.INFO, "reading from socket to receive command stopped"); } } }); readerThread.start(); }

Target:
private void receiveCommandsToOutputPort() { readerThread = new Thread(new Runnable() { @Override public void run() { try { tcpSocketRead = initTcpSocket(tcpSocketRead); while (!readerThread.isInterrupted()) { String result = readFromSocket(tcpSocketRead, 0); opOutput.sendData(ConversionUtils.stringToBytes(result)); logger.log(Level.INFO, "IRTrans received: " + result); } } catch (Exception e) { logger.log(Level.INFO, "reading from socket to receive command stopped"); } finally { closeTcpSocket(tcpSocketRead); } } }); readerThread.start(); }
Source:
public void validateDetailCountGood() { try { concurStandardAccountingExtractService.validateDetailCount(file); assertTrue("We successfully validated counts.", true); } catch (ValidationException ve) { assertTrue("The counts should be been the same.", false); } }

Target:
public void validateDetailCountGood() { assertTrue("The counts should be been the same.", concurStandardAccountingValidationService.validateDetailCount(file)); }
Source:
public void processRecord(ComputationContext context, String inputStream, Record record) { BulkStatus status = codec.decode(record.getData()); if (IndexAction.ACTION_NAME.equals(status.getAction()) && BulkStatus.State.COMPLETED.equals(status.getState())) { logIndexing(status); BulkService bulkService = Framework.getService(BulkService.class); BulkCommand command = bulkService.getCommand(status.getId()); if (command != null) { refreshIndexIfNeeded(command); updateAliasIfNeeded(command); } else { log.error(String.format("Command not found for id = %s", status.getId())); } } context.askForCheckpoint(); }

Target:
public void processRecord(ComputationContext context, String inputStream, Record record) { BulkStatus status = codec.decode(record.getData()); if (IndexAction.ACTION_NAME.equals(status.getAction()) && BulkStatus.State.COMPLETED.equals(status.getState())) { logIndexing(status); BulkService bulkService = Framework.getService(BulkService.class); BulkCommand command = bulkService.getCommand(status.getId()); if (command != null) { refreshIndexIfNeeded(command); updateAliasIfNeeded(command); } else { log.error("Command not found for id: {}", status::getId); } } context.askForCheckpoint(); }
Source:
public Object getEventName() { return eventData.get("event"); }

Target:
public String getEventName() { return (String)eventData.get("event"); }
Source:
public IStatus validate(IProject project, String path) { if( fileExists(path)){ return Status.OK_STATUS; } return new Status(IStatus.ERROR, "TmfTraceStub", "File does not exist: " + path) ; }

Target:
public IStatus validate(IProject project, String path) { if (fileExists(path)) { return Status.OK_STATUS; } return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TmfTraceStub_FileNotFound + ": " + path); }
Source:
private void record(final ReadableMap options, final Promise promise) { if (mRecordingPromise == null) { mCamera = RCTCamera.getInstance().acquireCameraInstance(options.getInt("type")); if (null == mCamera) { promise.reject("No camera found."); return; } if (!prepareMediaRecorder(options)) { promise.reject("Fail in prepareMediaRecorder()!"); return; } try { mMediaRecorder.start(); MRStartTime = System.currentTimeMillis(); mRecordingOptions = options; mRecordingPromise = promise; } catch (final Exception ex) { promise.reject("Exception in thread"); return; } } }

Target:
private void record(final ReadableMap options, final Promise promise) { if (mRecordingPromise != null) { return; } mCamera = RCTCamera.getInstance().acquireCameraInstance(options.getInt("type")); if (mCamera == null) { promise.reject(new RuntimeException("No camera found.")); return; } Throwable prepareError = prepareMediaRecorder(options); if (prepareError != null) { promise.reject(prepareError); return; } try { mMediaRecorder.start(); MRStartTime = System.currentTimeMillis(); mRecordingOptions = options; mRecordingPromise = promise; } catch (Exception ex) { Log.e(TAG, "Media recorder start error.", ex); promise.reject(ex); } }
Source:
public void process(JSONRequestContext jsonRequestContext) { CurriculumDAO curriculumDAO = DAOFactory.getInstance().getCurriculumDAO(); Long rowCountLong = jsonRequestContext.getLong("curriculumsTable.rowCount"); if (rowCountLong == null) throw new SmvcRuntimeException(StatusCode.UNDEFINED, "Row count was not defined."); int rowCount = rowCountLong.intValue(); for (int i = 0; i < rowCount; i++) { String colPrefix = "curriculumsTable." + i; Long curriculumId = jsonRequestContext.getLong(colPrefix + ".curriculumId"); String name = jsonRequestContext.getString(colPrefix + ".name"); boolean modified = new Integer(1).equals(jsonRequestContext.getInteger(colPrefix + ".modified")); if (curriculumId == -1) { curriculumDAO.create(name); } else if (modified) { Curriculum curriculum = curriculumDAO.findById(curriculumId); curriculumDAO.updateName(curriculum, name); } } jsonRequestContext.setRedirectURL(jsonRequestContext.getReferer(true)); }

Target:
public void process(JSONRequestContext jsonRequestContext) { CurriculumDAO curriculumDAO = DAOFactory.getInstance().getCurriculumDAO(); Long rowCountLong = jsonRequestContext.getLong("curriculumsTable.rowCount"); if (rowCountLong == null) throw new SmvcRuntimeException(StatusCode.UNDEFINED, "Row count was not defined."); int rowCount = rowCountLong.intValue(); for (int i = 0; i < rowCount; i++) { String colPrefix = "curriculumsTable." + i; Long curriculumId = jsonRequestContext.getLong(colPrefix + ".curriculumId"); String name = jsonRequestContext.getString(colPrefix + ".name"); boolean modified = new Integer(1).equals(jsonRequestContext.getInteger(colPrefix + ".modified")); if (curriculumId == -1) { curriculumDAO.create(name); } else if (modified) { Curriculum curriculum = curriculumDAO.findById(curriculumId); if (curriculum != null) curriculumDAO.updateName(curriculum, name); else throw new SmvcRuntimeException(StatusCode.UNDEFINED, "Modified curriculum was not found."); } } jsonRequestContext.setRedirectURL(jsonRequestContext.getReferer(true)); }
Source:
public void onStart() { Log.d(TAG, "onStart()"); handler.postDelayed(moveAround, 60000); handler.postDelayed(fadeClock, 30000); }

Target:
public void onStart() { Log.d(TAG, "onStart()"); handler.postDelayed(moveAround, 30000); handler.postDelayed(fadeClock, 30000); }
Source:
public Type getClassType(String fullyQualifiedName) { return bytecodeCompleter.loadClass(fullyQualifiedName).type; }

Target:
public Type getClassType(String fullyQualifiedName) { return bytecodeCompleter.loadClass(fullyQualifiedName).type(); }
Source:
public void testSessionStartup() throws ObjectFactoryException { int oldLogLevel = Logger.getLogLevel(); Logger.setLogLevel( ILogger.TRACE ); final ISolutionEngine engine = mock( ISolutionEngine.class ); pentahoObjectFactory = mock( IPentahoObjectFactory.class ); when( pentahoObjectFactory.objectDefined( anyString() ) ).thenReturn( true ); when( pentahoObjectFactory.get( this.anyClass(), anyString(), any( IPentahoSession.class ) ) ).thenAnswer( new Answer<Object>() { @Override public ISolutionEngine answer( InvocationOnMock invocation ) throws Throwable { return engine; } } ); PentahoSystem.registerObjectFactory( pentahoObjectFactory ); ISessionStartupAction action = mock( ISessionStartupAction.class ); when( action.getActionOutputScope() ).thenReturn( PentahoSystem.SCOPE_SESSION ); when( action.getSessionType() ).thenReturn( session.getClass().getName() ); when( session.isAuthenticated() ).thenReturn( true ); PentahoSystem.setSessionStartupActions( Arrays.asList( action ) ); PentahoSystem.sessionStartup( session, null ); System.out.flush(); System.out.println( baos.toString() ); assertNotNull( baos ); assertTrue( baos.toString().contains( "Process session startup actions" ) ); Logger.setLogLevel( oldLogLevel ); }

Target:
public void testSessionStartup() throws ObjectFactoryException { int oldLogLevel = Logger.getLogLevel(); Logger.setLogLevel( ILogger.TRACE ); final ISolutionEngine engine = mock( ISolutionEngine.class ); pentahoObjectFactory = mock( IPentahoObjectFactory.class ); when( pentahoObjectFactory.objectDefined( anyString() ) ).thenReturn( true ); when( pentahoObjectFactory.get( this.anyClass(), anyString(), any( IPentahoSession.class ) ) ).thenAnswer( new Answer<Object>() { @Override public ISolutionEngine answer( InvocationOnMock invocation ) throws Throwable { return engine; } } ); PentahoSystem.registerObjectFactory( pentahoObjectFactory ); ISessionStartupAction action = mock( ISessionStartupAction.class ); when( action.getActionOutputScope() ).thenReturn( PentahoSystem.SCOPE_SESSION ); when( action.getSessionType() ).thenReturn( session.getClass().getName() ); when( session.isAuthenticated() ).thenReturn( true ); PentahoSystem.setSessionStartupActions( Arrays.asList( action ) ); PentahoSystem.sessionStartup( session, null ); System.out.flush(); assertNotNull( baos ); assertTrue( baos.toString().contains( "Process session startup actions" ) ); Logger.setLogLevel( oldLogLevel ); }
Source:
protected void handleReceiveSlowConsumerKillMessage(DisconnectConsumerWithKillMessage message) { if (message.getNodeID() != null) { setKilled(true); } }

Target:
protected void handleReceiveSlowConsumerKillMessage(DisconnectConsumerWithKillMessage message) { if (message.getNodeID() != null) { kill(); } }
Source:
public void testTransactionHistoryInfo() throws Exception { Ignite ignite = startGridsMultiThreaded(2); ignite.cluster().active(true); Ignite client = startGrid("client"); client.getOrCreateCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME) .setAtomicityMode(TRANSACTIONAL).setBackups(2).setWriteSynchronizationMode(FULL_SYNC)); for (Ignite ig : G.allGrids()) assertNotNull(ig.cache(DEFAULT_CACHE_NAME)); CountDownLatch lockLatch = new CountDownLatch(1); CountDownLatch unlockLatch = new CountDownLatch(1); IgniteInternalFuture<?> fut = startTransactions(lockLatch, unlockLatch, false); U.awaitQuiet(lockLatch); doSleep(3000); Set<GridCacheVersion> nearXids = new HashSet<>(); for (int i = 0; i < 2; i++) { IgniteEx grid = grid(i); IgniteTxManager tm = grid.context().cache().context().tm(); for (IgniteInternalTx tx : tm.activeTransactions()) nearXids.add(tx.nearXidVersion()); } unlockLatch.countDown(); fut.get(); doSleep(3000); injectTestSystemOut(); for (GridCacheVersion nearXid : nearXids) assertEquals(EXIT_CODE_OK, execute("--tx", "--info", nearXid.toString())); String out = testOut.toString(); assertTrue(out.contains("Transaction was found in completed versions history of the following nodes:")); assertTrue(out.contains("COMMITTED")); assertTrue(out.contains("ROLLED_BACK")); }

Target:
public void testTransactionHistoryInfo() throws Exception { Ignite ignite = startGridsMultiThreaded(2); ignite.cluster().active(true); Ignite client = startGrid("client"); client.getOrCreateCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME) .setAtomicityMode(TRANSACTIONAL).setBackups(2).setWriteSynchronizationMode(FULL_SYNC)); for (Ignite ig : G.allGrids()) assertNotNull(ig.cache(DEFAULT_CACHE_NAME)); CountDownLatch lockLatch = new CountDownLatch(1); CountDownLatch unlockLatch = new CountDownLatch(1); IgniteInternalFuture<?> fut = startTransactions(lockLatch, unlockLatch, false); U.awaitQuiet(lockLatch); doSleep(3000); Set<GridCacheVersion> nearXids = new HashSet<>(); for (int i = 0; i < 2; i++) { IgniteEx grid = grid(i); IgniteTxManager tm = grid.context().cache().context().tm(); for (IgniteInternalTx tx : tm.activeTransactions()) nearXids.add(tx.nearXidVersion()); } unlockLatch.countDown(); fut.get(); doSleep(3000); injectTestSystemOut(); boolean commitMatched = false; boolean rollbackMatched = false; for (GridCacheVersion nearXid : nearXids) { assertEquals(EXIT_CODE_OK, execute("--tx", "--info", nearXid.toString())); String out = testOut.toString(); testOut.reset(); assertTrue(out.contains("Transaction was found in completed versions history of the following nodes:")); if (out.contains(TransactionState.COMMITTED.name())) { commitMatched = true; assertFalse(out.contains(TransactionState.ROLLED_BACK.name())); } if (out.contains(TransactionState.ROLLED_BACK.name())) { rollbackMatched = true; assertFalse(out.contains(TransactionState.COMMITTED.name())); } } assertTrue(commitMatched); assertTrue(rollbackMatched); }
Source:
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { this.watermark = in.readLong(); this.flags = decodeFlags(in.readShort()); this.key = (String) in.readObject(); int dataLength = in.readInt(); if (dataLength == 0) { this.data = null; } else { this.data = new byte[dataLength]; int pos = 0; while (pos < dataLength) { pos += in.read(this.data, pos, dataLength - pos); } } }

Target:
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { this.watermark = in.readLong(); this.flags = decodeFlags(in.readShort()); this.key = (String) in.readObject(); int dataLength = in.readInt(); if (dataLength == 0) { this.data = null; } else { this.data = new byte[dataLength]; int pos = 0; while (pos < dataLength) { int byteRead = in.read(this.data, pos, dataLength - pos); if (byteRead == -1) { throw new IllegalStateException("Corrupted stream, can not read " + dataLength + " bytes"); } pos += byteRead; } } }
Source:
public int calculateLeadImageWidth() { Resources res = app.getResources(); return (int) (res.getDimension(R.dimen.leadImageWidth) / res.getDisplayMetrics().density); }

Target:
private int calculateLeadImageWidth() { Resources res = app.getResources(); return (int) (res.getDimension(R.dimen.leadImageWidth) / res.getDisplayMetrics().density); }
Source:
public boolean canFlipToNextPage() { List<String> tracesToScan = new ArrayList<String>(); for (TreeItem traceFamily : treeView.getItems()) { for (TreeItem traceType : traceFamily.getItems()) { if (traceType.getChecked()) { tracesToScan.add(traceType.getText()); } } } ((BatchImportTraceWizard) getWizard()).setTracesToScan(tracesToScan); if( tracesToScan.isEmpty()){ setErrorMessage("Please Select at least one trace type"); } else{ setErrorMessage(null); } return super.canFlipToNextPage() && !tracesToScan.isEmpty(); }

Target:
public boolean canFlipToNextPage() { List<String> tracesToScan = new ArrayList<String>(); String elements[] = (String[]) fProvider.getElements(null); for (String traceFamily : elements) { final String[] children = (String[]) fProvider.getChildren(traceFamily); if (children != null) { for (String traceType : children) { if (fTreeView.getChecked(traceType)) { tracesToScan.add(traceType); } } } } ((BatchImportTraceWizard) getWizard()).setTraceTypesToScan(tracesToScan); if (tracesToScan.isEmpty()) { setErrorMessage(Messages.ImportTraceWizardPageSelectTraceType_2); } else { setErrorMessage(null); } return super.canFlipToNextPage() && !tracesToScan.isEmpty(); }
Source:
public SendEventBatchPartitionTest(EventHubsPerfStressOptions options) throws Exception { super(options); partitionSender = eventHubClient.createPartitionSender(String.valueOf(options.getPartitionId())).get(); BatchOptions batchOptions = new BatchOptions(); if (options.getBatchSize() != null) { batchOptions.maxMessageSize = options.getBatchSize(); } if (options.getPartitionKey() != null) { batchOptions.partitionKey = options.getPartitionKey(); } eventDataBatch = partitionSender.createBatch(batchOptions); for (int i = 0; i < options.getEvents(); i++) { if (!eventDataBatch.tryAdd(EventData.create("Static Event".getBytes(StandardCharsets.UTF_8)))) { throw new Exception(String.format("Batch can only fit %d number of messages with batch size of %d ", options.getCount(), options.getSize())); } } }

Target:
public SendEventBatchPartitionTest(EventHubsPerfStressOptions options) throws Exception { super(options); batchOptions = new BatchOptions(); BatchOptions batchOptions = new BatchOptions(); if (options.getBatchSize() != null) { batchOptions.maxMessageSize = options.getBatchSize(); } if (options.getPartitionKey() != null) { batchOptions.partitionKey = options.getPartitionKey(); } }
Source:
protected GoVisitor buildGoVisitor(@NotNull final ProblemsHolder holder, @NotNull LocalInspectionToolSession session) { return new GoVisitor() { @Override public void visitShortVarDeclaration(@NotNull GoShortVarDeclaration o) { super.visitShortVarDeclaration(o); visitVarDefinitionList(o, o.getVarDefinitionList()); } @Override public void visitRecvStatement(@NotNull GoRecvStatement o) { super.visitRecvStatement(o); visitVarDefinitionList(o, o.getVarDefinitionList()); } @Override public void visitRangeClause(@NotNull GoRangeClause o) { super.visitRangeClause(o); visitVarDefinitionList(o, o.getVarDefinitionList()); } private void visitVarDefinitionList(@NotNull PsiElement o, @NotNull List<GoVarDefinition> list) { GoVarDefinition first = ContainerUtil.getFirstItem(list); GoVarDefinition last = ContainerUtil.getLastItem(list); if (first == null || last == null) return; if (hasNonNewVariables(list)) { TextRange textRange = TextRange.create(first.getStartOffsetInParent(), last.getStartOffsetInParent() + last.getTextLength()); holder.registerProblem(o, textRange, "No new variables on left side of :=", new MyLocalQuickFixBase()); } } }; }

Target:
protected GoVisitor buildGoVisitor(@NotNull final ProblemsHolder holder, @NotNull LocalInspectionToolSession session) { return new GoVisitor() { @Override public void visitShortVarDeclaration(@NotNull GoShortVarDeclaration o) { visitVarDefinitionList(o, o.getVarDefinitionList()); } @Override public void visitRecvStatement(@NotNull GoRecvStatement o) { visitVarDefinitionList(o, o.getVarDefinitionList()); } @Override public void visitRangeClause(@NotNull GoRangeClause o) { visitVarDefinitionList(o, o.getVarDefinitionList()); } private void visitVarDefinitionList(@NotNull PsiElement o, @NotNull List<GoVarDefinition> list) { ProgressManager.checkCanceled(); GoVarDefinition first = ContainerUtil.getFirstItem(list); GoVarDefinition last = ContainerUtil.getLastItem(list); if (first == null || last == null) return; if (hasNonNewVariables(list)) { TextRange textRange = TextRange.create(first.getStartOffsetInParent(), last.getStartOffsetInParent() + last.getTextLength()); holder.registerProblem(o, textRange, "No new variables on left side of :=", new MyLocalQuickFixBase()); } } }; }
Source:
public CompletableFuture<Void> truncateTable(TableName tableName, boolean preserveSplits) { return CompletableFuture.supplyAsync(() -> { DropRowRangeRequest.Builder dropBuilder = DropRowRangeRequest.newBuilder().setDeleteAllDataFromTable(true); dropBuilder.setName(bigtableInstanceName.toTableNameStr(tableName.getNameAsString())); return dropBuilder; }).thenCompose( d -> FutureUtils.toCompletableFuture(bigtableTableAdminClient.dropRowRangeAsync(d.build()))) .thenApply(r -> null); }

Target:
public CompletableFuture<Void> truncateTable(TableName tableName, boolean preserveSplits) { if (!preserveSplits) { LOG.info("truncate will preserveSplits. The passed in variable is ignored."); } DropRowRangeRequest.Builder deleteRequest = DropRowRangeRequest.newBuilder().setDeleteAllDataFromTable(true); return FutureUtils.toCompletableFuture( bigtableTableAdminClient.dropRowRangeAsync(deleteRequest.setName(bigtableInstanceName.toTableNameStr(tableName.getNameAsString())).build())) .thenApply(r -> null); }
Source:
public Block copyPositions(List<Integer> positions) { int[] newOffsets = new int[positions.size() + 1]; boolean[] newRowIsNull = new boolean[positions.size()]; List<Integer> columnBlockPositions = new ArrayList<>(positions.size()); int newPosition = 0; for (int position : positions) { if (isNull(position)) { newRowIsNull[newPosition] = true; newOffsets[newPosition + 1] = newOffsets[newPosition]; } else { newOffsets[newPosition + 1] = newOffsets[newPosition] + 1; columnBlockPositions.add(getColumnBlockOffset(position)); } newPosition++; } Block[] newColumnBlocks = new Block[numColumns]; for (int i = 0; i < numColumns; i++) { newColumnBlocks[i] = getColumnBlock(i).copyPositions(columnBlockPositions); } return new RowBlock(0, positions.size(), newRowIsNull, newOffsets, newColumnBlocks); }

Target:
public Block copyPositions(List<Integer> positions) { int newPositionCount = positions.size(); int[] newOffsets = new int[newPositionCount + 1]; boolean[] newRowIsNull = new boolean[newPositionCount]; List<Integer> fieldBlockPositions = new ArrayList<>(newPositionCount); for (int i = 0; i < newPositionCount; i++) { int position = positions.get(i); if (isNull(position)) { newRowIsNull[i] = true; newOffsets[i + 1] = newOffsets[i]; } else { newOffsets[i + 1] = newOffsets[i] + 1; fieldBlockPositions.add(getFieldBlockOffset(position)); } } Block[] newBlocks = new Block[numFields]; for (int i = 0; i < numFields; i++) { newBlocks[i] = getFieldBlocks()[i].copyPositions(fieldBlockPositions); } return new RowBlock(0, positions.size(), newRowIsNull, newOffsets, newBlocks); }
Source:
protected static PrivateKey getPrivateKeyFromFile(String filename) throws Exception { byte[] keyBytes = Files.readAllBytes(new File(filename).toPath()); PKCS8EncodedKeySpec spec = new PKCS8EncodedKeySpec(keyBytes); KeyFactory kf = KeyFactory.getInstance("RSA"); return kf.generatePrivate(spec); }

Target:
private static PrivateKey getPrivateKeyFromFile(String filename) throws Exception { byte[] keyBytes = Files.readAllBytes(new File(filename).toPath()); PKCS8EncodedKeySpec spec = new PKCS8EncodedKeySpec(keyBytes); KeyFactory kf = KeyFactory.getInstance(algorithm); return kf.generatePrivate(spec); }
Source:
default AbstractPlanNode inputRelNodeToPlanNode(RelNode node, int childOrdinal) { VoltDBPRel inputNode = getInputNode(node, childOrdinal); assert (inputNode != null); return inputNode.toPlanNode(); }

Target:
default AbstractPlanNode inputRelNodeToPlanNode(RelNode node, int childOrdinal) { VoltDBPRel inputNode = getInputNode(node, childOrdinal); Objects.requireNonNull(inputNode); return inputNode.toPlanNode(); }
Source:
public synchronized void stop() { if (state == State.STARTING || state == State.RUNNING) { setState(State.STOPPING); watcherThread.interrupt(); } }

Target:
public void stop() { if (compareAndSetState( new State[]{State.RUNNING, State.STARTING}, State.STOPPING)) { watcherThread.interrupt(); } }
Source:
protected List<LUNs> getLUNsFromVgInfo(String vgId) { List<LUNs> luns = new ArrayList<>(); VDSReturnValue returnValue; try { returnValue = runVdsCommand(VDSCommandType.GetVGInfo, new GetVGInfoVDSCommandParameters(getParameters().getVdsId(), vgId)); } catch (RuntimeException e) { log.error("Could not get info for VG ID '{}'. Error message: {}", vgId, e.getMessage()); return luns; } luns.addAll((ArrayList<LUNs>) returnValue.getReturnValue()); return luns; }

Target:
protected List<LUNs> getLUNsFromVgInfo(String vgId) { List<LUNs> luns = new ArrayList<>(); VDSReturnValue returnValue; try { returnValue = runVdsCommand(VDSCommandType.GetVGInfo, new GetVGInfoVDSCommandParameters(getParameters().getVdsId(), vgId)); } catch (RuntimeException e) { log.error("Could not get info for VG ID '{}': {}", vgId, e.getMessage()); log.debug("Exception", e); return luns; } luns.addAll((ArrayList<LUNs>) returnValue.getReturnValue()); return luns; }
Source:
private void handleAck(long deliveryTag, boolean channelLocallyTransacted) throws IOException { boolean isLocallyTransacted = channelLocallyTransacted || (isChannelTransacted() && TransactionSynchronizationManager.getResource(this.connectionFactory) == null); try { if (this.ackRequired) { if (this.messagesPerAck > 0) { synchronized (this) { this.deliveryTag = deliveryTag; this.pendingAcks++; this.lastDeliveryComplete = System.currentTimeMillis(); ackIfNecessary(this.lastDeliveryComplete); } } else if (!isChannelTransacted() || isLocallyTransacted) { getChannel().basicAck(deliveryTag, false); } } if (isLocallyTransacted) { RabbitUtils.commitIfNecessary(getChannel()); } } catch (Exception e) { this.logger.error("Error acking", e); } }

Target:
private void handleAck(long deliveryTag, boolean channelLocallyTransacted) throws IOException { boolean isLocallyTransacted = channelLocallyTransacted || (isChannelTransacted() && TransactionSynchronizationManager.getResource(this.connectionFactory) == null); try { if (this.ackRequired) { if (this.messagesPerAck > 1) { synchronized (this) { this.deliveryTag = deliveryTag; this.pendingAcks++; this.lastDeliveryComplete = System.currentTimeMillis(); ackIfNecessary(this.lastDeliveryComplete); } } else if (!isChannelTransacted() || isLocallyTransacted) { getChannel().basicAck(deliveryTag, false); } } if (isLocallyTransacted) { RabbitUtils.commitIfNecessary(getChannel()); } } catch (Exception e) { this.logger.error("Error acking", e); } }
Source:
@Override public void cancel(String name) { A.notNull(name, "name"); if (log.isInfoEnabled()) log.info("Canceling service[name=" + name + ']'); boolean res; try { IgniteClusterImpl cluster = ctx.cluster().get(); IgniteCompute compute = cluster.compute(); ClusterNode srv = U.randomServerNode(ctx); res = compute.execute(new VisorCancelServiceTask(), new VisorTaskArgument<>(srv.id(), new VisorCancelServiceTaskArg(name), false)); } catch (Exception e) { throw new RuntimeException(e); } if (!res) throw new RuntimeException("Service not found or can't be canceled[name=" + name + ']'); }

Target:
@Override public void cancel(String name) { A.notNull(name, "name"); if (log.isInfoEnabled()) log.info("Canceling service[name=" + name + ']'); try { IgniteClusterImpl cluster = ctx.cluster().get(); IgniteCompute compute = cluster.compute(); boolean res = compute.execute(new VisorCancelServiceTask(), new VisorTaskArgument<>(ctx.localNodeId(), new VisorCancelServiceTaskArg(name), false)); if (!res) throw new RuntimeException("Service not found or can't be canceled[name=" + name + ']'); } catch (IgniteException e) { throw new RuntimeException(e); } }
Source:
private void addMasterJulLogRecords(Container result) { result.add(new LogRecordContent("nodes/master/logs/all_memory_buffer.log") { @Override public Iterable<LogRecord> getLogRecords() { return SupportPlugin.getInstance().getAllLogRecords(); } }); final Jenkins jenkins = Jenkins.getInstance(); if (jenkins == null) { LOGGER.log(Level.WARNING, "Cannot add master logs to the bundle. Jenkins instance is not ready"); return; } final File[] logFiles = jenkins.getRootDir().listFiles(ROTATED_LOGFILE_FILTER); if (logFiles == null) { LOGGER.log(Level.WARNING, "Cannot add master logs to the bundle. Cannot access log files"); return; } for (File file : logFiles){ result.add(new FileContent("nodes/master/logs/" + file.getName(), file)); } }

Target:
private void addMasterJulLogRecords(Container result) { result.add(new LogRecordContent("nodes/master/logs/all_memory_buffer.log") { @Override public Iterable<LogRecord> getLogRecords() { return SupportPlugin.getInstance().getAllLogRecords(); } }); final Jenkins jenkins = Jenkins.getInstance(); if (jenkins == null) { LOGGER.log(Level.WARNING, "Cannot add master logs to the bundle. Jenkins instance is not ready"); return; } final File[] julLogFiles = SupportPlugin.getRootDirectory().listFiles(new LogFilenameFilter()); if (julLogFiles == null) { LOGGER.log(Level.WARNING, "Cannot add master java.util.logging logs to the bundle. Cannot access log files"); return; } for (File file : julLogFiles){ result.add(new FileContent("nodes/master/logs/" + file.getName(), file)); } }
Source:
public void onLifespanFinished(Iterable<Lifespan> newlyCompletedDriverGroups) { checkState(initialScheduled); SettableFuture<?> newDriverGroupReady = this.newDriverGroupReady; synchronized (this) { for (Lifespan newlyCompletedDriverGroup : newlyCompletedDriverGroups) { checkArgument(!newlyCompletedDriverGroup.isTaskWide()); recentlyCompletedDriverGroups.add(newlyCompletedDriverGroup); } } newDriverGroupReady.set(null); }

Target:
public void onLifespanFinished(Iterable<Lifespan> newlyCompletedDriverGroups) { checkState(initialScheduled); SettableFuture<?> newDriverGroupReady; synchronized (this) { for (Lifespan newlyCompletedDriverGroup : newlyCompletedDriverGroups) { checkArgument(!newlyCompletedDriverGroup.isTaskWide()); recentlyCompletedDriverGroups.add(newlyCompletedDriverGroup); } newDriverGroupReady = this.newDriverGroupReady; } newDriverGroupReady.set(null); }
Source:
public MessageTemplate() { super(); }

Target:
public MessageTemplate() { tags = new ArrayList<>(); }
Source:
public ImmutableList<Double> initialGuesses(MarketData marketData) { ImmutableList.Builder<Double> result = ImmutableList.builder(); for (CurveDefinition defn : curveDefinitions) { if (defn instanceof ParameterizedFunctionalCurveDefinition) { ParameterizedFunctionalCurveDefinition casted = (ParameterizedFunctionalCurveDefinition) defn; result.addAll(casted.getInitialGuess().toList().iterator()); } else { ValueType valueType = defn.getYValueType(); for (CurveNode node : defn.getNodes()) { result.add(node.initialGuess(marketData, valueType)); } } } return result.build(); }

Target:
public ImmutableList<Double> initialGuesses(MarketData marketData) { ImmutableList.Builder<Double> result = ImmutableList.builder(); for (CurveDefinition defn : curveDefinitions) { result.addAll(defn.initialGuess(marketData)); } return result.build(); }
Source:
public List<PTCreditNote> findByReferencedDocument(UID uidCompany, UID uidInvoice) { JPAGenericInvoiceEntity invoice = this.queryInvoice().uid.eq(uidInvoice.toString()).findOne(); List<JPAPTCreditNoteEntryEntity> referencingEntries = this.queryCreditNoteEntry().reference.equalTo((JPAPTInvoiceEntity) invoice).findList(); List<Integer> referencingEntryIDs = new ArrayList<>(); for (JPAPTCreditNoteEntryEntity referencingEntry : referencingEntries) { referencingEntryIDs.add(referencingEntry.getID()); } List<JPAGenericInvoiceEntity> referencingDocuments = this.queryInvoice().business.uid.eq(uidCompany.toString()).entries .filterMany(this.queryGenericInvoiceEntry().setIdIn(referencingEntryIDs).getExpressionList()) .findList(); List<PTCreditNote> referencingCreditNotes = new ArrayList<>(); for (JPAGenericInvoiceEntity referencingInvoice : referencingDocuments) { if (referencingInvoice instanceof JPAPTCreditNoteEntity) { referencingCreditNotes.add((JPAPTCreditNoteEntity) referencingInvoice); } } return referencingCreditNotes; }

Target:
public List<PTCreditNote> findByReferencedDocument(UID uidCompany, UID uidInvoice) { JPAGenericInvoiceEntity invoice = this.queryInvoice().uid.eq(uidInvoice.toString()).findOne(); if (invoice == null) { return new ArrayList<>(); } List<JPAPTCreditNoteEntryEntity> referencingEntries = this.queryCreditNoteEntry().reference.equalTo((JPAPTInvoiceEntity) invoice).findList(); List<Integer> referencingEntryIDs = new ArrayList<>(); for (JPAPTCreditNoteEntryEntity referencingEntry : referencingEntries) { referencingEntryIDs.add(referencingEntry.getID()); } List<JPAGenericInvoiceEntity> referencingDocuments = this.queryInvoice().business.uid.eq(uidCompany.toString()).entries .filterMany(this.queryGenericInvoiceEntry().setIdIn(referencingEntryIDs).getExpressionList()) .findList(); List<PTCreditNote> referencingCreditNotes = new ArrayList<>(); for (JPAGenericInvoiceEntity referencingInvoice : referencingDocuments) { if (referencingInvoice instanceof JPAPTCreditNoteEntity) { referencingCreditNotes.add((JPAPTCreditNoteEntity) referencingInvoice); } } return referencingCreditNotes; }
Source:
private void addPluginActionButtons(List<ActionButtonDefinition<?>> pluginActionButtonList) { if (hasActionPanelPresenterWidget()) { for(ActionButtonDefinition<?> buttonDef: pluginActionButtonList) { getActionPanelPresenterWidget().addActionButton((ActionButtonDefinition) buttonDef, (int) buttonDef.getPriority()); } } }

Target:
private void addPluginActionButtons(List<ActionButtonDefinition<?>> pluginActionButtonList) { if (hasActionPanelPresenterWidget()) { for(ActionButtonDefinition<?> buttonDef: pluginActionButtonList) { getActionPanelPresenterWidget().addActionButton((ActionButtonDefinition) buttonDef); } } }
Source:
private SSLConnectionSocketFactory createSslConnectionSocketFactory() { SSLConnectionSocketFactory sslConnFactory = new SSLConnectionSocketFactory(SSLContexts.createDefault(), new String[] {"TLSv1.2"}, null, SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); return sslConnFactory; }

Target:
private SSLConnectionSocketFactory createSslConnectionSocketFactory() { SSLConnectionSocketFactory sslConnFactory = new SSLConnectionSocketFactory(SSLContexts.createDefault(), new String[] {TLS_V1_2}, null, SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); return sslConnFactory; }
Source:
public Registration updateRegistration(RegistrationUpdate update) { try (Jedis j = pool.getResource()) { byte[] ep = j.get(toRegIdKey(update.getRegistrationId())); if (ep == null) { return null; } byte[] data = j.get(toEndpointKey(ep)); if (data == null) { return null; } Registration r = deserializeReg(data); byte[] lockValue = null; byte[] lockKey = toLockKey(r.getEndpoint()); try { lockValue = RedisLock.acquire(j, lockKey); Registration clientUpdated = update.updateClient(r); j.set(toEndpointKey(clientUpdated.getEndpoint()), serializeReg(clientUpdated)); return clientUpdated; } finally { RedisLock.release(j, lockKey, lockValue); } } }

Target:
public Registration updateRegistration(RegistrationUpdate update) { try (Jedis j = pool.getResource()) { byte[] ep = j.get(toRegIdKey(update.getRegistrationId())); if (ep == null) { return null; } byte[] data = j.get(toEndpointKey(ep)); if (data == null) { return null; } Registration r = deserializeReg(data); byte[] lockValue = null; byte[] lockKey = toLockKey(r.getEndpoint()); try { lockValue = RedisLock.acquire(j, lockKey); Registration updatedRegistration = update.update(r); j.set(toEndpointKey(updatedRegistration.getEndpoint()), serializeReg(updatedRegistration)); return updatedRegistration; } finally { RedisLock.release(j, lockKey, lockValue); } } }
Source:
@Override public void cacheMaxSize(int maxSize) { for (EventListener listener : eventListeners) { listener.cacheMaxSize(maxSize); } }

Target:
void cacheMaxSize(int maxSize) { int numListeners = eventListeners.size(); for (int i = 0; i < numListeners; i++) { EventListener listener = eventListeners.get(i); listener.cacheMaxSize(maxSize); } }
Source:
final void initComponents() { enableOSXFullscreen(this); setLayout(new BorderLayout()); setResizable(true); setIconImage(ImageUtility.readSystemImage("chess_logo")); setJMenuBar(ChessActions.createJMenuBar()); setPreferredSize(new Dimension(685, 450)); InputMap inputMap = getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_W, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), "close"); inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F, InputEvent.SHIFT_DOWN_MASK | Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), "fullscreen"); ActionMap actionMap = getRootPane().getActionMap(); actionMap.put("close", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { onWindowCloseKeyboardRequest(); } }); actionMap.put("fullscreen", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { } }); setPreferredSize(new Dimension(685, 450)); setMinimumSize(new Dimension(685, 450)); this.addComponentListener(new ComponentAdapter(){ public void componentResized(ComponentEvent e){ Dimension d = getSize(); Dimension minD = getMinimumSize(); if(d.width<minD.width) d.width=minD.width; if(d.height<minD.height) d.height=minD.height; setSize(d); } }); doInitComponents(); }

Target:
final void initComponents() { enableOSXFullscreen(this); setLayout(new BorderLayout()); setResizable(true); setIconImage(ImageUtility.readSystemImage("chess_logo")); setJMenuBar(ChessActions.createJMenuBar()); setPreferredSize(new Dimension(685, 450)); InputMap inputMap = getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_W, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), "close"); inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F, InputEvent.SHIFT_DOWN_MASK | Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), "fullscreen"); ActionMap actionMap = getRootPane().getActionMap(); actionMap.put("close", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { onWindowCloseKeyboardRequest(); } }); actionMap.put("fullscreen", new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { } }); doInitComponents(); }
Source:
public List<ProjectBuildingResult> build( List<File> pomFiles, boolean recursive, ProjectBuildingRequest request ) throws ProjectBuildingException { List<ProjectBuildingResult> results = new ArrayList<>(); List<InterimResult> interimResults = new ArrayList<>(); ReactorModelPool.Builder poolBuilder = new ReactorModelPool.Builder(); ReactorModelPool modelPool = poolBuilder.build(); InternalConfig config = new InternalConfig( request, modelPool, useGlobalModelCache() ? getModelCache() : new ReactorModelCache() ); Map<String, MavenProject> projectIndex = new HashMap<>( 256 ); boolean noErrors = build( results, interimResults, projectIndex, pomFiles, new LinkedHashSet<>(), true, recursive, config, poolBuilder ); ClassLoader oldContextClassLoader = Thread.currentThread().getContextClassLoader(); try { noErrors = build( results, new ArrayList<>(), projectIndex, interimResults, request, new HashMap<>(), config.session ) && noErrors; } finally { Thread.currentThread().setContextClassLoader( oldContextClassLoader ); } if ( !noErrors ) { throw new ProjectBuildingException( results ); } return results; }

Target:
public List<ProjectBuildingResult> build( List<File> pomFiles, boolean recursive, ProjectBuildingRequest request ) throws ProjectBuildingException { List<ProjectBuildingResult> results = new ArrayList<>(); List<InterimResult> interimResults = new ArrayList<>(); ReactorModelPool.Builder poolBuilder = new ReactorModelPool.Builder(); final ReactorModelPool modelPool = poolBuilder.build(); if ( Features.buildConsumer().isActive() ) { final TransformerContext context = new TransformerContext() { @Override public String getUserProperty( String key ) { return request.getUserProperties().getProperty( key ); } @Override public Model getRawModel( Path p ) { return modelPool.get( p ); } @Override public Model getRawModel( String groupId, String artifactId ) { return modelPool.get( groupId, artifactId, null ); } }; request.getRepositorySession().getData().set( TransformerContext.KEY, context ); } InternalConfig config = new InternalConfig( request, modelPool, useGlobalModelCache() ? getModelCache() : new ReactorModelCache() ); Map<String, MavenProject> projectIndex = new HashMap<>( 256 ); boolean noErrors = build( results, interimResults, projectIndex, pomFiles, new LinkedHashSet<>(), true, recursive, config, poolBuilder ); ClassLoader oldContextClassLoader = Thread.currentThread().getContextClassLoader(); try { noErrors = build( results, new ArrayList<>(), projectIndex, interimResults, request, new HashMap<>(), config.session ) && noErrors; } finally { Thread.currentThread().setContextClassLoader( oldContextClassLoader ); } if ( !noErrors ) { throw new ProjectBuildingException( results ); } return results; }
Source:
public void connect(Context context, LostApiClient.ConnectionCallbacks callbacks) { this.context = context; Intent intent = new Intent(context, FusedLocationProviderService.class); context.startService(intent); if (callbacks != null) { connectionCallbacks.add(callbacks); } intent = new Intent(context, FusedLocationProviderService.class); context.bindService(intent, serviceConnection, Context.BIND_AUTO_CREATE); }

Target:
public void connect(Context context, LostApiClient.ConnectionCallbacks callbacks) { if (connectState == ConnectState.IDLE) { this.context = context; connectState = ConnectState.CONNECTING; Intent intent = new Intent(context, FusedLocationProviderService.class); context.startService(intent); intent = new Intent(context, FusedLocationProviderService.class); context.bindService(intent, serviceConnection, Context.BIND_AUTO_CREATE); } if (callbacks != null) { connectionCallbacks.add(callbacks); } }