auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void addRow(Value[] values) { cloneLobs(values); if (distinct) { if (distinctRows != null) { ValueArray array = getArrayOfVisible(values); distinctRows.put(array, values); rowCount = distinctRows.size(); if (rowCount > maxMemoryRows) { createExternalResult(); rowCount = external.addRows(distinctRows.values()); distinctRows = null; } } else { rowCount = external.addRow(values); } } else { rows.add(values); rowCount++; if (rows.size() > maxMemoryRows) { if (external == null) { createExternalResult(); } <START> addRowsToDisk(); <END> } } }</code><technical_language>2 line addRowsToDisk() if (external == null) { createExternalResult(); } logic cleaner easier read</technical_language>

Target:
public void addRow(Value[] values) { cloneLobs(values); if (distinct) { if (distinctRows != null) { ValueArray array = getArrayOfVisible(values); distinctRows.put(array, values); rowCount = distinctRows.size(); if (rowCount > maxMemoryRows) { createExternalResult(); rowCount = external.addRows(distinctRows.values()); distinctRows = null; } } else { rowCount = external.addRow(values); } } else { rows.add(values); rowCount++; if (rows.size() > maxMemoryRows) { addRowsToDisk(); } } }
Source:
<code>public boolean isFirstData(){ <START> if (index == 0){ <END> return true; } else { return false; } }</code><technical_language>return index == 0;</technical_language>

Target:
public boolean isFirstData(){ return index == 0; }
Source:
<code>public void testCreateDeleteFeedbackQuestion() throws InvalidParametersException, EntityAlreadyExistsException { ______TS("standard success case"); FeedbackQuestionAttributes fqa = getNewFeedbackQuestionAttributes(); fqDb.deleteEntity(fqa); fqDb.createEntity(fqa); verifyPresentInDatastore(fqa, true); ______TS("duplicate - with same id."); try { fqDb.createEntity(fqa); signalFailureToDetectException(); } catch (EntityAlreadyExistsException e) { AssertHelper.assertContains(String.format(QuestionsDb.ERROR_CREATE_ENTITY_ALREADY_EXISTS, fqa.getEntityTypeAsString()) + fqa.getIdentificationString(), e.getMessage()); } ______TS("delete - with id specified"); fqDb.deleteEntity(fqa); verifyAbsentInDatastore(fqa); ______TS("null params"); try { fqDb.createEntity(null); signalFailureToDetectException(); } catch (AssertionError e) { AssertHelper.assertContains(Const.StatusCodes.DBLEVEL_NULL_INPUT, e.getLocalizedMessage()); } ______TS("invalid params"); try { <START> fqa.creatorEmail = "haha"; <END> fqDb.createEntity(fqa); signalFailureToDetectException(); } catch (InvalidParametersException e) { AssertHelper.assertContains("Invalid creator's email", e.getLocalizedMessage()); } }</code><technical_language>stuck_out_tongue_closed_eyes:</technical_language>

Target:
public void testCreateDeleteFeedbackQuestion() throws InvalidParametersException, EntityAlreadyExistsException { ______TS("standard success case"); FeedbackQuestionAttributes fqa = getNewFeedbackQuestionAttributes(); fqDb.deleteEntity(fqa); fqDb.createEntity(fqa); verifyPresentInDatastore(fqa, true); ______TS("duplicate - with same id."); try { fqDb.createEntity(fqa); signalFailureToDetectException(); } catch (EntityAlreadyExistsException e) { AssertHelper.assertContains(String.format(QuestionsDb.ERROR_CREATE_ENTITY_ALREADY_EXISTS, fqa.getEntityTypeAsString()) + fqa.getIdentificationString(), e.getMessage()); } ______TS("delete - with id specified"); fqDb.deleteEntity(fqa); verifyAbsentInDatastore(fqa); ______TS("null params"); try { fqDb.createEntity(null); signalFailureToDetectException(); } catch (AssertionError e) { AssertHelper.assertContains(Const.StatusCodes.DBLEVEL_NULL_INPUT, e.getLocalizedMessage()); } ______TS("invalid params"); try { fqa.creatorEmail = "invalidCreatorEmail"; fqDb.createEntity(fqa); signalFailureToDetectException(); } catch (InvalidParametersException e) { AssertHelper.assertContains("Invalid creator's email", e.getLocalizedMessage()); } }
Source:
<code>public DfsBlockCacheConfig fromConfig(final Config rc) { <START> setBlockLimit(rc.getLong("core", "dfs", "blockLimit", getBlockLimit())); <END> setBlockSize(rc.getInt("core", "dfs", "blockSize", getBlockSize())); setReadAheadLimit(rc.getInt("core", "dfs", "readAheadLimit", getReadAheadLimit())); int readAheadThreads = rc.getInt("core", "dfs", "readAheadThreads", 0); if (0 < getReadAheadLimit() && 0 < readAheadThreads) { setReadAheadService(new ThreadPoolExecutor( 1, readAheadThreads, 60, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(1), new ThreadFactory() { private final String name = "JGit-DFS-ReadAhead"; private final AtomicInteger cnt = new AtomicInteger(); private final ThreadGroup group = new ThreadGroup(name); public Thread newThread(Runnable body) { int id = cnt.incrementAndGet(); Thread thread = new Thread(group, body, name + "-" + id); thread.setDaemon(true); thread.setContextClassLoader(getClass().getClassLoader()); return thread; } }, ReadAheadRejectedExecutionHandler.INSTANCE)); } return this; }</code><technical_language>moving config keys ConfigConstants</technical_language>

