auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public <T extends Info> T getById(final String id, final Class<T> type) { Assert.notNull(id, "id"); Info info = null; try { final Callable<? extends Info> valueLoader; if (CatalogInfo.class.isAssignableFrom(type)) { valueLoader = new CatalogLoader(id); } else { valueLoader = new ConfigLoader(id); } Semaphore lock = locks.get(id); if (lock == null) { lock = new Semaphore(1); locks.put(id, lock); } info = cache.getIfPresent(id); if (info == null) { if (lock.tryAcquire()) { try { info = cache.get(id, valueLoader); } finally { lock.release(); } } } if (info == null) { try { info = valueLoader.call(); } catch (Exception e) { throw new ExecutionException(e); } } } catch (CacheLoader.InvalidCacheLoadException notFound) { return null; } catch (ExecutionException e) { Throwables.propagate(e.getCause()); } if (info == null) { return null; } if (info instanceof CatalogInfo) { info = resolveCatalog((CatalogInfo) info); } else if (info instanceof ServiceInfo) { resolveTransient((ServiceInfo) info); } if (type.isAssignableFrom(info.getClass())) { return ModificationProxy.create(type.cast(info), type); } return null; }

Target:
public <T extends Info> T getById(final String id, final Class<T> type) { Assert.notNull(id, "id"); Info info = null; try { final Callable<? extends Info> valueLoader; if (CatalogInfo.class.isAssignableFrom(type)) { valueLoader = new CatalogLoader(id); } else { valueLoader = new ConfigLoader(id); } Semaphore lock = locks.computeIfAbsent(id, x -> new Semaphore(1)); info = cache.getIfPresent(id); if (info == null) { if (lock.tryAcquire()) { try { info = cache.get(id, valueLoader); } finally { lock.release(); } } } if (info == null) { try { info = valueLoader.call(); } catch (Exception e) { throw new ExecutionException(e); } } } catch (CacheLoader.InvalidCacheLoadException notFound) { return null; } catch (ExecutionException e) { Throwables.propagate(e.getCause()); } if (info == null) { return null; } if (info instanceof CatalogInfo) { info = resolveCatalog((CatalogInfo) info); } else if (info instanceof ServiceInfo) { resolveTransient((ServiceInfo) info); } if (type.isAssignableFrom(info.getClass())) { return ModificationProxy.create(type.cast(info), type); } return null; }
Source:
public ExtensionEntry(File file) throws IOException { this.file = file; context = new EnumMap<>(ExtensionProperties.class); Properties props = new Properties(); try (FileInputStream inputStream = new FileInputStream(file)) { props.load(inputStream); context.put(ExtensionProperties.CONFIGURATION, props); context.put(ExtensionProperties.NAME, props.getProperty(NAME)); context.put(ExtensionProperties.PROVIDES, props.getProperty(PROVIDES)); Module module = loadModule(props.getProperty(MODULE)); this.extension = createExtension(module); } }

Target:
public ExtensionEntry(File file) throws IOException { this.file = file; context = new EnumMap<>(ExtensionProperties.class); Properties props = new Properties(); try (FileInputStream inputStream = new FileInputStream(file)) { enabled = props.get(ENABLED) != null ? Boolean.parseBoolean((String) props.get(ENABLED)) : true; props.load(inputStream); context.put(ExtensionProperties.CONFIGURATION, props); context.put(ExtensionProperties.NAME, props.getProperty(NAME)); context.put(ExtensionProperties.PROVIDES, props.getProperty(PROVIDES)); } }
Source:
private void initializeSlot(int dimIndex) { final int index = dimIndex / 8; final int extraIndex = dimIndex % 8; usedFlagBuffer.put(index, (byte) (usedFlagBuffer.get(index) | 1 << extraIndex)); final int recordOffset = dimIndex * recordSize; for (int i = 0; i < aggregators.length; i++) { aggregators[i].init(valBuffer, recordOffset + aggregatorOffsets[i]); } }

Target:
private void initializeSlot(int dimIndex) { final int index = dimIndex / Byte.SIZE; final int extraIndex = dimIndex % Byte.SIZE; usedFlagBuffer.put(index, (byte) (usedFlagBuffer.get(index) | (1 << extraIndex))); final int recordOffset = dimIndex * recordSize; for (int i = 0; i < aggregators.length; i++) { aggregators[i].init(valBuffer, recordOffset + aggregatorOffsets[i]); } }
Source:
private void drawVariables(List<UserVariable> variableList, Batch batch) { if (variableList == null) { return; } if (variableToShow.isDummy()) { drawText(batch, Constants.NO_VARIABLE_SELECTED, xPosition, yPosition); } else { for (UserVariable variable : variableList) { if (variable.getName().equals(variableToShow.getName())) { String variableValue = variable.getValue().toString(); if (variable.getVisible()) { if (isNumberAndInteger(variableValue)) { drawText(batch, variableValueWithoutDecimal, xPosition, yPosition); } else if (variable.getValue().toString().isEmpty()) { drawText(batch, Constants.NO_VALUE_SET, xPosition - 200, yPosition); } else { drawText(batch, variableValue, xPosition, yPosition); } } break; } } } }

Target:
private void drawVariables(List<UserVariable> variableList, Batch batch) { if (variableList == null) { return; } if (variableToShow.isDummy()) { drawText(batch, Constants.NO_VARIABLE_SELECTED, xPosition, yPosition); } else { for (UserVariable variable : variableList) { if (variable.getName().equals(variableToShow.getName())) { String variableValue = variable.getValue().toString(); if (variable.getVisible()) { if (isNumberAndInteger(variableValue)) { drawText(batch, variableValueWithoutDecimal, xPosition, yPosition); } else if (variableValue.isEmpty()) { drawText(batch, Constants.NO_VALUE_SET, xPosition, yPosition); } else { drawText(batch, variableValue, xPosition, yPosition); } } break; } } } }
Source:
public void testNaNValuesResult() { String url = UriComponentsBuilder.fromUriString(urlPattern).buildAndExpand(ARABIDOPSIS_SPECIES, GENE_IDS).encode().toUriString(); mockServer.expect(requestTo(url)) .andExpect(method(HttpMethod.GET)) .andRespond(withSuccess(TSV_WITH_NAN, MediaType.TEXT_PLAIN)); List<String> bioentityIdentifiers = Arrays.asList(GENE_IDS.split("\\W+")); Pair<Optional<Exception>, Optional<JsonArray>> result = subject.fetchEnrichedGenes(ARABIDOPSIS_SPECIES, bioentityIdentifiers); assertThat(jsonPath("$", hasSize(2))); assertThat(jsonPath("$[0].effect_size", is(Double.NaN))); assertThat(jsonPath("$[1].effect_size", is(3.2))); }

