auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void run() { while (true) { try { final int size = size(); if (size > MIN_FLUSH_THRESHOLD) { final int maxflushes = Math.max(MIN_FLUSH_THRESHOLD, size * FLUSH_INTERVAL * FLUSH_SPEED / Const.MAX_TIMESPAN); final long now = System.currentTimeMillis(); flush(now / 1000 - Const.MAX_TIMESPAN - 1, maxflushes); if (LOG.isDebugEnabled()) { final int newsize = size(); <START> LOG.debug("flush() took {}ms, new queue size={} ({}" + ')', <END> System.currentTimeMillis() - now, newsize, newsize - size); } } } catch (Exception e) { LOG.error("Uncaught exception in compaction thread", e); } catch (OutOfMemoryError e) { final int sz = size.get(); CompactionQueue.super.clear(); size.set(0); LOG.error("Discarded the compaction queue, size={}", sz, e); } catch (Throwable e) { LOG.error("Uncaught *Throwable* in compaction thread", e); try { Thread.sleep(1000); } catch (InterruptedException i) { LOG.error("Compaction thread interrupted in error handling", i); return; } startCompactionThread(); return; } try { Thread.sleep(FLUSH_INTERVAL * 1000); } catch (InterruptedException e) { LOG.error("Compaction thread interrupted, doing one last flush", e); flush(); return; } } }</code><technical_language>+ ')' is necessary anymore. this LOG.debug() call is a check LOG.isDebugEnabled(), is need notation here</technical_language>

Target:
public void run() { while (true) { try { final int size = size(); if (size > MIN_FLUSH_THRESHOLD) { final int maxflushes = Math.max(MIN_FLUSH_THRESHOLD, size * FLUSH_INTERVAL * FLUSH_SPEED / Const.MAX_TIMESPAN); final long now = System.currentTimeMillis(); flush(now / 1000 - Const.MAX_TIMESPAN - 1, maxflushes); if (LOG.isDebugEnabled()) { final int newsize = size(); LOG.debug("flush() took {}ms, new queue size={} ({})", System.currentTimeMillis() - now, newsize, newsize - size); } } } catch (Exception e) { LOG.error("Uncaught exception in compaction thread", e); } catch (OutOfMemoryError e) { final int sz = size.get(); CompactionQueue.super.clear(); size.set(0); LOG.error("Discarded the compaction queue, size={}", sz, e); } catch (Throwable e) { LOG.error("Uncaught *Throwable* in compaction thread", e); try { Thread.sleep(1000); } catch (InterruptedException i) { LOG.error("Compaction thread interrupted in error handling", i); return; } startCompactionThread(); return; } try { Thread.sleep(FLUSH_INTERVAL * 1000); } catch (InterruptedException e) { LOG.error("Compaction thread interrupted, doing one last flush", e); flush(); return; } } }
Source:
<code>public Response putDecision(final DecisionUpdate update) throws Exception { <START> System.out.println(String.format("update [%s]", update)); <END> ResultSet<ArtifactReadable> results = AtsUtilServer.getQuery(orcsApi).and(AtsAttributeTypes.AtsId, Operator.EQUAL, update.getUuids()).getResults(); IAtsChangeSet changes = atsServer.getStoreFactory().createAtsChangeSet("Update CPA Decision", AtsCoreUsers.SYSTEM_USER); for (ArtifactReadable art : results) { IAtsTeamWorkflow teamWf = atsServer.getWorkItemFactory().getTeamWf(art); updateRationale(update, changes, teamWf); updateDuplicatedPcrId(update, changes, teamWf); updateApplicability(update, changes, teamWf); updateAssignees(update, changes, teamWf); } if (!changes.isEmpty()) { changes.execute(); } return Response.ok().entity(AHTML.simplePage("Ok")).build(); }</code><technical_language>Suggest logging</technical_language>

Target:
public Response putDecision(final DecisionUpdate update) throws Exception { ResultSet<ArtifactReadable> results = AtsUtilServer.getQuery(orcsApi).and(AtsAttributeTypes.AtsId, Operator.EQUAL, update.getUuids()).getResults(); IAtsChangeSet changes = atsServer.getStoreFactory().createAtsChangeSet("Update CPA Decision", AtsCoreUsers.SYSTEM_USER); for (ArtifactReadable art : results) { IAtsTeamWorkflow teamWf = atsServer.getWorkItemFactory().getTeamWf(art); updateRationale(update, changes, teamWf); updateDuplicatedPcrId(update, changes, teamWf); updateApplicability(update, changes, teamWf); updateAssignees(update, changes, teamWf); } if (!changes.isEmpty()) { changes.execute(); } return Response.ok().entity(AHTML.simplePage("Ok")).build(); }
Source:
<code>private void validateJoinKeySchemas(Map<String, Schema> inputSchemas) { perStageJoinKeys = conf.getPerStageJoinKeys(); List<Schema> prevSchemaList = null; for (Map.Entry<String, List<String>> entry : perStageJoinKeys.entrySet()) { ArrayList<Schema> schemaList = new ArrayList<>(); String stageName = entry.getKey(); Schema schema = inputSchemas.get(stageName); for (String joinKey : entry.getValue()) { Schema.Field field = schema.getField(joinKey); schemaList.add(field.getSchema()); } if (prevSchemaList != null && !prevSchemaList.equals(schemaList)) { throw new IllegalArgumentException(String.format("For stage %s, Schemas of joinKeys %s are expected to be: " + "%s, but found: %s", stageName, entry.getValue(), prevSchemaList.toString(), schemaList.toString())); } <START> prevSchemaList = new ArrayList<>(schemaList); <END> } }</code><technical_language>need copy, schemaList is newly created in loop</technical_language>