Target:
public DfsBlockCacheConfig fromConfig(final Config rc) { setBlockLimit(rc.getLong( CONFIG_CORE_SECTION, CONFIG_DFS_SECTION, CONFIG_KEY_BLOCK_LIMIT, getBlockLimit())); setBlockSize(rc.getInt( CONFIG_CORE_SECTION, CONFIG_DFS_SECTION, CONFIG_KEY_BLOCK_SIZE, getBlockSize())); setReadAheadLimit(rc.getInt( CONFIG_CORE_SECTION, CONFIG_DFS_SECTION, CONFIG_KEY_READ_AHEAD_LIMIT, getReadAheadLimit())); int readAheadThreads = rc.getInt( CONFIG_CORE_SECTION, CONFIG_DFS_SECTION, CONFIG_KEY_READ_AHEAD_THREADS, 0); if (0 < getReadAheadLimit() && 0 < readAheadThreads) { setReadAheadService(new ThreadPoolExecutor( 1, readAheadThreads, 60, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(1), new ThreadFactory() { private final String name = "JGit-DFS-ReadAhead"; private final AtomicInteger cnt = new AtomicInteger(); private final ThreadGroup group = new ThreadGroup(name); public Thread newThread(Runnable body) { int id = cnt.incrementAndGet(); Thread thread = new Thread(group, body, name + "-" + id); thread.setDaemon(true); thread.setContextClassLoader(getClass().getClassLoader()); return thread; } }, ReadAheadRejectedExecutionHandler.INSTANCE)); } return this; }
Source:
<code>public void setInstallState(@Nonnull InstallState newState) { if(newState.equals(installState)) { return; } if(InstallState.INITIAL_SETUP_COMPLETED.equals(installState)) { throw new IllegalArgumentException("Setup has already been completed!"); } installState = newState; try { switch(newState) { case INITIAL_PLUGINS_INSTALLED: <START> setInstallState(InstallState.CONFIGURING_SECURITY); <END> break; case SECURITY_CONFIGURATION_COMPLETED: if(!HudsonPrivateSecurityRealm.requiresLocalUser(this)) { setInstallState(InstallState.INITIAL_SETUP_COMPLETED); } else { setInstallState(InstallState.CREATING_ADMIN_USER); } break; case ADMIN_USER_CREATED: setInstallState(InstallState.INITIAL_SETUP_COMPLETED); break; case INITIAL_SETUP_COMPLETED: initPostSetupTasks(); servletContext.setAttribute(WebAppMain.APP, this); break; default: } } catch (Exception e) { throw new RuntimeException(e); } }</code><technical_language>set this state in code configures security? wrong do part of setting state INITIAL_PLUGINS_INSTALLED</technical_language>

Target:
public void setInstallState(@Nonnull InstallState newState) { installState = newState; }
Source:
<code>public TypedQuery<Long> buildCountQuery() { StringBuilder query = new StringBuilder() .append("SELECT ") .append(" COUNT(userdevfile) ") .append("FROM UserDevfilePermission permission ") .append("LEFT JOIN permission.userDevfile userdevfile ") .append(filter); TypedQuery<Long> typedQuery = entityManager.createQuery(query.toString(), Long.class); <START> params.forEach((k, v) -> typedQuery.setParameter(k, v)); <END> return typedQuery; }</code><technical_language>replaced lamda</technical_language>

Target:
public TypedQuery<Long> buildCountQuery() { StringBuilder query = new StringBuilder() .append("SELECT ") .append(" COUNT(userdevfile) ") .append("FROM UserDevfilePermission permission ") .append("LEFT JOIN permission.userDevfile userdevfile ") .append(filter); TypedQuery<Long> typedQuery = entityManager.createQuery(query.toString(), Long.class); params.forEach(typedQuery::setParameter); return typedQuery; }
Source:
<code>private boolean mapTags(String value, Context context) throws IOException, InterruptedException { <START> String[] elements = InputFormatter.splitInputString(value); <END> if (elements == null) { return true; } for (int i = 0; i < elements.length; i++) { String firstTag = removeVersionFromName(elements[i]); for (int j = 0; j < elements.length; j++) { if (i != j) { String secondTag = removeVersionFromName(elements[j]); context.write(new RelationKey(firstTag, secondTag), MappingType.TAG); } } } return false; }</code><technical_language>Mayby words more descriptive name</technical_language>

Target:
private boolean mapTags(String value, Context context) throws IOException, InterruptedException { String[] tags = InputFormatter.splitInputString(value); if (tags == null) { return true; } for (int i = 0; i < tags.length; i++) { String firstTag = removeVersionFromName(tags[i]); for (int j = 0; j < tags.length; j++) { if (i != j) { String secondTag = removeVersionFromName(tags[j]); context.write(new RelationKey(firstTag, secondTag), MappingType.TAG); } } } return false; }
Source:
<code>public T getContent() { if (content == null) { try { if (Boolean.TRUE.equals(contentIsInitializing.get())) { throw new IllegalStateException( "The content is not yet initialized. " + "Infinite loop detected: you are calling a code inside 'initContent' " + "which directly or indirectly is calling 'getContent'/'initContent'. " + "You may not call any method on " + Composite.class.getSimpleName() + " instance until it initialized (inside 'getContent' or 'initContent'). " <START> + "Call methods on the content component instead."); <END> } contentIsInitializing.set(true); T newContent = initContent(); if (newContent == null) { throw new IllegalStateException( "initContent returned null instead of a component"); } setContent(newContent); } finally { contentIsInitializing.set(false); } } return content; }</code><technical_language>I suggest: content is initialized. Detected direct indirect call 'getContent' 'initContent'. call framework method a 'Composite' instance 'initContent' completed initializing component . Rationale: infinite loop symptom is of implementation choice, user need aware is prevented this code. suggestion "Call methods content component instead" assuming dev is do</technical_language>

Target:
public T getContent() { if (content == null) { try { if (Boolean.TRUE.equals(contentIsInitializing.get())) { throw new IllegalStateException( "The content is not yet initialized. " + "Detected direct or indirect call to 'getContent' from 'initContent'. " + "You may not call any framework method on a '" + Composite.class.getSimpleName() + "' instance before 'initContent' has completed initializing the component."); } contentIsInitializing.set(true); T newContent = initContent(); if (newContent == null) { throw new IllegalStateException( "initContent returned null instead of a component"); } setContent(newContent); } finally { contentIsInitializing.set(false); } } return content; }
Source:
<code>private void addToUserProperties(String operation, String property, Object value) { if (userProperties.contains(property)) { <START> Log.e(TAG, String.format("Already used property %s in previous operation, ignoring operation %s", property, operation)); <END> return; } try { if (!userPropertiesOperations.has(operation)) { userPropertiesOperations.put(operation, new JSONObject()); } userPropertiesOperations.getJSONObject(operation).put(property, value); userProperties.add(property); } catch (JSONException e) { Log.e(TAG, e.toString()); } }</code><technical_language>this a warning</technical_language>

