auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testIteratorCloseHandleOnError() throws Exception { Spiffy s = dbi.onDemand(Spiffy.class); try { s.crashNow(); fail("Should throw a JDBIException"); } catch (JdbiException e) { assertThat(e).isNotNull(); } assertThat(tracker.hasOpenedHandle()).isFalse(); }

Target:
public void testIteratorCloseHandleOnError() throws Exception { Spiffy s = dbi.onDemand(Spiffy.class); assertThatExceptionOfType(JdbiException.class).isThrownBy(s::crashNow); assertThat(tracker.hasOpenedHandle()).isFalse(); }
Source:
public ListenableFuture<?> execute(CreateView statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, QueryStateMachine stateMachine, List<Expression> parameters) { Session session = stateMachine.getSession(); QualifiedObjectName name = createQualifiedObjectName(session, statement, statement.getName()); accessControl.checkCanCreateView(session.getRequiredTransactionId(), session.getIdentity(), name); String sql = getFormattedSql(statement.getQuery(), sqlParser, Optional.of(parameters)); Analysis analysis = analyzeStatement(statement, session, metadata, accessControl, parameters); List<ViewColumn> columns = analysis.getOutputDescriptor(statement.getQuery()) .getVisibleFields().stream() .map(field -> new ViewColumn(field.getName().get(), field.getType())) .collect(toImmutableList()); String data = codec.toJson(new ViewDefinition(sql, session.getCatalog(), session.getSchema(), columns, Optional.of(session.getUser()))); metadata.createView(session, name.getCatalogName(), new ConnectorViewDefinition(name.asSchemaTableName(), Optional.empty(), data, statement.getComment()), statement.isReplace()); return immediateFuture(null); }

Target:
public ListenableFuture<?> execute(CreateView statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, QueryStateMachine stateMachine, List<Expression> parameters) { Session session = stateMachine.getSession(); QualifiedObjectName name = createQualifiedObjectName(session, statement, statement.getName()); accessControl.checkCanCreateView(session.getRequiredTransactionId(), session.getIdentity(), name); String sql = getFormattedSql(statement.getQuery(), sqlParser, Optional.of(parameters)); Analysis analysis = analyzeStatement(statement, session, metadata, accessControl, parameters); List<ViewColumn> columns = analysis.getOutputDescriptor(statement.getQuery()) .getVisibleFields().stream() .map(field -> new ViewColumn(field.getName().get(), field.getType())) .collect(toImmutableList()); String data = codec.toJson(new ViewDefinition(sql, session.getCatalog(), session.getSchema(), columns, Optional.of(session.getUser()))); ConnectorViewDefinition definition = new ConnectorViewDefinition(name.asSchemaTableName(), Optional.empty(), data, statement.getComment()); metadata.createView(session, name.getCatalogName(), definition, statement.isReplace()); return immediateFuture(null); }
Source:
public void shouldStartPreviousSurvivedMutationsAtAStatusOfNotStartedWhenCoverageHasChanged() { final MutationDetails md = makeMutation("foo"); setHistoryForAllMutationsTo(DetectionStatus.SURVIVED); when( this.history.hasCoverageChanged(any(ClassName.class), isNull())).thenReturn(true); final Collection<MutationResult> actual = this.testee.analyse(Collections .singletonList(md)); assertEquals(DetectionStatus.NOT_STARTED, actual.iterator().next() .getStatus()); }

Target:
public void shouldStartPreviousSurvivedMutationsAtAStatusOfNotStartedWhenCoverageHasChanged() { final MutationDetails md = makeMutation("foo"); setHistoryForAllMutationsTo(DetectionStatus.SURVIVED); when(coverage.getCoverageIdForClass(any(ClassName.class))) .thenReturn(BigInteger.ONE); when( this.history.hasCoverageChanged(any(ClassName.class), any(BigInteger.class))).thenReturn(true); final Collection<MutationResult> actual = this.testee.analyse(singletonList(md)); assertThat(actual, hasItem(withStatus(NOT_STARTED))); assertThat(logCatcher.logEntries, hasItems( "Incremental analysis set 1 mutations to a status of NOT_STARTED", "Incremental analysis reduced number of mutations by 0" )); }
Source:
public static void assertValidatorMessage(Validator validator, Object object, String fieldName, String error) { String fieldNameAsLabel = fieldName; if (!error.startsWith(" ")) { error = " " + error; } try { Validate.entityThrowingException(validator, object); fail("Should have thrown exception"); } catch(InvalidEntityException e) { for (int i=0; i < e.getErrors().get(fieldName).size(); i++) { String msg = e.getErrors().get(fieldName).get(i); if ((fieldNameAsLabel+error).equals(msg)) { return; } } fail("Did not find error message in errors object"); } }

Target:
public static void assertValidatorMessage(Validator validator, Object object, String fieldName, String error) { String fieldNameAsLabel = fieldName; if (!error.startsWith(" ")) { error = " " + error; } try { Validate.entityThrowingException(validator, object); fail("Should have thrown exception"); } catch(InvalidEntityException e) { if (e.getErrors().get(fieldName).contains(fieldNameAsLabel+error)) { return; } fail("Did not find error message in errors object"); } }
Source:
public void run() { Future<T> future = null; try { if (done || cancelled || numTries >= maxTries) { return; } ++numTries; runThread = Thread.currentThread(); future = backgroundService.submit(this.callable); try { if (timeout > 0) { result = future.get(timeout, TimeUnit.MILLISECONDS); } else { result = future.get(); } } finally { future.cancel(true); } runThread = null; done(); } catch (Exception e) { if (e instanceof ExecutionException) { Throwable cause = e.getCause(); if (cause != null && cause instanceof Exception) { e = (Exception) e.getCause(); } } LOGGER.log(Level.INFO, "Exception executing task", e); runThread = null; exceptions.add(e); if (!cancelled && numTries < maxTries) { LOGGER.info("Resubmitting task to executor " + numTries + "/" + maxTries + " attempts"); SubmitTaskToExecutor retryTask = new SubmitTaskToExecutor(this); if (retryDelay <= 0L || retryTimer == null) { retryTask.run(); } else { retryTimer.schedule(retryTask, retryDelay); } } else { done(); } } }

