auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Iterable<Server> listNodesByIds(final Iterable<String> ids) { Iterable<Long> idsAsLongs = Iterables.transform(ids, new Function<String, Long>() { @Override public Long apply(String arg0) { <START> return Long.valueOf(checkNotNull(arg0, "arg0")); <END> } }); return client.getServerServices().getServersById(Longs.toArray(ImmutableSet.copyOf(idsAsLongs))); }</code><technical_language>Replace arg0 more meaningful? planning blow when, in similar functions below, silently ignore null</technical_language>

Target:
public Iterable<Server> listNodesByIds(final Iterable<String> ids) { Set<Long> idsAsLongs = FluentIterable.from(ids) .transform(toLong()) .toSet(); return client.getServerServices().getServersById(Longs.toArray(idsAsLongs)); }
Source:
<code>public void start(ComponentContext context) { <START> getLog().debug("Starting component"); <END> applicationStarted(context); }</code><technical_language>log getName() if null, this debugging class name</technical_language>

Target:
public void start(ComponentContext context) { getLog().debug("Starting component " + getName()); applicationStarted(context); }
Source:
<code>private int dropDatabase(Hive db, DropDatabaseDesc dropDb) throws HiveException { try { String dbName = dropDb.getDatabaseName(); ReplicationSpec replicationSpec = dropDb.getReplicationSpec(); if (replicationSpec.isInReplicationScope()) { Database database = db.getDatabase(dbName); if (database == null) { return 0; } Set<String> keySet = database.getParameters().keySet(); <START> if (keySet.contains(ReplicationSpec.KEY.CURR_STATE_ID.toString())) { <END> String value = database.getParameters().get(ReplicationSpec.KEY.CURR_STATE_ID.toString()); long replState = Long.parseLong(replicationSpec.getCurrentReplicationState()); long currentState = Long.parseLong(value); if (currentState > replState) { return 0; } } } db.dropDatabase(dbName, true, dropDb.getIfExists(), dropDb.isCasdade()); if (dropDb.isCasdade()) { FunctionRegistry.unregisterPermanentFunctions(dbName); } } catch (NoSuchObjectException ex) { throw new HiveException(ex, ErrorMsg.DATABASE_NOT_EXISTS, dropDb.getDatabaseName()); } return 0; }</code><technical_language>replicationSpec.allowEventReplacementInto(database.getParameters()) here</technical_language>

Target:
private int dropDatabase(Hive db, DropDatabaseDesc dropDb) throws HiveException { try { String dbName = dropDb.getDatabaseName(); ReplicationSpec replicationSpec = dropDb.getReplicationSpec(); if (replicationSpec.isInReplicationScope()) { Database database = db.getDatabase(dbName); if (database == null || !replicationSpec.allowEventReplacementInto(database.getParameters())) { return 0; } } db.dropDatabase(dbName, true, dropDb.getIfExists(), dropDb.isCasdade()); if (dropDb.isCasdade()) { FunctionRegistry.unregisterPermanentFunctions(dbName); } } catch (NoSuchObjectException ex) { throw new HiveException(ex, ErrorMsg.DATABASE_NOT_EXISTS, dropDb.getDatabaseName()); } return 0; }
Source:
<code>private void newEntity() { if (getWindow() != null) { return; } AffinityGroupModel model = getNewAffinityGroupModel(); <START> model.init(); <END> setWindow(model); }</code><technical_language>I reason separate this constructor. a method AffinityGroupModel, private called constructor</technical_language>

Target:
private void newEntity() { if (getWindow() != null) { return; } AffinityGroupModel model = new NewAffinityGroupModel(getNewAffinityGroup(), this, getClusterResolver()); model.init(); setWindow(model); }
Source:
<code>public byte[] call(final byte[] bytes) throws Exception { final HdfsDataSet<LongWritable, Text> dataSet; try { dataSet = HdfsDataSet.from(bytes); } catch (final IOException e) { <START> throw new RuntimeException("Exception while instantiating a HdfsDataSet", e); <END> } LOG.log(Level.FINER, "LineCounting task started"); int count = 0; for (final Pair<LongWritable, Text> recordPair : dataSet) { LOG.log(Level.FINEST, "Read line: {0}", recordPair); count++; } LOG.log(Level.INFO, "LineCounting task finished: read {0} lines", count); return Integer.toString(count).getBytes(StandardCharsets.UTF_8); }</code><technical_language>I think, throw IOException, this method throws Exception. final HdfsDataSet<LongWritable, Text> dataSet = HdfsDataSet.from(bytes);</technical_language>

Target:
public byte[] call(final byte[] bytes) throws Exception { final HdfsDataSet<LongWritable, Text> dataSet; try { dataSet = HdfsDataSet.from(bytes); } catch (final IOException e) { LOG.log(Level.SEVERE, "Exception while instantiating a HdfsDataSet: {0}", e); throw e; } LOG.log(Level.FINER, "LineCounting task started"); int count = 0; for (final Pair<LongWritable, Text> recordPair : dataSet) { LOG.log(Level.FINEST, "Read line: {0}", recordPair); count++; } LOG.log(Level.INFO, "LineCounting task finished: read {0} lines", count); return Integer.toString(count).getBytes(StandardCharsets.UTF_8); }
Source:
<code>public static String getDownloadUrlSuffix(Release.Edition edition) { switch (edition) { case DEVELOPER: return DOWNLOAD_DEVELOPER_URL_SUFFIX; case ENTERPRISE: return DOWNLOAD_ENTERPRISE_URL_SUFFIX; case DATACENTER: return DOWNLOAD_DATACENTER_URL_SUFFIX; default: <START> case COMMUNITY: <END> return DOWNLOAD_URL_SUFFIX; } }</code><technical_language>This case redundant default</technical_language>

Target:
public static String getDownloadUrlSuffix(Release.Edition edition) { switch (edition) { case DEVELOPER: return DOWNLOAD_DEVELOPER_URL_SUFFIX; case ENTERPRISE: return DOWNLOAD_ENTERPRISE_URL_SUFFIX; case DATACENTER: return DOWNLOAD_DATACENTER_URL_SUFFIX; default: return DOWNLOAD_URL_SUFFIX; } }
Source:
<code>public static NIOMavenCompiler getCompiler(Decorator decorator) { <START> NIOMavenCompiler compiler = compilers.get(decorator); <END> if (compiler == null) { compiler = createAndAddNewCompiler(decorator); } return compiler; }</code><technical_language>compilers is of type Map<String, NIOMavenCompiler> based key of type decorator. miss name() call</technical_language>

