auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private boolean isInfiniteLoop(IterationStatementTree tree, @Nullable JavaScriptTree condition) { if (isNeverExecutedLoop(condition)) { return false; } ControlFlowGraph flowGraph = CheckUtils.buildControlFlowGraph(tree); Map<Tree, CfgBlock> treesOfFlowGraph = treesToBlocks(flowGraph); if (isBrokenLoop(tree, flowGraph)) { return false; } if (condition != null && conditionIsUpdated(condition, (JavaScriptTree) tree, treesOfFlowGraph)) { return false; } else { return true; } }

Target:
private static boolean isInfiniteLoop(IterationStatementTree tree, @Nullable JavaScriptTree condition) { if (isNeverExecutedLoop(condition)) { return false; } ControlFlowGraph flowGraph = CheckUtils.buildControlFlowGraph(tree); Map<Tree, CfgBlock> treesOfFlowGraph = treesToBlocks(flowGraph); if (isBrokenLoop(tree, flowGraph)) { return false; } return condition == null || conditionIsUpdated(condition, (JavaScriptTree) tree, treesOfFlowGraph); }
Source:
void sendWarningForNonExportableDisks(ArrayList<Disk> disks) { final List<Disk> nonExportableDisks = new ArrayList<Disk>(); for(Disk disk : disks) { if(!disk.isAllowSnapshot()) { nonExportableDisks.add(disk); } } if(!nonExportableDisks.isEmpty()) { final StringBuilder s = new StringBuilder(); for(Disk disk : nonExportableDisks) { if(s.length() > 0) { s.append(", "); } s.append(disk.getDiskAlias()); } setMessage(ConstantsManager.getInstance().getMessages().disksWillNotBePartOfTheExportedVMSnapshot(s.toString())); } }

Target:
void sendWarningForNonExportableDisks(ArrayList<Disk> disks) { final List<String> list = new ArrayList<String>(); for (Disk disk : disks) { if (!disk.isAllowSnapshot()) { list.add(disk.getDiskAlias()); } } if(!list.isEmpty()) { final String s = StringUtils.join(list, ", "); setMessage(ConstantsManager.getInstance().getMessages().disksWillNotBePartOfTheExportedVMSnapshot(s)); } }
Source:
public final boolean equals(Object o) { if (o instanceof LFUEvictionPolicyComparator) { return true; } return false; }

Target:
public final boolean equals(Object o) { if (o == null) { return false; } return getClass().equals(o.getClass()); }
Source:
protected AsyncTaskResult<KeyPair> doInBackground(Void... voids) { AsyncTaskResult<KeyPair> retval = null; for(Provider provider : Security.getProviders()) Log.d(TAG, "Provider: " + provider.getName()); try { for(PemToKeyPairConverter converter : converters) { KeyPair keyPair = converter.convert(new String(pemFile)); if(keyPair != null) { retval = new AsyncTaskResult<KeyPair>(keyPair); break; } } if(retval == null) throw new IOException("No converter availableExact to parse selected PEM"); } catch (IOException e) { Log.e(TAG, "IOException reading PEM", e); retval = new AsyncTaskResult<KeyPair>(e); } return retval; }

Target:
protected AsyncTaskResult<KeyPair> doInBackground(Void... voids) { AsyncTaskResult<KeyPair> retval = null; for(Provider provider : Security.getProviders()) Log.d(TAG, "Provider: " + provider.getName()); try { for(PemToKeyPairConverter converter : converters) { KeyPair keyPair = converter.convert(new String(pemFile)); if(keyPair != null) { retval = new AsyncTaskResult<KeyPair>(keyPair); break; } } if(retval == null) throw new IOException("No converter available to parse selected PEM"); } catch (IOException e) { Log.e(TAG, "IOException reading PEM", e); retval = new AsyncTaskResult<KeyPair>(e); } return retval; }
Source:
private void startAllocatedContainer(Container container) { LOG.info("Starting container [" + container.getContainerId()+ "]"); scheduledToRunContainers.put(container.getContainerId(), container); this.utilizationManager.addContainerResources(container); if (container.getContainerTokenIdentifier().getExecutionType() == ExecutionType.OPPORTUNISTIC) { this.opportunisticContainersStatus.setOpportMemoryUsed( this.opportunisticContainersStatus.getOpportMemoryUsed() + container.getResource().getMemorySize()); this.opportunisticContainersStatus.setOpportCoresUsed( this.opportunisticContainersStatus.getOpportCoresUsed() + container.getResource().getVirtualCores()); this.opportunisticContainersStatus.setRunningOpportContainers( this.opportunisticContainersStatus.getRunningOpportContainers() + 1); } container.sendLaunchEvent(); }

Target:
private void startAllocatedContainer(Container container) { LOG.info("Starting container [" + container.getContainerId()+ "]"); runningContainers.put(container.getContainerId(), container); this.utilizationTracker.addContainerResources(container); if (container.getContainerTokenIdentifier().getExecutionType() == ExecutionType.OPPORTUNISTIC) { this.metrics.opportunisticContainerStarted(container); } container.sendLaunchEvent(); }
Source:
protected void doStop() { log.info("Stopping Netty server"); boss.shutdownGracefully(); if(!datagram) { wrkr.shutdownGracefully(); } try { sock.channel().closeFuture().sync(); } catch (InterruptedException e) { log.warn("Netty server stop interrupted"); Thread.currentThread().interrupt(); } log.info("Netty server stopped"); notifyStopped(); }

Target:
protected void doStop() { log.info("Stopping Netty server"); wrkr.shutdownGracefully(); if(!datagram) { boss.shutdownGracefully(); } try { sock.channel().closeFuture().sync(); } catch (InterruptedException e) { log.warn("Netty server stop interrupted"); Thread.currentThread().interrupt(); } log.info("Netty server stopped"); notifyStopped(); }
Source:
public static boolean equals(Thing a, Thing b) { if (!a.getUID().equals(b.getUID())) { return false; } if (a.getBridgeUID() == null && b.getBridgeUID() != null) { return false; } if (a.getBridgeUID() != null && !a.getBridgeUID().equals(b.getBridgeUID())) { return false; } if (a.getConfiguration() == null && b.getConfiguration() != null) { return false; } if (a.getConfiguration() != null && !a.getConfiguration().equals(b.getConfiguration())) { return false; } if (a.getLabel() == null && b.getLabel() != null) { return false; } if (a.getLabel() != null && !a.getLabel().equals(b.getLabel())) { return false; } if (a.getLocation() == null && b.getLocation() != null) { return false; } if (a.getLocation() != null && !a.getLocation().equals(b.getLocation())) { return false; } List<Channel> channelsOfA = a.getChannels(); List<Channel> channelsOfB = b.getChannels(); if (channelsOfA.size() != channelsOfB.size()) { return false; } if (!toString(channelsOfA).equals(toString(channelsOfB))) { return false; } return true; }

