auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>static void computeSha1s(FileInputStream fileInputStream, BoxUploadSession uploadSession, long fileSize) throws NoSuchAlgorithmException, IOException { int totalParts = uploadSession.getTotalParts(); List<String> partSha1s = new ArrayList<>(totalParts); <START> byte[] partBuffer = new byte[uploadSession.getPartSize()]; <END> MessageDigest mdFile = MessageDigest.getInstance("SHA-1"); MessageDigest mdPart = MessageDigest.getInstance("SHA-1"); for (int i = 0; i < totalParts; i++) { partBuffer = new byte[BoxUploadSession.getChunkSize(uploadSession, i, fileSize)]; fileInputStream.read(partBuffer); mdPart.reset(); mdPart.update(partBuffer); partSha1s.add(Base64.encodeToString(mdPart.digest(), Base64.DEFAULT)); mdFile.update(partBuffer); } uploadSession.setPartsSha1(partSha1s); uploadSession.setSha1(Base64.encodeToString(mdFile.digest(), Base64.DEFAULT)); }</code><technical_language>is need declare this byte array for loop. Lets for loop</technical_language>

Target:
static void computeSha1s(FileInputStream fileInputStream, BoxUploadSession uploadSession, long fileSize) throws NoSuchAlgorithmException, IOException { int totalParts = uploadSession.getTotalParts(); List<String> partSha1s = new ArrayList<>(totalParts); byte[] partBuffer; int partBufferSize = SdkUtils.BUFFER_SIZE; int bytesOfChunkToRead; MessageDigest mdFile = MessageDigest.getInstance("SHA-1"); MessageDigest mdPart = MessageDigest.getInstance("SHA-1"); for (int i = 0; i < totalParts; i++) { bytesOfChunkToRead = BoxUploadSession.getChunkSize(uploadSession, i, fileSize); partBuffer = new byte[partBufferSize]; while (bytesOfChunkToRead > 0) { if (bytesOfChunkToRead < partBufferSize) { partBuffer = new byte[bytesOfChunkToRead]; } fileInputStream.read(partBuffer); bytesOfChunkToRead -= partBufferSize; mdPart.update(partBuffer); mdFile.update(partBuffer); } partSha1s.add(Base64.encodeToString(mdPart.digest(), Base64.DEFAULT)); mdPart.reset(); } uploadSession.setPartsSha1(partSha1s); uploadSession.setSha1(Base64.encodeToString(mdFile.digest(), Base64.DEFAULT)); }
Source:
<code>protected void ExecuteVmCommand() { lockVmWithCompensationIfNeeded(); if (!isInternalExecution()) { freeLock(); } restoreSnapshotAndRemoveObsoleteSnapshots(); if (getImagesList().size() > 0) { VdcReturnValueBase returnValue = null; for (DiskImage image : getImagesList()) { if (image.getimageStatus() != ImageStatus.ILLEGAL) { ImagesContainterParametersBase params = new RestoreFromSnapshotParameters(image.getImageId(), getVmId(), targetSnapshot, removedSnapshotId); returnValue = runAsyncTask(VdcActionType.RestoreFromSnapshot, params); } } if (getTaskIdList().size() == 0) { log.errorFormat("Can't restore snapshot for VM, since no destroyImage task could be established in the VDSM."); if (returnValue != null) { getReturnValue().setFault(returnValue.getFault()); <START> return; <END> } } else { setSucceeded(true); } deleteOrphanedImages(); removeSnapshotsFromDB(); } else { removeSnapshotsFromDB(); EndVmCommand(); setSucceeded(true); } }</code><technical_language>Allon Mureinik 2:08 PM If is need for async tasks - call EndCommand manually (the else block) If async tasks - AsyncTaskManager call EndCommand done. if unable create tasks needed - task returns a fault - /not/ call endCommand. Reply: assuming if multiple tasks, EndVmCommand takes a lock prevent a race tasks finish time is another task running perform necessary actions</technical_language>

Target:
protected void ExecuteVmCommand() { lockVmWithCompensationIfNeeded(); if (!isInternalExecution()) { freeLock(); } restoreSnapshotAndRemoveObsoleteSnapshots(); boolean succeeded = true; boolean hasAsyncTasks = false; if (getImagesList().size() > 0) { for (DiskImage image : getImagesList()) { if (image.getimageStatus() != ImageStatus.ILLEGAL) { ImagesContainterParametersBase params = new RestoreFromSnapshotParameters(image.getImageId(), getVmId(), targetSnapshot, removedSnapshotId); VdcReturnValueBase returnValue = runAsyncTask(VdcActionType.RestoreFromSnapshot, params); if (!returnValue.getSucceeded()) { succeeded = false; getReturnValue().setFault(returnValue.getFault()); } } } hasAsyncTasks = !getTaskIdList().isEmpty(); } removeSnapshotsFromDB(); if (hasAsyncTasks) { deleteOrphanedImages(); } else { EndVmCommand(); } setSucceeded(succeeded); }
Source:
<code><START> public boolean hasTxLogs() throws RuntimeException <END> { File[] files = storeDir.listFiles( LogFiles.FILENAME_FILTER ); if ( files == null ) { throw new RuntimeException( "Files was null. Incorrect directory or I/O error?" ); } return files.length > 0; }</code><technical_language>sense declare throws RuntimeException</technical_language>

Target:
public boolean hasTxLogs() { File[] files = storeDir.listFiles( LogFiles.FILENAME_FILTER ); if ( files == null ) { throw new RuntimeException( "Files was null. Incorrect directory or I/O error?" ); } return files.length > 0; }
Source:
<code>protected Map<Guid, KeyValuePairCompat<String, List<Guid>>> populateVmsMetadataForOvfUpdate(List<Guid> idsToProcess) { Map<Guid, KeyValuePairCompat<String, List<Guid>>> vmsAndTemplateMetadata = new HashMap<Guid, KeyValuePairCompat<String, List<Guid>>>(); List<VM> vms = getVmDao().getVmsByIds(idsToProcess); for (VM vm : vms) { if (VMStatus.ImageLocked != vm.getStatus()) { updateVmDisksFromDb(vm); if (!verifyImagesStatus(vm.getDiskList())) { continue; } ArrayList<DiskImage> vmImages = getVmImagesFromDb(vm); if (!verifyImagesStatus(vmImages)) { continue; } vm.setSnapshots(getSnapshotDao().getAllWithConfiguration(vm.getId())); if (!verifySnapshotsStatus(vm.getSnapshots())) { continue; } loadVmData(vm); Long currentDbGeneration = getVmStaticDao().getDbGeneration(vm.getId()); <START> if (currentDbGeneration == null) { <END> log.warnFormat("currentDbGeneration of VM (name: {0}, id: {1}) is null, probably because the VM was deleted during the run of OvfDataUpdater.", vm.getName(), vm.getId()); } else if (vm.getStaticData().getDbGeneration() == currentDbGeneration) { proccessedOvfConfigurationsInfo.add(buildMetadataDictionaryForVm(vm, vmsAndTemplateMetadata, vmImages)); proccessedIdsInfo.add(vm.getId()); proccessedOvfGenerationsInfo.add(vm.getStaticData().getDbGeneration()); proccessDisksDomains(vm.getDiskList()); } } } return vmsAndTemplateMetadata; }</code><technical_language>please change 'continue' instead of else branch</technical_language>

