auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static void putNextGroup( ResultSet rs, ExtMap next, ExtMap context ) throws SQLException { if (!next.containsKey(Authz.GroupRecord.NAMESPACE)) { next.put(GroupKeys.DB_ID, rs.getInt("group_id")); next.put(Authz.GroupRecord.NAMESPACE, rs.getString("namespace")); next.put(Authz.GroupRecord.ID, rs.getString("group_uuid")); next.put(Authz.GroupRecord.NAME, rs.getString("group_name")); next.put(Authz.GroupRecord.DISPLAY_NAME, rs.getString("group_display_name")); next.putIfAbsent(Authz.GroupRecord.DISPLAY_NAME, ""); next.put(AuthzInternal.GROUP_DESCRIPTION, rs.getString("group_description")); next.putIfAbsent(AuthzInternal.GROUP_DESCRIPTION, ""); next.put(Authz.GroupRecord.GROUPS, new ArrayList<ExtMap>()); } if (context.get(Global.SearchContext.WITH_GROUPS, Boolean.class)) { String nested = rs.getString("group_group_id"); if (nested != null) { ExtMap group = new ExtMap(); group.put(Authz.GroupRecord.NAMESPACE, rs.getString("namespace")); group.put(Authz.GroupRecord.ID, rs.getString("group_group_uuid")); group.put(Authz.GroupRecord.NAME, rs.getString("group_group_name")); group.put(Authz.GroupRecord.DISPLAY_NAME, rs.getString("group_group_display_name")); group.putIfAbsent(Authz.GroupRecord.DISPLAY_NAME, ""); group.put(AuthzInternal.GROUP_DESCRIPTION, rs.getString("group_group_description")); group.putIfAbsent(AuthzInternal.GROUP_DESCRIPTION, ""); next.get(Authz.PrincipalRecord.GROUPS, ArrayList.class).add(group); } } }

Target:
private static void putNextGroup( ResultSet rs, ExtMap next, ExtMap context ) throws SQLException { if (!next.containsKey(Authz.GroupRecord.NAMESPACE)) { next.put(Authz.GroupRecord.NAMESPACE, rs.getString("namespace")); next.put(Authz.GroupRecord.ID, rs.getString("group_uuid")); next.put(Authz.GroupRecord.NAME, rs.getString("group_name")); next.put(Authz.GroupRecord.DISPLAY_NAME, rs.getString("group_display_name")); next.putIfAbsent(Authz.GroupRecord.DISPLAY_NAME, ""); next.put(AuthzInternal.GROUP_DESCRIPTION, rs.getString("group_description")); next.putIfAbsent(AuthzInternal.GROUP_DESCRIPTION, ""); next.put(Authz.GroupRecord.GROUPS, new ArrayList<ExtMap>()); } if (context.get(Global.SearchContext.ALL_ATTRIBUTES, Boolean.class, false)) { next.put(GroupKeys.DB_ID, rs.getInt("group_id")); } if (context.get(Global.SearchContext.WITH_GROUPS, Boolean.class)) { String nested = rs.getString("group_group_id"); if (nested != null) { ExtMap group = new ExtMap(); group.put(Authz.GroupRecord.NAMESPACE, rs.getString("namespace")); group.put(Authz.GroupRecord.ID, rs.getString("group_group_uuid")); group.put(Authz.GroupRecord.NAME, rs.getString("group_group_name")); group.put(Authz.GroupRecord.DISPLAY_NAME, rs.getString("group_group_display_name")); group.putIfAbsent(Authz.GroupRecord.DISPLAY_NAME, ""); group.put(AuthzInternal.GROUP_DESCRIPTION, rs.getString("group_group_description")); group.putIfAbsent(AuthzInternal.GROUP_DESCRIPTION, ""); next.get(Authz.PrincipalRecord.GROUPS, ArrayList.class).add(group); } } }
Source:
protected void onLoginFinished() { AnalyticsUtils.trackAnalyticsSignIn(mAccountStore, mSiteStore, true); mLoginListener.loggedInViaSocialAccount(SiteUtils.getCurrentSiteIds(mSiteStore, false)); }

Target:
protected void onLoginFinished() { AnalyticsUtils.trackAnalyticsSignIn(mAccountStore, mSiteStore, true); mLoginListener.loggedInViaSocialAccount(mOldSitesIDs); }
Source:
public InfinitestConfiguration parseFileContent(CharSource textConfiguration) throws IOException { List<String> excludedPatterns = new ArrayList<String>(); List<String> includedPatterns = new ArrayList<String>(); List<String> includedGroups = new ArrayList<String>(); List<String> excludedGroups = new ArrayList<String>(); List<String> testngListeners = new ArrayList<String>(); ImmutableList<LineParser> orderedLineParsers = ImmutableList.<LineParser> builder() .add(new PatternLineParser(linePattern("include"), includedPatterns)) .add(new PatternLineParser(linePattern("exclude"), excludedPatterns)) .add(new PatternLineParser(linePattern("includeGroups"), includedGroups)) .add(new PatternLineParser(linePattern("excludeGroups"), excludedGroups)) .add(new PatternLineParser(linePattern("testngListeners"), testngListeners)) .add(new PatternLineParser(legacySyntaxLinePattern("groups"), includedGroups)) .add(new PatternLineParser(legacySyntaxLinePattern("excluded-groups"), excludedGroups)) .add(new PatternLineParser(legacySyntaxLinePattern("listeners"), testngListeners)) .add(new CommentLineParser()) .add(new PatternLineParser(Pattern.compile("(.*)"), excludedPatterns)) .build(); for (String line : textConfiguration.readLines()) { for (LineParser lineParser : orderedLineParsers) { if (lineParser.maybeProcessLine(line)) { break; } } } return InfinitestConfiguration.builder().excludedPatterns(excludedPatterns).includedPatterns(includedPatterns) .excludedGroups(excludedGroups).includedGroups(includedGroups).testngListeners(testngListeners).build(); }

