auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void applyDelete(MessageInfo messageInfo, RemoteReplicaInfo remoteReplicaInfo) throws StoreException { DataNodeId remoteNode = remoteReplicaInfo.getReplicaId().getDataNodeId(); try { messageInfo = <START> new MessageInfo(messageInfo.getStoreKey(), messageInfo.getSize(), false, messageInfo.isTtlUpdated(), false, <END> messageInfo.getExpirationTimeInMs(), messageInfo.getCrc(), messageInfo.getAccountId(), messageInfo.getContainerId(), messageInfo.getOperationTimeMs(), messageInfo.getLifeVersion()); remoteReplicaInfo.getLocalStore().delete(Collections.singletonList(messageInfo)); logger.trace("Remote node: Thread name: Remote replica: Key delete: {}", remoteNode, threadName, remoteReplicaInfo.getReplicaId(), messageInfo.getStoreKey()); } catch (StoreException e) { if (e.getErrorCode() == StoreErrorCodes.ID_Deleted) { logger.trace("Remote node: Thread name: Remote replica: Key already deleted: {}", remoteNode, threadName, remoteReplicaInfo.getReplicaId(), messageInfo.getStoreKey()); } else { throw e; } } if (notification != null) { notification.onBlobReplicaDeleted(dataNodeId.getHostname(), dataNodeId.getPort(), messageInfo.getStoreKey().getID(), BlobReplicaSourceType.REPAIRED); } }</code><technical_language>deleted flag set true here</technical_language>

Target:
private void applyDelete(MessageInfo messageInfo, RemoteReplicaInfo remoteReplicaInfo) throws StoreException { DataNodeId remoteNode = remoteReplicaInfo.getReplicaId().getDataNodeId(); try { messageInfo = new MessageInfo(messageInfo.getStoreKey(), messageInfo.getSize(), true, messageInfo.isTtlUpdated(), false, messageInfo.getExpirationTimeInMs(), messageInfo.getCrc(), messageInfo.getAccountId(), messageInfo.getContainerId(), messageInfo.getOperationTimeMs(), messageInfo.getLifeVersion()); remoteReplicaInfo.getLocalStore().delete(Collections.singletonList(messageInfo)); logger.trace("Remote node: Thread name: Remote replica: Key delete: {}", remoteNode, threadName, remoteReplicaInfo.getReplicaId(), messageInfo.getStoreKey()); } catch (StoreException e) { if (e.getErrorCode() == StoreErrorCodes.ID_Deleted) { logger.trace("Remote node: Thread name: Remote replica: Key already deleted: {}", remoteNode, threadName, remoteReplicaInfo.getReplicaId(), messageInfo.getStoreKey()); } else { throw e; } } if (notification != null) { notification.onBlobReplicaDeleted(dataNodeId.getHostname(), dataNodeId.getPort(), messageInfo.getStoreKey().getID(), BlobReplicaSourceType.REPAIRED); } }
Source:
<code>private boolean validationEnabled(VariableTree variable) { Type type = variable.symbol().type(); boolean result = variable.symbol().metadata().isAnnotatedWith(JAVAX_VALIDATION_VALID); <START> if (type instanceof ParametrizedTypeJavaType) { <END> result = result || typeArgumentAnnotationNames(variable).anyMatch(name -> name.equals(JAVAX_VALIDATION_VALID)); } return result; }</code><technical_language>if result is true, do need check this? I return</technical_language>

Target:
private static boolean validationEnabled(VariableTree variable) { if (variable.symbol().metadata().isAnnotatedWith(JAVAX_VALIDATION_VALID)) { return true; } Type type = variable.symbol().type(); return type instanceof ParametrizedTypeJavaType && typeArgumentAnnotations(variable).anyMatch(annotation -> annotation.is(JAVAX_VALIDATION_VALID)); }
Source:
<code>private ZonedDateTime readFromFile() { if (!lastEventPollingPath.toFile().isFile()) { return null; } try ( <START> FileInputStream fis = new FileInputStream(lastEventPollingPath.toFile()); <END> ObjectInputStream ois = new ObjectInputStream(fis)) { return (ZonedDateTime) ois.readObject(); } catch (Exception e) { } return null; }</code><technical_language>close this stream? a try resources</technical_language>

Target:
private ZonedDateTime readFromFile() { if (!lastEventPollingPath.toFile().isFile()) { return null; } try { long millis = Long.parseLong(new String(Files.readAllBytes(lastEventPollingPath), Charset.defaultCharset())); return ZonedDateTime.ofInstant(Instant.ofEpochMilli(millis), ZoneOffset.systemDefault()); } catch (IOException | NumberFormatException e) { } return null; }
Source:
<code>private synchronized void reserveNextBlock(long nextTS) throws TimestampIOException { <START> while (nextTS > _maxReservedTimestamp) { <END> long nextMax = _maxReservedTimestamp + blockSize; timestampBlockManager.reserveNextBlock(nextMax); _maxReservedTimestamp = nextMax; _numBlocksReserved.incrementAndGet(); SpliceLogUtils.debug(LOG, "Next timestamp block reserved with max = %s", _maxReservedTimestamp); } }</code><technical_language>If **nextTS** is larger **_maxReservedTimestamp** **blockSize**, ZK times. do do right in take</technical_language>

Target:
private synchronized void reserveNextBlock(long nextTS) throws TimestampIOException { if (nextTS > _maxReservedTimestamp) { long blockCount = (nextTS - _maxReservedTimestamp) / blockSize + 1; long nextMax = _maxReservedTimestamp + blockSize * blockCount; timestampBlockManager.persistMaxTimestamp(nextMax); _maxReservedTimestamp = nextMax; _numBlocksReserved.addAndGet(blockCount); SpliceLogUtils.debug(LOG, "Next timestamp block reserved with max = %s", _maxReservedTimestamp); } }
Source:
<code>public Map<Long, Set<TObject>> chronologize(Text key, long start, long end) { read.lock(); try { Map<Long, Set<TObject>> context = Maps.newLinkedHashMap(); List<CompactRevision<Value>> revisions = history.get(key); Set<TObject> set = Sets.newLinkedHashSet(); if(revisions != null) { Iterator<CompactRevision<Value>> it = revisions.iterator(); while (it.hasNext()) { CompactRevision<Value> revision = it.next(); <START> long timeStamp = revision.getVersion(); <END> if(timeStamp >= start && timeStamp <= end) { Action action = revision.getType(); set = Sets.newLinkedHashSet(set); Value newValue = revision.getValue(); if(action == Action.ADD) { set.add(newValue.getTObject()); } else if(action == Action.REMOVE) { set.remove(newValue.getTObject()); } context.put(timeStamp, set); } else if(timeStamp > end) { break; } } } return context; } finally { read.unlock(); } }</code><technical_language>call this timestamp for consistency rest of codebase</technical_language>

