auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void parseECState(final ECC ecc) throws TypeImportException, XMLStreamException { ECState state = LibraryElementFactory.eINSTANCE.createECState(); readNameCommentAttributes(state); getXandY(state); processChildren(LibraryElementTags.ECSTATE_ELEMENT, name -> { if (name.equals(LibraryElementTags.ECACTION_ELEMENT)) { parseECAction(state); return true; } return false; }); if (ecc.getECState().isEmpty()) { ecc.setStart(state); } ecc.getECState().add(state); ecStates.put(state.getName(), state); }

Target:
private void parseECState(final ECC ecc) throws TypeImportException, XMLStreamException { ECState state = LibraryElementFactory.eINSTANCE.createECState(); readNameCommentAttributes(state); getXandY(state); processChildren(LibraryElementTags.ECSTATE_ELEMENT, name -> { if (LibraryElementTags.ECACTION_ELEMENT.equals(name)) { parseECAction(state); return true; } return false; }); if (ecc.getECState().isEmpty()) { ecc.setStart(state); } ecc.getECState().add(state); ecStates.put(state.getName(), state); }
Source:
private void setType() { try { final Field typeField; if (option.getClass().getSimpleName().equals("SequenceOption")) { typeField = option.getClass().getDeclaredField("elementType"); } else { typeField = option.getClass().getDeclaredField("type"); } typeField.setAccessible(true); optionType = (Class<?>) typeField.get(option); if (optionType.isAssignableFrom(Integer.class)) { type = ModelType.INT; } else if (optionType.isAssignableFrom(Long.class)) { type = ModelType.LONG; } else if (optionType.isAssignableFrom(BigInteger.class)) { type = ModelType.BIG_INTEGER; } else if (optionType.isAssignableFrom(Double.class)) { type = ModelType.DOUBLE; } else if (optionType.isAssignableFrom(BigDecimal.class)) { type = ModelType.BIG_DECIMAL; } else if (optionType.isEnum() || optionType.isAssignableFrom(String.class)) { type = ModelType.STRING; } else if (optionType.isAssignableFrom(Boolean.class)) { type = ModelType.BOOLEAN; } else { type = ModelType.UNDEFINED; } } catch (Exception e) { IOLogger.ROOT_LOGGER.error(e.getLocalizedMessage(), e); } }

Target:
private void setType() { try { final Field typeField; if (option.getClass().getSimpleName().equals("SequenceOption")) { typeField = option.getClass().getDeclaredField("elementType"); } else { typeField = option.getClass().getDeclaredField("type"); } typeField.setAccessible(true); optionType = (Class<?>) typeField.get(option); if (optionType.isAssignableFrom(Integer.class)) { type = ModelType.INT; } else if (optionType.isAssignableFrom(Long.class)) { type = ModelType.LONG; } else if (optionType.isAssignableFrom(BigInteger.class)) { type = ModelType.BIG_INTEGER; } else if (optionType.isAssignableFrom(Double.class)) { type = ModelType.DOUBLE; } else if (optionType.isAssignableFrom(BigDecimal.class)) { type = ModelType.BIG_DECIMAL; } else if (optionType.isEnum() || optionType.isAssignableFrom(String.class)) { type = ModelType.STRING; } else if (optionType.isAssignableFrom(Boolean.class)) { type = ModelType.BOOLEAN; } else { type = ModelType.UNDEFINED; } } catch (Exception e) { throw new IllegalArgumentException(e); } }
Source:
public VEvent() { mProperties = new HashMap<String, String>(); mAttendees = new LinkedList<Attendee>(); addProperty(UID , UUID.randomUUID().toString() + "@cyanogenmod.com"); addTimeStamp(); }

Target:
public VEvent() { mProperties = new HashMap<String, String>(); mAttendees = new LinkedList<Attendee>(); addProperty(UID , UUID.randomUUID().toString() + "@ws.xsoh.etar"); addTimeStamp(); }
Source:
public void setArch(String arch) { incrementSequenceNumber(); fArch = arch; if (fRoot != null && arch != null && arch.length() > 0) { Element archNode = TargetDefinitionDocumentTools.getChildElement(fRoot, TargetDefinitionPersistenceHelper.ENVIRONMENT, TargetDefinitionPersistenceHelper.ARCH); archNode.setTextContent(arch); } else { removeElement(TargetDefinitionPersistenceHelper.ENVIRONMENT, TargetDefinitionPersistenceHelper.ARCH); } }

Target:
public void setArch(String arch) { incrementSequenceNumber(); fArch = arch; if (fRoot != null && arch != null && !arch.isEmpty()) { Element archNode = TargetDefinitionDocumentTools.getChildElement(fRoot, TargetDefinitionPersistenceHelper.ENVIRONMENT, TargetDefinitionPersistenceHelper.ARCH); archNode.setTextContent(arch); } else { removeElement(TargetDefinitionPersistenceHelper.ENVIRONMENT, TargetDefinitionPersistenceHelper.ARCH); } }
Source:
public static User login(final HttpServletRequest request, final HttpServletResponse response, final User user, final String authenticationMethod) { if (user == null || user.isLoginExpired()) { throw AuthorizationException.authenticationFailed(); } final AuthenticationContext authenticationContext = loggedUserContext.get(); if (authenticationContext == null) { loggedUserContext.set(new AuthenticationContext(user, authenticationMethod)); storeInSession(request, authenticationContext); final Locale preferredLocale = user.getProfile().getPreferredLocale(); if (preferredLocale != null) { I18NFilter.updateLocale(preferredLocale, request, response); } fireLoginListeners(request, response, user); logger.debug("Logged in user: " + user.getUsername()); } else if (authenticationContext.getUser() != user) { throw AuthorizationException.authenticationFailed(); } else { authenticationContext.addAuthenticationMethodEvent(authenticationMethod); } return user; }

