auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testListOfTokens() throws Exception { Grammar.NonTerminalId ntistart = new Grammar.NonTerminalId("StartNT"); Grammar.StateId stistart = new Grammar.StateId("StartState"); Grammar.StateId stiend = new Grammar.StateId("EndState"); Grammar.NonTerminal nt1 = new Grammar.NonTerminal(ntistart, stistart, new Grammar.State.OrderingInfo(0), stiend, new Grammar.State.OrderingInfo(100)); Grammar.RegExState res1 = new Grammar.RegExState(new Grammar.StateId("RegExStid"), nt1, new Grammar.State.OrderingInfo(1), Pattern.compile("[a-zA-Z0-9]")); nt1.entryState.next.add(res1); nt1.entryState.next.add(nt1.exitState); res1.next.add(nt1.exitState); res1.next.add(res1); { Term result = new Parser(new ParseState("abc")).parse(nt1, 0); Term expected = amb(klist(amb(klist(Token.kAppOf("K", "a"), Token.kAppOf("K", "b"), Token.kAppOf("K", "c"))))); assertEquals("Single Token check: ", expected, result); } { Term result = new Parser(new ParseState("")).parse(nt1, 0); Term expected = amb(klist(amb(klist()))); assertEquals("Single Token check: ", expected, result); } { StringBuilder sb = new StringBuilder(); for (int i = 0; i < 100; i++) { sb.append('a'); } for (int j = 0; j < 20; j++) { long start = getCpuTime(); for (int i = 0; i < 100; i++) { Term result = new Parser(new ParseState(sb.toString())).parse(nt1, 0); } long end = getCpuTime(); System.out.println("Time: " + ((end - start) / 1000000.0)); } } <START> assertEquals("Expected Nullable NTs", 1, NullabilityCheck.getReachableNullableNT(nt1).size()); <END> }</code><technical_language>Please assert nullable nonterminal is</technical_language>

Target:
public void testListOfTokens() throws Exception { Grammar.NonTerminalId ntistart = new Grammar.NonTerminalId("StartNT"); Grammar.StateId stistart = new Grammar.StateId("StartState"); Grammar.StateId stiend = new Grammar.StateId("EndState"); Grammar.NonTerminal nt1 = new Grammar.NonTerminal(ntistart, stistart, new Grammar.State.OrderingInfo(0), stiend, new Grammar.State.OrderingInfo(100)); Grammar.RegExState res1 = new Grammar.RegExState(new Grammar.StateId("RegExStid"), nt1, new Grammar.State.OrderingInfo(1), Pattern.compile("[a-zA-Z0-9]")); nt1.entryState.next.add(res1); nt1.entryState.next.add(nt1.exitState); res1.next.add(nt1.exitState); res1.next.add(res1); { Term result = new Parser(new ParseState("abc")).parse(nt1, 0); Term expected = amb(klist(amb(klist(Token.kAppOf("K", "a"), Token.kAppOf("K", "b"), Token.kAppOf("K", "c"))))); Assert.assertEquals("Single Token check: ", expected, result); } { Term result = new Parser(new ParseState("")).parse(nt1, 0); Term expected = amb(klist(amb(klist()))); Assert.assertEquals("Single Token check: ", expected, result); } { StringBuilder sb = new StringBuilder(); for (int i = 0; i < 10; i++) { sb.append('a'); } for (int j = 0; j < 1; j++) { long start = getCpuTime(); for (int i = 0; i < 100; i++) { Term result = new Parser(new ParseState(sb.toString())).parse(nt1, 0); } long end = getCpuTime(); } } Assert.assertEquals("Expected Nullable NTs", nt1, NullabilityCheck.getReachableNullableNT(nt1).iterator().next()); }
Source:
<code>public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { return false; } ElasticsearchColumnMetadata that = (ElasticsearchColumnMetadata) o; <START> return jsonPath.equals(that.jsonPath) && jsonType.equals(that.jsonType) && ordinalPosition == that.ordinalPosition; <END> }</code><technical_language>Is intentional *not* isList for equality (& hash code)</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { return false; } ElasticsearchColumnMetadata that = (ElasticsearchColumnMetadata) o; return jsonPath.equals(that.jsonPath) && jsonType.equals(that.jsonType) && ordinalPosition == that.ordinalPosition && isList == that.isList; }
Source:
<code>public Tag(int accountId, int id, int internal, String name) { this.accountId = checkNotNull(accountId, "accountId"); this.id = checkNotNull(id, "id"); <START> this.internal = checkNotNull(internal, "internal"); <END> this.name = checkNotNull(name, "name"); }</code><technical_language>Remove null check for primitives</technical_language>

Target:
public Tag(int accountId, int id, int internal, String name) { this.accountId = accountId; this.id = id; this.internal = internal; this.name = checkNotNull(name, "name"); }
Source:
<code>public void testCurrentSchemaPropertyNotVisibilityTableInsideFunction() throws SQLException { testCurrentSchemaPropertyVisibilityTableDuringFunctionCreation(); Properties properties = new Properties(); properties.setProperty(PGProperty.CURRENT_SCHEMA.getName(), "public,schema2"); Connection connection = TestUtil.openDB(properties); expectedEx.expect(PSQLException.class); <START> expectedEx.expectMessage("ERROR: relation \"check_table\" does not exist"); <END> TestUtil.execute("select check_fun()", connection); connection.close(); }</code><technical_language>This is susceptible failures locale different. please comparison of SQL codes? (see org.postgresql.util.PSQLState.*)</technical_language>

