auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public HeaderStore headerStore() { DbSource<byte[]> dataSource = keyValueDataSource("headers"); WriteCache.BytesKey<byte[]> cache = new WriteCache.BytesKey<>( new BatchSourceWriter<>(dataSource), WriteCache.CacheType.SIMPLE); cache.setFlushSource(true); dbFlushManager().addCache(cache); HeaderStore headerStore = new HeaderStore(); Source<byte[], byte[]> headers = cachedDbSource("header", new XorDataSource<>(cache, HashUtil.sha3("header".getBytes()))); Source<byte[], byte[]> index = cachedDbSource("index", new XorDataSource<>(cache, HashUtil.sha3("index".getBytes()))); headerStore.init(index, headers); return headerStore; }

Target:
public HeaderStore headerStore() { DbSource<byte[]> dataSource = headerSource(); WriteCache.BytesKey<byte[]> cache = new WriteCache.BytesKey<>( new BatchSourceWriter<>(dataSource), WriteCache.CacheType.SIMPLE); cache.setFlushSource(true); dbFlushManager().addCache(cache); HeaderStore headerStore = new HeaderStore(); Source<byte[], byte[]> headers = new XorDataSource<>(cache, HashUtil.sha3("header".getBytes())); Source<byte[], byte[]> index = new XorDataSource<>(cache, HashUtil.sha3("index".getBytes())); headerStore.init(index, headers); return headerStore; }
Source:
protected final void setState(State state) { AlluxioEvent.MasterIsTransitioning .fire(String.format("Old-State: %s, New-State: %s", mState, state)); try (LockResource lr = new LockResource(mStateLock)) { mState = state; mStateCond.signalAll(); synchronized (mListeners) { mListeners.forEach(listener -> listener.get().accept(state)); } LOG.info("Primary selector transitioning to {}", state); } }

Target:
protected final void setState(State state) { AlluxioEvent.MasterIsTransitioning.fire( new Pair<>("OldState", mState), new Pair<>("NewState", state)); try (LockResource lr = new LockResource(mStateLock)) { mState = state; mStateCond.signalAll(); synchronized (mListeners) { mListeners.forEach(listener -> listener.get().accept(state)); } LOG.info("Primary selector transitioning to {}", state); } }
Source:
private void generateTrainingData() throws Exception { switch (args.property.toLowerCase()) { case "birthdate": birthdate(); break; default: LOG.error("Cannot generate training data for property: {}", args.property); throw new IllegalArgumentException("Cannot generate training data for property: " + args.property + ". Supported properties are: " + supportedPropertiesStr); } }

Target:
private void generateTrainingData() throws IOException, ParseException, NoSuchMethodException { Method propertyFunction = null; try { propertyFunction = this.getClass().getDeclaredMethod(args.property); propertyFunction.invoke(this); } catch (NoSuchMethodException e) { String msg = "Cannot generate training data for property: " + args.property + ". Supported properties are: " + supportedPropertiesStr; LOG.error(msg); throw new IllegalArgumentException(msg); } catch (IllegalAccessException | InvocationTargetException e) { String msg = "Unable to call method: " + propertyFunction.getName(); LOG.error(msg, e); throw new IllegalArgumentException(msg); } }
Source:
protected void firePropertyChange(final int propertyId) { Object[] array = getListeners(); for (Object element : array) { final IPropertyListener l = (IPropertyListener) element; SafeRunner.run(new SafeRunnable() { @Override public void run() { l.propertyChanged(this, propertyId); } }); } }

Target:
protected void firePropertyChange(final int propertyId) { for (Object listener : getListeners()) { final IPropertyListener propertyListener = (IPropertyListener) listener; SafeRunner.run(new SafeRunnable() { @Override public void run() { propertyListener.propertyChanged(this, propertyId); } }); } }
Source:
public void test_create_user_as_regular_user_with_al_privileges() throws Exception { executeAsSuperuser("CREATE USER trillian"); executeAsSuperuser("GRANT AL TO trillian"); assertBusy(() -> { var userManager = internalCluster().getInstance(UserManager.class); var user = userManager.findUser("trillian"); assertThat(user, Matchers.notNullValue()); assertThat(user.hasPrivilege(Privilege.Type.AL, Privilege.Clazz.CLUSTER, null, "doc"), is(true)); }); executeAs("CREATE USER arthur", "trillian"); assertUserIsCreated("arthur"); executeAs("DROP USER arthur", "trillian"); assertUserDoesntExist("arthur"); }

Target:
public void test_create_user_as_regular_user_with_al_privileges() throws Exception { executeAsSuperuser("CREATE USER trillian"); executeAsSuperuser("GRANT AL TO trillian"); executeAs("CREATE USER arthur", "trillian"); assertUserIsCreated("arthur"); executeAs("DROP USER arthur", "trillian"); assertUserDoesntExist("arthur"); }
Source:
public QueuedUpdateListener() { updateDelayInterval = 5 * 1000; }

Target:
public QueuedUpdateListener() { updateDelayInterval = DEFAULT_UPDATE_DELAY; }
Source:
private FileStatus[] listConstraintFilesInDBDir(FileSystem fs, Path dbDir) { try { return fs.listStatus(new Path(dbDirs[0].getPath(), ReplicationSemanticAnalyzer.CONSTRAINTS_ROOT_DIR_NAME)); } catch (FileNotFoundException e) { return new FileStatus[]{}; } catch (IOException e) { throw new RuntimeException(e); } }

Target:
private FileStatus[] listConstraintFilesInDBDir(FileSystem fs, Path dbDir) { try { return fs.listStatus(new Path(dbDir, ReplicationSemanticAnalyzer.CONSTRAINTS_ROOT_DIR_NAME)); } catch (FileNotFoundException e) { return new FileStatus[]{}; } catch (IOException e) { throw new RuntimeException(e); } }
Source:
private Transfer retrieve( final ArtifactStore store, final String path, final boolean suppressFailures, final EventMetadata eventMetadata ) throws IndyWorkflowException { if ( store.getKey().getType() == StoreType.group ) { return null; } if ( !checkMask(store, path)) { return null; } Transfer target; final ConcreteResource res = new ConcreteResource( LocationUtils.toLocation( store ), path ); try { if ( store instanceof RemoteRepository ) { target = transfers.retrieve( res, suppressFailures, eventMetadata ); } else if ( nfc.isMissing( res ) ) { target = null; } else { target = transfers.getCacheReference( res ); if ( target == null || !target.exists() ) { logger.trace( "Resource not found when retrieved; added to NFC: {}", res ); nfc.addMissing( res ); target = null; } } } catch ( final TransferLocationException e ) { fileEventManager.fire( new IndyStoreErrorEvent( store.getKey(), e ) ); logger.warn( "Timeout / bad gateway: " + res + ". Reason: " + e.getMessage(), e ); target = null; } catch ( final TransferContentException e ) { logger.warn( "Content-Length mismatch: " + res + ". Reason: " + e.getMessage() + "\nNOTE: This may be a network error; will retry download on next request.", e ); target = null; } catch ( final TransferException e ) { logger.error( e.getMessage(), e ); throw new IndyWorkflowException( "Failed to retrieve path: from: {}. Reason: {}", e, path, store, e.getMessage() ); } return target; }

