auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Paragraph<PS, SEG, S> subSequence(int start) { if(start < 0) { throw new IllegalArgumentException("start must not be negative (was: " + start + ")"); } else if(start == 0) { return this; } else if(start <= length()) { Position pos = navigator.offsetToPosition(start, Forward); int segIdx = pos.getMajor(); List<SEG> segs = new ArrayList<>(segments.size() - segIdx); segmentOps.subSequence(segments.get(segIdx), pos.getMinor()) .ifPresent(seg -> segs.add(seg)); segs.addAll(segments.subList(segIdx + 1, segments.size())); return new Paragraph<>(paragraphStyle, segmentOps, segs); } else { throw new IndexOutOfBoundsException(start + " not in [0, " + length() + "]"); } }

Target:
public Paragraph<PS, SEG, S> subSequence(int start) { if(start < 0) { throw new IllegalArgumentException("start must not be negative (was: " + start + ")"); } else if(start == 0) { return this; } else if(start <= length()) { Position pos = navigator.offsetToPosition(start, Forward); int segIdx = pos.getMajor(); List<SEG> segs = new ArrayList<>(segments.size() - segIdx); segs.add(segmentOps.subSequence(segments.get(segIdx), pos.getMinor())); segs.addAll(segments.subList(segIdx + 1, segments.size())); if (segs.isEmpty()) { segs.add(segmentOps.createEmpty()); } return new Paragraph<>(paragraphStyle, segmentOps, segs); } else { throw new IndexOutOfBoundsException(start + " not in [0, " + length() + "]"); } }
Source:
private void openGuide(Player p, PlayerRightClickEvent e, SlimefunGuideLayout layout) { GuideOpenEvent event = new GuideOpenEvent(p, e.getItem(), layout) ; Bukkit.getPluginManager().callEvent(event); if (!event.isCancelled()) { e.cancel(); SlimefunGuide.openGuide(p, layout); } }

Target:
private void openGuide(Player p, PlayerRightClickEvent e, SlimefunGuideLayout layout) { SlimefunGuideOpenEvent event = new SlimefunGuideOpenEvent(p, e.getItem(), layout); Bukkit.getPluginManager().callEvent(event); if (!event.isCancelled()) { e.cancel(); SlimefunGuide.openGuide(p, event.getGuideLayout()); } }
Source:
protected void addDragAndDropSupport(final NatTable nattable) { final int operations = DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_DEFAULT; final DropTarget target = new DropTarget(nattable, operations); final LocalTransfer localTransfer = LocalTransfer.getInstance(); final LocalSelectionTransfer localSelectionTransfer = LocalSelectionTransfer.getTransfer(); final Transfer[] types = new Transfer[] { localSelectionTransfer, localTransfer }; target.setTransfer(types); final NatTableDropListener dropListener = createDropListener(); target.addDropListener(dropListener); natTable.addDragSupport(operations, types, new NatTableDragSourceListener(this, natTable, GridRegion.ROW_HEADER)); }

Target:
protected void addDragAndDropSupport(final NatTable nattable) { final int operations = DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_DEFAULT; final DropTarget target = new DropTarget(nattable, operations); final LocalTransfer localTransfer = LocalTransfer.getInstance(); final LocalSelectionTransfer localSelectionTransfer = LocalSelectionTransfer.getTransfer(); final Transfer[] types = new Transfer[] { localSelectionTransfer, localTransfer }; target.setTransfer(types); final NatTableDropListener dropListener = createDropListener(); target.addDropListener(dropListener); BooleanValueStyle values = (BooleanValueStyle) table.getTableConfiguration().getNamedStyle(NattablestylePackage.eINSTANCE.getBooleanValueStyle(), NamedStyleConstants.DRAG_ENABLED); if (null != values && values.isBooleanValue()) { natTable.addDragSupport(operations, types, new NatTableDragSourceListener(this, natTable, Collections.singletonList(GridRegion.ROW_HEADER))); } }
Source:
public int size() { try { RestResponse response = CompletableFutures.await(cacheClient.size().toCompletableFuture()); String sizeContent = response.getBody(); try { return Integer.parseInt(sizeContent); } catch (NumberFormatException e) { throw log.errorGettingCacheSize(e); } } catch (Exception e) { throw log.errorLoadingRemoteEntries(e); } }

Target:
public int size() { try { RestResponse response = CompletionStages.join(cacheClient.size()); String sizeContent = response.getBody(); try { return Integer.parseInt(sizeContent); } catch (NumberFormatException e) { throw log.errorGettingCacheSize(e); } } catch (Exception e) { throw log.errorLoadingRemoteEntries(e); } }
Source:
public ImmutableBoundedValue<Integer> durability() { return new ImmutableSpongeBoundedValue<Integer>(Keys.ITEM_DURABILITY, this.durability, 60, intComparator(), 0, Integer.MAX_VALUE); }

Target:
public ImmutableBoundedValue<Integer> durability() { return this.durability; }
Source:
private BAMFileReader(final BlockCompressedInputStream compressedInputStream, final SeekableStream indexStream, final boolean eagerDecode, final boolean useAsynchronousIO, final String source, final ValidationStringency validationStringency, final SAMRecordFactory factory) throws IOException { mIndexStream = indexStream; mIsSeekable = null != indexStream; mCompressedInputStream = compressedInputStream; mStream = new BinaryCodec(new DataInputStream(mCompressedInputStream)); this.eagerDecode = eagerDecode; this.useAsynchronousIO = useAsynchronousIO; this.mValidationStringency = validationStringency; this.samRecordFactory = factory; this.mFileHeader = readHeader(this.mStream, this.mValidationStringency, source); mFirstRecordPointer = mCompressedInputStream.getFilePointer(); }

Target:
private BAMFileReader(final BlockCompressedInputStream compressedInputStream, final SeekableStream indexStream, final boolean eagerDecode, final boolean useAsynchronousIO, final String source, final ValidationStringency validationStringency, final SAMRecordFactory factory) throws IOException { mIndexStream = indexStream; mIsSeekable = true; mCompressedInputStream = compressedInputStream; mStream = new BinaryCodec(new DataInputStream(mCompressedInputStream)); this.eagerDecode = eagerDecode; this.useAsynchronousIO = useAsynchronousIO; this.mValidationStringency = validationStringency; this.samRecordFactory = factory; this.mFileHeader = readHeader(this.mStream, this.mValidationStringency, source); mFirstRecordPointer = mCompressedInputStream.getFilePointer(); }
Source:
@Override public Fragment getItem(int pos) { Fragment fragment = fm.findFragmentByTag(NavTab.of(pos).getTag()); return fragment != null ? fragment : NavTab.of(pos).newInstance(); }

