auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean popMessage(String processorName) throws Exception { try { if (processorName != null) { return stub.popMessage(processorName); } return false; } catch (Exception e) { handleException(e); return false; } }

Target:
public boolean popMessage(String processorName) throws Exception { try { return stub.popMessage(processorName); } catch (Exception e) { throw createException("Failed to pop the message from the queue", e); } }
Source:
public OrmException convertError(String op, String entity, SQLException err) { return fallbackConvertError(op, entity, err); }

Target:
public OrmException convertError(String op, String entity, SQLException err) { switch (err.getErrorCode()) { case 1022: case 1062: case 1169: return new OrmDuplicateKeyException(entity, err); default: return fallbackConvertError(op, entity, err); } }
Source:
public void setConnection(IRemoteConnection connection) throws CoreException { fSelectionListernersEnabled = false; if (fLocalButton != null && connection != null && connection.getConnectionType() == fRemoteServicesManager.getLocalConnectionType()) { fLocalButton.setSelection(true); handleButtonSelected(); } else { handleRemoteServiceSelected(connection); } handleConnectionSelected(); updateEnablement(); fSelectionListernersEnabled = true; }

Target:
public void setConnection(IRemoteConnection connection) { fSelectionListernersEnabled = false; if (fLocalButton != null && connection != null && connection.getConnectionType() == fRemoteServicesManager.getLocalConnectionType()) { fLocalButton.setSelection(true); handleButtonSelected(); } else { handleRemoteServiceSelected(connection); } handleConnectionSelected(); updateEnablement(); fSelectionListernersEnabled = true; }
Source:
@Override public void publish(LogRecord record) { for (Map.Entry<String,LogRecorder> entry : logRecorders.entrySet()) { for (LogRecorder.Target target : entry.getValue().targets) { if (target.includes(record)) { try { String name = entry.getKey(); LogFile logFile; synchronized (logFiles) { logFile = logFiles.get(name); if (logFile == null) { logFile = new LogFile(name); logFiles.put(name, logFile); } } logFile.publish(record); } catch (IOException x) { x.printStackTrace(); } } } } }

Target:
@Override public void publish(LogRecord record) { for (Map.Entry<String,LogRecorder> entry : logRecorders.entrySet()) { for (LogRecorder.Target target : entry.getValue().targets) { if (target.includes(record)) { String name = entry.getKey(); try { LogFile logFile; synchronized (logFiles) { logFile = logFiles.get(name); if (logFile == null) { logFile = new LogFile(name); logFiles.put(name, logFile); } } logFile.publish(record); } catch (IOException x) { LOGGER.warning("Error while publishing log records for '" + name); } } } } }
Source:
public void warp(IUser teleportee, String warp, Trade chargeFor, TeleportCause cause) throws Exception { EssentialsWarpEvent event = new EssentialsWarpEvent(teleportee, warp); Bukkit.getServer().getPluginManager().callEvent(event); if(event.isCancelled()){ return; } Location loc = ess.getWarps().getWarp(warp); teleportee.sendMessage(tl("warpingTo", warp, loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())); if (!teleportee.equals(teleportOwner)) { teleportOwner.sendMessage(tl("warpingTo", warp, loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())); } teleport(teleportee, new LocationTarget(loc), chargeFor, cause); }

Target:
public void warp(IUser teleportee, String warp, Trade chargeFor, TeleportCause cause) throws Exception { UserWarpEvent event = new UserWarpEvent(teleportee, warp, chargeFor); Bukkit.getServer().getPluginManager().callEvent(event); if(event.isCancelled()) { return; } warp = event.getWarp(); Location loc = ess.getWarps().getWarp(warp); teleportee.sendMessage(tl("warpingTo", warp, loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())); if (!teleportee.equals(teleportOwner)) { teleportOwner.sendMessage(tl("warpingTo", warp, loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())); } teleport(teleportee, new LocationTarget(loc), chargeFor, cause); }
Source:
public void serialize(DataOutputStream out) throws IOException, IllegalStateException { out.writeLong(entryLogId); out.writeLong(totalSize); out.writeLong(remainingSize); out.writeLong(ledgersMap.size()); ledgersMap.forEach((ledgerId, size) -> { try { out.writeLong(ledgerId); out.writeLong(size); } catch (IOException e) { throw new IllegalStateException("Failed to serialize entryLogMetadata", e); } }); out.writeLong(remainingSize); }

Target:
public void serialize(DataOutputStream out) throws IOException, IllegalStateException { out.writeShort(DEFAULT_SERIALIZATION_VERSION); out.writeLong(entryLogId); out.writeLong(totalSize); out.writeLong(remainingSize); out.writeLong(ledgersMap.size()); ledgersMap.forEach((ledgerId, size) -> { try { out.writeLong(ledgerId); out.writeLong(size); } catch (IOException e) { throw new IllegalStateException("Failed to serialize entryLogMetadata", e); } }); out.flush(); }
Source:
public NewStreamsResponse(DataInputStream inNet) throws IOException { byte[] data = new byte[size()]; inNet.readFully(data); ByteBuffer bb = ByteBuffer.wrap(data); bb.order(ByteOrder.BIG_ENDIAN); fStatus = NewStreamsReturnCode.values()[bb.getInt() - 1]; fNbStreams = bb.getInt(); List<StreamResponse> sl = new ArrayList<>(fNbStreams); if (getStatus().equals(NewStreamsReturnCode.LTTNG_VIEWER_NEW_STREAMS_OK)) { for (int stream = 0; stream < fNbStreams; stream++) { sl.add(stream, new StreamResponse(inNet)); } } fStreamList = ImmutableList.copyOf(sl); }

Target:
public NewStreamsResponse(DataInputStream inNet) throws IOException { byte[] data = new byte[size()]; inNet.readFully(data); ByteBuffer bb = ByteBuffer.wrap(data); bb.order(ByteOrder.BIG_ENDIAN); fStatus = NewStreamsReturnCode.values()[bb.getInt() - 1]; fNbStreams = bb.getInt(); ImmutableList.Builder<StreamResponse> sl = new ImmutableList.Builder<>(); if (getStatus().equals(NewStreamsReturnCode.LTTNG_VIEWER_NEW_STREAMS_OK)) { for (int stream = 0; stream < fNbStreams; stream++) { sl.add(new StreamResponse(inNet)); } } fStreamList = sl.build(); }
Source:
public void testLeft() throws Exception { ResultSet rs; String sql = "select left(name, cut, 'short') from (" + "values ('hello world', 5), ('hey dude', 20)" + ") tb(name, cut);"; List<String> expected = new ArrayList<String>(2); expected.add("hello"); expected.add("hey dudeshortshortsh"); rs = methodWatcher.executeQuery(sql); int i = 0; while (rs.next()) { Assert.assertEquals(expected.get(i), rs.getInt(1)); i += 1; } }