Target:
public static NIOMavenCompiler getCompiler(Decorator decorator) { NIOMavenCompiler compiler = compilers.get(decorator.name()); if (compiler == null) { compiler = createAndAddNewCompiler(decorator); } return compiler; }
Source:
<code>private List<Person> createModel() { return Arrays.asList(new Person("Tom", "Schindl", "tom.schindl@bestsolution.at"), new Person("Boris", "Bokowski", "boris_bokowski@ca.ibm.com"), new Person("Tod", "Creasey", "tod_creasey@ca.ibm.com"), new Person("Jeanderson", "Candido", "jeandersonbc@gmail.com"), new Person("Lars", "Vogel", "Lars.Vogel@gmail.com"), new Person("Hendrik", "Still", <START> "hendrik.still@vogella.com")); <END> }</code><technical_language>Add here? If do change email vogella.com one</technical_language>

Target:
private List<Person> createModel() { return Arrays.asList(new Person("Tom", "Schindl", "tom.schindl@bestsolution.at"), new Person("Boris", "Bokowski", "boris_bokowski@ca.ibm.com"), new Person("Tod", "Creasey", "tod_creasey@ca.ibm.com"), new Person("Jeanderson", "Candido", "jeandersonbc@gmail.com"), new Person("Lars", "Vogel", "lars.vogel@vogella.com"), new Person("Hendrik", "Still", "hendrik.still@vogella.com"), new Person("Simon", "Scholz", "simon.scholz@vogella.com")); }
Source:
<code>void checkAndMaybeComplete() { if (!chunkCompleted && chunkOperationTracker.isDone()) { if (chunkOperationTracker.hasSucceeded()) { <START> if (chunkException != null) { <END> chunkException = null; } } chunkCompleted = true; } if (chunkCompleted) { operationException.set(chunkException); state = ChunkState.Complete; } }</code><technical_language>this change? Do find this more readable</technical_language>

Target:
void checkAndMaybeComplete() { if (chunkOperationTracker.isDone()) { if (!retainExceptionOnSuccess && chunkOperationTracker.hasSucceeded()) { chunkException = null; } chunkCompleted = true; } if (chunkCompleted) { operationException.set(chunkException); state = ChunkState.Complete; } }
Source:
<code>public static void persistUpdatedPackingPlan(String topologyName, PackingPlan updatedPackingPlan, SchedulerStateManagerAdaptor stateManager) { LOG.log(Level.INFO, "Updating scheduled-resource in packing plan: {0}", topologyName); PackingPlanProtoSerializer serializer = new PackingPlanProtoSerializer(); if (stateManager.getPackingPlan(topologyName) != null) { <START> stateManager.deletePackingPlan(topologyName); <END> } boolean result = stateManager.setPackingPlan(serializer.toProto(updatedPackingPlan), topologyName); if (!result) { throw new RuntimeException(String.format("Failed to save %s's packing plan", topologyName)); } }</code><technical_language>is a test for this util method, persistUpdatedPackingPlanWillUpdatesStateManager. Is verification of delete operation needed</technical_language>

Target:
public static void persistUpdatedPackingPlan(String topologyName, PackingPlan updatedPackingPlan, SchedulerStateManagerAdaptor stateManager) { LOG.log(Level.INFO, "Updating scheduled-resource in packing plan: {0}", topologyName); PackingPlanProtoSerializer serializer = new PackingPlanProtoSerializer(); if (!stateManager.updatePackingPlan(serializer.toProto(updatedPackingPlan), topologyName)) { throw new RuntimeException(String.format( "Failed to update packing plan for topology %s", topologyName)); } }
Source:
<code>public final void deallocate() { <START> maxCapacity(-rawMaxCapacity()); <END> wrapped.deallocate(); }</code><technical_language>assert this positive</technical_language>

Target:
public final void deallocate() { wrapped.deallocate(); }
Source:
<code>public UpdateEmailTemplateResponse updateEmailTemplate(UpdateEmailTemplateRequest input) { LOG.finer("Entering updateEmailTemplate"); UpdateEmailTemplateResponse output = new UpdateEmailTemplateResponse(); try { if (input == null) throw new InputValidationException(ApiError.InvalidValueNull.getCode(), ApiError.InvalidValueNull.getMessage("UpdateEmailTemplateRequest: input")); input.accessCode = ValidationHelper.validateAccessCode(input.accessCode, "input.accessCode"); output.session = input.session = ValidationHelper.validateAndExtendSession(input.session, "input.session"); if (input.emailTemplate == null) <START> throw new InputValidationException(ApiError.InvalidValueNull.getCode(), ApiError.InvalidValueNull.getMessage("input.emailTemplate")); <END> ValidationHelper.validateAuthorised(input.session.user, DataTypeHelper.createRole(DataTypeHelper.ROLE_ADMIN_ID)); EmailTemplateServiceProvider.provide().updateEmailTemplate(input.emailTemplate); output.status = StatusType.StatusTypeSuccess; } catch (Exception e) { output.status = StatusType.StatusTypeFailure; output.error = convertToErrorAndLog(LOG, e); } LOG.finer("Exiting updateEmailTemplate"); return output; }</code><technical_language>is a missing validation checks email template updated exists changes valid e.g. change system promotional field is blank etc</technical_language>

