auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static Change.Id changeIdFromDraftComments(String refName) { int d = refName.lastIndexOf('-'); return new Change.Id(Integer.parseInt(refName.substring(d + 1), 10)); }

Target:
public static Change.Id changeIdFromDraftComments(String refName) { int d = refName.lastIndexOf('-'); return new Change.Id(Integer.parseInt(refName.substring(d + 1))); }
Source:
protected List<String> getRequiredBundles() { String orgEclipseUiPluginId = getProjectInfo().isRapOption() ? "org.eclipse.rap.ui" : "org.eclipse.ui" ; String orgEclipseEmfParsleyViewsPluginId = getProjectInfo().isRapOption() ? "org.eclipse.emf.parsley.rap.views" : EmfParsleyViewsActivator.PLUGIN_ID ; return Lists.newArrayList( "org.eclipse.core.runtime", orgEclipseUiPluginId, orgEclipseEmfParsleyViewsPluginId, "org.eclipse.xtext.xbase.lib"); }

Target:
protected List<String> getRequiredBundles() { String orgEclipseUiPluginId = getProjectInfo().isRapOption() ? "org.eclipse.rap.ui;resolution:=optional" : "org.eclipse.ui" ; String orgEclipseEmfParsleyViewsPluginId = getProjectInfo().isRapOption() ? "org.eclipse.emf.parsley.rap.views;resolution:=optional" : EmfParsleyViewsActivator.PLUGIN_ID ; return Lists.newArrayList( "org.eclipse.core.runtime", orgEclipseUiPluginId, orgEclipseEmfParsleyViewsPluginId, "org.eclipse.xtext.xbase.lib"); }
Source:
public void refreshCustomizedViewMap(final HelixDataAccessor accessor) { if (_propertyDataChangedMap.get(HelixConstants.ChangeType.CUSTOMIZED_VIEW).getAndSet(false)) { for (String stateType : _aggregationEnabledTypes) { if (!_customizedViewCacheMap.containsKey(stateType)) { CustomizedViewCache newCustomizedViewCache = new CustomizedViewCache(getClusterName(), stateType); _customizedViewCacheMap.put(stateType, newCustomizedViewCache); } _customizedViewCacheMap.get(stateType).refresh(accessor); } Set<String> previousCachedStateTypes = new HashSet<>(_customizedViewCacheMap.keySet()); previousCachedStateTypes.removeAll(_aggregationEnabledTypes); logger.info("Remove customizedView for state: " + previousCachedStateTypes); removeCustomizedViewTypes(new ArrayList<>(previousCachedStateTypes)); } }

Target:
public void refreshCustomizedViewMap(final HelixDataAccessor accessor) { if (_propertyDataChangedMap.get(HelixConstants.ChangeType.CUSTOMIZED_VIEW).getAndSet(false)) { for (String stateType : _aggregationEnabledTypes) { if (!_customizedViewCacheMap.containsKey(stateType)) { CustomizedViewCache newCustomizedViewCache = new CustomizedViewCache(getClusterName(), stateType); _customizedViewCacheMap.put(stateType, newCustomizedViewCache); } _customizedViewCacheMap.get(stateType).refresh(accessor); } Set<String> previousCachedStateTypes = new HashSet<>(_customizedViewCacheMap.keySet()); previousCachedStateTypes.removeAll(_aggregationEnabledTypes); logger.info("Remove customizedView for state: " + previousCachedStateTypes); removeCustomizedViewTypes(previousCachedStateTypes); } }
Source:
public void testDSLPhrase() throws Exception { try ( Session session = openSession() ) { FullTextSession fullTextSession = Search.getFullTextSession( session ); final QueryBuilder queryBuilder = queryBuilder( fullTextSession ); Query query = queryBuilder .phrase() .onField( "message" ) .sentence( "A very important matter" ) .createQuery(); FullTextQuery fullTextQuery = fullTextSession.createFullTextQuery( query, Letter.class ); String queryString = fullTextQuery.getQueryString(); assertThat( queryString ).isEqualTo( "{\"query\":{\"match_phrase\":{\"message\":{\"query\":\"very important matter\",\"slop\":0,\"boost\":1.0}}}}" ); } }

Target:
public void testDSLPhrase() throws Exception { try ( Session session = openSession() ) { FullTextSession fullTextSession = Search.getFullTextSession( session ); final QueryBuilder queryBuilder = queryBuilder( fullTextSession ); Query query = queryBuilder .phrase() .onField( "message" ) .sentence( "A very important matter" ) .createQuery(); FullTextQuery fullTextQuery = fullTextSession.createFullTextQuery( query, Letter.class ); String queryString = fullTextQuery.getQueryString(); assertJsonEquals( "{'query':{'match_phrase':{'message':{'query':'very important matter','slop':0,'boost':1.0}}}}", queryString ); } }
Source:
public void before() { defaultLocale = Locale.getDefault(Locale.Category.FORMAT); Locale.setDefault(Locale.Category.FORMAT, Locale.US); }

Target:
public void before() { originalFormatLocale = Locale.getDefault(Locale.Category.FORMAT); originalDefaultLocale = Locale.getDefault(); Locale.setDefault(Locale.GERMANY); Locale.setDefault(Locale.Category.FORMAT, Locale.US); }
Source:
private static FolderSelectedStateCommand optimizeGroupings(FolderSelectedStateCommand command) { Set<Long> idSet = command.getIdSet(); List<ContiguousIdGroup> idGroups = command.getIdGroups(); if (idGroups != null && idGroups.get(0).getEnd() == ContiguousIdGroup.LAST_ID) { return command; } TreeSet<Long> fullIdSet = new TreeSet<>(); if (idSet != null) { fullIdSet.addAll(command.idSet); } if (idGroups != null) { for (ContiguousIdGroup idGroup : idGroups) { for (long i = idGroup.getStart();i <= idGroup.getEnd();i++) { fullIdSet.add(i); } } } Builder builder = command.newBuilder() .idSet(null) .idRanges(null); List<Long> idList = new ArrayList<>(fullIdSet); int start = 0; for (int i = 1; i < idList.size();i++) { if (idList.get(i - 1) + 1 != idList.get(i)) { checkAndAddIds(builder, idList, start, i - 1); start = i; } } checkAndAddIds(builder, idList, start, idList.size() - 1); FolderSelectedStateCommand tempCommand = builder.build(); command.setIdSet(tempCommand.getIdSet()); command.setIdGroups(tempCommand.getIdGroups()); return command; }

