auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public boolean canExecute(@NonNull ITmfTrace trace) { <END> for (TmfAnalysisRequirement requirement : getAnalysisRequirements()) { if (!requirement.fulfill(trace)) { return false; } } return true; }</code><technical_language>annotations inherited, repeat them. hurt I guess</technical_language>

Target:
public boolean canExecute(@NonNull ITmfTrace trace) { for (TmfAnalysisRequirement requirement : getAnalysisRequirements()) { if (!requirement.isFulfilled(trace)) { return false; } } return true; }
Source:
<code>void setPluginName(String name) { <START> if (!name.isEmpty()) { <END> this.pluginName = name; } }</code><technical_language>!Strings.isNullOrEmpty(name)</technical_language>

Target:
void setPluginName(String name) { if (!Strings.isNullOrEmpty(name)) { this.pluginName = name; } }
Source:
<code>public void should_compute_annotations_on_workflow() { MavenInstallation.installMaven(jenkins, "M3", "3.3.3"); WorkflowJob job = jenkins.jobs.create(WorkflowJob.class); job.script.set( "node {\n" + <START> " git '<LINK_0>'\n" + <END> " def mvnHome = tool 'M3'\n" + " sh \"${mvnHome}/bin/mvn -B -Dmaven.test.failure.ignore verify\"\n" + " step([$class: 'FindBugsPublisher', pattern: '**/findbugsXml.xml'])\n" + " step([$class: 'CheckStylePublisher'])\n" + " step([$class: 'AnalysisPublisher'])\n" + "}"); job.sandbox.check(); job.save(); final Build build = job.startBuild(); build.shouldSucceed(); assertThat(build, hasAction("Static Analysis Warnings")); AnalysisCollectorAction action = new AnalysisCollectorAction(build); action.open(); assertThat(action.getNumberOfWarnings(), is(17)); assertThat(action.getNumberOfNewWarnings(), is(17)); }</code><technical_language>Do idea of automated test relying some mutable repository in some personal account</technical_language>

Target:
public void should_compute_annotations_on_workflow() { WorkflowJob job = jenkins.jobs.create(WorkflowJob.class); job.script.set( "node {\n" + job.copyResourceStep(ANALYSIS_COLLECTOR_PLUGIN_RESOURCES + "/checkstyle-result.xml") + job.copyResourceStep(ANALYSIS_COLLECTOR_PLUGIN_RESOURCES +"/findbugs.xml") + " step([$class: 'FindBugsPublisher', pattern: '**/findbugs.xml'])\n" + " step([$class: 'CheckStylePublisher'])\n" + " step([$class: 'AnalysisPublisher'])\n" + "}"); job.sandbox.check(); job.save(); final Build build = job.startBuild(); build.shouldSucceed(); assertThat(build, hasAction("Static Analysis Warnings")); AnalysisCollectorAction action = new AnalysisCollectorAction(build); action.open(); assertThat(action.getNumberOfWarnings(), is(FINDBUGS_ALL + CHECKSTYLE_ALL)); assertThat(action.getNumberOfNewWarnings(), is(FINDBUGS_ALL + CHECKSTYLE_ALL)); }
Source:
<code>public void canConvertToStringWithBothMethodAndClassName() { AtlasDbStackTraceElement element = ImmutableAtlasDbStackTraceElement.builder() .className(CLASS_NAME) .methodName(METHOD_NAME) .build(); <START> assertThat(element.toString()) <END> .contains(CLASS_NAME) .contains(METHOD_NAME); }</code><technical_language>extract assertClassAndMethodName(stackTraceElement, className, methodName)</technical_language>

Target:
public void canConvertToStringWithBothMethodAndClassName() { AtlasDbStackTraceElement element = ImmutableAtlasDbStackTraceElement.builder() .className(CLASS_NAME) .methodName(METHOD_NAME) .build(); assertClassAndMethodName(element, CLASS_NAME, METHOD_NAME); }
Source:
<code>@Override public void unparseSqlIntervalLiteral( SqlWriter writer, SqlIntervalLiteral literal, int leftPrec, int rightPrec) { SqlIntervalLiteral.IntervalValue interval = <START> (SqlIntervalLiteral.IntervalValue) literal.getValue(); <END> writer.keyword("INTERVAL"); if (interval.getSign() == -1) { writer.print("-"); } writer.literal(literal.getValue().toString()); unparseSqlIntervalQualifier(writer, interval.getIntervalQualifier(), RelDataTypeSystem.DEFAULT); }</code><technical_language>Calcite allows a pure string interval value, if BigQuery allows int64 format, check throw for other non-integers values</technical_language>