Target:
public void testLeft() throws Exception { ResultSet rs; methodWatcher.execute("create table ta(name VARCHAR(128), cut INT)"); methodWatcher.execute( "insert into ta(name, cut) " + "values ('hello world', 5), ('hey dude', 20), (null, 10), ('cute string', null)" ); String sql = "select left(name, cut) from ta"; rs = methodWatcher.executeQuery(sql); methodWatcher.execute("drop table ta"); List<String> expected = new ArrayList<>(2); expected.add("hello"); expected.add("hey dude"); expected.add(null); expected.add(null); for (String s: expected) { Assert.assertTrue(rs.next()); Assert.assertEquals(s, rs.getString(1)); } Assert.assertFalse(rs.next()); }
Source:
protected boolean canDoAction() { boolean result = true; if (!canDoSnapshot(getVm())) { return false; } List<DiskImage> disksList = getDisksList(); if (disksList.size() > 0) { VmValidator vmValidator = new VmValidator(getVm()); SnapshotsValidator snapshotValidator = new SnapshotsValidator(); result = validate(snapshotValidator.vmNotDuringSnapshot(getVmId())) && validate(snapshotValidator.vmNotInPreview(getVmId())) && validate(vmValidator.vmNotDuringMigration()) && validate(vmValidator.vmNotRunningStateless()) && validate(vmValidator.vmNotIlegal()) && ImagesHandler.PerformImagesChecks( getReturnValue().getCanDoActionMessages(), getVm().getStoragePoolId(), Guid.Empty, true, true, true, true, true, true, disksList) && validate(vmValidator.vmNotLocked()) && validate(vmValidator.vmNotSavingRestoring()); } return result; }

Target:
protected boolean canDoAction() { boolean result = validateVM(); List<DiskImage> disksList = getDisksList(); if (result && disksList.size() > 0) { VmValidator vmValidator = new VmValidator(getVm()); SnapshotsValidator snapshotValidator = new SnapshotsValidator(); result = validate(snapshotValidator.vmNotDuringSnapshot(getVmId())) && validate(snapshotValidator.vmNotInPreview(getVmId())) && validate(vmValidator.vmNotDuringMigration()) && validate(vmValidator.vmNotRunningStateless()) && validate(vmValidator.vmNotIlegal()) && ImagesHandler.PerformImagesChecks( getReturnValue().getCanDoActionMessages(), getVm().getStoragePoolId(), Guid.Empty, true, true, true, true, true, true, disksList) && validate(vmValidator.vmNotLocked()); } return result; }
Source:
public void run() { try { this.connection = getConnection(); } catch (Exception e) { logger.finest(e); future.onFailure(e); connectionsInProgress.remove(target); return; } try { authenticateAsync(); } catch (Exception e) { future.onFailure(e); connection.close("Failed to authenticate connection", e); connectionsInProgress.remove(target); } }

Target:
public void run() { ClientConnection connection; try { connection = getConnection(); } catch (Exception e) { logger.finest(e); future.onFailure(e); connectionsInProgress.remove(target); return; } try { authenticateAsync(connection); } catch (Exception e) { future.onFailure(e); connection.close("Failed to authenticate connection", e); connectionsInProgress.remove(target); } }
Source:
public CompletionStage<ExecutionResult> execute(ExecutionContext executionContext, ExecutionStrategyParameters parameters) throws NonNullableFieldWasNullException { Map<String, List<Field>> fields = parameters.fields(); Map<String, Object> results = new LinkedHashMap<>(); for (String fieldName : fields.keySet()) { List<Field> fieldList = fields.get(fieldName); ExecutionPath fieldPath = parameters.path().segment(fieldName); ExecutionStrategyParameters newParameters = parameters.transform(builder -> builder.path(fieldPath)); try { ExecutionResult resolvedResult = resolveField(executionContext, newParameters, fieldList).toCompletableFuture().join(); results.put(fieldName, resolvedResult != null ? resolvedResult.getData() : null); } catch (NonNullableFieldWasNullException e) { assertNonNullFieldPrecondition(e); results = null; break; } } return CompletableFuture.completedFuture(new ExecutionResultImpl(results, executionContext.getErrors())); }

Target:
public CompletionStage<ExecutionResult> execute(ExecutionContext executionContext, ExecutionStrategyParameters parameters) throws NonNullableFieldWasNullException { Map<String, List<Field>> fields = parameters.fields(); final Map<String, CompletableFuture<ExecutionResult>> results = new LinkedHashMap<>(); List<CompletableFuture<ExecutionResult>> futures = new ArrayList<>(); for (String fieldName : fields.keySet()) { List<Field> fieldList = fields.get(fieldName); ExecutionPath fieldPath = parameters.path().segment(fieldName); ExecutionStrategyParameters newParameters = parameters.transform(builder -> builder.path(fieldPath)); try { CompletableFuture<ExecutionResult> future = resolveField(executionContext, newParameters, fieldList).toCompletableFuture(); futures.add(future); results.put(fieldName, future); } catch (NonNullableFieldWasNullException e) { assertNonNullFieldPrecondition(e); return CompletableFuture.completedFuture(null); } } return CompletableFuture.allOf(futures.toArray(new CompletableFuture[futures.size()])).thenApply((ignored) -> { Map<String, ExecutionResult> realResults = new LinkedHashMap<>(); for (String field : results.keySet()) { realResults.put(field, results.get(field).join()); } return new ExecutionResultImpl(realResults, executionContext.getErrors()); }); }
Source:
protected void executeQueryCommand() { List<ManagedBlockStorage> allCinderDomainsList = cinderStorageDao.getAll(); List<ManagedBlockStorage> resDomainsList = allCinderDomainsList.stream() .filter(cinderStorage -> isDriverOptionEquals(cinderStorage.getDriverOptions()) && isDriverSensitiveOptionEquals(cinderStorage.getDriverSensitiveOptions())) .collect(Collectors.toList()); getQueryReturnValue().setReturnValue(resDomainsList); }