Target:
public void testNaNValuesResult() { String url = UriComponentsBuilder.fromUriString(urlPattern).buildAndExpand(ARABIDOPSIS_SPECIES, GENE_IDS).encode().toUriString(); mockServer.expect(requestTo(url)) .andExpect(method(HttpMethod.GET)) .andRespond(withSuccess(TSV_WITH_NAN, MediaType.TEXT_PLAIN)); List<String> bioentityIdentifiers = Arrays.asList(GENE_IDS.split("\\W+")); Pair<Optional<Exception>, Optional<JsonArray>> result = subject.fetchEnrichedGenes(ARABIDOPSIS_SPECIES, bioentityIdentifiers); assertThat(jsonPath("$", hasSize(2))); assertThat(jsonPath("$[0].effect_size", is("NaN"))); assertThat(jsonPath("$[1].effect_size", is(3.2))); }
Source:
private static QualifiedName getPrefix(UseStatementTree useStatementTree) { QualifiedName namespacePrefix; if (useStatementTree.prefix() != null) { namespacePrefix = QualifiedName.create(useStatementTree.prefix()); } else { namespacePrefix = null; } return namespacePrefix; }

Target:
private static QualifiedName getPrefix(UseStatementTree useStatementTree) { NamespaceNameTree prefix = useStatementTree.prefix(); return prefix == null ? null : QualifiedName.create(prefix); }
Source:
public byte[] generateByteArray() { checksum = new XBeeChecksum(); checksum.reset(); byte[] packetData = getPacketData(); ByteArrayOutputStream os = new ByteArrayOutputStream(); os.write(SpecialByte.HEADER_BYTE.getValue()); if (packetData != null) { byte[] length = ByteUtils.shortToByteArray((short)packetData.length); int msb = length[0]; int lsb = length[1]; os.write(msb); os.write(lsb); for (int i = 0; i < packetData.length; i++) { checksum.add(packetData[i]); os.write(packetData[i]); } } else { os.write(0); os.write(0); } os.write((byte)checksum.generate() & 0xFF); return os.toByteArray(); }

Target:
public byte[] generateByteArray() { checksum.reset(); byte[] packetData = getPacketData(); ByteArrayOutputStream os = new ByteArrayOutputStream(); os.write(SpecialByte.HEADER_BYTE.getValue()); if (packetData != null) { byte[] length = ByteUtils.shortToByteArray((short)packetData.length); int msb = length[0]; int lsb = length[1]; os.write(msb); os.write(lsb); for (int i = 0; i < packetData.length; i++) { checksum.add(packetData[i]); os.write(packetData[i]); } } else { os.write(0); os.write(0); } os.write((byte)checksum.generate() & 0xFF); return os.toByteArray(); }
Source:
public String getAmaUrl() { String mcSchema = (getMcPort() == "443") ? "https" : "http"; return mcSchema + "://" + getMcHost(); }

Target:
public String getAmaUrl() { String port = getMcPort(); String context = getMcContext(); String amaUrl = new String(); switch (port) { case "80": amaUrl = "http://" + getMcHost(); break; case "443": amaUrl = "https://" + getMcHost(); break; default: amaUrl = "http://" + getMcHost() + ":" + port; break; } if (!StringUtils.isEmpty(context)) { amaUrl += "/" + context; } return amaUrl; }
Source:
public boolean equals(Object o) { if(!(o instanceof Account)) { return false; } return ((Account) o).getId().equals(getId()); }

Target:
public boolean equals(Object o) { return o instanceof Account && ((Account) o).getId().equals(getId()); }
Source:
public static Optional<CompletableFuture<String>> upload(File file, Runnable preparedAction, Consumer<String> callback, Type fileType) { if (!Configuration.getBoolean(Configuration.Parameter.S3_UPLOAD_ENABLE)) { LOGGER.debug("there is no sense to continue as saving screenshots onto S3 is disabled."); return Optional.empty(); } preparedAction.run(); return Optional.ofNullable(CompletableFuture.supplyAsync(() -> { String url = null; try { int expiresIn = Configuration.getInt(Configuration.Parameter.ARTIFACTS_EXPIRATION_SECONDS); LOGGER.debug("Uploading to AWS: " + file.getName() + ". Expires in " + expiresIn + " seconds."); url = ZafiraSingleton.INSTANCE.getClient().uploadFile(file, expiresIn, String.format(fileType.getPath() + "/%s/", DATE_FORMAT.format(new Date()))); LOGGER.debug("Uploaded to AWS: " + file.getName()); callback.accept(url); LOGGER.debug("Updated AWS metadata: " + file.getName()); } catch (Exception e) { LOGGER.debug("Can't save file to Amazon S3!", e); } return url; }, executorService).exceptionally(e -> { LOGGER.debug("Can't save file to Amazon S3!", e); return null; })); }

Target:
public static Optional<CompletableFuture<String>> upload(File file, Runnable preparedAction, Consumer<String> callback, Type fileType) { preparedAction.run(); return Optional.ofNullable(CompletableFuture.supplyAsync(() -> { String url = null; try { int expiresIn = Configuration.getInt(Configuration.Parameter.ARTIFACTS_EXPIRATION_SECONDS); LOGGER.debug("Uploading to AWS: " + file.getName() + ". Expires in " + expiresIn + " seconds."); url = ZafiraSingleton.INSTANCE.getClient().uploadFile(file, expiresIn, String.format(fileType.getPath() + "/%s/", DATE_FORMAT.format(new Date()))); LOGGER.debug("Uploaded to AWS: " + file.getName()); callback.accept(url); LOGGER.debug("Updated AWS metadata: " + file.getName()); } catch (Exception e) { LOGGER.debug("Can't save file to Amazon S3!", e); } return url; }, executorService).exceptionally(e -> { LOGGER.debug("Can't save file to Amazon S3!", e); return null; })); }
Source:
public void onStatusUpdate(PTOperator oper) { for (StatsListener l : oper.statsListeners) { final StatsListener.Response rsp; if (l instanceof StatsListener.StatsListenerWithContext) { rsp = ((StatsListener.StatsListenerWithContext)l).processStats(oper.stats, statsListenerContext); } else { rsp = l.processStats(oper.stats); } if (rsp != null) { oper.loadIndicator = rsp.loadIndicator; if (rsp.repartitionRequired) { final OperatorMeta om = oper.getOperatorMeta(); if (this.pendingRepartition.putIfAbsent(om, om) != null) { LOG.debug("Skipping repartitioning for load {}", oper, oper.loadIndicator); } else { LOG.debug("Scheduling repartitioning for load {}", oper, oper.loadIndicator); Runnable r = new Runnable() { @Override public void run() { redoPartitions(logicalToPTOperator.get(om), rsp.repartitionNote); pendingRepartition.remove(om); } }; ctx.dispatch(r); } } if (rsp.operatorRequests != null) { for (OperatorRequest cmd : rsp.operatorRequests) { StramToNodeRequest request = new StramToNodeRequest(); request.operatorId = oper.getId(); request.requestType = StramToNodeRequest.RequestType.CUSTOM; request.cmd = cmd; ctx.addOperatorRequest(oper, request); } } if (rsp.operatorCommands != null) { for (@SuppressWarnings("deprecation") com.datatorrent.api.StatsListener.OperatorCommand cmd : rsp.operatorCommands) { StramToNodeRequest request = new StramToNodeRequest(); request.operatorId = oper.getId(); request.requestType = StramToNodeRequest.RequestType.CUSTOM; OperatorCommandConverter converter = new OperatorCommandConverter(); converter.cmd = cmd; request.cmd = converter; ctx.addOperatorRequest(oper, request); } } } } }