Target:
private void addToUserProperties(String operation, String property, Object value) { if (userProperties.contains(property)) { Log.w(TAG, String.format("Already used property %s in previous operation, ignoring operation %s", property, operation)); return; } try { if (!userPropertiesOperations.has(operation)) { userPropertiesOperations.put(operation, new JSONObject()); } userPropertiesOperations.getJSONObject(operation).put(property, value); userProperties.add(property); } catch (JSONException e) { Log.e(TAG, e.toString()); } }
Source:
<code>public Response createMetric( @ApiParam(required = true) MetricDefinition metricDefinition, @Context UriInfo uriInfo ) { MetricId<?> id = new MetricId(tenantId, metricDefinition.getType(), metricDefinition.getId()); <START> Metric<?> metric = new Metric<>(id, metricDefinition.getTags(), metricDefinition.getDataRetention()); <END> URI location = uriInfo.getBaseUriBuilder().path("/{type}/{id}").build(MetricTypeTextConverter.getLongForm(id .getType()), id.getName()); try { Observable<Void> observable = metricsService.createMetric(metric); observable.toBlocking().lastOrDefault(null); return Response.created(location).build(); } catch (MetricAlreadyExistsException e) { String message = "A metric with name [" + e.getMetric().getId().getName() + "] already exists"; return Response.status(Response.Status.CONFLICT).entity(new ApiError(message)).build(); } catch (Exception e) { return ApiUtils.serverError(e); } }</code><technical_language>encapsulate lines in MetricDefinition</technical_language>

Target:
public Response createMetric( @ApiParam(required = true) MetricDefinition metricDefinition, @Context UriInfo uriInfo ) { if(metricDefinition.getType() == null || !metricDefinition.getType().isUserType()) { return ApiUtils.badRequest(new ApiError("MetricDefinition type is invalid")); } MetricId<?> id = new MetricId(tenantId, metricDefinition.getType(), metricDefinition.getId()); Metric<?> metric = new Metric<>(id, metricDefinition.getTags(), metricDefinition.getDataRetention()); URI location = uriInfo.getBaseUriBuilder().path("/{type}/{id}").build(MetricTypeTextConverter.getLongForm(id .getType()), id.getName()); try { Observable<Void> observable = metricsService.createMetric(metric); observable.toBlocking().lastOrDefault(null); return Response.created(location).build(); } catch (MetricAlreadyExistsException e) { String message = "A metric with name [" + e.getMetric().getId().getName() + "] already exists"; return Response.status(Response.Status.CONFLICT).entity(new ApiError(message)).build(); } catch (Exception e) { return ApiUtils.serverError(e); } }
Source:
<code>public Enumerable<Object[]> scan(DataContext root) { final List<ImmutableDruidServer> druidServers = serverView.getDruidServers(); final AuthenticationResult authenticationResult = (AuthenticationResult) root.get(PlannerContext.DATA_CTX_AUTHENTICATION_RESULT); final Access access = AuthorizationUtils.authorizeAllResourceActions( authenticationResult, Collections.singletonList(new ResourceAction(new Resource("STATE", ResourceType.STATE), Action.READ)), authorizerMapper ); if (!access.isAllowed()) { <START> return Linq4j.asEnumerable(ImmutableList.of()); <END> } final FluentIterable<Object[]> results = FluentIterable .from(druidServers) .transform(val -> new Object[]{ val.getHost(), val.getHost().split(":")[0], val.getHostAndPort() == null ? -1 : val.getHostAndPort().split(":")[1], val.getHostAndTlsPort() == null ? -1 : val.getHostAndTlsPort().split(":")[1], val.getType(), val.getTier(), val.getCurrSize(), val.getMaxSize() }); return Linq4j.asEnumerable(results); }</code><technical_language>this is "all nothing" check, I throw a ForbiddenException user insufficient privileges servers</technical_language>

Target:
public Enumerable<Object[]> scan(DataContext root) { final List<ImmutableDruidServer> druidServers = serverView.getDruidServers(); final AuthenticationResult authenticationResult = (AuthenticationResult) root.get(PlannerContext.DATA_CTX_AUTHENTICATION_RESULT); final Access access = AuthorizationUtils.authorizeAllResourceActions( authenticationResult, Collections.singletonList(new ResourceAction(new Resource("STATE", ResourceType.STATE), Action.READ)), authorizerMapper ); if (!access.isAllowed()) { throw new ForbiddenException("Insufficient permission to view servers :" + access.toString()); } final FluentIterable<Object[]> results = FluentIterable .from(druidServers) .transform(val -> new Object[]{ val.getHost(), val.getHost().split(":")[0], val.getHostAndPort() == null ? -1 : val.getHostAndPort().split(":")[1], val.getHostAndTlsPort() == null ? -1 : val.getHostAndTlsPort().split(":")[1], val.getType(), val.getTier(), val.getCurrSize(), val.getMaxSize() }); return Linq4j.asEnumerable(results); }
Source:
<code>protected Object getResourceAttributeValue(Attribute attr, Entity sourceEntity) { if (attr.getName().equals(GENERALIZED_INHERITANCE.getAttributeName())) { return getGeneralizedInheritance(sourceEntity); } String sourceName = CGDAttributeName.getCgdName(attr.getName()); if (sourceName == null) <START> throw new IllegalArgumentException(String.format("%s not present in CGD data", attr.getName())); <END> return sourceEntity.get(sourceName); }</code><technical_language>This occurs if CGD resource expected attributes, "something wrong" is in this case</technical_language>

Target:
protected Object getResourceAttributeValue(Attribute attr, Entity sourceEntity) { if (attr.getName().equals(GENERALIZED_INHERITANCE.getAttributeName())) { return getGeneralizedInheritance(sourceEntity); } String sourceName = CGDAttributeName.getCgdName(attr.getName()); if (sourceName == null) { throw new IllegalArgumentException(String.format("%s not present in CGD data", attr.getName())); } return sourceEntity.get(sourceName); }
Source:
<code>public void searchAnalyzerWithoutAnalyzer() { SubTest.expectException( <START> "Setting a search analyzer, without setting a normalizer on the same field", <END> () -> setup( ctx -> { IndexSchemaElement root = ctx.getSchemaElement(); root.field( "myField", f -> f.asString() .searchAnalyzer( DefaultAnalysisDefinitions.ANALYZER_STANDARD_ENGLISH.name ) ) .toReference(); } ) ) .assertThrown() .isInstanceOf( SearchException.class ) .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() .typeContext( TYPE_NAME ) .indexContext( INDEX_NAME ) .failure( "Cannot apply a search analyzer if an analyzer has not been defined on the same field", "'" + DefaultAnalysisDefinitions.ANALYZER_STANDARD_ENGLISH.name + "'" ) .build() ); }</code><technical_language>setting a normalizer => setting analyzer</technical_language>