Target:
public UpdateEmailTemplateResponse updateEmailTemplate(UpdateEmailTemplateRequest input) { LOG.finer("Entering updateEmailTemplate"); UpdateEmailTemplateResponse output = new UpdateEmailTemplateResponse(); try { if (input == null) throw new InputValidationException(ApiError.InvalidValueNull.getCode(), ApiError.InvalidValueNull.getMessage("UpdateEmailTemplateRequest: input")); input.accessCode = ValidationHelper.validateAccessCode(input.accessCode, "input.accessCode"); output.session = input.session = ValidationHelper.validateAndExtendSession(input.session, "input.session"); if (input.emailTemplate == null) throw new InputValidationException(ApiError.InvalidValueNull.getCode(), ApiError.InvalidValueNull.getMessage("input.emailTemplate")); input.emailTemplate = ValidationHelper.validateExistingEmailTemplate(input.emailTemplate, "input.emailTemplate"); ValidationHelper.validateAuthorised(input.session.user, DataTypeHelper.createRole(DataTypeHelper.ROLE_ADMIN_ID)); EmailTemplateServiceProvider.provide().updateEmailTemplate(input.emailTemplate); output.status = StatusType.StatusTypeSuccess; } catch (Exception e) { output.status = StatusType.StatusTypeFailure; output.error = convertToErrorAndLog(LOG, e); } LOG.finer("Exiting updateEmailTemplate"); return output; }
Source:
<code>public boolean equals(Object o) { if(this == o) return true; if(o == null || getClass() != o.getClass()) return false; MCFluidStack that = (MCFluidStack) o; <START> return stack.equals(that.stack); <END> }</code><technical_language>Is intended compare size of stack here? (FluidStack size account for equals, for hashCode)</technical_language>

Target:
public boolean equals(Object o) { if(this == o) return true; if(o == null || getClass() != o.getClass()) return false; final FluidStack thatStack = ((MCFluidStack) o).stack; final FluidStack thisStack = this.stack; if(thisStack.isEmpty()) { return thatStack.isEmpty(); } if(thisStack.getAmount() != thatStack.getAmount()) { return false; } if(!Objects.equals(thisStack.getFluid(), thatStack.getFluid())) { return false; } return Objects.equals(thisStack.getTag(), thatStack.getTag()); }
Source:
<code>public void aggregate(String groupKey, Iterator<StructuredRecord> iterator, Emitter<StructuredRecord> emitter) throws Exception { if (!iterator.hasNext()) { return; } StructuredRecord.Builder builder = StructuredRecord.builder(outputSchema); builder.set(conf.getKeyField(), groupKey); while (iterator.hasNext()) { StructuredRecord record = iterator.next(); String fieldName = record.get(conf.getFieldName()); fieldName = outputMappings.containsKey(fieldName) ? outputMappings.get(fieldName) : fieldName; if (outputFields.contains(fieldName)) { <START> builder.set(fieldName, record.get(conf.getFieldValue())); <END> } } emitter.emit(builder.build()); }</code><technical_language>If output field is supposed a string, need check type of this field do conversion string</technical_language>

Target:
public void aggregate(String groupKey, Iterator<StructuredRecord> iterator, Emitter<StructuredRecord> emitter) throws Exception { if (!iterator.hasNext()) { return; } StructuredRecord.Builder builder = StructuredRecord.builder(outputSchema); builder.set(conf.getKeyField(), groupKey); while (iterator.hasNext()) { StructuredRecord record = iterator.next(); String outputFieldName = record.get(nameField); String outputFieldValue = record.get(valueField); outputFieldName = outputMappings.containsKey(outputFieldName) ? outputMappings.get(outputFieldName) : outputFieldName; if (outputFields.contains(outputFieldName)) { builder.set(outputFieldName, outputFieldValue); } } emitter.emit(builder.build()); }
Source:
<code>private static <S extends Enum<S>, T extends Enum<T>> Class<S> getOutcomeType(Map<T, Set<S>> translation) { Map.Entry<T, Set<S>> first = translation.entrySet().iterator().next(); <START> Class<S> outcomeType = first.getValue().iterator().next().getDeclaringClass(); <END> return outcomeType; }</code><technical_language>This is guaranteed element</technical_language>

Target:
private static <S extends Enum<S>, T extends Enum<T>> Class<S> getOutcomeType(Map<T, Set<S>> translation) { Map.Entry<T, Set<S>> first = translation.entrySet().iterator().next(); return first.getValue().iterator().next().getDeclaringClass(); }
Source:
<code>public void addEventNotification(final String deviceUid, final String eventType, final String description, final int index, final String timestamp) { Assert.notNull(eventType); Assert.notNull(description); <START> Assert.notNull(timestamp); <END> final OslpDevice oslpDevice = this.oslpDeviceSettingsService.getDeviceByUid(deviceUid); LOGGER.info("addEventNotification called for device: with eventType: {}, description: and index: {}", oslpDevice.getDeviceIdentification(), eventType, description, index); final DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern("yyyyMMddHHmmss Z"); final DateTime dateTime = dateTimeFormatter.withOffsetParsed().parseDateTime(timestamp.concat(" +0000")); LOGGER.info("parsed timestamp from string: to DateTime: {}", timestamp, dateTime); final EventNotificationDto eventNotification = new EventNotificationDto(deviceUid, dateTime, EventTypeDto.valueOf(eventType), description, index); final RequestMessage requestMessage = new RequestMessage("no-correlationUid", "no-organisation", oslpDevice.getDeviceIdentification(), eventNotification); this.osgpRequestMessageSender.send(requestMessage, DeviceFunctionDto.ADD_EVENT_NOTIFICATION.name()); }</code><technical_language>I "timestamp" a for devices running firmware</technical_language>

Target:
public void addEventNotification(final String deviceUid, final String eventType, final String description, final int index, final String timestamp) { Assert.notNull(eventType); Assert.notNull(description); final OslpDevice oslpDevice = this.oslpDeviceSettingsService.getDeviceByUid(deviceUid); LOGGER.info("addEventNotification called for device: with eventType: {}, description: and index: {}", oslpDevice.getDeviceIdentification(), eventType, description, index); DateTime dateTime; if (StringUtils.isEmpty(timestamp)) { dateTime = DateTime.now(); LOGGER.info("timestamp is empty, using DateTime.now(): {}", dateTime); } else { final DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern("yyyyMMddHHmmss Z"); dateTime = dateTimeFormatter.withOffsetParsed().parseDateTime(timestamp.concat(" +0000")); LOGGER.info("parsed timestamp from string: to DateTime: {}", timestamp, dateTime); } final EventNotificationDto eventNotification = new EventNotificationDto(deviceUid, dateTime, EventTypeDto.valueOf(eventType), description, index); final RequestMessage requestMessage = new RequestMessage("no-correlationUid", "no-organisation", oslpDevice.getDeviceIdentification(), eventNotification); this.osgpRequestMessageSender.send(requestMessage, DeviceFunctionDto.ADD_EVENT_NOTIFICATION.name()); }
Source:
<code>public AutoscaleRecommendationV4Response(Set<String> timeBasedHostGroups, Set<String> loadBasedHostGroups) { <START> this.timeBasedHostGroups = timeBasedHostGroups; <END> this.loadBasedHostGroups = loadBasedHostGroups; }</code><technical_language>Set.copyOf, line please</technical_language>