Target:
public void testCurrentSchemaPropertyNotVisibilityTableInsideFunction() throws SQLException { testCurrentSchemaPropertyVisibilityTableDuringFunctionCreation(); Properties properties = new Properties(); properties.setProperty(PGProperty.CURRENT_SCHEMA.getName(), "public,schema2"); try (Connection connection = TestUtil.openDB(properties)) { TestUtil.execute("select check_fun()", connection); } catch (PSQLException e) { String sqlState = e.getSQLState(); String message = e.getMessage(); assertThat("Test call function in schema 'schema2' and this function uses table \"check_table\" " + "from schema 'schema1'. We expect here sql error code - " + PSQLState.UNDEFINED_TABLE + ", " + "because search_path does not contains schema 'schema1' and postgres does not see table \"check_table\".", sqlState, equalTo(PSQLState.UNDEFINED_TABLE.getState()) ); assertThat( "Test call function in schema 'schema2' and this function uses table \"check_table\" " + "from schema 'schema1'. We expect here that sql error message will be contains \"check_table\", because " + " search_path does not contains schema 'schema1' and postgres does not see table \"check_table\"", message, containsString("\"check_table\"") ); } }
Source:
<code>void hookEvents () { if ((style & SWT.BALLOON) != 0) { if (!OS.GTK3) { OS.g_signal_connect_closure_by_id (handle, display.signalIds [EXPOSE_EVENT], 0, display.getClosure (EXPOSE_EVENT), true); } else { if (OS.GTK_VERSION >= OS.VERSION (3, 9, 0)) { <START> OS.g_signal_connect_closure_by_id (handle, display.signalIds [EXPOSE_EVENT_INVERSE], 0, display.getClosure (EXPOSE_EVENT_INVERSE), true); <END> } else { OS.g_signal_connect_closure_by_id (handle, display.signalIds [EXPOSE_EVENT], 0, display.getClosure (EXPOSE_EVENT), true); } } OS.gtk_widget_add_events (handle, OS.GDK_BUTTON_PRESS_MASK); OS.g_signal_connect_closure (handle, OS.button_press_event, display.getClosure (BUTTON_PRESS_EVENT), false); } }</code><technical_language>connect expose event GTK 3? is critical if custom drawing in tooltip. I connect EXPOSE_EVENT unconditionally EXPOSE_EVENT_INVERSE for gtk 3.9+ is correct do simple test snippet working</technical_language>

Target:
void hookEvents () { if ((style & SWT.BALLOON) != 0) { if (!OS.GTK3) { OS.g_signal_connect_closure_by_id (handle, display.signalIds [EXPOSE_EVENT], 0, display.getClosure (EXPOSE_EVENT), true); } else { OS.g_signal_connect_closure_by_id (handle, display.signalIds [EXPOSE_EVENT], 0, display.getClosure (EXPOSE_EVENT), true); if (OS.GTK_VERSION >= OS.VERSION (3, 9, 0)) { OS.g_signal_connect_closure_by_id (handle, display.signalIds [EXPOSE_EVENT_INVERSE], 0, display.getClosure (EXPOSE_EVENT_INVERSE), true); } } OS.gtk_widget_add_events (handle, OS.GDK_BUTTON_PRESS_MASK); OS.g_signal_connect_closure (handle, OS.button_press_event, display.getClosure (BUTTON_PRESS_EVENT), false); } }
Source:
<code>public void doAuthorise_shouldRespondWith3dsResponseForEpdq3dsOrders() throws XMLUnmarshallerException { providerWillRequireEpdq3ds(); GatewayResponse response = cardAuthorisationService.doAuthorise(charge.getExternalId(), aValidAuthorisationDetails()); assertThat(response.isSuccessful(), is(true)); assertThat(charge.getStatus(), is(AUTHORISATION_3DS_REQUIRED.getValue())); verify(mockedChargeEventDao).persistChargeEventOf(charge, Optional.empty()); assertThat(charge.get3dsDetails().getHtmlOut(), is(notNullValue())); Card3dsEntity card3ds = paymentRequest.getChargeTransaction().getCard3ds(); assertThat(card3ds.getIssuerUrl(), is(nullValue())); assertThat(card3ds.getPaRequest(), is(nullValue())); <START> assertThat(card3ds.getHtmlOut(), is(notNullValue())); <END> }</code><technical_language>test for actual value</technical_language>

Target:
public void doAuthorise_shouldRespondWith3dsResponseForEpdq3dsOrders() { epdqProviderWillRequire3ds(); GatewayResponse response = cardAuthorisationService.doAuthorise(charge.getExternalId(), aValidAuthorisationDetails()); assertThat(response.isSuccessful(), is(true)); assertThat(charge.getStatus(), is(AUTHORISATION_3DS_REQUIRED.getValue())); verify(mockedChargeEventDao).persistChargeEventOf(charge, Optional.empty()); assertThat(charge.get3dsDetails().getHtmlOut(), is(notNullValue())); Card3dsEntity card3ds = paymentRequest.getChargeTransaction().getCard3ds(); assertThat(card3ds.getIssuerUrl(), is(nullValue())); assertThat(card3ds.getPaRequest(), is(nullValue())); assertThat(card3ds.getHtmlOut(), is("Base64encodedHtmlForm")); }
Source:
<code>private void validateEntities(List<Entity> entities) throws FalconException { for (Entity entity : entities) { <START> super.validate(entity); <END> } }</code><technical_language>ensure entities of type process feed</technical_language>