Target:
public void run() { Future<T> future = null; try { if (done || cancelled || numTries >= maxTries) { return; } ++numTries; runThread = Thread.currentThread(); future = backgroundService.submit(this.callable); try { if (timeout > 0) { result = future.get(timeout, TimeUnit.MILLISECONDS); } else { result = future.get(); } } finally { future.cancel(true); } runThread = null; setDone(); } catch (Exception e) { if (e instanceof ExecutionException) { Throwable cause = e.getCause(); if (cause != null && cause instanceof Exception) { e = (Exception) cause; } } LOGGER.log(Level.INFO, "Exception executing task", e); runThread = null; exceptions.add(e); if (!cancelled && numTries < maxTries) { LOGGER.info("Resubmitting task to executor " + numTries + "/" + maxTries + " attempts"); SubmitTaskToExecutor retryTask = new SubmitTaskToExecutor(this); if (retryDelay <= 0L || retryTimer == null) { retryTask.run(); } else { retryTimer.schedule(retryTask, retryDelay); } } else { setDone(); } } }
Source:
public void start(Stage stage) throws Exception { FXMLLoader loader = new FXMLLoader(getClass().getResource("/views/window.fxml")); Parent root = loader.load(); final WindowController controller = (WindowController) loader.getController(); Scene scene = new Scene(root, 1200, 800); stage.setTitle("Cool demo!"); stage.setScene(scene); stage.show(); LibraryLoader libraryLoader = new LibraryLoader("library.xml"); libraryLoader.load(); scene.getWindow().setOnHidden(new EventHandler<WindowEvent>() { @Override public void handle(WindowEvent arg0) { PlayerService.getInstance().exit(); if (playlist != null) { XmlExport exporter = new XmlExport("library.xml", library); exporter.export(); } System.exit(0); } }); String directory = ""; DirectoryChooser directoryChooser = new DirectoryChooser(); File selectedDirectory = directoryChooser.showDialog(stage); if (selectedDirectory == null) { System.out.println("No directory selected."); System.exit(-1); } else { directory = selectedDirectory.getAbsolutePath(); } FolderLoader folderLoader = new FolderLoader(directory); playlist = folderLoader.load(); library.add(playlist); PlaylistSorter sorter = new GreedyPlaylistSorter(); Playlist mixablePlaylist = sorter.sort(playlist); controller.setLibrary(mixablePlaylist); }

Target:
public void start(Stage stage) throws Exception { FXMLLoader loader = new FXMLLoader(getClass().getResource("/views/window.fxml")); Parent root = (Parent) loader.load(); final WindowController controller = (WindowController) loader.getController(); App.controller = controller; Scene scene = new Scene(root, 1200, 800); stage.setTitle("Demo Sprint 3"); stage.setScene(scene); stage.show(); try { LibraryLoader libraryLoader = new LibraryLoader("library.xml"); library = libraryLoader.load(); if (library.size() < 1) { empty = true; } } catch (IOException e) { library = new Library(); empty = true; } scene.getWindow().setOnHidden(new EventHandler<WindowEvent>() { @Override public void handle(WindowEvent arg0) { PlayerService.getInstance().exit(); if (library != null) { XmlExport exporter = new XmlExport("library.xml", library); exporter.export(); System.out.println(library.size()); } System.exit(0); } }); if (empty) { String directory = ""; DirectoryChooser directoryChooser = new DirectoryChooser(); File selectedDirectory = directoryChooser.showDialog(null); if (selectedDirectory == null) { System.out.println("No directory selected."); System.exit(-1); } else { directory = selectedDirectory.getAbsolutePath(); } FolderLoader folderLoader = new FolderLoader(directory); String playlistname = PlaylistName.getName(directory); Playlist playlist = folderLoader.load(); PlaylistSorter sorter = new GreedyPlaylistSorter(); Playlist mixablePlaylist = sorter.sort(playlist); controller.setEverything(mixablePlaylist, playlistname); } else { controller.setLibrary(library); } }
Source:
public static void setCookieHeaders(@NonNull Map<String, String> headers) { if (cookie == null) { Timber.e("Cookie was empty for some reason, trying to restore cookie"); restoreLoginCookies(AwfulPreferences.getInstance().getContext()); } if (!cookie.isEmpty()) { headers.put(COOKIE_HEADER, cookie); } }

Target:
public static void setCookieHeaders(@NonNull Map<String, String> headers) { if (cookie == null) { Timber.w("Cookie was empty for some reason, trying to restore cookie"); restoreLoginCookies(AwfulPreferences.getInstance().getContext()); } if (!cookie.isEmpty()) { headers.put(COOKIE_HEADER, cookie); } }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final TaskStatusPlus that = (TaskStatusPlus) o; if (!id.equals(that.id)) { return false; } if (!type.equals(that.type)) { return false; } if (!createdTime.equals(that.createdTime)) { return false; } if (!queueInsertionTime.equals(that.queueInsertionTime)) { return false; } if (!Objects.equals(state, that.state)) { return false; } if (!Objects.equals(duration, that.duration)) { return false; } if (!Objects.equals(location, that.location)) { return false; } if (!Objects.equals(errorMsg, that.errorMsg)) { return false; } if (!Objects.equals(location, that.location)) { return false; } return Objects.equals(context, that.context); }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } TaskStatusPlus that = (TaskStatusPlus) o; return Objects.equals(getId(), that.getId()) && Objects.equals(getType(), that.getType()) && Objects.equals(getCreatedTime(), that.getCreatedTime()) && Objects.equals(getQueueInsertionTime(), that.getQueueInsertionTime()) && getState() == that.getState() && Objects.equals(getDuration(), that.getDuration()) && Objects.equals(getLocation(), that.getLocation()) && Objects.equals(getDataSource(), that.getDataSource()) && Objects.equals(getErrorMsg(), that.getErrorMsg()); }
Source:
private Method findMethod(Class itf, String methodName, Class[] params) { assert itf.isInterface(); Method res = null; try { res = itf.getDeclaredMethod(methodName, params); if (res != null) return res; } catch (NoSuchMethodException ignored) { } Class[] superItfs = itf.getInterfaces(); for (Class superItf: superItfs) { res = findMethod(superItf, methodName, params); if (res != null) return res; } return res; }

Target:
private Method findMethod(Class itf, String methodName, Class[] params) { assert itf.isInterface() : itf + " must represent the interface"; Method res = null; try { res = itf.getDeclaredMethod(methodName, params); if (res != null) return res; } catch (NoSuchMethodException ignored) { } Class[] superItfs = itf.getInterfaces(); for (Class superItf: superItfs) { res = findMethod(superItf, methodName, params); if (res != null) return res; } return res; }
Source:
public void subscribedEntityChanged(SubscriptionAwareEntity entity, Collection<JCUser> excludeFromNotification) { Collection<JCUser> subscribers = subscriptionService.getAllowedSubscribers(entity); filterSubscribers(subscribers, entity); for (JCUser user : subscribers) { if (!excludeFromNotification.contains(user)) { mailService.sendUpdatesOnSubscription(user, entity); } } }

