auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
String processedIndexHtml() throws IOException { InputStream is = indexHtml.getInputStream(); Document soup = Jsoup.parse(is, null, ui.getBasePath()); is.close(); if (soup.head().getElementsByTag("base").isEmpty()) { soup.head().appendChild( soup.createElement("base") ); } soup.head().getElementsByTag("base").html(ui.getBasePath()); return soup.html(); }

Target:
String processedIndexHtml() throws IOException { String baseTagValue = "/".equals(ui.getBasepath()) ? "/" : ui.getBasepath() + "/"; Document soup; try (InputStream is = indexHtml.getInputStream()) { soup = Jsoup.parse(is, null, baseTagValue); } if (soup.head().getElementsByTag("base").isEmpty()) { soup.head().appendChild( soup.createElement("base") ); } soup.head().getElementsByTag("base").attr("href", baseTagValue); return soup.html(); }
Source:
void updateCommittedTail(long newCommittedTail) { if (updateIfGreater(committedTail, newCommittedTail, COMMITTED_TAIL_RECORD)) { log.debug("Updated committed log tail to: {}", newCommittedTail); } else { log.trace("New committed log tail not greater than current, ignore."); } }

Target:
void updateCommittedTail(long newCommittedTail) { if (update(COMMITTED_TAIL_RECORD, committedTail, newCommittedTail, (curr, next) -> next > curr)) { log.debug("Updated committed log tail to: {}", newCommittedTail); } else { log.trace("New committed log tail not greater than current, ignore.", newCommittedTail); } }
Source:
public void notifyCheckpointComplete(long checkpointId, OperatorChain<?, ?> operatorChain, Supplier<Boolean> isRunning) throws Exception { if (isRunning.get()) { LOG.debug("Notification of complete checkpoint for task {}", checkpointId, taskName); for (StreamOperatorWrapper<?, ?> operatorWrapper : operatorChain.getAllOperators(true)) { operatorWrapper.notifyCheckpointComplete(checkpointId); } } else { LOG.debug("Ignoring notification of complete checkpoint for not-running task {}", taskName); } env.getTaskStateManager().notifyCheckpointComplete(checkpointId); }

Target:
public void notifyCheckpointComplete(long checkpointId, OperatorChain<?, ?> operatorChain, Supplier<Boolean> isRunning) throws Exception { if (isRunning.get()) { LOG.debug("Notification of complete checkpoint for task {}", taskName); for (StreamOperatorWrapper<?, ?> operatorWrapper : operatorChain.getAllOperators(true)) { operatorWrapper.notifyCheckpointComplete(checkpointId); } } else { LOG.debug("Ignoring notification of complete checkpoint for not-running task {}", taskName); } env.getTaskStateManager().notifyCheckpointComplete(checkpointId); }
Source:
public static StashPullRequest extractPullRequest(String project, String repository, String pullRequestId, String jsonBody) throws StashReportExtractionException { StashPullRequest result = new StashPullRequest(project, repository, pullRequestId); try { JSONObject jsonPullRequest = (JSONObject) new JSONParser().parse(jsonBody); long version = (long) jsonPullRequest.get("version"); result.setVersion(version); JSONArray jsonReviewers = (JSONArray) jsonPullRequest.get("reviewers"); if (jsonReviewers != null) { for (Object objReviewer : jsonReviewers.toArray()) { JSONObject jsonReviewer = (JSONObject) objReviewer; JSONObject jsonUser = (JSONObject) jsonReviewer.get("user"); if (jsonUser != null){ long id = (long) jsonUser.get("id"); String name = (String) jsonUser.get("name"); String slug = (String) jsonUser.get("slug"); String email = (String) jsonUser.get("email"); StashUser reviewer = new StashUser(id, name, slug, email); result.addReviewer(reviewer); } } } } catch (ParseException e) { throw new StashReportExtractionException(e); } return result; }

Target:
public static StashPullRequest extractPullRequest(String project, String repository, String pullRequestId, String jsonBody) throws StashReportExtractionException { StashPullRequest result = new StashPullRequest(project, repository, pullRequestId); try { JSONObject jsonPullRequest = (JSONObject) new JSONParser().parse(jsonBody); long version = (long) jsonPullRequest.get("version"); result.setVersion(version); JSONArray jsonReviewers = (JSONArray) jsonPullRequest.get("reviewers"); if (jsonReviewers != null) { for (Object objReviewer : jsonReviewers.toArray()) { JSONObject jsonReviewer = (JSONObject) objReviewer; JSONObject jsonUser = (JSONObject) jsonReviewer.get("user"); if (jsonUser != null){ StashUser reviewer = extractUser(jsonUser.toJSONString()); result.addReviewer(reviewer); } } } } catch (ParseException e) { throw new StashReportExtractionException(e); } return result; }
Source:
public VmDevice addSoundDevice(VmBase vmBase, Supplier<Cluster> clusterSupplier) { ChipsetType chipset = EmulatedMachineUtils.getEffectiveChipset(vmBase, clusterSupplier); Version compatibilityVersion = vmBase instanceof VmTemplate ? CompatibilityVersionUtils.getEffective((VmBase) null, clusterSupplier) : clusterUtils.getCompatibilityVersion(vmBase); return addSoundDevice(vmBase.getId(), vmBase.getOsId(), compatibilityVersion, chipset); }

Target:
public VmDevice addSoundDevice(VmBase vmBase, Supplier<Cluster> clusterSupplier) { ChipsetType chipset = EmulatedMachineUtils.getEffectiveChipset(vmBase, clusterSupplier); Version compatibilityVersion = CompatibilityVersionUtils.getEffective(vmBase, clusterSupplier); return addSoundDevice(vmBase.getId(), vmBase.getOsId(), compatibilityVersion, chipset); }
Source:
protected boolean canDoAction() { boolean result=true; if (getParameters().getEvent() == null || getParameters().getEvent().equals(OVIRT)){ addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_EXTERNAL_EVENT_ILLEGAL_ORIGIN); result = false; } if (!result) { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__ADD); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__EXTERNAL_EVENT); } return result; }

Target:
protected boolean canDoAction() { boolean result=true; if (getParameters().getEvent() == null || getParameters().getEvent().getOrigin().equalsIgnoreCase(OVIRT)){ addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_EXTERNAL_EVENT_ILLEGAL_ORIGIN); result = false; } if (!result) { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__ADD); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__EXTERNAL_EVENT); } return result; }
Source:
public void getStrategyThrowsOnUncheckedException() { when(mockKvs.getMetadataForTable(any())).thenThrow(new RuntimeException()); assertThatThrownBy(() -> partitioner.getStrategy(getWriteInfoWithFixedCellHash(getTableRef("a"), 0))) .isInstanceOf(UncheckedExecutionException.class); }