Target:
protected Map<Guid, KeyValuePairCompat<String, List<Guid>>> populateVmsMetadataForOvfUpdate(List<Guid> idsToProcess) { Map<Guid, KeyValuePairCompat<String, List<Guid>>> vmsAndTemplateMetadata = new HashMap<Guid, KeyValuePairCompat<String, List<Guid>>>(); List<VM> vms = getVmDao().getVmsByIds(idsToProcess); for (VM vm : vms) { if (VMStatus.ImageLocked != vm.getStatus()) { updateVmDisksFromDb(vm); if (!verifyImagesStatus(vm.getDiskList())) { continue; } ArrayList<DiskImage> vmImages = getVmImagesFromDb(vm); if (!verifyImagesStatus(vmImages)) { continue; } vm.setSnapshots(getSnapshotDao().getAllWithConfiguration(vm.getId())); if (!verifySnapshotsStatus(vm.getSnapshots())) { continue; } loadVmData(vm); Long currentDbGeneration = getVmStaticDao().getDbGeneration(vm.getId()); if (currentDbGeneration == null) { log.warnFormat("currentDbGeneration of VM (name: {0}, id: {1}) is null, probably because the VM was deleted during the run of OvfDataUpdater.", vm.getName(), vm.getId()); continue; } if (vm.getStaticData().getDbGeneration() == currentDbGeneration) { proccessedOvfConfigurationsInfo.add(buildMetadataDictionaryForVm(vm, vmsAndTemplateMetadata, vmImages)); proccessedIdsInfo.add(vm.getId()); proccessedOvfGenerationsInfo.add(vm.getStaticData().getDbGeneration()); proccessDisksDomains(vm.getDiskList()); } } } return vmsAndTemplateMetadata; }
Source:
<code>public Control render(final SWTGridCell cell, Composite parent) throws NoRendererFoundException, NoPropertyDescriptorFoundExeption { Control control = controls.get(cell); if (control != null) { return control; } control = renderControl(cell, parent); if (control == null) { return null; } controls.put(cell, control); <START> <END> if (!canHandleControlProcessor()) { defaultHandleControlProcessorForCell(control, cell); } control.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { if (controls != null) { controls.remove(cell); } } }); return control; }</code><technical_language>I prefer move this AbstractControlSWTRenderer rely VControls</technical_language>

Target:
public Control render(final SWTGridCell cell, Composite parent) throws NoRendererFoundException, NoPropertyDescriptorFoundExeption { Control control = controls.get(cell); if (control != null) { return control; } control = renderControl(cell, parent); if (control == null) { return null; } controls.put(cell, control); control.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { if (controls != null) { controls.remove(cell); } } }); return control; }
Source:
<code>void validateMappingsConfig(MappingsConfig mappingsConfig, StackV4Request stackRequest) { String errorMessage = null; if (stackRequest.getCluster().isRangerRazEnabled()) { if (!mappingsConfig.getActorMappings().containsKey("rangerraz")) { errorMessage = "IDBMMS mappings must contain the RAZ role if RAZ is to be created!"; } } else { if (mappingsConfig.getActorMappings().containsKey("rangerraz")) { errorMessage = "IDBMMS mappings cannot contain the RAZ role if RAZ is not enabled for the cluster!"; } } if (errorMessage != null) { LOGGER.error(errorMessage); <START> throw new IdbmmsOperationException(errorMessage); <END> } }</code><technical_language>Minor: I throw BadRequestException more appropriately expresses problem is due a conflict of cluster settings IDBroker mappings. IdbmmsOperationException is supposed denote problems specific IDBMMS, e.g. due missing mappings, communication error some other internal service error</technical_language>

Target:
void validateMappingsConfig(MappingsConfig mappingsConfig, StackV4Request stackRequest) { if (stackRequest.getCluster().isRangerRazEnabled()) { if (!mappingsConfig.getActorMappings().containsKey("rangerraz")) { LOGGER.error("IDBMMS mappings must contain the RAZ role if RAZ is to be created!"); throw new BadRequestException("IDBMMS mappings must contain the RAZ role if RAZ is to be created!"); } } }
Source:
<code>public static void deletePeopleExceptForFirstPage(int localTableBlogId) { int fetchLimit = PeopleUtils.FETCH_LIMIT; <START> String[] tables = {TEAM_TABLE, FOLLOWERS_TABLE, EMAIL_FOLLOWERS_TABLE}; <END> getWritableDb().beginTransaction(); try { for (String table : tables) { int size = getPeopleCountForLocalBlogId(table, localTableBlogId); if (size > fetchLimit) { int deleteCount = size - fetchLimit; String[] args = new String[] {Integer.toString(localTableBlogId), Integer.toString(deleteCount)}; getWritableDb().delete(table, "local_blog_id=?1 AND person_id IN (SELECT person_id FROM " + table + " WHERE local_blog_id=?1" + orderByString(table) + " DESC LIMIT ?2)", args); } } getWritableDb().setTransactionSuccessful(); } finally { getWritableDb().endTransaction(); } }</code><technical_language>Hey @oguzkocer , this array include VIEWERS_TABLE well</technical_language>

