auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void mouseDown(MouseEvent e) { if (_dragState != DRAG_NONE || null == _timeProvider) { return; } int idx; if (1 == e.button) { int nameSpace = _timeProvider.getNameSpace(); if (nameSpace != 0) { if (isOverSplitLine(e.x)) { _dragState = DRAG_SPLIT_LINE; _dragX = _dragX0 = e.x; _time0bak = _timeProvider.getTime0(); _time1bak = _timeProvider.getTime1(); redraw(); return; } } idx = getItemIndexAtY(e.y); if (idx >= 0) { Item item = _data._expandedItems[idx]; if (item._hasChildren && e.x < nameSpace && e.x < MARGIN + (item.level + 1) * EXPAND_SIZE) { toggle(idx); } else { long hitTime = getTimeAtX(e.x); if (hitTime >= 0) { setCapture(true); _dragState = DRAG_TRACE_ITEM; _dragX = _dragX0 = e.x - nameSpace; _time0bak = _timeProvider.getTime0(); _time1bak = _timeProvider.getTime1(); } } selectItem(idx, false); fireSelectionChanged(); } else { selectItem(idx, false); redraw(); fireSelectionChanged(); } <START> } else if (3 == e.button && _timeEventMenuListeners.isEmpty()) { <END> if (_timeProvider.getTime0() == _timeProvider.getTime1() || getCtrlSize().x - _timeProvider.getNameSpace() <= 0) { return; } setCapture(true); _dragX = _dragX0 = Math.min(Math.max(e.x, _timeProvider.getNameSpace()), getCtrlSize().x - RIGHT_MARGIN); _dragState = DRAG_ZOOM; } }</code><technical_language>colleagues I Windows... In words of immortal Samir Nagheenanajar, "This is suck!". Fortunately, is a trick Linux (and platform) behaving Windows does, handle menuDetected mouseUp. additional code in mouseUp() menuDetected()</technical_language>

Target:
public void mouseDown(MouseEvent e) { if (_dragState != DRAG_NONE || null == _timeProvider) { return; } int idx; if (1 == e.button) { int nameSpace = _timeProvider.getNameSpace(); if (nameSpace != 0) { if (isOverSplitLine(e.x)) { _dragState = DRAG_SPLIT_LINE; _dragX = _dragX0 = e.x; _time0bak = _timeProvider.getTime0(); _time1bak = _timeProvider.getTime1(); redraw(); return; } } idx = getItemIndexAtY(e.y); if (idx >= 0) { Item item = _data._expandedItems[idx]; if (item._hasChildren && e.x < nameSpace && e.x < MARGIN + (item.level + 1) * EXPAND_SIZE) { toggle(idx); } else { long hitTime = getTimeAtX(e.x); if (hitTime >= 0) { setCapture(true); _dragState = DRAG_TRACE_ITEM; _dragX = _dragX0 = e.x - nameSpace; _time0bak = _timeProvider.getTime0(); _time1bak = _timeProvider.getTime1(); } } selectItem(idx, false); fireSelectionChanged(); } else { selectItem(idx, false); redraw(); fireSelectionChanged(); } } else if (3 == e.button) { if (_timeProvider.getTime0() == _timeProvider.getTime1() || getCtrlSize().x - _timeProvider.getNameSpace() <= 0) { return; } setCapture(true); _dragX = _dragX0 = Math.min(Math.max(e.x, _timeProvider.getNameSpace()), getCtrlSize().x - RIGHT_MARGIN); _dragState = DRAG_ZOOM; } }
Source:
<code>private void wakeUpConsumer() { <START> if ( LockSupport.getBlocker( consumerThread ) != null ) { <END> LockSupport.unpark( consumerThread ); } }</code><technical_language>I a tricky race condition here: fail unpark consumer thread, while consumer is park (but check queue is empty)</technical_language>

Target:
private void wakeUpConsumer() { LockSupport.unpark( consumerThread ); }
Source:
<code><START> public void testEscapeComplexUri() throws Exception { <END> final CountDownLatch latch = new CountDownLatch(1); HttpProviderFactory factory = mock(HttpProviderFactory.class); when(factory.get(anyObject())).thenReturn(mock(HttpProvider.class)); RestAdapter<Data> adapter = new RestAdapter<Data>(Data.class, url); Object restRunner = UnitTestUtils.getPrivateField(adapter, "restRunner"); UnitTestUtils.setPrivateField(restRunner, "httpProviderFactory", factory); ReadFilter filter = new ReadFilter(); filter.setLinkUri(URI.create("metrics/gauges/MI~R~%5Bacbfe3d2-fd73-43b0-94ad-c38f32abba1f" + "%2FHolu~~%5D~MT~WildFly%20Memory%20Metrics~Heap%20Max/data?start=1463907826698&end=1466586226698")); adapter.read(filter, new Callback<List<Data>>() { @Override public void onSuccess(List<Data> data) { latch.countDown(); } @Override public void onFailure(Exception e) { latch.countDown(); } }); latch.await(500, TimeUnit.MILLISECONDS); verify(factory).get(eq(new URL(url.toString() + "metrics/gauges/MI~R~%5Bacbfe3d2-fd73-43b0-94ad-c38f32abba1f" + "%2FHolu~~%5D~MT~WildFly%20Memory%20Metrics~Heap%20Max/data?start=1463907826698&end=1466586226698"))); }</code><technical_language>hey! I forgot I created a var args matcher in project. this verify(factory).get(Mockito.argThat(new ObjectVarArgsMatcher(new URL(url.toString() + "rail%2Ftrails?limit=10&where=%7B%22model%22:%22BMW%22%7D"), 60000))); I"ll send a PR PR</technical_language>

