auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testModifyJdbcCall() throws SQLException { assertEquals("select * from pack_getValue(?,?) as result", Parser.modifyJdbcCall("{ ? = call pack_getValue(?) }", true, ServerVersion.v9_6.getVersionNum(), 3).getSql()); assertEquals("select * from pack_getValue(?) as result", Parser.modifyJdbcCall("{ ? = call pack_getValue()}", true, ServerVersion.v9_6.getVersionNum(), 3).getSql()); <START> assertEquals("select * from pack_getValue(?,?,?,?) as result", Parser.modifyJdbcCall("{ ? = call pack_getValue(?,?,?) }", true, ServerVersion.v9_6.getVersionNum(), 3).getSql()); <END> assertEquals("select * from lower(?,?) as result", Parser.modifyJdbcCall("{ ? = call lower(?)}", true, ServerVersion.v9_6.getVersionNum(), 3).getSql()); }</code><technical_language>Please add a case { ? = call pack_getValue}</technical_language>

Target:
public void testModifyJdbcCall() throws SQLException { assertEquals("select * from pack_getValue(?) as result", Parser.modifyJdbcCall("{ ? = call pack_getValue}", true, ServerVersion.v9_6.getVersionNum(), 3).getSql()); assertEquals("select * from pack_getValue(?,?) as result", Parser.modifyJdbcCall("{ ? = call pack_getValue(?) }", true, ServerVersion.v9_6.getVersionNum(), 3).getSql()); assertEquals("select * from pack_getValue(?) as result", Parser.modifyJdbcCall("{ ? = call pack_getValue()}", true, ServerVersion.v9_6.getVersionNum(), 3).getSql()); assertEquals("select * from pack_getValue(?,?,?,?) as result", Parser.modifyJdbcCall("{ ? = call pack_getValue(?,?,?) }", true, ServerVersion.v9_6.getVersionNum(), 3).getSql()); assertEquals("select * from lower(?,?) as result", Parser.modifyJdbcCall("{ ? = call lower(?)}", true, ServerVersion.v9_6.getVersionNum(), 3).getSql()); }
Source:
<code>public void deleteFileInMediaScan(String path) { String mimetypeString = FileStorageUtils.getMimeTypeFromName(path); if (mimetypeString.startsWith("image/")) { <START> getContentResolver().delete(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, <END> MediaStore.Images.Media.DATA + "=?", new String[]{path}); } else if (mimetypeString.startsWith("audio/")) { getContentResolver().delete(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, MediaStore.Audio.Media.DATA + "=?", new String[]{path}); } else if (mimetypeString.startsWith("video/")) { getContentResolver().delete(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, MediaStore.Video.Media.DATA + "=?", new String[]{path}); } }</code><technical_language>Problem here: getContentResolver() returns a NULL in context of SyncAdapter. necessary check returned is NULL and, otherwise, call instead getContentProviderClient(). a other methods in this class calling getContentResolver()</technical_language>

Target:
public void deleteFileInMediaScan(String path) { String mimetypeString = FileStorageUtils.getMimeTypeFromName(path); ContentResolver contentResolver = getContentResolver(); if (contentResolver != null) { if (mimetypeString.startsWith("image/")) { contentResolver.delete(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, MediaStore.Images.Media.DATA + "=?", new String[]{path}); } else if (mimetypeString.startsWith("audio/")) { contentResolver.delete(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, MediaStore.Audio.Media.DATA + "=?", new String[]{path}); } else if (mimetypeString.startsWith("video/")) { contentResolver.delete(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, MediaStore.Video.Media.DATA + "=?", new String[]{path}); } } else { ContentProviderClient contentProviderClient = getContentProviderClient(); try { if (mimetypeString.startsWith("image/")) { contentProviderClient.delete(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, MediaStore.Images.Media.DATA + "=?", new String[]{path}); } else if (mimetypeString.startsWith("audio/")) { contentProviderClient.delete(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, MediaStore.Audio.Media.DATA + "=?", new String[]{path}); } else if (mimetypeString.startsWith("video/")) { contentProviderClient.delete(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, MediaStore.Video.Media.DATA + "=?", new String[]{path}); } } catch (RemoteException e) { Log_OC.e(TAG, "Exception deleting media file in MediaStore " + e.getMessage()); } } }
Source:
<code>public TmfEventTableDataProvider(ITmfTrace trace, Iterable<ITmfEventAspect<?>> aspects) { super(trace); fAspects = new LinkedHashMap<>(); for (ITmfEventAspect<?> aspect : aspects) { <START> fAspects.put(aspect.getName(), aspect); <END> } }</code><technical_language>if 2 aspects name</technical_language>

Target:
public TmfEventTableDataProvider(ITmfTrace trace, Iterable<ITmfEventAspect<?>> aspects) { super(trace); fAspects = Objects.requireNonNull(LinkedHashMultimap.create()); for (ITmfEventAspect<?> aspect : aspects) { fAspects.put(aspect.getName(), aspect); } }
Source:
<code>private void processProbe() { verify(probe != null); PagesSpatialIndex pagesSpatialIndex = getDone(pagesSpatialIndexFuture); for (int position = probePosition; position < probe.getPositionCount(); position++) { if (this.joinAddresses == null) { joinAddresses = pagesSpatialIndex.findJoinAddresses(position, probe, probeGeometryChannel, spatialRelationshipTest); joinAddressIndex = -1; } for (int joinAddressIndex = this.joinAddressIndex + 1; joinAddressIndex < joinAddresses.size(); joinAddressIndex++) { if (pageBuilder.isFull()) { probePosition = position; <START> this.joinAddressIndex = joinAddressIndex; <END> return; } long joinAddress = joinAddresses.get(joinAddressIndex); pageBuilder.declarePosition(); int outputChannelOffset = 0; for (int outputIndex : probeOutputChannels) { Type type = probeTypes.get(outputIndex); Block block = probe.getBlock(outputIndex); type.appendTo(block, position, pageBuilder.getBlockBuilder(outputChannelOffset)); outputChannelOffset++; } pagesSpatialIndex.appendTo(joinAddress, pageBuilder, outputChannelOffset); } this.joinAddresses = null; } this.probe = null; this.probePosition = 0; }</code><technical_language>this.joinAddressIndex "last processed position", existing joinAddressIndex (the loop index variable) processed. i missing something</technical_language>