Target:
public InfinitestConfiguration parseFileContent(CharSource textConfiguration) throws IOException { List<String> excludedPatterns = new ArrayList<String>(); List<String> includedPatterns = new ArrayList<String>(); List<String> includedGroups = new ArrayList<String>(); List<String> excludedGroups = new ArrayList<String>(); List<String> testngListeners = new ArrayList<String>(); ImmutableList<LineParser> orderedLineParsers = ImmutableList.<LineParser> builder() .add(new PatternLineParser(linePattern("include"), includedPatterns)) .add(new PatternLineParser(linePattern("exclude"), excludedPatterns)) .add(new PatternLineParser(linePattern("includeGroups"), includedGroups)) .add(new PatternLineParser(linePattern("excludeGroups"), excludedGroups)) .add(new PatternLineParser(linePattern("testngListeners"), testngListeners)) .add(new PatternLineParser(legacySyntaxLinePattern("groups"), includedGroups)) .add(new PatternLineParser(legacySyntaxLinePattern("excluded-groups"), excludedGroups)) .add(new PatternLineParser(legacySyntaxLinePattern("listeners"), testngListeners)) .add(new CommentLineParser()) .add(new PatternLineParser(Pattern.compile("(.*)"), excludedPatterns)) .build(); for (String line : textConfiguration.readLines()) { for (LineParser lineParser : orderedLineParsers) { if (lineParser.processLineIfRelevant(line)) { break; } } } return InfinitestConfiguration.builder().excludedPatterns(excludedPatterns).includedPatterns(includedPatterns) .excludedGroups(excludedGroups).includedGroups(includedGroups).testngListeners(testngListeners).build(); }
Source:
private void downloadTokenAndStart(final Fragment fragment) { final ApiDownloader task = new ApiDownloader(fragment.getActivity(), ListFragment.lameStatic.dbHelper, null, MainActivity.TOKEN_URL, true, false, true, ApiDownloader.REQUEST_POST, new ApiListener() { @Override public void requestComplete(final JSONObject json, final boolean isCache) { try { final SharedPreferences prefs = fragment.getContext() .getSharedPreferences(ListFragment.SHARED_PREFS, 0); if (json.getBoolean("success")) { final String authname = json.getString("authname"); final String token = json.getString("token"); final SharedPreferences.Editor edit = prefs.edit(); edit.putString(ListFragment.PREF_AUTHNAME, authname); edit.putString(ListFragment.PREF_TOKEN, token); edit.apply(); start(); } else { MainActivity.warn("login failed. json: " + json); } } catch (final JSONException ex) { MainActivity.warn("json exception: " + ex + " json: " + json, ex); } } }); task.start(); }

Target:
private void downloadTokenAndStart(final Fragment fragment) { final ApiDownloader task = new ApiDownloader(fragment.getActivity(), ListFragment.lameStatic.dbHelper, null, MainActivity.TOKEN_URL, true, false, true, ApiDownloader.REQUEST_POST, new ApiListener() { @Override public void requestComplete(final JSONObject json, final boolean isCache) throws WiGLEAuthException { try { if (json.getBoolean("success")) { final String authname = json.getString("authname"); final String token = json.getString("token"); final SharedPreferences prefs = fragment.getContext() .getSharedPreferences(ListFragment.SHARED_PREFS, 0); final SharedPreferences.Editor edit = prefs.edit(); edit.putString(ListFragment.PREF_AUTHNAME, authname); edit.putString(ListFragment.PREF_TOKEN, token); edit.apply(); start(); } else if (json.has("credential_0")) { String message = "login failed for " + json.getString("credential_0"); MainActivity.warn(message); throw new WiGLEAuthException(message); } else { throw new WiGLEAuthException("Unable to log in."); } } catch (final JSONException ex) { MainActivity.warn("json exception: " + ex + " json: " + json, ex); throw new WiGLEAuthException("Unable to log in."); } } }); task.start(); }
Source:
private void releaseWhenMergeCumulateThrowsInExpand(int untilFailure, boolean shouldFail) { ByteBuf oldCumulation = UnpooledByteBufAllocator.DEFAULT.heapBuffer(8, 8); final WriteFailingByteBuf newCumulation = new WriteFailingByteBuf(untilFailure, 16); ByteBufAllocator allocator = new AbstractByteBufAllocator(false) { @Override public boolean isDirectBufferPooled() { return false; } @Override protected ByteBuf newHeapBuffer(int initialCapacity, int maxCapacity) { return newCumulation; } @Override protected ByteBuf newDirectBuffer(int initialCapacity, int maxCapacity) { throw new UnsupportedOperationException(); } }; ByteBuf in = Unpooled.buffer().writeZero(12); Throwable thrown = null; try { ByteToMessageDecoder.MERGE_CUMULATOR.cumulate(allocator, oldCumulation, in); } catch (Throwable t) { thrown = t; } assertEquals(0, in.refCnt()); if (shouldFail) { assertSame(newCumulation.writeError(), thrown); assertEquals(1, oldCumulation.refCnt()); assertEquals(0, newCumulation.refCnt()); } else { assertNull(thrown); assertEquals(0, oldCumulation.refCnt()); assertEquals(1, newCumulation.refCnt()); } }

Target:
private void releaseWhenMergeCumulateThrowsInExpand(int untilFailure, boolean shouldFail) { ByteBuf oldCumulation = UnpooledByteBufAllocator.DEFAULT.heapBuffer(8, 8); final WriteFailingByteBuf newCumulation = new WriteFailingByteBuf(untilFailure, 16); ByteBufAllocator allocator = new AbstractByteBufAllocator(false) { @Override public boolean isDirectBufferPooled() { return false; } @Override protected ByteBuf newHeapBuffer(int initialCapacity, int maxCapacity) { return newCumulation; } @Override protected ByteBuf newDirectBuffer(int initialCapacity, int maxCapacity) { throw new UnsupportedOperationException(); } }; ByteBuf in = Unpooled.buffer().writeZero(12); Throwable thrown = null; try { ByteToMessageDecoder.MERGE_CUMULATOR.cumulate(allocator, oldCumulation, in); } catch (Throwable t) { thrown = t; } assertEquals(0, in.refCnt()); if (shouldFail) { assertSame(newCumulation.writeError(), thrown); assertEquals(1, oldCumulation.refCnt()); oldCumulation.release(); assertEquals(0, newCumulation.refCnt()); } else { assertNull(thrown); assertEquals(0, oldCumulation.refCnt()); assertEquals(1, newCumulation.refCnt()); newCumulation.release(); } }
Source:
public T select() { int chance = random.nextInt(100); for (Map.Entry<T, Integer> entry : operations.entrySet()) { Integer probability = entry.getValue(); if ((chance -= probability) < 0) { return entry.getKey(); } } return defaultOperation; }

Target:
public T select() { int chance = random.nextInt(operations.length); return (T) operations[chance]; }
Source:
public FormValidation doCheckSecurityOptsString(@QueryParameter String securityOptsString) { final List<String> securityOpts = splitAndFilterEmptyList(securityOptsString, "\n"); for (String securityOpt : securityOpts) { if (securityOpt.trim().split("=").length < 2) { return FormValidation.error("Wrong security option format: '%s'", securityOpt); } } return FormValidation.ok(); }

