auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public HorizontalPaneledChoiceDialog(Context context, String title) { super(context, title); <START> view = LayoutInflater.from(context).inflate(R.layout.choice_dialog_three_panel, null); <END> }</code><technical_language>inflated a view in super constructor. I refactor this inflate layouts, inflation is expensive. ways do this. I [this approach](<LINK_0> of providing override-able method returns inflate, is sort of unsatisfying... if of a approach</technical_language>

Target:
public HorizontalPaneledChoiceDialog(Context context, String title) { super(context, title); }
Source:
<code>protected void executeCommand() { T parameters = getParameters(); final DbUser user = parameters.getUser(); if (user != null && user.getId() == null) { user.setId(Guid.newGuid()); getDbUserDAO().save(user); } final DbGroup group = parameters.getGroup(); if (group != null && group.getId() == null) { group.setId(Guid.newGuid()); getAdGroupDAO().save(group); } Guid ownerId = parameters.getPermission().getad_element_id(); if (ownerId == null) { if (user != null) { ownerId = user.getId(); } } if (ownerId == null) { <START> if (group != null) { <END> ownerId = group.getId(); } } final permissions paramPermission = parameters.getPermission(); permissions permission = getPermissionDAO().getForRoleAndAdElementAndObject( paramPermission.getrole_id(), ownerId, paramPermission.getObjectId() ); if (permission == null) { paramPermission.setId(Guid.newGuid()); paramPermission.setad_element_id(ownerId); TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { getPermissionDAO().save(paramPermission); getCompensationContext().snapshotNewEntity(paramPermission); getCompensationContext().stateChanged(); return null; } }); permission = paramPermission; } getReturnValue().setActionReturnValue(permission.getId()); if (user != null) { updateAdminStatus(permission); } setSucceeded(true); }</code><technical_language>moved if block</technical_language>

Target:
protected void executeCommand() { T parameters = getParameters(); final DbUser user = parameters.getUser(); if (user != null && user.getId() == null) { user.setId(Guid.newGuid()); getDbUserDAO().save(user); } final DbGroup group = parameters.getGroup(); if (group != null && group.getId() == null) { group.setId(Guid.newGuid()); getAdGroupDAO().save(group); } Guid ownerId = parameters.getPermission().getad_element_id(); if (ownerId == null) { if (user != null) { ownerId = user.getId(); } if (ownerId == null) { if (group != null) { ownerId = group.getId(); } } } final permissions paramPermission = parameters.getPermission(); permissions permission = getPermissionDAO().getForRoleAndAdElementAndObject( paramPermission.getrole_id(), ownerId, paramPermission.getObjectId() ); if (permission == null) { paramPermission.setId(Guid.newGuid()); paramPermission.setad_element_id(ownerId); TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { getPermissionDAO().save(paramPermission); getCompensationContext().snapshotNewEntity(paramPermission); getCompensationContext().stateChanged(); return null; } }); permission = paramPermission; } getReturnValue().setActionReturnValue(permission.getId()); if (user != null) { updateAdminStatus(permission); } setSucceeded(true); }
Source:
<code>public void markHostMissing(boolean isMissing) { <START> if (isMissing) { <END> this.isMissing = true; } }</code><technical_language>Do need IF case here? case set isMissing false</technical_language>

Target:
public void markHostMissing(boolean isMissing) { this.isMissing = isMissing; }
Source:
<code>JsonLayoutFormat(String contextName, Integer maxChunkLength) { <START> this.jsonLayout = new CustomJsonLayout(contextName, maxChunkLength); <END> jsonLayout.setIncludeMessage(true); jsonLayout.setAppendLineSeparator(true); jsonLayout.setJsonFormatter(m -> new ObjectMapper().writeValueAsString(m)); jsonLayout.setTimestampFormat(DATE_FORMAT); }</code><technical_language>this. removed</technical_language>

Target:
JsonLayoutFormat(String contextName, Integer maxChunkLength) { jsonLayout = new CustomJsonLayout(contextName, maxChunkLength); jsonLayout.setIncludeMessage(true); jsonLayout.setAppendLineSeparator(true); jsonLayout.setJsonFormatter(m -> new ObjectMapper().writeValueAsString(m)); jsonLayout.setTimestampFormat(DATE_FORMAT); }
Source:
<code>protected void initServices() { this.marketDataService = new LatokenMarketDataService(this); this.tradeService = new LatokenTradeService(this); this.accountService = new LatokenAccountService(this); <START> } <END></code><technical_language>replace this @Override protected void initServices() { latoken = RestProxyFactory.createProxy(LatokenAuthenticated.class, getExchangeSpecification().getSslUri(), getClientConfig()); this.marketDataService = new LatokenMarketDataService(this, latoken); this.tradeService = new LatokenTradeService(this, latoken); this.accountService = new LatokenAccountService(this, latoken); }</technical_language>

Target:
protected void initServices() { this.latoken = RestProxyFactory.createProxy( LatokenAuthenticated.class, getExchangeSpecification().getSslUri()); this.marketDataService = new LatokenMarketDataService(this); this.tradeService = new LatokenTradeService(this); this.accountService = new LatokenAccountService(this); }
Source:
<code>private void removeSessionImpl(String sessionId, int reason, String message, Object... msgArgs) { AcctUtils.reportRecords(reason, getPrincipalName(sessionId), (ExtMap) getData(sessionId, AUTH_RECORD_PARAMETER_NAME, false), (ExtMap) getData(sessionId, PRINCIPAL_RECORD_PARAMETER_NAME, false), message, msgArgs ); sessionInfoMap.remove(sessionId); <START> getDbFacade().getEngineSessionDao().removeBySessionId(sessionId); <END> }</code><technical_language>remove seq... no</technical_language>