Target:
public static User login(final HttpServletRequest request, final HttpServletResponse response, final User user, final String authenticationMethod) { if (user == null || user.isLoginExpired()) { throw AuthorizationException.authenticationFailed(); } AuthenticationContext authenticationContext = loggedUserContext.get(); if (authenticationContext == null) { authenticationContext = new AuthenticationContext(user, authenticationMethod); loggedUserContext.set(authenticationContext); storeInSession(request, authenticationContext); final Locale preferredLocale = user.getProfile().getPreferredLocale(); if (preferredLocale != null) { I18NFilter.updateLocale(preferredLocale, request, response); } fireLoginListeners(request, response, authenticationContext); logger.debug("Logged in user: " + user.getUsername()); } else if (authenticationContext.getUser() != user) { throw AuthorizationException.authenticationFailed(); } else { authenticationContext.addAuthenticationMethodEvent(authenticationMethod); } return user; }
Source:
private List<String> determineAccessStatus(DocumentIndexingPackage dip) throws IndexingException { ContentObject obj = dip.getContentObject(); PID pid = obj.getPid(); List<String> status = new ArrayList<>(); PatronAccess inheritedAccess = inheritedAclFactory.getPatronAccess(pid); PatronAccess objAccess = objAclFactory.getPatronAccess(pid); if (inheritedAclFactory.isMarkedForDeletion(pid)) { status.add(FacetConstants.MARKED_FOR_DELETION); } if (inheritedAclFactory.getEmbargoUntil(pid) != null) { status.add(FacetConstants.EMBARGOED); } if (inheritedAccess.equals(PatronAccess.none)) { status.add(FacetConstants.STAFF_ONLY_ACCESS); } else if (inheritedAclFactory.getPrincipalRoles(pid).containsKey(AccessPrincipalConstants.PUBLIC_PRINC)) { status.add(FacetConstants.PUBLIC_ACCESS); } if (inheritedAccess.equals(PatronAccess.none) && !objAccess.equals(PatronAccess.none)) { status.add(FacetConstants.PARENT_HAS_STAFF_ONLY_ACCESS); } return status; }

Target:
private List<String> determineAccessStatus(DocumentIndexingPackage dip) throws IndexingException { PID pid = dip.getPid(); List<String> status = new ArrayList<>(); PatronAccess inheritedAccess = inheritedAclFactory.getPatronAccess(pid); PatronAccess objAccess = objAclFactory.getPatronAccess(pid); if (inheritedAclFactory.isMarkedForDeletion(pid)) { status.add(FacetConstants.MARKED_FOR_DELETION); } Date objEmbargo = objAclFactory.getEmbargoUntil(pid); Date parentEmbargo = inheritedAclFactory.getEmbargoUntil(pid); if (objEmbargo != null) { status.add(FacetConstants.EMBARGOED); } else if (parentEmbargo != null) { status.add(FacetConstants.EMBARGOED_PARENT); } if (objAccess.equals(PatronAccess.none)) { status.add(FacetConstants.STAFF_ONLY_ACCESS); } else if (inheritedAclFactory.getPrincipalRoles(pid).containsKey(AccessPrincipalConstants.PUBLIC_PRINC)) { status.add(FacetConstants.PUBLIC_ACCESS); } if (inheritedAccess.equals(PatronAccess.none) && !objAccess.equals(PatronAccess.none)) { status.add(FacetConstants.PARENT_HAS_STAFF_ONLY_ACCESS); } return status; }
Source:
protected Scope visitCreateFunction(CreateFunction node, Optional<Scope> scope) { analysis.setUpdateType("CREATE FUNCTION"); Type returnType = metadata.getType(parseTypeSignature(node.getReturnType())); List<Field> fields = node.getParameters().stream() .map(parameter -> Field.newUnqualified(parameter.getName().getValue(), metadata.getType(parseTypeSignature(parameter.getType())))) .collect(toImmutableList()); Scope functionScope = Scope.builder() .withRelationType(RelationId.anonymous(), new RelationType(fields)) .build(); Type bodyType = analyzeExpression(node.getBody(), functionScope).getExpressionTypes().get(NodeRef.of(node.getBody())); metadata.getTypeManager().canCoerce(bodyType, returnType); Analyzer.verifyNoAggregateWindowOrGroupingFunctions(analysis.getFunctionHandles(), metadata.getFunctionManager(), node.getBody(), "CREATE FUNCTION body"); return createAndAssignScope(node, scope); }

Target:
protected Scope visitCreateFunction(CreateFunction node, Optional<Scope> scope) { analysis.setUpdateType("CREATE FUNCTION"); List<String> duplicateParameters = node.getParameters().stream() .map(SqlParameterDeclaration::getName) .map(Identifier::getValue) .collect(groupingBy(Function.identity(), counting())) .entrySet() .stream() .filter(entry -> entry.getValue() > 1) .map(Entry::getKey) .collect(toImmutableList()); if (!duplicateParameters.isEmpty()) { throw new SemanticException(DUPLICATE_PARAMETER_NAME, node, "Duplicate function parameter name: %s", Joiner.on(", ").join(duplicateParameters)); } Type returnType = metadata.getType(parseTypeSignature(node.getReturnType())); List<Field> fields = node.getParameters().stream() .map(parameter -> Field.newUnqualified(parameter.getName().getValue(), metadata.getType(parseTypeSignature(parameter.getType())))) .collect(toImmutableList()); Scope functionScope = Scope.builder() .withRelationType(RelationId.anonymous(), new RelationType(fields)) .build(); Type bodyType = analyzeExpression(node.getBody(), functionScope).getExpressionTypes().get(NodeRef.of(node.getBody())); if (!bodyType.equals(returnType)) { throw new SemanticException(TYPE_MISMATCH, node, "Function implementation type '%s' does not match declared return type '%s'", bodyType, returnType); } Analyzer.verifyNoAggregateWindowOrGroupingFunctions(analysis.getFunctionHandles(), metadata.getFunctionManager(), node.getBody(), "CREATE FUNCTION body"); return createAndAssignScope(node, scope); }
Source:
public void testNoAuth() throws Exception { serverKeystore = null; serverTruststore = null; clientKeystore = null; clientTruststore = null; Properties p = saveStoresAndGetConnectorProperties(); p.put(JmxmpAgent.USE_SSL_PROPERTY, "false"); p.put(JmxmpAgent.AUTHENTICATE_CLIENTS_PROPERTY, "false"); server = new JmxmpAgent().startJmxmpConnector(p); new JmxmpClient().connect("service:jmx:jmxmp://almacretin.local:11099", new LinkedHashMap()); }