Target:
@Override public Fragment getItem(int pos) { return NavTab.of(pos).newInstance(); }
Source:
protected void triggerShutdown() { stopped = true; twitterStream.cleanUp(); twitterStream.shutdown(); }

Target:
protected void triggerShutdown() { stopped = true; super.triggerShutdown(); }
Source:
private void init(boolean activateParsingErrorCheck) throws Exception { File moduleBaseDir = new File("src/test/resources"); context = SensorContextTester.create(moduleBaseDir); fs = new DefaultFileSystem(moduleBaseDir); fs.setWorkDir(temporaryFolder.newFolder("temp").toPath()); ActiveRulesBuilder activeRuleBuilder = new ActiveRulesBuilder() .create(NEW_LINE_RULE_KEY) .activate() .create(TAB_CHARACTER_RULE_KEY) .activate(); if (activateParsingErrorCheck) { activeRuleBuilder = activeRuleBuilder .create(PARSING_ERROR_RULE_KEY) .setInternalKey(PARSING_ERROR_CHECK_KEY) .activate(); } CheckFactory checkFactory = new CheckFactory(activeRuleBuilder.build()); FileLinesContextFactory fileLinesContextFactory = mock(FileLinesContextFactory.class); when(fileLinesContextFactory.createFor(any(InputFile.class))).thenReturn(mock(FileLinesContext.class)); sensor = new XmlSensor(fs, checkFactory, fileLinesContextFactory); }

Target:
private void init(boolean activateParsingErrorCheck) throws Exception { File moduleBaseDir = new File("src/test/resources"); context = SensorContextTester.create(moduleBaseDir); fs = new DefaultFileSystem(moduleBaseDir); fs.setWorkDir(temporaryFolder.newFolder("temp").toPath()); ActiveRulesBuilder activeRuleBuilder = new ActiveRulesBuilder() .create(NEW_LINE_RULE_KEY) .activate() .create(TAB_CHARACTER_RULE_KEY) .activate(); if (activateParsingErrorCheck) { activeRuleBuilder = activeRuleBuilder .create(PARSING_ERROR_RULE_KEY) .activate(); } CheckFactory checkFactory = new CheckFactory(activeRuleBuilder.build()); FileLinesContextFactory fileLinesContextFactory = mock(FileLinesContextFactory.class); when(fileLinesContextFactory.createFor(any(InputFile.class))).thenReturn(mock(FileLinesContext.class)); sensor = new XmlSensor(fs, checkFactory, fileLinesContextFactory); }
Source:
public TransactionEdit next(TransactionEdit reuse) throws IOException { if (isClosed()) { return null; } if (transactionEdits.size() != 0) { return transactionEdits.remove(); } populateTransactionEdits(); return transactionEdits.poll(); }

Target:
public TransactionEdit next(TransactionEdit reuse) throws IOException { if (closed) { return null; } if (!transactionEdits.isEmpty()) { return transactionEdits.remove(); } populateTransactionEdits(); return transactionEdits.poll(); }
Source:
public void onGenerateMap() { try { if (!previousMapName.getText().isEmpty()) { mapGeneratorService.generateMap(previousMapName.getText()).thenAccept(mapName -> Platform.runLater(() -> { createGameController.initMapSelection(); createGameController.mapListView.getItems().stream() .filter(mapBean -> mapBean.getFolderName().equalsIgnoreCase(mapName)) .findAny().ifPresent(mapBean -> { createGameController.mapListView.getSelectionModel().select(mapBean); createGameController.mapListView.scrollTo(mapBean); createGameController.setSelectedMap(mapBean); }); })); } else { byte[] optionArray = getOptionArray(); mapGeneratorService.generateMap(optionArray).thenAccept(mapName -> Platform.runLater(() -> { createGameController.initMapSelection(); createGameController.mapListView.getItems().stream() .filter(mapBean -> mapBean.getFolderName().equalsIgnoreCase(mapName)) .findAny().ifPresent(mapBean -> { createGameController.mapListView.getSelectionModel().select(mapBean); createGameController.mapListView.scrollTo(mapBean); createGameController.setSelectedMap(mapBean); }); })); } } catch (IllegalArgumentException e) { String msg = e.getMessage(); if (msg.startsWith("New Version")) { notificationService.addImmediateErrorNotification(e, "mapGenerator.tooNewVersion"); log.error("Map generation failed", e); } if (msg.startsWith("Old Version")) { notificationService.addImmediateErrorNotification(e, "mapGenerator.tooOldVersion"); log.error("Map generation failed", e); } } catch (Exception e) { notificationService.addImmediateErrorNotification(e, "mapGenerator.generationFailed"); log.error("Map generation failed", e); } onCloseButtonClickedListener.run(); }

Target:
public void onGenerateMap() { CompletableFuture<String> generateFuture; if (!previousMapName.getText().isEmpty()) { if (!mapGeneratorService.isGeneratedMap(previousMapName.getText())) { notificationService.addImmediateErrorNotification(new IllegalArgumentException(), "mapGenerator.invalidName"); log.warn("Invalid Generated Map Name", new IllegalArgumentException()); return; } generateFuture = mapGeneratorService.generateMap(previousMapName.getText()); } else { byte[] optionArray = getOptionArray(); generateFuture = mapGeneratorService.generateMap(optionArray); } generateFuture.thenAccept(mapName -> Platform.runLater(() -> { createGameController.initMapSelection(); createGameController.mapListView.getItems().stream() .filter(mapBean -> mapBean.getFolderName().equalsIgnoreCase(mapName)) .findAny().ifPresent(mapBean -> { createGameController.mapListView.getSelectionModel().select(mapBean); createGameController.mapListView.scrollTo(mapBean); createGameController.setSelectedMap(mapBean); }); })) .exceptionally(throwable -> { handleGenerationException(throwable); return null; }); onCloseButtonClickedListener.run(); }
Source:
public Map<String, Object> parse(String input) { try { Pattern compiled = Pattern.compile(pattern); Matcher matcher = compiled.matcher(input); if (!matcher.matches()) { throw new ParseException("Incorrect Regex: %s . No match found.", pattern); } List<String> values = Lists.newArrayList(); for (int i = 0; i < matcher.groupCount(); i++) { values.add(matcher.group(i + 1)); } if (fieldNames == null) { setFieldNames(ParserUtils.generateFieldNames(values.size())); } return Utils.zipMapPartial(fieldNames, Iterables.transform(values, valueFunction)); } catch (Exception e) { throw new ParseException(e, "Unable to parse row [%s]", input); } }