Target:
private void removeSessionImpl(String sessionId, int reason, String message, Object... msgArgs) { AcctUtils.reportRecords(reason, getPrincipalName(sessionId), (ExtMap) getData(sessionId, AUTH_RECORD_PARAMETER_NAME, false), (ExtMap) getData(sessionId, PRINCIPAL_RECORD_PARAMETER_NAME, false), message, msgArgs ); getDbFacade().getEngineSessionDao().removeBySessionId(sessionId); sessionInfoMap.remove(sessionId); }
Source:
<code>public Duplicable getValueWithRequiredEvaluations(@Nonnull final String nodeKey) throws IllegalStateException, IllegalArgumentException { assertNodeExists(Utils.nonNull(nodeKey, "The key of the node can not be null.")); return accumulateEvaluationsForDepthSortedNodeList(cgs.getEvalStrategyByEvaluatedNode(nodeKey), true).get(nodeKey); <START> } <END></code><technical_language>need new line imo</technical_language>

Target:
public Duplicable getValueWithRequiredEvaluations(@Nonnull final String nodeKey) throws IllegalStateException, IllegalArgumentException { assertNodeExists(nodeKey); return evaluateInTopologicalOrder(cgs.getTopologicalOrderForNodeEvaluation(nodeKey)).get(nodeKey); }
Source:
<code>private static Type resolveVar(Type resolved, String varName, Type declaringType, EntityType context) { int index = -1; for (int i = 0; i < declaringType.getParameters().size(); i++) { Type param = unwrap(declaringType.getParameters().get(i)); if (param instanceof TypeExtends && Objects.equal(((TypeExtends)param).getVarName(), varName)) { index = i; <START> } else if (param instanceof TypeSuper && Objects.equal(((TypeSuper) param).getVarName(), varName)) { <END> index = i; } } if (index == -1) { throw new IllegalStateException("Did not find type " + varName + " in " + declaringType + " for " + context); } Supertype type = context.getSuperType(); while (!type.getEntityType().equals(declaringType)) { type = type.getEntityType().getSuperType(); } if (!type.getType().getParameters().isEmpty()) { return type.getType().getParameters().get(index); } else { return resolved; } }</code><technical_language>I combine of if clauses if (Objects.equal(getVarName(param), varName)) type checks casts in method</technical_language>

Target:
private static Type resolveVar(Type resolved, String varName, Type declaringType, EntityType context) { int index = -1; for (int i = 0; i < declaringType.getParameters().size(); i++) { Type param = unwrap(declaringType.getParameters().get(i)); if (Objects.equal(getVarName(param), varName)) { index = i; } } if (index == -1) { throw new IllegalStateException("Did not find type " + varName + " in " + declaringType + " for " + context); } Supertype type = context.getSuperType(); while (!type.getEntityType().equals(declaringType)) { type = type.getEntityType().getSuperType(); } if (!type.getType().getParameters().isEmpty()) { return type.getType().getParameters().get(index); } else { return resolved; } }
Source:
<code>public Object getElementAt(int index) { if (index == getSize() - 1) { return CREATE_NEW_THEME; } if (index == getSize() - 2) { return SEPARATOR; } if (index == getSize() - 3) { <START> return SHOW_ALL_THEMES; <END> } if (myNumberProjectThemes > 0) { if (index == myNumberProjectThemes) { return SEPARATOR; } else if (index > myNumberProjectThemes) { return myThemeList.get(index - 1); } } return myThemeList.get(index); }</code><technical_language>This is starting want move a separate list "overflow options". If index is greater getSize() - 4, get OVERFLOW_MENU[getSize() - OVERFLOW_MENU.length] This get rid of a hardcoded numbers</technical_language>

Target:
public Object getElementAt(int index) { if (index >= mySizeBeforeExtraOptions) { return EXTRA_OPTIONS[index - mySizeBeforeExtraOptions]; } if (myNumberProjectThemes > 0) { if (index == myNumberProjectThemes) { return SEPARATOR; } else if (index > myNumberProjectThemes) { return myThemeList.get(index - 1); } } return myThemeList.get(index); }
Source:
<code>IndexValue getIndexValueOfLastPut() throws StoreException { IndexValue indexValueOfLastPut = null; if (sealed.get()) { ByteBuffer readBuf = serEntries.duplicate(); int numOfIndexEntries = numberOfEntries(readBuf); NavigableSet<IndexValue> values = new TreeSet<>(); for (int i = 0; i < numOfIndexEntries; i++) { StoreKey key = getKeyAt(readBuf, i); values.clear(); getAllValuesFromMmap(readBuf, key, i, numOfIndexEntries, values); for (IndexValue indexValue : values) { if (indexValue.getFlags() == IndexValue.FLAGS_DEFAULT_VALUE && (indexValueOfLastPut == null || indexValue.compareTo(indexValueOfLastPut) > 0)) { <START> indexValueOfLastPut = indexValue; <END> } } } } else { for (Map.Entry<StoreKey, ConcurrentSkipListSet<IndexValue>> entry : index.entrySet()) { for (IndexValue indexValue : entry.getValue()) { if (indexValue.getFlags() == IndexValue.FLAGS_DEFAULT_VALUE && (indexValueOfLastPut == null || indexValue.compareTo(indexValueOfLastPut) > 0)) { indexValueOfLastPut = indexValue; } } } } return indexValueOfLastPut; }</code><technical_language>processing this navigable set in reverse cutting out (break;) find a PUT? IndexValue natively sorts offset, for PUT biggest offset</technical_language>

