auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void initializeApplication(ArtifactFactory factory, MavenProject project, ArtifactResolver resolver, ArtifactRepository localRepository) throws MojoFailureException { if (configuration.getApplication() == null) { Artifact artifact = resolveMavenProjectArtifact(factory, project, resolver, localRepository); configuration.setApplication(artifact.getFile()); log.info("No application configured. Using project artifact: " + configuration.getApplication()); if (configuration.getApplicationName() == null) { configuration.setApplicationName(artifact.getArtifactId()); } } else { if (configuration.getApplicationName() == null) { configuration.setApplicationName(configuration.getApplication().getName()); } } }

Target:
public void initializeApplication(ArtifactFactory factory, MavenProject project, ArtifactResolver resolver, ArtifactRepository localRepository) throws MojoFailureException { if (configuration.getApplication() == null) { Artifact artifact = resolveMavenProjectArtifact(factory, project, resolver, localRepository); configuration.setApplication(artifact.getFile()); log.info("No application configured. Using project artifact: " + configuration.getApplication()); if (configuration.getApplicationName() == null) { configuration.setApplicationName(artifact.getArtifactId()); } } else { if (StringUtils.isBlank(configuration.getApplicationName())) { configuration.setApplicationName(configuration.getApplication().getName()); } } }
Source:
public String script() throws IOException { return DockerRun.enlist( Iterables.concat( DockerRun.scripts( this.profile.read(), "/p/entry[@key='install']" ), DockerRun.scripts(this.node(), "entry[@key='script']"), DockerRun.scripts( this.profile.read(), "/p/entry[@key='uninstall']" ) ) ); }

Target:
public String script() throws IOException { final Iterable<String> uninstall; if (this.profile.read().nodes("/p/entry[@key='uninstall']").isEmpty()) { uninstall = Collections.emptyList(); } else { uninstall = Iterables.concat( Lists.newArrayList("function", "clean_up()", "{"), DockerRun.scripts( this.profile.read(), "/p/entry[@key='uninstall']" ), Lists.newArrayList("}", ";"), Lists.newArrayList("trap", "clean_up", "EXIT", ";") ); } return DockerRun.enlist( Iterables.concat( uninstall, DockerRun.scripts( this.profile.read(), "/p/entry[@key='install']" ), DockerRun.scripts(this.node(), "entry[@key='script']") ) ); }
Source:
public static RequestOptions getDefault() { return new RequestOptions(Stripe.apiKey, Stripe.apiVersion, null, null, 30 * 1000, 80 * 1000); }

Target:
public static RequestOptions getDefault() { return new RequestOptions(Stripe.apiKey, Stripe.apiVersion, null, null, DEFAULT_CONNECT_TIMEOUT, DEFAULT_READ_TIMEOUT); }
Source:
HeadlessEnvironment(Name... modules) { super(modules); }

Target:
public HeadlessEnvironment(Name... modules) { super(modules); }
Source:
private void syncEntity(Entity ent, Set<? extends Entity> observers, boolean forceDestroy) { for (Entity observer : observers) { if (ent == observer) { continue; } if (!(observer instanceof Player)) { continue; } Player player = (Player) observer; if (!player.isOnline()) { continue; } PlayerNetworkComponent network = player.getNetwork(); int view = network.getSyncDistance(); boolean spawn, sync, destroy; spawn = sync = destroy = false; final SpoutPhysicsComponent physics = (SpoutPhysicsComponent) ent.getPhysics(); if (forceDestroy || ent.isRemoved() || physics.getTransformLive().getPosition().distanceSquared(player.getPhysics().getPosition()) > view * view || player.isInvisible(ent)) { destroy = true; } else if (network.hasSpawned(ent)) { sync = true; } else { spawn = true; } network.syncEntity(ent, physics.getTransformLive(), spawn, destroy, sync); } }

Target:
private void syncEntity(Entity ent, Set<? extends Entity> observers, boolean forceDestroy) { for (Entity observer : observers) { if (ent == observer) { continue; } if (!(observer instanceof Player)) { continue; } Player player = (Player) observer; if (!player.isOnline()) { continue; } PlayerNetworkComponent network = player.getNetwork(); int syncDistance = network.getSyncDistance(); boolean spawn, sync, destroy; spawn = sync = destroy = false; final SpoutPhysicsComponent physics = (SpoutPhysicsComponent) ent.getPhysics(); if (forceDestroy || ent.isRemoved() || physics.getTransformLive().getPosition().distanceSquared(player.getPhysics().getPosition()) > syncDistance * syncDistance || player.isInvisible(ent)) { destroy = true; } else if (network.hasSpawned(ent)) { sync = true; } else { spawn = true; } network.syncEntity(ent, physics.getTransformLive(), spawn, destroy, sync); } }
Source:
protected void collectValidationErrors(LibraryType object, LibraryType beforeChange, List<ValidationError> errors) throws IOException { if ((ValidationUtils.isSetAndChanged(LibraryType::getPlatformType, object, beforeChange) || ValidationUtils.isSetAndChanged(LibraryType::getDescription, object, beforeChange)) && libraryTypeDao.getByPlatformAndDescription(object.getPlatformType(), object.getDescription()) != null) { errors.add(new ValidationError("description", "There is already a library type with this description for platform: " + object.getPlatformType().getKey())); } long libUsage = libraryTypeDao.getUsageByLibraries(beforeChange); long tempUsage = libraryTypeDao.getUsageByLibraryTemplates(beforeChange); if ((libUsage > 0L || tempUsage > 0L) && ValidationUtils.isSetAndChanged(LibraryType::getPlatformType, object, beforeChange)) { errors.add(new ValidationError("platform", String.format("Cannot be changed because library type is already used by %d librar%s and %d library template%s", libUsage, libUsage == 1L ? "y" : "ies", tempUsage, tempUsage == 1L ? "" : "s"))); } }