Target:
public void onStatusUpdate(PTOperator oper) { for (StatsListenerWithContext l : oper.statsListeners) { final StatsListener.Response rsp = l.processStats(oper.stats, statsListenerContext); if (rsp != null) { oper.loadIndicator = rsp.loadIndicator; if (rsp.repartitionRequired) { final OperatorMeta om = oper.getOperatorMeta(); if (this.pendingRepartition.putIfAbsent(om, om) != null) { LOG.debug("Skipping repartitioning for load {}", oper, oper.loadIndicator); } else { LOG.debug("Scheduling repartitioning for load {}", oper, oper.loadIndicator); Runnable r = new Runnable() { @Override public void run() { redoPartitions(logicalToPTOperator.get(om), rsp.repartitionNote); pendingRepartition.remove(om); } }; ctx.dispatch(r); } } if (rsp.operatorRequests != null) { for (OperatorRequest cmd : rsp.operatorRequests) { StramToNodeRequest request = new StramToNodeRequest(); request.operatorId = oper.getId(); request.requestType = StramToNodeRequest.RequestType.CUSTOM; request.cmd = cmd; ctx.addOperatorRequest(oper, request); } } if (rsp.operatorCommands != null) { for (@SuppressWarnings("deprecation") com.datatorrent.api.StatsListener.OperatorCommand cmd : rsp.operatorCommands) { StramToNodeRequest request = new StramToNodeRequest(); request.operatorId = oper.getId(); request.requestType = StramToNodeRequest.RequestType.CUSTOM; OperatorCommandConverter converter = new OperatorCommandConverter(); converter.cmd = cmd; request.cmd = converter; ctx.addOperatorRequest(oper, request); } } } } }
Source:
public Node visitBlock(BlockContext ctx) { List<VarRefNode> arguments = new ArrayList<>(); for (DeclContext node : ctx.decl()) { arguments.add((VarRefNode) visit(node)); } SequenceNode sequence = (SequenceNode) visit(ctx.sequence()); return new BlockNode(sequence, arguments); }

Target:
public Node visitBlock(BlockContext ctx) { List<VarRefNode> arguments = new ArrayList<>(); for (DeclContext node : ctx.decl()) { arguments.add((VarDeclNode) visit(node)); } SequenceNode sequence = (SequenceNode) visit(ctx.sequence()); return new BlockNode(sequence, arguments); }
Source:
public Optional<Decorrelated> visitFilter(FilterNode node, PlanNode reference) { Optional<Decorrelated> result = decorrelate(node.getSource()); return result.map(decorrelated -> { return new Decorrelated( ImmutableList.<Expression>builder() .addAll(decorrelated.getCorrelatedPredicates()) .add(node.getPredicate()) .build(), decorrelated.getDecorrelatedNode() ); }); }

Target:
public Optional<Decorrelated> visitFilter(FilterNode node, PlanNode reference) { Optional<Decorrelated> result = decorrelate(node.getSource()); return result.map(decorrelated -> new Decorrelated( ImmutableList.<Expression>builder() .addAll(decorrelated.getCorrelatedPredicates()) .add(node.getPredicate()) .build(), decorrelated.getDecorrelatedNode() )); }
Source:
public Set<Identity> getIdentities(Account account) { if (!isConfigured()) { return new HashSet<>(); } String accessToken = (String) DataAccessor.fields(account).withKey(ServiceAuthConstants.ACCESS_TOKEN).get(); if (tokenUtil.findAndSetJWT()) { ApiRequest request = ApiContext.getContext().getApiRequest(); request.setAttribute(ServiceAuthConstants.ACCESS_TOKEN, accessToken); return tokenUtil.getIdentities(); } else if(ServiceAuthConstants.NO_IDENTITY_LOOKUP_SUPPORTED.get()) { Set<Identity> identities = new HashSet<>(); identities.add(new Identity(account.getExternalIdType(), account.getExternalId())); return identities; } String jwt = null; if (SecurityConstants.SECURITY.get() && !StringUtils.isBlank(accessToken)) { AuthToken authToken = authTokenDao.getTokenByAccountId(account.getId()); if (authToken == null) { Token token = refreshToken(accessToken); if (token != null) { jwt = ProjectConstants.AUTH_TYPE + token.getJwt(); authToken = authTokenDao.createToken(token.getJwt(), token.getAuthProvider(), account.getId(), account.getId()); jwt = authToken.getKey(); accessToken = (String) DataAccessor.fields(account).withKey(ServiceAuthConstants.ACCESS_TOKEN).get(); } } else { jwt = authToken.getKey(); } } if (StringUtils.isBlank(jwt)){ return Collections.emptySet(); } ApiRequest request = ApiContext.getContext().getApiRequest(); request.setAttribute(tokenUtil.tokenType(), jwt); request.setAttribute(ServiceAuthConstants.ACCESS_TOKEN, accessToken); return tokenUtil.getIdentities(); }