Target:
public void testEscapeComplexUri() throws Exception { final CountDownLatch latch = new CountDownLatch(1); HttpProviderFactory factory = mock(HttpProviderFactory.class); when(factory.get(anyObject())).thenReturn(mock(HttpProvider.class)); RestAdapter<Data> adapter = new RestAdapter<Data>(Data.class, url); Object restRunner = UnitTestUtils.getPrivateField(adapter, "restRunner"); UnitTestUtils.setPrivateField(restRunner, "httpProviderFactory", factory); ReadFilter filter = new ReadFilter(); filter.setLinkUri(URI.create("metrics/gauges/MI~R~%5Bacbfe3d2-fd73-43b0-94ad-c38f32abba1f" + "%2FHolu~~%5D~MT~WildFly%20Memory%20Metrics~Heap%20Max/data?start=1463907826698&end=1466586226698")); adapter.read(filter, new Callback<List<Data>>() { @Override public void onSuccess(List<Data> data) { latch.countDown(); } @Override public void onFailure(Exception e) { latch.countDown(); } }); latch.await(500, TimeUnit.MILLISECONDS); verify(factory).get(Mockito.argThat(new ObjectVarArgsMatcher(new URL(url.toString() + "metrics/gauges/MI~R~%5Bacbfe3d2-fd73-43b0-" + "94ad-c38f32abba1f%2FHolu~~%5D~MT~WildFly%20Memory%20Metrics~Heap%20Max/data?start=1463907826698&end=1466586226698"), 60000))); }
Source:
<code>public void initRepo() throws Exception { coreSession.removeChildren(coreSession.getRootDocument().getRef()); coreSession.save(); testFolder = coreSession.createDocumentModel("/", "Folder", "Folder"); testFolder.setPropertyValue("dc:title", "Folder"); testFolder = coreSession.createDocument(testFolder); coreSession.save(); testFolder = coreSession.getDocument(testFolder.getRef()); doc = coreSession.createDocumentModel("/Folder", "TestDoc", "DataSet"); doc.setPropertyValue("dc:title", "TestDoc"); doc = coreSession.createDocument(doc); coreSession.save(); doc = coreSession.getDocument(doc.getRef()); assertNotNull(doc.getPropertyValue("ds:fields")); <START> assertEquals(0, ((Collection) doc.getPropertyValue("ds:fields")).size()); <END> File fieldsAsJsonFile = FileUtils.getResourceFileFromContext("newFields.json"); assertNotNull(fieldsAsJsonFile); String fieldsDataAsJSon = org.apache.commons.io.FileUtils.readFileToString(fieldsAsJsonFile, UTF_8); fieldsDataAsJSon = fieldsDataAsJSon.replaceAll("\n", ""); fieldsDataAsJSon = fieldsDataAsJSon.replaceAll("\r", ""); OperationContext ctx = new OperationContext(coreSession); ctx.setInput(doc); OperationChain chain = new OperationChain("testChain"); chain.add(AddItemToListProperty.ID).set("xpath", "ds:fields").set("complexJsonProperties", fieldsDataAsJSon); doc = (DocumentModel) service.run(ctx, chain); List dbFields = (List) doc.getPropertyValue("ds:fields"); assertEquals(2, dbFields.size()); }</code><technical_language>isEmpty check is better, no</technical_language>

Target:
public void initRepo() throws Exception { coreSession.removeChildren(coreSession.getRootDocument().getRef()); coreSession.save(); testFolder = coreSession.createDocumentModel("/", "Folder", "Folder"); testFolder.setPropertyValue("dc:title", "Folder"); testFolder = coreSession.createDocument(testFolder); coreSession.save(); testFolder = coreSession.getDocument(testFolder.getRef()); doc = coreSession.createDocumentModel("/Folder", "TestDoc", "DataSet"); doc.setPropertyValue("dc:title", "TestDoc"); doc = coreSession.createDocument(doc); coreSession.save(); doc = coreSession.getDocument(doc.getRef()); List fields = (List) doc.getPropertyValue("ds:fields"); assertNotNull(fields); assertTrue(fields.isEmpty()); File fieldsAsJsonFile = FileUtils.getResourceFileFromContext("newFields.json"); assertNotNull(fieldsAsJsonFile); String fieldsDataAsJSon = org.apache.commons.io.FileUtils.readFileToString(fieldsAsJsonFile, UTF_8); fieldsDataAsJSon = fieldsDataAsJSon.replaceAll("\n", ""); fieldsDataAsJSon = fieldsDataAsJSon.replaceAll("\r", ""); OperationContext ctx = new OperationContext(coreSession); ctx.setInput(doc); OperationChain chain = new OperationChain("testChain"); chain.add(AddItemToListProperty.ID).set("xpath", "ds:fields").set("complexJsonProperties", fieldsDataAsJSon); doc = (DocumentModel) service.run(ctx, chain); List dbFields = (List) doc.getPropertyValue("ds:fields"); assertEquals(2, dbFields.size()); }
Source:
<code>public void drawAnnotationTest() throws IOException, InterruptedException { GraphFactory<SequenceSegment> gf = FactoryProducer .getFactory("JGraphT"); Graph<SequenceSegment> graph; SequenceSegment v1; v1 = new SequenceSegment(new HashSet<Sequence>(Arrays.asList(s1, s2)), 0, 20, new SegmentEmpty(20)); v1.setUnifiedStart(0); v1.setUnifiedEnd(20); graph = gf.getGraph(); graph.addVertex(v1); BucketCache buckets = new BucketCache(1, graph); File file = new File( "./src/test/resources/data/test_annotations/simple_annotations.txt"); List<KnownMutation> parse = KnownMutationParser .parseKnownMutations(file); Sequence reference = graph.getSources().iterator().next().getSources() .iterator().next(); Map<SequenceSegment, List<KnownMutation>> annotations = KnownMutationMapper .mapAnnotations(graph, parse, reference); JFXPanel panel = new JFXPanel(); Platform.runLater(() -> { Group result = tileview.drawGraph(buckets.getSegments(0, 1), graph, annotations, 1); bookmark = (Circle) ((Group) result.getChildrenUnmodifiable().get(2)) .getChildrenUnmodifiable().get(0); vView1 = (VertexView) ((Group) result.getChildrenUnmodifiable() .get(0)).getChildrenUnmodifiable().get(0); }); Thread.sleep(1000); <START> assertEquals(bookmark.getRadius(), Double.parseDouble(Settings.get("bookmark_radius")), 1e-10); <END> }</code><technical_language>a final string for settings property</technical_language>