Target:
protected void executeQueryCommand() { List<ManagedBlockStorage> allCinderDomainsList = cinderStorageDao.getCinderStorageByDrivers(getParameters().getDriverOption()); List<ManagedBlockStorage> resDomainsList = allCinderDomainsList.stream() .filter(managedBlockStorage -> managedBlockStorage.getDriverSensitiveOptions() .equals(getParameters().getDriverSensitiveOption())) .collect(Collectors.toList()); getQueryReturnValue().setReturnValue(resDomainsList); }
Source:
public Optional<AuthorData> build(DataView container) throws InvalidDataException { DataUtil.checkDataExists(container, Keys.BOOK_AUTHOR.getQuery()); final String json = DataUtil.getData(container, Keys.BOOK_AUTHOR, String.class); final Text author = Texts.json().fromUnchecked(json); return Optional.<AuthorData>of(new SpongeAuthorData(author)); }

Target:
public Optional<AuthorData> build(DataView container) { if (container.contains(Keys.BOOK_AUTHOR.getQuery())) { final String json = DataUtil.getData(container, Keys.BOOK_AUTHOR, String.class); final Text author = Texts.json().fromUnchecked(json); return Optional.<AuthorData>of(new SpongeAuthorData(author)); } else { return Optional.empty(); } }
Source:
public String[] transform(final InputRow inputRow) { StringBuilder builder = new StringBuilder(); int length = 0; for (final InputColumn<?> column : _columns) { final Object value = inputRow.getValue(column); if (value != null && !value.toString().isEmpty()) { final String stringValue = value.toString(); length += stringValue.length(); builder.append(stringValue); } } return new String[] { hash(builder.toString().getBytes()), ""+length }; }

Target:
public String[] transform(final InputRow inputRow) { final StringBuilder builder = new StringBuilder(); int length = 0; for (final InputColumn<?> column : _columns) { final Object value = inputRow.getValue(column); if (value != null && !value.toString().isEmpty()) { final String stringValue = value.toString(); length += stringValue.length(); builder.append(stringValue); } } return new String[] { hash(builder.toString().getBytes()), String.valueOf(length) }; }
Source:
void peekBatchWithSequenceNumberMessages() { final int numberOfEvents = 2; final int fromSequenceNumber = 10; when(managementNode.peekBatch(numberOfEvents, fromSequenceNumber)) .thenReturn(Flux.fromArray(new ServiceBusReceivedMessage[]{message1, message2})); StepVerifier.create(consumer.peekBatch(numberOfEvents, fromSequenceNumber)) .expectNextCount(numberOfEvents) .verifyComplete(); }

Target:
void peekBatchWithSequenceNumberMessages() { final int numberOfEvents = 2; final int fromSequenceNumber = 10; when(managementNode.peekBatch(numberOfEvents, fromSequenceNumber)) .thenReturn(Flux.fromArray(new ServiceBusReceivedMessage[]{receivedMessage, receivedMessage2})); StepVerifier.create(consumer.peekBatch(numberOfEvents, fromSequenceNumber)) .expectNext(receivedMessage, receivedMessage2) .verifyComplete(); }
Source:
public boolean eval(Row row) { List<String> dimRowValList = row.getDimension(this.dimension); String extracted; if (dimRowValList == null || dimRowValList.isEmpty()) { return Strings.isNullOrEmpty(value); } for (String rowVal : dimRowValList) { if (this.getExtractionFn() != null) { extracted = this.getExtractionFn().apply(rowVal); } else { extracted = rowVal; } if (this.value != null && this.value.equals(extracted)) { return true; } if (extracted == null || extracted.isEmpty()) { return Strings.isNullOrEmpty(value); } } return false; }

Target:
public boolean eval(Row row) { List<String> dimRowValList = row.getDimension(dimension); if (dimRowValList == null || dimRowValList.isEmpty()) { return Strings.isNullOrEmpty(value); } for (String rowVal : dimRowValList) { String extracted = getExtractionFn().apply(rowVal); if (value != null && value.equals(extracted)) { return true; } if (extracted == null || extracted.isEmpty()) { return Strings.isNullOrEmpty(value); } } return false; }
Source:
private static void initOculus() { switch (LWJGLUtil.getPlatform()) { case LWJGLUtil.PLATFORM_WINDOWS: OculusVrHelper.loadNatives(); break; } }

Target:
private static void initOculus() { if (LWJGLUtil.getPlatform() == LWJGLUtil.PLATFORM_WINDOWS) { OculusVrHelper.loadNatives(); } }
Source:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (getActivity().getActionBar() != null) getActivity().getActionBar().setDisplayHomeAsUpEnabled(true); rootView = inflater.inflate(R.layout.dialog_fragment_charge, null); ButterKnife.bind(this, rootView); mChargeDialogPresenter.attachView(this); inflatedueDate(); inflateChargesSpinner(); inflateChargeNameSpinner(); duedateString = chargeDueDate.getText().toString(); duedateString = DateHelper.getDateAsStringUsedForCollectionSheetPayload(duedateString) .replace("-", " "); btSaveCharge.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ChargesPayload chargesPayload = new ChargesPayload(); chargesPayload.setAmount(etAmoutDue.getEditableText().toString()); chargesPayload.setLocale(chargeLocale.getEditableText().toString()); chargesPayload.setDueDate(duedateString); chargesPayload.setDateFormat("dd MMMM yyyy"); chargesPayload.setChargeId(chargeId); initiateChargesCreation(chargesPayload); } }); return rootView; }

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (getActivity().getActionBar() != null) getActivity().getActionBar().setDisplayHomeAsUpEnabled(true); rootView = inflater.inflate(R.layout.dialog_fragment_charge, null); ButterKnife.bind(this, rootView); mChargeDialogPresenter.attachView(this); inflatedueDate(); inflateChargesSpinner(); inflateChargeNameSpinner(); duedateString = etChargeDueDate.getText().toString(); duedateString = DateHelper.getDateAsStringUsedForCollectionSheetPayload(duedateString) .replace("-", " "); return rootView; }
Source:
protected void tearDown() throws Exception { SessionUIManager.INSTANCE.getUISession(session).closeEditors(false, Collections.singleton((DialectEditor) editorPart)); DialectUIManager.INSTANCE.closeEditor(editorPart, false); editorPart.getSite().getPage().closeEditor(editorPart, false); TestsUtil.emptyEventsFromUIThread(); super.tearDown(); }