Target:
@Override public void unparseSqlIntervalLiteral( SqlWriter writer, SqlIntervalLiteral literal, int leftPrec, int rightPrec) { SqlIntervalLiteral.IntervalValue interval = (SqlIntervalLiteral.IntervalValue) literal.getValue(); writer.keyword("INTERVAL"); if (interval.getSign() == -1) { writer.print("-"); } Long intervalValueInLong; try { intervalValueInLong = Long.parseLong(literal.getValue().toString()); } catch (NumberFormatException e) { throw new RuntimeException("Only INT64 is supported as the interval value for BigQuery."); } writer.literal(intervalValueInLong.toString()); unparseSqlIntervalQualifier(writer, interval.getIntervalQualifier(), RelDataTypeSystem.DEFAULT); }
Source:
<code>protected ServerImpl updateServer(ServerImpl server) { super.updateServer(server); if (!Strings.isNullOrEmpty(cheDockerCustomExternalProtocol)) { ServerPropertiesImpl properties = (ServerPropertiesImpl) server.getProperties(); String url = properties.getInternalUrl(); <START> if(url != null && url.startsWith("http:")) { <END> int length = "http".length(); properties.setInternalUrl(cheDockerCustomExternalProtocol.concat(url.substring(length))); } } return server; }</code><technical_language>@davidfestal formatting in if(. extract some method e.g. isHttp(String url) please clarify is done in updateServer internal URL is updated is http based</technical_language>

Target:
protected ServerImpl updateServer(ServerImpl server) { super.updateServer(server); setExternalProtocolForInternalUrl(server); return server; }
Source:
<code>public TransactionParser getParser(KXmlParser parser) { String namespace = parser.getNamespace(); String name = parser.getName(); TransactionParser superParser = super.getParser(parser); <START> if(superParser != null){ <END> return superParser; } if("message".equalsIgnoreCase(name)) { return new TransactionParser<String>(parser) { String nature = parser.getAttributeValue(null, "nature"); public void commit(String parsed) throws IOException { } public String parse() throws InvalidStructureException,IOException, XmlPullParserException, UnfullfilledRequirementsException { message = parser.nextText(); if(nature != null) { if(message != null) { messages.put(nature, message); } } return message; } }; } return null; }</code><technical_language>I if for future-proofing this check _after_ of internal ones? want default assumption override superclass's parsing behavior if supply parser for something</technical_language>

Target:
public TransactionParser getParser(KXmlParser parser) { String namespace = parser.getNamespace(); String name = parser.getName(); if("message".equalsIgnoreCase(name)) { return new TransactionParser<String>(parser) { String nature = parser.getAttributeValue(null, "nature"); public void commit(String parsed) throws IOException { } public String parse() throws InvalidStructureException,IOException, XmlPullParserException, UnfullfilledRequirementsException { message = parser.nextText(); if(nature != null) { if(message != null) { messages.put(nature, message); } } return message; } }; } TransactionParser superParser = super.getParser(parser); if(superParser != null){ return superParser; } return null; }
Source:
<code>private int convertToDate(Object object) { final long millis; if (object instanceof Integer) { final Integer value = (Integer) object; <START> millis = (long) value * MILLIS_PER_DAY; <END> } else { final LocalDate value = (LocalDate) object; millis = value.toDate().getTime(); } return (int) (millis / MILLIS_PER_DAY); }</code><technical_language>return day value. need recomute MILLIS_PER_DAY</technical_language>

Target:
private int convertToDate(Object object) { if (object instanceof Integer) { return (Integer) object; } else { final LocalDate value = (LocalDate) object; return (int) (toTimestampData(value.toDate().getTime()).getMillisecond() / MILLIS_PER_DAY); } }
Source:
<code><START> String translate(RexNode e, boolean set, boolean formatDateString) { <END> int index = -1; switch (e.getKind()) { case INPUT_REF: final RexInputRef ref = (RexInputRef) e; index = ref.getIndex(); break; case CAST: return tr(e, 0, set, formatDateString); case LITERAL: if (!formatDateString) { return ((RexLiteral) e).getValue3().toString(); } else { switch (((RexLiteral) e).getTypeName()) { case TIMESTAMP_WITH_LOCAL_TIME_ZONE: case TIMESTAMP: case DATE: Long val = ((RexLiteral) e).getValueAs(Long.class); return dateFormatter.format(val); default: return ((RexLiteral) e).getValue3().toString(); } } case FLOOR: case EXTRACT: final RexCall call = (RexCall) e; assert DruidDateTimeUtils.extractGranularity(call) != null; index = RelOptUtil.InputFinder.bits(e).asList().get(0); break; case IS_TRUE: return ""; } if (index == -1) { throw new AssertionError("invalid expression " + e); } final String fieldName = rowType.getFieldList().get(index).getName(); if (set) { if (druidTable.metricFieldNames.contains(fieldName)) { metrics.add(fieldName); } else if (!druidTable.timestampFieldName.equals(fieldName) && !DruidTable.DEFAULT_TIMESTAMP_COLUMN.equals(fieldName)) { dimensions.add(fieldName); } } return fieldName; }</code><technical_language>java docs formatDateString is for</technical_language>

Target:
String translate(RexNode e, boolean set, boolean formatDateString) { int index = -1; switch (e.getKind()) { case INPUT_REF: final RexInputRef ref = (RexInputRef) e; index = ref.getIndex(); break; case CAST: return tr(e, 0, set, formatDateString); case LITERAL: final RexLiteral rexLiteral = (RexLiteral) e; if (!formatDateString) { return Objects.toString(rexLiteral.getValue3()); } else { TimestampString timestampString = DruidDateTimeUtils .literalValue(e, TimeZone.getTimeZone(timeZone)); if (timestampString == null) { throw new AssertionError( "Cannot translate Literal" + e + " of type " + rexLiteral.getTypeName() + " to TimestampString"); } return dateFormatter.format(timestampString.getMillisSinceEpoch()); } case FLOOR: case EXTRACT: final RexCall call = (RexCall) e; assert DruidDateTimeUtils.extractGranularity(call) != null; index = RelOptUtil.InputFinder.bits(e).asList().get(0); break; case IS_TRUE: return ""; } if (index == -1) { throw new AssertionError("invalid expression " + e); } final String fieldName = rowType.getFieldList().get(index).getName(); if (set) { if (druidTable.metricFieldNames.contains(fieldName)) { metrics.add(fieldName); } else if (!druidTable.timestampFieldName.equals(fieldName) && !DruidTable.DEFAULT_TIMESTAMP_COLUMN.equals(fieldName)) { dimensions.add(fieldName); } } return fieldName; }
Source:
<code>public DataSource call() throws Exception { try { Class.forName(CONNECTION_POOL_DRIVER); } catch (Exception ex) { <START> throw new OseeDataStoreException(ex, "Error loading connectino pool driver [%s]", CONNECTION_POOL_DRIVER); <END> } ConnectionFactory connectionFactory = createConnectionFactory(dbInfo); ObjectPool<Connection> connectionPool = new GenericObjectPool<Connection>(); @SuppressWarnings({"rawtypes", "unchecked"}) KeyedObjectPoolFactory statementPool = new GenericKeyedObjectPoolFactory(null); new PoolableConnectionFactory(connectionFactory, connectionPool, statementPool, null, false, true); DataSource dataSource = new PoolingDataSource(connectionPool); String poolId = dbInfo.getId(); PoolingDriver driver = poolingDriver.get(); driver.registerPool(poolId, connectionPool); return dataSource; }</code><technical_language>typo</technical_language>

Target:
public DataSource call() throws Exception { try { Class.forName(CONNECTION_POOL_DRIVER); } catch (Exception ex) { throw new OseeDataStoreException(ex, "Error loading connection pool driver [%s]", CONNECTION_POOL_DRIVER); } ConnectionFactory connectionFactory = createConnectionFactory(dbInfo); ObjectPool<Connection> connectionPool = new GenericObjectPool<Connection>(); @SuppressWarnings({"rawtypes", "unchecked"}) KeyedObjectPoolFactory statementPool = new GenericKeyedObjectPoolFactory(null); new PoolableConnectionFactory(connectionFactory, connectionPool, statementPool, null, false, true); DataSource dataSource = new PoolingDataSource(connectionPool); String poolId = dbInfo.getId(); PoolingDriver driver = poolingDriver.get(); driver.registerPool(poolId, connectionPool); return dataSource; }
Source:
<code>static URI relativize(URI current, URI target) { <START> if ((current.getHost() == null) != (target.getHost() == null)) { <END> return target; } if (current.getHost() != null && !current.getHost().equals(target.getHost())) { return target; } String cur = current.normalize().getPath(); String dest = target.normalize().getPath(); if (cur.startsWith(SLASH) != dest.startsWith(SLASH)) { return target; } while (cur.startsWith(SLASH)) { cur = cur.substring(1); } while (dest.startsWith(SLASH)) { dest = dest.substring(1); } if (cur.indexOf('/') == -1 || dest.indexOf('/') == -1) { String prefix = "prefix/"; cur = prefix + cur; dest = prefix + dest; } if (!cur.endsWith(SLASH)) { int lastSlash = cur.lastIndexOf('/'); cur = cur.substring(0, lastSlash); } String destFile = ""; if (!dest.endsWith(SLASH)) { int lastSlash = dest.lastIndexOf('/'); destFile = dest.substring(lastSlash + 1, dest.length()); dest = dest.substring(0, dest.lastIndexOf('/')); } String[] cs = cur.split(SLASH); String[] ds = dest.split(SLASH); int common = 0; while (common < cs.length && common < ds.length && cs[common].equals(ds[common])) { common++; } StringJoiner j = new StringJoiner(SLASH); for (int i = common; i < cs.length; i++) { j.add(".."); } for (int i = common; i < ds.length; i++) { j.add(ds[i]); } j.add(destFile); return URI.create(j.toString()); }</code><technical_language>simplify Objects.equals <<LINK_0>,%20java.lang.Object)></technical_language>