Target:
public void drawAnnotationTest() throws IOException, InterruptedException { GraphFactory<SequenceSegment> gf = FactoryProducer .getFactory("JGraphT"); Graph<SequenceSegment> graph; SequenceSegment v1; v1 = new SequenceSegment(new HashSet<Sequence>(Arrays.asList(s1, s2)), 0, 20, new SegmentEmpty(20)); v1.setUnifiedStart(0); v1.setUnifiedEnd(20); graph = gf.getGraph(); graph.addVertex(v1); BucketCache buckets = new BucketCache(1, graph); File file = new File( "./src/test/resources/data/test_annotations/simple_annotations.txt"); List<KnownMutation> parse = KnownMutationParser .parseKnownMutations(file); Sequence reference = graph.getSources().iterator().next().getSources() .iterator().next(); Map<SequenceSegment, List<KnownMutation>> annotations = KnownMutationMapper .mapAnnotations(graph, parse, reference); JFXPanel panel = new JFXPanel(); Platform.runLater(() -> { Group result = tileview.drawGraph(buckets.getSegments(0, 1), graph, annotations, 1); bookmark = (Circle) ((Group) result.getChildrenUnmodifiable() .get(2)).getChildrenUnmodifiable().get(0); vertexView1 = (VertexView) ((Group) result .getChildrenUnmodifiable().get(0)) .getChildrenUnmodifiable().get(0); }); Thread.sleep(1000); assertEquals(bookmark.getRadius(), Double.parseDouble(Settings.get(RADIUS_SETTING)), 1e-10); }
Source:
<code>public boolean poll(Timer timer) { maybeUpdateSubscriptionMetadata(); invokeCompletedOffsetCommitCallbacks(); if (subscriptions.partitionsAutoAssigned()) { if (protocol == null) { <START> throw new IllegalStateException("User configure ConsumerConfig#PARTITION_ASSIGNMENT_STRATEGY_CONFIG to empty " + <END> "while trying to subscribe for group protocol to auto assign partitions"); } pollHeartbeat(timer.currentTimeMs()); if (coordinatorUnknown() && !ensureCoordinatorReady(timer)) { return false; } if (rejoinNeededOrPending()) { if (subscriptions.hasPatternSubscription()) { if (this.metadata.timeToAllowUpdate(timer.currentTimeMs()) == 0) { this.metadata.requestUpdate(); } if (!client.ensureFreshMetadata(timer)) { return false; } maybeUpdateSubscriptionMetadata(); } if (!ensureActiveGroup(timer)) { return false; } } } else { if (metadata.updateRequested() && !client.hasReadyNodes(timer.currentTimeMs())) { client.awaitMetadataUpdate(timer); } } maybeAutoCommitOffsetsAsync(timer.currentTimeMs()); return true; }</code><technical_language>nit: configure -> configured</technical_language>

Target:
public boolean poll(Timer timer) { maybeUpdateSubscriptionMetadata(); invokeCompletedOffsetCommitCallbacks(); if (subscriptions.partitionsAutoAssigned()) { if (protocol == null) { throw new IllegalStateException("User configured " + ConsumerConfig.PARTITION_ASSIGNMENT_STRATEGY_CONFIG + " to empty while trying to subscribe for group protocol to auto assign partitions"); } pollHeartbeat(timer.currentTimeMs()); if (coordinatorUnknown() && !ensureCoordinatorReady(timer)) { return false; } if (rejoinNeededOrPending()) { if (subscriptions.hasPatternSubscription()) { if (this.metadata.timeToAllowUpdate(timer.currentTimeMs()) == 0) { this.metadata.requestUpdate(); } if (!client.ensureFreshMetadata(timer)) { return false; } maybeUpdateSubscriptionMetadata(); } if (!ensureActiveGroup(timer)) { return false; } } } else { if (metadata.updateRequested() && !client.hasReadyNodes(timer.currentTimeMs())) { client.awaitMetadataUpdate(timer); } } maybeAutoCommitOffsetsAsync(timer.currentTimeMs()); return true; }
Source:
<code>private MemoryImageBuilder createMemoryImageBuilder() { <START> return FeatureSupported.memorySnapshot(getVm().getVdsGroupCompatibilityVersion()) <END> && getParameters().isSaveMemory() && isLiveSnapshotApplicable() ? new DefaultMemoryImageBuilder(getVm(), getStorageDomainIdForVmMemory(), getStoragePool(), this) : new NullableMemoryImageBuilder(); }</code><technical_language>this operation done spm? guarantee spm host is in vds group of vm operation fail undefined in vdsm side? I fact rely vds group version error prone in case.. I pool compatibility version</technical_language>

Target:
private MemoryImageBuilder createMemoryImageBuilder() { if (FeatureSupported.memorySnapshot(getVm().getVdsGroupCompatibilityVersion()) && getParameters().isSaveMemory() && isLiveSnapshotApplicable()) { prepareForMemorySnapshot = true; return new DefaultMemoryImageBuilder(getVm(), getStorageDomainIdForVmMemory(), getStoragePool(), this); } else { return new NullableMemoryImageBuilder(); } }
Source:
<code>private <T, R> ClientFuture<R> executeAsync0( <START> String taskName, <END> @Nullable T arg, ClientClusterGroupImpl clusterGrp, byte flags, long timeout ) throws ClientException { Collection<UUID> nodeIds = clusterGrp == cluster ? null : clusterGrp.nodeIds(); if (nodeIds != null && nodeIds.isEmpty()) throw new ClientException("Cluster group is empty."); while (true) { Consumer<PayloadOutputChannel> payloadWriter = ch -> { if (!ch.clientChannel().isFeatureSupported(ClientFeature.EXECUTE_TASK_BY_NAME)) { throw new ClientFeatureNotSupportedByServerException("Compute grid functionality for thin " + "client not supported by server node (" + ch.clientChannel().serverNodeId() + ')'); } try (BinaryRawWriterEx w = new BinaryWriterExImpl(marsh.context(), ch.out(), null, null)) { if (nodeIds == null) w.writeInt(0); else { w.writeInt(nodeIds.size()); for (UUID nodeId : nodeIds) w.writeUuid(nodeId); } w.writeByte(flags); w.writeLong(timeout); w.writeString(taskName); utils.writeObject(ch.out(), arg); } }; Function<PayloadInputChannel, T2<ClientChannel, Long>> payloadReader = ch -> new T2<>(ch.clientChannel(), ch.in().readLong()); T2<ClientChannel, Long> taskParams; try { taskParams = ch.service(COMPUTE_TASK_EXECUTE, payloadWriter, payloadReader); } catch (ClientServerError error) { throw new ClientException(error.getMessage()); } ClientComputeTask<Object> task = addTask(taskParams.get1(), taskParams.get2()); if (task == null) continue; task.fut.listen(f -> removeTask(task.ch, task.taskId)); return new ClientFutureImpl<>((IgniteInternalFuture<R>)task.fut); } }</code><technical_language>taskName is validated null empty string</technical_language>