Target:
public AutoscaleRecommendationV4Response(Set<String> timeBasedHostGroups, Set<String> loadBasedHostGroups) { this.timeBasedHostGroups = Set.copyOf(timeBasedHostGroups); this.loadBasedHostGroups = Set.copyOf(loadBasedHostGroups); }
Source:
<code><START> public void canConvertToStringWithUnknownLineNumber() { <END> AtlasDbStackTraceElement element = ImmutableAtlasDbStackTraceElement.builder() .className(CLASS_NAME) .methodName(METHOD_NAME) .fileName(FILE_NAME) .build(); assertThat(element.toString()) .contains(CLASS_NAME) .contains(METHOD_NAME) .contains(FILE_NAME); }</code><technical_language>Unknown file name line number? error</technical_language>

Target:
public void canConvertToStringWithUnknownLineNumber() { AtlasDbStackTraceElement element = ImmutableAtlasDbStackTraceElement.builder() .className(CLASS_NAME) .methodName(METHOD_NAME) .fileName(FILE_NAME) .build(); assertClassAndMethodName(element, CLASS_NAME, METHOD_NAME); assertThat(element.toString()).contains(FILE_NAME); }
Source:
<code>public boolean equals(final Object obj) { <START> if (this == obj) <END> return true; if (obj == null) return false; if (this.getClass() != obj.getClass()) return false; final ObisCodeValuesDto other = (ObisCodeValuesDto) obj; if (this.a != other.a) return false; if (this.b != other.b) return false; if (this.c != other.c) return false; if (this.d != other.d) return false; if (this.e != other.e) return false; if (this.f != other.f) return false; return true; }</code><technical_language>code style conventions blocks in if/while/for/do statements. braces missing here</technical_language>

Target:
public boolean equals(final Object obj) { if (this == obj) { return true; } if (!(obj instanceof ObisCodeValuesDto)) { return false; } final ObisCodeValuesDto other = (ObisCodeValuesDto) obj; return this.a == other.a && this.b == other.b && this.c == other.c && this.d == other.d && this.e == other.e && this.f == other.f; }
Source:
<code>private void generateCommands() throws IOException, TemplateException { if (ConverterUtil.hasContent(spec.getRequests())) { for (final Ds3Request request : spec.getRequests()) { generateRequest(request); } } if (ConverterUtil.hasContent(spec.getTypes())) { for (final Ds3Type typeEntry : spec.getTypes().values()) { <START> if (typeEntry.getElements().isEmpty()) { <END> generateTypeEnumConstant(typeEntry); generateTypeEnumConstantMatcher(typeEntry); } } for (final Ds3Type typeEntry : spec.getTypes().values()) { if (!typeEntry.getElements().isEmpty()) { generateTypeElement(typeEntry); } } } }</code><technical_language>want change this checking if enum constants content, exist enum constants elements a type. Java generation, I discussed Ryan determined exist type, elements descriptive of internal variables related code generation. Therefore, if exist, generate enum. if for C generated code</technical_language>

Target:
private void generateCommands() throws IOException, TemplateException { if (ConverterUtil.hasContent(spec.getRequests())) { for (final Ds3Request request : spec.getRequests()) { generateRequest(request); } } if (ConverterUtil.hasContent(spec.getTypes())) { for (final Ds3Type typeEntry : spec.getTypes().values()) { if (ConverterUtil.hasContent(typeEntry.getEnumConstants())) { generateTypeEnumConstant(typeEntry); generateTypeEnumConstantMatcher(typeEntry); } } for (final Ds3Type typeEntry : spec.getTypes().values()) { if (ConverterUtil.hasContent(typeEntry.getElements())) { generateTypeElement(typeEntry); generateFreeTypeElementPrototype(typeEntry); generateFreeTypeElement(typeEntry); } } } }
Source:
<code>abstract public void release() throws PublisherException; } private DataNode tail = new DataNode(null, 0); private int windowCount; <START> public synchronized void add(PublisherPush item) throws PublisherException { <END> boolean hasWindows; synchronized (this) { hasWindows = windowCount != 0; if (hasWindows) { DataNode prev = tail; tail = new DataNode(item, windowCount); prev.setNext(tail); } } if (!hasWindows) item.close(); }</code><technical_language>remove synchronized</technical_language>

Target:
abstract public void release() throws PublisherException; } private BlockingNode tail = new BlockingNode(Data.EMPTY); private int windowCount; public void add(PublisherPush item) throws PublisherException { if (item == null) throw new NullPointerException(); boolean hasWindows; synchronized (this) { hasWindows = windowCount != 0; if (hasWindows) { BlockingNode old = tail; tail = new BlockingNode(new Data(item, windowCount)); old.setNext(tail); } } if (!hasWindows) item.close(); }
Source:
<code><START> private InstrumentedHttpClientConnectionManager(MetricRegistry metricsRegistry, <END> HttpClientConnectionOperator httpClientConnectionOperator, HttpConnectionFactory<HttpRoute, ManagedHttpClientConnection> connFactory, long connTTL, TimeUnit connTTLTimeUnit, String name) { super(httpClientConnectionOperator, connFactory, connTTL, connTTLTimeUnit); if (metricsRegistry==null) { throw new IllegalArgumentException("metricsRegistry must be specified"); } this.metricsRegistry = metricsRegistry; this.name = name; metricsRegistry.register(name(HttpClientConnectionManager.class, name, "available-connections"), (Gauge<Integer>) () -> { return getTotalStats().getAvailable(); }); metricsRegistry.register(name(HttpClientConnectionManager.class, name, "leased-connections"), (Gauge<Integer>) () -> { return getTotalStats().getLeased(); }); metricsRegistry.register(name(HttpClientConnectionManager.class, name, "max-connections"), (Gauge<Integer>) () -> { return getTotalStats().getMax(); }); metricsRegistry.register(name(HttpClientConnectionManager.class, name, "pending-connections"), (Gauge<Integer>) () -> { return getTotalStats().getPending(); }); }</code><technical_language>try maintain compatibility previous version of Metrics. Please remove public constructors, forced migrate code Builder, optional</technical_language>