Target:
void validateJoinKeySchemas(Map<String, Schema> inputSchemas) { perStageJoinKeys = conf.getPerStageJoinKeys(); if (perStageJoinKeys.size() != inputSchemas.size()) { throw new IllegalArgumentException("There should be join keys present from each stage"); } List<Schema> prevSchemaList = null; for (Map.Entry<String, List<String>> entry : perStageJoinKeys.entrySet()) { ArrayList<Schema> schemaList = new ArrayList<>(); String stageName = entry.getKey(); Schema schema = inputSchemas.get(stageName); for (String joinKey : entry.getValue()) { Schema.Field field = schema.getField(joinKey); schemaList.add(field.getSchema()); } if (prevSchemaList != null && !prevSchemaList.equals(schemaList)) { throw new IllegalArgumentException(String.format("For stage %s, Schemas of joinKeys %s are expected to be: " + "%s, but found: %s", stageName, entry.getValue(), prevSchemaList.toString(), schemaList.toString())); } prevSchemaList = schemaList; } }
Source:
<code>public int get(final long timestampUTC) { Map.Entry<Long,Integer> higherEntry = offsetByTimeUTC.ceilingEntry(timestampUTC); Map.Entry<Long,Integer> lowerEntry = offsetByTimeUTC.floorEntry(timestampUTC); if (higherEntry == null && lowerEntry == null) { return 0; } <START> <END> if (higherEntry == null) { higherEntry = lowerEntry; } if (lowerEntry == null) { lowerEntry = higherEntry; } final long diffHigher = Math.abs(higherEntry.getKey() - timestampUTC); final long diffLower = Math.abs(lowerEntry.getKey() - timestampUTC); if (diffHigher > diffLower) { return lowerEntry.getValue(); } else { return higherEntry.getValue(); } }</code><technical_language>return a default here? anyway, sample offset</technical_language>

Target:
public int get(final long timestampUTC) { if (offsetByTimeUTC.isEmpty()) { return 0; } Map.Entry<Long,Integer> higherEntry = offsetByTimeUTC.ceilingEntry(timestampUTC); Map.Entry<Long,Integer> lowerEntry = offsetByTimeUTC.floorEntry(timestampUTC); if (higherEntry == null) { higherEntry = lowerEntry; } if (lowerEntry == null) { lowerEntry = higherEntry; } final long diffHigher = Math.abs(higherEntry.getKey() - timestampUTC); final long diffLower = Math.abs(lowerEntry.getKey() - timestampUTC); if (diffHigher > diffLower) { return lowerEntry.getValue(); } else { return higherEntry.getValue(); } }
Source:
<code>public AtlasDbServices connect() { if (services != null) { throw new IllegalStateException("connect() has already been called"); } DockerizedDatabaseUri dburi = DockerizedDatabaseUri.fromUriString(uri); KeyValueServiceConfig config = dburi.getKeyValueServiceInstrumentation() .getKeyValueServiceConfig(dburi.getAddress()); ServicesConfigModule servicesConfigModule = ServicesConfigModule.create( <START> ImmutableAtlasDbConfig.builder() <END> .keyValueService(config) .build(), ImmutableAtlasDbRuntimeConfig .defaultRuntimeConfig()); services = DaggerAtlasDbServices.builder() .servicesConfigModule(servicesConfigModule) .build(); return services; }</code><technical_language>nit: this nicer if collapse config-building line</technical_language>

Target:
public AtlasDbServices connect() { if (services != null) { throw new IllegalStateException("connect() has already been called"); } DockerizedDatabaseUri dburi = DockerizedDatabaseUri.fromUriString(uri); KeyValueServiceConfig config = dburi.getKeyValueServiceInstrumentation() .getKeyValueServiceConfig(dburi.getAddress()); ImmutableAtlasDbConfig atlasDbConfig = ImmutableAtlasDbConfig.builder().keyValueService(config).build(); ImmutableAtlasDbRuntimeConfig runtimeConfig = ImmutableAtlasDbRuntimeConfig.defaultRuntimeConfig(); ServicesConfigModule servicesConfigModule = ServicesConfigModule.create(atlasDbConfig, runtimeConfig); services = DaggerAtlasDbServices.builder() .servicesConfigModule(servicesConfigModule) .build(); return services; }
Source:
<code>protected void onPostExecute(final ArrayList<Theme> result) { runOnUiThread(new Runnable() { @Override public void run() { mFetchingThemes = false; if (mThemeBrowserFragment != null && mThemeBrowserFragment.isVisible()) { <START> mThemeBrowserFragment.mEmptyTextView.setText(R.string.theme_no_search_result_found); <END> mThemeBrowserFragment.setRefreshing(false); } else if (mThemeSearchFragment != null && mThemeSearchFragment.isVisible()) { mThemeSearchFragment.mEmptyTextView.setText(R.string.theme_no_search_result_found); mThemeSearchFragment.setRefreshing(false); } } }); }</code><technical_language>I prefer a setter member variable access</technical_language>

Target:
protected void onPostExecute(final ArrayList<Theme> result) { runOnUiThread(new Runnable() { @Override public void run() { mFetchingThemes = false; if (mThemeBrowserFragment != null && mThemeBrowserFragment.isVisible()) { mThemeBrowserFragment.getEmptyTextView().setText(R.string.theme_no_search_result_found); mThemeBrowserFragment.setRefreshing(false); } else if (mThemeSearchFragment != null && mThemeSearchFragment.isVisible()) { mThemeSearchFragment.getEmptyTextView().setText(R.string.theme_no_search_result_found); mThemeSearchFragment.setRefreshing(false); } } }); }
Source:
<code>protected void updateInternal() { if (!(getContainer().isNewStorage() || getContainer().isStorageActive())) { return; } VDS host = getContainer().getHost().getSelectedItem(); if (host == null) { proposeDiscover(); return; } final Collection<EntityModel<?>> prevSelected = Linq.findSelectedItems((Collection<EntityModel<?>>) getSelectedItem()); clearItems(); initializeItems(null, null); final SanStorageModelBase model = this; AsyncQuery<QueryReturnValue> asyncQuery = new AsyncQuery<>(response -> { if (response.getSucceeded()) { <START> boolean isInMaintenance = false; <END> Set<String> metadata = null; if (!model.getContainer().isNewStorage()) { isInMaintenance = model.getContainer().getStorage().getStatus() == StorageDomainStatus.Maintenance; metadata = model.getMetadataDevices(); } model.applyData(isInMaintenance, metadata, (ArrayList<LUNs>) response.getReturnValue(), false, prevSelected); model.setGetLUNsFailure(""); } else { model.setGetLUNsFailure( ConstantsManager.getInstance().getConstants().couldNotRetrieveLUNsLunsFailure()); } }, true); Frontend.getInstance().runQuery(QueryType.GetDeviceList, new GetDeviceListQueryParameters(host.getId(), getType(), false, null, false), asyncQuery); }</code><technical_language>is this change related patch</technical_language>

