auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean equals(Node graph, Node pattern) { if(graph!=null&& pattern!=null){ if (! (graph instanceof Relation) && ! (pattern instanceof Relation)) { if(pattern.getConcept() == null && pattern.getType() == null) { graph.setId(pattern.getId()); return true; } if (graph.getConcept()!=null && pattern.getConcept() != null) { boolean isFound = false; if (!graph.getConcept().equals(pattern.getConcept())) { <START> if(graph.getAlternativeIds() != null) { <END> for(String alternateId : graph.getAlternativeIds()) { if(alternateId.equals(pattern.getConcept())) { isFound = true; break; } } } if(!isFound) { return false; } } graph.setId(pattern.getId()); return true; } else if (graph.getType()!=null && pattern.getType() != null) { if (!graph.getType().equals(pattern.getType())) return false; graph.setId(pattern.getId()); return true; } } if (graph instanceof Relation && pattern instanceof Relation) { if (!equals(((Relation)graph).getSubject(), ((Relation)pattern).getSubject())) return false; if (!equals(((Relation)graph).getPredicate(), ((Relation)pattern).getPredicate())) return false; if (!equals(((Relation)graph).getObject(), ((Relation)pattern).getObject())) return false; graph.setId(null); return true; } } return false; }</code><technical_language>alternative ids ids (including main one)? If so, remove line 82 alternative ids</technical_language>

Target:
public boolean equals(Node graph, Node pattern) { if(graph!=null&& pattern!=null){ if (! (graph instanceof Relation) && ! (pattern instanceof Relation)) { if(pattern.getConcept() == null && pattern.getType() == null) { graph.setId(pattern.getId()); return true; } if (pattern.getConcept() != null && graph.getAlternativeIds() != null) { if (graph.getAlternativeIds().contains(pattern.getConcept())) { graph.setId(pattern.getId()); return true; } return false; } else if (graph.getType()!=null && pattern.getType() != null) { if (!graph.getType().equals(pattern.getType())) return false; graph.setId(pattern.getId()); return true; } } if (graph instanceof Relation && pattern instanceof Relation) { if (!equals(((Relation)graph).getSubject(), ((Relation)pattern).getSubject())) return false; if (!equals(((Relation)graph).getPredicate(), ((Relation)pattern).getPredicate())) return false; if (!equals(((Relation)graph).getObject(), ((Relation)pattern).getObject())) return false; graph.setId(null); return true; } } return false; }
Source:
<code>public void initialize(Server server, Injector injector) { final ServletContextHandler root = new ServletContextHandler(ServletContextHandler.SESSIONS); ServletHolder holderPwd = new ServletHolder("default", DefaultServlet.class); root.addServlet(holderPwd, "/"); root.setBaseResource( new ResourceCollection( new String[]{ TaskMaster.class.getClassLoader().getResource("static").toExternalForm(), TaskMaster.class.getClassLoader().getResource("indexer_static").toExternalForm() } ) ); JettyServerInitUtils.addExtensionFilters(root, injector); root.addFilter(JettyServerInitUtils.defaultGzipFilterHolder(), "/*", null); root.addFilter(GuiceFilter.class, "/status/*", null); root.addFilter(new FilterHolder(injector.getInstance(RedirectFilter.class)), "/*", null); root.addFilter(GuiceFilter.class, "/druid/*", null); HandlerList handlerList = new HandlerList(); <START> if(serverConfig.getEnableHttpRequestLogging()) { <END> handlerList.setHandlers(new Handler[]{JettyServerInitUtils.getJettyRequestLogHandler(), root}); } else { handlerList.setHandlers(new Handler[]{root}); } server.setHandler(handlerList); }</code><technical_language>formatting</technical_language>

Target:
public void initialize(Server server, Injector injector) { final ServletContextHandler root = new ServletContextHandler(ServletContextHandler.SESSIONS); ServletHolder holderPwd = new ServletHolder("default", DefaultServlet.class); root.addServlet(holderPwd, "/"); root.setBaseResource( new ResourceCollection( new String[]{ TaskMaster.class.getClassLoader().getResource("static").toExternalForm(), TaskMaster.class.getClassLoader().getResource("indexer_static").toExternalForm() } ) ); JettyServerInitUtils.addExtensionFilters(root, injector); root.addFilter(JettyServerInitUtils.defaultGzipFilterHolder(), "/*", null); root.addFilter(GuiceFilter.class, "/status/*", null); root.addFilter(new FilterHolder(injector.getInstance(RedirectFilter.class)), "/*", null); root.addFilter(GuiceFilter.class, "/druid/*", null); HandlerList handlerList = new HandlerList(); handlerList.setHandlers(new Handler[]{JettyServerInitUtils.getJettyRequestLogHandler(), root}); server.setHandler(handlerList); }
Source:
<code>public final void initialize(final URL location, final ResourceBundle resources) { NotificationFactory notFact = new NotificationFactory(); forceRepaintPosition = false; listen(Message.OPENED, (controller, args) -> { assert controller instanceof MenuController; assert args[0] instanceof File && args[1] instanceof File; try { loadGraph((File) args[0], (File) args[1]); } catch (IOException exception) { shout(NotificationController.NOTIFY, notFact .getNotification(exception)); } }); listen(Message.FILTERED, (controller, args) -> { assert args.length == 1; <START> if (!(args[0] instanceof Set<?>)) { <END> throw new IllegalArgumentException( "Argument not of type Set<Sequence>"); } model.setVisible((Set<Sequence>) args[0]); forceRepaintPosition = true; repaint(); }); }</code><technical_language>This assert</technical_language>

Target:
public final void initialize(final URL location, final ResourceBundle resources) { NotificationFactory notFact = new NotificationFactory(); forceRepaintPosition = false; listen(Message.OPENED, (controller, args) -> { assert controller instanceof MenuController; assert args[0] instanceof File && args[1] instanceof File; try { loadGraph((File) args[0], (File) args[1]); } catch (IOException exception) { shout(NotificationController.NOTIFY, notFact .getNotification(exception)); } }); listen(Message.FILTERED, (controller, args) -> { assert args.length == 1; assert args[0] instanceof Set<?>; model.setVisible((Set<Sequence>) args[0]); forceRepaintPosition = true; repaint(); }); }
Source:
<code>void complete(BitmapHunter hunter) { List<Request> joined = hunter.getRequests(); Uri uri = hunter.getUri(); Exception exception = hunter.getException(); Bitmap result = hunter.getResult(); LoadedFrom from = hunter.getLoadedFrom(); <START> if (!joined.isEmpty()) { <END> for (Request join : joined) { if (!join.isCancelled()) { targetToRequest.remove(join.getTarget()); if (result != null) { join.complete(result, from); } else { join.error(); if (listener != null && exception != null) { listener.onImageLoadFailed(this, uri, exception); } } } } } }</code><technical_language>java if (joined.isEmpty()) { return; }</technical_language>