Target:
public void getStrategyThrowsOnUncheckedException() { RuntimeException cause = new RuntimeException("cause"); when(mockKvs.getMetadataForTable(any())).thenThrow(cause); assertThatThrownBy(() -> partitioner.getStrategy(getWriteInfoWithFixedCellHash(getTableRef("a"), 0))) .isInstanceOf(UncheckedExecutionException.class) .hasCause(cause); }
Source:
private RedirectHandler getOrInstall(Logger logger) { synchronized (this) { for (Handler handler : logger.getHandlers()) { if (handler instanceof RedirectHandler) { return (RedirectHandler) handler; } } RedirectHandler redirectHandler = new RedirectHandler(logContext.getLogger(logger.getName())); logger.addHandler(redirectHandler); logger.setUseParentHandlers(false); return redirectHandler; } }

Target:
private RedirectHandler getOrInstall(Logger logger) { synchronized (this) { for (Handler handler : logger.getHandlers()) { if (handler instanceof RedirectHandler) { logger.setUseParentHandlers(false); return (RedirectHandler) handler; } } RedirectHandler redirectHandler = new RedirectHandler(logContext.getLogger(logger.getName())); logger.addHandler(redirectHandler); logger.setUseParentHandlers(false); return redirectHandler; } }
Source:
public APIResult getExtensionDefinition( @PathParam("extension-name") String extensionName) { checkIfExtensionServiceIsEnabled(); try { return new APIResult(APIResult.Status.SUCCEEDED, ExtensionStore.get().getResource(extensionName, extensionName.toLowerCase() + EXTENSION_PROPERTY_JSON_SUFFIX)); } catch (Throwable e) { throw FalconWebException.newAPIException(e, Response.Status.BAD_REQUEST); } }

Target:
public APIResult getExtensionDefinition( @PathParam("extension-name") String extensionName) { checkIfExtensionServiceIsEnabled(); try { return new APIResult(APIResult.Status.SUCCEEDED, ExtensionStore.get().getResource(extensionName, extensionName.toLowerCase() + EXTENSION_PROPERTY_JSON_SUFFIX)); } catch (FalconException e) { throw FalconWebException.newAPIException(e, Response.Status.BAD_REQUEST); } catch (Throwable e) { throw FalconWebException.newAPIException(e, Response.Status.INTERNAL_SERVER_ERROR); } }
Source:
public ValidationResult initialize(RuntimeContainer container, Properties properties) { ValidationResultMutable validationResult = new ValidationResultMutable(); if (properties instanceof MarkLogicBulkLoadProperties) { bulkLoadProperties = (MarkLogicBulkLoadProperties) properties; MarkLogicConnectionProperties connection = bulkLoadProperties.connection; if (!connection.isReferenceConnectionUsed()) { boolean isRequiredPropertiesSet = !connection.host.getStringValue().isEmpty() && connection.port.getValue() != null && !connection.database.getStringValue().isEmpty() && !connection.username.getStringValue().isEmpty() && !connection.password.getStringValue().isEmpty() && !bulkLoadProperties.loadFolder.getStringValue().isEmpty(); if (!isRequiredPropertiesSet) { validationResult.setStatus(ValidationResult.Result.ERROR); validationResult.setMessage(MESSAGES.getMessage("error.missedProperties")); } } } else { validationResult.setStatus(ValidationResult.Result.ERROR); validationResult.setMessage(MESSAGES.getMessage("error.wrongProperties")); } return validationResult; }

Target:
public ValidationResult initialize(RuntimeContainer container, Properties properties) { ValidationResultMutable validationResult = new ValidationResultMutable(); if (properties instanceof MarkLogicBulkLoadProperties) { bulkLoadProperties = (MarkLogicBulkLoadProperties) properties; if (isRequiredPropertiesMissed()) { validationResult.setStatus(ValidationResult.Result.ERROR); validationResult.setMessage(MESSAGES.getMessage("error.missedProperties")); } } else { validationResult.setStatus(ValidationResult.Result.ERROR); validationResult.setMessage(MESSAGES.getMessage("error.wrongProperties")); } return validationResult; }
Source:
public ImmutableBitmap getBitmapIndex(BitmapIndexSelector selector) { if (extractionFn == null) { return selector.getBitmapIndex(dimension, value); } else { final List<Filter> filters = makeFilters(selector); if (filters.isEmpty()) { return selector.getBitmapFactory().makeEmptyImmutableBitmap(); } return new OrFilter(makeFilters(selector)).getBitmapIndex(selector); } }

Target:
public ImmutableBitmap getBitmapIndex(BitmapIndexSelector selector) { if (extractionFn == null) { return selector.getBitmapIndex(dimension, value); } else { final List<Filter> filters = makeFiltersUsingExtractionFn(selector); if (filters.isEmpty()) { return selector.getBitmapFactory().makeEmptyImmutableBitmap(); } return new OrFilter(filters).getBitmapIndex(selector); } }
Source:
private boolean isPublisherEnabled() { boolean publisherEnabled = false; for (ThriftClientInfo thriftClientInfo : thriftClientInfoList) { publisherEnabled = thriftClientInfo.isStatsPublisherEnabled(); if (publisherEnabled) { break; } } return publisherEnabled; }

Target:
private boolean isPublisherEnabled() { for (ThriftClientInfo thriftClientInfo : thriftClientInfoList) { if (thriftClientInfo.isStatsPublisherEnabled()) { return true; } } return false; }
Source:
public static int getFuelValue(@Nullable ItemStack fuel) { if (fuel == null) { return 0; } for (FuelEntry e : fuels) { if (e.getItem().isItemEqual(fuel)) { return e.getFuelValue(); } } return 0; }