Target:
public static boolean equals(Thing a, Thing b) { if (!a.getUID().equals(b.getUID())) { return false; } if (!Objects.equal(a.getBridgeUID(), b.getBridgeUID())) { return false; } if (!Objects.equal(a.getConfiguration(), b.getConfiguration())) { return false; } if (!Objects.equal(a.getLabel(), b.getLabel())) { return false; } if (!Objects.equal(a.getLocation(), b.getLocation())) { return false; } List<Channel> channelsOfA = a.getChannels(); List<Channel> channelsOfB = b.getChannels(); if (channelsOfA.size() != channelsOfB.size()) { return false; } if (!toString(channelsOfA).equals(toString(channelsOfB))) { return false; } return true; }
Source:
public String toString() { return cucumberFeature.getPath(); }

Target:
public String toString() { return "\"" + cucumberFeature.getGherkinFeature().getFeature().getName() + "\""; }
Source:
public void testPauseContainer() throws Exception { MockWebServer server = mockWebServer(); server.enqueue(new MockResponse().setResponseCode(204)); DockerApi dockerApi = api(server.getUrl("/")); ContainerApi api = dockerApi.getContainerApi(); try { api.pause("1"); assertRequestHasCommonFields(server.takeRequest(), "POST", "/containers/1/pause"); } finally { dockerApi.close(); server.shutdown(); } }

Target:
public void testPauseContainer() throws Exception { MockWebServer server = mockWebServer(new MockResponse().setResponseCode(204)); ContainerApi api = api(DockerApi.class, server.getUrl("/").toString()).getContainerApi(); try { api.pause("1"); assertSent(server, "POST", "/containers/1/pause"); } finally { server.shutdown(); } }
Source:
public boolean validate() { if (getIsAttachDisk().getEntity()) { if (isSelectionsEmpty(getInternalAttachableDisks()) && isSelectionsEmpty(getExternalAttachableDisks())) { getInvalidityReasons().add(CONSTANTS.noDisksSelected()); setIsValid(false); return false; } return true; } if (!getIsInternal().getEntity() && getSanStorageModel() != null) { getSanStorageModel().validate(); if (!getSanStorageModel().getIsValid()) { return false; } ArrayList<String> partOfSdLunsMessages = getSanStorageModel().getPartOfSdLunsMessages(); if (!partOfSdLunsMessages.isEmpty() && !getSanStorageModel().isForce()) { forceCreationWarning(partOfSdLunsMessages); return false; } } StorageType storageType = getStorageDomain().getSelectedItem() == null ? StorageType.UNKNOWN : getStorageDomain().getSelectedItem().getStorageType(); LongValidation sizeValidation = new LongValidation(); sizeValidation.setMinimum(1); if (storageType.isBlockDomain()) { sizeValidation.setMaximum((Integer) AsyncDataProvider.getInstance().getConfigValuePreConverted(ConfigurationValues.MaxBlockDiskSize)); } getSize().validateEntity(new IValidation[] { new NotEmptyValidation(), sizeValidation }); getStorageDomain().validateSelectedItem(new IValidation[] { new NotEmptyValidation() }); return super.validate() && getSize().getIsValid() && getStorageDomain().getIsValid(); }

Target:
public boolean validate() { if (getIsAttachDisk().getEntity()) { if (isSelectionsEmpty(getInternalAttachableDisks()) && isSelectionsEmpty(getExternalAttachableDisks())) { getInvalidityReasons().add(CONSTANTS.noDisksSelected()); setIsValid(false); return false; } return true; } if (!getIsInternal().getEntity() && getSanStorageModel() != null) { getSanStorageModel().validate(); if (!getSanStorageModel().getIsValid()) { return false; } ArrayList<String> partOfSdLunsMessages = getSanStorageModel().getPartOfSdLunsMessages(); if (!partOfSdLunsMessages.isEmpty() && !getSanStorageModel().isForce()) { forceCreationWarning(partOfSdLunsMessages); return false; } } StorageType storageType = getStorageDomain().getSelectedItem() == null ? StorageType.UNKNOWN : getStorageDomain().getSelectedItem().getStorageType(); IntegerValidation sizeValidation = new IntegerValidation(); sizeValidation.setMinimum(1); if (storageType.isBlockDomain()) { sizeValidation.setMaximum((Integer) AsyncDataProvider.getInstance().getConfigValuePreConverted(ConfigurationValues.MaxBlockDiskSize)); } getSize().validateEntity(new IValidation[] { new NotEmptyValidation(), sizeValidation }); getStorageDomain().validateSelectedItem(new IValidation[] { new NotEmptyValidation() }); return super.validate() && getSize().getIsValid() && getStorageDomain().getIsValid(); }
Source:
public void OnSave() { DataCenterModel model = (DataCenterModel) getWindow(); if (!model.Validate()) { return; } if (!model.getIsNew() && !((Version) model.getVersion().getSelectedItem()).equals(((storage_pool) getSelectedItem()).getcompatibility_version())) { ConfirmationModel confirmModel = new ConfirmationModel(); setConfirmWindow(confirmModel); confirmModel.setTitle(ConstantsManager.getInstance() .getConstants() .changeDataCenterCompatibilityVersionTitle()); confirmModel.setHashName("change_data_center_compatibility_version"); confirmModel.setMessage(ConstantsManager.getInstance() .getConstants() .youAreAboutChangeDcCompatibilityVersionMsg()); UICommand tempVar = new UICommand("OnSaveInternal", this); tempVar.setTitle(ConstantsManager.getInstance().getConstants().ok()); tempVar.setIsDefault(true); confirmModel.getCommands().add(tempVar); UICommand tempVar2 = new UICommand("CancelConfirmation", this); tempVar2.setTitle(ConstantsManager.getInstance().getConstants().cancel()); tempVar2.setIsCancel(true); confirmModel.getCommands().add(tempVar2); } else if (((storage_pool) getSelectedItem()).getQuotaEnforcementType() == QuotaEnforcementTypeEnum.DISABLED && model.getQuotaEnforceTypeListModel().getSelectedItem() != QuotaEnforcementTypeEnum.DISABLED) { promptNoQuotaAvailable(model.getEntity(), this); } else { OnSaveInternal(); } }