Target:
private Transfer retrieve( final ArtifactStore store, final String path, final boolean suppressFailures, final EventMetadata eventMetadata ) throws IndyWorkflowException { if ( store.getKey().getType() == StoreType.group ) { return null; } if ( !PathMaskChecker.checkMask( store, path)) { return null; } final ConcreteResource res = new ConcreteResource( LocationUtils.toLocation( store ), path ); if ( nfc.isMissing( res ) ) { return null; } Transfer target; try { if ( store instanceof RemoteRepository ) { target = transfers.retrieve( res, suppressFailures, eventMetadata ); } else { target = transfers.getCacheReference( res ); if ( target == null || !target.exists() ) { logger.trace( "Resource not found when retrieved; added to NFC: {}", res ); nfc.addMissing( res ); target = null; } } } catch ( final TransferLocationException e ) { fileEventManager.fire( new IndyStoreErrorEvent( store.getKey(), e ) ); logger.warn( "Timeout / bad gateway: " + res + ". Reason: " + e.getMessage(), e ); target = null; } catch ( final TransferContentException e ) { logger.warn( "Content-Length mismatch: " + res + ". Reason: " + e.getMessage() + "\nNOTE: This may be a network error; will retry download on next request.", e ); target = null; } catch ( final TransferException e ) { logger.error( e.getMessage(), e ); throw new IndyWorkflowException( "Failed to retrieve path: from: {}. Reason: {}", e, path, store, e.getMessage() ); } return target; }
Source:
public static EventAuthField deserialize(final ConsumerRecord<byte[], byte[]> record) { final Header typeHeader = record.headers().lastHeader(EventAuthField.AUTH_PARAM_NAME); if (null == typeHeader) { return null; } final Header valueHeader = record.headers().lastHeader(EventAuthField.AUTH_PARAM_VALUE); if (valueHeader == null) { return null; } return new EventAuthField( new String(typeHeader.value(), Charsets.UTF_8), new String(valueHeader.value(), Charsets.UTF_8)); }

Target:
public static EventAuthField deserialize(final ConsumerRecord<byte[], byte[]> record) { final Header nameHeader = record.headers().lastHeader(EventAuthField.AUTH_PARAM_NAME); if (null == nameHeader) { return null; } final Header valueHeader = record.headers().lastHeader(EventAuthField.AUTH_PARAM_VALUE); if (valueHeader == null) { return null; } return new EventAuthField( new String(nameHeader.value(), Charsets.UTF_8), new String(valueHeader.value(), Charsets.UTF_8)); }
Source:
public static PrestoThriftTupleDomain tupleDomainToThriftTupleDomain(TupleDomain<ColumnHandle> tupleDomain) { if (!tupleDomain.getDomains().isPresent()) { return new PrestoThriftTupleDomain(null); } Map<String, PrestoThriftDomain> thriftDomains = tupleDomain.getDomains().get() .entrySet().stream() .collect(toImmutableMap( entry -> ((ThriftColumnHandle) entry.getKey()).getColumnName(), entry -> fromDomain(entry.getValue()))); return new PrestoThriftTupleDomain(thriftDomains); }

Target:
public static PrestoThriftTupleDomain tupleDomainToThriftTupleDomain(TupleDomain<ColumnHandle> tupleDomain) { if (!tupleDomain.getDomains().isPresent()) { return new PrestoThriftTupleDomain(null); } return new PrestoThriftTupleDomain(tupleDomain.getDomains().get() .entrySet().stream() .collect(toImmutableMap( entry -> ((ThriftColumnHandle) entry.getKey()).getColumnName(), entry -> fromDomain(entry.getValue())))); }
Source:
protected WorkbenchJob doCreateRefreshJob() { WorkbenchJob job = super.doCreateRefreshJob(); job.addJobChangeListener(new JobChangeAdapter() { @Override public void done(IJobChangeEvent event) { CheckboxTreeViewer checkboxTreeViewer = getCheckboxTreeViewer(); if (checkboxTreeViewer.getTree().isDisposed()) { return; } checkboxTreeViewer.expandAll(); checkboxTreeViewer.setCheckedElements(getCheckedElements()); maintainAllCheckIntegrity(); } }); return job; }

Target:
protected WorkbenchJob doCreateRefreshJob() { WorkbenchJob job = super.doCreateRefreshJob(); job.addJobChangeListener(new JobChangeAdapter() { @Override public void done(IJobChangeEvent event) { maintainAllCheckIntegrity(); } }); return job; }
Source:
private void checkMeanResTimeLimit(double meanResTimeLimit) { if (meanResTimeLimit < meanResTime / 1000) { double exceededMeanResTime = meanResTime / 1000 - meanResTimeLimit; resultsErrorMessage += "Avg resp time is " + String.format("%.2f", exceededMeanResTime) + "s higher than the threshold."; } }

Target:
private void checkMeanResTimeLimit(double meanResTimeLimit) { if (meanResTimeLimit < meanResTime / 1000) { double exceededMeanResTime = meanResTime / 1000 - meanResTimeLimit; resultsErrorMessage += "Avg resp time is " + String.format("%.2f", exceededMeanResTime) + "s higher than the specified threshold."; } }
Source:
MethodHandle findStatic(Class<?> refc, String name, MethodType type) throws NoSuchMethodException, IllegalAccessException { if (refc == MethodHandle.class) { MethodHandle mh = findVirtualForMH(name, type); if (mh != null) return mh; } Method method = refc.getDeclaredMethod(name, type.ptypes()); final int modifiers = method.getModifiers(); if (!Modifier.isStatic(modifiers)) { throw new IllegalAccessException("Method" + method + " is not static"); } checkAccess(refc, method.getDeclaringClass(), modifiers, method.getName()); return new MethodHandleImpl(method.getArtMethod(), MethodHandle.INVOKE_STATIC, type); }