Target:
static URI relativize(URI current, URI target) { if (!Objects.equals(current.getHost(), target.getHost())) { return target; } String cur = current.normalize().getPath(); String dest = target.normalize().getPath(); if (cur.startsWith(SLASH) != dest.startsWith(SLASH)) { return target; } while (cur.startsWith(SLASH)) { cur = cur.substring(1); } while (dest.startsWith(SLASH)) { dest = dest.substring(1); } if (cur.indexOf('/') == -1 || dest.indexOf('/') == -1) { String prefix = "prefix/"; cur = prefix + cur; dest = prefix + dest; } if (!cur.endsWith(SLASH)) { int lastSlash = cur.lastIndexOf('/'); cur = cur.substring(0, lastSlash); } String destFile = ""; if (!dest.endsWith(SLASH)) { int lastSlash = dest.lastIndexOf('/'); destFile = dest.substring(lastSlash + 1, dest.length()); dest = dest.substring(0, dest.lastIndexOf('/')); } String[] cs = cur.split(SLASH); String[] ds = dest.split(SLASH); int common = 0; while (common < cs.length && common < ds.length && cs[common].equals(ds[common])) { common++; } StringJoiner j = new StringJoiner(SLASH); for (int i = common; i < cs.length; i++) { j.add(".."); } for (int i = common; i < ds.length; i++) { j.add(ds[i]); } j.add(destFile); return URI.create(j.toString()); }
Source:
<code>public void doSelectRow() { initRowHighlighting(); if (TeclaApp.persistence.isSelfScanningEnabled()) { <START> delaySelfScanning(); <END> } }</code><technical_language>necessary this function, lines suffice pauseSelfScanning(); mHandler.postDelayed(mScanRunnable, Math.round(1.5 * TeclaApp.persistence.getScanDelay()));</technical_language>

Target:
public void doSelectRow() { initRowHighlighting(); if (TeclaApp.persistence.isSelfScanningEnabled()) { pauseSelfScanning(); mHandler.postDelayed(mScanRunnable, mScanDelay); } }
Source:
<code><START> public void binaryType(BinaryType binaryType) { <END> webSocket.binaryType(binaryType.name()); }</code><technical_language>return this expose kind of fluent API</technical_language>

Target:
public void binaryType(BinaryType binaryType) { webSocket.setBinaryType(JSString.valueOf(binaryType.name())); }
Source:
<code>public BulkMutation(String tableName) { this.builder = MutateRowsRequest.newBuilder().setTableName(tableName); <START> size = MutateRowsRequest.newBuilder().setTableName(tableName).build().getSerializedSize(); <END> }</code><technical_language>this.size for consistency</technical_language>

Target:
public BulkMutation(String tableName) { this.builder = MutateRowsRequest.newBuilder().setTableName(tableName); this.size = MutateRowsRequest.newBuilder().setTableName(tableName).build().getSerializedSize(); }
Source:
<code>private String getLaserLimits(Observation observation, ClearanceWindow clearance) { String fmt = "HH:mm:ss"; LaserTarget scienceTarget = observation.getScienceTarget().getLaserTarget(); for (Visibility.Interval visibility : scienceTarget.getVisibility().getAboveLaserLimit()) { <START> long vStart = visibility.getStart().getTime() / DateTimeUtils.MillisecondsPerSecond(); END> long vEnd = visibility.getEnd().getTime() / DateTimeUtils.MillisecondsPerSecond(); long cStart = clearance.getStart().getTime() / DateTimeUtils.MillisecondsPerSecond(); long cEnd = clearance.getEnd().getTime() / DateTimeUtils.MillisecondsPerSecond(); if (vStart > cStart && vStart < cEnd) { return "(rises above " + LimitsListener.MIN_ELEVATION_ERROR_LIMIT + "&deg; at " + formatDate(fmt, visibility.getStart().getTime()) + ")"; } if (vEnd > cStart && vEnd < cEnd) { return "(sets below " + LimitsListener.MIN_ELEVATION_ERROR_LIMIT + "&deg; at " + formatDate(fmt, visibility.getEnd().getTime()) + ")"; } } return ""; }</code><technical_language>is MillisecodnsPerSecond a function. Sounds a constant</technical_language>