Target:
public static void deletePeopleExceptForFirstPage(int localTableBlogId) { int fetchLimit = PeopleUtils.FETCH_LIMIT; String[] tables = {TEAM_TABLE, FOLLOWERS_TABLE, EMAIL_FOLLOWERS_TABLE, VIEWERS_TABLE}; getWritableDb().beginTransaction(); try { for (String table : tables) { int size = getPeopleCountForLocalBlogId(table, localTableBlogId); if (size > fetchLimit) { int deleteCount = size - fetchLimit; String[] args = new String[] {Integer.toString(localTableBlogId), Integer.toString(deleteCount)}; getWritableDb().delete(table, "local_blog_id=?1 AND person_id IN (SELECT person_id FROM " + table + " WHERE local_blog_id=?1" + orderByString(table) + " DESC LIMIT ?2)", args); } } getWritableDb().setTransactionSuccessful(); } finally { getWritableDb().endTransaction(); } }
Source:
<code>public void toExecute(JobExecutionContext context) throws JobExecutionException { Date now = new Date(); PoolFilterBuilder filters = new PoolFilterBuilder(); filters.addAttributeFilter("unmapped_guests_only", "true"); List<Pool> unmappedGuestPools = poolCurator.listByFilter(filters); List<Entitlement> lapsedUnmappedGuestEntitlements = new ArrayList<Entitlement>(); for (Pool p : unmappedGuestPools) { for (Entitlement e : p.getEntitlements()) { if (isLapsed(e, now)) { lapsedUnmappedGuestEntitlements.add(e); } } } for (Entitlement e : lapsedUnmappedGuestEntitlements) { <START> poolManager.revokeEntitlement(e); <END> } if (lapsedUnmappedGuestEntitlements.size() > 0) { log.info("Reaped unmapped guest entitlements due to expiration.", lapsedUnmappedGuestEntitlements.size()); } else { log.debug("No unmapped guest entitlements need reaping."); } }</code><technical_language>Adrian pointed out valid for 24 hours, revoke bloat bloated CRL more. this revoke method is that. modify this revoke entitlement, delete it</technical_language>

Target:
public void toExecute(JobExecutionContext context) throws JobExecutionException { Date now = new Date(); List<Entitlement> unmappedGuestEntitlements = entitlementCurator.findByPoolAttribute("unmapped_guests_only", "true"); int total = 0; for (Entitlement e : unmappedGuestEntitlements) { if (isLapsed(e, now)) { poolManager.revokeEntitlement(e); total++; } } if (total > 0) { log.info("Reaped unmapped guest entitlements due to expiration.", total); } else { log.debug("No unmapped guest entitlements need reaping."); } }
Source:
<code>public void customLabelNoOp_NegativeVoteNotBlock() throws Exception { Q.setFunctionName("NoOp"); saveLabelConfig(); PushOneCommit.Result r = createChange(); revision(r).review(new ReviewInput().label(Q.getName(), -1)); ChangeInfo c = get(r.getChangeId()); LabelInfo q = c.labels.get(Q.getName()); <START> assertThat(q.all.size()).isEqualTo(1); <END> assertThat(q.rejected).isNotNull(); assertThat(q.blocking).isNull(); }</code><technical_language>in tests</technical_language>

Target:
public void customLabelNoOp_NegativeVoteNotBlock() throws Exception { Q.setFunctionName("NoOp"); saveLabelConfig(); PushOneCommit.Result r = createChange(); revision(r).review(new ReviewInput().label(Q.getName(), -1)); ChangeInfo c = get(r.getChangeId()); LabelInfo q = c.labels.get(Q.getName()); assertThat(q.all).hasSize(1); assertThat(q.rejected).isNotNull(); assertThat(q.blocking).isNull(); }
Source:
<code>public String getImageId(String tagName) { String imageId = null; ModelNode tags = get(IMAGESTREAM_STATUS_TAGS); if (tags == null || tags.getType() != ModelType.LIST) return null; List<ModelNode> tagWrappers = tags.asList(); if (tagWrappers != null) { for (ModelNode tagWrapper : tagWrappers) { ModelNode tag = tagWrapper.get(TAG); ModelNode items = tagWrapper.get(ITEMS); if (tag != null && tag.asString().equals(tagName) && items != null) { List<ModelNode> itemWrappers = items.asList(); <START> for (ModelNode itemWrapper : itemWrappers) { <END> ModelNode image = itemWrapper.get(IMAGE); if (image != null) { imageId = image.asString(); break; } } } if (imageId != null) break; } } return imageId; }</code><technical_language>this extracted a separate method #getImageId(List<ModelNode> itemWrappers) for added code clarity/ method brevity</technical_language>

Target:
public String getImageId(String tagName) { String imageId = null; ModelNode tags = get(IMAGESTREAM_STATUS_TAGS); if (tags.getType() != ModelType.LIST || tagName == null) return null; List<ModelNode> tagWrappers = tags.asList(); for (ModelNode tagWrapper : tagWrappers) { ModelNode tag = tagWrapper.get(TAG); ModelNode items = tagWrapper.get(ITEMS); if (tag.asString().equals(tagName) && items.getType() == ModelType.LIST) { imageId = getImageId(items.asList()); break; } } return imageId; }
Source:
<code>private String formatProjects( List<MavenProject> projects ) { StringBuilder projectNames = new StringBuilder(); for ( int index = 0, size = projects.size(); index < size; index++ ) { <START> MavenProject project = projects.get( index ); <END> projectNames.append( project.getGroupId() ).append( ":" ).append( project.getArtifactId() ); boolean lastElement = index + 1 == size; if (!lastElement) { projectNames.append( ", " ); } } return projectNames.toString(); }</code><technical_language>iterate lists indexes, foreach iterators instead</technical_language>

Target:
private String formatProjects( List<MavenProject> projects ) { StringBuilder projectNames = new StringBuilder(); Iterator<MavenProject> iterator = projects.iterator(); while ( iterator.hasNext() ) { MavenProject project = iterator.next(); projectNames.append( project.getGroupId() ).append( ":" ).append( project.getArtifactId() ); if ( iterator.hasNext() ) { projectNames.append( ", " ); } } return projectNames.toString(); }
Source:
<code>public static void startIfRequired(MaxwellContext context) { MaxwellMetrics.Registries metricsRegistries = getMetricsRegistries(context.getConfig()); MaxwellDiagnosticContext diagnosticContext = getDiagnosticContext(context); if (metricsRegistries != null || diagnosticContext != null) { <START> LOGGER.info("Metrics http server starting"); <END> int port = context.getConfig().monitoringHTTPPort; String pathPrefix = context.getConfig().monitoringHTTPPathPrefix; MaxwellHTTPServerWorker maxwellHTTPServerWorker = new MaxwellHTTPServerWorker(port, pathPrefix, metricsRegistries, diagnosticContext); Thread thread = new Thread(maxwellHTTPServerWorker); context.addTask(maxwellHTTPServerWorker); thread.setUncaughtExceptionHandler((t, e) -> { e.printStackTrace(); System.exit(1); }); thread.setDaemon(true); thread.start(); LOGGER.info("Metrics http server started on port " + port); } }</code><technical_language>s/Metrics/Monitoring/? call "Maxwell http server" rename ;)</technical_language>