Target:
public static int getFuelValue(@Nullable ItemStack fuel) { if (fuel == null || fuel.getItem() == null) { return 0; } int max = 0; for (IFuelHandler e : fuels) { max = Math.max(e.getBurnTime(fuel), max); } if (fuel.hasCapability(BREWING_CAP, null)) { IBrewingStandFuel brewingStandFuel = fuel.getCapability(BREWING_CAP, null); if (brewingStandFuel != null) max = Math.max(brewingStandFuel.getFuelValue(), max); } return max; }
Source:
private void collapseOrExpandContainer(SWTBotGefEditPart container) { ICondition editPartResizedCondition = new CheckEditPartResized(container); AbstractDiagramElementContainerEditPart part = (AbstractDiagramElementContainerEditPart) container.part(); GraphicalHelper.getAbsoluteBoundsIn100Percent(part); Point top = GraphicalHelper.getAbsoluteBoundsIn100Percent(part).getTop(); editor.click(top.getTranslated(0, 40)); bot.waitUntil(new ICondition() { @Override public boolean test() throws Exception { IFigure handleLayer = LayerManager.Helper.find(part).getLayer(LayerConstants.HANDLE_LAYER); Point toggleFigureLocation; if (handleLayer != null) { for (Object figure : handleLayer.getChildren()) { if (figure instanceof CompartmentCollapseHandle) { toggleFigureLocation = ((CompartmentCollapseHandle) figure).getLocation(); if (toggleFigureLocation.x != 0 && toggleFigureLocation.y != 0) { Dimension size = ((CompartmentCollapseHandle) figure).getSize(); toggleFigureLocation.translate(size.width / 2, size.height / 2); editor.click(toggleFigureLocation); return true; } } } } return false; } @Override public void init(SWTBot bot) { } @Override public String getFailureMessage() { return "The collapse button has not been found after region selection."; } }); bot.waitUntil(editPartResizedCondition); SWTBotUtils.waitAllUiEvents(); }

Target:
private void collapseOrExpandContainer(SWTBotGefEditPart container) { ICondition editPartResizedCondition = new CheckEditPartResized(container); AbstractDiagramElementContainerEditPart part = (AbstractDiagramElementContainerEditPart) container.part(); GraphicalHelper.getAbsoluteBoundsIn100Percent(part); Point top = GraphicalHelper.getAbsoluteBoundsIn100Percent(part).getTop(); editor.click(top.getTranslated(0, 40)); bot.waitUntil(new DefaultCondition() { @Override public boolean test() throws Exception { IFigure handleLayer = LayerManager.Helper.find(part).getLayer(LayerConstants.HANDLE_LAYER); Point toggleFigureLocation; if (handleLayer != null) { for (Object figure : handleLayer.getChildren()) { if (figure instanceof CompartmentCollapseHandle) { toggleFigureLocation = ((CompartmentCollapseHandle) figure).getLocation(); if (toggleFigureLocation.x != 0 && toggleFigureLocation.y != 0) { Dimension size = ((CompartmentCollapseHandle) figure).getSize(); toggleFigureLocation.translate(size.width / 2, size.height / 2); editor.click(toggleFigureLocation); return true; } } } } return false; } @Override public String getFailureMessage() { return "The collapse button has not been found after region selection."; } }); bot.waitUntil(editPartResizedCondition); SWTBotUtils.waitAllUiEvents(); }
Source:
JobResultImpl(JobResultData data) throws IOException, ClassNotFoundException { JobIdData id = data.getId(); jobId = new JobIdImpl(id.getId(), id.getReadableName()); allResults = createTaskResultMap(data.getAllResults()); preciousResults = createTaskResultMap(data.getPreciousResults()); exceptionResults = createTaskResultMap(data.getExceptionResults()); resultMap = ObjectByteConverter.mapOfBase64StringToSerializable(data.getSerializedResultMap()); jobInfo = data.getJobInfo(); }

Target:
JobResultImpl(JobResultData data) { JobIdData id = data.getId(); jobId = new JobIdImpl(id.getId(), id.getReadableName()); allResults = createTaskResultMap(data.getAllResults()); preciousResults = createTaskResultMap(data.getPreciousResults()); exceptionResults = createTaskResultMap(data.getExceptionResults()); resultMap = ObjectByteConverter.mapOfBase64StringToSerializable(data.getSerializedResultMap()); jobInfo = data.getJobInfo(); }
Source:
private List<Integer> recoverPartitions(AbstractTopology topology, String haGroup) { List<Integer>partitions = null; AbstractTopology recoveredTopo = AbstractTopology.mutateRecoverTopology(topology, m_messenger.getLiveHostIds(), m_messenger.getHostId(), haGroup); if (recoveredTopo != null) { partitions = recoveredTopo.getPartitionIdList(m_messenger.getHostId()); if (partitions != null && partitions.size() == m_catalogContext.getNodeSettings().getLocalSitesCount()) { TopologyZKUtils.updateTopologyToZK(m_messenger.getZK(), recoveredTopo); } } return partitions; }

Target:
private List<Integer> recoverPartitions(AbstractTopology topology, String haGroup) { AbstractTopology recoveredTopo = AbstractTopology.mutateRecoverTopology(topology, m_messenger.getLiveHostIds(), m_messenger.getHostId(), haGroup); if (recoveredTopo == null) { return null; } List<Integer> partitions = recoveredTopo.getPartitionIdList(m_messenger.getHostId()); if (partitions != null && partitions.size() == m_catalogContext.getNodeSettings().getLocalSitesCount()) { TopologyZKUtils.updateTopologyToZK(m_messenger.getZK(), recoveredTopo); return partitions; } return null; }
Source:
protected @Nullable String getSegmentType(@NonNull ISegment segment) { if (segment instanceof ICalledFunction) { ICalledFunction calledFunction = (ICalledFunction) segment; ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace(); if (trace != null) { Object symbol = calledFunction.getSymbol(); return String.valueOf(symbol); } } return null; }

Target:
protected @Nullable String getSegmentType(@NonNull ISegment segment) { if (segment instanceof ICalledFunction) { ICalledFunction calledFunction = (ICalledFunction) segment; return String.valueOf(calledFunction.getSymbol()); } return null; }
Source:
Call<RbRelatedPages> request(@NonNull Service service, @NonNull String title, int limit, @NonNull Callback cb) { Call<RbRelatedPages> call = service.fetch(title); call.enqueue(new retrofit2.Callback<RbRelatedPages>() { @Override public void onResponse(@NonNull Call<RbRelatedPages> call, @NonNull Response<RbRelatedPages> response) { if (response.body() != null && response.body().success()) { cb.success(call, limit < 0 ? response.body().getPages() : response.body().getPages(limit)); } else if (response.body().hasError()) { cb.failure(call, new Throwable(response.body().getErrorMessage())); } else { cb.failure(call, new IOException("An unknown error occurred.")); } } @Override public void onFailure(@NonNull Call<RbRelatedPages> call, @NonNull Throwable t) { cb.failure(call, t); } }); return call; }