Target:
public void subscribedEntityChanged(SubscriptionAwareEntity entity, Collection<JCUser> excludeFromNotification) { Collection<JCUser> subscribers = subscriptionService.getAllowedSubscribers(entity); subscribers.removeAll(excludeFromNotification); filterSubscribers(subscribers, entity); for (JCUser user : subscribers) { mailService.sendUpdatesOnSubscription(user, entity); } }
Source:
public HashSet<String> getValues(final ProgressMonitor pm){ HashSet<String> ret = new HashSet<String>(); try { long rowCount=ds.getRowCount(); pm.startTask(I18N.tr("Retrieving classes"), 10); pm.progressTo(0); double m = rowCount>0 ?(double)10/rowCount : 0; int n =0; int fieldIndex = ds.getFieldIndexByName(fieldName); boolean moveOn = false; final int warn = 100; for(long i=0; i<rowCount; i++){ Value val = ds.getFieldValue(i, fieldIndex); ret.add(val.toString()); if(ret.size() == warn && !moveOn){ final UIPanel cancel = new CancelPanel(warn); try{ SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { if(!UIFactory.showDialog(cancel,true, true)){ pm.setCancelled(true); } } }); } catch (Exception ie){ LOGGER.warn(I18N.tr("The application has ended unexpectedly")); } } if(i*m>n*10){ n++; pm.progressTo(n); } if(pm.isCancelled()){ pm.endTask(); return null; } } } catch (DriverException e) { LOGGER.error("IO error while handling the input data source : " + e.getMessage()); } pm.endTask(); return ret; }

Target:
public HashSet<String> getValues(final ProgressMonitor pm){ HashSet<String> ret = new HashSet<String>(); try { long rowCount=ds.getRowCount(); pm.startTask(I18N.tr("Retrieving classes"), 10); pm.progressTo(0); double m = rowCount>0 ?(double)10/rowCount : 0; int n =0; int fieldIndex = ds.getFieldIndexByName(fieldName); final int warn = 100; for(long i=0; i<rowCount; i++){ Value val = ds.getFieldValue(i, fieldIndex); ret.add(val.toString()); if(ret.size() == warn){ final UIPanel cancel = new CancelPanel(warn); try{ SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { if(!UIFactory.showDialog(cancel,true, true)){ pm.setCancelled(true); } } }); } catch (Exception ie){ LOGGER.warn(I18N.tr("The application has ended unexpectedly")); } } if(i*m>n*10){ n++; pm.progressTo(n); } if(pm.isCancelled()){ pm.endTask(); return null; } } } catch (DriverException e) { LOGGER.error("IO error while handling the input data source : " + e.getMessage()); } pm.endTask(); return ret; }
Source:
public void cherryPickSameBranch() throws Exception { CherryPickInput in = new CherryPickInput(); in.destination = "master"; in.message = "it generates a new patch set"; PushOneCommit.Result r1 = createChange(); PushOneCommit push = pushFactory.create(db, admin.getIdent(), PushOneCommit.SUBJECT, "another_file.txt", "another content"); PushOneCommit.Result r2 = push.to(git, "refs/for/master"); ChangeApi orig = gApi.changes() .id("p~master~" + r2.getChangeId()); ChangeApi cherry = orig.revision(r2.getCommit().name()) .cherryPick(in); ChangeInfo cherryInfo = cherry.get(); assertThat((Iterable<?>)cherryInfo.messages).hasSize(1); Iterator<ChangeMessageInfo> cherryIt = cherryInfo.messages.iterator(); assertThat(cherryIt.next().message).isEqualTo("Cherry picked as patch set 2."); }

Target:
public void cherryPickSameBranch() throws Exception { createChange(); PushOneCommit push = pushFactory.create(db, admin.getIdent(), PushOneCommit.SUBJECT, "another_file.txt", "another content"); PushOneCommit.Result r2 = push.to(git, "refs/for/master"); CherryPickInput in = new CherryPickInput(); in.destination = "master"; in.message = "it generates a new patch set\n\nChange-Id: " + r2.getChangeId(); ChangeApi orig = gApi.changes() .id("p~master~" + r2.getChangeId()); ChangeApi cherry = orig.revision(r2.getCommit().name()) .cherryPick(in); ChangeInfo cherryInfo = cherry.get(); assertThat((Iterable<?>)cherryInfo.messages).hasSize(2); Iterator<ChangeMessageInfo> cherryIt = cherryInfo.messages.iterator(); assertThat(cherryIt.next().message).isEqualTo("Uploaded patch set 1."); assertThat(cherryIt.next().message).isEqualTo("Cherry picked as patch set 2."); }
Source:
public SideEffectSet(Map<SideEffect, SideEffect.State> sideEffects) { this.sideEffects = Maps.immutableEnumMap(sideEffects); appliesAny = sideEffects.values().stream().anyMatch(state -> state != SideEffect.State.OFF); appliedSideEffects = sideEffects.entrySet() .stream() .filter(entry -> entry.getValue() != SideEffect.State.OFF) .map(Map.Entry::getKey) .collect(Collectors.toSet()); }

Target:
public SideEffectSet(Map<SideEffect, SideEffect.State> sideEffects) { this.sideEffects = Maps.immutableEnumMap(sideEffects); appliedSideEffects = sideEffects.entrySet() .stream() .filter(entry -> entry.getValue() != SideEffect.State.OFF) .map(Map.Entry::getKey) .collect(Collectors.toSet()); appliesAny = !appliedSideEffects.isEmpty(); }
Source:
public OrcInputStream( OrcDataSourceId orcDataSourceId, FixedLengthSliceInput sliceInput, Optional<OrcDecompressor> decompressor, AggregatedMemoryContext systemMemoryContext, long sliceInputRetainedSizeInBytes) { this.orcDataSourceId = requireNonNull(orcDataSourceId, "orcDataSource is null"); requireNonNull(sliceInput, "sliceInput is null"); this.decompressor = requireNonNull(decompressor, "decompressor is null"); requireNonNull(systemMemoryContext, "systemMemoryContext is null"); this.bufferMemoryUsage = systemMemoryContext.newLocalMemoryContext(OrcInputStream.class.getSimpleName()); checkArgument(sliceInputRetainedSizeInBytes >= 0, "sliceInputRetainedSizeInBytes is negative"); systemMemoryContext.newLocalMemoryContext(OrcInputStream.class.getSimpleName()).setBytes(sliceInputRetainedSizeInBytes); if (!decompressor.isPresent()) { long sliceInputPosition = sliceInput.position(); this.buffer = new byte[toIntExact(sliceInput.remaining())]; this.length = buffer.length; sliceInput.readFully(buffer, toIntExact(sliceInput.position()), toIntExact(sliceInput.remaining())); sliceInput.setPosition(sliceInputPosition); this.compressedSliceInput = EMPTY_SLICE.getInput(); } else { this.compressedSliceInput = sliceInput; this.buffer = new byte[0]; } }