Target:
private <T, R> Future<R> executeAsync0( String taskName, @Nullable T arg, ClientClusterGroupImpl clusterGrp, byte flags, long timeout ) throws ClientException { Collection<UUID> nodeIds = clusterGrp == cluster ? null : clusterGrp.nodeIds(); if (F.isEmpty(taskName)) throw new ClientException("Task name can't be null or empty."); if (nodeIds != null && nodeIds.isEmpty()) throw new ClientException("Cluster group is empty."); while (true) { Consumer<PayloadOutputChannel> payloadWriter = ch -> writeExecuteTaskRequest(ch, taskName, arg, nodeIds, flags, timeout); Function<PayloadInputChannel, T2<ClientChannel, Long>> payloadReader = ch -> new T2<>(ch.clientChannel(), ch.in().readLong()); T2<ClientChannel, Long> taskParams; try { taskParams = ch.service(COMPUTE_TASK_EXECUTE, payloadWriter, payloadReader); } catch (ClientServerError error) { throw new ClientException(error.getMessage()); } ClientComputeTask<Object> task = addTask(taskParams.get1(), taskParams.get2()); if (task == null) continue; task.fut.listen(f -> removeTask(task.ch, task.taskId)); return new ClientFutureImpl<>((GridFutureAdapter<R>)task.fut); } }
Source:
<code>private void mergeLogs(MergedReftable mr) throws IOException { if (oldestReflogTimeMillis == Long.MAX_VALUE) { return; } try (LogCursor lc = mr.allLogs()) { while (lc.next()) { long updateIndex = lc.getUpdateIndex(); if <START> (updateIndex > maxUpdateIndex || updateIndex < minUpdateIndex) { <END> continue; } String refName = lc.getRefName(); ReflogEntry log = lc.getReflogEntry(); if (log == null) { if (includeDeletes) { writer.deleteLog(refName, updateIndex); } continue; } PersonIdent who = log.getWho(); if (who.getWhen().getTime() >= oldestReflogTimeMillis) { writer.writeLog( refName, updateIndex, who, log.getOldId(), log.getNewId(), log.getComment()); } } } }</code><technical_language>update indices setters, while writer in line 157 158 indices reader. consistent</technical_language>

Target:
private void mergeLogs(MergedReftable mr) throws IOException { if (expireOldestReflogTimeMillis == Long.MAX_VALUE) { return; } try (LogCursor lc = mr.allLogs()) { while (lc.next()) { long updateIndex = lc.getUpdateIndex(); if (updateIndex > expireMaxUpdateIndex || updateIndex < expireMinUpdateIndex) { continue; } String refName = lc.getRefName(); ReflogEntry log = lc.getReflogEntry(); if (log == null) { if (includeDeletes) { writer.deleteLog(refName, updateIndex); } continue; } PersonIdent who = log.getWho(); if (who.getWhen().getTime() >= expireOldestReflogTimeMillis) { writer.writeLog( refName, updateIndex, who, log.getOldId(), log.getNewId(), log.getComment()); } } } }
Source:
<code>public ProcessExecution(Process process, String executable, Map<String, String> params, Map<String, String> hiddenParams) { notNull(process, "process"); this.executionsUri = notEmpty(process.getExecutionsLink(), "process executions link"); <START> this.executable = notEmpty(executable, "executable"); <END> this.params = notNull(params, "params"); this.hiddenParams = notNull(hiddenParams, "hiddenParams"); }</code><technical_language>please check if executable is contained in process</technical_language>

Target:
public ProcessExecution(Process process, String executable, Map<String, String> params, Map<String, String> hiddenParams) { notNull(process, "process"); this.executionsUri = notEmpty(process.getExecutionsLink(), "process executions link"); this.executable = executable; this.params = notNull(params, "params"); this.hiddenParams = notNull(hiddenParams, "hiddenParams"); if (!CollectionUtils.isEmpty(process.getExecutables()) && !process.getExecutables().contains(executable)) { throw new IllegalArgumentException("Executable " + executable + " not found in process executables."); } }
Source:
<code>private boolean isExcludedUrl(HttpServletRequest request) { String servletPath = request.getServletPath(); for (String pattern : this.excludePatterns) { <START> if (servletPath.matches(pattern)) { <END> return true; } } return false; }</code><technical_language>possibly prepare a collection of statically compiled patterns matches() call. improve performance a bit. matches() call is compile pattern for time request</technical_language>

Target:
private boolean isExcludedUrl(HttpServletRequest request) { String servletPath = request.getServletPath(); for (Pattern pattern : this.excludePatterns) { if (pattern.matcher(servletPath).matches()) { return true; } } return false; }
Source:
<code>public void retriesOnExceptionTillSuccess() throws Exception { final int count = 3; final int delay = 1000; final Take take = Mockito.mock(Take.class); Mockito.when(take.act(Mockito.any(Request.class))).thenThrow( new IOException() ).thenReturn(new RsText()); final long minTime = delay; final long startTime = System.currentTimeMillis(); new TkRetry(count, delay, take).act(new RqFake(RqMethod.GET)); MatcherAssert.assertThat( <START> minTime, <END> Matchers.lessThanOrEqualTo(System.currentTimeMillis() - startTime) ); }</code><technical_language>@aschworer here, variable minTime replaced delay</technical_language>

Target:
public void retriesOnExceptionTillSuccess() throws Exception { final int count = 3; final int delay = 1000; final Take take = Mockito.mock(Take.class); Mockito.when(take.act(Mockito.any(Request.class))).thenThrow( new IOException() ).thenReturn(new RsText()); final long startTime = System.currentTimeMillis(); new TkRetry(count, delay, take).act(new RqFake(RqMethod.GET)); MatcherAssert.assertThat( new Long(delay), Matchers.lessThanOrEqualTo(System.currentTimeMillis() - startTime) ); }
Source:
<code>private void loadConfiguration(final ServletContextEvent servletContextEvent) { LOGGER.info(" Loading configuration ..."); <START> final String configurationDirectoryPath = documentationPathLogic.getDocumentationPath(servletContextEvent); <END> RepositoryLocator.INSTANCE.initializeConfigurationRepository(configurationDirectoryPath); final ConfigurationRepository configurationRepository = RepositoryLocator.INSTANCE.getConfigurationRepository(); final Configuration configuration = configurationRepository.getConfiguration(); LOGGER.info(" Configuration loaded."); LOGGER.info(" Configured documentation content directory: " + configurationDirectoryPath); }</code><technical_language>@mi-we Please log configured path - reading config - in case this is failing, I want path is configured</technical_language>