Target:
private void processProbe() { verify(probe != null); PagesSpatialIndex pagesSpatialIndex = getDone(pagesSpatialIndexFuture); DriverYieldSignal yieldSignal = operatorContext.getDriverContext().getYieldSignal(); while (probePosition < probe.getPositionCount()) { if (joinAddresses == null) { joinAddresses = pagesSpatialIndex.findJoinAddresses(probePosition, probe, probeGeometryChannel); localUserMemoryContext.setBytes(sizeOf(joinAddresses)); nextJoinAddressIndex = 0; if (yieldSignal.isSet()) { return; } } while (nextJoinAddressIndex < joinAddresses.length) { if (pageBuilder.isFull()) { return; } long joinAddress = joinAddresses[nextJoinAddressIndex]; if (pagesSpatialIndex.isJoinAddressEligible(joinAddress, probePosition, probe)) { pageBuilder.declarePosition(); int outputChannelOffset = 0; for (int outputIndex : probeOutputChannels) { Type type = probeTypes.get(outputIndex); Block block = probe.getBlock(outputIndex); type.appendTo(block, probePosition, pageBuilder.getBlockBuilder(outputChannelOffset)); outputChannelOffset++; } pagesSpatialIndex.appendTo(joinAddress, pageBuilder, outputChannelOffset); } nextJoinAddressIndex++; if (yieldSignal.isSet()) { return; } } joinAddresses = null; localUserMemoryContext.setBytes(0); probePosition++; } this.probe = null; this.probePosition = 0; }
Source:
<code>public JwtAuthenticationToken build() { <START> if (!jwt.hasHeader()) { <END> jwt.header(DEFAULT_HEADER_NAME, DEFAULT_HEADER_VALUE); } final Jwt token = jwt.build(); final Collection<GrantedAuthority> tokenAuthorities = authoritiesConverter.convert(token); final Collection<GrantedAuthority> authorities = addedAuthorities.isEmpty() ? tokenAuthorities : Stream.concat(tokenAuthorities.stream(), addedAuthorities.stream()).collect(Collectors.toSet()); return new JwtAuthenticationToken(token, authorities); }</code><technical_language>I simply supply a default header in beginning</technical_language>

Target:
public JwtAuthenticationToken build() { final Jwt token = getToken(); return new JwtAuthenticationToken(token, getAuthorities(token)); }
Source:
<code>public void execute(CommandLine options) throws Exception { boolean mergeBlocks = options.hasOption('b'); <START> int maxBlockSize = options.hasOption('l')? Integer.parseInt(options.getOptionValue('l')) : 128; <END> CompressionCodecName compressionCodec = options.hasOption('c') ? CompressionCodecName.valueOf(options.getOptionValue('c')) : CompressionCodecName.SNAPPY; List<String> args = options.getArgList(); List<Path> inputFiles = getInputFiles(args.subList(0, args.size() - 1)); Path outputFile = new Path(args.get(args.size() - 1)); if (mergeBlocks) { CodecFactory.BytesCompressor compressor = new CodecFactory(conf, DEFAULT_PAGE_SIZE).getCompressor(compressionCodec); mergeBlocks(maxBlockSize * 1024 * 1024, compressor, inputFiles, outputFile); } else { mergeFiles(inputFiles, outputFile); } }</code><technical_language>I mistaken, I this result in a desired row group size of 128 bytes, 128 megabytes. I suggest ParquetWriter.DEFAULT_BLOCK_SIZE constant instead of a hard-coded value</technical_language>

Target:
public void execute(CommandLine options) throws Exception { boolean mergeBlocks = options.hasOption('b'); int maxBlockSize = options.hasOption('l')? Integer.parseInt(options.getOptionValue('l')) * 1024 * 1024 : DEFAULT_BLOCK_SIZE; CompressionCodecName compressionCodec = options.hasOption('c') ? CompressionCodecName.valueOf(options.getOptionValue('c')) : CompressionCodecName.SNAPPY; List<String> args = options.getArgList(); List<Path> inputFiles = getInputFiles(args.subList(0, args.size() - 1)); Path outputFile = new Path(args.get(args.size() - 1)); if (mergeBlocks) { CodecFactory.BytesCompressor compressor = new CodecFactory(conf, DEFAULT_PAGE_SIZE).getCompressor(compressionCodec); mergeBlocks(maxBlockSize, compressor, inputFiles, outputFile); } else { mergeFiles(inputFiles, outputFile); } }
Source:
<code>public GarrukSavageHerald(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{4}{G}{G}"); this.addSuperType(SuperType.LEGENDARY); this.subtype.add(SubType.GARRUK); this.addAbility(new PlaneswalkerEntersWithLoyaltyCountersAbility(5)); this.addAbility(new LoyaltyAbility(new GarrukSavageHeraldEffect(), 1)); Ability minusAbility = new LoyaltyAbility(new DamageWithPowerFromOneToAnotherTargetEffect(), -2); minusAbility.addTarget(new TargetControlledCreaturePermanent()); <START> minusAbility.addTarget(new TargetCreaturePermanent(StaticFilters.FILTER_CREATURE_YOU_DONT_CONTROL)); <END> this.addAbility(minusAbility); ContinuousEffect ultimateEffect = new GainAbilityControlledEffect(DamageAsThoughNotBlockedAbility.getInstance(), Duration.EndOfTurn); ultimateEffect.setText("Until end of turn, creatures you control gain \"You may have this creature assign its combat damage as though it weren't blocked.\""); ultimateEffect.setDependedToType(DependencyType.AddingAbility); this.addAbility(new LoyaltyAbility(ultimateEffect, -7)); }</code><technical_language>Wrong filter -- "another target creature", "you control". example of FallOfTheHammer target tags usage for ability (but please, test changes -- is works correct not)</technical_language>