Target:
public OrcInputStream( OrcDataSourceId orcDataSourceId, FixedLengthSliceInput sliceInput, Optional<OrcDecompressor> decompressor, AggregatedMemoryContext systemMemoryContext, long sliceInputRetainedSizeInBytes) { this.orcDataSourceId = requireNonNull(orcDataSourceId, "orcDataSource is null"); requireNonNull(sliceInput, "sliceInput is null"); this.decompressor = requireNonNull(decompressor, "decompressor is null"); requireNonNull(systemMemoryContext, "systemMemoryContext is null"); this.bufferMemoryUsage = systemMemoryContext.newLocalMemoryContext(OrcInputStream.class.getSimpleName()); checkArgument(sliceInputRetainedSizeInBytes >= 0, "sliceInputRetainedSizeInBytes is negative"); systemMemoryContext.newLocalMemoryContext(OrcInputStream.class.getSimpleName()).setBytes(sliceInputRetainedSizeInBytes); if (!decompressor.isPresent()) { int sliceInputPosition = toIntExact(sliceInput.position()); int sliceInputRemaining = toIntExact(sliceInput.remaining()); this.buffer = new byte[sliceInputRemaining]; this.length = buffer.length; sliceInput.readFully(buffer, sliceInputPosition, sliceInputRemaining); this.compressedSliceInput = EMPTY_SLICE.getInput(); } else { this.compressedSliceInput = sliceInput; this.buffer = new byte[0]; } }
Source:
public void testTableWithInvalidBucketNumber() throws Exception { long ts = nextTimestamp(); String url = PHOENIX_JDBC_URL + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); Properties props = new Properties(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { String query = "create table salted_table (a_integer integer not null CONSTRAINT pk PRIMARY KEY (a_integer)) SALT_BUCKETS = 129"; PreparedStatement stmt = conn.prepareStatement(query); stmt.execute(); fail("Should have caught exception"); } catch (SQLException e) { assertTrue(e.getMessage(), e.getMessage().contains("ERROR 1021 (42Y80): Salt bucket numbers should be with 1 and 128.")); } finally { conn.close(); } }

Target:
public void testTableWithInvalidBucketNumber() throws Exception { long ts = nextTimestamp(); String url = PHOENIX_JDBC_URL + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5); Properties props = new Properties(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { String query = "create table salted_table (a_integer integer not null CONSTRAINT pk PRIMARY KEY (a_integer)) SALT_BUCKETS = 257"; PreparedStatement stmt = conn.prepareStatement(query); stmt.execute(); fail("Should have caught exception"); } catch (SQLException e) { assertTrue(e.getMessage(), e.getMessage().contains("ERROR 1021 (42Y80): Salt bucket numbers should be with 1 and 256.")); } finally { conn.close(); } }
Source:
private void pingHandlerClaim(final DirectBuffer buffer, final int offset, final int length, final Header header) { if (buffer.getByte(offset + 0) == (byte)'q') { running.set(false); return; } if (pongPub.tryClaim(length, bufferClaim) >= 0) { try { final MutableDirectBuffer newBuffer = bufferClaim.buffer(); newBuffer.putBytes(bufferClaim.offset(), buffer, offset, length); } catch (final Exception e) { e.printStackTrace(); } finally { bufferClaim.commit(); } } else { pingHandlerClaim(buffer, offset, length, header); } }

Target:
private void pingHandlerClaim(final DirectBuffer buffer, final int offset, final int length, final Header header) { if (buffer.getByte(offset + 0) == (byte)'q') { running.set(false); return; } if (pongPub.tryClaim(length, bufferClaim) >= 0) { final MutableDirectBuffer newBuffer = bufferClaim.buffer(); newBuffer.putBytes(bufferClaim.offset(), buffer, offset, length); bufferClaim.commit(); } else { pingHandlerClaim(buffer, offset, length, header); } }
Source:
private ConnectorBucketNodeMap getConnectorBucketNodeMap(Session session, PartitioningHandle partitioningHandle) { checkArgument(!(partitioningHandle.getConnectorHandle() instanceof SystemPartitioningHandle)); ConnectorNodePartitioningProvider partitioningProvider = partitioningProviders.get(partitioningHandle.getConnectorId().get()); checkArgument(partitioningProvider != null, "No partitioning provider for connector %s", partitioningHandle.getConnectorId().get()); ConnectorBucketNodeMap connectorBucketNodeMap = partitioningProvider.getBucketNodeMap( partitioningHandle.getTransactionHandle().orElse(null), session.toConnectorSession(), partitioningHandle.getConnectorHandle()); checkArgument(connectorBucketNodeMap != null, "No partition map %s", partitioningHandle); if (connectorBucketNodeMap.hasFixedMapping()) { checkArgument(!connectorBucketNodeMap.getFixedMapping().isEmpty(), "Partition map %s is empty", partitioningHandle); } return connectorBucketNodeMap; }