Target:
public InstrumentedHttpClientConnectionManager(MetricRegistry metricsRegistry, HttpClientConnectionOperator httpClientConnectionOperator, HttpConnectionFactory<HttpRoute, ManagedHttpClientConnection> connFactory, long connTTL, TimeUnit connTTLTimeUnit, String name) { super(httpClientConnectionOperator, connFactory, connTTL, connTTLTimeUnit); this.metricsRegistry = metricsRegistry; this.name = name; metricsRegistry.register(name(HttpClientConnectionManager.class, name, "available-connections"), (Gauge<Integer>) () -> { return getTotalStats().getAvailable(); }); metricsRegistry.register(name(HttpClientConnectionManager.class, name, "leased-connections"), (Gauge<Integer>) () -> { return getTotalStats().getLeased(); }); metricsRegistry.register(name(HttpClientConnectionManager.class, name, "max-connections"), (Gauge<Integer>) () -> { return getTotalStats().getMax(); }); metricsRegistry.register(name(HttpClientConnectionManager.class, name, "pending-connections"), (Gauge<Integer>) () -> { return getTotalStats().getPending(); }); }
Source:
<code>public static void initialize() { assumeTrue(testTrace.exists()); stateFile = new File(TmfTraceManager.getSupplementaryFileDir(testTrace.getTrace()) + TEST_FILE_NAME); <START> stateFileBenchmark = new File(TmfTraceManager.getSupplementaryFileDir(testTrace.getTrace()) + BENCHMARK_FILE_NAME); <END> TestLttngKernelAnalysisModule module = new TestLttngKernelAnalysisModule(TEST_FILE_NAME); try { module.setTrace(testTrace.getTrace()); } catch (TmfAnalysisException e) { fail(); } module.schedule(); assertTrue(module.waitForCompletion(new NullProgressMonitor())); ssq = module.getStateSystem(); assertNotNull(ssq); }</code><technical_language>question new File() File.createTempFile()</technical_language>

Target:
public static void initialize() { assumeTrue(testTrace.exists()); try { stateFile = File.createTempFile("test", ".ht"); stateFileBenchmark = File.createTempFile("test", ".ht.benchmark"); input = new LttngKernelStateProvider(testTrace.getTrace()); ssq = TmfStateSystemFactory.newFullHistory(stateFile, input, true); } catch (IOException e) { fail(); } catch (TmfTraceException e) { fail(); } }
Source:
<code>public SslCertResponse createCertResponse(final SslCertVO cert, final List<LoadBalancerCertMapVO> lbCertMap) { Preconditions.checkNotNull(cert); final SslCertResponse response = new SslCertResponse(); final Account account = _accountDao.findByIdIncludingRemoved(cert.getAccountId()); if (account.getType() == Account.ACCOUNT_TYPE_PROJECT) { final Project project = _projectMgr.findByProjectAccountIdIncludingRemoved(account.getId()); if (project != null) { response.setProjectId(project.getUuid()); response.setProjectName(project.getName()); } else { response.setAccountName(account.getAccountName()); } } else { response.setAccountName(account.getAccountName()); } final DomainVO domain = _domainDao.findByIdIncludingRemoved(cert.getDomainId()); response.setDomainId(domain.getUuid()); response.setDomainName(domain.getName()); response.setObjectName("sslcert"); response.setId(cert.getUuid()); response.setCertificate(cert.getCertificate()); response.setFingerprint(cert.getFingerPrint()); response.setName(cert.getName()); <START> if (cert.getChain() != null) <END> response.setCertchain(cert.getChain()); if (lbCertMap != null && !lbCertMap.isEmpty()) { final List<String> lbIds = new ArrayList<String>(); for (final LoadBalancerCertMapVO mapVO : lbCertMap) { final LoadBalancer lb = _entityMgr.findById(LoadBalancerVO.class, mapVO.getLbId()); if (lb != null) { lbIds.add(lb.getUuid()); } } response.setLbIds(lbIds); } return response; }</code><technical_language>please, do remove brackets</technical_language>

Target:
public SslCertResponse createCertResponse(final SslCertVO cert, final List<LoadBalancerCertMapVO> lbCertMap) { Preconditions.checkNotNull(cert); final SslCertResponse response = new SslCertResponse(); final Account account = _accountDao.findByIdIncludingRemoved(cert.getAccountId()); if (account.getType() == Account.ACCOUNT_TYPE_PROJECT) { final Project project = _projectMgr.findByProjectAccountIdIncludingRemoved(account.getId()); if (project != null) { response.setProjectId(project.getUuid()); response.setProjectName(project.getName()); } else { response.setAccountName(account.getAccountName()); } } else { response.setAccountName(account.getAccountName()); } final DomainVO domain = _domainDao.findByIdIncludingRemoved(cert.getDomainId()); response.setDomainId(domain.getUuid()); response.setDomainName(domain.getName()); response.setObjectName("sslcert"); response.setId(cert.getUuid()); response.setCertificate(cert.getCertificate()); response.setFingerprint(cert.getFingerPrint()); response.setName(cert.getName()); if (cert.getChain() != null) { response.setCertchain(cert.getChain()); } if (lbCertMap != null && !lbCertMap.isEmpty()) { final List<String> lbIds = new ArrayList<String>(); for (final LoadBalancerCertMapVO mapVO : lbCertMap) { final LoadBalancer lb = _entityMgr.findById(LoadBalancerVO.class, mapVO.getLbId()); if (lb != null) { lbIds.add(lb.getUuid()); } } response.setLbIds(lbIds); } return response; }
Source:
<code>public UrlAssetImport(MimeTypeService mimeTypeService, HttpClientBuilderFactory httpFactory) { super(mimeTypeService); if (httpFactory != null) { <START> this.httpClient = httpFactory.newBuilder().build(); <END> } }</code><technical_language>I this is timeouts need set</technical_language>