Target:
public Map<PrimaryKey, Set<Value>> chronologize(Text key, long start, long end) { read.lock(); try { Map<PrimaryKey, Set<Value>> context = Maps.newLinkedHashMap(); List<CompactRevision<Value>> revisions = history.get(key); Set<Value> snapshot = Sets.newLinkedHashSet(); if(revisions != null) { Iterator<CompactRevision<Value>> it = revisions.iterator(); while (it.hasNext()) { CompactRevision<Value> revision = it.next(); long timestamp = revision.getVersion(); if(timestamp >= end) { break; } else { Action action = revision.getType(); snapshot = Sets.newLinkedHashSet(snapshot); Value value = revision.getValue(); if(action == Action.ADD) { snapshot.add(value); } else if(action == Action.REMOVE) { snapshot.remove(value); } if(timestamp >= start && !snapshot.isEmpty()) context.put(PrimaryKey.wrap(timestamp), snapshot); } } } return context; } finally { read.unlock(); } }
Source:
<code>public static GraphTraversal<?, ?> transform(final E_Equals e, List<Triple> triples) { GraphTraversal traversal = null; <START> for(final Triple triple : triples){ <END> String subject = ""; if( triple.getSubject().isVariable()) { subject = triple.getSubject().getName().toString(); } else { subject = triple.getSubject().getLiteralValue().toString(); } String object = ""; if( triple.getObject().isVariable()) { object = triple.getObject().getName().toString(); } else { object = triple.getObject().getLiteralValue().toString(); } String uri = Prefixes.getURIValue(triple.getPredicate().getURI()); String arg1 = e.getArg1().getExprVar().getVarName(); final Object value = e.getArg2().getConstant().getNode().getLiteralValue(); if (object.equals(arg1)){ traversal = __.as(subject).has(uri, P.eq(value)); } } return traversal; }</code><technical_language>terribly familiar APIs play expect - if "triples" List multiple Triple objects in it, this function return a GraphTraversal others ignored. Is ok</technical_language>

Target:
public static GraphTraversal<?, ?> transform(final E_Equals e, List<Triple> triples) { GraphTraversal traversal = null; for(final Triple triple : triples){ String subject = ""; if( triple.getSubject().isVariable()) { subject = triple.getSubject().getName().toString(); } else { subject = triple.getSubject().getLiteralValue().toString(); } String object = ""; if( triple.getObject().isVariable()) { object = triple.getObject().getName().toString(); } else { object = triple.getObject().getLiteralValue().toString(); } String uri = Prefixes.getURIValue(triple.getPredicate().getURI()); String arg1 = e.getArg1().getExprVar().getVarName(); final Object value = e.getArg2().getConstant().getNode().getLiteralValue(); if (object.equals(arg1)){ return __.as(subject).has(uri, P.eq(value)); } } return traversal; }
Source:
<code>public void serveDevModeRequest_prepareTasksThrows_serveDevModeReturnsFalseAndDoesNotThrow() throws IOException { CompletableFuture<Void> throwFuture = new CompletableFuture<>(); throwFuture.completeExceptionally(new CustomRuntimeException()); DevModeHandler handler = DevModeHandler.start(0, configuration, npmFolder, throwFuture); try { handler.handleRequest(Mockito.mock(VaadinSession.class), Mockito.mock(VaadinRequest.class), Mockito.mock(VaadinResponse.class)); } catch (CustomRuntimeException ignore) { } HttpServletRequest request = Mockito.mock(HttpServletRequest.class); HttpServletResponse response = Mockito.mock(HttpServletResponse.class); <START> handler.serveDevModeRequest(request, response); <END> }</code><technical_language>check method serveDevModeRequest returns false</technical_language>

Target:
public void serveDevModeRequest_prepareTasksThrows_serveDevModeReturnsFalseAndDoesNotThrow() throws IOException { CompletableFuture<Void> throwFuture = new CompletableFuture<>(); throwFuture.completeExceptionally(new CustomRuntimeException()); DevModeHandler handler = DevModeHandler.start(0, configuration, npmFolder, throwFuture); try { handler.handleRequest(Mockito.mock(VaadinSession.class), Mockito.mock(VaadinRequest.class), Mockito.mock(VaadinResponse.class)); } catch (CustomRuntimeException ignore) { } HttpServletRequest request = Mockito.mock(HttpServletRequest.class); HttpServletResponse response = Mockito.mock(HttpServletResponse.class); Assert.assertFalse(handler.serveDevModeRequest(request, response)); }
Source:
<code>public static boolean isPluginPrefixAndArtifactIdEquals( Plugin p1, Plugin p2 ) { <START> if ( StringUtils.equals( p1.getArtifactId(), p2.getArtifactId() ) <END> && StringUtils.equals( p1.getPrefix(), p2.getPrefix() ) ) { return true; } return false; }</code><technical_language>just: return StringUtils.equals( p1.getArtifactId(), p2.getArtifactId() ) && StringUtils.equals( p1.getPrefix(), p2.getPrefix() );</technical_language>

Target:
public static boolean isPluginPrefixAndArtifactIdEquals( Plugin p1, Plugin p2 ) { return StringUtils.equals( p1.getArtifactId(), p2.getArtifactId() ) && StringUtils.equals( p1.getPrefix(), p2.getPrefix() ); }
Source:
<code>public void dispatch(@NonNull Traversal traversal, @NonNull TraversalCallback callback) { Log.d("BasicDispatcher", "dispatching " + traversal); final Object leaving = traversal.origin == null ? null : traversal.origin.top(); final Object entering = traversal.destination.top(); ViewGroup frame = (ViewGroup) activity.findViewById(R.id.basic_activity_frame); @LayoutRes final int layout; if (entering instanceof LandscapeScreen) { layout = R.layout.landscape_screen; } else if (entering instanceof LooseScreen) { layout = R.layout.loose_screen; } else { throw new AssertionError("Unrecognized screen " + entering); } boolean outgoingWasLocked = leaving instanceof LandscapeScreen; boolean incomingNeedsLock = entering instanceof LandscapeScreen; boolean waitForOrientationChange = incomingNeedsLock && requestLandscapeLock(); if (waitForOrientationChange) { <START> hangingCallback = callback; <END> } else { View incomingView = LayoutInflater.from(traversal.createContext(entering, activity)) .inflate(layout, frame, false); frame.removeAllViews(); frame.addView(incomingView); if (outgoingWasLocked && !incomingNeedsLock) { requestUnlock(); } callback.onTraversalCompleted(); } }</code><technical_language>Do want a callback.suspend()? terminal for callback instance, onCallbackCompleted. Flow handle finishPendingTraversal part, expose a Flow.resume() if cases arise</technical_language>