Target:
public FormValidation doCheckSecurityOptsString(@QueryParameter String securityOptsString) { final List<String> securityOpts = splitAndFilterEmptyList(securityOptsString, "\n"); for (String securityOpt : securityOpts) { if ( !( securityOpt.trim().split("=").length == 2 || securityOpt.trim().startsWith( "no-new-privileges" ) ) ) { return FormValidation.warning("Security option may be incorrect. Please double check syntax: '%s'", securityOpt); } } return FormValidation.ok(); }
Source:
private void setRegexMatchedTopicsToSourceNodes() { if (hasSubscriptionUpdates()) { for (final String nodeName : nodeToSourcePatterns.keySet()) { final List<String> sourceTopics = ((SourceNodeFactory) nodeFactories.get(nodeName)) .getTopics(subscriptionUpdates); nodeToSourceTopics.put(nodeName, sourceTopics); sourceTopicNames.addAll(sourceTopics); } log.debug("Updated nodeToSourceTopics: {}", nodeToSourceTopics); } }

Target:
private void setRegexMatchedTopicsToSourceNodes() { if (hasSubscriptionUpdates()) { for (final String nodeName : nodeToSourcePatterns.keySet()) { final SourceNodeFactory sourceNode = (SourceNodeFactory) nodeFactories.get(nodeName); final List<String> sourceTopics = sourceNode.getTopics(subscriptionUpdates); nodeToSourceTopics.put(nodeName, sourceTopics); sourceTopicNames.addAll(sourceTopics); } log.debug("Updated nodeToSourceTopics: {}", nodeToSourceTopics); } }
Source:
public void testBookieStartException() throws Exception { File journalDir = createTempDir("bookie", "journal"); Bookie.checkDirectoryStructure(Bookie.getCurrentDirectory(journalDir)); File ledgerDir = createTempDir("bookie", "ledger"); Bookie.checkDirectoryStructure(Bookie.getCurrentDirectory(ledgerDir)); int numOfEntries = 100; BookieJournalTest.writeV5Journal(Bookie.getCurrentDirectory(journalDir), numOfEntries, "testV5Journal".getBytes()); ServerConfiguration conf = TestBKConfiguration.newServerConfiguration(); int port = PortManager.nextFreePort(); conf.setBookiePort(port).setJournalDirName(journalDir.getPath()) .setLedgerDirNames(new String[] { ledgerDir.getPath() }).setMetadataServiceUri(metadataServiceUri) .setLedgerStorageClass(MockInterleavedLedgerStorage.class.getName()); BookieConfiguration bkConf = new BookieConfiguration(conf); Cookie.Builder cookieBuilder = Cookie.generateCookie(conf); Cookie cookie = cookieBuilder.build(); cookie.writeToDirectory(new File(journalDir, "current")); cookie.writeToDirectory(new File(ledgerDir, "current")); LifecycleComponent server = Main.buildBookieServer(bkConf); CompletableFuture<Void> startFuture = ComponentStarter.startComponent(server); startFuture.get(); }

Target:
public void testBookieStartException() throws Exception { File journalDir = createTempDir("bookie", "journal"); Bookie.checkDirectoryStructure(Bookie.getCurrentDirectory(journalDir)); File ledgerDir = createTempDir("bookie", "ledger"); Bookie.checkDirectoryStructure(Bookie.getCurrentDirectory(ledgerDir)); int numOfEntries = 100; BookieJournalTest.writeV5Journal(Bookie.getCurrentDirectory(journalDir), numOfEntries, "testV5Journal".getBytes()); ServerConfiguration conf = TestBKConfiguration.newServerConfiguration(); int port = PortManager.nextFreePort(); conf.setBookiePort(port).setJournalDirName(journalDir.getPath()) .setLedgerDirNames(new String[] { ledgerDir.getPath() }).setMetadataServiceUri(metadataServiceUri) .setLedgerStorageClass(MockInterleavedLedgerStorage.class.getName()); BookieConfiguration bkConf = new BookieConfiguration(conf); Cookie.Builder cookieBuilder = Cookie.generateCookie(conf); Cookie cookie = cookieBuilder.build(); cookie.writeToDirectory(new File(journalDir, "current")); cookie.writeToDirectory(new File(ledgerDir, "current")); LifecycleComponent server = Main.buildBookieServer(bkConf); CompletableFuture<Void> startFuture = ComponentStarter.startComponent(server); startFuture.get(); loggerOutput.expect((List<LoggingEvent> logEvents) -> { assertThat(logEvents, hasItem(hasProperty("message", containsString("Triggered exceptionHandler of Component:")))); }); }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_firestore_paging); ButterKnife.bind(this); mFirestore = FirebaseFirestore.getInstance(); mProgressBar.setIndeterminate(true); setUpAdapter(); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_firestore_paging); ButterKnife.bind(this); mFirestore = FirebaseFirestore.getInstance(); mItemsCollection = mFirestore.collection("items"); setUpAdapter(); }
Source:
public float getFloat(ByteBuffer buf, int position) { return delegate.getFloat(buf, position + Byte.BYTES); }

Target:
public float getFloat(ByteBuffer buf, int position) { if (isNull(buf, position)) { throw new IllegalStateException("Cannot return float for Null Value"); } return delegate.getFloat(buf, position + Byte.BYTES); }
Source:
public boolean shouldForceTargets() { totem.onChunkUnloaded(); totem.world.isAreaLoaded(pos, (int)villageArea.getAverageEdgeLength()); return this.totem.captureForceTargetTimer > VampirismConfig.BALANCE.viForceTargetTime.get(); }

Target:
public boolean shouldForceTargets() { return this.totem.captureForceTargetTimer > VampirismConfig.BALANCE.viForceTargetTime.get(); }
Source:
public int getSSLPort() { if (ports.containsKey("sslport")) { return ports.get("sslport"); } else { throw new IllegalStateException("No SSL port exists for the Data Node " + hostname + ":" + port); } }

Target:
public int getSSLPort() { if (hasSSLPort()) { return ports.get(PortType.SSL); } else { throw new IllegalStateException("No SSL port exists for the Data Node " + hostname + ":" + port); } }
Source:
private void internalStopTracking() { if (isTracking()) { if (logger.isLoggable(getClass(), TechnicalLogSeverity.WARNING)) { this.logger.log(getClass(), TechnicalLogSeverity.WARNING, "Stopping Time tracker tracking..."); } if (flushThread.isStarted()) { flushThread.interrupt(); } for (final FlushEventListener listener : getActiveFlushEventListeners()) { listener.notifyStopTracking(); } if (logger.isLoggable(getClass(), TechnicalLogSeverity.WARNING)) { this.logger.log(getClass(), TechnicalLogSeverity.WARNING, "Time tracker tracking is deactivated."); } } }

