auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public <K, V> void send(final String topic, final K key, final V value, final Headers headers, final Integer partition, final Long timestamp, final Serializer<K> keySerializer, final Serializer<V> valueSerializer) { checkForException(); final byte[] keyBytes = keySerializer.serialize(topic, headers, key); final byte[] valBytes = valueSerializer.serialize(topic, headers, value); final ProducerRecord<byte[], byte[]> serializedRecord = new ProducerRecord<>(topic, partition, timestamp, keyBytes, valBytes, headers); transactionManager.send(serializedRecord, (metadata, exception) -> { if (sendException != null) { return; } if (exception == null) { final TopicPartition tp = new TopicPartition(metadata.topic(), metadata.partition()); offsets.put(tp, metadata.offset()); } else { recordSendError(topic, exception, serializedRecord); log.trace("Failed record: (key value timestamp {}) topic=[{}] partition=[{}]", key, value, timestamp, topic, partition); } }); }

Target:
public <K, V> void send(final String topic, final K key, final V value, final Headers headers, final Integer partition, final Long timestamp, final Serializer<K> keySerializer, final Serializer<V> valueSerializer) { checkForException(); final byte[] keyBytes; final byte[] valBytes; try { keyBytes = keySerializer.serialize(topic, headers, key); valBytes = valueSerializer.serialize(topic, headers, value); } catch (final RuntimeException exception) { final String errorMessage = String.format(SEND_EXCEPTION_MESSAGE, topic, taskId, exception.toString()); throw new StreamsException(errorMessage, exception); } final ProducerRecord<byte[], byte[]> serializedRecord = new ProducerRecord<>(topic, partition, timestamp, keyBytes, valBytes, headers); streamsProducer.send(serializedRecord, (metadata, exception) -> { if (sendException != null) { return; } if (exception == null) { final TopicPartition tp = new TopicPartition(metadata.topic(), metadata.partition()); offsets.put(tp, metadata.offset()); } else { recordSendError(topic, exception, serializedRecord); log.trace("Failed record: (key value timestamp {}) topic=[{}] partition=[{}]", key, value, timestamp, topic, partition); } }); }
Source:
private Guid findChildCommandByActionType(VdcActionType commandType, List<Guid> childCmdIds) { for (Guid cmdId : childCmdIds) { CommandEntity commandEntity = CommandCoordinatorUtil.getCommandEntity(cmdId); if (commandEntity.getCommandType() == commandType) { return cmdId; } } return null; }

Target:
private Guid findChildCommandByActionType(VdcActionType commandType, List<Guid> childCmdIds) { return childCmdIds.stream() .filter(cmdId -> CommandCoordinatorUtil.getCommandEntity(cmdId).getCommandType() == commandType) .findFirst().orElse(null); }
Source:
private List<DiskImage> getDiskList() { List<DiskImage> disksList = new ArrayList<>(); for (DiskImage diskImage : diskInfoDestinationMap.values()) { DiskImage clone = DiskImage.copyOf(diskImage); clone.setVolumeType(VolumeType.Sparse); if (getDiskStorageDomain(diskImage).getStorageType().isBlockDomain()) { clone.setvolumeFormat(VolumeFormat.COW); } else { clone.setvolumeFormat(VolumeFormat.RAW); } } return disksList; }

Target:
private List<DiskImage> getDiskList() { List<DiskImage> disksList = new ArrayList<>(); for (DiskImage diskImage : diskInfoDestinationMap.values()) { DiskImage clone = DiskImage.copyOf(diskImage); clone.setVolumeType(VolumeType.Sparse); if (getDiskStorageDomain(diskImage).getStorageType().isBlockDomain()) { clone.setvolumeFormat(VolumeFormat.COW); } } return disksList; }
Source:
private void reloadData(Quester quester) { if (quester == null) return; quester.saveData(); quester.loadData(); }

Target:
private void reloadData(Quester quester) { if (quester == null) { return; } quester.saveData(); quester.loadData(); }
Source:
public void render(GraphicsContext gc) { if (isDead()) { return; } getBoundingArea().setRotation(behaviour); if (sprite != null) { drawRotatedImage(gc, sprite, getBoundingArea()); } }

Target:
public void render(GraphicsContext gc) { if (isDead()) { return; } getBoundingArea().setRotation(behaviour); if (sprite != null) { drawRotatedImage(gc, sprite, getBoundingArea()); } else { super.render(gc); } }
Source:
protected IStatus run(IProgressMonitor monitor) { String[][] configurations = fInfo.targets; if (configurations == null) configurations = new String[][] {{TargetPlatform.getOS(), TargetPlatform.getWS(), TargetPlatform.getOSArch(), TargetPlatform.getNL()}}; cleanupBuildRepo(); errorMessage = null; SubMonitor subMonitor = SubMonitor.convert(monitor, 10); try { String featureID = "org.eclipse.pde.container.feature"; fFeatureLocation = fBuildTempLocation + File.separator + featureID; createFeature(featureID, fFeatureLocation, configurations, fProduct.includeLaunchers()); createBuildPropertiesFile(fFeatureLocation, configurations); doExport(featureID, null, fFeatureLocation, configurations, subMonitor.newChild(8)); } catch (IOException e) { PDECore.log(e); } catch (InvocationTargetException e) { return new Status(IStatus.ERROR, PDECore.PLUGIN_ID, PDECoreMessages.FeatureBasedExportOperation_ProblemDuringExport, e.getTargetException()); } catch (CoreException e) { if (errorMessage != null) return parseErrorMessage(e); return e.getStatus(); } finally { for (int j = 0; j < fInfo.items.length; j++) { try { deleteBuildFiles(fInfo.items[j]); } catch (CoreException e) { PDECore.log(e); } } cleanup(null, subMonitor.newChild(1)); } if (hasAntErrors()) { return new Status(IStatus.WARNING, PDECore.PLUGIN_ID, NLS.bind(PDECoreMessages.FeatureExportOperation_CompilationErrors, fInfo.destinationDirectory)); } errorMessage = null; return Status.OK_STATUS; }