Target:
protected void updateInternal() { if (!(getContainer().isNewStorage() || getContainer().isStorageActive())) { return; } VDS host = getContainer().getHost().getSelectedItem(); if (host == null) { proposeDiscover(); return; } final Collection<EntityModel<?>> prevSelected = Linq.findSelectedItems((Collection<EntityModel<?>>) getSelectedItem()); clearItems(); initializeItems(null, null); final SanStorageModelBase model = this; AsyncQuery<QueryReturnValue> asyncQuery = new AsyncQuery<>(response -> { if (response.getSucceeded()) { boolean isInMaintenance = false; Set<String> metadata = null; if (!model.getContainer().isNewStorage()) { isInMaintenance = model.getContainer().getStorage().getStatus() == StorageDomainStatus.Maintenance; metadata = model.getMetadataDevices(); } model.applyData((ArrayList<LUNs>) response.getReturnValue(), false, prevSelected, isInMaintenance, metadata); model.setGetLUNsFailure(""); } else { model.setGetLUNsFailure( ConstantsManager.getInstance().getConstants().couldNotRetrieveLUNsLunsFailure()); } }, true); Frontend.getInstance().runQuery(QueryType.GetDeviceList, new GetDeviceListQueryParameters(host.getId(), getType(), false, null, false), asyncQuery); }
Source:
<code>protected void onReset() { super.onReset(); FaviconRefreshUtil.refreshFavicon(); <START> <END> if (user.isLoggedIn()) { placeManager.revealDefaultPlace(); } else { RevealRootPopupContentEvent.fire(this, loginPopup); } }</code><technical_language>this refresh of if is Firefox</technical_language>

Target:
protected void onReset() { super.onReset(); if ("firefox".equalsIgnoreCase(clientAgentType.getBrowser())) { FaviconRefreshUtil.refreshFavicon(); } if (user.isLoggedIn()) { placeManager.revealDefaultPlace(); } else { RevealRootPopupContentEvent.fire(this, loginPopup); } }
Source:
<code><START> public ValidationWhiteListSearchRequestBuilder filterByComponentIdentifier(ComponentIdentifier componentIdentifier) { <END> return addOption(OptionKey.COMPONENTENT_IDENTIFIER, componentIdentifier); }</code><technical_language>Add methods filterByRuleIds(Iterable) filterByComponentIdentifiers(Iterable) allow clients filter multiple rule component identifier values</technical_language>

Target:
public ValidationWhiteListSearchRequestBuilder filterByComponentIdentifier(ComponentIdentifier componentIdentifier) { return addOption(OptionKey.COMPONENT_IDENTIFIER, componentIdentifier); }
Source:
<code>public boolean registerMessageListener(LIRCMessageListener listener) { if (listener == null) { throw new IllegalArgumentException("The listener parameter may not be null."); } <START> return deviceStatusListeners.contains(listener) ? false : deviceStatusListeners.add(listener); <END> }</code><technical_language>if deviceStatusListeners a Set, need check this (see above)</technical_language>

Target:
public boolean registerMessageListener(LIRCMessageListener listener) { if (listener == null) { throw new IllegalArgumentException("The listener parameter may not be null."); } return deviceStatusListeners.add(listener); }
Source:
<code>public synchronized boolean addShardingKey(String realm, String shardingKey) { if (_leaderElection.isLeader()) { if (_zkClient.isClosed()) { throw new IllegalStateException("ZkClient is closed!"); } String realmPath = MetadataStoreRoutingConstants.ROUTING_DATA_PATH + "/" + realm; if (!_zkClient.exists(realmPath)) { if (!createZkRealm(realm)) { LOG.error( "Failed to add sharding key because ZkRealm creation failed! Namespace: {}, Realm: {}, Sharding key: {}", _namespace, realm, shardingKey); return false; } } ZNRecord znRecord; try { znRecord = _zkClient.readData(realmPath); } catch (Exception e) { LOG.error( "Failed to read the realm ZNRecord in addShardingKey()! Namespace: {}, Realm: {}, ShardingKey: {}", _namespace, realm, shardingKey, e); return false; } znRecord.setListField(MetadataStoreRoutingConstants.ZNRECORD_LIST_FIELD_KEY, Collections.singletonList(shardingKey)); try { _zkClient.writeData(realmPath, znRecord); } catch (Exception e) { LOG.error( "Failed to write the realm ZNRecord in addShardingKey()! Namespace: {}, Realm: {}, ShardingKey: {}", _namespace, realm, shardingKey, e); return false; } return true; } <START> String leaderHostName = _leaderElection.getCurrentLeaderInfo().getId(); String url = leaderHostName + "/admin/v2/namespaces/" + _namespace + "/metadata-store-realms/" + realm + "/sharding-keys/" + shardingKey; <END> HttpPut putRequest = new HttpPut(url); try { HttpResponse response = _forwardHttpClient.execute(putRequest); if (response.getStatusLine().getStatusCode() != 201) { HttpEntity respEntity = response.getEntity(); LOG.error("the forwarded request to leader has failed for addShardingKey: {}", respEntity != null ? EntityUtils.toString(respEntity) : ""); return false; } } catch (IOException e) { LOG.error("the forwarded request to leader raised an exception for addShardingKey", e); return false; } return true; }</code><technical_language>refactor</technical_language>

Target:
public synchronized boolean addShardingKey(String realm, String shardingKey) { if (_leaderElection.isLeader()) { if (_zkClient.isClosed()) { throw new IllegalStateException("ZkClient is closed!"); } return createZkShardingKey(realm, shardingKey); } String urlSuffix = constructUrlSuffix(MetadataStoreRoutingConstants.MSDS_GET_ALL_REALMS_ENDPOINT, realm, MetadataStoreRoutingConstants.MSDS_GET_ALL_SHARDING_KEYS_ENDPOINT, shardingKey); return forwardRequestToLeader(urlSuffix, HttpConstants.RestVerbs.PUT, Response.Status.CREATED.getStatusCode()); }
Source:
<code>public RegistrationData findByToken(Context context, String token) throws SQLException { CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context); CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, RegistrationData.class); Root<RegistrationData> registrationDataRoot = criteriaQuery.from(RegistrationData.class); criteriaQuery.select(registrationDataRoot); criteriaQuery.where(criteriaBuilder.equal(registrationDataRoot.get(RegistrationData_.token), token)); <START> return uniqueResult(context, criteriaQuery, true, RegistrationData.class, -1, -1); <END> }</code><technical_language>Original query cacheable. This is. I param false</technical_language>