Target:
MethodHandle findStatic(Class<?> refc, String name, MethodType type) throws NoSuchMethodException, IllegalAccessException { if (refc == MethodHandle.class) { MethodHandle mh = findVirtualForMH(name, type); if (mh != null) { return mh; } } Method method = refc.getDeclaredMethod(name, type.ptypes()); final int modifiers = method.getModifiers(); if (!Modifier.isStatic(modifiers)) { throw new IllegalAccessException("Method" + method + " is not static"); } checkAccess(refc, method.getDeclaringClass(), modifiers, method.getName()); return new MethodHandleImpl(method.getArtMethod(), MethodHandle.INVOKE_STATIC, type); }
Source:
private synchronized void setQueryOutputInfo(QueryExecution.QueryOutputInfo outputInfo) { if (columns == null) { List<String> columnNames = outputInfo.getColumnNames(); List<Type> columnTypes = outputInfo.getColumnTypes(); checkArgument(columnNames.size() == columnTypes.size(), "Column names and types size mismatch"); ImmutableList.Builder<Column> list = ImmutableList.builder(); for (int i = 0; i < columnNames.size(); i++) { list.add(new Column(columnNames.get(i), columnTypes.get(i))); } columns = list.build(); types = outputInfo.getColumnTypes(); } for (URI outputLocation : outputInfo.getBufferLocations()) { exchangeClient.addLocation(outputLocation, TaskId.valueOf("taskid")); } if (outputInfo.isNoMoreBufferLocations()) { exchangeClient.noMoreLocations(); } }

Target:
private synchronized void setQueryOutputInfo(QueryExecution.QueryOutputInfo outputInfo) { if (columns == null) { List<String> columnNames = outputInfo.getColumnNames(); List<Type> columnTypes = outputInfo.getColumnTypes(); checkArgument(columnNames.size() == columnTypes.size(), "Column names and types size mismatch"); ImmutableList.Builder<Column> list = ImmutableList.builder(); for (int i = 0; i < columnNames.size(); i++) { list.add(new Column(columnNames.get(i), columnTypes.get(i))); } columns = list.build(); types = outputInfo.getColumnTypes(); } outputInfo.getBufferLocations().forEach(exchangeClient::addLocation); if (outputInfo.isNoMoreBufferLocations()) { exchangeClient.noMoreLocations(); } }
Source:
public static File createTempFile(@Nonnull String prefix, @Nonnull String suffix) throws CannotCreateFileException, CannotChangePermissionException { String tmpdir = System.getProperty("java.io.tmpdir"); assert tmpdir != null; Directory baseDir; try { baseDir = new Directory( tmpdir, null, Existence.MUST_EXIST, Permission.READ | Permission.WRITE, ChangePermission.NOCHANGE); return createTempFile(prefix, suffix, baseDir); } catch (NotDirectoryException | WrongPermissionException | NoSuchFileException | FileAlreadyExistsException e) { throw new AssertionError(e.getMessage(), e); } }

Target:
public static File createTempFile(@Nonnull String prefix, @Nonnull String suffix) throws CannotCreateFileException, CannotChangePermissionException, NotDirectoryException, WrongPermissionException, NoSuchFileException { String tmpdir = System.getProperty("java.io.tmpdir"); assert tmpdir != null; Directory baseDir; try { baseDir = new Directory( tmpdir, null, Existence.MUST_EXIST, Permission.READ | Permission.WRITE, ChangePermission.NOCHANGE); return createTempFile(prefix, suffix, baseDir); } catch (FileAlreadyExistsException e) { throw new AssertionError(e.getMessage(), e); } }
Source:
public void testProcessQueryGraphqlApiEmptyResults() throws NoHttpResponseException, URISyntaxException, MalformedURLException { TableExport queryObj = new TableExport(); String query = "/group?sort=commonName&fields%5Bgroup%5D=commonName,description"; String id = "edc4a871-dff2-4054-804e-d80075cf827d"; queryObj.setId(id); queryObj.setQuery(query); queryObj.setQueryType(QueryType.GRAPHQL_V1_0); queryObj.setResultType(ResultType.CSV); when(exporter.export(any())).thenReturn(Observable.empty()); when(engine.storeResults(any(), any())).thenReturn(queryObj); TableExportThread queryThread = new TableExportThread(queryObj, engine, exporter); TableExportResult queryResultObj = (TableExportResult) queryThread.call(); assertEquals(queryResultObj.getHttpStatus(), 200); assertEquals(queryResultObj.getRecordCount(), 0); }

Target:
public void testProcessQueryGraphqlApiEmptyResults() throws NoHttpResponseException, URISyntaxException, MalformedURLException { TableExport queryObj = new TableExport(); String query = "/tableExport"; String id = "edc4a871-dff2-4054-804e-d80075cf827d"; queryObj.setId(id); queryObj.setQuery(query); queryObj.setQueryType(QueryType.GRAPHQL_V1_0); queryObj.setResultType(ResultType.CSV); when(exporter.export(any())).thenReturn(Observable.empty()); when(engine.storeResults(any(), any())).thenReturn(queryObj); TableExportThread queryThread = new TableExportThread(queryObj, engine, exporter); TableExportResult queryResultObj = (TableExportResult) queryThread.call(); assertEquals(queryResultObj.getHttpStatus(), 200); assertEquals(queryResultObj.getRecordCount(), 0); }
Source:
private void updateStoragePoolFormatType() { final StoragePool storagePool = getStoragePool(); final Guid spId = storagePool.getId(); final Version spVersion = storagePool.getcompatibility_version(); final Version oldSpVersion = _oldStoragePool.getcompatibility_version(); if (oldSpVersion.equals(spVersion)) { return; } StorageFormatType targetFormat = updatePoolAndDomainsFormat(spVersion); if (_oldStoragePool.getStatus() == StoragePoolStatus.Up) { try { runVdsCommand(VDSCommandType.UpgradeStoragePool, new UpgradeStoragePoolVDSCommandParameters(spId, targetFormat)); } catch (VdcBLLException e) { log.warnFormat("Upgrade process of Storage Pool '{}' has encountered a problem due to following reason: {}", spId, e.getMessage()); AuditLogDirector.log(this, AuditLogType.UPGRADE_STORAGE_POOL_ENCOUNTERED_PROBLEMS); if (e.getVdsError() != null && e.getErrorCode() == VdcBllErrors.PoolUpgradeInProgress) { updatePoolAndDomainsFormat(oldSpVersion); return; } } } runSynchronizeOperation(new RefreshPoolSingleAsyncOperationFactory(), new ArrayList<Guid>()); }