Target:
public void dispatch(@NonNull Traversal traversal, @NonNull TraversalCallback callback) { Log.d("BasicDispatcher", "dispatching " + traversal); final OrientationSampleScreen destScreen = traversal.destination.top(); final boolean incomingNeedsLock = destScreen.requiresLandscape(); final boolean waitForOrientationChange = incomingNeedsLock && requestLandscapeLock(); if (waitForOrientationChange) { hangingCallback = callback; } else { ViewGroup frame = (ViewGroup) activity.findViewById(R.id.basic_activity_frame); View destView = LayoutInflater.from(traversal.createContext(destScreen, activity)) .inflate(destScreen.getLayoutId(), frame, false); frame.removeAllViews(); frame.addView(destView); if (!incomingNeedsLock) { requestUnlock(); } callback.onTraversalCompleted(); } }
Source:
<code>public void declareOutputFields(OutputFieldsDeclarer outputFieldsDeclarer) { <START> outputFieldsDeclarer.declare(new Fields("output")); <END> }</code><technical_language>Good a constant field externally in a Constant class, a String constant directly; easy trace understand</technical_language>

Target:
public void declareOutputFields(OutputFieldsDeclarer outputFieldsDeclarer) { outputFieldsDeclarer.declare(new Fields(OUTPUTFIELDNAME)); }
Source:
<code>public static final void addSearchPathSuffix(String libraryName, String pathSuffix) { File ps = new File(pathSuffix); if (!ps.isAbsolute()) { synchronized (pathSuffixes) { List customPaths = (List) pathSuffixes.get(libraryName); if (customPaths == null) { customPaths = Collections.synchronizedList(new LinkedList()); <START> pathSuffixes.put(libraryName, customPaths); <END> } customPaths.add(pathSuffix); } } }</code><technical_language>generics Java 1.5+</technical_language>

Target:
public static final void addSearchPathSuffix(String libraryName, String pathSuffix) { File ps = new File(pathSuffix); if (!ps.isAbsolute()) { synchronized (pathSuffixes) { List<String> customPaths = pathSuffixes.get(libraryName); if (customPaths == null) { customPaths = Collections.synchronizedList(new LinkedList<String>()); pathSuffixes.put(libraryName, customPaths); } customPaths.add(pathSuffix); } } }
Source:
<code>public void partDeactivated(IWorkbenchPartReference partRef) { if (isThisPart(partRef)) { <START> fActive = false; <END> } }</code><technical_language>need call deactivateParticipants()</technical_language>

Target:
public void partDeactivated(IWorkbenchPartReference partRef) { if (isThisPart(partRef)) { fActive = false; deactivateParticipants(fActiveConsole); } }
Source:
<code>private EventBookingDTO convertToDTO(final EventBooking eb, final IsaacEventPageDTO eventInformation) throws SegueDatabaseException { EventBookingDTO result = new EventBookingDTO(); try { UserSummaryWithEmailAddressDTO user = userManager.convertToDetailedUserSummaryObject(userManager.getUserDTOById(eb .getUserId()), UserSummaryWithEmailAddressDTO.class); Long reservedById = eb.getReservedBy(); <START> if (!reservedById.equals(0L)) { <END> UserSummaryWithEmailAddressDTO reservingUser = userManager.convertToDetailedUserSummaryObject(userManager.getUserDTOById(reservedById), UserSummaryWithEmailAddressDTO.class); result.setReservedBy(reservingUser); } result.setBookingId(eb.getId()); result.setEventDate(eventInformation.getDate()); result.setEventId(eventInformation.getId()); result.setEventTitle(eventInformation.getTitle()); result.setBookingDate(eb.getCreationDate()); result.setUpdated(eb.getUpdateDate()); result.setBookingStatus(eb.getBookingStatus()); result.setUserBooked(user); result.setAdditionalInformation(eb.getAdditionalInformation()); return result; } catch (NoUserException e) { log.error("Unable to create event booking dto as user is unavailable"); throw new SegueDatabaseException("Unable to create event booking dto as user is unavailable", e); } }</code><technical_language>S 0L is weird. Is postgres set default null? Is a foreign key userId</technical_language>

Target:
private EventBookingDTO convertToDTO(final EventBooking eb, final IsaacEventPageDTO eventInformation) throws SegueDatabaseException { EventBookingDTO result = new EventBookingDTO(); try { UserSummaryWithEmailAddressDTO user = userManager.convertToDetailedUserSummaryObject(userManager.getUserDTOById(eb .getUserId(), true), UserSummaryWithEmailAddressDTO.class); result.setReservedById(eb.getReservedById()); result.setUserBooked(user); result.setBookingId(eb.getId()); result.setEventDate(eventInformation.getDate()); result.setEventId(eventInformation.getId()); result.setEventTitle(eventInformation.getTitle()); result.setBookingDate(eb.getCreationDate()); result.setUpdated(eb.getUpdateDate()); result.setBookingStatus(eb.getBookingStatus()); result.setAdditionalInformation(eb.getAdditionalInformation()); return result; } catch (NoUserException e) { log.error("Unable to create event booking dto as user is unavailable"); throw new SegueDatabaseException("Unable to create event booking dto as user is unavailable", e); } }
Source:
<code>private Map<String, String> initializeApplicationTableProps() { Map<String, String> ntcProps = new HashMap<>(); <START> ntcProps.put("table.group.notify", encodeColumnFamily(ColumnConstants.NOTIFY_CF)); <END> ntcProps.put("table.groups.enabled", "notify"); IteratorSetting gcIter2 = new IteratorSetting(10, "gc", GarbageCollectionIterator.class); GarbageCollectionIterator.setZookeepers(gcIter2, config.getAppZookeepers()); IteratorSetting ntfyIter = new IteratorSetting(11, "ntfy", NotificationIterator.class); for (IteratorSetting setting : new IteratorSetting[] {gcIter2, ntfyIter}) { for (IteratorScope scope : EnumSet.of(IteratorUtil.IteratorScope.majc, IteratorUtil.IteratorScope.minc)) { String root = String.format("table.iterator.%s.%s", scope.name().toLowerCase(), setting.getName()); for (Entry<String, String> prop : setting.getOptions().entrySet()) { ntcProps.put(root + ".opt." + prop.getKey(), prop.getValue()); } ntcProps.put(root, setting.getPriority() + "," + setting.getIteratorClass()); } } return ntcProps; }</code><technical_language>nice create constants for props in AccumuloProps class</technical_language>