Target:
private void validateEntities(List<Entity> entities) throws FalconException { for (Entity entity : entities) { if (!EntityType.FEED.equals(entity.getEntityType()) && !EntityType.FEED.equals(entity.getEntityType())) { LOG.error("Cluster entity is not allowed for submission via submitEntities: {}", entity.getName()); throw new FalconException("Cluster entity is not allowed for submission in extensions submission"); } super.validate(entity); } }
Source:
<code>private List<VmAnalyzer> analyzeVms( List<Pair<VM, VdsmVm>> monitoredVms, long fetchTime, VdsManager vdsManager, boolean updateStatistics) { VmAnalyzerFactory vmAnalyzerFactory = getVmAnalyzerFactory(vdsManager, updateStatistics); List<VmAnalyzer> vmAnalyzers = new ArrayList<>(monitoredVms.size()); monitoredVms.forEach(vm -> { if (shouldAnalyzeVm(vm, fetchTime, vdsManager.getVdsId())) { try { VmAnalyzer vmAnalyzer = vmAnalyzerFactory.getVmAnalyzer(vm); vmAnalyzer.analyze(); vmAnalyzers.add(vmAnalyzer); } catch (RuntimeException ex) { Guid vmId = getVmId(vm.getFirst(), vm.getSecond()); VmManager vmManager = resourceManager.getVmManager(vmId); <START> vmManager.unlock(); <END> String vmName = vm.getFirst() != null ? vm.getFirst().getName() : ""; log.error("Failed during monitoring vm {}, error is: {}", vmName, ex); log.error("Exception:", ex); } } }); return vmAnalyzers; }</code><technical_language>this unlock vm 2 times, is wrong (cause vm is vmAnalizers list unlocked in unlockVms Arik, Andrej 1st version is cleaner need handle exception. If analyzer list, stays there. approach is step isolating problem per-vm. I eventually this is monitoring code aim (maybe that)</technical_language>

Target:
private List<VmAnalyzer> analyzeVms( List<Pair<VM, VdsmVm>> monitoredVms, long fetchTime, VdsManager vdsManager, boolean updateStatistics) { VmAnalyzerFactory vmAnalyzerFactory = getVmAnalyzerFactory(vdsManager, updateStatistics); List<VmAnalyzer> vmAnalyzers = new ArrayList<>(monitoredVms.size()); monitoredVms.forEach(vm -> { if (shouldAnalyzeVm(vm, fetchTime, vdsManager.getVdsId())) { try { VmAnalyzer vmAnalyzer = vmAnalyzerFactory.getVmAnalyzer(vm); vmAnalyzer.analyze(); vmAnalyzers.add(vmAnalyzer); } catch (RuntimeException ex) { Guid vmId = getVmId(vm.getFirst(), vm.getSecond()); VmManager vmManager = resourceManager.getVmManager(vmId); vmManager.unlock(); String vmName = vm.getFirst() != null ? vm.getFirst().getName() : ""; log.error("Failed during monitoring vm: ({}), error is: {}", vmName, vmId, ex); log.error("Exception:", ex); } } }); return vmAnalyzers; }
Source:
<code>public Object getProperty( String key, Object defaultValue ) { if ( null == key ) { throw new IllegalArgumentException( "(null) property key is not allowed" ); } try ( Statement ignore = actions.statement() ) { KernelTransaction transaction = actions.kernelTransaction(); CursorFactory cursors = transaction.cursors(); try ( NodeCursor nodes = cursors.allocateNodeCursor(); PropertyCursor properties = cursors.allocatePropertyCursor() ) { int propertyKey = transaction.token().propertyKey( key ); if ( propertyKey == KeyReadOperations.NO_SUCH_PROPERTY_KEY ) { return defaultValue; <START> } <END> transaction.dataRead().singleNode( nodeId, nodes ); if ( !nodes.next() ) { throw new NotFoundException( new EntityNotFoundException( EntityType.NODE, nodeId ) ); } nodes.properties( properties ); while ( properties.next() ) { if ( propertyKey == properties.propertyKey() ) { Value value = properties.propertyValue(); return value == Values.NO_VALUE ? defaultValue : value.asObjectCopy(); } } return defaultValue; } } }</code><technical_language>This check done allocating cursors</technical_language>

Target:
public Object getProperty( String key, Object defaultValue ) { if ( null == key ) { throw new IllegalArgumentException( "(null) property key is not allowed" ); } try ( Statement ignore = actions.statement() ) { KernelTransaction transaction = actions.kernelTransaction(); int propertyKey = transaction.token().propertyKey( key ); if ( propertyKey == KeyReadOperations.NO_SUCH_PROPERTY_KEY ) { return defaultValue; } CursorFactory cursors = transaction.cursors(); try ( NodeCursor nodes = cursors.allocateNodeCursor(); PropertyCursor properties = cursors.allocatePropertyCursor() ) { transaction.dataRead().singleNode( nodeId, nodes ); if ( !nodes.next() ) { throw new NotFoundException( new EntityNotFoundException( EntityType.NODE, nodeId ) ); } nodes.properties( properties ); while ( properties.next() ) { if ( propertyKey == properties.propertyKey() ) { Value value = properties.propertyValue(); return value == Values.NO_VALUE ? defaultValue : value.asObjectCopy(); } } return defaultValue; } } }
Source:
<code>public void run() { updateTimeTrackingBeforeRun(); if (missedStartTime() && isScheduled()) { onChoreMissedStartTime(); if (LOG.isInfoEnabled()) LOG.info("Chore: " + getName() + " missed its start time"); } else if (stopper.isStopped() || !isScheduled()) { cancel(false); cleanup(); if (LOG.isInfoEnabled()) LOG.info("Chore: " + getName() + " was stopped"); } else { try { long start = 0; if (LOG.isDebugEnabled()) { start = System.nanoTime(); } if (!initialChoreComplete) { initialChoreComplete = initialChore(); } else { chore(); } if (LOG.isDebugEnabled()) { long end = System.nanoTime(); <START> LOG.debug("{} execution time: ms.", getName(), <END> TimeUnit.NANOSECONDS.toMillis(end - start)); } } catch (Throwable t) { if (LOG.isErrorEnabled()) LOG.error("Caught error", t); if (this.stopper.isStopped()) { cancel(false); cleanup(); } } } }</code><technical_language>log start time, too? If debug enabled execution, get a wrong execution time</technical_language>

Target:
public void run() { updateTimeTrackingBeforeRun(); if (missedStartTime() && isScheduled()) { onChoreMissedStartTime(); if (LOG.isInfoEnabled()) LOG.info("Chore: " + getName() + " missed its start time"); } else if (stopper.isStopped() || !isScheduled()) { cancel(false); cleanup(); if (LOG.isInfoEnabled()) LOG.info("Chore: " + getName() + " was stopped"); } else { try { long start = 0; if (LOG.isDebugEnabled()) { start = System.nanoTime(); } if (!initialChoreComplete) { initialChoreComplete = initialChore(); } else { chore(); } if (LOG.isDebugEnabled() && start > 0) { long end = System.nanoTime(); LOG.debug("{} execution time: ms.", getName(), TimeUnit.NANOSECONDS.toMillis(end - start)); } } catch (Throwable t) { if (LOG.isErrorEnabled()) LOG.error("Caught error", t); if (this.stopper.isStopped()) { cancel(false); cleanup(); } } } }
Source:
<code>public BufferAggregator factorizeBuffered(final ColumnSelectorFactory metricFactory) { if (metricColumns == null) { final BaseObjectColumnValueSelector<ArrayOfDoublesSketch> selector = metricFactory .makeColumnValueSelector(fieldName); if (selector instanceof NilColumnValueSelector) { return new ArrayOfDoublesSketchNoOpBufferAggregator(numberOfValues); } return new ArrayOfDoublesSketchMergeBufferAggregator(selector, nominalEntries, numberOfValues, getMaxIntermediateSize()); } final DimensionSelector keySelector = metricFactory .makeDimensionSelector(new DefaultDimensionSpec(fieldName, fieldName)); if (keySelector instanceof NullDimensionSelector) { return new ArrayOfDoublesSketchNoOpBufferAggregator(numberOfValues); } final List<BaseDoubleColumnValueSelector> valueSelectors = new ArrayList<>(); for (final String column: metricColumns) { final BaseDoubleColumnValueSelector valueSelector = metricFactory.makeColumnValueSelector(column); valueSelectors.add(valueSelector); } return new ArrayOfDoublesSketchBuildBufferAggregator(keySelector, valueSelectors, nominalEntries, <START> getMaxIntermediateSize()); <END> }</code><technical_language>This is Druid style. In Druid style, method/constructor call args fit line: foo(a, b, c);, or, if fit 120 cols, is formatted this: java foo( a, b, c ); i. e. arg line, closing paren line. violations of this policy in this PR, please fix them</technical_language>

Target:
public BufferAggregator factorizeBuffered(final ColumnSelectorFactory metricFactory) { if (metricColumns == null) { final BaseObjectColumnValueSelector<ArrayOfDoublesSketch> selector = metricFactory .makeColumnValueSelector(fieldName); if (selector instanceof NilColumnValueSelector) { return new ArrayOfDoublesSketchNoOpBufferAggregator(numberOfValues); } return new ArrayOfDoublesSketchMergeBufferAggregator( selector, nominalEntries, numberOfValues, getMaxIntermediateSize() ); } final DimensionSelector keySelector = metricFactory .makeDimensionSelector(new DefaultDimensionSpec(fieldName, fieldName)); if (DimensionSelectorUtils.isNilSelector(keySelector)) { return new ArrayOfDoublesSketchNoOpBufferAggregator(numberOfValues); } final List<BaseDoubleColumnValueSelector> valueSelectors = new ArrayList<>(); for (final String column : metricColumns) { final BaseDoubleColumnValueSelector valueSelector = metricFactory.makeColumnValueSelector(column); valueSelectors.add(valueSelector); } return new ArrayOfDoublesSketchBuildBufferAggregator( keySelector, valueSelectors, nominalEntries, getMaxIntermediateSize() ); }
Source:
<code><START> private boolean isTopLevelRepresentationRemoval(Notification notification) { Object notifier = notification.getNotifier(); boolean isResourceContentChange = notifier instanceof Resource && notification.getFeatureID(Resource.class) == Resource.RESOURCE__CONTENTS; final boolean isRepresentationRemoval; if (notification.getEventType() == Notification.REMOVE && notification.getOldValue() instanceof DRepresentation) { isRepresentationRemoval = true; } else if (notification.getEventType() == Notification.REMOVE_MANY) { Collection<?> removed = (Collection<?>) notification.getOldValue(); isRepresentationRemoval = Iterables.all(removed, Predicates.instanceOf(DRepresentation.class)); } else { isRepresentationRemoval = false; } return isResourceContentChange && isRepresentationRemoval; } <END></code><technical_language>public static reused</technical_language>

Target:
public static boolean isTopLevelRepresentationRemoval(Notification notification) { Object notifier = notification.getNotifier(); boolean isResourceContentChange = notifier instanceof Resource && notification.getFeatureID(Resource.class) == Resource.RESOURCE__CONTENTS; final boolean isRepresentationRemoval; if (notification.getEventType() == Notification.REMOVE && notification.getOldValue() instanceof DRepresentation) { isRepresentationRemoval = true; } else if (notification.getEventType() == Notification.REMOVE_MANY) { Collection<?> removed = (Collection<?>) notification.getOldValue(); isRepresentationRemoval = Iterables.all(removed, Predicates.instanceOf(DRepresentation.class)); } else { isRepresentationRemoval = false; } return isResourceContentChange && isRepresentationRemoval; }
Source:
<code>public String getString(String dataType, BigInteger address, MemoryByte[] data) { boolean invalid = false; String paddedStr = DebugUIPlugin.getDefault().getPreferenceStore().getString(IDebugUIConstants.PREF_PADDED_STR); for (MemoryByte <START> d : <END> data) { if (!d.isReadable()) { invalid = true; break; } } if (invalid) { StringBuilder strBuf = new StringBuilder(); for (int i=0; i<data.length; i++) { strBuf.append(paddedStr); } return strBuf.toString(); } int columnSize = getBytesPerColumn(); int endianess = getDisplayEndianess(); if (endianess == RenderingsUtil.ENDIANESS_UNKNOWN) { endianess = getBytesEndianess(data); } byte[] byteArray = new byte[data.length]; for (int i=0; i<byteArray.length;i ++) { byteArray[i] = data[i].getValue(); } if (RenderingsUtil.ENDIANESS_UNKNOWN == endianess) { StringBuilder strBuf = new StringBuilder(); for (int i=0; i<byteArray.length; i++) { strBuf.append(paddedStr); } return strBuf.toString(); } return convertToString(byteArray, columnSize, endianess); }</code><technical_language>rename memByte</technical_language>

Target:
public String getString(String dataType, BigInteger address, MemoryByte[] data) { boolean invalid = false; String paddedStr = DebugUIPlugin.getDefault().getPreferenceStore().getString(IDebugUIConstants.PREF_PADDED_STR); for (MemoryByte memByte : data) { if (!memByte.isReadable()) { invalid = true; break; } } if (invalid) { StringBuilder strBuf = new StringBuilder(); for (int i=0; i<data.length; i++) { strBuf.append(paddedStr); } return strBuf.toString(); } int columnSize = getBytesPerColumn(); int endianess = getDisplayEndianess(); if (endianess == RenderingsUtil.ENDIANESS_UNKNOWN) { endianess = getBytesEndianess(data); } byte[] byteArray = new byte[data.length]; for (int i=0; i<byteArray.length;i ++) { byteArray[i] = data[i].getValue(); } if (RenderingsUtil.ENDIANESS_UNKNOWN == endianess) { StringBuilder strBuf = new StringBuilder(); for (int i=0; i<byteArray.length; i++) { strBuf.append(paddedStr); } return strBuf.toString(); } return convertToString(byteArray, columnSize, endianess); }
Source:
<code>public void testDeserializationOfSingleJobExecution() throws IOException { final ObjectMapper objectMapper = DataFlowTemplate.prepareObjectMapper(new ObjectMapper()); final InputStream inputStream = JobExecutionDeserializationTests.class .getResourceAsStream("/SingleJobExecutionJson.txt"); final String json = new String(StreamUtils.copyToByteArray(inputStream)); final JobExecutionResource jobExecutionInfoResource = objectMapper.readValue(json, JobExecutionResource.class); assertNotNull(jobExecutionInfoResource); assertEquals(Long.valueOf(1), jobExecutionInfoResource.getJobId()); assertEquals("ff.job", jobExecutionInfoResource.getName()); assertEquals("COMPLETED", jobExecutionInfoResource.getJobExecution().getStatus().name()); assertEquals(1, jobExecutionInfoResource.getJobExecution().getStepExecutions().size()); StepExecution stepExecution = jobExecutionInfoResource.getJobExecution().getStepExecutions().iterator().next(); assertNotNull(stepExecution); <START> ExecutionContext stepExecutionExecutionContext = stepExecution.getExecutionContext(); <END> assertNotNull(stepExecutionExecutionContext); assertEquals(2, stepExecutionExecutionContext.size()); }</code><technical_language>add final consistent</technical_language>

Target:
public void testDeserializationOfSingleJobExecution() throws IOException { final ObjectMapper objectMapper = DataFlowTemplate.prepareObjectMapper(new ObjectMapper()); final InputStream inputStream = JobExecutionDeserializationTests.class .getResourceAsStream("/SingleJobExecutionJson.txt"); final String json = new String(StreamUtils.copyToByteArray(inputStream)); final JobExecutionResource jobExecutionInfoResource = objectMapper.readValue(json, JobExecutionResource.class); assertNotNull(jobExecutionInfoResource); assertEquals(Long.valueOf(1), jobExecutionInfoResource.getJobId()); assertEquals("ff.job", jobExecutionInfoResource.getName()); assertEquals("COMPLETED", jobExecutionInfoResource.getJobExecution().getStatus().name()); assertEquals(1, jobExecutionInfoResource.getJobExecution().getStepExecutions().size()); final StepExecution stepExecution = jobExecutionInfoResource.getJobExecution().getStepExecutions().iterator().next(); assertNotNull(stepExecution); final ExecutionContext stepExecutionExecutionContext = stepExecution.getExecutionContext(); assertNotNull(stepExecutionExecutionContext); assertEquals(2, stepExecutionExecutionContext.size()); }
Source:
<code>private String analyzerName(DocumentFieldMetadata fieldMetadata) { <START> AnalyzerReference analyzer = fieldMetadata.getAnalyzer(); <END> if ( analyzer.is( RemoteAnalyzerReference.class ) ) { return analyzer.unwrap( RemoteAnalyzerReference.class ).getName(); } return null; }</code><technical_language>raise exception if actual Lucene analyzer? raise a warning effect</technical_language>

Target:
private String analyzerName(DocumentFieldMetadata fieldMetadata) { AnalyzerReference analyzer = fieldMetadata.getAnalyzer(); if ( analyzer.is( RemoteAnalyzerReference.class ) ) { return analyzer.unwrap( RemoteAnalyzerReference.class ).getName(); } LOG.analyzerIsNotRemote( String.valueOf( analyzer ) ); return null; }
Source:
<code>public Predicate<ChangeData> project(String name) { <START> Project project = args.projectCache.get(new Project.NameKey(name)).getProject(); <END> return new ProjectPredicate(args.dbProvider, project.getId()); }</code><technical_language>This NPE if name exist. instead throw IllegalArgumentException("No project "+name), construct a ProjectPredicate match input project name</technical_language>

Target:
public Predicate<ChangeData> project(String name) { if (name.startsWith("^")) return new RegexProjectPredicate(args.dbProvider, args.projectCache, name); final ProjectState projectState = args.projectCache.get(new Project.NameKey(name)); if (projectState == null) { return new NotMatchingPredicate<ChangeData>(FIELD_PROJECT, name); } final Project project = projectState.getProject(); return new ProjectPredicate(args.dbProvider, project.getId(), name); }
Source:
<code>public long internal_new_GC (GCData data) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (type != SWT.BITMAP || memGC != null) { SWT.error(SWT.ERROR_INVALID_ARGUMENT); } double <START> sx[] <END> =new double[1]; double sy[] =new double[1]; Cairo.cairo_surface_get_device_scale(surface, sx, sy); long gc = Cairo.cairo_create(surface); if (data != null) { int mask = SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT; if ((data.style & mask) == 0) { data.style |= SWT.LEFT_TO_RIGHT; } else { if ((data.style & SWT.RIGHT_TO_LEFT) != 0) { data.style |= SWT.MIRRORED; } } data.device = device; data.drawable = pixmap; if (GTK.GTK3) { data.foregroundRGBA = device.COLOR_BLACK.handleRGBA; data.backgroundRGBA = device.COLOR_WHITE.handleRGBA; } else { data.background = device.COLOR_WHITE.handle; data.foreground = device.COLOR_BLACK.handle; } data.font = device.systemFont; data.image = this; } return gc; }</code><technical_language>Is this somewhere? I it, array below</technical_language>