Target:
private String getLaserLimits(Observation observation, ClearanceWindow clearance) { String fmt = "HH:mm:ss"; LaserTarget scienceTarget = observation.getScienceTarget().getLaserTarget(); final long msPerSecs = TimeUnit.SECONDS.toMillis(1); for (Visibility.Interval visibility : scienceTarget.getVisibility().getAboveLaserLimit()) { long vStart = visibility.getStart().getTime() / msPerSecs; long vEnd = visibility.getEnd().getTime() / msPerSecs; long cStart = clearance.getStart().getTime() / msPerSecs; long cEnd = clearance.getEnd().getTime() / msPerSecs; if (vStart > cStart && vStart < cEnd) { return "(rises above " + LimitsListener.MIN_ELEVATION_ERROR_LIMIT + "&deg; at " + formatDate(fmt, visibility.getStart().getTime()) + ")"; } if (vEnd > cStart && vEnd < cEnd) { return "(sets below " + LimitsListener.MIN_ELEVATION_ERROR_LIMIT + "&deg; at " + formatDate(fmt, visibility.getEnd().getTime()) + ")"; } } return ""; }
Source:
<code>private Option<? extends Command> getRefreshOpenedRepresentationsCommand(boolean isChanged) { Option<? extends Command> result = Options.newNone(); Collection<DRepresentation> representationsToRefresh = new LinkedHashSet<DRepresentation>(); if (isChanged && <START> (!isForceRefresh() || isAutoRefresh())) <END> { representationsToRefresh.addAll(RefreshFilterManager.INSTANCE.getOpenedRepresantationsToRefresh()); } representationsToRefresh.addAll(representationsToForceRefresh); restrictRepresentationWithinCurrentEditingDomain(representationsToRefresh); if (!representationsToRefresh.isEmpty()) { CompoundCommand cc = new CompoundCommand(); cc.append(new RefreshRepresentationsCommand(transactionalEditingDomain, new NullProgressMonitor(), representationsToRefresh)); for (PostRefreshCommandFactory listener : postRefreshCommandFactories) { cc.appendIfCanExecute(listener.getPostCommandToExecute(transactionalEditingDomain, representationsToRefresh)); } postRefreshCommandFactories.clear(); result = Options.newSome(cc); } return result; }</code><technical_language>is needed? is isAutoRefresh sufficient? In case, forceRefresh represenatations refreshed representationsToRefresh is a set</technical_language>