Target:
private Map<String, String> initializeApplicationTableProps() { Map<String, String> ntcProps = new HashMap<>(); ntcProps.put(AccumuloProps.TABLE_GROUP_PREFIX + ColumnConstants.NOTIFY_LOCALITY_GROUP_NAME, encodeColumnFamily(ColumnConstants.NOTIFY_CF)); ntcProps.put(AccumuloProps.TABLE_GROUPS_ENABLED, ColumnConstants.NOTIFY_LOCALITY_GROUP_NAME); IteratorSetting gcIter = new IteratorSetting(10, ColumnConstants.GC_CF.toString(), GarbageCollectionIterator.class); GarbageCollectionIterator.setZookeepers(gcIter, config.getAppZookeepers()); IteratorSetting ntfyIter = new IteratorSetting(11, ColumnConstants.NOTIFY_CF.toString(), NotificationIterator.class); for (IteratorSetting setting : new IteratorSetting[] {gcIter, ntfyIter}) { for (IteratorScope scope : EnumSet.of(IteratorUtil.IteratorScope.majc, IteratorUtil.IteratorScope.minc)) { String root = String.format("%s%s.%s", AccumuloProps.TABLE_ITERATOR_PREFIX, scope.name().toLowerCase(), setting.getName()); for (Entry<String, String> prop : setting.getOptions().entrySet()) { ntcProps.put(root + ".opt." + prop.getKey(), prop.getValue()); } ntcProps.put(root, setting.getPriority() + "," + setting.getIteratorClass()); } } return ntcProps; }
Source:
<code>private void backupDnsFile(CommandExecutorService executorService) throws KuraException { File file = new File(DNS_FILE_NAME); if (file.exists()) { Command command = new Command(new String[] { "mv", DNS_FILE_NAME, BACKUP_DNS_FILE_NAME }); <START> command.setTimeout(60); <END> CommandStatus status = executorService.execute(command); if ((Integer) status.getExitStatus().getExitValue() != 0) { logger.error("Failed to move the file to {}. The 'mv' command has failed ...", DNS_FILE_NAME, BACKUP_DNS_FILE_NAME); throw new KuraException(KuraErrorCode.OS_COMMAND_ERROR, "Failed to backup DNS file " + DNS_FILE_NAME); } else { logger.info("successfully backed up {}", DNS_FILE_NAME); } } }</code><technical_language>this 60 exported a final static int. result in a generic magic number</technical_language>

Target:
private void backupDnsFile(CommandExecutorService executorService) throws KuraException { File file = new File(DNS_FILE_NAME); if (file.exists()) { Command command = new Command(new String[] { "mv", DNS_FILE_NAME, BACKUP_DNS_FILE_NAME }); command.setTimeout(COMMAND_TIMEOUT); CommandStatus status = executorService.execute(command); if ((Integer) status.getExitStatus().getExitValue() != 0) { logger.error("Failed to move the file to {}. The 'mv' command has failed ...", DNS_FILE_NAME, BACKUP_DNS_FILE_NAME); throw new KuraException(KuraErrorCode.OS_COMMAND_ERROR, "Failed to backup DNS file " + DNS_FILE_NAME); } else { logger.info("successfully backed up {}", DNS_FILE_NAME); } } }
Source:
<code>public void testClassAnnotation() { assertGeneratedMatches( Lists.<String>newArrayList(), Lists.newArrayList("@" + TEST_ANNOTATION_FULLNAME + "(testClass = String.class)"), <START> Lists.newArrayList("@" + TEST_ANNOTATION_FULLNAME + "(testClass = java.lang.String.class)")); <END> }</code><technical_language>Making TypeSimplifier work properly is non-trivial fine this for now</technical_language>

Target:
public void testClassAnnotation() { assertGeneratedMatches( ImmutableList.<String>of(), ImmutableList.of(TEST_ANNOTATION + "(testClass = String.class)"), ImmutableList.of(TEST_ANNOTATION + "(testClass = java.lang.String.class)")); }
Source:
<code>public SESSION_INFO_10(Pointer p) { <START> super(p, Structure.ALIGN_DEFAULT, W32APITypeMapper.DEFAULT); <END> read(); }</code><technical_language>DEFAULT Type mapper correct here? header file: > // // UNICODE version of LM APIs NT. // Non-UNICODE version other platforms // #if defined( _WIN32_WINNT ) || defined( WINNT ) || defined( __midl ) \ || defined( FORCE_UNICODE ) #define LMSTR LPWSTR #define LMCSTR LPCWSTR #else #define LMSTR LPSTR #define LMCSTR LPCSTR #endif I risk a guess, Windows Versions (i.e. post W2K) - is WIN32_WINNT WINNT defined? If so, this need UNICODE mapper, if some more logic is necessary</technical_language>

Target:
public SESSION_INFO_10(Pointer p) { super(p, Structure.ALIGN_DEFAULT, W32APITypeMapper.UNICODE); read(); }
Source:
<code>protected Set<String> getApplicableColos(String type, Entity entity) { try { if (DeploymentUtil.isEmbeddedMode()) { return DeploymentUtil.getDefaultColos(); } if (EntityType.getEnum(type) == EntityType.CLUSTER) { return getAllColos(); } Set<String> clusters = EntityUtil.getClustersDefined(entity); Set<String> colos = new HashSet<String>(); for (String cluster : clusters) { try{ Cluster clusterEntity = EntityUtil.getEntity(EntityType.CLUSTER, cluster); colos.add(clusterEntity.getColo()); } catch (EntityNotRegisteredException e){ e.printStackTrace(); } } <START> if (colos.size() == 0) { <END> throw new EntityNotRegisteredException(entity.getName() + " (" + type + ") not found"); } return colos; } catch (FalconException e) { throw FalconWebException.newAPIException(e); } }</code><technical_language>this case occur</technical_language>