Target:
private void internalStopTracking() { if (isTracking()) { log(TechnicalLogSeverity.WARNING, "Stopping Time tracker tracking..."); if (flushThread.isStarted()) { flushThread.interrupt(); } for (final FlushEventListener listener : getActiveFlushEventListeners()) { listener.notifyStopTracking(); } log(TechnicalLogSeverity.WARNING, "Time tracker tracking is deactivated."); } }
Source:
public void visitToken(DetailAST ast) { final int type = ast.getType(); final boolean hasNoSlist = ast.findFirstToken(TokenTypes.SLIST) == null; boolean hasViolation = hasNoSlist && !isSkipStatement(ast); switch (type) { case TokenTypes.LITERAL_FOR: case TokenTypes.LITERAL_WHILE: hasViolation = hasViolation && !isEmptyLoopBodyAllowed(ast); break; case TokenTypes.LITERAL_CASE: case TokenTypes.LITERAL_DEFAULT: hasViolation = hasViolation && hasUnbracedStatements(ast); break; case TokenTypes.LITERAL_ELSE: hasViolation = hasViolation && ast.findFirstToken(TokenTypes.LITERAL_IF) == null; break; default: break; } if (hasViolation) { log(ast.getLineNo(), MSG_KEY_NEED_BRACES, ast.getText()); } }

Target:
public void visitToken(DetailAST ast) { final boolean hasNoSlist = ast.findFirstToken(TokenTypes.SLIST) == null; if (hasNoSlist && !isSkipStatement(ast) && isBracesNeeded(ast)) { log(ast.getLineNo(), MSG_KEY_NEED_BRACES, ast.getText()); } }
Source:
public int compare(@NotNull TcpDiscoveryNode firstNode, @NotNull TcpDiscoveryNode secondNode) { Long firstRegionId = firstNode.getClusterRegionId(); Long secondRegionId = secondNode.getClusterRegionId(); if (firstRegionId == null && secondRegionId == null) return firstNode.compareTo(secondNode); if (firstRegionId == null) return -1; if (secondRegionId == null) return 1; if (firstRegionId.equals(secondRegionId)) return firstNode.compareTo(secondNode); return firstRegionId.compareTo(secondRegionId); }

Target:
@Override public int compare(@NotNull TcpDiscoveryNode firstNode, @NotNull TcpDiscoveryNode secondNode) { long firstRegionId = firstNode.getClusterRegionId(); long secondRegionId = secondNode.getClusterRegionId(); if (firstRegionId == secondRegionId) return firstNode.compareTo(secondNode); return (firstRegionId<secondRegionId)?-1:1; }
Source:
public void testIdempotentReprocess() throws IOException { final IndexableAdapter adapter = new QueryableIndexIndexableAdapter(IndexIO.loadIndex(persistTmpDir)); Assert.assertEquals(events.size(), adapter.getNumRows()); reprocessAndValidate(persistTmpDir, tmpDir); final File tmpDir2 = Files.createTempDir(); try { final IndexableAdapter adapter2 = new QueryableIndexIndexableAdapter(IndexIO.loadIndex(tmpDir)); Assert.assertEquals(events.size(), adapter2.getNumRows()); reprocessAndValidate(tmpDir, tmpDir2); final File tmpDir3 = Files.createTempDir(); try { final IndexableAdapter adapter3 = new QueryableIndexIndexableAdapter(IndexIO.loadIndex(tmpDir2)); Assert.assertEquals(events.size(), adapter3.getNumRows()); reprocessAndValidate(tmpDir2, tmpDir3); } finally { FileUtils.deleteDirectory(tmpDir3); } } finally { FileUtils.deleteDirectory(tmpDir2); } }

Target:
public void testIdempotentReprocess() throws IOException { final IndexableAdapter adapter = new QueryableIndexIndexableAdapter(IndexIO.loadIndex(persistTmpDir)); Assert.assertEquals(events.size(), adapter.getNumRows()); final File tmpDir1 = new File(tmpDir, "reprocessed1"); reprocessAndValidate(persistTmpDir, tmpDir1); final File tmpDir2 = new File(tmpDir, "reprocessed2"); final IndexableAdapter adapter2 = new QueryableIndexIndexableAdapter(IndexIO.loadIndex(tmpDir1)); Assert.assertEquals(events.size(), adapter2.getNumRows()); reprocessAndValidate(tmpDir1, tmpDir2); final File tmpDir3 = new File(tmpDir, "reprocessed3"); final IndexableAdapter adapter3 = new QueryableIndexIndexableAdapter(IndexIO.loadIndex(tmpDir2)); Assert.assertEquals(events.size(), adapter3.getNumRows()); reprocessAndValidate(tmpDir2, tmpDir3); }
Source:
public void test() throws Exception { String txnAsString = null; tm.setTransactionTimeout(1); try { tm.begin(); txnAsString = tm.getTransaction().toString(); TxTestUtil.waitForTimeout(tm); tm.commit(); } catch (RollbackException e) { try { log.debugf("Rollbacking transaction '%s'", txnAsString); tm.rollback(); Assert.fail("Rollback should throw IllegalStateException: BaseTransaction.rollback - ARJUNA016074: no transaction!" + " as the original transaction should be aborted by transaction manager"); } catch (Exception rollbacke) { log.debugf(rollbacke, "Got expected transaction: %s'", rollbacke.getClass()); } } tm.setTransactionTimeout(0); tm.begin(); txnAsString = tm.getTransaction().toString(); TxTestUtil.waitForTimeout(tm); tm.commit(); }

Target:
public void test() throws Exception { String txnAsString = null; tm.setTransactionTimeout(1); try { tm.begin(); txnAsString = tm.getTransaction().toString(); TxTestUtil.waitForTimeout(tm); tm.commit(); } catch (RollbackException e) { try { log.tracef("Rollbacking transaction '%s'", txnAsString); tm.rollback(); Assert.fail("Rollback should throw IllegalStateException: BaseTransaction.rollback - ARJUNA016074: no transaction!" + " as the original transaction should be aborted by transaction manager"); } catch (Exception rollbacke) { log.debugf(rollbacke, "Got expected transaction: %s'", rollbacke.getClass()); } } finally { tm.setTransactionTimeout(0); } tm.begin(); txnAsString = tm.getTransaction().toString(); TxTestUtil.waitForTimeout(tm); tm.commit(); }
Source:
public void testArraysOfNulls() throws Exception { for (Type type : ImmutableList.of(BOOLEAN, BIGINT, INTEGER, SMALLINT, TINYINT, DOUBLE, REAL, TIMESTAMP, DECIMAL_TYPE_PRECISION_19, DECIMAL_TYPE_PRECISION_4, VARCHAR, CharType.createCharType(10), VARBINARY, arrayType(INTEGER))) { tester.testRoundTrip(arrayType(type), nCopies(30_000, nCopies(5, null)), ImmutableList.of( ImmutableMap.of(new Subfield("c[2]"), IS_NULL), ImmutableMap.of(new Subfield("c[2]"), IS_NOT_NULL))); } }