Target:
public void OnSave() { DataCenterModel model = (DataCenterModel) getWindow(); if (!model.Validate()) { return; } if ((model.getIsNew() || model.getEntity() == null) && model.getQuotaEnforceTypeListModel().getSelectedItem() != QuotaEnforcementTypeEnum.DISABLED) { promptNoQuotaInDCMessage(); } else if (!((Version) model.getVersion().getSelectedItem()).equals(((storage_pool) getSelectedItem()).getcompatibility_version())) { ConfirmationModel confirmModel = new ConfirmationModel(); setConfirmWindow(confirmModel); confirmModel.setTitle(ConstantsManager.getInstance() .getConstants() .changeDataCenterCompatibilityVersionTitle()); confirmModel.setHashName("change_data_center_compatibility_version"); confirmModel.setMessage(ConstantsManager.getInstance() .getConstants() .youAreAboutChangeDcCompatibilityVersionMsg()); UICommand tempVar = new UICommand("OnSaveInternal", this); tempVar.setTitle(ConstantsManager.getInstance().getConstants().ok()); tempVar.setIsDefault(true); confirmModel.getCommands().add(tempVar); UICommand tempVar2 = new UICommand("CancelConfirmation", this); tempVar2.setTitle(ConstantsManager.getInstance().getConstants().cancel()); tempVar2.setIsCancel(true); confirmModel.getCommands().add(tempVar2); } else if (((storage_pool) getSelectedItem()).getQuotaEnforcementType() == QuotaEnforcementTypeEnum.DISABLED && model.getQuotaEnforceTypeListModel().getSelectedItem() != QuotaEnforcementTypeEnum.DISABLED) { checkForQuotaInDC(model.getEntity(), this); } else { OnSaveInternal(); } }
Source:
private String getDefaultRemoteName() { String defaultName = ""; boolean onlyOneRemote = syncRepos.size() == 2; if (onlyOneRemote) { defaultName = syncRepos.get(1).getName(); } else { for (SyncRepoEntity repo : syncRepos) if (repo.getName().equals(DEFAULT_REMOTE_NAME)) return DEFAULT_REMOTE_NAME; } return defaultName; }

Target:
private String getDefaultRemoteName() { boolean onlyOneRemote = syncRepos.size() == 2; if (onlyOneRemote) return syncRepos.get(1).getName(); else { for (SyncRepoEntity repo : syncRepos) if (repo.getName().equals(DEFAULT_REMOTE_NAME)) return DEFAULT_REMOTE_NAME; } return ""; }
Source:
public InstructorData(InstructorAttributes instructorAttributes) { this.name = Optional.ofNullable(instructorAttributes.getName()).orElse("DEFAULT_NAME"); }

Target:
public InstructorData(InstructorAttributes instructorAttributes) { this.courseId = instructorAttributes.getCourseId(); this.email = instructorAttributes.getEmail(); this.isDisplayedToStudents = instructorAttributes.isDisplayedToStudents(); this.displayedToStudentsAs = instructorAttributes.getDisplayedName(); this.name = instructorAttributes.getName(); this.joinState = instructorAttributes.isRegistered() ? JoinState.JOINED : JoinState.NOT_JOINED; }
Source:
public ActionResult execute() { String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); String feedbackSessionName = getNonNullRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME); FeedbackSessionAttributes feedbackSession = logic.getFeedbackSession(feedbackSessionName, courseId); if (!feedbackSession.isPublished()) { return new JsonResult("Published email could not be resent " + "as the feedback session is not published.", HttpStatus.SC_BAD_REQUEST); } String usersToEmail = getNonNullRequestParamValue(Const.ParamsNames.SUBMISSION_RESEND_PUBLISHED_EMAIL_USER_LIST); taskQueuer.scheduleFeedbackSessionResendPublishedEmail(courseId, feedbackSessionName, usersToEmail.split(",")); return new JsonResult("Reminders sent"); }

Target:
public ActionResult execute() { String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); String feedbackSessionName = getNonNullRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME); FeedbackSessionAttributes feedbackSession = logic.getFeedbackSession(feedbackSessionName, courseId); if (!feedbackSession.isPublished()) { return new JsonResult("Published email could not be resent " + "as the feedback session is not published.", HttpStatus.SC_BAD_REQUEST); } FeedbackSessionStudentRemindRequest remindRequest = getAndValidateRequestBody(FeedbackSessionStudentRemindRequest.class); String[] usersToEmail = remindRequest.getUsersToRemind(); taskQueuer.scheduleFeedbackSessionResendPublishedEmail(courseId, feedbackSessionName, usersToEmail); return new JsonResult("Reminders sent"); }
Source:
private static SiriusContext fromDAnalysis(DAnalysis dAnalysis) { Session session = SessionManager.INSTANCE.getSession(dAnalysis); return new SiriusContext(dAnalysis, session, null, null, dAnalysis); }

Target:
private static SiriusContext fromDAnalysis(DAnalysis dAnalysis) { Session session = Session.of(dAnalysis).orElse(null); return new SiriusContext(dAnalysis, session, null, null, dAnalysis); }
Source:
public byte[] convert(byte[] key, byte[] oldValue, Metadata oldMetadata, byte[] newValue, Metadata newMetadata, EventType eventType) { int capacity = UnsignedNumeric.sizeUnsignedInt(key.length) + key.length + (newValue != null ? UnsignedNumeric.sizeUnsignedInt(newValue.length) + newValue.length + 8 : 0); if (returnOldValue && oldValue != null) { capacity += UnsignedNumeric.sizeUnsignedInt(oldValue.length) + oldValue.length + 8; } byte[] out = new byte[capacity]; int offset = UnsignedNumeric.writeUnsignedInt(out, 0, key.length); offset += putBytes(key, offset, out); if (newValue != null) { offset += UnsignedNumeric.writeUnsignedInt(out, offset, newValue.length); offset += putBytes(newValue, offset, out); putLong(((NumericVersion) newMetadata.version()).getVersion(), offset, out); } if (returnOldValue && oldValue != null) { offset += UnsignedNumeric.writeUnsignedInt(out, offset, oldValue.length); offset += putBytes(oldValue, offset, out); putLong(((NumericVersion) newMetadata.version()).getVersion(), offset, out); } return out; }