Target:
protected Set<String> getApplicableColos(String type, Entity entity) { try { if (DeploymentUtil.isEmbeddedMode()) { return DeploymentUtil.getDefaultColos(); } if (EntityType.getEnum(type) == EntityType.CLUSTER) { return getAllColos(); } Set<String> clusters = EntityUtil.getClustersDefined(entity); Set<String> colos = new HashSet<String>(); for (String cluster : clusters) { try{ Cluster clusterEntity = EntityUtil.getEntity(EntityType.CLUSTER, cluster); colos.add(clusterEntity.getColo()); } catch (EntityNotRegisteredException e){ LOG.warn(e.getMessage(), e); } } if (colos.isEmpty()) { throw new EntityNotRegisteredException(entity.getName() + " (" + type + ") not found"); } return colos; } catch (FalconException e) { throw FalconWebException.newAPIException(e); } }
Source:
<code>public static <T> List<Field> build(Class<T> modelClass) { ClientLogger logger = new ClientLogger(FieldBuilder.class); java.lang.reflect.Field[] fields = modelClass.getFields(); List<Field> searchFieldList = new ArrayList<>(); for (java.lang.reflect.Field field: fields) { Annotation[] annotations = field.getAnnotations(); for (Annotation annotation : annotations) { if (annotation instanceof FieldIgnore) { continue; } Field searchField = new Field(); searchField.setName(field.getName()); searchField.setType(covertToDataType(field, logger)); if (annotation instanceof SimpleFieldProperty) { buildSimpleField(searchField, (SimpleFieldProperty) annotation); searchFieldList.add(searchField); } else if (annotation instanceof SearchableFieldProperty) { buildSearchableField(searchField, (SearchableFieldProperty) annotation); searchFieldList.add(searchField); } else if (annotation instanceof FieldProperty) { buildField(searchField, (FieldProperty) annotation); searchFieldList.add(searchField); } <START> logger.info("The property is not a search field.", field.getName()); <END> } } return searchFieldList; }</code><technical_language>ComplexField? implemented yet</technical_language>

Target:
public static <T> List<Field> build(Class<T> modelClass) { ClientLogger logger = new ClientLogger(FieldBuilder.class); return build(modelClass, new Stack<>(), logger); }
Source:
<code><START> public void each(MatrixProcedure procedure) { <END> int l = 0; for (int i = 0; i < rows; i++) { for (int j = 0; j < columns; j++) { if (j == columnIndices[l]) { procedure.apply(i,j,values[l++]); } else { procedure.apply(i,j,0); } } } }</code><technical_language>need a separate implementation of method for CRS matrix. in AbstractMatrix</technical_language>

Target:
public void each(MatrixProcedure procedure) { int k = 0; for (int i = 0; i < rows; i++) { for (int j = 0; j < columns; j++) { if (j == columnIndices[k]) { procedure.apply(i, j, values[k]); k++; } else { procedure.apply(i, j, 0); } } } }
Source:
<code>protected String inferRootUrl() { if (isProtocolEnabled("https")) { Integer port = getHttpsPort(); checkNotNull(port, "HTTPS_PORT sensors not set; is an acceptable port available?"); <START> return String.format("https://%s:%s/", getHostname(), port); <END> } else if (isProtocolEnabled("http")) { Integer port = getHttpPort(); checkNotNull(port, "HTTP_PORT sensors not set; is an acceptable port available?"); return String.format("http://%s:%s/", getHostname(), port); } else { throw new IllegalStateException("HTTP and HTTPS protocols not enabled for "+entity+"; enabled protocols are "+getEnabledProtocols()); } }</code><technical_language>@grkvlt this a problem Clocker? problem is depends context for want subnet hostname/ip public hostname/ip. this point main.uri sensor is used</technical_language>

Target:
protected String inferRootUrl() { if (isProtocolEnabled("https")) { Integer port = getHttpsPort(); checkNotNull(port, "HTTPS_PORT sensors not set; is an acceptable port available?"); HostAndPort accessibleAddress = BrooklynAccessUtils.getBrooklynAccessibleAddress(getEntity(), port); return String.format("https://%s:%s/", accessibleAddress.getHostText(), accessibleAddress.getPort()); } else if (isProtocolEnabled("http")) { Integer port = getHttpPort(); checkNotNull(port, "HTTP_PORT sensors not set; is an acceptable port available?"); HostAndPort accessibleAddress = BrooklynAccessUtils.getBrooklynAccessibleAddress(getEntity(), port); return String.format("http://%s:%s/", accessibleAddress.getHostText(), accessibleAddress.getPort()); } else { throw new IllegalStateException("HTTP and HTTPS protocols not enabled for "+entity+"; enabled protocols are "+getEnabledProtocols()); } }
Source:
<code><START> public static void validateTrue(final boolean condition, final String msg) { <END> if (!condition) { throw new IllegalArgumentException(msg); } }</code><technical_language>this is place for generic checks</technical_language>

Target:
private static void validateTrue(final boolean condition, final String msg) { if (!condition) { throw new IllegalArgumentException(msg); } }
Source:
<code>public boolean isArrayType() { <START> return isArray(); <END> }</code><technical_language>implementation of this new method depends a deprecated method... I new implementation delegate deprecated new one... (I know, change impl of isArrayType() in 7.0.0 other AST nodes)</technical_language>

Target:
public boolean isArrayType() { return getArrayDepth() > 0; }
Source:
<code>public static void Init() { mUpdateVmsStatic = new ObjectIdentityChecker(VmHandler.class, Arrays.asList(new String[] { "VM", "VmStatic", "VmDynamic" }), VMStatus.class); mUpdateVmsStatic.AddPermittedFields(new String[] { "vm_name", "description", "domain", "os", "osType", "creation_date", "num_of_monitors", "allowConsoleReconnect", "usb_policy", "is_auto_suspend", "auto_startup", "dedicated_vm_for_vds", "default_display_type", "priority", "default_boot_sequence", "initrd_url", "kernel_url", "kernel_params", "migrationSupport", "minAllocatedMem", "quotaId", "quotaName", "quotaEnforcementType", "cpuPinning", <START> "vmPayload", "balloonEnabled", "smartcardEnabled","deleteProtected","db_generation", <END> "images", "interfaces" }); mUpdateVmsStatic.AddFields( Arrays.asList(new Enum<?>[] { VMStatus.Down }), Arrays.asList(new String[] { "vds_group_id", "time_zone", "is_stateless", "nice_level", "mem_size_mb", "num_of_sockets", "cpu_per_socket", "iso_path", "userDefinedProperties", "predefinedProperties", "customProperties" })); }</code><technical_language>/s/db_generation/dbGenereation VmTemplateHandler? Update work</technical_language>