Target:
protected void collectValidationErrors(LibraryType object, LibraryType beforeChange, List<ValidationError> errors) throws IOException { if ((ValidationUtils.isSetAndChanged(LibraryType::getPlatformType, object, beforeChange) || ValidationUtils.isSetAndChanged(LibraryType::getDescription, object, beforeChange)) && libraryTypeDao.getByPlatformAndDescription(object.getPlatformType(), object.getDescription()) != null) { errors.add(new ValidationError("description", "There is already a library type with this description for platform: " + object.getPlatformType().getKey())); } long libUsage = libraryTypeDao.getUsageByLibraries(beforeChange); long tempUsage = libraryTypeDao.getUsageByLibraryTemplates(beforeChange); if ((libUsage > 0L || tempUsage > 0L) && ValidationUtils.isSetAndChanged(LibraryType::getPlatformType, object, beforeChange)) { errors.add(new ValidationError("platform", String.format("Cannot be changed because library type is already used by %d %s and %d library %s", libUsage, Pluralizer.libraries(libUsage), tempUsage, Pluralizer.templates(tempUsage)))); } }
Source:
public void testMessageCount() throws Exception { String topicName = "myTopic"; String groupId = "groupId"; AmqpConsumerAdapter adapter = createAdapterWithNonDurableConf(topicName, groupId, false); when(mockChannel.messageCount(anyString())).thenReturn(42L); adapter.subscribe((jsonMessage, ackHandler) -> { }); verify(mockChannel).exchangeDeclare(topicName, "fanout", false, true, null); Optional<Long> answer = Optional.of(42L); Optional<Long> result = adapter.messageCount(); verify(mockChannel, times(1)).messageCount(anyString()); assertEquals(result, answer); }

Target:
public void testMessageCount() throws Exception { String topicName = "myTopic"; String groupId = "groupId"; AmqpConsumerAdapter adapter = createAdapterWithNonDurableConf(topicName, groupId, false); when(mockChannel.messageCount(anyString())).thenReturn(42L); adapter.subscribe((jsonMessage, ackHandler) -> { }); verify(mockChannel).exchangeDeclare(topicName, "fanout", false, true, null); Optional<Long> answer = Optional.of(42L); Optional<Long> result = adapter.messageCount(); verify(mockChannel, times(1)).messageCount(anyString()); assertEquals(answer, result); }
Source:
public synchronized String toString(Calendar cal, Timestamp x, boolean withTimeZone) { if (x.getTime() == PGStatement.DATE_POSITIVE_INFINITY) { return "infinity"; } else if (x.getTime() == PGStatement.DATE_NEGATIVE_INFINITY) { return "-infinity"; } cal = setupCalendar(cal); long timeMillis = x.getTime(); int nanos = x.getNanos(); if (nanos >= MAX_NANOS_BEFORE_WRAP_ON_ROUND) { nanos = 0; timeMillis++; } else if (nanos % 1000 >= 500) { nanos = nanos + 1000 - nanos % 1000; } cal.setTimeInMillis(timeMillis); sbuf.setLength(0); appendDate(sbuf, cal); sbuf.append(' '); appendTime(sbuf, cal, nanos); if (withTimeZone) { appendTimeZone(sbuf, cal); } appendEra(sbuf, cal); return sbuf.toString(); }

Target:
public synchronized String toString(Calendar cal, Timestamp x, boolean withTimeZone) { if (x.getTime() == PGStatement.DATE_POSITIVE_INFINITY) { return "infinity"; } else if (x.getTime() == PGStatement.DATE_NEGATIVE_INFINITY) { return "-infinity"; } cal = setupCalendar(cal); long timeMillis = x.getTime(); int nanos = x.getNanos(); if (nanos >= MAX_NANOS_BEFORE_WRAP_ON_ROUND) { nanos = 0; timeMillis++; } else if (nanosExceed499(nanos)) { nanos += 1000 - nanos % 1000; } cal.setTimeInMillis(timeMillis); sbuf.setLength(0); appendDate(sbuf, cal); sbuf.append(' '); appendTime(sbuf, cal, nanos); if (withTimeZone) { appendTimeZone(sbuf, cal); } appendEra(sbuf, cal); return sbuf.toString(); }
Source:
protected List<String> getKotlinCompilerOptions(boolean testOnly) { if (!isKotlin) { return ImmutableList.of(); } if (!getHasKotlinAndroidExtensions()) { return super.getKotlinCompilerOptions(testOnly); } ImmutableList.Builder<String> extraKotlincArgs = ImmutableList.builder(); StringBuilder plugin = new StringBuilder(); StringBuilder resDirs = new StringBuilder(); StringBuilder options = new StringBuilder(); String module = getProject().getPath().replace(":", File.separator).substring(1) + File.separator; getResVariantDirs() .forEach( (String dir, String variant) -> { String pathToRes = module + dir; resDirs.append(KOTLIN_EXTENSIONS_OPTION); resDirs.append("variant="); resDirs.append(variant); resDirs.append(";"); resDirs.append(pathToRes); resDirs.append(","); }); plugin.append("-Xplugin="); plugin.append(KotlinManager.KOTLIN_LIBRARIES_LOCATION); plugin.append(File.separator); plugin.append("kotlin-android-extensions.jar"); options.append(resDirs.toString()); options.append(KOTLIN_EXTENSIONS_OPTION); options.append("package="); options.append(getResPackage()); if (getHasExperimentalKotlinAndroidExtensions()) { options.append(","); options.append(KOTLIN_EXTENSIONS_OPTION); options.append("experimental=true"); } extraKotlincArgs.add(plugin.toString()); extraKotlincArgs.add("-P"); extraKotlincArgs.add(options.toString()); extraKotlincArgs.addAll(super.getKotlinCompilerOptions(testOnly)); return extraKotlincArgs.build(); }

Target:
protected List<String> getKotlinCompilerOptions(boolean testOnly) { if (!getHasKotlinAndroidExtensions()) { return super.getKotlinCompilerOptions(testOnly); } ImmutableList.Builder<String> extraKotlincArgs = ImmutableList.builder(); StringBuilder plugin = new StringBuilder(); StringBuilder resDirs = new StringBuilder(); StringBuilder options = new StringBuilder(); String module = getProject().getPath().replace(":", File.separator).substring(1) + File.separator; getResVariantDirs() .forEach( (String dir, String variant) -> { String pathToRes = module + dir; resDirs.append(KOTLIN_EXTENSIONS_OPTION); resDirs.append("variant="); resDirs.append(variant); resDirs.append(";"); resDirs.append(pathToRes); resDirs.append(","); }); plugin.append("-Xplugin="); plugin.append(KotlinManager.KOTLIN_LIBRARIES_LOCATION); plugin.append(File.separator); plugin.append("kotlin-android-extensions.jar"); options.append(resDirs.toString()); options.append(KOTLIN_EXTENSIONS_OPTION); options.append("package="); options.append(getResPackage()); if (getHasExperimentalKotlinAndroidExtensions()) { options.append(","); options.append(KOTLIN_EXTENSIONS_OPTION); options.append("experimental=true"); } extraKotlincArgs.add(plugin.toString()); extraKotlincArgs.add("-P"); extraKotlincArgs.add(options.toString()); extraKotlincArgs.addAll(super.getKotlinCompilerOptions(testOnly)); return extraKotlincArgs.build(); }
Source:
public void shouldFailWhenNoUsersOrEmailAreProvided() throws OperationException { DocumentModel doc = session.getDocument(new PathRef("/src")); OperationContext ctx = new OperationContext(session); ctx.setInput(doc); Map<String, Object> params = getParametersForAddOperation(null, null, null, "Write", null, null, null, false, false, null); try { automationService.run(ctx, AddPermission.ID, params); fail(); } catch (Exception e) { assertEquals(IllegalParameterException.class, e.getClass()); String expectedMsg = "'users' or 'email' parameters must be set"; assertEquals(expectedMsg, ((IllegalParameterException) e).getOriginalMessage()); } }

