auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private int translateToError(Throwable cause) { if (cause instanceof CertificateRevokedException) { return CertificateVerifier.X509_V_ERR_CERT_REVOKED; } Throwable wrapped = cause.getCause(); while (wrapped != null) { if (wrapped instanceof CertPathValidatorException) { CertPathValidatorException ex = (CertPathValidatorException) wrapped; CertPathValidatorException.Reason reason = ex.getReason(); if (reason == CertPathValidatorException.BasicReason.EXPIRED) { return CertificateVerifier.X509_V_ERR_CERT_HAS_EXPIRED; } if (reason == CertPathValidatorException.BasicReason.NOT_YET_VALID) { return CertificateVerifier.X509_V_ERR_CERT_NOT_YET_VALID; } if (reason == CertPathValidatorException.BasicReason.REVOKED) { return CertificateVerifier.X509_V_ERR_CERT_REVOKED; } } wrapped = wrapped.getCause(); } return CertificateVerifier.X509_V_ERR_UNSPECIFIED; }

Target:
private static int translateToError(Throwable cause) { if (cause instanceof CertificateRevokedException) { return CertificateVerifier.X509_V_ERR_CERT_REVOKED; } Throwable wrapped = cause.getCause(); while (wrapped != null) { if (wrapped instanceof CertPathValidatorException) { CertPathValidatorException ex = (CertPathValidatorException) wrapped; CertPathValidatorException.Reason reason = ex.getReason(); if (reason == CertPathValidatorException.BasicReason.EXPIRED) { return CertificateVerifier.X509_V_ERR_CERT_HAS_EXPIRED; } if (reason == CertPathValidatorException.BasicReason.NOT_YET_VALID) { return CertificateVerifier.X509_V_ERR_CERT_NOT_YET_VALID; } if (reason == CertPathValidatorException.BasicReason.REVOKED) { return CertificateVerifier.X509_V_ERR_CERT_REVOKED; } } wrapped = wrapped.getCause(); } return CertificateVerifier.X509_V_ERR_UNSPECIFIED; }
Source:
private Map<String, IPath> importAsBinaryWithLinks(IProject project, IPluginModelBase model, IProgressMonitor monitor) throws CoreException { SubMonitor subMonitor = SubMonitor.convert(monitor, "", 3); File srcFile = new File(model.getInstallLocation()); if (srcFile.isFile()) { IFile dstFile = project.getFile(new Path(srcFile.getName())); dstFile.createLink(srcFile.toURI(), IResource.NONE, subMonitor.newChild(1)); } else { IFolder dstFile = project.getFolder(new Path(srcFile.getName())); dstFile.createLink(srcFile.toURI(), IResource.NONE, subMonitor.newChild(1)); } Map<String, IPath> sourceMap = importSourceArchives(project, model, IMPORT_BINARY_WITH_LINKS, subMonitor.newChild(1)); importAdditionalSourceFiles(project, model, subMonitor.newChild(1)); importRequiredPluginFiles(project, model, subMonitor.newChild(1)); modifyBundleClasspathHeader(project, model); RepositoryProvider.map(project, PDECore.BINARY_REPOSITORY_PROVIDER); project.setPersistentProperty(PDECore.EXTERNAL_PROJECT_PROPERTY, PDECore.BINARY_PROJECT_VALUE); return sourceMap; }

Target:
private Map<String, IPath> importAsBinaryWithLinks(IProject project, IPluginModelBase model, IProgressMonitor monitor) throws CoreException { SubMonitor subMonitor = SubMonitor.convert(monitor, 4); File srcFile = new File(model.getInstallLocation()); if (srcFile.isFile()) { IFile dstFile = project.getFile(new Path(srcFile.getName())); dstFile.createLink(srcFile.toURI(), IResource.NONE, subMonitor.newChild(1)); } else { IFolder dstFile = project.getFolder(new Path(srcFile.getName())); dstFile.createLink(srcFile.toURI(), IResource.NONE, subMonitor.newChild(1)); } Map<String, IPath> sourceMap = importSourceArchives(project, model, IMPORT_BINARY_WITH_LINKS, subMonitor.newChild(1)); importAdditionalSourceFiles(project, model, subMonitor.newChild(1)); importRequiredPluginFiles(project, model, subMonitor.newChild(1)); modifyBundleClasspathHeader(project, model); RepositoryProvider.map(project, PDECore.BINARY_REPOSITORY_PROVIDER); project.setPersistentProperty(PDECore.EXTERNAL_PROJECT_PROPERTY, PDECore.BINARY_PROJECT_VALUE); return sourceMap; }
Source:
public static synchronized void startUp() throws InterruptedException, IOException { RandomConfigurationSupport randomConfigSupport = new RandomConfigurationSupport(); if (application == null) { application = new SingleNodeApplication().run("--transport", "local", "--analytics", "redis"); integrationTestSupport = new SingleNodeIntegrationTestSupport(application, "classpath:/spring-xd/xd/modules"); Bootstrap bootstrap = new Bootstrap(new String[] { "--port", randomConfigSupport.getAdminServerPort() }); shell = bootstrap.getJLineShellComponent(); } if (!shell.isRunning()) { shell.start(); } }

Target:
public static synchronized void startUp() throws InterruptedException, IOException { RandomConfigurationSupport randomConfigSupport = new RandomConfigurationSupport(); if (application == null) { application = new SingleNodeApplication().run("--transport", "local", "--analytics", "redis"); integrationTestSupport = new SingleNodeIntegrationTestSupport(application); integrationTestSupport.addModuleRegistry(new ArchiveModuleRegistry("classpath:/spring-xd/xd/modules")); Bootstrap bootstrap = new Bootstrap(new String[] { "--port", randomConfigSupport.getAdminServerPort() }); shell = bootstrap.getJLineShellComponent(); } if (!shell.isRunning()) { shell.start(); } }
Source:
public SortedMap<String, SortedMap<Integer, String>> getProperties() { return properties; }

Target:
public Map<String, SortedMap<Integer, String>> getProperties() { return properties; }
Source:
public long commitTimestamp(long transaction, long startTimestamp) throws IOException { if (aborted.contains(transaction)) return -2; long commitTimestamp = committed.getCommit(transaction); if (commitTimestamp != -1 && commitTimestamp > startTimestamp) return -2; if (commitTimestamp != -1 && commitTimestamp <= startTimestamp) return commitTimestamp; if (hasConnectionTimestamp && transaction > connectionTimestamp) return transaction <= largestDeletedTimestamp ? -1 : -2; if (transaction <= largestDeletedTimestamp) return -1; Statistics.partialReport(Statistics.Tag.ASKTSO, 1); askedTSO++; SyncCommitQueryCallback cb = new SyncCommitQueryCallback(); isCommitted(startTimestamp, transaction, cb); try { cb.await(); } catch (InterruptedException e) { throw new IOException("Commit query didn't complete", e); } if (!cb.isAClearAnswer()) throw new IOException("Either abort or retry the transaction"); return cb.isCommitted() ? cb.commitTimestamp() : -2; }

