auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void reauthenticateSuccessNoMigration() throws Exception { String expQuery = "SELECT acct FROM HibernateAccount AS acct LEFT JOIN acct.accountSubstudies AS "+ "acctSubstudy WITH acct.id = acctSubstudy.accountId WHERE acct.studyId = :studyId AND "+ "acct.email=:email GROUP BY acct.id"; HibernateAccount hibernateAccount = makeValidHibernateAccount(false); when(mockHibernateHelper.queryGet(any(), any(), any(), any(), any())).thenReturn(ImmutableList.of(hibernateAccount)); AccountSecret secret = AccountSecret.create(); when(mockAccountSecretDao.verifySecret(AccountSecretType.REAUTH, hibernateAccount.getId(), REAUTH_TOKEN, HibernateAccountDao.ROTATIONS)).thenReturn(Optional.of(secret)); Account account = dao.reauthenticate(study, REAUTH_SIGNIN); assertEquals(ACCOUNT_ID, account.getId()); assertEquals(TestConstants.TEST_STUDY_IDENTIFIER, account.getStudyId()); assertEquals(EMAIL, account.getEmail()); assertEquals(1, account.getVersion()); verify(mockHibernateHelper).queryGet(expQuery, EMAIL_QUERY_PARAMS, null, null, HibernateAccount.class); verify(mockHibernateHelper, never()).update(any(), any()); assertNull(hibernateAccount.getReauthTokenHash()); assertNull(hibernateAccount.getReauthTokenAlgorithm()); assertNull(hibernateAccount.getReauthTokenModifiedOn()); }

Target:
public void reauthenticateSuccessNoMigration() throws Exception { String expQuery = "SELECT acct FROM HibernateAccount AS acct LEFT JOIN acct.accountSubstudies AS "+ "acctSubstudy WITH acct.id = acctSubstudy.accountId WHERE acct.studyId = :studyId AND "+ "acct.email=:email GROUP BY acct.id"; HibernateAccount hibernateAccount = makeValidHibernateAccount(false); when(mockHibernateHelper.queryGet(any(), any(), any(), any(), any())).thenReturn(ImmutableList.of(hibernateAccount)); AccountSecret secret = AccountSecret.create(); when(mockAccountSecretDao.verifySecret(AccountSecretType.REAUTH, hibernateAccount.getId(), REAUTH_TOKEN, HibernateAccountDao.ROTATIONS)).thenReturn(Optional.of(secret)); Account account = dao.reauthenticate(study, REAUTH_SIGNIN); assertEquals(ACCOUNT_ID, account.getId()); assertEquals(TestConstants.TEST_STUDY_IDENTIFIER, account.getStudyId()); assertEquals(EMAIL, account.getEmail()); assertEquals(1, account.getVersion()); verify(mockHibernateHelper).queryGet(expQuery, EMAIL_QUERY_PARAMS, null, null, HibernateAccount.class); verify(mockHibernateHelper, never()).create(any(), any()); verify(mockHibernateHelper, never()).update(any(), any()); assertNull(hibernateAccount.getReauthTokenHash()); assertNull(hibernateAccount.getReauthTokenAlgorithm()); assertNull(hibernateAccount.getReauthTokenModifiedOn()); verify(mockAccountSecretDao).verifySecret(AccountSecretType.REAUTH, ACCOUNT_ID, REAUTH_TOKEN, 3); }
Source:
public Stream<InputSplit<URI>> createSplits(InputFormat inputFormat, @Nullable SplitHintSpec splitHintSpec) throws IOException { if (cacheSplitUris == null) { initalizeSplitUris(); } return cacheSplitUris.stream().map(InputSplit::new); }

Target:
public Stream<InputSplit<CloudObjectLocation>> createSplits( InputFormat inputFormat, @Nullable SplitHintSpec splitHintSpec ) { if (objects != null) { return objects.stream().map(InputSplit::new); } if (uris != null) { return uris.stream().map(CloudObjectLocation::new).map(InputSplit::new); } return StreamSupport.stream(getIterableObjectsFromPrefixes().spliterator(), false) .map(S3Utils::summaryToCloudObjectLocation) .map(InputSplit::new); }
Source:
public void doAddRole(StaplerRequest request, StaplerResponse response) throws IOException { Hudson.getInstance().checkPermission(Hudson.ADMINISTER); String type = request.getParameter("type"); String roleName = request.getParameter("roleName"); String permissions = request.getParameter("permissionIds"); String overwrite = request.getParameter("overwrite"); if(type != null && roleName != null && permissions != null) { boolean overwriteb = false; String pattern = ".*"; if(type != RoleBasedAuthorizationStrategy.GLOBAL && request.getParameter("pattern") != null) { pattern = request.getParameter("pattern"); } if(overwrite != null) { if(overwrite.equals("true")) { overwriteb = true; } } ArrayList<String> permissionList = new ArrayList<String>(); String[] split = permissions.split(","); for(int i=0; i<split.length; i++) { permissionList.add(split[i]); } Set<Permission> permissionSet = new HashSet<Permission>(); for(String p: permissionList) { permissionSet.add(Permission.fromId(p)); } Role role = new Role(roleName, pattern, permissionSet); if(overwriteb) { Role role2 = this.grantedRoles.get(type).getRole(roleName); if(role2!=null) { this.grantedRoles.get(type).removeRole(role2); } } addRole(type, role); Hudson.getInstance().save(); } }

Target:
public void doAddRole(StaplerRequest request, StaplerResponse response) throws IOException { Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER); String type = request.getParameter("type"); String roleName = request.getParameter("roleName"); String permissions = request.getParameter("permissionIds"); String overwrite = request.getParameter("overwrite"); if (type != null && roleName != null && permissions != null) { boolean overwriteb = false; String pattern = ".*"; if (type != RoleBasedAuthorizationStrategy.GLOBAL && request.getParameter("pattern") != null) { pattern = request.getParameter("pattern"); } if (overwrite != null) { if (overwrite.equals("true")) { overwriteb = true; } } ArrayList<String> permissionList = new ArrayList<String>(); String[] split = permissions.split(","); for (int i=0; i<split.length; i++) { permissionList.add(split[i]); } Set<Permission> permissionSet = new HashSet<Permission>(); for (String p: permissionList) { permissionSet.add(Permission.fromId(p)); } Role role = new Role(roleName, pattern, permissionSet); if (overwriteb) { Role role2 = this.grantedRoles.get(type).getRole(roleName); if (role2!=null) { this.grantedRoles.get(type).removeRole(role2); } } addRole(type, role); Hudson.getInstance().save(); } }
Source:
public TcpConnectionSupport getConnection() throws Exception { TcpConnectionSupport connection = this.connections.get(); if (connection == null || !connection.isOpen()) { connection = this.connectionFactory.getConnection(); connection.disableClose(); this.connections.set(connection); } return connection; }