Target:
public void shouldFailWhenNoUsersOrEmailAreProvided() throws OperationException { DocumentModel doc = session.getDocument(new PathRef("/src")); assertNotNull(doc.getACP()); assertNull(doc.getACP().getACL("local")); OperationContext ctx = new OperationContext(session); ctx.setInput(doc); Map<String, Object> params = getParametersForAddOperation(null, null, null, "Write", null, null, null, false, false, null); try { automationService.run(ctx, AddPermission.ID, params); fail(); } catch (IllegalParameterException e) { String expectedMsg = "'users' or 'email' parameters must be set"; assertEquals(expectedMsg, e.getOriginalMessage()); verifyZeroInteractions(userManager); } }
Source:
public Environment(DataFetchingEnvironment environment) { Map<String, Object> args = environment.getArguments(); requestScope = (GraphQLRequestScope) environment.getContext(); filters = Optional.ofNullable((String) args.get(ModelBuilder.ARGUMENT_FILTER)); offset = Optional.ofNullable((String) args.get(ModelBuilder.ARGUMENT_AFTER)); first = Optional.ofNullable((String) args.get(ModelBuilder.ARGUMENT_FIRST)); sort = Optional.ofNullable((String) args.get(ModelBuilder.ARGUMENT_SORT)); parentType = environment.getParentType(); outputType = environment.getFieldType(); rawSource = environment.getSource(); if (rawSource instanceof PersistentResourceContainer) { parentResource = ((PersistentResourceContainer) rawSource).getPersistentResource(); } else if (rawSource instanceof PersistentResource) { parentResource = (PersistentResource) rawSource; } else { parentResource = null; } field = environment.getFields().get(0); this.ids = Optional.ofNullable((List<String>) args.get(ModelBuilder.ARGUMENT_IDS)); List<Map<String, Object>> data = (List<Map<String, Object>>) args.get(ModelBuilder.ARGUMENT_DATA); this.data = Optional.ofNullable(data); }

Target:
public Environment(DataFetchingEnvironment environment) { Map<String, Object> args = environment.getArguments(); requestScope = (GraphQLRequestScope) environment.getContext(); filters = Optional.ofNullable((String) args.get(ModelBuilder.ARGUMENT_FILTER)); offset = Optional.ofNullable((String) args.get(ModelBuilder.ARGUMENT_AFTER)); first = Optional.ofNullable((String) args.get(ModelBuilder.ARGUMENT_FIRST)); sort = Optional.ofNullable((String) args.get(ModelBuilder.ARGUMENT_SORT)); parentType = environment.getParentType(); outputType = environment.getFieldType(); rawSource = environment.getSource(); container = isRoot() ? new RootContainer() : (GraphQLContainer) rawSource; if (rawSource instanceof PersistentResourceContainer) { parentResource = ((PersistentResourceContainer) rawSource).getPersistentResource(); } else { parentResource = null; } field = environment.getFields().get(0); this.ids = Optional.ofNullable((List<String>) args.get(ModelBuilder.ARGUMENT_IDS)); List<Map<String, Object>> data = (List<Map<String, Object>>) args.get(ModelBuilder.ARGUMENT_DATA); this.data = Optional.ofNullable(data); }
Source:
public void testSingleQueryWithJoins() throws Exception { Properties props = PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { prepareTableWithValues(conn, 100); String query = "SELECT count(*) FROM " + tableName +" as A tablesample (45), "+joinedTableName+" as B tablesample (75) where A.i1=B.i1"; System.out.println(query); ResultSet rs = conn.createStatement().executeQuery(query); assertTrue(rs.next()); assertEquals(31, rs.getInt(1)); } finally { conn.close(); } }

Target:
public void testSingleQueryWithJoins() throws Exception { Properties props = PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); try { prepareTableWithValues(conn, 100); String query = "SELECT count(*) FROM " + tableName +" as A tablesample (45), "+joinedTableName+" as B tablesample (75) where A.i1=B.i1"; ResultSet rs = conn.createStatement().executeQuery(query); assertTrue(rs.next()); assertEquals(31, rs.getInt(1)); } finally { conn.close(); } }
Source:
public static boolean isAlive(VirtualChannel channel, int pid, Launcher launcher) throws IOException, InterruptedException { Boolean working = workingLaunchers.get(launcher); if (working == null) { working = !_isAlive(channel, 9999, launcher); workingLaunchers.put(launcher, working); if (!working) { LOGGER.log(Level.WARNING, "{0} on {1} does not seem able to determine whether processes are alive or not", new Object[] {launcher, channel}); } } if (!working) { return true; } return _isAlive(channel, pid, launcher); }

Target:
public static boolean isAlive(VirtualChannel channel, int pid, Launcher launcher) throws IOException, InterruptedException { Boolean working = workingLaunchers.get(launcher); if (working == null) { working = !_isAlive(channel, 9999, launcher); workingLaunchers.put(launcher, working); if (working) { LOGGER.log(Level.FINE, "{0} on {1} appears to be working", new Object[] {launcher, channel}); } else { LOGGER.log(Level.WARNING, "{0} on {1} does not seem able to determine whether processes are alive or not", new Object[] {launcher, channel}); } } if (!working) { return true; } return _isAlive(channel, pid, launcher); }
Source:
void execute(final Socket sock) throws IOException, ServiceNotEnabledException, ServiceNotAuthorizedException { rawIn = new BufferedInputStream(sock.getInputStream()); rawOut = new BufferedOutputStream(sock.getOutputStream()); if (0 < daemon.getTimeout()) sock.setSoTimeout(daemon.getTimeout() * 1000); String cmd = new PacketLineIn(rawIn).readStringRaw(); Collection<String> extraParameters = null; final int nul = cmd.indexOf('\0'); if (nul >= 0) { cmd = cmd.substring(0, nul); int nulnul = cmd.indexOf("\0\0"); if (nulnul != -1) { extraParameters = Arrays.asList(cmd.substring(nulnul + 2).split("\0")); } } final DaemonService srv = getDaemon().matchService(cmd); if (srv == null) return; sock.setSoTimeout(0); srv.execute(this, cmd, extraParameters); }