Target:
Call<RbRelatedPages> request(@NonNull Service service, @NonNull String title, int limit, @NonNull Callback cb) { Call<RbRelatedPages> call = service.fetch(title); call.enqueue(new retrofit2.Callback<RbRelatedPages>() { @Override public void onResponse(@NonNull Call<RbRelatedPages> call, @NonNull Response<RbRelatedPages> response) { if (response.body() != null && response.body().getPages() != null) { cb.success(call, limit < 0 ? response.body().getPages() : response.body().getPages(limit)); } else { cb.failure(call, new IOException("An unknown error occurred.")); } } @Override public void onFailure(@NonNull Call<RbRelatedPages> call, @NonNull Throwable t) { cb.failure(call, t); } }); return call; }
Source:
public static void deselectAll(final ISelection selection) { if (selection instanceof IStructuredSelection) { IStructuredSelection structuredSelection = (IStructuredSelection) selection; if (structuredSelection.getFirstElement() instanceof EditPart) { ((EditPart) structuredSelection.getFirstElement()).getViewer().deselectAll(); } } }

Target:
public static void deselectAll(final ISelection selection) { if (selection instanceof IStructuredSelection) { IStructuredSelection structuredSelection = (IStructuredSelection) selection; if (structuredSelection.getFirstElement() instanceof EditPart) { EditPartViewer viewer = ((EditPart) structuredSelection.getFirstElement()).getViewer(); if (viewer != null) { viewer.deselectAll(); } } } }
Source:
private void baseInitialization(String menuIndex) { add(new Link<Object>("lang.en") { @Override public void onClick() { getSession().setLocale(Locale.ENGLISH); } }); add(new Link<Object>("lang.de") { @Override public void onClick() { getSession().setLocale(Locale.GERMAN); } }); HeaderTemplate.menuIndex = menuIndex; add(new BookmarkablePageLink<Index>("logo", Index.class)); if (openengsbVersionService == null || openengsbVersionService.size() == 0) { if (openengsbVersion == null) { add(new Label("version", "UNKNOWN version")); } else { add(new Label("version", openengsbVersion.getVersionNumber())); } return; } else { add(new Label("version", openengsbVersionService.get(0).getOpenEngSBVersion())); } }

Target:
private void baseInitialization(String menuIndex) { add(new Link<Object>("lang.en") { @Override public void onClick() { getSession().setLocale(Locale.ENGLISH); } }); add(new Link<Object>("lang.de") { @Override public void onClick() { getSession().setLocale(Locale.GERMAN); } }); HeaderTemplate.menuIndex = menuIndex; add(new BookmarkablePageLink<Index>("logo", Index.class)); if (openengsbVersionService == null || openengsbVersionService.size() == 0) { if (openengsbVersion == null) { add(new Label("version", new StringResourceModel("unknown.version", this, null))); } else { add(new Label("version", openengsbVersion.getVersionNumber())); } return; } else { add(new Label("version", openengsbVersionService.get(0).getOpenEngSBVersion())); } }
Source:
private synchronized boolean addExecCommandToQueue(final ExecutableCommand cmd, long delayTime) { if (cmd.getConfiguration() .getConfigurationDescription() .getMetaData(ShardHelper.LOCAL_SHARDED_KEY) == null) { if (isShutdown()) { return false; } } if (delayTime > 0) { mSleepingCommands.add(cmd); Runnable delayCommand = new Runnable() { @Override public void run() { synchronized (CommandScheduler.this) { if (mSleepingCommands.remove(cmd)) { mReadyCommands.add(cmd); mCommandProcessWait.signalEventReceived(); } } } }; mCommandTimer.schedule(delayCommand, delayTime, TimeUnit.MILLISECONDS); } else { mReadyCommands.add(cmd); mCommandProcessWait.signalEventReceived(); } return true; }

Target:
private synchronized boolean addExecCommandToQueue(final ExecutableCommand cmd, long delayTime) { if (isShutdown()) { if (cmd.getConfiguration() .getConfigurationDescription() .getMetaData(ConfigurationDescriptor.LOCAL_SHARDED_KEY) == null) { return false; } } if (delayTime > 0) { mSleepingCommands.add(cmd); Runnable delayCommand = new Runnable() { @Override public void run() { synchronized (CommandScheduler.this) { if (mSleepingCommands.remove(cmd)) { mReadyCommands.add(cmd); mCommandProcessWait.signalEventReceived(); } } } }; mCommandTimer.schedule(delayCommand, delayTime, TimeUnit.MILLISECONDS); } else { mReadyCommands.add(cmd); mCommandProcessWait.signalEventReceived(); } return true; }
Source:
public List<Map<String, Object>> getLoginAsUser() throws Exception { final Map<String, String> filterParams = map( "start", "0", "limit", "30", "includeAnonymous", "false", "includeDefault", "false"); List<User> users = userAPI.getUsersByNameOrEmailOrUserID("", 1, 30, false, false); List<Map<String, Object>> userList = new ArrayList<>(); List<String> rolesId = new ArrayList<>(); rolesId.add( roleAPI.loadRoleByKey(Role.ADMINISTRATOR).getId() ); rolesId.add( roleAPI.loadCMSAdminRole().getId() ); for (User user : users) { Map<String, Object> userMap = user.toMap(); String id = user.getUserId(); boolean hasPermissions = roleAPI.doesUserHaveRoles(id, rolesId); if ( hasPermissions ){ userMap.put("requestPassword", true); } userList.add(userMap); } return userList; }

Target:
public List<Map<String, Object>> getLoginAsUser() throws Exception { List<User> users = userAPI.getUsersByNameOrEmailOrUserID(StringPool.BLANK, 1, 30, false, false); List<Map<String, Object>> userList = new ArrayList<>(); List<String> rolesId = list( roleAPI.loadRoleByKey(Role.ADMINISTRATOR).getId(), roleAPI.loadCMSAdminRole().getId() ); for (User user : users) { Map<String, Object> userMap = user.toMap(); String id = user.getUserId(); boolean hasPermissions = roleAPI.doesUserHaveRoles(id, rolesId); if ( hasPermissions ){ userMap.put("requestPassword", true); } userList.add(userMap); } return userList; }
Source:
public void init(IViewSite site, IMemento memento) throws PartInitException { super.init(site, memento); if (memento != null) { fInitialConnections= new ArrayList<>(); for(int i=0; ; i++) { String id= memento.getString("rc_id_" + i); String name= memento.getString("rc_name_" + i); if (id == null || name == null) { break; } IRemoteServices rs = RemoteServices.getRemoteServices(id); if (rs != null) { IRemoteConnection rc = rs.getConnectionManager().getConnection(name); if (rc != null) { fInitialConnections.add(rc); } } } } }