Target:
private ConnectorBucketNodeMap getConnectorBucketNodeMap(Session session, PartitioningHandle partitioningHandle) { checkArgument(!(partitioningHandle.getConnectorHandle() instanceof SystemPartitioningHandle)); ConnectorNodePartitioningProvider partitioningProvider = partitioningProviders.get(partitioningHandle.getConnectorId().get()); checkArgument(partitioningProvider != null, "No partitioning provider for connector %s", partitioningHandle.getConnectorId().get()); ConnectorBucketNodeMap connectorBucketNodeMap = partitioningProvider.getBucketNodeMap( partitioningHandle.getTransactionHandle().orElse(null), session.toConnectorSession(), partitioningHandle.getConnectorHandle()); checkArgument(connectorBucketNodeMap != null, "No partition map %s", partitioningHandle); return connectorBucketNodeMap; }
Source:
public void run() { PrivilegedExceptionAction<Object> doAsAction = new PrivilegedExceptionAction<Object>() { @Override public Object run() throws HiveSQLException { Hive.set(parentHive); SessionState.setCurrentSessionState(parentSessionState); PerfLogger.setPerfLogger(SessionState.getPerfLogger()); LogUtils.registerLoggingContext(queryState.getConf()); try { if (asyncPrepare) { prepare(queryState); } runQuery(); } catch (HiveSQLException e) { setOperationException(e); LOG.error("Error running hive query: ", e); } finally { Hive.closeCurrent(); LogUtils.unregisterLoggingContext(); } return null; } }; try { currentUGI.doAs(doAsAction); } catch (Exception e) { setOperationException(new HiveSQLException(e)); LOG.error("Error running hive query as user : " + currentUGI.getShortUserName(), e); } finally { if (ThreadWithGarbageCleanup.currentThread() instanceof ThreadWithGarbageCleanup) { ThreadWithGarbageCleanup currentThread = (ThreadWithGarbageCleanup) ThreadWithGarbageCleanup.currentThread(); currentThread.cacheThreadLocalRawStore(); } } }

Target:
public void run() { PrivilegedExceptionAction<Object> doAsAction = new PrivilegedExceptionAction<Object>() { @Override public Object run() throws HiveSQLException { Hive.set(parentHive); SessionState.setCurrentSessionState(parentSessionState); PerfLogger.setPerfLogger(SessionState.getPerfLogger()); LogUtils.registerLoggingContext(queryState.getConf()); try { if (asyncPrepare) { prepare(queryState); } runQuery(); } catch (HiveSQLException e) { setOperationException(e); LOG.error("Error running hive query: ", e); } finally { LogUtils.unregisterLoggingContext(); Hive hiveDb = Hive.getThreadLocal(); if (hiveDb != null && hiveDb != parentHive) { Hive.closeCurrent(); } } return null; } }; try { currentUGI.doAs(doAsAction); } catch (Exception e) { setOperationException(new HiveSQLException(e)); LOG.error("Error running hive query as user : " + currentUGI.getShortUserName(), e); } finally { if (ThreadWithGarbageCleanup.currentThread() instanceof ThreadWithGarbageCleanup) { ThreadWithGarbageCleanup currentThread = (ThreadWithGarbageCleanup) ThreadWithGarbageCleanup.currentThread(); currentThread.cacheThreadLocalRawStore(); } } }
Source:
public void call(final Subscriber<? super T> o) { final Iterator<? extends T> it = is.iterator(); final Scheduler.Worker trampoline = Schedulers.trampoline().createWorker(); o.add(trampoline); o.setProducer(new Producer() { final AtomicInteger requested = new AtomicInteger(); @Override public void request(int n) { int _c = requested.getAndAdd(n); if (_c == 0) { trampoline.schedule(new Action0() { @Override public void call() { while (it.hasNext()) { if (o.isUnsubscribed()) { return; } int c = requested.decrementAndGet(); T t = it.next(); o.onNext(t); if (c == 0) { return; } } if (o.isUnsubscribed()) { return; } o.onCompleted(); } }); } } }); }

Target:
public void call(final Subscriber<? super T> o) { final Iterator<? extends T> it = is.iterator(); o.setProducer(new Producer() { final AtomicInteger requested = new AtomicInteger(); @Override public void request(int n) { System.out.println("onSubscribeFromIterable.request: " + n); int _c = requested.getAndAdd(n); if (_c == 0) { while (it.hasNext()) { if (o.isUnsubscribed()) { return; } T t = it.next(); o.onNext(t); if (requested.decrementAndGet() == 0) { return; } } o.onCompleted(); } } }); }
Source:
private void completeWithEmptyResponse( CollectCoordinationRequest request, CompletableFuture<CoordinationResponse> future) { try { future.complete(new CollectCoordinationResponse<>( request.getVersion(), 0, Collections.emptyList(), LongSerializer.INSTANCE)); } catch (IOException e) { future.completeExceptionally(e); } }

Target:
private void completeWithEmptyResponse( CollectCoordinationRequest request, CompletableFuture<CoordinationResponse> future) { try { future.complete(new CollectCoordinationResponse<>( request.getVersion(), -1, Collections.emptyList(), LongSerializer.INSTANCE)); } catch (IOException e) { future.completeExceptionally(e); } }
Source:
public List<MemorySegment> requestMemorySegments() throws IOException { if (numberOfSegmentsToRequest <= 0) { return Collections.emptyList(); } synchronized (factoryLock) { if (isDestroyed) { throw new IllegalStateException("Network buffer pool has already been destroyed."); } tryRedistributeBuffers(); } final List<MemorySegment> segments = new ArrayList<>(numberOfSegmentsToRequest); try { final Deadline deadline = Deadline.fromNow(requestSegmentsTimeout); while (true) { if (isDestroyed) { throw new IllegalStateException("Buffer pool is destroyed."); } MemorySegment segment; synchronized (availableMemorySegments) { if ((segment = internalRequestMemorySegment()) == null) { availableMemorySegments.wait(2000); } } if (segment != null) { segments.add(segment); } if (segments.size() >= numberOfSegmentsToRequest) { break; } if (!deadline.hasTimeLeft()) { throw new IOException(String.format("Timeout triggered when requesting exclusive buffers: %s, " + " or you may increase the timeout which is %dms by setting the key '%s'.", getConfigDescription(), requestSegmentsTimeout.toMillis(), NettyShuffleEnvironmentOptions.NETWORK_EXCLUSIVE_BUFFERS_REQUEST_TIMEOUT_MILLISECONDS.key())); } } } catch (Throwable e) { try { recycleMemorySegments(segments, numberOfSegmentsToRequest); } catch (IOException inner) { e.addSuppressed(inner); } ExceptionUtils.rethrowIOException(e); } return segments; }

