auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void setTipBar(List<TipItemInterface> tipItems) { tipBar.clear(); if (tipItems != null) { if (tipItems.size() == 0) { tipBarPanel.setVisible(false); } else { tipBarPanel.setVisible(true); for (TipItemInterface menuItem : tipItems) { final FlowPanel flowPanel = new FlowPanel(); final TipItemInterface currentItem = menuItem; final Label label = new Label(); label.setText("- " + currentItem.getLabel()); label.setStyleName(resources.tipBarStyle().fontStyle()); final Label actionLabel = new Label(); actionLabel.setText(currentItem.getActionLabel()); actionLabel.setStyleName(resources.tipBarStyle().linkStyle()); actionLabel.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { currentItem.getCallBack().onClickAction(); } }); flowPanel.add(label); flowPanel.add(actionLabel); tipBar.add(flowPanel); } } } }

Target:
public void setTipBar(List<TipItemInterface> tipItems) { tipBar.clear(); if (tipItems != null) { if (tipItems.size() == 0) { tipBarPanel.setVisible(false); } else { tipBarPanel.setVisible(true); for (TipItemInterface tipItem : tipItems) { addTipBarItem(tipItem); } } } }
Source:
public boolean advanceNextPosition() { while (true) { boolean hasNextPosition = delegate.advanceNextPosition(); if (!hasNextPosition) { return false; } for (int i = 0; i < scratch.length; i++) { int index = bucketColumnIndices[i]; if (delegate.isNull(index)) { scratch[i] = null; continue; } Class<?> javaType = javaTypeList.get(i); if (javaType == boolean.class) { scratch[i] = delegate.getBoolean(index); } else if (javaType == long.class) { scratch[i] = delegate.getLong(index); } else if (javaType == double.class) { scratch[i] = delegate.getDouble(index); } else if (javaType == Slice.class) { scratch[i] = delegate.getSlice(index); } else if (javaType == Block.class) { scratch[i] = (Block) delegate.getObject(index); } else { throw new UnsupportedOperationException("unknown java type"); } } int bucket = HiveBucketing.getHiveBucket(tableBucketCount, typeInfoList, scratch); if ((bucket - bucketToKeep) % partitionBucketCount != 0) { throw new PrestoException(HIVE_INVALID_BUCKET_FILES, format( "A row that is supposed to be in bucket %s is encountered. Only rows in bucket %s (modulo %s) is expected", bucket, bucketToKeep % partitionBucketCount, partitionBucketCount)); } if (bucket == bucketToKeep) { return true; } } }

Target:
public boolean advanceNextPosition() { while (true) { if (Thread.interrupted()) { Thread.currentThread().interrupt(); throw new PrestoException(GENERIC_INTERNAL_ERROR, "RecordCursor was interrupted"); } boolean hasNextPosition = delegate.advanceNextPosition(); if (!hasNextPosition) { return false; } for (int i = 0; i < scratch.length; i++) { int index = bucketColumnIndices[i]; if (delegate.isNull(index)) { scratch[i] = null; continue; } Class<?> javaType = javaTypeList.get(i); if (javaType == boolean.class) { scratch[i] = delegate.getBoolean(index); } else if (javaType == long.class) { scratch[i] = delegate.getLong(index); } else if (javaType == double.class) { scratch[i] = delegate.getDouble(index); } else if (javaType == Slice.class) { scratch[i] = delegate.getSlice(index); } else if (javaType == Block.class) { scratch[i] = (Block) delegate.getObject(index); } else { throw new UnsupportedOperationException("unknown java type"); } } int bucket = HiveBucketing.getHiveBucket(tableBucketCount, typeInfoList, scratch); if ((bucket - bucketToKeep) % partitionBucketCount != 0) { throw new PrestoException(HIVE_INVALID_BUCKET_FILES, format( "A row that is supposed to be in bucket %s is encountered. Only rows in bucket %s (modulo %s) are expected", bucket, bucketToKeep % partitionBucketCount, partitionBucketCount)); } if (bucket == bucketToKeep) { return true; } } }
Source:
public List<InterpreterCompletion> completion(String buf, int cursor) { if (buf.length() < cursor) { cursor = buf.length(); } String completionText = getCompletionTargetString(buf, cursor); if (completionText == null) { completionText = ""; cursor = completionText.length(); } if (Utils.isScala2_10()) { ScalaCompleter c = (ScalaCompleter) Utils.invokeMethod(completor, "completer"); Candidates ret = c.complete(completionText, cursor); List<String> candidates = WrapAsJava$.MODULE$.seqAsJavaList(ret.candidates()); List<InterpreterCompletion> completions = new LinkedList<InterpreterCompletion>(); for (String candidate : candidates) { completions.add(new InterpreterCompletion(candidate, candidate)); } return completions; } else { return new LinkedList<InterpreterCompletion>(); } }

Target:
public List<InterpreterCompletion> completion(String buf, int cursor) { if (buf.length() < cursor) { cursor = buf.length(); } String completionText = getCompletionTargetString(buf, cursor); if (completionText == null) { completionText = ""; cursor = completionText.length(); } if (Utils.isScala2_10()) { ScalaCompleter c = (ScalaCompleter) Utils.invokeMethod(completer, "completer"); Candidates ret = c.complete(completionText, cursor); List<String> candidates = WrapAsJava$.MODULE$.seqAsJavaList(ret.candidates()); List<InterpreterCompletion> completions = new LinkedList<InterpreterCompletion>(); for (String candidate : candidates) { completions.add(new InterpreterCompletion(candidate, candidate)); } return completions; } else { return new LinkedList<InterpreterCompletion>(); } }
Source:
private synchronized static void allowPatchRequestsIfNeeded() throws GeneralException { if (isPatchRequestAllowed) { return; } try { Field methodsField = HttpURLConnection.class.getDeclaredField("methods"); methodsField.setAccessible(true); Field modifiersField = Field.class.getDeclaredField("modifiers"); modifiersField.setAccessible(true); modifiersField.setInt(methodsField, methodsField.getModifiers() & ~Modifier.FINAL); String[] allowedMethods = getAllowedMethods((String[]) methodsField.get(null)); Object noInstanceBecauseStaticField = null; methodsField.set(noInstanceBecauseStaticField, allowedMethods); isPatchRequestAllowed = true; } catch (IllegalAccessException | NoSuchFieldException e) { throw new GeneralException(CAN_NOT_ALLOW_PATCH); } }