Target:
protected IStatus run(IProgressMonitor monitor) { String[][] configurations = fInfo.targets; if (configurations == null) configurations = new String[][] {{TargetPlatform.getOS(), TargetPlatform.getWS(), TargetPlatform.getOSArch(), TargetPlatform.getNL()}}; cleanupBuildRepo(); errorMessage = null; SubMonitor subMonitor = SubMonitor.convert(monitor, 9); try { String featureID = "org.eclipse.pde.container.feature"; fFeatureLocation = fBuildTempLocation + File.separator + featureID; createFeature(featureID, fFeatureLocation, configurations, fProduct.includeLaunchers()); createBuildPropertiesFile(fFeatureLocation, configurations); doExport(featureID, null, fFeatureLocation, configurations, subMonitor.newChild(8)); } catch (IOException e) { PDECore.log(e); } catch (InvocationTargetException e) { return new Status(IStatus.ERROR, PDECore.PLUGIN_ID, PDECoreMessages.FeatureBasedExportOperation_ProblemDuringExport, e.getTargetException()); } catch (CoreException e) { if (errorMessage != null) return parseErrorMessage(e); return e.getStatus(); } finally { for (int j = 0; j < fInfo.items.length; j++) { try { deleteBuildFiles(fInfo.items[j]); } catch (CoreException e) { PDECore.log(e); } } cleanup(null, subMonitor.newChild(1)); } if (hasAntErrors()) { return new Status(IStatus.WARNING, PDECore.PLUGIN_ID, NLS.bind(PDECoreMessages.FeatureExportOperation_CompilationErrors, fInfo.destinationDirectory)); } errorMessage = null; return Status.OK_STATUS; }
Source:
public PointList getPolygonPoints() { if ((getOwner().getChildren().get(0)) instanceof IRoundedRectangleFigure) { IRoundedRectangleFigure packageFigure = ((IRoundedRectangleFigure) ((IFigure) getOwner().getChildren().get(0))); Rectangle packageHeader = packageFigure.getPackageHeader().getCopy(); packageFigure.translateToAbsolute(packageHeader); if (!packageHeader.isEmpty()) { PointList points = new PointList(5); Rectangle anchorableRectangle = getBox(); points.addPoint(anchorableRectangle.x, anchorableRectangle.y); points.addPoint(anchorableRectangle.x + packageHeader.width, anchorableRectangle.y); points.addPoint(anchorableRectangle.x + packageHeader.width, anchorableRectangle.y + packageHeader.height); points.addPoint(anchorableRectangle.x + anchorableRectangle.width, anchorableRectangle.y + packageHeader.height); points.addPoint(anchorableRectangle.x + anchorableRectangle.width, anchorableRectangle.y + anchorableRectangle.height); points.addPoint(anchorableRectangle.x, anchorableRectangle.y + anchorableRectangle.height); points.addPoint(anchorableRectangle.x, anchorableRectangle.y); return points; } else { return super.getPolygonPoints(); } } else { return super.getPolygonPoints(); } }

Target:
public PointList getPolygonPoints() { if (getFigure() instanceof IRoundedRectangleFigure) { IRoundedRectangleFigure packageFigure = ((IRoundedRectangleFigure) ((IFigure) getFigure())); Rectangle packageHeader = packageFigure.getPackageHeader().getCopy(); packageFigure.translateToAbsolute(packageHeader); if (!packageHeader.isEmpty()) { PointList points = new PointList(5); Rectangle anchorableRectangle = getBox(); points.addPoint(anchorableRectangle.x, anchorableRectangle.y); points.addPoint(anchorableRectangle.x + packageHeader.width, anchorableRectangle.y); points.addPoint(anchorableRectangle.x + packageHeader.width, anchorableRectangle.y + packageHeader.height); points.addPoint(anchorableRectangle.x + anchorableRectangle.width, anchorableRectangle.y + packageHeader.height); points.addPoint(anchorableRectangle.x + anchorableRectangle.width, anchorableRectangle.y + anchorableRectangle.height); points.addPoint(anchorableRectangle.x, anchorableRectangle.y + anchorableRectangle.height); points.addPoint(anchorableRectangle.x, anchorableRectangle.y); return points; } else { return super.getPolygonPoints(); } } else { return super.getPolygonPoints(); } }
Source:
public void testReflectingOnlyCurrentLayer() { PointF screenPointLeft = new PointF(displayWidth / 2 - 10, displayHeight / 2 - 5); PointF screenPointRight = new PointF(displayWidth / 2 + 10, displayHeight / 2 - 5); onView(isRoot()).perform(touchAt(screenPointLeft)); onLayerMenuView().performOpen(); onLayerMenuView().performAddLayer(); onLayerMenuView().performClose(); onView(isRoot()).perform(touchAt(screenPointRight)); ToolBarViewInteraction.onToolBarView().performSelectTool(ToolType.TRANSFORM); try { Thread.sleep(100); } catch (Exception e) { e.printStackTrace(); Log.d("LayerIntegrationTest", e.getMessage()); } onView(withId(R.id.transform_flip_vertical_btn)).perform(click()); ToolBarViewInteraction.onToolBarView().performSelectTool(ToolType.PIPETTE); onView(isRoot()).perform(touchAt(screenPointRight)); int color = PaintroidApplication.currentTool.getDrawPaint().getColor(); assertEquals("Color should be transparent", Color.TRANSPARENT, color); onView(withId(R.id.btn_top_undo)).perform(click()); onView(isRoot()).perform(touchAt(screenPointRight)); color = PaintroidApplication.currentTool.getDrawPaint().getColor(); assertEquals("Color should be black", Color.BLACK, color); onView(withId(R.id.btn_top_redo)).perform(click()); onView(isRoot()).perform(touchAt(screenPointRight)); color = PaintroidApplication.currentTool.getDrawPaint().getColor(); assertEquals("Color should be transparent", Color.TRANSPARENT, color); }

Target:
public void testReflectingOnlyCurrentLayer() { PointF screenPointLeft = new PointF(displayWidth / 2 - 10, displayHeight / 2 - 5); PointF screenPointRight = new PointF(displayWidth / 2 + 10, displayHeight / 2 - 5); onView(isRoot()).perform(touchAt(screenPointLeft)); onLayerMenuView().performOpen(); onLayerMenuView().performAddLayer(); onLayerMenuView().performClose(); onView(isRoot()).perform(touchAt(screenPointRight)); ToolBarViewInteraction.onToolBarView().performSelectTool(ToolType.TRANSFORM); try { Thread.sleep(100); } catch (Exception e) { Log.e("LayerIntegrationTest", e.getMessage()); } onView(withId(R.id.transform_flip_vertical_btn)).perform(click()); ToolBarViewInteraction.onToolBarView().performSelectTool(ToolType.PIPETTE); onView(isRoot()).perform(touchAt(screenPointRight)); int color = PaintroidApplication.currentTool.getDrawPaint().getColor(); assertEquals("Color should be transparent", Color.TRANSPARENT, color); onView(withId(R.id.btn_top_undo)).perform(click()); onView(isRoot()).perform(touchAt(screenPointRight)); color = PaintroidApplication.currentTool.getDrawPaint().getColor(); assertEquals("Color should be black", Color.BLACK, color); onView(withId(R.id.btn_top_redo)).perform(click()); onView(isRoot()).perform(touchAt(screenPointRight)); color = PaintroidApplication.currentTool.getDrawPaint().getColor(); assertEquals("Color should be transparent", Color.TRANSPARENT, color); }
Source:
public <K> HashMap<K, ImList<T>> groupBy(Function1<? super T, K> f) { HashMap<K, ImList<T>> m = new HashMap<>(); for (final T elem : backingList) { final K key = f.apply(elem); final ImList<T> val = m.get(key); if (val == null) { m.put(key, create(elem)); } else { m.put(key, val.append(elem)); } } return m; }