Target:
public long commitTimestamp(long transaction, long startTimestamp) throws IOException { if (aborted.contains(transaction)) return INVALID_READ; long commitTimestamp = committed.getCommit(transaction); if (commitTimestamp != -1 && commitTimestamp > startTimestamp) return INVALID_READ; if (commitTimestamp != -1 && commitTimestamp <= startTimestamp) return commitTimestamp; if (hasConnectionTimestamp && transaction > connectionTimestamp) return transaction <= largestDeletedTimestamp ? LOST_TC : INVALID_READ; if (transaction <= largestDeletedTimestamp) return LOST_TC; Statistics.partialReport(Statistics.Tag.ASKTSO, 1); askedTSO++; SyncCommitQueryCallback cb = new SyncCommitQueryCallback(); isCommitted(startTimestamp, transaction, cb); try { cb.await(); } catch (InterruptedException e) { throw new IOException("Commit query didn't complete", e); } if (!cb.isAClearAnswer()) throw new IOException("Either abort or retry the transaction"); return cb.isCommitted() ? cb.commitTimestamp() : INVALID_READ; }
Source:
protected static Map<String, String> getQueryParameters(BusinessTransactionCriteria criteria) { Map<String, String> ret = new HashMap<String, String>(); if (criteria.getStartTime() > 0) { ret.put("startTime", "" + criteria.getStartTime()); } if (criteria.getEndTime() > 0) { ret.put("endTime", "" + criteria.getEndTime()); } if (!criteria.getProperties().isEmpty()) { boolean first = true; StringBuffer buf = new StringBuffer(); for (String key : criteria.getProperties().keySet()) { if (first) { first = false; } else { buf.append(','); } buf.append(key); buf.append('|'); buf.append(criteria.getProperties().get(key)); } ret.put("properties", buf.toString()); } if (!criteria.getCorrelationIds().isEmpty()) { boolean first = true; StringBuffer buf = new StringBuffer(); for (CorrelationIdentifier cid : criteria.getCorrelationIds()) { if (first) { first = false; } else { buf.append(','); } buf.append(cid.getScope().name()); buf.append('|'); buf.append(cid.getValue()); } ret.put("correlations", buf.toString()); } return ret; }

Target:
protected static Map<String, String> getQueryParameters(BusinessTransactionCriteria criteria) { Map<String, String> ret = new HashMap<String, String>(); if (criteria.getStartTime() > 0) { ret.put("startTime", "" + criteria.getStartTime()); } if (criteria.getEndTime() > 0) { ret.put("endTime", "" + criteria.getEndTime()); } if (!criteria.getProperties().isEmpty()) { boolean first = true; StringBuilder buf = new StringBuilder(); for (String key : criteria.getProperties().keySet()) { if (first) { first = false; } else { buf.append(','); } buf.append(key); buf.append('|'); buf.append(criteria.getProperties().get(key)); } ret.put("properties", buf.toString()); } if (!criteria.getCorrelationIds().isEmpty()) { boolean first = true; StringBuilder buf = new StringBuilder(); for (CorrelationIdentifier cid : criteria.getCorrelationIds()) { if (first) { first = false; } else { buf.append(','); } buf.append(cid.getScope().name()); buf.append('|'); buf.append(cid.getValue()); } ret.put("correlations", buf.toString()); } return ret; }
Source:
void visitConditionalSchema(ConditionalSchema conditionalSchema) { if (!conditionalSchema.getIfSchema().isPresent() || (!conditionalSchema.getThenSchema().isPresent() && !conditionalSchema.getElseSchema().isPresent())) { return; } try { conditionalSchema.getIfSchema().get().validate(subject); } catch (ValidationException ifSchemaValidationException) { Schema elseSchema = conditionalSchema.getElseSchema().orElseThrow(() -> ifSchemaValidationException); elseSchema.validate(subject); return; } conditionalSchema.getThenSchema().ifPresent(schema -> schema.validate(subject)); }

Target:
void visitConditionalSchema(ConditionalSchema conditionalSchema) { conditionalSchema.accept(new ConditionalSchemaValidatingVisitor(subject, this)); }
Source:
public void visitMemberSelectExpression(MemberSelectExpressionTree tree) { IdentifierTree identifier = null; ExpressionTree expression = tree.expression(); if (expression.is(Kind.IDENTIFIER)) { identifier = (IdentifierTree) expression; } else if (expression.is(Kind.PARENTHESIZED_EXPRESSION) && ((ParenthesizedTree) expression).expression().is(Kind.IDENTIFIER)) { identifier = (IdentifierTree) ((ParenthesizedTree) expression).expression(); } if (!usageStatusStack.isEmpty() && identifier != null) { Iterator<UsageStatus> iterator = usageStatusStack.iterator(); while (iterator.hasNext()) { iterator.next().addInvalidUsage(identifier); } } super.visitMemberSelectExpression(tree); }

Target:
public void visitMemberSelectExpression(MemberSelectExpressionTree tree) { final IdentifierTree identifier; ExpressionTree expression = tree.expression(); if (expression.is(Kind.IDENTIFIER)) { identifier = (IdentifierTree) expression; } else if (expression.is(Kind.PARENTHESIZED_EXPRESSION) && ((ParenthesizedTree) expression).expression().is(Kind.IDENTIFIER)) { identifier = (IdentifierTree) ((ParenthesizedTree) expression).expression(); } else { identifier = null; } if (!usageStatusStack.isEmpty() && identifier != null) { usageStatusStack.forEach(usageStatus -> usageStatus.addInvalidUsage(identifier)); } super.visitMemberSelectExpression(tree); }
Source:
public void scenario1() throws IOException { final String testObj = ingestObj("/rest/webacl_box1"); final String acl1 = ingestAcl("fedoraAdmin", "/acls/01/acl.ttl", "/acls/01/authorization.ttl"); linkToAcl(testObj, acl1); final String aclLink = acl1 + "; rel=\"acl\""; logger.debug("Anonymous can't read"); final HttpGet request = getObjMethod(testObj.replace(serverAddress, "")); try (final CloseableHttpResponse response = execute(request)) { assertEquals(HttpStatus.SC_FORBIDDEN, getStatus(response)); } logger.debug("Can username 'smith123' read " + testObj); setAuth(request, "smith123"); try (final CloseableHttpResponse response = execute(request)) { assertEquals(HttpStatus.SC_OK, getStatus(response)); for (final Header header : response.getHeaders("Link")) { logger.debug("Link header: {}", header.getValue()); if (header.getValue().equals(aclLink)) { return; } } assertEquals("Missing Link Header " + aclLink.toString(), 1, 0); } }