Target:
public Set<Identity> getIdentities(Account account) { if (!isConfigured()) { return new HashSet<>(); } String accessToken = (String) DataAccessor.fields(account).withKey(ServiceAuthConstants.ACCESS_TOKEN).get(); if (tokenUtil.findAndSetJWT()) { ApiRequest request = ApiContext.getContext().getApiRequest(); request.setAttribute(ServiceAuthConstants.ACCESS_TOKEN, accessToken); return tokenUtil.getIdentities(); } else if(ServiceAuthConstants.NO_IDENTITY_LOOKUP_SUPPORTED.get()) { Set<Identity> identities = new HashSet<>(); if (StringUtils.equals(account.getExternalIdType(), ServiceAuthConstants.USER_TYPE.get())) { identities.add(new Identity(account.getExternalIdType(), account.getExternalId(), null, null, null, null, true)); } return identities; } String jwt = null; if (SecurityConstants.SECURITY.get() && !StringUtils.isBlank(accessToken)) { AuthToken authToken = authTokenDao.getTokenByAccountId(account.getId()); if (authToken == null) { Token token = refreshToken(accessToken); if (token != null) { jwt = ProjectConstants.AUTH_TYPE + token.getJwt(); authToken = authTokenDao.createToken(token.getJwt(), token.getAuthProvider(), account.getId(), account.getId()); jwt = authToken.getKey(); accessToken = (String) DataAccessor.fields(account).withKey(ServiceAuthConstants.ACCESS_TOKEN).get(); } } else { jwt = authToken.getKey(); } } if (StringUtils.isBlank(jwt)){ return Collections.emptySet(); } ApiRequest request = ApiContext.getContext().getApiRequest(); request.setAttribute(tokenUtil.tokenType(), jwt); request.setAttribute(ServiceAuthConstants.ACCESS_TOKEN, accessToken); return tokenUtil.getIdentities(); }
Source:
public static AbstractTaskContextStore loadTaskContextStore() { ExtensionPointReader<AbstractTaskContextStore> reader = new ExtensionPointReader<AbstractTaskContextStore>( ITasksCoreConstants.ID_PLUGIN, "contextStore", "contextStore", AbstractTaskContextStore.class); IStatus status = reader.read(); if (!status.isOK()) { StatusHandler.log(status); } AbstractTaskContextStore contextStore = reader.getItem(); if (contextStore != null) { return contextStore; } return new DefaultTaskContextStore(); }

Target:
public static AbstractTaskContextStore loadTaskContextStore() { ExtensionPointReader<AbstractTaskContextStore> reader = new ExtensionPointReader<AbstractTaskContextStore>( ITasksCoreConstants.ID_PLUGIN, "contextStore", "contextStore", AbstractTaskContextStore.class); reader.read(); AbstractTaskContextStore contextStore = reader.getItem(); if (contextStore != null) { return contextStore; } return new DefaultTaskContextStore(); }
Source:
public static void assertUsername(String strippedUsername) { profilePage.clickOnDropDownMenuForUserOnMainPage(); profilePage.clickOnProfileInDropDownMenu(); profilePage.openMainProfileTab(); info("Begin asserting the automatic stripping of the excess spaces in username"); assertTrue("Excess space characters were not cut", profilePage.getUsernameTableField().getText().equals(strippedUsername)); info("Excess space characters are stripped to 1 in the middle"); }

Target:
public static void assertUsername(String strippedUsername) { profilePage.clickOnDropDownMenuForUserOnMainPage(); profilePage.clickOnProfileInDropDownMenu(); profilePage.openMainProfileTab(); info("Asserting that username on profile is same as: " + strippedUsername); profilePage.assertUsernameInProfile(strippedUsername); info("Assertion passed"); }
Source:
public CountingMap<String> getSegmentAvailability() { return getSegmentStats( new Function<DataSegment, Integer>() { @Override public Integer apply(DataSegment input) { int available = (segmentReplicantLookup.getTotalReplicants(input.getIdentifier()) == 0) ? 0 : 1; return 1 - available; } } ); }

Target:
public CountingMap<String> getSegmentAvailability() { final CountingMap<String> retVal = new CountingMap<>(); if (segmentReplicantLookup == null) { return retVal; } for (DataSegment segment : getAvailableDataSegments()) { int available = (segmentReplicantLookup.getTotalReplicants(segment.getIdentifier()) == 0) ? 0 : 1; retVal.add(segment.getDataSource(), 1 - available); } return retVal; }
Source:
public void start() { scheduledExecutor = Execs.scheduledSingleThreaded("coordinator_handoff_scheduled_%d"); scheduledExecutor.scheduleAtFixedRate( new Runnable() { @Override public void run() { Iterator<Map.Entry<SegmentDescriptor, Pair<Executor, Runnable>>> itr = handOffCallbacks.entrySet() .iterator(); while (itr.hasNext()) { Map.Entry<SegmentDescriptor, Pair<Executor, Runnable>> entry = itr.next(); SegmentDescriptor descriptor = entry.getKey(); try { List<SegmentLoadInfo> serverView = coordinatorClient.fetchServerView( dataSource, descriptor.getInterval(), true ); if (isHandOffComplete(serverView, entry.getKey())) { log.info("Segment Handoff complete for dataSource[%s] Segment[%s]", dataSource, descriptor); entry.getValue().lhs.execute(entry.getValue().rhs); itr.remove(); } else { log.info( "Segment Handoff not complete for dataSource[%s] Segment[%s]. Will try again after [%d]secs", dataSource, descriptor, pollDurationMillis ); } } catch (Exception e) { log.error( e, "Exception while checking handoff for dataSource[%s] Segment[%s], Will try again after [%d]secs", dataSource, descriptor, pollDurationMillis ); } } } }, 0L, pollDurationMillis, TimeUnit.MILLISECONDS ); }

Target:
public void start() { scheduledExecutor = Execs.scheduledSingleThreaded("coordinator_handoff_scheduled_%d"); scheduledExecutor.scheduleAtFixedRate( new Runnable() { @Override public void run() { checkForSegmentHandoffs(); } }, 0L, pollDurationMillis, TimeUnit.MILLISECONDS ); }
Source:
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj.getClass() != this.getClass()) { return false; } EngineBackupLog other = (EngineBackupLog)obj; return (dbName.equals(other.getDbName()) && doneAt.equals(other.getDoneAt())); }

Target:
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof EngineBackupLogId)) { return false; } EngineBackupLog other = (EngineBackupLog)obj; return (dbName.equals(other.getDbName()) && doneAt.equals(other.getDoneAt())); }
Source:
public <T> T create0(Class<T> entityViewClass, Map<String, Object> optionalParameters) { Constructor<T> constructor = (Constructor<T>) createConstructorCache.get(entityViewClass); CREATION: try { if (constructor == null) { ManagedViewTypeImplementor<T> managedViewType = metamodel.managedView(entityViewClass); if (!managedViewType.isCreatable()) { break CREATION; } Class<? extends T> proxyClass = proxyFactory.getProxy(this, managedViewType); constructor = (Constructor<T>) proxyClass.getConstructor(proxyClass, Map.class); createConstructorCache.put(entityViewClass, constructor); } return constructor.newInstance(null, optionalParameters); } catch (Exception e) { e.printStackTrace(); throw new IllegalArgumentException("Couldn't instantiate entity view object for type: " + entityViewClass.getName() + "\nDid you forget to add a no-args constructor to the view? Consider adding a no-args constructor annotated with @ViewConstructor(\"create\").", e); } throw new IllegalArgumentException("Can't create instance of non-creatable view type: " + entityViewClass.getName() + "\nDid you forget to annotate it with @CreatableEntityView?"); }