Target:
void execute(final Socket sock) throws IOException, ServiceNotEnabledException, ServiceNotAuthorizedException { rawIn = new BufferedInputStream(sock.getInputStream()); rawOut = new BufferedOutputStream(sock.getOutputStream()); if (0 < daemon.getTimeout()) sock.setSoTimeout(daemon.getTimeout() * 1000); String cmd = new PacketLineIn(rawIn).readStringRaw(); Collection<String> extraParameters = null; int nulnul = cmd.indexOf("\0\0"); if (nulnul != -1) { extraParameters = Arrays.asList(cmd.substring(nulnul + 2).split("\0")); } final int nul = cmd.indexOf('\0'); if (nul >= 0) { cmd = cmd.substring(0, nul); } final DaemonService srv = getDaemon().matchService(cmd); if (srv == null) return; sock.setSoTimeout(0); srv.execute(this, cmd, extraParameters); }
Source:
public void testEnsureProperCacheState() throws Exception { ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, true); EmbeddedCacheManager cacheManager = addClusterEnabledCacheManager(builder); Cache cache = cacheManager.getCache(); cache.stop(); try { MapReduceTask<String, String, String, Integer> task = createMapReduceTask(cache); } catch(IllegalStateException ex) { assertNotNull(ex.getMessage()); assertTrue(ex.getMessage().contains("Cache is in an invalid state:")); throw ex; } finally { TestingUtil.killCacheManagers(cacheManager); cacheManagers.remove(cacheManager); } }

Target:
public void testEnsureProperCacheState() throws Exception { ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, true); withCacheManager(new CacheManagerCallable(TestCacheManagerFactory.createClusteredCacheManager(builder) ) { @Override public void call() { try { Cache cache = cm.getCache(); cache.stop(); MapReduceTask<String, String, String, Integer> task = createMapReduceTask(cache); } catch(IllegalStateException ex) { assertNotNull(ex.getMessage()); assertTrue(ex.getMessage().contains("Cache is in an invalid state:")); throw ex; } } }); }
Source:
synchronized BufferedLogChannel createNewLog() throws IOException { BufferedLogChannel bc; if (!entryLogPreAllocationEnabled || null == preallocation) { bc = allocateNewLog(); } else { try { bc = preallocation.get(0, TimeUnit.MILLISECONDS); } catch (ExecutionException ee) { if (ee.getCause() instanceof IOException) { throw (IOException) (ee.getCause()); } else { throw new IOException("Error to execute entry log allocation.", ee); } } catch (CancellationException ce) { throw new IOException("Task to allocate a new entry log is cancelled.", ce); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); throw new IOException("Intrrupted when waiting a new entry log to be allocated.", ie); } catch (TimeoutException e) { LOG.debug("Received TimeoutException while trying to get preallocation future result," + " which means that Future is waiting for acquiring lock on EntryLoggerAllocator.this"); bc = allocateNewLog(); } } if (entryLogPreAllocationEnabled) { if ((preallocation == null) || preallocation.isDone()) { preallocation = allocatorExecutor.submit(new Callable<BufferedLogChannel>() { @Override public BufferedLogChannel call() throws IOException { return allocateNewLog(); } }); } } LOG.info("Created new entry logger {}.", bc.getLogId()); return bc; }

Target:
BufferedLogChannel createNewLog() throws IOException { synchronized (createEntryLogLock) { BufferedLogChannel bc; if (!entryLogPreAllocationEnabled){ bc = allocateNewLog(); return bc; } else { if (null == preallocation){ bc = allocateNewLog(); } else { try { bc = preallocation.get(); } catch (ExecutionException ee) { if (ee.getCause() instanceof IOException) { throw (IOException) (ee.getCause()); } else { throw new IOException("Error to execute entry log allocation.", ee); } } catch (CancellationException ce) { throw new IOException("Task to allocate a new entry log is cancelled.", ce); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); throw new IOException("Intrrupted when waiting a new entry log to be allocated.", ie); } } preallocation = allocatorExecutor.submit(() -> allocateNewLog()); return bc; } } }
Source:
public <R> When.Then<R> then(Supplier<? extends R> supplier) { Objects.requireNonNull(supplier, "supplier is null"); return then(ignored -> {return supplier.get();}); }

Target:
public <R> When.Then<R> then(Supplier<? extends R> supplier) { Objects.requireNonNull(supplier, "supplier is null"); return then(ignored -> supplier.get()); }
Source:
public void serialize(ClaimsHolder holder, JsonGenerator gen, SerializerProvider provider) throws IOException { gen.writeStartObject(); for (Map.Entry<String, Object> e : holder.getClaims().entrySet()) { switch (e.getKey()) { case PublicClaims.AUDIENCE: if (e.getValue() instanceof String) { gen.writeFieldName(e.getKey()); gen.writeString((String)e.getValue()); break; } String[] audArray = (String[]) e.getValue(); if (audArray.length == 1) { gen.writeFieldName(e.getKey()); gen.writeString(audArray[0]); } else if (audArray.length > 1) { gen.writeFieldName(e.getKey()); gen.writeStartArray(); for(String aud : audArray) { gen.writeString(aud); } gen.writeEndArray(); } break; case PublicClaims.EXPIRES_AT: case PublicClaims.ISSUED_AT: case PublicClaims.NOT_BEFORE: gen.writeFieldName(e.getKey()); gen.writeNumber(dateToSeconds((Date) e.getValue())); break; default: gen.writeFieldName(e.getKey()); if (e.getValue() instanceof Date) { gen.writeNumber(dateToSeconds((Date) e.getValue())); } else { gen.writeObject(e.getValue()); } break; } } gen.writeEndObject(); }