Target:
public List<MemorySegment> requestMemorySegments() throws IOException { synchronized (factoryLock) { if (isDestroyed) { throw new IllegalStateException("Network buffer pool has already been destroyed."); } if (numberOfSegmentsToRequest == 0) { return Collections.emptyList(); } tryRedistributeBuffers(); } final List<MemorySegment> segments = new ArrayList<>(numberOfSegmentsToRequest); try { final Deadline deadline = Deadline.fromNow(requestSegmentsTimeout); while (true) { if (isDestroyed) { throw new IllegalStateException("Buffer pool is destroyed."); } MemorySegment segment; synchronized (availableMemorySegments) { if ((segment = internalRequestMemorySegment()) == null) { availableMemorySegments.wait(2000); } } if (segment != null) { segments.add(segment); } if (segments.size() >= numberOfSegmentsToRequest) { break; } if (!deadline.hasTimeLeft()) { throw new IOException(String.format("Timeout triggered when requesting exclusive buffers: %s, " + " or you may increase the timeout which is %dms by setting the key '%s'.", getConfigDescription(), requestSegmentsTimeout.toMillis(), NettyShuffleEnvironmentOptions.NETWORK_EXCLUSIVE_BUFFERS_REQUEST_TIMEOUT_MILLISECONDS.key())); } } } catch (Throwable e) { try { recycleMemorySegments(segments, numberOfSegmentsToRequest); } catch (IOException inner) { e.addSuppressed(inner); } ExceptionUtils.rethrowIOException(e); } return segments; }
Source:
public void testXmlToObject() throws Exception { SimpleBean obj = new SimpleBean(); Reader in = new StringReader(xml); handler.toObject(ai, in, obj); assertNotNull(obj); assertEquals(obj.getName(), "Jan"); assertEquals(obj.getAge().longValue(), 12L); assertNotNull(obj.getParents()); assertThat(obj.getParents()) .hasSize(2) .containsExactly("Adam", "Ewa"); }

Target:
public void testXmlToObject() throws Exception { SimpleBean obj = new SimpleBean(); Reader in = new StringReader(xml); handler.toObject(ai, in, obj); assertNotNull(obj); assertEquals("Jan", obj.getName()); assertEquals(12L, obj.getAge().longValue()); assertNotNull(obj.getParents()); assertThat(obj.getParents()) .hasSize(2) .containsExactly("Adam", "Ewa"); }
Source:
public void setMenuItems(@Nullable List<CarMenuItem> items) { mMenuItems = items; mOverflowMenuItems.clear(); mActionViews.forEach(this::removeView); mActionViews.clear(); List<CarMenuItem> actionItems = new ArrayList<>(); List<CarMenuItem> ifRoomItems = new ArrayList<>(); if (mMenuItems != null) { for (CarMenuItem item : mMenuItems) { if (item.getDisplayBehavior() == CarMenuItem.DisplayBehavior.ALWAYS) { actionItems.add(item); } else if (item.getDisplayBehavior() == CarMenuItem.DisplayBehavior.IF_ROOM) { ifRoomItems.add(item); } else { mOverflowMenuItems.add(item); } } } for (CarMenuItem item : ifRoomItems) { if (item.isCheckable() || actionItems.size() < RECOMMENDED_ACTION_ITEM_LIMIT) { actionItems.add(item); } else { mOverflowMenuItems.add(0, item); } } mOverflowButtonView.setVisibility(mOverflowMenuItems.isEmpty() ? GONE : VISIBLE); for (CarMenuItem item : actionItems) { View action = item.isCheckable() ? createCheckableAction(item) : createAction(item); MarginLayoutParams marginLayoutParams = new MarginLayoutParams(LayoutParams.WRAP_CONTENT, mActionButtonHeight); action.setLayoutParams(marginLayoutParams); mActionViews.add(action); addView(action); } requestLayout(); }

Target:
public void setMenuItems(@Nullable List<CarMenuItem> items) { mMenuItems = items; mActionItems.forEach(indexedItem -> removeView(indexedItem.mView)); mActionItems.clear(); mOverflowMenuItems.clear(); if (mMenuItems != null) { int alwaysItemCount = 0; for (CarMenuItem item : mMenuItems) { if (item.getDisplayBehavior() == CarMenuItem.DisplayBehavior.ALWAYS) { alwaysItemCount++; } } int ifRoomActionCapacity = ACTION_ITEM_COUNT_LIMIT - alwaysItemCount; for (int i = 0; i < mMenuItems.size(); i++) { CarMenuItem item = mMenuItems.get(i); if (item.getDisplayBehavior() == CarMenuItem.DisplayBehavior.ALWAYS || (item.getDisplayBehavior() == CarMenuItem.DisplayBehavior.IF_ROOM && ifRoomActionCapacity > 0)) { View action = item.isCheckable() ? createCheckableAction(item) : createAction(item); mActionItems.add(new IndexedMenuItem(item, action, i)); addView(action); if (item.getDisplayBehavior() == CarMenuItem.DisplayBehavior.IF_ROOM) { ifRoomActionCapacity--; } } else { mOverflowMenuItems.add(new IndexedMenuItem(item, null, i)); } } } mOverflowButtonView.setVisibility(mOverflowMenuItems.isEmpty() ? GONE : VISIBLE); requestLayout(); }
Source:
@Override protected void stop0(boolean cancel, boolean destroy) { cctx.kernalContext().cache().cleanup(cctx.config(),plc,cctx.isNear()); }

Target:
@Override protected void stop0(boolean cancel, boolean destroy) { cleanup(cctx.config(),plc,cctx.isNear()); }
Source:
private boolean isRecoverable(List<ExecutionFailureInfo> failures) { return stageTaskRecoveryCallback.isPresent() && failedTasks.size() + 1 < allTasks.size() * maxFailedTaskPercentage && failures.stream().map(ExecutionFailureInfo::getErrorCode).allMatch(RECOVERABLE_ERROR_CODES::contains); }

Target:
private boolean isRecoverable(List<ExecutionFailureInfo> failures) { for (ExecutionFailureInfo failure : failures) { if (!RECOVERABLE_ERROR_CODES.contains(failure.getErrorCode())) { return false; } } return stageTaskRecoveryCallback.isPresent() && failedTasks.size() + 1 < allTasks.size() * maxFailedTaskPercentage; }
Source:
public void testUnapplyNull() { if (NullHandling.sqlCompatible()) { Assert.assertEquals(Collections.emptyList(), loadingLookup.unapply(null)); } else { Assert.assertEquals(null, loadingLookup.unapply(null)); } }

Target:
public void testUnapplyNull() { if (NullHandling.sqlCompatible()) { Assert.assertEquals(Collections.emptyList(), loadingLookup.unapply(null)); } else { Assert.assertNull(loadingLookup.unapply(null)); } }
Source:
protected void runAutonomous() throws InterruptedException, AutonomousModeOverException { setClampHeight(1.0f); collectTote(); if (containerToCollect.get() && collectContainers.get()) { setClampHeight(0.0f); setClampOpen(true); drive(nudge.get()); setClampOpen(false); setClampHeight(1.0f); } drive(toteDistance.get()); collectTote(); if (!containerToCollect.get() && collectContainers.get()) { setClampHeight(0.0f); setClampOpen(true); drive(nudge.get()); setClampOpen(false); setClampHeight(1.0f); } drive(toteDistance.get()); collectTote(); turn(90); drive(autoZoneDistance.get()); if (collectContainers.get()) { setClampHeight(0.0f); setClampOpen(true); setClampHeight(1.0f); DriveCode.octocanumShifting.set(true); strafe(1.0f, strafeTime.get()); } ejectTotes(); DriveCode.octocanumShifting.set(false); }