Target:
public TcpConnectionSupport getConnection() throws Exception { TcpThreadConnection connection = this.connections.get(); if (connection == null || !connection.isOpen()) { TcpConnectionSupport delegate = this.connectionFactory.getConnection(); connection = new TcpThreadConnection(delegate); this.connections.set(connection); } return connection; }
Source:
private String generateStringSetter( final String className, final String fieldName, final String name, final String enumSetter) { return String.format( "%2$s" + " public %3$s %1$s(final CharSequence value)\n" + " {\n" + " toBytes(value, %1$s);\n" + " %1$sOffset = 0;\n" + " %1$sLength = value.length();\n" + " return this;\n" + " }\n\n" + " public %3$s %1$s(final AsciiSequenceView value)\n" + " {\n" + " if (value.length() > 0)\n" + " {\n" + " %1$s.wrap(value.buffer());\n" + " %1$sOffset = value.offset();\n" + " %1$sLength = value.length();\n" + " }\n" + " return this;\n" + " }\n\n" + " public %3$s %1$s(final char[] value)\n" + " {\n" + " return %1$s(value, 0, value.length);\n" + " }\n\n" + " public %3$s %1$s(final char[] value, final int length)\n" + " {\n" + " return %1$s(value, 0, length);\n" + " }\n\n" + " public %3$s %1$s(final char[] value, final int offset, final int length)\n" + " {\n" + " toBytes(value, %1$s, offset, length);\n" + " %1$sOffset = 0;\n" + " %1$sLength = length;\n" + " return this;\n" + " }\n\n" + "%4$s", fieldName, generateBytesSetter(className, fieldName, name), className, enumSetter); }

Target:
private String generateStringSetter( final String className, final String fieldName, final String name, final String enumSetter) { return String.format( "%2$s" + " public %3$s %1$s(final CharSequence value)\n" + " {\n" + " toBytes(value, %1$s);\n" + " %1$sOffset = 0;\n" + " %1$sLength = value.length();\n" + " return this;\n" + " }\n\n" + " public %3$s %1$s(final AsciiSequenceView value)\n" + " {\n" + " final DirectBuffer buffer = value.buffer();\n" + " if (buffer != null)\n" + " {\n" + " %1$s.wrap(buffer);\n" + " %1$sOffset = value.offset();\n" + " %1$sLength = value.length();\n" + " }\n" + " return this;\n" + " }\n\n" + " public %3$s %1$s(final char[] value)\n" + " {\n" + " return %1$s(value, 0, value.length);\n" + " }\n\n" + " public %3$s %1$s(final char[] value, final int length)\n" + " {\n" + " return %1$s(value, 0, length);\n" + " }\n\n" + " public %3$s %1$s(final char[] value, final int offset, final int length)\n" + " {\n" + " toBytes(value, %1$s, offset, length);\n" + " %1$sOffset = 0;\n" + " %1$sLength = length;\n" + " return this;\n" + " }\n\n" + "%4$s", fieldName, generateBytesSetter(className, fieldName, name), className, enumSetter); }
Source:
private AuthenticationResult acquireTokenSilentFlow(final AuthenticationRequest authenticationRequest) throws AuthenticationException { final AuthenticationResult authResult = tryAcquireTokenSilentLocally(authenticationRequest); if (isAccessTokenReturned(authResult)) { return authResult; } if (!canSwitchToBroker(authenticationRequest)) { return authResult; } Logger.d(TAG, "Cannot get AT from local cache, switch to Broker for auth, " + "clear the local token cache for the user."); removeTokensForUser(authenticationRequest); return tryAcquireTokenSilentWithBroker(authenticationRequest); }

Target:
private AuthenticationResult acquireTokenSilentFlow(final AuthenticationRequest authenticationRequest) throws AuthenticationException { final AuthenticationResult authResult = tryAcquireTokenSilentLocally(authenticationRequest); if (isAccessTokenReturned(authResult)) { return authResult; } if (!canSwitchToBroker(authenticationRequest)) { return authResult; } Logger.d(TAG, "Cannot get AT from local cache, switch to Broker for auth, " + "clear tokens from local cache for the user."); removeTokensForUser(authenticationRequest); return tryAcquireTokenSilentWithBroker(authenticationRequest); }
Source:
private static boolean createSymlinkJava7(@Nonnull File baseDir, @Nonnull String targetPath, @Nonnull String symlinkPath) throws IOException { try { Path path = new File(baseDir, symlinkPath).toPath(); Path target = Paths.get(targetPath, new String[0]); Object noAttrs = Array.newInstance(Class.forName("java.nio.file.attribute.FileAttribute"), 0); final int maxNumberOfTries = 4; final int timeInMillis = 100; for (int tryNumber = 1; tryNumber <= maxNumberOfTries; tryNumber++) { Files.deleteIfExists(path); try { Files.createSymbolicLink(path, target); break; } catch (FileAlreadyExistsException fileAlreadyExistsException) { if (tryNumber < maxNumberOfTries) { TimeUnit.MILLISECONDS.sleep(timeInMillis); continue; } LOGGER.warning("symlink FileAlreadyExistsException thrown " + maxNumberOfTries + " times => cannot createSymbolicLink"); } } return true; } catch (UnsupportedOperationException e) { return true; } catch (FileSystemException e) { if (Functions.isWindows()) { warnWindowsSymlink(); return true; } return false; } catch (Exception x) { throw (IOException) new IOException(x.toString()).initCause(x); } }

Target:
private static boolean createSymlinkJava7(@Nonnull File baseDir, @Nonnull String targetPath, @Nonnull String symlinkPath) throws IOException { try { Path path = new File(baseDir, symlinkPath).toPath(); Path target = Paths.get(targetPath, new String[0]); final int maxNumberOfTries = 4; final int timeInMillis = 100; for (int tryNumber = 1; tryNumber <= maxNumberOfTries; tryNumber++) { Files.deleteIfExists(path); try { Files.createSymbolicLink(path, target); break; } catch (FileAlreadyExistsException fileAlreadyExistsException) { if (tryNumber < maxNumberOfTries) { TimeUnit.MILLISECONDS.sleep(timeInMillis); continue; } LOGGER.warning("symlink FileAlreadyExistsException thrown " + maxNumberOfTries + " times => cannot createSymbolicLink"); throw fileAlreadyExistsException; } } return true; } catch (UnsupportedOperationException e) { return true; } catch (FileSystemException e) { if (Functions.isWindows()) { warnWindowsSymlink(); return true; } return false; } catch (IOException x) { throw x; } catch (Exception x) { throw (IOException) new IOException(x.toString()).initCause(x); } }
Source:
public StructArrayEncoder int32(String name, int value) { int fieldIndex = fieldSearcher.findFieldIndex(name, Int32Field.class, null); currentData.add(new Int32DataHolder(value, fieldIndex)); return this; }