Target:
static void optimizeGroupings(FolderSelectedStateCommand command) { Set<Long> idSet = command.getIdSet(); List<ContiguousIdGroup> idGroups = command.getIdGroups(); if (idSet.isEmpty() && idGroups.isEmpty()) { return; } if (idGroups.size() == 1 && idGroups.get(0).getEnd() == ContiguousIdGroup.LAST_ID) { return; } TreeSet<Long> fullIdSet = new TreeSet<>(); fullIdSet.addAll(idSet); for (ContiguousIdGroup idGroup : idGroups) { for (long i = idGroup.getStart();i <= idGroup.getEnd();i++) { fullIdSet.add(i); } } command.clearIds(); List<Long> idList = new ArrayList<>(fullIdSet); int start = 0; for (int i = 1; i < idList.size();i++) { if (idList.get(i - 1) + 1 != idList.get(i)) { checkAndAddIds(command, idList, start, i - 1); start = i; } } checkAndAddIds(command, idList, start, idList.size() - 1); }
Source:
private void bindViewHolderToResponseRow(DiscussionResponseViewHolder holder, final int position) { final DiscussionComment comment = discussionResponses.get(position - 1); holder.responseCommentBodyTextView.setText(DiscussionTextUtils.parseHtml(comment.getRenderedBody())); holder.addCommentLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (0 == comment.getChildren().size()) { router.showCourseDiscussionAddComment(context, comment); } else { router.showCourseDiscussionComments(context, comment); } } }); holder.authorLayoutViewHolder.setAuthorData(comment); bindNumberCommentsView(holder.numberResponsesViewHolder, comment); final int positionInResponses = position - 1; bindSocialView(holder.socialLayoutViewHolder, positionInResponses, comment); holder.discussionReportViewHolder.reportLayout.setOnClickListener(new View.OnClickListener() { public void onClick(final View v) { FlagCommentTask task = new FlagCommentTask(context, comment, !comment.isAbuseFlagged()) { @Override public void onSuccess(DiscussionComment comment) { if (comment != null) { discussionResponses.remove(positionInResponses); discussionResponses.add(positionInResponses, comment); notifyDataSetChanged(); } } @Override public void onException(Exception ex) { logger.error(ex); } }; task.execute(); } }); holder.discussionReportViewHolder.setReported(comment.isAbuseFlagged()); holder.socialLayoutViewHolder.threadFollowContainer.setVisibility(View.INVISIBLE); }