Target:
public <T> T create0(Class<T> entityViewClass, Map<String, Object> optionalParameters) { Constructor<T> constructor = (Constructor<T>) createConstructorCache.get(entityViewClass); CREATION: try { if (constructor == null) { ManagedViewTypeImplementor<T> managedViewType = metamodel.managedView(entityViewClass); if (!managedViewType.isCreatable()) { break CREATION; } Class<? extends T> proxyClass = proxyFactory.getProxy(this, managedViewType); constructor = (Constructor<T>) proxyClass.getConstructor(proxyClass, Map.class); createConstructorCache.put(entityViewClass, constructor); } return constructor.newInstance(null, optionalParameters); } catch (Exception e) { throw new IllegalArgumentException("Couldn't instantiate entity view object for type: " + entityViewClass.getName() + "\nDid you forget to add a no-args constructor to the view? Consider adding a no-args constructor annotated with @ViewConstructor(\"create\").", e); } throw new IllegalArgumentException("Can't create instance of non-creatable view type: " + entityViewClass.getName() + "\nDid you forget to annotate it with @CreatableEntityView?"); }
Source:
public String destroy(Request request, Response response) throws IOException { final String materialName = request.params(MATERIAL_NAME); SCM scm = fetchEntityFromConfig(materialName); HttpLocalizedOperationResult result = new HttpLocalizedOperationResult(); pluggableScmService.deletePluggableSCM(currentUsername(), scm, result); return renderHTTPOperationResult(result, request, response); }

Target:
public String destroy(Request request, Response response) throws IOException { final String materialName = request.params(MATERIAL_NAME); SCM scm = fetchEntityFromConfig(materialName); haltIfEntityIsDefinedRemotely(scm); HttpLocalizedOperationResult result = new HttpLocalizedOperationResult(); pluggableScmService.deletePluggableSCM(currentUsername(), scm, result); return renderHTTPOperationResult(result, request, response); }
Source:
public void testLoadingDefaultPropertiesFile() throws IOException { reader.loadDefaultPropertyFile(DEFAULT_PROPERTIES_FILE, topologyProperties); assertNotNull(topologyProperties); assertFalse(topologyProperties.isEmpty()); for (final Map.Entry<Object, Object> e : topologyProperties.entrySet()) { assertNotNull(e.getKey()); } }

Target:
public void testLoadingDefaultPropertiesFile() throws IOException { reader.loadDefaultPropertyFile(DEFAULT_PROPERTIES_FILE, topologyProperties); assertNotNull(topologyProperties); assertFalse(topologyProperties.isEmpty()); }
Source:
public Collection<PlannedNode> provision(Label label, int excessWorkload) { List<PlannedNode> list = new ArrayList<PlannedNode>(); try { while (excessWorkload > 0) { if (onDemandRegistration) { SchedularSupervisor.LOCK.lock(); try { LOGGER.fine("Checking if scheduler is running?"); if (!Mesos.getInstance().isSchedulerRunning()) { LOGGER.info("Creating scheduler, as it was not running."); restartMesos(); } } finally { SchedularSupervisor.LOCK.unlock(); } } final int numExecutors = Math.min(excessWorkload, getMaxExecutors()); excessWorkload -= numExecutors; LOGGER.info("Provisioning Jenkins Slave on Mesos with " + numExecutors + " executors. Remaining excess workload: " + excessWorkload + " executors)"); list.add(new PlannedNode(this.getDisplayName(), Computer.threadPoolForRemoting .submit(new Callable<Node>() { public Node call() throws Exception { MesosSlave s = doProvision(numExecutors); return s; } }), numExecutors)); } } catch (Exception e) { LOGGER.log(Level.WARNING, "Failed to create instances on Mesos", e); return Collections.emptyList(); } return list; }

Target:
public Collection<PlannedNode> provision(Label label, int excessWorkload) { List<PlannedNode> list = new ArrayList<PlannedNode>(); final MesosSlaveInfo slaveInfo = getSlaveInfo(slaveInfos, label); try { while (excessWorkload > 0) { if (onDemandRegistration) { JenkinsScheduler.SUPERVISOR_LOCK.lock(); try { LOGGER.fine("Checking if scheduler is running"); if (!Mesos.getInstance().isSchedulerRunning()) { restartMesos(); } } finally { JenkinsScheduler.SUPERVISOR_LOCK.unlock(); } } final int numExecutors = Math.min(excessWorkload, slaveInfo.getMaxExecutors()); excessWorkload -= numExecutors; LOGGER.info("Provisioning Jenkins Slave on Mesos with " + numExecutors + " executors. Remaining excess workload: " + excessWorkload + " executors)"); list.add(new PlannedNode(this.getDisplayName(), Computer.threadPoolForRemoting .submit(new Callable<Node>() { public Node call() throws Exception { MesosSlave s = doProvision(numExecutors, slaveInfo); return s; } }), numExecutors)); } } catch (Exception e) { LOGGER.log(Level.WARNING, "Failed to create instances on Mesos", e); return Collections.emptyList(); } return list; }
Source:
public void applyChanges(SampleAnalyte target, SampleAnalyte source) throws IOException { target.setRegion(source.getRegion()); target.setTubeId(source.getTubeId()); target.setStrStatus(source.getStrStatus()); target.getSample().getSampleAdditionalInfo().setGroupId(source.getSample().getSampleAdditionalInfo().getGroupId()); target.getSample().getSampleAdditionalInfo().setGroupDescription(source.getSample().getSampleAdditionalInfo().getGroupDescription()); loadMembers(target, source); }