Target:
public void testNoAuth() throws Exception { serverKeystore = null; serverTruststore = null; clientKeystore = null; clientTruststore = null; Properties p = saveStoresAndGetConnectorProperties(); p.put(JmxmpAgent.USE_SSL_PROPERTY, "false"); p.put(JmxmpAgent.AUTHENTICATE_CLIENTS_PROPERTY, "false"); server = new JmxmpAgent().startJmxmpConnector(p); new JmxmpClient().connect("service:jmx:jmxmp://localhost:11099", new LinkedHashMap()); }
Source:
public void sendAdvertisedRefs(final RefAdvertiser adv) throws IOException, ServiceMayNotContinueException { try { advertiseRefsHook.advertiseRefs(this); } catch (ServiceMayNotContinueException fail) { if (fail.getMessage() != null) { adv.writeOne("ERR " + fail.getMessage()); fail.setOutput(); } throw fail; } adv.init(db); adv.advertiseCapability(OPTION_INCLUDE_TAG); adv.advertiseCapability(OPTION_MULTI_ACK_DETAILED); adv.advertiseCapability(OPTION_MULTI_ACK); adv.advertiseCapability(OPTION_OFS_DELTA); adv.advertiseCapability(OPTION_SIDE_BAND); adv.advertiseCapability(OPTION_SIDE_BAND_64K); adv.advertiseCapability(OPTION_THIN_PACK); adv.advertiseCapability(OPTION_NO_PROGRESS); adv.advertiseCapability(OPTION_SHALLOW); if (!biDirectionalPipe) adv.advertiseCapability(OPTION_NO_DONE); RequestPolicy policy = getRequestPolicy(); if (policy == RequestPolicy.TIP || policy == RequestPolicy.REACHABLE_COMMIT_TIP || policy == null) adv.advertiseCapability(OPTION_ALLOW_TIP_SHA1_IN_WANT); adv.setDerefTags(true); findSymrefs(adv); advertised = adv.send(getAdvertisedOrDefaultRefs()); if (adv.isEmpty()) adv.advertiseId(ObjectId.zeroId(), "capabilities^{}"); adv.end(); }

Target:
public void sendAdvertisedRefs(final RefAdvertiser adv) throws IOException, ServiceMayNotContinueException { try { advertiseRefsHook.advertiseRefs(this); } catch (ServiceMayNotContinueException fail) { if (fail.getMessage() != null) { adv.writeOne("ERR " + fail.getMessage()); fail.setOutput(); } throw fail; } adv.init(db); adv.advertiseCapability(OPTION_INCLUDE_TAG); adv.advertiseCapability(OPTION_MULTI_ACK_DETAILED); adv.advertiseCapability(OPTION_MULTI_ACK); adv.advertiseCapability(OPTION_OFS_DELTA); adv.advertiseCapability(OPTION_SIDE_BAND); adv.advertiseCapability(OPTION_SIDE_BAND_64K); adv.advertiseCapability(OPTION_THIN_PACK); adv.advertiseCapability(OPTION_NO_PROGRESS); adv.advertiseCapability(OPTION_SHALLOW); if (!biDirectionalPipe) adv.advertiseCapability(OPTION_NO_DONE); RequestPolicy policy = getRequestPolicy(); if (policy == RequestPolicy.TIP || policy == RequestPolicy.REACHABLE_COMMIT_TIP || policy == null) adv.advertiseCapability(OPTION_ALLOW_TIP_SHA1_IN_WANT); adv.setDerefTags(true); Map<String, Ref> refs = getAdvertisedOrDefaultRefs(); findSymrefs(adv, refs); advertised = adv.send(refs); if (adv.isEmpty()) adv.advertiseId(ObjectId.zeroId(), "capabilities^{}"); adv.end(); }
Source:
private static <TSource, TInner, TResult> Enumerable<TResult> nestedLoopJoinAsList( final Enumerable<TSource> outer, final Enumerable<TInner> inner, final Predicate2<TSource, TInner> predicate, Function2<TSource, TInner, TResult> resultSelector, final JoinType joinType) { final boolean generateNullsOnLeft = joinType.generatesNullsOnLeft(); final boolean generateNullsOnRight = joinType.generatesNullsOnRight(); final List<TResult> result = new ArrayList<>(); final Enumerator<TSource> lefts = outer.enumerator(); final List<TInner> rightList = inner.toList(); final Set<TInner> rightUnmatched; if (generateNullsOnLeft) { rightUnmatched = Sets.newIdentityHashSet(); rightUnmatched.addAll(rightList); } else { rightUnmatched = null; } while (lefts.moveNext()) { int leftMatchCount = 0; final TSource left = lefts.current(); final Enumerator<TInner> rights = Linq4j.iterableEnumerator(rightList); while (rights.moveNext()) { TInner right = rights.current(); if (predicate.apply(left, right)) { ++leftMatchCount; if (joinType == JoinType.ANTI) { break; } else { if (rightUnmatched != null) { rightUnmatched.remove(right); } result.add(resultSelector.apply(left, right)); if (joinType == JoinType.SEMI) { break; } } } } if (leftMatchCount == 0 && (generateNullsOnRight || joinType == JoinType.ANTI)) { result.add(resultSelector.apply(left, null)); } } if (rightUnmatched != null) { final Enumerator<TInner> rights = Linq4j.iterableEnumerator(rightUnmatched); while (rights.moveNext()) { TInner right = rights.current(); result.add(resultSelector.apply(null, right)); } } return Linq4j.asEnumerable(result); }

Target:
private static <TSource, TInner, TResult> Enumerable<TResult> nestedLoopJoinAsList( final Enumerable<TSource> outer, final Enumerable<TInner> inner, final Predicate2<TSource, TInner> predicate, Function2<TSource, TInner, TResult> resultSelector, final JoinType joinType) { final boolean generateNullsOnLeft = joinType.generatesNullsOnLeft(); final boolean generateNullsOnRight = joinType.generatesNullsOnRight(); final List<TResult> result = new ArrayList<>(); final List<TInner> rightList = inner.toList(); final Set<TInner> rightUnmatched; if (generateNullsOnLeft) { rightUnmatched = Sets.newIdentityHashSet(); rightUnmatched.addAll(rightList); } else { rightUnmatched = null; } try (Enumerator<TSource> lefts = outer.enumerator()) { while (lefts.moveNext()) { int leftMatchCount = 0; final TSource left = lefts.current(); for (TInner right : rightList) { if (predicate.apply(left, right)) { ++leftMatchCount; if (joinType == JoinType.ANTI) { break; } else { if (rightUnmatched != null) { rightUnmatched.remove(right); } result.add(resultSelector.apply(left, right)); if (joinType == JoinType.SEMI) { break; } } } } if (leftMatchCount == 0 && (generateNullsOnRight || joinType == JoinType.ANTI)) { result.add(resultSelector.apply(left, null)); } } if (rightUnmatched != null) { for (TInner right : rightUnmatched) { result.add(resultSelector.apply(null, right)); } } return Linq4j.asEnumerable(result); } }
Source:
private String getCertificateUrlParams(String secret, String path, String cn, String name, String alt, String organizationName) throws UnsupportedEncodingException { String pathAux = path != null ? path.replaceAll("/", "%2F") + secret : "%2Fuserland%2Fcertificates%2F" + secret; String cnAux = cn != null ? cn : secret; String nameAux = name != null ? name : secret; String urlParams = "?path=" + URLEncoder.encode(pathAux, "UTF-8") + "&cn=" + URLEncoder.encode(cnAux, "UTF-8") + "&name=" + URLEncoder.encode(nameAux, "UTF-8"); if (alt != null) { urlParams = urlParams + "&alt=" + alt; } if (organizationName != null) { urlParams = urlParams + "&organizationName=" + organizationName; } return urlParams; }