Target:
IndexValue getIndexValueOfLastPut() throws StoreException { IndexValue indexValueOfLastPut = null; if (sealed.get()) { ByteBuffer readBuf = serEntries.duplicate(); int numOfIndexEntries = numberOfEntries(readBuf); NavigableSet<IndexValue> values = new TreeSet<>(); for (int i = 0; i < numOfIndexEntries; i++) { StoreKey key = getKeyAt(readBuf, i); values.clear(); getAllValuesFromMmap(readBuf, key, i, numOfIndexEntries, values); for (IndexValue indexValue : values) { if (indexValue.getFlags() == IndexValue.FLAGS_DEFAULT_VALUE && (indexValueOfLastPut == null || indexValue.compareTo(indexValueOfLastPut) > 0)) { indexValueOfLastPut = indexValue; break; } } } } else { for (Map.Entry<StoreKey, ConcurrentSkipListSet<IndexValue>> entry : index.entrySet()) { for (IndexValue indexValue : entry.getValue()) { if (indexValue.getFlags() == IndexValue.FLAGS_DEFAULT_VALUE && (indexValueOfLastPut == null || indexValue.compareTo(indexValueOfLastPut) > 0)) { indexValueOfLastPut = indexValue; break; } } } } return indexValueOfLastPut; }
Source:
<code>protected boolean canDoAction() { initializeObjectState(); getVmDAO().get(getVmId()); getReturnValue().setCanDoAction(validate(validateVmNotDuringSnapshot())); <START> <END> if (!validateSnapshotExists()) { getReturnValue().setCanDoAction(false); } if (!validateImages()) { getReturnValue().setCanDoAction(false); } if (!validateImageNotInTemplate()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CANNOT_REMOVE_IMAGE_TEMPLATE); getReturnValue().setCanDoAction(false); } if (!validateImageNotActive()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CANNOT_REMOVE_ACTIVE_IMAGE); getReturnValue().setCanDoAction(false); } if (!getReturnValue().getCanDoAction()) { addCanDoActionMessage(VdcBllMessages.VAR__TYPE__SNAPSHOT); addCanDoActionMessage(VdcBllMessages.VAR__ACTION__REMOVE); } return getReturnValue().getCanDoAction(); }</code><technical_language>, is idea continue perform a canDoAction test, if failed time? I is a good idea if factoring a code fix a errors</technical_language>

Target:
protected boolean canDoAction() { initializeObjectState(); getVmDAO().get(getVmId()); if (!validateVmNotDuringSnapshot()) { handleCanDoActionFailure(); return false; } if (!validateSnapshotExists()) { handleCanDoActionFailure(); return false; } if (!validateImages()) { handleCanDoActionFailure(); return false; } if (!validateImageNotInTemplate()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CANNOT_REMOVE_IMAGE_TEMPLATE); handleCanDoActionFailure(); return false; } if (!validateImageNotActive()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CANNOT_REMOVE_ACTIVE_IMAGE); handleCanDoActionFailure(); return false; } return getReturnValue().getCanDoAction(); }
Source:
<code><START> public Secret setProperties(SecretProperties properties) { properties.name = this.properties.name; this.properties = properties; return this; <END> }</code><technical_language>properties setable? if properties argument is null</technical_language>

Target:
public Secret setProperties(SecretProperties properties) { Objects.requireNonNull(properties); properties.name = this.properties.name; this.properties = properties; return this; }
Source:
<code>public PaginationOptions limit(int limit) { checkState(limit >= MIN_LIMIT, "limit must be >= " + MIN_LIMIT); <START> checkState(limit <= MAX_LIMIT, "limit must be <= " + MAX_LIMIT); <END> queryParameters.put("limit", Integer.toString(limit)); return this; }</code><technical_language>checkArgument instead throw IllegalArgumentException</technical_language>

Target:
public PaginationOptions limit(int limit) { checkArgument(limit >= MIN_LIMIT, "limit must be >= " + MIN_LIMIT); checkArgument(limit <= MAX_LIMIT, "limit must be <= " + MAX_LIMIT); queryParameters.put("limit", Integer.toString(limit)); return this; }
Source:
<code>public void bind(Moshi moshi, JsonAdapter.Factory factory) { if (jsonAdapters.length > 0) { Type[] parameterTypes = method.getGenericParameterTypes(); Annotation[][] parameterAnnotations = method.getParameterAnnotations(); for (int i = adaptersOffset, size = parameterTypes.length; i < size; i++) { Type type = ((ParameterizedType) parameterTypes[i]).getActualTypeArguments()[0]; Set<? extends Annotation> jsonAnnotations = jsonAnnotations(parameterAnnotations[i]); jsonAdapters[i - adaptersOffset] = <START> Types.equals(Types.getRawType(this.type), Types.getRawType(type)) <END> && annotations.equals(jsonAnnotations) ? moshi.nextAdapter(factory, type, jsonAnnotations) : moshi.adapter(type, jsonAnnotations); } } }</code><technical_language>I this equate List<String> List<Integer></technical_language>

Target:
public void bind(Moshi moshi, JsonAdapter.Factory factory) { if (jsonAdapters.length > 0) { Type[] parameterTypes = method.getGenericParameterTypes(); Annotation[][] parameterAnnotations = method.getParameterAnnotations(); for (int i = adaptersOffset, size = parameterTypes.length; i < size; i++) { Type type = ((ParameterizedType) parameterTypes[i]).getActualTypeArguments()[0]; Set<? extends Annotation> jsonAnnotations = jsonAnnotations(parameterAnnotations[i]); jsonAdapters[i - adaptersOffset] = Types.equals(Types.canonicalize(this.type), Types.canonicalize(type)) && annotations.equals(jsonAnnotations) ? moshi.nextAdapter(factory, type, jsonAnnotations) : moshi.adapter(type, jsonAnnotations); } } }
Source:
<code>public void getUserCardTransactionsShouldReturnTheRequest() throws Exception { final AtomicReference<Request> bodyRef = new AtomicReference<>(); final CountDownLatch latch = new CountDownLatch(1); final RestAdapter adapter = new RestAdapter.Builder().setEndpoint(MOCK_URL).setClient(new Client() { @Override public Response execute(Request request) throws IOException { bodyRef.set(request); latch.countDown(); <START> return null; <END> } }).build(); final UserCardService userCardService = adapter.create(UserCardService.class); userCardService.getUserCardTransactions("foo", "bar", new RetrofitPromise<List<Transaction>>()); latch.await(); Assert.assertEquals(bodyRef.get().getUrl(), String.format("%s/v0/me/cards/%s/transactions", MOCK_URL, "bar")); Assert.assertEquals(bodyRef.get().getMethod(), "GET"); Assert.assertTrue(bodyRef.get().getHeaders().contains(new Header("Range", "foo"))); }</code><technical_language>Add newline return</technical_language>