Target:
public long internal_new_GC (GCData data) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (type != SWT.BITMAP || memGC != null) { SWT.error(SWT.ERROR_INVALID_ARGUMENT); } long gc = Cairo.cairo_create(surface); if (data != null) { int mask = SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT; if ((data.style & mask) == 0) { data.style |= SWT.LEFT_TO_RIGHT; } else { if ((data.style & SWT.RIGHT_TO_LEFT) != 0) { data.style |= SWT.MIRRORED; } } data.device = device; data.drawable = pixmap; if (GTK.GTK3) { data.foregroundRGBA = device.COLOR_BLACK.handleRGBA; data.backgroundRGBA = device.COLOR_WHITE.handleRGBA; } else { data.background = device.COLOR_WHITE.handle; data.foreground = device.COLOR_BLACK.handle; } data.font = device.systemFont; data.image = this; } return gc; }
Source:
<code>public void test_unmodifiableMap_LinkedHashMap() { LinkedHashMap<String, Integer> smallMap = new LinkedHashMap<String, Integer>(); <START> for (int counter = 0; counter < 100; counter++) { <END> Integer object = objArray[counter]; smallMap.put(object.toString(), object); } new Support_MapTest("", smallMap).runTest(); }</code><technical_language>i ctr</technical_language>

Target:
public void test_unmodifiableMap_LinkedHashMap() { LinkedHashMap<String, Integer> smallMap = new LinkedHashMap<String, Integer>(); for (int i = 0; i < 100; i++) { Integer object = objArray[i]; smallMap.put(object.toString(), object); } new MapTestSupport(smallMap).runTest(); }
Source:
<code>public double getLocationRatio(ITmfLocation<?> location) { final CtfLocation curLocation = (CtfLocation) location; <START> CtfIterator iterator = CtfIteratorManager.getIterator(this, ctx); <END> ctx.setLocation(curLocation); ctx.seek(curLocation.getLocation()); long currentTime = ((Long)ctx.getLocation().getLocation()); return ((double) currentTime - iterator.getStartTime()) / (iterator.getEndTime() - iterator.getStartTime()); }</code><technical_language>a local context instead</technical_language>