Target:
public void applyChanges(SampleAnalyte target, SampleAnalyte source) throws IOException { target.setRegion(source.getRegion()); target.setTubeId(source.getTubeId()); target.setStrStatus(source.getStrStatus()); loadMembers(target, source); }
Source:
public void remove(@Nonnull K key, @Nonnull V value) { assert key != null; assert value != null; int index = findIndex(key); assert index != -1; ArrayList<V> keyValues = getValues(index); assert keyValues != null; assert keyValues.size() > 0; if (keyValues.size() > 1) { getValues(index).remove(value); } else { assert value.equals(keyValues.get(0)); K[] newKeys = (K[]) new Object[keys.length - 1]; Object[] newValues = new Object[values.length - 1]; int firstFree = 0; for (int i = 0; i < keys.length; ++i) { if (!key.equals(keys[i])) { newKeys[firstFree] = keys[i]; newValues[firstFree] = values[i]; ++firstFree; } } keys = newKeys; values = newValues; } }

Target:
public void remove(@Nonnull K key, @Nonnull V value) { assert key != null; assert value != null; int index = findIndex(key); assert index != -1; ArrayList<V> keyValues = getValues(index); assert keyValues != null; assert keyValues.size() > 0; if (keyValues.size() > 1) { getValues(index).remove(value); } else { assert value.equals(keyValues.get(0)); K[] newKeys = (K[]) new Object[keys.length - 1]; Object[] newValues = new Object[values.length - 1]; int positionToInsertNext = 0; for (int i = 0; i < keys.length; ++i) { if (!key.equals(keys[i])) { newKeys[positionToInsertNext] = keys[i]; newValues[positionToInsertNext] = values[i]; ++positionToInsertNext; } } keys = newKeys; values = newValues; } }
Source:
@Test public void shouldPostBookingFormAsyncThrowError() { final InputForm inputForm = mock(InputForm.class); String responseError = "{\"error\":\"That userToken is unrecognised.\",\"errorCode\":401,\"usererror\":false}"; ResponseBody responseBody = ResponseBody.create(MediaType.parse("application/json"), responseError); final Response<BookingForm> response = Response.error(401, responseBody); when(bookingApi.postFormAsync("url", inputForm)) .thenReturn(Observable.just(response)); final TestSubscriber<BookingForm> subscriber = new TestSubscriber<>(); service.postFormAsync("url", inputForm).subscribe(subscriber); subscriber.awaitTerminalEvent(); subscriber.assertError(BookingError.class); Throwable error = subscriber.getOnErrorEvents().get(0); assertThat(error instanceof BookingError).isTrue(); }

Target:
@Test public void shouldPostBookingFormAsyncThrowError() { final InputForm inputForm = mock(InputForm.class); String responseError = "{\"error\":\"That userToken is unrecognised.\",\"errorCode\":401,\"usererror\":false}"; ResponseBody responseBody = ResponseBody.create(MediaType.parse("application/json"), responseError); final Response<BookingForm> response = Response.error(401, responseBody); when(bookingApi.postFormAsync("url", inputForm)) .thenReturn(Observable.just(response)); final TestSubscriber<BookingForm> subscriber = new TestSubscriber<>(); service.postFormAsync("url", inputForm).subscribe(subscriber); subscriber.awaitTerminalEvent(); subscriber.assertError(BookingError.class); Throwable error = subscriber.getOnErrorEvents().get(0); assertThat(error.getMessage()).isEqualTo("That userToken is unrecognised."); }
Source:
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (getIntent().getBooleanExtra(DeepLink.IS_DEEP_LINK, false)) { Bundle parameters = getIntent().getExtras(); Log.d(TAG, "Deeplink params: " + parameters); String idString = parameters.getString("id"); String name = parameters.getString("name"); if(!TextUtils.isEmpty(idString)) showToast("class id== " + idString + " and name==" + name); else{ showToast("no id in the deeplink"); } }else{ showToast("no deep link :( "); } }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (getIntent().getBooleanExtra(DeepLink.IS_DEEP_LINK, false)) { Bundle parameters = getIntent().getExtras(); Log.d(TAG, "Deeplink params: " + parameters); String idString = parameters.getString("id"); String name = parameters.getString("name"); if (!TextUtils.isEmpty(idString)) { showToast("class id== " + idString + " and name==" + name); } else { showToast("no id in the deeplink"); } } else { showToast("no deep link :( "); } }
Source:
public ServerWritePerfRun(int threadIndex, Throttler throttler, AtomicBoolean isShutdown, CountDownLatch latch, int minBlobSize, int maxBlobSize, FileWriter blobIdWriter, FileWriter performanceWriter, AtomicLong totalTimeTaken, AtomicLong totalWrites, long measurementIntervalNs, boolean enableVerboseLogging, ClusterMap clusterMap, ConnectionPool connectionPool) { this.threadIndex = threadIndex; this.throttler = throttler; this.isShutdown = isShutdown; this.latch = latch; this.clusterMap = clusterMap; this.minBlobSize = minBlobSize; this.maxBlobSize = maxBlobSize; this.blobIdWriter = blobIdWriter; this.performanceWriter = performanceWriter; this.totalTimeTaken = totalTimeTaken; this.totalWrites = totalWrites; this.measurementIntervalNs = measurementIntervalNs; this.enableVerboseLogging = enableVerboseLogging; this.connectionPool = connectionPool; Properties props = new Properties(); props.setProperty("router.hostname", "localhost"); props.setProperty("router.datacenter.name", "localDC"); blobIdVersion = new RouterConfig(new VerifiableProperties(props)).routerBlobIdCurrentVersion; }

Target:
public ServerWritePerfRun(int threadIndex, Throttler throttler, AtomicBoolean isShutdown, CountDownLatch latch, int minBlobSize, int maxBlobSize, FileWriter blobIdWriter, FileWriter performanceWriter, AtomicLong totalTimeTaken, AtomicLong totalWrites, long measurementIntervalNs, boolean enableVerboseLogging, ClusterMap clusterMap, ConnectionPool connectionPool) { this.threadIndex = threadIndex; this.throttler = throttler; this.isShutdown = isShutdown; this.latch = latch; this.clusterMap = clusterMap; this.minBlobSize = minBlobSize; this.maxBlobSize = maxBlobSize; this.blobIdWriter = blobIdWriter; this.performanceWriter = performanceWriter; this.totalTimeTaken = totalTimeTaken; this.totalWrites = totalWrites; this.measurementIntervalNs = measurementIntervalNs; this.enableVerboseLogging = enableVerboseLogging; this.connectionPool = connectionPool; Properties props = new Properties(); props.setProperty("router.hostname", "localhost"); props.setProperty("router.datacenter.name", "localDC"); blobIdVersion = new RouterConfig(new VerifiableProperties(props)).routerBlobidCurrentVersion; }
Source:
private void traverseDownstream(CaseInsensitiveString upstreamPipelineName, Map<CaseInsensitiveString, List<PipelineConfig>> pipelineToDownstreamMap, ValueStreamMap graph, List<PipelineConfig> visitedNodes) { List<PipelineConfig> downstreamPipelines = pipelineToDownstreamMap.get(upstreamPipelineName); traverseDownstream(upstreamPipelineName.toString(), downstreamPipelines, pipelineToDownstreamMap, graph, visitedNodes); }