Target:
protected void runAutonomous() throws InterruptedException, AutonomousModeOverException { boolean bothEnabled = collectFirstContainer.get() && collectSecondContainer.get(); if (bothEnabled) { Logger.warning("Can't collect two containers! Go sit in the corner and think about what you've done."); } setClampHeight(1.0f); collectTote(); if (collectFirstContainer.get() || bothEnabled) { setClampHeight(0.0f); setClampOpen(true); drive(nudge.get()); setClampOpen(false); setClampHeight(1.0f); } drive(toteDistance.get()); collectTote(); if (collectSecondContainer.get() ^ bothEnabled) { setClampHeight(0.0f); setClampOpen(true); drive(nudge.get()); setClampOpen(false); setClampHeight(1.0f); } drive(toteDistance.get()); collectTote(); turn(90); drive(autoZoneDistance.get()); if (collectFirstContainer.get() || collectSecondContainer.get()) { setClampHeight(0.0f); setClampOpen(true); setClampHeight(1.0f); DriveCode.octocanumShifting.set(true); strafe(1.0f, strafeTime.get()); } ejectTotes(); DriveCode.octocanumShifting.set(false); }
Source:
private void fillModelList() { modelDisplay = new ArrayList<DisplayPair>(); modelIds = new ArrayList<Long>(); for (int i = 0; i < models.size(); i++) { try { modelIds.add(models.get(i).getLong("id")); modelDisplay.add(new DisplayPair(models.get(i).getString("name"), cardCounts.get(i))); } catch (JSONException e) { closeActivity(DB_ERROR_EXIT); } } noteTypeArrayAdapter = new DisplayPairAdapter(this, modelDisplay); noteTypeListView.setAdapter(noteTypeArrayAdapter); noteTypeListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { long noteTypeID = modelIds.get(position); currentPos = position; Intent noteOpenIntent = new Intent(ModelBrowser.this, ModelFieldEditor.class); noteOpenIntent.putExtra("title", modelDisplay.get(position).getName()); noteOpenIntent.putExtra("noteTypeID", noteTypeID); startActivityForResultWithAnimation(noteOpenIntent, 0, ActivityTransitionAnimation.LEFT); } }); noteTypeListView.setOnItemLongClickListener(new OnItemLongClickListener() { public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { String cardName = modelDisplay.get(position).getName(); currentID = modelIds.get(position); currentPos = position; cMenu = new ModelBrowserContextMenu().newInstance(cardName, mContextMenuListener); showDialogFragment(cMenu); return true; } }); updateSubtitleText(); }

Target:
private void fillModelList() { mModelDisplayList = new ArrayList<DisplayPair>(); mModelIds = new ArrayList<Long>(); for (int i = 0; i < mModels.size(); i++) { try { mModelIds.add(mModels.get(i).getLong("id")); mModelDisplayList.add(new DisplayPair(mModels.get(i).getString("name"), mCardCounts.get(i))); } catch (JSONException e) { throw new RuntimeException(e); } } mModelDisplayAdapter = new DisplayPairAdapter(this, mModelDisplayList); mModelListView.setAdapter(mModelDisplayAdapter); mModelListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { long noteTypeID = mModelIds.get(position); mModelListPosition = position; Intent noteOpenIntent = new Intent(ModelBrowser.this, ModelFieldEditor.class); noteOpenIntent.putExtra("title", mModelDisplayList.get(position).getName()); noteOpenIntent.putExtra("noteTypeID", noteTypeID); startActivityForResultWithAnimation(noteOpenIntent, 0, ActivityTransitionAnimation.LEFT); } }); mModelListView.setOnItemLongClickListener(new OnItemLongClickListener() { public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { String cardName = mModelDisplayList.get(position).getName(); mCurrentID = mModelIds.get(position); mModelListPosition = position; mContextMenu = ModelBrowserContextMenu.newInstance(cardName, mContextMenuListener); showDialogFragment(mContextMenu); return true; } }); updateSubtitleText(); }
Source:
synchronized public boolean isDue() { if(neverUpdate) return false; if(dataTimestamp == 0) dataTimestamp = getDataFile().file.lastModified(); long now = System.currentTimeMillis(); retryWindow = Math.max(retryWindow,SECONDS.toMillis(15)); boolean due = now - dataTimestamp > DAY && now - lastAttempt > retryWindow; if(due) { lastAttempt = now; retryWindow = Math.min(retryWindow*2, HOURS.toMillis(1)); } return due; }

Target:
public boolean isDue() { if(neverUpdate) return false; if(dataTimestamp == 0) dataTimestamp = getDataFile().file.lastModified(); long now = System.currentTimeMillis(); retryWindow = Math.max(retryWindow,SECONDS.toMillis(15)); boolean due = now - dataTimestamp > DAY && now - lastAttempt > retryWindow; if(due) { lastAttempt = now; retryWindow = Math.min(retryWindow*2, HOURS.toMillis(1)); } return due; }
Source:
public void processHeaderRow(String[] headerRow) { this.headerRow = headerRow.clone(); for (int i = 0; i < this.headerRow.length; i++) { String value = headerRow[i]; if (value != null) { value = value.trim(); } if (!Strings.isValid(value)) { this.headerRow[i] = null; } else { String str = RowTypeEnum.VERIFICATION_CRITERIA._rowType; if (value.contains(RowTypeEnum.VERIFICATION_CRITERIA._rowType)) { value = RowTypeEnum.VERIFICATION_CRITERIA._rowType; } RowTypeEnum rowTypeEnum = RowTypeEnum.fromString(value); rowIndexToRowTypeMap.put(i, rowTypeEnum); } } }