Target:
public static void startIfRequired(MaxwellContext context) throws IOException { MaxwellMetrics.Registries metricsRegistries = getMetricsRegistries(context); MaxwellDiagnosticContext diagnosticContext = getDiagnosticContext(context); if (metricsRegistries != null || diagnosticContext != null) { LOGGER.info("Maxwell http server starting"); int port = context.getConfig().httpPort; String pathPrefix = context.getConfig().httpPathPrefix; MaxwellHTTPServerWorker maxwellHTTPServerWorker = new MaxwellHTTPServerWorker(port, pathPrefix, metricsRegistries, diagnosticContext); Thread thread = new Thread(maxwellHTTPServerWorker); context.addTask(maxwellHTTPServerWorker); thread.setUncaughtExceptionHandler((t, e) -> { LOGGER.error("Maxwell http server failure", e); context.terminate((Exception) e); }); thread.setDaemon(true); thread.start(); LOGGER.info("Maxwell http server started on port " + port); } }
Source:
<code><START> private MessageInfo(StoreKey key, long size, boolean deleted, long expirationTimeInMs, Long crc, short accountId, <END> short containerId, long operationTimeMs) { this.key = key; this.size = size; this.isDeleted = deleted; this.expirationTimeInMs = expirationTimeInMs; this.crc = crc; this.accountId = accountId; this.containerId = containerId; this.operationTimeMs = operationTimeMs; }</code><technical_language>allowing negative values other -1 for timeInMs arguments</technical_language>

Target:
public MessageInfo(StoreKey key, long size, boolean deleted, long expirationTimeInMs, Long crc, short accountId, short containerId, long operationTimeMs) { if (operationTimeMs < Utils.Infinite_Time) { throw new IllegalArgumentException("OperationTime cannot be negative " + operationTimeMs); } this.key = key; this.size = size; this.isDeleted = deleted; this.expirationTimeInMs = expirationTimeInMs; this.crc = crc; this.accountId = accountId; this.containerId = containerId; this.operationTimeMs = operationTimeMs; }
Source:
<code><START> public SslEngineConfiguration(String keyStoreFileName, String keyStoreType, char[] keyStorePassword, char[] keyStoreCertificatePassword, String keyAlias, <END> SSLContext sslContext, String trustStoreFileName, String trustStoreType, char[] trustStorePassword, String protocol) { this.keyStoreFileName = keyStoreFileName; this.keyStoreType = keyStoreType; this.keyStorePassword = keyStorePassword; this.keyStoreCertificatePassword = keyStoreCertificatePassword; this.keyAlias = keyAlias; this.sslContext = sslContext; this.trustStoreFileName = trustStoreFileName; this.trustStoreType = trustStoreType; this.trustStorePassword = trustStorePassword; this.protocol = protocol; }</code><technical_language>need public</technical_language>

Target:
SslEngineConfiguration(String keyStoreFileName, String keyStoreType, char[] keyStorePassword, char[] keyStoreCertificatePassword, String keyAlias, SSLContext sslContext, String trustStoreFileName, String trustStoreType, char[] trustStorePassword, String protocol) { this.keyStoreFileName = keyStoreFileName; this.keyStoreType = keyStoreType; this.keyStorePassword = keyStorePassword; this.keyStoreCertificatePassword = keyStoreCertificatePassword; this.keyAlias = keyAlias; this.sslContext = sslContext; this.trustStoreFileName = trustStoreFileName; this.trustStoreType = trustStoreType; this.trustStorePassword = trustStorePassword; this.protocol = protocol; }
Source:
<code>private WhereClauseBuilder constraintClauseBuilder(RelationshipEntityType relationshipEntityType, String relationshipEntityUid) { return new WhereClauseBuilder() .appendKeyStringValue( RelationshipConstraintTableInfo.Columns.RELATIONSHIP_ENTITY, relationshipEntityType) .appendKeyStringValue( <START> RelationshipConstraintTableInfo.Columns.TRACKED_ENTITY_TYPE, relationshipEntityUid); <END> }</code><technical_language>hardcodes EntityUid a TrackedEntityType</technical_language>

Target:
private WhereClauseBuilder constraintClauseBuilder(RelationshipEntityType relationshipEntityType, String relationshipEntityUid) { return new WhereClauseBuilder() .appendKeyStringValue( RelationshipConstraintTableInfo.Columns.RELATIONSHIP_ENTITY, relationshipEntityType) .appendKeyStringValue(getRelationshipEntityColumn(relationshipEntityType), relationshipEntityUid); }
Source:
<code>private void afterDFcollection() { if (globalState == DynamicProcessorState.DONE || globalState == DynamicProcessorState.FAILED) { return; } TupleDomain<Symbol> tupleDomain = dfTupleDomain.get(); if (!tupleDomain.isAll()) { try { final Expression expr = DomainTranslator.toPredicate(tupleDomain); final Optional<RowExpression> rowExpression = converter.expressionToRowExpression(Optional.of(expr)); final RowExpression combinedExpression = call(logicalExpressionSignature(LogicalBinaryExpression.Type.AND), BOOLEAN, rowExpression.get(), staticFilter.get()); resultExpression = Optional.of(combinedExpression); globalState = DynamicProcessorState.DONE; triggerCallback(combinedExpression); } catch (Exception e) { globalState = DynamicProcessorState.FAILED; throw e; <START> } <END> } else { log.debug("DF Processing: Tuple Domain is all"); globalState = DynamicProcessorState.FAILED; } }</code><technical_language>this exception reported logged</technical_language>

Target:
private void afterDFcollection() { if (globalState == DynamicProcessorState.DONE || globalState == DynamicProcessorState.FAILED) { return; } TupleDomain<Symbol> tupleDomain = dfTupleDomain.get(); if (!tupleDomain.isAll()) { try { final Expression expr = DomainTranslator.toPredicate(tupleDomain); final Optional<RowExpression> rowExpression = converter.expressionToRowExpression(Optional.of(expr)); final RowExpression combinedExpression = call(logicalExpressionSignature(LogicalBinaryExpression.Type.AND), BOOLEAN, rowExpression.get(), staticFilter.get()); resultExpression = Optional.of(combinedExpression); globalState = DynamicProcessorState.DONE; triggerCallback(combinedExpression); } catch (Exception e) { globalState = DynamicProcessorState.FAILED; log.warn(e, "Could not convert Tuple Domain from DynamicFilter to Expression"); throw e; } } else { log.debug("DF Processing: Tuple Domain is all"); globalState = DynamicProcessorState.FAILED; } }
Source:
<code>private EventSubscriber<WorkspaceCreatedEvent> subscribeAndGetCreatedSubscriber() { subscribeToEventService(); <START> @SuppressWarnings("unchecked") <END> final EventSubscriber<WorkspaceCreatedEvent> subscriber = (EventSubscriber<WorkspaceCreatedEvent>) createAndChangeEventCaptor.getAllValues().get(1); return subscriber; }</code><technical_language>allow separate events captors for Create Update Workspace Events avoid casting, element index SuppressWarnings</technical_language>