Target:
private void bindViewHolderToResponseRow(DiscussionResponseViewHolder holder, final int position) { final DiscussionComment comment = discussionResponses.get(position - 1); holder.responseCommentBodyTextView.setText(DiscussionTextUtils.parseHtml(comment.getRenderedBody())); holder.addCommentLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (comment.getChildren().isEmpty()) { router.showCourseDiscussionAddComment(context, comment); } else { router.showCourseDiscussionComments(context, comment); } } }); holder.authorLayoutViewHolder.setAuthorData(comment); bindNumberCommentsView(holder.numberResponsesViewHolder, comment); final int positionInResponses = position - 1; bindSocialView(holder.socialLayoutViewHolder, positionInResponses, comment); holder.discussionReportViewHolder.reportLayout.setOnClickListener(new View.OnClickListener() { public void onClick(final View v) { FlagCommentTask task = new FlagCommentTask(context, comment, !comment.isAbuseFlagged()) { @Override public void onSuccess(DiscussionComment comment) { if (comment != null) { discussionResponses.remove(positionInResponses); discussionResponses.add(positionInResponses, comment); notifyDataSetChanged(); } } @Override public void onException(Exception ex) { logger.error(ex); } }; task.execute(); } }); holder.discussionReportViewHolder.setReported(comment.isAbuseFlagged()); holder.socialLayoutViewHolder.threadFollowContainer.setVisibility(View.INVISIBLE); }
Source:
public static IndexPredicateAnalyzer createAnalyzer(boolean equalOnly) { IndexPredicateAnalyzer analyzer = new IndexPredicateAnalyzer(); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPEqual"); if (equalOnly) { return analyzer; } analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPEqualOrGreaterThan"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPEqualOrLessThan"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPLessThan"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPGreaterThan"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPNotEqual"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFBetween"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFIn"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFIn"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPNull"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPNotNull"); return analyzer; }

Target:
public static IndexPredicateAnalyzer createAnalyzer(boolean equalOnly) { IndexPredicateAnalyzer analyzer = new IndexPredicateAnalyzer(); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPEqual"); if (equalOnly) { return analyzer; } analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic" + ".GenericUDFOPEqualOrGreaterThan"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic" + ".GenericUDFOPEqualOrLessThan"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPLessThan"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPGreaterThan"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPNotEqual"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFBetween"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFIn"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFIn"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPNull"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPNotNull"); return analyzer; }
Source:
public void resourceOffers(SchedulerDriver driver, List<Protos.Offer> offers) { synchronized (_offersLock) { if (_offers == null) { return; } LOG.debug("resourceOffers: Currently have offers buffered {}", _offers.size(), (_offers.size() > 0 ? (":" + offerMapToString(_offers)) : "")); for (Protos.Offer offer : offers) { if (isHostAccepted(offer.getHostname())) { LOG.debug("resourceOffers: Recording offer from host: {}, offerId: {}", offer.getHostname(), offer.getId().getValue()); _offers.put(offer.getId(), offer); } else { LOG.debug("resourceOffers: Declining offer from host: offerId: {}", offer.getHostname(), offer.getId().getValue()); driver.declineOffer(offer.getId()); } } LOG.debug("resourceOffers: After processing offers, now have offers buffered: {}", _offers.size(), offerMapToString(_offers)); } }

Target:
public void resourceOffers(SchedulerDriver driver, List<Protos.Offer> offers) { synchronized (_offersLock) { if (_offers == null) { return; } LOG.debug("resourceOffers: Currently have offers buffered {}", _offers.size(), (_offers.size() > 0 ? (":" + offerMapToString(_offers)) : "")); for (Protos.Offer offer : offers) { if (isHostAccepted(offer.getHostname())) { LOG.debug("resourceOffers: Recording offer from host: {}, offerId: {}", offer.getHostname(), offer.getId().getValue()); _offers.put(offer.getId(), offer); } else { LOG.debug("resourceOffers: Declining offer from host: {}, offerId: {}", offer.getHostname(), offer.getId().getValue()); driver.declineOffer(offer.getId()); } } LOG.debug("resourceOffers: After processing offers, now have offers buffered: {}", _offers.size(), offerMapToString(_offers)); } }
Source:
private void changePlayPauseState(final String state) { if (mPlayer == null || state == null) { return; } mPlayer.postDelayed(new Runnable() { @Override public void run() { if (KPlayerListener.PauseKey.equals(state)) { if ("pause".equals(mLastSentEvent)){ return; } if (mPlayer != null && !mPlayer.isPlaying()) { mLastSentEvent = "pause"; mListener.eventWithValue(KWVCPlayer.this, KPlayerListener.PauseKey, null); return; } } else if (KPlayerListener.PlayKey.equals(state)) { if ("play".equals(mLastSentEvent)){ return; } if (mPlayer != null && mPlayer.isPlaying()) { mListener.eventWithValue(KWVCPlayer.this, KPlayerListener.PlayKey, null); mLastSentEvent = "pause"; return; } } else { Log.e(TAG, "Unsupported state " + state + " was used in changePlayPauseState"); return; } changePlayPauseState(state); } }, 100); }

Target:
private void changePlayPauseState(final String state) { if (mPlayer == null || state == null) { return; } mPlayer.postDelayed(new Runnable() { @Override public void run() { if (KPlayerListener.PauseKey.equals(state)) { if (KPlayerListener.PauseKey.equals(mLastSentEvent)){ return; } if (mPlayer != null && !mPlayer.isPlaying()) { mLastSentEvent = KPlayerListener.PauseKey; mListener.eventWithValue(KWVCPlayer.this, KPlayerListener.PauseKey, null); return; } } else if (KPlayerListener.PlayKey.equals(state)) { if (KPlayerListener.PlayKey.equals(mLastSentEvent)){ return; } if (mPlayer != null && mPlayer.isPlaying()) { mListener.eventWithValue(KWVCPlayer.this, KPlayerListener.PlayKey, null); mLastSentEvent = KPlayerListener.PauseKey; return; } } else { Log.e(TAG, "Unsupported state " + state + " was used in changePlayPauseState"); return; } changePlayPauseState(state); } }, 100); }
Source:
public void doPolling(Guid cmdId, List<Guid> childCmdIds) { boolean anyFailed = false; int finishedChildren = 0; for (Guid childCmdId : childCmdIds) { CommandStatus commandStatus = CommandCoordinatorUtil.getCommandStatus(childCmdId); switch (commandStatus) { case NOT_STARTED: case ACTIVE: log.info("Waiting on CloneCinderDisksCommandCallback child commands to complete"); return; case SUCCEEDED: finishedChildren++; break; case FAILED: case FAILED_RESTARTED: case UNKNOWN: anyFailed = true; default: finishedChildren++; log.error("Invalid command status: '{}", commandStatus); break; } } T command = getCommand(cmdId); if (finishedChildren == childCmdIds.size()) { command.getParameters().setTaskGroupSuccess(!anyFailed); command.setCommandStatus(anyFailed ? CommandStatus.FAILED : CommandStatus.SUCCEEDED); log.info("All CloneCinderDisksCommandCallback commands have completed, status '{}'", command.getCommandStatus()); } else { log.info("Waiting for all child commands to finish. Number of child commands: {}. Finished child commands: {}. ", childCmdIds.size(), finishedChildren); } }

Target:
public void doPolling(Guid cmdId, List<Guid> childCmdIds) { boolean anyFailed = false; int finishedChildren = 0; for (Guid childCmdId : childCmdIds) { CommandStatus commandStatus = CommandCoordinatorUtil.getCommandStatus(childCmdId); switch (commandStatus) { case SUCCEEDED: finishedChildren++; break; case FAILED: case FAILED_RESTARTED: case UNKNOWN: anyFailed = true; default: finishedChildren++; log.error("Invalid command status: '{}", commandStatus); break; } } if (finishedChildren == childCmdIds.size()) { T command = getCommand(cmdId); command.getParameters().setTaskGroupSuccess(!anyFailed); command.setCommandStatus(anyFailed ? CommandStatus.FAILED : CommandStatus.SUCCEEDED); log.info("All CloneCinderDisksCommandCallback commands have completed, status '{}'", command.getCommandStatus()); } else { log.info("Waiting for all child commands to finish. Number of child commands: {}. Finished child commands: {}. ", childCmdIds.size(), finishedChildren); } }
Source:
public void testAttemptLoadWithSpring() throws Exception { Properties testProperties = PropertiesLoader.attemptLoadWithSpring( PROPERTIES_FILENAME, this.getClass().getClassLoader()); this.getClass().getClassLoader().getResource("pom.xml"); Assert.assertEquals( "Returns the correct properties", exampleMap.entrySet(), testProperties.entrySet()); }

Target:
public void testAttemptLoadWithSpring() throws Exception { Properties testProperties = PropertiesLoader.attemptLoadWithSpring( PROPERTIES_FILENAME, this.getClass().getClassLoader()); assertThat(testProperties.entrySet(), equalTo(EXAMPLE_MAP.entrySet())); }
Source:
private void invalidateAmbientCache() { OfflineManager fileSource = OfflineManager.getInstance(CacheManagementActivity.this); fileSource.invalidateAmbientCache(new OfflineManager.FileSourceCallback() { @Override public void onSuccess() { showToast(R.string.cache_invalidated_toast_confirmation); } @Override public void onError(@NonNull String message) { showToast(R.string.cache_invalidated_toast_error); } }); }

Target:
private void invalidateAmbientCache() { OfflineManager fileSource = OfflineManager.getInstance(CacheManagementActivity.this); fileSource.invalidateAmbientCache(new OfflineManager.FileSourceCallback() { @Override public void onSuccess() { showToast(getString(R.string.cache_invalidated_toast_confirmation)); } @Override public void onError(@NonNull String message) { showToast(String.format(getString( R.string.cache_invalidated_toast_error), message)); } }); }
Source:
private ChildSessionStateMachine buildChildSession(ChildSessionOptions childOptions) { boolean isNatDetected = mIsLocalBehindNat || mIsRemoteBehindNat; ChildSessionStateMachine childSession = ChildSessionStateMachineFactory.makeChildSessionStateMachine( "ChildSessionStateMachine", getHandler().getLooper(), mContext, childOptions, new ChildSessionSmCallback(), mLocalAddress, mRemoteAddress, (isNatDetected ? mIkeSessionOptions.getUdpEncapsulationSocket() : null), mIkePrf, mCurrentIkeSaRecord.getSkD()); return childSession; }

Target:
private ChildSessionStateMachine buildChildSession(ChildSessionOptions childOptions) { boolean isNatDetected = mIsLocalBehindNat || mIsRemoteBehindNat; ChildSessionStateMachine childSession = ChildSessionStateMachineFactory.makeChildSessionStateMachine( getHandler().getLooper(), mContext, childOptions, new ChildSessionSmCallback(), mLocalAddress, mRemoteAddress, (isNatDetected ? mIkeSessionOptions.getUdpEncapsulationSocket() : null), mIkePrf, mCurrentIkeSaRecord.getSkD()); return childSession; }
Source:
protected void refreshChildren() { ITmfTrace trace = getParent().getTrace(); if (trace == null) { return; } if (!fInitialized) { Set<IOnDemandAnalysis> analyses = OnDemandAnalysisManager.getInstance().getOndemandAnalyses(trace); IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IPath nodePath = this.getResource().getFullPath(); analyses.forEach(analysis -> { IFolder analysisRes = checkNotNull(root.getFolder(nodePath.append(analysis.getName()))); TmfOnDemandAnalysisElement elem = new TmfOnDemandAnalysisElement( analysis.getName(), analysisRes, this, analysis); addChild(elem); }); } getChildren().forEach(child -> ((TmfProjectModelElement) child).refreshChildren()); }

Target:
protected void refreshChildren() { ITmfTrace trace = getParent().getTrace(); if (trace == null) { return; } if (!fInitialized) { Set<IOnDemandAnalysis> analyses = OnDemandAnalysisManager.getInstance().getOndemandAnalyses(trace); IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IPath nodePath = getResource().getFullPath(); analyses.forEach(analysis -> { IFolder analysisRes = checkNotNull(root.getFolder(nodePath.append(analysis.getName()))); TmfOnDemandAnalysisElement elem = new TmfOnDemandAnalysisElement( analysis.getName(), analysisRes, this, analysis); addChild(elem); }); } getChildren().forEach(child -> ((TmfProjectModelElement) child).refreshChildren()); }
Source:
public JdbcSecurityRealm build() { List<QueryConfiguration> configuration = new ArrayList<>(); for (QueryBuilder query : this.queries) { configuration.add(query.buildQuery()); } if (hashCharset == null) { return new JdbcSecurityRealm(configuration, providers, StandardCharsets.UTF_8); } else { return new JdbcSecurityRealm(configuration, providers, hashCharset); } }

Target:
public JdbcSecurityRealm build() { List<QueryConfiguration> configuration = new ArrayList<>(); for (QueryBuilder query : this.queries) { configuration.add(query.buildQuery()); } if (hashCharset == null) { hashCharset = StandardCharsets.UTF_8; } return new JdbcSecurityRealm(configuration, providers, hashCharset); }
Source:
public void validateParameter(String parameterName, ModelNode value) throws OperationFailedException { super.validateParameter(parameterName, value); ModelType type = value.getType(); if (type == ModelType.STRING && !value.isProtected()) { String tuString = ExpressionResolver.SIMPLE.resolveExpressions(value).asString(); E enumValue = toStringMap.get(tuString); if (enumValue == null) { try { enumValue = Enum.valueOf(enumType, tuString.toUpperCase(Locale.ENGLISH)); } catch (IllegalArgumentException e) { throw ControllerLogger.ROOT_LOGGER.invalidEnumValue(tuString, parameterName, toStringMap.keySet()); } } if (!allowedValues.contains(enumValue)) { throw ControllerLogger.ROOT_LOGGER.invalidEnumValue(tuString, parameterName, toStringMap.keySet()); } value.set(enumValue.toString()); } }

Target:
public void validateParameter(String parameterName, ModelNode value) throws OperationFailedException { super.validateParameter(parameterName, value); ModelType type = value.getType(); if (type == ModelType.STRING ) { String tuString = ExpressionResolver.SIMPLE.resolveExpressions(value).asString(); E enumValue = toStringMap.get(tuString); if (enumValue == null) { try { enumValue = Enum.valueOf(enumType, tuString.toUpperCase(Locale.ENGLISH)); } catch (IllegalArgumentException e) { throw ControllerLogger.ROOT_LOGGER.invalidEnumValue(tuString, parameterName, toStringMap.keySet()); } } if (!allowedValues.contains(enumValue)) { throw ControllerLogger.ROOT_LOGGER.invalidEnumValue(tuString, parameterName, toStringMap.keySet()); } if (!value.isProtected()) { value.set(enumValue.toString()); } } }
Source:
public int getAverageResultSize() { if (currentReader == null) { return 16; } return currentReader.getAverageResultSize(); }

Target:
public int getAverageResultSize() { if (currentReader == null) { return 2 * Long.BYTES + Integer.BYTES; } return currentReader.getAverageResultSize(); }
Source:
EventBus createEventBus(PostCommentedEventHandler postCommentedEventHandler) { EventBus eventBus = new EventBus(); return eventBus; }

Target:
EventBus createEventBus(PostCommentedEventHandler postCommentedEventHandler) { EventBus eventBus = new EventBus(); eventBus.register(postCommentedEventHandler); return eventBus; }
Source:
static boolean isTopStrand(final SAMRecord rec) { final int read1FivePrimeCoordinate; final int read2FivePrimeCoordinate; if (rec.getFirstOfPairFlag()) { read1FivePrimeCoordinate = (rec.getReadNegativeStrandFlag()) ? rec.getAlignmentEnd() : rec.getAlignmentStart(); read2FivePrimeCoordinate = (rec.getMateNegativeStrandFlag()) ? SAMUtils.getMateUnclippedEnd(rec) : SAMUtils.getMateUnclippedStart(rec); } else { read1FivePrimeCoordinate = (rec.getMateNegativeStrandFlag()) ? SAMUtils.getMateUnclippedEnd(rec) : SAMUtils.getMateUnclippedStart(rec); read2FivePrimeCoordinate = (rec.getReadNegativeStrandFlag()) ? rec.getAlignmentEnd() : rec.getAlignmentStart(); } return read1FivePrimeCoordinate < read2FivePrimeCoordinate; }

Target:
static boolean isTopStrand(final SAMRecord rec) { if (!rec.getReferenceIndex().equals(rec.getMateReferenceIndex())) { return rec.getFirstOfPairFlag() == (rec.getReferenceIndex() < rec.getMateReferenceIndex()); } final int read5PrimeStart = (rec.getReadNegativeStrandFlag()) ? rec.getUnclippedEnd() : rec.getUnclippedStart(); final int mate5PrimeStart = (rec.getMateNegativeStrandFlag()) ? SAMUtils.getMateUnclippedEnd(rec) : SAMUtils.getMateUnclippedStart(rec); return rec.getFirstOfPairFlag() == (read5PrimeStart < mate5PrimeStart); }
Source:
@Test public void deserializeWrongClass() throws Exception { ResponseBody body = ResponseBody.create(MEDIA_TYPE, JSON); try { converter.fromBody(body, String.class); } catch (NoSuchMapperException ignored) { } }

Target:
public void deserializeWrongClass() throws Exception { ResponseBody body = ResponseBody.create(MEDIA_TYPE, JSON); try { converter.fromBody(body, String.class); fail(); } catch (Exception ignored) { } }
Source:
public long getTablePtr() { return table.getNativePtr(); }

Target:
private long getTablePtr() { return table.getNativePtr(); }
Source:
private void handleMetadata(Versioned<LedgerMetadata> result, Throwable exception) { if (exception == null) { final Set<LedgerMetadataListener> listenerSet = listeners.get(ledgerId); if (null != listenerSet) { if (LOG.isDebugEnabled()) { LOG.debug("Ledger metadata is changed for : {}.", ledgerId, result); } scheduler.submit(() -> { synchronized (listenerSet) { for (LedgerMetadataListener listener : listenerSet) { listener.onChanged(ledgerId, result); } } }); } } else if (exception instanceof BKException.BKNoSuchLedgerExistsException) { Set<LedgerMetadataListener> listenerSet = listeners.remove(ledgerId); if (null != listenerSet) { if (LOG.isDebugEnabled()) { LOG.debug("Removed ledger metadata listener set on ledger as its ledger is deleted : {}", ledgerId, listenerSet.size()); } synchronized (listenerSet) { for (LedgerMetadataListener listener : listenerSet) { listener.onChanged(ledgerId, null); } } } } else { LOG.warn("Failed on read ledger metadata of ledger {}", ledgerId, exception); scheduler.schedule(this, ZK_CONNECT_BACKOFF_MS, TimeUnit.MILLISECONDS); } }

Target:
private void handleMetadata(Versioned<LedgerMetadata> result, Throwable exception) { if (exception == null) { final Set<LedgerMetadataListener> listenerSet = listeners.get(ledgerId); if (null != listenerSet) { if (LOG.isDebugEnabled()) { LOG.debug("Ledger metadata is changed for : {}.", ledgerId, result); } scheduler.submit(() -> { synchronized (listenerSet) { for (LedgerMetadataListener listener : listenerSet) { listener.onChanged(ledgerId, result); } } }); } } else if (BKException.getExceptionCode(exception) == BKException.Code.NoSuchLedgerExistsException) { Set<LedgerMetadataListener> listenerSet = listeners.remove(ledgerId); if (null != listenerSet) { if (LOG.isDebugEnabled()) { LOG.debug("Removed ledger metadata listener set on ledger as its ledger is deleted : {}", ledgerId, listenerSet.size()); } synchronized (listenerSet) { for (LedgerMetadataListener listener : listenerSet) { listener.onChanged(ledgerId, null); } } } } else { LOG.warn("Failed on read ledger metadata of ledger {}: {}", ledgerId, BKException.getExceptionCode(exception)); scheduler.schedule(this, ZK_CONNECT_BACKOFF_MS, TimeUnit.MILLISECONDS); } }
Source:
public Optional<PlanNode> apply(PlanNode node, Lookup lookup, PlanNodeIdAllocator idAllocator, SymbolAllocator symbolAllocator, Session session) { ProjectNode parent = (ProjectNode) node; PlanNode source = lookup.resolve(parent.getSource()); if (!(source instanceof TableScanNode)) { return Optional.empty(); } TableScanNode child = (TableScanNode) source; Optional<Set<Symbol>> dependencies = pruneInputs(child.getOutputSymbols(), parent.getAssignments().getExpressions()); if (!dependencies.isPresent()) { return Optional.empty(); } List<Symbol> newOutputs = filter(child.getOutputSymbols(), dependencies.get()::contains); return Optional.of( new ProjectNode( parent.getId(), new TableScanNode( child.getId(), child.getTable(), newOutputs, filterKeys(child.getAssignments(), newOutputs::contains), child.getLayout(), child.getCurrentConstraint(), child.getOriginalConstraint()), parent.getAssignments())); }

Target:
public Optional<PlanNode> apply(PlanNode node, Lookup lookup, PlanNodeIdAllocator idAllocator, SymbolAllocator symbolAllocator, Session session) { ProjectNode parent = (ProjectNode) node; PlanNode source = lookup.resolve(parent.getSource()); if (!(source instanceof TableScanNode)) { return Optional.empty(); } TableScanNode child = (TableScanNode) source; Optional<Set<Symbol>> dependencies = pruneInputs(child.getOutputSymbols(), parent.getAssignments().getExpressions()); if (!dependencies.isPresent()) { return Optional.empty(); } return Optional.of( new ProjectNode( parent.getId(), new TableScanNode( child.getId(), child.getTable(), filteredCopy(child.getOutputSymbols(), dependencies.get()::contains), filterKeys(child.getAssignments(), dependencies.get()::contains), child.getLayout(), child.getCurrentConstraint(), child.getOriginalConstraint()), parent.getAssignments())); }
Source:
public HashMap<String, String> getAttributes() { if (attributes == null) { attributes = new HashMap<>(); } return attributes; }

Target:
public Map<String, String> getAttributes() { if (attributes == null) { attributes = new HashMap<>(); } return attributes; }
Source:
private File getFeatureTypeDir( File featureTypesBaseDir, String namespacePrefix, String typeName) { return new File(featureTypesBaseDir, getDataStoreName(namespacePrefix, typeName)); }

Target:
protected File getFeatureTypeDir( File featureTypesBaseDir, String namespacePrefix, String typeName) { return new File(featureTypesBaseDir, getDataStoreName(namespacePrefix, typeName)); }
Source:
public static SystemTapView createView(final String viewID) { Display.getDefault().syncExec(new Runnable() { @Override public void run() { try { IViewPart view = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getActivePage(). showView(viewID); if (!(view instanceof SystemTapView)) throw new RuntimeException("Miscast type: " + view.getClass().toString()); newView = ((SystemTapView) view); newView.setViewID(); } catch (PartInitException e) { e.printStackTrace(); } } }); addView(newView); return newView; }

Target:
public static SystemTapView createView(final String viewID) { Display.getDefault().syncExec(new Runnable() { @Override public void run() { try { IViewPart view = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getActivePage(). showView(viewID); if (!(view instanceof SystemTapView)) return; newView = ((SystemTapView) view); newView.setViewID(); } catch (PartInitException e) { e.printStackTrace(); } } }); addView(newView); return newView; }
Source:
@Test public void testRoundingNPE() { CalciteAssert.that() .query("SELECT ROUND(CAST((X/Y) AS NUMERIC), 2) " + "FROM (VALUES (1, 2), (NULLIF(5, 5), NULLIF(5, 5))) A(X, Y)") .planContains(" final Object[] current = (Object[]) inputEnumerator.current();\n" + " final Integer input_value = (Integer) current[0];\n" + " final Integer input_value0 = (Integer) current[1];\n" + " final Integer binary_call_value = input_value == null || input_value0 == null ? (Integer) null : Integer.valueOf(input_value / input_value0);\n" + " final java.math.BigDecimal cast_value = binary_call_value == null ? (java.math.BigDecimal) null : binary_call_value == null ? (java.math.BigDecimal) null : new java.math.BigDecimal(\n" + " binary_call_value.intValue());\n" + " return cast_value == null ? (java.math.BigDecimal) null : org.apache.calcite.runtime.SqlFunctions.sround(cast_value, 2);") .returns("EXPR$0=0.00\n" + "EXPR$0=null\n"); }

Target:
@Test public void testRoundingNPE() { CalciteAssert.that() .query("SELECT ROUND(CAST((X/Y) AS NUMERIC), 2) " + "FROM (VALUES (1, 2), (NULLIF(5, 5), NULLIF(5, 5))) A(X, Y)") .returns("EXPR$0=0.00\n" + "EXPR$0=null\n"); }
Source:
public int hashCode() { int result = processId.hashCode(); result = 31 * result + taskId.hashCode(); result = 31 * result + taskName.hashCode(); result = 31 * result + formName.hashCode(); return result; }

Target:
public int hashCode() { int result = processId.hashCode(); result = ~~result; result = 31 * result + taskId.hashCode(); result = ~~result; result = 31 * result + taskName.hashCode(); result = ~~result; result = 31 * result + formName.hashCode(); result = ~~result; return result; }
Source:
public BroadcasterMessageHandler(Processor processor) { Assert.notNull(processor, "processor cannot be null."); this.reactorProcessor = processor; Environment.initializeIfEmpty(); this.inputType = ReactorReflectionUtils.extractInputType(processor); this.stream = RingBufferProcessor.share("xd-reactor", 8192); Publisher<?> outputStream = processor.process(Streams.wrap(stream)); outputStream.subscribe(new DefaultSubscriber<Object>() { @Override public void onSubscribe(Subscription s) { processorSubscription = s; s.request(Long.MAX_VALUE); } @Override public void onNext(Object outputObject) { if (ClassUtils.isAssignable(Message.class, outputObject.getClass())) { getOutputChannel().send((Message) outputObject); } else { getOutputChannel().send(MessageBuilder.withPayload(outputObject).build()); } } @Override public void onError(Throwable throwable) { logger.error(throwable); } @Override public void onComplete() { } }); }

Target:
public BroadcasterMessageHandler(Processor processor) { super(processor); }
Source:
public synchronized void updated(final Map<String, Object> properties) { s_logger.debug(s_message.updatingCloudPublisher()); this.options = new CloudPublisherOptions(properties); if (this.cloudServiceTracker != null) { this.cloudServiceTracker.close(); } initCloudServiceTracking(); s_logger.debug(s_message.updatingCloudPublisherDone()); }

Target:
public synchronized void updated(final Map<String, Object> properties) { logger.debug(message.updatingCloudPublisher()); this.cloudPublisherOptions = new CloudPublisherOptions(properties); if (this.cloudServiceTracker != null) { this.cloudServiceTracker.close(); } initCloudServiceTracking(); logger.debug(message.updatingCloudPublisherDone()); }
Source:
protected Response JSONRepresentation(Object entity) { if (entity == null) { return OK(""); } try { String jsonStr = toJson(entity); return OK(jsonStr); } catch (IOException e) { _logger.error("Failed to convert " + entity + " to JSON response", e); return serverError(); } }

Target:
protected Response JSONRepresentation(Object entity) { try { String jsonStr = toJson(entity); return OK(jsonStr); } catch (IOException e) { _logger.error("Failed to convert " + entity + " to JSON response", e); return serverError(); } }
Source:
@Test public void responseBodyStreams() throws IOException { Retrofit retrofit = new Retrofit.Builder() .baseUrl(server.getUrl("/").toString()) .converterFactory(new ToStringConverterFactory()) .build(); Service example = retrofit.create(Service.class); server.enqueue(new MockResponse() .setBody("1234") .setSocketPolicy(DISCONNECT_DURING_RESPONSE_BODY)); Response<ResponseBody> response = example.getStreamingBody().execute(); try { response.body().string(); } catch (IOException e) { assertThat(e).hasMessage("unexpected end of stream"); } }

Target:
@Test public void responseBodyStreams() throws IOException { Retrofit retrofit = new Retrofit.Builder() .baseUrl(server.getUrl("/").toString()) .converterFactory(new ToStringConverterFactory()) .build(); Service example = retrofit.create(Service.class); server.enqueue(new MockResponse() .setBody("1234") .setSocketPolicy(DISCONNECT_DURING_RESPONSE_BODY)); Response<ResponseBody> response = example.getStreamingBody().execute(); ResponseBody streamedBody = response.body(); try { streamedBody.string(); fail(); } catch (IOException e) { assertThat(e).hasMessage("unexpected end of stream"); } }
Source:
public static void sendToTMaster(String command, String topologyName, SchedulerStateManagerAdaptor stateManager, NetworkUtils.TunnelConfig tunnelConfig) throws TMasterException { LOG.fine("Fetching TMaster location for topology: " + topologyName); TopologyMaster.TMasterLocation location = stateManager.getTMasterLocation(topologyName); Preconditions.checkNotNull(location, "Failed to fetch TMaster Location for topology: " + topologyName); LOG.fine("Fetched TMaster location for topology: " + topologyName); String url = String.format("http://%s:%d/%s?topologyid=%s", location.getHost(), location.getControllerPort(), command, location.getTopologyId()); try { URL endpoint = new URL(url); LOG.fine("HTTP URL for TMaster: " + endpoint); sendGetRequest(endpoint, command, tunnelConfig); } catch (MalformedURLException e) { throw new RuntimeException("Invalid URL for Tmaster endpoint: " + url, e); } }

Target:
public static void sendToTMaster(String command, String topologyName, SchedulerStateManagerAdaptor stateManager, NetworkUtils.TunnelConfig tunnelConfig) throws TMasterException { LOG.fine("Fetching TMaster location for topology: " + topologyName); TopologyMaster.TMasterLocation location = stateManager.getTMasterLocation(topologyName); if (location == null) { throw new TMasterException("Failed to fetch TMaster location for topology: " + topologyName); } LOG.fine("Fetched TMaster location for topology: " + topologyName); String url = String.format("http://%s:%d/%s?topologyid=%s", location.getHost(), location.getControllerPort(), command, location.getTopologyId()); try { URL endpoint = new URL(url); LOG.fine("HTTP URL for TMaster: " + endpoint); sendGetRequest(endpoint, command, tunnelConfig); } catch (MalformedURLException e) { throw new TMasterException("Invalid URL for TMaster endpoint: " + url, e); } }
Source:
public T getUniqueByProperty(String property, Object value, boolean enforceType) throws NonUniqueResultException { Iterable<T> results = findAllByProperty(property, value, enforceType); T result = null; Iterator<? extends WindupVertexFrame> iterator = results.iterator(); do { if (!iterator.hasNext()) return result; WindupVertexFrame item = iterator.next(); if (!type.isInstance(item)) continue; if ("jsf".equals(value)) Logger.getLogger("FOO").info("Model with name 'jsf', type: " + type + " item: " + StringUtils.join(item.getClass().getInterfaces(), ", ")); if (result != null) { throw new NonUniqueResultException("Expected unique value, but returned non-unique: " + property + " Conflicting models:" + NL + "\t" + StringUtils.join(item.getClass().getInterfaces(), ", ") + NL + "\t\t" + item.toPrettyString() + NL + "\t" + StringUtils.join(result.getClass().getInterfaces(), ", ") + NL + "\t\t" + result.toPrettyString()); } result = (T) item; } while (iterator != null); return result; }

Target:
public T getUniqueByProperty(String property, Object value, boolean enforceType) throws NonUniqueResultException { Iterable<T> results = findAllByProperty(property, value, enforceType); T result = null; for (WindupVertexFrame item : results) { if (!type.isInstance(item)) continue; if (result != null) { throw new NonUniqueResultException("Expected unique value, but returned non-unique: " + property + " Conflicting models:" + NL + "\t" + StringUtils.join(item.getClass().getInterfaces(), ", ") + NL + "\t\t" + item.toPrettyString() + NL + "\t" + StringUtils.join(result.getClass().getInterfaces(), ", ") + NL + "\t\t" + result.toPrettyString()); } result = (T) item; } return result; }
Source:
public void onKeyUp(KeyUpEvent event){ if (event.isLeftArrow() && event.isRightArrow()) { } else if (event.isDownArrow()) { if (dropDownPopup != null) { String itemText = dropDownPopup.selectNextItem(); if (itemText != null) { textBox.setText(itemText); } } } else if (event.isUpArrow()) { if (dropDownPopup != null) { String itemText = dropDownPopup.selectPreviousItem(); if (itemText != null) { textBox.setText(itemText); } else { textBox.setText(previousSearchString); } } } else if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) { if (dropDownPopup != null) { setSelectedDisplayItem(dropDownPopup.getSelectedItem()); } } else if (textBox.getText().length() >= this.minCharCount && !textBox.getText().equals(previousSearchString)) { selectedObject = null; previousSearchString = textBox.getText(); this.setValue(textBox.getText()); createDropDownPopup(); applyFilter(); } else if (textBox.getText().length() < this.minCharCount) { selectedObject = null; previousSearchString = textBox.getText(); this.setValue(textBox.getText()); destroyDropDownPopup(); } }

Target:
public void onKeyUp(KeyUpEvent event) { if (event.isLeftArrow() || event.isRightArrow()) { } else if (event.isDownArrow()) { if (dropDownPopup != null) { String itemText = dropDownPopup.selectNextItem(); if (itemText != null) { textBox.setText(itemText); } } } else if (event.isUpArrow()) { if (dropDownPopup != null) { String itemText = dropDownPopup.selectPreviousItem(); if (itemText != null) { textBox.setText(itemText); } else { textBox.setText(previousSearchString); } } } else if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) { if (dropDownPopup != null) { setSelectedDisplayItem(dropDownPopup.getSelectedItem()); } } else if (textBox.getText().length() >= this.minCharCount && !textBox.getText().equals(previousSearchString)) { selectedObject = null; previousSearchString = textBox.getText(); createDropDownPopup(); applyFilter(); } else if (textBox.getText().length() < this.minCharCount) { selectedObject = null; previousSearchString = textBox.getText(); destroyDropDownPopup(); } }
Source:
private WritableSupplier<IndexedInts> readSingleValuedColumn(VERSION version, ByteBuffer buffer) { switch (version) { case UNCOMPRESSED_SINGLE_VALUE: return VSizeIndexedInts.readFromByteBuffer(buffer).asWritableSupplier(); case COMPRESSED: return CompressedVSizeIntsIndexedSupplier.fromByteBuffer(buffer, byteOrder); } throw new IAE("Unsupported version[%s]", version); }