Target:
public GarrukSavageHerald(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{4}{G}{G}"); this.addSuperType(SuperType.LEGENDARY); this.subtype.add(SubType.GARRUK); this.addAbility(new PlaneswalkerEntersWithLoyaltyCountersAbility(5)); this.addAbility(new LoyaltyAbility(new GarrukSavageHeraldEffect(), 1)); DamageWithPowerFromOneToAnotherTargetEffect effect = new DamageWithPowerFromOneToAnotherTargetEffect(); effect.setText("Target creature you control deals damage equal to its power to another target creature"); Ability minusAbility = new LoyaltyAbility(effect, -2); TargetControlledCreaturePermanent controlledCreature = new TargetControlledCreaturePermanent(); controlledCreature.setTargetTag(1); minusAbility.addTarget(controlledCreature); FilterCreaturePermanent filter = new FilterCreaturePermanent("Another creature: damage dealt to"); filter.add(new AnotherTargetPredicate(2)); TargetCreaturePermanent anotherTargetCreature = new TargetCreaturePermanent(filter); minusAbility.addTarget(anotherTargetCreature); this.addAbility(minusAbility); ContinuousEffect ultimateEffect = new GainAbilityControlledEffect(DamageAsThoughNotBlockedAbility.getInstance(), Duration.EndOfTurn); ultimateEffect.setText("Until end of turn, creatures you control gain \"You may have this creature assign its combat damage as though it weren't blocked.\""); this.addAbility(new LoyaltyAbility(ultimateEffect, -7)); }
Source:
<code>public Variable createVariable(IBinding element, IType enclosingType, int positionScore) throws CModelException { IType elementType = getType(element); String elementName = element.getName(); if (elementType != null && (elementType.toString().equals(enclosingType.toString()) || elementType.isSameType(enclosingType) || isParent(elementType, enclosingType) || isAutomaticCasting(enclosingType, elementType) || isReferenceTo(enclosingType, elementType) <START> || isReferenceTo(elementType, <END> enclosingType))) { int variableType = Variable.GLOBAL; if (element instanceof ICPPField) { variableType = Variable.FIELD; } else if (element instanceof IVariable) { try { if (element instanceof ICPPBinding && ((ICPPBinding) element).isGloballyQualified()) { variableType = Variable.GLOBAL; } else { variableType = Variable.LOCAL; } } catch (DOMException e) { } } if (isReferenceTo(enclosingType, elementType)) elementName = "&" + elementName; else if (isReferenceTo(elementType, enclosingType)) elementName = "*" + elementName; return new Variable(elementType, elementName, variableType, positionScore, NO_TRIGGERS, getImageDescriptor(element)); } return null; }</code><technical_language>Break ||</technical_language>

Target:
private Variable createVariable(IBinding element, IType enclosingType, int positionScore) throws CModelException { IType elementType = getType(element); String elementName = element.getName(); if (elementType != null && (elementType.toString().equals(enclosingType.toString()) || elementType.isSameType(enclosingType) || isParent(elementType, enclosingType) || isAutomaticCasting(enclosingType, elementType) || isReferenceTo(enclosingType, elementType) || isReferenceTo(elementType, enclosingType))) { VariableType variableType = VariableType.GLOBAL; if (element instanceof ICPPField) { variableType = VariableType.FIELD; } else if (element instanceof IVariable) { try { if (element instanceof ICPPBinding && ((ICPPBinding) element).isGloballyQualified()) { variableType = VariableType.GLOBAL; } else { variableType = VariableType.LOCAL; } } catch (DOMException e) { } } if (isReferenceTo(enclosingType, elementType)) elementName = "&" + elementName; else if (isReferenceTo(elementType, enclosingType)) elementName = "*" + elementName; return new Variable(elementName, variableType, positionScore, NO_TRIGGERS, getImageDescriptor(element)); } return null; }
Source:
<code>public Subscription createSubscription(final SubscriptionBase subscriptionBase) throws TooManyPartitionsException, RepositoryProblemException, DuplicatedSubscriptionException, NoSuchEventTypeException, InconsistentStateException, WrongInitialCursorsException, DbWriteOperationsBlockedException, UnableProcessException, AuthorizationSectionException, ServiceTemporarilyUnavailableException { <START> checkFeatureToggles(subscriptionBase); <END> subscriptionValidationService.validateSubscription(subscriptionBase); final Subscription subscription = subscriptionRepository.createSubscription(subscriptionBase); authorizationValidator.authorizeSubscriptionView(subscription); nakadiKpiPublisher.publish(subLogEventType, () -> new JSONObject() .put("subscription_id", subscription.getId()) .put("status", "created")); nakadiAuditLogPublisher.publish(Optional.empty(), Optional.of(subscription), NakadiAuditLogPublisher.ResourceType.SUBSCRIPTION, NakadiAuditLogPublisher.ActionType.CREATED, subscription.getId()); return subscription; }</code><technical_language>I move checks for feature toggles private method, removes clutter. However, I suggest more precise in naming: checking feature toggles relevant creation update of subscriptions specifically, this reflected in method name</technical_language>

Target:
public Subscription createSubscription(final SubscriptionBase subscriptionBase) throws TooManyPartitionsException, RepositoryProblemException, DuplicatedSubscriptionException, NoSuchEventTypeException, InconsistentStateException, WrongInitialCursorsException, DbWriteOperationsBlockedException, UnableProcessException, AuthorizationNotPresentException, ServiceTemporarilyUnavailableException { checkFeatureTogglesForCreationAndUpdate(subscriptionBase); subscriptionValidationService.validateSubscription(subscriptionBase); final Subscription subscription = subscriptionRepository.createSubscription(subscriptionBase); authorizationValidator.authorizeSubscriptionView(subscription); nakadiKpiPublisher.publish(subLogEventType, () -> new JSONObject() .put("subscription_id", subscription.getId()) .put("status", "created")); nakadiAuditLogPublisher.publish(Optional.empty(), Optional.of(subscription), NakadiAuditLogPublisher.ResourceType.SUBSCRIPTION, NakadiAuditLogPublisher.ActionType.CREATED, subscription.getId()); return subscription; }
Source:
<code>protected void executeCommand() { VDSReturnValue vdsReturnaValue = runVdsCommand(VDSCommandType.StopRebalanceGlusterVolume, new GlusterVolumeVDSParameters(upServer.getId(), getGlusterVolumeName())); setSucceeded(vdsReturnaValue.getSucceeded()); if (!getSucceeded()) { handleVdsError(AuditLogType.GLUSTER_VOLUME_REBALANCE_STOP_FAILED, vdsReturnaValue.getVdsError() .getMessage()); return; } else { VDSReturnValue vdsRettunValueStatus = runVdsCommand(VDSCommandType.GetGlusterVolumeRebalanceStatus, new GlusterVolumeVDSParameters(upServer.getId(), getGlusterVolumeName())); <START> <END> GlusterVolumeTaskStatusEntity entity = (GlusterVolumeTaskStatusEntity) vdsRettunValueStatus.getReturnValue(); List<Step> stepsList = getDbFacade().getStepDao() .getStepsByExternalId(getGlusterVolumeDao().getById(getParameters().getVolumeId()) .getAsyncTask() .getStepId()); if (stepsList != null && !stepsList.isEmpty()) { entity.setStartTime(stepsList.get(0).getStartTime()); } getReturnValue().setActionReturnValue(entity); } endStepJob(); releaseVolumeLock(); }</code><technical_language>if command fails</technical_language>