Target:
private void loadConfiguration(final ServletContextEvent servletContextEvent) { final String configurationDirectoryPath = scenariooDataPathLogic.getDataPath(servletContextEvent); LOGGER.info(" Configured scenarioo data directory: " + configurationDirectoryPath); LOGGER.info(" Loading configuration ..."); RepositoryLocator.INSTANCE.initializeConfigurationRepository(configurationDirectoryPath); final ConfigurationRepository configurationRepository = RepositoryLocator.INSTANCE.getConfigurationRepository(); final Configuration configuration = configurationRepository.getConfiguration(); LOGGER.info(" Configuration loaded."); }
Source:
<code>public boolean enableWagedRebalance(String clusterName, List<String> resourceNames) { <START> if (clusterName == null || clusterName.isEmpty()) { <END> throw new HelixException("Cluster name is invalid!"); } if (resourceNames == null || resourceNames.isEmpty()) { throw new HelixException("Resource name list is invalid!"); } HelixDataAccessor accessor = new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<>(_zkClient)); Builder keyBuilder = accessor.keyBuilder(); List<IdealState> idealStates = accessor.getChildValues(keyBuilder.idealStates()); List<String> nullIdealStates = new ArrayList<>(); for (int i = 0; i < idealStates.size(); i++) { if (idealStates.get(i) == null) { nullIdealStates.add(resourceNames.get(i)); } else { idealStates.get(i) .setRebalancerClassName("org.apache.helix.controller.rebalancer.WagedRebalancer"); } } if (!nullIdealStates.isEmpty()) { throw new HelixException( String.format("Not all IdealStates exist in the cluster: %s", nullIdealStates)); } List<PropertyKey> idealStateKeys = new ArrayList<>(); idealStates.forEach( idealState -> idealStateKeys.add(keyBuilder.idealStates(idealState.getResourceName()))); boolean[] success = accessor.setChildren(idealStateKeys, idealStates); for (boolean s : success) { if (!s) { return false; } } return true; }</code><technical_language>nit, do for addResourceWithWeight method</technical_language>

Target:
public boolean enableWagedRebalance(String clusterName, List<String> resourceNames) { if (clusterName == null || clusterName.isEmpty()) { throw new HelixException("Cluster name is invalid!"); } if (resourceNames == null || resourceNames.isEmpty()) { throw new HelixException("Resource name list is invalid!"); } HelixDataAccessor accessor = new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<>(_zkClient)); Builder keyBuilder = accessor.keyBuilder(); List<IdealState> idealStates = accessor.getChildValues(keyBuilder.idealStates()); List<String> nullIdealStates = new ArrayList<>(); for (int i = 0; i < idealStates.size(); i++) { if (idealStates.get(i) == null) { nullIdealStates.add(resourceNames.get(i)); } else { idealStates.get(i).setRebalancerClassName(WagedRebalancer.class.getName()); idealStates.get(i).setRebalanceMode(RebalanceMode.FULL_AUTO); } } if (!nullIdealStates.isEmpty()) { throw new HelixException( String.format("Not all IdealStates exist in the cluster: %s", nullIdealStates)); } List<PropertyKey> idealStateKeys = new ArrayList<>(); idealStates.forEach( idealState -> idealStateKeys.add(keyBuilder.idealStates(idealState.getResourceName()))); boolean[] success = accessor.setChildren(idealStateKeys, idealStates); for (boolean s : success) { if (!s) { return false; } } return true; }
Source:
<code>public void processMessage(final ProtocolResponseMessage message) { LOGGER.info("Processing protocol response message with correlation uid [{}]", message.getCorrelationUid()); try { if (message.isScheduled()) { LOGGER.info("Handling scheduled protocol response message."); <START> this.handleScheduleTask(message); <END> } else { LOGGER.info("Handling protocol response message."); this.handleProtocolResponseMessage(message); } } catch (JMSException | FunctionalException e) { LOGGER.error("Exception: {}, StackTrace: {}", e.getMessage(), e.getStackTrace(), e); } }</code><technical_language>method name for handleScheduleTask suggests method deals scheduling a task. handleScheduledTask is happens</technical_language>

Target:
public void processMessage(final ProtocolResponseMessage message) { LOGGER.info("Processing protocol response message with correlation uid [{}]", message.getCorrelationUid()); try { if (message.isScheduled()) { LOGGER.info("Handling scheduled protocol response message."); this.handleScheduledTask(message); } else { LOGGER.info("Handling protocol response message."); this.handleProtocolResponseMessage(message); } } catch (JMSException | FunctionalException e) { LOGGER.error("Exception: {}, StackTrace: {}", e.getMessage(), e.getStackTrace(), e); } }
Source:
<code>ShoppingBagItemPresenter( EventBus eventBus, MyView view, @Assisted ShoppingBagItem item, CurrentShoppingBag currentShoppingBag) { super(eventBus, view); this.currentShoppingBag = currentShoppingBag; getView().setUiHandlers(this); <START> this.item = item; <END> }</code><technical_language>other this</technical_language>

Target:
ShoppingBagItemPresenter( EventBus eventBus, MyView view, @Assisted ShoppingBagItem item, CurrentShoppingBag currentShoppingBag) { super(eventBus, view); this.currentShoppingBag = currentShoppingBag; this.item = item; getView().setUiHandlers(this); }
Source:
<code>public ResultSetMetaData getMetaData() throws SQLException { <START> try (PrestoStatement statement = (PrestoStatement) getConnection().createStatement()) { <END> ResultSet rs = statement.executeQuery("DESCRIBE OUTPUT " + statementName); ImmutableList.Builder<ColumnInfo> list = ImmutableList.builder(); while (rs.next()) { ColumnInfo.Builder builder = new ColumnInfo.Builder() .setCatalogName(rs.getString(2)) .setSchemaName(rs.getString(3)) .setTableName(rs.getString(4)) .setColumnLabel(rs.getString(1)) .setColumnName(rs.getString(1)) .setColumnTypeSignature(parseTypeSignature(rs.getString(5))) .setNullable(NULLABLE) .setCurrency(false); ColumnInfo.setTypeInfo(builder, parseTypeSignature(rs.getString(5))); list.add(builder.build()); } return new PrestoResultSetMetaData(list.build()); } }</code><technical_language>able Statement here. I requires PrestoStatement</technical_language>

Target:
public ResultSetMetaData getMetaData() throws SQLException { try (Statement statement = getConnection().createStatement()) { try (ResultSet rs = statement.executeQuery("DESCRIBE OUTPUT " + statementName)) { ImmutableList.Builder<ColumnInfo> list = ImmutableList.builder(); while (rs.next()) { ColumnInfo.Builder builder = new ColumnInfo.Builder() .setCatalogName(rs.getString(2)) .setSchemaName(rs.getString(3)) .setTableName(rs.getString(4)) .setColumnLabel(rs.getString(1)) .setColumnName(rs.getString(1)) .setTypeSignature(parseTypeSignature(rs.getString(5))) .setNullable(NULLABLE) .setCurrency(false); list.add(builder.build()); } return new PrestoResultSetMetaData(list.build()); } } }
Source:
<code>public void endVisit(@Nonnull JMethodCall call) { Collection<JMethod> targets = call.getMethodId().getMethods(); if (targets.size() != 1) { return; } JMethod target = targets.iterator().next(); if (target.isAbstract() || target.isNative()) { return; } <START> Location location = target.getEnclosingType().getLocation(); <END> if (location instanceof TypeInInputLibraryLocation) { InputLibrary inputLibrary = ((TypeInInputLibraryLocation) location).getInputLibrary(); if (inputLibrary.containsFileType(FileType.PREBUILT)) { return; } } List<JAnnotation> annotationList = target.getAnnotations(forceInlineAnnotationType); if (!annotationList.isEmpty()) { call.addMarker(new InlineMarker(target)); } }</code><technical_language>Strange. deisable pre-dex. property a ComptiblePrebuilt a DumpInLib good, no</technical_language>

