auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public static NameMetadataDescription create(List<NameComponentDescription> components, int numberOfComponentsHashed) { <END> if (numberOfComponentsHashed == 0) { return new NameMetadataDescription(components, numberOfComponentsHashed); } else { List<NameComponentDescription> withHashRowComponent = Lists.newArrayListWithCapacity(components.size() + 1); withHashRowComponent.add(new NameComponentDescription.Builder() .componentName(HASH_ROW_COMPONENT_NAME) .type(ValueType.FIXED_LONG) .build()); withHashRowComponent.addAll(components); return new NameMetadataDescription(withHashRowComponent, numberOfComponentsHashed); } }</code><technical_language>deprecate constructor add new constructor prevent a dev break</technical_language>

Target:
public static NameMetadataDescription create(List<NameComponentDescription> components, int numberOfComponentsHashed) { Preconditions.checkArgument(numberOfComponentsHashed <= components.size(), "Number of hashed components can't exceed total number of row components."); if (numberOfComponentsHashed == 0) { return new NameMetadataDescription(components, numberOfComponentsHashed); } else { List<NameComponentDescription> withHashRowComponent = Lists.newArrayListWithCapacity(components.size() + 1); withHashRowComponent.add(new NameComponentDescription.Builder() .componentName(HASH_ROW_COMPONENT_NAME) .type(ValueType.FIXED_LONG) .build()); withHashRowComponent.addAll(components); return new NameMetadataDescription(withHashRowComponent, numberOfComponentsHashed); } }
Source:
<code>public void deserializes(@Observes ReadyToExecuteMethod event, HttpServletRequest request, MethodInfo methodInfo, Status status) throws IOException { ControllerMethod method = event.getControllerMethod(); if (!method.containsAnnotation(Consumes.class)) return; List<String> supported = asList(method.getMethod().getAnnotation(Consumes.class).value()); String contentType = mime(request.getContentType()); if (!supported.isEmpty() && !supported.contains(contentType)) { unsupported("Request with media type [%s]. Expecting one of %s.", status, contentType, supported); return; } Deserializer deserializer = deserializers.deserializerFor(contentType, container); if (deserializer == null) { unsupported("Unable to handle media type [%s]: no deserializer found.", status, contentType); return; } Object[] deserialized = deserializer.deserialize(request.getInputStream(), method); ValuedParameter[] parameters = methodInfo.getValuedParameters(); logger.debug("Deserialized parameters for are ", method, deserialized); for (int i = 0; i < deserialized.length; i++) { if (deserialized[i] != null) { <START> parameters[i].setValue(deserialized[i]); <END> } } }</code><technical_language>put this invocation in method info. methodInfo.setParameter(i, deserialized[i]);</technical_language>

Target:
public void deserializes(@Observes ReadyToExecuteMethod event, HttpServletRequest request, MethodInfo methodInfo, Status status) throws IOException { ControllerMethod method = event.getControllerMethod(); if (!method.containsAnnotation(Consumes.class)) return; List<String> supported = asList(method.getMethod().getAnnotation(Consumes.class).value()); String contentType = mime(request.getContentType()); if (!supported.isEmpty() && !supported.contains(contentType)) { unsupported("Request with media type [%s]. Expecting one of %s.", status, contentType, supported); return; } Deserializer deserializer = deserializers.deserializerFor(contentType, container); if (deserializer == null) { unsupported("Unable to handle media type [%s]: no deserializer found.", status, contentType); return; } Object[] deserialized = deserializer.deserialize(request.getInputStream(), method); logger.debug("Deserialized parameters for are ", method, deserialized); for (int i = 0; i < deserialized.length; i++) { if (deserialized[i] != null) { methodInfo.setParameter(i, deserialized[i]); } } }
Source:
<code>public void testClasspathConfiguration() throws Exception { ClasspathPropertiesConfiguration.initialize(); assertEquals("10", ConfigurationManager.getConfigInstance().getString("standaloneConfigProperty")); assertEquals("11", ConfigurationManager.getConfigInstance().getString("jarConfigProperty")); ClasspathPropertiesConfiguration.setPropertiesResourceRelativePath("non-existent/conf/bluh"); try { <START> ClasspathPropertiesConfiguration.initialize(); <END> } catch (Exception e) { assertEquals("Cannot locate non-existent/conf/bluh as a classpath resource.", e.getCause().getMessage()); } }</code><technical_language>another assertion cover case if exception is thrown, fail("exception expected");</technical_language>

Target:
public void testClasspathConfiguration() throws Exception { ClasspathPropertiesConfiguration.initialize(); assertEquals("10", ConfigurationManager.getConfigInstance().getString("standaloneConfigProperty")); assertEquals("11", ConfigurationManager.getConfigInstance().getString("jarConfigProperty")); ClasspathPropertiesConfiguration.setPropertiesResourceRelativePath("non-existent/conf/bluh"); try { ClasspathPropertiesConfiguration.initialize(); fail("exception expected"); } catch (Exception e) { assertEquals("Cannot locate non-existent/conf/bluh as a classpath resource.", e.getCause().getMessage()); } }
Source:
<code>public void multiIndex_incompatibleAnalyzer_overrideAnalyzer() { StubMappingSearchScope scope = indexManager.createSearchScope( incompatibleAnalyzerIndexManager ); String absoluteFieldPath = indexMapping.analyzedStringField1.relativeFieldName; IndexSearchQuery<DocumentReference> query = scope.query().asReference() .predicate( f -> f.simpleQueryString().onField( absoluteFieldPath ).matching( TERM_5 ) .analyzer( OverrideAnalysisDefinitions.ANALYZER_WHITESPACE_LOWERCASE.name ) ) .toQuery(); <START> assertThat( query ).assertThat( query ).hasDocRefHitsAnyOrder( b -> { <END> b.doc( INDEX_NAME, DOCUMENT_1 ); b.doc( INCOMPATIBLE_ANALYZER_INDEX_NAME, INCOMPATIBLE_ANALYZER_INDEX_DOCUMENT_1 ); } ); }</code><technical_language>assertThat( query ).assertThat( query )</technical_language>