Target:
public byte[] convert(byte[] key, byte[] oldValue, Metadata oldMetadata, byte[] newValue, Metadata newMetadata, EventType eventType) { int capacity = UnsignedNumeric.sizeUnsignedInt(key.length) + key.length + (newValue != null ? UnsignedNumeric.sizeUnsignedInt(newValue.length) + newValue.length + 8 : 0); if (newValue == null && returnOldValue && oldValue != null) { capacity += UnsignedNumeric.sizeUnsignedInt(oldValue.length) + oldValue.length + 8; } byte[] out = new byte[capacity]; int offset = UnsignedNumeric.writeUnsignedInt(out, 0, key.length); offset += putBytes(key, offset, out); if (newValue != null) { offset += UnsignedNumeric.writeUnsignedInt(out, offset, newValue.length); offset += putBytes(newValue, offset, out); putLong(((NumericVersion) newMetadata.version()).getVersion(), offset, out); } if (newValue == null && returnOldValue && oldValue != null) { offset += UnsignedNumeric.writeUnsignedInt(out, offset, oldValue.length); offset += putBytes(oldValue, offset, out); putLong(((NumericVersion) newMetadata.version()).getVersion(), offset, out); } return out; }
Source:
private void waitElementIsStatic(FluentWait<WebDriver> webDriverWait, WebElement webElement) { AtomicInteger dimensionSum = new AtomicInteger(0); webDriverWait.until( (ExpectedCondition<Boolean>) driver -> { Dimension dimension = getAndWaitWebElement(webElement).getSize(); if (dimensionsAreEquivalent(dimensionSum, dimension)) { return true; } else { dimensionSum.set(getDimensionSumWithShift(dimension)); return false; } }); }

Target:
private void waitElementIsStatic(FluentWait<WebDriver> webDriverWait, WebElement webElement) { AtomicInteger sizeHashCode = new AtomicInteger(); webDriverWait.until( (ExpectedCondition<Boolean>) driver -> { Dimension newDimension = getAndWaitWebElement(webElement).getSize(); if (dimensionsAreEquivalent(sizeHashCode, newDimension)) { return true; } else { sizeHashCode.set(getSizeHashCode(newDimension)); return false; } }); }
Source:
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { req.setCharacterEncoding("UTF-8"); String baseURL = req.getRequestURL().toString(); String contentURL = baseURL.replaceFirst(Utils.SERVICE_CONTEXT, ""); String query = req.getQueryString(); if (query != null) contentURL += '?' + query; URL url = new URL(contentURL); URLConnection con = ProxyUtil.getConnection(url); con.setAllowUserInteraction(false); con.setDoInput(true); con.connect(); String contentType; ServletContext context = getServletContext(); String pathInfo = req.getPathInfo(); String mimeType = context.getMimeType(pathInfo); if (mimeType != null && !mimeType.equals("application/xhtml+xml")) { contentType = mimeType; } else { contentType = con.getContentType(); } resp.setContentType(contentType); try (OutputStream out = resp.getOutputStream()) { if (!contentType.equals("application/xhtml+xml") && !contentType.equals("text/html") && !con.getContentType().equals("text/html")) { try (InputStream is = con.getInputStream()) { Utils.transferContent(is, out); out.flush(); } } else { String response = Utils.convertStreamToString(ProxyUtil.getStream(url)); response = Utils.updateResponse(response); try (PrintWriter writer = new PrintWriter(new OutputStreamWriter(out, StandardCharsets.UTF_8))) { writer.write(response); } } } }

Target:
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { req.setCharacterEncoding("UTF-8"); String baseURL = req.getRequestURL().toString(); String contentURL = baseURL.replaceFirst(Utils.SERVICE_CONTEXT, ""); String query = req.getQueryString(); if (query != null) contentURL += '?' + query; URL url = new URL(contentURL); URLConnection con = ProxyUtil.getConnection(url); con.setAllowUserInteraction(false); con.setDoInput(true); con.connect(); String contentType; ServletContext context = getServletContext(); String pathInfo = req.getPathInfo(); String mimeType = context.getMimeType(pathInfo); if (mimeType != null && !mimeType.equals("application/xhtml+xml")) { contentType = mimeType; } else { contentType = con.getContentType(); } resp.setContentType(contentType); @SuppressWarnings("resource") InputStream is = con.getInputStream(); OutputStream out = resp.getOutputStream(); if (!contentType.equals("application/xhtml+xml") && !contentType.equals("text/html") && !con.getContentType().equals("text/html")) { Utils.transferContent(is, out); out.flush(); } else { String response = Utils.convertStreamToString(ProxyUtil.getStream(url)); response = Utils.updateResponse(response); try (PrintWriter writer = new PrintWriter(new OutputStreamWriter(out, StandardCharsets.UTF_8))) { writer.write(response); } } }
Source:
public void testHaltOnException() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(CheckWhichThrowsError.class); final DefaultConfiguration treeWalkerConfig = createModuleConfig(TreeWalker.class); treeWalkerConfig.addChild(checkConfig); final DefaultConfiguration checkerConfig = createRootConfig(treeWalkerConfig); checkerConfig.addChild(treeWalkerConfig); checkerConfig.addAttribute("haltOnException", "true"); final String filePath = getPath("InputChecker.java"); try { verify(checkerConfig, filePath); fail("Exception is expected"); } catch (CheckstyleException ex) { assertEquals("Error message is not expected", "Exception was thrown while processing " + filePath, ex.getMessage()); } }

Target:
public void testHaltOnException() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(CheckWhichThrowsError.class); final String filePath = getPath("InputChecker.java"); try { verify(checkConfig, filePath); fail("Exception is expected"); } catch (CheckstyleException ex) { assertEquals("Error message is not expected", "Exception was thrown while processing " + filePath, ex.getMessage()); } }
Source:
List<StartIdentifiedAtlasDbTransactionResponse> startIdentifiedAtlasDbTransactionBatch(int count) { return AtlasFutures.getUnchecked(autobatcher.apply(count)); }

Target:
List<StartIdentifiedAtlasDbTransactionResponse> startIdentifiedAtlasDbTransactionBatch(int count) { Preconditions.checkArgument(count > 0, "Cannot start 0 or fewer transactions"); return AtlasFutures.getUnchecked(autobatcher.apply(count)); }
Source:
public String generate(Sample sample) throws MisoNamingException, IOException { if (!LimsUtils.isDetailedSample(sample)) { throw new IllegalArgumentException("Can only generate an alias for detailed samples"); } DetailedSample detailed = (DetailedSample) sample; for (DetailedSample parent = detailed.getParent(); parent != null; parent = parent.getParent()) { if (isAliquotSample(parent)) { return addSiblingTag(parent.getAlias(), detailed); } if (isTissueSample(parent)) { if (isTissueSample(detailed) && isIdentitySample(parent.getParent())) { return generateTissueAlias((SampleTissue) detailed, (SampleIdentity) LimsUtils.deproxify(parent.getParent())); } else { return addSiblingTag(parent.getAlias(), detailed); } } if (isIdentitySample(parent)) { if (!isTissueSample(detailed)) throw new IllegalArgumentException("Missing parent tissue"); return generateTissueAlias((SampleTissue) detailed, (SampleIdentity) parent); } } throw new IllegalArgumentException("Cannot generate alias for Identities"); }