Target:
protected void executeCommand() { VDSReturnValue vdsReturnaValue = runVdsCommand(VDSCommandType.StopRebalanceGlusterVolume, new GlusterVolumeVDSParameters(upServer.getId(), getGlusterVolumeName())); setSucceeded(vdsReturnaValue.getSucceeded()); if (!getSucceeded()) { handleVdsError(AuditLogType.GLUSTER_VOLUME_REBALANCE_STOP_FAILED, vdsReturnaValue.getVdsError() .getMessage()); return; } else { VDSReturnValue vdsRettunValueStatus = runVdsCommand(VDSCommandType.GetGlusterVolumeRebalanceStatus, new GlusterVolumeVDSParameters(upServer.getId(), getGlusterVolumeName())); if(vdsRettunValueStatus.getSucceeded()) { GlusterVolumeTaskStatusEntity entity = (GlusterVolumeTaskStatusEntity) vdsRettunValueStatus.getReturnValue(); List<Step> stepsList = getDbFacade().getStepDao() .getStepsByExternalId(getGlusterVolume().getAsyncTask().getTaskId()); if (stepsList != null && !stepsList.isEmpty()) { entity.setStartTime(stepsList.get(0).getStartTime()); } getReturnValue().setActionReturnValue(entity); } } endStepJob(); releaseVolumeLock(); }
Source:
<code>private <T> void executeOperation(final DataOperation<T> operation) { final List<LongRange> dataKeyRanges = operation.getDataKeyRanges(); final Pair<List<LongRange>, Map<String, List<LongRange>>> routingResult = router.route(dataKeyRanges); final List<LongRange> localKeyRanges = routingResult.getFirst(); final Map<String, List<LongRange>> remoteKeyRangesMap = routingResult.getSecond(); if (operation.isFromLocalClient()) { <START> resultAggregator.registerOperation(operation, remoteKeyRangesMap.size() + 1); <END> } if (operation.isFromLocalClient() && !remoteKeyRangesMap.isEmpty()) { sendOperationsToRemoteStores(operation, remoteKeyRangesMap); } final Map<Long, T> localOutputData; if (!localKeyRanges.isEmpty()) { localOutputData = executeLocalOperation(operation, localKeyRanges); } else { localOutputData = Collections.EMPTY_MAP; } if (operation.isFromLocalClient()) { resultAggregator.submitResultAndWaitRemoteOps(operation, localOutputData); } else { final Collection<List<LongRange>> failedRanges = remoteKeyRangesMap.values(); sendResultToOriginStore(operation, localOutputData, failedRanges); } }</code><technical_language>clarify, + 1 is for local operation, right</technical_language>

Target:
private <T> void executeOperation(final DataOperation<T> operation) { final List<LongRange> dataKeyRanges = operation.getDataKeyRanges(); final Pair<List<LongRange>, Map<String, List<LongRange>>> routingResult = router.route(dataKeyRanges); final List<LongRange> localKeyRanges = routingResult.getFirst(); final Map<String, List<LongRange>> remoteKeyRangesMap = routingResult.getSecond(); if (operation.isFromLocalClient()) { final int numSubOps = remoteKeyRangesMap.size() + 1; resultAggregator.registerOperation(operation, numSubOps); } if (operation.isFromLocalClient() && !remoteKeyRangesMap.isEmpty()) { sendOperationsToRemoteStores(operation, remoteKeyRangesMap); } final Map<Long, T> localOutputData; if (!localKeyRanges.isEmpty()) { localOutputData = executeLocalOperation(operation, localKeyRanges); } else { localOutputData = Collections.EMPTY_MAP; } if (operation.isFromLocalClient()) { resultAggregator.submitLocalResult(operation, localOutputData); } else { final Collection<List<LongRange>> failedRanges = remoteKeyRangesMap.values(); sendResultToOrigin(operation, localOutputData, failedRanges); } }
Source:
<code>public <T extends IRemoteConnection.Service> T getService(IRemoteConnection connection, Class<T> service) { if (IRemoteCommandShellService.class.equals(service)) { return (T) new JSchCommandShellService(connection); } else { <START> return null; <END> } }</code><technical_language>else is redundant</technical_language>

Target:
public <T extends IRemoteConnection.Service> T getService(IRemoteConnection connection, Class<T> service) { if (IRemoteCommandShellService.class.equals(service)) { return (T) new JSchCommandShellService(connection); } return null; }
Source:
<code>public void testTransientVariableDeletion() { <START> runtimeService.startProcessInstanceByKey("transientVarsTest"); <END> }</code><technical_language>adding assert stop Codacy complaining</technical_language>

Target:
public void testTransientVariableDeletion() { String processInstanceId = runtimeService.startProcessInstanceByKey("transientVarsTest").getId(); long count = historyService.createHistoricVariableInstanceQuery().processInstanceId(processInstanceId).variableName("response").count(); assertEquals(0, count); count = historyService.createHistoricVariableInstanceQuery().processInstanceId(processInstanceId).variableName("status").count(); assertEquals(0, count); }
Source:
<code>public static Collection<EClass> getSubClasses(EClass superClass) { final Collection<EClass> classes = new HashSet<EClass>(); for (final EPackage ePackage : getAllRegisteredEPackages()) { for (final EClassifier eClassifier : ePackage.getEClassifiers()) { if (eClassifier instanceof EClass) { final EClass eClass = (EClass) eClassifier; <START> if (superClass.isSuperTypeOf(eClass) && !eClass.isAbstract() && !eClass.isInterface() <END> || EcorePackage.eINSTANCE.getEObject() == superClass) { classes.add(eClass); } } } } return classes; }</code><technical_language>a minor detail, of checks faster isSuperTypeOf isAbstract weeds out many</technical_language>