Target:
private synchronized static void allowPatchRequestsIfNeeded() throws GeneralException { if (isPatchRequestAllowed) { return; } try { Field methodsField = HttpURLConnection.class.getDeclaredField("methods"); methodsField.setAccessible(true); Field modifiersField = Field.class.getDeclaredField("modifiers"); modifiersField.setAccessible(true); modifiersField.setInt(methodsField, methodsField.getModifiers() & ~Modifier.FINAL); Object noInstanceBecauseStaticField = null; String[] existingMethods = (String[]) methodsField.get(noInstanceBecauseStaticField); String[] allowedMethods = getAllowedMethods(existingMethods); methodsField.set(noInstanceBecauseStaticField, allowedMethods); isPatchRequestAllowed = true; } catch (IllegalAccessException | NoSuchFieldException e) { throw new GeneralException(CAN_NOT_ALLOW_PATCH); } }
Source:
protected RepositoryFile updateFile( final RepositoryFileImportBundle bundle, final RepositoryFile file, final IRepositoryFileData data ) throws PlatformImportException { RepositoryFile updatedFile = null; if ( isNodeRepositoryFileData( file ) ) { updatedFile = getRepository().updateFile( file, data, bundle.getComment() ); } else { String fileName = bundle.getName(); getLogger().trace( "The file [" + fileName + "] will be recreated because it content-type was changed." ); RepositoryFileAcl originFileAcl = getRepository().getAcl( file.getId() ); getRepository().deleteFile( file.getId(), true, null ); RepositoryFileAcl newFileAcl = bundle.getAcl(); bundle.setExtraMetaData( bundle.getExtraMetaData() ); updatedFile = createFile( bundle, file.getPath(), data ); bundle.setAcl( newFileAcl ); } return updatedFile; }

Target:
protected RepositoryFile updateFile( final RepositoryFileImportBundle bundle, final RepositoryFile file, final IRepositoryFileData data ) throws PlatformImportException { RepositoryFile updatedFile = null; if ( isNodeRepositoryFileData( file ) ) { updatedFile = getRepository().updateFile( file, data, bundle.getComment() ); } else { String fileName = bundle.getName(); getLogger().trace( "The file [" + fileName + "] will be recreated because it content-type was changed." ); RepositoryFileAcl originFileAcl = getRepository().getAcl( file.getId() ); getRepository().deleteFile( file.getId(), true, null ); RepositoryFileAcl newFileAcl = bundle.getAcl(); bundle.setAcl( originFileAcl ); bundle.setExtraMetaData( bundle.getExtraMetaData() ); updatedFile = createFile( bundle, file.getPath(), data ); bundle.setAcl( newFileAcl ); } return updatedFile; }
Source:
void rehash() { ++rehashCount; long newBucketCountLong = bucketCount * 2L; if (newBucketCountLong > Integer.MAX_VALUE) { throw new PrestoException(GENERIC_INSUFFICIENT_RESOURCES, "Size of hash table cannot exceed 1 billion entries"); } int newBucketCount = (int) newBucketCountLong; int newMask = newBucketCount - 1; IntBigArray newBuckets = new IntBigArray(-1); newBuckets.ensureCapacity(newBucketCount); for (int i = 0; i < values.getPositionCount(); i++) { long valueRawHash = valueHashList.get(i); int bucketId = getHashPosition(valueRawHash, newMask); int probeCount = 1; int originalBucket = bucketId; while (newBuckets.get(bucketId) != -1) { int probe = nextProbe(probeCount); bucketId = nextBucketId(originalBucket, mask, probe); probeCount++; } newBuckets.set(bucketId, i); } buckets = newBuckets; valueHashList.ensureCapacity(newBucketCount); bucketCount = newBucketCount; maxfill = calculateMaxFill(newBucketCount, MAX_FILL_RATIO); mask = newMask; }

Target:
void rehash() { ++rehashCount; long newBucketCountLong = bucketCount * 2L; if (newBucketCountLong > Integer.MAX_VALUE) { throw new PrestoException(GENERIC_INSUFFICIENT_RESOURCES, "Size of hash table cannot exceed " + Integer.MAX_VALUE + " entries (" + newBucketCountLong + ")"); } int newBucketCount = (int) newBucketCountLong; int newMask = newBucketCount - 1; IntBigArray newBuckets = new IntBigArray(-1); newBuckets.ensureCapacity(newBucketCount); for (int i = 0; i < values.getPositionCount(); i++) { long valueHash = valueHashes.get(i); int bucketId = getBucketId(valueHash, newMask); int probeCount = 1; while (newBuckets.get(bucketId) != EMPTY_BUCKET) { int probe = nextProbe(probeCount); bucketId = nextBucketId(bucketId, newMask, probe); probeCount++; } newBuckets.set(bucketId, i); } buckets = newBuckets; valueHashes.ensureCapacity(newBucketCount); bucketCount = newBucketCount; maxFill = calculateMaxFill(newBucketCount, MAX_FILL_RATIO); mask = newMask; }
Source:
public MappingIterator(Collection<S> source, Function<S, D> transformation) { this.sourceIt = source.iterator(); this.transformation = transformation; readNext(); }

Target:
public MappingIterator(Collection<S> source, Function<S, D> transformation) { this.sourceIt = source.iterator(); this.transformation = transformation; }
Source:
private void setupMapView(Bundle savedInstanceState) { Timber.d("setupMapView called"); MapboxMapOptions options = new MapboxMapOptions() .compassGravity(Gravity.BOTTOM | Gravity.LEFT) .compassMargins(new int[]{12, 0, 0, 24}) .styleUrl(Style.OUTDOORS) .logoEnabled(false) .attributionEnabled(false) .camera(new CameraPosition.Builder() .target(new LatLng(curLatLng.getLatitude(), curLatLng.getLongitude())) .zoom(ZOOM_LEVEL) .build()); if (!getParentFragment().getActivity().isFinishing()) { mapView = new MapView(getParentFragment().getActivity(), options); mapView.onCreate(savedInstanceState); mapView.getMapAsync(mapboxMap -> { NearbyMapFragment.this.mapboxMap = mapboxMap; addMapMovementListeners(); updateMapSignificantlyForCurrentLocation(); }); mapView.setStyleUrl("asset://mapstyle.json"); } }