Target:
private Option<? extends Command> getRefreshOpenedRepresentationsCommand(boolean isChanged) { Option<? extends Command> result = Options.newNone(); Collection<DRepresentation> representationsToRefresh = new LinkedHashSet<DRepresentation>(); if (isChanged && isAutoRefresh()) { representationsToRefresh.addAll(RefreshFilterManager.INSTANCE.getOpenedRepresantationsToRefresh()); } representationsToRefresh.addAll(representationsToForceRefresh); restrictRepresentationWithinCurrentEditingDomain(representationsToRefresh); if (!representationsToRefresh.isEmpty()) { CompoundCommand cc = new CompoundCommand(); cc.append(new RefreshRepresentationsCommand(transactionalEditingDomain, new NullProgressMonitor(), representationsToRefresh)); for (PostRefreshCommandFactory listener : postRefreshCommandFactories) { cc.appendIfCanExecute(listener.getPostCommandToExecute(transactionalEditingDomain, representationsToRefresh)); } postRefreshCommandFactories.clear(); result = Options.newSome(cc); } return result; }
Source:
<code>public void testBroadcastSerialDataReceiveSubscribedRx16() throws Exception { Mockito.when(rx16Packet.getReceiveOptions()).thenReturn(RECEIVE_OPTIONS_BROADCAST); dataReader.addSerialDatatReceiveListener(receiveSerialDataListener); Whitebox.invokeMethod(dataReader, PACKET_RECEIVED_METHOD, rx16Packet); PowerMockito.verifyPrivate(dataReader, Mockito.times(1)).invoke(NOTIFY_SERIAL_DATA_RECEIVED_METHOD, XBEE_16BIT_ADDRESS.toString(), RECEIVED_DATA_BYTES, IS_BROADCAST_DATA); Mockito.verify(receiveSerialDataListener, Mockito.times(1)).broadcastSerialDataReceived(XBEE_16BIT_ADDRESS.toString(), RECEIVED_DATA_BYTES); <START> <END> assertEquals(XBEE_16BIT_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 testBroadcastSerialDataReceiveSubscribedRx16() throws Exception { Mockito.when(rx16Packet.getReceiveOptions()).thenReturn(RECEIVE_OPTIONS_BROADCAST); dataReader.addSerialDatatReceiveListener(receiveSerialDataListener); Whitebox.invokeMethod(dataReader, PACKET_RECEIVED_METHOD, rx16Packet); PowerMockito.verifyPrivate(dataReader, Mockito.times(1)).invoke(NOTIFY_SERIAL_DATA_RECEIVED_METHOD, XBEE_16BIT_ADDRESS.toString(), RECEIVED_DATA_BYTES, IS_BROADCAST_DATA); Mockito.verify(receiveSerialDataListener, Mockito.times(1)).broadcastSerialDataReceived(XBEE_16BIT_ADDRESS.toString(), RECEIVED_DATA_BYTES); Mockito.verify(receiveSerialDataListener, Mockito.never()).serialDataReceived(Mockito.anyString(), (byte[])Mockito.any()); assertEquals(XBEE_16BIT_ADDRESS.toString(), receiveSerialDataListener.getAddress()); assertArrayEquals(RECEIVED_DATA_BYTES, receiveSerialDataListener.getSerialData()); }
Source:
<code>public OracleReturning(RowMapper<ResultType> mapper) { this.mapper = mapper; try { <START> this.oraclePS = Class.forName("oracle.jdbc.OraclePreparedStatement"); <END> this.registerReturnParameter = oraclePS.getMethod("registerReturnParameter", new Class[]{int.class, int.class}); this.getReturnResultSet = oraclePS.getMethod("getReturnResultSet"); } catch (Exception e) { throw new RuntimeException(e); } }</code><technical_language>Do need do this reflective bullshit in a separate artifact</technical_language>

Target:
public OracleReturning(RowMapper<ResultType> mapper) { this.mapper = mapper; }
Source:
<code>public void testJavascriptFunctionInvocation() { deployProcess(JAVASCRIPT, "function sum(a,b){" + " return a+b;" + "};" + "var result = sum(1,2);" + "execution.setVariable('foo', result);" ); ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess"); Object variable = runtimeService.getVariable(pi.getId(), "foo"); <START> if (variable instanceof Integer) { assertEquals(3.0, variable); } else assertEquals(3, variable); } <END></code><technical_language>If JDK 6/7 returned a double JDK 8+ return Integer, simplify this block java assertEquals(3, variable); expecting JDK8+ on</technical_language>

Target:
public void testJavascriptFunctionInvocation() { deployProcess(JAVASCRIPT, "function sum(a,b){" + " return a+b;" + "};" + "var result = sum(1,2);" + "execution.setVariable('foo', result);" ); ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess"); Object variable = runtimeService.getVariable(pi.getId(), "foo"); assertThat(variable).isIn(3, 3.0); }
Source:
<code>CompletableFuture<Void> getFailureOp(CommitData cd) { <START> return CompletableFuture.supplyAsync(() -> { <END> try { rollbackLocks(cd); } catch (Exception e) { throw new CompletionException(e); } return null; }, env.getSharedResources().getSyncCommitExecutor()); }</code><technical_language>throws Exception is dropped rollbackLocks, this code : java CompletableFuture<Void> getFailureOp(CommitData cd) { return rollbackLocks(cd); }</technical_language>

Target:
CompletableFuture<Void> getFailureOp(CommitData cd) { return rollbackLocks(cd); }
Source:
<code>default Stream<T> leftPadTo(int length, T element) { <START> if (length <= 1) { <END> return this; } else if (isEmpty()) { return Stream.ofAll(Iterator.continually(element).take(length)); } else { return cons(element, () -> this.leftPadTo(length - 1, element)); } }</code><technical_language>this test fails java assertThat(empty().leftPadTo(1, 1)).isEqualTo(of(1)); I <code>if (length <= 1)</code> removed</technical_language>

Target:
default Stream<T> leftPadTo(int length, T element) { final int actualLength = length(); if (length <= actualLength) { return this; } else { return Stream.continually(element).take(length - actualLength).appendAll(this); } }
Source:
<code>public InterceptedMessageHandlingMember(MessageHandlingMember<T> original) { super(original); Method method = original.unwrap(Method.class).orElseThrow(() -> new AxonConfigurationException( <START> "The @MessageHandlerInterceptor must be on method.")); <END> shouldInvokeInterceptorChain = Arrays.stream(method.getParameters()) .noneMatch(p -> p.getType().equals(InterceptorChain.class)); if (shouldInvokeInterceptorChain && !Void.TYPE.equals(method.getReturnType())) { throw new AxonConfigurationException("@MessageHandlerInterceptor must return void or declare " + "InterceptorChain parameter."); } }</code><technical_language>suggestion "The @MessageHandlerInterceptor a method."));</technical_language>

Target:
public InterceptedMessageHandlingMember(MessageHandlingMember<T> original) { super(original); Method method = original.unwrap(Method.class).orElseThrow(() -> new AxonConfigurationException( "Only methods can be marked as MessageHandlerInterceptor. Violating handler: " + original.signature())); shouldInvokeInterceptorChain = Arrays.stream(method.getParameters()) .noneMatch(p -> p.getType().equals(InterceptorChain.class)); if (shouldInvokeInterceptorChain && !Void.TYPE.equals(method.getReturnType())) { throw new AxonConfigurationException("A MessageHandlerInterceptor must either return null or declare a parameter of type InterceptorChain. Violating handler: " + original.signature()); } }
Source:
<code>protected void setInitialState(ByteBuffer initialState) { if (m_shutdown.get()) { if (exportLog.isDebugEnabled()) { exportLog.debug("Shutdown, ignore initial state proposed on " + m_eds); } return; } try { m_eds.getExecutorService().execute(new Runnable() { @Override public void run() { try { if (exportLog.isDebugEnabled()) { exportLog.debug("Set initial state on host: " + m_hostId); } Integer newLeaderHostId = initialState.getInt(); m_leaderHostId = newLeaderHostId; StringBuilder sb = new StringBuilder("Initialized export coordinator: host ") .append(m_leaderHostId) .append(isPartitionLeader() ? " (localHost) " : " ") .append("is the leader at initial state"); if (isPartitionLeader()) { exportLog.info(sb.toString()); } else if (exportLog.isDebugEnabled()) { <START> exportLog.debug(sb.toString()); <END> } setCoordinatorInitialized(); invokeNext(); } catch (Exception e) { exportLog.error("Failed to change to initial state leader: " + e); } } }); } catch (RejectedExecutionException rej) { if (exportLog.isDebugEnabled()) { exportLog.debug("Initial state rejected by: " + m_eds); } } catch (Exception e) { exportLog.error("Failed to handle initial state: " + e); } }</code><technical_language>build log message needed</technical_language>

Target:
protected void setInitialState(ByteBuffer initialState) { if (m_shutdown.get()) { if (exportLog.isDebugEnabled()) { exportLog.debug("Shutdown, ignore initial state proposed on " + m_eds); } return; } try { m_eds.getExecutorService().execute(new Runnable() { @Override public void run() { try { if (exportLog.isDebugEnabled()) { exportLog.debug("Set initial state on host: " + m_hostId); } Integer newLeaderHostId = initialState.getInt(); m_leaderHostId = newLeaderHostId; if (isPartitionLeader()) { exportLog.info(getLeaderMessageAtInitialState()); } else if (exportLog.isDebugEnabled()) { exportLog.debug(getLeaderMessageAtInitialState()); } setCoordinatorInitialized(); invokeNext(); } catch (Exception e) { exportLog.error("Failed to change to initial state leader: " + e); } } }); } catch (RejectedExecutionException rej) { if (exportLog.isDebugEnabled()) { exportLog.debug("Initial state rejected by: " + m_eds); } } catch (Exception e) { exportLog.error("Failed to handle initial state: " + e); } }
Source:
<code>public void writeExternal(ObjectOutput out) throws IOException { URI uri = toURI(); try { <START> System.out.println("writing " + uri.toASCIIString()); <END> out.writeUTF(uri.toASCIIString()); } catch (Exception e) { if (e instanceof IOException) { throw (IOException) e; } throw new IOException(e); } }</code><technical_language>removed</technical_language>

Target:
public void writeExternal(ObjectOutput out) throws IOException { URI uri = toURI(); try { out.writeUTF(uri.toASCIIString()); } catch (Exception e) { if (e instanceof IOException) { throw (IOException) e; } throw new IOException(e); } }
Source:
<code>public static void handleViewpointActivation(Session session, Set<Viewpoint> viewpointsToHandle, boolean activateViewpoint, boolean askUserForDependencyActivation) { Collection<Viewpoint> selectedViewpoints = session.getSelectedViewpoints(false); final SortedMap<Viewpoint, Boolean> originalViewpointsMap = Maps.newTreeMap(new ViewpointRegistry.ViewpointComparator()); Collection<Viewpoint> availableViewpoints = ViewpointHelper.getAvailableViewpoints(session); for (final Viewpoint viewpoint : availableViewpoints) { boolean selected = false; for (Viewpoint selectedViewpoint : selectedViewpoints) { if (EqualityHelper.areEquals(selectedViewpoint, viewpoint)) { selected = true; break; } } originalViewpointsMap.put(viewpoint, Boolean.valueOf(selected)); } SortedMap<Viewpoint, Boolean> newViewpointToSelectionStateMap = Maps.newTreeMap(new ViewpointRegistry.ViewpointComparator()); newViewpointToSelectionStateMap.putAll(originalViewpointsMap); <START> ArrayList<Viewpoint> arrayList = new ArrayList<>(); arrayList.addAll(newViewpointToSelectionStateMap.keySet()); <END> for (Viewpoint viewpoint : viewpointsToHandle) { newViewpointToSelectionStateMap.put(viewpoint, activateViewpoint); } Display.getCurrent().syncExec(() -> { ViewpointHelper.applyNewViewpointSelection(originalViewpointsMap, newViewpointToSelectionStateMap, session, true, new ViewpointSelectionCallbackWithConfimationAndDependenciesHandling(askUserForDependencyActivation)); }); }</code><technical_language>New local variable anywhere</technical_language>

Target:
public static void handleViewpointActivation(Session session, Set<Viewpoint> viewpointsToHandle, boolean activateViewpoint, boolean askUserForDependencyActivation) { Collection<Viewpoint> selectedViewpoints = session.getSelectedViewpoints(false); final SortedMap<Viewpoint, Boolean> originalViewpointsMap = Maps.newTreeMap(new ViewpointRegistry.ViewpointComparator()); Collection<Viewpoint> availableViewpoints = ViewpointHelper.getAvailableViewpoints(session); for (final Viewpoint viewpoint : availableViewpoints) { boolean selected = false; for (Viewpoint selectedViewpoint : selectedViewpoints) { if (EqualityHelper.areEquals(selectedViewpoint, viewpoint)) { selected = true; break; } } originalViewpointsMap.put(viewpoint, Boolean.valueOf(selected)); } SortedMap<Viewpoint, Boolean> newViewpointToSelectionStateMap = Maps.newTreeMap(new ViewpointRegistry.ViewpointComparator()); newViewpointToSelectionStateMap.putAll(originalViewpointsMap); for (Viewpoint viewpoint : viewpointsToHandle) { newViewpointToSelectionStateMap.put(viewpoint, activateViewpoint); } Display.getCurrent().syncExec(() -> { ViewpointHelper.applyNewViewpointSelection(originalViewpointsMap, newViewpointToSelectionStateMap, session, true, new ViewpointSelectionCallbackWithConfimationAndDependenciesHandling(askUserForDependencyActivation)); }); }
Source:
<code><START> public TransferDiskImageParameters createInitParams(DiskImage diskImage) { <END> TransferDiskImageParameters parameters = new TransferDiskImageParameters(); parameters.setTransferType(TransferType.Download); parameters.setImageGroupID(diskImage.getId()); String fileExtension = diskImage.getVolumeFormat() == VolumeFormat.COW ? ".qcow2" : ".raw"; parameters.setDownloadFilename(diskImage.getDiskAlias() + fileExtension); parameters.setTransferSize(diskImage.getActualSizeInBytes()); parameters.setTransferringViaBrowser(true); return parameters; }</code><technical_language>static avoid avoid redundant object creation startDownload</technical_language>

Target:
public static TransferDiskImageParameters createInitParams(DiskImage diskImage) { TransferDiskImageParameters parameters = new TransferDiskImageParameters(); parameters.setTransferType(TransferType.Download); parameters.setImageGroupID(diskImage.getId()); String fileExtension = diskImage.getVolumeFormat() == VolumeFormat.COW ? ".qcow2" : ".raw"; parameters.setDownloadFilename(diskImage.getDiskAlias() + fileExtension); parameters.setTransferSize(diskImage.getActualSizeInBytes()); parameters.setTransferringViaBrowser(true); return parameters; }
Source:
<code>public Item[] getDrops() { List<Item> drops = new ArrayList<>(); if (this.lastDamageCause instanceof EntityDamageByEntityEvent) { <START> int EnderPearl = Drops.rand(0, 3); END> for (int i = 0; i < EnderPearl; i++) { drops.add(Item.get(Item.ENDER_PEARL, 0, 1)); } } return drops.toArray(new Item[drops.size()]); }</code><technical_language>lowerCamelCase please, enderPearl**s**. P.S. 0-1</technical_language>

Target:
public Item[] getDrops() { List<Item> drops = new ArrayList<>(); if (this.lastDamageCause instanceof EntityDamageByEntityEvent) { int enderPearl = Drops.rand(0, 2); for (int i = 0; i < EnderPearl; i++) { drops.add(Item.get(Item.ENDER_PEARL, 0, 1)); } } return drops.toArray(new Item[drops.size()]); }
Source:
<code>public void addEdge(GenericEdge edge) { Objects.requireNonNull(edge); Objects.requireNonNull(edge.getId()); if (jungGraph.containsEdge(edge)) return; if(!this.getNamespace().equals(edge.getNamespace())){ throw new IllegalArgumentException( String.format("The namespace of the edge (%s) doesn't match the namespace of this graph (%s). Edge: %s ", edge.getNamespace(), this.getNamespace(), edge.toString())); } if (edge.getSource().getNamespace().equalsIgnoreCase(getNamespace()) && getVertex(edge.getSource().getId()) == null) { throw new IllegalArgumentException( <START> String.format("Adding an VertexRef to an unknown Vertex with id=%s in our namespace (%s). Please add the Vertex first to the graph", <END> edge.getSource().getId(), this.getNamespace())); } if (edge.getTarget().getNamespace().equalsIgnoreCase(getNamespace()) && getVertex(edge.getTarget().getId()) == null) { throw new IllegalArgumentException( String.format("Adding an VertexRef to an unknown Vertex with id=%s in our namespace (%s). Please add the Vertex first to the graph", edge.getTarget().getId(), this.getNamespace())); } jungGraph.addEdge(edge, edge.getSource(), edge.getTarget()); edgeToIdMap.put(edge.getId(), edge); }</code><technical_language>duplicate text here</technical_language>

Target:
public void addEdge(GenericEdge edge) { Objects.requireNonNull(edge); Objects.requireNonNull(edge.getId()); if (jungGraph.containsEdge(edge)) return; if(!this.getNamespace().equals(edge.getNamespace())){ throw new IllegalArgumentException( String.format("The namespace of the edge (%s) doesn't match the namespace of this graph (%s). Edge: %s ", edge.getNamespace(), this.getNamespace(), edge.toString())); } assertVertexFromSameNamespaceIsKnown(edge.getSource()); assertVertexFromSameNamespaceIsKnown(edge.getTarget()); jungGraph.addEdge(edge, edge.getSource(), edge.getTarget()); edgeToIdMap.put(edge.getId(), edge); }
Source:
<code>public int getNumberOfUnitsByType(long type, boolean inTransit, boolean lv) { int num = 0; for (Unit unit : getHangar().getUnits()) { if (!inTransit && !unit.isPresent()) { continue; } if (unit.isMothballed()) { if (type == Unit.ETYPE_MOTHBALLED) { num++; } continue; } Entity en = unit.getEntity(); <START> if (en instanceof GunEmplacement || en instanceof FighterSquadron || en instanceof Jumpship) { <END> continue; } if (type == Entity.ETYPE_MECH && en instanceof Mech) { num++; continue; } if (type == Entity.ETYPE_DROPSHIP && en instanceof Dropship) { num++; continue; } if (type == Entity.ETYPE_SMALL_CRAFT && en instanceof SmallCraft && !(en instanceof Dropship)) { num++; continue; } if (type == Entity.ETYPE_CONV_FIGHTER && en instanceof ConvFighter) { num++; continue; } if (type == Entity.ETYPE_AERO && en instanceof Aero && !(en instanceof SmallCraft || en instanceof ConvFighter)) { num++; continue; } if (type == Entity.ETYPE_INFANTRY && en instanceof Infantry && !(en instanceof BattleArmor)) { num++; continue; } if (type == Entity.ETYPE_BATTLEARMOR && en instanceof BattleArmor) { num++; continue; } if (type == Entity.ETYPE_TANK && en instanceof Tank) { if ((en.getWeight() <= 50 && lv) || (en.getWeight() > 50 && !lv)) { num++; } continue; } if (type == Entity.ETYPE_PROTOMECH && en instanceof Protomech) { num++; } } return num; }</code><technical_language>suggestion if ((en instanceof GunEmplacement) || (en instanceof FighterSquadron) || (en instanceof Jumpship)) {</technical_language>

Target:
public int getNumberOfUnitsByType(long type, boolean inTransit, boolean lv) { int num = 0; for (Unit unit : getHangar().getUnits()) { if (!inTransit && !unit.isPresent()) { continue; } if (unit.isMothballed()) { if (type == Unit.ETYPE_MOTHBALLED) { num++; } continue; } Entity en = unit.getEntity(); if ((en instanceof GunEmplacement) || (en instanceof FighterSquadron) || (en instanceof Jumpship)) { continue; } if ((type == Entity.ETYPE_MECH) && (en instanceof Mech)) { num++; continue; } if ((type == Entity.ETYPE_DROPSHIP) && (en instanceof Dropship)) { num++; continue; } if ((type == Entity.ETYPE_SMALL_CRAFT) && (en instanceof SmallCraft) && !(en instanceof Dropship)) { num++; continue; } if ((type == Entity.ETYPE_CONV_FIGHTER) && (en instanceof ConvFighter)) { num++; continue; } if ((type == Entity.ETYPE_AERO) && (en instanceof Aero) && !((en instanceof SmallCraft) || (en instanceof ConvFighter))) { num++; continue; } if ((type == Entity.ETYPE_INFANTRY) && (en instanceof Infantry) && !(en instanceof BattleArmor)) { num++; continue; } if ((type == Entity.ETYPE_BATTLEARMOR) && (en instanceof BattleArmor)) { num++; continue; } if ((type == Entity.ETYPE_TANK) && (en instanceof Tank)) { if (((en.getWeight() <= 50) && lv) || ((en.getWeight() > 50) && !lv)) { num++; } continue; } if ((type == Entity.ETYPE_PROTOMECH) && (en instanceof Protomech)) { num++; } } return num; }
Source:
<code>protected void updateVmPayload() { VmDeviceDAO dao = getVmDeviceDao(); VmPayload payload = getParameters().getVmPayload(); if (payload != null) { List<VmDevice> disks = dao.getVmDeviceByVmIdAndType(getVmId(), VmDeviceType.DISK.getName()); VmDevice oldPayload = null; for (VmDevice disk : disks) { if (VmPayload.isPayload(disk.getSpecParams())) { oldPayload = disk; break; } } if (oldPayload != null) { List<VmDeviceId> devs = new ArrayList<VmDeviceId>(); devs.add(oldPayload.getId()); dao.removeAll(devs); } VmDeviceUtils.addManagedDevice(new VmDeviceId(Guid.NewGuid(), getVmId()), VmDeviceType.DISK, payload.getType(), payload.getSpecParams(), true, true, <START> ""); <END> } }</code><technical_language>please remove alias setting (should encapsulated in addManagedDevice</technical_language>

Target:
protected void updateVmPayload() { VmDeviceDAO dao = getVmDeviceDao(); VmPayload payload = getParameters().getVmPayload(); if (payload != null) { List<VmDevice> disks = dao.getVmDeviceByVmIdAndType(getVmId(), VmDeviceType.DISK.getName()); VmDevice oldPayload = null; for (VmDevice disk : disks) { if (VmPayload.isPayload(disk.getSpecParams())) { oldPayload = disk; break; } } if (oldPayload != null) { List<VmDeviceId> devs = new ArrayList<VmDeviceId>(); devs.add(oldPayload.getId()); dao.removeAll(devs); } VmDeviceUtils.addManagedDevice(new VmDeviceId(Guid.NewGuid(), getVmId()), VmDeviceType.DISK, payload.getType(), payload.getSpecParams(), true, true); } }
Source:
<code>private HBox createNameArea() { HBox nameArea = new HBox(); nameText = new Text(panelName); nameText.setId(model.getDefaultRepo() + "_col" + panelIndex + "_nameText"); nameBox = new HBox(); nameBox.getChildren().add(nameText); nameBox.setMinWidth(330); nameBox.setMaxWidth(330); nameBox.setAlignment(Pos.CENTER_LEFT); nameBox.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent mouseEvent) { if (mouseEvent.getButton().equals(MouseButton.PRIMARY)) { if (mouseEvent.getClickCount() == 2) { <START> mouseEvent.consume(); <END> activateInplaceRename(); } } } }); renameButton = new Label(RENAME_PANEL); renameButton.getStyleClass().add("label-button"); renameButton.setId(model.getDefaultRepo() + "_col" + panelIndex + "_renameButton"); renameButton.setOnMouseClicked(e -> { e.consume(); activateInplaceRename(); }); HBox renameBox = new HBox(); renameBox.getChildren().add(renameButton); renameBox.setAlignment(Pos.TOP_RIGHT); nameArea.getChildren().addAll(nameBox, renameButton); nameArea.setMinWidth(360); nameArea.setMaxWidth(360); return nameArea; }</code><technical_language>This replaced a lambda. some nesting removed conditional: java boolean isDoubleClick = ... && ...; if (isDoubleClick) { ... } In future factor this out maybe, double clicks commonplace</technical_language>

Target:
private HBox createNameArea() { HBox nameArea = new HBox(); nameText = new Text(panelName); nameText.setId(model.getDefaultRepo() + "_col" + panelIndex + "_nameText"); nameBox = new HBox(); nameBox.getChildren().add(nameText); nameBox.setMinWidth(330); nameBox.setMaxWidth(330); nameBox.setAlignment(Pos.CENTER_LEFT); nameBox.setOnMouseClicked(mouseEvent -> { if (mouseEvent.getButton().equals(MouseButton.PRIMARY)) { if (mouseEvent.getClickCount() == 2) { mouseEvent.consume(); activateInplaceRename(); } } }); renameButton = new Label(RENAME_PANEL); renameButton.getStyleClass().add("label-button"); renameButton.setId(model.getDefaultRepo() + "_col" + panelIndex + "_renameButton"); renameButton.setOnMouseClicked(e -> { e.consume(); activateInplaceRename(); }); HBox renameBox = new HBox(); renameBox.getChildren().add(renameButton); renameBox.setAlignment(Pos.TOP_RIGHT); nameArea.getChildren().addAll(nameBox, renameButton); nameArea.setMinWidth(360); nameArea.setMaxWidth(360); return nameArea; }
Source:
<code>public void testGatewayScatterGather() { Message<?> bestQuoteMessage = this.gateway.exchange(new GenericMessage<String>("foo")); Object payload = bestQuoteMessage.getPayload(); assertThat(payload, instanceOf(List.class)); <START> assertThat(((List) payload).size(), greaterThanOrEqualTo(1)); <END> }</code><technical_language>(List<?>) (3 places)</technical_language>

Target:
public void testGatewayScatterGather() { Message<?> bestQuoteMessage = this.gateway.exchange(new GenericMessage<String>("foo")); Object payload = bestQuoteMessage.getPayload(); assertThat(payload, instanceOf(List.class)); assertThat(((List<?>) payload).size(), greaterThanOrEqualTo(1)); }
Source:
<code>public ISchedulerClient getSchedulerClient() throws SchedulerException { LOG.fine("Creating scheduler client"); ISchedulerClient schedulerClient; if (Context.schedulerService(config)) { SchedulerStateManagerAdaptor statemgr = Runtime.schedulerStateManagerAdaptor(runtime); Scheduler.SchedulerLocation schedulerLocation = statemgr.getSchedulerLocation(Runtime.topologyName(runtime)); if (schedulerLocation == null) { <START> throw new SchedulerException("Failed to get scheduler location"); <END> } LOG.log(Level.FINE, "Scheduler is listening on location: {0} ", schedulerLocation.toString()); schedulerClient = new HttpServiceSchedulerClient(config, runtime, schedulerLocation.getHttpEndpoint()); } else { final IScheduler scheduler = LauncherUtils.getInstance() .getSchedulerInstance(config, runtime); LOG.fine("Invoke scheduler as a library"); schedulerClient = new LibrarySchedulerClient(config, runtime, scheduler); } return schedulerClient; }</code><technical_language>append "from state manager"</technical_language>

Target:
public ISchedulerClient getSchedulerClient() throws SchedulerException { LOG.fine("Creating scheduler client"); ISchedulerClient schedulerClient; if (Context.schedulerService(config)) { SchedulerStateManagerAdaptor statemgr = Runtime.schedulerStateManagerAdaptor(runtime); Scheduler.SchedulerLocation schedulerLocation = statemgr.getSchedulerLocation(Runtime.topologyName(runtime)); if (schedulerLocation == null) { throw new SchedulerException("Failed to get scheduler location from state manager"); } LOG.log(Level.FINE, "Scheduler is listening on location: {0} ", schedulerLocation.toString()); schedulerClient = new HttpServiceSchedulerClient(config, runtime, schedulerLocation.getHttpEndpoint()); } else { final IScheduler scheduler = LauncherUtils.getInstance() .getSchedulerInstance(config, runtime); LOG.fine("Invoke scheduler as a library"); schedulerClient = new LibrarySchedulerClient(config, runtime, scheduler); } return schedulerClient; }
Source:
<code>protected String formatFileName(String filename, String count) { <START> StringBuilder sb = new StringBuilder(requireNonNull(filename)); <END> int offset = filename.lastIndexOf('.'); if (offset == -1) { offset = filename.length(); } sb.insert(offset, count); return sb.toString(); }</code><technical_language>org.apache.commons.io.FileNameUtils simplify code? java String.format("%s%s%s", FilenameUtils.getBaseName(filename), count, FilenameUtils.getExtension(filename));</technical_language>

Target:
protected String formatFileName(String filename, String count) { requireNonNull(filename); String extension = FilenameUtils.getExtension(filename); if (!extension.isBlank()) { extension = FilenameUtils.EXTENSION_SEPARATOR_STR + extension; } return String.format("%s%s%s", FilenameUtils.getBaseName(filename), count, extension); }
Source:
<code>private boolean isGenerative(final String methodType) { <START> return methodType.equals("GEN"); <END> }</code><technical_language>MethodType.GENERATIVE.getCode()</technical_language>

Target:
private boolean isGenerative(final String methodType) { return methodType.equals(MethodType.GENERATIVE.getCode()); }
Source:
<code>private boolean isAllowedVAADINBuildOrStaticUrl(String filenameWithPath) { <START> return filenameWithPath.startsWith("/" + VAADIN_BUILD_FILES_PATH) || filenameWithPath.startsWith("/" + VAADIN_STATIC_FILES_PATH) <END> || themeFolder.matcher(filenameWithPath).find(); }</code><technical_language>Add a line break ||</technical_language>

Target:
private boolean isAllowedVAADINBuildOrStaticUrl(String filenameWithPath) { return filenameWithPath.startsWith("/" + VAADIN_BUILD_FILES_PATH) || filenameWithPath.startsWith("/" + VAADIN_STATIC_FILES_PATH) || APP_THEME_PATTERN.matcher(filenameWithPath).find(); }
Source:
<code>public FailedLoginCounter() { buckets = new HashMap<Long, Map<String,Integer>>(); <START> userFailedAttempts = new HashMap<String,Integer>(); <END> }</code><technical_language>nice if this a tunable. please give a meaningful name</technical_language>

Target:
public FailedLoginCounter() { m_timeBucketQueue = new LinkedList<TimeBucket>(); m_userFailedAttempts = new HashMap<String,Integer>(); m_ipFailedAttempts = new HashMap<String,Integer>(); }