Target:
private EventSubscriber<WorkspaceCreatedEvent> subscribeAndGetCreatedSubscriber() { subscribeToEventService(); return createEventCaptor.getValue(); }
Source:
<code>public void testFireExpressionEditorSelectedEventSelectsParentGridWidget() { final GridData mockParentUiModel = mock(GridData.class); final BaseExpressionGrid mockParentGrid = mock(BaseExpressionGrid.class); doReturn(mockParentUiModel).when(parent).getGridData(); doReturn(mockParentUiModel).when(mockParentGrid).getModel(); doReturn(new HashSet<GridWidget>() {{ add(mockParentGrid); add(grid); }}).when(gridLayer).getGridWidgets(); <START> grid.fireExpressionEditorSelectedEvent(); <END> verify(editorSelectedEvent).fire(expressionEditorSelectedEventCaptor.capture()); final ExpressionEditorSelectedEvent event = expressionEditorSelectedEventCaptor.getValue(); assertThat(event.getEditor()).isPresent(); assertThat(mockParentGrid).isSameAs(event.getEditor().get()); }</code><technical_language>I grid.select(); this place cover more reported problem</technical_language>

Target:
public void testFireExpressionEditorSelectedEventSelectsParentGridWidget() { final GridData mockParentUiModel = mock(GridData.class); final BaseExpressionGrid mockParentGrid = mock(BaseExpressionGrid.class); doReturn(mockParentUiModel).when(parent).getGridData(); doReturn(mockParentUiModel).when(mockParentGrid).getModel(); doReturn(new HashSet<GridWidget>() {{ add(mockParentGrid); add(grid); }}).when(gridLayer).getGridWidgets(); grid.select(); verify(editorSelectedEvent).fire(expressionEditorSelectedEventCaptor.capture()); final ExpressionEditorSelectedEvent event = expressionEditorSelectedEventCaptor.getValue(); assertThat(event.getEditor()).isPresent(); assertThat(mockParentGrid).isSameAs(event.getEditor().get()); }
Source:
<code>public static Slice myanmarFontEncoding(@SqlType(StandardTypes.VARCHAR) Slice slice) { <START> if (detector.getZawgyiProbability(slice.toStringUtf8()) > 0.9) { <END> return utf8Slice("zawgyi"); } else { return utf8Slice("unicode"); } }</code><technical_language>Do want constant ZAWGYI_PROBABILITY_THRESHOLD well</technical_language>

Target:
public static Slice myanmarFontEncoding(@SqlType(StandardTypes.VARCHAR) Slice slice) { if (detector.getZawgyiProbability(slice.toStringUtf8()) > ZAWGYI_PROBABILITY_THRESHOLD) { return utf8Slice("zawgyi"); } else { return utf8Slice("unicode"); } }
Source:
<code>public IterableStream<PartitionEvent> receive(String partitionId, int maximumMessageCount, <START> Duration maximumWaitTime) { <END> Objects.requireNonNull(maximumWaitTime, "'maximumWaitTime' cannot be null."); if (maximumMessageCount < 1) { throw logger.logExceptionAsError( new IllegalArgumentException("'maximumMessageCount' cannot be less than 1.")); } else if (maximumWaitTime.isNegative() || maximumWaitTime.isZero()) { throw logger.logExceptionAsError( new IllegalArgumentException("'maximumWaitTime' cannot be zero or less.")); } final Flux<PartitionEvent> events = Flux.create(emitter -> { queueWork(partitionId, maximumMessageCount, maximumWaitTime, emitter); }); final Flux<PartitionEvent> map = events.collectList().map(x -> { logger.info("Number of events received: {}", x.size()); return Flux.fromIterable(x); }).block(); return new IterableStream<>(map); }</code><technical_language>NET ReadFromPartitionAsync. While I read, receiveFromPartition closer .NET is using</technical_language>

Target:
public IterableStream<PartitionEvent> receive(String partitionId, int maximumMessageCount, Duration maximumWaitTime) { Objects.requireNonNull(maximumWaitTime, "'maximumWaitTime' cannot be null."); if (maximumMessageCount < 1) { throw logger.logExceptionAsError( new IllegalArgumentException("'maximumMessageCount' cannot be less than 1.")); } else if (maximumWaitTime.isNegative() || maximumWaitTime.isZero()) { throw logger.logExceptionAsError( new IllegalArgumentException("'maximumWaitTime' cannot be zero or less.")); } final Flux<PartitionEvent> events = Flux.create(emitter -> { queueWork(partitionId, maximumMessageCount, maximumWaitTime, emitter); }); return new IterableStream<>(events); }
Source:
<code>public void testInsertConfigToDB() { String jdbcDriver = "com.mysql.jdbc.Driver"; String mysqlURL = "jdbc:mysql://gargamel.cs.illinois.edu/openeval_db"; String username = "oeroot"; <START> String password = "Fow,10#"; END> try { Connection conn = DriverManager.getConnection(mysqlURL, username, password); String sql = "SELECT COUNT(*) FROM configurations;"; PreparedStatement stmt = conn.prepareStatement(sql); ResultSet ret = stmt.executeQuery(); ret.first(); int countOfRecordsInitial = ret.getInt(1); FrontEndDBInterface f = new FrontEndDBInterface(); List<String> taskVariants = new ArrayList<>(); taskVariants.add("testTskVar"); f.insertConfigToDB("testDataset", "testTeamName", "testDescription", "testEvaluator", "testTaskType", taskVariants); sql = "SELECT COUNT(*) FROM configurations;"; stmt = conn.prepareStatement(sql); ret = stmt.executeQuery(); ret.first(); int countOfRecordsNew = ret.getInt(1); assertEquals(countOfRecordsInitial + 1, countOfRecordsNew); sql = "DELETE FROM configurations WHERE datasetName = 'testDataset'"; stmt = conn.prepareStatement(sql); stmt.executeUpdate(); conn.close(); } catch (SQLException e) { e.printStackTrace(); } }</code><technical_language>need do here, want read in parameters (username, password, etc) a properties file (rather hard-coding in multiple places in code)</technical_language>