Target:
private void traverseDownstream(CaseInsensitiveString upstreamPipelineName, Map<CaseInsensitiveString, List<PipelineConfig>> pipelineToDownstreamMap, ValueStreamMap graph, List<PipelineConfig> visitedNodes) { List<PipelineConfig> downstreamPipelines = pipelineToDownstreamMap.get(upstreamPipelineName); traverseDownstream(upstreamPipelineName, downstreamPipelines, pipelineToDownstreamMap, graph, visitedNodes); }
Source:
public ListenableFuture<List<Availability>> tagAvailabilityData(AvailabilityMetric metric, final Map<String, String> tags, long timestamp) { ListenableFuture<ResultSet> queryFuture = dataAccess.findData(metric, timestamp); ListenableFuture<List<Availability>> dataFuture = Futures.transform(queryFuture, new AvailabilityDataMapper(true), metricsTasks); int ttl = getTTL(metric); ListenableFuture<List<Availability>> updatedDataFuture = Futures.transform(dataFuture, new ComputeTTL<>(ttl)); return Futures.transform(updatedDataFuture, new AsyncFunction<List<Availability>, List<Availability>>() { @Override public ListenableFuture<List<Availability>> apply(final List<Availability> data) throws Exception { if (data.isEmpty()) { List<Availability> results = Collections.emptyList(); return Futures.immediateFuture(results); } List<ResultSetFuture> insertFutures = new ArrayList<>(); tags.forEach((k, v) -> dataAccess.insertAvailabilityTag(k, v, data)); for (Availability a : data) { insertFutures.add(dataAccess.updateDataWithTag(a, tags)); } ListenableFuture<List<ResultSet>> insertsFuture = Futures.allAsList(insertFutures); return Futures.transform(insertsFuture, (List<ResultSet> resultSets) -> data); } }); }

Target:
public ListenableFuture<List<Availability>> tagAvailabilityData(AvailabilityMetric metric, final Map<String, String> tags, long timestamp) { ListenableFuture<ResultSet> queryFuture = dataAccess.findData(metric, timestamp); ListenableFuture<List<Availability>> dataFuture = Futures.transform(queryFuture, new AvailabilityDataMapper(true), metricsTasks); int ttl = getTTL(metric); ListenableFuture<List<Availability>> updatedDataFuture = Futures.transform(dataFuture, new ComputeTTL<>(ttl)); return Futures.transform(updatedDataFuture, new AsyncFunction<List<Availability>, List<Availability>>() { @Override public ListenableFuture<List<Availability>> apply(final List<Availability> data) throws Exception { if (data.isEmpty()) { List<Availability> results = Collections.emptyList(); return Futures.immediateFuture(results); } List<ResultSetFuture> insertFutures = new ArrayList<>(); tags.forEach((k, v) -> dataAccess.insertAvailabilityTag(k, v, metric, data)); for (Availability a : data) { insertFutures.add(dataAccess.updateDataWithTag(metric, a, tags)); } ListenableFuture<List<ResultSet>> insertsFuture = Futures.allAsList(insertFutures); return Futures.transform(insertsFuture, (List<ResultSet> resultSets) -> data); } }); }
Source:
public static byte[] getTenantIdBytes(RowKeySchema schema, boolean isSalted, PName tenantId) throws SQLException { int pkPos = isSalted ? 1 : 0; Field field = schema.getField(pkPos); PDataType dataType = field.getDataType(); byte[] convertedValue; try { Object value = dataType.toObject(tenantId.getString()); convertedValue = dataType.toBytes(value); } catch(IllegalDataException ex) { throw new SQLExceptionInfo.Builder(SQLExceptionCode.TENANTID_IS_OF_WRONG_TYPE) .build().buildException(); } return convertedValue; }

Target:
public static byte[] getTenantIdBytes(RowKeySchema schema, boolean isSalted, PName tenantId) throws SQLException { int pkPos = isSalted ? 1 : 0; Field field = schema.getField(pkPos); PDataType dataType = field.getDataType(); byte[] convertedValue; try { Object value = dataType.toObject(tenantId.getString()); convertedValue = dataType.toBytes(value); ImmutableBytesWritable ptr = new ImmutableBytesWritable(convertedValue); dataType.pad(ptr, field.getMaxLength(), field.getSortOrder()); convertedValue = ByteUtil.copyKeyBytesIfNecessary(ptr); } catch(IllegalDataException ex) { throw new SQLExceptionInfo.Builder(SQLExceptionCode.TENANTID_IS_OF_WRONG_TYPE) .build().buildException(); } return convertedValue; }
Source:
protected Response performRemove(String id) { return performAction(VdcActionType.RemoveExternalEvent, new RemoveExternalEventParameters(Long.valueOf(id))); }

Target:
protected Response performRemove(String id) { return performAction(VdcActionType.RemoveExternalEvent, new RemoveExternalEventParameters(asLong(id))); }
Source:
public static boolean isEditAllowed(@NonNull PageTitle title) { return Arrays.asList(ENABLED_LANGUAGES).contains(title.getWikiSite().languageCode()); }

Target:
public static boolean isEditAllowed(@NonNull PageTitle title) { return ENABLED_LANGUAGES.contains(title.getWikiSite().languageCode()); }
Source:
public void testRegister() throws Exception { Cluster cluster = getTestCluster(1L); ZookeeperServiceRegistrar registrar = initializeServiceRegistrar(); Config config = new Config(); config.put(ZookeeperServiceRegistrar.PARAM_ZOOKEEPER_SERVER_HOSTNAMES, Lists.newArrayList("zookeeper-1", "zookeeper-2")); config.put(ZookeeperServiceRegistrar.PARAM_ZOOKEEPER_PORT, (Object) 2181); registrar.register(cluster, config, Collections.emptyList()); Service zkService = environmentService.getServiceByName(cluster.getId(), Constants.Zookeeper.SERVICE_NAME); assertNotNull(zkService); Component zkServer = environmentService.getComponentByName(zkService.getId(), ComponentPropertyPattern.ZOOKEEPER_SERVER.name()); assertNotNull(zkServer); Collection<ComponentProcess> zkServerProcesses = environmentService.listComponentProcessesInComponent(zkServer.getId()); assertEquals(Sets.newHashSet("zookeeper-1", "zookeeper-2"), zkServerProcesses.stream().map(ComponentProcess::getHost).collect(Collectors.toSet())); assertEquals(Sets.newHashSet(2181, 2181), zkServerProcesses.stream().map(ComponentProcess::getPort).collect(Collectors.toSet())); ServiceConfiguration zooConf = environmentService.getServiceConfigurationByName(zkService.getId(), CONFIGURATION_NAME_ZOO_CFG); assertNotNull(zooConf); }