Target:
private WritableSupplier<IndexedInts> readSingleValuedColumn(VERSION version, ByteBuffer buffer) { switch (version) { case UNCOMPRESSED_SINGLE_VALUE: return VSizeIndexedInts.readFromByteBuffer(buffer).asWritableSupplier(); case COMPRESSED: return CompressedVSizeIntsIndexedSupplier.fromByteBuffer(buffer, byteOrder); } throw new IAE("Unsupported single-value version[%s]", version); }
Source:
public boolean deleteChunk(Chunk chunk) { IChunkProvider provider = this.getChunkProvider(); Vector3i chunkPos = chunk.getPosition(); if (provider instanceof ChunkProviderServer) { ((ChunkProviderServer) provider).dropChunk(chunkPos.getX(), chunkPos.getZ()); return true; } return false; }

Target:
public boolean deleteChunk(Chunk chunk) { ChunkProviderServer provider = (ChunkProviderServer) this.getChunkProvider(); Vector3i chunkPos = chunk.getPosition(); if (ForgeChunkManager.getPersistentChunksFor((net.minecraft.world.World) (Object) this).containsKey( new ChunkCoordIntPair(chunkPos.getX(), chunkPos.getZ()))) { return false; } provider.dropChunk(chunkPos.getX(), chunkPos.getZ()); return true; }
Source:
public int getBufferedBytes() { return toIntExact((rowCount * otherColumnsBytesPerRow) + dictionaryColumns.stream() .mapToLong(TestDictionaryColumn::getBufferedBytes) .sum()); }