Target:
public void testArraysOfNulls() throws Exception { for (Type type : ImmutableList.of(BOOLEAN, BIGINT, INTEGER, SMALLINT, TINYINT, DOUBLE, REAL, TIMESTAMP, DECIMAL_TYPE_PRECISION_19, DECIMAL_TYPE_PRECISION_4, VARCHAR, CHAR_10, VARBINARY, arrayType(INTEGER))) { tester.testRoundTrip(arrayType(type), nCopies(NUM_ROWS, nCopies(5, null)), ImmutableList.of( ImmutableMap.of(new Subfield("c[2]"), IS_NULL), ImmutableMap.of(new Subfield("c[2]"), IS_NOT_NULL))); } }
Source:
protected boolean validateImageTransfer() { DiskImage diskImage = getDiskImage(); DiskValidator diskValidator = getDiskValidator(diskImage); DiskImagesValidator diskImagesValidator = getDiskImagesValidator(diskImage); StorageDomainValidator storageDomainValidator = getStorageDomainValidator( storageDomainDao.getForStoragePool(diskImage.getStorageIds().get(0), diskImage.getStoragePoolId())); return validate(diskValidator.isDiskExists()) && validateActiveDiskPluggedToAnyNonDownVm(diskImage, diskValidator) && validate(diskImagesValidator.diskImagesNotIllegal()) && validate(diskImagesValidator.diskImagesNotLocked()) && validate(storageDomainValidator.isDomainExistAndActive()); }

Target:
protected boolean validateImageTransfer() { DiskImage diskImage = getDiskImage(); DiskValidator diskValidator = getDiskValidator(diskImage); DiskImagesValidator diskImagesValidator = getDiskImagesValidator(diskImage); StorageDomainValidator storageDomainValidator = getStorageDomainValidator( storageDomainDao.getForStoragePool(diskImage.getStorageIds().get(0), diskImage.getStoragePoolId())); boolean isValid = validate(diskValidator.isDiskExists()) && validate(diskImagesValidator.diskImagesNotIllegal()) && validate(storageDomainValidator.isDomainExistAndActive()); if (getParameters().getBackupId() != null) { return isValid && validate(isVmBackupExists()); } return isValid && validateActiveDiskPluggedToAnyNonDownVm(diskImage, diskValidator) && validate(diskImagesValidator.diskImagesNotLocked()); }
Source:
public Collection<ImmutableWorkerInfo> getBlackListedWorkers() { return ImmutableList.copyOf( Collections2.transform( blackListedWorkers, new Function<ZkWorker, ImmutableWorkerInfo>() { @Override public ImmutableWorkerInfo apply(ZkWorker input) { return input.toImmutable(); } } ) ); }

Target:
public Collection<ImmutableWorkerInfo> getBlackListedWorkers() { return getImmutableWorkerFromZK(blackListedWorkers); }
Source:
public Optional<Argument> build(Type type, Object value, ConfigRegistry config) { if (!(value instanceof Duration)) { return Optional.empty(); } Duration duration = (Duration)value; final boolean isNegative = duration.isNegative(); if (isNegative) { duration = duration.negated(); } final long days = duration.toDays(); if (days > Integer.MAX_VALUE) { throw new IllegalArgumentException( String.format("duration %s too large to be represented unambiguously as postgres interval", duration)); } duration = duration.minusDays(days); final int hours = (int)duration.toHours(); duration = duration.minusHours(hours); final int minutes = (int)duration.toMinutes(); duration = duration.minusMinutes(minutes); if (duration.getNano() % 1000 != 0) { throw new IllegalArgumentException( String.format("duration %s too precise to represented as postgres interval", duration)); } double seconds = duration.getSeconds() + duration.getNano() / 1e9; final PGInterval interval = new PGInterval(0, 0, (int)days, hours, minutes, seconds); if (isNegative) { interval.scale(-1); } return Optional.of((i, p, cx) -> p.setObject(i, interval, Types.OTHER)); }

Target:
public Optional<Argument> build(Type type, Object value, ConfigRegistry config) { if (Duration.class != type) { return Optional.empty(); } if (null == value) { return Optional.of(new NullArgument(Types.OTHER)); } Duration duration = (Duration)value; final boolean isNegative = duration.isNegative(); if (isNegative) { duration = duration.negated(); } final long days = duration.toDays(); if (days > Integer.MAX_VALUE) { throw new IllegalArgumentException( String.format("duration %s too large to be represented unambiguously as postgres interval", duration)); } duration = duration.minusDays(days); final int hours = (int)duration.toHours(); duration = duration.minusHours(hours); final int minutes = (int)duration.toMinutes(); duration = duration.minusMinutes(minutes); if (duration.getNano() % 1000 != 0) { throw new IllegalArgumentException( String.format("duration %s too precise to represented as postgres interval", duration)); } double seconds = duration.getSeconds() + duration.getNano() / 1e9; final PGInterval interval = new PGInterval(0, 0, (int)days, hours, minutes, seconds); if (isNegative) { interval.scale(-1); } return Optional.of((i, p, cx) -> p.setObject(i, interval, Types.OTHER)); }
Source:
public boolean scaleIn() throws AvroRemoteException { final String removedTaskName = getMinimumLoadTask(); final boolean stopTaskSuccess = proxyToDriver.stopTask(removedTaskName); if (stopTaskSuccess) { final ExecutorService singleThreadedExecutor = Executors.newSingleThreadExecutor(); final TaskStats taskStats = taskStatsMap.removeTask(removedTaskName); singleThreadedExecutor .submit(new RecoveryStarter(taskStats.getGroupStatsMap(), recoveryScheduler)); return true; } else { return false; } }