Target:
private String getCertificateUrlParams(String secret, String path, String cn, String name, String alt, String organizationName) { String pathAux = path != null ? path.replaceAll("/", "%2F") + secret : "%2Fuserland%2Fcertificates%2F" + secret; String cnAux = cn != null ? cn : secret; String nameAux = name != null ? name : secret; String urlParams = "?path=" + pathAux + "&cn=" + cnAux + "&name=" + nameAux; if (alt != null) { urlParams = urlParams + "&alt=" + alt; } if (organizationName != null) { urlParams = urlParams + "&organizationName=" + organizationName; } return urlParams; }
Source:
public Map<String, List<Integer>> parse(File... files) throws ParserConfigurationException, SAXException, IOException { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db; Map<NodeList, List<String>> coverageData = new HashMap<NodeList, List<String>>(); for (File file : files) { InputStream is = null; try { is = new FileInputStream(file); db = dbf.newDocumentBuilder(); db.setEntityResolver(new EntityResolver() { @Override public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { String res = dtdMap.get(systemId); if (res != null) { return new InputSource(this.getClass().getResourceAsStream(res)); } else { LOGGER.log(Level.WARNING, "Unknown DTD systemID \"" + systemId + "\", skipping download by returning empty DTD"); return new InputSource(new StringReader(EMPTY_XML)); } } }); Document doc = db.parse(is); NodeList classes = doc.getElementsByTagName(TAG_NAME_CLASS); List<String> sourceDirs = getSourceDirs(doc); coverageData.put(classes, sourceDirs); } finally { if (is != null) { is.close(); } } } return parse(coverageData); }

Target:
public Map<String, List<Integer>> parse(File... files) throws ParserConfigurationException, SAXException, IOException { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db; Map<NodeList, List<String>> coverageData = new HashMap<NodeList, List<String>>(); for (File file : files) { InputStream is = null; try { is = new FileInputStream(file); db = dbf.newDocumentBuilder(); db.setEntityResolver(entityResolver); Document doc = db.parse(is); NodeList classes = doc.getElementsByTagName(TAG_NAME_CLASS); List<String> sourceDirs = getSourceDirs(doc); coverageData.put(classes, sourceDirs); } finally { if (is != null) { is.close(); } } } return parse(coverageData); }
Source:
public void registerTaskManager(final TaskExecutorConnection taskExecutorConnection, SlotReport initialSlotReport) { checkInit(); LOG.debug("Registering TaskManager under at the SlotManager.", taskExecutorConnection.getResourceID(), taskExecutorConnection.getInstanceID()); if (taskManagerRegistrations.containsKey(taskExecutorConnection.getInstanceID())) { reportSlotStatus(taskExecutorConnection.getInstanceID(), initialSlotReport); } else { if (getNumberRegisteredSlots() + Math.max(getNumberPendingTaskManagerSlots(), numSlotsPerWorker) > maxSlotNum) { LOG.warn("The total number of slots exceeds the max limitation, release the excess resource."); resourceActions.releaseResource(taskExecutorConnection.getInstanceID(), new FlinkException("The total number of slots exceeds the max limitation.")); return; } ArrayList<SlotID> reportedSlots = new ArrayList<>(); for (SlotStatus slotStatus : initialSlotReport) { reportedSlots.add(slotStatus.getSlotID()); } TaskManagerRegistration taskManagerRegistration = new TaskManagerRegistration( taskExecutorConnection, reportedSlots); taskManagerRegistrations.put(taskExecutorConnection.getInstanceID(), taskManagerRegistration); for (SlotStatus slotStatus : initialSlotReport) { registerSlot( slotStatus.getSlotID(), slotStatus.getAllocationID(), slotStatus.getJobID(), slotStatus.getResourceProfile(), taskExecutorConnection); } } }

Target:
public void registerTaskManager(final TaskExecutorConnection taskExecutorConnection, SlotReport initialSlotReport) { checkInit(); LOG.debug("Registering TaskManager under at the SlotManager.", taskExecutorConnection.getResourceID(), taskExecutorConnection.getInstanceID()); if (taskManagerRegistrations.containsKey(taskExecutorConnection.getInstanceID())) { reportSlotStatus(taskExecutorConnection.getInstanceID(), initialSlotReport); } else { if (isMaxSlotNumExceededAfterRegistration(initialSlotReport)) { LOG.info("The total number of slots exceeds the max limitation {}, release the excess resource.", maxSlotNum); resourceActions.releaseResource(taskExecutorConnection.getInstanceID(), new FlinkException("The total number of slots exceeds the max limitation.")); return; } ArrayList<SlotID> reportedSlots = new ArrayList<>(); for (SlotStatus slotStatus : initialSlotReport) { reportedSlots.add(slotStatus.getSlotID()); } TaskManagerRegistration taskManagerRegistration = new TaskManagerRegistration( taskExecutorConnection, reportedSlots); taskManagerRegistrations.put(taskExecutorConnection.getInstanceID(), taskManagerRegistration); for (SlotStatus slotStatus : initialSlotReport) { registerSlot( slotStatus.getSlotID(), slotStatus.getAllocationID(), slotStatus.getJobID(), slotStatus.getResourceProfile(), taskExecutorConnection); } } }
Source:
public void skipWindowsThatDontCleanTempFolder() { org.junit.Assume.assumeFalse(IS_WIN); }

Target:
public void skipWindowsThatDontCleanTempFolder() { assumeFalse(IS_WIN); }
Source:
public void convertCcDivisions_Same() { long idOne = 111; long idTwo = 222; CommonCourtDivision ccDivisionOne = new CommonCourtDivision(); ccDivisionOne.setName(ccDivisionNames[0]); Whitebox.setInternalState(ccDivisionOne, "id", idOne); CommonCourtDivision ccDivisionTwo = new CommonCourtDivision(); ccDivisionTwo.setName(ccDivisionNames[1]); Whitebox.setInternalState(ccDivisionTwo, "id", idTwo); List<CommonCourtDivision> ccDivisions = Arrays.asList(ccDivisionOne, ccDivisionTwo); List<SimpleEntity> convertedSimpleEntities = simpleEntityConverter.convertCcDivisions(ccDivisions); assertEquals(ccDivisionNames.length, convertedSimpleEntities.size()); assertEquals(idOne, convertedSimpleEntities.get(0).getId()); assertEquals(idTwo, convertedSimpleEntities.get(1).getId()); assertEquals(ccDivisionNames[0], convertedSimpleEntities.get(0).getName()); assertEquals(ccDivisionNames[1], convertedSimpleEntities.get(1).getName()); }