Target:
public void endVisit(@Nonnull JMethodCall call) { Collection<JMethod> targets = call.getMethodId().getMethods(); if (targets.size() != 1) { return; } JMethod target = targets.iterator().next(); if (target.isAbstract() || target.isNative()) { return; } Location location = target.getEnclosingType().getLocation(); if (location instanceof TypeInInputLibraryLocation) { InputLibrary inputLibrary = ((TypeInInputLibraryLocation) location).getInputLibrary(); if (inputLibrary.containsFileType(FileType.PREBUILT)) { return; } } assert forceInlineAnnotationType != null; List<JAnnotation> annotationList = target.getAnnotations(forceInlineAnnotationType); if (!annotationList.isEmpty()) { call.addMarker(new InlineMarker(target)); } }
Source:
<code>public CatchAllImpl(OMElement omElement) { super(omElement); <START> name = "CATCHALL" + System.currentTimeMillis(); <END> displayName = "Catch All"; startIconPath = BPEL2SVGFactory.getInstance().getIconPath(this.getClass().getName()); endIconPath = BPEL2SVGFactory.getInstance().getEndIconPath(this.getClass().getName()); }</code><technical_language>do append current time</technical_language>

Target:
public CatchAllImpl(OMElement omElement) { super(omElement); name = "CATCHALL"; displayName = "Catch All"; startIconPath = BPEL2SVGFactory.getInstance().getIconPath(this.getClass().getName()); endIconPath = BPEL2SVGFactory.getInstance().getEndIconPath(this.getClass().getName()); }
Source:
<code>public PdpFeedDetailEntry buildPdpFeedDetailEntry(ConcurStandardAccountingExtractDetailLine line) { PdpFeedDetailEntry currentDetailEntry = new PdpFeedDetailEntry(); currentDetailEntry.setSourceDocNbr(buildSourceDocumentNumber(line.getReportId())); currentDetailEntry.setFsOriginCd(getConcurParamterValue(ConcurConstants.DEFAULT_ORIGINATION_CODE_PARAMETER_NAME)); currentDetailEntry.setFdocTypCd(getConcurParamterValue(ConcurConstants.DEFAULT_SAW_PDP_DOCUMENT_TYPE_PARAMETER_NAME)); currentDetailEntry.setInvoiceNbr(""); <START> currentDetailEntry.setPoNbr(""); <END> currentDetailEntry.setInvoiceDate(formatDate(line.getBatchDate())); return currentDetailEntry; }</code><technical_language>StringUtils.EMPTY for lines</technical_language>

Target:
public PdpFeedDetailEntry buildPdpFeedDetailEntry(ConcurStandardAccountingExtractDetailLine line) { PdpFeedDetailEntry currentDetailEntry = new PdpFeedDetailEntry(); currentDetailEntry.setSourceDocNbr(buildSourceDocumentNumber(line.getReportId())); currentDetailEntry.setFsOriginCd(getConcurParameterValue(ParameterNames.CONCUR_AP_PDP_ORIGINATION_CODE)); currentDetailEntry.setFdocTypCd(getConcurParameterValue(ParameterNames.CONCUR_SAE_PDP_DOCUMENT_TYPE)); currentDetailEntry.setInvoiceNbr(StringUtils.EMPTY); currentDetailEntry.setPoNbr(StringUtils.EMPTY); currentDetailEntry.setInvoiceDate(formatDate(line.getBatchDate())); return currentDetailEntry; }
Source:
<code>private void commitOnePhase(Xid xid) throws XAException { try { if (xid.equals(preparedXid)) { throw new PGXAException(GT.tr("One-phase commit called for prepared"), XAException.XAER_PROTO); } if (currentXid == null && !committedOrRolledBack) { throw new PGXAException( GT.tr( "Not implemented: one-phase commit must be issued using the same connection that was used to start it"), XAException.XAER_RMERR); } if (!xid.equals(currentXid) || committedOrRolledBack) { <START> throw new PGXAException(GT.tr("One-phase commit with unknown xid "), XAException.XAER_NOTA); <END> } if (state != State.ENDED) { throw new PGXAException(GT.tr("commit called before end"), XAException.XAER_PROTO); } state = State.IDLE; currentXid = null; committedOrRolledBack = true; conn.commit(); conn.setAutoCommit(localAutoCommitMode); } catch (SQLException ex) { throw new PGXAException(GT.tr("Error during one-phase commit"), ex, XAException.XAER_RMFAIL); } }</code><technical_language>space end of string</technical_language>

Target:
private void commitOnePhase(Xid xid) throws XAException { try { if (xid.equals(preparedXid)) { throw new PGXAException(GT.tr("One-phase commit called for xid {0} but connection was prepared with xid {1}", xid, preparedXid), XAException.XAER_PROTO); } if (currentXid == null && !committedOrRolledBack) { throw new PGXAException(GT.tr( "Not implemented: one-phase commit must be issued using the same connection that was used to start it", xid), XAException.XAER_RMERR); } if (!xid.equals(currentXid) || committedOrRolledBack) { throw new PGXAException(GT.tr("One-phase commit with unknown xid. commit xid={0}, currentXid={1}", xid, currentXid), XAException.XAER_NOTA); } if (state != State.ENDED) { throw new PGXAException(GT.tr("commit called before end. commit xid={0}, state={1}", xid, state), XAException.XAER_PROTO); } state = State.IDLE; currentXid = null; committedOrRolledBack = true; conn.commit(); conn.setAutoCommit(localAutoCommitMode); } catch (SQLException ex) { throw new PGXAException(GT.tr("Error during one-phase commit. commit xid={0}", xid), ex, XAException.XAER_RMFAIL); } }
Source:
<code>public void write(DataOutput output) throws IOException { Bytes.writeByteArray(output, name.getBytes()); Bytes.writeByteArray(output, familyName == null ? ByteUtil.EMPTY_BYTE_ARRAY : familyName.getBytes()); WritableUtils.writeVInt(output, dataType.ordinal()); <START> WritableUtils.writeVInt(output, maxLength == null ? Integer.MIN_VALUE : maxLength); <END> WritableUtils.writeVInt(output, scale == null ? Integer.MIN_VALUE : scale); output.writeBoolean(nullable); WritableUtils.writeVInt(output, position); }</code><technical_language>a constant instead define in NumberUtil QueryConstants, NO_SCALE</technical_language>