Target:
public void getUserCardTransactionsShouldReturnTheRequest() throws Exception { final AtomicReference<Request> bodyRef = new AtomicReference<>(); final CountDownLatch latch = new CountDownLatch(1); final RestAdapter adapter = new RestAdapter.Builder().setEndpoint(MOCK_URL).setClient(new Client() { @Override public Response execute(Request request) throws IOException { bodyRef.set(request); latch.countDown(); return null; } }).build(); final UserCardService userCardService = adapter.create(UserCardService.class); userCardService.getUserCardTransactions("foo", "bar", new RetrofitPromise<List<Transaction>>()); latch.await(); Assert.assertEquals(bodyRef.get().getMethod(), "GET"); Assert.assertEquals(bodyRef.get().getUrl(), String.format("%s/v0/me/cards/%s/transactions", MOCK_URL, "bar")); Assert.assertTrue(bodyRef.get().getHeaders().contains(new Header("Range", "foo"))); }
Source:
<code>private void initRenderingSupport() { buffersManager = new FrameBuffersManager(); context.put(FrameBuffersManager.class, buffersManager); graphicState = new GraphicState(buffersManager); postProcessor = new PostProcessor(buffersManager, graphicState); context.put(PostProcessor.class, postProcessor); buffersManager.setGraphicState(graphicState); buffersManager.setPostProcessor(postProcessor); buffersManager.initialize(); shaderManager.initShaders(); postProcessor.initializeMaterials(); initMaterials(); shadowMap = new ShadowMapNode(getMaterial("engine:prog.shadowMap"), playerCamera, this, backdropProvider, renderingConfig, graphicState); <START> <END> dag.add(shadowMap); }</code><technical_language>Generally speaking a RenderNode find needs. This DAG remains agnostic of a node needs treat nodes same. So: 1. node find renderingConfig backdropProvider a context object obtain playerCamera WorldRenderer instance. 2. GraphicState is a class I created collect easily recognizable opengl directives in place. Earlier "visually polluting" renderer code making hard get overview - a picture details focus guide eye. However, divide code of existing rendering engine RenderNodes, sense move gl directives nodes, needed. code a node horribly big, probably. So, do is place code currently in GraphicState.preRenderSetupSceneShadowMap() GraphicState.postRenderCleanupSceneShadowMap() ShadowMapNode, eliminating dependency graphicState instance. Word of caution though: I remind this stage generating ShadowMap executing other step in rendering engine rely state changes occurred earlier in flow of execution. state change is done undone immediately use, leaving DAG optimize process, ensure RenderNodes executed in current order. if need clarify this</technical_language>

Target:
private void initRenderingSupport() { buffersManager = new FrameBuffersManager(); context.put(FrameBuffersManager.class, buffersManager); graphicState = new GraphicState(buffersManager); postProcessor = new PostProcessor(buffersManager, graphicState); context.put(PostProcessor.class, postProcessor); buffersManager.setGraphicState(graphicState); buffersManager.setPostProcessor(postProcessor); buffersManager.initialize(); shaderManager.initShaders(); postProcessor.initializeMaterials(); initMaterials(); context.put(WorldRenderer.class, this); context.put(RenderQueuesHelper.class, renderQueues); context.put(RenderableWorld.class, renderableWorld); initPipeline(); }
Source:
<code>private void cleanNetworks() { try { for (Network network : dockerConnector.getNetworks(GET_NETWORKS_PARAMS)) { Matcher cheNetworkMatcher = CHE_NETWORK_PATTERN.matcher(network.getName()); if (cheNetworkMatcher.matches() && network.getContainers().isEmpty() && !additionalNetworks.contains(network.getName()) && !runtimes.hasRuntime(cheNetworkMatcher.group(WORKSPACE_ID_REGEX_GROUP))) { try { dockerConnector.removeNetwork(network.getId()); } catch (IOException e) { <START> LOG.warn("Failed to remove abandoned network: %s", network.getName()); <END> } } } } catch (IOException e) { LOG.error("Failed to get list of docker networks", e); } }</code><technical_language>Log exception</technical_language>

Target:
void cleanNetworks() { try { for (Network network : dockerConnector.getNetworks(GET_NETWORKS_PARAMS)) { Matcher cheNetworkMatcher = CHE_NETWORK_PATTERN.matcher(network.getName()); if (cheNetworkMatcher.matches() && network.getContainers().isEmpty() && !additionalNetworks.contains(network.getName()) && !runtimes.hasRuntime(cheNetworkMatcher.group(WORKSPACE_ID_REGEX_GROUP))) { try { dockerConnector.removeNetwork(network.getId()); } catch (IOException e) { LOG.warn("Failed to remove abandoned network: " + network.getName(), e); } } } } catch (IOException e) { LOG.error("Failed to get list of docker networks", e); } }
Source:
<code>private void removeSkippedRegion(Locus stopBeforeLocus) { int i = 0; while (i < accumulator.size() && accumulator.get(i).isEmpty() && locusComparator.compare(accumulator.get(i), stopBeforeLocus) < 0) { i++; } if (i > 0){ <START> List<K> temporaryList = new ArrayList<>(accumulator.subList(i, accumulator.size())); <END> accumulator.clear(); accumulator.addAll(temporaryList); } }</code><technical_language>This do a bunch of unnecessary allocations. I do this, java doc for subList * <p>This method eliminates need for explicit range operations (of * sort commonly exist for arrays). operation expects * a list a range operation passing a subList view * instead of a list. For example, idiom * removes a range of elements a list: * <pre> * list.subList(from, to).clear(); efficient internal method removeRange. So, I learned new. update subList.clear instead of new list allocations? Good that</technical_language>