Target:
public <K> HashMap<K, ImList<T>> groupBy(Function1<? super T, K> f) { HashMap<K, ImList<T>> m = new HashMap<>(); for (final T elem : backingList) { final K key = f.apply(elem); m.put(key, ImOption.apply(m.get(key)).map( lst -> lst.append(elem) ).getOrElse(() -> create(elem))); } return m; }
Source:
public ArrayList<String> checkListTexts() { ArrayList<String> list = new ArrayList<String>(CHECKLIST_SIZE); list.add("&1) the correct dialog displays."); list.add("&2) the dialog is an appropriate size for the required resolution (1024x768)."); list.add("&3) the texts are correct and not cut off."); list.add("&4) all strings have been externalized properly."); list.add("&5) all the widgets are viewable and not cut off."); return list; }

Target:
public List<String> checkListTexts() { List<String> list = new ArrayList<String>(CHECKLIST_SIZE); list.add("&1) the correct dialog displays."); list.add("&2) the dialog is an appropriate size for the required resolution (1024x768)."); list.add("&3) the texts are correct and not cut off."); list.add("&4) all strings have been externalized properly."); list.add("&5) all the widgets are viewable and not cut off."); return list; }
Source:
private void updateBoundedGarbageSize(SMRGarbageEntry garbageEntry) { if (resetBoundedGarbageSize) { boundedGarbageSize = totalGarbageSize; resetBoundedGarbageSize = false; } boundedGarbageSize += garbageEntry.getGarbageSizeUpTo(nextCompactionUpperBound); }

Target:
private void updateBoundedGarbageSize(SMRGarbageEntry garbageEntry) { if (compactionUpperBound != nextCompactionUpperBound) { compactionUpperBound = nextCompactionUpperBound; boundedGarbageSize = totalGarbageSize; } boundedGarbageSize += garbageEntry.getGarbageSizeUpTo(compactionUpperBound); }
Source:
public LdapObjectDefinitionBuilder(String id) { this.id = requireNonNull(id, "id is null"); }

Target:
private LdapObjectDefinitionBuilder(String id) { this.id = requireNonNull(id, "id is null"); }
Source:
public ImmutableWorkerInfo findWorkerForTask( final WorkerTaskRunnerConfig config, final ImmutableMap<String, ImmutableWorkerInfo> zkWorkers, final Task task ) { Map<String, Integer> restSlots = new TreeMap<String, Integer>( new Comparator<String>() { @Override public int compare(String o1, String o2) { int diff = o2.length() - o1.length(); if (diff != 0) { return diff; } return o1.compareTo(o2); } } ) { { Map<String, Integer> configs = limitConfig.getLimit(); for (String taskIdPrefix: configs.keySet()) { put(taskIdPrefix, configs.get(taskIdPrefix)); } } }; for (ImmutableWorkerInfo zkWorker: zkWorkers.values()) { for (String taskId: zkWorker.getRunningTasks()) { for (String taskIdPrefix: restSlots.keySet()) { if (taskId.startsWith(taskIdPrefix)) { restSlots.put(taskIdPrefix, restSlots.get(taskIdPrefix) - 1); } } } } String taskId = task.getId(); for (String taskIdPrefix: restSlots.keySet()) { if (taskId.startsWith(taskIdPrefix)) { if (restSlots.getOrDefault(taskIdPrefix, 1) <= 0) { return null; } } } final TreeSet<ImmutableWorkerInfo> sortedWorkers = Sets.newTreeSet( Comparator.comparing(ImmutableWorkerInfo::getAvailableCapacity).reversed() .thenComparing(zkWorker -> zkWorker.getWorker().getVersion())); sortedWorkers.addAll(zkWorkers.values()); final String minWorkerVer = config.getMinWorkerVersion(); for (ImmutableWorkerInfo zkWorker : sortedWorkers) { if (zkWorker.canRunTask(task) && zkWorker.isValidVersion(minWorkerVer)) { return zkWorker; } } return null; }

Target:
public ImmutableWorkerInfo findWorkerForTask( final WorkerTaskRunnerConfig config, final ImmutableMap<String, ImmutableWorkerInfo> zkWorkers, final Task task ) { Map<String, Integer> rest = new TreeMap<String, Integer>( Comparator.comparing(String::length).reversed().thenComparing(Comparator.naturalOrder()) ); Map<String, Integer> configs = limitConfig.getLimit(); for (String taskIdPrefix: configs.keySet()) { rest.put(taskIdPrefix, configs.get(taskIdPrefix)); } for (ImmutableWorkerInfo zkWorker: zkWorkers.values()) { for (String taskId: zkWorker.getRunningTasks()) { for (String taskIdPrefix: rest.keySet()) { if (taskId.startsWith(taskIdPrefix)) { rest.put(taskIdPrefix, rest.get(taskIdPrefix) - 1); } } } } String taskId = task.getId(); for (String taskIdPrefix: rest.keySet()) { if (taskId.startsWith(taskIdPrefix)) { if (rest.getOrDefault(taskIdPrefix, 1) <= 0) { return null; } } } final TreeSet<ImmutableWorkerInfo> sortedWorkers = Sets.newTreeSet( Comparator.comparing(ImmutableWorkerInfo::getAvailableCapacity).reversed() .thenComparing(zkWorker -> zkWorker.getWorker().getVersion())); sortedWorkers.addAll(zkWorkers.values()); final String minWorkerVer = config.getMinWorkerVersion(); for (ImmutableWorkerInfo zkWorker : sortedWorkers) { if (zkWorker.canRunTask(task) && zkWorker.isValidVersion(minWorkerVer)) { return zkWorker; } } return null; }
Source:
public int hashCode() { return 37 * pattern.hashCode() + factField.hashCode(); }

Target:
public int hashCode() { final int result = 37 * pattern.hashCode() + factField.hashCode(); return ~~result; }
Source:
private int getOrCreateLabelId( String labelName ) throws ProcedureException { try { return ktx.tokenWrite().labelGetOrCreateForName( labelName ); } catch ( TooManyLabelsException | IllegalTokenNameException e ) { throw new ProcedureException( e.status(), e, "" ); } }