Target:
public void init(IViewSite site, IMemento memento) throws PartInitException { super.init(site, memento); if (memento != null) { fInitialConnections = new ArrayList<>(); for(int i = 0; ; i++) { String id = memento.getString("rc_id_" + i); String name = memento.getString("rc_name_" + i); if (id == null || name == null) { break; } if (!Workaround_Bug449362.triggerRSEStartup(id)) { } else { IRemoteServices rs = RemoteServices.getRemoteServices(id); if (rs != null) { IRemoteConnection rc = rs.getConnectionManager().getConnection(name); if (rc != null) { fInitialConnections.add(rc); } } } } } }
Source:
public IUser findUserByProviderUserId(String userId, String provider) throws QuadrigaStorageException { try { return userDeepMapper.findUserByProviderUserId(userId, provider); } catch (Exception ex) { throw new QuadrigaStorageException(); } }

Target:
public IUser findUserByProviderUserId(String userId, String provider) { return userDeepMapper.findUserByProviderUserId(userId, provider); }
Source:
public HdfsWriter(HdfsSinkConnectorConfig connectorConfig) { writers = new HashMap<TopicPartition, RecordWriter<Long, SinkRecord>>(); recordCounters = new HashMap<TopicPartition, Integer>(); url = connectorConfig.getString(HdfsSinkConnectorConfig.HDFS_URL_CONFIG); topicsDir = connectorConfig.getString(HdfsSinkConnectorConfig.TOPIC_DIR_CONFIG); conf = new Configuration(); try { fs = FileSystem.newInstance(URI.create(url), conf); Path path = new Path(url + "/" + topicsDir); if (!fs.exists(path)) { fs.mkdirs(path); } } catch (IOException e) { throw new CopycatRuntimeException(e); } try { offsets = readOffsets(); } catch (CopycatException e) { throw new CopycatRuntimeException(e); } try { writerProviderClass = (Class<RecordWriterProvider>) Class.forName(connectorConfig.getString(HdfsSinkConnectorConfig.RECORD_WRITER_PROVIDER_CLASS_CONFIG)); } catch (ClassNotFoundException e) { throw new CopycatRuntimeException("RecordWriterProvider class not found", e); } flushSize = connectorConfig.getInt(HdfsSinkConnectorConfig.FLUSH_SIZE_CONFIG); }

Target:
public HdfsWriter(HdfsSinkConnectorConfig connectorConfig) { try { writers = new HashMap<TopicPartition, RecordWriter<Long, SinkRecord>>(); recordCounters = new HashMap<TopicPartition, Integer>(); flushSize = connectorConfig.getInt(HdfsSinkConnectorConfig.FLUSH_SIZE_CONFIG); url = connectorConfig.getString(HdfsSinkConnectorConfig.HDFS_URL_CONFIG); topicsDir = connectorConfig.getString(HdfsSinkConnectorConfig.TOPIC_DIR_CONFIG); conf = new Configuration(); fs = FileSystem.newInstance(URI.create(url), conf); Path path = new Path(url + "/" + topicsDir); if (!fs.exists(path)) { fs.mkdirs(path); } offsets = readOffsets(); writerProviderClass = (Class<RecordWriterProvider>) Class.forName(connectorConfig.getString(HdfsSinkConnectorConfig.RECORD_WRITER_PROVIDER_CLASS_CONFIG)); } catch (IOException e) { throw new CopycatRuntimeException(e); } catch (ClassNotFoundException e) { throw new CopycatRuntimeException("RecordWriterProvider class not found", e); } }
Source:
protected String getAbsolutePath(String relativePath) { File fileCheck = new File(relativePath); if (!fileCheck.isFile()) { try { throw new Exception("File doesn't exist"); } catch (Exception e) { e.printStackTrace(); } } return fileCheck.getAbsolutePath(); }

Target:
protected String getAbsolutePath(String relativePath) { File fileCheck = new File(relativePath); if (!fileCheck.isFile()) { throw new RuntimeException("file " + relativePath + " doesn't exists"); } return fileCheck.getAbsolutePath(); }
Source:
public Observable<List<T>> createObservable() { try { throwExceptionIfRxJavaIsNotAvailable("createObservable()"); return storIOContentResolver .observeChangesOfUri(query.uri()) .map(MapSomethingToExecuteAsBlocking.newInstance(this)) .startWith(Observable.create(OnSubscribeExecuteAsBlocking.newInstance(this))) .subscribeOn(Schedulers.io()); } catch (Throwable throwable) { throw new StorIOException(throwable); } }

Target:
public Observable<List<T>> createObservable() { throwExceptionIfRxJavaIsNotAvailable("createObservable()"); return storIOContentResolver .observeChangesOfUri(query.uri()) .map(MapSomethingToExecuteAsBlocking.newInstance(this)) .startWith(Observable.create(OnSubscribeExecuteAsBlocking.newInstance(this))) .subscribeOn(Schedulers.io()); }
Source:
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { validateServletEnvironment(req, res); final HttpServletRequest baseRequest = (HttpServletRequest) req; final HttpServletResponse baseResponse = (HttpServletResponse) res; if (staticHandler.requestingStaticFile(baseRequest)) { staticHandler.deferProcessingToContainer(chain, baseRequest, baseResponse); } else { logger.debug("VRaptor received a new request {}", req); VRaptorRequest mutableRequest = new VRaptorRequest(baseRequest); VRaptorResponse mutableResponse = new VRaptorResponse(baseResponse); final RequestInfo request = new RequestInfo(servletContext, chain, mutableRequest, mutableResponse); try { encodingHandler.setEncoding(baseRequest, baseResponse); provider.provideForRequest(request); newRequestEvent.fire(new NewRequest()); } catch (ApplicationLogicException e) { throw new ServletException(e.getMessage(), e.getCause()); } logger.debug("VRaptor ended the request"); } }

Target:
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { validateServletEnvironment(req, res); final HttpServletRequest baseRequest = (HttpServletRequest) req; final HttpServletResponse baseResponse = (HttpServletResponse) res; if (staticHandler.requestingStaticFile(baseRequest)) { staticHandler.deferProcessingToContainer(chain, baseRequest, baseResponse); } else { logger.trace("VRaptor received a new request {}", req); VRaptorRequest mutableRequest = new VRaptorRequest(baseRequest); VRaptorResponse mutableResponse = new VRaptorResponse(baseResponse); final RequestInfo request = new RequestInfo(servletContext, chain, mutableRequest, mutableResponse); try { encodingHandler.setEncoding(baseRequest, baseResponse); provider.provideForRequest(request); newRequestEvent.fire(new NewRequest()); } catch (ApplicationLogicException e) { throw new ServletException(e.getMessage(), e.getCause()); } logger.debug("VRaptor ended the request"); } }
Source:
public String getJobName() { if (this.jobName == null) { throw new SamzaException("Job name was not specified. Check if the job.name configuration is missing."); } return this.jobName; }