Target:
public RegistrationData findByToken(Context context, String token) throws SQLException { CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context); CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, RegistrationData.class); Root<RegistrationData> registrationDataRoot = criteriaQuery.from(RegistrationData.class); criteriaQuery.select(registrationDataRoot); criteriaQuery.where(criteriaBuilder.equal(registrationDataRoot.get(RegistrationData_.token), token)); return uniqueResult(context, criteriaQuery, false, RegistrationData.class, -1, -1); }
Source:
<code><START> public Seq<? extends E> getErrors() throws RuntimeException { <END> throw new NoSuchElementException("errors of 'valid' Validation"); }</code><technical_language>java public Seq<E> getErrors()</technical_language>

Target:
public Seq<E> getErrors() throws RuntimeException { throw new NoSuchElementException("errors of 'valid' Validation"); }
Source:
<code>public BoardPanel(BoardSize boardSize, SquareConfig squareConfig, Function<BoardCoordinate, Set<BoardCoordinate>> getMovesCallback) { super(false); mSquareConfig = squareConfig; mGetMovesCallback = getMovesCallback; mBoardSize = boardSize; mSquareLabels = new ArrayList<>(boardSize.width * boardSize.height); addComponentListener(new ComponentListener() { @Override public void componentResized(ComponentEvent e) { Rectangle b = e.getComponent().getBounds(); <START> if(b.height > b.width){ <END> setMinimumSize(new Dimension(b.width, b.width)); setPreferredSize(new Dimension(b.width, b.width)); setMaximumSize(new Dimension(b.width, b.width)); } else{ setMinimumSize(new Dimension(b.height, b.height)); setPreferredSize(new Dimension(b.height, b.height)); setMaximumSize(new Dimension(b.height, b.height)); } } @Override public void componentMoved(ComponentEvent e) { } @Override public void componentShown(ComponentEvent e) { } @Override public void componentHidden(ComponentEvent e) { } }); GridLayout gridLayout = new GridLayout(mBoardSize.width + 2, mBoardSize.height + 2); setLayout(gridLayout); createGrid(gridLayout); }</code><technical_language>about: int size = Math.min(b.height, b.width); setMinimumSize(new Dimension(s, s)); setPreferredSize(new Dimension(s, s)); setMaximumSize(new Dimension(s, s));</technical_language>

Target:
public BoardPanel(BoardSize boardSize, SquareConfig squareConfig, Function<BoardCoordinate, Set<BoardCoordinate>> getMovesCallback) { super(false); mSquareConfig = squareConfig; mGetMovesCallback = getMovesCallback; mBoardSize = boardSize; mSquareLabels = new ArrayList<>(boardSize.width * boardSize.height); GridLayout gridLayout = new GridLayout(mBoardSize.width + 2, mBoardSize.height + 2); setLayout(gridLayout); createGrid(gridLayout); }
Source:
<code>public boolean onActivate(Level level, Player player, Block block, Block target, int face, double fx, double fy, double fz) { Block targetBlock = Block.get(this.meta); if (targetBlock instanceof BlockAir) { if (target instanceof BlockLiquid && target.getDamage() == 0) { Item result = Item.get(BUCKET, this.getDamageByTarget(target.getId()), 1); PlayerBucketFillEvent ev; player.getServer().getPluginManager().callEvent(ev = new PlayerBucketFillEvent(player, block, face, this, result)); if (!ev.isCancelled()) { player.getLevel().setBlock(target, new BlockAir(), true, true); if (player.isSurvival()) { this.setCount(this.getCount() - 1); <START> player.getInventory().setItemInHand(this.getCount() >= 1 ? this : Item.get(0)); <END> player.getInventory().addItem(ev.getItem()); } return true; } else { player.getInventory().sendContents(player); } } } else if (targetBlock instanceof BlockLiquid) { Item result = Item.get(BUCKET, 0, 1); PlayerBucketEmptyEvent ev; player.getServer().getPluginManager().callEvent(ev = new PlayerBucketEmptyEvent(player, block, face, this, result)); if (!ev.isCancelled()) { player.getLevel().setBlock(block, targetBlock, true, true); if (player.isSurvival()) { this.setCount(this.getCount() - 1); player.getInventory().setItemInHand(this.getCount() >= 1 ? this : Item.get(0)); player.getInventory().addItem(ev.getItem()); } return true; } else { player.getInventory().sendContents(player); } } return false; }</code><technical_language>This is unnecessary, remove this check <LINK_0></technical_language>

Target:
public boolean onActivate(Level level, Player player, Block block, Block target, int face, double fx, double fy, double fz) { Block targetBlock = Block.get(this.meta); if (targetBlock instanceof BlockAir) { if (target instanceof BlockLiquid && target.getDamage() == 0) { Item result = Item.get(BUCKET, this.getDamageByTarget(target.getId()), 1); PlayerBucketFillEvent ev; player.getServer().getPluginManager().callEvent(ev = new PlayerBucketFillEvent(player, block, face, this, result)); if (!ev.isCancelled()) { player.getLevel().setBlock(target, new BlockAir(), true, true); if (player.isSurvival()) { this.setCount(this.getCount() - 1); player.getInventory().setItemInHand(this); player.getInventory().addItem(ev.getItem()); } return true; } else { player.getInventory().sendContents(player); } } } else if (targetBlock instanceof BlockLiquid) { Item result = Item.get(BUCKET, 0, 1); PlayerBucketEmptyEvent ev; player.getServer().getPluginManager().callEvent(ev = new PlayerBucketEmptyEvent(player, block, face, this, result)); if (!ev.isCancelled()) { player.getLevel().setBlock(block, targetBlock, true, true); if (player.isSurvival()) { this.setCount(this.getCount() - 1); player.getInventory().setItemInHand(this); player.getInventory().addItem(ev.getItem()); } return true; } else { player.getInventory().sendContents(player); } } return false; }
Source:
<code>public synchronized void add(PrestoWarning warning) { requireNonNull(warning, "warning is null"); switch(config.getWarningHandlingLevel()) { case SUPPRESS: break; case NORMAL: if (warnings.size() < config.getMaxWarnings()) { warnings.putIfAbsent(warning.getWarningCode(), warning); } break; case AS_ERROR: <START> throw new PrestoException(StandardErrorCode.WARNING_AS_ERROR, warning.toString()); <END> } }</code><technical_language>Hmm, want wrap warning in PrestoException get context</technical_language>