Target:
public Map<String, Object> parse(String input) { try { final Matcher matcher = compiled.matcher(input); if (!matcher.matches()) { throw new ParseException("Incorrect Regex: %s . No match found.", pattern); } List<String> values = Lists.newArrayList(); for (int i = 1; i <= matcher.groupCount(); i++) { values.add(matcher.group(i)); } if (fieldNames == null) { setFieldNames(ParserUtils.generateFieldNames(values.size())); } return Utils.zipMapPartial(fieldNames, Iterables.transform(values, valueFunction)); } catch (Exception e) { throw new ParseException(e, "Unable to parse row [%s]", input); } }
Source:
default boolean endsWith(Seq<? extends T> that) { if(that instanceof IndexedSeq) { int i = length() - 1; int j = that.length() - 1; if(j > i) return false; else { while(j >= 0) { if(!Objects.equals(this.get(i), that.get(j))) return false; i--; j--; } return true; } } else { return Seq.super.endsWith(that); } }

Target:
default boolean endsWith(Seq<? extends T> that) { Objects.requireNonNull(that, "that is null"); if(that instanceof IndexedSeq) { int i = length() - 1; int j = that.length() - 1; if(j > i) return false; else { while(j >= 0) { if(!Objects.equals(this.get(i), that.get(j))){ return false; } i--; j--; } return true; } } else { return Seq.super.endsWith(that); } }
Source:
public OrderType retireOrderType(OrderType orderType, String reason) { orderType.setRetired(true); orderType.setRetireReason(reason); return dao.saveOrderType(orderType); }

Target:
public OrderType retireOrderType(OrderType orderType, String reason) { orderType.setRetired(true); orderType.setRetireReason(reason); return saveOrderType(orderType); }
Source:
public void dispose() { mHandler.removeCallbacksAndMessages(null); mHandler = null; super.dispose(); }

Target:
public void dispose() { super.dispose(); }
Source:
private Set<Object> getInvocationResults(IClass testClass) { Class<?> cls = testClass.getRealClass(); Set<Object> set = null; while (true) { if (cls.equals(Object.class)) { break; } set = m_classInvocationResults.get(cls); if (set != null) { break; } cls = cls.getSuperclass(); } if (set == null) { throw new IllegalStateException("No failure logs for " + testClass.getRealClass()); } return set; }

Target:
private Set<Object> getInvocationResults(IClass testClass) { Class<?> cls = testClass.getRealClass(); Set<Object> set = null; while (!cls.equals(Object.class)) { set = m_classInvocationResults.get(cls); if (set != null) { break; } cls = cls.getSuperclass(); } if (set == null) { throw new IllegalStateException("No failure logs for " + testClass.getRealClass()); } return set; }
Source:
public IndexSearchResult<T> fetch(Long limit, Long offset) { ElasticsearchWork<ElasticsearchLoadableSearchResult<T>> work = workFactory.search( payload, searchResultExtractor ) .indexes( indexNames ) .paging( limit, offset ) .routingKeys( routingKeys ).build(); ElasticsearchLoadableSearchResult<T> searchResult; try { searchResult = queryOrchestrator.submit( work ).join(); } catch (CompletionException ex) { Throwable cause = ex.getCause(); throw ( cause instanceof SearchException ) ? (SearchException) cause : ex; } return searchResult .loadBlocking( sessionContext ); }

Target:
public IndexSearchResult<T> fetch(Long limit, Long offset) { ElasticsearchWork<ElasticsearchLoadableSearchResult<T>> work = workFactory.search( payload, searchResultExtractor ) .indexes( indexNames ) .paging( limit, offset ) .routingKeys( routingKeys ).build(); return Futures.unwrappedExceptionJoin( queryOrchestrator.submit( work ) ) .loadBlocking( sessionContext ); }
Source:
public void testExpiredData() throws InterruptedException { dc.put("k", "v", new EmbeddedMetadata.Builder().maxIdle(100, TimeUnit.MINUTES).build()); Thread.sleep(100); InternalCacheEntry entry = dc.get("k"); assertNotNull(entry); assertEquals(transienttype(), entry.getClass()); assertTrue(entry.getLastUsed() <= timeService.wallClockTime()); long entryLastUsed = entry.getLastUsed(); timeService.advance(100); entry = dc.get("k"); assertTrue(entry.getLastUsed() > entryLastUsed); dc.put("k", "v", new EmbeddedMetadata.Builder().maxIdle(0, TimeUnit.MINUTES).build()); dc.put("k", "v", new EmbeddedMetadata.Builder().lifespan(100, TimeUnit.MINUTES).build()); timeService.advance(100); assertEquals(1, dc.size()); entry = dc.get("k"); assertNotNull(entry); assertEquals(mortaltype(), entry.getClass()); assertTrue(entry.getCreated() <= timeService.wallClockTime()); dc.put("k", "v", new EmbeddedMetadata.Builder().lifespan(0, TimeUnit.MINUTES).build()); timeService.advance(10); assertNull(dc.get("k")); assertEquals(0, dc.size()); dc.put("k", "v", new EmbeddedMetadata.Builder().lifespan(0, TimeUnit.MINUTES).build()); timeService.advance(100); assertEquals(0, dc.size()); }

Target:
public void testExpiredData() throws InterruptedException { dc.put("k", "v", new EmbeddedMetadata.Builder().maxIdle(100, TimeUnit.MINUTES).build()); timeService.advance(100); InternalCacheEntry entry = dc.get("k"); assertNotNull(entry); assertEquals(transienttype(), entry.getClass()); assertEquals(timeService.wallClockTime(), entry.getLastUsed()); long entryLastUsed = entry.getLastUsed(); timeService.advance(100); entry = dc.get("k"); assertEquals(entryLastUsed + 100, entry.getLastUsed()); dc.put("k", "v", new EmbeddedMetadata.Builder().maxIdle(1, TimeUnit.MILLISECONDS).build()); long oldTime = timeService.wallClockTime(); dc.put("k", "v", new EmbeddedMetadata.Builder().lifespan(100, TimeUnit.MINUTES).build()); timeService.advance(100); assertEquals(1, dc.size()); entry = dc.get("k"); assertNotNull(entry); assertEquals(mortaltype(), entry.getClass()); assertEquals(oldTime, entry.getCreated()); assertEquals(-1, entry.getMaxIdle()); dc.put("k", "v", new EmbeddedMetadata.Builder().lifespan(1, TimeUnit.MILLISECONDS).build()); timeService.advance(10); assertNull(dc.get("k")); assertEquals(0, dc.size()); dc.put("k", "v", new EmbeddedMetadata.Builder().lifespan(1, TimeUnit.MILLISECONDS).build()); timeService.advance(100); assertEquals(0, dc.size()); }
Source:
private static boolean isSentinelCigar(final Cigar cigar, final int readLength) { return cigar.getCigarElement(0).getOperator() == CigarOperator.S && (cigar.getCigarElement(0).getLength() == readLength || readLength == 0) && cigar.getCigarElement(1).getOperator() == CigarOperator.N; }