Target:
public void convertCcDivisions_Same() { long idOne = 111; long idTwo = 222; CommonCourtDivision ccDivisionOne = new CommonCourtDivision(); ccDivisionOne.setName(ccDivisionNames[0]); Whitebox.setInternalState(ccDivisionOne, "id", idOne); CommonCourtDivision ccDivisionTwo = new CommonCourtDivision(); ccDivisionTwo.setName(ccDivisionNames[1]); Whitebox.setInternalState(ccDivisionTwo, "id", idTwo); List<CommonCourtDivision> ccDivisions = Arrays.asList(ccDivisionOne, ccDivisionTwo); List<SimpleEntity> convertedSimpleEntities = simpleEntityConverter.convertCcDivisions(ccDivisions); assertEquals(ccDivisions.size(), convertedSimpleEntities.size()); assertEquals(idOne, convertedSimpleEntities.get(0).getId()); assertEquals(idTwo, convertedSimpleEntities.get(1).getId()); assertEquals(ccDivisionNames[0], convertedSimpleEntities.get(0).getName()); assertEquals(ccDivisionNames[1], convertedSimpleEntities.get(1).getName()); }
Source:
public void shouldNotBeAllowedToAttachTwoRules() { RetentionRule rr = createManualImmediateRuleMillis(100L); file = service.attachRule(file, rr, session); try { service.attachRule(file, rr, session); fail("Should not be abe to attach rule twice"); } catch (NuxeoException e) { } }

Target:
public void shouldNotBeAllowedToAttachTwoRules() { RetentionRule rr = createManualImmediateRuleMillis(100); file = service.attachRule(file, rr, session); try { service.attachRule(file, rr, session); fail("Should not be abe to attach rule twice"); } catch (NuxeoException e) { assertEquals("Document is already a record", e.getMessage()); } }
Source:
public void releaseStore(Store<?, ?> resource) { CacheStore cacheStore = (CacheStore) resource; Map.Entry<CachingTier.Provider, AuthoritativeTier.Provider> entry = providersMap.remove(resource); if (entry == null) { throw new IllegalArgumentException("Given store is not managed by this provider : " + resource); } entry.getKey().releaseCachingTier(cacheStore.cachingTier); entry.getValue().releaseAuthoritativeTier(cacheStore.authoritativeTier); }

Target:
public void releaseStore(Store<?, ?> resource) { Map.Entry<CachingTier.Provider, AuthoritativeTier.Provider> entry = providersMap.get(resource); if (entry == null) { throw new IllegalArgumentException("Given store is not managed by this provider : " + resource); } CacheStore cacheStore = (CacheStore) resource; entry.getKey().releaseCachingTier(cacheStore.cachingTier); entry.getValue().releaseAuthoritativeTier(cacheStore.authoritativeTier); }
Source:
public static void addTypeAnnotation(ASTRewrite astRewrite, ASTNode target, Annotation newAnnotation, TextEditGroup group) { if (target instanceof AnnotatableType) { AnnotatableType annotatableType= (AnnotatableType) target; if (annotatableType.isNameQualifiedType()) { ListRewrite listRewrite= astRewrite.getListRewrite(annotatableType, NameQualifiedType.ANNOTATIONS_PROPERTY); listRewrite.insertLast(newAnnotation, group); } else if (annotatableType.isSimpleType()) { SimpleType simpleType= (SimpleType) annotatableType; Name name2= simpleType.getName(); assert name2.isQualifiedName(); QualifiedName qualifiedName= (QualifiedName) name2; qualifiedName.getName(); Name qualifier= (Name) ASTNode.copySubtree(astRewrite.getAST(), qualifiedName.getQualifier()); SimpleName name= (SimpleName) ASTNode.copySubtree(astRewrite.getAST(), qualifiedName.getName()); NameQualifiedType nameQualifiedType= astRewrite.getAST().newNameQualifiedType(qualifier, name); nameQualifiedType.annotations().add(newAnnotation); astRewrite.replace(annotatableType, nameQualifiedType, group); } else if (annotatableType.isQualifiedType()) { ListRewrite listRewrite= astRewrite.getListRewrite(annotatableType, QualifiedType.ANNOTATIONS_PROPERTY); listRewrite.insertLast(newAnnotation, group); } } else if (target instanceof Dimension) { Dimension dimension= (Dimension) target; ListRewrite listRewrite= astRewrite.getListRewrite(dimension, Dimension.ANNOTATIONS_PROPERTY); listRewrite.insertLast(newAnnotation, group); } }

Target:
public static void addTypeAnnotation(ASTRewrite astRewrite, ASTNode target, Annotation newAnnotation, TextEditGroup group) { if (target instanceof AnnotatableType) { AnnotatableType annotatableType= (AnnotatableType) target; if (annotatableType.isSimpleType()) { SimpleType simpleType= (SimpleType) annotatableType; Name name2= simpleType.getName(); assert name2.isQualifiedName(); QualifiedName qualifiedName= (QualifiedName) name2; qualifiedName.getName(); Name qualifier= (Name) astRewrite.createMoveTarget(qualifiedName.getQualifier()); SimpleName name= (SimpleName) astRewrite.createMoveTarget(qualifiedName.getName()); NameQualifiedType nameQualifiedType= astRewrite.getAST().newNameQualifiedType(qualifier, name); nameQualifiedType.annotations().add(newAnnotation); astRewrite.replace(annotatableType, nameQualifiedType, group); } else if (annotatableType.isNameQualifiedType()) { ListRewrite listRewrite= astRewrite.getListRewrite(annotatableType, NameQualifiedType.ANNOTATIONS_PROPERTY); listRewrite.insertLast(newAnnotation, group); } else if (annotatableType.isQualifiedType()) { ListRewrite listRewrite= astRewrite.getListRewrite(annotatableType, QualifiedType.ANNOTATIONS_PROPERTY); listRewrite.insertLast(newAnnotation, group); } } else if (target instanceof Dimension) { Dimension dimension= (Dimension) target; ListRewrite listRewrite= astRewrite.getListRewrite(dimension, Dimension.ANNOTATIONS_PROPERTY); listRewrite.insertLast(newAnnotation, group); } }
Source:
public Collection<SlotOffer> offerSlots( Collection<? extends SlotOffer> offers, TaskManagerLocation taskManagerLocation, TaskManagerGateway taskManagerGateway, long currentTime) { LOG.debug("Received slot offers from TaskExecutor {}.", offers.size(), taskManagerLocation); final Collection<SlotOffer> acceptedSlotOffers = new ArrayList<>(); final Collection<SlotOffer> candidates = new ArrayList<>(); for (SlotOffer offer : offers) { final AllocationID allocationId = offer.getAllocationId(); if (slotPool.containsSlot(allocationId)) { acceptedSlotOffers.add(offer); } else { candidates.add(offer); } } final Collection<SlotOfferMatching> matchings = matchOffersWithOutstandingRequirements(candidates); final Collection<AllocatedSlot> acceptedSlots = new ArrayList<>(); ResourceCounter acceptedResources = ResourceCounter.empty(); for (SlotOfferMatching matching : matchings) { if (matching.getMatching().isPresent()) { final ResourceProfile matchedResourceProfile = matching.getMatching().get(); final AllocatedSlot allocatedSlot = createAllocatedSlot( matching.getSlotOffer(), taskManagerLocation, taskManagerGateway); acceptedSlots.add(allocatedSlot); acceptedSlotOffers.add(matching.getSlotOffer()); acceptedResources = acceptedResources.add(matchedResourceProfile, 1); slotToRequirementProfileMappings.put(allocatedSlot.getAllocationId(), matchedResourceProfile); } } slotPool.addSlots(acceptedSlots, currentTime); increaseAvailableResources(acceptedResources); if (!acceptedSlots.isEmpty()) { notifyNewSlots.accept(acceptedSlots); } return acceptedSlotOffers; }