Target:
public void serialize(ClaimsHolder holder, JsonGenerator gen, SerializerProvider provider) throws IOException { gen.writeStartObject(); for (Map.Entry<String, Object> e : holder.getClaims().entrySet()) { switch (e.getKey()) { case PublicClaims.AUDIENCE: if (e.getValue() instanceof String) { gen.writeFieldName(e.getKey()); gen.writeString((String)e.getValue()); break; } String[] audArray = (String[]) e.getValue(); if (audArray.length == 1) { gen.writeFieldName(e.getKey()); gen.writeString(audArray[0]); } else if (audArray.length > 1) { gen.writeFieldName(e.getKey()); gen.writeStartArray(); for(String aud : audArray) { gen.writeString(aud); } gen.writeEndArray(); } break; default: gen.writeFieldName(e.getKey()); if (e.getValue() instanceof Date) { gen.writeNumber(dateToSeconds((Date) e.getValue())); } else { gen.writeObject(e.getValue()); } break; } } gen.writeEndObject(); }
Source:
private I_C_Invoice_Detail createI_C_InvoiceDetail(final InvoiceCandidateId invoiceCandidateId, final InvoiceDetailItem invoiceDetailItem) { final I_C_Invoice_Detail invoiceDetailEntity = newInstance(I_C_Invoice_Detail.class); invoiceDetailEntity.setC_Invoice_Candidate_ID(invoiceCandidateId.getRepoId()); invoiceDetailEntity.setSeqNo(NumberUtils.asInt(invoiceDetailItem.getSeqNo(), 0)); invoiceDetailEntity.setDescription(invoiceDetailItem.getDescription()); invoiceDetailEntity.setLabel(invoiceDetailItem.getLabel()); invoiceDetailEntity.setNote(invoiceDetailItem.getNote()); invoiceDetailEntity.setPriceActual(invoiceDetailItem.getPrice()); invoiceDetailEntity.setDate(getDate(invoiceCandidateId, invoiceDetailItem)); return invoiceDetailEntity; }

Target:
private I_C_Invoice_Detail createI_C_InvoiceDetail(final InvoiceCandidateId invoiceCandidateId, final InvoiceDetailItem invoiceDetailItem) { final I_C_Invoice_Detail invoiceDetailEntity = newInstance(I_C_Invoice_Detail.class); invoiceDetailEntity.setC_Invoice_Candidate_ID(invoiceCandidateId.getRepoId()); invoiceDetailEntity.setAD_Org_ID(invoiceDetailItem.getOrgId().getRepoId()); invoiceDetailEntity.setSeqNo(NumberUtils.asInt(invoiceDetailItem.getSeqNo(), 0)); invoiceDetailEntity.setDescription(invoiceDetailItem.getDescription()); invoiceDetailEntity.setLabel(invoiceDetailItem.getLabel()); invoiceDetailEntity.setNote(invoiceDetailItem.getNote()); invoiceDetailEntity.setPriceActual(invoiceDetailItem.getPrice()); invoiceDetailEntity.setDate(getDate(invoiceDetailItem)); return invoiceDetailEntity; }
Source:
public static WordUpdateChange updateWordArtifacts(WordUpdateData wud) { WordUpdateChange change = null; OseeClient oseeClient = ServiceUtil.getOseeClient(); WordUpdateEndpoint endpoint = oseeClient.getWordUpdateEndpoint(); try { change = endpoint.updateWordArtifacts(wud); } catch (Exception ex) { throw JaxRsExceptions.asOseeException(ex); } return change; }

Target:
public static WordUpdateChange updateWordArtifacts(WordUpdateData wud) { WordUpdateChange change = null; OseeClient oseeClient = ServiceUtil.getOseeClient(); WordUpdateEndpoint endpoint = oseeClient.getWordUpdateEndpoint(); try { change = endpoint.updateWordArtifacts(wud); } catch (Exception ex) { throw new OseeWebApplicationException(Status.INTERNAL_SERVER_ERROR, "Exception in WordUpdateRequest", ex); } return change; }
Source:
public PBSIMFastqReader(final BufferedReader brRef, final BufferedReader brMAF, final BufferedReader brFastq, final boolean forceFiveBaseEncoding) throws IOException { maf_ = new MafReader(brMAF); fastq_ = new FastqReader(brFastq); index2chrom_ = new ArrayList<String>(5); index2chrom_.add(null); for(String buffer = brRef.readLine() ; buffer != null ; buffer = brRef.readLine()) { index2chrom_.add(buffer.substring(1)); } }

Target:
public PBSIMFastqReader(final BufferedReader brRef, final BufferedReader brMAF, final BufferedReader brFastq, final boolean forceFiveBaseEncoding) throws IOException { maf_ = new MafReader(brMAF); fastq_ = new FastqReader(brFastq); idx2chr_ = new Idx2Chr(brRef); }
Source:
public void onClick(View view) { Log.e("Click", "Button"); switch (view.getId()) { case R.id.take_photo_button: Log.e("Click", "Take Photo"); onTakePhotoButtonPressed(view); break; case R.id.submit_field_report_button: onSubmitFieldReportButtonPressed(view); break; } }

Target:
public void onClick(View view) { switch (view.getId()) { case R.id.take_photo_button: onTakePhotoButtonPressed(view); break; case R.id.submit_field_report_button: onSubmitFieldReportButtonPressed(view); break; } }
Source:
public void testTableNotFoundException() throws Exception { ZooKeeperWatcher zkw = HBaseTestingUtility.getZooKeeperWatcher(TEST_UTIL); TableName table = TableName.valueOf("tableNotExists"); try { ZKTableStateClientSideReader.isDisabledTable(zkw, table); fail("Shouldn't be here"); } catch (TableNotFoundException e) { } }

Target:
public void testTableNotFoundException() throws Exception { ZooKeeperWatcher zkw = TEST_UTIL.getZooKeeperWatcher(); TableName table = TableName.valueOf("tableNotExists"); try { ZKTableStateClientSideReader.isDisabledTable(zkw, table); fail("Shouldn't be here"); } catch (TableNotFoundException e) { } }
Source:
public void doHeal(EntityRef entity, int healAmount, EntityRef instigator, HealthComponent targetHealthComponent) { HealthComponent health = targetHealthComponent; if (health == null) { health = entity.getComponent(HealthComponent.class); } int healedAmount = Math.min(health.currentHealth + healAmount, health.maxHealth) - health.currentHealth; health.currentHealth += healedAmount; entity.saveComponent(health); entity.send(new OnHealedEvent(healAmount, healedAmount, instigator)); if (health.currentHealth == health.maxHealth) { entity.send(new FullHealthEvent(instigator)); } }