Target:
private void removeSkippedRegion(Locus stopBeforeLocus) { int i = 0; while (i < accumulator.size() && accumulator.get(i).isEmpty() && locusComparator.compare(accumulator.get(i), stopBeforeLocus) < 0) { i++; } if (i > 0){ accumulator.subList(0, i).clear(); } }
Source:
<code>public void testMongoTopology() throws Exception { try { String templateUrl = "classpath://templates/mongo-topology.tosca.yaml"; EntitySpec<?> spec = transformer.createApplicationSpec( new ResourceUtils(mgmt).getResourceAsString(templateUrl)); assertNotNull(spec, "spec"); assertEquals(spec.getType(), BasicApplication.class); assertEquals(spec.getChildren().size(), 1, "Expected exactly one child of root application"); EntitySpec<?> compute = Iterators.getOnlyElement(spec.getChildren().iterator()); assertEquals(compute.getType(), SameServerEntity.class); <START> assertEquals(compute.getChildren().size(), 1, "Expected exactly one child of root application"); <END> EntitySpec<?> mongo = Iterators.getOnlyElement(compute.getChildren().iterator()); assertEquals(mongo.getType(), VanillaSoftwareProcess.class); String customize = mongo.getFlags().get(VanillaSoftwareProcess.CUSTOMIZE_COMMAND.getName()).toString(); assertConfigValueContains(customize, "DB_IP"); assertConfigValueContains(customize, "$brooklyn:entity(\"Compute\").attributeWhenReady(\"ip_address\")"); } finally { if (platform!=null) { platform.close(); } } }</code><technical_language>child of compute entity</technical_language>

Target:
public void testMongoTopology() throws Exception { try { String templateUrl = "classpath://templates/mongo-topology.tosca.yaml"; EntitySpec<?> spec = transformer.createApplicationSpec( new ResourceUtils(mgmt).getResourceAsString(templateUrl)); assertNotNull(spec, "spec"); assertEquals(spec.getType(), BasicApplication.class); assertEquals(spec.getChildren().size(), 1, "Expected exactly one child of root application"); EntitySpec<?> compute = Iterators.getOnlyElement(spec.getChildren().iterator()); assertEquals(compute.getType(), SameServerEntity.class); assertEquals(compute.getChildren().size(), 1, "Expected exactly one child of compute entity"); EntitySpec<?> mongo = Iterators.getOnlyElement(compute.getChildren().iterator()); assertEquals(mongo.getType(), VanillaSoftwareProcess.class); String customize = mongo.getFlags().get(VanillaSoftwareProcess.CUSTOMIZE_COMMAND.getName()).toString(); assertConfigValueContains(customize, "DB_IP"); assertConfigValueContains(customize, "$brooklyn:entity(\"Compute\").attributeWhenReady(\"ip_address\")"); } finally { if (platform!=null) { platform.close(); } } }
Source:
<code>private List<IJavaElement> addLibraryEntries(IFile[] resources, IJavaProject project, IProgressMonitor monitor) throws CoreException { List<CPListElement> addedEntries= new ArrayList<>(); try { monitor.beginTask(NewWizardMessages.ClasspathModifier_Monitor_AddToBuildpath, 4); for (IFile resource : resources) { <START> IResource res= resource; <END> CPListElement cpListElement= new CPListElement(project, IClasspathEntry.CPE_LIBRARY, res.getFullPath(), res); if(fForTestOnly) { cpListElement.setAttribute(IClasspathAttribute.TEST, "true"); } else { if(project.getModuleDescription() != null) { cpListElement.setAttribute(IClasspathAttribute.MODULE, new ModuleEncapsulationDetail[0]); } } addedEntries.add(cpListElement); } monitor.worked(1); List<CPListElement> existingEntries= ClasspathModifier.getExistingEntries(project); ClasspathModifier.setNewEntry(existingEntries, addedEntries, project, new SubProgressMonitor(monitor, 1)); ClasspathModifier.commitClassPath(existingEntries, project, new SubProgressMonitor(monitor, 1)); BuildpathDelta delta= new BuildpathDelta(getToolTipText()); delta.setNewEntries(existingEntries.toArray(new CPListElement[existingEntries.size()])); informListeners(delta); List<IJavaElement> result= new ArrayList<>(addedEntries.size()); for (IResource res : resources) { IJavaElement elem= project.getPackageFragmentRoot(res); if (elem != null) { result.add(elem); } } monitor.worked(1); return result; } finally { monitor.done(); } }</code><technical_language>obsolete; rename loop var res</technical_language>

Target:
private List<IJavaElement> addLibraryEntries(IFile[] resources, IJavaProject project, IProgressMonitor monitor) throws CoreException { List<CPListElement> addedEntries= new ArrayList<>(); try { monitor.beginTask(NewWizardMessages.ClasspathModifier_Monitor_AddToBuildpath, 4); for (IFile res : resources) { CPListElement cpListElement= new CPListElement(project, IClasspathEntry.CPE_LIBRARY, res.getFullPath(), res); if(fForTestOnly) { cpListElement.setAttribute(IClasspathAttribute.TEST, "true"); } else { if(project.getModuleDescription() != null) { cpListElement.setAttribute(IClasspathAttribute.MODULE, new ModuleEncapsulationDetail[0]); } } addedEntries.add(cpListElement); } monitor.worked(1); List<CPListElement> existingEntries= ClasspathModifier.getExistingEntries(project); ClasspathModifier.setNewEntry(existingEntries, addedEntries, project, new SubProgressMonitor(monitor, 1)); ClasspathModifier.commitClassPath(existingEntries, project, new SubProgressMonitor(monitor, 1)); BuildpathDelta delta= new BuildpathDelta(getToolTipText()); delta.setNewEntries(existingEntries.toArray(new CPListElement[existingEntries.size()])); informListeners(delta); List<IJavaElement> result= new ArrayList<>(addedEntries.size()); for (IResource res : resources) { IJavaElement elem= project.getPackageFragmentRoot(res); if (elem != null) { result.add(elem); } } monitor.worked(1); return result; } finally { monitor.done(); } }
Source:
<code>public String getPermissionDescription(String role) { <START> return NLS.getIfExists("Permission." + role + ".description", null).orElse(""); <END> }</code><technical_language>method provided in Permissions?</technical_language>

Target:
public String getPermissionDescription(String role) { return Permissions.getPermissionDescription(role); }
Source:
<code><START> public void set(long oid, long rows) { <END> this.oid = oid; this.rows = rows; }</code><technical_language>this need public</technical_language>