Target:
private void updateStoragePoolFormatType() { final StoragePool storagePool = getStoragePool(); final Guid spId = storagePool.getId(); final Version spVersion = storagePool.getcompatibility_version(); final Version oldSpVersion = _oldStoragePool.getcompatibility_version(); if (oldSpVersion.equals(spVersion)) { return; } StorageFormatType targetFormat = updatePoolAndDomainsFormat(spVersion); if (_oldStoragePool.getStatus() == StoragePoolStatus.Up) { try { runVdsCommand(VDSCommandType.UpgradeStoragePool, new UpgradeStoragePoolVDSCommandParameters(spId, targetFormat)); } catch (VdcBLLException e) { log.warnFormat("Upgrade process of Storage Pool '{0}' has encountered a problem due to following reason: {1}", spId, e.getMessage()); AuditLogDirector.log(this, AuditLogType.UPGRADE_STORAGE_POOL_ENCOUNTERED_PROBLEMS); if (e.getVdsError() != null && e.getErrorCode() == VdcBllErrors.PoolUpgradeInProgress) { updatePoolAndDomainsFormat(oldSpVersion); return; } } } runSynchronizeOperation(new RefreshPoolSingleAsyncOperationFactory(), new ArrayList<Guid>()); }
Source:
public Object visit(ASTClassOrInterfaceDeclaration node, Object data) { if (node.isInterface()) { return data; } Map<MethodNameDeclaration, List<NameOccurrence>> methods = node.getScope().getEnclosingScope(ClassScope.class) .getMethodDeclarations(); List<ASTMethodDeclarator> getSetMethList = new ArrayList<>(methods.size()); for (MethodNameDeclaration d : methods.keySet()) { ASTMethodDeclarator mnd = d.getMethodNameDeclaratorNode(); if (isBeanAccessor(mnd)) { getSetMethList.add(mnd); } } String[] methNameArray = imagesOf(getSetMethList); Arrays.sort(methNameArray); Map<VariableNameDeclaration, List<NameOccurrence>> vars = node.getScope() .getDeclarations(VariableNameDeclaration.class); for (Map.Entry<VariableNameDeclaration, List<NameOccurrence>> entry : vars.entrySet()) { AccessNode accessNodeParent = entry.getKey().getAccessNodeParent(); if (entry.getValue().isEmpty() || accessNodeParent.isTransient() || accessNodeParent.isStatic()) { continue; } String varName = trimIfPrefix(entry.getKey().getImage()); varName = varName.substring(0, 1).toUpperCase() + varName.substring(1, varName.length()); boolean hasGetMethod = Arrays.binarySearch(methNameArray, "get" + varName) >= 0 || Arrays.binarySearch(methNameArray, "is" + varName) >= 0; boolean hasSetMethod = Arrays.binarySearch(methNameArray, "set" + varName) >= 0; if (!hasGetMethod || !accessNodeParent.isFinal() && !hasSetMethod) { addViolation(data, entry.getKey().getNode(), entry.getKey().getImage()); } } return super.visit(node, data); }

Target:
public Object visit(ASTClassOrInterfaceDeclaration node, Object data) { if (node.isInterface()) { return data; } Map<MethodNameDeclaration, List<NameOccurrence>> methods = node.getScope().getEnclosingScope(ClassScope.class) .getMethodDeclarations(); List<ASTMethodDeclarator> getSetMethList = new ArrayList<>(methods.size()); for (MethodNameDeclaration d : methods.keySet()) { ASTMethodDeclarator mnd = d.getMethodNameDeclaratorNode(); if (isBeanAccessor(mnd)) { getSetMethList.add(mnd); } } String[] methNameArray = imagesOf(getSetMethList); Arrays.sort(methNameArray); Map<VariableNameDeclaration, List<NameOccurrence>> vars = node.getScope() .getDeclarations(VariableNameDeclaration.class); for (Map.Entry<VariableNameDeclaration, List<NameOccurrence>> entry : vars.entrySet()) { VariableNameDeclaration decl = entry.getKey(); AccessNode accessNodeParent = decl.getAccessNodeParent(); if (entry.getValue().isEmpty() || accessNodeParent.isTransient() || accessNodeParent.isStatic()) { continue; } String varName = trimIfPrefix(decl.getImage()); varName = varName.substring(0, 1).toUpperCase() + varName.substring(1, varName.length()); boolean hasGetMethod = Arrays.binarySearch(methNameArray, "get" + varName) >= 0 || Arrays.binarySearch(methNameArray, "is" + varName) >= 0; boolean hasSetMethod = Arrays.binarySearch(methNameArray, "set" + varName) >= 0; if (!hasGetMethod || !accessNodeParent.isFinal() && !hasSetMethod) { addViolation(data, decl.getNode(), decl.getImage()); } } return super.visit(node, data); }
Source:
private static String GETRequest(String urlString) throws IOException { URL url = new URL(urlString); HttpURLConnection urlConnection = (HttpURLConnection)url.openConnection(); urlConnection.setRequestMethod("GET"); return IOUtils.toString(urlConnection.getInputStream()); }

Target:
private static String GETRequest(String urlString) throws IOException { URL url = new URL(urlString); HttpURLConnection urlConnection = (HttpURLConnection)url.openConnection(); urlConnection.setConnectTimeout(10000); urlConnection.setReadTimeout(10000); urlConnection.setRequestMethod("GET"); return IOUtils.toString(urlConnection.getInputStream()); }
Source:
public SetMultimap<String,ASMData> getAnnotationsFor(ModContainer container) { if (containerAnnotationData == null) { ImmutableMap.Builder<ModContainer, SetMultimap<String, ASMData>> mapBuilder = ImmutableMap.builder(); containers.parallelStream().forEach(cont -> { Multimap<String, ASMData> values = Multimaps.filterValues(globalAnnotationData, new ModContainerPredicate(cont)); ImmutableSetMultimap<String, ASMData> immutableValues = ImmutableSetMultimap.copyOf(values); synchronized (mapBuilder) { mapBuilder.put(cont, immutableValues); } }); containerAnnotationData = mapBuilder.build(); } return containerAnnotationData.get(container); }