Target:
public synchronized void add(PrestoWarning warning) { requireNonNull(warning, "warning is null"); switch (warningHandlingLevel) { case SUPPRESS: break; case NORMAL: addWarningIfNumWarningsLessThanConfig(warning); break; case AS_ERROR: if (warning.getWarningCode() == PARSER_WARNING.toWarningCode()) { addWarningIfNumWarningsLessThanConfig(warning); } else { throw new PrestoException(WARNING_AS_ERROR, warning.toString()); } } }
Source:
<code>protected void executeCommand() { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { updateNetworkAttachment( getVdsGroupId(), getNetworkCluster(), getNetwork(), <START> AttachNetworkToVdsGroupCommand.this); <END> return null; } }); if (!getPersistedNetwork().isExternal() && NetworkUtils.isLabeled(getPersistedNetwork()) && NetworkHelper.setupNetworkSupported(getVdsGroup().getcompatibility_version())) { addNetworkToHosts(); } setSucceeded(true); }</code><technical_language>suggest merge Lior's patch mentioned in previous in-chain patch reduce changes this patch. rebase top of patch clears this soon-to-be-removed code</technical_language>

Target:
protected void executeCommand() { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { attachNetwork(getVdsGroupId(), getNetworkCluster(), getNetwork()); return null; } }); if (!getPersistedNetwork().isExternal() && NetworkUtils.isLabeled(getPersistedNetwork()) && NetworkHelper.setupNetworkSupported(getVdsGroup().getcompatibility_version())) { addNetworkToHosts(); } setSucceeded(true); }
Source:
<code>private WrappedNetworkMonitor <START> makeMonitor(NetworkCapabilities <END> nc) { final WrappedNetworkMonitor nm = new WrappedNetworkMonitor(); nm.start(); setNetworkCapabilities(nm, nc); HandlerUtilsKt.waitForIdle(nm.getHandler(), HANDLER_TIMEOUT_MS); mCreatedNetworkMonitors.add(nm); return nm; }</code><technical_language>please express this methods in terms of new avoid duplication</technical_language>

Target:
private WrappedNetworkMonitor makeMonitor(NetworkCapabilities nc) { final WrappedNetworkMonitor nm = new WrappedNetworkMonitor(); nm.start(); setNetworkCapabilities(nm, nc); HandlerUtilsKt.waitForIdle(nm.getHandler(), HANDLER_TIMEOUT_MS); mCreatedNetworkMonitors.add(nm); when(mTstDependencies.isTcpInfoParsingSupported()).thenReturn(false); return nm; }
Source:
<code>private EdgeMapping createEdgeMappingReference(Layer layer, ToolSection toolSection, ContainerMapping classMapping) { EdgeMapping edgeMappingReference = DescriptionFactory.eINSTANCE.createEdgeMapping(); EdgeStyleDescription edgeStyleR = StyleFactory.eINSTANCE.createEdgeStyleDescription(); edgeMappingReference.setName(BASE_ID + ".edge.reference"); edgeMappingReference.setLabel("Reference"); edgeMappingReference.setUseDomainElement(true); edgeStyleR.setCenterLabelStyleDescription(StyleFactory.eINSTANCE.createCenterLabelStyleDescription()); edgeMappingReference.setStyle(edgeStyleR); edgeMappingReference.getSourceMapping().add(classMapping); edgeMappingReference.getTargetMapping().add(classMapping); layer.getEdgeMappings().add(edgeMappingReference); EdgeCreationDescription edgeCreationDescription = ToolFactory.eINSTANCE.createEdgeCreationDescription(); <START> edgeCreationDescription.setName(BASE_ID + ".package.toolsection.containerEdgeMappingReference"); <END> edgeCreationDescription.setLabel("Container EdgeMapping Reference"); edgeCreationDescription.getEdgeMappings().add(edgeMappingReference); toolSection.getOwnedTools().add(edgeCreationDescription); return edgeMappingReference; }</code><technical_language>".edge.reference.creation"</technical_language>

Target:
private EdgeMapping createEdgeMappingReference(Layer layer, ToolSection toolSection, ContainerMapping classMapping) { EdgeMapping edgeMappingReference = DescriptionFactory.eINSTANCE.createEdgeMapping(); EdgeStyleDescription edgeStyleR = StyleFactory.eINSTANCE.createEdgeStyleDescription(); edgeMappingReference.setName(BASE_ID + ".edge.reference"); edgeMappingReference.setLabel("Reference"); edgeMappingReference.setUseDomainElement(true); edgeStyleR.setCenterLabelStyleDescription(StyleFactory.eINSTANCE.createCenterLabelStyleDescription()); edgeMappingReference.setStyle(edgeStyleR); edgeMappingReference.getSourceMapping().add(classMapping); edgeMappingReference.getTargetMapping().add(classMapping); layer.getEdgeMappings().add(edgeMappingReference); EdgeCreationDescription edgeCreationDescription = ToolFactory.eINSTANCE.createEdgeCreationDescription(); edgeCreationDescription.setName(BASE_ID + ".edge.reference.creation"); edgeCreationDescription.setLabel("Reference"); edgeCreationDescription.getEdgeMappings().add(edgeMappingReference); toolSection.getOwnedTools().add(edgeCreationDescription); return edgeMappingReference; }
Source:
<code>public WildflyConfiguration build() { if (mode.equals(Mode.STANDALONE)) { script = new File(directory, "bin" + File.separator + (SystemUtils.IS_OS_WINDOWS ? "standalone.bat" : "standalone.sh")); } else { script = new File(directory, "bin" + File.separator + (SystemUtils.IS_OS_WINDOWS ? "domain.bat" : "domain.sh")); } javaOpts = javaOpts.stream().map(i -> i.replaceAll("\\s","")).collect(Collectors.toList()); if (!StringUtils.isEmpty(xms)) { replaceJavaOptIfExists("-Xms", xms); } if (!StringUtils.isEmpty(xmx)) { replaceJavaOptIfExists("-Xmx", xmx); } if (!StringUtils.isEmpty(permSize)) { replaceJavaOptIfExists("-XX:PermSize=", permSize); } if (!StringUtils.isEmpty(maxPermSize)) { replaceJavaOptIfExists("-XX:MaxPermSize=", maxPermSize); } <START> replaceJavaOptIfExists("-Djava.net.preferIPv4Stack=", "true"); <END> replaceJavaOptIfExists("-Djboss.modules.system.pkgs=", "org.jboss.byteman"); replaceJavaOptIfExists("-Djava.awt.headless=", "true"); replaceJavaOptIfExists("-Djboss.socket.binding.port-offset=", String.valueOf(portOffset)); if (baseDir != null) { replaceJavaOptIfExists("-Djboss.server.base.dir=", baseDir.toString()); } if (nodeName != null) { replaceJavaOptIfExists("-Djboss.node.name=", nodeName); } envProps.put(Configuration.JAVA_OPTS_ENV_NAME, String.join(" ", javaOpts)); return new WildflyConfiguration(this); }</code><technical_language>dont replace users configuration for -Djava.net.preferIPv4Stack=, -Djboss.modules.system.pkgs=" -Djava.awt.headless=. users overflow default configuration. For example I want add multiply system pkgs -Djboss.modules.system.pkgs=org.jboss.byteman,my.package</technical_language>