Target:
protected void tearDown() throws Exception { SessionUIManager.INSTANCE.getUISession(session).closeEditors(false, Collections.singleton((DialectEditor) editorPart)); DialectUIManager.INSTANCE.closeEditor(editorPart, false); TestsUtil.emptyEventsFromUIThread(); super.tearDown(); }
Source:
public void testPush() throws InterruptedException { BufferedEventSender sender = new BufferedEventSender(10); List<Event> receivedEvents = new ArrayList<>(); EventSender underlyingSender = receivedEvents::add; BufferedEventSender.Worker resender = sender.newSendWorker(receivedEvents::add, 10); List<Event> sentEvents = Stream.generate(EventTestUtils::newTestEvent) .limit(10) .collect(Collectors.toList()); AsyncEventSender asyncSend = new AsyncEventSender(sender, resender, underlyingSender); asyncSend.push(sentEvents.get(0)); asyncSend.push(sentEvents.subList(1, sentEvents.size())); resender.stopAndWaitForCompletion(); resender.run(); assertThat(receivedEvents).isEqualTo(sentEvents); }

Target:
public void testPush() throws InterruptedException { BufferedEventSender sender = new BufferedEventSender(10); List<Event> receivedEvents = new ArrayList<>(); EventSender underlyingSender = receivedEvents::add; BufferedEventSender.Worker resender = sender.newSendWorker(receivedEvents::add, 10); List<Event> sentEvents = Stream.generate(EventTestUtils::newTestEvent) .limit(10) .collect(toList()); AsyncEventSender asyncSend = new AsyncEventSender(sender, resender, underlyingSender); asyncSend.push(sentEvents.get(0)); asyncSend.push(sentEvents.subList(1, sentEvents.size())); resender.stopAndWaitForCompletion(); resender.run(); assertThat(receivedEvents).isEqualTo(sentEvents); }
Source:
public void waitForState(final Predicate<State> predicate) { await("Predicate on Mesos Master failed").atMost(clusterConfig.getTimeout(), TimeUnit.SECONDS).until(() -> { try { return predicate.test(State.fromJSON(getMaster().getStateInfoJSON().toString())); } catch (InternalServerErrorException e) { return false; } }); }

Target:
public void waitForState(final Predicate<State> predicate) { await("Mesos master startup" + clusterConfig.getTimeout()).atMost(clusterConfig.getTimeout(), TimeUnit.SECONDS).until(() -> { try { assertTrue(predicate.test(State.fromJSON(getMaster().getStateInfoJSON().toString()))); } catch (InternalServerErrorException | JsonParseException | UnirestException | JsonMappingException e) { throw new AssertionError("Mesos master did not start after " + clusterConfig.getTimeout(), e); } }); }
Source:
public void executeNodeSourceScript(final String script, final String engine, final String nodeSourceName, final Callback<String, String> syncCallBack) { rm.executeNodeSourceScript(LoginModel.getInstance().getSessionId(), script, engine, nodeSourceName, new AsyncCallback<String>() { public void onFailure(Throwable caught) { String msg = JSONUtils.getJsonErrorMessage(caught); LogModel.getInstance() .logImportantMessage("Failed to execute a script " + script + " on node source " + nodeSourceName + " : " + msg); if (msg.equals("HTTP 500 Internal Server Error")) { syncCallBack.onFailure("You are not authorized to execute scripts on this node source. Please contact the administrator."); } else { syncCallBack.onFailure(msg); } } public void onSuccess(String result) { syncCallBack.onSuccess(parseListScriptResult(result)); } }); }

Target:
public void executeNodeSourceScript(final String script, final String engine, final String nodeSourceName, final Callback<String, String> syncCallBack) { rm.executeNodeSourceScript(LoginModel.getInstance().getSessionId(), script, engine, nodeSourceName, new AsyncCallback<String>() { public void onFailure(Throwable caught) { reportScriptExecutionFailure(caught, script, nodeSourceName, syncCallBack); } public void onSuccess(String result) { syncCallBack.onSuccess(parseAllScriptResults(result)); } }); }
Source:
public void setTabs() { List<Fragment> fragmentList = new ArrayList<>(); List<String> titleList = new ArrayList<>(); leaderboardUploadFragment = new LeaderboardUploadFragment(); leaderboardNearbyFragment = new LeaderboardNearbyFragment(); leaderboardUsedFragment = new LeaderboardUsedFragment(); fragmentList.add(leaderboardUploadFragment); titleList.add(getResources().getString(R.string.leaderBoard_upload_title)); fragmentList.add(leaderboardNearbyFragment); titleList.add(getResources().getString(R.string.leaderBoard_nearby_title)); fragmentList.add(leaderboardUsedFragment); titleList.add(getResources().getString(R.string.leaderBoard_used_title)); adapter.setTabData(fragmentList, titleList); adapter.notifyDataSetChanged(); }

Target:
public void setTabs() { List<Fragment> fragmentList = new ArrayList<>(); List<String> titleList = new ArrayList<>(); leaderboardUploadFragment = new LeaderboardFragment(); Bundle uploadArguments = new Bundle(); uploadArguments.putString("FragmentName","upload"); leaderboardUploadFragment.setArguments(uploadArguments); fragmentList.add(leaderboardUploadFragment); titleList.add(getResources().getString(R.string.leaderBoard_upload_title)); leaderboardNearbyFragment = new LeaderboardFragment(); Bundle nearbyArguments = new Bundle(); nearbyArguments.putString("FragmentName","nearby"); leaderboardNearbyFragment.setArguments(nearbyArguments); fragmentList.add(leaderboardNearbyFragment); titleList.add(getResources().getString(R.string.leaderBoard_nearby_title)); leaderboardUsedFragment = new LeaderboardFragment(); Bundle usedArguments = new Bundle(); usedArguments.putString("FragmentName","used"); leaderboardUsedFragment.setArguments(usedArguments); fragmentList.add(leaderboardUsedFragment); titleList.add(getResources().getString(R.string.leaderBoard_used_title)); adapter.setTabData(fragmentList, titleList); adapter.notifyDataSetChanged(); }
Source:
public void setUp() throws Exception { first = new AbstractEntityTest.TestEntity(Point3D.ZERO, Point3D.UNITCUBE); second = new AbstractEntityTest.TestEntity(Point3D.ZERO, Point3D.UNITCUBE); entity = new TestEntity(Point3D.ZERO, Point3D.UNITCUBE); crashMap = mock(CrashMap.class); State.getTrack().setCollisions(crashMap); }