Target:
public double getLocationRatio(ITmfLocation<?> location) { final CtfLocation curLocation = (CtfLocation) location; CtfIterator iterator = getIterator(); ctx.setLocation(curLocation); ctx.seek(curLocation.getLocation()); long currentTime = ((Long)ctx.getLocation().getLocation()); return ((double) currentTime - iterator.getStartTime()) / (iterator.getEndTime() - iterator.getStartTime()); }
Source:
<code>public void start() throws CacheLoaderException { super.start(); try { validateConfiguration(config, cache.getCacheConfiguration()); String location = config.getLocation(); if (location == null || location.trim().length() == 0) location = "Infinispan-SingleFileCacheStore"; File dir = new File(location); if (!dir.exists() && !dir.mkdirs()) throw log.directoryCannotBeCreated(dir.getAbsolutePath()); File f = new File(location, cache.getName() + ".dat"); file = new RandomAccessFile(f, "rw").getChannel(); final Map<Object, FileEntry> entryMap; if (config.getMaxKeysInMemory() > 0) entryMap = new LinkedHashMap<Object, FileEntry>(16, 0.75f, true); else entryMap = new HashMap<Object, FileEntry>(); entries = Collections.synchronizedMap(entryMap); freeList = Collections.synchronizedSortedSet(new TreeSet<FileEntry>()); byte[] header = new byte[MAGIC.length]; if (file.read(ByteBuffer.wrap(header), 0) == MAGIC.length && Arrays.equals(MAGIC, header) && cache.getCacheConfiguration().loaders().preload()) <START> preload(); <END> else clear(); } catch (Exception e) { throw new CacheLoaderException(e); } }</code><technical_language>preload call optional me, key</technical_language>