Target:
public void processHeaderRow(String[] headerRow) { this.headerRow = headerRow.clone(); for (int i = 0; i < this.headerRow.length; i++) { String value = headerRow[i]; if (value != null) { value = value.trim(); } if (!Strings.isValid(value)) { this.headerRow[i] = null; } else { String str = RowTypeEnum.VERIFICATION_CRITERIA.getRowType(); if (value.contains(RowTypeEnum.VERIFICATION_CRITERIA.getRowType())) { value = RowTypeEnum.VERIFICATION_CRITERIA.getRowType(); } RowTypeEnum rowTypeEnum = RowTypeEnum.fromString(value); rowIndexToRowTypeMap.put(i, rowTypeEnum); } } }
Source:
public void onComplete() { try { publishBulkheadEvent(() -> new BulkheadOnCallFinishedEvent(name)); } finally { semaphore.release(); } }

Target:
public void onComplete() { semaphore.release(); publishBulkheadEvent(() -> new BulkheadOnCallFinishedEvent(name)); }
Source:
private ParamDescriptor createParamDescriptor(final String postfix) { final ParamDescriptor pd = new ParamDescriptor(); pd.setName("Name" + postfix); pd.setDescription("Description" + postfix); return pd; }

Target:
private static ParamDescriptor createParamDescriptor(final String postfix) { final ParamDescriptor pd = new ParamDescriptor(); pd.setName("Name" + postfix); pd.setDescription("Description" + postfix); return pd; }
Source:
void doSave(final AsyncCallback<Account> onSave) { String newName = canEditFullName() ? nameTxt.getText() : null; if ("".equals(newName.trim())) { newName = null; } final String newEmail; if (emailPick.isEnabled() && emailPick.getSelectedIndex() >= 0) { final String v = emailPick.getValue(emailPick.getSelectedIndex()); if (Util.C.buttonOpenRegisterNewEmail().equals(v)) { newEmail = currentEmail; } else { newEmail = v; } } else { newEmail = currentEmail; } final ContactInformation info = toContactInformation(); save.setEnabled(false); registerNewEmail.setEnabled(false); Util.ACCOUNT_SEC.updateContact(newName, newEmail, info, new GerritCallback<Account>() { public void onSuccess(final Account result) { registerNewEmail.setEnabled(true); onSaveSuccess(result); if (onSave != null) { onSave.onSuccess(result); } } @Override public void onFailure(final Throwable caught) { save.setEnabled(true); registerNewEmail.setEnabled(true); super.onFailure(caught); } }); }

Target:
void doSave(final AsyncCallback<Account> onSave) { String newName = canEditFullName() ? nameTxt.getText() : null; if (newName != null && newName.trim().isEmpty()) { newName = null; } final String newEmail; if (emailPick.isEnabled() && emailPick.getSelectedIndex() >= 0) { final String v = emailPick.getValue(emailPick.getSelectedIndex()); if (Util.C.buttonOpenRegisterNewEmail().equals(v)) { newEmail = currentEmail; } else { newEmail = v; } } else { newEmail = currentEmail; } final ContactInformation info = toContactInformation(); save.setEnabled(false); registerNewEmail.setEnabled(false); Util.ACCOUNT_SEC.updateContact(newName, newEmail, info, new GerritCallback<Account>() { public void onSuccess(final Account result) { registerNewEmail.setEnabled(true); onSaveSuccess(result); if (onSave != null) { onSave.onSuccess(result); } } @Override public void onFailure(final Throwable caught) { save.setEnabled(true); registerNewEmail.setEnabled(true); super.onFailure(caught); } }); }
Source:
public void testConvertProfileGenericDataResponseVo() { ProfileGenericDataResponseDto responseDto = this.makeResponseDto(); ProfileGenericDataResponse responseVo = this.mapper.map(responseDto, ProfileGenericDataResponse.class); assertTrue(responseVo != null); assertTrue(responseVo.getProfileEntries().get(0).getProfileEntryValues().size() == EXPECTED_CLASS.length); int i = 0; for (ProfileEntryValue profileEntryValueVo : responseVo.getProfileEntries().get(0).getProfileEntryValues()) { Class<?> clazz = profileEntryValueVo.getValue().getClass(); assertTrue(EXPECTED_CLASS[i++].equals(clazz)); } }

Target:
public void testConvertProfileGenericDataResponseVo() { ProfileGenericDataResponseDto responseDto = this.makeResponseDto(); ProfileGenericDataResponse responseVo = this.mapper.map(responseDto, ProfileGenericDataResponse.class); assertNotNull("response object should not be null", responseVo); assertEquals("response object should return same number of profilentries", responseVo.getProfileEntries() .get(0).getProfileEntryValues().size(), EXPECTED_CLASS.length); int i = 0; for (ProfileEntryValue profileEntryValueVo : responseVo.getProfileEntries().get(0).getProfileEntryValues()) { Class<?> clazz = profileEntryValueVo.getValue().getClass(); assertEquals("the return class should be of the same type", EXPECTED_CLASS[i++], clazz); } }
Source:
BlobOutputStream(final BlockBlobAsyncClient parentBlob, final BlobAccessConditions accessCondition) throws StorageException { this(parentBlob, accessCondition, null, UUID.randomUUID().toString() + "-", new TreeMap<>(), 0, BlobType.BLOCK_BLOB, BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE); }

Target:
BlobOutputStream(final BlockBlobAsyncClient parentBlob, final BlobAccessConditions accessCondition) throws StorageException { this((BlobAsyncClient) parentBlob); this.accessCondition = accessCondition; this.blockList = new TreeMap<>(); this.blockIdPrefix = UUID.randomUUID().toString() + "-"; this.streamType = BlobType.BLOCK_BLOB; this.internalWriteThreshold = (int) BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE; }
Source:
public void run() { try { startDiscovery(); while (shouldRun) { try { DiscoveryServiceEvent event = eventQueue.take(); processEvent(event); } catch (Exception e) { log.error("Caught an exception. Stop discovery service.", e); shouldRun = false; stopLogReplication(); if (e instanceof InterruptedException) { Thread.interrupted(); } } } } catch (Exception e) { log.error("Unhandled exception caught during log replication service discovery. Retry,", e); } finally { runtime.cleanup(CorfuRuntime::shutdown); } }

Target:
public void run() { try { startDiscovery(); while (shouldRun) { try { DiscoveryServiceEvent event = eventQueue.take(); processEvent(event); } catch (Exception e) { log.error("Caught an exception. Stop discovery service.", e); shouldRun = false; stopLogReplication(); if (e instanceof InterruptedException) { Thread.interrupted(); } } } } catch (Exception e) { log.error("Unhandled exception caught during log replication service discovery.", e); } finally { runtime.cleanup(CorfuRuntime::shutdown); interClusterReplicationService.close(); } }