Target:
void complete(BitmapHunter hunter) { List<Request> joined = hunter.getRequests(); if (joined.isEmpty()) { return; } Uri uri = hunter.getUri(); Exception exception = hunter.getException(); Bitmap result = hunter.getResult(); LoadedFrom from = hunter.getLoadedFrom(); for (Request join : joined) { if (join.isCancelled()) { continue; } targetToRequest.remove(join.getTarget()); if (result != null) { join.complete(result, from); } else { join.error(); } } if (listener != null && exception != null) { listener.onImageLoadFailed(this, uri, exception); } }
Source:
<code>private void deleteVariable(final DmsProject project, final int termId) { if (project.getProperties() != null) { final List<ProjectProperty> deletedProjectProperties = new ArrayList<>(); for (final ProjectProperty property : project.getProperties()) { if (property.getVariableId().equals(termId)) { this.saver.getProjectPropertyDao().makeTransient(property); <START> deletedProjectProperties.add(property); <END> } } project.getProperties().removeAll(deletedProjectProperties); } }</code><technical_language>Question, 2 project properties variable id? do type_id too</technical_language>

Target:
public void deleteVariable(final DmsProject project, final int termId) { if (project.getProperties() != null) { final List<ProjectProperty> deletedProjectProperties = new ArrayList<>(); for (final ProjectProperty property : project.getProperties()) { if (property.getVariableId().equals(termId)) { this.saver.getProjectPropertyDao().makeTransient(property); deletedProjectProperties.add(property); } } project.getProperties().removeAll(deletedProjectProperties); } }
Source:
<code>public void testRecoverJobGraph() throws Exception { final RetrievableStateHandle<JobGraph> stateHandle = jobGraphStorageHelper.store(testingJobGraph); final TestingStateHandleStore<JobGraph> stateHandleStore = builder .setGetFunction(ignore -> stateHandle) .build(); final JobGraphStore jobGraphStore = createAndStartJobGraphStore(stateHandleStore); final JobGraph recoveredJobGraph = jobGraphStore.recoverJobGraph(testingJobGraph.getJobID()); assertThat(recoveredJobGraph, is(notNullValue())); assertThat(recoveredJobGraph.getJobID(), is(testingJobGraph.getJobID())); jobGraphStore.stop(); <START> } <END></code><technical_language>do need stop jobGraphStore in this test</technical_language>

Target:
public void testRecoverJobGraph() throws Exception { final RetrievableStateHandle<JobGraph> stateHandle = jobGraphStorageHelper.store(testingJobGraph); final TestingStateHandleStore<JobGraph> stateHandleStore = builder .setGetFunction(ignore -> stateHandle) .build(); final JobGraphStore jobGraphStore = createAndStartJobGraphStore(stateHandleStore); final JobGraph recoveredJobGraph = jobGraphStore.recoverJobGraph(testingJobGraph.getJobID()); assertThat(recoveredJobGraph, is(notNullValue())); assertThat(recoveredJobGraph.getJobID(), is(testingJobGraph.getJobID())); }
Source:
<code>public Exercise call() throws Exception { logger.info("Checking adaptive exercises availability"); Exercise exercise = tmcServerCommunicationTaskFactory.getAdaptiveExercise().call(); if (exercise == null) { return null; } exercise.setName("AdaLovelace"); exercise.setCourseName("None"); byte[] zipb = tmcServerCommunicationTaskFactory.getDownloadingExerciseZipTask(exercise).call(); System.out.println(zipb.length); <START> Progress progress = new Progress(3); <END> extractProject(zipb, exercise, progress); return exercise; }</code><technical_language>3</technical_language>

Target:
public Exercise call() throws Exception { logger.info("Checking adaptive exercises availability"); Exercise exercise = tmcServerCommunicationTaskFactory.getAdaptiveExercise().call(); if (exercise == null) { return null; } exercise.setName("AdaLovelace"); exercise.setCourseName("None"); byte[] zipb = tmcServerCommunicationTaskFactory.getDownloadingExerciseZipTask(exercise).call(); Progress progress = new Progress(3); extractProject(zipb, exercise, progress); return exercise; }
Source:
<code>void close( FileMeta metadata, LocalLockOwner owner ) throws IOException { TransactionManager transactionManager = metadataCache.getAdvancedCache().getTransactionManager(); try { lockManager.reentrantSynchronous( metadata.getFilePath(), ( opLock ) -> { if ( owner == null || owner.getContextLockCount() == 0 ) { metadata.removeLock( this.nodeKey ); transactionManager.begin(); metadataCache.put( metadata.getFilePath(), metadata ); transactionManager.commit(); } else { LockLevel nodeLevel = metadata.getLockLevel( this.nodeKey ); <START> <END> } return null; } ); } catch ( InterruptedException e ) { throw new IOException( "Thread interrupted while closing file: " + metadata.getFilePath(), e ); } }</code><technical_language>Here, I active lock level, need check lock level is in FileMeta, set / put() if so. If level changed, want do extra cache.put() call. Also, ownership change happen LocalLockOwner.unlock() is called, I is this close() method called. need process node-level lock update in updateDominantLocks() method instead of here</technical_language>

Target:
void close( FileMeta metadata, LocalLockOwner owner ) throws IOException { }
Source:
<code>public void updateParentCommits(IRepository parent, IReview review, ChangeDetailX detail) { Map<Integer, CommitInfo[]> parents = detail.getParents(); List<IReviewItemSet> sets = review.getSets(); <START> for (Entry<Integer, CommitInfo[]> parentCommit : parents.entrySet()) { <END> CommitInfo[] commits = parentCommit.getValue(); List<String> commitIds = new ArrayList<String>(); for (CommitInfo commit : commits) { commitIds.add(commit.getCommit()); } ((ReviewItemSet) sets.get(parentCommit.getKey() - 1)).setParentCommits(commitIds); } }</code><technical_language>sense. need test of course. require more Git manipulation</technical_language>