Target:
private void setupMapView(Bundle savedInstanceState) { Timber.d("setupMapView called"); boolean isDarkTheme = applicationKvStore.getBoolean("theme", false); MapboxMapOptions options = new MapboxMapOptions() .compassGravity(Gravity.BOTTOM | Gravity.LEFT) .compassMargins(new int[]{12, 0, 0, 24}) .styleUrl(isDarkTheme ? Style.DARK : Style.OUTDOORS) .logoEnabled(true) .attributionEnabled(true) .camera(new CameraPosition.Builder() .target(new LatLng(curLatLng.getLatitude(), curLatLng.getLongitude())) .zoom(ZOOM_LEVEL) .build()); if (!getParentFragment().getActivity().isFinishing()) { mapView = new MapView(getParentFragment().getActivity(), options); mapView.onCreate(savedInstanceState); mapView.getMapAsync(mapboxMap -> { LocalizationPlugin localizationPlugin = new LocalizationPlugin(mapView, mapboxMap); try { localizationPlugin.matchMapLanguageWithDeviceDefault(); } catch (RuntimeException exception) { Timber.d(exception.toString()); } NearbyMapFragment.this.mapboxMap = mapboxMap; addMapMovementListeners(); updateMapSignificantlyForCurrentLocation(); }); } }
Source:
public void notifyVideoEnd() { Log.d("___", "GOT IT"); new Handler(Looper.getMainLooper()).post(new Runnable() { @Override public void run() { if (videoEnabledWebChromeClient != null) { videoEnabledWebChromeClient.onHideCustomView(); } } }); }

Target:
public void notifyVideoEnd() { new Handler(Looper.getMainLooper()).post(new Runnable() { @Override public void run() { if (videoEnabledWebChromeClient != null) { videoEnabledWebChromeClient.onHideCustomView(); } } }); }
Source:
private void updateValueMetadataIfNeccessary(Record record, Object updateValue) { Object valueMetadata = null; try { if (record.getValue() instanceof Data) { valueMetadata = metadataInitializer.createFromData(serializationService.toData(updateValue)); } else { valueMetadata = metadataInitializer.createFromObject(serializationService.toObject(updateValue)); } } catch (IOException e) { ignore(e); } if (valueMetadata != null) { Metadata existing = getMetadata(record); if (existing == null) { existing = new Metadata(); setMetadata(record, existing); } existing.setValueMetadata(valueMetadata); } else { Metadata existing = getMetadata(record); if (existing != null) { if (existing.getKeyMetadata() == null) { removeMetadata(record); } else { existing.setValueMetadata(valueMetadata); } } } }

Target:
private void updateValueMetadataIfNeccessary(Record record, Object updateValue) { Object valueMetadata = null; try { if (record.getValue() instanceof Data) { valueMetadata = metadataInitializer.createFromData(serializationService.toData(updateValue)); } else { valueMetadata = metadataInitializer.createFromObject(serializationService.toObject(updateValue)); } } catch (IOException e) { ignore(e); } catch (Exception e) { throw rethrow(e); } if (valueMetadata != null) { Metadata existing = getMetadata(record); if (existing == null) { existing = new Metadata(); setMetadata(record, existing); } existing.setValueMetadata(valueMetadata); } else { Metadata existing = getMetadata(record); if (existing != null) { if (existing.getKeyMetadata() == null) { removeMetadata(record); } else { existing.setValueMetadata(valueMetadata); } } } }
Source:
public ServerFrontEnd(ChannelInboundHandlerAdapter adapter, int port, boolean datagram) { this.adapter = adapter; this.port = port; this.datagram = datagram; if(datagram){boss = null;}else{ boss = new NioEventLoopGroup();} }

Target:
private ServerFrontEnd(ChannelInboundHandlerAdapter adapter, int port, boolean datagram) { this.adapter = adapter; this.port = port; this.datagram = datagram; if(datagram) { boss = null; } else { boss = new NioEventLoopGroup(); } }
Source:
public void changePeriodTest() { final ArrayList<Integer> ticks = new ArrayList<>(); final TickingTimer tickingTimer = new TickingTimer("test3", 5, (Integer i) -> {}, () -> { tickingTimerStatus = true; ticks.clear(); }, TimeUnit.SECONDS); tickingTimer.start(); delay(3.9); if (hasTimeout()) { fail(); } else { tickingTimer.changePeriod(3); } delay(1.5); if (hasTimeout()) { fail(); } delay(1.6); if (hasTimeout()) { tickingTimerStatus = false; } else { fail(); } delay(2); if (hasTimeout()) { fail(); } delay(1.5); if (!hasTimeout()) { fail(); } }

Target:
public void changePeriodTest() { final ArrayList<Integer> ticks = new ArrayList<>(); final TickingTimer tickingTimer = new TickingTimer("test3", 5, (Integer i) -> {}, () -> { isTriggered = true; ticks.clear(); }, TimeUnit.SECONDS); tickingTimer.start(); delay(3.9); assertTrue(!isTriggered()); tickingTimer.restartTimer(3); delay(1.5); assertTrue(!isTriggered()); delay(1.6); assertTrue(isTriggered()); resetTimeoutStatus(); delay(2); assertTrue(!isTriggered()); delay(1.5); assertTrue(isTriggered()); }
Source:
public void handleIQ(IQ packet, MUCRole role) throws ForbiddenException, ConflictException, NotAllowedException, CannotBeInvitedException { IQ reply = IQ.createResultIQ(packet); Element element = packet.getChildElement(); @SuppressWarnings("unchecked") List<Element> itemsList = element.elements("item"); if (!itemsList.isEmpty()) { handleItemsElement(role, itemsList, reply); } else if (!itemsList.isEmpty() && !itemsList.toString().contains(packet.getFrom().toBareJID())) { handleItemsElement(role, itemsList, reply); } else { reply.setChildElement(packet.getChildElement().createCopy()); reply.setError(PacketError.Condition.bad_request); } if (reply.getTo() != null) { router.route(reply); } }

Target:
public void handleIQ(IQ packet, MUCRole role) throws ForbiddenException, ConflictException, NotAllowedException, CannotBeInvitedException { IQ reply = IQ.createResultIQ(packet); Element element = packet.getChildElement(); @SuppressWarnings("unchecked") List<Element> itemsList = element.elements("item"); if (!itemsList.isEmpty() && packet.getFrom() == null) { handleItemsElement(role, itemsList, reply); } else if (!itemsList.isEmpty() && !itemsList.toString().contains(packet.getFrom().toBareJID())) { handleItemsElement(role, itemsList, reply); } else { reply.setChildElement(packet.getChildElement().createCopy()); reply.setError(PacketError.Condition.bad_request); } if (reply.getTo() != null) { router.route(reply); } }
Source:
private JComboBox getSymbolUOMComboBox(){ uoms = getUomProperties(); UomCombo puc = new UomCombo(((CategorizedPoint)getLegend()).getSymbolUom(), uoms, I18N.tr(UNIT_OF_MEASURE + " - size :")); puc.addActionListener( EventHandler.create(ActionListener.class, this, "updateSUComboBox", "source.selectedIndex")); return puc.getCombo(); }

Target:
private JComboBox getSymbolUOMComboBox(){ uoms = getUomProperties(); UomCombo puc = new UomCombo(((CategorizedPoint)getLegend()).getSymbolUom(), uoms, I18N.tr("Symbol size unit")); puc.addActionListener( EventHandler.create(ActionListener.class, this, "updateSUComboBox", "source.selectedIndex")); return puc.getCombo(); }
Source:
public void dispose() { if (connectionJob != null) { connectionJob.cancel(true); connectionJob = null; } scheduler.submit(() -> { if (device != null) { device.disconnect(); device = null; } }); super.dispose(); }