Target:
public boolean scaleIn() throws AvroRemoteException { final String removedTaskName = getMinimumLoadTask(); final boolean stopTaskSuccess = proxyToDriver.stopTask(removedTaskName); if (stopTaskSuccess) { final TaskStats taskStats = taskStatsMap.removeTask(removedTaskName); singleThreadedExecutor .submit(new RecoveryStarter(taskStats.getGroupStatsMap(), recoveryScheduler)); return true; } else { return false; } }
Source:
public void getMeasurementSuccess() { final CountDownLatch signal = new CountDownLatch(1); a.getApiClient().getMeasurement(EXISTING_REPORT_ID, null).enqueue(new GetMeasurementsCallback() { @Override public void onSuccess(ApiMeasurement.Result result) { Assert.assertNotNull(result); signal.countDown(); } @Override public void onError(String msg) { Assert.fail(); signal.countDown(); } }); try { signal.await(1, TimeUnit.MINUTES); } catch (InterruptedException e) { e.printStackTrace(); } }

Target:
public void getMeasurementSuccess() { final CountDownLatch signal = new CountDownLatch(1); a.getApiClient().getMeasurement(EXISTING_REPORT_ID, null).enqueue(new GetMeasurementsCallback() { @Override public void onSuccess(ApiMeasurement.Result result) { Assert.assertNotNull(result); signal.countDown(); } @Override public void onError(String msg) { Assert.fail(); signal.countDown(); } }); try { signal.await(1, TimeUnit.MINUTES); } catch (InterruptedException e) { e.printStackTrace(); Assert.fail(); } }
Source:
public void afterPropertiesSet() throws Exception { if (this.mongoTemplate == null) { if (this.mappingMongoConverter == null) { this.mappingMongoConverter = new MappingMongoConverter(this.mongoDbFactory, new MongoMappingContext()); this.mappingMongoConverter.setApplicationContext(this.applicationContext); Assert.state(!(this.messageToDbConverter != null ^ this.dbToMessageConverter != null), "Both 'messageToDbConverter' and 'dbToMessageConverter' should be provided, or no one " + "in case of 'mongoDbFactory' is configured. " + "If these converters arn't provided 'MongoDbMessageBytesConverter' will be used by default"); List<Object> customConverters = new ArrayList<Object>(); customConverters.add(new MongoDbMessageBytesConverter()); this.mappingMongoConverter.setCustomConversions(new CustomConversions(customConverters)); this.mappingMongoConverter.afterPropertiesSet(); } else { Assert.state(this.messageToDbConverter != null | this.dbToMessageConverter != null, "'messageToDbConverter' and 'dbToMessageConverter' can't provided, if 'mappingMongoConverter' is configured." + "All conversion will rely on provided 'dbToMessageConverter'."); } this.mongoTemplate = new MongoTemplate(this.mongoDbFactory, this.mappingMongoConverter); this.mongoTemplate.setApplicationContext(this.applicationContext); } else { Assert.state(this.messageToDbConverter != null | this.dbToMessageConverter != null, "'messageToDbConverter' and 'dbToMessageConverter' can't provided, if 'mongoTemplate' is configured." + "All conversion will rely on provided 'mongoTemplate'."); } IndexOperations indexOperations = this.mongoTemplate.indexOps(this.collectionName); indexOperations.ensureIndex(new Index(MESSAGE_ID, Order.ASCENDING)); indexOperations.ensureIndex(new Index(GROUP_ID, Order.ASCENDING).on(LAST_MODIFIED_TIME, Order.DESCENDING)); }

Target:
public void afterPropertiesSet() throws Exception { if (this.mongoTemplate == null) { if (this.mappingMongoConverter == null) { this.mappingMongoConverter = new MappingMongoConverter(this.mongoDbFactory, new MongoMappingContext()); this.mappingMongoConverter.setApplicationContext(this.applicationContext); List<Object> customConverters = new ArrayList<Object>(); customConverters.add(new MongoDbMessageBytesConverter()); this.mappingMongoConverter.setCustomConversions(new CustomConversions(customConverters)); this.mappingMongoConverter.afterPropertiesSet(); } this.mongoTemplate = new MongoTemplate(this.mongoDbFactory, this.mappingMongoConverter); if (this.applicationContext != null) { this.mongoTemplate.setApplicationContext(this.applicationContext); } } IndexOperations indexOperations = this.mongoTemplate.indexOps(this.collectionName); indexOperations.ensureIndex(new Index(MESSAGE_ID, Order.ASCENDING)); indexOperations.ensureIndex(new Index(GROUP_ID, Order.ASCENDING).on(LAST_MODIFIED_TIME, Order.DESCENDING)); }
Source:
public Status insert(final String table, final String key, final Map<String, ByteIterator> values) { try { final Map<String, String> data = StringByteIterator.getStringMap(values); data.put(KEY, key); final Response response = restClient.performRequest( "POST", "/" + indexKey + "/" + table + "/", Collections.<String, String>emptyMap(), new NStringEntity(new ObjectMapper().writeValueAsString(data), ContentType.APPLICATION_JSON)); if (response.getStatusLine().getStatusCode() != 201) { return Status.ERROR; } if (!isRefreshNeeded) { synchronized (this) { isRefreshNeeded = true; } } return Status.OK; } catch (final Exception e) { e.printStackTrace(); return Status.ERROR; } }

Target:
public Status insert(final String table, final String key, final Map<String, ByteIterator> values) { try { final Map<String, String> data = StringByteIterator.getStringMap(values); data.put(KEY, key); final Response response = restClient.performRequest( "POST", "/" + indexKey + "/" + table + "/", Collections.<String, String>emptyMap(), new NStringEntity(new ObjectMapper().writeValueAsString(data), ContentType.APPLICATION_JSON)); if (response.getStatusLine().getStatusCode() != HttpStatus.SC_CREATED) { return Status.ERROR; } if (!isRefreshNeeded) { synchronized (this) { isRefreshNeeded = true; } } return Status.OK; } catch (final Exception e) { e.printStackTrace(); return Status.ERROR; } }
Source:
LocalClientConnection(ScheduledExecutorService executorService, HandlerRegistry handlers) { super(executorService); this.serverConnection = new LocalServerConnection(handlers); serverConnection.setClientConnection(this); }

Target:
LocalClientConnection(ScheduledExecutorService executorService, HandlerRegistry handlers) { super(executorService); this.serverConnection = new LocalServerConnection(handlers, this); }
Source:
void modifyBindings() throws MigrationException { try { List<Binding> bindings = connector.readBindings(); for (Binding binding : bindings) { try { binding.setBindingDetails(modifier.modifyBinding(binding.getBindingDetails())); } catch (MigrationException e) { logger.error("Error modifying binding for queue: " + binding.getQueueName() + ". Incorrect " + "binding info format: " + binding.getBindingDetails(), e); } } connector.updateBindings(bindings); addDlcBindings(); } catch (SQLException e) { throw new MigrationException("Error while modifying bindings in the database", e); } }