Target:
public String getJobName() { return this.jobName; }
Source:
void eliminateWeakInequalities(PBody body) { for (Inequality inequality : body.getConstraintsOfType(Inequality.class)){ if (inequality.isEliminable()){ inequality.eliminateWeak(); derivativeRemoved(inequality); } } }

Target:
void eliminateWeakInequalities(PBody body) { for (Inequality inequality : body.getConstraintsOfType(Inequality.class)){ if (inequality.isEliminable()){ inequality.eliminateWeak(); derivativeRemoved(inequality, new PConstraintListRemovalReason(inequality)); } } }
Source:
protected void configureOauthCredentials() { if (appExtSecurePropertiesFile != null) { M_log.debug("oauthCredentials were injected"); } if (appExtSecurePropertiesFile == null) { M_log.debug("try to set oauth credentials from url"); appExtSecurePropertiesFile = Utils.loadProperties(CCM_SECURE_PROPERTY_FILE_PATH); } if (appExtSecurePropertiesFile == null) { M_log.debug("try to set oauth credentials from default."); appExtSecurePropertiesFile = new Properties(); appExtSecurePropertiesFile.put("lmsng.school.edu.secret", "secret"); } oacf = new OauthCredentialsFactory(appExtSecurePropertiesFile); }

Target:
protected void configureOauthCredentials() { if (appExtSecurePropertiesFile != null) { M_log.debug("oauthCredentials were injected"); } else{ M_log.debug("try to set oauth credentials from properties url"); appExtSecurePropertiesFile = Utils.loadProperties(CCM_SECURE_PROPERTY_FILE_PATH); } if (appExtSecurePropertiesFile == null) { M_log.debug("try to set oauth credentials from default."); appExtSecurePropertiesFile = new Properties(); appExtSecurePropertiesFile.put("lmsng.school.edu.secret", "secret"); } oacf = new OauthCredentialsFactory(appExtSecurePropertiesFile); }
Source:
void toto() { new Handler(){ @Override public String handle() { return "handled"; } }.handle(); new Handler(){ private String myMethod(){ return "plop"; } @Override public String handle() { return myMethod(); } }.handle(); new Handler(){ @Override public String handle() { return this.toString(); } }.handle(); new Handler(){ @Override public String handle() { class C{ String meth(){ return ""; } String fun(){ return this.meth(); } } return new C().fun(); } }; new Handler(){ int myVar; @Override public String handle() { return ""; } }; new Handler(){ @Override public String handle() { return ""; }; }; new Handler (){ @Override public String handle() { return A.this.toStr(); } }; new B() { @Override public void bar() { } }; new C() { @Override public void foo() { } }; new D() {}; new D() { @Override public void foo2() }; }

Target:
void toto() { new Handler(){ @Override public String handle() { return "handled"; } }.handle(); new Handler(){ private String myMethod(){ return "plop"; } @Override public String handle() { return myMethod(); } }.handle(); new Handler(){ @Override public String handle() { return this.toString(); } }.handle(); new Handler(){ @Override public String handle() { class C{ String meth(){ return ""; } String fun(){ return this.meth(); } } return new C().fun(); } }; new Handler(){ int myVar; @Override public String handle() { return ""; } }; new Handler(){ @Override public String handle() { return ""; }; }; new Handler (){ @Override public String handle() { return A.this.toStr(); } }; }
Source:
public void resolveVersionRangeWithX() { Dependency dependency1 = Dependency.withId("foo1", "com.acme", "foo1", "0.3.0.RELEASE"); dependency1.setVersionRange("[1.1.0.RELEASE, 1.2.x.RELEASE)"); dependency1.resolve(); assertThat(dependency1.getVersionRange()) .isEqualTo("[1.1.0.RELEASE,1.2.999.RELEASE)"); Dependency dependency2 = Dependency.withId("foo2", "com.acme", "foo2", "0.3.0.RELEASE"); dependency2.setVersionRange("1.1.x.RELEASE"); dependency2.resolve(); assertThat(dependency2.getVersionRange()).isEqualTo("1.1.999.RELEASE"); }

Target:
public void resolveVersionRangeWithX() { Dependency dependency = Dependency.withId("foo1", "com.acme", "foo1", "0.3.0.RELEASE"); dependency.setVersionRange("[1.1.0.RELEASE, 1.2.x.RELEASE)"); dependency.resolve(); assertThat(dependency.getVersionRange()) .isEqualTo("[1.1.0.RELEASE,1.2.999.RELEASE)"); }
Source:
public ImmutableCollection<E> loadAll() { final RecordStorage<I> storage = recordStorage(); final Map<I, EntityStorageRecord> recordMap = storage.readAll(); final ImmutableCollection<E> entities = FluentIterable.from(recordMap.entrySet()) .transform(new Function<Map.Entry<I, EntityStorageRecord>, E>() { @Nullable @Override public E apply(@Nullable Map.Entry<I, EntityStorageRecord> input) { Preconditions.checkNotNull(input); return toEntity(input.getKey(), input.getValue()); } }) .toList(); return entities; }

Target:
public ImmutableCollection<E> loadAll() { final RecordStorage<I> storage = recordStorage(); final Map<I, EntityStorageRecord> recordMap = storage.readAll(); final ImmutableCollection<E> entities = FluentIterable.from(recordMap.entrySet()) .transform(storageRecordToEntityTransformer()) .toList(); return entities; }
Source:
public void test_invalid_index() throws Exception { File batchJar = temp.newFile("sonar-scanner-api-batch.jar"); when(jarExtractor.extractToTemp("sonar-scanner-api-batch")).thenReturn(batchJar.toPath()); when(connection.downloadString("/batch/index")).thenReturn( "cpd.jar\n"); Jars jars = new Jars(fileCache, connection, jarExtractor, mock(Logger.class)); try { jars.download(); fail(); } catch (RuntimeException e) { assertThat(e).hasMessage("Fail to bootstrap from server. Bootstrap index was:\ncpd.jar\n"); } }