Target:
public void dispose() { if (connectionJob != null) { connectionJob.cancel(true); connectionJob = null; } scheduler.submit(() -> { try { deviceLock.lock(); if (device != null) { device.removeListener(this); device.disconnect(); device = null; } } finally { deviceLock.unlock(); } }); }
Source:
? TimeUnit.MINUTES.toMillis(1) : TimeUnit.DAYS.toMillis(1); private static ComponentName sDexoptServiceName = new ComponentName( "android", BackgroundDexOptService.class.getName()); private static final int OPTIMIZE_PROCESSED = 0; private static final int OPTIMIZE_CONTINUE = 1; private static final int OPTIMIZE_ABORT_BY_JOB_SCHEDULER = 2; private static final int OPTIMIZE_ABORT_NO_SPACE_LEFT = 3; private static final long QUICKEN_UNUSED_APPS_THRESHOLD_IN_MILLIS = 2592000000L; static final ArraySet<String> sFailedPackageNamesPrimary = new ArraySet<String>(); static final ArraySet<String> sFailedPackageNamesSecondary = new ArraySet<String>(); private final AtomicBoolean mAbortPostBootUpdate = new AtomicBoolean(false); private final AtomicBoolean mAbortIdleOptimization = new AtomicBoolean(false); private final AtomicBoolean mExitPostBootUpdate = new AtomicBoolean(false); private final File mDataDir = Environment.getDataDirectory(); public static void schedule(Context context) { JobScheduler js = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE); js.schedule(new JobInfo.Builder(JOB_POST_BOOT_UPDATE, sDexoptServiceName) .setMinimumLatency(TimeUnit.MINUTES.toMillis(1)) .setOverrideDeadline(TimeUnit.MINUTES.toMillis(1)) .build()); js.schedule(new JobInfo.Builder(JOB_IDLE_OPTIMIZE, sDexoptServiceName) .setRequiresDeviceIdle(true) .setRequiresCharging(true) .setPeriodic(IDLE_OPTIMIZATION_PERIOD) .build()); if (DEBUG_DEXOPT) { Log.i(TAG, "Jobs scheduled"); } }

Target:
? TimeUnit.MINUTES.toMillis(1) : TimeUnit.DAYS.toMillis(1); private static ComponentName sDexoptServiceName = new ComponentName( "android", BackgroundDexOptService.class.getName()); private static final int OPTIMIZE_PROCESSED = 0; private static final int OPTIMIZE_CONTINUE = 1; private static final int OPTIMIZE_ABORT_BY_JOB_SCHEDULER = 2; private static final int OPTIMIZE_ABORT_NO_SPACE_LEFT = 3; private static final String DEOPTIMIZE_UNUSED_APPS_THRSHOLD_SYS_PROP = "pm.dexopt.deopt_threshold"; private static final long DEOPTIMIZE_UNUSED_APPS_THRESHOLD_IN_MILLIS = getDeoptimizeUnusedAppsThresholdInMillis(); static final ArraySet<String> sFailedPackageNamesPrimary = new ArraySet<String>(); static final ArraySet<String> sFailedPackageNamesSecondary = new ArraySet<String>(); private final AtomicBoolean mAbortPostBootUpdate = new AtomicBoolean(false); private final AtomicBoolean mAbortIdleOptimization = new AtomicBoolean(false); private final AtomicBoolean mExitPostBootUpdate = new AtomicBoolean(false); private final File mDataDir = Environment.getDataDirectory(); public static void schedule(Context context) { JobScheduler js = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE); js.schedule(new JobInfo.Builder(JOB_POST_BOOT_UPDATE, sDexoptServiceName) .setMinimumLatency(TimeUnit.MINUTES.toMillis(1)) .setOverrideDeadline(TimeUnit.MINUTES.toMillis(1)) .build()); js.schedule(new JobInfo.Builder(JOB_IDLE_OPTIMIZE, sDexoptServiceName) .setRequiresDeviceIdle(true) .setRequiresCharging(true) .setPeriodic(IDLE_OPTIMIZATION_PERIOD) .build()); if (DEBUG_DEXOPT) { Log.i(TAG, "Jobs scheduled"); } }
Source:
public final void collision(final AbstractEntity collidee) { if (collidee instanceof Coin) { apCoin.play(); OBSERVABLE.notify(Category.PLAYER, GameObserver.Player.COLLISION, Coin.class.getSimpleName()); State.addScore(Coin.VALUE); State.addCoins(1); } if (collidee instanceof AbstractObstacle) { apDie.play(); OBSERVABLE.notify( Category.PLAYER, GameObserver.Player.COLLISION, AbstractObstacle.class.getSimpleName()); if (!isInvincible()) { die(); } } }

Target:
public final void collision(final AbstractEntity collidee) { if (collidee instanceof Coin) { OBSERVABLE.notify(Category.PLAYER, GameObserver.Player.COLLISION, Coin.class.getSimpleName()); State.addScore(Coin.VALUE); State.addCoins(1); } if (collidee instanceof AbstractObstacle) { OBSERVABLE.notify( Category.PLAYER, GameObserver.Player.COLLISION, AbstractObstacle.class.getSimpleName()); if (!isInvincible()) { die(); } } }
Source:
public RespondingGatewayPRPAIN201306UV02ResponseType respondingGatewayPRPAIN201305UV02(PRPAIN201305UV02 pdRequest, AssertionType assertion, NhinTargetCommunitiesType targetCommunities) { LOG.debug("Begin respondingGatewayPRPAIN201305UV02"); RespondingGatewayPRPAIN201306UV02ResponseType response = null; try { String url = getEndpointURL(); if (pdRequest == null) { LOG.error("PRPAIN201305UV02 was null"); } else if (assertion == null) { LOG.error("AssertionType was null"); } else if (targetCommunities == null) { LOG.error("NhinTargetCommunitiesType was null"); } else { RespondingGatewayPRPAIN201305UV02RequestType request = new RespondingGatewayPRPAIN201305UV02RequestType(); request.setPRPAIN201305UV02(pdRequest); request.setAssertion(assertion); request.setNhinTargetCommunities(targetCommunities); response = (RespondingGatewayPRPAIN201306UV02ResponseType) getClient(url, assertion).invokePort( EntityPatientDiscoveryPortType.class, "respondingGatewayPRPAIN201305UV02", request); } } catch (Exception ex) { LOG.error("Error calling respondingGatewayPRPAIN201305UV02: " + ex.getMessage(), ex); } LOG.debug("End respondingGatewayPRPAIN201305UV02"); return response; }