Target:
void modifyBindings() throws MigrationException { try { List<Binding> bindings = connector.readBindings(); for (Binding binding : bindings) { try { binding.setBindingDetails(modifier.modifyBinding(binding.getBindingDetails())); logger.info("Modified binding information in database"); } catch (MigrationException e) { logger.error("Error modifying binding for queue: " + binding.getQueueName() + ". Incorrect " + "binding info format: " + binding.getBindingDetails(), e); } } connector.updateBindings(bindings); addDlcBindings(); } catch (SQLException e) { throw new MigrationException("Error while modifying bindings in the database", e); } }
Source:
private SimpleConsumer createConsumer(TopicPartition topicPartition) { HostAndPort leader = findLeader(topicPartition); LOG.debug("leader for topic partition is {}", topicPartition.getTopic(), topicPartition.getPartition(), leader); if (leader == null) { return null; } final String clientName = getClientName(topicPartition); return createConsumer(leader.getHostText(), leader.getPort(), clientName); }

Target:
private SimpleConsumer createConsumer(TopicPartition topicPartition) { HostAndPort leader = findLeader(topicPartition); if (leader == null) { LOG.warn("no leader for topic partition {}", topicPartition.getTopic(), topicPartition.getPartition()); return null; } LOG.debug("leader for topic partition is {}", topicPartition.getTopic(), topicPartition.getPartition(), leader); final String clientName = getClientName(topicPartition); return createConsumer(leader.getHostText(), leader.getPort(), clientName); }
Source:
public String toString() { return "LockToken [lockCreated=" + isCreated + ", link=" + link.get().getFileName() + "]"; }

Target:
public String toString() { return "LockToken [lockCreated=" + isCreated + ", link=" + (link.isPresent() ? link.get().getFileName() + "]" : "<null>]"); }
Source:
private static void testPidSorting(final SWTBotTree tree, final SWTBotTimeGraph timeGraph) { SWTBotTreeColumn column = tree.header(PID_COLUMN); String[] expected = { LTTNG_CONSUMER_PROCESS_NAME, KTHREAD_PROCESS_NAME, SYSTEMD_PROCESS_NAME }; SWTBotTestCondition condition = getSortCondition(PID_COLUMN, PROCESS_COLUMN_ID, expected, timeGraph, false); clickColumn(tree, column, condition); String[] expected2 = { SYSTEMD_PROCESS_NAME, KTHREAD_PROCESS_NAME, LTTNG_CONSUMER_PROCESS_NAME }; condition = getSortCondition(PID_COLUMN, PROCESS_COLUMN_ID, expected2, timeGraph, false); clickColumn(tree, column, condition); }

Target:
private static void testPidSorting(final SWTBotTree tree, final SWTBotTimeGraph timeGraph) { SWTBotTreeColumn column = tree.header(PID_COLUMN); String[] expected = { SYSTEMD_PROCESS_NAME, KTHREAD_PROCESS_NAME, LTTNG_CONSUMER_PROCESS_NAME }; SWTBotTestCondition condition = getSortCondition(PID_COLUMN, PROCESS_COLUMN_ID, expected, timeGraph, false); clickColumn(tree, column, condition); String[] expected2 = { LTTNG_CONSUMER_PROCESS_NAME, KTHREAD_PROCESS_NAME, SYSTEMD_PROCESS_NAME }; condition = getSortCondition(PID_COLUMN, PROCESS_COLUMN_ID, expected2, timeGraph, false); clickColumn(tree, column, condition); }
Source:
protected void testStayLocalIfAllSegmentsPresentLocallyWithWriteBehindStore(boolean rehashAware) { Cache<Object, String> cache0 = cache(0, CACHE_NAME); ClusterStreamManager clusterStreamManager = replaceWithSpy(cache0); IntStream.rangeClosed(0, 499).boxed().forEach(i -> cache0.put(i, i.toString())); KeyPartitioner keyPartitioner = TestingUtil.extractComponent(cache0, KeyPartitioner.class); ConsistentHash ch = cache0.getAdvancedCache().getDistributionManager().getWriteConsistentHash(); Set<Integer> segmentsCache0 = ch.getSegmentsForOwner(address(0)); CacheStream<Map.Entry<Object, String>> stream = cache0.entrySet().stream(); if (!rehashAware) stream = stream.disableRehashAware(); Map<Object, String> entries = mapFromIterator(stream.filterKeySegments(segmentsCache0).iterator()); Map<Integer, Set<Map.Entry<Object, String>>> entriesPerSegment = generateEntriesPerSegment(keyPartitioner, entries.entrySet()); assertTrue(segmentsCache0.containsAll(entriesPerSegment.keySet())); verifyZeroInteractions(clusterStreamManager); assertTrue(cache0.getCacheConfiguration().persistence().stores().get(0).isWriteBehindShared()); }

Target:
protected void testStayLocalIfAllSegmentsPresentLocallyWithWriteBehindStore(boolean rehashAware) { Cache<Object, String> cache0 = cache(0, CACHE_NAME); ClusterStreamManager clusterStreamManager = replaceWithSpy(cache0); IntStream.rangeClosed(0, 499).boxed().forEach(i -> cache0.put(i, i.toString())); KeyPartitioner keyPartitioner = TestingUtil.extractComponent(cache0, KeyPartitioner.class); ConsistentHash ch = cache0.getAdvancedCache().getDistributionManager().getWriteConsistentHash(); Set<Integer> segmentsCache0 = ch.getSegmentsForOwner(address(0)); CacheStream<Map.Entry<Object, String>> stream = cache0.entrySet().stream(); if (!rehashAware) stream = stream.disableRehashAware(); Map<Object, String> entries = mapFromIterator(stream.filterKeySegments(segmentsCache0).iterator()); Map<Integer, Set<Map.Entry<Object, String>>> entriesPerSegment = generateEntriesPerSegment(keyPartitioner, entries.entrySet()); assertTrue(segmentsCache0.containsAll(entriesPerSegment.keySet())); verifyZeroInteractions(clusterStreamManager); assertTrue(new DistributedCacheStream(null).hasWriteBehindSharedStore(cache0.getCacheConfiguration().persistence())); }
Source:
private void useCardKnight(GameUserBean gameUser, GameBean game) throws PlayException, GameException { cardUtil.validateUserDidNotUsedCardsInCurrentTurn(game); cardUtil.validateUserDidNotBoughtCardInCurrentTurn(gameUser, DevelopmentCard.KNIGHT); cardUtil.takeDevelopmentCardFromPlayer(gameUser, DevelopmentCard.KNIGHT); game.setRobberShouldBeMovedMandatory(true); game.setDevelopmentCardUsed(true); gameUser.getAchievements().setTotalUsedKnights(gameUser.getAchievements().getTotalUsedKnights() + 1); }