Target:
public StructArrayEncoder int32(String name, int value) { Int32Field field = fieldSearcher.findField(name, Int32Field.class, null); currentData.add(new Int32DataHolder(value, field.index())); return this; }
Source:
public VM getVm() { VM vm = super.getVm(); if (vm != null) { return vm; } vm = getVmDAO().get(getParameters().getVmId()); if (vm != null) { setVm(vm); setVmId(vm.getId()); } return vm; }

Target:
public VM getVm() { VM vm = super.getVm(); if (vm != null) { setVm(vm); } return vm; }
Source:
public void ack(Object messageId) { if (!isAtLeastOnceProcessing()) { return; } final KafkaSpoutMessageId msgId = (KafkaSpoutMessageId) messageId; if (!msgId.isNullTuple()) { if (!emitted.contains(msgId)) { LOG.debug("Received ack for message [{}], associated with tuple emitted for a ConsumerRecord that " + "came from a topic-partition that this consumer group instance is no longer tracking " + "due to rebalance/partition reassignment. No action taken.", msgId); } else { Validate.isTrue(!retryService.isScheduled(msgId), "The message id " + msgId + " is queued for retry while being acked." + " This should never occur barring errors in the RetryService implementation or the spout code."); offsetManagers.get(msgId.getTopicPartition()).addToAckMsgs(msgId); emitted.remove(msgId); } } else { offsetManagers.get(msgId.getTopicPartition()).addToAckMsgs(msgId); LOG.debug("Received direct ack for message [{}], associated with null tuple", msgId); } tupleListener.onAck(msgId); }

Target:
public void ack(Object messageId) { if (!isAtLeastOnceProcessing()) { return; } final KafkaSpoutMessageId msgId = (KafkaSpoutMessageId) messageId; if (msgId.isNullTuple()) { offsetManagers.get(msgId.getTopicPartition()).addToAckMsgs(msgId); LOG.debug("Received direct ack for message [{}], associated with null tuple", msgId); tupleListener.onAck(msgId); return; } if (!emitted.contains(msgId)) { LOG.debug("Received ack for message [{}], associated with tuple emitted for a ConsumerRecord that " + "came from a topic-partition that this consumer group instance is no longer tracking " + "due to rebalance/partition reassignment. No action taken.", msgId); } else { Validate.isTrue(!retryService.isScheduled(msgId), "The message id " + msgId + " is queued for retry while being acked." + " This should never occur barring errors in the RetryService implementation or the spout code."); offsetManagers.get(msgId.getTopicPartition()).addToAckMsgs(msgId); emitted.remove(msgId); } tupleListener.onAck(msgId); }
Source:
public Filter rewriteRequiredColumns(Map<String, String> columnRewrites) { if (columnRewrites.get(boundDimFilter.getDimension()) == null) { throw new IAE( "Received a non-applicable rewrite: %s, filter's dimension: %s", columnRewrites, boundDimFilter.getDimension() ); } BoundDimFilter newDimFilter = new BoundDimFilter( columnRewrites.get(boundDimFilter.getDimension()), boundDimFilter.getLower(), boundDimFilter.getUpper(), boundDimFilter.isLowerStrict(), boundDimFilter.isUpperStrict(), null, boundDimFilter.getExtractionFn(), boundDimFilter.getOrdering() ); return new BoundFilter( newDimFilter ); }

Target:
public Filter rewriteRequiredColumns(Map<String, String> columnRewrites) { String rewriteDimensionTo = columnRewrites.get(boundDimFilter.getDimension()); if (rewriteDimensionTo == null) { throw new IAE( "Received a non-applicable rewrite: %s, filter's dimension: %s", columnRewrites, boundDimFilter.getDimension() ); } BoundDimFilter newDimFilter = new BoundDimFilter( rewriteDimensionTo, boundDimFilter.getLower(), boundDimFilter.getUpper(), boundDimFilter.isLowerStrict(), boundDimFilter.isUpperStrict(), null, boundDimFilter.getExtractionFn(), boundDimFilter.getOrdering() ); return new BoundFilter( newDimFilter ); }
Source:
static <T extends BaseProcessPayment> void serialize(JsonObject object, T value) { if (object == null) { throw new NullPointerException("object is null"); } if (value == null) { throw new NullPointerException("builder is null"); } object.addProperty(MEMBER_STATUS, value.status.code); object.addProperty(MEMBER_ERROR, value.error.code); object.addProperty(MEMBER_ACS_URI, value.acsUri); object.addProperty(MEMBER_INVOICE_ID, value.invoiceId); object.add(MEMBER_ACS_PARAMS, toJsonObject(value.acsParams)); object.addProperty(MEMBER_NEXT_RETRY, value.nextRetry); }

Target:
static <T extends BaseProcessPayment> void serialize(JsonObject object, T value) { checkNotNull(object, "object"); checkNotNull(value, "value"); object.addProperty(MEMBER_STATUS, value.status.code); if (value.error != null) { object.addProperty(MEMBER_ERROR, value.error.code); } else { object.addProperty(MEMBER_ACS_URI, value.acsUri); object.addProperty(MEMBER_INVOICE_ID, value.invoiceId); object.add(MEMBER_ACS_PARAMS, toJsonObject(value.acsParams)); object.addProperty(MEMBER_NEXT_RETRY, value.nextRetry); } }
Source:
public boolean isEnabled() { return Boolean.FALSE.equals(isDisabled); }

Target:
public boolean isEnabled() { return !isDisabled(); }
Source:
public SearchResults findPageForSearchQueryInAnyList(@NonNull String searchQuery) { SQLiteDatabase db = getReadableDatabase(); List<SearchResult> searchResults = new ArrayList<>(); String normalizedQuery = StringUtils.stripAccents(searchQuery).toLowerCase(Locale.getDefault()); String titleCol = ReadingListPageContract.Col.DISPLAY_TITLE.getName(); String selection = null; String[] selectionArgs = null; if (!TextUtils.isEmpty(normalizedQuery)) { normalizedQuery = normalizedQuery.replace("\\", "\\\\").replace("%", "\\%").replace("_", "\\_"); selection = "UPPER(" + titleCol + ") LIKE UPPER(?) ESCAPE '\\'"; selectionArgs = new String[]{"%" + normalizedQuery + "%"}; } try (Cursor cursor = db.query(ReadingListPageContract.TABLE, null, selection, selectionArgs, null, null, null)) { if (cursor.moveToFirst()) { ReadingListPage readingListPage = ReadingListPage.DATABASE_TABLE.fromCursor(cursor); SearchResult searchResult = new SearchResult(new PageTitle(((ReadingListPage) readingListPage).title(), ((ReadingListPage) readingListPage).wiki(), ((ReadingListPage) readingListPage).thumbUrl())); searchResult.setSearchResultTypeWithPriority(READING_LIST_SEARCH_RESULT); searchResults.add(searchResult); return new SearchResults(searchResults); } } return new SearchResults(); }