Target:
void set(long oid, long rows) { this.oid = oid; this.rows = rows; }
Source:
<code>public List<org.atlasapi.media.entity.Clip> clipsFor(PidReference ref) throws NitroException { try { Iterable<com.metabroadcast.atlas.glycerin.model.Clip> nitroClips = Iterables.transform(Iterables.filter(getNitroClip(ref), isClip), toClip); if (Iterables.isEmpty(nitroClips)) { log.warn("No programmes found for clipRefs {}", ref, new Function<PidReference, String>() { @Override public String apply(@Nullable PidReference pidRef) { return pidRef.getPid(); } }); } <START> Iterable<List<Clip>> clipParts = Iterables.partition(nitroClips, BATCH_SIZE); <END> ImmutableList.Builder<org.atlasapi.media.entity.Clip> clips = ImmutableList.builder(); for (List<Clip> clipPart : clipParts) { clips.addAll(extractClips(clipPart).values()); } return clips.build(); } catch (GlycerinException e) { throw new NitroException(ref.toString(), e); } }</code><technical_language>do need partition these</technical_language>

Target:
public List<org.atlasapi.media.entity.Clip> clipsFor(PidReference ref) throws NitroException { try { Iterable<com.metabroadcast.atlas.glycerin.model.Clip> nitroClips = Iterables .transform(Iterables.filter(getNitroClips(ref), isClip), toClip); if (Iterables.isEmpty(nitroClips)) { log.warn("No programmes found for clipRefs {}", ref, new Function<PidReference, String>() { @Override public String apply(@Nullable PidReference pidRef) { return pidRef.getPid(); } }); } ImmutableList.Builder<org.atlasapi.media.entity.Clip> extractedClips = ImmutableList.builder(); for (Clip clip : nitroClips) { extractedClips.add(extractClip(clip)); } return extractedClips.build(); } catch (GlycerinException e) { throw new NitroException(ref.toString(), e); } }
Source:
<code>public void testBasicPathArgumentRecognitionAndParsing2() throws Exception { ModelNode request = ctx.buildRequest("deployment-info --headers=false"); <START> Assert.assertFalse(request.hasDefined(Util.OPERATION_HEADERS)); <END> }</code><technical_language>this result in a CLI error --headers, --headers= --headers=<any_simple_value> sense <LINK_0> check of headers in BaseOperationCommand.addHeaders, OBJECT type accept it</technical_language>

Target:
public void testBasicPathArgumentRecognitionAndParsing2() throws Exception { try { ctx.buildRequest("deployment-info --headers=false"); Assert.fail(); } catch (CommandFormatException cfe) { } }
Source:
<code>void should_fail_when_period_is_null() { Period period = null; <START> ThrowableAssert.ThrowingCallable code = () -> assertThat(period).hasDays(5); <END> assertThatAssertionErrorIsThrownBy(code).withMessage(actualIsNull()); }</code><technical_language>expectAssertionError then(assertionError).hasMessage(actualIsNull());</technical_language>

Target:
void should_fail_when_period_is_null() { Period period = null; final AssertionError code = expectAssertionError(() -> assertThat(period).hasDays(5)); then(code).hasMessage(actualIsNull()); }
Source:
<code>public void test() { XmlRulesDefinition rulesDefinition = new XmlRulesDefinition(); RulesDefinition.Context context = new RulesDefinition.Context(); rulesDefinition.define(context); RulesDefinition.Repository repository = context.repository("xml"); assertThat(repository.name()).isEqualTo("SonarAnalyzer"); assertThat(repository.language()).isEqualTo("xml"); assertThat(repository.rules()).hasSize(CheckRepository.getChecks().size()); RulesDefinition.Rule alertUseRule = repository.rule("IndentCheck"); assertThat(alertUseRule).isNotNull(); assertThat(alertUseRule.name()).isEqualTo("Source code should be indented consistently"); assertThat(Stream.of(repository.rule("XPathCheck"), repository.rule("XmlSchemaCheck"))) .isNotEmpty() .allMatch(rule -> rule != null) <START> .allMatch(rule -> rule.template()); <END> for (Rule rule : repository.rules()) { for (RulesDefinition.Param param : rule.params()) { assertThat(param.description()).as("description for " + param.key()).isNotEmpty(); } } }</code><technical_language>check 2 rules declared rule templates</technical_language>

Target:
public void test() { XmlRulesDefinition rulesDefinition = new XmlRulesDefinition(); RulesDefinition.Context context = new RulesDefinition.Context(); rulesDefinition.define(context); RulesDefinition.Repository repository = context.repository("xml"); assertThat(repository.name()).isEqualTo("SonarAnalyzer"); assertThat(repository.language()).isEqualTo("xml"); assertThat(repository.rules()).hasSize(CheckRepository.getChecks().size()); RulesDefinition.Rule alertUseRule = repository.rule("IndentCheck"); assertThat(alertUseRule).isNotNull(); assertThat(alertUseRule.name()).isEqualTo("Source code should be indented consistently"); assertThat(repository.rules().stream().filter(Rule::template).map(Rule::key)) .isNotEmpty() .containsOnly("XPathCheck", "XmlSchemaCheck"); for (Rule rule : repository.rules()) { for (RulesDefinition.Param param : rule.params()) { assertThat(param.description()).as("description for " + param.key()).isNotEmpty(); } } }
Source:
<code>@Test public void multipleTopLevelValuesInOneDocument() throws IOException { <START> if (factory == Factory.JSON_OBJECT) return; END> JsonReader reader = factory.newReader("[][]"); reader.setLenient(true); reader.beginArray(); reader.endArray(); assertThat(reader.getPath()).isEqualTo("$"); reader.beginArray(); reader.endArray(); assertThat(reader.getPath()).isEqualTo("$"); }</code><technical_language>assumeTrue(factory != Factory.JSON_OBJECT);</technical_language>