Target:
public static void Init() { mUpdateVmsStatic = new ObjectIdentityChecker(VmHandler.class, Arrays.asList(new String[] { "VM", "VmStatic", "VmDynamic" }), VMStatus.class); mUpdateVmsStatic.AddPermittedFields(new String[] { "vm_name", "description", "domain", "os", "osType", "creation_date", "num_of_monitors", "allowConsoleReconnect", "usb_policy", "is_auto_suspend", "auto_startup", "dedicated_vm_for_vds", "default_display_type", "priority", "default_boot_sequence", "initrd_url", "kernel_url", "kernel_params", "migrationSupport", "minAllocatedMem", "quotaId", "quotaName", "quotaEnforcementType", "cpuPinning", "vmPayload", "balloonEnabled", "smartcardEnabled","deleteProtected","dbGeneration", "images", "interfaces" }); mUpdateVmsStatic.AddFields( Arrays.asList(new Enum<?>[] { VMStatus.Down }), Arrays.asList(new String[] { "vds_group_id", "time_zone", "is_stateless", "nice_level", "mem_size_mb", "num_of_sockets", "cpu_per_socket", "iso_path", "userDefinedProperties", "predefinedProperties", "customProperties" })); }
Source:
<code>private void setAppropriateView() { <START> Log.v("Allergon", "Count " + mRvAllergens.getAdapter().getItemCount()); <END> if (mEmptyMessageView != null && mRvAllergens.getAdapter() != null) { boolean isListEmpty = mRvAllergens.getAdapter().getItemCount() == 0; mEmptyMessageView.setVisibility(isListEmpty ? View.VISIBLE : View.GONE); mRvAllergens.setVisibility(isListEmpty ? View.GONE : View.VISIBLE); } }</code><technical_language>Remove this log</technical_language>

Target:
private void setAppropriateView() { if (mEmptyMessageView != null && mAdapter != null) { boolean isListEmpty = mAdapter.getItemCount() == 0; mEmptyMessageView.setVisibility(isListEmpty ? View.VISIBLE : View.GONE); mRvAllergens.setVisibility(isListEmpty ? View.GONE : View.VISIBLE); } }
Source:
<code>private List<String> filterContent(List<String> contentLines) { ImmutableList.Builder<String> result = ImmutableList.builder(); for (int i = 0; i < contentLines.size(); i++) { String line = contentLines.get(i); if (isSpecialLine(line) || isBlank(line)) { continue; } while (line.endsWith(LINE_ESCAPE)) { <START> checkState(i + 1 < contentLines.size(), "There no more lines, while the end of the line was escaped"); <END> line = line.substring(0, line.length() - 1) + "\n" + contentLines.get(++i); } result.add(unescapeLine(line)); } return result.build(); }</code><technical_language>suggestion checkState(i + 1 < contentLines.size(), "There more lines, while end of line escaped");</technical_language>

Target:
private List<String> filterContent(List<String> contentLines) { return contentLines.stream() .filter(s -> !(isSpecialLine(s) || isBlank(s))) .map(AnnotatedFileParser::unescapeLine) .map(line -> line.replace(NEW_LINE_LITERAL, "\n")) .collect(toList()); }
Source:
<code>public void setupNotificationChannel(Context context, String id, String name) { Timber.i("Creating notification channel with id/name: %s/%s",id, name); <START> NotificationManager manager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE); <END> NotificationChannel mNotificationChannel = new NotificationChannel(id, name, NotificationManager.IMPORTANCE_DEFAULT); mNotificationChannel.setShowBadge(true); mNotificationChannel.setLockscreenVisibility(NotificationCompat.VISIBILITY_PUBLIC); manager.createNotificationChannel(mNotificationChannel); }</code><technical_language>m... prefix for member variables</technical_language>

Target:
public void setupNotificationChannel(Context context, String id, String name) { Timber.i("Creating notification channel with id/name: %s/%s",id, name); NotificationManager manager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE); NotificationChannel notificationChannel = new NotificationChannel(id, name, NotificationManager.IMPORTANCE_DEFAULT); notificationChannel.setShowBadge(true); notificationChannel.setLockscreenVisibility(NotificationCompat.VISIBILITY_PUBLIC); manager.createNotificationChannel(notificationChannel); }
Source:
<code>public final void indexingProgress(IndexingProgressStats stats) { Display.getDefault().asyncExec(new Runnable() { @Override public void run() { final String cqueryStatusFieldId = "org.eclipse.lsp4e.cpp.status"; final int width = 28; <START> IWorkbenchWindow[] Workbenchwindows = PlatformUI.getWorkbench().getWorkbenchWindows(); <END> for (IWorkbenchWindow window : Workbenchwindows) { StatusLineManager statusLine = ((WorkbenchWindow) window).getStatusLineManager(); if (statusLine.find(cqueryStatusFieldId) != null) { statusLine.remove(cqueryStatusFieldId); } StatusLineContributionItem cqueryStatusField = new StatusLineContributionItem(cqueryStatusFieldId, width); statusLine.add(cqueryStatusField); String msg = stats.getTotalJobs() > 0 ? NLS.bind(Messages.CqueryStateBusy, stats.getTotalJobs()) : Messages.CqueryStateIdle; cqueryStatusField.setText(msg); } } }); }</code><technical_language>naming: "workbenchWindows"</technical_language>

Target:
public final void indexingProgress(IndexingProgressStats stats) { Display.getDefault().asyncExec(new Runnable() { @Override public void run() { final String cqueryStatusFieldId = "org.eclipse.lsp4e.cpp.status"; final int width = 28; StatusLineContributionItem cqueryStatusField; IWorkbenchWindow[] workbenchWindows = PlatformUI.getWorkbench().getWorkbenchWindows(); for (IWorkbenchWindow window : workbenchWindows) { StatusLineManager statusLine = ((WorkbenchWindow) window).getStatusLineManager(); if (statusLine.find(cqueryStatusFieldId) != null) { cqueryStatusField = (StatusLineContributionItem) statusLine.find(cqueryStatusFieldId); } else { cqueryStatusField = new StatusLineContributionItem(cqueryStatusFieldId, width); statusLine.add(cqueryStatusField); } String msg = stats.getTotalJobs() > 0 ? NLS.bind(Messages.CqueryStateBusy, stats.getTotalJobs()) : Messages.CqueryStateIdle; cqueryStatusField.setText(msg); } } }); }
Source:
<code>private boolean isGetClassOnArgument(ExpressionTree tree) { ExpressionTree expressionTree = removeParenthesis(tree); if (expressionTree.is(Tree.Kind.METHOD_INVOCATION)) { ExpressionTree methodSelect = ((MethodInvocationTree) expressionTree).methodSelect(); if (methodSelect.is(Tree.Kind.MEMBER_SELECT)) { ExpressionTree expression = ((MemberSelectExpressionTree) methodSelect).expression(); return isArgument(expression); } } <START> return false; <END> }</code><technical_language>forget check if invoked method is called "getClass" other method</technical_language>