Target:
public SearchResults findPageForSearchQueryInAnyList(@NonNull String searchQuery) { SQLiteDatabase db = getReadableDatabase(); List<SearchResult> searchResults = new ArrayList<>(); String normalizedQuery = StringUtils.stripAccents(searchQuery).toLowerCase(Locale.getDefault()); String titleCol = ReadingListPageContract.Col.DISPLAY_TITLE.getName(); String selection = null; String[] selectionArgs = null; if (!TextUtils.isEmpty(normalizedQuery)) { normalizedQuery = normalizedQuery.replace("\\", "\\\\").replace("%", "\\%").replace("_", "\\_"); selection = "UPPER(" + titleCol + ") LIKE UPPER(?) ESCAPE '\\'"; selectionArgs = new String[]{"%" + normalizedQuery + "%"}; } try (Cursor cursor = db.query(ReadingListPageContract.TABLE, null, selection, selectionArgs, null, null, null)) { if (cursor.moveToFirst()) { ReadingListPage readingListPage = ReadingListPage.DATABASE_TABLE.fromCursor(cursor); SearchResult searchResult = new SearchResult(READING_LIST_SEARCH_RESULT, new PageTitle(readingListPage.title(), readingListPage.wiki(), readingListPage.thumbUrl())); searchResults.add(searchResult); return new SearchResults(searchResults); } } return new SearchResults(); }
Source:
public Object visit(ASTIfStatement node, Object data) { List<JavaNode> statementChildren = new ArrayList<>(); for (int i = 0; i < node.jjtGetNumChildren(); i++) { if (node.jjtGetChild(i) instanceof ASTStatement) { statementChildren.add((JavaNode) node.jjtGetChild(i)); } } int complexity = node.hasElse() ? 0 : 1; for (JavaNode element : statementChildren) { complexity += (Integer) element.jjtAccept(this, data); } int boolCompIf = CycloMetric.booleanExpressionComplexity(node.getFirstChildOfType(ASTExpression.class)); return boolCompIf + complexity; }

Target:
public Object visit(ASTIfStatement node, Object data) { List<ASTStatement> statementChildren = node.findChildrenOfType(ASTStatement.class); int complexity = node.hasElse() ? 0 : 1; for (ASTStatement element : statementChildren) { complexity += (Integer) element.jjtAccept(this, data); } int boolCompIf = CycloMetric.booleanExpressionComplexity(node.getFirstChildOfType(ASTExpression.class)); return boolCompIf + complexity; }
Source:
public void isCpuPinningValidWithoutPinnedHost() { VmManagementCommandBase<VmManagementParametersBase> test = spy(new VmManagementCommandBase<VmManagementParametersBase>(Guid.Empty)); VmStatic vmStatic = new VmStatic(); vmStatic.setNumOfSockets(6); vmStatic.setCpuPerSocket(2); vmStatic.setDedicatedVmForVds(null); Assert.assertFalse(test.isCpuPinningValid("0#0", vmStatic)); Assert.assertFalse(test.getReturnValue().getCanDoActionMessages().isEmpty()); Assert.assertFalse(test.getReturnValue() .getCanDoActionMessages() .contains(VdcBllMessages.ACTION_TYPE_FAILED_VM_CANNOT_BE_PINNED_TO_CPU_WITH_UNDEFINED_HOST)); }

Target:
public void isCpuPinningValidWithoutPinnedHost() { VmManagementCommandBase<VmManagementParametersBase> test = spy(new VmManagementCommandBase<VmManagementParametersBase>(Guid.Empty)); VmStatic vmStatic = new VmStatic(); vmStatic.setNumOfSockets(6); vmStatic.setCpuPerSocket(2); vmStatic.setDedicatedVmForVds(null); Assert.assertFalse(test.isCpuPinningValid("0#0", vmStatic)); Assert.assertFalse(test.getReturnValue() .getCanDoActionMessages() .contains(VdcBllMessages.ACTION_TYPE_FAILED_VM_CANNOT_BE_PINNED_TO_CPU_WITH_UNDEFINED_HOST)); }
Source:
public int getResultSize() { checkCacheAvailable(); int accumulator; if (resultSize == null) { ClusteredQueryCommand command = ClusteredQueryCommand.getResultSize(queryDefinition, cache); ClusteredQueryInvoker invoker = new ClusteredQueryInvoker(cache, asyncExecutor); List<QueryResponse> responses = invoker.broadcast(command); accumulator = 0; for (QueryResponse response : responses) { accumulator += response.getResultSize(); } resultSize = accumulator; } else { accumulator = resultSize; } return accumulator; }

Target:
public int getResultSize() { partitionHandlingSupport.checkCacheAvailable(); int accumulator; if (resultSize == null) { ClusteredQueryCommand command = ClusteredQueryCommand.getResultSize(queryDefinition, cache); ClusteredQueryInvoker invoker = new ClusteredQueryInvoker(cache, asyncExecutor); List<QueryResponse> responses = invoker.broadcast(command); accumulator = 0; for (QueryResponse response : responses) { accumulator += response.getResultSize(); } resultSize = accumulator; } else { accumulator = resultSize; } return accumulator; }
Source:
public void metersExcluded() { PrototypeMeasurementFilterSpecification.MeterFilterSpecification meterSpec = new PrototypeMeasurementFilterSpecification.MeterFilterSpecification( Arrays.asList(valueSpecAyBx, valueSpecAzBy)); PrototypeMeasurementFilterSpecification spec = new PrototypeMeasurementFilterSpecification(); spec.getInclude().put( "counter.+", new PrototypeMeasurementFilterSpecification.MeterFilterSpecification()); spec.getExclude().put( "counterC", new PrototypeMeasurementFilterSpecification.MeterFilterSpecification()); PrototypeMeasurementFilter filter = new PrototypeMeasurementFilter(spec); Id idAYX = new TestId("counterA").withTag("tagA", "Y").withTag("tagB", "X"); Id idCYX = new TestId("counterC").withTag("tagA", "Y").withTag("tagB", "X"); Assert.assertTrue(filter.test(new Measurement(idAYX, 1, 1))); Assert.assertFalse(filter.test(new Measurement(idCYX, 2, 2))); }