Target:
static boolean isSentinelCigar(final Cigar cigar, final int readLength) { return cigar.numCigarElements() == 2 && cigar.getCigarElement(1).getOperator() == CigarOperator.N && cigar.getCigarElement(0).getOperator() == CigarOperator.S && (cigar.getCigarElement(0).getLength() == readLength || readLength == 0) ; }
Source:
public boolean checkMeasurementPointSize(int radius){ if(radius <= maxMeasurementPointRadius && radius >= minMeasurementPointRadius){ return true; }else{ return false; } }

Target:
public boolean checkMeasurementPointSize(int radius){ return radius <= maxMeasurementPointRadius && radius >= minMeasurementPointRadius; }
Source:
private void addFieldValueToRow(List<String> row, Release._Fields field, Release release) throws SW360Exception { switch (field) { case COMPONENT_ID: row.add(fieldValueAsString( release.getFieldValue(org.eclipse.sw360.datahandler.thrift.components.Release._Fields.ID))); if (extendedByAdditionalData) { try { Component component = cClient.getComponentById(release.componentId, this.user); row.add(fieldValueAsString(component.getFieldValue( org.eclipse.sw360.datahandler.thrift.components.Component._Fields.COMPONENT_TYPE))); } catch (TException e) { throw new SW360Exception("Could not get Component for id [" + release.componentId + "] and user [" + this.user + "] because of:\n" + e.getMessage()); } String projectNames = releaseToShortenedStringsMap.get(release).projectNames; row.add(projectNames); } break; case VENDOR: addVendorToRow(release.getVendor(), row); break; case COTS_DETAILS: addCotsDetailsToRow(release.getCotsDetails(), row); break; case CLEARING_INFORMATION: addClearingInformationToRow(release.getClearingInformation(), row); break; case ECC_INFORMATION: addEccInformationToRow(release.getEccInformation(), row); break; case RELEASE_ID_TO_RELATIONSHIP: addReleaseIdToRelationShipToRow(release.getReleaseIdToRelationship(), row); break; case ATTACHMENTS: String size = "0"; if (release.isSetAttachments()) { size = release.attachments.size() + ""; } row.add(size); break; default: Object fieldValue = release.getFieldValue(field); row.add(fieldValueAsString(fieldValue)); } }

Target:
private void addFieldValueToRow(List<String> row, Release._Fields field, Release release) throws SW360Exception { switch (field) { case COMPONENT_ID: row.add(release.getComponentId()); if (addAdditionalData()) { Component component = this.preloadedComponents.get(release.componentId); if (component != null) { row.add(ThriftEnumUtils.enumToString(component.getComponentType())); } else { row.add(""); } if (releaseToShortenedStringsMap.containsKey(release)) { row.add(releaseToShortenedStringsMap.get(release).projectNames); } else { row.add(""); } } break; case VENDOR: addVendorToRow(release.getVendor(), row); break; case COTS_DETAILS: addCotsDetailsToRow(release.getCotsDetails(), row); break; case CLEARING_INFORMATION: addClearingInformationToRow(release.getClearingInformation(), row); break; case ECC_INFORMATION: addEccInformationToRow(release.getEccInformation(), row); break; case RELEASE_ID_TO_RELATIONSHIP: addReleaseIdToRelationShipToRow(release.getReleaseIdToRelationship(), row); break; case ATTACHMENTS: String size = Integer.toString(release.isSetAttachments() ? release.getAttachments().size() : 0); row.add(size); break; default: Object fieldValue = release.getFieldValue(field); row.add(fieldValueAsString(fieldValue)); } }
Source:
private void internalFinishSpan(Span span, long duration) { synchronized (span) { span.setDuration(duration); reporter().report(span.toZipkin()); } spanAndEndpoint().state().setCurrentLocalSpan(null); }

Target:
private void internalFinishSpan(Span span, long duration) { synchronized (span) { span.setDuration(duration); } reporter().report(span.toZipkin()); spanAndEndpoint().state().setCurrentLocalSpan(null); }
Source:
public GrpcBlockingStream(Function<StreamObserver<ResT>, StreamObserver<ReqT>> rpcFunc, int bufferSize, String description) { LOG.debug("Opening stream ({})", description); mResponses = new LinkedBlockingQueue<>(); mResponseObserver = new ResponseStreamObserver(); mRequestObserver = (ClientCallStreamObserver) rpcFunc.apply(mResponseObserver); mDescription = description; }

Target:
public GrpcBlockingStream(Function<StreamObserver<ResT>, StreamObserver<ReqT>> rpcFunc, int bufferSize, String description) { LOG.debug("Opening stream ({})", description); mResponses = new ArrayBlockingQueue<>(bufferSize); mResponseObserver = new ResponseStreamObserver(); mRequestObserver = (ClientCallStreamObserver) rpcFunc.apply(mResponseObserver); mDescription = description; }
Source:
public void waitsForServiceToExist_whenGettingAllBatchStatuses() throws InterruptedException { final ArgumentCaptor<Runnable> argumentCaptor = ArgumentCaptor.forClass(Runnable.class); willAnswer(new Answer<Void>() { @Override public Void answer(InvocationOnMock invocation) throws Throwable { argumentCaptor.getValue().run(); return null; } }).given(executorService).submit(argumentCaptor.capture()); notifyLockOnAnotherThread(); downloadManager.getAllDownloadBatchStatuses(allBatchStatusesCallback); }

Target:
public void waitsForServiceToExist_whenGettingAllBatchStatuses() throws InterruptedException { willAnswer(new Answer<Void>() { @Override public Void answer(InvocationOnMock invocation) throws Throwable { ((Runnable) invocation.getArgument(0)).run(); return null; } }).given(executorService).submit(any(Runnable.class)); notifyLockOnAnotherThread(); downloadManager.getAllDownloadBatchStatuses(allBatchStatusesCallback); }
Source:
public Stream<Room> getAll() throws Exception { try { var connection = getConnection(); var statement = connection.prepareStatement("SELECT * FROM ROOMS"); var resultSet = statement.executeQuery(); return StreamSupport.stream(new Spliterators.AbstractSpliterator<Room>(Long.MAX_VALUE, Spliterator.ORDERED) { @Override public boolean tryAdvance(Consumer<? super Room> action) { try { if (!resultSet.next()) { return false; } action.accept(createRoom(resultSet)); return true; } catch (Exception e) { throw new RuntimeException(e); } } }, false).onClose(() -> { try { mutedClose(connection, statement, resultSet); } catch (Exception e) { e.printStackTrace(); } }); } catch (Exception e) { throw new SqlException(e.getMessage(), e); } }