Target:
public UrlAssetImport(MimeTypeService mimeTypeService, HttpClientBuilderFactory httpFactory) { super(mimeTypeService); this.httpFactory = httpFactory; }
Source:
<code>public void shutdown(RequestMonitor rm) { fTrackedTargets.clear(); fCreatedTargetBreakpoints.clear(); fDeletedTargetBreakpoints.clear(); fPendingModifications.clear(); MIBreakpointsManager bm = getBreakpointsManager(); if (bm != null) { bm.removeBreakpointsTrackingListener(this); <START> } <END> unregister(); super.shutdown( rm ); }</code><technical_language>Missing: getSession().removeServiceEventListener(this);</technical_language>

Target:
public void shutdown(RequestMonitor rm) { fTrackedTargets.clear(); fCreatedTargetBreakpoints.clear(); fDeletedTargetBreakpoints.clear(); fPendingModifications.clear(); getSession().removeServiceEventListener(this); MIBreakpointsManager bm = getBreakpointsManager(); if (bm != null) { bm.removeBreakpointsTrackingListener(this); } unregister(); super.shutdown( rm ); }
Source:
<code>private Integer getRangeInDays(final JobExecutionContext jobContext) { Integer range = 7; if (jobContext.getMergedJobDataMap().containsKey("range")) { range = jobContext.getMergedJobDataMap().getInt("range"); } <START> return range * -1; <END> }</code><technical_language>validation in here. if be, assume UI provide "valid" numbers. guess is a min a max value, defined environment.properties values, ensure end user passes in falls range, is constrained range code, if want allow</technical_language>

Target:
private Integer getRangeInDays(final JobExecutionContext jobContext) { Integer range = DEFAULT_RANGE; if (jobContext.getMergedJobDataMap().containsKey("range")) { try { range = jobContext.getMergedJobDataMap().getInt("range"); } catch (ClassCastException e) { LOGGER.info("Range is not stored as an integer. Using the default value of: " + range); } } return range; }
Source:
<code><START> public Multimap<Serializable, Notice> getNoticeAssignments() { <END> return noticeAssignments; }</code><technical_language>In Netex, IDs per-type unique feed-level unique? If feed unique, get a collision a route a stop trip. This is reason key objects instead of IDs, identity instead of semantic ID-based equality hashcodes. discussed: key need entity identifier. exact definition of equals hashcode defaults Bus ID-and-class based ones, work for clean input data, key maps ID</technical_language>

Target:
public Multimap<TransitEntity<?>, Notice> getNoticeAssignments() { return noticeAssignments; }
Source:
<code>public boolean contains(String name, String value, boolean ignoreCase) { <START> return contains(name, value, ignoreCase); <END> }</code><technical_language>This is needed infinite loop</technical_language>

Target:
public boolean contains(String name, String value, boolean ignoreCase) { return contains((CharSequence) name, (CharSequence) value, ignoreCase); }
Source:
<code>private Object getFieldValue(@Nullable AbstractFieldValue value) throws ParseException { int type = value.getFieldDetail().getType(); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat simpleDateFormat; switch (type) { case 0: case 1: case 2: case 3: case 71: return value.asString(); case 4: return Long.parseLong(value.asHex(), 16); case 5: case 6: case 7: return value.asInt(); case 15: case 16: case 23: <START> return Integer.parseInt(Base64.decodeBase64(Base64.encodeBase64(value.toString().getBytes())).toString()); <END> case 8: case 11: case 18: case 19: case 20: case 22: case 24: case 25: case 26: case 27: case 28: case 29: case 31: case 32: case 33: return value.asDouble(); case 17: return value.asFloat(); case 35: case 36: case 39: return Base64.decodeInteger(Base64.encodeInteger(value.asBigInteger())); case 72: simpleDateFormat = new SimpleDateFormat("YYMMDD"); return dateFormat.format(simpleDateFormat.parse(value.toString())); case 73: simpleDateFormat = new SimpleDateFormat("YYYYMMDD"); return dateFormat.format(simpleDateFormat.parse(value.toString())); case 74: simpleDateFormat = new SimpleDateFormat("DDMMYY"); return dateFormat.format(simpleDateFormat.parse(value.toString())); case 75: simpleDateFormat = new SimpleDateFormat("DDMMYYYY"); return dateFormat.format(simpleDateFormat.parse(value.toString())); case 111: if (value.toString().toLowerCase().contains("y")) { return true; } else { return false; } case 112: if (value.toString().toLowerCase().contains("t")) { return true; } else { return false; } case 114: return value.asBoolean(); default: return value.toString(); } }</code><technical_language>Do example for is here? I understand this is done. decode(encode(x)) == x? this entire expression return value.toString()? If this is integer, returning a string</technical_language>

Target:
private Object getFieldValue(@Nullable AbstractFieldValue value) throws ParseException { if (value == null) { return null; } int type = value.getFieldDetail().getType(); switch (type) { case 0: return value.asString(); case 17: return value.asFloat(); case 18: case 22: case 31: case 32: case 33: return value.asDouble(); case 25: return value.asInt(); case 35: case 36: case 39: return value.asLong(); default: return value.asString(); } }
Source:
<code>private Node maybeRecordAndRemoveAlias(Node assign) { Node next = assign.getParent(); Node lhs = assign; Node rhs = assign.getLastChild(); if (rhs == null) { return null; } <START> if (isInProvidedNameSpace(rhs)) { <END> aliasToProvidedNamespace.put(lhs.getString(), rhs.getQualifiedName()); next = assign.getParent().getNext(); assign.detachFromParent(); compiler.reportCodeChange(); return next; } return null; }</code><technical_language>s/NameSpace/Namespace</technical_language>

Target:
private Node maybeRecordAndRemoveAlias(Node assign) { Node next = assign.getParent(); Node lhs = assign; Node rhs = assign.getLastChild(); if (rhs == null) { return null; } if (isInProvidedNamespace(rhs)) { aliasToProvidedNamespace.put(lhs.getString(), rhs.getQualifiedName()); next = assign.getParent().getNext(); assign.detachFromParent(); compiler.reportCodeChange(); return next; } return null; }
Source:
<code>public void removeMember(PerunSession sess, Member member, List<Group> groups) throws InternalErrorException, MemberNotExistsException, NotGroupMemberException, PrivilegeException, GroupNotExistsException, WrongAttributeAssignmentException, AttributeNotExistsException, ExternallyManagedException { Utils.checkPerunSession(sess); for (Group group : groups) { getGroupsManagerBl().checkGroupExists(sess, group); Attribute attrSynchronizeEnabled = getPerunBl().getAttributesManagerBl().getAttribute(sess, group, GROUPSYNCHROENABLED_ATTRNAME); if ("true".equals(attrSynchronizeEnabled.getValue()) || getGroupsManagerBl().isGroupInStructureSynchronizationTree(sess, group)) { throw new ExternallyManagedException("Removing of member is not allowed. Group is externally managed."); } } getPerunBl().getMembersManagerBl().checkMemberExists(sess, member); List<PerunBean> beans = new ArrayList<>(groups); beans.add(member); if (!AuthzResolver.authorizedInternal(sess, "removeMember_Member_List<Group>_policy", beans)) { <START> throw new PrivilegeException(sess, "addMember"); <END> } getGroupsManagerBl().removeMember(sess, groups, member); }</code><technical_language>"removeMember"</technical_language>