Target:
public void searchAnalyzerWithoutAnalyzer() { SubTest.expectException( "Setting a search analyzer, without setting an analyzer on the same field", () -> setup( ctx -> { IndexSchemaElement root = ctx.getSchemaElement(); root.field( "myField", f -> f.asString() .searchAnalyzer( DefaultAnalysisDefinitions.ANALYZER_STANDARD_ENGLISH.name ) ) .toReference(); } ) ) .assertThrown() .isInstanceOf( SearchException.class ) .hasMessageMatching( FailureReportUtils.buildFailureReportPattern() .typeContext( TYPE_NAME ) .indexContext( INDEX_NAME ) .failure( "Cannot apply a search analyzer if an analyzer has not been defined on the same field", "'" + DefaultAnalysisDefinitions.ANALYZER_STANDARD_ENGLISH.name + "'" ) .build() ); }
Source:
<code>private static long countMethodImplementations(IMethod method, IProgressMonitor monitor) throws CoreException { if (method == null) { return 0; } IType type= method.getDeclaringType(); IType[] results= type.newTypeHierarchy(monitor).getAllSubtypes(type); List<IType> list= Stream.of(results).filter(t -> t.getAncestor(IJavaElement.COMPILATION_UNIT) != null).collect(Collectors.toList()); <START> <END> long count= 0; for (IType t : list) { IMethod m= t.getMethod(method.getElementName(), method.getParameterTypes()); if (m.exists()) { ++count; } } return count; }</code><technical_language>2 extraneous whitespaces introduced change. if happen fix pre-existing (line 115, line 142) I fault for making changes parts of code nearby</technical_language>

Target:
private static long countMethodImplementations(IMethod method, IProgressMonitor monitor) throws CoreException { if (method == null) { return 0; } IType type= method.getDeclaringType(); IType[] results= type.newTypeHierarchy(monitor).getAllSubtypes(type); List<IType> list= Stream.of(results).filter(t -> t.getAncestor(IJavaElement.COMPILATION_UNIT) != null).collect(Collectors.toList()); long count= list.stream().filter(t -> t.getMethod(method.getElementName(), method.getParameterTypes()).exists()).count(); return count; }
Source:
<code>private final <T extends EObject> void fillCategory( SerializationNode category, Resource model, Class<T> categoryClass) { final List<T> categoryList = filterAllContents(model.getAllContents(), categoryClass); final Map<String, Integer> globalResNaming = new HashMap<String, Integer>(); <START> for (T c : categoryList) { <END> String name = RDONaming.getFullyQualifiedName(c); if (c instanceof ResourceCreateStatement) { if (!(c.eContainer() instanceof RDOModel)) continue; if (((ResourceCreateStatement) c).getName() == null) { final String typeName = ((ResourceCreateStatement) c) .getType().getName(); int count = 0; if (globalResNaming.containsKey(typeName)) { count = globalResNaming.get(typeName) + 1; } globalResNaming.put(typeName, count); name = name.substring(0, name.lastIndexOf('.') + 1) + typeName + "[" + count + "]"; } } SerializationNode child = category.addChild(name); if (c instanceof DecisionPointSearch) { for (SerializationLevel type : SerializationLevel.values()) child.addChild(child.getFullName() + "." + type.toString()); } if (c instanceof Pattern || c instanceof Event) { child.addChild(child.getFullName() + ".createdResources"); } } }</code><technical_language>c -> category</technical_language>

Target:
private final <T extends EObject> void fillCategory( SerializationNode category, Resource model, Class<T> categoryClass) { final List<T> categoryItems = filterAllContents(model.getAllContents(), categoryClass); final Map<String, Integer> instanceCountOfResourceType = new HashMap<String, Integer>(); for (T categoryItem : categoryItems) { String name = RDONaming.getFullyQualifiedName(categoryItem); if (categoryItem instanceof ResourceCreateStatement) { if (!(categoryItem.eContainer() instanceof RDOModel)) continue; if (((ResourceCreateStatement) categoryItem).getName() == null) { final String typeName = ((ResourceCreateStatement) categoryItem) .getType().getName(); int count = 0; if (instanceCountOfResourceType.containsKey(typeName)) { count = instanceCountOfResourceType.get(typeName) + 1; } instanceCountOfResourceType.put(typeName, count); name = name.substring(0, name.lastIndexOf('.') + 1) + typeName + "[" + count + "]"; } } SerializationNode child = category.addChild(name); if (categoryItem instanceof DecisionPointSearch) { for (SerializationLevel type : SerializationLevel.values()) child.addChild(child.getFullName() + "." + type.toString()); } if (categoryItem instanceof Pattern || categoryItem instanceof Event) { child.addChild(child.getFullName() + ".createdResources"); } } }
Source:
<code>public Map<String, Object> getConfiguration() { <START> return Collections.unmodifiableMap(configuration); <END> }</code><technical_language>configuration of Metadata fixed / unmodifiable? In constructor Collections.emptyMap() is if configuration is provided, in case member is unmodifiable. change constructor part if a provided configuration is assigned new HashMap<>(configuration) Collections.unmodifiableMap(new HashMap<>(configuration)) return configuration here. return a view this requires collection is altered, this break (CME) usage of returned view</technical_language>

Target:
public Map<String, Object> getConfiguration() { return configuration; }
Source:
<code>public ModelExplorerView(IMultiDiagramEditor part) { if (part == null) { throw new <START> IllegalArgumentException(Messages.ModelExplorerView_ExceptionAPartSouldBeProvided); <END> } init(part); IReloadableEditor.Adapter.getAdapter(part).addEditorReloadListener(new EditorReloadAdapter() { @Override public void editorAboutToReload(EditorReloadEvent event) { event.putContext(new ModelExplorerTreeViewerContext(getCommonViewer())); deactivate(); } @Override public void editorReloaded(EditorReloadEvent event) { init(event.getEditor()); activate(); initCommonViewer(getCommonViewer()); ((TreeViewerContext<?>) event.getContext()).restore(getCommonViewer()); } }); }</code><technical_language>Exception Message logs internationalize // NLS...</technical_language>