Target:
private int getOrCreateLabelId( String labelName ) throws ProcedureException { try { return ktx.tokenWrite().labelGetOrCreateForName( labelName ); } catch ( TooManyLabelsException | IllegalTokenNameException e ) { throw new ProcedureException( e.status(), e, e.getMessage() ); } }
Source:
public boolean validate(IOperationMonitor monitor) throws BugzillaRestException { RepositoryLocation location = getClient().getLocation(); if (location.getBooleanPropery(IBugzillaRestConstants.REPOSITORY_USE_API_KEY)) { UserCredentials credentials = location.getCredentials(AuthenticationType.REPOSITORY); if (credentials == null) { throw new IllegalStateException("Authentication requested without valid credentials"); } String url = MessageFormat.format("/valid_login?login={0}&api_key={1}", new Object[] { credentials.getUserName(), location.getProperty(IBugzillaRestConstants.REPOSITORY_API_KEY) }); BooleanResult response = new BugzillaRestUnauthenticatedGetRequest<BooleanResult>(client, url, new TypeToken<BooleanResult>() { }).run(monitor); return response.getResult(); } else { LoginToken validateResponse = new BugzillaRestLoginRequest(client).run(monitor); if (validateResponse != null && !Strings.isNullOrEmpty(validateResponse.getId())) { String url = MessageFormat.format("/logout?token={0}", new Object[] { validateResponse.getToken() }); new BugzillaRestUnauthenticatedGetRequest<BooleanResult>(client, url, new TypeToken<BooleanResult>() { }).run(monitor); return true; } } return false; }

Target:
public boolean validate(IOperationMonitor monitor) throws BugzillaRestException { RepositoryLocation location = getClient().getLocation(); if (location.getBooleanPropery(IBugzillaRestConstants.REPOSITORY_USE_API_KEY)) { UserCredentials credentials = location.getCredentials(AuthenticationType.REPOSITORY); Preconditions.checkState(credentials != null, "Authentication requested without valid credentials"); String url = MessageFormat.format("/valid_login?login={0}&api_key={1}", credentials.getUserName(), location.getProperty(IBugzillaRestConstants.REPOSITORY_API_KEY)); BooleanResult response = new BugzillaRestUnauthenticatedGetRequest<BooleanResult>(client, url, new TypeToken<BooleanResult>() { }).run(monitor); return response.getResult(); } else { LoginToken validateResponse = new BugzillaRestLoginRequest(client).run(monitor); if (validateResponse != null && !Strings.isNullOrEmpty(validateResponse.getId())) { String url = MessageFormat.format("/logout?token={0}", validateResponse.getToken()); new BugzillaRestUnauthenticatedGetRequest<BooleanResult>(client, url, new TypeToken<BooleanResult>() { }).run(monitor); return true; } } return false; }
Source:
public List<Reference> parseArticleReferences(InputStream xml) throws ParserConfigurationException, IOException, SAXException, XmlContentException { Objects.requireNonNull(xml); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse(xml); doc.getDocumentElement().normalize(); List<Reference> references = new ArrayList<>(); List<Node> refListNodes = NodeListAdapter.wrap(doc.getElementsByTagName("ref-list")); if (ParseXmlUtil.isNullOrEmpty(refListNodes)) { log.info("No <ref-list> element was found in the xml."); return references; } if (refListNodes.size() > 1) { throw new XmlContentException("More than one <ref-list> element was found in the xml."); } Node refListNode = refListNodes.get(0); if (refListNode.getNodeType() != Node.ELEMENT_NODE) { throw new XmlContentException("<ref-list> is not an element."); } Element refListElement = (Element) refListNode; List<Node> refNodes = NodeListAdapter.wrap(refListElement.getElementsByTagName("ref")); references = refNodes.stream() .map(ref -> { try { return parseReferenceService.buildReferences((Element) ref); } catch (XMLParseException e) { throw new RuntimeException(e); } }) .flatMap(r -> r.stream()).collect(Collectors.toList()); return references; }

Target:
public List<Reference> parseArticleReferences(InputStream xml) throws IOException { Objects.requireNonNull(xml); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); Document doc; try { DocumentBuilder builder = factory.newDocumentBuilder(); doc = builder.parse(xml); } catch (ParserConfigurationException | SAXException e) { throw new RuntimeException(e); } doc.getDocumentElement().normalize(); List<Reference> references = new ArrayList<>(); List<Node> refListNodes = NodeListAdapter.wrap(doc.getElementsByTagName("ref-list")); if (ParseXmlUtil.isNullOrEmpty(refListNodes)) { log.info("No <ref-list> element was found in the xml."); return references; } if (refListNodes.size() > 1) { throw new XmlContentException("More than one <ref-list> element was found in the xml."); } Node refListNode = refListNodes.get(0); if (refListNode.getNodeType() != Node.ELEMENT_NODE) { throw new XmlContentException("<ref-list> is not an element."); } Element refListElement = (Element) refListNode; List<Node> refNodes = NodeListAdapter.wrap(refListElement.getElementsByTagName("ref")); references = refNodes.stream() .map(ref -> { try { return parseReferenceService.buildReferences((Element) ref); } catch (XMLParseException e) { throw new RuntimeException(e); } }) .flatMap(r -> r.stream()).collect(Collectors.toList()); return references; }
Source:
public Integer resolveLocationId(PL pl) throws HL7Exception { String pointOfCare = pl.getPointOfCare().getValue(); String facility = pl.getFacility().getUniversalID().getValue(); try { Integer locationId = Integer.valueOf(pointOfCare); if (locationId == null) throw new Exception(); return locationId; } }

Target:
public Integer resolveLocationId(PL pl) throws HL7Exception { String pointOfCare = pl.getPointOfCare().getValue(); String facility = pl.getFacility().getUniversalID().getValue(); try { Integer locationId = Integer.valueOf(pointOfCare); if (locationId == null) throw new Exception(); return locationId; } catch (Exception ex) { if (facility == null) { throw new HL7Exception("Error trying to treat PL.pointOfCare '" + pointOfCare + "' as a location.location_id", ex); } } try { Location l = Context.getLocationService().getLocation(facility); if (l == null) { log.debug("Couldn't find a location named '" + facility + "'"); } return l == null ? null : l.getLocationId(); } catch (Exception ex) { log.error("Error trying to treat PL.facility '" + facility + "' as a location.name", ex); return null; } }
Source:
public void testSortMilestone1() { List<TurboIssue> issues = testModel.getIssues(); TurboIssue issue6 = new TurboIssue("testrepo/testrepo", 6, "Issue6"); TurboIssue issue7 = new TurboIssue("testrepo/testrepo", 7, "Issue7"); issue7.setMilestone(testModel.getMilestones().get(3)); issues.add(issue6); issues.add(issue7); Comparator<TurboIssue> comparator = getComparatorForSortQualifier("sort:milestone,id"); Collections.shuffle(issues); Collections.sort(issues, comparator); assertEquals("[#3 Issue3, #2 Issue2, #1 Issue1, #4 Issue4, #7 Issue7, #5 Issue5, #6 Issue6]", issues.toString()); }