Target:
public static Collection<EClass> getSubClasses(EClass superClass) { final Collection<EClass> classes = new HashSet<EClass>(); for (final EPackage ePackage : getAllRegisteredEPackages()) { for (final EClassifier eClassifier : ePackage.getEClassifiers()) { if (eClassifier instanceof EClass) { final EClass eClass = (EClass) eClassifier; if (!eClass.isAbstract() && !eClass.isInterface() && (EcorePackage.eINSTANCE.getEObject() == superClass || superClass.isSuperTypeOf(eClass))) { classes.add(eClass); } } } } return classes; }
Source:
<code>private WaitForDownloadService.ThenPerform.Action<Void> executeUpdateNotification(DownloadBatchStatus downloadBatchStatus) { return () -> { NotificationInformation notificationInformation = notificationCreator.createNotification(downloadBatchStatus); <START> if (downloadBatchStatus.status() == DELETION) { <END> downloadService.dismissNotification(notificationInformation); return null; } if (downloadBatchStatus.status() == DOWNLOADED) { downloadService.stackNotification(notificationInformation); return null; } downloadService.updateNotification(notificationInformation); return null; }; }</code><technical_language>if () { } else if (){ } else { } return null;</technical_language>

Target:
private WaitForDownloadService.ThenPerform.Action<Void> executeUpdateNotification(DownloadBatchStatus downloadBatchStatus) { return () -> { NotificationInformation notificationInformation = notificationCreator.createNotification(downloadBatchStatus); if (downloadBatchStatus.status() == DOWNLOADED || downloadBatchStatus.status() == DELETION) { downloadService.stackNotification(notificationInformation); } else { downloadService.updateNotification(notificationInformation); } return null; }; }
Source:
<code>protected void copyProperties(MetaDataMap metaDataMap, ResourceResolver resourceResolver, String payload) { final Resource resource = workflowHelper.getPageOrAssetResource(resourceResolver, payload); if (resource == null) { <START> log.debug("Could not process payload [ ] as it could be resolved to a Page or Asset", payload); <END> return; } final Boolean skipEmptyValue = metaDataMap.get(PN_SKIP_EMPTY_SOURCE_PROPERTY, Boolean.TRUE); final String[] propertyMaps = metaDataMap.get(PN_PROPERTY_MAP, new String[]{}); for (String propertyMap : propertyMaps) { propertyMap = StringUtils.replace(propertyMap, ALTERNATE_SEPARATOR, SEPARATOR); Map.Entry<String, String> entry = ParameterUtil.toMapEntry(propertyMap, SEPARATOR); try { PropertyResource source = new PropertyResource(StringUtils.trim(entry.getKey()), resource.getPath(), resourceResolver); PropertyResource destination = new PropertyResource(StringUtils.trim(entry.getValue()), resource.getPath(), resourceResolver); destination.setValue(source.getValue(), skipEmptyValue); } catch (WorkflowException e) { log.error("Could not copy properties", e); } } }</code><technical_language>Debug, warn</technical_language>

Target:
protected void copyProperties(MetaDataMap metaDataMap, ResourceResolver resourceResolver, String payload) { final Resource resource = workflowHelper.getPageOrAssetResource(resourceResolver, payload); if (resource == null) { log.warn("Could not process payload [ ] as it could be resolved to a Page or Asset", payload); return; } final Boolean skipEmptyValue = metaDataMap.get(PN_SKIP_EMPTY_SOURCE_PROPERTY, Boolean.TRUE); final String[] propertyMaps = metaDataMap.get(PN_PROPERTY_MAP, new String[]{}); for (String propertyMap : propertyMaps) { propertyMap = StringUtils.replace(propertyMap, ALTERNATE_SEPARATOR, SEPARATOR); Map.Entry<String, String> entry = ParameterUtil.toMapEntry(propertyMap, SEPARATOR); try { PropertyResource source = new PropertyResource(StringUtils.trim(entry.getKey()), resource.getPath(), resourceResolver); PropertyResource destination = new PropertyResource(StringUtils.trim(entry.getValue()), resource.getPath(), resourceResolver); destination.setValue(source.getValue(), skipEmptyValue); } catch (WorkflowException e) { log.error("Could not copy properties [ -> ] for payload [ ]", new String[]{entry.getKey(), entry.getValue(), resource.getPath()} , e); } } }
Source:
<code>public IgniteInternalFuture<Void> schedule(int grpId) throws IgniteCheckedException { CacheGroupContext grp = ctx.cache().cacheGroup(grpId); if (grp == null) { if (log.isDebugEnabled()) log.debug("Skip reencryption, cache group was destroyed [grp=" + grpId + "]"); return new GridFinishedFuture<>(); } lock.lock(); try { if (stopped) throw new NodeStoppingException("Operation has been cancelled (node is stopping)."); if (grps.isEmpty()) ((GridCacheDatabaseSharedManager)ctx.cache().context().database()).addCheckpointListener(this); GroupScanTask prevState = grps.get(grpId); if (prevState != null && !prevState.isDone()) { if (log.isDebugEnabled()) log.debug("Reencryption already scheduled [grpId=" + grpId + "]"); return prevState; } Set<Integer> parts = new HashSet<>(); forEachPageStore(grp, new IgniteInClosureX<Integer>() { @Override public void applyx(Integer partId) { if (ctx.encryption().getEncryptionState(grpId, partId) == 0) { if (log.isDebugEnabled()) log.debug("Skipping partition reencryption [grp=" + grpId + ", p=" + partId + "]"); return; } parts.add(partId); } }); GroupScanTask grpScan = new GroupScanTask(grp, parts); <START> ctx.getSystemExecutorService().submit(grpScan); <END> if (log.isInfoEnabled()) log.info("Scheduled reencryption [grpId=" + grpId + "]"); grps.put(grpId, grpScan); return grpScan; } finally { lock.unlock(); } }</code><technical_language>task for cache group executed threads. single-threaded execution here</technical_language>