Target:
public ModelExplorerView(IMultiDiagramEditor part) { if (part == null) { throw new IllegalArgumentException("A part should be provided."); } init(part); IReloadableEditor.Adapter.getAdapter(part).addEditorReloadListener(new EditorReloadAdapter() { @Override public void editorAboutToReload(EditorReloadEvent event) { event.putContext(new ModelExplorerTreeViewerContext(getCommonViewer())); deactivate(); } @Override public void editorReloaded(EditorReloadEvent event) { init(event.getEditor()); activate(); initCommonViewer(getCommonViewer()); ((TreeViewerContext<?>) event.getContext()).restore(getCommonViewer()); } }); }
Source:
<code>String brewJava() { StringBuilder builder = new StringBuilder(); builder.append(" builder.append("package ").append(classPackage).append(";\n\n"); builder.append("import android.view.View;\n"); builder.append("import butterknife.ButterKnife.Finder;\n\n"); builder.append("public class ").append(className); if (parentInjector != null) { builder.append(" extends ").append(parentInjector); <START> } else { <END> builder.append(" implements butterknife.Injector<") .append(targetClass) .append(">"); } builder.append(" {\n"); emitInject(builder); builder.append('\n'); emitReset(builder); builder.append("}\n"); return builder.toString(); }</code><technical_language>This else a problem (and reason for this earlier). I this impossible do: java class Foo { @InjectView(1) View foo; } class Bar extends Foo { @InjectView(2) View bar; } work this composition inheritance. generated code instance of superclass injector: java class Bar$$ViewInjector implements Injector<Bar> { private final Injector<Foo> parent = new Injector<Foo>(); @Override public void inject(Foo foo, ...) { parent.inject(foo, ...); // ... } // for reset... }</technical_language>

Target:
String brewJava() { StringBuilder builder = new StringBuilder(); builder.append(" builder.append("package ").append(classPackage).append(";\n\n"); builder.append("import android.view.View;\n"); builder.append("import butterknife.ButterKnife.Finder;\n\n"); builder.append("public class ").append(className); builder.append("<T extends ").append(targetClass).append(">"); if (parentInjector != null) { builder.append(" extends ").append(parentInjector).append("<T>"); } else { builder.append(" implements butterknife.ButterKnife.Injector<T>"); } builder.append(" {\n"); emitInject(builder); builder.append('\n'); emitReset(builder); builder.append("}\n"); return builder.toString(); }
Source:
<code>private void refreshVolumeCapacity(GlusterVolumeEntity volume, GlusterVolumeAdvancedDetails volumeAdvancedDetails) { Long confirmedFreeSize = calculateConfirmedVolumeCapacity(volume); if (volume.getAdvancedDetails().getCapacityInfo() == null) { volumeDao.addVolumeCapacityInfo(volumeAdvancedDetails.getCapacityInfo()); } else { volumeAdvancedDetails.getCapacityInfo().setConfirmedFreeSize(confirmedFreeSize); volumeDao.updateVolumeCapacityInfo(volumeAdvancedDetails.getCapacityInfo()); } if (confirmedFreeSize != null) { <START> storageDomainStaticDao.getAllForStoragePool(clusterDao.get(volume.getClusterId()).getStoragePoolId()) <END> .stream() .map(StorageDomainStatic::getId) .filter(sd -> storageServerConnectionDao.getAllForDomain(sd) .stream() .anyMatch(c -> volume.getId().equals(c.getGlusterVolumeId()))) .map(i -> storageDomainDynamicDao.get(i)) .forEach(d -> { d.setConfirmedAvailableDiskSize((int) (confirmedFreeSize / (1024 * 1024 * 1024))); storageDomainDynamicDao.updateConfirmedSize(d); }); } }</code><technical_language>Do need get StorageDomain based datacenter storagedomains</technical_language>

Target:
private void refreshVolumeCapacity(GlusterVolumeEntity volume, GlusterVolumeAdvancedDetails volumeAdvancedDetails) { Long confirmedFreeSize = calculateConfirmedVolumeCapacity(volume); if (volume.getAdvancedDetails().getCapacityInfo() == null) { volumeDao.addVolumeCapacityInfo(volumeAdvancedDetails.getCapacityInfo()); } else { volumeAdvancedDetails.getCapacityInfo().setConfirmedFreeSize(confirmedFreeSize); volumeDao.updateVolumeCapacityInfo(volumeAdvancedDetails.getCapacityInfo()); } if (confirmedFreeSize != null) { storageDomainStaticDao.getAllForStoragePool(clusterDao.get(volume.getClusterId()).getStoragePoolId()) .stream() .map(StorageDomainStatic::getId) .filter(sd -> storageServerConnectionDao.getAllForDomain(sd) .stream() .anyMatch(c -> volume.getId().equals(c.getGlusterVolumeId()))) .map(i -> storageDomainDynamicDao.get(i)) .forEach(d -> { d.setConfirmedAvailableDiskSize((int) (confirmedFreeSize / SizeConverter.BYTES_IN_GB)); storageDomainDynamicDao.updateConfirmedSize(d); }); } }
Source:
<code>public void deleteNetworkToPublicRouter(ClaudiaData claudiaData, NetworkInstance netInstance, String region) throws InfrastructureException { log.info("Delete Interfact from net " + netInstance.getNetworkName() + " to public router in region " + region); List<Port> ports = listPortsFromNetwork(claudiaData, region, netInstance.getInterfaceNetId()); if (ports.size() > 0) { <START> String msm = "Error to delete the interface from public router " + netInstance.getNetworkName() + <END> " to the public router : They are still used ports"; log.warn(msm); return; } try { openStackUtil.deleteInterfaceToPublicRouter(claudiaData.getUser(), netInstance, region); } catch (OpenStackException e) { String msm = "Error to delete the network " + netInstance.getNetworkName() + " to the public router :" + e.getMessage(); log.error(msm); throw new InfrastructureException(msm, e); } }</code><technical_language>variable name "msm"</technical_language>

Target:
public void deleteNetworkToPublicRouter(ClaudiaData claudiaData, NetworkInstance netInstance, String region) throws InfrastructureException { log.info("Delete Interfact from net " + netInstance.getNetworkName() + " to public router in region " + region); List<Port> ports = listPortsFromNetwork(claudiaData, region, netInstance.getInterfaceNetId()); if (ports.size() > 0) { String mns = "Error to delete the interface from public router " + netInstance.getNetworkName() + " to the public router : They are still used ports"; log.warn(mns); return; } try { openStackUtil.deleteInterfaceToPublicRouter(claudiaData.getUser(), netInstance, region); } catch (OpenStackException e) { String msm = "Error to delete the network " + netInstance.getNetworkName() + " to the public router :" + e.getMessage(); log.error(msm); throw new InfrastructureException(msm, e); } }
Source:
<code>protected void processWatchEvent(WatchEvent<?> event, Kind<?> kind, Path path) { if (kind == ENTRY_CREATE || kind == ENTRY_MODIFY) { try { File f = path.toFile(); if (!f.isHidden()) { processConfigFile(f); } } catch (IOException e) { logger.warn("Could not process config file '{}': {}", path, e); } } else if (kind == ENTRY_DELETE) { File configFile = path.toFile(); if (configFile.isHidden() || configFile.isDirectory() || !configFile.getName().endsWith(".cfg")) { return; } exclusivcePIDMap.setFileRemoved(configFile.getAbsolutePath()); <START> processOrphanExclusivePIDs(); <END> storeCurrentExclusivePIDList(); } }</code><technical_language>update list CREATE MODIFIED events</technical_language>

Target:
protected void processWatchEvent(WatchEvent<?> event, Kind<?> kind, Path path) { if (kind == ENTRY_CREATE || kind == ENTRY_MODIFY) { try { File f = path.toFile(); if (!f.isHidden()) { processConfigFile(f); } } catch (IOException e) { logger.warn("Could not process config file '{}': {}", path, e); } } else if (kind == ENTRY_DELETE) { File configFile = path.toFile(); if (configFile.isHidden() || configFile.isDirectory() || !configFile.getName().endsWith(".cfg")) { return; } exclusivePIDMap.setFileRemoved(configFile.getAbsolutePath()); processOrphanExclusivePIDs(); } storeCurrentExclusivePIDList(); }
Source:
<code>public EngineBackupLog getLastSuccessfulEngineBackup(String dbName) { List<EngineBackupLog> logs = multipleResults(entityManager.createNamedQuery("EngineBackupLog.getLatest", EngineBackupLog.class).setParameter("dbName", dbName)); <START> if (logs != null && logs.size() > 0) { <END> return logs.get(0); } else { return null; } }</code><technical_language>is assumption logs null, replace entire if with: if (logs.isEmpty()) { return null; } else { return logs.get(0); }</technical_language>

Target:
public EngineBackupLog getLastSuccessfulEngineBackup(String dbName) { List<EngineBackupLog> logs = multipleResults(entityManager.createNamedQuery("EngineBackupLog.getLatest", EngineBackupLog.class).setParameter("dbName", dbName)); if (logs.isEmpty()) { return null; } else { return logs.get(0); } }
Source:
<code>private void fetchLiveInstanceData(boolean force) throws AmazonClientException { <START> return fetchLiveInstanceData(force, 25); <END> }</code><technical_language>suggestion fetchLiveInstanceData(force, 25);</technical_language>

Target:
private void fetchLiveInstanceData(boolean force) throws AmazonClientException { fetchLiveInstanceData(force, 25); }
Source:
<code>public void testByteValues() throws Exception { List<Byte> byteValues = ImmutableList.of(1, 3, 5, 7, 11, 13, 17) .stream() .map(Integer::byteValue) .collect(toList()); List<Map<Integer, TupleDomainFilter>> filters = ImmutableList.of( ImmutableMap.of(0, BigintRange.of(1, 17, false)), ImmutableMap.of(0, IS_NULL)); <START> tester.testRoundTrip(TINYINT, byteValues, ImmutableList.of(ImmutableMap.of(0, BigintValues.of(new long[] {1, 17}, false)))); <END> tester.testRoundTripTypes(ImmutableList.of(TINYINT, TINYINT), ImmutableList.of(byteValues, reverse(byteValues)), filters); }</code><technical_language>add IS_NULL filter here</technical_language>

Target:
public void testByteValues() throws Exception { List<Byte> byteValues = ImmutableList.of(1, 3, 5, 7, 11, 13, 17) .stream() .map(Integer::byteValue) .collect(toList()); tester.testRoundTrip(TINYINT, byteValues, ImmutableList.of( ImmutableMap.of(0, BigintValues.of(new long[] {1, 17}, false)), ImmutableMap.of(0, IS_NULL))); List<Map<Integer, TupleDomainFilter>> filters = ImmutableList.of( ImmutableMap.of(0, BigintRange.of(1, 17, false)), ImmutableMap.of(0, IS_NULL), ImmutableMap.of(1, IS_NULL), ImmutableMap.of( 0, BigintRange.of(11, 15, false), 1, BigintRange.of(11, Long.MAX_VALUE, false))); tester.testRoundTripTypes(ImmutableList.of(TINYINT, TINYINT), ImmutableList.of(byteValues, reverse(byteValues)), filters); }
Source:
<code>public void tearDown() { ledgerEntriesImpl.close(); try { ledgerEntriesImpl.getEntry(entryId); fail("should fail getEntry after close"); } catch (NullPointerException e) { <START> <END> } try { ledgerEntriesImpl.iterator(); fail("should fail iterator after close"); } catch (NullPointerException e) { } try { ledgerEntriesImpl.retainIterator(); fail("should fail retainIterator after close"); } catch (NullPointerException e) { } }</code><technical_language>oh. noticed this before</technical_language>

Target:
public void tearDown() { ledgerEntriesImpl.close(); bufs.forEach(byteBuf -> assertEquals(0, byteBuf.refCnt())); try { ledgerEntriesImpl.getEntry(entryId); fail("should fail getEntry after close"); } catch (NullPointerException e) { } try { ledgerEntriesImpl.iterator(); fail("should fail iterator after close"); } catch (NullPointerException e) { } }
Source:
<code>public Object visit(PropertyIsLike filter, Object data) { Map.Entry<String, String> pair = filterAsKeyValuePair(filter.getExpression(), filter.getLiteral()); if (pair != null) { LOGGER.trace("Found key-value predicate {}, looking for metacard tags", pair); saveTag(pair.getKey(), pair.getValue()); return super.visit(filter, data); } LOGGER.trace( "Filter could not be converted to key-value pair so could not be referring to metacard tags", filter); <START> reportNonTagEncountered(); <END> return super.visit(filter, data); }</code><technical_language>duplicate code starting line 134</technical_language>

Target:
public Object visit(PropertyIsLike filter, Object data) { final Map.Entry<String, String> pair = filterAsKeyValuePair(filter.getExpression(), filter.getLiteral()); if (pair != null) { LOGGER.trace("Found key-value predicate {}, looking for metacard tags", pair); saveTag(pair.getKey(), pair.getValue()); } else { LOGGER.trace( "Filter could not be converted to key-value pair thus is not referring to metacard tags", filter); reportNonTagEncountered(); } return super.visit(filter, data); }
Source:
<code>public void dropSegment(final DataSegment segment) throws SegmentLoadingException { final String dataSource = segment.getDataSource(); dataSources.compute( dataSource, (k, v) -> { <START> final DataSourceState dataSourceState = v == null ? new DataSourceState() : v; <END> final VersionedIntervalTimeline<String, ReferenceCountingSegment> loadedIntervals = dataSourceState.getTimeline(); if (loadedIntervals == null) { log.info("Told to delete a queryable for a dataSource[%s] that doesn't exist.", dataSource); return null; } final PartitionChunk<ReferenceCountingSegment> removed = loadedIntervals.remove( segment.getInterval(), segment.getVersion(), segment.getShardSpec().createChunk(null) ); final ReferenceCountingSegment oldQueryable = (removed == null) ? null : removed.getObject(); if (oldQueryable != null) { dataSourceState.removeSegment(segment); try { log.info("Attempting to close segment %s", segment.getIdentifier()); oldQueryable.close(); } catch (IOException e) { log.makeAlert(e, "Exception closing segment") .addData("dataSource", dataSource) .addData("segmentId", segment.getIdentifier()) .emit(); } } else { log.info( "Told to delete a queryable on dataSource[%s] for interval[%s] and version [%s] that I don't have.", dataSource, segment.getInterval(), segment.getVersion() ); } return dataSourceState; } ); segmentLoader.cleanup(segment); }</code><technical_language>logic changed if dataSource present? In previous version, exit early Told delete a queryable for a dataSource[%s] exist. message. create new DataSourceState(), checks loadedIntervals is null (it's not), finally creates entry in dataSources Map. exit early if (v == null) {message; return null}. computeIfPresent() method</technical_language>

Target:
public void dropSegment(final DataSegment segment) throws SegmentLoadingException { final String dataSource = segment.getDataSource(); dataSources.compute( dataSource, (dataSourceName, dataSourceState) -> { if (dataSourceState == null) { log.info("Told to delete a queryable for a dataSource[%s] that doesn't exist.", dataSourceName); } else { final VersionedIntervalTimeline<String, ReferenceCountingSegment> loadedIntervals = dataSourceState.getTimeline(); final PartitionChunk<ReferenceCountingSegment> removed = loadedIntervals.remove( segment.getInterval(), segment.getVersion(), segment.getShardSpec().createChunk(null) ); final ReferenceCountingSegment oldQueryable = (removed == null) ? null : removed.getObject(); if (oldQueryable != null) { dataSourceState.removeSegment(segment); try { log.info("Attempting to close segment %s", segment.getIdentifier()); oldQueryable.close(); } catch (IOException e) { log.makeAlert(e, "Exception closing segment") .addData("dataSource", dataSourceName) .addData("segmentId", segment.getIdentifier()) .emit(); } } else { log.info( "Told to delete a queryable on dataSource[%s] for interval[%s] and version [%s] that I don't have.", dataSourceName, segment.getInterval(), segment.getVersion() ); } } return dataSourceState == null || dataSourceState.isEmpty() ? null : dataSourceState; } ); segmentLoader.cleanup(segment); }
Source:
<code>void store() { NbPreferences.forModule(LaTeXSettingsPanel.class).put("latexPath", jTextField1.getText()); int autoCompleteDelay = DEFAULT_AUTOCOMPLETE_DELAY_MS; try{ autoCompleteDelay = Integer.parseInt(jFormattedTextField1.getText()); }catch(NumberFormatException ex){ <START> autoCompleteDelay = DEFAULT_AUTOCOMPLETE_DELAY_MS; <END> } NbPreferences.forModule(LaTeXSettingsPanel.class).putInt(LaTeXSettingsPanel.KEY_AUTOCOMPLETE_DELAY, autoCompleteDelay); }</code><technical_language>I silently set default if user provides incorrect data. loudly fail user provide correct data</technical_language>

Target:
void store() { ApplicationSettings.INSTANCE.setLatexPath( jTextField1.getText() ); int autoCompleteDelay = Integer.parseInt(jFormattedTextField1.getText()); ApplicationSettings.INSTANCE.setAutoCompleteDelay(autoCompleteDelay); ApplicationSettings.INSTANCE.save(); }
Source:
<code>public GetBlobOperation(String datacenterName, ConnectionPool connectionPool, ExecutorService requesterPool, OperationContext oc, BlobId blobId, long operationTimeoutMs, ClusterMap clusterMap) throws CoordinatorException { super(datacenterName, connectionPool, requesterPool, oc, blobId, operationTimeoutMs, clusterMap, MessageFormatFlags.Blob); logger.trace( <START> "GetBlob: Datacenter name " + datacenterName + " Connection pool " + connectionPool + ", requester pool " + ( <END> requesterPool != null) + ", Operation context " + oc + ", blobId " + blobId + ", timeout " + operationTimeoutMs + ", clustermap " + (clusterMap != null)); this.blobOutput = null; }</code><technical_language>If want check if connectionPool is null not, do for requesterPool</technical_language>

Target:
public GetBlobOperation(String datacenterName, ConnectionPool connectionPool, ExecutorService requesterPool, OperationContext oc, BlobId blobId, long operationTimeoutMs, ClusterMap clusterMap) throws CoordinatorException { super(datacenterName, connectionPool, requesterPool, oc, blobId, operationTimeoutMs, clusterMap, MessageFormatFlags.Blob); logger.trace("GetBlob: Datacenter name " + datacenterName + " Connection pool " + (connectionPool != null) + ", requester pool " + (requesterPool != null) + ", Operation context " + oc + ", blobId " + blobId + ", timeout " + operationTimeoutMs + ", clustermap " + (clusterMap != null)); this.blobOutput = null; }
Source:
<code>public List<ItemStack> getDisplayRecipes() { List<ItemStack> display = new ArrayList<>(); for (String matName : materialSpeeds.keySet()) { Material mat = Material.getMaterial(matName); if (mat == null) continue; <START> display.add(new CustomItem(mat, "&bCan Climb This Block")); <END> } return display; }</code><technical_language>This is a badly done lore. of all, change name... user Block climb. do new ItemStack(mat) instead</technical_language>

Target:
public List<ItemStack> getDisplayRecipes() { List<ItemStack> display = new ArrayList<>(); for (Material mat : materialSpeeds.keySet()) { display.add(new ItemStack(mat)); } return display; }
Source:
<code>private LoadingStub makeStub(Object parentElement) { LoadingStub stub = stubs.get(parentElement); if (stub == null) { stub= new LoadingStub(); <START> stubs.put(parentElement, stub); <END> } return stub; }</code><technical_language>chance of a race condition concurrent threads try add entries ends replacing other</technical_language>

Target:
private LoadingStub makeStub(Object parentElement) { synchronized (stubs) { LoadingStub stub = stubs.get(parentElement); if (stub == null) { stub = new LoadingStub(); stubs.put(parentElement, stub); } return stub; } }
Source:
<code>public void Vectors_add() { Vector2D a = new Vector2D( 1, 2 ); Vector2D b = new Vector2D( 3, 4 ); <START> assertThat( a.add( b ), equalToVector2D( new Vector2D( 4, 6 ) ) ); <END> }</code><technical_language>I need equalToVector2D. I if equalTo work</technical_language>

Target:
public void Vectors_add() { Vector2D a = new Vector2D( 1, 2 ); Vector2D b = new Vector2D( 3, 4 ); assertThat( a.add( b ), equalTo( new Vector2D( 4, 6 ) ) ); }
Source:
<code>public void close() { for ( StoreType type : StoreType.values() ) { <START> if ( type.isRecordStore() && !type.isLimitedIdStore() ) <END> { ((Resource)idGenerator( type )).close(); } } }</code><technical_language>sense instead check if respective IdGenerator implements Resource</technical_language>

Target:
public void close() { for ( StoreType type : StoreType.values() ) { IdSequence generator = idGenerator( type ); if ( generator instanceof RenewableBatchIdSequence ) { ((RenewableBatchIdSequence)generator).close(); } } }
Source:
<code>public AttachmentStreamFactory(KeyProvider keyProvider) { <START> EncryptionKey key = keyProvider.getEncryptionKey(); <END> if (key != null) { this.key = key.getKey(); } else { this.key = null; } }</code><technical_language>Variable name choice is confusing shadows field key</technical_language>

Target:
public AttachmentStreamFactory(KeyProvider keyProvider) { if (keyProvider.getEncryptionKey() != null) { this.key = keyProvider.getEncryptionKey().getKey(); } else { this.key = null; } }
Source:
<code>private static ArrayList<UnspentOutput> getSortedCoins( ArrayList<UnspentOutput> unspentOutputs) { ArrayList<UnspentOutput> sortedCoins = new ArrayList<>(); Collections.sort(unspentOutputs, new UnspentOutputAmountComparatorAsc()); for(UnspentOutput coin : unspentOutputs) { if (!coin.isReplayable()) { sortedCoins.add(coin); break; } } <START> Collections.sort(unspentOutputs, new UnspentOutputAmountComparatorDesc()); <END> for(UnspentOutput coin : unspentOutputs) { if (!sortedCoins.contains(coin) && coin.isReplayable()) { sortedCoins.add(coin); break; } } for(UnspentOutput coin : unspentOutputs) { if (!sortedCoins.contains(coin) && !coin.isReplayable()) { sortedCoins.add(coin); break; } } return sortedCoins; }</code><technical_language>this sort need done here? I cheaper reverse list</technical_language>

Target:
private static ArrayList<UnspentOutput> getSortedCoins( ArrayList<UnspentOutput> unspentOutputs) { ArrayList<UnspentOutput> sortedCoins = new ArrayList<>(); Collections.sort(unspentOutputs, new UnspentOutputAmountComparatorAsc()); for(UnspentOutput coin : unspentOutputs) { if (!coin.isReplayable()) { sortedCoins.add(coin); break; } } Collections.reverse(unspentOutputs); for(UnspentOutput coin : unspentOutputs) { if (!sortedCoins.contains(coin) && coin.isReplayable()) { sortedCoins.add(coin); break; } } for(UnspentOutput coin : unspentOutputs) { if (!sortedCoins.contains(coin) && !coin.isReplayable()) { sortedCoins.add(coin); break; } } return sortedCoins; }
Source:
<code>public int compare(Viewer viewer, Object e1, Object e2) { int rc = 0; if (direction == DESCENDING) { <START> rc = super.compare(viewer, labelProvider.getText(e1), labelProvider.getText(e2)); <END> } else { rc = super.compare(viewer, labelProvider.getText(e2), labelProvider.getText(e1)); } return rc; }</code><technical_language>I surprised this works. super.compare() obtain a label again. I this getComparator().compare(), labelProvider.getText(e1).compareTo(labelProvider.getText(e2)). BTW, this ascending sort order</technical_language>

Target:
public int compare(Viewer viewer, Object e1, Object e2) { int rc = 0; String firstCell = labelProvider.getText(e1).toLowerCase(); String secondCell = labelProvider.getText(e2).toLowerCase(); if (direction == DESCENDING) { rc = secondCell.compareTo(firstCell); } else { rc = firstCell.compareTo(secondCell); } return rc; }
Source:
<code>public void close() throws IOException { try { if (mClient.get().isShutdown()) { return; } mStream.close(); try { <START> mStream.waitForComplete(5 * Constants.SECOND_MS); <END> } catch (Throwable e) { } } finally { mMarshaller.close(); mClient.close(); } }</code><technical_language>Some applications depend closure done server side perform other operations file safely. reader skip wait subsequent operations fail</technical_language>

Target:
public void close() throws IOException { try { if (mClient.get().isShutdown()) { return; } mStream.close(); try { if (mCloseWaitMs > 0) { mStream.waitForComplete(mCloseWaitMs); } } catch (Throwable e) { } } finally { mMarshaller.close(); mClient.close(); } }