Target:
private void doHeal(EntityRef entity, int healAmount, EntityRef instigator, HealthComponent targetHealthComponent) { HealthComponent health = targetHealthComponent; if (health == null) { health = entity.getComponent(HealthComponent.class); } int healedAmount = Math.min(health.currentHealth + healAmount, health.maxHealth) - health.currentHealth; health.currentHealth += healedAmount; entity.saveComponent(health); entity.send(new OnHealedEvent(healAmount, healedAmount, instigator)); if (health.currentHealth == health.maxHealth) { entity.send(new FullHealthEvent(instigator)); } }
Source:
protected String getBackupUrl() { String backupUrl = HttpSolrClientFactory.getDefaultHttpsAddress(); if (configurationAdmin != null) { try { Configuration solrConfig = configurationAdmin.getConfiguration( "(service.pid=ddf.catalog.solr.external.SolrHttpCatalogProvider)"); if (solrConfig != null) { if (solrConfig.getProperties() != null && solrConfig.getProperties().get("url") != null) { LOGGER.debug("Found url property in config, setting backup url"); backupUrl = (String) solrConfig.getProperties().get("url"); } else { LOGGER.debug("No Solr config found, checking System settings"); if (System.getProperty("hostContext") != null) { backupUrl = SystemBaseUrl.INTERNAL.constructUrl( SystemBaseUrl.INTERNAL.getProtocol(), System.getProperty("hostContext")); LOGGER.debug("Trying system configured URL instead: {}", backupUrl); } else { LOGGER.info( "No Solr url configured, defaulting to: {}", HttpSolrClientFactory.getDefaultHttpsAddress()); } } } } catch (IOException e) { LOGGER.debug("Unable to get Solr url from bundle config, will check system properties."); } } return backupUrl; }

Target:
protected String getBackupUrl() { return AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty(SOLR_URL_PROP)); }
Source:
public JettyHttpClient(HttpClientConfig config, ClientSecurityConfig securityConfig) { this(config, securityConfig, ImmutableList.<HttpRequestFilter>of()); }

Target:
public JettyHttpClient(HttpClientConfig config, ClientSecurityConfig securityConfig) { this(config, securityConfig, Optional.<JettyIoPool>absent(), ImmutableList.<HttpRequestFilter>of()); }
Source:
public Builder(ConnectionPolicy connectionPolicy) { this.bufferPageSize = DEFAULT_OPTIONS.bufferPageSize; this.connectionAcquisitionTimeout = DEFAULT_OPTIONS.connectionAcquisitionTimeout; this.connectTimeout = connectionPolicy.getConnectTimeout(); this.idleChannelTimeout = connectionPolicy.getIdleConnectionTimeout(); this.idleEndpointTimeout = DEFAULT_OPTIONS.idleEndpointTimeout; this.maxBufferCapacity = DEFAULT_OPTIONS.maxBufferCapacity; this.maxChannelsPerEndpoint = connectionPolicy.getMaxConnectionsPerEndpoint(); this.maxRequestsPerChannel = connectionPolicy.getMaxRequestsPerConnection(); this.receiveHangDetectionTime = DEFAULT_OPTIONS.receiveHangDetectionTime; this.requestExpiryInterval = DEFAULT_OPTIONS.requestExpiryInterval; this.requestTimeout = connectionPolicy.getRequestTimeout(); this.requestTimerResolution = DEFAULT_OPTIONS.requestTimerResolution; this.sendHangDetectionTime = DEFAULT_OPTIONS.sendHangDetectionTime; this.shutdownTimeout = DEFAULT_OPTIONS.shutdownTimeout; this.threadCount = DEFAULT_OPTIONS.threadCount; this.userAgent = DEFAULT_OPTIONS.userAgent; }

Target:
public Builder(ConnectionPolicy connectionPolicy) { this.bufferPageSize = DEFAULT_OPTIONS.bufferPageSize; this.connectionAcquisitionTimeout = DEFAULT_OPTIONS.connectionAcquisitionTimeout; this.connectTimeout = connectionPolicy.getConnectTimeout(); this.idleChannelTimeout = connectionPolicy.getIdleTcpConnectionTimeout(); this.idleEndpointTimeout = DEFAULT_OPTIONS.idleEndpointTimeout; this.maxBufferCapacity = DEFAULT_OPTIONS.maxBufferCapacity; this.maxChannelsPerEndpoint = connectionPolicy.getMaxConnectionsPerEndpoint(); this.maxRequestsPerChannel = connectionPolicy.getMaxRequestsPerConnection(); this.receiveHangDetectionTime = DEFAULT_OPTIONS.receiveHangDetectionTime; this.requestExpiryInterval = DEFAULT_OPTIONS.requestExpiryInterval; this.requestTimeout = connectionPolicy.getRequestTimeout(); this.requestTimerResolution = DEFAULT_OPTIONS.requestTimerResolution; this.sendHangDetectionTime = DEFAULT_OPTIONS.sendHangDetectionTime; this.shutdownTimeout = DEFAULT_OPTIONS.shutdownTimeout; this.threadCount = DEFAULT_OPTIONS.threadCount; this.userAgent = DEFAULT_OPTIONS.userAgent; }
Source:
public String toString() { if(m_highLoadWatermark != null) { return "Load:" + m_load + ", high water-mark:" + m_highLoadWatermark.intValue(); } else { return "Load:" + m_load + ", high water-mark: not defined"; } }

Target:
public String toString() { if(m_highLoadWatermark != null) { return "Load:" + m_load + ", high water-mark:" + m_highLoadWatermark; } else { return "Load:" + m_load + ", high water-mark: not defined"; } }
Source:
public int isApplicable(VElement vElement, ViewModelContext viewModelContext) { if (!VControl.class.isInstance(vElement)) { return NOT_APPLICABLE; } final VControl control = (VControl) vElement; IValueProperty valueProperty; try { valueProperty = Activator.getDefault().getEMFFormsDatabinding() .getValueProperty(control.getDomainModelReference(), viewModelContext.getDomainModel()); } catch (final DatabindingFailedException ex) { Activator.getDefault().getReportService().report(new DatabindingFailedReport(ex)); return NOT_APPLICABLE; } catch (final IllegalArgumentException ex) { Activator.getDefault().getReportService().report(new AbstractReport(ex)); return NOT_APPLICABLE; } final EStructuralFeature feature = (EStructuralFeature) valueProperty.getValueType(); if (feature.isMany()) { return NOT_APPLICABLE; } if (!EAttribute.class.isInstance(feature)) { return NOT_APPLICABLE; } final EAttribute eAttribute = EAttribute.class.cast(feature); if (eAttribute.getEContainingClass().equals(RulePackage.eINSTANCE.getLeafCondition())) { return 3; } return NOT_APPLICABLE; }