Target:
public long getBufferedBytes() { return (long) rowCount * otherColumnsBytesPerRow + dictionaryColumns.stream() .mapToLong(TestDictionaryColumn::getBufferedBytes) .sum(); }
Source:
public void createDirectoriesAndFiles() throws Exception { root = new File("target", "configuration").toPath(); Files.createDirectories(root); File baseDir = root.toAbsolutePath().toFile(); File gitDir = new File(baseDir, Constants.DOT_GIT); if (!gitDir.exists()) { try (Git git = Git.init().setDirectory(baseDir).call()) { git.commit().setMessage("Repository initialized").call(); } } repository = new FileRepositoryBuilder().setWorkTree(baseDir).setGitDir(gitDir).setup().build(); }

Target:
public void createDirectoriesAndFiles() throws Exception { root = new File("target", "standalone").toPath(); Files.createDirectories(root); File baseDir = root.toAbsolutePath().toFile(); File gitDir = new File(baseDir, Constants.DOT_GIT); if (!gitDir.exists()) { try (Git git = Git.init().setDirectory(baseDir).setGitDir(gitDir).call()) { git.commit().setMessage("Repository initialized").call(); } } repository = new FileRepositoryBuilder().setWorkTree(baseDir).setGitDir(gitDir).setup().build(); }
Source:
private void flushDeadQueue() { executorService.submit(new Runnable() { @Override public void run() { while (!deadQueue.isEmpty()) { try { Entry entry = deadQueue.poll(); graphite.send(entry.getName(), entry.getValue(), entry.getTimestamp()); } catch (IOException ex) { LOGGER.warn("Error closing Graphite", graphite, ex); } } } }); }