Target:
public void updateParentCommits(IRepository parent, IReview review, ChangeDetailX detail) { Map<Integer, CommitInfo[]> parents = detail.getParents(); if (parents == null) { return; } List<IReviewItemSet> sets = review.getSets(); for (Entry<Integer, CommitInfo[]> parentCommit : parents.entrySet()) { IReviewItemSet reviewItemSet = sets.get(parentCommit.getKey() - 1); for (CommitInfo gerritCommit : parentCommit.getValue()) { ICommit commit = IReviewsFactory.INSTANCE.createCommit(); commit.setId(gerritCommit.getCommit()); IUser commitAuthor = IReviewsFactory.INSTANCE.createUser(); GitPersonalInfo author = gerritCommit.getAuthor(); if (author != null) { commitAuthor.setId(author.getName()); commitAuthor.setDisplayName(author.getName()); commitAuthor.setEmail(author.getEmail()); commit.setAuthor(commitAuthor); } commit.setSubject(gerritCommit.getSubject()); commit.setMessage(gerritCommit.getMessage()); commit.setId(gerritCommit.getCommit()); reviewItemSet.getParentCommits().add(commit); } } }
Source:
<code>public OkClient(OkHttpClient client) { <START> if (client == null) throw new NullPointerException("client"); <END> this.client = client; }</code><technical_language>topic: writing this "client == null". I this conveys information in characters, Shipley's law I switch over. drawback is "client == null" is a boolean expression, is consistent "limit < 0" etc. .</technical_language>

Target:
public OkClient(OkHttpClient client) { if (client == null) throw new NullPointerException("client == null"); this.client = client; }
Source:
<code>protected void updateParametersVmFromInstanceType() { InstanceType instanceType = getInstanceType(); VmStatic vmStatic = getParameters().getVmStaticData(); if (instanceType != null) { vmStatic.setMemSizeMb(instanceType.getMemSizeMb()); vmStatic.setNumOfSockets(instanceType.getNumOfSockets()); vmStatic.setCpuPerSocket(instanceType.getCpuPerSocket()); vmStatic.setThreadsPerCpu(instanceType.getThreadsPerCpu()); vmStatic.setAutoStartup(instanceType.isAutoStartup()); if (FeatureSupported.isMigrationSupported(getCluster().getArchitecture(), getEffectiveCompatibilityVersion())) { vmStatic.setMigrationSupport(instanceType.getMigrationSupport()); } vmStatic.setNumOfIoThreads(instanceType.getNumOfIoThreads()); vmStatic.setMigrationDowntime(instanceType.getMigrationDowntime()); vmStatic.setPriority(instanceType.getPriority()); vmStatic.setTunnelMigration(instanceType.getTunnelMigration()); <START> List<VmDevice> vmDevices = vmDeviceUtils.getMemoryBalloons(instanceType.getId()); <END> vmStatic.setMinAllocatedMem(instanceType.getMinAllocatedMem()); if (vmDevices.isEmpty()) { getParameters().setBalloonEnabled(false); } else if (osRepository.isBalloonEnabled(getParameters().getVmStaticData().getOsId(), getEffectiveCompatibilityVersion())) { getParameters().setBalloonEnabled(true); } vmStatic.setMigrationPolicyId(instanceType.getMigrationPolicyId()); } }</code><technical_language>Suggestion: Consider getVmDeviceUtils() added it</technical_language>

Target:
protected void updateParametersVmFromInstanceType() { InstanceType instanceType = getInstanceType(); VmStatic vmStatic = getParameters().getVmStaticData(); if (instanceType != null) { vmStatic.setMemSizeMb(instanceType.getMemSizeMb()); vmStatic.setNumOfSockets(instanceType.getNumOfSockets()); vmStatic.setCpuPerSocket(instanceType.getCpuPerSocket()); vmStatic.setThreadsPerCpu(instanceType.getThreadsPerCpu()); vmStatic.setAutoStartup(instanceType.isAutoStartup()); if (FeatureSupported.isMigrationSupported(getCluster().getArchitecture(), getEffectiveCompatibilityVersion())) { vmStatic.setMigrationSupport(instanceType.getMigrationSupport()); } vmStatic.setNumOfIoThreads(instanceType.getNumOfIoThreads()); vmStatic.setMigrationDowntime(instanceType.getMigrationDowntime()); vmStatic.setPriority(instanceType.getPriority()); vmStatic.setTunnelMigration(instanceType.getTunnelMigration()); List<VmDevice> vmDevices = getVmDeviceUtils().getMemoryBalloons(instanceType.getId()); vmStatic.setMinAllocatedMem(instanceType.getMinAllocatedMem()); if (vmDevices.isEmpty()) { getParameters().setBalloonEnabled(false); } else if (osRepository.isBalloonEnabled(getParameters().getVmStaticData().getOsId(), getEffectiveCompatibilityVersion())) { getParameters().setBalloonEnabled(true); } vmStatic.setMigrationPolicyId(instanceType.getMigrationPolicyId()); } }
Source:
<code>public void snapshot(SnapshotWriter writer) { if (mClosed) { return; } LOG.debug("Calling snapshot"); Preconditions.checkState(!mSnapshotting, "Cannot call snapshot multiple times concurrently"); mSnapshotting = true; mLastSnapshotStartTime = System.currentTimeMillis(); long snapshotId = mNextSequenceNumberToRead - 1; try (SnapshotWriterStream sws = new SnapshotWriterStream(writer)) { writer.writeLong(snapshotId); JournalUtils.writeToCheckpoint(sws, getStateMachines()); } catch (Exception e) { <START> ProcessUtils.fatalError(LOG, e, "Failed to snapshot"); <END> throw new RuntimeException(e); } LOG.info("Completed snapshot up to SN in {}ms", snapshotId, System.currentTimeMillis() - mLastSnapshotStartTime); mSnapshotting = false; }</code><technical_language>include snapshotId in message</technical_language>