Target:
public void testInsertConfigToDB() { String jdbcDriver = "com.mysql.jdbc.Driver"; String mysqlURL = "jdbc:mysql://gargamel.cs.illinois.edu/openeval_db"; String username = "oeroot"; String password = "Fow,10#"; try { Connection conn = DriverManager.getConnection(mysqlURL, username, password); String sql = "SELECT COUNT(*) FROM configurations;"; PreparedStatement stmt = conn.prepareStatement(sql); ResultSet ret = stmt.executeQuery(); ret.first(); int countOfRecordsInitial = ret.getInt(1); FrontEndDBInterface f = new FrontEndDBInterface(); List<String> taskVariants = new ArrayList<>(); taskVariants.add("testTskVar"); f.insertConfigToDB("testDataset", "testTeamName", "testDescription", "testEvaluator", "testTaskType", taskVariants); sql = "SELECT COUNT(*) FROM configurations;"; stmt = conn.prepareStatement(sql); ret = stmt.executeQuery(); ret.first(); int countOfRecordsNew = ret.getInt(1); assertEquals(countOfRecordsInitial + 1, countOfRecordsNew); sql = "DELETE FROM configurations WHERE datasetName = 'testDataset'"; stmt = conn.prepareStatement(sql); stmt.executeUpdate(); conn.close(); } catch (SQLException e) { if (e.getMessage().contains("The driver has not received any packets from the server.")) return; } }
Source:
<code>private void reloadPalette(PaletteManager paletteManager, Diagram gmfDiagram, boolean clean) { TransactionalEditingDomain editingDomain = dDiagramEditorImpl.getEditingDomain(); if (editingDomain != null && gmfDiagram != null && gmfDiagram.getElement() instanceof DDiagram <START> && SessionManager.INSTANCE.getSession(((DSemanticDecorator) gmfDiagram.getElement()).getTarget()) != null) { <END> TransactionImpl t = new TransactionImpl(editingDomain, false, Collections.EMPTY_MAP); try { t.start(); UpdateToolRecordingCommand updateToolRecordingCommand = new UpdateToolRecordingCommand(editingDomain, (DDiagram) gmfDiagram.getElement(), true); if (updateToolRecordingCommand.canExecute()) { updateToolRecordingCommand.execute(); } t.commit(); ToolManagement toolManagement = DiagramPlugin.getDefault().getToolManagement(gmfDiagram); if (toolManagement != null) { if (clean) { toolManagement.notifyToolChangeAfterVSMReload(); } else { toolManagement.notifyToolChange(); } } } catch (RollbackException | InterruptedException e) { DiagramPlugin.getDefault().getLog().log(new Status(IStatus.WARNING, DiagramPlugin.ID, Messages.DDiagramEditorImpl_updateToolFailure, e)); } } }</code><technical_language>I if this done line 115 116. globally do if session is found</technical_language>

Target:
private void reloadPalette(PaletteManager paletteManager, Diagram gmfDiagram, boolean clean) { TransactionalEditingDomain editingDomain = dDiagramEditorImpl.getEditingDomain(); if (editingDomain != null && gmfDiagram != null && gmfDiagram.getElement() instanceof DDiagram) { TransactionImpl t = new TransactionImpl(editingDomain, false, Collections.EMPTY_MAP); try { t.start(); UpdateToolRecordingCommand updateToolRecordingCommand = new UpdateToolRecordingCommand(editingDomain, (DDiagram) gmfDiagram.getElement(), true); if (updateToolRecordingCommand.canExecute()) { updateToolRecordingCommand.execute(); } t.commit(); ToolManagement toolManagement = DiagramPlugin.getDefault().getToolManagement(gmfDiagram); if (toolManagement != null) { if (clean) { toolManagement.notifyToolChangeAfterVSMReload(); } else { toolManagement.notifyToolChange(); } } } catch (RollbackException | InterruptedException e) { DiagramPlugin.getDefault().getLog().log(new Status(IStatus.WARNING, DiagramPlugin.ID, Messages.DDiagramEditorImpl_updateToolFailure, e)); } } }
Source:
<code>private void registerSessionManager() { Bundle bundle = FrameworkUtil.getBundle(AttributeSharingHashSessionIdManager.class); if (bundle == null) { LOGGER.error("Error initializing Session Manager"); } else { final BundleContext bundleContext = bundle.getBundleContext(); final SharingSessionInvalidator sm = new SharingSessionInvalidator(this); <START> final Hashtable<String, Object> props = new Hashtable<>(); <END> props.put(Constants.SERVICE_PID, sm.getClass().getName()); props.put(Constants.SERVICE_DESCRIPTION, "Sharing Session Invalidator"); props.put(Constants.SERVICE_VENDOR, "Codice Foundation"); props.put(Constants.SERVICE_RANKING, Integer.MIN_VALUE); bundleContext.registerService(HttpSessionInvalidator.class.getName(), sm, props); } }</code><technical_language>reason new hashmaptable clockard added</technical_language>

Target:
private void registerSessionManager() { Bundle bundle = FrameworkUtil.getBundle(AttributeSharingHashSessionIdManager.class); if (bundle == null) { LOGGER.error("Error initializing Session Manager"); return; } final BundleContext bundleContext = bundle.getBundleContext(); if (bundleContext == null) { LOGGER.error("Error initializing Session Manager"); return; } final SharingSessionInvalidator sm = new SharingSessionInvalidator(this); final Dictionary<String, Object> props = new DictionaryMap<>(); props.put(Constants.SERVICE_PID, sm.getClass().getName()); props.put(Constants.SERVICE_DESCRIPTION, "Sharing Session Invalidator"); props.put(Constants.SERVICE_VENDOR, "Codice Foundation"); props.put(Constants.SERVICE_RANKING, Integer.MIN_VALUE); bundleContext.registerService(HttpSessionInvalidator.class.getName(), sm, props); }
Source:
<code>protected RollCycle getRollCycle(String retentionDuration) { String rollingPeriod = retentionDuration.substring(retentionDuration.length() - 1); RollCycle rollCycle; switch (rollingPeriod) { case SECOND_ROLLING_PERIOD: rollCycle = RollCycles.TEST_SECONDLY; break; <START> case MINUTE_ROLLING_PERIOD: <END> rollCycle = RollCycles.MINUTELY; break; case HOUR_ROLLING_PERIOD: rollCycle = RollCycles.HOURLY; break; case DAY_ROLLING_PERIOD: rollCycle = RollCycles.DAILY; break; default: String msg = "Unknown rolling period: " + rollingPeriod + " for Log: " + name(); log.error(msg); throw new IllegalArgumentException(msg); } return rollCycle; }</code><technical_language>this static</technical_language>