Target:
public String generate(Sample sample) throws MisoNamingException, IOException { if (!LimsUtils.isDetailedSample(sample)) { throw new IllegalArgumentException("Can only generate an alias for detailed samples"); } DetailedSample detailed = (DetailedSample) sample; for (DetailedSample parent = detailed.getParent(); parent != null; parent = parent.getParent()) { if (isAliquotSample(parent)) { return addSiblingTag(parent.getAlias(), detailed); } if (isTissueSample(parent)) { if (isTissueSample(detailed)) { return generateTissueAlias((SampleTissue) detailed, LimsUtils.getParent(SampleIdentity.class, parent)); } else { return addSiblingTag(parent.getAlias(), detailed); } } if (isIdentitySample(parent)) { if (!isTissueSample(detailed)) throw new IllegalArgumentException("Missing parent tissue"); return generateTissueAlias((SampleTissue) detailed, (SampleIdentity) parent); } } throw new IllegalArgumentException("Cannot generate alias for Identities"); }
Source:
private void joinHelper(ETLStage filmStage, ETLStage filmActorStage, ETLStage filmCategoryStage, ETLStage joinStage, ETLStage joinSinkStage, String filmDatasetName, String filmActorDatasetName, String filmCategoryDatasetName, String joinedDatasetName, Schema outputSchema, BiFunction<Schema, TimePartitionedFileSet, Void> verifyOutput) throws Exception { ETLBatchConfig config = ETLBatchConfig.builder("* * * * *") .addStage(filmStage) .addStage(filmActorStage) .addStage(filmCategoryStage) .addStage(joinStage) .addStage(joinSinkStage) .addConnection(filmStage.getName(), joinStage.getName()) .addConnection(filmActorStage.getName(), joinStage.getName()) .addConnection(filmCategoryStage.getName(), joinStage.getName()) .addConnection(joinStage.getName(), joinSinkStage.getName()) .build(); ApplicationManager appManager = deployETL(config, "joiner-test"); ingestToFilmTable(filmDatasetName); ingestToFilmActorTable(filmActorDatasetName); ingestToFilmCategoryTable(filmCategoryDatasetName); runETLOnce(appManager); DataSetManager<TimePartitionedFileSet> outputManager = getDataset(joinedDatasetName); TimePartitionedFileSet fileSet = outputManager.get(); verifyOutput.apply(outputSchema, fileSet); }

Target:
private void joinHelper(ETLStage filmStage, ETLStage filmActorStage, ETLStage filmCategoryStage, ETLStage joinStage, ETLStage joinSinkStage, String filmDatasetName, String filmActorDatasetName, String filmCategoryDatasetName, String joinedDatasetName, Schema outputSchema, BiFunction<Schema, TimePartitionedFileSet, Void> verifyOutput) throws Exception { ETLBatchConfig config = ETLBatchConfig.builder() .addStage(filmStage) .addStage(filmActorStage) .addStage(filmCategoryStage) .addStage(joinStage) .addStage(joinSinkStage) .addConnection(filmStage.getName(), joinStage.getName()) .addConnection(filmActorStage.getName(), joinStage.getName()) .addConnection(filmCategoryStage.getName(), joinStage.getName()) .addConnection(joinStage.getName(), joinSinkStage.getName()) .build(); ApplicationManager appManager = deployETL(config, UUID.randomUUID().toString()); ingestToFilmTable(filmDatasetName); ingestToFilmActorTable(filmActorDatasetName); ingestToFilmCategoryTable(filmCategoryDatasetName); runETLOnce(appManager); DataSetManager<TimePartitionedFileSet> outputManager = getDataset(joinedDatasetName); TimePartitionedFileSet fileSet = outputManager.get(); verifyOutput.apply(outputSchema, fileSet); }
Source:
protected void meetSP(final StatementPattern node) throws Exception { final Var subVar = node.getSubjectVar(); final Var predVar = node.getPredicateVar(); final Var objVar = node.getObjectVar(); final Var conVar = node.getContextVar(); if (predVar != null && objVar != null && objVar.getValue() != null && RDF.TYPE.equals(predVar.getValue()) && !EXPANDED.equals(conVar)) { final URI object = (URI) objVar.getValue(); if (inferenceEngine.isEnumeratedType(object)) { final Set<BindingSet> solutions = new LinkedHashSet<>(); final Set<Resource> enumeration = inferenceEngine.getEnumeration(object); if (enumeration != null && !enumeration.isEmpty()) { for (final Resource enumType : enumeration) { final QueryBindingSet qbs = new QueryBindingSet(); qbs.addBinding(subVar.getName(), enumType); solutions.add(qbs); } if (!solutions.isEmpty()) { final BindingSetAssignment enumNode = new BindingSetAssignment(); enumNode.setBindingSets(solutions); node.replaceWith(enumNode); log.trace("Replacing node with inferred one of enumeration: " + enumNode); } } } } }

Target:
protected void meetSP(final StatementPattern node) throws Exception { final Var subVar = node.getSubjectVar(); final Var predVar = node.getPredicateVar(); final Var objVar = node.getObjectVar(); final Var conVar = node.getContextVar(); if (predVar != null && objVar != null && objVar.getValue() != null && objVar.getValue() instanceof Resource && RDF.TYPE.equals(predVar.getValue()) && !EXPANDED.equals(conVar)) { final Resource object = (Resource) objVar.getValue(); if (inferenceEngine.isEnumeratedType(object)) { final Set<BindingSet> solutions = new LinkedHashSet<>(); final Set<Resource> enumeration = inferenceEngine.getEnumeration(object); for (final Resource enumType : enumeration) { final QueryBindingSet qbs = new QueryBindingSet(); qbs.addBinding(subVar.getName(), enumType); solutions.add(qbs); } if (!solutions.isEmpty()) { final BindingSetAssignment enumNode = new BindingSetAssignment(); enumNode.setBindingSets(solutions); node.replaceWith(enumNode); log.trace("Replacing node with inferred one of enumeration: " + enumNode); } } } }
Source:
synchronized void completeRequest() { List<Map<Address, CacheEntry<K, V>>> retVal = keyReplicaMap.entrySet().stream() .map(Map.Entry::getValue) .collect(Collectors.toList()); clear(); future.complete(Collections.unmodifiableList(retVal)); }