Target:
private boolean isGetClassOnArgument(ExpressionTree tree) { ExpressionTree expressionTree = removeParenthesis(tree); if (expressionTree.is(Tree.Kind.METHOD_INVOCATION) && GETCLASS_MATCHER.matches((MethodInvocationTree) expressionTree)) { ExpressionTree methodSelect = ((MethodInvocationTree) expressionTree).methodSelect(); if (methodSelect.is(Tree.Kind.MEMBER_SELECT)) { ExpressionTree expression = ((MemberSelectExpressionTree) methodSelect).expression(); return isArgument(expression); } } return false; }
Source:
<code><START> public static long sumHistogramEntries(HistogramMetric histogram) { <END> return LongStream.of(histogram.value()).reduce(Long::sum).orElse(0); }</code><technical_language>I suppose simple for loop array of primitives is better</technical_language>

Target:
public static long sumHistogramEntries(HistogramMetric histogram) { if (histogram == null) return 0; long sum = 0; for (int i = 0; i < histogram.value().length; ++i) sum += histogram.value()[i]; return sum; }
Source:
<code>public Hardware apply(HardwareFlavour from) { double minRamSize = (int) from.hardware().ram(); if (from.hardware().ram() < 1) { minRamSize = 0.5; } List<Volume> volumes = new ArrayList<Volume>(); for (HardwareFlavour.Hardware.Hdd hdd : from.hardware().hdds()) { Volume vol = new VolumeBuilder() .bootDevice(hdd.isMain()) .device("hdd") .type(Volume.Type.LOCAL) .size((float) hdd.size()) .build(); volumes.add(vol); } List<Processor> processors = new ArrayList<Processor>(); for (int i = 0; i < from.hardware().coresPerProcessor(); i++) { Processor proc = new Processor(from.hardware().vcore(), 1d); processors.add(proc); } final HardwareBuilder builder; builder = new HardwareBuilder() .ids(from.name()) <START> .name(from.name()) <END> .ram((int) (minRamSize * 1024)) .volumes(volumes) .processors(ImmutableList.copyOf(processors)); return builder.build(); }</code><technical_language>id(from.id()) .name(from.name()) if .ids() is want</technical_language>

Target:
public Hardware apply(HardwareFlavour from) { double minRamSize = (int) from.hardware().ram(); if (from.hardware().ram() < 1) { minRamSize = 0.5; } List<Volume> volumes = new ArrayList<Volume>(); for (HardwareFlavour.Hardware.Hdd hdd : from.hardware().hdds()) { Volume vol = new VolumeBuilder() .bootDevice(hdd.isMain()) .device("hdd") .type(Volume.Type.LOCAL) .size((float) hdd.size()) .build(); volumes.add(vol); } List<Processor> processors = new ArrayList<Processor>(); for (int i = 0; i < from.hardware().coresPerProcessor(); i++) { Processor proc = new Processor(from.hardware().vcore(), 1d); processors.add(proc); } final HardwareBuilder builder; builder = new HardwareBuilder() .ids(from.id()) .name(from.name()) .ram((int) (minRamSize * 1024)) .volumes(volumes) .processors(ImmutableList.copyOf(processors)); return builder.build(); }
Source:
<code>public PullCommand setRebase(boolean useRebase) { checkCallable(); <START> if (useRebase) { <END> pullRebaseMode = PullRebaseMode.REBASE; } else { pullRebaseMode = PullRebaseMode.NO_REBASE; } return this; }</code><technical_language>style nit: curly braces single line statements</technical_language>

Target:
public PullCommand setRebase(boolean useRebase) { checkCallable(); pullRebaseMode = useRebase ? PullRebaseMode.REBASE : PullRebaseMode.NO_REBASE; return this; }
Source:
<code>private void initMainDirectionalLight() { mainDirectionalLight.lightType = LightComponent.LightType.DIRECTIONAL; mainDirectionalLight.lightAmbientIntensity = 0.75f; <START> mainDirectionalLight.lightDiffuseIntensity = 0.75f; <END> }</code><technical_language>eliminating vector3 variables eliminating potential for a statically tinged (non-white) mainlight. tinge added elsewhere, runtime</technical_language>

Target:
private void initMainDirectionalLight() { mainDirectionalLight.lightType = LightComponent.LightType.DIRECTIONAL; mainDirectionalLight.lightAmbientIntensity = 0.75f; mainDirectionalLight.lightDiffuseIntensity = 0.75f; mainDirectionalLight.lightSpecularIntensity = 0.02f; mainDirectionalLight.lightSpecularPower = 100f; }
Source:
<code>public void deleteTempFileAndFolder() { try { if ( aliasingIsActive() ) { FileObject srcFile = KettleVFS.getFileObject( temporaryFilePath, variableSpace ); srcFile.getParent().deleteAll(); } } catch ( FileSystemException | KettleFileException e ) { <START> log.logError( e.getMessage() ); <END> } }</code><technical_language>add exception parameter? able error happened message</technical_language>

Target:
public void deleteTempFileAndFolder() { try { if ( aliasingIsActive() ) { FileObject srcFile = KettleVFS.getFileObject( temporaryFilePath, variableSpace ); srcFile.getParent().deleteAll(); } } catch ( FileSystemException | KettleFileException e ) { log.logError( e.getMessage(), e ); } }
Source:
<code>private Path writeNestedWithNullsSampleParquetFile(Configuration conf, boolean dictionaryEncoding, CompressionCodecName compression) throws IOException { File file = tempFolder.newFile(); file.delete(); Path path = new Path(file.toURI()); <START> ParquetWriter<Group> writer = ExampleParquetWriter.builder(path) <END> .withConf(conf) .withWriteMode(ParquetFileWriter.Mode.OVERWRITE) .withCompressionCodec(compression) .withDictionaryEncoding(dictionaryEncoding) .withType(schemaNestedWithNulls) .withPageWriteChecksumEnabled(ParquetOutputFormat.getPageWriteChecksumEnabled(conf)) .build(); GroupFactory groupFactory = new SimpleGroupFactory(schemaNestedWithNulls); Random rand = new Random(42); for (int i = 0; i < numRecordsNestedWithNullsFile; i++) { Group group = groupFactory.newGroup(); if (rand.nextDouble() > nullRatio) { if (rand.nextDouble() > 0.5) { group.addGroup("c").append("id", (long) i).addGroup("d") .append("val", rand.nextInt() % 10); } else { group.addGroup("c").append("id", (long) i).addGroup("d") .append("val", rand.nextInt() % 10) .append("val", rand.nextInt() % 10) .append("val", rand.nextInt() % 10); } } writer.write(group); } writer.close(); return path; }</code><technical_language>wrap a try-with-resource this</technical_language>