Target:
public void test_invalid_index() throws Exception { File batchJar = temp.newFile("sonar-scanner-api-batch.jar"); when(jarExtractor.extractToTemp("sonar-scanner-api-batch")).thenReturn(batchJar.toPath()); when(connection.downloadString("/batch/index")).thenReturn( "cpd.jar\n"); Jars jars = new Jars(fileCache, connection, jarExtractor, mock(Logger.class)); thrown.expect(IllegalStateException.class); thrown.expectMessage("Fail to bootstrap from server. Bootstrap index was:\ncpd.jar\n"); jars.download(); }
Source:
public void send(ProcessEngineEvent newEvent) { System.out.println("Sending Event: " + newEvent); producer.send(MessageBuilder.withPayload(newEvent).build()); }

Target:
public void send(ProcessEngineEvent newEvent) { producer.send(MessageBuilder.withPayload(newEvent).build()); }
Source:
public void init() { super.init(); for (int i = 0; 12 != i; i++) { new GuiTab("Tab1", new ItemStack(Blocks.BEDROCK), TestGui.class) { @Override public void onTabClicked() { GuiTabsTest.INSTANCE.sendToServer(new TabMessageHandler.TabMessage(0)); } }.setTargetGui(TestGui.class).addTo(GuiInventory.class); } for (int i = 0; 13 != i; i++) { new GuiTab("Tab2", new ResourceLocation("textures/blocks/tnt_side.png"), GuiChest.class) { @Override public void onTabClicked() { GuiTabsTest.INSTANCE.sendToServer(new TabMessageHandler.TabMessage(1)); } }.setTargetGui(GuiChest.class).addTo(GuiInventory.class); } for (int i = 0; 13 != i; i++) { new GuiTab("Tab3", new ItemStack(Blocks.FURNACE), TestGui2.class) { @Override public void onTabClicked() { GuiTabsTest.INSTANCE.sendToServer(new TabMessageHandler.TabMessage(2)); } }.setTargetGui(TestGui2.class).addTo(TestGui.class); } }

Target:
public void init() { super.init(); new GuiTab("Tab1", new ItemStack(Blocks.BEDROCK), TestGui.class) { @Override public void onTabClicked(GuiContainer guiContainer) { super.onTabClicked(guiContainer); GuiTabsTest.INSTANCE.sendToServer(new TabMessageHandler.TabMessage(0)); } }.setTargetGui(TestGui.class).addTo(GuiInventory.class); new GuiTab("Tab2", new ResourceLocation("textures/blocks/tnt_side.png"), GuiChest.class) { @Override public void onTabClicked(GuiContainer guiContainer) { super.onTabClicked(guiContainer); GuiTabsTest.INSTANCE.sendToServer(new TabMessageHandler.TabMessage(1)); } }.setTargetGui(GuiChest.class).addTo(GuiFurnace.class); ItemStack is = new ItemStack(Items.APPLE); is.addEnchantment(new net.minecraft.enchantment.EnchantmentProtection(Enchantment.Rarity.COMMON, EnchantmentProtection.Type.FALL, null), 1); new GuiTab("Tab3", is, TestGui2.class) { @Override public void onTabClicked(GuiContainer guiContainer) { super.onTabClicked(guiContainer); GuiTabsTest.INSTANCE.sendToServer(new TabMessageHandler.TabMessage(2)); } }.setTargetGui(TestGui2.class).addTo(GuiInventory.class); }
Source:
private ImmutableSet<HuId> retrieveSelectedHuIds() { final DocumentIdsSelection selectedRowIds = getSelectedRowIds(); final ImmutableList<PPOrderLineRow> selectedRows = getView().streamByIds(selectedRowIds) .collect(ImmutableList.toImmutableList()); final List<HuId> huIds = new ArrayList<HuId>(); selectedRows.forEach(row -> { final PPOrderLineType type = row.getType(); if (type.isMainProduct()) { final ImmutableList<PPOrderLineRow> includedRows = row.getIncludedRows(); includedRows.stream().map(PPOrderLineRow::getHuId).collect(Collectors.toCollection(() -> huIds)); } else { huIds.add(row.getHuId()); } }); final ImmutableSet<HuId> distinctHuIds = huIds.stream().filter(Objects::nonNull).distinct() .collect(ImmutableSet.toImmutableSet()); return distinctHuIds; }

Target:
private Set<HuId> retrieveSelectedHuIds() { final DocumentIdsSelection selectedRowIds = getSelectedRowIds(); final ImmutableList<PPOrderLineRow> selectedRows = getView() .streamByIds(selectedRowIds) .collect(ImmutableList.toImmutableList()); final Set<HuId> huIds = new HashSet<HuId>(); for (final PPOrderLineRow row : selectedRows) { final PPOrderLineType type = row.getType(); if (type.isMainProduct()) { final ImmutableList<PPOrderLineRow> includedRows = row.getIncludedRows(); includedRows.stream() .filter(ppOrderLineRow -> ppOrderLineRow.getType().isHUOrHUStorage()) .map(PPOrderLineRow::getHuId) .filter(Objects::nonNull) .forEach(huIds::add); } else if (row.getHuId() != null && type.isHUOrHUStorage()) { huIds.add(row.getHuId()); } } return huIds; }
Source:
public void setMateReferenceIndex(final int mateReferenceIndex) { if (mateReferenceIndex == NO_ALIGNMENT_REFERENCE_INDEX) { mMateReferenceIndex = NO_ALIGNMENT_REFERENCE_INDEX; mMateReferenceName = NO_ALIGNMENT_REFERENCE_NAME; } else if (null == mHeader) { throw new IllegalArgumentException("A non-null SAMFileHeader is required to resolve the mate reference index"); } else { SAMSequenceRecord samSequence = mHeader.getSequence(mateReferenceIndex); if (null != samSequence) { mMateReferenceIndex = mateReferenceIndex; mMateReferenceName = samSequence.getSequenceName(); } else { throw new IllegalArgumentException("Reference index " + mateReferenceIndex + " not found in sequence dictionary."); } } }