Target:
public void multiIndex_incompatibleAnalyzer_overrideAnalyzer() { StubMappingSearchScope scope = indexManager.createSearchScope( incompatibleAnalyzerIndexManager ); String absoluteFieldPath = indexMapping.analyzedStringField1.relativeFieldName; IndexSearchQuery<DocumentReference> query = scope.query().asReference() .predicate( f -> f.simpleQueryString().onField( absoluteFieldPath ).matching( TERM_5 ) .analyzer( OverrideAnalysisDefinitions.ANALYZER_WHITESPACE_LOWERCASE.name ) ) .toQuery(); assertThat( query ).hasDocRefHitsAnyOrder( b -> { b.doc( INDEX_NAME, DOCUMENT_1 ); b.doc( INCOMPATIBLE_ANALYZER_INDEX_NAME, INCOMPATIBLE_ANALYZER_INDEX_DOCUMENT_1 ); } ); }
Source:
<code>private void handleException(Thread thread, Throwable exception) { if (exception instanceof Error) { LOG.log(Level.SEVERE, "Error caught in thread: " + thread.getName() <START> + " with thread id: " + thread.getId() + ". Process halting..."); <END> Runtime.getRuntime().halt(1); } LOG.log(Level.SEVERE, String.format("Exception caught in thread: %s with id: %d", thread.getName(), thread.getId()), exception); final CountDownLatch exited = new CountDownLatch(1); final ExecutorService exitExecutor = Executors.newSingleThreadExecutor(); exitExecutor.execute(new ForceExitTask(exited, systemConfig.getInstanceForceExitTimeout())); if (thread.getName().equals(ThreadNames.THREAD_SLAVE_NAME)) { new SlaveExitTask().run(); gatewayLooper.exitLoop(); } else { new GatewayExitTask().run(); } exited.countDown(); }</code><technical_language>a clarification, this change basically log actual message error happens. OOM error</technical_language>

Target:
private void handleException(Thread thread, Throwable exception) { if (exception instanceof Error) { try { LOG.log(Level.SEVERE, "Error caught in thread: " + thread.getName() + " with thread id: " + thread.getId() + ". Process halting...", exception); } finally { Runtime.getRuntime().halt(1); } } LOG.log(Level.SEVERE, String.format("Exception caught in thread: %s with id: %d", thread.getName(), thread.getId()), exception); final CountDownLatch exited = new CountDownLatch(1); final ExecutorService exitExecutor = Executors.newSingleThreadExecutor(); exitExecutor.execute(new ForceExitTask(exited, systemConfig.getInstanceForceExitTimeout())); if (thread.getName().equals(ThreadNames.THREAD_SLAVE_NAME)) { new SlaveExitTask().run(); gatewayLooper.exitLoop(); } else { new GatewayExitTask().run(); } exited.countDown(); }
Source:
<code>public void addVirtioScsiController(VmBase vm, Version version) { boolean hasIoThreads = vm.getNumOfIoThreads() > 0 && FeatureSupported.virtioScsiIoThread(version); int <START> scsiControllers = <END> hasIoThreads ? vm.getNumOfIoThreads() : 1; for (int i = 0; i < scsiControllers; i++) { Map<String, Object> specParams = new HashMap<>(); if (hasIoThreads) { specParams.put(VdsProperties.ioThreadId, i); } VmDevice device = addManagedDevice( new VmDeviceId(Guid.newGuid(), vm.getId()), VmDeviceGeneralType.CONTROLLER, VmDeviceType.VIRTIOSCSI, specParams, true, false); } }</code><technical_language>please rename numOfScsiControllers</technical_language>

Target:
public void addVirtioScsiController(VmBase vm, Version version) { boolean hasIoThreads = vm.getNumOfIoThreads() > 0 && FeatureSupported.virtioScsiIoThread(version); int numOfScsiControllers = hasIoThreads ? vm.getNumOfIoThreads() : 1; for (int i = 0; i < numOfScsiControllers; i++) { Map<String, Object> specParams = new HashMap<>(); if (hasIoThreads) { specParams.put(VdsProperties.ioThreadId, i); } VmDevice device = addManagedDevice( new VmDeviceId(Guid.newGuid(), vm.getId()), VmDeviceGeneralType.CONTROLLER, VmDeviceType.VIRTIOSCSI, specParams, true, false); } }
Source:
<code>protected boolean hasDataAvailable() { <START> return mFollowersWPCOM != null && mFollowersEmail != null; <END> }</code><technical_language>this compared || instead of &&</technical_language>

Target:
protected boolean hasDataAvailable() { return mFollowersWPCOM != null || mFollowersEmail != null; }
Source:
<code>private MethodHandle findBuilderSetter(final Class<?> builderClass, String name, Type type) throws IllegalAccessException, NoSuchMethodException { final NoSuchMethodException failure; try { <START> return MethodHandles.lookup().unreflect(builderClass.getMethod(name, GenericTypes.getErasedType(type))); <END> } catch (NoSuchMethodException e) { failure = e; } for (Method m : builderClass.getMethods()) { if (m.getName().equals(name) && m.getParameterCount() == 1) { return MethodHandles.lookup().unreflect(m); } } throw failure; }</code><technical_language>Similar getters, fall setName() method if name() setter found</technical_language>

Target:
private MethodHandle findBuilderSetter(final Class<?> builderClass, String name, Type type) throws IllegalAccessException, NoSuchMethodException { final List<NoSuchMethodException> failures = new ArrayList<>(); final String setName = "set" + name.substring(0, 1).toUpperCase() + name.substring(1); final Set<String> names = new HashSet<>(Arrays.asList(setName, name)); for (String tryName : names) { try { return MethodHandles.lookup().unreflect(builderClass.getMethod(tryName, GenericTypes.getErasedType(type))); } catch (NoSuchMethodException e) { failures.add(e); } } for (Method m : builderClass.getMethods()) { if (names.contains(m.getName()) && m.getParameterCount() == 1) { return MethodHandles.lookup().unreflect(m); } } final IllegalArgumentException iae = new IllegalArgumentException("Failed to find builder setter for property " + name + " of " + type); failures.forEach(iae::addSuppressed); throw iae; }
Source:
<code><START> public SolenoidSubsystem( DoubleSolenoid... solenoids) { <END> this(false, solenoids); }</code><technical_language>format: remove extra space</technical_language>

Target:
public SolenoidSubsystem(DoubleSolenoid... solenoids) { this("SolenoidSubsystem", solenoids); }
Source:
<code>public boolean deleteEndpointForTenant(String endpointName, String tenantDomain) throws EndpointAdminException { try { PrivilegedCarbonContext.startTenantFlow(); PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomain, true); boolean status = deleteEndpoint(endpointName); <START> return status; <END> } finally { PrivilegedCarbonContext.endTenantFlow(); } }</code><technical_language>remove status variable calling "return deleteEndpoint(endpointName);"</technical_language>