Target:
protected RollCycle getRollCycle(String retentionDuration) { String rollingPeriod = retentionDuration.substring(retentionDuration.length() - 1); switch (rollingPeriod) { case SECOND_ROLLING_PERIOD: return RollCycles.TEST_SECONDLY; case MINUTE_ROLLING_PERIOD: return RollCycles.MINUTELY; case HOUR_ROLLING_PERIOD: return RollCycles.HOURLY; case DAY_ROLLING_PERIOD: return RollCycles.DAILY; default: String msg = "Unknown rolling period: " + rollingPeriod + " for Log: " + name(); log.error(msg); throw new IllegalArgumentException(msg); } }
Source:
<code>public List<Variant> create(String fileId, String studyId, String line) throws IllegalArgumentException, NonVariantException, IncompleteInformationException { String[] fields = line.split("\t"); if (fields.length < 8) { throw new IllegalArgumentException("Not enough fields provided (min 8)"); } String[] alternateAlleles = getAlternateAlleles(fields); <START> List<VariantCoreFields> generatedKeyFields = buildVariantCoreFields(fields, alternateAlleles); <END> float quality = getQuality(fields); String filter = getFilter(fields); String info = getInfo(fields); String format = getFormat(fields); List<Variant> variants = new LinkedList<>(); for (int altAlleleIdx = 0; altAlleleIdx < alternateAlleles.length; altAlleleIdx++) { VariantCoreFields keyFields = generatedKeyFields.get(altAlleleIdx); Variant variant = new Variant(keyFields.getChromosome(), keyFields.getStart(), keyFields.getEnd(), keyFields.getReference(), keyFields.getAlternate()); String[] secondaryAlternates = getSecondaryAlternates(altAlleleIdx, alternateAlleles); VariantSourceEntry file = new VariantSourceEntry(fileId, studyId, secondaryAlternates, format); variant.addSourceEntry(file); parseSplitSampleData(file, fields, altAlleleIdx); setOtherFields(variant, fileId, studyId, quality, filter, info, altAlleleIdx, alternateAlleles, line); checkVariantInformation(variant, fileId, studyId); variants.add(variant); } return variants; }</code><technical_language>I find previous implementation more consistent. I understand alternates calculated buildVariantCoreFields, strange fields provided in ways</technical_language>

Target:
public List<Variant> create(String fileId, String studyId, String line) throws IllegalArgumentException, NonVariantException, IncompleteInformationException { String[] fields = line.split("\t"); if (fields.length < 8) { throw new IllegalArgumentException("Not enough fields provided (min 8)"); } String chromosome = getChromosomeWithoutPrefix(fields); int position = getPosition(fields); String reference = getReference(fields); String[] alternateAlleles = getAlternateAlleles(fields); float quality = getQuality(fields); String filter = getFilter(fields); String info = getInfo(fields); String format = getFormat(fields); List<VariantCoreFields> generatedKeyFields = buildVariantCoreFields(chromosome, position, reference, alternateAlleles); List<Variant> variants = new LinkedList<>(); for (int altAlleleIdx = 0; altAlleleIdx < alternateAlleles.length; altAlleleIdx++) { VariantCoreFields keyFields = generatedKeyFields.get(altAlleleIdx); Variant variant = new Variant(chromosome, keyFields.getStart(), keyFields.getEnd(), keyFields.getReference(), keyFields.getAlternate()); String[] secondaryAlternates = getSecondaryAlternates(altAlleleIdx, alternateAlleles); VariantSourceEntry file = new VariantSourceEntry(fileId, studyId, secondaryAlternates, format); variant.addSourceEntry(file); parseSplitSampleData(file, fields, altAlleleIdx); setOtherFields(variant, fileId, studyId, quality, filter, info, altAlleleIdx, alternateAlleles, line); checkVariantInformation(variant, fileId, studyId); variants.add(variant); } return variants; }
Source:
<code>public String getScript(String inMoovServiceName) { <START> return String.format((Locale)null,"%s.moveTorso(%.2f,%.2f,%.2f)\n", inMoovServiceName, topStom.getPos(), midStom.getPos(), lowStom.getPos()); <END> }</code><technical_language>incorrect</technical_language>

Target:
public String getScript(String inMoovServiceName) { return String.format(Locale.ENGLISH,"%s.moveTorso(%.2f,%.2f,%.2f)\n", inMoovServiceName, topStom.getPos(), midStom.getPos(), lowStom.getPos()); }
Source:
<code>public void execute(String[] args, ConsoleReader reader) throws Exception { String containerLongId = getContainerLongId(args[1]); if (containerLongId == null) { throw new CliException("Container " + args[1] + " not found"); } JSONObject response; try { response = getResource(StramWebServices.PATH_PHYSICAL_PLAN_CONTAINERS + "/" + args[1] + "/" + StramWebServices.PATH_STACKTRACE, currentApp); } catch (Exception ex) { <START> response = new JSONObject(ex.toString()); <END> } printJson(response); }</code><technical_language>This throw a CLIException</technical_language>

Target:
public void execute(String[] args, ConsoleReader reader) throws Exception { String containerLongId = getContainerLongId(args[1]); if (containerLongId == null) { throw new CliException("Container " + args[1] + " not found"); } JSONObject response; try { response = getResource(StramWebServices.PATH_PHYSICAL_PLAN_CONTAINERS + "/" + args[1] + "/" + StramWebServices.PATH_STACKTRACE, currentApp); } catch (Exception ex) { throw new CliException("Webservice call to AppMaster failed.", ex); } printJson(response); }
Source:
<code>byte lookAhead() throws IOException { if(head == READ_NEXT) { if(ensure(1)) <START> head = buffer.getByte(position); <END> } return head; }</code><technical_language>need advance position, right?: java byte lookAhead() throws IOException { if(head == READ_NEXT) { if(ensure(1)) { head = buffer.getByte(position); position++; } } return head; } consume, skipValueWithSwitch need call consume() lookAhead(). unpackNil, unpackBoolean, needs reset head calling consume(). unpackByte call lookAhead() consume(), etc..</technical_language>

Target:
byte lookAhead() throws IOException { if(head == READ_NEXT) { if(ensure(1)) head = buffer.getByte(position); else throw new EOFException(); } return head; }
Source:
<code><START> public Long getDbGeneration() { <END> return vmStatic.getDbGeneration(); }</code><technical_language>question</technical_language>

Target:
public long getDbGeneration() { return vmStatic.getDbGeneration(); }
Source:
<code>boolean isModified() { <START> return modified; <END> }</code><technical_language>Needs readLock</technical_language>