Target:
public void snapshot(SnapshotWriter writer) { if (mClosed) { return; } LOG.debug("Calling snapshot"); Preconditions.checkState(!mSnapshotting, "Cannot call snapshot multiple times concurrently"); mSnapshotting = true; mLastSnapshotStartTime = System.currentTimeMillis(); long snapshotId = mNextSequenceNumberToRead - 1; try (SnapshotWriterStream sws = new SnapshotWriterStream(writer)) { writer.writeLong(snapshotId); JournalUtils.writeToCheckpoint(sws, getStateMachines()); } catch (Exception e) { ProcessUtils.fatalError(LOG, e, "Failed to take snapshot: %s", snapshotId); throw new RuntimeException(e); } LOG.info("Completed snapshot up to SN in {}ms", snapshotId, System.currentTimeMillis() - mLastSnapshotStartTime); mSnapshotting = false; }
Source:
<code>private void handlePaused(final StateContext context) { periodicPauseLog(context.entity, context.iterationTimestamp); if (context.entity.getImagedTicketId() != null && getParameters().isRetryOperation()) { boolean stopSucceeded = stopImageTransferSession(context.entity); if (!stopSucceeded) { log.warn("Failed to remove transfer ticket for {}", getTransferDescription()); <START> if (getParameters().isRetryOperation()) { getParameters().setRetryOperation(false); } else { getParameters().setRetryOperation(true); } <END> } } }</code><technical_language>This if is true else is a dead code get if getParameters().isRetryOperation(). be: if (context.entity.getImagedTicketId() != null) { if (getParameters().isRetryOperation()) { boolean stopSucceeded = stopImageTransferSession(context.entity); if (!stopSucceeded) { log.warn("Failed remove transfer ticket for {}", getTransferDescription()); getParameters().setRetryOperation(false); } } else { getParameters().setRetryOperation(true); } } this implementation stopImageTransferSession() called in 20 seconds state change here. Is wanted do? right is set false set true else</technical_language>

Target:
private void handlePaused(final StateContext context) { periodicPauseLog(context.entity, context.iterationTimestamp); if (context.entity.getImagedTicketId() != null && getParameters().isRetryOperation()) { boolean stopSucceeded = stopImageTransferSession(context.entity); if (!stopSucceeded) { log.warn("Failed to remove transfer ticket for {}", getTransferDescription()); if (getParameters().isRetryOperation()) { getParameters().setRetryOperation(false); } } } }
Source:
<code>public void testProfileGenericDataResponse() { com.alliander.osgp.domain.core.valueobjects.smartmetering.ProfileGenericDataResponse voResponse = this .makeresponseVo(); ProfileGenericDataResponse wsResponse = this.monitoringMapper.map(voResponse, ProfileGenericDataResponse.class); <START> Assert.assertTrue(wsResponse != null && wsResponse instanceof ProfileGenericDataResponse); <END> Assert.assertTrue(wsResponse.getCaptureObjects().getCaptureObject().size() > 0); Assert.assertTrue(wsResponse.getProfileEntries().getProfileEntry().size() > 0); Assert.assertTrue(wsResponse.getProfileEntries().getProfileEntry().get(0).getProfileEntryValue() != null); Assert.assertTrue(!wsResponse.getProfileEntries().getProfileEntry().get(0).getProfileEntryValue().isEmpty()); Assert.assertTrue(wsResponse.getProfileEntries().getProfileEntry().get(0).getProfileEntryValue().size() == 4); int i = 0; for (ProfileEntryValue profileEntryValue : wsResponse.getProfileEntries().getProfileEntry().get(0) .getProfileEntryValue()) { Assert.assertTrue(profileEntryValue.getStringValueOrDateValueOrFloatValue() != null && !profileEntryValue.getStringValueOrDateValueOrFloatValue().isEmpty()); Assert.assertTrue(EXPECTED_CLASS[i++].equals(profileEntryValue.getStringValueOrDateValueOrFloatValue() .get(0).getClass())); } }</code><technical_language>use: import static org.hamcrest.CoreMatchers.instanceOf; ... assertNotNull(result); assertThat(result, instanceOf(ClassName.class));</technical_language>

Target:
public void testProfileGenericDataResponse() { com.alliander.osgp.domain.core.valueobjects.smartmetering.ProfileGenericDataResponse source = this .makeresponseVo(); ProfileGenericDataResponse target = this.monitoringMapper.map(source, ProfileGenericDataResponse.class); assertNotNull("mapping ProfileGenericDataResponse should not return null", target); assertEquals(target.getCaptureObjects().getCaptureObject().size(), 1); assertEquals(target.getProfileEntries().getProfileEntry().size(), 2); assertNotNull(target.getProfileEntries().getProfileEntry().get(0).getProfileEntryValue()); assertEquals(target.getProfileEntries().getProfileEntry().get(0).getProfileEntryValue().size(), 4); int i = 0; for (ProfileEntryValue profileEntryValue : target.getProfileEntries().getProfileEntry().get(0) .getProfileEntryValue()) { assertNotNull(profileEntryValue.getStringValueOrDateValueOrFloatValue()); assertEquals(profileEntryValue.getStringValueOrDateValueOrFloatValue().size(), 1); assertEquals(profileEntryValue.getStringValueOrDateValueOrFloatValue().get(0).getClass(), EXPECTED_CLASS[i++]); assertTrue(profileEntryValue.getStringValueOrDateValueOrFloatValue() != null && !profileEntryValue.getStringValueOrDateValueOrFloatValue().isEmpty()); } }
Source:
<code>public void run() { try { processingLoop(segment); } catch (Throwable e) { logger.error("Processing loop ended due to uncaught exception. Processor pausing.", e); state.set(State.PAUSED_ERROR); } finally { releaseSegment(segment.getSegmentId()); if (activeSegments.size() == maxThreadCount - 1) { <START> new WorkerLauncher().run(); <END> } } }</code><technical_language>threadFactory for spawning this thread</technical_language>

Target:
public void run() { try { processingLoop(segment); } catch (Throwable e) { logger.error("Processing loop ended due to uncaught exception. Pausing processor in Error State.", e); state.set(State.PAUSED_ERROR); } finally { activeSegments.remove(segment.getSegmentId()); if (availableThreads.getAndIncrement() == 0 && getState().isRunning()) { logger.info("No Worker Launcher active. Using current thread to assign segments."); new WorkerLauncher().run(); } } }
Source:
<code>private void beforeFirstRefreshTreatment(boolean isVdsUpOrGoingToMaintenance) { if (vdsManager.getbeforeFirstRefresh()) { boolean flagsChanged = false; final AtomicBoolean processHardwareCapsNeededTemp = new AtomicBoolean(); <START> vdsManager.refreshCapabilities(null, processHardwareCapsNeededTemp, <END> vds); flagsChanged = processHardwareCapsNeededTemp.get(); vdsManager.setbeforeFirstRefresh(false); refreshedCapabilities = true; saveVdsDynamic = true; processHardwareCapsNeeded = processHardwareCapsNeeded ? processHardwareCapsNeeded : flagsChanged; } else if (isVdsUpOrGoingToMaintenance || vds.getStatus() == VDSStatus.Error) { return; } if (vds.getStatus() != VDSStatus.Up) { AuditLogable logable = createAuditLogableForHost(); logable.addCustomValue("HostStatus", vds.getStatus().toString()); auditLog(logable, AuditLogType.VDS_DETECTED); } }</code><technical_language>nan</technical_language>