Target:
public void testSortMilestone1() { List<TurboIssue> issues = testModel.getIssues(); TurboIssue issue6 = new TurboIssue("testrepo/testrepo", 6, "Issue6"); TurboIssue issue7 = new TurboIssue("testrepo/testrepo", 7, "Issue7"); issue7.setMilestone(testModel.getMilestones().get(3)); issues.add(issue6); issues.add(issue7); Comparator<TurboIssue> comparator = getComparatorForSortQualifier("sort:milestone,id"); Collections.shuffle(issues); Collections.sort(issues, comparator); List<Integer> expected = Arrays.asList(3, 2, 1, 4, 7, 5, 6); List<Integer> actual = issues.stream().map(TurboIssue::getId).collect(Collectors.toList()); assertEquals(expected, actual); }
Source:
public void testMultiBlock_readPastEnd() throws IOException { byte[] uncompressedData = new byte[16 * BLOCK_SIZE]; fillWithCompressibleData(uncompressedData); initializeStreams(uncompressedData); byte[] decompressedData = new byte[17 * BLOCK_SIZE]; int bytesRead = ByteStreams.read(decompressingStream, decompressedData, 0, decompressedData.length); assertEquals(uncompressedData.length, bytesRead); assertArrayEquals(uncompressedData, Arrays.copyOf(decompressedData, bytesRead)); }

Target:
public void testMultiBlock_readPastEnd() throws Exception { byte[] uncompressedData = new byte[16 * BLOCK_SIZE]; fillWithCompressibleData(uncompressedData); initializeStreams(uncompressedData); byte[] decompressedData = new byte[17 * BLOCK_SIZE]; int bytesRead = ByteStreams.read(decompressingStream, decompressedData, 0, decompressedData.length); assertEquals(uncompressedData.length, bytesRead); assertArrayEquals(uncompressedData, Arrays.copyOf(decompressedData, bytesRead)); }
Source:
protected void eventHandle(@NonNull ITmfEvent event) { String name = event.getName(); long inc; if (name.equals(fLayout.eventKmemPageAlloc())) { inc = PAGE_SIZE; } else if (name.equals(fLayout.eventKmemPageFree())) { inc = -PAGE_SIZE; } else { return; } try { ITmfStateSystemBuilder ss = checkNotNull(getStateSystemBuilder()); long ts = event.getTimestamp().getValue(); Integer tidField = KernelTidAspect.INSTANCE.resolve(event); String tid; if (tidField == null) { tid = "other"; } else { tid = tidField.toString(); } int tidQuark = ss.getQuarkAbsoluteAndAdd(tid); StateSystemBuilderUtils.incrementAttributeLong(ss, ts, tidQuark, inc); long currentMemoryValue = ss.queryOngoingState(tidQuark).unboxLong(); int lowestMemoryQuark = ss.getQuarkRelativeAndAdd(tidQuark, KernelMemoryAnalysisModule.THREAD_LOWEST_MEMORY_VALUE); ITmfStateValue lowestMemoryValue = ss.queryOngoingState(lowestMemoryQuark); long previousLowest = lowestMemoryValue.isNull() ? 0 : lowestMemoryValue.unboxLong(); if (previousLowest > currentMemoryValue) { ss.modifyAttribute(ts, TmfStateValue.newValueLong(currentMemoryValue), lowestMemoryQuark); } } catch (AttributeNotFoundException e) { Activator.getDefault().logError(e.getMessage(), e); } }

Target:
protected void eventHandle(@NonNull ITmfEvent event) { String name = event.getName(); long inc; if (name.equals(fLayout.eventKmemPageAlloc())) { inc = PAGE_SIZE; } else if (name.equals(fLayout.eventKmemPageFree())) { inc = -PAGE_SIZE; } else { return; } try { ITmfStateSystemBuilder ss = checkNotNull(getStateSystemBuilder()); long ts = event.getTimestamp().getValue(); Integer tidField = KernelTidAspect.INSTANCE.resolve(event); String tid; if (tidField == null) { tid = OTHER_TID; } else { tid = tidField.toString(); } int tidQuark = ss.getQuarkAbsoluteAndAdd(tid); StateSystemBuilderUtils.incrementAttributeLong(ss, ts, tidQuark, inc); long currentMemoryValue = ss.queryOngoingState(tidQuark).unboxLong(); int lowestMemoryQuark = ss.getQuarkRelativeAndAdd(tidQuark, KernelMemoryAnalysisModule.THREAD_LOWEST_MEMORY_VALUE); ITmfStateValue lowestMemoryValue = ss.queryOngoingState(lowestMemoryQuark); long previousLowest = lowestMemoryValue.isNull() ? 0 : lowestMemoryValue.unboxLong(); if (previousLowest > currentMemoryValue) { ss.modifyAttribute(ts, TmfStateValue.newValueLong(currentMemoryValue), lowestMemoryQuark); } } catch (AttributeNotFoundException e) { Activator.getDefault().logError(e.getMessage(), e); } }
Source:
public void setMapType(MapType type) { String webType; if (type == MapType.MAP_TYPE_NORMAL) { webType = "Normal"; } else if (type == MapType.MAP_TYPE_SATELLITE) { webType = "Satellite"; } else if (type == MapType.MAP_TYPE_TERRAIN) { webType = "Terrain"; } else { webType = "Normal"; } webView.loadUrl(String.format(Locale.US, "javascript:setMapTypeId('%1$s');", webType)); }

Target:
public void setMapType(MapType type) { String webType = null; switch (type) { case MAP_TYPE_NORMAL: webType = "Normal"; break; case MAP_TYPE_SATELLITE: webType = "Satellite"; break; case MAP_TYPE_TERRAIN: webType = "Terrain"; break; } webView.loadUrl(String.format(Locale.US, "javascript:setMapTypeId('%1$s');", webType)); }
Source:
private RowExpression rewrite(RowExpression expression, ConnectorSession session) { RowExpression optimized = optimizer.optimize(expression, SERIALIZABLE, session); if (optimized instanceof ConstantExpression || !BooleanType.BOOLEAN.equals(optimized.getType())) { return optimized; } return RowExpressionTreeRewriter.rewriteWith(logicalExpressionRewriter, optimized, true); }