Target:
boolean isModified() { readLock.lock(); try { return modified; } finally { readLock.unlock(); } }
Source:
<code>public static void combine(@AggregationState NullableDoubleState state, @AggregationState NullableDoubleState otherState) { if (state.isNull()) { state.setNull(false); state.setDouble(otherState.getDouble()); } <START> else { <END> state.setDouble(state.getDouble() + otherState.getDouble()); } }</code><technical_language>Is a performance difference this original code</technical_language>

Target:
public static void combine(@AggregationState NullableDoubleState state, @AggregationState NullableDoubleState otherState) { if (state.isNull()) { state.setNull(false); state.setDouble(otherState.getDouble()); return; } state.setDouble(state.getDouble() + otherState.getDouble()); }
Source:
<code>void setText (String dateTimeText) { if (dateTimeText != null){ byte dateTimeConverted = Converter.wcsToMbcs (dateTimeText, true); GTK.gtk_entry_set_width_chars (textEntryHandle, dateTimeText.length ()); GTK.gtk_entry_set_text (textEntryHandle, dateTimeConverted); if (popupCalendar != null && calendar != null) { try { Date parse = dateFormat.parse(dateTimeText); Calendar clone = (Calendar) calendar.clone(); clone.setTime(parse); popupCalendar.setDate (clone.get(Calendar.YEAR), clone.get(Calendar.MONTH), clone.get(Calendar.DAY_OF_MONTH)); <START> } catch(Exception e) { <END> } } } }</code><technical_language>Do catch Exception this catch RuntimeException SWTException propagate proper. Please catch ignore ParseException</technical_language>

Target:
void setText (String dateTimeText) { if (dateTimeText != null){ byte dateTimeConverted = Converter.wcsToMbcs (dateTimeText, true); GTK.gtk_entry_set_width_chars (textEntryHandle, dateTimeText.length ()); GTK.gtk_entry_set_text (textEntryHandle, dateTimeConverted); if (popupCalendar != null && calendar != null) { Date parse; try { parse = dateFormat.parse(dateTimeText); } catch(ParseException e) { return; } Calendar clone = (Calendar) calendar.clone(); clone.setTime(parse); try { popupCalendar.setDate (clone.get(Calendar.YEAR), clone.get(Calendar.MONTH), clone.get(Calendar.DAY_OF_MONTH)); } catch(SWTException e) { if (e.code == SWT.ERROR_WIDGET_DISPOSED) { return; } throw e; } } } }
Source:
<code>private ReadBuffer(ByteBuffer byteBuffer, int limit) { this.byteBuffer = byteBuffer; <START> this.origin = byteBuffer.position(); <END> this.limit = origin + limit; if (this.limit > byteBuffer.capacity()) { throw new LimitReachedException(); } }</code><technical_language>Do need worry ByteBuffer a limit</technical_language>

Target:
private ReadBuffer(ByteBuffer byteBuffer, int limit) { this.byteBuffer = byteBuffer; this.limit = byteBuffer.position() + limit; if (this.limit > byteBuffer.capacity()) { throw new LimitReachedException(); } }
Source:
<code>public @NonNull Iterable<@NonNull ISegmentAspect> getSegmentAspects() { <START> ImmutableList<@NonNull ISegmentAspect> of = ImmutableList.of(new HelloAspect()); <END> assertNotNull(of); return of; }</code><technical_language>variable name is that</technical_language>

Target:
public @NonNull Iterable<@NonNull ISegmentAspect> getSegmentAspects() { ImmutableList<@NonNull ISegmentAspect> aspectList = ImmutableList.of(new HelloAspect()); assertNotNull(aspectList); return aspectList; }
Source:
<code>private void handleFinalizingSuccess(final StateContext context) { log.info("Finalizing successful transfer for {}", getTransferDescription()); ImageStatus <START> nextImageStatus; <END> if (stopImageTransferSession(context.entity)) { Guid transferingVdsId = context.entity.getVdsId(); if (getParameters().getTransferType() == TransferType.Download) { nextImageStatus = ImageStatus.OK; updateEntityPhase(ImageTransferPhase.FINISHED_SUCCESS); setAuditLogTypeFromPhase(ImageTransferPhase.FINISHED_SUCCESS); } else if (verifyImage(transferingVdsId)) { setVolumeLegalityInStorage(LEGAL_IMAGE); if (getDiskImage().getVolumeFormat().equals(VolumeFormat.COW)) { setQcowCompat(getDiskImage().getImage(), getStoragePool().getId(), getDiskImage().getId(), getDiskImage().getImageId(), getStorageDomainId(), transferingVdsId); imageDao.update(getDiskImage().getImage()); } nextImageStatus = ImageStatus.OK; updateEntityPhase(ImageTransferPhase.FINISHED_SUCCESS); setAuditLogTypeFromPhase(ImageTransferPhase.FINISHED_SUCCESS); } else { nextImageStatus = ImageStatus.ILLEGAL; updateEntityPhase(ImageTransferPhase.FINALIZING_FAILURE); } tearDownImage(context.entity.getVdsId()); setImageStatus(nextImageStatus); } }</code><technical_language>Suggestion: set OK default</technical_language>

Target:
private void handleFinalizingSuccess(final StateContext context) { log.info("Finalizing successful transfer for {}", getTransferDescription()); ImageStatus nextImageStatus = ImageStatus.OK; if (stopImageTransferSession(context.entity)) { Guid transferingVdsId = context.entity.getVdsId(); if (getParameters().getTransferType() == TransferType.Download) { updateEntityPhase(ImageTransferPhase.FINISHED_SUCCESS); setAuditLogTypeFromPhase(ImageTransferPhase.FINISHED_SUCCESS); } else if (verifyImage(transferingVdsId)) { setVolumeLegalityInStorage(LEGAL_IMAGE); if (getDiskImage().getVolumeFormat().equals(VolumeFormat.COW)) { setQcowCompat(getDiskImage().getImage(), getStoragePool().getId(), getDiskImage().getId(), getDiskImage().getImageId(), getStorageDomainId(), transferingVdsId); imageDao.update(getDiskImage().getImage()); } updateEntityPhase(ImageTransferPhase.FINISHED_SUCCESS); setAuditLogTypeFromPhase(ImageTransferPhase.FINISHED_SUCCESS); } else { nextImageStatus = ImageStatus.ILLEGAL; updateEntityPhase(ImageTransferPhase.FINALIZING_FAILURE); } tearDownImage(context.entity.getVdsId()); setImageStatus(nextImageStatus); } }