Target:
private void beforeFirstRefreshTreatment(boolean isVdsUpOrGoingToMaintenance) { if (vdsManager.getbeforeFirstRefresh()) { final AtomicBoolean processHardwareCapsNeededTemp = new AtomicBoolean(); vdsManager.refreshCapabilities(new BeforeFirstTreatmentCallback( vdsManager, vds, processHardwareCapsNeededTemp, isVdsUpOrGoingToMaintenance), processHardwareCapsNeededTemp, vds); } else if (isVdsUpOrGoingToMaintenance || vds.getStatus() == VDSStatus.Error) { return; } }
Source:
<code>public Object remove(Data key, CallerProvenance provenance) { checkIfLoaded(); long now = getNow(); Record record = getRecordOrNull(key, now, false); Object oldValue = null; if (record == null) { if (persistenceEnabledFor(provenance)) { <START> oldValue = mapDataStore.load(key); <END> if (oldValue != null) { mapDataStore.remove(key, now); } } } else { oldValue = removeRecord(key, record, now, provenance); } return oldValue; }</code><technical_language>return if persistance is disabled. Is this intentional</technical_language>

Target:
public Object remove(Data key, CallerProvenance provenance) { checkIfLoaded(); long now = getNow(); Record record = getRecordOrNull(key, now, false); Object oldValue; if (record == null) { oldValue = mapDataStore.load(key); if (oldValue != null && persistenceEnabledFor(provenance)) { mapDataStore.remove(key, now); } } else { oldValue = removeRecord(key, record, now, provenance); } return oldValue; }
Source:
<code>public void basicUsageOfSolverManagerWithOneProblem() throws InterruptedException { TestdataSolution problem = createTestProblem(tenantId); solverManager.solve(tenantId, problem, taskAssigningSolution -> solutionChangedLatch.countDown(), taskAssigningSolution -> solvingEndedLatch.countDown()); solutionChangedLatch.await(5, TimeUnit.SECONDS); <START> assertEquals(solverManager.getSolverStatus(tenantId), SolverStatus.SOLVING); <END> assertEquals(solverManager.getBestSolution(tenantId).getCode(), tenantId.toString()); assertTrue(solverManager.getBestScore(tenantId).isSolutionInitialized()); solverManager.stopSolver(tenantId); assertEquals(SolverStatus.TERMINATED_EARLY, solverManager.getSolverStatus(tenantId)); logger.info(String.valueOf(solvingEndedLatch.getCount())); }</code><technical_language>Wrong order of arguments. JUnit Assert assertEquals(expected, actual)</technical_language>

Target:
public void basicUsageOfSolverManagerWithOneProblem() throws InterruptedException { TestdataSolution problem = createTestProblem(tenantId); solverManager.solve(tenantId, problem, taskAssigningSolution -> solutionChangedLatch.countDown(), taskAssigningSolution -> solvingEndedLatch.countDown()); solutionChangedLatch.await(5, TimeUnit.SECONDS); assertTrue(solverManager.isProblemSubmitted(tenantId)); solverManager.terminateSolver(tenantId); solvingEndedLatch.await(5, TimeUnit.SECONDS); }
Source:
<code>private String jsonAMF(AMFDataObj dataObj) { if (dataObj == null) { logger.debug("data object is null"); <START> return null; <END> } String json = null; try { Map<String, Object> map = new HashMap<>(); addToMap(map, dataObj, OBJECT_TYPE_KEY); addToMap(map, dataObj, OFFSET_KEY); addToMap(map, dataObj, TIMESTAMP_KEY); addToMap(map, dataObj, ID_KEY); json = new ObjectMapper().writeValueAsString(map); } catch (JsonProcessingException e) { logger.debug("error occurred while parsing AMFData", e); } return json; }</code><technical_language>this happen? If throw exception instead of returning null</technical_language>

Target:
private String jsonAMF(AMFDataObj dataObj) throws JsonProcessingException { Map<String, Object> map = new HashMap<>(); addToMap(map, dataObj, OBJECT_TYPE_KEY); addToMap(map, dataObj, OFFSET_KEY); addToMap(map, dataObj, TIMESTAMP_KEY); addToMap(map, dataObj, ID_KEY); return new ObjectMapper().writeValueAsString(map); }
Source:
<code>public void writeLeaderInformation(LeaderInformation leaderInformation) { assert(running); if (LOG.isDebugEnabled()) { LOG.debug("Write leader information: {}.", leaderInformation); } <START> if (leaderInformation.equals(LeaderInformation.empty())) { <END> return; } try { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeUTF(leaderInformation.getLeaderAddress()); oos.writeObject(leaderInformation.getLeaderSessionID()); oos.close(); boolean dataWritten = false; while (!dataWritten && leaderLatch.hasLeadership()) { Stat stat = client.checkExists().forPath(leaderPath); if (stat != null) { long owner = stat.getEphemeralOwner(); long sessionID = client.getZookeeperClient().getZooKeeper().getSessionId(); if (owner == sessionID) { try { client.setData().forPath(leaderPath, baos.toByteArray()); dataWritten = true; } catch (KeeperException.NoNodeException noNode) { } } else { try { client.delete().forPath(leaderPath); } catch (KeeperException.NoNodeException noNode) { } } } else { try { client.create().creatingParentsIfNeeded().withMode(CreateMode.EPHEMERAL).forPath( leaderPath, baos.toByteArray()); dataWritten = true; } catch (KeeperException.NodeExistsException nodeExists) { } } } if (LOG.isDebugEnabled()) { LOG.debug("Successfully wrote leader information: {}.", leaderInformation); } } catch (Exception e) { fatalErrorHandler.onFatalError( new LeaderElectionException("Could not write leader address and leader session ID to " + "ZooKeeper.", e)); } }</code><technical_language>LeaderInformation.isEmpty()</technical_language>