Target:
public void metersExcluded() { PrototypeMeasurementFilterSpecification spec = new PrototypeMeasurementFilterSpecification(); spec.getInclude().put( "counter.+", new PrototypeMeasurementFilterSpecification.MeterFilterSpecification()); spec.getExclude().put( "counterC", new PrototypeMeasurementFilterSpecification.MeterFilterSpecification()); PrototypeMeasurementFilter filter = new PrototypeMeasurementFilter(spec); Id idAYX = new TestId("counterA").withTag("tagA", "Y").withTag("tagB", "X"); Id idCYX = new TestId("counterC").withTag("tagA", "Y").withTag("tagB", "X"); Assert.assertTrue(filter.test(new Measurement(idAYX, 1, 1))); Assert.assertFalse(filter.test(new Measurement(idCYX, 2, 2))); }
Source:
boolean shouldUpdate(Player player) { if (!hasMoved) { hasMoved = true; return true; } Location currentLoc = player.getLocation(YAW_LOCATION); float currentYaw = currentLoc.getYaw(); boolean hasRotated = Math.abs(currentYaw - this.initialYaw) < 90; if (hasRotated && rotationCount < 2) { rotationCount++; return true; } double distance = currentLoc.distanceSquared(this.location); return distance > 50 * 50; }

Target:
boolean shouldUpdate(Player player) { if (!hasMoved) { hasMoved = true; reset(player); return true; } Location currentLoc = player.getLocation(YAW_LOCATION); float currentYaw = currentLoc.getYaw(); if (rotationCount < 2) { float rotationDegrees = Setting.NPC_SKIN_ROTATION_UPDATE_DEGREES.asFloat(); boolean hasRotated = Math.abs(NMS.clampYaw(currentYaw - this.initialYaw)) < rotationDegrees; if (hasRotated) { rotationCount++; reset(player); return true; } } double distance = currentLoc.distanceSquared(this.location); if (distance > MOVEMENT_SKIN_UPDATE_DISTANCE) { reset(player); return true; } else { return false; } }
Source:
public void getAllCodeSystems() { final String shortName = "newCodeSystemShortName"; final String oid = "newCodeSystemOid"; assertCodeSystemCreated(shortName, oid); final CodeSystems codeSystems = CodeSystemRequests.prepareSearchCodeSystemsInAllRepositories() .build() .execute(Services.context()); assertEquals(codeSystems.getTotal(), 2); }

Target:
public void getAllCodeSystems() { final String shortName = "newCodeSystemShortName"; final String oid = "newCodeSystemOid"; assertCodeSystemCreated(shortName, oid); final CodeSystems codeSystems = CodeSystemRequests.prepareSearchAllCodeSystems() .build() .execute(Services.context()); assertThat(codeSystems.getItems()).hasSizeGreaterThanOrEqualTo(2); }
Source:
public void testGraphTypeHandling() throws Exception { Assert.assertNotNull(context); GraphService<FooModel> fooModelService = context.getService(FooModel.class); FooModel inMemoryModel = fooModelService.createInMemory(); inMemoryModel.setProp1("prop1"); inMemoryModel.setProp2("prop2"); inMemoryModel.setProp3("prop3"); Iterable<Vertex> vertices = context.getFramed().query() .has("type", Text.CONTAINS, FooModel.class.getAnnotation(TypeValue.class).value()) .vertices(); int numberFound = 0; for (Vertex v : vertices) { numberFound++; WindupVertexFrame framed = context.getFramed().frame(v, WindupVertexFrame.class); Assert.assertTrue(framed instanceof FooModel); } Assert.assertEquals(0, numberFound); InMemoryVertexFrame inMemoryFrame = (InMemoryVertexFrame) inMemoryModel; inMemoryFrame.attach(context.getFramed()); numberFound = 0; for (Vertex v : vertices) { numberFound++; FooModel framed = (FooModel) context.getFramed().frame(v, WindupVertexFrame.class); Assert.assertTrue(framed instanceof FooModel); Assert.assertEquals("prop1", framed.getProp1()); Assert.assertEquals("prop2", framed.getProp2()); Assert.assertEquals("prop3", framed.getProp3()); } Assert.assertEquals(1, numberFound); }

Target:
public void testGraphTypeHandling() throws Exception { Assert.assertNotNull(context); GraphService<FooModel> fooModelService = context.getService(FooModel.class); FooModel inMemoryModel = fooModelService.createInMemory(); inMemoryModel.setProp1("prop1"); inMemoryModel.setProp2("prop2"); inMemoryModel.setProp3("prop3"); Iterable<Vertex> vertices = context.getFramed().query() .has("type", Text.CONTAINS, FooModel.class.getAnnotation(TypeValue.class).value()) .vertices(); Assert.assertFalse(vertices.iterator().hasNext()); InMemoryVertexFrame inMemoryFrame = (InMemoryVertexFrame) inMemoryModel; inMemoryFrame.attach(context.getFramed()); int numberFound = 0; for (Vertex v : vertices) { numberFound++; FooModel framed = (FooModel) context.getFramed().frame(v, WindupVertexFrame.class); Assert.assertTrue(framed instanceof FooModel); Assert.assertEquals("prop1", framed.getProp1()); Assert.assertEquals("prop2", framed.getProp2()); Assert.assertEquals("prop3", framed.getProp3()); } Assert.assertEquals(1, numberFound); }
Source:
private String selectIpv6Gateway(HostNetwork attachment) { boolean isIpv6DefaultRouteAttachment = attachment.isDefaultRoute() && attachment.getIpv6Gateway() != null; return isIpv6DefaultRouteAttachment ? attachment.getIpv6Gateway() : IpAddressPredicate.UNSPECIFIED_IPV6; }

Target:
private String selectIpv6Gateway(HostNetwork attachment) { boolean isIpv6DefaultRouteAttachment = attachment.isDefaultRoute() && attachment.getIpv6Gateway() != null; return isIpv6DefaultRouteAttachment ? attachment.getIpv6Gateway() : Ipv6UnspecifiedPredicate.UNSPECIFIED; }
Source:
public static Text sanitizeForRichText(Text text) { if (text == null || text.getValue() == null) { return null; } return new Text(Sanitizer.sanitizeForRichText(sanitizeTextField(text.getValue()))); }

Target:
public static Text sanitizeForRichText(Text text) { if (text == null || text.getValue() == null) { return null; } return new Text(sanitizeForRichText(text.getValue())); }
Source:
public void setVariable(String name, @Nullable Object value) { if (name == null) throw new IllegalArgumentException("name should not be null"); else super.setVariable(name, value); }