Target:
public void start() throws CacheLoaderException { super.start(); try { String location = config.getLocation(); if (location == null || location.trim().length() == 0) location = "Infinispan-SingleFileCacheStore"; File dir = new File(location); if (!dir.exists() && !dir.mkdirs()) throw log.directoryCannotBeCreated(dir.getAbsolutePath()); File f = new File(location, cache.getName() + ".dat"); file = new RandomAccessFile(f, "rw").getChannel(); final Map<Object, FileEntry> entryMap; if (config.getMaxEntries() > 0) entryMap = new LinkedHashMap<Object, FileEntry>(16, 0.75f, true); else entryMap = new HashMap<Object, FileEntry>(); entries = Collections.synchronizedMap(entryMap); freeList = Collections.synchronizedSortedSet(new TreeSet<FileEntry>()); byte[] header = new byte[MAGIC.length]; if (file.read(ByteBuffer.wrap(header), 0) == MAGIC.length && Arrays.equals(MAGIC, header)) rebuildIndex(); else clear(); } catch (Exception e) { throw new CacheLoaderException(e); } }
Source:
<code>public void messageReceived(final String message) { final PlayerName from = MessageContext.getSender().getPlayerName(); if (isIgnored(from)) { return; } chatHistory.add(new ChatMessage(message, from)); for (final IChatListener listener : listeners) { listener.addMessage(message, from); } while (chatHistory.size() > 1000) { chatHistory.remove(0); <START> } <END> }</code><technical_language>I this is code, chatHistory is a CopyOnWriteArrayList, remove(0) a super expensive call. recommend guavas [EvictingQueue](<LINK_0>, automatically remove elements, is a cyclic buffer. If thread-safety is a requirement, Collections#synchronizedCollection do trick</technical_language>

Target:
public void messageReceived(final String message) { final PlayerName from = MessageContext.getSender().getPlayerName(); if (isIgnored(from)) { return; } chatHistory.add(new ChatMessage(message, from)); for (final IChatListener listener : listeners) { listener.addMessage(message, from); } }
Source:
<code>private void generateInstallSection(StringBuilder buffer) { buffer.append("%install\n"); <START> buffer.append("rm -rf %{buildroot}\n\n"); <END> buffer.append("%if 0%{?with_python3}\n"); buffer.append("pushd %{py3dir}\n"); buffer.append("%{__python3} setup.py install --skip-build --root %{buildroot}\n"); buffer.append("popd\n"); buffer.append("%endif # with_python3\n\n"); buffer.append("%{__python} setup.py install --skip-build --root %{buildroot}\n\n\n"); }</code><technical_language>need clean buildroot either, rpmbuild handles internally</technical_language>

Target:
private void generateInstallSection(StringBuilder buffer) { buffer.append("%install\n"); buffer.append("%if 0%{?with_python3}\n"); buffer.append("pushd %{py3dir}\n"); buffer.append("%{__python3} setup.py install --skip-build --root %{buildroot}\n"); buffer.append("popd\n"); buffer.append("%endif # with_python3\n\n"); buffer.append("%{__python} setup.py install --skip-build --root %{buildroot}\n\n\n"); }
Source:
<code>private void loadSnapshot(SingleFileSnapshotInfo snapshot) throws IOException { if (snapshot == null) { <START> LOG.info("No snapshot to load"); <END> return; } LOG.info("Loading Snapshot {}", snapshot); final File snapshotFile = snapshot.getFile().getPath().toFile(); if (!snapshotFile.exists()) { LOG.error("The snapshot does not exist", snapshot); throw new FileNotFoundException( String.format("The snapshot file %s does not exist", snapshotFile.getPath())); } try { resetState(); setLastAppliedTermIndex(snapshot.getTermIndex()); install(snapshotFile); } catch (Exception e) { LOG.error("Failed to load snapshot {}", snapshot, e); throw e; } }</code><technical_language>ERROR. Also, this happen? I this message is supposed user. is this throwing exception instead</technical_language>

Target:
private void loadSnapshot(SingleFileSnapshotInfo snapshot) throws IOException { if (snapshot == null) { LOG.info("No snapshot to load"); return; } LOG.info("Loading Snapshot {}", snapshot); final File snapshotFile = snapshot.getFile().getPath().toFile(); if (!snapshotFile.exists()) { throw new FileNotFoundException( String.format("The snapshot file %s does not exist", snapshotFile.getPath())); } try { resetState(); setLastAppliedTermIndex(snapshot.getTermIndex()); install(snapshotFile); } catch (Exception e) { throw new IOException(String.format("Failed to load snapshot %s", snapshot), e); } }
Source:
<code>private void restartServices(ClustersResourceApi clustersResourceApi) throws ApiException, CloudbreakException { List<String> serviceNames = getClusterServices(); ApiRestartClusterArgs restartClusterArgs = new ApiRestartClusterArgs(); <START> restartClusterArgs.setRestartServiceNames(serviceNames); <END> restartClusterArgs.setRedeployClientConfiguration(true); ApiCommand restartCommand = clustersResourceApi.restartCommand(stack.getName(), restartClusterArgs); PollingResult pollingResult = clouderaManagerPollingServiceProvider.startPollingCmServicesRestart(stack, apiClient, restartCommand.getId()); if (isExited(pollingResult)) { throw new CancellationException("Cluster was terminated while refreshing services."); } else if (isTimeout(pollingResult)) { throw new CloudbreakException("Timeout while was restarting services."); } }</code><technical_language>I this setting is needed, API docs: "Only restart services dependent services". Omitting work</technical_language>

Target:
private void restartServices(ClustersResourceApi clustersResourceApi) throws ApiException, CloudbreakException { ApiRestartClusterArgs restartClusterArgs = new ApiRestartClusterArgs(); restartClusterArgs.setRedeployClientConfiguration(true); ApiCommand restartCommand = clustersResourceApi.restartCommand(stack.getName(), restartClusterArgs); PollingResult pollingResult = clouderaManagerPollingServiceProvider.startPollingCmServicesRestart(stack, apiClient, restartCommand.getId()); if (isExited(pollingResult)) { throw new CancellationException("Cluster was terminated while restarting services."); } else if (isTimeout(pollingResult)) { throw new CloudbreakException("Timeout happened while restarting services."); } }
Source:
<code>public GoGoDuck(Catalog catalog, String profile, String subset, String outputFile, Integer limit) { this(profile, subset, outputFile, limit); <START> this.urlIndexInterface = new UrlIndexFeatureSource(this.userLog, catalog); <END> }</code><technical_language>FeatureSourceIndexReader</technical_language>

Target:
public GoGoDuck(Catalog catalog, String profile, String subset, String outputFile, Integer limit) { this(profile, subset, outputFile, limit); this.indexReader = new FeatureSourceIndexReader(this.userLog, catalog); }
Source:
<code>public void close() throws Exception { <START> if (iterator instanceof CloseableIterator) { <END> ((CloseableIterator) iterator).close(); } }</code><technical_language>GraphStep implement AutoCloseable others</technical_language>

Target:
public void close() { CloseableIterator.closeIterator(iterator); }
Source:
<code>public void init() { this.entityRewrite = EntityMap.getEntityMap( getPendingConnection().getVersion() ); this.displayName = name; switch ( getPendingConnection().getListener().getTabListType() ) { case "EMPTY": <START> tabListHandler = new Global( this ); <END> break; default: tabListHandler = new ServerUnique( this ); break; } Collection<String> g = bungee.getConfigurationAdapter().getGroups( name ); for ( String s : g ) { addGroups( s ); } }</code><technical_language>empty setting global one? new Empty( this )</technical_language>

Target:
public void init() { this.entityRewrite = EntityMap.getEntityMap( getPendingConnection().getVersion() ); this.displayName = name; switch ( getPendingConnection().getListener().getTabListType() ) { case "EMPTY": if( getPendingConnection().getVersion() < ProtocolConstants.MINECRAFT_SNAPSHOT ) { tabListHandler = new Empty(this); } else { tabListHandler = new EmptyNew(this); } break; default: tabListHandler = new ServerUnique( this ); break; } Collection<String> g = bungee.getConfigurationAdapter().getGroups( name ); for ( String s : g ) { addGroups( s ); } }
Source:
<code>protected void doFilterInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, FilterChain filterChain) throws ServletException, IOException { if (isTwoFactorAuthenticationEnabled()) { if (!httpServletRequest.getRequestURI().contains(TwoFactorAuthenticationController.URI) && SecurityUtils.currentUserIsAuthenticated() && !httpServletRequest.getRequestURI() .toLowerCase() <START> .equals(CHANGE_PASSWORD_URI.toLowerCase())) <END> { if (!isUserTwoFactorAuthenticated() && !hasAuthenticatedMolgenisToken() && !isUserRecoveryAuthenticated()) { if (isTwoFactorAuthenticationEnforced() || userUsesTwoFactorAuthentication()) { if (twoFactorAuthenticationService.isConfiguredForUser()) { redirectStrategy.sendRedirect(httpServletRequest, httpServletResponse, TwoFactorAuthenticationController.URI + TwoFactorAuthenticationController.TWO_FACTOR_CONFIGURED_URI); return; } else { redirectStrategy.sendRedirect(httpServletRequest, httpServletResponse, TwoFactorAuthenticationController.URI + TwoFactorAuthenticationController.TWO_FACTOR_ACTIVATION_URI); return; } } } } } filterChain.doFilter(httpServletRequest, httpServletResponse); }</code><technical_language>this is security stuff I a unit test for this code branch</technical_language>