Target:
public void writeLeaderInformation(LeaderInformation leaderInformation) { assert(running); if (LOG.isDebugEnabled()) { LOG.debug("Write leader information: {}.", leaderInformation); } if (leaderInformation.isEmpty()) { return; } try { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeUTF(leaderInformation.getLeaderAddress()); oos.writeObject(leaderInformation.getLeaderSessionID()); oos.close(); boolean dataWritten = false; while (!dataWritten && leaderLatch.hasLeadership()) { Stat stat = client.checkExists().forPath(leaderPath); if (stat != null) { long owner = stat.getEphemeralOwner(); long sessionID = client.getZookeeperClient().getZooKeeper().getSessionId(); if (owner == sessionID) { try { client.setData().forPath(leaderPath, baos.toByteArray()); dataWritten = true; } catch (KeeperException.NoNodeException noNode) { } } else { try { client.delete().forPath(leaderPath); } catch (KeeperException.NoNodeException noNode) { } } } else { try { client.create().creatingParentsIfNeeded().withMode(CreateMode.EPHEMERAL).forPath( leaderPath, baos.toByteArray()); dataWritten = true; } catch (KeeperException.NodeExistsException nodeExists) { } } } if (LOG.isDebugEnabled()) { LOG.debug("Successfully wrote leader information: {}.", leaderInformation); } } catch (Exception e) { fatalErrorHandler.onFatalError( new LeaderElectionException("Could not write leader address and leader session ID to " + "ZooKeeper.", e)); } }
Source:
<code>private StockOperation createOperation(StockOperation operation, InventoryStockTake delegate) { operation.setStatus(StockOperationStatus.NEW); <START> IStockOperationType operationType = WellKnownOperationTypes.getAdjustment(); <END> operation.setInstanceType(operationType); Stockroom stockroom; stockroom = delegate.getStockroom(); operation.setSource(stockroom); operation.setOperationNumber(delegate.getOperationNumber()); Date dNow = new Date(); operation.setOperationDate(dNow); operation.setItems(createOperationsItemSet(operation, delegate.getItemStockSummaryList())); return operation; }</code><technical_language>Remove extra variables in a setter</technical_language>

Target:
private StockOperation createOperation(StockOperation operation, InventoryStockTake delegate) { operation.setStatus(StockOperationStatus.NEW); IStockOperationType operationType = WellKnownOperationTypes.getAdjustment(); operation.setInstanceType(operationType); Stockroom stockroom = delegate.getStockroom(); operation.setSource(stockroom); operation.setOperationNumber(delegate.getOperationNumber()); operation.setOperationDate(new Date()); operation.setItems(createOperationsItemSet(operation, delegate.getItemStockSummaryList())); return operation; }
Source:
<code>public String getPreview() { StringBuffer buf= new StringBuffer(); buf.append("\n"); buf.append("public class IFoo {\n"); if (isEnabled(CleanUpConstants.REMOVE_REDUNDANT_SEMICOLONS)) { buf.append(" int a = 3;\n"); buf.append(" public void foo() <START> {};\n"); <END> } else { buf.append(" int a = 3;;\n"); buf.append(" public void foo() {};;\n"); } buf.append("}\n"); return buf.toString(); }</code><technical_language>if previews is showing cleaned-up code, is this here</technical_language>

Target:
public String getPreview() { StringBuffer buf= new StringBuffer(); buf.append("\n"); buf.append("enum color {\n"); buf.append(" red, yellow, green\n"); if (isEnabled(CleanUpConstants.REMOVE_REDUNDANT_SEMICOLONS)) { buf.append("}\n"); } else { buf.append("};\n"); } buf.append("\npublic class IFoo {\n"); if (isEnabled(CleanUpConstants.REMOVE_REDUNDANT_SEMICOLONS)) { buf.append(" int a= 3;\n"); buf.append(" public void foo() {}\n"); buf.append("}\n"); } else { buf.append(" int a= 3;;\n"); buf.append(" public void foo() {;};\n"); buf.append("};\n"); } return buf.toString(); }
Source:
<code>public void add() throws Exception { client.apply(new AddSecretAuthentication.Builder(TEST_REALM_NAME) .password(PASSWORD) .build()); <START> ops.exists(TEST_SECRET_IDENTITY_ADDRESS); <END> ModelNodeResult result = ops.readAttribute(TEST_SECRET_IDENTITY_ADDRESS, "value"); result.assertSuccess(); assertEquals("Password should be encoded properly.", PASSWORD, new String(Base64.getDecoder().decode(result.stringValue()))); }</code><technical_language>Result used</technical_language>

Target:
public void add() throws Exception { client.apply(new AddSecretAuthentication.Builder(TEST_REALM_NAME) .password(PASSWORD) .build()); assertTrue("Server identity should be created", ops.exists(TEST_SECRET_IDENTITY_ADDRESS)); ModelNodeResult result = ops.readAttribute(TEST_SECRET_IDENTITY_ADDRESS, "value"); result.assertSuccess(); assertEquals("Password should be encoded properly.", PASSWORD, new String(BaseEncoding.base64().decode(result.stringValue()), "UTF-8")); }
Source:
<code>private Map<Integer, OnmsAcknowledgment> fetchAcks(Set<OnmsAlarm> alarms) { Set<OnmsAcknowledgment> acks = new HashSet<>(); if (alarms.size() == 1) { acknowledgmentDao.findLatestAckForRefId(alarms.iterator() .next() .getId()) .ifPresent(acks::add); } else { final Date earliestAlarm = alarms.stream() .map(OnmsAlarm::getFirstEventTime) .filter(Objects::nonNull) .min(Comparator.naturalOrder()) .orElseGet(() -> { final LocalDateTime oneMonthAgoLdt = LocalDateTime.now().minusMonths(1); final Date oneMonthAgo = Date.from(oneMonthAgoLdt.atZone(ZoneId.systemDefault()).toInstant()); <START> LOG.error("Could not find minimum alarm creation time for alarms: {}. Using: {}", oneMonthAgo); <END> return oneMonthAgo; }); acks.addAll(acknowledgmentDao.findLatestAcks(earliestAlarm)); } Map<Integer, OnmsAcknowledgment> acksById = acks.stream().collect(Collectors.toMap(OnmsAcknowledgment::getRefId, ack -> ack)); acksById.putAll(alarms.stream() .filter(alarm -> !acksById.containsKey(alarm.getId())) .collect(Collectors.toMap(OnmsAlarm::getId, alarm -> { OnmsAcknowledgment ack = new OnmsAcknowledgment(alarm, DefaultAlarmService.DEFAULT_USER, alarm.getFirstEventTime()); ack.setAckAction(AckAction.UNACKNOWLEDGE); ack.setId(0); return ack; }))); return acksById; }</code><technical_language>this is missing alarms a parameter</technical_language>