Target:
public RespondingGatewayPRPAIN201306UV02ResponseType respondingGatewayPRPAIN201305UV02(PRPAIN201305UV02 pdRequest, AssertionType assertion, NhinTargetCommunitiesType targetCommunities) { LOG.debug("Begin respondingGatewayPRPAIN201305UV02"); RespondingGatewayPRPAIN201306UV02ResponseType response = null; try { String url = getEndpointURL(); if (pdRequest == null) { LOG.error("PRPAIN201305UV02 was null"); } else if (assertion == null) { LOG.error("AssertionType was null"); } else if (targetCommunities == null) { LOG.error("NhinTargetCommunitiesType was null"); } else { RespondingGatewayPRPAIN201305UV02RequestType request = new RespondingGatewayPRPAIN201305UV02RequestType(); request.setPRPAIN201305UV02(pdRequest); request.setAssertion(assertion); request.setNhinTargetCommunities(targetCommunities); response = (RespondingGatewayPRPAIN201306UV02ResponseType) getClient(url, assertion).invokePort( EntityPatientDiscoveryPortType.class, "respondingGatewayPRPAIN201305UV02", request); } } catch (Exception ex) { LOG.error("Error calling respondingGatewayPRPAIN201305UV02: " , ex.getMessage(), ex); } LOG.debug("End respondingGatewayPRPAIN201305UV02"); return response; }
Source:
public MessageArtifactTranslator(InputStream templateStream, JinjavaFactory jinjavaFactory) { if (templateStream == null) { this.jinjaTemplate = ""; } else { try { this.jinjaTemplate = IOUtils.toString(templateStream, Charset.defaultCharset()); } catch (IOException ioe) { throw new RuntimeException(ioe); } } this.jinjavaFactory = jinjavaFactory; }

Target:
public MessageArtifactTranslator(InputStream templateStream, JinjavaFactory jinjavaFactory) { if (templateStream == null) { this.jinjaTemplate = ""; } else { try { this.jinjaTemplate = IOUtils.toString(templateStream, Charset.forName("UTF-8")); } catch (IOException ioe) { throw new RuntimeException(ioe); } } this.jinjavaFactory = jinjavaFactory; }
Source:
public static void listResources(URI parent, Consumer<Path> consumer) throws IOException { FileSystem fileSystem = null; try { if (!parent.getScheme().equals("file")) { try { fileSystem = FileSystems.newFileSystem(parent, Collections.emptyMap()); } catch (FileSystemAlreadyExistsException ignore) { } } Path root = Paths.get(parent); Files.list(root).forEach(consumer); } finally { if (fileSystem != null) { fileSystem.close(); } } }

Target:
public static void listResources(URI parent, Consumer<Path> consumer) throws IOException { FileSystem fileSystem = null; try { if (!"file".equals(parent.getScheme())) { try { fileSystem = FileSystems.newFileSystem(parent, Collections.emptyMap()); } catch (FileSystemAlreadyExistsException ignore) { } } Path root = Paths.get(parent); Files.list(root).forEach(consumer); } finally { if (fileSystem != null) { fileSystem.close(); } } }
Source:
public void verifyBackLinkFunctionality(int anchorIndex) { waitForElementVisibleByElement(chevrons.get(anchorIndex)); if (chevrons.size() != 0) { chevrons.get(anchorIndex).click(); waitForElementVisibleByElement(backChevron); backChevron.click(); PageObjectLogging.log("verifyBackLinkFunctionality", "Back button is working", true, driver); } }

Target:
public void verifyBackLinkFunctionality(int anchorIndex) { waitForElementVisibleByElement(chevrons.get(anchorIndex)); chevrons.get(anchorIndex).click(); waitForElementVisibleByElement(backChevron); backChevron.click(); PageObjectLogging.log("verifyBackLinkFunctionality", "Back button is working", true, driver); }
Source:
protected void setUp() throws Exception { super.setUp(); changePlatformUIPreference(IWorkbenchPreferenceConstants.PROMPT_WHEN_SAVEABLE_STILL_OPEN, true); changeSiriusUIPreference(SiriusUIPreferencesKeys.PREF_RELOAD_ON_LAST_EDITOR_CLOSE.name(), true); changeSiriusUIPreference(SiriusUIPreferencesKeys.PREF_SAVE_WHEN_NO_EDITOR.name(), true); copyFilesToTestProject(SiriusTestsPlugin.PLUGIN_ID, ZOOM_SEMANTIC_MODEL_FOLDER_PATH, ZOOM_SEMANTIC_MODEL_NAME); copyFilesToTestProject(SiriusTestsPlugin.PLUGIN_ID, PACKAGES_SEMANTIC_MODEL_FOLDER_PATH, PACKAGES_SEMANTIC_MODEL_NAME); String alternativeSessionResourcePath = TEMPORARY_PROJECT_NAME + "/" + "alternativeSession.aird"; genericSetUp(TEMPORARY_PROJECT_NAME + "/" + ZOOM_SEMANTIC_MODEL_NAME, MODELER_PATH, alternativeSessionResourcePath); alternateSession = session; alternateSemanticModel = alternateSession.getSemanticResources().iterator().next().getContents().get(0); initViewpoint(DESIGN_VIEWPOINT_NAME, alternateSession, alternateSemanticModel); TestsUtil.emptyEventsFromUIThread(); String sessionResourcePath = TEMPORARY_PROJECT_NAME + "/" + "session.aird"; genericSetUp(TEMPORARY_PROJECT_NAME + "/" + PACKAGES_SEMANTIC_MODEL_NAME, MODELER_PATH, sessionResourcePath); initViewpoint(DESIGN_VIEWPOINT_NAME); TestsUtil.emptyEventsFromUIThread(); Job.getJobManager().join(SaveSessionJob.FAMILY, new NullProgressMonitor()); session.save(new NullProgressMonitor()); mock = createMock(SessionManagerListener.class); makeThreadSafe(mock, true); SessionManager.INSTANCE.addSessionsListener(mock); }