Target:
public SetMultimap<String,ASMData> getAnnotationsFor(ModContainer container) { if (containerAnnotationData == null) { containerAnnotationData = containers.parallelStream() .map(cont -> Pair.of(cont, ImmutableSetMultimap.copyOf(Multimaps.filterValues(globalAnnotationData, new ModContainerPredicate(cont))))) .collect(ImmutableMap.toImmutableMap(Pair::getKey, Pair::getValue)); } return containerAnnotationData.get(container); }
Source:
public VDS get(Guid vdsId) { VDS vdsPartial = new VDS(); vdsPartial.setStaticData(DbFacade.getInstance().getVdsStaticDao().get(vdsId)); vdsPartial.setDynamicData(DbFacade.getInstance().getVdsDynamicDao().get(vdsId)); VDSGroup group = DbFacade.getInstance().getVdsGroupDao().get(vdsPartial.getVdsGroupId()); vdsPartial.setVdsGroupCompatibilityVersion(group.getcompatibility_version()); vdsPartial.setVdsGroupCpuName(group.getcpu_name()); vdsPartial.setVdsGroupDescription(group.getdescription()); vdsPartial.setVdsGroupName(group.getName()); vdsPartial.setStoragePoolId(group.getStoragePoolId()); vdsPartial.setStoragePoolName(group.getStoragePoolName()); vdsPartial.setMaxVdsMemoryOverCommit(group.getmax_vds_memory_over_commit()); return vdsPartial; }

Target:
public VDS get(Guid vdsId) { VDS vdsPartial = new VDS(); vdsPartial.setStaticData(DbFacade.getInstance().getVdsStaticDao().get(vdsId)); if (vdsPartial.getStaticData() == null) { return null; } vdsPartial.setDynamicData(DbFacade.getInstance().getVdsDynamicDao().get(vdsId)); VDSGroup group = DbFacade.getInstance().getVdsGroupDao().get(vdsPartial.getVdsGroupId()); vdsPartial.setVdsGroupCompatibilityVersion(group.getcompatibility_version()); vdsPartial.setVdsGroupCpuName(group.getcpu_name()); vdsPartial.setVdsGroupDescription(group.getdescription()); vdsPartial.setVdsGroupName(group.getName()); vdsPartial.setStoragePoolId(group.getStoragePoolId()); vdsPartial.setStoragePoolName(group.getStoragePoolName()); vdsPartial.setMaxVdsMemoryOverCommit(group.getmax_vds_memory_over_commit()); return vdsPartial; }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); binding = ActvityContactUsBinding.inflate(getLayoutInflater()); setContentView(binding.getRoot()); presenter = new ContactUsPresenter(this); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setElevation(0); actionBar.setDisplayHomeAsUpEnabled(true); } binding.contactEmailButton.setOnClickListener(v -> { Intent sendMailIntent = new Intent(Intent.ACTION_SENDTO); String mailTo = getString(R.string.MIME_type_mail).concat(binding.contactEmailText.getText().toString()); sendMailIntent.setData(Uri.parse(mailTo)); try { startActivity(sendMailIntent); } catch (android.content.ActivityNotFoundException ex) { ToastUtil.showShortToast(this, ToastUtil.ToastType.ERROR, getString(R.string.no_mailing_client_found)); } }); binding.talksButton.setOnClickListener(v -> { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.contact_forum_url))); startActivity(intent); }); binding.ircButton.setOnClickListener(v -> { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.contact_irc_url))); startActivity(intent); }); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); binding = ActvityContactUsBinding.inflate(getLayoutInflater()); setContentView(binding.getRoot()); presenter = new ContactUsPresenter(this); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setElevation(0); actionBar.setDisplayHomeAsUpEnabled(true); } binding.contactEmailButton.setOnClickListener(v -> { Intent sendMailIntent = new Intent(Intent.ACTION_SENDTO); String mailTo = ApplicationConstants.MIME_TYPE_MAILTO.concat(binding.contactEmailText.getText().toString()); sendMailIntent.setData(Uri.parse(mailTo)); try { startActivity(sendMailIntent); } catch (android.content.ActivityNotFoundException ex) { ToastUtil.showShortToast(this, ToastUtil.ToastType.ERROR, getString(R.string.no_mailing_client_found)); } }); binding.talksButton.setOnClickListener(v -> { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.contact_forum_url))); startActivity(intent); }); binding.ircButton.setOnClickListener(v -> { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.contact_irc_url))); startActivity(intent); }); }
Source:
public boolean extractQuestionDetails(Map<String, String[]> requestParameters, FeedbackQuestionType questionType) { super.extractQuestionDetails(requestParameters, questionType); List<String> options = new ArrayList<>(); String numOptionsCreatedString = HttpRequestHelper.getValueFromParamMap( requestParameters, Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFCHOICECREATED); Assumption.assertNotNull("Null number of choice for Rank", numOptionsCreatedString); int numOptionsCreated = Integer.parseInt(numOptionsCreatedString); for (int i = 0; i < numOptionsCreated; i++) { String rankOption = HttpRequestHelper.getValueFromParamMap( requestParameters, Const.ParamsNames.FEEDBACK_QUESTION_RANKOPTION + "-" + i); if (rankOption != null && !rankOption.trim().isEmpty()) { options.add(rankOption); } } this.initialiseQuestionDetails(options); String minOptionsToBeRankedParameter = Strings.nullToEmpty(HttpRequestHelper.getValueFromParamMap( requestParameters, Const.ParamsNames.FEEDBACK_QUESTION_RANK_MIN_OPTIONS_TO_BE_RANKED)); String maxOptionsToBeRankedParameter = Strings.nullToEmpty(HttpRequestHelper.getValueFromParamMap( requestParameters, Const.ParamsNames.FEEDBACK_QUESTION_RANK_MAX_OPTIONS_TO_BE_RANKED)); Integer parsedMinOptionsToBeRanked = Ints.tryParse(minOptionsToBeRankedParameter); Integer parsedMaxOptionsToBeRanked = Ints.tryParse(maxOptionsToBeRankedParameter); minOptionsToBeRanked = MoreObjects.firstNonNull(parsedMinOptionsToBeRanked, NO_VALUE); maxOptionsToBeRanked = MoreObjects.firstNonNull(parsedMaxOptionsToBeRanked, NO_VALUE); return true; }