Target:
public void setVariable(String name, @Nullable Object value) { if ( name == null ) { throw new IllegalArgumentException("name should not be null"); } else { super.setVariable(name, value); } }
Source:
public List<VDS> filter(List<VDS> hosts, VM vm, Map<String, String> parameters, PerHostMessages messages) { String requiredEmulatedMachine; List<VDS> hostsToRunOn = new ArrayList<VDS>(); if (StringUtils.isNotEmpty(vm.getEmulatedMachine())) { requiredEmulatedMachine = vm.getEmulatedMachine(); } else if (StringUtils.isNotEmpty(vm.getCustomEmulatedMachine())) { requiredEmulatedMachine = vm.getCustomEmulatedMachine(); } else { return hosts; } for (VDS host : hosts) { String supportedEmulatedMachines = host.getSupportedEmulatedMachines(); if(StringUtils.isNotEmpty(supportedEmulatedMachines)) { if (Arrays.asList(supportedEmulatedMachines.split(",")).contains(requiredEmulatedMachine)) { hostsToRunOn.add(host); log.debugFormat("Host {0} wasn't filtered out as it supports the VM required emulated machine ({1})", host.getName(), requiredEmulatedMachine); } else { log.debugFormat("Host {0} was filtered out as it doesn't support the VM required emulated machine ({1})", host.getName(), requiredEmulatedMachine); messages.addMessage(host.getId(), String.format("$vmEmulatedMachine %1$s", requiredEmulatedMachine)); messages.addMessage(host.getId(), VdcBllMessages.VAR__DETAIL__UNSUPPORTED_EMULATED_MACHINE.toString()); } } } return hostsToRunOn; }

Target:
public List<VDS> filter(List<VDS> hosts, VM vm, Map<String, String> parameters, PerHostMessages messages) { String requiredEmulatedMachine; List<VDS> hostsToRunOn = new ArrayList<VDS>(); if (StringUtils.isNotEmpty(vm.getEmulatedMachine())) { requiredEmulatedMachine = vm.getEmulatedMachine(); } else if (StringUtils.isNotEmpty(vm.getCustomEmulatedMachine())) { requiredEmulatedMachine = vm.getCustomEmulatedMachine(); } else { return hosts; } for (VDS host : hosts) { String supportedEmulatedMachines = host.getSupportedEmulatedMachines(); if(StringUtils.isNotEmpty(supportedEmulatedMachines)) { if (Arrays.asList(supportedEmulatedMachines.split(",")).contains(requiredEmulatedMachine)) { hostsToRunOn.add(host); log.debugFormat("Host {0} wasn't filtered out as it supports the VM required emulated machine ({1})", host.getName(), requiredEmulatedMachine); } else { log.debugFormat("Host {0} was filtered out as it doesn't support the VM required emulated machine ({1}). Host supported emulated machines are: {2}.", host.getName(), requiredEmulatedMachine, supportedEmulatedMachines); messages.addMessage(host.getId(), String.format("$vmEmulatedMachine %1$s", requiredEmulatedMachine)); messages.addMessage(host.getId(), String.format("$hostEmulatedMachines %1$s", supportedEmulatedMachines)); messages.addMessage(host.getId(), VdcBllMessages.VAR__DETAIL__UNSUPPORTED_EMULATED_MACHINE.toString()); } } } return hostsToRunOn; }
Source:
public void orTest() throws Exception { OrClauseInTrigger clause = new OrClauseInTrigger( new EqualsClauseInTrigger("alias", "f1", "a"), new EqualsClauseInTrigger("alias", "f2", 1)); Parcel parcel = Parcel.obtain(); clause.writeToParcel(parcel, 0); parcel.setDataPosition(0); OrClauseInTrigger deserializedClause = OrClauseInTrigger.CREATOR.createFromParcel(parcel); Assert.assertTrue(Arrays.equals( clause.getClauses().toArray(), deserializedClause.getClauses().toArray())); }

Target:
public void orTest() throws Exception { OrClauseInTrigger clause = new OrClauseInTrigger( new EqualsClauseInTrigger("alias", "f1", "a"), new NotEqualsClauseInTrigger( new EqualsClauseInTrigger("alias", "f2", 1)), RangeClauseInTrigger.greaterThan("alias", "f3", 23), RangeClauseInTrigger.lessThan("alias", "f3", 230), RangeClauseInTrigger.range("alias", "f4", 11, true, 23, false)); Parcel parcel = Parcel.obtain(); clause.writeToParcel(parcel, 0); parcel.setDataPosition(0); OrClauseInTrigger deserializedClause = OrClauseInTrigger.CREATOR.createFromParcel(parcel); Assert.assertTrue(Arrays.equals( clause.getClauses().toArray(), deserializedClause.getClauses().toArray())); }
Source:
int readNoFilter(int[] positions, int positionCount) throws IOException { int streamPosition = 0; for (int i = 0; i < positionCount; i++) { int position = positions[i]; if (position > streamPosition) { skip(position - streamPosition); streamPosition = position; } if (presentStream != null && !presentStream.nextBit()) { if ((nonDeterministicFilter && filter.testNull()) || nullsAllowed) { if (outputRequired) { nulls[outputPositionCount] = true; } outputPositionCount++; } } else { Slice decimal = UnscaledDecimal128Arithmetic.unscaledDecimal(); Slice rescaledDecimal = UnscaledDecimal128Arithmetic.unscaledDecimal(); int scale = (int) scaleStream.next(); dataStream.nextLongDecimal(decimal); rescale(decimal, decimalType.getScale() - scale, rescaledDecimal); if (outputRequired) { values[2 * outputPositionCount] = rescaledDecimal.getLong(0); values[2 * outputPositionCount + 1] = rescaledDecimal.getLong(Long.BYTES); } if (nullsAllowed && presentStream != null) { nulls[outputPositionCount] = false; } outputPositionCount++; } outputPositions = positions; streamPosition++; } return streamPosition; }