Target:
private RowExpression rewrite(RowExpression expression, ConnectorSession session) { RowExpression optimizedRowExpression = optimizer.optimize(expression, SERIALIZABLE, session); if (optimizedRowExpression instanceof ConstantExpression || !BooleanType.BOOLEAN.equals(optimizedRowExpression.getType())) { return optimizedRowExpression; } return RowExpressionTreeRewriter.rewriteWith(logicalExpressionRewriter, optimizedRowExpression, true); }
Source:
public SecurityGroup addIpPermission(IpProtocol protocol, int startPort, int endPort, Multimap<String, String> tenantIdGroupNamePairs, Iterable<String> ipRanges, Iterable<String> groupIds, SecurityGroup group) { String region = AWSUtils.getRegionFromLocationOrNull(group.getLocation()); String name = group.getName(); String id = Iterables.get(client.getSecurityGroupApi().get().describeSecurityGroupsInRegion(region, name), 0).getId(); IpPermission.Builder builder = IpPermission.builder(); builder.ipProtocol(protocol); builder.fromPort(startPort); builder.toPort(endPort); if (Iterables.size(ipRanges) > 0) { for (String cidr : ipRanges) { builder.cidrBlock(cidr); } } if (tenantIdGroupNamePairs.size() > 0) { for (String userId : tenantIdGroupNamePairs.keySet()) { for (String groupName : tenantIdGroupNamePairs.get(userId)) { builder.tenantIdGroupNamePair(userId, groupName); } } } client.getSecurityGroupApi().get().authorizeSecurityGroupIngressInRegion(region, id, builder.build()); return getSecurityGroupById(new RegionAndName(region, group.getName()).slashEncode()); }

Target:
public SecurityGroup addIpPermission(IpProtocol protocol, int startPort, int endPort, Multimap<String, String> tenantIdGroupNamePairs, Iterable<String> ipRanges, Iterable<String> groupIds, SecurityGroup group) { String region = AWSUtils.getRegionFromLocationOrNull(group.getLocation()); String name = group.getName(); String id = groupNameToId.apply(new RegionAndName(region, name).slashEncode()); IpPermission.Builder builder = IpPermission.builder(); builder.ipProtocol(protocol); builder.fromPort(startPort); builder.toPort(endPort); if (Iterables.size(ipRanges) > 0) { for (String cidr : ipRanges) { builder.cidrBlock(cidr); } } if (tenantIdGroupNamePairs.size() > 0) { for (String userId : tenantIdGroupNamePairs.keySet()) { for (String groupName : tenantIdGroupNamePairs.get(userId)) { builder.tenantIdGroupNamePair(userId, groupName); } } } client.getSecurityGroupApi().get().authorizeSecurityGroupIngressInRegion(region, id, builder.build()); return getSecurityGroupById(new RegionAndName(region, group.getName()).slashEncode()); }
Source:
public Context currentContext() { return context; }

Target:
public Context currentContext() { return this.context; }
Source:
public int getPort() { checkNotNull(server); return server.getListenAddress().getPort(); }

Target:
public int getPort() { verifyServerState(); return server.getListenAddress().getPort(); }
Source:
public List<Suggestion> enhanceResults(List<Suggestion> results, String query) { LinkedList<Suggestion> enhanced = new LinkedList<>(results); LiteralSuggestion literal = getMgrsSuggestion(query); if (literal != null && literal.hasGeo()) { enhanced.addFirst(literal); } return enhanced; }

Target:
public void enhanceResults(List<Suggestion> results, String query) { final LiteralSuggestion literal = getMgrsSuggestion(query); if (literal != null && literal.hasGeo()) { LOGGER.trace("Adding the MGRS suggestion to results [{}]", literal); results.add(0, literal); } }
Source:
private void copyComment(TaggedValuePointable tvp, NodeTreePointable ntp, IMutableValueStorage mvs) throws IOException { CommentNodeBuilder cnb = new CommentNodeBuilder(); VoidPointable vp = ppool.takeOne(VoidPointable.class); TextOrCommentNodePointable tcnp = ppool.takeOne(TextOrCommentNodePointable.class); tvp.getValue(tcnp); tcnp.getValue(ntp, vp); cnb.reset(mvs); cnb.setValue(vp); ppool.giveBack(vp); ppool.giveBack(tcnp); }

Target:
private void copyComment(TaggedValuePointable tvp, NodeTreePointable ntp, IMutableValueStorage mvs) throws IOException { VoidPointable vp = ppool.takeOne(VoidPointable.class); TextOrCommentNodePointable tcnp = ppool.takeOne(TextOrCommentNodePointable.class); tvp.getValue(tcnp); tcnp.getValue(ntp, vp); cnb.reset(mvs); cnb.setValue(vp); ppool.giveBack(vp); ppool.giveBack(tcnp); }
Source:
private int evictExpiredInternal(int maxIterationCount, long now) { initExpirationIterator(); int processedCount = 0; LinkedList<Map.Entry<Data, R>> records = new LinkedList<Map.Entry<Data, R>>(); while (expirationIterator.hasNext()) { Map.Entry<Data, R> record = expirationIterator.next(); records.add(record); processedCount++; if (processedCount >= maxIterationCount) { break; } } int evictedCount = 0; while (!records.isEmpty()) { Map.Entry<Data, R> record = records.poll(); Data key = record.getKey(); R value = record.getValue(); boolean expired = evictIfExpired(key, value, now); if (expired) { accumulateOrSendExpiredKeysToBackup(key, value); evictedCount++; } } return evictedCount; }

Target:
private int evictExpiredInternal(int maxIterationCount, long now) { initExpirationIterator(); int processedCount = 0; LinkedList<Map.Entry<Data, R>> records = new LinkedList<Map.Entry<Data, R>>(); while (expirationIterator.hasNext() && processedCount < maxIterationCount) { Map.Entry<Data, R> record = expirationIterator.next(); records.add(record); processedCount++; } int evictedCount = 0; while (!records.isEmpty()) { Map.Entry<Data, R> record = records.poll(); Data key = record.getKey(); R value = record.getValue(); boolean expired = evictIfExpired(key, value, now); if (expired) { accumulateOrSendExpiredKeysToBackup(key, value); evictedCount++; } } return evictedCount; }
Source:
public void testSimple() throws Exception { BulkCommand command = createCommand(); bulkService.submit(command); assertTrue("Bulk action didn't finish", bulkService.await(command.getId(), Duration.ofSeconds(60))); BulkStatus status = bulkService.getStatus(command.getId()); assertEquals(COMPLETED, status.getState()); assertEquals(10, status.getProcessed()); assertEquals(10, status.getTotal()); String url = Framework.getService(DownloadService.class).getDownloadUrl(command.getId()); assertEquals(url, status.getResult().get("url")); Blob blob = getBlob(command.getId()); assertNotNull(blob); try (InputStream is = new FileInputStream(blob.getFile())) { assertTrue(ZipUtils.isValid(is)); } File file = getUnzipFile(command, blob); List<String> lines = Files.lines(file.toPath()).collect(Collectors.toList()); assertEquals(11, lines.size()); assertArrayEquals(SYSTEM_PROPERTIES_HEADER_FIELDS, lines.get(0).split(",")); long count = lines.stream().collect(Collectors.groupingBy(e -> e, Collectors.counting())).get(lines.get(0)); assertEquals(1, count); List<String> content = lines.subList(1, lines.size()); List<String> sortedContent = new ArrayList<>(content); Collections.sort(sortedContent); assertEquals(content, sortedContent); }