Target:
public WildflyConfiguration build() { if (mode.equals(Mode.STANDALONE)) { script = new File(directory, "bin" + File.separator + (SystemUtils.IS_OS_WINDOWS ? "standalone.bat" : "standalone.sh")); } else { script = new File(directory, "bin" + File.separator + (SystemUtils.IS_OS_WINDOWS ? "domain.bat" : "domain.sh")); } for (int i = 0; i < javaOpts.size(); i++) { javaOpts.set(i, javaOpts.get(i).replaceAll("\\s", "")); } if (!StringUtils.isEmpty(xms)) { replaceJavaOptIfExists("-Xms", xms); } if (!StringUtils.isEmpty(xmx)) { replaceJavaOptIfExists("-Xmx", xmx); } if (!StringUtils.isEmpty(permSize)) { replaceJavaOptIfExists("-XX:PermSize=", permSize); } if (!StringUtils.isEmpty(maxPermSize)) { replaceJavaOptIfExists("-XX:MaxPermSize=", maxPermSize); } if (baseDir != null) { replaceJavaOptIfExists("-Djboss.server.base.dir=", baseDir.toString()); } if (nodeName != null) { replaceJavaOptIfExists("-Djboss.node.name=", nodeName); } addJavaOptIfNotExists("-Djava.net.preferIPv4Stack=", "true"); addJavaOptIfNotExists("-Djboss.modules.system.pkgs=", "org.jboss.byteman"); addJavaOptIfNotExists("-Djava.awt.headless=", "true"); addJavaOptIfNotExists("-Djboss.socket.binding.port-offset=", String.valueOf(portOffset)); envProps.put(Configuration.JAVA_OPTS_ENV_NAME, Joiner.on(" ").join(javaOpts)); return new WildflyConfiguration(this); }
Source:
<code>private void sizeToWindow(int top, Style.Overflow overflowY) { <START> NodeList<Element> e = this.menuBar_.getElement().getElementsByTagName("table"); <END> if (e.getLength() < 1) return; Element table = e.getItem(0); int windowHeight = Window.getClientHeight(); table.getStyle().setOverflowY(overflowY); table.getStyle().setDisplay(Style.Display.BLOCK); table.getStyle().setPropertyPx("maxHeight", windowHeight - top - 30); }</code><technical_language>need this here</technical_language>

Target:
private void sizeToWindow(int top, Style.Overflow overflowY) { NodeList<Element> e = menuBar_.getElement().getElementsByTagName("table"); if (e.getLength() < 1) return; Element table = e.getItem(0); int windowHeight = Window.getClientHeight(); table.getStyle().setOverflowY(overflowY); table.getStyle().setDisplay(Style.Display.BLOCK); table.getStyle().setPropertyPx("maxHeight", windowHeight - top - 30); }
Source:
<code>public void deleteEntry(String id) throws DirectoryException { checkPermission(SecurityConstants.WRITE); checkDeleteConstraints(id); for (Reference reference : getDirectory().getReferences()) { <START> if (reference.getClass() == referenceClassName) { <END> reference.removeLinksForSource(id, this); } else { reference.removeLinksForSource(id); } } deleteEntryWithoutReferences(id); getDirectory().invalidateCaches(); }</code><technical_language>question createEntry updateEntry</technical_language>

Target:
public void deleteEntry(String id) throws DirectoryException { checkPermission(SecurityConstants.WRITE); checkDeleteConstraints(id); for (Reference reference : getDirectory().getReferences()) { if (reference.getClass() == referenceClass) { reference.removeLinksForSource(id, this); } else { reference.removeLinksForSource(id); } } deleteEntryWithoutReferences(id); getDirectory().invalidateCaches(); }
Source:
<code>public static void createSchema(String url, String tableName, Long ts) throws SQLException { if (tableName.contains(".")) { String schema = tableName.substring(0, tableName.indexOf(".")); if (!schema.equals("")) { Properties props = new Properties(); if (ts != null) { props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts)); } try (Connection conn = DriverManager.getConnection(url, props);) { conn.createStatement().executeUpdate("CREATE SCHEMA IF NOT EXISTS " + schema); <START> } catch (TableAlreadyExistsException e) { <END> throw e; } } } }</code><technical_language>Remove catch() block apply</technical_language>

Target:
public static void createSchema(String url, String tableName, Long ts) throws SQLException { String schema = SchemaUtil.getSchemaNameFromFullName(tableName); if (!schema.equals("")) { Properties props = new Properties(); if (ts != null) { props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts)); } try (Connection conn = DriverManager.getConnection(url, props);) { if (SchemaUtil.isNamespaceMappingEnabled(null, conn.unwrap(PhoenixConnection.class).getQueryServices().getProps())) { conn.createStatement().executeUpdate("CREATE SCHEMA IF NOT EXISTS " + schema); } } } }
Source:
<code>private Network getNetworkByName(List<Network> networks) { <START> return LinqUtils.firstOrNull(networks, new Predicate<Network>() { <END> @Override public boolean eval(Network network) { return network.getname().equals(getNetworkName()); } }); }</code><technical_language>LinqUtils replaced for loop return statement simplify reading reduce need of creating new anonymous class</technical_language>