Target:
protected int readNoFilter(int[] positions, int positionCount) throws IOException { Slice decimal = UnscaledDecimal128Arithmetic.unscaledDecimal(); Slice rescaledDecimal = UnscaledDecimal128Arithmetic.unscaledDecimal(); int streamPosition = 0; for (int i = 0; i < positionCount; i++) { int position = positions[i]; if (position > streamPosition) { skip(position - streamPosition); streamPosition = position; } if (presentStream != null && !presentStream.nextBit()) { nulls[i] = true; } else { int scale = (int) scaleStream.next(); dataStream.nextLongDecimal(decimal); rescale(decimal, this.scale - scale, rescaledDecimal); values[2 * i] = UnsafeSlice.getLongUnchecked(rescaledDecimal, 0); values[2 * i + 1] = UnsafeSlice.getLongUnchecked(rescaledDecimal, Long.BYTES); if (presentStream != null) { nulls[i] = false; } } streamPosition++; } outputPositionCount = positionCount; return streamPosition; }
Source:
private void createTrackers( final BundleContext context ) { serviceTracker = new ServiceTracker( context, Provider.class, new ProviderServiceTracker( context, locator ) ); serviceTracker.open( true ); bundleTracker = new BundleTracker( context, Bundle.ACTIVE, new ModuleBundleTracker(locator) ); bundleTracker.open(); }

Target:
private void createTrackers( final BundleContext context ) { serviceTracker = new ServiceTracker( context, Provider.class, new InjectorServiceTracker( context, locator ) ); serviceTracker.open( true ); bundleTracker = new BundleTracker( context, Bundle.ACTIVE, new ModuleBundleTracker( locator ) ); bundleTracker.open(); }
Source:
protected ServiceBusClientBuilder getBuilder(boolean useCredentials) { final ServiceBusClientBuilder builder = new ServiceBusClientBuilder() .proxyOptions(ProxyOptions.SYSTEM_DEFAULTS) .retryOptions(RETRY_OPTIONS) .transportType(AmqpTransportType.AMQP) .scheduler(scheduler); logger.info("Getting Builder using credentials : ", useCredentials); if (useCredentials) { final String fullyQualifiedDomainName = getFullyQualifiedDomainName(); assumeTrue(fullyQualifiedDomainName != null && !fullyQualifiedDomainName.isEmpty(), "AZURE_SERVICEBUS_FULLY_QUALIFIED_DOMAIN_NAME variable needs to be set when using credentials."); String clientId = System.getenv("AZURE_CLIENT_ID"); String domainName = System.getenv("AZURE_SERVICEBUS_FULLY_QUALIFIED_DOMAIN_NAME"); String clientSecret = System.getenv("AZURE_CLIENT_SECRET"); String tenantId = System.getenv("AZURE_TENANT_ID"); if (domainName != null ) { logger.info("Getting Builder using credentials with domainName.length : ", domainName.length()); } else { logger.error("Getting Builder using credentials domainName is null."); } if (clientId != null ) { logger.info("Getting Builder using credentials with clientId.length : ", clientId.length()); } else { logger.error("Getting Builder using credentials clientId is null."); } if (clientSecret != null ) { logger.info("Getting Builder using credentials with clientSecret.length :[{}]", clientSecret.length()); } else { logger.error("Getting Builder using credentials clientSecret is null."); } if (tenantId != null ) { logger.info("Getting Builder using credentials with tenantId.length : [{}]", tenantId.length()); } else { logger.error("Getting Builder using credentials tenantId is null."); } final ClientSecretCredential clientSecretCredential = new ClientSecretCredentialBuilder() .clientId(System.getenv("AZURE_CLIENT_ID")) .clientSecret(System.getenv("AZURE_CLIENT_SECRET")) .tenantId(System.getenv("AZURE_TENANT_ID")) .build(); return builder.credential(fullyQualifiedDomainName, clientSecretCredential); } else { return builder.connectionString(getConnectionString()); } }

Target:
protected ServiceBusClientBuilder getBuilder(boolean useCredentials) { final ServiceBusClientBuilder builder = new ServiceBusClientBuilder() .proxyOptions(ProxyOptions.SYSTEM_DEFAULTS) .retryOptions(RETRY_OPTIONS) .transportType(AmqpTransportType.AMQP) .scheduler(scheduler); logger.info("Getting Builder using credentials : ", useCredentials); if (useCredentials) { final String fullyQualifiedDomainName = getFullyQualifiedDomainName(); assumeTrue(fullyQualifiedDomainName != null && !fullyQualifiedDomainName.isEmpty(), "AZURE_SERVICEBUS_FULLY_QUALIFIED_DOMAIN_NAME variable needs to be set when using credentials."); final ClientSecretCredential clientSecretCredential = new ClientSecretCredentialBuilder() .clientId(System.getenv("AZURE_CLIENT_ID")) .clientSecret(System.getenv("AZURE_CLIENT_SECRET")) .tenantId(System.getenv("AZURE_TENANT_ID")) .build(); return builder.credential(fullyQualifiedDomainName, clientSecretCredential); } else { return builder.connectionString(getConnectionString()); } }
Source:
private <T> void validateAndAssertResult(List<VdsNetworkInterface> listOfInterfaces, boolean isValid) { NoRepetitiveStaticIpInListContainer container = new NoRepetitiveStaticIpInListContainer(listOfInterfaces); Set<ConstraintViolation<NoRepetitiveStaticIpInListContainer>> validate = validator.validate(container); Assert.assertEquals(isValid, validate.isEmpty()); }

Target:
private void validateAndAssertResult(List<VdsNetworkInterface> listOfInterfaces, boolean isValid) { NoRepetitiveStaticIpInListContainer container = new NoRepetitiveStaticIpInListContainer(listOfInterfaces); Set<ConstraintViolation<NoRepetitiveStaticIpInListContainer>> validate = validator.validate(container); Assert.assertEquals(isValid, validate.isEmpty()); }
Source:
public static String getDefaultProfile(SsoExtensionsManager extensionsManager) { Optional<ExtensionProxy> defaultExtension = extensionsManager.getExtensionsByService(Authn.class.getName()) .stream() .filter(a -> a.getContext().<Boolean>get(Authn.ConfigKeys.DEFAULT, false)) .findFirst(); return defaultExtension.isPresent() ? getProfileName(defaultExtension.get()) : null; }

Target:
public static String getDefaultProfile(SsoExtensionsManager extensionsManager) { Optional<ExtensionProxy> defaultExtension = extensionsManager.getExtensionsByService(Authn.class.getName()) .stream() .filter(a -> Boolean.valueOf(a.getContext().<Properties>get(Base.ContextKeys.CONFIGURATION) .getProperty(Authn.ConfigKeys.DEFAULT_PROFILE))) .findFirst(); return defaultExtension.isPresent() ? getProfileName(defaultExtension.get()) : null; }
Source:
public User getUserByUsername(String username) throws APIException { User user = dao.getUserByUsername(username); if (isDaemon(user)) { log.warn("requested User '" + username + "' is Daemon"); return null; } return user; }