Target:
public void scenario1() throws IOException { final String testObj = ingestObj("/rest/webacl_box1"); final String acl1 = ingestAcl("fedoraAdmin", "/acls/01/acl.ttl", "/acls/01/authorization.ttl"); linkToAcl(testObj, acl1); final String aclLink = Link.fromUri(acl1).rel("acl").build().toString(); logger.debug("Anonymous can't read"); final HttpGet request = getObjMethod(testObj.replace(serverAddress, "")); assertEquals(HttpStatus.SC_FORBIDDEN, getStatus(request)); logger.debug("Can username 'smith123' read " + testObj); setAuth(request, "smith123"); try (final CloseableHttpResponse response = execute(request)) { assertEquals(HttpStatus.SC_OK, getStatus(response)); final Optional<String> header = Arrays.asList(response.getHeaders("Link")).stream().map(Header::getValue) .filter(aclLink::equals).findFirst(); assertTrue("Missing Link header", header.isPresent()); } }
Source:
public AssertionError failure(String message, Throwable cause) { return prettyPrintedWithoutAssertJRelatedElementsFromStackTraceIfNeeded(new AssertionFailedError(message, cause)); }

Target:
public AssertionError failure(String message, Throwable cause) { return prettyPrintedWithoutAssertJRelatedElementsFromStackTraceIfNeeded(assertionErrorCreator.assertionError(message, cause)); }
Source:
private DbUser buildUser(T params, String authzName) { DbUser dbUser = dbUserDao.getByExternalId(authzName, params.getPrincipalId()); DbUser user = dbUser != null ? new DbUser(dbUser) : new DbUser(); user.setId(dbUser == null ? Guid.newGuid() : dbUser.getId()); user.setExternalId(params.getPrincipalId()); user.setDomain(authzName); user.setEmail(params.getEmail()); user.setFirstName(params.getFirstName()); user.setLastName(params.getLastName()); user.setNamespace(params.getNamespace()); user.setLoginName(params.getPrincipalName()); List<Guid> groupIds = new ArrayList<>(); List<String> groupRecordIds = new ArrayList<>(); flatGroups((Collection<ExtMap>) params.getGroupIds(), groupRecordIds); for (String groupId : groupRecordIds) { DbGroup dbGroup = dbGroupDao.getByExternalId(authzName, groupId); if (dbGroup != null) { groupIds.add(dbGroup.getId()); } } user.setGroupIds(groupIds); boolean isAdmin = !roleDao.getAnyAdminRoleForUserAndGroups(user.getId(), StringUtils.join(user.getGroupIds(), ",")).isEmpty(); user.setAdmin(isAdmin); if (dbUser == null) { dbUserDao.save(user); } else if (!dbUser.equals(user)) { dbUserDao.update(user); } return user; }