Target:
public Collection<SlotOffer> offerSlots( Collection<? extends SlotOffer> offers, TaskManagerLocation taskManagerLocation, TaskManagerGateway taskManagerGateway, long currentTime) { LOG.debug("Received slot offers from TaskExecutor {}.", offers.size(), taskManagerLocation); final Collection<SlotOffer> acceptedSlotOffers = new ArrayList<>(); final Collection<AllocatedSlot> acceptedSlots = new ArrayList<>(); for (SlotOffer offer : offers) { if (slotPool.containsSlot(offer.getAllocationId())) { acceptedSlotOffers.add(offer); } else { Optional<AllocatedSlot> acceptedSlot = matchOfferWithOutstandingRequirements(offer, taskManagerLocation, taskManagerGateway); if (acceptedSlot.isPresent()) { acceptedSlotOffers.add(offer); acceptedSlots.add(acceptedSlot.get()); } } } slotPool.addSlots(acceptedSlots, currentTime); if (!acceptedSlots.isEmpty()) { notifyNewSlots.accept(acceptedSlots); } return acceptedSlotOffers; }
Source:
public void setError(@NonNull Context context, @Nullable Throwable caught) { Resources resources = context.getResources(); ErrorType errorType = getErrorType(context, caught); icon.setImageDrawable(ContextCompat.getDrawable(context, errorType.icon())); errorText.setText(resources.getString(errorType.text())); button.setText(resources.getString(errorType.buttonText())); button.setOnClickListener(errorType.buttonClickListener(this)); if (errorType.hasFooterText()) { footerText.setText(resources.getString(errorType.footerText())); } if (context instanceof PageActivity) { PageActivity activity = (PageActivity) context; contentTopOffset.setLayoutParams(getContentTopOffsetParams(activity)); contentTopOffset.setVisibility(View.VISIBLE); tabLayoutOffset.setLayoutParams(getTabLayoutOffsetParams(activity)); tabLayoutOffset.setVisibility(View.VISIBLE); } }

Target:
public void setError(@NonNull Context context, @Nullable Throwable caught) { Resources resources = context.getResources(); ErrorType errorType = getErrorType(context, caught); icon.setImageDrawable(ContextCompat.getDrawable(context, errorType.icon())); errorText.setText(resources.getString(errorType.text())); button.setText(resources.getString(errorType.buttonText())); button.setOnClickListener(errorType.buttonClickListener(this)); if (errorType.hasFooterText()) { footerText.setText(resources.getString(errorType.footerText())); } }
Source:
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args.length != 1) { return false; } if (args[0].equalsIgnoreCase("all") || args[0].equalsIgnoreCase("everyone")) { playerMsg("Correct usage: /opall"); return true; } OfflinePlayer player = null; for (Player onlinePlayer : server.getOnlinePlayers()) { if (args[0].equalsIgnoreCase(onlinePlayer.getName())) { player = onlinePlayer; } } if (player == null) { if (TFM_AdminList.isSuperAdmin(sender) || senderIsConsole) { player = TFM_DepreciationAggregator.getOfflinePlayer(server, args[0]); } else { playerMsg("That player is not online."); playerMsg("You don't have permissions to OP offline players.", ChatColor.YELLOW); return true; } } if (!player.isOp()) + { + TFM_Util.adminAction(sender.getName(), "Opping " + player.getName(), false); + player.setOp(true); + } + else + { + playerMsg("The player you are trying to OP is already OP!"); + } return true; }

Target:
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args.length != 1) { return false; } if (args[0].equalsIgnoreCase("all") || args[0].equalsIgnoreCase("everyone")) { playerMsg("Correct usage: /opall"); return true; } OfflinePlayer player = null; for (Player onlinePlayer : server.getOnlinePlayers()) { if (args[0].equalsIgnoreCase(onlinePlayer.getName())) { player = onlinePlayer; } } if (player == null) { if (TFM_AdminList.isSuperAdmin(sender) || senderIsConsole) { player = TFM_DepreciationAggregator.getOfflinePlayer(server, args[0]); } else { playerMsg("That player is not online."); playerMsg("You don't have permissions to OP offline players.", ChatColor.YELLOW); return true; } } if (!player.isOp()) { TFM_Util.adminAction(sender.getName(), "Opping " + player.getName(), false); player.setOp(true); } else { playerMsg("The player you are trying to OP is already OP!"); } return true; }
Source:
public void setTasksStatusDown(Process process) { Task currentTask = ServiceManager.getProcessService().getCurrentTask(process); setTaskStatusDown(currentTask); }

Target:
public void setTasksStatusDown(Process process) { List<Task> currentTask = ServiceManager.getProcessService().getCurrentTasks(process); if (currentTask.isEmpty()) { currentTask = getLastClosedTask(process); } setTaskStatusDown(currentTask); }
Source:
public void parseConfig(List<String> configParts) throws BindingConfigParseException { String address = ""; for (int i = 0; i < configParts.size(); i++) { String paramName = configParts.get(i).split("=")[0].toLowerCase(); String paramValue = configParts.get(i).split("=")[1]; switch (paramName) { case "commandon": commandON = paramValue; break; case "commandoff": commandOFF = paramValue; break; case "address": address = paramValue; break; } } if (!address.equals("")) { logger.warn("The address-parameter is deprecated! Please use just commandOn and commandOff."); logger.warn("type=raw;commandOn={}{};commandOff={}{}", address, commandON, address, commandOFF); commandON = address + commandON; commandOFF = address + commandOFF; } logger.trace("commandON = {}", commandON); logger.trace("commandOFF = {}", commandOFF); }