Target:
public User getUserByUsername(String username) throws APIException { return dao.getUserByUsername(username); }
Source:
private List<HudsonModelJob> getJobsFromFolder(final String folderUrl, final List<String> ids, final IOperationMonitor monitor) throws HudsonException { return new HudsonOperation<List<HudsonModelJob>>(client) { @Override protected List<HudsonModelJob> execute() throws IOException, HudsonException, JAXBException { String url = HudsonUrl.create(folderUrl) .depth(2) .include(" job/build") .toUrl(); HttpRequestBase request = createGetRequest(url); CommonHttpResponse response = execute(request, monitor); return processAndRelease(response, monitor); } @Override protected List<HudsonModelJob> doProcess(CommonHttpResponse response, IOperationMonitor monitor) throws IOException, HudsonException, JAXBException { InputStream in = response.getResponseEntityAsStream(); HudsonModelHudson hudson = unmarshal(parse(in, response.getRequestPath()), HudsonModelHudson.class); List<HudsonModelJob> buildPlans = new ArrayList<>(); List<Object> jobsNodes = hudson.getJob(); Set<String> urls = new HashSet<>(); for (Object jobNode : jobsNodes) { Node node = (Node) jobNode; HudsonModelJob job = unmarshal(node, HudsonMatrixMatrixProject.class); if (job.getColor() != null) { String jobUrl = hudsonUrlUtil.assembleJobUrl(job.getName(), folderUrl); if (!urls.contains(jobUrl)) { job.setUrl(jobUrl); buildPlans.add(job); urls.add(jobUrl); } } else if (ids == null) { buildPlans.addAll(getJobsFromFolder(job.getUrl(), ids, monitor)); } } return buildPlans; } }.run(); }

Target:
private List<HudsonModelJob> getJobsFromFolder(final String folderUrl, final List<String> ids, final IOperationMonitor monitor) throws HudsonException { return new HudsonOperation<List<HudsonModelJob>>(client) { @Override protected List<HudsonModelJob> execute() throws IOException, HudsonException, JAXBException { String url = HudsonUrl.create(folderUrl) .depth(3) .include(" job/build") .toUrl(); HttpRequestBase request = createGetRequest(url); CommonHttpResponse response = execute(request, monitor); return processAndRelease(response, monitor); } @Override protected List<HudsonModelJob> doProcess(CommonHttpResponse response, IOperationMonitor monitor) throws IOException, HudsonException, JAXBException { InputStream in = response.getResponseEntityAsStream(); HudsonModelHudson hudson = unmarshal(parse(in, response.getRequestPath()), HudsonModelHudson.class); List<HudsonModelJob> buildPlans = new ArrayList<>(); List<Object> jobsNodes = hudson.getJob(); Set<String> urls = new HashSet<>(); for (Object jobNode : jobsNodes) { Node node = (Node) jobNode; HudsonModelJob job = unmarshal(node, HudsonMatrixMatrixProject.class); if (job.getColor() != null) { String jobUrl = hudsonUrlUtil.assembleJobUrl(job.getName(), folderUrl); if (!urls.contains(jobUrl)) { job.setUrl(jobUrl); buildPlans.add(job); urls.add(jobUrl); } } else if (ids == null) { buildPlans.addAll(getJobsFromFolder(job.getUrl(), ids, monitor)); } } return buildPlans; } }.run(); }
Source:
public LeftButton(String name) { super(name); this.name = name; this.getStyleClass().add("leftButton"); this.setMaxWidth(Double.MAX_VALUE); this.setAlignment(Pos.CENTER_LEFT); this.setPadding(new Insets(2)); }

Target:
public LeftButton(String name) { super(name); this.name = name; this.getStyleClass().add("leftButton"); this.setAlignment(Pos.CENTER_LEFT); this.setPadding(new Insets(2)); }
Source:
public void addEntry(View view) { if (mAmountView.getText().toString().isEmpty()) { mAmountView.setError(getString(R.string.error_invalid_amount)); mAmountView.requestFocus(); return; } final Entry newEntry = createEntry(); if (newEntry == null) { return; } ApiInterface.getInstance().create(newEntry, new ApiCallback<Long>() { @Override public void onSuccess(Long result) { Toast.makeText(AddEntryActivity.this, "Added $" + ((double) newEntry.getAmount() / CENTS) + " to the " + newEntry.getBudget().getName() + " budget " + "with the date of: " + newEntry.getDate() + " with a note of: " + newEntry.getNotes() , Toast.LENGTH_LONG).show(); AddEntryActivity.this.clearEntry(null); newEntry.getBudget().addEntry(newEntry); Intent intent = new Intent(AddEntryActivity.this, LogsActivity.class); finish(); startActivity(intent); } @Override public void onFailure(String errorMessage) { Toast.makeText(AddEntryActivity.this, "FAILED", Toast.LENGTH_LONG).show(); } }); }

Target:
public void addEntry(View view) { mAmountView.setError(null); if (mAmountView.getText().toString().isEmpty()) { mAmountView.setError(getString(R.string.error_invalid_amount)); mAmountView.requestFocus(); return; } final Entry newEntry = createEntry(); if (newEntry == null) { return; } ApiInterface.getInstance().create(newEntry, new ApiCallback<Long>() { @Override public void onSuccess(Long result) { Toast.makeText(AddEntryActivity.this, "Added $" + ((double) newEntry.getAmount() / CENTS) + " to the " + newEntry.getBudget().getName() + " budget " + "with the date of: " + newEntry.getDate() + " with a note of: " + newEntry.getNotes() , Toast.LENGTH_LONG).show(); AddEntryActivity.this.clearEntry(null); newEntry.getBudget().addEntry(newEntry); finish(); } @Override public void onFailure(String errorMessage) { Toast.makeText(AddEntryActivity.this, "FAILED", Toast.LENGTH_LONG).show(); } }); }
Source:
protected void drawBorder(GC gc) { Rectangle bounds = getBounds(); gc.drawRoundRectangle(bounds.x, bounds.y, bounds.width, bounds.height, fArc, fArc); RGBAColor backgroundColor = getBackgroundColor(); if (fLabel != null && !fLabel.isEmpty() && bounds.width > bounds.height && backgroundColor != null) { gc.setForeground(Utils.getDistinctColor(RGBAUtil.fromRGBAColor(backgroundColor).rgb)); Utils.drawText(gc, fLabel, bounds.x, bounds.y, bounds.width, bounds.height, true, true); } }

Target:
protected void drawBorder(GC gc) { Rectangle bounds = getBounds(); gc.drawRoundRectangle(bounds.x, bounds.y, bounds.width, bounds.height, fArc, fArc); }
Source:
protected boolean isCustomMtu() { return MtuSelector.customMtu.equals(getMtuSelector().getSelectedItem()); }

Target:
protected boolean isCustomMtu() { return MtuSelector.customMtu == getMtuSelector().getSelectedItem(); }