Target:
private Network getNetworkByName(List<Network> networks) { return LinqUtils.firstOrNull(networks, new Predicate<Network>() { @Override public boolean eval(Network network) { return network.getName().equals(getNetworkName()); } }); }
Source:
<code>public static VmInitNetwork map(NicConfiguration model, VmInitNetwork template) { VmInitNetwork entity = template != null ? template : new VmInitNetwork(); if (model.isSetName()) { entity.setName(model.getName()); } if (model.isOnBoot()) { entity.setStartOnBoot(model.isOnBoot()); } if (model.isSetBootProtocol()) { entity.setBootProtocol(Ipv4BootProtocolMapper.map(model.getBootProtocol())); } if (model.isSetIp()) { if (model.getIp().isSetAddress()) { entity.setIp(model.getIp().getAddress()); } if (model.getIp().isSetNetmask()) { entity.setNetmask(model.getIp().getNetmask()); } if (model.getIp().isSetGateway()) { entity.setGateway(model.getIp().getGateway()); } } if (model.isSetIpv6BootProtocol()) { <START> entity.setIpv6BootProtocol(Ipv6BootProtocolMapper.map(model.getIpv6BootProtocol())); <END> } if (model.isSetIpv6()) { if (model.getIpv6().isSetAddress()) { entity.setIpv6Address(model.getIpv6().getAddress()); } if (model.getIpv6().isSetNetmask()) { entity.setIpv6Prefix((int) IntegerParser.parseUnsignedInt(model.getIpv6().getNetmask())); } if (model.getIpv6().isSetGateway()) { entity.setIpv6Gateway(model.getIpv6().getGateway()); } } return entity; }</code><technical_language>this bug fix stands for own. Please move another commit</technical_language>

Target:
public static VmInitNetwork map(NicConfiguration model, VmInitNetwork template) { VmInitNetwork entity = template != null ? template : new VmInitNetwork(); if (model.isSetName()) { entity.setName(model.getName()); } if (model.isOnBoot()) { entity.setStartOnBoot(model.isOnBoot()); } if (model.isSetBootProtocol()) { entity.setBootProtocol(Ipv4BootProtocolMapper.map(model.getBootProtocol())); } if (model.isSetIp()) { if (model.getIp().isSetAddress()) { entity.setIp(model.getIp().getAddress()); } if (model.getIp().isSetNetmask()) { entity.setNetmask(model.getIp().getNetmask()); } if (model.getIp().isSetGateway()) { entity.setGateway(model.getIp().getGateway()); } } if (model.isSetIpv6BootProtocol()) { entity.setIpv6BootProtocol(Ipv6BootProtocolMapper.map(model.getBootProtocol())); } if (model.isSetIpv6()) { if (model.getIpv6().isSetAddress()) { entity.setIpv6Address(model.getIpv6().getAddress()); } if (model.getIpv6().isSetNetmask()) { entity.setIpv6Prefix((int) IntegerParser.parseUnsignedInt(model.getIpv6().getNetmask())); } if (model.getIpv6().isSetGateway()) { entity.setIpv6Gateway(model.getIpv6().getGateway()); } } return entity; }
Source:
<code>private void schedule(Command command) { if (scheduler != null) { scheduler.schedule(command); } else { throw new IllegalStateException( <START> "Scheduled commands are not supported by this command bus (scheduler is not set)."); <END> } }</code><technical_language>Consider sentences in message, instead of nested in braces</technical_language>

Target:
private void schedule(Command command) { if (scheduler != null) { scheduler.schedule(command); } else { throw new IllegalStateException( "Scheduled commands are not supported by this command bus: scheduler is not set."); } }
Source:
<code>public static JSONObject deleteRepeatToJson(FormEntryController controller, FormEntryModel model, String formIndexString) { JSONObject ret = new JSONObject(); FormIndex formIndex = indexFromString(formIndexString, model.getForm()); controller.deleteRepeat(formIndex); <START> ret.put(ApiConstants.QUESTION_TREE_KEY, walkToJSON(model, controller)); <END> return ret; }</code><technical_language>return result of getCurrentJson avoid repeating this line (same for descendRepeatToJson)</technical_language>

Target:
public static JSONObject deleteRepeatToJson(FormEntryController controller, FormEntryModel model, String formIndexString) { FormIndex formIndex = indexFromString(formIndexString, model.getForm()); controller.deleteRepeat(formIndex); return getCurrentJson(controller, model); }
Source:
<code>private void assertJson(Object value, String resourceFile) { final JsonNode jsonTree = readTreeFromResource(resourceFile); final JsonNode objectTree = mapper.valueToTree(value); try { assertEquals(mapper.readTree(jsonTree.toString()), mapper.readTree(objectTree.toString())); } catch (IOException e) { <START> System.out.println(new StringBuilder("Error while reading tree: ").append(e.getMessage())); <END> } }</code><technical_language>fail() throw exception</technical_language>

Target:
private void assertJson(Object value, String resourceFile) { final JsonNode jsonTree = readTreeFromResource(resourceFile); final JsonNode objectTree = mapper.valueToTree(value); try { assertEquals(mapper.readTree(jsonTree.toString()), mapper.readTree(objectTree.toString())); } catch (IOException e) { fail(e.getMessage()); } }
Source:
<code>public void addACL(ACL acl) { assert acl != null; ACL oldACL = getACL(acl.getName()); if (!acl.equals(oldACL)) { if (oldACL != null) { oldACL.clear(); oldACL.addAll(acl); } else { String name = acl.getName(); switch (name) { case ACL.INHERITED_ACL: acls.add(acl); break; case ACL.LOCAL_ACL: ACL inherited = getACL(ACL.INHERITED_ACL); if (inherited != null) { int i = acls.indexOf(inherited); acls.add(i, acl); } else { acls.add(acl); } break; default: ACL local = getACL(ACL.LOCAL_ACL); if (local != null) { int i = acls.indexOf(local); if (Framework.isBooleanPropertyTrue(LEGACY_BEHAVIOUR_PROPERTY)) { ++i; } <START> acls.add(i, acl); <END> } else { inherited = getACL(ACL.INHERITED_ACL); if (inherited != null) { int i = acls.indexOf(inherited); acls.add(i, acl); } else { acls.add(acl); } } } } } cache.clear(); }</code><technical_language>i++ instead of ++i here... if local ACL is i++ is out of bound</technical_language>