Target:
public boolean deleteEndpointForTenant(String endpointName, String tenantDomain) throws EndpointAdminException { try { PrivilegedCarbonContext.startTenantFlow(); PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomain, true); return deleteEndpoint(endpointName); } finally { PrivilegedCarbonContext.endTenantFlow(); } }
Source:
<code>public void onTestStart(ITestResult result) { super.onTestStart(result); <START> if (!isLocal) { <END> if (result.getInstance() instanceof SauceOnDemandSessionIdProvider) { this.sessionIdProvider = (SauceOnDemandSessionIdProvider) result.getInstance(); if (sessionIdProvider.getSessionId() != null) { System.out.println(String.format("SauceOnDemandSessionID=%1$s job-name=%2$s", sessionIdProvider.getSessionId(), result.getMethod().getMethodName())); } } SauceOnDemandAuthentication sauceOnDemandAuthentication; if (result.getInstance() instanceof SauceOnDemandAuthenticationProvider) { SauceOnDemandAuthenticationProvider provider = (SauceOnDemandAuthenticationProvider) result.getInstance(); sauceOnDemandAuthentication = provider.getAuthentication(); } else { sauceOnDemandAuthentication = new SauceOnDemandAuthentication(); } this.sauceREST = new SauceREST(sauceOnDemandAuthentication.getUsername(), sauceOnDemandAuthentication.getAccessKey()); } }</code><technical_language>cleaner if changed this if (local) { early return</technical_language>

Target:
public void onTestStart(ITestResult result) { super.onTestStart(result); if (isLocal) { return; } if (result.getInstance() instanceof SauceOnDemandSessionIdProvider) { this.sessionIdProvider = (SauceOnDemandSessionIdProvider) result.getInstance(); if (sessionIdProvider.getSessionId() != null) { System.out.println(String.format("SauceOnDemandSessionID=%1$s job-name=%2$s", sessionIdProvider.getSessionId(), result.getMethod().getMethodName())); } } SauceOnDemandAuthentication sauceOnDemandAuthentication; if (result.getInstance() instanceof SauceOnDemandAuthenticationProvider) { SauceOnDemandAuthenticationProvider provider = (SauceOnDemandAuthenticationProvider) result.getInstance(); sauceOnDemandAuthentication = provider.getAuthentication(); } else { sauceOnDemandAuthentication = new SauceOnDemandAuthentication(); } this.sauceREST = new SauceREST(sauceOnDemandAuthentication.getUsername(), sauceOnDemandAuthentication.getAccessKey()); }
Source:
<code>public void setUp() throws IOException { final Registry registry = Mockito.mock(Registry.class); this.initialSetupTask = new InitialSetupTask(registry); <START> this.temporaryTestDirectory = Files.createTempDirectory(InitialSetupTaskUnitTest.class.getSimpleName() + "-"); <END> }</code><technical_language>Is a reason [this](<LINK_0></technical_language>

Target:
public void setUp() throws IOException { final Registry registry = Mockito.mock(Registry.class); this.initialSetupTask = new InitialSetupTask(registry); }
Source:
<code>public void testParsePointSymbolizerRelativeURL() throws Exception { PointSymbolizer sym = (PointSymbolizer) parse("example-pointsymbolizer6.xml"); assertEquals("MyPointSymbolizer", sym.getName()); assertEquals("Example Pointsymbolizer", sym.getDescription().getTitle().toString()); assertEquals( "This is just a simple example of a point symbolizer.", sym.getDescription().getAbstract().toString()); Graphic g = sym.getGraphic(); assertEquals(15.0, g.getSize().evaluate(null, Double.class)); assertEquals(1, g.getExternalGraphics().length); <START> ExternalGraphic eg = g.getExternalGraphics()[0]; <END> assertEquals("inlineContent-image.png", eg.getURI().toString()); assertEquals("image/png", eg.getFormat()); }</code><technical_language>This is a call a deprecated API, please avoid (the build fail deprecated API call is used, deprecation branch is merged)</technical_language>

Target:
public void testParsePointSymbolizerRelativeURL() throws Exception { SEConfiguration se = new SEConfiguration() { @Override protected void configureContext(MutablePicoContainer container) { super.configureContext(container); DefaultResourceLocator locator = (DefaultResourceLocator) container.getComponentInstance(ResourceLocator.class); try { locator.setSourceUrl(new URL("<LINK_4>")); } catch (MalformedURLException e) { } } }; Parser p = new Parser(se); PointSymbolizer sym = (PointSymbolizer) p.parse(getClass().getResourceAsStream("example-pointsymbolizer6.xml")); assertEquals("MyPointSymbolizer", sym.getName()); assertEquals("Example Pointsymbolizer", sym.getDescription().getTitle().toString()); assertEquals( "This is just a simple example of a point symbolizer.", sym.getDescription().getAbstract().toString()); Graphic g = sym.getGraphic(); assertEquals(15.0, g.getSize().evaluate(null, Double.class)); assertEquals(1, g.graphicalSymbols().size()); ExternalGraphic eg = (ExternalGraphic) g.graphicalSymbols().get(0); assertEquals("<LINK_4>inlineContent-image.png", eg.getURI().toString()); assertEquals("image/png", eg.getFormat()); }
Source:
<code>public void testCreationalAndDisposalMethods() { Bean<Skeleton> skeletonBean = getUniqueBean(Skeleton.class, Undead.UndeadLiteral.INSTANCE); CreationalContext<Skeleton> skeletonCreationalContext = getCurrentManager().createCreationalContext(skeletonBean); Skeleton skeleton = skeletonBean.create(skeletonCreationalContext); Bean<Zombie> zombieBean = getUniqueBean(Zombie.class, Undead.UndeadLiteral.INSTANCE, Dangerous.DangerousLiteral.INSTANCE); CreationalContext<Zombie> zombieCreationalContext = getCurrentManager().createCreationalContext(zombieBean); Zombie zombie = zombieBean.create(zombieCreationalContext); Bean<Ghost> ghostBean = getUniqueBean(Ghost.class, Undead.UndeadLiteral.INSTANCE); CreationalContext<Ghost> ghostCreationalContext = getCurrentManager().createCreationalContext(ghostBean); Ghost ghost = ghostBean.create(ghostCreationalContext); Bean<Vampire> vampireBean = getUniqueBean(Vampire.class, Undead.UndeadLiteral.INSTANCE); CreationalContext<Vampire> vampireCreationalContext = getCurrentManager().createCreationalContext(vampireBean); <START> Vampire vampire = vampireBean.create(vampireCreationalContext); <END> assertTrue(MonsterController.skeletonProducerCalled); assertTrue(MonsterController.zombieProducerCalled); assertTrue(MonsterController.ghostInstanceObtained); assertTrue(MonsterController.vampireInstanceCreated); skeletonBean.destroy(skeleton, skeletonCreationalContext); zombieBean.destroy(zombie, zombieCreationalContext); assertTrue(MonsterController.zombieKilled); assertTrue(MonsterController.skeletonKilled); }</code><technical_language>3 lines reused in some private helper method instead of repeating for type</technical_language>

Target:
public void testCreationalAndDisposalMethods() { Bean<Skeleton> skeletonBean = getUniqueBean(Skeleton.class, Undead.UndeadLiteral.INSTANCE); CreationalContext<Skeleton> skeletonCreationalContext = getCurrentManager().createCreationalContext(skeletonBean); Skeleton skeleton = skeletonBean.create(skeletonCreationalContext); Bean<Zombie> zombieBean = getUniqueBean(Zombie.class, Undead.UndeadLiteral.INSTANCE, Dangerous.DangerousLiteral.INSTANCE); CreationalContext<Zombie> zombieCreationalContext = getCurrentManager().createCreationalContext(zombieBean); Zombie zombie = zombieBean.create(zombieCreationalContext); spawnMonster(Ghost.class, Undead.UndeadLiteral.INSTANCE); spawnMonster(Vampire.class, Undead.UndeadLiteral.INSTANCE); assertTrue(MonsterController.skeletonProducerCalled); assertTrue(MonsterController.zombieProducerCalled); assertTrue(MonsterController.ghostInstanceObtained); assertTrue(MonsterController.vampireInstanceCreated); skeletonBean.destroy(skeleton, skeletonCreationalContext); zombieBean.destroy(zombie, zombieCreationalContext); assertTrue(MonsterController.zombieKilled); assertTrue(MonsterController.skeletonKilled); }
Source:
<code>protected String getBuildAuthorName() { <START> try { <END> return runGitCommand(canonical, "config --get user.name"); } catch (NativeCommandException e) { if (e.getExitCode() == 1) { return ""; } throw Throwables.propagate(e); } }</code><technical_language>ok I hm... sure</technical_language>

Target:
protected String getBuildAuthorName() throws GitCommitIdExecutionException { try { return runGitCommand(canonical, "config --get user.name"); } catch (NativeCommandException e) { if (e.getExitCode() == 1) { return ""; } throw Throwables.propagate(e); } }
Source:
<code>public void should_run_eslint_based_rules() throws Exception { String sourceCode = "function foo() { try {" + " doSomething();" + "} catch (ex) {" + " throw ex;" + "}}"; List<Issue> issues = analyze(FILE_PATH, sourceCode); assertThat(issues).extracting(Issue::getRuleKey).containsExactly("javascript:S2737"); issues = analyze(FILE_PATH, sourceCode); assertThat(issues).extracting(Issue::getRuleKey).containsExactly("javascript:S2737"); <START> assertThat(logs).contains("Node.js process is already started, no need to start."); <END> }</code><technical_language>more precise here, process is started</technical_language>

Target:
public void should_run_eslint_based_rules() throws Exception { String sourceCode = "function foo() { try {" + " doSomething();" + "} catch (ex) {" + " throw ex;" + "}}"; List<Issue> issues = analyze(FILE_PATH, sourceCode); assertThat(issues).extracting(Issue::getRuleKey).containsExactly("javascript:S2737"); issues = analyze(FILE_PATH, sourceCode); assertThat(issues).extracting(Issue::getRuleKey).containsExactly("javascript:S2737"); assertThat(logs).contains("SonarJS eslint-bridge server is up, no need to start."); }
Source:
<code>public boolean visitTree(VisitContext context, VisitCallback callback) { if (!isVisitable(context)) return false; FacesContext facesContext = context.getFacesContext(); pushComponentToEL(facesContext, null); try { VisitResult result = context.invokeVisitCallback(this, callback); if (result == VisitResult.COMPLETE) return true; if (result == VisitResult.ACCEPT) { <START> Iterator<UIComponent> kids = this.getKids(context); <END> while(kids.hasNext()) { boolean done = kids.next().visitTree(context, callback); if (done) return true; } } } finally { popComponentFromEL(facesContext); } return false; }</code><technical_language>naming of method getKids is unfortunate is descriptive</technical_language>

Target:
public boolean visitTree(VisitContext context, VisitCallback callback) { if (!isVisitable(context)) return false; FacesContext facesContext = context.getFacesContext(); pushComponentToEL(facesContext, null); try { VisitResult result = context.invokeVisitCallback(this, callback); if (result == VisitResult.COMPLETE) return true; if (result == VisitResult.ACCEPT) { Iterator<UIComponent> kids = AbstractTab.getVisitableChildren(this, context); while(kids.hasNext()) { boolean done = kids.next().visitTree(context, callback); if (done) return true; } } } finally { popComponentFromEL(facesContext); } return false; }
Source:
<code>public void addressesInHeadersAddedWithoutSlashes() throws IOException { final Socket socket = BkBasicTest.createMockSocket(); <START> final AtomicReference<Request> ref = new AtomicReference<Request>(); <END> new BkBasic( new Take() { @Override public Response act(final Request req) { ref.set(req); return new RsEmpty(); } } ).accept(socket); final Request request = ref.get(); MatcherAssert.assertThat( request, Matchers.is( Matchers.notNullValue() ) ); MatcherAssert.assertThat( request, Matchers.is( Matchers.instanceOf( RqWithHeaders.class ) ) ); final Collection<String> head = Lists.newArrayList(request.head()); MatcherAssert.assertThat(head, Matchers.not(Matchers.<String>empty())); final Collection<String> found = Collections2.filter( head, new Predicate<String>() { @Override public boolean apply(final String header) { return header.contains("X-Takes") && header.contains("Address"); } } ); for (final String header : found) { MatcherAssert.assertThat( header, Matchers.not( Matchers.containsString("/") ) ); } MatcherAssert.assertThat( new RqSocket(request).getLocalAddress(), Matchers.notNullValue() ); MatcherAssert.assertThat( new RqSocket(request).getRemoteAddress(), Matchers.notNullValue() ); }</code><technical_language>@alexey-krylov do need AtomicReference here? BkBasic threads I</technical_language>

Target:
public void addressesInHeadersAddedWithoutSlashes() throws IOException { final Socket socket = BkBasicTest.createMockSocket(); final AtomicReference<Request> ref = new AtomicReference<Request>(); new BkBasic( new Take() { @Override public Response act(final Request req) { ref.set(req); return new RsEmpty(); } } ).accept(socket); final Request request = ref.get(); final RqHeaders.Smart smart = new RqHeaders.Smart( new RqHeaders.Base(request) ); MatcherAssert.assertThat( smart.single( "X-Takes-LocalAddress", "" ), Matchers.not( Matchers.containsString("/") ) ); MatcherAssert.assertThat( smart.single( "X-Takes-RemoteAddress", "" ), Matchers.not( Matchers.containsString("/") ) ); MatcherAssert.assertThat( new RqSocket(request).getLocalAddress(), Matchers.notNullValue() ); MatcherAssert.assertThat( new RqSocket(request).getRemoteAddress(), Matchers.notNullValue() ); }
Source:
<code>public void checkCanSetUser(Principal principal, String userName) { <START> if (principal == null) { <END> return; } String principalName = principal.getName(); if (usernameExtractionRules.isEmpty()) { return; } for (Pattern pattern : usernameExtractionRules) { Matcher matcher = pattern.matcher(principalName); while (matcher.find()) { for (int i = 1; i <= matcher.groupCount(); i++) { String extractedUsername = matcher.group(i); if (userName.equals(extractedUsername)) { return; } } } } denySetUser(principal, userName); }</code><technical_language>so. deny usernameExtractionRules is empty</technical_language>

Target:
public void checkCanSetUser(Principal principal, String userName) { if (userPatterns.isEmpty()) { return; } if (principal == null) { denySetUser(principal, userName); } String principalName = principal.getName(); for (Pattern pattern : userPatterns) { Matcher matcher = pattern.matcher(principalName); if (matcher.matches()) { for (int i = 1; i <= matcher.groupCount(); i++) { String extractedUsername = matcher.group(i); if (userName.equals(extractedUsername)) { return; } } } } denySetUser(principal, userName); }
Source:
<code>private Label getHostJavaToolchain() { <START> if (useRemoteHostJavaToolchain) { <END> return Label.parseAbsoluteUnchecked("@bazel_tools } return hostJavaToolchain; }</code><technical_language>default</technical_language>

Target:
private Label getHostJavaToolchain() { if (hostJavaToolchain == null) { if (useRemoteHostJavaToolchain) { return Label.parseAbsoluteUnchecked("@bazel_tools } else { return Label.parseAbsoluteUnchecked("@bazel_tools } } return hostJavaToolchain; }
Source:
<code>public void test() throws Exception { connect(); sleep(1000); <START> Assert.assertEquals("au working", getZKLog()); <END> }</code><technical_language>test success in versions</technical_language>

Target:
public void test() throws Exception { connect(); sleep(1000); Assert.assertEquals("onPageSize", getZKLog()); }
Source:
<code>protected RevisionListViewImpl(GitResources resources, GitLocalizationConstant locale, DateTimeFormatter dateTimeFormatter, org.eclipse.che.ide.Resources coreRes) { this.res = resources; this.locale = locale; this.dateTimeFormatter = dateTimeFormatter; this.ensureDebugId("git-compare-revision-window"); <START> Widget widget = ourUiBinder.createAndBindUi(this); <END> this.setTitle(locale.compareWithRevisionTitle()); this.setWidget(widget); description.setReadOnly(true); createRevisionsTable(coreRes); createButtons(); }</code><technical_language>ourUiBinder named prefix our? myUiBinder, hisUiBinder theirUiBinder? not? :smile:</technical_language>

Target:
protected RevisionListViewImpl(GitResources resources, GitLocalizationConstant locale, DateTimeFormatter dateTimeFormatter, org.eclipse.che.ide.Resources coreRes) { this.res = resources; this.locale = locale; this.dateTimeFormatter = dateTimeFormatter; this.ensureDebugId("git-compare-revision-window"); Widget widget = uiBinder.createAndBindUi(this); this.setTitle(locale.compareWithRevisionTitle()); this.setWidget(widget); description.setReadOnly(true); createRevisionsTable(coreRes); createButtons(); }
Source:
<code>private static Optional<Page> extractStatisticsRows(Page page) { int statisticsPositionCount = 0; for (int position = 0; position < page.getPositionCount(); position++) { if (isStatisticsPosition(page, position)) { statisticsPositionCount++; } } if (statisticsPositionCount == 0) { return Optional.empty(); } if (statisticsPositionCount == page.getPositionCount()) { return Optional.of(page); } int selectedPositionsIndex = 0; int[] selectedPositions = new int[statisticsPositionCount]; for (int position = 0; position < page.getPositionCount(); position++) { if (isStatisticsPosition(page, position)) { selectedPositions[selectedPositionsIndex] = position; selectedPositionsIndex++; } } Block[] blocks = new Block[page.getChannelCount()]; for (int channel = 0; channel < page.getChannelCount(); channel++) { <START> blocks[channel] = page.getBlock(channel).copyPositions(selectedPositions, 0, statisticsPositionCount); <END> } return Optional.of(new Page(statisticsPositionCount, blocks)); }</code><technical_language>- return page (few lines earlier), assumption do a copy. (no strong opinion either, opportunity simplify code)</technical_language>

Target:
private static Optional<Page> extractStatisticsRows(Page page) { int statisticsPositionCount = 0; for (int position = 0; position < page.getPositionCount(); position++) { if (isStatisticsPosition(page, position)) { statisticsPositionCount++; } } if (statisticsPositionCount == 0) { return Optional.empty(); } if (statisticsPositionCount == page.getPositionCount()) { return Optional.of(page); } int selectedPositionsIndex = 0; int[] selectedPositions = new int[statisticsPositionCount]; for (int position = 0; position < page.getPositionCount(); position++) { if (isStatisticsPosition(page, position)) { selectedPositions[selectedPositionsIndex] = position; selectedPositionsIndex++; } } Block[] blocks = new Block[page.getChannelCount()]; for (int channel = 0; channel < page.getChannelCount(); channel++) { blocks[channel] = page.getBlock(channel).getPositions(selectedPositions, 0, statisticsPositionCount); } return Optional.of(new Page(statisticsPositionCount, blocks)); }
Source:
<code>boolean sendMouseEvent (int type, int button, int count, int detail, boolean send, int time, double x, double y, boolean is_hint, int state) { if (!hooks (type) && !filters (type)) return true; Event event = new Event (); event.time = time; event.button = button; event.detail = detail; event.count = count; if (is_hint) { Rectangle eventRect = new Rectangle ((int)x, (int)y, 0, 0); event.setBounds (DPIUtil.autoScaleDown (eventRect)); } else { long window = eventWindow (); int origin_x = new int [1], origin_y = new int [1]; OS.gdk_window_get_origin (window, origin_x, origin_y); Rectangle eventRect = new Rectangle ((int)x - origin_x [0], (int)y - origin_y [0], 0, 0); event.setBounds (DPIUtil.autoScaleDown (eventRect)); } if ((style & SWT.MIRRORED) != 0) event.x = DPIUtil.autoScaleDown (getClientWidth ()) - event.x; setInputState (event, state); if (!OS.isX11()) { if (type == SWT.MouseDown) { dragDetectionQueue = new Event [4]; postDragEventQueue(type, event); <START> return event.doit; <END> } else { if (dragDetectionQueue != null) { if (type == SWT.MouseMove) { postDragEventQueue(type, event); if (dragDetect (event.x, event.y, false, true, null)) { sendEvent(dragDetectionQueue[0].type, dragDetectionQueue[0]); dragDetectionQueue = null; } } else if (type == SWT.MouseUp) { postDragEventQueue(type, event); runDeferredDragEvents(); } return event.doit; } } } if (send) { sendEvent (type, event); if (isDisposed ()) return false; } else { postEvent (type, event); } return event.doit; }</code><technical_language>I suggest condense this a single return</technical_language>

Target:
boolean sendMouseEvent (int type, int button, int count, int detail, boolean send, int time, double x, double y, boolean is_hint, int state) { if (!hooks (type) && !filters (type)) return true; Event event = new Event (); event.time = time; event.button = button; event.detail = detail; event.count = count; if (is_hint) { Rectangle eventRect = new Rectangle ((int)x, (int)y, 0, 0); event.setBounds (DPIUtil.autoScaleDown (eventRect)); } else { long window = eventWindow (); int origin_x = new int [1], origin_y = new int [1]; OS.gdk_window_get_origin (window, origin_x, origin_y); Rectangle eventRect = new Rectangle ((int)x - origin_x [0], (int)y - origin_y [0], 0, 0); event.setBounds (DPIUtil.autoScaleDown (eventRect)); } if ((style & SWT.MIRRORED) != 0) event.x = DPIUtil.autoScaleDown (getClientWidth ()) - event.x; setInputState (event, state); if (!OS.isX11()) { if (type == SWT.MouseDown) { dragDetectionQueue = new LinkedList<>(); postDragEventQueue(type, event); return event.doit; } else { if (dragDetectionQueue != null) { if (type == SWT.MouseMove) { postDragEventQueue(type, event); if (dragDetect (event.x, event.y, false, true, null)) { sendEvent(dragDetectionQueue.getFirst().type, dragDetectionQueue.getFirst()); dragDetectionQueue = null; } } else if (type == SWT.MouseUp) { postDragEventQueue(type, event); runDeferredDragEvents(); } return event.doit; } } } if (send) { sendEvent (type, event); if (isDisposed ()) return false; } else { postEvent (type, event); } return event.doit; }
Source:
<code>public String toString() { final StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append("EJBClientCluster(name="); stringBuffer.append(name); stringBuffer.append(", max nodes="); stringBuffer.append(maximumConnectedNodes); stringBuffer.append(", connect timeout milis="); stringBuffer.append(connectTimeoutMilliseconds); stringBuffer.append("selector="); <START> stringBuffer.append(clusterNodeSelector); <END> stringBuffer.append(", override config="); stringBuffer.append(overrideConfiguration); stringBuffer.append(")"); return stringBuffer.toString(); }</code><technical_language>", selector=" for formatting</technical_language>

Target:
public String toString() { final StringBuilder builder = new StringBuilder(); builder.append("EJBClientCluster(name="); builder.append(name); builder.append(", max nodes="); builder.append(maximumConnectedNodes); builder.append(", connect timeout milis="); builder.append(connectTimeoutMilliseconds); builder.append(", selector="); builder.append(clusterNodeSelector); builder.append(", override config="); builder.append(overrideConfiguration); builder.append(")"); return builder.toString(); }
Source:
<code>public void putDirectory(final String rawPath, final boolean recursive, final MantaHttpHeaders headers) throws IOException { if (!recursive) { putDirectory(rawPath, headers); return; } final Integer skipDepth = config.getSkipDirectoryDepth(); final RecursiveDirectoryCreationStrategy directoryCreationStrategy; if (skipDepth != null && 0 < skipDepth) { <START> directoryCreationStrategy = new DepthSkippingDirectoryCreationStrategy(this, skipDepth); <END> } else { directoryCreationStrategy = new PessimisticDirectoryCreationStrategy(this); } putDirectory(rawPath, headers, directoryCreationStrategy); }</code><technical_language>Is a author strategy need create a new object put operation</technical_language>

Target:
public void putDirectory(final String rawPath, final boolean recursive, final MantaHttpHeaders headers) throws IOException { if (!recursive) { putDirectory(rawPath, headers); return; } final Integer skipDepth = config.getSkipDirectoryDepth(); if (skipDepth != null && 0 < skipDepth) { RecursiveDirectoryCreationStrategy.createWithSkipDepth(this, rawPath, headers, skipDepth); } else { RecursiveDirectoryCreationStrategy.createCompletely(this, rawPath, headers); } }
Source:
<code>private List<String> toFilterList(Resource list) { List<String> result = new ArrayList<>(); Resource current = list; while (current != null && ! current.equals(RDF.nil)){ Statement stmt = current.getProperty(RDF.first); if (stmt == null) { throw new TextIndexException("filter list not well formed"); } RDFNode node = stmt.getObject(); if (! node.isResource()) { throw new TextIndexException("filter is not a resource : " + node); } <START> Resource res = (Resource)node; <END> result.add(res.getLocalName()); stmt = current.getProperty(RDF.rest); if (stmt == null) { throw new TextIndexException("filter list not terminated by rdf:nil"); } node = stmt.getObject(); if (! node.isResource()) { throw new TextIndexException("filter list node is not a resource : " + node); } current = (Resource) node; } return result; }</code><technical_language>Node::asResource a below</technical_language>

Target:
private List<String> toFilterList(Resource list) { List<String> result = new ArrayList<>(); Resource current = list; while (current != null && ! current.equals(RDF.nil)){ Statement stmt = current.getProperty(RDF.first); if (stmt == null) { throw new TextIndexException("filter list not well formed"); } RDFNode node = stmt.getObject(); if (! node.isResource()) { throw new TextIndexException("filter is not a resource : " + node); } result.add(node.asResource().getLocalName()); stmt = current.getProperty(RDF.rest); if (stmt == null) { throw new TextIndexException("filter list not terminated by rdf:nil"); } node = stmt.getObject(); if (! node.isResource()) { throw new TextIndexException("filter list node is not a resource : " + node); } current = node.asResource(); } return result; }
Source:
<code>public void visit(LayoutModel<N, P> layoutModel) { super.visit(layoutModel); <START> this.m_currentPoint = pointModel.newPoint(0, 0); <END> buildTree(layoutModel); }</code><technical_language>missing something, this assignment effect, immediately overwritten buildTree() call, remove it. Pushing this farther: clear want a currentPoint instance field. changes: (1) change buildTree overload arguments argument is current point (not X coordinate) (2) add a P argument setCurrentPositionFor() pass current point need this piece of class-level state all, a better/more robust design</technical_language>

Target:
public void visit(LayoutModel<N, P> layoutModel) { super.visit(layoutModel); buildTree(layoutModel); }
Source:
<code>public RootCauseMetricResource(ExecutorService executor, AggregationLoader aggregationLoader, TimeSeriesLoader timeSeriesLoader, MetricConfigManager metricDAO, DatasetConfigManager datasetDAO, EventManager eventDAO, MergedAnomalyResultManager anomalyDAO, EvaluationManager evaluationDAO) { this.executor = executor; this.aggregationLoader = aggregationLoader; this.timeSeriesLoader = timeSeriesLoader; this.metricDAO = metricDAO; this.datasetDAO = datasetDAO; this.eventDAO = eventDAO; this.anomalyDAO = anomalyDAO; this.evaluationDAO = evaluationDAO; <START> this.loader = new DetectionPipelineLoader(); <END> TimeSeriesLoader timeseriesLoader = new DefaultTimeSeriesLoader(metricDAO, datasetDAO, ThirdEyeCacheRegistry.getInstance().getQueryCache(), ThirdEyeCacheRegistry.getInstance().getTimeSeriesCache()); this.dataProvider = new DefaultDataProvider(metricDAO, datasetDAO, eventDAO, anomalyDAO, evaluationDAO, timeseriesLoader, aggregationLoader, loader, TimeSeriesCacheBuilder.getInstance(), AnomaliesCacheBuilder.getInstance()); }</code><technical_language>is this anywhere? if I remove it</technical_language>

Target:
public RootCauseMetricResource(ExecutorService executor, AggregationLoader aggregationLoader, TimeSeriesLoader timeSeriesLoader, MetricConfigManager metricDAO, DatasetConfigManager datasetDAO, EventManager eventDAO, MergedAnomalyResultManager anomalyDAO, EvaluationManager evaluationDAO) { this.executor = executor; this.aggregationLoader = aggregationLoader; this.timeSeriesLoader = timeSeriesLoader; this.metricDAO = metricDAO; this.datasetDAO = datasetDAO; TimeSeriesLoader timeseriesLoader = new DefaultTimeSeriesLoader(metricDAO, datasetDAO, ThirdEyeCacheRegistry.getInstance().getQueryCache(), ThirdEyeCacheRegistry.getInstance().getTimeSeriesCache()); this.dataProvider = new DefaultDataProvider(metricDAO, datasetDAO, eventDAO, anomalyDAO, evaluationDAO, timeseriesLoader, aggregationLoader, new DetectionPipelineLoader(), TimeSeriesCacheBuilder.getInstance(), AnomaliesCacheBuilder.getInstance()); }
Source:
<code>public void seekTo(long position, @MediaPlayer2.SeekMode int mode) { mPlayer.setSeekParameters(ExoPlayerUtils.getSeekParameters(mode)); MediaItem2 mediaItem2 = mMediaItemQueue.getCurrentMediaItem(); if (mediaItem2 != null) { <START> if (mediaItem2.getStartPosition() > position || mediaItem2.getEndPosition() < position) { throw new IllegalArgumentException( "Requested seek position is out of range : " + position); } <END> position -= mediaItem2.getStartPosition(); } mPlayer.seekTo(position); }</code><technical_language>Optional suggestion: Preconditions.checkArgument shorter</technical_language>

Target:
public void seekTo(long position, @MediaPlayer2.SeekMode int mode) { mPlayer.setSeekParameters(ExoPlayerUtils.getSeekParameters(mode)); MediaItem2 mediaItem2 = mMediaItemQueue.getCurrentMediaItem(); if (mediaItem2 != null) { Preconditions.checkArgument( mediaItem2.getStartPosition() <= position && mediaItem2.getEndPosition() >= position, "Requested seek position is out of range : " + position); position -= mediaItem2.getStartPosition(); } mPlayer.seekTo(position); }
Source:
<code>void reactOnTopologyChange() { if (null == topologyChangeSubscription) { return; } final ZkSubscriptionClient.Topology topology = topologyChangeSubscription.getData(); final Partition[] assignedPartitions = Stream.of(topology.getPartitions()) .filter(p -> getSessionId().equals(p.getSession())) .toArray(Partition[]::new); addTask(() -> refreshTopologyUnlocked(assignedPartitions)); trackIdleness(topology); <START> if (!streamInitialized) { <END> refreshTopologyUnlocked(assignedPartitions); } }</code><technical_language>elaborate want do it? I previous lines 442: addTask(() -> refreshTopologyUnlocked(assignedPartitions)); scheduled for execution</technical_language>

Target:
void reactOnTopologyChange() { if (null == topologyChangeSubscription) { return; } final ZkSubscriptionClient.Topology topology = topologyChangeSubscription.getData(); final Partition[] assignedPartitions = Stream.of(topology.getPartitions()) .filter(p -> getSessionId().equals(p.getSession())) .toArray(Partition[]::new); addTask(() -> refreshTopologyUnlocked(assignedPartitions)); trackIdleness(topology); }
Source:
<code>public void draw(GC gc, StyledText textWidget, int offset, int length, Color color, int x, int y) { gc.setForeground(color); gc.setBackground(textWidget.getBackground()); List<ICodeMining> minings= new ArrayList<>(fMinings); int nbDraw= 0; int separatorWidth= -1; boolean redrawn= false; <START> int width= 0; <END> for (int i= 0; i < minings.size(); i++) { ICodeMining mining= minings.get(i); if (!mining.isResolved()) { if (!redrawn) { redraw(); redrawn= true; } if (fResolvedMinings != null) { mining= fResolvedMinings[i]; } if (mining == null) { continue; } } else { fResolvedMinings[i]= mining; } if (nbDraw > 0) { gc.drawText(SEPARATOR, x, y); if (separatorWidth == -1) { separatorWidth= gc.stringExtent(SEPARATOR).x; } width+= separatorWidth; x+= separatorWidth; } int miningWidth= mining.draw(gc, textWidget, color, x, y).x; width+= miningWidth; x+= miningWidth; nbDraw++; } if (width != 0) { if (separatorWidth == -1) { separatorWidth= gc.stringExtent(SEPARATOR).x; } width+= separatorWidth; } }</code><technical_language>Do need compute width here</technical_language>

Target:
public void draw(GC gc, StyledText textWidget, int offset, int length, Color color, int x, int y) { gc.setForeground(color); gc.setBackground(textWidget.getBackground()); List<ICodeMining> minings= new ArrayList<>(fMinings); int nbDraw= 0; int separatorWidth= -1; boolean redrawn= false; for (int i= 0; i < minings.size(); i++) { ICodeMining mining= minings.get(i); if (!mining.isResolved()) { if (!redrawn) { redraw(); redrawn= true; } if (fResolvedMinings != null) { mining= fResolvedMinings[i]; } if (mining == null) { continue; } } else { fResolvedMinings[i]= mining; } if (nbDraw > 0) { gc.drawText(SEPARATOR, x, y); if (separatorWidth == -1) { separatorWidth= gc.stringExtent(SEPARATOR).x; } x+= separatorWidth; } x+= mining.draw(gc, textWidget, color, x, y).x; nbDraw++; } }
Source:
<code>public void testBroadcastSerialDataReceiveSubscribedReceive() throws Exception { Mockito.when(receivePacket.getReceiveOptions()).thenReturn(RECEIVE_OPTIONS_BROADCAST); dataReader.addSerialDatatReceiveListener(receiveSerialDataListener); Whitebox.invokeMethod(dataReader, PACKET_RECEIVED_METHOD, receivePacket); PowerMockito.verifyPrivate(dataReader, Mockito.times(1)).invoke(NOTIFY_SERIAL_DATA_RECEIVED_METHOD, XBEE_64BIT_ADDRESS.toString(), RECEIVED_DATA_BYTES, IS_BROADCAST_DATA); Mockito.verify(receiveSerialDataListener, Mockito.times(1)).broadcastSerialDataReceived(XBEE_64BIT_ADDRESS.toString(), RECEIVED_DATA_BYTES); <START> <END> assertEquals(XBEE_64BIT_ADDRESS.toString(), receiveSerialDataListener.getAddress()); assertArrayEquals(RECEIVED_DATA_BYTES, receiveSerialDataListener.getSerialData()); }</code><technical_language>Add a check verify serialDataReceived method called</technical_language>

Target:
public void testBroadcastSerialDataReceiveSubscribedReceive() throws Exception { Mockito.when(receivePacket.getReceiveOptions()).thenReturn(RECEIVE_OPTIONS_BROADCAST); dataReader.addSerialDatatReceiveListener(receiveSerialDataListener); Whitebox.invokeMethod(dataReader, PACKET_RECEIVED_METHOD, receivePacket); PowerMockito.verifyPrivate(dataReader, Mockito.times(1)).invoke(NOTIFY_SERIAL_DATA_RECEIVED_METHOD, XBEE_64BIT_ADDRESS.toString(), RECEIVED_DATA_BYTES, IS_BROADCAST_DATA); Mockito.verify(receiveSerialDataListener, Mockito.times(1)).broadcastSerialDataReceived(XBEE_64BIT_ADDRESS.toString(), RECEIVED_DATA_BYTES); Mockito.verify(receiveSerialDataListener, Mockito.never()).serialDataReceived(Mockito.anyString(), (byte[])Mockito.any()); assertEquals(XBEE_64BIT_ADDRESS.toString(), receiveSerialDataListener.getAddress()); assertArrayEquals(RECEIVED_DATA_BYTES, receiveSerialDataListener.getSerialData()); }
Source:
<code>public Config[] createGnirsConfig(GnirsParameters gnirsParams, int numExp) { Config[] conf = createCommonConfig(numExp); for (Config step : conf) { step.putItem(ReadModeKey, (gnirsParams.readMode())); step.putItem(InstInstrumentKey, "GNIRS"); step.putItem(SlitWidthKey, gnirsParams.slitWidth().logValue()); if (gnirsParams.altair().isDefined()) { AltairParameters altairParameters = gnirsParams.altair().get(); step.putItem(AOGuideStarTypeKey, altairParameters.wfsMode().displayValue()); step.putItem(AOSystemKey, "Altair"); step.putItem(AOFieldLensKey, altairParameters.fieldLens().displayValue()); } } <START> return conf; <END> }</code><technical_language>This simplified a Config repeated values in for loop for step, putAll, e.g.: java final Config commonStep = new DefaultConfig(); commonStep.putItem(ReadModeKey, (gnirsParams.readMode())); commonStep.putItem(InstInstrumentKey, "GNIRS"); commonStep.putItem(SlitWidthKey, gnirsParams.slitWidth().logValue()); if (gnirsParams.altair().isDefined()) { AltairParameters altairParameters = gnirsParams.altair().get(); step.putItem(AOGuideStarTypeKey, altairParameters.wfsMode().displayValue()); commonStep.putItem(AOSystemKey, "Altair"); commonStep.putItem(AOFieldLensKey, altairParameters.fieldLens().displayValue()); } final Config[] conf = createCommonConfig(numExp); for (final Config step : conf) { step.putAll(commonStep); } Again, though, clear putting exact step repeatedly array. proper behaviour a unusual me</technical_language>

Target:
public ConfigCreatorResult createGnirsConfig(GnirsParameters gnirsParams, int numExp) { ConfigCreatorResult result = createCommonConfig(numExp); for (Config step : result.getConfig()) { step.putItem(ReadModeKey, (gnirsParams.readMode())); step.putItem(InstInstrumentKey, SPComponentType.INSTRUMENT_GNIRS); step.putItem(SlitWidthKey, gnirsParams.slitWidth()); if (gnirsParams.altair().isDefined()) { AltairParameters altairParameters = gnirsParams.altair().get(); step.putItem(AOGuideStarTypeKey, altairParameters.wfsMode()); step.putItem(AOSystemKey, SPComponentType.AO_ALTAIR); } } return result; }