Target:
private void flushDeadQueue() { executorService.submit(new Runnable() { @Override public void run() { while (!deadQueue.isEmpty()) { try { Entry entry = deadQueue.poll(); graphite.send(entry.getName(), entry.getValue(), entry.getTimestamp()); } catch (IOException ex) { LOGGER.warn("Unable to report to Graphite", graphite, ex); } } } }); }
Source:
public static Resource getResource(final ResourceSet resourceSet, final URI resourceURI) { Resource resource = null; try { resource = resourceSet.getResource(resourceURI, true); } catch (WrappedException e) { SiriusPlugin.getDefault().getLog().log(new Status(IStatus.WARNING, SiriusPlugin.ID, e.getMessage(), e)); } return resource; }

Target:
private static Resource getResource(final ResourceSet resourceSet, final URI resourceURI) { Resource resource = null; try { resource = resourceSet.getResource(resourceURI, true); } catch (WrappedException e) { SiriusPlugin.getDefault().getLog().log(new Status(IStatus.WARNING, SiriusPlugin.ID, e.getMessage(), e)); } return resource; }
Source:
public void testRoundTripPoint() throws Exception { PointSymbolizer sym = (PointSymbolizer) parse("example-pointsymbolizer-local-uom.xml"); assertEquals("pixel", Units.toName( sym.getUnitOfMeasure() )); assertEquals("8m", sym.getGraphic().getSize().evaluate(null, String.class)); Document doc = encode(sym, SE.PointSymbolizer); }

Target:
public void testRoundTripPoint() throws Exception { PointSymbolizer sym = (PointSymbolizer) parse("example-pointsymbolizer-local-uom.xml"); assertEquals("pixel", Units.toName( sym.getUnitOfMeasure() )); assertEquals(Units.PIXEL, sym.getUnitOfMeasure() ); assertEquals("8m", sym.getGraphic().getSize().evaluate(null, String.class)); Document doc = encode(sym, SE.PointSymbolizer); }