Target:
public void testSimple() throws Exception { BulkCommand command = createCommand(); testCsvExport(command); }
Source:
private boolean shouldBeDeleted(@Nonnull TopLevelItem item, FilePath dir, @Nonnull Node n) throws IOException, InterruptedException { if(!dir.exists()) { LOGGER.log(Level.FINE, "Directory {0} does not exist", dir); return false; } long now = new Date().getTime(); if(dir.lastModified() + retainForDays * DAY > now) { LOGGER.log(Level.FINE, "Directory {0} is only {1} old, so not deleting", new Object[] {dir, Util.getTimeSpanString(now-dir.lastModified())}); return false; } if (item instanceof AbstractProject<?,?>) { AbstractProject<?,?> p = (AbstractProject<?,?>) item; Node lb = p.getLastBuiltOn(); LOGGER.log(Level.FINER, "Directory {0} is last built on {1}", new Object[] {dir, lb}); if(lb!=null && lb.equals(n)) { LOGGER.log(Level.FINE, "Directory {0} is the last workspace for {1}", new Object[] {dir, p}); return false; } if(!p.getScm().processWorkspaceBeforeDeletion((Job<?, ?>) p,dir,n)) { LOGGER.log(Level.FINE, "Directory deletion of {0} is vetoed by SCM", dir); return false; } } if (item instanceof Job<?,?>) { Job<?,?> j = (Job<?,?>) item; if (j.isBuilding()) { return false; } } LOGGER.log(Level.FINER, "Going to delete directory {0}", dir); return true; }

Target:
private boolean shouldBeDeleted(@Nonnull TopLevelItem item, FilePath dir, @Nonnull Node n) throws IOException, InterruptedException { if(!dir.exists()) { LOGGER.log(Level.FINE, "Directory {0} does not exist", dir); return false; } long now = new Date().getTime(); if(dir.lastModified() + retainForDays * DAY > now) { LOGGER.log(Level.FINE, "Directory {0} is only {1} old, so not deleting", new Object[] {dir, Util.getTimeSpanString(now-dir.lastModified())}); return false; } if (item instanceof AbstractProject<?,?>) { AbstractProject<?,?> p = (AbstractProject<?,?>) item; Node lb = p.getLastBuiltOn(); LOGGER.log(Level.FINER, "Directory {0} is last built on {1}", new Object[] {dir, lb}); if(lb!=null && lb.equals(n)) { LOGGER.log(Level.FINE, "Directory {0} is the last workspace for {1}", new Object[] {dir, p}); return false; } if(!p.getScm().processWorkspaceBeforeDeletion((Job<?, ?>) p,dir,n)) { LOGGER.log(Level.FINE, "Directory deletion of {0} is vetoed by SCM", dir); return false; } } if (item instanceof Job<?,?>) { Job<?,?> j = (Job<?,?>) item; if (j.isBuilding()) { LOGGER.log(Level.FINE, "Job {0} is building, so not deleting", item.getFullDisplayName()); return false; } } LOGGER.log(Level.FINER, "Going to delete directory {0}", dir); return true; }
Source:
public void scrollToSelectedNote(String id) { if (mNoteListFragment != null && mNoteListFragment.getListAdapter() != null) { ListAdapter listAdapter = mNoteListFragment.getListAdapter(); ListView listView = mNoteListFragment.getListView(); for (int i = 0; i < listAdapter.getCount(); i++) { if (((Note) listAdapter.getItem(i + listView.getHeaderViewsCount())).getSimperiumKey().equals(id)) { listView.smoothScrollToPosition(i); } } } }

Target:
public void scrollToSelectedNote(String id) { if (mNoteListFragment != null && mNoteListFragment.getListAdapter() != null) { ListAdapter listAdapter = mNoteListFragment.getListAdapter(); ListView listView = mNoteListFragment.getListView(); for (int i = 0; i < listAdapter.getCount(); i++) { if (((Note) listAdapter.getItem(i + listView.getHeaderViewsCount())).getSimperiumKey().equals(id)) { listView.smoothScrollToPosition(i); break; } } } }
Source:
private void initViews(){ setOrientation(LinearLayout.HORIZONTAL); setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, getPixels(35))); setGravity(Gravity.CENTER_VERTICAL); mImageView = new ImageView(getContext()); mImageView.setLayoutParams(new ViewGroup.LayoutParams(getPixels(25), getPixels(25))); addView(mImageView); mTextView = new TextView(getContext()); mTextView.setPadding(getPixels(20), 0, 0, 0); mTextView.setTextColor(0xFF666666); addView(mTextView); }

Target:
private void initViews(){ setOrientation(LinearLayout.HORIZONTAL); setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (int)getContext().getResources().getDimension(R.dimen.my_priorities_item_height))); setGravity(Gravity.CENTER_VERTICAL); mImageView = new ImageView(getContext()); mImageView.setLayoutParams(new ViewGroup.LayoutParams(getPixels(25), getPixels(25))); addView(mImageView); mTextView = new TextView(getContext()); mTextView.setPadding(getPixels(20), 0, 0, 0); mTextView.setTextColor(0xFF666666); addView(mTextView); }
Source:
public void stop() { try { client.close(); } catch (Exception e) { e.printStackTrace(); } }

Target:
public void stop() { try { client.close(); } catch (Exception e) { log.cannotCloseClient(e); } }
Source:
public void applyMigration() { try { if (curatorFramework.checkExists().forPath(ACTIVE_TASKS_ROOT) != null) { List<String> currentActive = curatorFramework.getChildren().forPath(ACTIVE_STATUSES_ROOT); for (String taskIdString : currentActive) { SingularityTaskId taskId = SingularityTaskId.valueOf(taskIdString); String oldPath = ZKPaths.makePath(ACTIVE_STATUSES_ROOT, taskIdString); byte[] oldData = curatorFramework.getData().forPath(oldPath); String newPath = ZKPaths.makePath(ACTIVE_STATUSES_ROOT, taskId.getRequestId(), taskIdString); if (curatorFramework.checkExists().forPath(newPath) != null) { curatorFramework.setData().forPath(newPath, oldData); } else { curatorFramework.create().creatingParentsIfNeeded().forPath(newPath, oldData); } curatorFramework.delete().forPath(oldPath); } curatorFramework.delete().deletingChildrenIfNeeded().forPath(ACTIVE_TASKS_ROOT); } } catch (Throwable t) { throw new RuntimeException(t); } }