Target:
protected void setUp() throws Exception { super.setUp(); changePlatformUIPreference(IWorkbenchPreferenceConstants.PROMPT_WHEN_SAVEABLE_STILL_OPEN, true); changeSiriusUIPreference(SiriusUIPreferencesKeys.PREF_RELOAD_ON_LAST_EDITOR_CLOSE.name(), true); changeSiriusUIPreference(SiriusUIPreferencesKeys.PREF_SAVE_WHEN_NO_EDITOR.name(), true); copyFilesToTestProject(SiriusTestsPlugin.PLUGIN_ID, ZOOM_SEMANTIC_MODEL_FOLDER_PATH, ZOOM_SEMANTIC_MODEL_NAME); copyFilesToTestProject(SiriusTestsPlugin.PLUGIN_ID, PACKAGES_SEMANTIC_MODEL_FOLDER_PATH, PACKAGES_SEMANTIC_MODEL_NAME); String alternativeSessionResourcePath = TEMPORARY_PROJECT_NAME + "/" + "alternativeSession.aird"; genericSetUp(TEMPORARY_PROJECT_NAME + "/" + ZOOM_SEMANTIC_MODEL_NAME, MODELER_PATH, alternativeSessionResourcePath); alternateSession = session; alternateSemanticModel = alternateSession.getSemanticResources().iterator().next().getContents().get(0); initViewpoint(DESIGN_VIEWPOINT_NAME, alternateSession, alternateSemanticModel); TestsUtil.emptyEventsFromUIThread(); String sessionResourcePath = TEMPORARY_PROJECT_NAME + "/" + "session.aird"; genericSetUp(TEMPORARY_PROJECT_NAME + "/" + PACKAGES_SEMANTIC_MODEL_NAME, MODELER_PATH, sessionResourcePath); initViewpoint(DESIGN_VIEWPOINT_NAME); TestsUtil.emptyEventsFromUIThread(); session.save(new NullProgressMonitor()); mock = createMock(SessionManagerListener.class); makeThreadSafe(mock, true); SessionManager.INSTANCE.addSessionsListener(mock); }
Source:
public StoringMappingIdGenerator(IdMappingStore idMappingStore, IdGenerator delegate) { this.idMappingStore = idMappingStore; this.delegate = delegate; }

Target:
public StoringMappingIdGenerator(IdMappingStore idMappingStore, IdGenerator delegate) { this.idMappingStore = checkNotNull(idMappingStore); this.delegate = checkNotNull(delegate); }
Source:
private List<String> validateFilterOption( String moduleName, String filterOption, String testGroup) { List<String> errors = new ArrayList<>(); Set<Filters> filterTypes = new HashSet<>(); Map<Filters, Set<TestInfo>> filterTestInfos = new HashMap<>(); for (TestInfo test : getTestInfos(moduleName, testGroup)) { for (TestOption options : test.getOptions()) { if (options.getName().equals(filterOption)) { Filters optionType = getOptionType(options.getValue()); filterTestInfos.computeIfAbsent(optionType, k -> new HashSet<>()).add(test); } } } filterTypes = filterTestInfos.keySet(); if (!(filterTypes.isEmpty() || filterTypes.size() == 1)) { errors.add( String.format( "Mixed filter types found. Test: %s , TestGroup: %s, Details:\n" + "%s", moduleName, testGroup, getDetailedErrors(filterOption, filterTestInfos))); } return errors; }

Target:
private List<String> validateFilterOption( String moduleName, String filterOption, String testGroup) { List<String> errors = new ArrayList<>(); Set<Filters> filterTypes = new HashSet<>(); Map<Filters, Set<TestInfo>> filterTestInfos = new HashMap<>(); for (TestInfo test : getTestInfos(moduleName, testGroup)) { for (TestOption options : test.getOptions()) { if (options.getName().equals(filterOption)) { Filters optionType = getOptionType(options.getValue()); filterTestInfos.computeIfAbsent(optionType, k -> new HashSet<>()).add(test); } } } filterTypes = filterTestInfos.keySet(); if (filterTypes.size() > 1) { errors.add( String.format( "Mixed filter types found. Test: %s , TestGroup: %s, Details:\n" + "%s", moduleName, testGroup, getDetailedErrors(filterOption, filterTestInfos))); } return errors; }
Source:
public void openInNewContext(EObject eObject) { if (RootObject.class.cast(treeViewer.getInput()).getRoot() == eObject) { treeViewer.setSelection(new StructuredSelection(eObject), true); return; } final AdapterFactoryContentProvider contentProvider = AdapterFactoryContentProvider.class.cast(treeViewer .getContentProvider()); final Object[] children = contentProvider.getChildren(RootObject.class.cast(treeViewer.getInput()) .getRoot()); if (containsData(contentProvider, children, eObject)) { treeViewer.setSelection(new StructuredSelection(eObject), true); return; } if (delegate == null) { return; } delegate.openInNewContext(eObject); }

Target:
public void openInNewContext(EObject eObject) { treeViewer.setSelection(new StructuredSelection(new Integer(1)), true); final ISelection selection = treeViewer.getSelection(); if (!selection.isEmpty()) { return; } if (delegate == null) { return; } delegate.openInNewContext(eObject); }
Source:
public void selectLanguage(String lang) { wait.forElementClickable(wikiLanguageDropdown); new Actions(driver).moveToElement(wikiLanguageDropdown).perform(); List<WebElement> langList = wikiLanguageList.findElements(By.cssSelector("li:not(.spacer)")); String langSelector = lang + ":"; for (WebElement selectedLanguage : langList) { String selectedLanguageText = selectedLanguage.getText(); if (selectedLanguageText.contains(langSelector)) { wait.forElementClickable(selectedLanguage); selectedLanguage.click(); PageObjectLogging .log("selectLanguage", "selected " + selectedLanguageText + " language", true, driver); break; } } }

Target:
public void selectLanguage(String lang) { jsActions.scrollToElement(wait.forElementClickable(wikiLanguageDropdown)); String langSelector = lang + ":"; WebElement langElementInDropdown = wikiLanguageList.stream() .filter(e -> e.getAttribute("innerHTML").trim().contains(langSelector)).findAny() .orElseThrow(() -> new WebDriverException(String.format("Couldn't find language [%s]", lang))); hover(wikiLanguageDropdown); langElementInDropdown.click(); PageObjectLogging .log("selectLanguage", "selected " + langElementInDropdown.getAttribute("innerHTML").trim() + " language", true, driver); }
Source:
public Object compute(Map<String, Object> values) { Iterator<PostAggregator> fieldsIter = fields.iterator(); Double retVal = NullHandling.replaceWithDefault() ? Double.NEGATIVE_INFINITY : null; while (fieldsIter.hasNext()) { Number nextVal = ((Number) fieldsIter.next().compute(values)); if (nextVal != null && COMPARATOR.compare(nextVal.doubleValue(), retVal) > 0) { retVal = nextVal.doubleValue(); } } return retVal; }