Target:
public void removeMember(PerunSession sess, Member member, List<Group> groups) throws InternalErrorException, MemberNotExistsException, NotGroupMemberException, PrivilegeException, GroupNotExistsException, WrongAttributeAssignmentException, AttributeNotExistsException, ExternallyManagedException { Utils.checkPerunSession(sess); for (Group group : groups) { getGroupsManagerBl().checkGroupExists(sess, group); Attribute attrSynchronizeEnabled = getPerunBl().getAttributesManagerBl().getAttribute(sess, group, GROUPSYNCHROENABLED_ATTRNAME); if ("true".equals(attrSynchronizeEnabled.getValue()) || getGroupsManagerBl().isGroupInStructureSynchronizationTree(sess, group)) { throw new ExternallyManagedException("Removing of member is not allowed. Group is externally managed."); } } getPerunBl().getMembersManagerBl().checkMemberExists(sess, member); List<PerunBean> beans = new ArrayList<>(groups); beans.add(member); if (!AuthzResolver.authorizedInternal(sess, "removeMember_Member_List<Group>_policy", beans)) { throw new PrivilegeException(sess, "removeMember"); } getGroupsManagerBl().removeMember(sess, groups, member); }
Source:
<code>public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { return false; } <START> Condition conditionObj = (Condition) o; <END> if (!patient.equals(conditionObj.patient)) { return false; } if (clinicalStatus != conditionObj.clinicalStatus) { return false; } if (verificationStatus != conditionObj.verificationStatus) { return false; } if (this.condition.getCoded() != null && !this.condition.getCoded().equals(conditionObj.getCondition().getCoded())) { return false; } if (this.condition.getNonCoded() != null ? !this.condition.getNonCoded().equals(conditionObj.getCondition().getNonCoded()) : conditionObj.getCondition().getNonCoded() != null) { return false; } if (!Objects.equals(onsetDate, conditionObj.onsetDate)) { return false; } if (!Objects.equals(additionalDetail, conditionObj.additionalDetail)) { return false; } if (!Objects.equals(endDate, conditionObj.endDate)) { return false; } return Objects.equals(endReason, conditionObj.endReason); }</code><technical_language>do conditionToBeChecked</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { return false; } Condition conditionToBeChecked = (Condition) o; if (!patient.equals(conditionToBeChecked.patient)) { return false; } if (clinicalStatus != conditionToBeChecked.clinicalStatus) { return false; } if (verificationStatus != conditionToBeChecked.verificationStatus) { return false; } if (this.condition.getCoded() != null && !this.condition.getCoded().equals(conditionToBeChecked.getCondition().getCoded())) { return false; } if (this.condition.getNonCoded() != null ? !this.condition.getNonCoded().equals(conditionToBeChecked.getCondition().getNonCoded()) : conditionToBeChecked.getCondition().getNonCoded() != null) { return false; } if (!Objects.equals(onsetDate, conditionToBeChecked.onsetDate)) { return false; } if (!Objects.equals(additionalDetail, conditionToBeChecked.additionalDetail)) { return false; } if (!Objects.equals(endDate, conditionToBeChecked.endDate)) { return false; } return Objects.equals(endReason, conditionToBeChecked.endReason); }
Source:
<code>public MatchAnyValidator(List<AttributeValidator> validators) { if (validators == null) { <START> this.validators = null; <END> } else { this.validators = validators .stream() .sorted(Comparator.comparingInt(Object::hashCode)) .collect(Collectors.toList()); } }</code><technical_language>more sense initialize this.validators empty List **in this case**? distinction **an** empty validators **a** null validators matters, I prevent complications line if reduce number of null values codebase permits</technical_language>

Target:
public MatchAnyValidator(List<AttributeValidator> validators) { if (validators == null) { this.validators = Collections.<AttributeValidator>emptyList(); } else { this.validators = validators .stream() .sorted(Comparator.comparingInt(Object::hashCode)) .collect(Collectors.toList()); } }
Source:
<code>public HttpClient get() { final DruidHttpClientConfig config = getConfigProvider().get().get(); final HttpClient httpClient; if (getSslContextBinding() != null) { final SslContextFactory sslContextFactory = new SslContextFactory(); sslContextFactory.setSslContext(getSslContextBinding().getProvider().get()); httpClient = new HttpClient(sslContextFactory); } else { httpClient = new HttpClient(); } httpClient.setIdleTimeout(config.getReadTimeout().getMillis()); httpClient.setMaxConnectionsPerDestination(config.getNumConnections()); <START> final QueuedThreadPool queuedThreadPool = new QueuedThreadPool(config.getNumMaxThreads()); <END> queuedThreadPool.setName(QueuedThreadPool.class.getSimpleName() + "@" + queuedThreadPool.hashCode()); httpClient.setExecutor(queuedThreadPool); final Lifecycle lifecycle = getLifecycleProvider().get(); try { lifecycle.addMaybeStartHandler( new Lifecycle.Handler() { @Override public void start() throws Exception { } @Override public void stop() { try { httpClient.stop(); } catch (Exception e) { throw Throwables.propagate(e); } } } ); } catch (Exception e) { throw Throwables.propagate(e); } return httpClient; }</code><technical_language>this non-daemon default. Suggest setting daemon true for thread pool</technical_language>