Target:
public Stream<Room> getAll() throws Exception { try { var connection = getConnection(); var statement = connection.prepareStatement("SELECT * FROM ROOMS"); var resultSet = statement.executeQuery(); return StreamSupport.stream(new Spliterators.AbstractSpliterator<Room>(Long.MAX_VALUE, Spliterator.ORDERED) { @Override public boolean tryAdvance(Consumer<? super Room> action) { try { if (!resultSet.next()) { return false; } action.accept(createRoom(resultSet)); return true; } catch (Exception e) { throw new RuntimeException(e); } } }, false).onClose(() -> { try { mutedClose(connection, statement, resultSet); } catch (Exception e) { LOGGER.error(e.getMessage()); } }); } catch (Exception e) { throw new Exception(e.getMessage(), e); } }
Source:
public TaskOnList(RowSnapshot<TaskContract.TaskLists> taskListRow, Predicate predicate) { super(new AllOf(predicate, new EqArg(TaskContract.Tasks.LIST_ID, taskListRow.values().charData(BaseColumns._ID).value("-1")))); }

Target:
public TaskOnList(RowSnapshot<TaskContract.TaskLists> taskListRow, Predicate predicate) { super(new AllOf(predicate, new ReferringTo<>(TaskContract.Tasks.LIST_ID, taskListRow))); }
Source:
private void updateConnectionsTypeMap() { connectionsTypeMap = new HashMap<>(); for (StorageServerConnections conn : _connections) { StorageType connType = conn.getstorage_type(); if (!connectionsTypeMap.containsKey(conn.getstorage_type())) { connectionsTypeMap.put(connType, new ArrayList<StorageServerConnections>()); } connectionsTypeMap.get(connType).add(conn); } }

Target:
private void updateConnectionsTypeMap() { connectionsTypeMap = new HashMap<>(); for (StorageServerConnections conn : _connections) { StorageType connType = conn.getstorage_type(); MultiValueMapUtils.addToMap(connType, conn, connectionsTypeMap); } }
Source:
public static byte[] getSha1(InputStream shaFis) { MessageDigest sha1; try { sha1 = MessageDigest.getInstance("SHA-1"); int bufSiz = 1024; byte buf[] = new byte[bufSiz]; int bytesRead; while ((bytesRead = shaFis.read(buf)) != -1) { sha1.update(buf, 0, bytesRead); } } catch (Exception e) { return null; } return sha1.digest(); }

Target:
public static byte[] getSha1(InputStream shaFis) { MessageDigest sha1; try { sha1 = MessageDigest.getInstance("SHA-1"); int bufSiz = 1024; byte buf[] = new byte[bufSiz]; int bytesRead; while ((bytesRead = shaFis.read(buf)) != -1) { sha1.update(buf, 0, bytesRead); } } catch (Exception e) { Log.w("getSha1", "Problem calculating SHA1 for stream: "+e); return null; } return sha1.digest(); }
Source:
public void prints_values() throws Exception { assertEquals("null", print(null)); assertEquals("\"str\"", print("str")); assertEquals("\"x\ny\"", print("x\ny")); assertEquals("3", print(3)); assertEquals("3L", print(3L)); assertEquals("[1, 2]", print(new int[]{1, 2})); assertEquals("{\"hoge\"=2L}", print(new HashMap<String, Object>() { { put("hoge", 2L); } })); assertTrue(print(new UnsafeToString()).contains("UnsafeToString")); assertEquals("ToString", print(new ToString())); assertEquals("formatted", print(new FormattedText("formatted"))); }

Target:
public void prints_values() throws Exception { assertEquals("null", print(null)); assertEquals("\"str\"", print("str")); assertEquals("\"x\ny\"", print("x\ny")); assertEquals("3", print(3)); assertEquals("3L", print(3L)); assertEquals("3.14d", print(3.14d)); assertEquals("3.14f", print(3.14f)); assertEquals("[1, 2]", print(new int[]{1, 2})); assertEquals("{\"foo\" = 2L}", print(new LinkedHashMap<String, Object>() { { put("foo", 2L); } })); assertEquals("{\"byte\" = 0x01, \"short\" = 2, \"int\" = 3, \"long\" = 4L, \"float\" = 2.71f, \"double\" = 3.14d}", print(new LinkedHashMap<String, Object>() { { put("byte", (byte)1); put("short", (short)2); put("int", 3); put("long", 4L); put("float", 2.71f); put("double", 3.14d); } })); assertTrue(print(new UnsafeToString()).contains("UnsafeToString")); assertEquals("ToString", print(new ToString())); assertEquals("formatted", print(new FormattedText("formatted"))); }
Source:
protected ToStringHelper string() { ToStringHelper toString = Objects.toStringHelper("").omitNullValues(); toString.add("keyName", keyName); if (securityGroupNames.size() > 0) toString.add("securityGroupNames", securityGroupNames); if (metadata.size() > 0) toString.add("metadata", metadata); if (personality.size() > 0) toString.add("personality", personality); if (adminPass != null) toString.add("adminPassPresent", true); toString.add("userData", userData == null ? null : new String(userData)); if (networks.size() > 0) toString.add("networks", networks); return toString; }

Target:
protected ToStringHelper string() { ToStringHelper toString = Objects.toStringHelper("").omitNullValues(); toString.add("keyName", keyName); if (securityGroupNames.size() > 0) toString.add("securityGroupNames", securityGroupNames); if (metadata.size() > 0) toString.add("metadata", metadata); if (personality.size() > 0) toString.add("personality", personality); if (adminPass != null) toString.add("adminPassPresent", true); if (diskConfig != null) toString.add("diskConfig", diskConfig); toString.add("userData", userData == null ? null : new String(userData)); if (!networks.isEmpty()) toString.add("networks", networks); return toString; }
Source:
public WebSocketMessageV13(WebSocketProxy proxy, InputStream in, byte frameHeader) throws IOException { super(proxy, getIncrementedMessageCount()); opcode = (frameHeader & 0x0F); Calendar calendar = Calendar.getInstance(); timestamp = new Timestamp(calendar.getTimeInMillis()); readFrame(in, frameHeader); direction = receivedFrames.get(0).isMasked() ? Direction.OUTGOING : Direction.INCOMING; hasChanged = true; }