Target:
public void addACL(ACL acl) { assert acl != null; ACL oldACL = getACL(acl.getName()); if (!acl.equals(oldACL)) { if (oldACL != null) { oldACL.clear(); oldACL.addAll(acl); } else { String name = acl.getName(); switch (name) { case ACL.INHERITED_ACL: acls.add(acl); break; case ACL.LOCAL_ACL: ACL inherited = getACL(ACL.INHERITED_ACL); if (inherited != null) { int i = acls.indexOf(inherited); acls.add(i, acl); } else { acls.add(acl); } break; default: ACL local = getACL(ACL.LOCAL_ACL); if (local != null) { int i = acls.indexOf(local); if (isLegacyBehavior) { i++; } acls.add(i, acl); } else { inherited = getACL(ACL.INHERITED_ACL); if (inherited != null) { int i = acls.indexOf(inherited); acls.add(i, acl); } else { acls.add(acl); } } } } } cache.clear(); }
Source:
<code>public TimeSeriesQueryPredicate build() { checkState(metric != null); try { <START> checkState(tagPredicates.size() > 0); <END> } catch (IllegalStateException e) { throw new QueryException("No valid tag predicates"); } return new TimeSeriesQueryPredicate(metric, ImmutableSet.copyOf(tagPredicates)); }</code><technical_language>a regular if condition throw QueryException instead of catching potential exception checkState. checkState this hide exception is thrown send exception parameter e QueryException throwing catching exception is generally considered bad practice</technical_language>

Target:
public TimeSeriesQueryPredicate build() { checkState(metric != null); checkState(tagPredicates.size() > 0); return new TimeSeriesQueryPredicate(metric, ImmutableSet.copyOf(tagPredicates)); }
Source:
<code>public ModelAndView byProjectShortName(@PathVariable String shortName, ModelMap model) throws IOException { Project project = projectService.getProjectByShortName(shortName); if (project == null) { <START> return new ModelAndView("/pages/notFound.jsp", model); <END> } return setupForm(project.getId(), model); }</code><technical_language>instead annotate a method @ExceptionHandler(NotFoundException.class) @ResponseStatus(HttpStatus.NOT_FOUND) return error page, throw a NotFoundException trigger it, result in proper HTTP status too. This method in a separate class annotated @ControllerAdvice apply controllers, want exclude REST controllers</technical_language>

Target:
public ModelAndView byProjectShortName(@PathVariable String shortName, ModelMap model) throws IOException { Project project = projectService.getProjectByShortName(shortName); if (project == null) throw new NotFoundException("No project found for shortname " + shortName); return setupForm(project.getId(), model); }
Source:
<code>public ITokenCacheStore getCache() { if (mBrokerProxy.canSwitchToBroker()) { return new ITokenCacheStore() { private static final long serialVersionUID = 1L; @Override public void setItem(String key, TokenCacheItem item) { throw new UnsupportedOperationException( "Broker cache does not support direct setItem operation"); } @Override public void removeItem(String key) { throw new UnsupportedOperationException( "Broker cache does not support direct removeItem operation"); } @Override public void removeAll() { mBrokerProxy.removeAccounts(); } @Override public TokenCacheItem getItem(String key) { throw new UnsupportedOperationException( "Broker cache does not support direct getItem operation"); } @Override public boolean contains(String key) { throw new UnsupportedOperationException( "Broker cache does not support contains operation"); } @Override <START> public Iterable<TokenCacheItem> getAll() { <END> throw new UnsupportedOperationException( "Broker cache does not support direct getAll operation"); } }; } return mTokenCacheStore; }</code><technical_language>I meant need this method all.. ITokenCacheStore Iterable< TokenCacheItem ></technical_language>

Target:
public ITokenCacheStore getCache() { if (mBrokerProxy.canSwitchToBroker()) { return new ITokenCacheStore() { private static final long serialVersionUID = 1L; @Override public void setItem(String key, TokenCacheItem item) { throw new UnsupportedOperationException( "Broker cache does not support direct setItem operation"); } @Override public void removeItem(String key) { throw new UnsupportedOperationException( "Broker cache does not support direct removeItem operation"); } @Override public void removeAll() { mBrokerProxy.removeAccounts(); } @Override public TokenCacheItem getItem(String key) { throw new UnsupportedOperationException( "Broker cache does not support direct getItem operation"); } @Override public boolean contains(String key) { throw new UnsupportedOperationException( "Broker cache does not support contains operation"); } @Override public Iterator<TokenCacheItem> getAll() { throw new UnsupportedOperationException( "Broker cache does not support direct getAll operation"); } }; } return mTokenCacheStore; }
Source:
<code>public void testStartSendingEvents() { entrancePi.setOutputStream(outputStream); new Expectations() { { for (int i=0; i<1; i++) { entranceProcessor.isFinished(); result=false; entranceProcessor.hasNext(); result=false; } for (int i=0; i<5; i++) { entranceProcessor.isFinished(); result=false; entranceProcessor.hasNext(); result=true; entranceProcessor.nextEvent(); result=event; outputStream.put(event); } for (int i=0; i<2; i++) { entranceProcessor.isFinished(); result=false; entranceProcessor.hasNext(); result=false; } for (int i=0; i<5; i++) { entranceProcessor.isFinished(); result=false; entranceProcessor.hasNext(); result=true; entranceProcessor.nextEvent(); result=event; outputStream.put(event); } <START> entranceProcessor.isFinished(); result=true; times=1; <END> entranceProcessor.hasNext(); times=0; } }; entrancePi.startSendingEvents(); new Verifications() { { try { Thread.sleep(anyInt); times=3; } catch (InterruptedException e) { } } }; }</code><technical_language>assignments times</technical_language>

Target:
public void testStartSendingEvents() { entrancePi.setOutputStream(outputStream); new StrictExpectations() { { for (int i=0; i<1; i++) { entranceProcessor.isFinished(); result=false; entranceProcessor.hasNext(); result=false; } for (int i=0; i<5; i++) { entranceProcessor.isFinished(); result=false; entranceProcessor.hasNext(); result=true; entranceProcessor.nextEvent(); result=event; outputStream.put(event); } for (int i=0; i<2; i++) { entranceProcessor.isFinished(); result=false; entranceProcessor.hasNext(); result=false; } for (int i=0; i<5; i++) { entranceProcessor.isFinished(); result=false; entranceProcessor.hasNext(); result=true; entranceProcessor.nextEvent(); result=event; outputStream.put(event); } entranceProcessor.isFinished(); result=true; times=1; entranceProcessor.hasNext(); times=0; } }; entrancePi.startSendingEvents(); new Verifications() { { try { Thread.sleep(anyInt); times=3; } catch (InterruptedException e) { } } }; }