Target:
public HttpClient get() { final DruidHttpClientConfig config = getConfigProvider().get().get(); final HttpClient httpClient; if (getSslContextBinding() != null) { final SslContextFactory sslContextFactory = new SslContextFactory(); sslContextFactory.setSslContext(getSslContextBinding().getProvider().get()); httpClient = new HttpClient(sslContextFactory); } else { httpClient = new HttpClient(); } httpClient.setIdleTimeout(config.getReadTimeout().getMillis()); httpClient.setMaxConnectionsPerDestination(config.getNumConnections()); final QueuedThreadPool pool = new QueuedThreadPool(config.getNumMaxThreads()); pool.setName(JettyHttpClientModule.class.getSimpleName() + "-threadPool-" + pool.hashCode()); httpClient.setExecutor(pool); final Lifecycle lifecycle = getLifecycleProvider().get(); try { lifecycle.addMaybeStartHandler( new Lifecycle.Handler() { @Override public void start() throws Exception { } @Override public void stop() { try { httpClient.stop(); } catch (Exception e) { throw Throwables.propagate(e); } } } ); } catch (Exception e) { throw Throwables.propagate(e); } return httpClient; }
Source:
<code>public static int mode(File f) throws PosixException { try { <START> if (Functions.isWindows()) { <END> return -1; } else if (Util.NATIVE_CHMOD_MODE) { return PosixAPI.jnr().stat(f.getPath()).mode(); } else { return Util.permissionsToMode(Files.getPosixFilePermissions(f.toPath())); } } catch (InvalidPathException | IOException cause) { PosixException e = new PosixException("Unable to get file permissions", null); e.initCause(cause); throw e; } }</code><technical_language>try/catch</technical_language>

Target:
public static int mode(File f) throws PosixException { if(Functions.isWindows()) return -1; try { if (Util.NATIVE_CHMOD_MODE) { return PosixAPI.jnr().stat(f.getPath()).mode(); } else { return Util.permissionsToMode(Files.getPosixFilePermissions(Util.fileToPath(f))); } } catch (IOException cause) { PosixException e = new PosixException("Unable to get file permissions", null); e.initCause(cause); throw e; } }
Source:
<code>private boolean processRebalance(LineTcpMeasurementEvent event) { if (event.rebalanceToThreadId == id) { if (!event.rebalanceReleasedByFromThread) { return false; } <START> return true; <END> } if (event.rebalanceFromThreadId == id) { Parser parser = parserCache.get(event.rebalanceTableName); parserCache.remove(event.rebalanceTableName); parser.close(); event.rebalanceReleasedByFromThread = true; return true; } return true; }</code><technical_language>a single return statement</technical_language>

Target:
private boolean processRebalance(LineTcpMeasurementEvent event) { if (event.rebalanceToThreadId == id) { return event.rebalanceReleasedByFromThread; } if (event.rebalanceFromThreadId == id) { Parser parser = parserCache.get(event.rebalanceTableName); parserCache.remove(event.rebalanceTableName); parser.close(); event.rebalanceReleasedByFromThread = true; } return true; }
Source:
<code>public static ConfigErrorFormGroupDisplayer getErrorGroup() { <START> return IOC.getBeanManager().lookupBean( ConfigErrorFormGroupDisplayer.class ).newInstance(); <END> }</code><technical_language>If this code is invoked multiple times a form is rendered sense cache SyncBeanDef<T> instead lf a lookup for invocation. @csadilek sense</technical_language>

Target:
public static ConfigErrorFormGroupDisplayer getErrorGroup() { return configErrorDisplayer.newInstance(); }
Source:
<code>public static String escapeStringLiteral(final String s) { Preconditions.checkNotNull(s); <START> if (s == null) { <END> return "''"; } else { boolean isPlainAscii = true; final StringBuilder builder = new StringBuilder("'"); for (int i = 0; i < s.length(); i++) { final char c = s.charAt(i); if (Character.isLetterOrDigit(c) || c == ' ') { builder.append(c); if (c > 127) { isPlainAscii = false; } } else { builder.append("\\").append(BaseEncoding.base16().encode(Chars.toByteArray(c))); isPlainAscii = false; } } builder.append("'"); return isPlainAscii ? builder.toString() : "U&" + builder.toString(); } }</code><technical_language>This check immediately Preconditions.checkNotNull</technical_language>

Target:
public static String escapeStringLiteral(final String s) { Preconditions.checkNotNull(s); boolean isPlainAscii = true; final StringBuilder builder = new StringBuilder("'"); for (int i = 0; i < s.length(); i++) { final char c = s.charAt(i); if (Character.isLetterOrDigit(c) || c == ' ') { builder.append(c); if (c > 127) { isPlainAscii = false; } } else { builder.append("\\").append(BaseEncoding.base16().encode(Chars.toByteArray(c))); isPlainAscii = false; } } builder.append("'"); return isPlainAscii ? builder.toString() : "U&" + builder.toString(); }
Source:
<code>static RailDirection fromFaces(final Direction firstDirection, final Direction secondDirection) { checkNotNull(firstDirection, "firstDirection"); checkNotNull(secondDirection, "secondDirection"); Direction cardinalFirstDirection = Direction.getClosest(firstDirection.asOffset(), Direction.Division.CARDINAL); Direction cardinalSecondDirection = Direction.getClosest(secondDirection.asOffset(), Direction.Division.CARDINAL); if (cardinalFirstDirection.equals(cardinalSecondDirection)) { throw new IllegalArgumentException("The directions should be different!"); } for (RailDirection currentRailDirection: Sponge.getRegistry().getAllForMinecraft(RailDirection.class)) { if (currentRailDirection.isFacing(cardinalFirstDirection) && currentRailDirection.isFacing(cardinalSecondDirection)) { return currentRailDirection; } } <START> throw new AssertionError(); <END> }</code><technical_language>No, throw AssertionError - this a IllegalArgumentException</technical_language>

Target:
static RailDirection fromFaces(final Direction firstDirection, final Direction secondDirection) { checkNotNull(firstDirection, "firstDirection"); checkNotNull(secondDirection, "secondDirection"); if (!firstDirection.isCardinal() || !secondDirection.isCardinal()) { throw new IllegalArgumentException("The given directions isn't cardinal!"); } for (RailDirection currentRailDirection: Sponge.getRegistry().getAllForMinecraft(RailDirection.class)) { if (currentRailDirection.isFacing(firstDirection) && currentRailDirection.isFacing(secondDirection)) { return currentRailDirection; } } throw new IllegalArgumentException(); }