Target:
private Map<Integer, OnmsAcknowledgment> fetchAcks(Set<OnmsAlarm> alarms) { Set<OnmsAcknowledgment> acks = new HashSet<>(); if (alarms.size() == 1) { acknowledgmentDao.findLatestAckForRefId(alarms.iterator() .next() .getId()) .ifPresent(acks::add); } else { final Date earliestAlarm = alarms.stream() .map(OnmsAlarm::getFirstEventTime) .filter(Objects::nonNull) .min(Comparator.naturalOrder()) .orElseGet(() -> { final LocalDateTime oneMonthAgoLdt = LocalDateTime.now().minusMonths(1); final Date oneMonthAgo = Date.from(oneMonthAgoLdt.atZone(ZoneId.systemDefault()).toInstant()); LOG.error("Could not find minimum alarm creation time for alarms: {}. Using: {}", alarms, oneMonthAgo); return oneMonthAgo; }); acks.addAll(acknowledgmentDao.findLatestAcks(earliestAlarm)); } Map<Integer, OnmsAcknowledgment> acksById = acks.stream().collect(Collectors.toMap(OnmsAcknowledgment::getRefId, ack -> ack)); acksById.putAll(alarms.stream() .filter(alarm -> !acksById.containsKey(alarm.getId())) .collect(Collectors.toMap(OnmsAlarm::getId, alarm -> { OnmsAcknowledgment ack = new OnmsAcknowledgment(alarm, DefaultAlarmService.DEFAULT_USER, alarm.getFirstEventTime()); ack.setAckAction(AckAction.UNACKNOWLEDGE); ack.setId(0); return ack; }))); return acksById; }
Source:
<code>void setFillColor(String color) { <START> color = color.trim(); <END> int polygonColorNum = (Color.parseColor("#" + convertColor(color))); setPolygonFillColor(polygonColorNum); mStylesSet.add("fillColor"); }</code><technical_language>applying this method convertColor avoid duplication input sanitation is applied? in cases color.trim() is desired calling convertColor anyway</technical_language>

Target:
void setFillColor(String color) { int polygonColorNum = (Color.parseColor("#" + convertColor(color))); setPolygonFillColor(polygonColorNum); mStylesSet.add("fillColor"); }
Source:
<code>public ValidationResult isVmPluggedDiskUsingScsiReservation() { for (VM vm : vms) { List<VmDevice> devices = getDbFacade().getVmDeviceDao().getVmDeviceByVmIdAndType(vm.getId(), VmDeviceGeneralType.DISK); for (VmDevice device : devices) { if (device.getIsPlugged() && device.isUsingScsiReservation()) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_VM_USES_SCSI_RESERVATION, String.format("$VmName %s", <START> vm.getName())); <END> } } } return ValidationResult.VALID; }</code><technical_language>aggregate list of problematic vms populate message of them</technical_language>

Target:
public ValidationResult isVmPluggedDiskUsingScsiReservation() { StringBuilder vmUsingScsiReservation = new StringBuilder(); for (VM vm : vms) { List<VmDevice> devices = getDbFacade().getVmDeviceDao().getVmDeviceByVmIdAndType(vm.getId(), VmDeviceGeneralType.DISK); for (VmDevice device : devices) { if (device.getIsPlugged() && device.isUsingScsiReservation()) { vmUsingScsiReservation.append(vm.getName()).append(" "); } } } if (vmUsingScsiReservation.length() == 0) { return ValidationResult.VALID; } return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_VM_USES_SCSI_RESERVATION, String.format("$VmName %s", vmUsingScsiReservation.toString().substring(0, vmUsingScsiReservation.toString().length()-1))); }
Source:
<code>public void testKafkaRpcAtRemoteLocation() throws InterruptedException, ExecutionException { assertNotEquals(REMOTE_LOCATION_NAME, identity.getLocation()); <START> Thread.sleep(5000); <END> EchoRequest request = new EchoRequest("Kafka-RPC"); request.setLocation(REMOTE_LOCATION_NAME); request.setDelay(5000L); EchoResponse expectedResponse = new EchoResponse("Kafka-RPC"); EchoResponse actualResponse = echoClient.execute(request).get(); assertEquals(expectedResponse, actualResponse); }</code><technical_language>do need sleep for 5 seconds here</technical_language>

Target:
public void testKafkaRpcAtRemoteLocation() throws InterruptedException, ExecutionException { EchoRequest request = new EchoRequest("Kafka-RPC"); request.setLocation(REMOTE_LOCATION_NAME); request.setDelay(5000L); EchoResponse expectedResponse = new EchoResponse("Kafka-RPC"); EchoResponse actualResponse = echoClient.execute(request).get(); assertEquals(expectedResponse, actualResponse); }
Source:
<code>public T[] asArray(Class<T> clazz) { T[] result = getArray(clazz, this.size); int index = 0; Element<T> current = head; while (Objects.nonNull(current)) { result[index++] = current.value; current = current.next; } <START> return (T[]) result; <END> }</code><technical_language>Cast unnecessary</technical_language>