Target:
@Test public void multipleTopLevelValuesInOneDocument() throws IOException { assumeTrue(factory != Factory.JSON_OBJECT); JsonReader reader = factory.newReader("[][]"); reader.setLenient(true); reader.beginArray(); reader.endArray(); assertThat(reader.getPath()).isEqualTo("$"); reader.beginArray(); reader.endArray(); assertThat(reader.getPath()).isEqualTo("$"); }
Source:
<code>private long getDiskUsage(Project.NameKey project) throws IOException { Repository git = gitManager.openRepository(project); try { <START> File gitDir = git.getDirectory(); return getDiskUsage(gitDir); <END> } finally { git.close(); } }</code><technical_language>need temp var here: return getDiskUsage(git.getDirectory()); GitRepositoryManager implements AutoClosable, change be: try (Repository repo = gitManager.openRepository(project); ) { return getDiskUsage(git.getDirectory()); }</technical_language>

Target:
private long getDiskUsage(Project.NameKey project) throws IOException { Repository git = gitManager.openRepository(project); try { return getDiskUsage(git.getDirectory()); } finally { git.close(); } }
Source:
<code>public static XMLEventReader createXMLEventReader(StringReader source) { try { return XML_INPUT_FACTORY.createXMLEventReader(source); } catch (Exception e) { <START> throw new XmlBeanDefinitionException("Error occurred creating a new XMLEventReader from a StringReader.", e); <END> } }</code><technical_language>Error occurred while creating a new XMLEventReader StringReader</technical_language>

Target:
public static XMLEventReader createXMLEventReader(StringReader source) { try { return XML_INPUT_FACTORY.createXMLEventReader(source); } catch (Exception e) { throw new XmlBeanDefinitionException("Error occurred while creating a new XMLEventReader from StringReader.", e); } }
Source:
<code><START> @Override @Before public void setUp(){ <END> init(); }</code><technical_language>annotations redundant test class is extended testcase, I suggest remove inheritance annotations here</technical_language>

Target:
@Before public void setUp() { init(); }
Source:
<code>private void drain() { synchronized (this) { if (busy) { missed = true; return; } else { <START> missed = false; <END> } } while (!child.isUnsubscribed()) { Notification<T> tn; synchronized (this) { tn = terminalNotification; } if (tn != null) { if (requested > 0) { terminalNotification = null; child.onNext(tn); if (!child.isUnsubscribed()) { child.onCompleted(); } return; } } synchronized (this) { if (!missed) { busy = false; return; } } } }</code><technical_language>If busy, missed is false (due exhaustive drain) need set here</technical_language>

Target:
private void drain() { synchronized (this) { if (busy) { missed = true; return; } } while (!child.isUnsubscribed()) { Notification<T> tn; tn = terminalNotification; if (tn != null) { if (requested > 0) { terminalNotification = null; child.onNext(tn); if (!child.isUnsubscribed()) { child.onCompleted(); } return; } } synchronized (this) { if (!missed) { busy = false; return; } } } }
Source:
<code>@Override public Connection createConnection() throws JMSException { if (null == connectionFactory) { logger.error("Connection cannot be establish to the broker. Please check the broker libs provided."); return null; } Connection connection = null; try { if (JMSConstants.JMS_SPEC_VERSION_1_1.equals(jmsSpec)) { if (this.destinationType.equals(JMSConstants.JMSDestinationType.QUEUE)) { connection = ((QueueConnectionFactory) (this.connectionFactory)).createQueueConnection(); } else if (this.destinationType.equals(JMSConstants.JMSDestinationType.TOPIC)) { connection = ((TopicConnectionFactory) (this.connectionFactory)).createTopicConnection(); if (isDurable) { connection.setClientID(clientId); } } return connection; } else { QueueConnectionFactory qConFac = null; TopicConnectionFactory tConFac = null; if (this.destinationType.equals(JMSConstants.JMSDestinationType.QUEUE)) { qConFac = (QueueConnectionFactory) this.connectionFactory; } else { tConFac = (TopicConnectionFactory) this.connectionFactory; } if (null != qConFac) { connection = qConFac.createQueueConnection(); } else if (null != tConFac) { connection = tConFac.createTopicConnection(); } if (isDurable && !isSharedSubscription) { connection.setClientID(clientId); } return connection; } } catch (Exception e) { logger.error("JMS Exception while creating connection through factory " + this.connectionFactoryString, e); if (null != connection) { try { connection.close(); } catch (Exception ex) { <START> logger.error("Error while closing the connection"); <END> } } throw e; } }</code><technical_language>print exception (ex) stack trace</technical_language>

Target:
public Connection createConnection() throws JMSException { if (null == connectionFactory) { throw new JMSException("Connection cannot be establish to the broker. Connection Factory is null. Please " + "check the Please check the broker libs provided."); } Connection connection = null; try { if (JMSConstants.JMS_SPEC_VERSION_1_1.equals(jmsSpec)) { if (this.destinationType.equals(JMSConstants.JMSDestinationType.QUEUE)) { connection = ((QueueConnectionFactory) (this.connectionFactory)).createQueueConnection(); } else if (this.destinationType.equals(JMSConstants.JMSDestinationType.TOPIC)) { connection = ((TopicConnectionFactory) (this.connectionFactory)).createTopicConnection(); if (isDurable) { connection.setClientID(clientId); } } return connection; } else { QueueConnectionFactory qConFac = null; TopicConnectionFactory tConFac = null; if (this.destinationType.equals(JMSConstants.JMSDestinationType.QUEUE)) { qConFac = (QueueConnectionFactory) this.connectionFactory; } else { tConFac = (TopicConnectionFactory) this.connectionFactory; } if (null != qConFac) { connection = qConFac.createQueueConnection(); } else if (null != tConFac) { connection = tConFac.createTopicConnection(); } if (isDurable && !isSharedSubscription) { connection.setClientID(clientId); } return connection; } } catch (JMSException e) { if (null != connection) { try { connection.close(); } catch (Exception ex) { logger.error("Error while closing the connection. ", ex); } } throw e; } }
Source:
<code>public void filter_groups_where_the_user_is_not_included_in() throws Exception { Group expectedGroup = getGroupByName(NAME_GROUP_TWO); <START> assertNotContainsUser(expectedGroup, TEST_USER_ID); <END> SCIMSearchResult<Group> result = searchGroup(String.format("not(members eq \"%s\")", TEST_USER_ID)); assertThat(String.format("Can not find expected group %s!", NAME_GROUP_TWO), result.getResources(), hasItem(new Group.Builder(NAME_GROUP_TWO).build())); }</code><technical_language>I this assertion is necessary, is asserting test data in seed is in DB. I drop it</technical_language>