Target:
public int isApplicable(VElement vElement, ViewModelContext viewModelContext) { if (!VControl.class.isInstance(vElement)) { return NOT_APPLICABLE; } final VControl control = (VControl) vElement; if (control.getDomainModelReference() == null) { return NOT_APPLICABLE; } IValueProperty valueProperty; try { valueProperty = Activator.getDefault().getEMFFormsDatabinding() .getValueProperty(control.getDomainModelReference(), viewModelContext.getDomainModel()); } catch (final DatabindingFailedException ex) { Activator.getDefault().getReportService().report(new DatabindingFailedReport(ex)); return NOT_APPLICABLE; } catch (final IllegalArgumentException ex) { Activator.getDefault().getReportService().report(new AbstractReport(ex)); return NOT_APPLICABLE; } final EStructuralFeature feature = (EStructuralFeature) valueProperty.getValueType(); if (feature.isMany()) { return NOT_APPLICABLE; } if (!EAttribute.class.isInstance(feature)) { return NOT_APPLICABLE; } final EAttribute eAttribute = EAttribute.class.cast(feature); if (eAttribute.getEContainingClass().equals(RulePackage.eINSTANCE.getLeafCondition())) { return 3; } return NOT_APPLICABLE; }
Source:
public void appendData(final String id, final byte[] data) throws IOException { this.rawData.putIfAbsent(id, new ByteArrayOutputStream()); final ByteArrayOutputStream stream = this.rawData.get(id); stream.write(data); }

Target:
public synchronized void appendData(final String id, final byte[] data) throws IOException { ByteArrayOutputStream stream = this.rawData.get(id); if (stream == null) { stream = new ByteArrayOutputStream(); this.rawData.put(id, stream); } stream.write(data); }
Source:
public CharSequence getQuantityText(int id, int quantity) throws NotFoundException { PluralRules rule = getPluralRule(); CharSequence res = mAssets.getResourceBagText(id, attrForQuantityCode(rule.select(quantity))); if (res != null) { return res; } res = mAssets.getResourceBagText(id, ID_OTHER); if (res != null) { return res; } throw new NotFoundException("Plural resource ID #0x" + Integer.toHexString(id) + " quantity=" + quantity + " item=" + stringForQuantityCode(rule.select(quantity))); }

Target:
public CharSequence getQuantityText(int id, int quantity) throws NotFoundException { PluralRules rule = getPluralRule(); CharSequence res = mAssets.getResourceBagText(id, attrForQuantityCode(rule.select(quantity))); if (res != null) { return res; } res = mAssets.getResourceBagText(id, ID_OTHER); if (res != null) { return res; } throw new NotFoundException("Plural resource ID #0x" + Integer.toHexString(id) + " quantity=" + quantity + " item=" + rule.select(quantity)); }
Source:
public void initialize(final List<Integer> initBlockLocations) { if (!initialized.compareAndSet(false, true)) { return; } if (initBlockLocations.size() != numTotalBlocks) { throw new RuntimeException("Imperfect routing table"); } for (int blockId = 0; blockId < numTotalBlocks; blockId++) { final int storeId = initBlockLocations.get(blockId); if (storeId == localStoreId) { throw new RuntimeException("Wrong initial routing table"); } this.blockLocations.set(blockId, storeId); } LOG.log(Level.FINE, "Operation router is initialized"); synchronized (this) { this.notifyAll(); } }

Target:
public synchronized void initialize(final List<Integer> initBlockLocations) { if (initialized) { return; } if (initBlockLocations.size() != numTotalBlocks) { throw new RuntimeException("Imperfect routing table"); } for (int blockId = 0; blockId < numTotalBlocks; blockId++) { final int storeId = initBlockLocations.get(blockId); if (storeId == localStoreId) { throw new RuntimeException("Wrong initial routing table"); } this.blockLocations.set(blockId, storeId); } initialized = true; LOG.log(Level.FINE, "Operation router is initialized"); synchronized (this) { this.notifyAll(); } }
Source:
private void writeUserData() { Set<DbUser> dbUsers = fullEntityOvfData.getDbUsers(); if (dbUsers == null || dbUsers.isEmpty()) { return; } _writer.writeStartElement("Section"); _writer.writeAttributeString(XSI_URI, "type", "ovf:UserDomainsSection_Type"); dbUsers.forEach(dbUser -> { _writer.writeStartElement(OvfProperties.USER); _writer.writeElement(OvfProperties.USER_DOMAIN, String.format("%s@%s", dbUser.getName(), dbUser.getDomain())); _writer.writeStartElement(OvfProperties.USER_ROLES); Set<String> roles = fullEntityOvfData.getUserToRoles().getOrDefault(dbUser.getLoginName(), Collections.EMPTY_SET); roles.forEach(role -> _writer.writeElement(OvfProperties.ROLE_NAME, role)); _writer.writeEndElement(); _writer.writeEndElement(); }); _writer.writeEndElement(); }

Target:
private void writeUserData() { Set<DbUser> dbUsers = fullEntityOvfData.getDbUsers(); if (dbUsers == null || dbUsers.isEmpty()) { return; } _writer.writeStartElement("Section"); _writer.writeAttributeString(XSI_URI, "type", "ovf:UserDomainsSection_Type"); dbUsers.forEach(dbUser -> { _writer.writeStartElement(OvfProperties.USER); _writer.writeElement(OvfProperties.USER_DOMAIN, String.format("%s@%s", dbUser.getName(), dbUser.getDomain())); _writer.writeStartElement(OvfProperties.USER_ROLES); Set<String> roles = fullEntityOvfData.getUserToRoles().getOrDefault(dbUser.getLoginName(), Collections.emptySet()); roles.forEach(role -> _writer.writeElement(OvfProperties.ROLE_NAME, role)); _writer.writeEndElement(); _writer.writeEndElement(); }); _writer.writeEndElement(); }
Source:
public void compile() { Nullability nullability = new Nullability(this); List<State> allStates = new ArrayList<>(); for (NonTerminal nonTerminal : getAllNonTerminals()) { allStates.addAll(nonTerminal.getReachableStates()); } Map<State, Integer> inverseAllStates = new HashMap<>(); for (int i = 0; i < allStates.size(); i++) { inverseAllStates.put(allStates.get(i), i); } @SuppressWarnings("unchecked") List<Integer>[] predecessors = new List[allStates.size()]; for (int i = 0; i < predecessors.length; i++) { predecessors[i] = new ArrayList<>(); } for (State s : allStates) { if (s instanceof NextableState) { NextableState ns = (NextableState) s; for (State nextState : ns.next) { if (nullability.isNullable(nextState)) { predecessors[inverseAllStates.get(nextState)].add(inverseAllStates.get(s)); } if (nextState instanceof NonTerminalState) { EntryState es = ((NonTerminalState) nextState).child.entryState; predecessors[inverseAllStates.get(es)].add(inverseAllStates.get(s)); } } if (ns instanceof NonTerminalState) { ExitState es = ((NonTerminalState) ns).child.exitState; predecessors[inverseAllStates.get(es)].add(inverseAllStates.get(s)); } } } List<List<Integer>> components = new SCCTarjan().scc(predecessors); for (int i = 0; i < components.size(); i++) { for (int j : components.get(i)) { State state = allStates.get(j); state.orderingInfo = new OrderingInfo(i); } } }