Target:
public T[] asArray(Class<T> clazz) { T[] result = newArray(clazz, this.size); int index = 0; Element<T> current = head; while (Objects.nonNull(current)) { result[index++] = current.value; current = current.next; } return result; }
Source:
<code>public void beginRecognizeContentFromUrl() { String sourceFilePath = "{file_source_url}"; formRecognizerAsyncClient.beginRecognizeContentFromUrl(sourceFilePath).subscribe(trainingOperationResponse -> trainingOperationResponse.getFinalResult().subscribe(layoutPageResults -> layoutPageResults.forEach(formPage -> { System.out.printf("Page Angle: %s%n", formPage.getTextAngle()); System.out.printf("Page Dimension unit: %s%n", formPage.getUnit()); System.out.println("Recognized Tables: "); formPage.getTables().forEach(formTable -> { for (int i = 0; i < formTable.getRowCount(); i++) { for (int j = 0; j < formTable.getColumnCount(); j++) { int finalJ = j; int finalI = i; Optional<FormTableCell> optionalFormTableCell = formTable.getCells().stream().filter(formTableCell -> formTableCell.getRowIndex() == finalI && formTableCell.getColumnIndex() == finalJ) .findFirst(); FormTableCell recognizedTableCell = optionalFormTableCell.get(); <START> if (recognizedTableCell.isHeader()) { System.out.println(recognizedTableCell.getText()); } else { System.out.printf("%s || ", recognizedTableCell.getText()); } <END> }} }); }) )); END: com.azure.ai.formrecognizer.FormRecognizerAsyncClient.beginRecognizeContentFromUrl#string }</code><technical_language>need check for header in code snippets print out text if present for content endpoints</technical_language>

Target:
public void beginRecognizeContentFromUrl() { String sourceFilePath = "{file_source_url}"; formRecognizerAsyncClient.beginRecognizeContentFromUrl(sourceFilePath).subscribe( recognizePollingOperation -> recognizePollingOperation.getFinalResult().subscribe(layoutPageResults -> layoutPageResults.forEach(recognizedForm -> { System.out.printf("Page Angle: %s%n", recognizedForm.getTextAngle()); System.out.printf("Page Dimension unit: %s%n", recognizedForm.getUnit()); System.out.println("Recognized Tables: "); recognizedForm.getTables().forEach(formTable -> formTable.getCells().forEach(recognizedTableCell -> System.out.printf("%s ", recognizedTableCell.getText()))); }) )); END: com.azure.ai.formrecognizer.FormRecognizerAsyncClient.beginRecognizeContentFromUrl#string }
Source:
<code>public VcfLineMapper(VariantSource source) { this.source = source; this.factory = new VariantVcfFactory(); <START> if (!VariantSource.Aggregation.NONE.equals(source.getAggregation())) { <END> throw new IllegalArgumentException( this.getClass().getSimpleName() + " should not take aggregated " + "VCFs, but the VariantSource is not marked as Aggregation.NONE"); } }</code><technical_language>Preconditions checked assigning attributes values</technical_language>

Target:
public VcfLineMapper(VariantSource source) { if (!VariantSource.Aggregation.NONE.equals(source.getAggregation())) { throw new IllegalArgumentException( this.getClass().getSimpleName() + " should be used to read genotyped VCFs only, " + "but the VariantSource.Aggregation set to " + source.getAggregation().toString()); } this.source = source; this.factory = new VariantVcfFactory(); }
Source:
<code>public ProcessContext<CheckoutSeed> execute(ProcessContext<CheckoutSeed> context) throws Exception { Order order = context.getSeedData().getOrder(); if (order == null) { return context; } for (OrderItem orderItem : order.getOrderItems()) { Sku sku; if (orderItem instanceof DiscreteOrderItem) { sku = ((DiscreteOrderItem) orderItem).getSku(); } else if (orderItem instanceof BundleOrderItem) { sku = ((BundleOrderItem) orderItem).getSku(); } else { LOG.warn("Could not check availability; did not recognize passed-in item " + orderItem.getClass().getName()); return context; } Integer requestedQuantity = orderItem.getQuantity(); inventoryService.checkSkuAvailability(order, sku, requestedQuantity); <START> Integer previousQty = orderItem.getQuantity(); <END> for (OrderItem child : orderItem.getChildOrderItems()) { Sku childSku = ((DiscreteOrderItem) child).getSku(); Integer childQuantity = child.getQuantity(); childQuantity = childQuantity / previousQty; inventoryService.checkSkuAvailability(order, childSku, childQuantity * requestedQuantity); } } return context; }</code><technical_language>I this block inventoryService.checkSkuAvailability(order, sku, requestedQuantity); is unnecessary, order.getOrderItems() include child order items well. This block of code is logic duplicated CheckUpdateAvailabilityActivity, original block CheckUpdateAvailablilityActivity is this: java Order order = context.getSeedData().getOrder(); Integer requestedQuantity = request.getItemRequest().getQuantity(); checkSkuAvailability(order, sku, requestedQuantity); Integer previousQty = orderItem.getQuantity(); for (OrderItem child : orderItem.getChildOrderItems()) { Sku childSku = ((DiscreteOrderItem) child).getSku(); Integer childQuantity = child.getQuantity(); childQuantity = childQuantity / previousQty; checkSkuAvailability(order, childSku, childQuantity * requestedQuantity); } In this usage for CheckUpdateAvailabilityActivity, requestedQuantity is a new, previousQty, quantity is _updated_. Therefore, Sku availability for newly scaled child quantity validated. However, in ValidateAvailabilityActivity, quantity is _not_ updated, requestedQuantity previousQty equal, is gained calculation of child quantity values. a problem remove this block</technical_language>

Target:
public ProcessContext<CheckoutSeed> execute(ProcessContext<CheckoutSeed> context) throws Exception { Order order = context.getSeedData().getOrder(); if (order == null) { return context; } for (OrderItem orderItem : order.getOrderItems()) { Sku sku; if (orderItem instanceof DiscreteOrderItem) { sku = ((DiscreteOrderItem) orderItem).getSku(); } else if (orderItem instanceof BundleOrderItem) { sku = ((BundleOrderItem) orderItem).getSku(); } else { LOG.warn("Could not check availability; did not recognize passed-in item " + orderItem.getClass().getName()); return context; } if (!sku.isActive()) { throw new IllegalArgumentException("The requested skuId (" + sku.getId() + ") is no longer active"); } Integer requestedQuantity = orderItem.getQuantity(); inventoryService.checkSkuAvailability(order, sku, requestedQuantity); } return context; }
Source:
<code>public void end() { if (isInTransaction()) { <START> log.warn("Ending transaction without commit!"); <END> quadsIndex().end(); defaultGraph().end(); isInTransaction.remove(); transactionType.remove(); writeLock().leaveCriticalSection(); } }</code><technical_language>begin(READ)-end() is a normal pattern. code needs if is considering a READ WRITE transaction</technical_language>

Target:
public void end() { if (isInTransaction()) { if (transactionType().equals(WRITE)) log.warn("Ending WRITE transaction without commit!"); quadsIndex().end(); defaultGraph().end(); isInTransaction.remove(); transactionType.remove(); writeLock().leaveCriticalSection(); } }