Target:
private Path writeNestedWithNullsSampleParquetFile(Configuration conf, boolean dictionaryEncoding, CompressionCodecName compression) throws IOException { File file = tempFolder.newFile(); file.delete(); Path path = new Path(file.toURI()); try (ParquetWriter<Group> writer = ExampleParquetWriter.builder(path) .withConf(conf) .withWriteMode(ParquetFileWriter.Mode.OVERWRITE) .withCompressionCodec(compression) .withDictionaryEncoding(dictionaryEncoding) .withType(schemaNestedWithNulls) .withPageWriteChecksumEnabled(ParquetOutputFormat.getPageWriteChecksumEnabled(conf)) .build()) { GroupFactory groupFactory = new SimpleGroupFactory(schemaNestedWithNulls); Random rand = new Random(42); for (int i = 0; i < numRecordsNestedWithNullsFile; i++) { Group group = groupFactory.newGroup(); if (rand.nextDouble() > nullRatio) { if (rand.nextDouble() > 0.5) { group.addGroup("c").append("id", (long) i).addGroup("d") .append("val", rand.nextInt() % 10); } else { group.addGroup("c").append("id", (long) i).addGroup("d") .append("val", rand.nextInt() % 10) .append("val", rand.nextInt() % 10) .append("val", rand.nextInt() % 10); } } writer.write(group); } } return path; }
Source:
<code>public Transition(LineAssociation link, org.eclipse.uml2.uml.Transition transition) { id = link.getId(); fromID = link.getFrom(); toID = link.getTo(); trigger = null; List<Trigger> triggers = transition.getTriggers(); if (triggers.size() > 0) { trigger = triggers.get(0).getEvent().getLabel(); } if (link.getTurns() == 0) { List<Point> points = link.getRoute(); int center = points.size() / 2; route = points.subList(center, center + 1); } else { List<Point> points = link.getMinimalRoute(); route = points.subList(1, points.size() - 1); <START> } <END> anchors = new ArrayList<Point>(); List<Point> points = link.getMinimalRoute(); anchors.add(points.get(0)); anchors.add(points.get(points.size() - 1)); }</code><technical_language>This route calculation factored out a base class (or Utility), in ClassLink well. this refactoring cde duplication avoided</technical_language>

Target:
public Transition(LineAssociation link, org.eclipse.uml2.uml.Transition transition) { id = link.getId(); fromID = link.getFrom(); toID = link.getTo(); trigger = null; List<Trigger> triggers = transition.getTriggers(); if (triggers.size() > 0) { trigger = triggers.get(0).getEvent().getLabel(); } }
Source:
<code>private void show(ExtMap context, String groupName, String groupUuid, List<String> memberGroups, List<String> memberUsers) { StringBuilder builder = new StringBuilder(); builder.append("Group: ").append(groupName).append("(").append(groupUuid).append(")"); if (memberGroups.isEmpty() && memberUsers.isEmpty()) { <START> builder.append(" is empty."); <END> } else { builder.append(" members:\n"); } for (String user : memberUsers) { builder.append(" user: ").append(user).append("\n"); } for (String group : memberGroups) { builder.append(" group: ").append(group).append("\n"); } String output = builder.toString().trim(); addContextMessage(context, false, output); }</code><technical_language>Please change " members."</technical_language>

Target:
private void show(ExtMap context, String groupName, String groupUuid, List<String> memberGroups, List<String> memberUsers) { StringBuilder builder = new StringBuilder(); builder.append("Group: ").append(groupName).append("(").append(groupUuid).append(")"); if (memberGroups.isEmpty() && memberUsers.isEmpty()) { builder.append(" has no members."); } else { builder.append(" members:\n"); } for (String user : memberUsers) { builder.append(" User: ").append(user).append("\n"); } for (String group : memberGroups) { builder.append(" Group: ").append(group).append("\n"); } String output = builder.toString().trim(); addContextMessage(context, false, output); }
Source:
<code>public void shouldAddAmountRateAndSum() { final MockTime time = new MockTime(0); <START> addAmountRateAndTotalMetricsToSensor(sensor, group, tags, metricNamePrefix, description1, description2); <END> verifyAmountRateMetric(metrics, sensor, description1, time); verifySumMetric(metrics, sensor, description2, time, 60); assertThat(metrics.metrics().size(), equalTo(2 + 1)); }</code><technical_language>Nit: I is confusing import methods test (makes unclear if this is a "setup" method -- static imports)</technical_language>

Target:
public void shouldAddAmountRateAndSum() { StreamsMetricsImpl .addRateOfSumAndSumMetricsToSensor(sensor, group, tags, metricNamePrefix, description1, description2); final double valueToRecord1 = 18.0; final double valueToRecord2 = 72.0; final long defaultWindowSizeInSeconds = Duration.ofMillis(new MetricConfig().timeWindowMs()).getSeconds(); final double expectedRateMetricValue = (valueToRecord1 + valueToRecord2) / defaultWindowSizeInSeconds; verifyMetric(metricNamePrefix + "-rate", description1, valueToRecord1, valueToRecord2, expectedRateMetricValue); final double expectedSumMetricValue = 2 * valueToRecord1 + 2 * valueToRecord2; verifyMetric(metricNamePrefix + "-total", description2, valueToRecord1, valueToRecord2, expectedSumMetricValue); assertThat(metrics.metrics().size(), equalTo(2 + 1)); }
Source:
<code>public void checkEntryContent(ActualEntry entry, String fileContent, String indexContent) { assertEquals(fileContent, entry.file); assertEquals(indexContent, entry.index); <START> if (entry.indexContentLength != 0) <END> assertEquals(fileContent.length(), entry.indexContentLength); }</code><technical_language>missing braces</technical_language>

Target:
public void checkEntryContent(ActualEntry entry, String fileContent, String indexContent) { assertEquals(fileContent, entry.file); assertEquals(indexContent, entry.index); if (entry.indexContentLength != 0) { assertEquals(fileContent.length(), entry.indexContentLength); } }
Source:
<code><START> public static int[] range(final int start, final int length) { <END> int[] ret = new int[length]; for (int i = 0; i < length; ++i) { ret[i] = start + i; } return ret; }</code><technical_language>Java 8, so: IntStream.range(start, start+length).toArray()</technical_language>

Target:
public static int[] range(final int start, final int length) { return IntStream.range(start, start + length).toArray(); }