Target:
protected void doFilterInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, FilterChain filterChain) throws ServletException, IOException { if (isUserShouldTwoFactorAuthenticate() && currentUserIsAuthenticated() && isNotProtected( httpServletRequest.getRequestURI()) && isInsufficientlyAuthenticated()) { redirectToTwoFactorAuthenticationController(httpServletRequest, httpServletResponse); } else { filterChain.doFilter(httpServletRequest, httpServletResponse); } }
Source:
<code>public void onOpenDataFile(OpenDataFileEvent event) { final String dataFilePath = event.getFile().getPath(); <START> if (dataFilePath.endsWith(".rds")) <END> { globalDisplay_.promptForText( "Load R Object", "Load '" + dataFilePath + "' into an R object named:", FilePathUtils.fileNameSansExtension(dataFilePath), new ProgressOperationWithInput<String>() { @Override public void execute(String input, ProgressIndicator indicator) { if (!RegexUtil.isSyntacticRIdentifier(input)) input = "`" + input.replaceAll("`", "\\\\`") + "`"; consoleDispatcher_.executeCommand( input + " <- readRDS", dataFilePath); indicator.onCompleted(); } }); } else { globalDisplay_.showYesNoMessage(GlobalDisplay.MSG_QUESTION, "Confirm Load RData", "Do you want to load the R data file \"" + dataFilePath + "\" " + "into the global environment?", new ProgressOperation() { public void execute(ProgressIndicator indicator) { consoleDispatcher_.executeCommand( "load", FileSystemItem.createFile(dataFilePath)); indicator.onCompleted(); } }, true); } }</code><technical_language>this need case-insensitive</technical_language>