Target:
synchronized void completeRequest() { List<Map<Address, CacheEntry<K, V>>> retVal = new ArrayList<>(keyReplicaMap.values()); clear(); future.complete(Collections.unmodifiableList(retVal)); }
Source:
public void writeHeader(final VCFHeader header) { if (isHeaderWritten) { throw new IllegalStateException("Header is already written"); } try { setVcfHeader(header); writeHeader(header, writer, getVersionLine(), getStreamName()); writeAndResetBuffer(); isHeaderWritten = true; } catch ( IOException e ) { throw new RuntimeIOException("Couldn't write file " + getStreamName(), e); } }

Target:
public void writeHeader(final VCFHeader header) { setVCFHeader(header); try { writeHeader(this.mHeader, writer, getVersionLine(), getStreamName()); writeAndResetBuffer(); outputHasBeenWritten = true; } catch ( IOException e ) { throw new RuntimeIOException("Couldn't write file " + getStreamName(), e); } }
Source:
public void resolveSymbolicRef() throws IOException { Reftable t = read(write( sym(HEAD, "refs/heads/tmp"), sym("refs/heads/tmp", MASTER), ref(MASTER, 1))); Ref head = t.exactRef(HEAD); assertNull(head.getObjectId()); assertEquals("refs/heads/tmp", head.getTarget().getName()); head = t.resolve(head); assertNotNull(head); assertEquals(id(1), head.getObjectId()); }

Target:
public void resolveSymbolicRef() throws IOException { Reftable t = read(write( sym(HEAD, "refs/heads/tmp"), sym("refs/heads/tmp", MASTER), ref(MASTER, 1))); Ref head = t.exactRef(HEAD); assertNull(head.getObjectId()); assertEquals("refs/heads/tmp", head.getTarget().getName()); head = t.resolve(head); assertNotNull(head); assertEquals(id(1), head.getObjectId()); Ref master = t.exactRef(MASTER); assertNotNull(master); assertSame(master, t.resolve(master)); }
Source:
public boolean apply(Game game, Ability source) { boolean result = false; switch (game.getState().getZone(source.getSourceId())) { case BATTLEFIELD: Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null && source.getSourceObjectZoneChangeCounter() == permanent.getZoneChangeCounter(game)) { result |= permanent.moveToZone(Zone.LIBRARY, source.getSourceId(), game, onTop); } case GRAVEYARD: Card card = game.getCard(source.getSourceId()); if (card != null && source.getSourceObjectZoneChangeCounter() == card.getZoneChangeCounter(game)) { for (Player player : game.getPlayers().values()) { if (player.getGraveyard().contains(card.getId())) { player.getGraveyard().remove(card); result |= card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, onTop); } } } } return result; }

Target:
public boolean apply(Game game, Ability source) { MageObject sourceObject = source.getSourceObjectIfItStillExists(game); if (sourceObject == null) { return false; } if (sourceObject instanceof Permanent) { ((Permanent) sourceObject).moveToZone(Zone.LIBRARY, source.getSourceId(), game, onTop); return true; } else if (sourceObject instanceof Card && game.getState().getZone(source.getSourceId()) == Zone.GRAVEYARD) { for (Player player : game.getPlayers().values()) { if (player.getGraveyard().contains(sourceObject.getId())) { player.getGraveyard().remove(((Card) sourceObject)); ((Card) sourceObject).moveToZone(Zone.LIBRARY, source.getSourceId(), game, onTop); return true; } } } return false; }
Source:
protected PortObject[] execute(PortObject[] inObjects, ExecutionContext exec) throws Exception { String filename = m_directory_name.getStringValue(); List<URIContent> uris = new ArrayList<URIContent>(); File in = new File(convertToURL(filename).toURI()); if (!in.canRead()) { throw new Exception("Cannot read from input file: " + in.getAbsolutePath()); } String prefix = filename; if (filename.contains(".")) { prefix = prefix.split("\\.",2)[0]; } List<File> files_list_ext = listf(filename); if (files_list_ext.isEmpty()) { throw new Exception("Could not find files"); } for (File file : files_list_ext) { uris.add(new URIContent(file.toURI(), FilenameUtils.getExtension(file.toString()))); } IPrefixURIPortObject uri_prefix_object = null; uri_prefix_object = new PrefixURIPortObject(uris, prefix); return new PortObject[] { (URIPortObject) uri_prefix_object }; }

Target:
protected PortObject[] execute(PortObject[] inObjects, ExecutionContext exec) throws Exception { String directoryname = m_directory_name.getStringValue(); List<URIContent> uris = new ArrayList<URIContent>(); File in = new File(convertToURL(directoryname).toURI()); if (!in.canRead()) { throw new Exception("Cannot read from input file: " + in.getAbsolutePath()); } String prefix = directoryname; if (directoryname.contains(".")) { prefix = prefix.split("\\.",2)[0]; } List<File> files_list_ext = listf(directoryname); if (files_list_ext.isEmpty()) { throw new Exception("Could not find any files in the selected directory"); } for (File file : files_list_ext) { uris.add(new URIContent(file.toURI(), FilenameUtils.getExtension(file.toString()))); } IPrefixURIPortObject uri_prefix_object = null; uri_prefix_object = new PrefixURIPortObject(uris, prefix); return new PortObject[] { (URIPortObject) uri_prefix_object }; }
Source:
@Test public void invalidCenterInside() { try { new RequestBuilder().centerInside(); fail("Center inside without resize should throw exception."); } catch (IllegalStateException expected) { } try { new RequestBuilder().centerInside().centerCrop(); fail("Calling center inside after center crop should throw exception."); } catch (IllegalStateException expected) { } }

Target:
@Test public void invalidCenterInside() { try { new RequestBuilder().centerInside(); fail("Center inside without resize should throw exception."); } catch (IllegalStateException expected) { } try { new RequestBuilder().resize(10, 10).centerInside().centerCrop(); fail("Calling center inside after center crop should throw exception."); } catch (IllegalStateException expected) { } }
Source:
private boolean isColdReboot() { boolean coldReboot = (getVm().isRunOnce() && !getVm().isVolatileRun()) || getVm().isNextRunConfigurationExists(); log.info("VM '{}' is performing reboot; run once: '{}', running as volatile: '{}', has next run configuration: '{}'", getVm().getName(), coldReboot ? "cold" : "warm", getVm().isRunOnce(), getVm().isVolatileRun(), getVm().isNextRunConfigurationExists()); return coldReboot; }