Target:
public WebSocketMessageV13(WebSocketProxy proxy, InputStream in, byte frameHeader) throws IOException { super(proxy, getIncrementedMessageCount()); opcode = (frameHeader & 0x0F); Calendar calendar = Calendar.getInstance(); timestamp = new Timestamp(calendar.getTimeInMillis()); readFrame(in, frameHeader); direction = receivedFrames.get(0).isMasked() ? Direction.OUTGOING : Direction.INCOMING; }
Source:
public void required_spec109_subscribeThrowNPEOnNullSubscriber() throws Throwable { optionalActivePublisherTest(1, true, new PublisherTestRun<T>() { @Override public void run(Publisher<T> pub) throws Throwable { try { pub.subscribe(null); env.flop(String.format("Publisher (%s) did not throw a NullPointerException when given a null Subscribe in subscribe", pub)); } catch (NullPointerException npe) { } env.verifyNoAsyncErrors(); } }); }

Target:
public void required_spec109_subscribeThrowNPEOnNullSubscriber() throws Throwable { activePublisherTest(0, false, new PublisherTestRun<T>() { @Override public void run(Publisher<T> pub) throws Throwable { try { pub.subscribe(null); env.flop(String.format("Publisher (%s) did not throw a NullPointerException when given a null Subscribe in subscribe", pub)); } catch (NullPointerException npe) { } env.verifyNoAsyncErrors(); } }); }
Source:
public void testIf() { IfLogicBeginBrick ifBrick = new IfLogicBeginBrick(); ifBrick.addBrickToIfBranch(brick); script.addBrick(ifBrick); Sprite cloneSprite = new SpriteController().copyForCloneBrick(sprite); Brick cloneIfLogicBrick = cloneSprite.getScript(0).getBrick(0); checkInNestedBrick((CompositeBrick) cloneIfLogicBrick); }

Target:
public void testIf() { IfLogicBeginBrick ifBrick = new IfLogicBeginBrick(); ifBrick.addBrickToIfBranch(brick); script.addBrick(ifBrick); Sprite cloneSprite = new SpriteController().copyForCloneBrick(sprite); Brick cloneIfLogicBrick = cloneSprite.getScript(0).getBrick(0); checkClonedBrickInNestedBrick((CompositeBrick) cloneIfLogicBrick); }
Source:
public void onResume() { super.onResume(); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeAsUpIndicator(R.drawable.ic_clear_24dp); actionBar.setTitle((getEditableItem() == null) ? getFlexString(R.string.DIALOG_TRIPMENU_TITLE_NEW) : getFlexString(R.string.DIALOG_TRIPMENU_TITLE_EDIT)); actionBar.setSubtitle(""); } if (focusedView != null) { focusedView.requestFocus(); } compositeDisposable = new CompositeDisposable(); compositeDisposable.add(getHideAutoCompleteVisibilityClick() .flatMap(tripTripPair -> presenter.updateTrip(tripTripPair.getFirst(), tripTripPair.getSecond())) .subscribe(tripOptional -> hideAutoCompleteValue(tripOptional.isPresent()) )); compositeDisposable.add(getUnHideAutoCompleteVisibilityClick() .flatMap(tripTripPair -> presenter.updateTrip(tripTripPair.getFirst(), tripTripPair.getSecond())) .subscribe(tripOptional -> unHideAutoCompleteValue(tripOptional.isPresent()) )); }

Target:
public void onResume() { super.onResume(); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeAsUpIndicator(R.drawable.ic_clear_24dp); actionBar.setTitle((getEditableItem() == null) ? getFlexString(R.string.DIALOG_TRIPMENU_TITLE_NEW) : getFlexString(R.string.DIALOG_TRIPMENU_TITLE_EDIT)); actionBar.setSubtitle(""); } if (focusedView != null) { focusedView.requestFocus(); } }
Source:
public void deleteByUnknownId() throws Exception { Venue venue = new Venue(new VenueGroup("group"), new VenueType("type"), Lists.newArrayList(new VenueName("Info", new Language("en")))); repository.create(new NewAccessPoint("ip", new MacAddress("aa:bb"), "sn", "model", venue)); repository.delete("id"); List<AccessPoint> found = repository.findAll(); assertThat(found.size(), is(1)); }

Target:
public void deleteByUnknownId() throws Exception { Venue venue = newVenueBuilder().build(); repository.create(new NewAccessPoint("ip", new MacAddress("aa:bb"), "sn", "model", venue)); repository.delete("id"); List<AccessPoint> found = repository.findAll(); assertThat(found.size(), is(1)); }
Source:
public FileChannel getFileChannel() { return (FileChannel) fFileChannel; }