Target:
public void applyMigration() { try { if (curatorFramework.checkExists().forPath(ACTIVE_TASKS_ROOT) != null) { List<String> currentActive = curatorFramework.getChildren().forPath(ACTIVE_STATUSES_ROOT); for (String taskIdString : currentActive) { try { SingularityTaskId taskId = SingularityTaskId.valueOf(taskIdString); String oldPath = ZKPaths.makePath(ACTIVE_STATUSES_ROOT, taskIdString); byte[] oldData = curatorFramework.getData().forPath(oldPath); String newPath = ZKPaths.makePath(ACTIVE_STATUSES_ROOT, taskId.getRequestId(), taskIdString); if (curatorFramework.checkExists().forPath(newPath) != null) { curatorFramework.setData().forPath(newPath, oldData); } else { curatorFramework.create().creatingParentsIfNeeded().forPath(newPath, oldData); } curatorFramework.delete().forPath(oldPath); } catch (InvalidSingularityTaskIdException e) { LOG.warn("Found invalid task id {}. This is likely because the migration did not finish successfully on a previous run. Will continue to migrate additional nodes", taskIdString); } } curatorFramework.delete().deletingChildrenIfNeeded().forPath(ACTIVE_TASKS_ROOT); } } catch (Throwable t) { throw new RuntimeException(t); } }
Source:
protected boolean proceedVdsStats() { boolean returnValue = true; try { runVdsCommand(VDSCommandType.GetStats, new VdsIdAndVdsVDSCommandParametersBase(getVds())); List<Guid> problematicDomainsIds = IrsBrokerCommand.checkIfDomainsReportedAsProblematic(getVds().getStoragePoolId(), getVds().getDomains()); for (Guid domainId : problematicDomainsIds) { StorageDomainStatic domainInfo = getStorageDomainStaticDAO().get(domainId); log.errorFormat("Storage Domain {0} of pool {1} is in problem in host {1}", domainInfo != null ? domainInfo.getStorageName() : domainId, getVds().getName(), getStoragePool() .getName()); if (domainInfo == null || domainInfo.getStorageDomainType().isDataDomain()) { returnValue = false; } } } catch (VdcBLLException e) { log.errorFormat("Could not get Host statistics for Host {0}, Error is {1}", getVds().getName(), e); returnValue = false; } return returnValue; }

Target:
protected boolean proceedVdsStats() { boolean returnValue = true; try { runVdsCommand(VDSCommandType.GetStats, new VdsIdAndVdsVDSCommandParametersBase(getVds())); List<Guid> problematicDomainsIds = IrsBrokerCommand.fetchDomainsReportedAsProblematic(getVds().getStoragePoolId(), getVds().getDomains()); for (Guid domainId : problematicDomainsIds) { StorageDomainStatic domainInfo = getStorageDomainStaticDAO().get(domainId); log.errorFormat("Storage Domain {0} of pool {1} is in problem in host {1}", domainInfo != null ? domainInfo.getStorageName() : domainId, getStoragePool().getName(), getVds().getName()); if (domainInfo == null || domainInfo.getStorageDomainType().isDataDomain()) { returnValue = false; } } } catch (VdcBLLException e) { log.errorFormat("Could not get Host statistics for Host {0}, Error is {1}", getVds().getName(), e); returnValue = false; } return returnValue; }
Source:
private static GoType findTypeInConstSpec(@NotNull GoConstDefinition o) { PsiElement parent = PsiTreeUtil.getStubOrPsiParent(o); if (!(parent instanceof GoConstSpec)) return null; GoConstSpec spec = (GoConstSpec)parent; GoType commonType = spec.getType(); if (commonType != null) return commonType; List<GoConstDefinition> varList = spec.getConstDefinitionList(); int i = Math.max(varList.indexOf(o), 0); List<GoExpression> es = spec.getExpressionList(); if (es.size() <= i) return null; return es.get(i).getGoType(null); }

Target:
private static Pair<GoType, Boolean> findTypeInConstSpec(@NotNull GoConstDefinition o) { PsiElement parent = PsiTreeUtil.getStubOrPsiParent(o); if (!(parent instanceof GoConstSpec)) return Pair.create(null, false); GoConstSpec spec = (GoConstSpec)parent; GoType commonType = spec.getType(); if (commonType != null) return Pair.create(commonType, true); List<GoConstDefinition> varList = spec.getConstDefinitionList(); int i = Math.max(varList.indexOf(o), 0); GoConstSpecStub specStub = spec.getStub(); List<GoExpression> es = specStub != null ? specStub.getExpressionList() : spec.getExpressionList(); if (es.size() <= i) return Pair.create(null, false); return Pair.create(es.get(i).getGoType(null), true); }
Source:
private void endTransaction(BinlogEventV4 e) { LOG.info("Ending transaction " + _scn); DatastreamProducerRecordBuilder builder = new DatastreamProducerRecordBuilder(); builder.setPartition(1); String checkpoint = MysqlCheckpoint.createCheckpointString(_sourceId, _scn, _currFileName, _mostRecentSeenEventPosition); builder.setSourceCheckpoint(checkpoint); for (String event : _eventsInTransaction) { DatastreamEvent datastreamEvent = new DatastreamEvent(); datastreamEvent.payload = ByteBuffer.wrap(event.getBytes()); datastreamEvent.key = null; builder.addEvent(datastreamEvent); } _producer.send(builder.build(), (metadata, exception) -> { if (exception == null) { LOG.debug(String.format("Sending event succeeded, metadata:{%s}", metadata)); } else { LOG.error(String.format("Sending event failed, metadata:{%s}", metadata), exception); } }); resetTransactionData(); }

Target:
private void endTransaction(BinlogEventV4 e) { LOG.info("Ending transaction " + _scn); if (_eventsInTransaction.size() > 0) { DatastreamProducerRecordBuilder builder = new DatastreamProducerRecordBuilder(); builder.setPartition(0); String checkpoint = MysqlCheckpoint.createCheckpointString(_sourceId, _scn, _currFileName, _mostRecentSeenEventPosition); builder.setSourceCheckpoint(checkpoint); _eventsInTransaction.forEach(builder::addEvent); _producer.send(builder.build(), (metadata, exception) -> { if (exception == null) { LOG.debug(String.format("Sending event succeeded, metadata:{%s}", metadata)); } else { LOG.error(String.format("Sending event failed, metadata:{%s}", metadata), exception); } }); } resetTransactionData(); }