Target:
public IgniteInternalFuture<Void> schedule(int grpId) throws IgniteCheckedException { CacheGroupContext grp = ctx.cache().cacheGroup(grpId); if (grp == null || !grp.affinityNode()) { if (log.isInfoEnabled()) log.info("Skip reencryption, cache group doesn't exist on the local node [grp=" + grpId + "]"); return new GridFinishedFuture<>(); } lock.lock(); try { if (stopped) throw new NodeStoppingException("Operation has been cancelled (node is stopping)."); if (grps.isEmpty()) ((GridCacheDatabaseSharedManager)ctx.cache().context().database()).addCheckpointListener(this); GroupScanTask prevState = grps.get(grpId); if (prevState != null && !prevState.isDone()) { if (log.isDebugEnabled()) log.debug("Reencryption already scheduled [grpId=" + grpId + "]"); return prevState; } Set<Integer> parts = new HashSet<>(); forEachPageStore(grp, new IgniteInClosureX<Integer>() { @Override public void applyx(Integer partId) { if (ctx.encryption().getEncryptionState(grpId, partId) == 0) { if (log.isDebugEnabled()) log.debug("Skipping partition reencryption [grp=" + grpId + ", p=" + partId + "]"); return; } parts.add(partId); } }); GroupScanTask grpScan = new GroupScanTask(grp, parts); singleExecSvc.submit(grpScan); if (log.isInfoEnabled()) log.info("Scheduled reencryption [grpId=" + grpId + "]"); grps.put(grpId, grpScan); return grpScan; } finally { lock.unlock(); } }
Source:
<code>public void tccReceived(RTCPTCCPacket tccPacket) { MediaStream videoStream = null; for (MediaStream stream : mediaStreams) { if (stream instanceof VideoMediaStream) { videoStream = stream; break; } } RTCPTCCPacket.PacketMap packetMap = tccPacket.getPackets(); long previousArrivalTimeMs = -1; for (Map.Entry<Integer, Long> entry : packetMap.entrySet()) { <START> long arrivalTimeUs = entry.getValue(); <END> if (arrivalTimeUs == -1) { continue; } PacketDetail packetDetail = null; synchronized (sentPacketsSyncRoot) { packetDetail = sentPacketDetails.remove(entry.getKey()); } if (packetDetail != null && videoStream != null) { long arrivalTimeMs = arrivalTimeUs / 4; if (logger.isDebugEnabled()) { if (previousArrivalTimeMs != -1) { logger.debug("seq=" + entry.getKey() + ", arrival_time_ms=" + arrivalTimeMs + ", diff_ms=" + (arrivalTimeMs - previousArrivalTimeMs)); } else { logger.debug("seq=" + entry.getKey() + ", arrival_time_ms=" + arrivalTimeMs); } } previousArrivalTimeMs = arrivalTimeMs; long sendTime24bits = RemoteBitrateEstimatorAbsSendTime .convertMsTo24Bits(packetDetail.packetSendTimeMs); bitrateEstimatorAbsSendTime.incomingPacketInfo( arrivalTimeMs, sendTime24bits, packetDetail.packetLength, tccPacket.getSourceSSRC()); } } }</code><technical_language>I name "arrivalTimeUs" is a confusing</technical_language>