Target:
public void setUp() throws Exception { first = mock(AbstractEntity.class); second = mock(AbstractEntity.class); entity = new TestEntity(Point3D.ZERO, Point3D.UNITCUBE); collisionHandler = mock(CollisionHandler.class); State.getTrack().setCollisions(collisionHandler); }
Source:
public boolean shutdown() { mServer.shutdown(); try { mCloser.close(); } catch (IOException e) { LOG.warn("Failed to close resources during shutdown.", e); } mServer.shutdownNow(); try { return mServer.awaitTermination(mServerShutdownTimeoutMs, TimeUnit.MILLISECONDS); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); return false; } }

Target:
public boolean shutdown() { mServer.shutdown(); try { mCloser.close(); } catch (IOException e) { LOG.error("Failed to close resources during shutdown.", e); } mServer.shutdownNow(); try { return mServer.awaitTermination(mServerShutdownTimeoutMs, TimeUnit.MILLISECONDS); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); return false; } }
Source:
public void updated(Map<String, Object> properties) { readProperties(properties); if (pollThreadTask != null && !pollThreadTask.isCancelled()) { pollThreadTask.cancel(true); } if (!this.configEnabled) { disableWatchdog(); } else { pollThreadTask = this.pollThreadExecutor.scheduleAtFixedRate(new Runnable() { @Override public void run() { Thread.currentThread().setName("WatchdogServiceImpl"); doWatchdogLoop(); } }, 0, this.pingInterval, TimeUnit.MILLISECONDS); } }

Target:
public void updated(Map<String, Object> properties) { readProperties(properties); cancelPollTask(); if (!this.configEnabled) { disableWatchdog(); } else { this.pollTask = this.pollExecutor.scheduleAtFixedRate(() -> { Thread.currentThread().setName("WatchdogServiceImpl"); checkCriticalComponents(); }, 0, this.pingInterval, TimeUnit.MILLISECONDS); } }
Source:
public static URLConnection connectToUrl(String u) throws Exception { final URL url = new URL(u); final AtomicReference<Exception> exception = new AtomicReference<Exception>(); Future<URLConnection> f = executor.submit(new Callable<URLConnection>() { public URLConnection call() { try { URLConnection connection = url.openConnection(); TrustingSslSocketFactory.configure(connection); HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() { @Override public boolean verify(String s, SSLSession sslSession) { return true; } }); connection.connect(); connection.getContentLength(); return connection; } catch (Exception e) { exception.set(e); LOG.debug("Error connecting to url "+url+" (propagating)", e); } return null; } }); try { URLConnection result = null; try { result = f.get(60, TimeUnit.SECONDS); } catch (InterruptedException e) { throw e; } catch (Exception e) { throw new IllegalStateException("Connect to URL not complete within 60 seconds, for url "+url+": "+e); } if (exception.get() != null) { LOG.debug("Error connecting to url "+url+", thread caller of "+exception, new Throwable("source of rethrown error "+exception)); throw exception.get(); } else { return result; } } finally { f.cancel(true); } }

Target:
public static URLConnection connectToUrl(String u) throws Exception { final URL url = new URL(u); final AtomicReference<Exception> exception = new AtomicReference<Exception>(); Future<URLConnection> f = executor.submit(new Callable<URLConnection>() { public URLConnection call() { try { URLConnection connection = url.openConnection(); TrustingSslSocketFactory.configure(connection); HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() { @Override public boolean verify(String s, SSLSession sslSession) { return true; } }); connection.connect(); connection.getContentLength(); return connection; } catch (Exception e) { exception.set(e); LOG.debug("Error connecting to url "+url+" (propagating): "+e, e); } return null; } }); try { URLConnection result = null; try { result = f.get(60, TimeUnit.SECONDS); } catch (InterruptedException e) { throw e; } catch (Exception e) { LOG.debug("Error connecting to url "+url+", probably timed out (rethrowing): "+e); throw new IllegalStateException("Connect to URL not complete within 60 seconds, for url "+url+": "+e); } if (exception.get() != null) { LOG.debug("Error connecting to url "+url+", thread caller of "+exception, new Throwable("source of rethrown error "+exception)); throw exception.get(); } else { return result; } } finally { f.cancel(true); } }
Source:
public synchronized TopLevelItem createProjectFromXML(String name, InputStream xml) throws IOException, Failure { Jenkins.checkGoodName(name); acl.checkPermission(Item.CREATE); Jenkins.getInstance().getProjectNamingStrategy().checkName(name); Items.verifyItemDoesNotAlreadyExist(parent, name, null); File configXml = Items.getConfigFile(getRootDirFor(name)).getFile(); final File dir = configXml.getParentFile(); dir.mkdirs(); boolean success = false; try { XMLUtils.safeTransform((Source)new StreamSource(xml), new StreamResult(configXml)); TopLevelItem result = Items.whileUpdatingByXml(new NotReallyRoleSensitiveCallable<TopLevelItem,IOException>() { @Override public TopLevelItem call() throws IOException { return (TopLevelItem) Items.load(parent, dir); } }); success = acl.getACL().hasCreatePermission(Jenkins.getAuthentication(), parent, result.getDescriptor()) && result.getDescriptor().isApplicableIn(parent); add(result); ItemListener.fireOnCreated(result); Jenkins.getInstance().rebuildDependencyGraphAsync(); return result; } catch (TransformerException e) { success = false; throw new IOException("Failed to persist config.xml", e); } catch (SAXException e) { success = false; throw new IOException("Failed to persist config.xml", e); } catch (IOException e) { success = false; throw e; } catch (RuntimeException e) { success = false; throw e; } finally { if (!success) { Util.deleteRecursive(dir); } } }