Target:
public boolean extractQuestionDetails(Map<String, String[]> requestParameters, FeedbackQuestionType questionType) { super.extractQuestionDetails(requestParameters, questionType); List<String> options = new ArrayList<>(); String numOptionsCreatedString = HttpRequestHelper.getValueFromParamMap( requestParameters, Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFCHOICECREATED); Assumption.assertNotNull("Null number of choice for Rank", numOptionsCreatedString); int numOptionsCreated = Integer.parseInt(numOptionsCreatedString); for (int i = 0; i < numOptionsCreated; i++) { String rankOption = HttpRequestHelper.getValueFromParamMap( requestParameters, Const.ParamsNames.FEEDBACK_QUESTION_RANKOPTION + "-" + i); if (rankOption != null && !rankOption.trim().isEmpty()) { options.add(rankOption); } } this.initialiseQuestionDetails(options); String minOptionsToBeRankedParameter = Strings.nullToEmpty(HttpRequestHelper.getValueFromParamMap( requestParameters, Const.ParamsNames.FEEDBACK_QUESTION_RANK_MIN_OPTIONS_TO_BE_RANKED)); String maxOptionsToBeRankedParameter = Strings.nullToEmpty(HttpRequestHelper.getValueFromParamMap( requestParameters, Const.ParamsNames.FEEDBACK_QUESTION_RANK_MAX_OPTIONS_TO_BE_RANKED)); minOptionsToBeRanked = MoreObjects.firstNonNull(Ints.tryParse(minOptionsToBeRankedParameter), NO_VALUE); maxOptionsToBeRanked = MoreObjects.firstNonNull(Ints.tryParse(maxOptionsToBeRankedParameter), NO_VALUE); return true; }
Source:
public boolean getOnlyCreateReportWithDifferentName() { return this.onlyCreateReportWithDifferentName; }

Target:
public boolean getOnlyCreateReportWithDifferentName() { if (this.onlyCreateReportWithDifferentName == null) { return false; } else { return this.onlyCreateReportWithDifferentName; } }
Source:
private void loadAuthorizedScriptsSignatures(File folder) { authorizedSelectionScripts = new HashSet<>(); for (File file : folder.listFiles()) { if (file.isFile()) { try { String script = SelectionScript.readFile(file); logger.debug("Adding authorized selection script " + file.getAbsolutePath()); authorizedSelectionScripts.add(Script.digest(script.trim())); } catch (Exception e) { logger.error(e.getMessage(), e); } } } }

Target:
private void loadAuthorizedScriptsSignatures(File folder) { authorizedSelectionScripts = new HashSet<>(); for (File file : folder.listFiles()) { if (file.isFile()) { try { String script = SelectionScript.readFile(file); logger.debug("Adding authorized selection script " + file.getAbsolutePath()); authorizedSelectionScripts.add(Script.digest(script.trim())); } catch (Exception e) { logger.error(e.getMessage(), e); throw new SecurityException("Error while reading authorized script file", e); } } } }
Source:
private Map<String, T> sync() throws KeeperException { log.debug("syncing: {}", path); final Map<String, T> newSnapshot = Maps.newHashMap(); List<String> children = null; Stat childrenStat = new Stat(); try { List<String> possibleChildren; while (children == null) { possibleChildren = curator.getChildren().storingStatIn(childrenStat) .usingWatcher(childrenWatcher) .forPath(path); if (clusterId == null) { children = possibleChildren; continue; } try { curator.inTransaction() .check().forPath(String.format("/config/id/%s", clusterId)).and() .check().withVersion(childrenStat.getVersion()).forPath(path).and() .commit(); } catch (KeeperException.BadVersionException e) { continue; } children = possibleChildren; } log.debug("children: {}", children); for (final String child : children) { final String node = ZKPaths.makePath(path, child); final byte[] bytes = curator.getData() .usingWatcher(dataWatcher) .forPath(node); final String json = new String(bytes, UTF_8); log.debug("child: {}={}", node, json); final T value; try { value = Json.read(bytes, valueType); } catch (IOException e) { log.warn("failed to parse node: {}: {}", node, json, e); continue; } newSnapshot.put(node, value); } } catch (KeeperException e) { throw e; } catch (Exception e) { throw Throwables.propagate(e); } return newSnapshot; }