Target:
public Object compute(Map<String, Object> values) { Iterator<PostAggregator> fieldsIter = fields.iterator(); Double retVal = NullHandling.replaceWithDefault() ? Double.NEGATIVE_INFINITY : null; while (fieldsIter.hasNext()) { Number nextVal = ((Number) fieldsIter.next().compute(values)); if (nextVal != null && (retVal == null || COMPARATOR.compare(nextVal, retVal) > 0)) { if (nextVal instanceof Double) { retVal = (Double) nextVal; } else { retVal = nextVal.doubleValue(); } } } return retVal; }
Source:
public void run(final ActionContext context) throws Exception { Connection connection = new Connection(config.host); try { connection.connect(); String password = Strings.isNullOrEmpty(config.password) ? null : config.password; if (!connection.authenticateWithPublicKey(config.user, new File(config.privateKeyFile), password)) { throw new IOException(String.format("Unable to establish SSH connection for %s@%s on port %d", config.user, config.host, config.port)); } LOG.info(String.format("Connection established with the host %s", config.host)); Session session = connection.openSession(); session.execCommand(config.cmd); InputStream stdout = new StreamGobbler(session.getStdout()); BufferedReader outBuffer = new BufferedReader(new InputStreamReader(stdout)); InputStream stderr = new StreamGobbler(session.getStderr()); BufferedReader errBuffer = new BufferedReader(new InputStreamReader(stderr)); StringBuilder outBuilder = new StringBuilder(); StringBuilder errBuilder = new StringBuilder(); String line = outBuffer.readLine(); while (line != null) { outBuilder.append(line).append("\n"); line = outBuffer.readLine(); } line = errBuffer.readLine(); while (line != null) { errBuilder.append(line).append("\n"); line = errBuffer.readLine(); } LOG.info("Output: {}", outBuilder.toString()); LOG.info("Errors: {}", errBuilder.toString()); if (config.output != null) { context.getArguments().set(config.output, outBuilder.toString()); } session.close(); } finally { connection.close(); } }

Target:
public void run(final ActionContext context) throws Exception { Connection connection = new Connection(config.host); Session session = connection.openSession(); try { connection.connect(); String password = Strings.isNullOrEmpty(config.password) ? null : config.password; if (!connection.authenticateWithPublicKey(config.user, new File(config.privateKeyFile), password)) { throw new IOException(String.format("SSH authentication error when connecting to %s@%s on port %d", config.user, config.host, config.port)); } LOG.debug("Connection established with the host {}", config.host); session.execCommand(config.command); InputStream stdout = new StreamGobbler(session.getStdout()); BufferedReader outBuffer = new BufferedReader(new InputStreamReader(stdout, Charsets.UTF_8)); InputStream stderr = new StreamGobbler(session.getStderr()); BufferedReader errBuffer = new BufferedReader(new InputStreamReader(stderr, Charsets.UTF_8)); String out = CharStreams.toString(outBuffer); String err = CharStreams.toString(errBuffer); LOG.debug("Output: {}", out); LOG.error("Errors: {}", err); if (config.output != null) { context.getArguments().set(config.output, out); } } finally { connection.close(); } }
Source:
public void run() { Thread.yield(); try { final String rawLastCheck = this.config.lastCheck(); final long lastCheck = Long.parseLong( rawLastCheck ); final Date now = new Date(); final long nowInMs = now.getTime(); final long intervalInMs = this.config.interval() * SEC_TO_HOUR * MS_TO_SEC; final long lastAfterInterval = lastCheck + intervalInMs; this.processInterval( nowInMs, lastAfterInterval ); AELog.info( "Stopping AE2 VersionChecker" ); } catch( Exception e ) { AELog.error( e ); } }

Target:
public void run() { try { Thread.yield(); this.config.save(); final String rawLastCheck = this.config.lastCheck(); final long lastCheck = Long.parseLong( rawLastCheck ); final Date now = new Date(); final long nowInMs = now.getTime(); final long intervalInMs = this.config.interval() * SEC_TO_HOUR * MS_TO_SEC; final long lastAfterInterval = lastCheck + intervalInMs; this.processInterval( nowInMs, lastAfterInterval ); } catch( Exception exception ) { AELog.error( exception ); } AELog.info( "Stopping AE2 VersionChecker" ); }
Source:
public List<Double> execute() throws SAXException, IOException, ParserConfigurationException, FeatureFinderMetaboException { List<Double> mzValuesResult = new ArrayList<Double>(); if (!OPENMS_FEATURE_FINDER_METABO_LIBRARY_NAME.equals(null)) { createTempFeatureXMLFile(); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(FEATURE_XML_FILE); doc.getDocumentElement().normalize(); NodeList featureMap = doc.getElementsByTagName("featureMap").item(0).getChildNodes(); NodeList featureList = null; for (int i = 0; i < featureMap.getLength(); i++) { Node node = featureMap.item(i); if (node.getNodeName().equals("featureList")) featureList = node.getChildNodes(); } for (int i = 0; i < featureList.getLength(); i++) { Node node = featureList.item(i); if (node.getNodeName().equals("feature")) { Element featureElement = (Element) node; mzValuesResult.add( Double.valueOf(featureElement.getElementsByTagName("position").item(1).getTextContent())); } } } else { throw new FeatureFinderMetaboException( "FeatureFinderMetabo library not found. Please install OpenMS and add FeatureFinderMetabo to Path."); } return mzValuesResult; }

Target:
public List<Double> execute() throws SAXException, IOException, ParserConfigurationException, MSDKException { List<Double> mzValuesResult = new ArrayList<Double>(); createTempFeatureXMLFile(); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(FEATURE_XML_FILE); doc.getDocumentElement().normalize(); NodeList featureMap = doc.getElementsByTagName("featureMap").item(0).getChildNodes(); NodeList featureList = null; for (int i = 0; i < featureMap.getLength(); i++) { Node node = featureMap.item(i); if (node.getNodeName().equals("featureList")) featureList = node.getChildNodes(); } for (int i = 0; i < featureList.getLength(); i++) { Node node = featureList.item(i); if (node.getNodeName().equals("feature")) { Element featureElement = (Element) node; mzValuesResult .add(Double.valueOf(featureElement.getElementsByTagName("position").item(1).getTextContent())); } } return mzValuesResult; }
Source:
private Predicate<ItemDefinition> typeRefIsCustom(final QName typeRef) { return itemDef -> itemDef.getName().getValue().equals(typeRef.getLocalPart()); }

Target:
private Predicate<ItemDefinition> typeRefIsCustom(final QName typeRef) { return itemDef -> Objects.equals(itemDef.getName().getValue(), typeRef.getLocalPart()); }
Source:
public final List<A> minus(final Equal<A> eq, final List<A> xs) { return this.removeAll(compose(Monoid.disjunctionMonoid.sumLeft(), xs.mapM(Function.<A, A, Boolean>curry(eq.eq())))); }