Target:
public synchronized TopLevelItem createProjectFromXML(String name, InputStream xml) throws IOException { try { Jenkins.checkGoodName(name); } catch (Failure e){ throw new IOException("Not a valid project name", e); } acl.checkPermission(Item.CREATE); Jenkins.getInstance().getProjectNamingStrategy().checkName(name); Items.verifyItemDoesNotAlreadyExist(parent, name, null); File configXml = Items.getConfigFile(getRootDirFor(name)).getFile(); final File dir = configXml.getParentFile(); dir.mkdirs(); boolean success = false; try { XMLUtils.safeTransform((Source)new StreamSource(xml), new StreamResult(configXml)); TopLevelItem result = Items.whileUpdatingByXml(new NotReallyRoleSensitiveCallable<TopLevelItem,IOException>() { @Override public TopLevelItem call() throws IOException { return (TopLevelItem) Items.load(parent, dir); } }); success = acl.getACL().hasCreatePermission(Jenkins.getAuthentication(), parent, result.getDescriptor()) && result.getDescriptor().isApplicableIn(parent); add(result); ItemListener.fireOnCreated(result); Jenkins.getInstance().rebuildDependencyGraphAsync(); return result; } catch (TransformerException e) { success = false; throw new IOException("Failed to persist config.xml", e); } catch (SAXException e) { success = false; throw new IOException("Failed to persist config.xml", e); } catch (IOException e) { success = false; throw e; } catch (RuntimeException e) { success = false; throw e; } finally { if (!success) { Util.deleteRecursive(dir); } } }
Source:
public ByteBuffer read(long pos, int cnt) throws IOException { if (ch == null && readAhead > 0 && notInCache(pos)) { open().setReadAheadBytes(readAhead); } DfsBlock block = cache.getOrLoad(file, pos, ctx, () -> { try { return open(); } catch (IOException e) { throw new RuntimeException(e); } }); if (block.start == pos && block.size() >= cnt) { return block.zeroCopyByteBuffer(cnt); } byte[] dst = new byte[cnt]; ByteBuffer buf = ByteBuffer.wrap(dst); buf.position(ctx.copy(file, pos, dst, 0, cnt)); return buf; }

Target:
public ByteBuffer read(long pos, int cnt) throws IOException { if (ch == null && readAhead > 0 && notInCache(pos)) { open().setReadAheadBytes(readAhead); } DfsBlock block = cache.getOrLoad(file, pos, ctx, () -> { return open(); }); if (block.start == pos && block.size() >= cnt) { return block.zeroCopyByteBuffer(cnt); } byte[] dst = new byte[cnt]; ByteBuffer buf = ByteBuffer.wrap(dst); buf.position(ctx.copy(file, pos, dst, 0, cnt)); return buf; }
Source:
public void delete() throws IOException, InterruptedException { checkPermission(DELETE); if (this instanceof Queue.Task) { Queue.getInstance().cancel((Queue.Task) this); Map<Queue.Executable, Executor> building = new LinkedHashMap<>(); for (Computer c : Jenkins.getInstance().getComputers()) { for (Executor e : c.getOneOffExecutors()) { WorkUnit workUnit = e.getCurrentWorkUnit(); if (workUnit != null && (workUnit.work == this || workUnit.work.getOwnerTask() == this)) { building.put(e.getCurrentExecutable(), e); e.interrupt(); } } for (Executor e : c.getExecutors()) { WorkUnit workUnit = e.getCurrentWorkUnit(); if (workUnit != null && (workUnit.work == this || workUnit.work.getOwnerTask() == this)) { building.put(e.getCurrentExecutable(), e); e.interrupt(); } } } if (!building.isEmpty()) { long expiration = System.nanoTime() + TimeUnit.SECONDS.toNanos(15); while (!building.isEmpty() && expiration - System.nanoTime() > 0L) { for (Iterator<Map.Entry<Queue.Executable, Executor>> iterator = building.entrySet().iterator(); iterator.hasNext(); ) { Map.Entry<Queue.Executable, Executor> entry = iterator.next(); if (!entry.getValue().isAlive() || entry.getKey() != entry.getValue().getCurrentExecutable()) { iterator.remove(); } } Thread.sleep(50L); } if (!building.isEmpty()) { throw new AbortException(Messages.Job_FailureToStopBuilds(building.size(), getFullDisplayName())); } } } super.delete(); Util.deleteRecursive(getBuildDir()); }

Target:
@Override public void delete() throws IOException, InterruptedException { super.delete(); Util.deleteRecursive(getBuildDir()); }
Source:
public void testStartpointTimestampVisitorShouldResolveToCorrectOffset() { final Long testTimeStamp = 10L; final KafkaConsumer consumer = Mockito.mock(KafkaConsumer.class); final KafkaStartpointToOffsetResolver kafkaStartpointToOffsetResolver = new KafkaStartpointToOffsetResolver(consumer); final StartpointTimestamp startpointTimestamp = new StartpointTimestamp(testTimeStamp); final Map<TopicPartition, OffsetAndTimestamp> offsetForTimesResult = ImmutableMap.of( TEST_TOPIC_PARTITION, new OffsetAndTimestamp(Long.valueOf(TEST_OFFSET), testTimeStamp)); Mockito.when(consumer.offsetsForTimes(ImmutableMap.of(TEST_TOPIC_PARTITION, testTimeStamp))).thenReturn(offsetForTimesResult); Mockito.doNothing().when(consumer).seek(TEST_TOPIC_PARTITION, Long.valueOf(TEST_OFFSET)); Mockito.when(consumer.position(TEST_TOPIC_PARTITION)).thenReturn(Long.valueOf(TEST_OFFSET)); String resolvedOffset = kafkaStartpointToOffsetResolver.visit(TEST_SYSTEM_STREAM_PARTITION, startpointTimestamp); Assert.assertEquals(TEST_OFFSET, resolvedOffset); }

Target:
public void testStartpointTimestampVisitorShouldResolveToCorrectOffset() { final Long testTimeStamp = 10L; final KafkaConsumer consumer = Mockito.mock(KafkaConsumer.class); final KafkaStartpointToOffsetResolver kafkaStartpointToOffsetResolver = new KafkaStartpointToOffsetResolver(consumer); final StartpointTimestamp startpointTimestamp = new StartpointTimestamp(testTimeStamp); final Map<TopicPartition, OffsetAndTimestamp> offsetForTimesResult = ImmutableMap.of( TEST_TOPIC_PARTITION, new OffsetAndTimestamp(Long.valueOf(TEST_OFFSET), testTimeStamp)); Mockito.when(consumer.offsetsForTimes(ImmutableMap.of(TEST_TOPIC_PARTITION, testTimeStamp))).thenReturn(offsetForTimesResult); Mockito.when(consumer.position(TEST_TOPIC_PARTITION)).thenReturn(Long.valueOf(TEST_OFFSET)); String resolvedOffset = kafkaStartpointToOffsetResolver.visit(TEST_SYSTEM_STREAM_PARTITION, startpointTimestamp); Assert.assertEquals(TEST_OFFSET, resolvedOffset); }
Source:
public void showFormulaEditorToEditFormula(View view) { switch (view.getId()) { case R.id.brick_glide_to_edit_text_x: FormulaEditorFragment.showFragment(view, this, BrickField.X_DESTINATION); break; case R.id.brick_glide_to_edit_text_y: FormulaEditorFragment.showFragment(view, this, BrickField.Y_DESTINATION); break; case R.id.brick_glide_to_edit_text_duration: FormulaEditorFragment.showFragment(view, this, BrickField.DURATION_IN_SECONDS); break; default: FormulaEditorFragment.showFragment(view, this, BrickField.DURATION_IN_SECONDS); break; } }