Target:
private Map<String, T> sync() throws KeeperException { log.debug("syncing: {}", path); final Map<String, T> newSnapshot = Maps.newHashMap(); try { final List<String> children = getChildren(); log.debug("children: {}", children); for (final String child : children) { final String node = ZKPaths.makePath(path, child); final byte[] bytes = curator.getData() .usingWatcher(dataWatcher) .forPath(node); final String json = new String(bytes, UTF_8); log.debug("child: {}={}", node, json); final T value; try { value = Json.read(bytes, valueType); } catch (IOException e) { log.warn("failed to parse node: {}: {}", node, json, e); continue; } newSnapshot.put(node, value); } } catch (KeeperException e) { throw e; } catch (Exception e) { throw Throwables.propagate(e); } return newSnapshot; }
Source:
public void testSendSerialData802Timeout() throws Exception { PowerMockito.doReturn(XBeeProtocol.RAW_802_15_4).when(xbeeDevice, "getXBeeProtocol"); PowerMockito.doThrow(new XBeeException(XBeeException.CONNECTION_TIMEOUT)).when(xbeeDevice, "sendXBeePacket", tx16Packet); PowerMockito.doThrow(new XBeeException(XBeeException.CONNECTION_TIMEOUT)).when(xbeeDevice, "sendXBeePacket", tx64Packet); try { xbeeDevice.sendSerialData(XBEE_64BIT_ADDRESS, SEND_DATA_BYTES); fail("Tx64 frame shouldn't have been sent successfully."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (XBeeException e) { assertEquals(XBeeException.CONNECTION_TIMEOUT, e.getErrorCode()); } try { xbeeDevice.sendSerialData(XBEE_16BIT_ADDRESS, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (XBeeException e) { assertEquals(XBeeException.CONNECTION_TIMEOUT, e.getErrorCode()); } try { xbeeDevice.sendSerialData(mockedDevice, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (XBeeException e) { assertEquals(XBeeException.CONNECTION_TIMEOUT, e.getErrorCode()); } }

Target:
public void testSendSerialData802Timeout() throws Exception { PowerMockito.doReturn(XBeeProtocol.RAW_802_15_4).when(xbeeDevice, "getXBeeProtocol"); PowerMockito.doThrow(new XBeeException(XBeeException.CONNECTION_TIMEOUT)).when(xbeeDevice, "sendXBeePacket", tx16Packet); PowerMockito.doThrow(new XBeeException(XBeeException.CONNECTION_TIMEOUT)).when(xbeeDevice, "sendXBeePacket", tx64Packet); try { xbeeDevice.sendSerialData(XBEE_16BIT_ADDRESS, SEND_DATA_BYTES); fail("Tx16 frame shouldn't have been sent successfully."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (XBeeException e) { assertEquals(XBeeException.CONNECTION_TIMEOUT, e.getErrorCode()); } try { xbeeDevice.sendSerialData(XBEE_64BIT_ADDRESS, SEND_DATA_BYTES); fail("Tx64 frame shouldn't have been sent successfully."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (XBeeException e) { assertEquals(XBeeException.CONNECTION_TIMEOUT, e.getErrorCode()); } try { xbeeDevice.sendSerialData(mockedDevice, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (XBeeException e) { assertEquals(XBeeException.CONNECTION_TIMEOUT, e.getErrorCode()); } }
Source:
public void afterPropertiesSet() throws Exception { Assert.notNull(this.delegate, "A delegate item reader is required"); }

Target:
public void afterPropertiesSet() throws Exception { Assert.notNull(this.delegate, "A delegate item writer is required"); }
Source:
public void returnFalseForIsConnectedToWifiWhenNetworkConnectedToWifiIsNotConnected() { when(mockConnectivityManager.getNetworkInfo(WIFI.getValue())).thenReturn(mockNetworkInfo); when(mockNetworkInfo.isConnected()).thenReturn(false); assertThat(merlinsBeard.isConnectedTo(WIFI)).isFalse(); }

Target:
public void returnFalseForIsConnectedToWifiWhenNetworkConnectedToWifiIsNotConnected() { when(mockConnectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI)).thenReturn(mockNetworkInfo); when(mockNetworkInfo.isConnected()).thenReturn(false); assertThat(merlinsBeard.isConnectedToWifi()).isFalse(); }
Source:
public void onCreate( Bundle savedInstanceState ) { super.onCreate( savedInstanceState ); setContentView( R.layout.main ); if( Defaults.APPLICATION_ID.equals( "" ) || Defaults.API_KEY.equals( "" ) || Defaults.VERSION.equals( "" ) ) { showAlert( this, "Missing application ID and api key arguments. Login to Backendless Console, select your app and get the ID and key from the Manage > App Settings screen. Copy/paste the values into the Backendless.initApp call" ); return; } Backendless.initApp( this, Defaults.APPLICATION_ID, Defaults.API_KEY ); final EditText emailField = (EditText) findViewById( R.id.emailField ); final EditText passwordField = (EditText) findViewById( R.id.passwordField ); findViewById( R.id.loginButton ).setOnClickListener( new View.OnClickListener() { @Override public void onClick( View view ) { Backendless.UserService.login( emailField.getText().toString(), passwordField.getText().toString(), new DefaultCallback<BackendlessUser>( MainActivity.this ) { public void handleResponse( BackendlessUser backendlessUser ) { super.handleResponse( backendlessUser ); startActivity( new Intent( getBaseContext(), LoggedInActivity.class ) ); } } ); } } ); findViewById( R.id.registerButton ).setOnClickListener( new View.OnClickListener() { @Override public void onClick( View view ) { startActivity( new Intent( getBaseContext(), RegisterActivity.class ) ); } } ); }

Target:
public void onCreate( Bundle savedInstanceState ) { super.onCreate( savedInstanceState ); setContentView( R.layout.main ); if( Defaults.APPLICATION_ID.equals( "" ) || Defaults.API_KEY.equals( "" ) ) { showAlert( this, "Missing application ID and api key arguments. Login to Backendless Console, select your app and get the ID and key from the Manage > App Settings screen. Copy/paste the values into the Backendless.initApp call" ); return; } Backendless.initApp( this, Defaults.APPLICATION_ID, Defaults.API_KEY ); final EditText emailField = (EditText) findViewById( R.id.emailField ); final EditText passwordField = (EditText) findViewById( R.id.passwordField ); findViewById( R.id.loginButton ).setOnClickListener( new View.OnClickListener() { @Override public void onClick( View view ) { Backendless.UserService.login( emailField.getText().toString(), passwordField.getText().toString(), new DefaultCallback<BackendlessUser>( MainActivity.this ) { public void handleResponse( BackendlessUser backendlessUser ) { super.handleResponse( backendlessUser ); startActivity( new Intent( getBaseContext(), LoggedInActivity.class ) ); } } ); } } ); findViewById( R.id.registerButton ).setOnClickListener( new View.OnClickListener() { @Override public void onClick( View view ) { startActivity( new Intent( getBaseContext(), RegisterActivity.class ) ); } } ); }
Source:
public List<StreamsDatum> process(StreamsDatum entry) { try { if (!(entry.getDocument() instanceof Activity)) { return Lists.newArrayList(); } if (Strings.isNullOrEmpty(pattern)) { prepare(null); } Activity activity = (Activity) entry.getDocument(); Map<String, List<Integer>> matches = RegexUtils.extractMatches(pattern, activity.getContent()); Collection<T> entities = ensureTargetObject(activity); for (String key : matches.keySet()) { entities.add(prepareObject(key)); } return Lists.newArrayList(entry); } catch (Throwable e) { LOGGER.error("Throwable process {}", e); e.printStackTrace(); throw new RuntimeException(e); } }

Target:
public List<StreamsDatum> process(StreamsDatum entry) { if (!(entry.getDocument() instanceof Activity)) { return Lists.newArrayList(); } if (Strings.isNullOrEmpty(pattern)) { prepare(null); } Activity activity = (Activity) entry.getDocument(); Map<String, List<Integer>> matches = RegexUtils.extractMatches(pattern, activity.getContent()); Collection<T> entities = ensureTargetObject(activity); for (String key : matches.keySet()) { entities.add(prepareObject(key)); } return Lists.newArrayList(entry); }
Source:
public static void main(String[] args) throws Exception { Logging.initialize(); File baseDirFile = null; if (args.length > 0) { if (args.length != 1) { log.error("Only one String argument (baseDir) is allowed. It must be a URI the user has write permission."); return; } baseDirFile = new File(args[0]); } DistributedQueryRunner queryRunner = createQueryRunner(TpchTable.getTables(), ImmutableMap.of("http-server.http.port", "8080"), Optional.ofNullable(baseDirFile)); Thread.sleep(10); Logger log = Logger.get(DistributedQueryRunner.class); log.info("======== SERVER STARTED ========"); log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl()); }

Target:
public static void main(String[] args) throws Exception { Logging.initialize(); Optional<Path> baseDataDir = Optional.empty(); if (args.length > 0) { if (args.length != 1) { log.error("usage: HiveQueryRunner [baseDataDir]\n"); log.error(" [baseDataDir] is a local directory under which you want the hive_data directory to be created.]\n"); System.exit(1); } File baseDataDirFile = new File(args[0]); if (baseDataDirFile.exists()) { if (!baseDataDirFile.isDirectory()) { log.error("Error: " + baseDataDirFile.getAbsolutePath() + " is not a directory."); System.exit(1); } else if (!baseDataDirFile.canRead() || !baseDataDirFile.canWrite()) { log.error("Error: " + baseDataDirFile.getAbsolutePath() + " is not readable/writable."); System.exit(1); } } else { while (!baseDataDirFile.exists()) { baseDataDirFile = baseDataDirFile.getParentFile(); } if (!baseDataDirFile.canRead() || !baseDataDirFile.canWrite()) { log.error("Error: The ancestor directory " + baseDataDirFile.getAbsolutePath() + " is not readable/writable."); System.exit(1); } } baseDataDir = Optional.of(baseDataDirFile.toPath()); } DistributedQueryRunner queryRunner = createQueryRunner(TpchTable.getTables(), ImmutableMap.of("http-server.http.port", "8080"), baseDataDir); Thread.sleep(10); Logger log = Logger.get(DistributedQueryRunner.class); log.info("======== SERVER STARTED ========"); log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl()); }
Source:
public void testNonZeroReplicationFactor() throws Exception { Map<Integer, Integer> sphMap = Maps.newHashMap(); sphMap.put(0, 1); sphMap.put(1, 1); sphMap.put(2, 1); ClusterConfig config = new ClusterConfig(3, sphMap, 2); Map<Integer, String> topology = Maps.newHashMap(); topology.put(0, "0"); topology.put(1, "0"); topology.put(2, "0"); JSONObject obj = config.getTopology(topology); config.validate(); System.out.println(obj.toString(4)); JSONArray partitions = obj.getJSONArray("partitions"); assertEquals(1, partitions.length()); for (int ii = 0; ii < partitions.length(); ii++) { JSONObject partition = partitions.getJSONObject(ii); assertEquals(0, partition.getInt("partition_id")); JSONArray replicas = partition.getJSONArray("replicas"); assertEquals(3, replicas.length()); HashSet<Integer> replicasContents = new HashSet<Integer>(); for (int zz = 0; zz < replicas.length(); zz++) { replicasContents.add(replicas.getInt(zz)); } assertTrue(replicasContents.contains(0)); assertTrue(replicasContents.contains(1)); assertTrue(replicasContents.contains(2)); } }

Target:
public void testNonZeroReplicationFactor() throws Exception { final int hostCount = 3; final int Kfactor = 2; final int sitesperhost = 1; ClusterConfig config = new ClusterConfig(hostCount, generateSameSphMap(hostCount, sitesperhost), Kfactor); Map<Integer, String> topology = Maps.newHashMap(); topology.put(0, "0"); topology.put(1, "0"); topology.put(2, "0"); JSONObject obj = config.getTopology(topology); config.validate(); System.out.println(obj.toString(4)); JSONArray partitions = obj.getJSONArray("partitions"); assertEquals(1, partitions.length()); for (int ii = 0; ii < partitions.length(); ii++) { JSONObject partition = partitions.getJSONObject(ii); assertEquals(0, partition.getInt("partition_id")); JSONArray replicas = partition.getJSONArray("replicas"); assertEquals(3, replicas.length()); HashSet<Integer> replicasContents = new HashSet<Integer>(); for (int zz = 0; zz < replicas.length(); zz++) { replicasContents.add(replicas.getInt(zz)); } assertTrue(replicasContents.contains(0)); assertTrue(replicasContents.contains(1)); assertTrue(replicasContents.contains(2)); } }
Source:
public void unlockSingleReturnsTrueIfTokenCanBeUnlocked() throws InterruptedException { when(mockClient.unlock(any())).thenReturn(ImmutableSet.of(LOCK_TOKEN)); assertTrue(client.unlockSingle(LOCK_TOKEN)); }

Target:
public void unlockSingleReturnsTrueIfTokenCanBeUnlocked() throws InterruptedException { when(mockClient.unlock(any())).then(REPLY_WITH_FIRST_TOKEN); assertTrue(client.unlockSingle(LOCK_TOKEN)); }
Source:
private TaskInfo createTask(SqlTaskManager sqlTaskManager, TaskId taskId, ImmutableSet<ScheduledSplit> splits, OutputBuffers outputBuffers) { return sqlTaskManager.updateTask(TEST_SESSION, taskId, Optional.of(PLAN_FRAGMENT), ImmutableList.of(new TaskSource(TABLE_SCAN_NODE_ID, splits, true)), outputBuffers.withNoMoreBufferIds(), OptionalInt.empty()); }

Target:
private TaskInfo createTask(SqlTaskManager sqlTaskManager, TaskId taskId, ImmutableSet<ScheduledSplit> splits, OutputBuffers outputBuffers) { return sqlTaskManager.updateTask(TEST_SESSION, taskId, Optional.of(PLAN_FRAGMENT), ImmutableList.of(new TaskSource(TABLE_SCAN_NODE_ID, splits, true)), outputBuffers, OptionalInt.empty()); }
Source:
public void createFeedbackQuestion(FeedbackQuestionAttributes fqa) throws InvalidParametersException { String feedbackSessionName = fqa.feedbackSessionName; String courseId = fqa.courseId; List<FeedbackQuestionAttributes> questions = getFeedbackQuestionsForSession(feedbackSessionName, courseId); if (questions.isEmpty()) { Assumption.fail("Session disappeared."); } if (fqa.questionNumber < 0) { fqa.questionNumber = questions.size() + 1; } adjustQuestionNumbers(questions.size() + 1, fqa.questionNumber, questions); createFeedbackQuestionNoIntegrityCheck(fqa, fqa.questionNumber); }

Target:
public void createFeedbackQuestion(FeedbackQuestionAttributes fqa) throws InvalidParametersException { String feedbackSessionName = fqa.feedbackSessionName; String courseId = fqa.courseId; if (fsLogic.getFeedbackSession(feedbackSessionName, courseId) == null) { Assumption.fail("Session disappeared."); } List<FeedbackQuestionAttributes> questions = getFeedbackQuestionsForSession(feedbackSessionName, courseId); if (fqa.questionNumber < 0) { fqa.questionNumber = questions.size() + 1; } adjustQuestionNumbers(questions.size() + 1, fqa.questionNumber, questions); createFeedbackQuestionNoIntegrityCheck(fqa, fqa.questionNumber); }