Target:
public void write(DataOutput output) throws IOException { Bytes.writeByteArray(output, name.getBytes()); Bytes.writeByteArray(output, familyName == null ? ByteUtil.EMPTY_BYTE_ARRAY : familyName.getBytes()); WritableUtils.writeVInt(output, dataType.ordinal()); WritableUtils.writeVInt(output, maxLength == null ? QueryConstants.NO_MAXLENGTH : maxLength); WritableUtils.writeVInt(output, scale == null ? QueryConstants.NO_SCALE : scale); output.writeBoolean(nullable); WritableUtils.writeVInt(output, position); }
Source:
<code>public RealMatrix normalizedPercentCoverage() { final double[][] values = reader.readDoubleMatrix(NORMALIZED_PCOV_PATH); final RealMatrix result = new Array2DRowRealMatrix(values,false); <START> if (result.getRowDimension() != targetNames.size()) { <END> throw new GATKException(String.format("wrong number of rows in normalized p-cov matrix from file '%s': %d != %d", reader.getFile(),result.getRowDimension(),targetNames.size())); } if (result.getColumnDimension() != sampleNames.size()) { throw new GATKException(String.format("wrong number of columns in normalized p-cov matrix from file '%s': %d != %d", reader.getFile(),result.getColumnDimension(),sampleNames.size())); } return result; }</code><technical_language>8 lines duplicated a times. extract a single place</technical_language>