Target:
private boolean isColdReboot() { boolean coldReboot = (getVm().isRunOnce() && getVm().isVolatileRun()) || getVm().isNextRunConfigurationExists(); log.info("VM '{}' is performing reboot; run once: '{}', running as volatile: '{}', has next run configuration: '{}'", getVm().getName(), coldReboot ? "cold" : "warm", getVm().isRunOnce(), getVm().isVolatileRun(), getVm().isNextRunConfigurationExists()); return coldReboot; }
Source:
public void truncatePutJob() throws Exception { final int testTimeOutSeconds = 5; final String book1 = "beowulf.txt"; final Path objPath1 = ResourceUtils.loadFileResource(RESOURCE_BASE_NAME + book1); final Ds3Object obj1 = new Ds3Object(book1, Files.size(objPath1)); final Ds3Object obj2 = new Ds3Object("place_holder", 5000000); try { final Ds3ClientHelpers.Job putJob = HELPERS.startWriteJob(BUCKET_NAME, Lists.newArrayList(obj1, obj2)); final UUID jobId = putJob.getJobId(); final SeekableByteChannel book1Channel = new ResourceObjectPutter(RESOURCE_BASE_NAME).buildChannel(book1); client.putObject(new PutObjectRequest(BUCKET_NAME, book1, book1Channel, jobId, 0, Files.size(objPath1))); ABMTestHelper.waitForJobCachedSizeToBeMoreThanZero(jobId, client, 20); final TruncateJobSpectraS3Response failedResponse = client.truncateJobSpectraS3( new TruncateJobSpectraS3Request(jobId.toString())); assertThat(failedResponse.getStatusCode(),is(204)); final GetJobSpectraS3Response truncatedJob = client.getJobSpectraS3(new GetJobSpectraS3Request(jobId.toString())); assertEquals(truncatedJob.getMasterObjectListResult().getOriginalSizeInBytes(), Files.size(objPath1)); } finally { deleteAllContents(client, BUCKET_NAME); } }

Target:
public void truncatePutJob() throws Exception { final int testTimeOutSeconds = 5; final String book1 = "beowulf.txt"; final Path objPath1 = ResourceUtils.loadFileResource(RESOURCE_BASE_NAME + book1); final Ds3Object obj1 = new Ds3Object(book1, Files.size(objPath1)); final Ds3Object obj2 = new Ds3Object("place_holder", 5000000); try { final Ds3ClientHelpers.Job putJob = HELPERS.startWriteJob(BUCKET_NAME, Lists.newArrayList(obj1, obj2)); final UUID jobId = putJob.getJobId(); final SeekableByteChannel book1Channel = new ResourceObjectPutter(RESOURCE_BASE_NAME).buildChannel(book1); client.putObject(new PutObjectRequest(BUCKET_NAME, book1, book1Channel, jobId, 0, Files.size(objPath1))); ABMTestHelper.waitForJobCachedSizeToBeMoreThanZero(jobId, client, 20); final TruncateJobSpectraS3Response truncateJobSpectraS3Response = client.truncateJobSpectraS3( new TruncateJobSpectraS3Request(jobId.toString())); assertThat(truncateJobSpectraS3Response.getStatusCode(),is(204)); final GetJobSpectraS3Response truncatedJob = client.getJobSpectraS3(new GetJobSpectraS3Request(jobId.toString())); assertEquals(truncatedJob.getMasterObjectListResult().getOriginalSizeInBytes(), Files.size(objPath1)); } finally { deleteAllContents(client, BUCKET_NAME); } }
Source:
public void getValueFromEntity(CallingContext cc) throws ODKDatastoreException { DynamicBase rel = (DynamicBase) repeatGroup.getFormDataModel().getBackingObjectPrototype(); Query q = cc.getDatastore().createQuery(rel, "RepeatSubmissionType.getValueFromEntity", cc.getCurrentUser()); q.addFilter(rel.parentAuri, FilterOperation.EQUAL, uriAssociatedRow); q.addSort(rel.parentAuri, Direction.ASCENDING); q.addSort(rel.ordinalNumber, Direction.ASCENDING); long maxOrdinalNumber = 0; Map<Long, List<DynamicBase>> rowsPerOrdinalNumber = new HashMap<>(); for (CommonFieldsBase cb : q.executeQuery()) { DynamicBase db = (DynamicBase) cb; Long ordinalNumber = db.getOrdinalNumber(); maxOrdinalNumber = Math.max(maxOrdinalNumber, ordinalNumber); if (!rowsPerOrdinalNumber.containsKey(ordinalNumber)) rowsPerOrdinalNumber.put(ordinalNumber, new ArrayList<DynamicBase>()); rowsPerOrdinalNumber.get(ordinalNumber).add(db); } if (rowsPerOrdinalNumber.size() != maxOrdinalNumber) LOGGER.error("Repeat table " + rel.getTableName() + " has dupes or missing rows for top level auri " + rel.getTopLevelAuri() + " and parent auri " + rel.getParentAuri()); for (List<DynamicBase> dbs : rowsPerOrdinalNumber.values()) submissionSets.add(new SubmissionSet(enclosingSet, chooseOne(dbs), repeatGroup, form, cc)); }

Target:
public void getValueFromEntity(CallingContext cc) throws ODKDatastoreException { DynamicBase submission = (DynamicBase) repeatGroup.getFormDataModel().getBackingObjectPrototype(); List<CommonFieldsBase> repeatRows = getRepeatRows(cc, submission); for (List<DynamicBase> groupOfRepeatRows : groupPerOrdinalNumber(submission, repeatRows)) submissionSets.add(new SubmissionSet(enclosingSet, chooseOneFrom(groupOfRepeatRows), repeatGroup, form, cc)); }
Source:
public static Metric from(String fullName, double value, MetricType metricType) { String[] pieces = fullName.split("\\."); Preconditions.checkArgument(pieces.length > 1, "Incorrect metrics name: %s.", fullName); int len = pieces.length; String hostname = null; int tagEndIndex = len; if (!pieces[0].equals(MetricsSystem.InstanceType.MASTER.toString()) && !pieces[0].equals(MetricsSystem.CLUSTER)) { hostname = pieces[len - 1]; tagEndIndex = len - 1; } MetricsSystem.InstanceType instance = MetricsSystem.InstanceType.fromString(pieces[0]); Metric metric = new Metric(instance, hostname, metricType, pieces[1], value); for (int i = 2; i < tagEndIndex; i++) { String tagStr = pieces[i]; if (!tagStr.contains(TAG_SEPARATOR)) { continue; } int tagSeparatorIdx = tagStr.indexOf(TAG_SEPARATOR); metric.addTag(tagStr.substring(0, tagSeparatorIdx), tagStr.substring(tagSeparatorIdx + 1)); } return metric; }