Target:
public void onOpenDataFile(OpenDataFileEvent event) { final String dataFilePath = event.getFile().getPath(); if (Pattern.create("[.]rds$", "i").test(dataFilePath)) { globalDisplay_.promptForText( "Load R Object", "Load '" + dataFilePath + "' into an R object named:", FilePathUtils.fileNameSansExtension(dataFilePath), new ProgressOperationWithInput<String>() { @Override public void execute(String input, ProgressIndicator indicator) { if (!RegexUtil.isSyntacticRIdentifier(input)) input = "`" + input.replaceAll("`", "\\\\`") + "`"; consoleDispatcher_.executeCommand( input + " <- readRDS", dataFilePath); indicator.onCompleted(); } }); } else { globalDisplay_.showYesNoMessage(GlobalDisplay.MSG_QUESTION, "Confirm Load RData", "Do you want to load the R data file \"" + dataFilePath + "\" " + "into the global environment?", new ProgressOperation() { public void execute(ProgressIndicator indicator) { consoleDispatcher_.executeCommand( "load", FileSystemItem.createFile(dataFilePath)); indicator.onCompleted(); } }, true); } }
Source:
<code>private void moveJobToAddressModeTaskQueue() { if (!addressModeOn) { return; } taskQueuer.scheduleAdminEmailPreparationInAddressMode(emailId, addressReceiverListString); <START> statusToAdmin += "<br/>" + "Receipient: " + addressReceiverListString; <END> statusToUser.add(new StatusMessage("Email will be sent within an hour to " + addressReceiverListString, StatusMessageColor.SUCCESS)); }</code><technical_language>* Receipient -> recipient? * safe do a +=. @xpdavid correct if wrong, statusToAdmin is default initialized empty String anywhere; declared String statusToAdmin initialized Action.execute()</technical_language>

Target:
private void moveJobToAddressModeTaskQueue() { if (!addressModeOn) { return; } taskQueuer.scheduleAdminEmailPreparationInAddressMode(emailId, addressReceiverListString); statusToAdmin += "<br/>" + "Recipient: " + addressReceiverListString; statusToUser.add(new StatusMessage("Email will be sent within an hour to " + addressReceiverListString, StatusMessageColor.SUCCESS)); }
Source:
<code>public PatchSet getBasePatchSet(ChangeEdit edit) throws IOException, InvalidChangeOperationException { Change change = edit.getChange(); Repository repo = gitManager.openRepository(change.getProject()); try { RevWalk rw = new RevWalk(repo); <START> ObjectInserter inserter = repo.newObjectInserter(); <END> try { RevCommit editCommit = rw.parseCommit(edit.getRef().getObjectId()); return getBasePatchSet(edit, editCommit); } finally { inserter.release(); rw.release(); } } finally { repo.close(); } }</code><technical_language>Unused</technical_language>

Target:
public PatchSet getBasePatchSet(ChangeEdit edit) throws IOException, InvalidChangeOperationException { Change change = edit.getChange(); Repository repo = gitManager.openRepository(change.getProject()); try { RevWalk rw = new RevWalk(repo); try { return getBasePatchSet(edit, rw.parseCommit( edit.getRef().getObjectId())); } finally { rw.release(); } } finally { repo.close(); } }
Source:
<code>public void returnsMessage() throws Exception { <START> final Response mock = new Response("A message", Status.OK); <END> Assert.assertEquals(Status.OK, mock.status()); }</code><technical_language>This is a mock, actual Response instance. call response</technical_language>

Target:
public void returnsMessage() throws Exception { final Response response = new Response("A message", Status.OK); MatcherAssert.assertThat( response.status(), Matchers.equalTo(Status.OK) ); }
Source:
<code>private boolean applyTypedFilter(Instance instance) { for (String type : this.typeFilters.keySet()) { <START> if (instance.getDefinition().getName().getLocalPart().equals(type + "Type")) { <END> for (Filter innerFilter : this.typeFilters.get(type)) { if (innerFilter.match(instance)) return true; } return false; } } return true; }</code><technical_language>Matching a type is easy. I a good idea (1) add a method dedicated check a type expression a type (2) discuss shortly expression matched</technical_language>

Target:
private boolean applyTypedFilter(Instance instance) { for (String type : this.typeFilters.keySet()) { if (checkType(instance.getDefinition(), type)) { for (Filter innerFilter : this.typeFilters.get(type)) { if (innerFilter.match(instance)) return true; } return false; } } return false; }
Source:
<code>double getExistingEditorWidth() { double existingWidth = DMNGridColumn.DEFAULT_WIDTH; final GridCell<?> cell = model.getRow(0).getCells().get(0); if (cell != null) { final GridCellValue<?> value = cell.getValue(); if (value instanceof ExpressionCellValue) { final ExpressionCellValue ecv = (ExpressionCellValue) value; final Optional<BaseExpressionGrid> editor = ecv.getValue(); if (editor.isPresent()) { final BaseExpressionGrid beg = editor.get(); existingWidth = Math.max(existingWidth, beg.getWidth() + beg.getPadding() * 2); existingWidth = Math.max(existingWidth, <START> beg.getMinimumWidth() + beg.getPadding() * 2); <END> } } } return existingWidth; }</code><technical_language>is this more readable, performance leaving decision java existingWidth = Collections.max(Arrays.asList(existingWidth, beg.getWidth() + beg.getPadding() * 2, beg.getMinimumWidth() + beg.getPadding() * 2));</technical_language>

Target:
double getExistingEditorWidth() { double existingWidth = DMNGridColumn.DEFAULT_WIDTH; final GridCell<?> cell = model.getRow(0).getCells().get(0); if (cell != null) { final GridCellValue<?> value = cell.getValue(); if (value instanceof ExpressionCellValue) { final ExpressionCellValue ecv = (ExpressionCellValue) value; final Optional<BaseExpressionGrid> editor = ecv.getValue(); if (editor.isPresent()) { final BaseExpressionGrid beg = editor.get(); existingWidth = Collections.max(Arrays.asList(existingWidth, beg.getWidth() + beg.getPadding() * 2, beg.getMinimumWidth() + beg.getPadding() * 2)); } } } return existingWidth; }