Target:
public FileChannel getFileChannel() throws IOException, BadPcapFileException { FileChannel f = (FileChannel) fFileChannel; if (f.size() == 0) { throw new BadPcapFileException("It is not a FileChannel type."); } return f; }
Source:
public void launch(ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException { this.config = config; Oprofile.OprofileProject.setProject(getProject()); LaunchOptions options = new LaunchOptions(); options.loadConfiguration(config); IPath exePath = getExePath(config); options.setBinaryImage(exePath.toOSString()); OprofileDaemonEvent[] daemonEvents = null; if (!config.getAttribute(OprofileLaunchPlugin.ATTR_USE_DEFAULT_EVENT, false)) { OprofileCounter[] counters = OprofileCounter.getCounters(config); ArrayList<OprofileDaemonEvent> events = new ArrayList<OprofileDaemonEvent>(); for (int i = 0; i < counters.length; ++i) { if (counters[i].getEnabled()) events.add(counters[i].getDaemonEvent()); } daemonEvents = new OprofileDaemonEvent[events.size()]; events.toArray(daemonEvents); } if (!preExec(options, daemonEvents, launch)) return; IRemoteCommandLauncher launcher = RemoteProxyManager.getInstance().getLauncher(Oprofile.OprofileProject.getProject()); IRemoteFileProxy proxy = RemoteProxyManager.getInstance().getFileProxy(Oprofile.OprofileProject.getProject()); URI workingDirURI = proxy.getRemoteDir(); IPath workingDirPath = new Path(workingDirURI.getPath()); String arguments[] = getProgramArgumentsArray( config ); Process process = launcher.execute(exePath, arguments, getEnvironment(config), workingDirPath, monitor); DebugPlugin.newProcess( launch, process, renderProcessLabel( exePath.toOSString() ) ); postExec(options, daemonEvents, process); }

Target:
public void launch(ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException { this.config = config; Oprofile.OprofileProject.setProject(getProject()); LaunchOptions options = new LaunchOptions(); options.loadConfiguration(config); IPath exePath = getExePath(config); options.setBinaryImage(exePath.toOSString()); OprofileDaemonEvent[] daemonEvents = null; if (!config.getAttribute(OprofileLaunchPlugin.ATTR_USE_DEFAULT_EVENT, false)) { OprofileCounter[] counters = OprofileCounter.getCounters(config); ArrayList<OprofileDaemonEvent> events = new ArrayList<OprofileDaemonEvent>(); for (int i = 0; i < counters.length; ++i) { if (counters[i].getEnabled()) events.add(counters[i].getDaemonEvent()); } daemonEvents = new OprofileDaemonEvent[events.size()]; events.toArray(daemonEvents); } if (!preExec(options, daemonEvents, launch)) return; IRemoteCommandLauncher launcher = RemoteProxyManager.getInstance().getLauncher(Oprofile.OprofileProject.getProject()); IRemoteFileProxy proxy = RemoteProxyManager.getInstance().getFileProxy(Oprofile.OprofileProject.getProject()); URI workingDirURI = proxy.getWorkingDir(); IPath workingDirPath = new Path(workingDirURI.getPath()); String arguments[] = getProgramArgumentsArray( config ); Process process = launcher.execute(exePath, arguments, getEnvironment(config), workingDirPath, monitor); DebugPlugin.newProcess( launch, process, renderProcessLabel( exePath.toOSString() ) ); postExec(options, daemonEvents, process); }
Source:
private void downloadInParallel(int partCount) throws Exception { if (lastFullyMergedPartNumber == null) { lastFullyMergedPartNumber = 0; } ServiceUtils.createParentDirectoryIfNecessary(dstfile); for (int i = lastFullyMergedPartNumber + 1; i <= partCount; i++) { GetObjectRequest getPartRequest = new GetObjectRequest(req.getBucketName(), req.getKey(), req.getVersionId()).withUnmodifiedSinceConstraint(req.getUnmodifiedSinceConstraint()) .withModifiedSinceConstraint(req.getModifiedSinceConstraint()) .withResponseHeaders(req.getResponseHeaders()).withSSECustomerKey(req.getSSECustomerKey()) .withGeneralProgressListener(req.getGeneralProgressListener()); getPartRequest.setMatchingETagConstraints(req.getMatchingETagConstraints()); getPartRequest.setNonmatchingETagConstraints(req.getNonmatchingETagConstraints()); getPartRequest.setRequesterPays(req.isRequesterPays()); futureFiles.add( executor.submit(new DownloadPartCallable(s3, getPartRequest.withPartNumber(i), dstfile))); } combineFiles(); }

Target:
private void downloadInParallel(int partCount) throws Exception { if (lastFullyMergedPartNumber == null) { lastFullyMergedPartNumber = 0; } for (int i = lastFullyMergedPartNumber + 1; i <= partCount; i++) { GetObjectRequest getPartRequest = new GetObjectRequest(req.getBucketName(), req.getKey(), req.getVersionId()).withUnmodifiedSinceConstraint(req.getUnmodifiedSinceConstraint()) .withModifiedSinceConstraint(req.getModifiedSinceConstraint()) .withResponseHeaders(req.getResponseHeaders()).withSSECustomerKey(req.getSSECustomerKey()) .withGeneralProgressListener(req.getGeneralProgressListener()); getPartRequest.setMatchingETagConstraints(req.getMatchingETagConstraints()); getPartRequest.setNonmatchingETagConstraints(req.getNonmatchingETagConstraints()); getPartRequest.setRequesterPays(req.isRequesterPays()); futureFiles.add( executor.submit(new DownloadPartCallable(s3, getPartRequest.withPartNumber(i), dstfile))); } combineFiles(); }
Source:
PageData split(int splitPoint) { int newPageId = index.getPageStore().allocatePage(); PageDataLeaf p2 = PageDataLeaf.create(index, newPageId, parentPageId); for (; splitPoint < entryCount; ) { int split = p2.addRowTry(getRowAt(splitPoint)); if (split != -1) { DbException.throwInternalError("split " + split); } removeRow(splitPoint); } return p2; }

Target:
PageData split(int splitPoint) { int newPageId = index.getPageStore().allocatePage(); PageDataLeaf p2 = PageDataLeaf.create(index, newPageId, parentPageId); while (splitPoint < entryCount) { int split = p2.addRowTry(getRowAt(splitPoint)); if (split != -1) { DbException.throwInternalError("split " + split); } removeRow(splitPoint); } return p2; }
Source:
public void toScopedState(ScopedPersistentState state) { state.setProperty(STATE_CONSISTENT_HASH, this.getClass().getName()); state.setProperty(STATE_NUM_OWNERS, numOwners); state.setProperty(STATE_NUM_SEGMENTS, getNumSegments());; state.setProperty(STATE_MEMBERS, members.size()); for (int i = 0; i < members.size(); i++) { state.setProperty(String.format(STATE_MEMBER, i), JGroupsAddressCache.getPersistentUUID(members.get(i)).toString()); } state.setProperty(STATE_CAPACITY_FACTORS, capacityFactors.length); for (int i = 0; i < capacityFactors.length; i++) { state.setProperty(String.format(STATE_CAPACITY_FACTOR, i), capacityFactors[i]); } state.setProperty(STATE_SEGMENT_OWNERS, segmentOwners.length); for (int i = 0; i < segmentOwners.length; i++) { List<Address> segmentOwnerAddresses = segmentOwners[i]; state.setProperty(String.format(STATE_SEGMENT_OWNER_COUNT, i), segmentOwnerAddresses.size()); for(int j = 0; j < segmentOwnerAddresses.size(); j++) { state.setProperty(String.format(STATE_SEGMENT_OWNER, i, j), JGroupsAddressCache.getPersistentUUID(segmentOwnerAddresses.get(j)).toString()); } } state.setProperty(STATE_HASH_FUNCTION, hashFunction.getClass().getName()); }

Target:
public void toScopedState(ScopedPersistentState state) { state.setProperty(ConsistentHashPersistenceConstants.STATE_CONSISTENT_HASH, this.getClass().getName()); state.setProperty(STATE_NUM_OWNERS, numOwners); state.setProperty(STATE_NUM_SEGMENTS, getNumSegments());; state.setProperty(ConsistentHashPersistenceConstants.STATE_MEMBERS, members.size()); for (int i = 0; i < members.size(); i++) { state.setProperty(String.format(ConsistentHashPersistenceConstants.STATE_MEMBER, i), JGroupsAddressCache.getPersistentUUID(members.get(i)).toString()); } state.setProperty(STATE_CAPACITY_FACTORS, capacityFactors.length); for (int i = 0; i < capacityFactors.length; i++) { state.setProperty(String.format(STATE_CAPACITY_FACTOR, i), capacityFactors[i]); } state.setProperty(STATE_SEGMENT_OWNERS, segmentOwners.length); for (int i = 0; i < segmentOwners.length; i++) { List<Address> segmentOwnerAddresses = segmentOwners[i]; state.setProperty(String.format(STATE_SEGMENT_OWNER_COUNT, i), segmentOwnerAddresses.size()); for(int j = 0; j < segmentOwnerAddresses.size(); j++) { state.setProperty(String.format(STATE_SEGMENT_OWNER, i, j), JGroupsAddressCache.getPersistentUUID(segmentOwnerAddresses.get(j)).toString()); } } state.setProperty(ConsistentHashPersistenceConstants.STATE_HASH_FUNCTION, hashFunction.getClass().getName()); }
Source:
public String[] endPoints(String backupAddress) { String[] endpoints = backupAddress.split(COMMA_SEPARATOR); List<String> addresses = Arrays.stream(endpoints) .map(address -> address.contains(org.apache.dubbo.remoting.etcd.Constants.HTTP_SUBFIX_KEY) ? address : org.apache.dubbo.remoting.etcd.Constants.HTTP_KEY + address) .collect(toList()); Collections.shuffle(addresses); return addresses.toArray(new String[0]); }

Target:
public String[] endPoints(String backupAddress) { String[] endpoints = backupAddress.split(COMMA_SEPARATOR); List<String> addresses = Arrays.stream(endpoints) .map(address -> address.contains(HTTP_SUBFIX_KEY) ? address : HTTP_KEY + address) .collect(toList()); Collections.shuffle(addresses); return addresses.toArray(new String[0]); }
Source:
public synchronized void start() { if (!this.mRunning) { this.mLastTick = System.nanoTime(); if (this.mSoundManager != null) { this.mSoundManager.autoResume(); } this.mRunning = true; } }

Target:
public synchronized void start() { if (!this.mRunning) { this.mLastTick = System.nanoTime(); if (this.mSoundManager != null) { this.mSoundManager.onResume(); } this.mRunning = true; } }
Source:
private Partitioning createPartitioning(List<Symbol> partitioningColumns) { if (SYSTEM_PARTITIONING_PROVIDER.equals(partitioningProvider)) { return Partitioning.create(FIXED_HASH_DISTRIBUTION, ImmutableList.copyOf(partitioningColumns)); } List<Type> partitioningTypes = partitioningColumns.stream() .map(column -> symbolAllocator.getTypes().get(column)) .collect(toImmutableList()); PartitioningHandle partitioningHandle = metadata.getPartitioningHandle(session, partitioningProvider, hashPartitionCount, partitioningTypes); return Partitioning.create(partitioningHandle, partitioningColumns); }

Target:
private Partitioning createPartitioning(List<Symbol> partitioningColumns) { if (GlobalSystemConnector.NAME.equals(partitioningProviderCatalog)) { return Partitioning.create(FIXED_HASH_DISTRIBUTION, ImmutableList.copyOf(partitioningColumns)); } List<Type> partitioningTypes = partitioningColumns.stream() .map(column -> symbolAllocator.getTypes().get(column)) .collect(toImmutableList()); PartitioningHandle partitioningHandle = metadata.getPartitioningHandleForExchange(session, partitioningProviderCatalog, hashPartitionCount, partitioningTypes); return Partitioning.create(partitioningHandle, partitioningColumns); }
Source:
private void clearPreviousRelationships(Object parent, FieldInfo reader) { Long id = session.context().nativeId(parent); String type = reader.relationshipType(); Class endNodeType = DescriptorMappings.getType(reader.getTypeDescriptor()); if (reader.relationshipDirection().equals(Direction.INCOMING)) { deregisterIncomingRelationship(id, type, endNodeType); } else if (reader.relationshipDirection().equals(Direction.OUTGOING)) { deregisterOutgoingRelationship(id, type, endNodeType); } else { deregisterOutgoingRelationship(id, type, endNodeType); deregisterIncomingRelationship(id, type, endNodeType); } }

Target:
private void clearPreviousRelationships(Object parent, FieldInfo reader) { Long id = session.context().nativeId(parent); String type = reader.relationshipType(); Class endNodeType = DescriptorMappings.getType(reader.getTypeDescriptor()); switch (reader.relationshipDirection()) { case INCOMING: deregisterIncomingRelationship(id, type, endNodeType); return; case OUTGOING: deregisterOutgoingRelationship(id, type, endNodeType); return; default: deregisterOutgoingRelationship(id, type, endNodeType); deregisterIncomingRelationship(id, type, endNodeType); return; } }
Source:
void callback() throws InterruptedException; } private void withHandlingRuntimeException(final RunnableRawCallback cb) throws InterruptedException { try { cb.callback(); } catch (final DBIException e) { log.warn(String.format("%s: Thread %s got DBIException exception: %s", svcQName, Thread.currentThread().getName(), e)); } catch (final RuntimeException e) { log.warn(String.format("%s: Thread %s got Runtime exception: %s", svcQName, Thread.currentThread().getName(), e)); } }

Target:
void callback() throws InterruptedException; } private void withHandlingRuntimeException(final RunnableRawCallback cb) throws InterruptedException { try { cb.callback(); } catch (final DBIException e) { log.warn("{}: Thread got DBIException exception: ", svcQName, Thread.currentThread().getName(), e); } catch (final RuntimeException e) { log.warn("{}: Thread got Runtime exception: ", svcQName, Thread.currentThread().getName(), e); } }
Source:
public boolean visitPropertyCommand( Command.PropertyCommand command ) throws IOException { if ( command.getNodeId() != -1 ) { lockGroup.add( lockService.acquireNodeLock( command.getNodeId(), LockService.LockType.WRITE_LOCK ) ); } else if ( command.getRelId() != -1 ) { lockGroup.add( lockService.acquireRelationshipLock( command.getRelId(), LockService.LockType.WRITE_LOCK ) ); } PropertyRecord select = version.select( command ); neoStores.getPropertyStore().updateRecord( select ); return false; }

Target:
public boolean visitPropertyCommand( Command.PropertyCommand command ) throws IOException { if ( command.getNodeId() != -1 ) { lockGroup.add( lockService.acquireNodeLock( command.getNodeId(), LockService.LockType.WRITE_LOCK ) ); } else if ( command.getRelId() != -1 ) { lockGroup.add( lockService.acquireRelationshipLock( command.getRelId(), LockService.LockType.WRITE_LOCK ) ); } updateStore( neoStores.getPropertyStore(), command ); return false; }