Target:
public void setMateReferenceIndex(final int mateReferenceIndex) { if (mateReferenceIndex == NO_ALIGNMENT_REFERENCE_INDEX) { mMateReferenceIndex = NO_ALIGNMENT_REFERENCE_INDEX; mMateReferenceName = NO_ALIGNMENT_REFERENCE_NAME; } else if (null == mHeader) { throw new IllegalStateException("A non-null SAMFileHeader is required to resolve the mate reference index"); } else { SAMSequenceRecord samSequence = mHeader.getSequence(mateReferenceIndex); if (null != samSequence) { mMateReferenceIndex = mateReferenceIndex; mMateReferenceName = samSequence.getSequenceName(); } else { throw new IllegalArgumentException("Reference index " + mateReferenceIndex + " not found in sequence dictionary."); } } }
Source:
public void testBufferSmallPages() throws Exception { int singlePageRowCount = 10; Page page = createSequencePage(TYPES, singlePageRowCount * 2); List<Page> splits = splitPage(page, page.getSizeInBytes() / 2); MergingPageOutput output = new MergingPageOutput(TYPES, toIntExact(page.getSizeInBytes() + 1), page.getPositionCount() + 1, Integer.MAX_VALUE); assertTrue(output.needsInput()); assertNull(output.getOutput()); output.addInput(createPageProcessorOutput(splits.get(0))); assertFalse(output.needsInput()); assertNull(output.getOutput()); assertTrue(output.needsInput()); output.addInput(createPageProcessorOutput(splits.get(1))); assertFalse(output.needsInput()); assertNull(output.getOutput()); output.finish(); assertFalse(output.needsInput()); assertPageEquals(TYPES, output.getOutput(), page); }

Target:
public void testBufferSmallPages() throws Exception { int singlePageRowCount = 10; Page page = createSequencePage(TYPES, singlePageRowCount * 2); List<Page> splits = splitPage(page, page.getSizeInBytes() / 2); MergingPageOutput output = new MergingPageOutput(TYPES, page.getSizeInBytes() + 1, page.getPositionCount() + 1, Integer.MAX_VALUE); assertTrue(output.needsInput()); assertNull(output.getOutput()); output.addInput(createPageProcessorOutput(splits.get(0))); assertFalse(output.needsInput()); assertNull(output.getOutput()); assertTrue(output.needsInput()); output.addInput(createPageProcessorOutput(splits.get(1))); assertFalse(output.needsInput()); assertNull(output.getOutput()); output.finish(); assertFalse(output.needsInput()); assertPageEquals(TYPES, output.getOutput(), page); }
Source:
private List<String> wrapLineComments( List<String> lines, int column0, JavaFormatterOptions options) { List<String> result = new ArrayList<>(); for (String line : lines) { Matcher matcher = LINE_COMMENT_PREFIX.matcher(line); if (matcher.find()) { int length = matcher.group(1).length(); boolean hasNoSuppression = (line.length() > length + 12) && line.substring(length, length + 12).equals("noinspection"); if (!hasNoSuppression) { line = Strings.repeat("/", length) + " " + line.substring(length); } } while (line.length() + column0 > options.maxLineLength()) { int idx = options.maxLineLength() - column0; while (idx >= 2 && !CharMatcher.whitespace().matches(line.charAt(idx))) { idx--; } if (idx <= 2) { break; } result.add(line.substring(0, idx)); line = " } result.add(line); } return result; }

Target:
private List<String> wrapLineComments( List<String> lines, int column0, JavaFormatterOptions options) { List<String> result = new ArrayList<>(); for (String line : lines) { Matcher matcher = LINE_COMMENT_PREFIX.matcher(line); if (matcher.find()) { int length = matcher.group(1).length(); boolean hasNoInspection = line.regionMatches(length, "noinspection", 0, 12); if (!hasNoInspection) { line = Strings.repeat("/", length) + " " + line.substring(length); } } while (line.length() + column0 > options.maxLineLength()) { int idx = options.maxLineLength() - column0; while (idx >= 2 && !CharMatcher.whitespace().matches(line.charAt(idx))) { idx--; } if (idx <= 2) { break; } result.add(line.substring(0, idx)); line = " } result.add(line); } return result; }
Source:
public static Collection<Object[]> data() { Object[][] data = new Object[][] { {SYNC, (Function<Transaction, Transaction>) GetSynchronousDelegate::new}, {ASYNC, (Function<Transaction, Transaction>) GetAsyncDelegate::new} }; return Arrays.asList(data); }

Target:
public static Collection<Object[]> data() { Object[][] data = new Object[][] { {SYNC, (UnaryOperator<Transaction>) GetSynchronousDelegate::new}, {ASYNC, (UnaryOperator<Transaction>) GetAsyncDelegate::new} }; return Arrays.asList(data); }
Source:
public void setup() throws ForceReattemptException { message = spy(new ClearPRMessage()); region = mock(PartitionedRegion.class); dataStore = mock(PartitionedRegionDataStore.class); when(region.getDataStore()).thenReturn(dataStore); bucketRegion = mock(BucketRegion.class); when(dataStore.getInitializedBucketForId(any(), any())).thenReturn(bucketRegion); }

Target:
public void setup() throws ForceReattemptException { message = spy(new ClearPRMessage()); region = mock(PartitionedRegion.class, RETURNS_DEEP_STUBS); dataStore = mock(PartitionedRegionDataStore.class); when(region.getDataStore()).thenReturn(dataStore); bucketRegion = mock(BucketRegion.class); when(dataStore.getInitializedBucketForId(any(), any())).thenReturn(bucketRegion); }
Source:
public void start(String baseDir) { Properties properties = createProperties(); Charset charset; { String s = (String) properties.get("encoding"); if (null == s) { charset = Charset.forName("UTF-8"); properties.put("encoding", charset.name()); } else { charset = Charset.forName(s); } } try { if (toConsole) { writer = new BufferedWriter(new OutputStreamWriter(System.out, charset)); } if (toFile != null) { writer = getToFileWriter(baseDir, toFile, charset); } renderer = createRenderer(); renderer.setWriter(writer); renderer.start(); } catch (IOException ioe) { throw new BuildException(ioe.getMessage(), ioe); } }

Target:
public void start(String baseDir) { Properties properties = createProperties(); Charset charset; { String s = (String) properties.get("encoding"); if (null == s) { if (toConsole) { s = getConsoleEncoding(); if (null == s) { s = System.getProperty("file.encoding"); } } if (null == s) { charset = StandardCharsets.UTF_8; } else { charset = Charset.forName(s); } final Parameter parameter = new Parameter(); parameter.setName("encoding"); parameter.setValue(charset.name()); parameters.add(parameter); } else { charset = Charset.forName(s); } } try { if (toConsole) { writer = new BufferedWriter(new OutputStreamWriter(System.out, charset)); } if (toFile != null) { writer = getToFileWriter(baseDir, toFile, charset); } renderer = createRenderer(); renderer.setWriter(writer); renderer.start(); } catch (IOException ioe) { throw new BuildException(ioe.getMessage(), ioe); } }