Target:
public static Metric from(String fullName, double value, MetricType metricType) { String[] pieces = fullName.split("\\."); Preconditions.checkArgument(pieces.length > 1, "Incorrect metrics name: %s.", fullName); int len = pieces.length; String source = null; int tagEndIndex = len; if (!pieces[0].equals(MetricsSystem.InstanceType.MASTER.toString()) && !pieces[0].equals(MetricsSystem.CLUSTER)) { source = pieces[len - 1]; tagEndIndex = len - 1; } MetricsSystem.InstanceType instance = MetricsSystem.InstanceType.fromString(pieces[0]); Metric metric = new Metric(instance, source, metricType, pieces[1], value); for (int i = 2; i < tagEndIndex; i++) { String tagStr = pieces[i]; if (!tagStr.contains(TAG_SEPARATOR)) { continue; } int tagSeparatorIdx = tagStr.indexOf(TAG_SEPARATOR); metric.addTag(tagStr.substring(0, tagSeparatorIdx), tagStr.substring(tagSeparatorIdx + 1)); } return metric; }
Source:
public void generateChunk(CoreChunk chunk, Region chunkRegion) { FloraFacet facet = chunkRegion.getFacet(FloraFacet.class); Block air = BlockManager.getAir(); Random rng = new FastRandom(chunk.getPosition().hashCode()); Map<Vector3i, FloraType> entries = facet.getRelativeEntries(); for (Vector3i pos : entries.keySet()) { if (chunk.getBlock(pos).equals(air)) { FloraType type = entries.get(pos); Block block = getBlock(rng, type); chunk.setBlock(pos, block); } } }

Target:
public void generateChunk(CoreChunk chunk, Region chunkRegion) { FloraFacet facet = chunkRegion.getFacet(FloraFacet.class); Block air = BlockManager.getAir(); NoiseTable noise = new NoiseTable(chunk.getPosition().hashCode()); Map<Vector3i, FloraType> entries = facet.getRelativeEntries(); for (Vector3i pos : entries.keySet()) { if (chunk.getBlock(pos).equals(air)) { FloraType type = entries.get(pos); List<Block> list = flora.get(type); int blockIdx = noise.noise(pos.x, pos.y, pos.z) % list.size(); Block block = list.get(blockIdx); chunk.setBlock(pos, block); } } }
Source:
public CreateServerWithKeyPair(String username, String apiKey) { Iterable<Module> modules = ImmutableSet.<Module> of(new SshjSshClientModule()); Properties overrides = new Properties(); overrides.setProperty(POLL_INITIAL_PERIOD, POLL_PERIOD_TWENTY_SECONDS); overrides.setProperty(POLL_MAX_PERIOD, POLL_PERIOD_TWENTY_SECONDS); ComputeServiceContext context = ContextBuilder.newBuilder(PROVIDER) .credentials(username, apiKey) .overrides(overrides) .modules(modules) .buildView(ComputeServiceContext.class); computeService = context.getComputeService(); nova = computeService.getContext().unwrap(); }

Target:
public CreateServerWithKeyPair(String username, String apiKey) { Iterable<Module> modules = ImmutableSet.<Module> of(new SshjSshClientModule()); Properties overrides = new Properties(); overrides.setProperty(POLL_INITIAL_PERIOD, POLL_PERIOD_TWENTY_SECONDS); overrides.setProperty(POLL_MAX_PERIOD, POLL_PERIOD_TWENTY_SECONDS); ComputeServiceContext context = ContextBuilder.newBuilder(PROVIDER) .credentials(username, apiKey) .overrides(overrides) .modules(modules) .buildView(ComputeServiceContext.class); computeService = context.getComputeService(); novaContext = context.unwrap(); }
Source:
public MongoDbOutboundGatewaySpec queryExpression(String queryExpression) { this.mongoDbOutboundGateway.setMongoDbQueryExpression(PARSER.parseExpression(queryExpression)); return this; }

Target:
public MongoDbOutboundGatewaySpec queryExpression(String queryExpression) { this.target.setQueryExpressionString(queryExpression); return this; }
Source:
public void removeShare() throws VersionException, LockException, ConstraintViolationException, RepositoryException { checkSession(); AbstractJcrNode parent = null; try { parent = getParent(); } catch (ItemNotFoundException e) { throw new InvalidItemStateException(e); } Path path = null; try { parent.checkForLock(); path = path(); session.addContextData(JCR_CONTENT, JCR_CONTENT); session.checkPermission(path, ModeShapePermissions.REMOVE); session.checkPermission(parent.getPath(), ModeShapePermissions.REMOVE_CHILD_NODES); } catch (NodeNotFoundInParentException e) { throw new InvalidItemStateException(e); } if (!parent.isCheckedOut()) { NodeDefinition defn = getDefinition(); int opv = defn.getOnParentVersion(); if (opv != OnParentVersionAction.IGNORE) { String opvStr = OnParentVersionAction.nameFromValue(opv); I18n msg = JcrI18n.cannotRemoveChildOnCheckedInNodeSinceOpvOfChildDefinitionIsNotIgnore; throw new VersionException(msg.text(path, defn.getName(), opvStr)); } } doRemove(); }

Target:
public void removeShare() throws VersionException, LockException, ConstraintViolationException, RepositoryException { checkSession(); AbstractJcrNode parent = null; try { parent = getParent(); } catch (ItemNotFoundException e) { throw new InvalidItemStateException(e); } Path path = null; try { parent.checkForLock(); path = path(); session.checkPermission(path, ModeShapePermissions.REMOVE); session.checkPermission(parent.getPath(), ModeShapePermissions.REMOVE_CHILD_NODES); } catch (NodeNotFoundInParentException e) { throw new InvalidItemStateException(e); } if (!parent.isCheckedOut()) { NodeDefinition defn = getDefinition(); int opv = defn.getOnParentVersion(); if (opv != OnParentVersionAction.IGNORE) { String opvStr = OnParentVersionAction.nameFromValue(opv); I18n msg = JcrI18n.cannotRemoveChildOnCheckedInNodeSinceOpvOfChildDefinitionIsNotIgnore; throw new VersionException(msg.text(path, defn.getName(), opvStr)); } } doRemove(); }
Source:
private Sequence<Row> postAggregate(final GroupByQuery query, IncrementalIndex index) { return Sequences.simple(index.iterableWithPostAggregations(query.getPostAggregatorSpecs())); }

Target:
private Sequence<Row> postAggregate(final GroupByQuery query, IncrementalIndex index) { return Sequences.map( Sequences.simple(index.iterableWithPostAggregations(query.getPostAggregatorSpecs())), new Function<Row, Row>() { @Override public Row apply(Row input) { final MapBasedRow row = (MapBasedRow) input; return new MapBasedRow( query.getGranularity() .toDateTime(row.getTimestampFromEpoch()), row.getEvent() ); } } ); }
Source:
public void stop() { if (scheduledTask != null) { scheduledTask.cancel(true); } }

Target:
public void stop() { }