Target:
public void showFormulaEditorToEditFormula(View view) { switch (view.getId()) { case R.id.brick_glide_to_edit_text_x: FormulaEditorFragment.showFragment(view, this, BrickField.X_DESTINATION); break; case R.id.brick_glide_to_edit_text_y: FormulaEditorFragment.showFragment(view, this, BrickField.Y_DESTINATION); break; case R.id.brick_glide_to_edit_text_duration: default: FormulaEditorFragment.showFragment(view, this, BrickField.DURATION_IN_SECONDS); break; } }
Source:
public void shouldCreateMultipleToolsAndAggregationResultWithWarningsAggregateTrue() { FreeStyleProject project = createJobWithWorkspaceFile("checkstyle.xml", "pmd-warnings.xml"); enableWarningsAggregation(project, true, "**/checkstyle-issues.txt", new CheckStyle(), "**/pmd-warnings-issues.txt", new Pmd()); AnalysisResult result = scheduleBuildAndAssertStatus(project, Result.SUCCESS); assertThat(result).hasTotalSize(10); assertThat(result.getSizePerOrigin()).containsKeys("checkstyle", "pmd"); assertThat(result).hasOverallResult(Result.SUCCESS); }

Target:
public void shouldCreateMultipleToolsAndAggregationResultWithWarningsAggregateTrue() { FreeStyleProject project = createJobWithWorkspaceFile("checkstyle.xml", "pmd-warnings.xml"); enableWarningsAggregation(project, true, "**/checkstyle-issues.txt", new CheckStyle(), "**/pmd-warnings-issues.txt", new Pmd()); List<AnalysisResult> results = scheduleBuildAndAssertStatusForBothTools(project, Result.SUCCESS); assertThat(results).hasSize(1); for (AnalysisResult element : results) { assertThat(element.getSizePerOrigin()).containsKeys("checkstyle", "pmd"); assertThat(element).hasTotalSize(10); assertThat(element).hasId("analysis"); assertThat(element).hasOverallResult(Result.SUCCESS); } }
Source:
public String addTenant(Tenant tenant) throws TenantMgtException { String tenantDomain = tenant.getDomain(); int tenantId; validateInputs(tenant); try { TenantMgtUtil.setTenantAdminCreationOperation(true); addAttributeValues(tenant); createTenant(tenant); addTenantAdminUser(tenant); tenantId = tenant.getId(); addClaimsToUserStore(tenant); TenantInfoBean tenantInfoBean = initializeTenantInfoBean(tenantId, tenant); notifyTenantAddition(tenantInfoBean); TenantMgtUtil.activateTenantInitially(tenantInfoBean, tenantId); if (INVITE_VIA_EMAIL.equalsIgnoreCase(tenant.getProvisioningMethod())) { if (tenant.getClaimsMap() != null) { tenant.getClaimsMap().put(TENANT_ADMIN_ASK_PASSWORD_CLAIM, "true"); } else { Map<String, String> claimsMap = new HashMap<>(); claimsMap.put(TENANT_ADMIN_ASK_PASSWORD_CLAIM, "true"); tenant.setClaimsMap(claimsMap); } } addAdditionalClaimsToUserStore(tenant); } catch (Exception e) { if (e instanceof TenantMgtException) { throw (TenantMgtException) e; } else { throw new TenantManagementServerException(e.getMessage(), e); } } log.info("Added the tenant '" + tenantDomain + " [" + tenantId + "]' by '" + PrivilegedCarbonContext.getThreadLocalCarbonContext(). getUsername() + "'"); TenantMgtUtil.prepareStringToShowThemeMgtPage(tenant.getId(), tenant.getTenantUniqueID()); return tenant.getTenantUniqueID(); }

Target:
public String addTenant(Tenant tenant) throws TenantMgtException { String tenantDomain = tenant.getDomain(); int tenantId; validateInputs(tenant); try { TenantMgtUtil.setTenantAdminCreationOperation(true); addAttributeValues(tenant); createTenant(tenant); addTenantAdminUser(tenant); tenantId = tenant.getId(); addClaimsToUserStore(tenant); TenantInfoBean tenantInfoBean = initializeTenantInfoBean(tenantId, tenant); notifyTenantAddition(tenantInfoBean); TenantMgtUtil.activateTenantInitially(tenantInfoBean, tenantId); if (INVITE_VIA_EMAIL.equalsIgnoreCase(tenant.getProvisioningMethod())) { if (tenant.getClaimsMap() == null) { tenant.setClaimsMap(new HashMap<>()); } tenant.getClaimsMap().put(TENANT_ADMIN_ASK_PASSWORD_CLAIM, "true"); } addAdditionalClaimsToUserStore(tenant); } catch (Exception e) { if (e instanceof TenantMgtException) { throw (TenantMgtException) e; } else { throw new TenantManagementServerException(e.getMessage(), e); } } log.info("Added the tenant '" + tenantDomain + " [" + tenantId + "]' by '" + PrivilegedCarbonContext.getThreadLocalCarbonContext(). getUsername() + "'"); TenantMgtUtil.prepareStringToShowThemeMgtPage(tenant.getId(), tenant.getTenantUniqueID()); return tenant.getTenantUniqueID(); }
Source:
public void testLocateFinest() { assertEquals("Unexpected response", icRoot, icRoot .locateFinest("com.kazgroup.courtlink.domain", "Class")); assertEquals("Unexpected response", icCommon, icRoot .locateFinest("com.kazgroup.courtlink.common.api", "Class")); assertNull("Unexpected response", icRoot.locateFinest("com", "Class")); }

Target:
public void testLocateFinest() { assertEquals("Unexpected response", icRoot, icRoot .locateFinest("com.kazgroup.courtlink.domain", "MyClass")); assertEquals("Unexpected response", icCommon, icRoot .locateFinest("com.kazgroup.courtlink.common.api", "MyClass")); assertNull("Unexpected response", icRoot.locateFinest("com", "MyClass")); }
Source:
public static GenomicVariant fromRegion(String region) { if (!isRegion(region)) throw new IllegalArgumentException("region is invalid"); String chr = getPattern("^\\d{1,2}(?=:)", region); RefType ref_type = null; Integer start = Integer.parseInt(getPattern("(?<=:)\\d+(?=-)", region)); Integer end = Integer.parseInt(getPattern("(?<=-)\\d+(?=:)", region)); Type type = null; String ref = null; String alt = getPattern("(?<=:-?1/)[ATCG]+|-$", region); return new GenomicVariant(chr, ref_type, start, end, type, ref, alt); }