Target:
public void tccReceived(RTCPTCCPacket tccPacket) { RTCPTCCPacket.PacketMap packetMap = tccPacket.getPackets(); long previousArrivalTimeMs = -1; for (Map.Entry<Integer, Long> entry : packetMap.entrySet()) { long arrivalTime250Us = entry.getValue(); if (arrivalTime250Us == -1) { continue; } if (remoteReferenceTimeMs == -1) { remoteReferenceTimeMs = RTCPTCCPacket.getReferenceTime( new ByteArrayBufferImpl( tccPacket.fci, 0, tccPacket.fci.length)) / 4; localReferenceTimeMs = System.currentTimeMillis(); } PacketDetail packetDetail; synchronized (sentPacketsSyncRoot) { packetDetail = sentPacketDetails.remove(entry.getKey()); } if (packetDetail == null) { continue; } long arrivalTimeMs = arrivalTime250Us / 4 - remoteReferenceTimeMs + localReferenceTimeMs; if (logger.isDebugEnabled()) { if (previousArrivalTimeMs != -1) { long diff_ms = arrivalTimeMs - previousArrivalTimeMs; logger.debug("seq=" + entry.getKey() + ", arrival_time_ms=" + arrivalTimeMs + ", diff_ms=" + diff_ms); } else { logger.debug("seq=" + entry.getKey() + ", arrival_time_ms=" + arrivalTimeMs); } } previousArrivalTimeMs = arrivalTimeMs; long sendTime24bits = RemoteBitrateEstimatorAbsSendTime .convertMsTo24Bits(packetDetail.packetSendTimeMs); bitrateEstimatorAbsSendTime.incomingPacketInfo( arrivalTimeMs, sendTime24bits, packetDetail.packetLength, tccPacket.getSourceSSRC()); } }
Source:
<code>public void updatesSameStandConcurrently() throws Exception { final Stand stand = this.stand(); final Coordinates pulse = this.pulse(); this.post(stand, pulse, new AtomicLong(1)); final Document dom = DocumentBuilderFactory.newInstance() .newDocumentBuilder().newDocument(); dom.appendChild(dom.createElement("a0")); final String xembly = stand.pulses().tail(pulse) .iterator().next().xembly(); <START> new Snapshot(xembly).xml(); <END> MatcherAssert.assertThat(xembly, Matchers.startsWith("XPATH \" MatcherAssert.assertThat( XhtmlMatchers.xhtml(dom), XhtmlMatchers.hasXPath("/a0/a1/a2/a3/a4") ); }</code><technical_language>This is wrong. error this integration test is in case. Read this test dom changed this line. changing anything, this line absolutely nothing</technical_language>

Target:
public void updatesSameStandConcurrently() throws Exception { final Stand stand = this.stand(); final Coordinates pulse = this.pulse(); this.post(stand, pulse, new AtomicLong(1)); final Document dom = DocumentBuilderFactory.newInstance() .newDocumentBuilder().newDocument(); dom.appendChild(dom.createElement("a0")); final String xembly = stand.pulses().tail(pulse) .iterator().next().xembly(); MatcherAssert.assertThat(xembly, Matchers.startsWith("XPATH \" MatcherAssert.assertThat( XhtmlMatchers.xhtml(new Snapshot(xembly).xml()), XhtmlMatchers.hasXPath("/a0/a1/a2/a3/a4") ); }
Source:
<code>public static boolean isRealmModel(TypeMirror type) { <START> for (TypeMirror typeMirror : typeUtils.directSupertypes(type)) { <END> String supertype = typeMirror.toString(); if (supertype.equals("io.realm.RealmObject") || supertype.equals("io.realm.RealmModel")) { return true; } } return false; }</code><technical_language>I assume scanning supertypes model implement interfaces? if model inherits ancestor implements RealmModel overrides RealmObject? this allowed</technical_language>

Target:
public static boolean isRealmModel(TypeMirror type) { return typeUtils.isAssignable(type, realmModel); }
Source:
<code>public void reduceTest() { List<Tuple2<Integer, Integer>> inData = new ArrayList<Tuple2<Integer, Integer>>(); List<Tuple2<Integer, Integer>> outData = new ArrayList<Tuple2<Integer, Integer>>(); for(int i=1; i<6; i++) { for(int j=0; j<i; j++) { inData.add(new Tuple2<Integer, Integer>(i,1)); } } TupleTypeInfo<Tuple2<Integer, Integer>> typeInfo = new TupleTypeInfo<Tuple2<Integer, Integer>>( BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.INT_TYPE_INFO); TypeSerializer<Tuple2<Integer, Integer>> serializer = typeInfo.createSerializer(); TypeComparator<Tuple2<Integer, Integer>> comparator = typeInfo.createComparator(new int[]{0}, new boolean[]{true}); MutableObjectIterator<Tuple2<Integer, Integer>> moi = new MutableObjectIteratorWrapper<Tuple2<Integer, Integer>>(inData.iterator(), serializer); KeyGroupedIterator<Tuple2<Integer, Integer>> kgi = new KeyGroupedIterator<Tuple2<Integer, Integer>>(moi, serializer, comparator); ReduceFunction<Tuple2<Integer, Integer>> testFunc = new ReduceTestFunction(); testFunc.setTypeSerializer(serializer); Collector<Tuple2<Integer, Integer>> out = new ListOutputCollector<Tuple2<Integer, Integer>>(outData, serializer); try { while (kgi.nextKey()) { testFunc.reduce(kgi.getValues(), out); } } catch(IOException ioe) { Assert.fail(); <START> } catch(Exception e) { <END> e.printStackTrace(); Assert.fail(); } for(int i=0; i<outData.size(); i++) { Assert.assertTrue( ((Integer)outData.get(i).getField(0)).intValue() == ((Integer)outData.get(i).getField(1)).intValue()); } }</code><technical_language>do this construct here? printing a stack trace IOException? a hand exception JUnit</technical_language>

Target:
public void reduceTest() throws Exception { List<Tuple2<Integer, Integer>> inData = new ArrayList<Tuple2<Integer, Integer>>(); List<Tuple2<Integer, Integer>> outData = new ArrayList<Tuple2<Integer, Integer>>(); for(int i=1; i<6; i++) { for(int j=0; j<i; j++) { inData.add(new Tuple2<Integer, Integer>(i,1)); } } TupleTypeInfo<Tuple2<Integer, Integer>> typeInfo = new TupleTypeInfo<Tuple2<Integer, Integer>>( BasicTypeInfo.INT_TYPE_INFO, BasicTypeInfo.INT_TYPE_INFO); TypeSerializer<Tuple2<Integer, Integer>> serializer = typeInfo.createSerializer(); TypeComparator<Tuple2<Integer, Integer>> comparator = typeInfo.createComparator(new int[]{0}, new boolean[]{true}); MutableObjectIterator<Tuple2<Integer, Integer>> moi = new MutableObjectIteratorWrapper<Tuple2<Integer, Integer>>(inData.iterator(), serializer); KeyGroupedIterator<Tuple2<Integer, Integer>> kgi = new KeyGroupedIterator<Tuple2<Integer, Integer>>(moi, serializer, comparator); ReduceFunction<Tuple2<Integer, Integer>> testFunc = new ReduceTestFunction(); testFunc.setTypeSerializer(serializer); Collector<Tuple2<Integer, Integer>> out = new CollectionOutputCollector<Tuple2<Integer, Integer>>(outData, serializer); while (kgi.nextKey()) { testFunc.reduce(kgi.getValues(), out); } for(int i=0; i<outData.size(); i++) { Assert.assertTrue( ((Integer)outData.get(i).getField(0)).intValue() == ((Integer)outData.get(i).getField(1)).intValue()); } }
Source:
<code>public Stack saveStack(final String applicationId, final String applicationVersion) { <START> VersionEntity version = versionRepository.findByName(applicationId); <END> if (version == null) { version = versionRepository.save(new VersionEntity(applicationVersion)); } ApplicationEntity application = applicationRepository.findByName(applicationId); if (application == null) { application = new ApplicationEntity(applicationId); } if (!application.getVersionEntities().contains(version)) { application.getVersionEntities().add(version); } application = applicationRepository.save(application); return new Stack(application, version); }</code><technical_language>applicationId applicationVersion null. of them. need handle this</technical_language>

Target:
public Stack saveStack(final String applicationId, final String applicationVersion) { if (applicationId == null && applicationVersion == null) { return new Stack( null, null ); } ApplicationEntity application = null; VersionEntity version = null; if (applicationVersion != null) { version = versionRepository.findByName(applicationVersion); if (version == null) { version = versionRepository.save(new VersionEntity(applicationVersion)); } } if (applicationId != null) { application = applicationRepository.findByName(applicationId); if (application == null) { application = new ApplicationEntity(applicationId); } if (version != null) { if (!application.getVersionEntities().contains(version)) { application.getVersionEntities().add(version); } } application = applicationRepository.save(application); } return new Stack(application, version); }
Source:
<code>public <T> Mono<CosmosItemResponse<T>> upsertItem(T item, PartitionKey partitionKey, CosmosItemRequestOptions options) { final CosmosItemRequestOptions requestOptions = options == null ? new CosmosItemRequestOptions() : options; <START> ModelBridgeInternal.setPartitionKey(options, partitionKey); <END> return withContext(context -> upsertItemInternal(item, requestOptions, context)); }</code><technical_language>This is a bug, need pass requestOptions instead of options OOF, I fix in branch push it</technical_language>

Target:
public <T> Mono<CosmosItemResponse<T>> upsertItem(T item, PartitionKey partitionKey, CosmosItemRequestOptions options) { final CosmosItemRequestOptions requestOptions = options == null ? new CosmosItemRequestOptions() : options; ModelBridgeInternal.setPartitionKey(requestOptions, partitionKey); return withContext(context -> upsertItemInternal(item, requestOptions, context)); }
Source:
<code>public void shouldCreateMultipleToolsAndAggregationResultWithWarningsAggregateFalseAndSameTool() { FreeStyleProject project = createJobWithWorkspaceFile("checkstyle2.xml", "checkstyle3.xml"); enableWarningsAggregation(project, false, "**/checkstyle2-issues.txt", new CheckStyle(), "**/checkstyle3-issues.txt", new CheckStyle()); List<AnalysisResult> results = scheduleBuildAndAssertStatusForBothTools(project, Result.FAILURE); for (AnalysisResult elements : results) { assertThat(elements).hasErrorMessages(); } <START> } <END></code><technical_language>Im Console Log des Builds der Jenkins Instanz! j.assertLogContains("ID checkstyle is another action: io.jenkins.plugins.analysis.core.views.ResultAction for CheckStyle", build)</technical_language>

Target:
public void shouldCreateMultipleToolsAndAggregationResultWithWarningsAggregateFalseAndSameTool() { FreeStyleProject project = createJobWithWorkspaceFile("checkstyle2.xml", "checkstyle3.xml"); enableWarningsAggregation(project, false, "**/checkstyle2-issues.txt", new CheckStyle(), "**/checkstyle3-issues.txt", new CheckStyle()); FreeStyleBuild build = scheduleBuildAndAssertLog(project, Result.FAILURE,"ID checkstyle is already used by another action: io.jenkins.plugins.analysis.core.views.ResultAction for CheckStyle"); List<AnalysisResult> results = getAssertStatusForBothTools(build); assertThat(results).hasSize(1); for (AnalysisResult element : results) { assertThat(element).hasId("checkstyle"); } }
Source:
<code><START> public void lastSweptGoesDownIfNewInformationBecomesAvailable() { <END> metrics.updateProgressForShard(CONS_ZERO, 999); waitForProgressToRecompute(); assertLastSweptTimestampConservativeEquals(999); puncherStore.put(999, 999); assertMillisSinceLastSweptConservativeEquals(999); metrics.updateProgressForShard(CONS_ONE, 200); waitForProgressToRecompute(); assertLastSweptTimestampConservativeEquals(200); puncherStore.put(200, 200); assertMillisSinceLastSweptConservativeEquals(200); }</code><technical_language>this happen in practice</technical_language>

Target:
public void lastSweptGoesDownIfNewInformationBecomesAvailable() { metrics.updateProgressForShard(CONS_ZERO, 999); waitForProgressToRecompute(); assertLastSweptTimestampConservativeEquals(999); puncherStore.put(999, 999); assertMillisSinceLastSweptConservativeEqualsClockTimeMinus(999); metrics.updateProgressForShard(CONS_ONE, 200); waitForProgressToRecompute(); assertLastSweptTimestampConservativeEquals(200); puncherStore.put(200, 200); assertMillisSinceLastSweptConservativeEqualsClockTimeMinus(200); }
Source:
<code>private void sendMetrics(final WorkerMetrics workerMetrics) { <START> LOG.log(Level.INFO, "Sending metricsMessage {0}", new Object[]{workerMetrics}); <END> metricsMsgSender.send(workerMetrics); }</code><technical_language>log Metrics periodically, I logging this message enough FINE (or below) level</technical_language>

Target:
private void sendMetrics(final WorkerMetrics workerMetrics) { LOG.log(Level.FINE, "Sending WorkerMetrics {0}", new Object[]{workerMetrics}); metricsMsgSender.send(workerMetrics); }
Source:
<code>public ChannelFuture awaitBarrier(String barrierName) throws Exception { final Barrier barrier = barriersByName.get(barrierName); if (barrier == null) { <START> throw new Exception("Can not await nonexistant barrier: " + barrierName); <END> } return barrier.getFuture(); }</code><technical_language>typo: nonexistent ?</technical_language>

Target:
public ChannelFuture awaitBarrier(String barrierName) throws Exception { final Barrier barrier = barriersByName.get(barrierName); if (barrier == null) { throw new Exception("Can not notify a barrier that does not exist in the script: " + barrierName); } return barrier.getFuture(); }
Source:
<code>private void validateStopDatetime(Visit visit, Visit otherVisit, Errors errors) { if (visit.getStopDatetime() != null && otherVisit.getStartDatetime() != null && otherVisit.getStopDatetime() != null && visit.getStopDatetime().after(otherVisit.getStartDatetime()) && visit.getStopDatetime().before(otherVisit.getStopDatetime())) { errors.rejectValue("stopDatetime", "Visit.stopDateCannotFallIntoAnotherVisitOfTheSamePatient", "This visit has a stop date that falls into another visit of the same patient."); } if (visit.getStartDatetime() != null && visit.getStopDatetime() != null && otherVisit.getStartDatetime() != null && otherVisit.getStopDatetime() != null && visit.getStartDatetime().before(otherVisit.getStartDatetime()) && visit.getStopDatetime().after(otherVisit.getStopDatetime())) { <START> String messageBuilder = "This visit contains another visit of the same patient, " <END> + "i.e. its start date is before the start date of the other visit " + "and its stop date is after the stop date of the other visit."; errors.rejectValue("stopDatetime", "Visit.visitCannotContainAnotherVisitOfTheSamePatient", messageBuilder); } }</code><technical_language>variable name remain messageBuilder</technical_language>

Target:
private void validateStopDatetime(Visit visit, Visit otherVisit, Errors errors) { if (visit.getStopDatetime() != null && otherVisit.getStartDatetime() != null && otherVisit.getStopDatetime() != null && visit.getStopDatetime().after(otherVisit.getStartDatetime()) && visit.getStopDatetime().before(otherVisit.getStopDatetime())) { errors.rejectValue("stopDatetime", "Visit.stopDateCannotFallIntoAnotherVisitOfTheSamePatient", "This visit has a stop date that falls into another visit of the same patient."); } if (visit.getStartDatetime() != null && visit.getStopDatetime() != null && otherVisit.getStartDatetime() != null && otherVisit.getStopDatetime() != null && visit.getStartDatetime().before(otherVisit.getStartDatetime()) && visit.getStopDatetime().after(otherVisit.getStopDatetime())) { String message = "This visit contains another visit of the same patient, " + "i.e. its start date is before the start date of the other visit " + "and its stop date is after the stop date of the other visit."; errors.rejectValue("stopDatetime", "Visit.visitCannotContainAnotherVisitOfTheSamePatient", message); } }
Source:
<code>public List<GridFSDBFile> find( DBObject query , DBObject sort){ List<GridFSDBFile> files = new ArrayList<GridFSDBFile>(); <START> DBCursor c = _filesCollection.find( query ); <END> if (sort != null) { c.sort(sort); } while ( c.hasNext() ){ files.add( _fix( c.next() ) ); } return files; }</code><technical_language>Ha... thanks much! I this section of code I aware of changes recently</technical_language>

Target:
public List<GridFSDBFile> find( DBObject query , DBObject sort){ List<GridFSDBFile> files = new ArrayList<GridFSDBFile>(); DBCursor c = null; try { c = _filesCollection.find( query ); if (sort != null) { c.sort(sort); } while ( c.hasNext() ){ files.add( _fix( c.next() ) ); } } finally { if (c != null){ c.close(); } } return files; }