Target:
public RealMatrix normalizedPercentCoverage() { return readMatrixAndCheckDimensions(NORMALIZED_PCOV_PATH,targetNames.size(), sampleNames.size()); }
Source:
<code>public void testNonPrintableCharsAreSorted() throws Exception { final String fieldName = "NON_PRINTABLE_CHARS"; final Field field = AvoidEscapedUnicodeCharactersCheck.class.getDeclaredField(fieldName); field.setAccessible(true); String expression = ((Pattern) field.get(null)).pattern(); final String charExpressions = "Aa,Bb,Cc,Dd,Ee,Ff"; <START> for (String charExpression : charExpressions.split(",")) { <END> final String regex = "\\[[" + charExpression + "]{2}]"; expression = expression.replaceAll(regex, charExpression.substring(0, 1)); } for (int i = 4; i > 1; i--) { final String regex = "([A-F])\\{" + i + "}"; String replacement = "$1$1{" + (i - 1) + "}"; if (i == 2) { replacement = "$1$1"; } expression = expression.replaceAll(regex, replacement); } final String[] expressionParts = expression.split("\\|"); final Pattern unicodeCharPattern = Pattern.compile("^\\\\\\\\u[0-9A-F]{4}$"); String lastChar = null; for (int i = 0; i < expressionParts.length; i++) { final String currentChar = expressionParts[i]; final Matcher matcher = unicodeCharPattern.matcher(currentChar); if (!matcher.matches()) { final String message = "Character '" + currentChar + "' (at position " + i + ") doesn't match the pattern"; assertTrue(message, matcher.matches()); } if (lastChar != null) { final String message = "Character '" + lastChar + "' should be after '" + currentChar + "', position: " + i; assertTrue(message, lastChar.compareTo(currentChar) < 0); } lastChar = currentChar; } }</code><technical_language>do new String[]{"Aa", "Bb" etc... instead of creating string splitting it</technical_language>

Target:
public void testNonPrintableCharsAreSorted() throws Exception { final Field field = TestUtil.getClassDeclaredField( AvoidEscapedUnicodeCharactersCheck.class, "NON_PRINTABLE_CHARS"); field.setAccessible(true); String expression = ((Pattern) field.get(null)).pattern(); final String[] charExpressions = {"Aa", "Bb", "Cc", "Dd", "Ee", "Ff"}; for (String charExpression : charExpressions) { final String regex = "\\[[" + charExpression + "]{2}]"; expression = expression.replaceAll(regex, charExpression.substring(0, 1)); } for (int i = 4; i > 1; i--) { final String regex = "([A-F])\\{" + i + "}"; String replacement = "$1$1{" + (i - 1) + "}"; if (i == 2) { replacement = "$1$1"; } expression = expression.replaceAll(regex, replacement); } final String[] expressionParts = expression.split("\\|"); final Pattern unicodeCharPattern = Pattern.compile("^\\\\\\\\u[0-9A-F]{4}$"); String lastChar = null; for (int i = 0; i < expressionParts.length; i++) { final String currentChar = expressionParts[i]; final Matcher matcher = unicodeCharPattern.matcher(currentChar); if (!matcher.matches()) { final String message = "Character '" + currentChar + "' (at position " + i + ") doesn't match the pattern"; assertTrue(message, matcher.matches()); } if (lastChar != null) { final String message = "Character '" + lastChar + "' should be after '" + currentChar + "', position: " + i; assertTrue(message, lastChar.compareTo(currentChar) < 0); } lastChar = currentChar; } }
Source:
<code>public void generateWriterTopology() { final StreamGraph streamGraph = buildGraph( TestSink.newBuilder().build(), runtimeExecutionMode); final StreamNode sourceNode = findNodeNameContains(streamGraph, "Source"); final StreamNode writerNode = findNodeNameContains(streamGraph, "Writer"); assertThat(streamGraph.getStreamNodes().size(), equalTo(2)); validateTopology( sourceNode, IntSerializer.class, writerNode, "Writer", StatelessWriterOperatorFactory.class, <START> ChainingStrategy.NEVER, <END> PARALLELISM, -1); }</code><technical_language>Writer chained input</technical_language>

Target:
public void generateWriterTopology() { final StreamGraph streamGraph = buildGraph( TestSink.newBuilder().build(), runtimeExecutionMode); final StreamNode sourceNode = findNodeNameContains(streamGraph, "Source"); final StreamNode writerNode = findNodeNameContains(streamGraph, "Writer"); assertThat(streamGraph.getStreamNodes().size(), equalTo(2)); validateTopology( sourceNode, IntSerializer.class, writerNode, "Writer", StatelessWriterOperatorFactory.class, PARALLELISM, -1); }
Source:
<code>private BulkExportJobEntity loadJob(String theJobUUID) { Optional<BulkExportJobEntity> jobOpt = myBulkExportJobDao.findByJobId(theJobUUID); if (!jobOpt.isPresent()) { <START> ourLog.info("Job appears to be deleted"); <END> return null; } return jobOpt.get(); }</code><technical_language>warn</technical_language>

Target:
private BulkExportJobEntity loadJob(String theJobUUID) { Optional<BulkExportJobEntity> jobOpt = myBulkExportJobDao.findByJobId(theJobUUID); if (!jobOpt.isPresent()) { ourLog.warn("Job with UUID appears to be deleted", theJobUUID); return null; } return jobOpt.get(); }
Source:
<code>private void createMesosTask(Offer offer, Request request) { TaskID taskId = TaskID.newBuilder().setValue(request.request.slave.name).build(); LOGGER.info("Launching task " + taskId.getValue() + " with URI " + joinPaths(jenkinsMaster, SLAVE_JAR_URI_SUFFIX)); TaskInfo task = TaskInfo .newBuilder() .setName("task " + taskId.getValue()) .setTaskId(taskId) .setSlaveId(offer.getSlaveId()) .addResources( Resource .newBuilder() .setName("cpus") .setType(Value.Type.SCALAR) .setScalar( Value.Scalar.newBuilder() .setValue(request.request.cpus).build()).build()) .addResources( Resource .newBuilder() .setName("mem") .setType(Value.Type.SCALAR) .setScalar( Value.Scalar .newBuilder() .setValue((1 + JVM_MEM_OVERHEAD_FACTOR) * request.request.mem) .build()).build()) .setCommand( CommandInfo .newBuilder() .setValue( <START> String.format(SLAVE_COMMAND_FORMAT, request.request.slaveJarMem, <END> getJnlpUrl(request.request.slave.name))) .addUris( CommandInfo.URI.newBuilder().setValue( joinPaths(jenkinsMaster, SLAVE_JAR_URI_SUFFIX)))).build(); List<TaskInfo> tasks = new ArrayList<TaskInfo>(); tasks.add(task); Filters filters = Filters.newBuilder().setRefuseSeconds(1).build(); driver.launchTasks(offer.getId(), tasks, filters); results.put(taskId, new Result(request.result, new Mesos.JenkinsSlave(offer.getSlaveId() .getValue()))); }</code><technical_language>confused. is slave started "slaveJarMem" instead of "request.request.mem"? account for Jenkins executor's memory? Do Jenkins executors get JVM</technical_language>

Target:
private void createMesosTask(Offer offer, Request request) { TaskID taskId = TaskID.newBuilder().setValue(request.request.slave.name).build(); LOGGER.info("Launching task " + taskId.getValue() + " with URI " + joinPaths(jenkinsMaster, SLAVE_JAR_URI_SUFFIX)); TaskInfo task = TaskInfo .newBuilder() .setName("task " + taskId.getValue()) .setTaskId(taskId) .setSlaveId(offer.getSlaveId()) .addResources( Resource .newBuilder() .setName("cpus") .setType(Value.Type.SCALAR) .setScalar( Value.Scalar.newBuilder() .setValue(request.request.cpus).build()).build()) .addResources( Resource .newBuilder() .setName("mem") .setType(Value.Type.SCALAR) .setScalar( Value.Scalar .newBuilder() .setValue((1 + JVM_MEM_OVERHEAD_FACTOR) * request.request.mem) .build()).build()) .setCommand( CommandInfo .newBuilder() .setValue( String.format(SLAVE_COMMAND_FORMAT, request.request.slaveMem, request.request.jvmArgs, getJnlpUrl(request.request.slave.name))) .addUris( CommandInfo.URI.newBuilder().setValue( joinPaths(jenkinsMaster, SLAVE_JAR_URI_SUFFIX)))).build(); List<TaskInfo> tasks = new ArrayList<TaskInfo>(); tasks.add(task); Filters filters = Filters.newBuilder().setRefuseSeconds(1).build(); driver.launchTasks(offer.getId(), tasks, filters); results.put(taskId, new Result(request.result, new Mesos.JenkinsSlave(offer.getSlaveId() .getValue()))); }
Source:
<code>public boolean isMacInUse(String mac) { lockObj.readLock().lock(); try { if (allocatedMacs.containsKey(mac) || allocatedCustomMacs.containsKey(mac)) { return true; } <START> for (String macAddress : allocatedMacs.keySet()) { <END> if (StringUtils.equalsIgnoreCase(macAddress, mac)) { return true; } } for (String macAddress : allocatedCustomMacs.keySet()) { if (StringUtils.equalsIgnoreCase(macAddress, mac)) { return true; } } return false; } finally { lockObj.readLock().unlock(); } }</code><technical_language>basically repeating check in explicit way. instead store in maps macs in format (either upper case) for that</technical_language>

Target:
public boolean isMacInUse(String mac) { lockObj.readLock().lock(); try { return allocatedMacs.containsKey(mac) || allocatedCustomMacs.containsKey(mac); } finally { lockObj.readLock().unlock(); } }
Source:
<code>public SpongeValue<Boolean> sneaking() { <START> return new SpongeValue<Boolean>(Keys.IS_SNEAKING, Boolean.FALSE, getValue()); <END> }</code><technical_language>reason box</technical_language>

Target:
public Value<Boolean> sneaking() { return new SpongeValue<Boolean>(Keys.IS_SNEAKING, false, getValue()); }
Source:
<code>private boolean isSerializableParametrized(ParametrizedTypeJavaType type) { return (type.isSubtypeOf("java.io.Serializable") || type.isSubtypeOf("java.util.Collection")) && type.typeParameters().stream().allMatch(t -> { JavaType javaType = type.substitution(t); <START> assert javaType != null; <END> return isSerializable(javaType); }); }</code><technical_language>Please remove assert statement replace lambda expression by: t -> isSerializable(type.substitution(t)); situation able retrieve substitution for of type parameter occur. However, if occurs, want rule fail analysis assertion error, want fail badly. means facing a problematic situation want a feedback afraid user it. is responsibility of semantic analysis fail if encounter impossible situation, rules. a coverage point of view, able cover cases, build it</technical_language>

Target:
private static boolean isSerializableParametrized(ParametrizedTypeJavaType type) { return (type.isSubtypeOf("java.io.Serializable") || type.isSubtypeOf("java.util.Collection")) && type.typeParameters().stream().allMatch(t -> isSerializable(type.substitution(t))); }
Source:
<code>private String getGitHistoryTopContent() { String rowTopIndex = Integer.toString(0); <START> return seleniumWebDriverHelper <END> .waitVisibility( By.xpath(String.format(Locators.HISTORY_ROW_NUMBER, rowTopIndex)), ELEMENT_TIMEOUT_SEC) .getText(); }</code><technical_language>is a method SeleniumWebDriverHelper#waitVisibilityAndGetText() is more suitable here</technical_language>

Target:
private String getGitHistoryTopContent() { String rowTopIndex = Integer.toString(0); return seleniumWebDriverHelper.waitVisibilityAndGetText( By.xpath(String.format(Locators.HISTORY_ROW_NUMBER, rowTopIndex))); }