Target:
public void parseConfig(List<String> configParts) throws BindingConfigParseException { String address = ""; for (int i = 0; i < configParts.size(); i++) { String paramName = configParts.get(i).split("=")[0].toLowerCase(); String paramValue = configParts.get(i).split("=")[1]; switch (paramName) { case "commandon": commandON = paramValue; break; case "commandoff": commandOFF = paramValue; break; case "address": address = paramValue; break; } } if (StringUtils.isNotBlank(address)) { logger.warn("The address parameter is deprecated! Please use just commandOn and commandOff."); logger.warn("type=raw;commandOn={}{};commandOff={}{}", address, commandON, address, commandOFF); commandON = address + commandON; commandOFF = address + commandOFF; } logger.trace("commandON = {}", commandON); logger.trace("commandOFF = {}", commandOFF); }
Source:
public static Slice serialize(Geometry geometry) { int spatialReferenceId = geometry.getSRID(); SliceOutput sliceOutput = new DynamicSliceOutput(100); sliceOutput.appendInt(spatialReferenceId); switch (geometry.getGeometryType()) { case JTS_POINT: writePoint((Point) geometry, sliceOutput); break; case JTS_MULTI_POINT: writeMultiPoint((MultiPoint) geometry, sliceOutput); break; case JTS_LINESTRING: case JTS_MULTI_LINESTRING: writePolyline(geometry, sliceOutput); break; case JTS_POLYGON: case JTS_MULTI_POLYGON: writePolygon(geometry, sliceOutput); break; case JTS_GEOMETRY_COLLECTION: for (int i = 0; i < geometry.getNumGeometries(); i++) { Slice slice = serialize(geometry.getGeometryN(i)); sliceOutput.appendBytes(slice.getBytes(4, slice.length() - 4)); } break; } return sliceOutput.slice(); }

Target:
public static Slice serialize(Geometry geometry) { SliceOutput output = new DynamicSliceOutput(100); boolean inGeometryCollection = geometry.getGeometryType().equals(JTS_GEOMETRY_COLLECTION); if (inGeometryCollection) { output.writeByte(GeometryUtils.GeometryTypeName.GEOMETRY_COLLECTION.code()); for (int i = 0; i < geometry.getNumGeometries(); i++) { writeGeometry(geometry.getGeometryN(i), output, true); } } else { writeGeometry(geometry, output, false); } return output.slice(); }
Source:
public void showToast(int textId, ToastUtil.ToastType toastType) { if (getActivity() != null) ToastUtil.showShortToast(getActivity(), toastType, getResources().getString(textId)); }

Target:
public void showToast(int textId, ToastUtil.ToastType toastType) { if (getActivity() != null) { ToastUtil.showShortToast(getActivity(), toastType, getResources().getString(textId)); } }
Source:
Options findOptions(Object[] argv) { if (argv == null || argv.length == 0) { return this.options; } return Stream.of(argv).filter(o -> o instanceof Options).findAny().map(o -> (Options) o) .orElse(this.options); }

Target:
Options findOptions(Object[] argv) { if (argv == null || argv.length == 0) { return this.options; } return (Options) Stream.of(argv) .filter(o -> o instanceof Options) .findFirst() .orElse(this.options); }
Source:
public ScheduledExecutorService createRetryDriverScheduledExecutor(ThriftConnectorConfig config) { return newScheduledThreadPool(config.getMetadataRefreshThreads(), threadsNamed("thrift-retry-driver-%s")); }

Target:
public ListeningScheduledExecutorService createRetryDriverScheduledExecutor(ThriftConnectorConfig config) { return listeningDecorator(newScheduledThreadPool(config.getRetryDriverThreads(), threadsNamed("thrift-retry-driver-%s"))); }
Source:
public MappingJacksonValue get(@PathVariable final String id, @RequestParam(required = false) String attributes) { Group group = scimGroupProvisioning.getById(id); return buildWrapper(group, attributes); }

Target:
public MappingJacksonValue get(@PathVariable final String id, @RequestParam(required = false) String attributes) { Group group = scimGroupProvisioning.getById(id); return buildResponse(group, attributes); }
Source:
public static void waitUntilURLDifferentFrom(String url) { final String refurl = url; log.info("Watch URL: " + refurl); ExpectedCondition<Boolean> urlchanged = d -> { if (d == null) { return false; } String currentUrl = d.getCurrentUrl(); log.debug("Compared with: " + currentUrl); AbstractTest.log.debug("currentUrl is still: " + currentUrl); return !currentUrl.equals(refurl); }; WebDriverWait wait = new WebDriverWait(AbstractTest.driver, URLCHANGE_MAX_WAIT); wait.until(urlchanged); if (AbstractTest.driver.getCurrentUrl().equals(refurl)) { log.warn("Page change failed"); } }

Target:
public static void waitUntilURLDifferentFrom(String url) { final String refurl = url; AbstractTest.log.debug("Watch URL: " + refurl); ExpectedCondition<Boolean> urlchanged = d -> { if (d == null) { return false; } String currentUrl = d.getCurrentUrl(); AbstractTest.log.debug("currentUrl is still: " + currentUrl); return !currentUrl.equals(refurl); }; WebDriverWait wait = new WebDriverWait(AbstractTest.driver, URLCHANGE_MAX_WAIT); wait.until(urlchanged); if (AbstractTest.driver.getCurrentUrl().equals(refurl)) { AbstractTest.log.warn("Page change failed"); } }
Source:
public void bindingChanged(BindingProvider provider, String itemName) { logger.debug("bindingChanged(): Item Name: {}", itemName); logger.debug("Provider items count: {}", provider.getItemNames().size()); itemUpdateDisabled = true; if (provider.getItemNames().size() >= itemCount) { triggerItemsUpdate = true; } itemCount = provider.getItemNames().size(); super.bindingChanged(provider, itemName); }