Target:
public void testRegister() throws Exception { Cluster cluster = getTestCluster(1L); ZookeeperServiceRegistrar registrar = initializeServiceRegistrar(); Config config = new Config(); config.put(ZookeeperServiceRegistrar.PARAM_ZOOKEEPER_SERVER_HOSTNAMES, Lists.newArrayList("zookeeper-1", "zookeeper-2")); config.put(ZookeeperServiceRegistrar.PARAM_ZOOKEEPER_PORT, (Object) 2181); registrar.register(cluster, config, Collections.emptyList()); Service zkService = environmentService.getServiceByName(cluster.getId(), Constants.Zookeeper.SERVICE_NAME); assertNotNull(zkService); Component zkServer = environmentService.getComponentByName(zkService.getId(), ComponentPropertyPattern.ZOOKEEPER_SERVER.name()); assertNotNull(zkServer); Collection<ComponentProcess> zkServerProcesses = environmentService.listComponentProcesses(zkServer.getId()); assertEquals(Sets.newHashSet("zookeeper-1", "zookeeper-2"), zkServerProcesses.stream().map(ComponentProcess::getHost).collect(Collectors.toSet())); assertEquals(Sets.newHashSet(2181, 2181), zkServerProcesses.stream().map(ComponentProcess::getPort).collect(Collectors.toSet())); ServiceConfiguration zooConf = environmentService.getServiceConfigurationByName(zkService.getId(), CONFIGURATION_NAME_ZOO_CFG); assertNotNull(zooConf); }
Source:
public static <T, R> IgniteFunction<T, R> constant(R r) { return new IgniteFunction<T, R>() { @Override public String toString() { return "Constant function [c=" + r + "]"; } @Override public R apply(T t) { return r; } }; }

Target:
public static <T, R> IgniteFunction<T, R> constant(R r) { return (IgniteFunction<T, R>)t -> r; }
Source:
protected static String getHttpStatusCode(final ImmutableList<Ds3ResponseCode> responseCodes) { if (isEmpty(responseCodes)) { LOG.error("There are no response codes"); return ""; } final ImmutableList.Builder<Integer> builder = ImmutableList.builder(); responseCodes.stream() .filter(responseCode -> ResponsePayloadUtil.isNonErrorCode(responseCode.getCode())) .forEach(responseCode -> builder.add(responseCode.getCode())); final ImmutableList<Integer> codes = builder.build(); if (isEmpty(codes)) { LOG.error("There are no non-error response codes within the list: " + codes.toString()); return ""; } if (codes.contains(204)) { return "NoContent"; } return "OK"; }

Target:
protected static String getHttpStatusCode(final ImmutableList<Ds3ResponseCode> responseCodes) { if (isEmpty(responseCodes)) { LOG.error("There are no response codes"); return ""; } final ImmutableList<Integer> codes = responseCodes.stream() .filter(responseCode -> ResponsePayloadUtil.isNonErrorCode(responseCode.getCode())) .map(Ds3ResponseCode::getCode) .collect(GuavaCollectors.immutableList()); if (isEmpty(codes)) { LOG.error("There are no non-error response codes within the list: " + codes.toString()); return ""; } if (codes.contains(204)) { return "NoContent"; } return "OK"; }
Source:
protected Header[] mergeHeaders(final HttpCacheEntry entry, final HttpResponse response) { response.removeHeaders(HTTP.CONTENT_ENCODING); if (entryAndResponseHaveDateHeader(entry, response) && entryDateHeaderNewerThenResponse(entry, response)) { return entry.getAllHeaders(); } final List<Header> cacheEntryHeaderList = new ArrayList<Header>(Arrays.asList(entry .getAllHeaders())); removeCacheHeadersThatMatchResponse(cacheEntryHeaderList, response); removeCacheEntry1xxWarnings(cacheEntryHeaderList, entry); cacheEntryHeaderList.addAll(Arrays.asList(response.getAllHeaders())); return cacheEntryHeaderList.toArray(new Header[cacheEntryHeaderList.size()]); }

Target:
protected Header[] mergeHeaders(final HttpCacheEntry entry, final HttpResponse response) { if (entryAndResponseHaveDateHeader(entry, response) && entryDateHeaderNewerThenResponse(entry, response)) { return entry.getAllHeaders(); } final HeaderGroup headerGroup = new HeaderGroup(); headerGroup.setHeaders(entry.getAllHeaders()); for (final HeaderIterator it = response.headerIterator(); it.hasNext(); ) { final Header responseHeader = it.nextHeader(); if (HTTP.CONTENT_ENCODING.equals(responseHeader.getName())) { continue; } final Header[] matchingHeaders = headerGroup.getHeaders(responseHeader.getName()); for (final Header matchingHeader : matchingHeaders) { headerGroup.removeHeader(matchingHeader); } } for (final HeaderIterator it = headerGroup.iterator(); it.hasNext(); ) { final Header cacheHeader = it.nextHeader(); if (HeaderConstants.WARNING.equalsIgnoreCase(cacheHeader.getName())) { final String warningValue = cacheHeader.getValue(); if (warningValue != null && warningValue.startsWith("1")) { it.remove(); } } } for (final HeaderIterator it = response.headerIterator(); it.hasNext(); ) { final Header responseHeader = it.nextHeader(); if (HTTP.CONTENT_ENCODING.equals(responseHeader.getName())) { continue; } headerGroup.addHeader(responseHeader); } return headerGroup.getAllHeaders(); }
Source:
public BookKeeper build() throws IOException, InterruptedException, KeeperException { Preconditions.checkNotNull(statsLogger, "No stats logger provided"); if (eventLoopGroup == null) { eventLoopGroup = getDefaultEventLoopGroup(); } return new BookKeeper(conf, zk, eventLoopGroup, statsLogger, dnsResolver, requestTimer, featureProvider); }

Target:
public BookKeeper build() throws IOException, InterruptedException, KeeperException { Preconditions.checkNotNull(statsLogger, "No stats logger provided"); return new BookKeeper(conf, zk, eventLoopGroup, statsLogger, dnsResolver, requestTimer, featureProvider); }