Target:
public void filter_groups_where_the_user_is_not_included_in() throws Exception { final SCIMSearchResult<Group> result = searchGroup("not(members eq \"cef9452e-00a9-4cec-a086-d171374ffbef\")"); final Group expectedGroup = new Group.Builder(GROUP_TWO_NAME).build(); assertThat("Can not find expected group test_group02!", result.getResources(), hasItem(expectedGroup)); }
Source:
<code>public static List<II> getPatientIds(PRPAIN201306UV02 response) { LOG.info("getPatientIds()"); List<II> oIIs = null; if (response != null && response.getControlActProcess() != null && response.getControlActProcess().getSubject() != null) { for (PRPAIN201306UV02MFMIMT700711UV01Subject1 subject : response.getControlActProcess().getSubject()) { if (subject.getRegistrationEvent() != null && subject.getRegistrationEvent().getSubject1() != null && subject.getRegistrationEvent().getSubject1().getPatient() != null && subject.getRegistrationEvent().getSubject1().getPatient().getId() != null) { <START> oIIs = subject.getRegistrationEvent().getSubject1().getPatient().getId(); <END> } else { LOG.error("PatientId doesn't exist in the received PRPAIN201306UV02 message"); } } } return oIIs; }</code><technical_language>a break here? Otherwise, looping possibility of overwriting</technical_language>

Target:
public static List<II> getPatientIds(PRPAIN201306UV02 response) { List<II> oIIs = null; if (response != null && response.getControlActProcess() != null && response.getControlActProcess().getSubject() != null) { oIIs = new ArrayList<>(); for (PRPAIN201306UV02MFMIMT700711UV01Subject1 subject : response.getControlActProcess().getSubject()) { if (subject.getRegistrationEvent() != null && subject.getRegistrationEvent().getSubject1() != null && subject.getRegistrationEvent().getSubject1().getPatient() != null && subject.getRegistrationEvent().getSubject1().getPatient().getId() != null) { oIIs.addAll(subject.getRegistrationEvent().getSubject1().getPatient().getId()); } } } else { LOG.error("PatientId doesn't exist in the received PRPAIN201306UV02 message"); } return oIIs; }
Source:
<code><START> public GenericSubscriptionQueryMessage(Q payload, ResponseType<I> responseType, <END> ResponseType<U> updateResponseType) { super(payload, responseType); this.updateResponseType = updateResponseType; }</code><technical_language>Nit: sense this constructor calls constructor line 63</technical_language>

Target:
public GenericSubscriptionQueryMessage(Q payload, ResponseType<I> responseType, ResponseType<U> updateResponseType) { this(payload, payload.getClass().getName(), responseType, updateResponseType); }
Source:
<code>public Void visitAggregation(AggregationNode node, ImmutableList.Builder<Expression> context) { node.getAggregations().values() .forEach(aggregation -> context.add(aggregation.getCall())); node.getGroupingSets().forEach(groupingSet -> groupingSet <START> .forEach(symbol -> context.add(symbol.toSymbolReference()))); <END> return super.visitAggregation(node, context); }</code><technical_language>is wrong. Symbols expressions</technical_language>

Target:
public Void visitAggregation(AggregationNode node, ImmutableList.Builder<Expression> context) { node.getAggregations().values() .forEach(aggregation -> context.add(aggregation.getCall())); return super.visitAggregation(node, context); }
Source:
<code>private void addWorldRenderingNodes(RenderGraph renderGraph) { Node opaqueObjectsNode = new OpaqueObjectsNode(context); renderGraph.addNode(opaqueObjectsNode, "opaqueObjectsNode"); Node opaqueBlocksNode = new OpaqueBlocksNode(context); renderGraph.addNode(opaqueBlocksNode, "opaqueBlocksNode"); Node alphaRejectBlocksNode = new AlphaRejectBlocksNode(context); renderGraph.addNode(alphaRejectBlocksNode, "alphaRejectBlocksNode"); Node overlaysNode = new OverlaysNode(context); renderGraph.addNode(overlaysNode, "overlaysNode"); Node lastUpdatedGBufferClearingNode = renderGraph.findNode(new SimpleUri("engine:lastUpdatedGBufferClearingNode")); renderGraph.connect(lastUpdatedGBufferClearingNode, opaqueObjectsNode); renderGraph.connect(lastUpdatedGBufferClearingNode, opaqueBlocksNode); renderGraph.connect(lastUpdatedGBufferClearingNode, alphaRejectBlocksNode); <START> renderGraph.connect(lastUpdatedGBufferClearingNode, overlaysNode); <END> }</code><technical_language>I pool connect() calls end of method. put close lines setting nodes instead, related a node is tightly clustered</technical_language>

Target:
private void addWorldRenderingNodes(RenderGraph renderGraph) { Node lastUpdatedGBufferClearingNode = renderGraph.findNode("engine:lastUpdatedGBufferClearingNode"); Node opaqueObjectsNode = new OpaqueObjectsNode(context); renderGraph.addNode(opaqueObjectsNode, "opaqueObjectsNode"); renderGraph.connect(lastUpdatedGBufferClearingNode, opaqueObjectsNode); Node opaqueBlocksNode = new OpaqueBlocksNode(context); renderGraph.addNode(opaqueBlocksNode, "opaqueBlocksNode"); renderGraph.connect(lastUpdatedGBufferClearingNode, opaqueBlocksNode); Node alphaRejectBlocksNode = new AlphaRejectBlocksNode(context); renderGraph.addNode(alphaRejectBlocksNode, "alphaRejectBlocksNode"); renderGraph.connect(lastUpdatedGBufferClearingNode, alphaRejectBlocksNode); Node overlaysNode = new OverlaysNode(context); renderGraph.addNode(overlaysNode, "overlaysNode"); renderGraph.connect(lastUpdatedGBufferClearingNode, overlaysNode); }