Target:
public void bindingChanged(BindingProvider provider, String itemName) { logger.debug("bindingChanged(): Item Name: Provider items count: {}", itemName, provider.getItemNames().size()); itemUpdateDisabled = true; if (provider.getItemNames().size() >= itemCount) { triggerItemsUpdate = true; } itemCount = provider.getItemNames().size(); super.bindingChanged(provider, itemName); }
Source:
private InfinispanContext(Map<String, String> properties) { this.infinispanConfiguration = new InfinispanConfiguration(); schemaGenerator = new SchemaGenerator(); ConfigurationBuilder builder = new ConfigurationBuilder(); builder.addServer() .host(properties.get(HOST)) .port(Integer.parseInt(properties.get(PORT))) .marshaller(new ProtoStreamMarshaller()) .marshaller(marshaller); cacheManager = new RemoteCacheManager(builder.build()); if (!this.getIndices().contains(TYPES_CACHE)) { cacheManager.administration().createCache(TYPES_CACHE, this.infinispanConfiguration.getConfiguration(TYPES_CACHE)); } if (!this.getIndices().contains(SCHEMAS_CACHE)) { cacheManager.administration().createCache(SCHEMAS_CACHE, this.infinispanConfiguration.getConfiguration(SCHEMAS_CACHE)); } marshaller.registerMarshaller(new KieProtostreamMarshaller.KieMarshallerSupplier<KObject>() { @Override public String extractTypeFromEntity(KObject entity) { return ORG_KIE + AttributesUtil.toProtobufFormat(entity.getClusterId() + "_" + entity.getType().getName()); } @Override public Class<KObject> getJavaClass() { return KObject.class; } @Override public BaseMarshaller<KObject> getMarshallerForType(String typeName) { return new KObjectMarshaller(typeName); } }); SerializationContext serializationContext = ProtoStreamMarshaller.getSerializationContext(cacheManager); addProtobufClass(serializationContext, SCHEMA_PROTO, Schema.class); }

Target:
private InfinispanContext(Map<String, String> properties) { this.infinispanConfiguration = new InfinispanConfiguration(); schemaGenerator = new SchemaGenerator(); cacheManager = this.createRemoteCache(properties); if (!this.getIndices().contains(TYPES_CACHE)) { cacheManager.administration().createCache(TYPES_CACHE, this.infinispanConfiguration.getConfiguration(TYPES_CACHE)); } if (!this.getIndices().contains(SCHEMAS_CACHE)) { cacheManager.administration().createCache(SCHEMAS_CACHE, this.infinispanConfiguration.getConfiguration(SCHEMAS_CACHE)); } marshaller.registerMarshaller(new KieProtostreamMarshaller.KieMarshallerSupplier<KObject>() { @Override public String extractTypeFromEntity(KObject entity) { return ORG_KIE + AttributesUtil.toProtobufFormat(entity.getClusterId() + "_" + entity.getType().getName()); } @Override public Class<KObject> getJavaClass() { return KObject.class; } @Override public BaseMarshaller<KObject> getMarshallerForType(String typeName) { return new KObjectMarshaller(typeName); } }); SerializationContext serializationContext = ProtoStreamMarshaller.getSerializationContext(cacheManager); addProtobufClass(serializationContext, SCHEMA_PROTO, Schema.class); this.loadProtobufSchema(getProtobufCache()); }
Source:
public void run(CommandLine theCommandLine) throws ParseException { parseFhirContext(theCommandLine); FhirContext ctx = getFhirContext(); String termUrl = theCommandLine.getOptionValue("u"); if (isBlank(termUrl)) { throw new ParseException("No URL provided"); } String[] datafile = theCommandLine.getOptionValues("d"); if (datafile == null || datafile.length == 0) { throw new ParseException("No data file provided"); } IGenericClient client = super.newClient(theCommandLine); IBaseParameters inputParameters = ParametersUtil.newInstance(myFhirCtx); ParametersUtil.addParameterToParametersUri(myFhirCtx, inputParameters, "url", termUrl); for (String next : datafile) { ParametersUtil.addParameterToParametersString(myFhirCtx, inputParameters, "localfile", next); } if (theCommandLine.hasOption("custom")) { ParametersUtil.addParameterToParametersCode(myFhirCtx, inputParameters, "contentMode", "custom"); } if (theCommandLine.hasOption(VERBOSE_LOGGING_PARAM)) { client.registerInterceptor(new LoggingInterceptor(true)); } ourLog.info("Beginning upload - This may take a while..."); IBaseParameters response; switch (myFhirCtx.getVersion().getVersion()) { case DSTU3: response = client .operation() .onType(org.hl7.fhir.dstu3.model.CodeSystem.class) .named(UPLOAD_EXTERNAL_CODE_SYSTEM) .withParameters(inputParameters) .execute(); break; case R4: response = client .operation() .onType(CodeSystem.class) .named(UPLOAD_EXTERNAL_CODE_SYSTEM) .withParameters(inputParameters) .execute(); break; default: throw new UnsupportedOperationException("This command does not currently support " + myFhirCtx.getVersion().getVersion()); } ourLog.info("Upload complete!"); ourLog.info("Response:\n{}", ctx.newXmlParser().setPrettyPrint(true).encodeResourceToString(response)); }

Target:
public void run(CommandLine theCommandLine) throws ParseException { parseFhirContext(theCommandLine); String termUrl = theCommandLine.getOptionValue("u"); if (isBlank(termUrl)) { throw new ParseException("No URL provided"); } String[] datafile = theCommandLine.getOptionValues("d"); if (datafile == null || datafile.length == 0) { throw new ParseException("No data file provided"); } IGenericClient client = super.newClient(theCommandLine); IBaseParameters inputParameters = ParametersUtil.newInstance(myFhirCtx); ParametersUtil.addParameterToParametersUri(myFhirCtx, inputParameters, "url", termUrl); for (String next : datafile) { ParametersUtil.addParameterToParametersString(myFhirCtx, inputParameters, "localfile", next); } if (theCommandLine.hasOption("custom")) { ParametersUtil.addParameterToParametersCode(myFhirCtx, inputParameters, "contentMode", "custom"); } if (theCommandLine.hasOption(VERBOSE_LOGGING_PARAM)) { client.registerInterceptor(new LoggingInterceptor(true)); } ourLog.info("Beginning upload - This may take a while..."); IBaseParameters response = client .operation() .onType(myFhirCtx.getResourceDefinition("CodeSystem").getImplementingClass()) .named(UPLOAD_EXTERNAL_CODE_SYSTEM) .withParameters(inputParameters) .execute(); ourLog.info("Upload complete!"); ourLog.info("Response:\n{}", myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(response)); }
Source:
public HistoryTreeStub getHistoryTree() { return (HistoryTreeStub) NonNullUtils.checkNotNull(super.getSHT()); }

Target:
public HistoryTreeStub getHistoryTree() { return (HistoryTreeStub) super.getSHT(); }