Target:
private void useCardKnight(GameUserBean gameUser, GameBean game) throws PlayException, GameException { cardUtil.validateUserDidNotUsedCardsInCurrentTurn(game); cardUtil.validateUserDidNotBoughtCardInCurrentTurn(gameUser, DevelopmentCard.KNIGHT); cardUtil.takeDevelopmentCardFromPlayer(gameUser, DevelopmentCard.KNIGHT); game.setRobberShouldBeMovedMandatory(true); game.setDevelopmentCardUsed(true); Achievements achievements = gameUser.getAchievements(); int totalUsedKnightsNew = achievements.getTotalUsedKnights() + 1; achievements.setTotalUsedKnights(totalUsedKnightsNew); }
Source:
public static Comparator<EventCrf> getCompareByOrdinal() { if(compareByOrdinal != null) { return compareByOrdinal; }else { compareByOrdinal = new Comparator<EventCrf>() { @Override public int compare(EventCrf o1, EventCrf o2) { Integer o1ordinal,o2ordinal; o1ordinal = getOrdinal(o1); o2ordinal = getOrdinal(o2); return o1ordinal.compareTo(o1ordinal); }; private Integer getOrdinal(EventCrf ec) { Integer ecOrdinal = null; List<EventDefinitionCrf> edfcList1 = ec.getFormLayout().getCrf().getEventDefinitionCrfs(); for(EventDefinitionCrf edfc: edfcList1) { if(edfc.getCrf().getOcOid().equals(ec.getFormLayout().getCrf().getOcOid())){ ecOrdinal = edfc.getOrdinal(); return ecOrdinal; } } return ecOrdinal; } }; } return compareByOrdinal; }

Target:
public static Comparator<EventCrf> getCompareByOrdinal() { if(compareByOrdinal != null) { return compareByOrdinal; }else { compareByOrdinal = new Comparator<EventCrf>() { @Override public int compare(EventCrf o1, EventCrf o2) { Integer o1ordinal,o2ordinal; o1ordinal = getOrdinal(o1); o2ordinal = getOrdinal(o2); return o1ordinal.compareTo(o2ordinal); }; private Integer getOrdinal(EventCrf ec) { Integer ecOrdinal = null; StudyEventDefinition sed1 = ec.studyEvent.getStudyEventDefinition(); List<EventDefinitionCrf> edfcList1 = ec.getFormLayout().getCrf().getEventDefinitionCrfs(); for(EventDefinitionCrf edfc: edfcList1) { StudyEventDefinition sed2 = edfc.getStudyEventDefinition(); if(edfc.getCrf().getOcOid().equals(ec.getFormLayout().getCrf().getOcOid()) && sed1.getOc_oid().equals(sed2.getOc_oid())){ ecOrdinal = edfc.getOrdinal(); return ecOrdinal; } } return ecOrdinal; } }; } return compareByOrdinal; }
Source:
public void add(String lookupName, LookupExtractorFactoryContainer lookupExtractorFactoryContainer) { assertStarted(); try { if (!queue.offer(new LoadNotice(lookupName, lookupExtractorFactoryContainer), 1, TimeUnit.MILLISECONDS)) { throw new ISE("notice queue add timedout to add [%s] lookup drop notice", lookupName); } } catch (InterruptedException ex) { throw new ISE(ex, "failed to add [%s] lookup load notice", lookupName); } }

Target:
public void add(String lookupName, LookupExtractorFactoryContainer lookupExtractorFactoryContainer) { Preconditions.checkState(lifecycleLock.awaitStarted(1, TimeUnit.MILLISECONDS)); addNotice(new LoadNotice(lookupName, lookupExtractorFactoryContainer)); }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.activity_form_entry_patient_list); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); if (toolbar != null) { setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); } FormEntryPatientListFragment formEntryPatientListFragment = (FormEntryPatientListFragment) getSupportFragmentManager().findFragmentById(R.id.formEntryPatientListContentFrame); if (formEntryPatientListFragment == null) { formEntryPatientListFragment = FormEntryPatientListFragment.newInstance(); } addFragmentToActivity(getSupportFragmentManager(), formEntryPatientListFragment, R.id.formEntryPatientListContentFrame); mPresenter = new FormEntryPatientListPresenter (formEntryPatientListFragment); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.activity_form_entry_patient_list); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); if (toolbar != null) { setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); } FormEntryPatientListFragment formEntryPatientListFragment = (FormEntryPatientListFragment) getSupportFragmentManager().findFragmentById(R.id.formEntryPatientListContentFrame); if (formEntryPatientListFragment == null) { formEntryPatientListFragment = FormEntryPatientListFragment.newInstance(); } if (!formEntryPatientListFragment.isActive()) { addFragmentToActivity(getSupportFragmentManager(), formEntryPatientListFragment, R.id.formEntryPatientListContentFrame); } mPresenter = new FormEntryPatientListPresenter (formEntryPatientListFragment); }
Source:
private RebalanceMode normalizeRebalanceMode(IdealStateModeProperty mode) { RebalanceMode property; switch (mode) { case AUTO_REBALANCE: property = RebalanceMode.FULL_AUTO; break; case AUTO: property = RebalanceMode.SEMI_AUTO; break; case CUSTOMIZED: property = RebalanceMode.CUSTOMIZED; break; default: String rebalancerName = getRebalancerClassName(); if (rebalancerName != null) { if (rebalancerName.equals(JobRebalancer.class.getName()) || rebalancerName.equals(WorkflowRebalancer.class.getName())) { property = RebalanceMode.TASK; } else { property = RebalanceMode.USER_DEFINED; } } else { property = RebalanceMode.SEMI_AUTO; } break; } return property; }

Target:
private RebalanceMode normalizeRebalanceMode(IdealStateModeProperty mode) { RebalanceMode property; switch (mode) { case AUTO_REBALANCE: property = RebalanceMode.FULL_AUTO; break; case AUTO: property = RebalanceMode.SEMI_AUTO; break; case CUSTOMIZED: property = RebalanceMode.CUSTOMIZED; break; default: String rebalancerName = getRebalancerClassName(); if (rebalancerName != null) { if (rebalancerName.equals(JobRebalancer.class.getName()) || rebalancerName.equals(WorkflowRebalancer.class.getName())) { property = RebalanceMode.TASK; } else { if (LEGACY_TASK_REBALANCERS.contains(rebalancerName)) { logger.warn("The rebalancer is not supported anymore. Setting rebalance mode to USER_DEFINED.", rebalancerName); } property = RebalanceMode.USER_DEFINED; } } else { property = RebalanceMode.SEMI_AUTO; } break; } return property; }