Target:
public static GenomicVariant fromRegion(String region) { if (!isRegion(region)) { throw new IllegalArgumentException("region is invalid"); } String chr = getPattern("^\\d{1,2}(?=:)", region); RefType ref_type = null; Integer start = Integer.parseInt(getPattern("(?<=:)\\d+(?=-)", region)); Integer end = Integer.parseInt(getPattern("(?<=-)\\d+(?=:)", region)); Type type = null; String ref = null; String alt = getPattern("(?<=:-?1/)[ATCG]+|-$", region); return new GenomicVariant(chr, ref_type, start, end, type, ref, alt); }
Source:
public void accept(CorenodeEvent event) { currentView.computeIfAbsent(event.keyHash, k -> new Stat(event.username, MaybeMultihash.empty(), 0, Collections.emptySet())); usage.putIfAbsent(event.username, 0L); ForkJoinPool.commonPool().submit(() -> processCorenodeEvent(event.username, event.keyHash)); }

Target:
public void accept(CorenodeEvent event) { currentView.computeIfAbsent(event.keyHash, k -> new Stat(event.username, MaybeMultihash.empty(), 0, Collections.emptySet())); usage.putIfAbsent(event.username, new Usage(0, defaultQuota)); ForkJoinPool.commonPool().submit(() -> processCorenodeEvent(event.username, event.keyHash)); }
Source:
private void goNStepsBack(int steps) { int zPosition = sprite.look.getZIndex(); int newSpriteZIndex = Math.max(zPosition - steps, Constants.Z_INDEX_FIRST_SPRITE); List<Sprite> spriteList = ProjectManager.getInstance().getCurrentProject().getSpriteListWithClones(); for (int i = 0; i < spriteList.size(); i++) { int currentSpriteZIndex = spriteList.get(i).look.getZIndex(); if (steps > 0 && currentSpriteZIndex >= newSpriteZIndex && currentSpriteZIndex < zPosition) { spriteList.get(i).look.setZIndex(currentSpriteZIndex + 1); } else if (currentSpriteZIndex <= newSpriteZIndex && currentSpriteZIndex > zPosition) { spriteList.get(i).look.setZIndex(currentSpriteZIndex - 1); } } sprite.look.setZIndex(newSpriteZIndex); }

Target:
private void goNStepsBack(int steps) { int zPosition = sprite.look.getZIndex(); int newSpriteZIndex = Math.max(zPosition - steps, Constants.Z_INDEX_FIRST_SPRITE); sprite.look.setZIndex(newSpriteZIndex); }
Source:
public Response generateNodes() { List<DeviceOrganizationVisNode> result; DeviceOrganizationProviderService dops = new DeviceOrganizationProviderServiceImpl(); result = dops.generateNodes(); if (result.isEmpty()) { String msg = "No Devices enrolled and visible"; log.error(msg); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); } return Response.status(Response.Status.OK).entity(result).build(); }

Target:
public Response generateNodes() { List<DeviceOrganizationVisNode> result; DeviceOrganizationProviderService dops = new DeviceOrganizationProviderServiceImpl(); result = dops.generateNodes(); if (result.isEmpty()) { String msg = "No Devices enrolled and visible"; if (log.isDebugEnabled()) { log.debug(msg); } return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); } return Response.status(Response.Status.OK).entity(result).build(); }
Source:
public BUILDER setName(String name) { this.name = name; return (BUILDER) this; }

Target:
public BUILDER setName(String name) { assert name != null; this.name = name; return (BUILDER) this; }
Source:
public void setWorldBorder(@Nullable WorldBorder border, Cause cause) { if (this.worldBorder == border) { return; } if (!SpongeImpl.postEvent(SpongeEventFactory.createChangeWorldBorderEventTargetPlayer(cause, Optional.ofNullable(this.worldBorder), Optional.ofNullable(border), this))) { this.worldBorder = border; if (this.worldBorder != null) { ((net.minecraft.world.border.WorldBorder) this.worldBorder).addListener(new PlayerOwnBorderListener((EntityPlayerMP) (Object) this)); this.connection.sendPacket(new SPacketWorldBorder((net.minecraft.world.border.WorldBorder) (Object) this.worldBorder, SPacketWorldBorder.Action.INITIALIZE)); } else { this.connection.sendPacket(new SPacketWorldBorder(new net.minecraft.world.border.WorldBorder(), SPacketWorldBorder.Action.INITIALIZE)); } } }

Target:
public void setWorldBorder(@Nullable WorldBorder border, Cause cause) { if (this.worldBorder == border) { return; } if (!SpongeImpl.postEvent(SpongeEventFactory.createChangeWorldBorderEventTargetPlayer(cause, Optional.ofNullable(this.worldBorder), Optional.ofNullable(border), this))) { if (this.worldBorder != null) { ((net.minecraft.world.border.WorldBorder) this.worldBorder).listeners.remove(this.borderListener); } this.worldBorder = border; if (this.worldBorder != null) { ((net.minecraft.world.border.WorldBorder) this.worldBorder).addListener(this.borderListener); this.connection.sendPacket(new SPacketWorldBorder((net.minecraft.world.border.WorldBorder) (Object) this.worldBorder, SPacketWorldBorder.Action.INITIALIZE)); } else { this.connection.sendPacket(new SPacketWorldBorder(this.world.getWorldBorder(), SPacketWorldBorder.Action.INITIALIZE)); } } }
Source:
public void testCast() throws Exception { final DefaultConfiguration configurationTestCast = createCheckConfig(WhitespaceAfterCheck.class); configurationTestCast.addAttribute("tokens", "TYPECAST"); final String[] expected = { "88:21: " + getCheckMessage(MSG_WS_TYPECAST), }; verify(configurationTestCast, getPath("InputWhitespaceAfter.java"), expected); }

Target:
public void testCast() throws Exception { final DefaultConfiguration configurationTestCast = createCheckConfig(WhitespaceAfterCheck.class); configurationTestCast.addAttribute("tokens", "TYPECAST"); final String[] expected = { "88:21: " + getCheckMessage(MSG_WS_TYPECAST), }; verify(configurationTestCast, getPath("InputWhitespaceAfterTypeCast.java"), expected); }