Target:
private DbUser buildUser(T params, String authzName) { DbUser dbUser = dbUserDao.getByExternalId(authzName, params.getPrincipalId()); DbUser user = new DbUser(dbUser); user.setId(dbUser == null ? Guid.newGuid() : dbUser.getId()); user.setExternalId(params.getPrincipalId()); user.setDomain(authzName); user.setEmail(params.getEmail()); user.setFirstName(params.getFirstName()); user.setLastName(params.getLastName()); user.setNamespace(params.getNamespace()); user.setLoginName(params.getPrincipalName()); List<Guid> groupIds = new ArrayList<>(); List<String> groupRecordIds = new ArrayList<>(); flatGroups((Collection<ExtMap>) params.getGroupIds(), groupRecordIds); for (String groupId : groupRecordIds) { DbGroup dbGroup = dbGroupDao.getByExternalId(authzName, groupId); if (dbGroup != null) { groupIds.add(dbGroup.getId()); } } user.setGroupIds(groupIds); user.setAdmin( !roleDao.getAnyAdminRoleForUserAndGroups( user.getId(), StringUtils.join(user.getGroupIds(), ",") ).isEmpty() ); if (dbUser == null) { dbUserDao.save(user); } else if (!dbUser.equals(user)) { dbUserDao.update(user); } return user; }
Source:
public void testSendSerialDataAsyncOtherProtocolsIOError() throws XBeeException, IOException { Mockito.when(xbeeDevice.getXBeeProtocol()).thenReturn(XBeeProtocol.ZIGBEE); Mockito.doThrow(new IOException()).when(xbeeDevice).sendXBeePacketAsync(transmitPacket); try { xbeeDevice.sendSerialDataAsync(XBEE_16BIT_ADDRESS, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (Exception e) { assertEquals(XBeeException.class, e.getClass()); } try { xbeeDevice.sendSerialDataAsync(XBEE_64BIT_ADDRESS, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (Exception e) { assertEquals(XBeeException.class, e.getClass()); } try { xbeeDevice.sendSerialDataAsync(mockedDevice, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (Exception e) { assertEquals(XBeeException.class, e.getClass()); } }

Target:
public void testSendSerialDataAsyncOtherProtocolsIOError() throws XBeeException, IOException { Mockito.when(xbeeDevice.getXBeeProtocol()).thenReturn(XBeeProtocol.ZIGBEE); Mockito.doThrow(new IOException()).when(xbeeDevice).sendXBeePacketAsync(transmitPacket); try { xbeeDevice.sendSerialDataAsync(XBEE_16BIT_ADDRESS, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (Exception e) { assertEquals(XBeeException.class, e.getClass()); assertEquals(IOException.class, e.getCause().getClass()); } try { xbeeDevice.sendSerialDataAsync(XBEE_64BIT_ADDRESS, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (Exception e) { assertEquals(XBeeException.class, e.getClass()); assertEquals(IOException.class, e.getCause().getClass()); } try { xbeeDevice.sendSerialDataAsync(mockedDevice, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (Exception e) { assertEquals(XBeeException.class, e.getClass()); assertEquals(IOException.class, e.getCause().getClass()); } }
Source:
public String getDescription() { return "Returns a qdigest from the set of doubles"; }

Target:
public String getDescription() { return "Returns a qdigest from the set of reals, bigints, doubles"; }
Source:
public synchronized IPieChartViewerState getCurrentState() { return fCurrentState; }

Target:
synchronized IPieChartViewerState getCurrentState() { return fCurrentState; }
Source:
public void openEditModal() { ItemObjectModel itemObjectModel = new ItemObjectModel(); itemObjectModel.setParameters(model.getParameters()); itemObjectModel.setResolver(model.getResolver()); singleValueModal.show((v) ->{ super.remove(); itemObjectModel.setValue(v); this.getListPresenter().add(itemObjectModel); fireChangeEvent(); }, model.getValue()); }

Target:
public void openEditModal() { singleValueModal.show(v -> { model.setValue(v); view.setValue(v); fireChangeEvent(); }, model.getValue()); }
Source:
public VdsStatic() { serverSslEnabled = false; vdsStrength = 100; vdsSpmPriority = HOST_DEFAULT_SPM_PRIORITY; sshPort = DEFAULT_SSH_PORT; sshUsername = DEFAULT_SSH_USERNAME; name = ""; comment = ""; vdsType = VDSType.VDS; autoRecoverable = true; disablePowerManagementPolicy = false; pmKdumpDetection = true; hostProviderId = null; currentKernelCmdline = null; lastStoredKernelCmdline = null; }

Target:
public VdsStatic() { serverSslEnabled = false; vdsStrength = 100; vdsSpmPriority = HOST_DEFAULT_SPM_PRIORITY; sshPort = DEFAULT_SSH_PORT; sshUsername = DEFAULT_SSH_USERNAME; name = ""; comment = ""; vdsType = VDSType.VDS; autoRecoverable = true; disablePowerManagementPolicy = false; pmKdumpDetection = true; hostProviderId = null; }
Source:
public boolean status() { if (status.equals("ON")) { return true; } return false; }

Target:
public boolean status() { return status != null && status.equals("ON"); }
Source:
public static List<BrooklynTypePlanTransformer> forType(ManagementContext mgmt, RegisteredType type, RegisteredTypeLoadingContext constraint) { Multimap<Double,BrooklynTypePlanTransformer> byScoreMulti = ArrayListMultimap.create(); Collection<BrooklynTypePlanTransformer> transformers = all(mgmt); for (BrooklynTypePlanTransformer transformer : transformers) { double score = transformer.scoreForType(type, constraint); if (score>0) byScoreMulti.put(score, transformer); } Map<Double, Collection<BrooklynTypePlanTransformer>> tree = new TreeMap<Double, Collection<BrooklynTypePlanTransformer>>(byScoreMulti.asMap()); List<Collection<BrooklynTypePlanTransformer>> highestFirst = new ArrayList<Collection<BrooklynTypePlanTransformer>>(tree.values()); Collections.reverse(highestFirst); return MutableList.copyOf(Iterables.concat(highestFirst)).asUnmodifiable(); }

Target:
public static List<BrooklynTypePlanTransformer> forType(ManagementContext mgmt, RegisteredType type, RegisteredTypeLoadingContext constraint) { Multimap<Double,BrooklynTypePlanTransformer> byScoreMulti = ArrayListMultimap.create(); Collection<BrooklynTypePlanTransformer> transformers = all(mgmt); for (BrooklynTypePlanTransformer transformer : transformers) { double score = transformer.scoreForType(type, constraint); if (score>0) byScoreMulti.put(score, transformer); } Map<Double, Collection<BrooklynTypePlanTransformer>> tree = new TreeMap<Double, Collection<BrooklynTypePlanTransformer>>(byScoreMulti.asMap()); List<Collection<BrooklynTypePlanTransformer>> highestFirst = new ArrayList<Collection<BrooklynTypePlanTransformer>>(tree.values()); Collections.reverse(highestFirst); return ImmutableList.copyOf(Iterables.concat(highestFirst)); }
Source:
public static UnresolvedCallExpression ifThenElse(Expression condition, Expression ifTrue, Expression ifFalse) { return call(IF, call(IS_TRUE, condition), ifTrue, ifFalse); }

Target:
public static UnresolvedCallExpression ifThenElse(Expression condition, Expression ifTrue, Expression ifFalse) { return call(IF, condition, ifTrue, ifFalse); }
Source:
private String getSnitch() { try { return getRandomGoodHost().runWithPooledResource( (FunctionCheckedException<CassandraClient, String, Exception>) CassandraClient::describe_snitch); } catch (Exception e) { log.warn("Failed to retrieve snitch description", e); throw new RuntimeException(e); } }

Target:
private String getSnitch() { try { return getRandomGoodHost().runWithPooledResource( (FunctionCheckedException<CassandraClient, String, Exception>) CassandraClient::describe_snitch); } catch (Exception e) { throw new RuntimeException(e); } }
Source:
public void setProjects(Map<String,Project> projects) { this.projects = (HashMap<String, Project>) projects; }

Target:
public void setProjects(Map<String,Project> projects) { this.projects = projects; }
Source:
private void dropItem(TravelingItem item) { PipeEventItem.DropItem event = new PipeEventItem.DropItem(item, item.toEntityItem()); container.pipe.handlePipeEvent(event); if (container.getWorldObj().isRemote) { return; } if (travelHook != null) { travelHook.drop(this, item); } if (event.entity == null) { return; } final EntityItem entity = event.entity; ForgeDirection direction = item.input; entity.setPosition(entity.posX + direction.offsetX * 0.5d, entity.posY + direction.offsetY * 0.5d, entity.posZ + direction.offsetZ * 0.5d); entity.motionX = direction.offsetX * item.speed * 5 + getWorld().rand.nextGaussian() * 0.1d; entity.motionY = direction.offsetY * item.speed * 5 + getWorld().rand.nextGaussian() * 0.1d; entity.motionZ = direction.offsetZ * item.speed * 5 + getWorld().rand.nextGaussian() * 0.1d; container.getWorldObj().spawnEntityInWorld(entity); }

Target:
private void dropItem(TravelingItem item) { if (container.getWorldObj().isRemote) { return; } PipeEventItem.DropItem event = new PipeEventItem.DropItem(item, item.toEntityItem()); container.pipe.handlePipeEvent(event); if (event.entity == null) { return; } final EntityItem entity = event.entity; ForgeDirection direction = item.input; entity.setPosition(entity.posX + direction.offsetX * 0.5d, entity.posY + direction.offsetY * 0.5d, entity.posZ + direction.offsetZ * 0.5d); entity.motionX = direction.offsetX * item.speed * 5 + getWorld().rand.nextGaussian() * 0.1d; entity.motionY = direction.offsetY * item.speed * 5 + getWorld().rand.nextGaussian() * 0.1d; entity.motionZ = direction.offsetZ * item.speed * 5 + getWorld().rand.nextGaussian() * 0.1d; container.getWorldObj().spawnEntityInWorld(entity); }
Source:
public JdbcSinkConfig(Map<?, ?> props) { super(CONFIG_DEF, props); connectorName = ConfigUtils.connectorName(this); connectionUrl = getString(CONNECTION_URL); connectionUser = getString(CONNECTION_USER); connectionPassword = getPasswordValue(CONNECTION_PASSWORD); tableNameFormat = getString(TABLE_NAME_FORMAT).trim(); batchSize = getInt(BATCH_SIZE); deleteEnabled = getBoolean(DELETE_ENABLED); maxRetries = getInt(MAX_RETRIES); retryBackoffMs = getInt(RETRY_BACKOFF_MS); autoCreate = getBoolean(AUTO_CREATE); autoEvolve = getBoolean(AUTO_EVOLVE); insertMode = InsertMode.valueOf(getString(INSERT_MODE).toUpperCase()); pkMode = PrimaryKeyMode.valueOf(getString(PK_MODE).toUpperCase()); pkFields = getList(PK_FIELDS); dialectName = getString(DIALECT_NAME_CONFIG); fieldsWhitelist = new HashSet<>(getList(FIELDS_WHITELIST)); String dbTimeZone = getString(DB_TIMEZONE_CONFIG); timeZone = TimeZone.getTimeZone(ZoneId.of(dbTimeZone)); if (deleteEnabled && pkMode != PrimaryKeyMode.RECORD_KEY) { throw new ConfigException( "Primary key mode must be 'record_key' when delete support is enabled"); } tableTypes = TableType.parse(getList(TABLE_TYPES_CONFIG)); }

Target:
public JdbcSinkConfig(Map<?, ?> props) { super(CONFIG_DEF, props); connectorName = ConfigUtils.connectorName(props); connectionUrl = getString(CONNECTION_URL); connectionUser = getString(CONNECTION_USER); connectionPassword = getPasswordValue(CONNECTION_PASSWORD); tableNameFormat = getString(TABLE_NAME_FORMAT).trim(); batchSize = getInt(BATCH_SIZE); deleteEnabled = getBoolean(DELETE_ENABLED); maxRetries = getInt(MAX_RETRIES); retryBackoffMs = getInt(RETRY_BACKOFF_MS); autoCreate = getBoolean(AUTO_CREATE); autoEvolve = getBoolean(AUTO_EVOLVE); insertMode = InsertMode.valueOf(getString(INSERT_MODE).toUpperCase()); pkMode = PrimaryKeyMode.valueOf(getString(PK_MODE).toUpperCase()); pkFields = getList(PK_FIELDS); dialectName = getString(DIALECT_NAME_CONFIG); fieldsWhitelist = new HashSet<>(getList(FIELDS_WHITELIST)); String dbTimeZone = getString(DB_TIMEZONE_CONFIG); timeZone = TimeZone.getTimeZone(ZoneId.of(dbTimeZone)); if (deleteEnabled && pkMode != PrimaryKeyMode.RECORD_KEY) { throw new ConfigException( "Primary key mode must be 'record_key' when delete support is enabled"); } tableTypes = TableType.parse(getList(TABLE_TYPES_CONFIG)); }
Source:
private MemorySchemaRegistryTuple loadSchema(String name, String id) { final Schema schema; InputStream is = this.getClass().getResourceAsStream(AVRO_SCHEMA_REPO_DEFAULT_PATH + "/" + name + "/" + id + ".avsc"); try { if( is == null ) { is = this.getClass().getResourceAsStream(AVRO_SCHEMA_REPO_DEFAULT_PATH + "/" + name + "/" + id + ".avpr"); if (is == null) { throw new RuntimeException("Unknown schema:" + name + " with rev_id:" + id); } Protocol protocol = Protocol.parse(is); schema = protocol.getType(SCHEMA_NAMESPACE + '.' + name); } else { Schema.Parser parser = new Schema.Parser(); schema = parser.parse(is); if (schema == null) { throw new RuntimeException("Schema not contained in parsed protocol:" + name + " with rev_id:" + id + " "); } } } catch (IOException e) { throw new RuntimeException("Cannot parser schema:" + name + " with rev_id:" + id + " ", e); } MemorySchemaRegistryTuple tuple = new MemorySchemaRegistryTuple(schema, Long.parseLong(id)); return tuple; }

Target:
private MemorySchemaRegistryTuple loadSchema(String name, String id) { final Schema schema; final String prefix = AVRO_SCHEMA_REPO_DEFAULT_PATH + "/" + name + "/" + id; InputStream is = this.getClass().getResourceAsStream(prefix + ".avsc"); try { if( is == null ) { is = this.getClass().getResourceAsStream(prefix + ".avpr"); if (is == null) { throw new RuntimeException("Unknown schema:" + name + " with rev_id:" + id); } Protocol protocol = Protocol.parse(is); schema = protocol.getType(SCHEMA_NAMESPACE + '.' + name); if (schema == null) { throw new RuntimeException("Schema not contained in parsed protocol:" + name + " with rev_id:" + id + " "); } } else { Schema.Parser parser = new Schema.Parser(); schema = parser.parse(is); } } catch (IOException e) { throw new RuntimeException("Cannot parser schema:" + name + " with rev_id:" + id + " ", e); } MemorySchemaRegistryTuple tuple = new MemorySchemaRegistryTuple(schema, Long.parseLong(id)); return tuple; }
Source:
private TreeSet<Entry<String, Path>> jarsFirstSortedPluginsSet( Map<String, Path> activePlugins) { final PathMatcher jarMatcher = FileSystems.getDefault().getPathMatcher("glob:*.jar"); TreeSet<Entry<String, Path>> sortedPlugins = Sets.newTreeSet(new Comparator<Entry<String, Path>>() { @Override public int compare(Entry<String, Path> e1, Entry<String, Path> e2) { Path n1 = e1.getValue().getFileName(); Path n2 = e2.getValue().getFileName(); return ComparisonChain.start() .compareTrueFirst(jarMatcher.matches(n1), jarMatcher.matches(n2)) .compare(n1, n2) .result(); } }); addAllEntries(activePlugins, sortedPlugins); return sortedPlugins; }

Target:
private TreeSet<Entry<String, Path>> jarsFirstSortedPluginsSet( Map<String, Path> activePlugins) { TreeSet<Entry<String, Path>> sortedPlugins = Sets.newTreeSet(new Comparator<Entry<String, Path>>() { PathMatcher jarMatcher = FileSystems.getDefault() .getPathMatcher("glob:*.jar"); @Override public int compare(Entry<String, Path> e1, Entry<String, Path> e2) { Path n1 = e1.getValue().getFileName(); Path n2 = e2.getValue().getFileName(); return ComparisonChain.start() .compareTrueFirst(jarMatcher.matches(n1), jarMatcher.matches(n2)) .compare(n1, n2) .result(); } }); addAllEntries(activePlugins, sortedPlugins); return sortedPlugins; }
Source:
public BoBIQ parse(XmlPullParser parser, int initialDepth) throws Exception { BoBHash bobHash = null; BoBData bobData = null; parser.next(); if (parser.getName().equals(BoBIQ.ELEMENT)) { String cid = parser.getAttributeValue("", "cid"); bobHash = BoBHash.fromCid(cid); String dataType = parser.getAttributeValue("", "type"); String maxAgeString = parser.getAttributeValue("", "max-age"); long maxAge = 0; if (maxAgeString != null) { maxAge = Long.parseLong(maxAgeString); } String data = null; try { data = parser.nextText(); } catch (Exception e) { } if (data != null && dataType != null) { bobData = new BoBData(maxAge, dataType, data.getBytes()); } } return new BoBIQ(bobHash, bobData); }

Target:
public BoBIQ parse(XmlPullParser parser, int initialDepth) throws Exception { BoBHash bobHash = null; BoBData bobData = null; parser.next(); if (parser.getName().equals(BoBIQ.ELEMENT)) { String cid = parser.getAttributeValue("", "cid"); bobHash = BoBHash.fromCid(cid); String dataType = parser.getAttributeValue("", "type"); String maxAgeString = parser.getAttributeValue("", "max-age"); long maxAge = 0; if (maxAgeString != null) { maxAge = Long.parseLong(maxAgeString); } String base64EncodedData = null; try { base64EncodedData = parser.nextText(); } catch (Exception e) { } if (base64EncodedData != null && dataType != null) { byte[] base64EncodedDataBytes = base64EncodedData.getBytes(); bobData = new BoBData(maxAge, dataType, Base64.decode(base64EncodedDataBytes)); } } return new BoBIQ(bobHash, bobData); }
Source:
private static void setup() { BeanUtilsBean.setInstance(new BeanUtilsBean(new ConvertUtilsBean() { { register(true, false, 0); register(TO_UUID_CONVERTER, UUID.class); register(EPOCH_TO_DATE_CONVERTER, Date.class); } @Override public Converter lookup(Class<?> sourceType, Class<?> targetType) { if (targetType.isEnum()) { return TO_ENUM_CONVERTER; } else if (Map.class.isAssignableFrom(sourceType)) { return FROM_MAP_CONVERTER; } else if ((String.class.isAssignableFrom(sourceType) || Number.class.isAssignableFrom(sourceType)) && ClassUtils.isAssignable(targetType, Date.class) && super.lookup(Date.class).equals(EPOCH_TO_DATE_CONVERTER)) { return EPOCH_TO_DATE_CONVERTER; } else { return super.lookup(sourceType, targetType); } } })); }

Target:
private static void setup() { BeanUtilsBean.setInstance(new BeanUtilsBean(new BidirectionalConvertUtilBean() { { register(true, false, 0); register(TO_UUID_CONVERTER, UUID.class); } @Override public Converter lookup(Class<?> sourceType, Class<?> targetType) { if (targetType.isEnum()) { return TO_ENUM_CONVERTER; } else if (Map.class.isAssignableFrom(sourceType)) { return FROM_MAP_CONVERTER; } else { return super.lookup(sourceType, targetType); } } })); }
Source:
private boolean validateLine(byte[] line, int lineStart, int lineEnd) { for (; lineStart < lineEnd; lineStart++) if ((line[lineStart] & 128) > 0) { int utf8Index = lineStart++; int utf8Bit = 64; if ((line[utf8Index] & utf8Bit) == 0) return false; for (; (lineStart - utf8Index) < 4 && (line[utf8Index] & utf8Bit) > 0 && (line[lineStart] & 128) > 0 && (line[lineStart] & 64) == 0 ; lineStart++, utf8Bit >>= 1); utf8Bit <<= 1; lineStart--; if ((lineStart - utf8Index) == 0) return false; if ((line[utf8Index] & utf8Bit) > 0 && (line[lineStart] & 128) == 0) return false; } return true; }

Target:
private boolean validateLine(byte[] line, int lineStart, int lineEnd) { for (; lineStart < lineEnd; lineStart++) if ((line[lineStart] & 128) > 0) { int utf8Index = lineStart++; int utf8Bit = 64; if ((line[utf8Index] & utf8Bit) == 0) return false; for (; (lineStart - utf8Index) < 4 && (line[utf8Index] & utf8Bit) > 0 && (line[lineStart] & 128) > 0 && (line[lineStart] & 64) == 0 ; lineStart++, utf8Bit >>= 1); utf8Bit <<= 1; lineStart--; if ((lineStart - utf8Index) == 0) { return false; } if ((line[utf8Index] & utf8Bit) > 0 && (line[lineStart] & 128) == 0) return false; } return true; }
Source:
public void run(Configuration config, final Environment env) throws Exception { env.jersey().register(new TestEchoResource()); ServerTracer serverTracer = ServerTracer.builder() .traceSampler(Sampler.ALWAYS_SAMPLE) .randomGenerator(new Random()) .state(new ThreadLocalServerClientAndLocalSpanState(0, 1, "server")) .spanCollector(new LoggingSpanCollector()) .build(); env.jersey().register(new BraveContainerRequestFilter( new ServerRequestInterceptor(serverTracer), new DefaultSpanNameProvider() )); env.jersey().register(new BraveContainerResponseFilter( new ServerResponseInterceptor(serverTracer) )); }

Target:
public void run(Configuration config, final Environment env) throws Exception { env.jersey().register(new TestEchoResource()); }
Source:
private static void connect(final Client client, String servers) throws InterruptedException { System.out.println("Connecting to VoltDB..."); String[] serverArray = servers.split(","); final CountDownLatch connections = new CountDownLatch(serverArray.length); for (final String server : serverArray) { new Thread(new Runnable() { @Override public void run() { connectToOneServerWithRetry(client, server); connections.countDown(); } }).start(); } connections.await(); }

Target:
private static void connect(final Client client, String servers) throws InterruptedException { Logger logger = LoggerFactory.getLogger(ConnectionHelper.class); logger.info("Connecting to VoltDB..."); String[] serverArray = servers.split(","); final CountDownLatch connections = new CountDownLatch(serverArray.length); for (final String server : serverArray) { new Thread(new Runnable() { @Override public void run() { connectToOneServerWithRetry(client, server); connections.countDown(); } }).start(); } connections.await(); }
Source:
public int getStateTableIndex(ITimeEvent event) { if (event instanceof NullTimeEvent) { return INVISIBLE; } if(event instanceof TimeEvent) { ITimeGraphState model = ((TimeEvent) event).getStateModel(); OutputElementStyle eventStyle = model.getStyle(); if(eventStyle != null) { String styleKey = eventStyle.getParentKey(); if(styleKey != null) { Integer index = fLabelToIndex.get(styleKey); return index != null ? index: TRANSPARENT; } } } return TRANSPARENT; }

Target:
public int getStateTableIndex(ITimeEvent event) { if (event instanceof NullTimeEvent) { return INVISIBLE; } if (event instanceof TimeEvent) { ITimeGraphState model = ((TimeEvent) event).getStateModel(); OutputElementStyle eventStyle = model.getStyle(); if (eventStyle == null && event.getEntry() instanceof TimeGraphEntry) { eventStyle = ((TimeGraphEntry) event.getEntry()).getEntryModel().getStyle(); } if (eventStyle != null) { String styleKey = eventStyle.getParentKey(); if (styleKey != null) { Integer index = fLabelToIndex.get(styleKey); return index != null ? index : Integer.MAX_VALUE; } } } return TRANSPARENT; }
Source:
public Map<ConfigKey<?>,Object> getLocalConfig() { Map<ConfigKey<?>,Object> result = new LinkedHashMap<ConfigKey<?>,Object>(inheritedConfig.size()+ownConfig.size()); result.putAll(ownConfig); return Collections.unmodifiableMap(result); }

Target:
public Map<ConfigKey<?>,Object> getLocalConfig() { Map<ConfigKey<?>,Object> result = new LinkedHashMap<ConfigKey<?>,Object>(ownConfig.size()); result.putAll(ownConfig); return Collections.unmodifiableMap(result); }
Source:
public static Timeline create(@JsonProperty("score") final Integer score, @JsonProperty("message") final String message, @JsonProperty("date") final String date, @JsonProperty("segments") final List<SleepSegment> events, @JsonProperty("insights") final List<Insight> insights, @JsonProperty("statistics") final SleepStats sleepStats, @JsonProperty("locked_down") final boolean lockedDown) { return new Timeline(score, message, date, Lists.newArrayList(Period.NIGHT), events, insights, (sleepStats == null || sleepStats.isFromNull()) ? null : sleepStats, lockedDown); }

Target:
public static Timeline create(@JsonProperty("score") final Integer score, @JsonProperty("message") final String message, @JsonProperty("date") final String date, @JsonProperty("segments") final List<SleepSegment> events, @JsonProperty("insights") final List<Insight> insights, @JsonProperty("statistics") final SleepStats sleepStats, @JsonProperty("locked_down") final boolean lockedDown) { final SleepStats timelineSleepStats; if (sleepStats.isFromNull()){ timelineSleepStats = null; } else{ timelineSleepStats = sleepStats; } return new Timeline(score, message, date, Lists.newArrayList(Period.NIGHT), events, insights, timelineSleepStats, lockedDown); }
Source:
public CompletableFuture<ArchivedExecutionGraph> requestJob(Time timeout) { synchronized (lock) { if (isInitialized()) { if (jobResultFuture.isDone()) { return jobResultFuture; } return getJobMasterGateway().thenCompose(jobMasterGateway -> jobMasterGateway.requestJob( timeout)); } else { Preconditions.checkState(jobStatus == DispatcherJobStatus.INITIALIZING || jobStatus == DispatcherJobStatus.CANCELLING); return CompletableFuture.supplyAsync(() -> { synchronized (lock) { return ArchivedExecutionGraph.createFromInitializingJob( jobId, jobName, jobStatus.asJobStatus(), null, initializationTimestamp); } }); } } }

Target:
public CompletableFuture<ArchivedExecutionGraph> requestJob(Time timeout) { synchronized (lock) { if (isInitialized()) { if (jobResultFuture.isDone()) { return jobResultFuture.thenApply(DispatcherJobResult::getArchivedExecutionGraph); } return getJobMasterGateway().thenCompose(jobMasterGateway -> jobMasterGateway.requestJob( timeout)); } else { Preconditions.checkState(this.jobStatus == DispatcherJobStatus.INITIALIZING || jobStatus == DispatcherJobStatus.CANCELLING); return CompletableFuture.completedFuture( ArchivedExecutionGraph.createFromInitializingJob( jobId, jobName, jobStatus.asJobStatus(), null, initializationTimestamp)); } } }
Source:
public void canOverrideWriteTimeoutPerCall() throws Exception { assumeThat(System.getenv("TRAVIS"), not(equalTo("true"))); server.enqueue(new MockResponse().throttleBody(1, 1, TimeUnit.SECONDS)); RequestBody streamingBody = new RequestBody() { @Override public MediaType contentType() { return MediaType.parse("*/*"); } @Override public void writeTo(BufferedSink sink) throws IOException { byte[] data = new byte[2 * 1024 * 1024]; sink.write(data); } }; int writeTimeout = 1; int executionTime = 200; Builder<ResponseBody, Object> builder = builder(HttpMethod.POST, "", false); Observable<ResponseBody> stream = builder.body(streamingBody).responseAs(ResponseBody.class).writeTimeout(writeTimeout) .build().stream().subscribeOn(Schedulers.newThread()); TestSubscriber<ResponseBody> testSubscriber = new TestSubscriber<>(); long before = System.currentTimeMillis(); stream.toBlocking().subscribe(testSubscriber); long diff = System.currentTimeMillis() - before; testSubscriber.assertError(SocketTimeoutException.class); assertThat(diff).isLessThan((writeTimeout * 1000) + executionTime); }

Target:
public void canOverrideWriteTimeoutPerCall() throws Exception { assumeThat(System.getenv("TRAVIS"), not(equalTo("true"))); server.enqueue(new MockResponse().throttleBody(1, 1, TimeUnit.SECONDS)); RequestBody streamingBody = new RequestBody() { @Override public MediaType contentType() { return MediaType.parse("*/*"); } @Override public void writeTo(BufferedSink sink) throws IOException { byte[] data = new byte[2 * 1024 * 1024]; sink.write(data); } }; int writeTimeout = 1; int executionTime = 500; Builder<ResponseBody, Object> builder = builder(HttpMethod.POST, "", false); Observable<ResponseBody> stream = builder.body(streamingBody).responseAs(ResponseBody.class).writeTimeout(writeTimeout) .build().stream(); TestSubscriber<ResponseBody> testSubscriber = new TestSubscriber<>(); long before = System.currentTimeMillis(); stream.subscribe(testSubscriber); long diff = System.currentTimeMillis() - before; testSubscriber.assertError(SocketTimeoutException.class); assertThat(diff).isLessThan((writeTimeout * 1000) + executionTime); }
Source:
public static Object readSingleValue(final byte tagType, final ByteBuffer byteBuffer, ValidationStringency validationStringency) { switch (tagType) { case 'Z': return readNullTerminatedString(byteBuffer); case 'A': return (char) byteBuffer.get(); case 'I': final long val = byteBuffer.getInt() & 0xffffffffL; if (val <= Integer.MAX_VALUE) { return (int)val; } SAMUtils.processValidationError(new SAMValidationError(SAMValidationError.Type.TAG_VALUE_TOO_LARGE, "Tag value " + val + " too large to store as signed integer.", null), validationStringency); return val; case 'i': return byteBuffer.getInt(); case 's': return (int) byteBuffer.getShort(); case 'S': return byteBuffer.getShort() & 0xffff; case 'c': return (int) byteBuffer.get(); case 'C': return byteBuffer.get() & 0xff; case 'f': return byteBuffer.getFloat(); case 'H': final String hexRep = readNullTerminatedString(byteBuffer); return StringUtil.hexStringToBytes(hexRep); case 'B': final TagValueAndUnsignedArrayFlag valueAndFlag = readArray( byteBuffer); return valueAndFlag.value; default: throw new SAMFormatException("Unrecognized tag type: " + (char) tagType); } }

Target:
public static Object readSingleValue(final byte tagType, final ByteBuffer byteBuffer, ValidationStringency validationStringency) { switch (tagType) { case 'Z': return readNullTerminatedString(byteBuffer); case 'A': return (char) byteBuffer.get(); case 'I': final long val = byteBuffer.getInt() & 0xffffffffL; if (val <= Integer.MAX_VALUE) { return (int)val; } if (! SAMUtils.isValidUnsignedIntegerAttribute(val)) { SAMUtils.processValidationError(new SAMValidationError(SAMValidationError.Type.TAG_VALUE_TOO_LARGE, "Unsigned integer is out of range for a 32-bit unsigned value: " + val, null), validationStringency); } return val; case 'i': return byteBuffer.getInt(); case 's': return (int) byteBuffer.getShort(); case 'S': return byteBuffer.getShort() & 0xffff; case 'c': return (int) byteBuffer.get(); case 'C': return byteBuffer.get() & 0xff; case 'f': return byteBuffer.getFloat(); case 'H': final String hexRep = readNullTerminatedString(byteBuffer); return StringUtil.hexStringToBytes(hexRep); case 'B': final TagValueAndUnsignedArrayFlag valueAndFlag = readArray( byteBuffer); return valueAndFlag.value; default: throw new SAMFormatException("Unrecognized tag type: " + (char) tagType); } }
Source:
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { DOMStorage.DomStorageItemRemovedParams removedParams = new DOMStorage.DomStorageItemRemovedParams(); removedParams.storageId = mStorageId; removedParams.key = key; sendNotificationToPeers("DOMStorage.domStorageItemRemoved", removedParams); Map<String, ?> entries = sharedPreferences.getAll(); if (entries.containsKey(key)) { DOMStorage.DomStorageItemAddedParams addedParams = new DOMStorage.DomStorageItemAddedParams(); addedParams.storageId = mStorageId; addedParams.key = key; addedParams.newValue = SharedPreferencesHelper.valueToString(entries.get(key)); sendNotificationToPeers("DOMStorage.domStorageItemAdded", addedParams); } }

Target:
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { Map<String, ?> entries = sharedPreferences.getAll(); boolean existedBefore = mCopy.containsKey(key); boolean existsNow = entries.containsKey(key); Object newValue = existsNow ? entries.get(key) : null; if (existedBefore && existsNow) { signalItemUpdated( mStorageId, key, SharedPreferencesHelper.valueToString(mCopy.get(key)), SharedPreferencesHelper.valueToString(newValue)); mCopy.put(key, newValue); } else if (existedBefore) { signalItemRemoved(mStorageId, key); mCopy.remove(key); } else if (existsNow) { signalItemAdded( mStorageId, key, SharedPreferencesHelper.valueToString(newValue)); mCopy.put(key, newValue); } else { throw new RuntimeException("Prefs change detected for unknown key=" + key); } }
Source:
void retrievePolicyForService(UUID serviceId) throws Throwable { ServicePolicy policy = getDirectoryClient().getServicePolicy(serviceId); currentServicePolicyEntity = policy == null ? null : ServicePolicyEntity.fromServicePolicy(policy); }

Target:
void retrievePolicyForService(UUID serviceId) throws Throwable { ServicePolicy policy = getDirectoryClient().getServicePolicy(serviceId); currentServicePolicyEntity = ServicePolicyEntity.fromServicePolicy(policy); }
Source:
public void move(final int numBlocks, final String srcEvalId, final String destEvalId, @Nullable final EventHandler<AvroElasticMemoryMessage> finishedCallback) { try (final TraceScope moveTraceScope = Trace.startSpan(MOVE, traceSampler)) { final String operationId = MOVE + "-" + Long.toString(operationIdCounter.getAndIncrement()); migrationManager.startMigration(operationId, srcEvalId, destEvalId, numBlocks, TraceInfo.fromSpan(moveTraceScope.getSpan()), finishedCallback); } }

Target:
public void move(final int numBlocks, final String srcEvalId, final String destEvalId, @Nullable final EventHandler<AvroElasticMemoryMessage> finishedCallback) { Trace.setProcessId("elastic_memory"); try (final TraceScope moveScope = Trace.startSpan(OP_MOVE, traceSampler)) { final String operationId = String.format("%s-%d", OP_MOVE, operationIdCounter.getAndIncrement()); migrationManager.startMigration(operationId, srcEvalId, destEvalId, numBlocks, TraceInfo.fromSpan(moveScope.getSpan()), finishedCallback); } }
Source:
static void handleNotificationReceived(OSNotificationGenerationJob notifJob, boolean displayed) { int androidNotificationId = notifJob.getAndroidId(); try { JSONObject jsonObject = new JSONObject(notifJob.jsonPayload.toString()); jsonObject.put("notificationId", androidNotificationId); OSNotificationOpenResult openResult = generateOsNotificationOpenResult(newJsonArray(jsonObject), displayed); if(trackFirebaseAnalytics != null && getFirebaseAnalyticsEnabled()) trackFirebaseAnalytics.trackReceivedEvent(openResult); } catch (JSONException e) { e.printStackTrace(); } fireNotificationWillShowInForegroundHandlers(notifJob); }

Target:
static void handleNotificationReceived(OSNotificationGenerationJob notifJob, boolean displayed) { try { JSONObject jsonObject = new JSONObject(notifJob.jsonPayload.toString()); jsonObject.put(BUNDLE_KEY_ANDROID_NOTIFICATION_ID, notifJob.getAndroidId()); OSNotificationOpenResult openResult = generateOsNotificationOpenResult(newJsonArray(jsonObject), displayed); if (trackFirebaseAnalytics != null && getFirebaseAnalyticsEnabled()) trackFirebaseAnalytics.trackReceivedEvent(openResult); } catch (JSONException e) { e.printStackTrace(); } }