Target:
public void compile() { Nullability nullability = new Nullability(this); List<State> allStates = new ArrayList<>(); for (NonTerminal nonTerminal : getAllNonTerminals()) { allStates.addAll(nonTerminal.getReachableStates()); } Map<State, Integer> inverseAllStates = new HashMap<>(); for (int i = 0; i < allStates.size(); i++) { inverseAllStates.put(allStates.get(i), i); } @SuppressWarnings("unchecked") List<Integer>[] predecessors = new List[allStates.size()]; for (int i = 0; i < predecessors.length; i++) { predecessors[i] = new ArrayList<>(); } for (State s : allStates) { if (s instanceof NextableState) { NextableState ns = (NextableState) s; for (State nextState : ns.next) { if (nullability.isNullable(nextState)) { predecessors[inverseAllStates.get(nextState)].add(inverseAllStates.get(s)); } if (nextState instanceof NonTerminalState) { EntryState es = ((NonTerminalState) nextState).child.entryState; predecessors[inverseAllStates.get(es)].add(inverseAllStates.get(s)); } } if (ns instanceof NonTerminalState) { ExitState es = ((NonTerminalState) ns).child.exitState; predecessors[inverseAllStates.get(es)].add(inverseAllStates.get(s)); } } } List<List<Integer>> components = new SCCTarjan().scc(predecessors); for (int i = 0; i < components.size(); i++) { for (int j : components.get(i)) { State state = allStates.get(j); state.orderingInfo = new State.OrderingInfo(i); } } }
Source:
public AttributeValueSearch(IAttributeType attributeType, String attributeValue) { this.attributeType = attributeType; this.attributeValue = attributeValue; Conditions.checkNotNull(attributeType, "attributeType"); Conditions.checkNotNullOrEmpty(attributeValue, "attributeValue"); }

Target:
public AttributeValueSearch(IAttributeType attributeType, String attributeValue) { Conditions.checkNotNull(attributeType, "attributeType"); Conditions.checkNotNullOrEmpty(attributeValue, "attributeValue"); this.attributeType = attributeType; this.attributeValue = attributeValue; }
Source:
private void updateLinkProperties(NetworkAgentInfo networkAgent, LinkProperties newLp, LinkProperties oldLp) { int netId = networkAgent.network.netId; networkAgent.clatd.fixupLinkProperties(oldLp, newLp); updateInterfaces(newLp, oldLp, netId, networkAgent.networkCapabilities); updateMtu(newLp, oldLp); if (isDefaultNetwork(networkAgent)) { updateTcpBufferSizes(newLp.getTcpBufferSizes()); } updateRoutes(newLp, oldLp, netId); updateDnses(newLp, oldLp, netId); mDnsManager.updatePrivateDnsStatus(netId, newLp); if (isDefaultNetwork(networkAgent)) { handleApplyDefaultProxy(newLp.getHttpProxy()); } else { updateProxy(newLp, oldLp); } if (!Objects.equals(newLp, oldLp)) { synchronized (networkAgent) { networkAgent.linkProperties = newLp; } networkAgent.clatd.update(); notifyIfacesChangedForNetworkStats(); if (networkAgent.everConnected) { try { networkAgent.networkMonitor().notifyLinkPropertiesChanged( networkAgent.linkProperties); } catch (RemoteException e) { e.rethrowFromSystemServer(); } notifyNetworkCallbacks(networkAgent, ConnectivityManager.CALLBACK_IP_CHANGED); } } mKeepaliveTracker.handleCheckKeepalivesStillValid(networkAgent); }

Target:
private void updateLinkProperties(NetworkAgentInfo networkAgent, LinkProperties newLp, LinkProperties oldLp) { int netId = networkAgent.network.netId; networkAgent.clatd.fixupLinkProperties(oldLp, newLp); updateInterfaces(newLp, oldLp, netId, networkAgent.networkCapabilities); updateMtu(newLp, oldLp); if (isDefaultNetwork(networkAgent)) { updateTcpBufferSizes(newLp.getTcpBufferSizes()); } updateRoutes(newLp, oldLp, netId); updateDnses(newLp, oldLp, netId); mDnsManager.updatePrivateDnsStatus(netId, newLp); if (isDefaultNetwork(networkAgent)) { handleApplyDefaultProxy(newLp.getHttpProxy()); } else { updateProxy(newLp, oldLp); } if (!Objects.equals(newLp, oldLp)) { synchronized (networkAgent) { networkAgent.linkProperties = newLp; } networkAgent.clatd.update(); notifyIfacesChangedForNetworkStats(); try { networkAgent.networkMonitor().notifyLinkPropertiesChanged(newLp); } catch (RemoteException e) { e.rethrowFromSystemServer(); } if (networkAgent.everConnected) { notifyNetworkCallbacks(networkAgent, ConnectivityManager.CALLBACK_IP_CHANGED); } } mKeepaliveTracker.handleCheckKeepalivesStillValid(networkAgent); }
Source:
public long maxSizeBytes() { String str = attributes.attribute(MAX_SIZE).get(); if(str == null) return -1; return ByteQuantity.parse(str); }

Target:
public long maxSizeBytes() { return maxSizeBytes; }
Source:
public void resolved(final Pair<Series, FetchData> result) throws Exception { final FetchData f = result.getRight(); boolean failed = false; for (final MetricCollection g : f.getGroups()) { failed = failed || failOnLimits && aggregationLimit.isGreater(session::getRetainedMetricsCount); if (!failed) { g.updateAggregation(session, result.getLeft().getTags(), ImmutableSet.of(result.getLeft())); } dataInMemoryReporter.reportDataNoLongerNeeded(g.size()); } }

Target:
public void resolved(final Pair<Series, FetchData> result) throws Exception { final FetchData f = result.getRight(); requestErrors.addAll(f.getErrors()); try { for (final MetricCollection g : f.getGroups()) { g.updateAggregation(session, result.getLeft().getTags(), ImmutableSet.of(result.getLeft())); dataInMemoryReporter.reportDataNoLongerNeeded(g.size()); } } catch (QuotaViolationException e) { log.debug("Aggregation quota violated", e); } }