Target:
public final List<A> minus(final Equal<A> eq, final List<A> xs) { return removeAll(compose(Monoid.disjunctionMonoid.sumLeft(), xs.mapM(curry(eq.eq())))); }
Source:
public boolean visit(IResourceDelta delta) throws CoreException { if (atLeastOneInterestingDelta) { return false; } final IResource resource = delta.getResource(); if (resource.getType() == IResource.ROOT) { return true; } if (resource.getType() == IResource.PROJECT && (delta.getKind() == IResourceDelta.REMOVED || delta .getKind() == IResourceChangeEvent.PRE_DELETE)) { atLeastOneInterestingDelta = true; return false; } if (resource.getType() == IResource.FOLDER && delta.getKind() == IResourceDelta.ADDED) { atLeastOneInterestingDelta = true; return false; } if (GitResourceDeltaVisitor.isInteresting(delta)) { atLeastOneInterestingDelta = true; return false; } return true; }

Target:
public boolean visit(IResourceDelta delta) throws CoreException { if (atLeastOneInterestingDelta) { return false; } final IResource resource = delta.getResource(); if (resource.getType() == IResource.ROOT) { return true; } if (resource.getType() == IResource.PROJECT && (delta.getKind() == IResourceDelta.REMOVED)) { atLeastOneInterestingDelta = true; return false; } if (resource.getType() == IResource.FOLDER && delta.getKind() == IResourceDelta.ADDED) { atLeastOneInterestingDelta = true; return false; } if (GitResourceDeltaVisitor.isInteresting(delta)) { atLeastOneInterestingDelta = true; return false; } return true; }
Source:
public void testAllocationDeallocationMemory() { fModule.schedule(); fModule.waitForCompletion(); ITmfStateSystem ss = fModule.getStateSystem(); assertNotNull(ss); assertEquals(1L, ss.getStartTime()); assertEquals(30L, ss.getCurrentEndTime()); long totalMemory = 0; threadEvent.put(1L, PAGE_SIZE); threadEvent.put(2L, -PAGE_SIZE); threadEvent.put(3L, -PAGE_SIZE); threadEvent.put(17L, PAGE_SIZE); threadEvent.put(22L, -PAGE_SIZE); threadEvent.put(28L, -PAGE_SIZE); threadEvent.put(29L, PAGE_SIZE); threadEvent.put(30L, PAGE_SIZE); for (Map.Entry<Long, Long> entry : threadEvent.entrySet()) { try { ITmfStateInterval kernelState = ss.querySingleState(entry.getKey(), 0); long value = kernelState.getStateValue().unboxLong(); totalMemory += entry.getValue(); assertEquals(totalMemory, value); } catch (StateSystemDisposedException | AttributeNotFoundException e) { fail(e.getMessage()); } } }

Target:
public void testAllocationDeallocationMemory() { fModule.schedule(); fModule.waitForCompletion(); ITmfStateSystem ss = fModule.getStateSystem(); assertNotNull(ss); assertEquals(1L, ss.getStartTime()); assertEquals(30L, ss.getCurrentEndTime()); long totalMemory = 0; threadEvent.put(1L, PAGE_SIZE); threadEvent.put(2L, -PAGE_SIZE); threadEvent.put(3L, -PAGE_SIZE); threadEvent.put(17L, PAGE_SIZE); threadEvent.put(22L, -PAGE_SIZE); threadEvent.put(28L, -PAGE_SIZE); threadEvent.put(29L, PAGE_SIZE); threadEvent.put(30L, PAGE_SIZE); for (Map.Entry<Long, Long> entry : threadEvent.entrySet()) { try { ITmfContext context = fTrace.seekEvent(entry.getKey()); ITmfEvent event = fTrace.getNext(context); if (event == null) { assertNull(event); }else{ Integer tidField = KernelTidAspect.INSTANCE.resolve(event); String tid; if (tidField == null) { assertNull(tidField); tid = "other"; } else { tid = tidField.toString(); } int tidQuark = ss.getQuarkAbsolute(tid); ITmfStateInterval kernelState = ss.querySingleState(entry.getKey(), tidQuark); long value = kernelState.getStateValue().unboxLong(); totalMemory += entry.getValue(); assertEquals(totalMemory, value); } } catch (StateSystemDisposedException | AttributeNotFoundException e) { fail(e.getMessage()); } } }
Source:
public void testFirstIntervalIsConsidered() { List<ITmfStateInterval> list; ITmfStateInterval interval; int quark = 233, valueInt; try { list = ssq.queryFullState(interestingTimestamp2); interval = list.get(quark); assertEquals(1331668247516664825L, interval.getStartTime()); assertEquals(1331668248014135818L, interval.getEndTime()); valueInt = interval.getStateValue().unboxInt(); assertEquals(1, valueInt); } catch (TimeRangeException e) { fail(); } catch (StateSystemDisposedException e) { fail(); } catch (StateValueTypeException e) { fail(); } }

Target:
public void testFirstIntervalIsConsidered() { try { List<ITmfStateInterval> list; ITmfStateInterval interval; int quark = interestingQuark, valueInt; list = ssq.queryFullState(interestingTimestamp2); interval = list.get(quark); assertEquals(1331668247516664825L, interval.getStartTime()); assertEquals(1331668248014135818L, interval.getEndTime()); valueInt = interval.getStateValue().unboxInt(); assertEquals(1, valueInt); } catch (TimeRangeException e) { fail(); } catch (StateSystemDisposedException e) { fail(); } catch (StateValueTypeException e) { fail(); } }
Source:
protected final boolean performAllBuildSteps(BuildListener listener, Iterable<? extends BuildStep> buildSteps, boolean phase) throws InterruptedException, IOException { boolean r = true; for (BuildStep bs : buildSteps) { if ((bs instanceof Publisher && ((Publisher)bs).needsToRunAfterFinalized()) ^ phase) try { if (!perform(bs,listener)) { LOGGER.log(Level.FINE, "{0} : {1} failed", new Object[] {AbstractBuild.this, bs}); setResult(Result.FAILURE); r = false; } } catch (Exception e) { reportError(bs, e, listener, phase); r = false; } catch (LinkageError e) { reportError(bs, e, listener, phase); r = false; } } return r; }

Target:
protected final boolean performAllBuildSteps(BuildListener listener, Iterable<? extends BuildStep> buildSteps, boolean phase) throws InterruptedException, IOException { boolean r = true; for (BuildStep bs : buildSteps) { if ((bs instanceof Publisher && ((Publisher)bs).needsToRunAfterFinalized()) ^ phase) try { if (!perform(bs,listener)) { LOGGER.log(Level.FINE, "{0} : {1} failed", new Object[] {AbstractBuild.this, bs}); r = false; if (phase) { setResult(Result.FAILURE); } } } catch (Exception e) { reportError(bs, e, listener, phase); r = false; } catch (LinkageError e) { reportError(bs, e, listener, phase); r = false; } } return r; }