auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private String formProfileUrl(String clusterId, String volumeId, boolean isBrickProfileSelected) { String apiMatrixParam = !isBrickProfileSelected ? ";nfsStatistics=true" : ""; return StringFormat.format("/ovirt-engine/api/clusters/%s/glustervolumes/%s/profilestatistics%s?accept=text/plain", clusterId, volumeId, apiMatrixParam); }

Target:
private String formProfileUrl(String clusterId, String volumeId, boolean isBrickProfileSelected) { String apiMatrixParam = !isBrickProfileSelected ? ";nfsStatistics=true" : ""; return StringFormat.format("/ovirt-engine/api/clusters/%s/glustervolumes/%s/profilestatistics%s?accept=application/json", clusterId, volumeId, apiMatrixParam); }
Source:
private boolean isOfAcceptedType(Object o) { for (Class<?> fAcceptedType : fAcceptedTypes) { if (fAcceptedType.isInstance(o)) { return true; } } return false; }

Target:
private boolean isOfAcceptedType(Object o) { for (Class<?> type : fAcceptedTypes) { if (type.isInstance(o)) { return true; } } return false; }
Source:
protected void recvCommands() throws IOException { for (;;) { String line; try { line = pckIn.readStringRaw(); } catch (EOFException eof) { if (commands.isEmpty()) return; throw eof; } if (line == PacketLineIn.END) break; if (line.length() >= 48 && line.startsWith("shallow ")) { clientShallowCommits.add(ObjectId.fromString(line.substring(8, 48))); continue; } if (commands.isEmpty()) { final FirstLine firstLine = new FirstLine(line); enabledCapabilities = firstLine.getCapabilities(); line = firstLine.getLine(); if (line.equals(GitProtocolConstants.OPTION_PUSH_CERT)) pushCertificateParser.receiveHeader(pckIn, !isBiDirectionalPipe()); } if (line.equals("-----BEGIN PGP SIGNATURE-----\n")) pushCertificateParser.receiveSignature(pckIn); if (pushCertificateParser.enabled()) pushCertificateParser.addCommand(line); if (line.length() < 83) { final String m = JGitText.get().errorInvalidProtocolWantedOldNewRef; sendError(m); throw new PackProtocolException(m); } final ReceiveCommand cmd = parseCommand(line); if (cmd.getRefName().equals(Constants.HEAD)) { cmd.setResult(Result.REJECTED_CURRENT_BRANCH); } else { cmd.setRef(refs.get(cmd.getRefName())); } commands.add(cmd); } }

Target:
protected void recvCommands() throws IOException { for (;;) { String rawLine; try { rawLine = pckIn.readStringRaw(); } catch (EOFException eof) { if (commands.isEmpty()) return; throw eof; } if (rawLine == PacketLineIn.END) { break; } String line = chomp(rawLine); if (line.length() >= 48 && line.startsWith("shallow ")) { clientShallowCommits.add(ObjectId.fromString(line.substring(8, 48))); continue; } if (commands.isEmpty()) { final FirstLine firstLine = new FirstLine(line); enabledCapabilities = firstLine.getCapabilities(); line = firstLine.getLine(); if (line.equals(GitProtocolConstants.OPTION_PUSH_CERT)) pushCertificateParser.receiveHeader(pckIn, !isBiDirectionalPipe()); } if (line.equals("-----BEGIN PGP SIGNATURE-----\n")) pushCertificateParser.receiveSignature(pckIn); if (pushCertificateParser.enabled()) { pushCertificateParser.addCommand(rawLine); } if (line.length() < 83) { final String m = JGitText.get().errorInvalidProtocolWantedOldNewRef; sendError(m); throw new PackProtocolException(m); } final ReceiveCommand cmd = parseCommand(line); if (cmd.getRefName().equals(Constants.HEAD)) { cmd.setResult(Result.REJECTED_CURRENT_BRANCH); } else { cmd.setRef(refs.get(cmd.getRefName())); } commands.add(cmd); } }
Source:
public final byte[] getTREs(final TaggedRecordExtensionHandler handler, final TreSource source) throws NitfFormatException, IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); for (Tre tre : handler.getTREsRawStructure().getTREsForSource(source)) { String name = padStringToLength(tre.getName(), TreConstants.TAG_LENGTH); baos.write(name.getBytes(StandardCharsets.ISO_8859_1)); if (tre.getRawData() != null) { String tagLen = padIntegerToLength(tre.getRawData().length, TreConstants.TAGLEN_LENGTH); baos.write(tagLen.getBytes(StandardCharsets.ISO_8859_1)); baos.write(tre.getRawData()); } else { byte[] treData = serializeTRE(tre); baos.write(padIntegerToLength(treData.length, TreConstants.TAGLEN_LENGTH).getBytes(StandardCharsets.ISO_8859_1)); baos.write(treData); } } return baos.toByteArray(); }

Target:
public final byte[] getTREs(final TaggedRecordExtensionHandler handler, final TreSource source) throws NitfFormatException, IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); for (Tre tre : handler.getTREsRawStructure().getTREsForSource(source)) { String name = padStringToLength(tre.getName(), TAG_LENGTH); baos.write(name.getBytes(StandardCharsets.ISO_8859_1)); if (tre.getRawData() != null) { String tagLen = padIntegerToLength(tre.getRawData().length, TAGLEN_LENGTH); baos.write(tagLen.getBytes(StandardCharsets.ISO_8859_1)); baos.write(tre.getRawData()); } else { byte[] treData = serializeTRE(tre); baos.write(padIntegerToLength(treData.length, TAGLEN_LENGTH).getBytes(StandardCharsets.ISO_8859_1)); baos.write(treData); } } return baos.toByteArray(); }
Source:
private void addContentProposalToUriText(Text uriTextField) { KeyStroke keyStroke; try { keyStroke = KeyStroke.getInstance("M1+Space"); } catch (ParseException e) { return; } ControlDecoration dec = new ControlDecoration(uriTextField, SWT.TOP | SWT.LEFT); if (Platform.isRunning()) { dec.setImage(FieldDecorationRegistry.getDefault() .getFieldDecoration( FieldDecorationRegistry.DEC_CONTENT_PROPOSAL) .getImage()); } dec.setShowOnlyOnFocus(true); dec.setShowHover(true); dec.setDescriptionText(NLS.bind( UIText.RepositorySelectionPage_ShowPrevisousURIs_Tooltip, keyStroke.format())); IContentProposalProvider cp = new IContentProposalProvider() { public IContentProposal[] getProposals(String contents, int position) { List<IContentProposal> resultList = new ArrayList<IContentProposal>(); Set<String> uriStrings = getUrisFromPrefs(); for (final String uriString : uriStrings) { IContentProposal propsal = new IContentProposal() { public String getLabel() { return null; } public String getDescription() { return null; } public int getCursorPosition() { return 0; } public String getContent() { return uriString; } }; resultList.add(propsal); } return resultList.toArray(new IContentProposal[resultList .size()]); } }; new ContentProposalAdapter(uriTextField, new TextContentAdapter(), cp, keyStroke, new char[0]) .setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE); }

Target:
private void addContentProposalToUriText(Text uriTextField) { ControlDecoration dec = new ControlDecoration(uriTextField, SWT.TOP | SWT.LEFT); if (Platform.isRunning()) { dec.setImage(FieldDecorationRegistry.getDefault() .getFieldDecoration( FieldDecorationRegistry.DEC_CONTENT_PROPOSAL) .getImage()); } dec.setShowOnlyOnFocus(true); dec.setShowHover(true); dec.setDescriptionText(UIText.RepositorySelectionPage_ShowPreviousURIs_HoverText); IContentProposalProvider cp = new IContentProposalProvider() { public IContentProposal[] getProposals(String contents, int position) { List<IContentProposal> resultList = new ArrayList<IContentProposal>(); String patternString = contents.replaceAll("\\x2A", ".*"); if (!patternString.endsWith(".*")) { patternString = patternString + ".*"; } Pattern pattern; try { pattern = Pattern.compile(patternString, Pattern.CASE_INSENSITIVE); } catch (PatternSyntaxException e) { pattern = null; } Set<String> uriStrings = getUrisFromPrefs(); for (final String uriString : uriStrings) { if (pattern!=null && !pattern.matcher(uriString).matches()) continue; IContentProposal propsal = new IContentProposal() { public String getLabel() { return null; } public String getDescription() { return null; } public int getCursorPosition() { return 0; } public String getContent() { return uriString; } }; resultList.add(propsal); } return resultList.toArray(new IContentProposal[resultList .size()]); } }; new ContentProposalAdapter(uriTextField, new TextContentAdapter(), cp, null, null) .setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE); }
Source:
public int compareTo(PickerMilestone milestone) { if (isSelected != milestone.isSelected()) { return isSelected ? -1 : 1; } if (this.isOpen() != milestone.isOpen()) { return this.isOpen() ? -1 : 1; } if (!this.getDueDate().isPresent()) return 1; if (!milestone.getDueDate().isPresent()) return -1; LocalDate thisDueDate = this.getDueDate().get(); LocalDate otherDueDate = milestone.getDueDate().get(); if (!thisDueDate.isEqual(otherDueDate)) { return thisDueDate.isBefore(otherDueDate) ? -1 : 1; } return this.getTitle().compareTo(milestone.getTitle()); }

Target:
public int compareTo(PickerMilestone milestone) { if (isSelected != milestone.isSelected()) { return isSelected ? -1 : 1; } if (this.isOpen() != milestone.isOpen()) { return this.isOpen() ? -1 : 1; } if (this.getDueDate().equals(milestone.getDueDate())) { return this.getTitle().compareTo(milestone.getTitle()); } if (!this.getDueDate().isPresent()) return 1; if (!milestone.getDueDate().isPresent()) return -1; return this.getDueDate().get().isBefore(milestone.getDueDate().get()) ? -1 : 1; }
Source:
public static Optional<DBMSType> fromString(String typeName) { if (typeName == null) { return Optional.empty(); } else { try { return Optional.of(Enum.valueOf(DBMSType.class, typeName.toUpperCase(Locale.ENGLISH))); } catch (IllegalArgumentException exception) { return Optional.empty(); } } }

Target:
public static Optional<DBMSType> fromString(String typeName) { return Arrays.stream(DBMSType.values()).filter(dbmsType -> dbmsType.type.equalsIgnoreCase(typeName)).findAny(); }
Source:
public void setupFieldLayout() { if (this.field.isShowLabel()) { if (labelTextView != null) { labelTextView.setText(this.field.getLabel()); labelTextView.setVisibility(VISIBLE); if (this.field.isRequired()) { Spannable requiredAlert = ThemeUtil.getRequiredSpannable(getContext()); labelTextView.append(requiredAlert); } } } else { if (labelTextView != null) { labelTextView.setVisibility(GONE); } } if (this.field.getPlaceHolder() != null && !this.field.getPlaceHolder().isEmpty()) { textEditText.setHint(this.field.getPlaceHolder()); } if (this.field.getTip() != null && !this.field.getTip().isEmpty()) { hintTextView.setText(this.field.getTip()); hintTextView.setVisibility(VISIBLE); } }

Target:
public void setupFieldLayout() { if (this.field.isShowLabel()) { if (labelTextView != null) { labelTextView.setText(this.field.getLabel()); labelTextView.setVisibility(VISIBLE); if (this.field.isRequired()) { Spannable requiredAlert = ThemeUtil.getRequiredSpannable(getContext()); labelTextView.append(requiredAlert); } } } else { if (labelTextView != null) { labelTextView.setVisibility(GONE); } } if (this.field.getPlaceHolder() != null && !this.field.getPlaceHolder().isEmpty()) { textEditText.setHint(this.field.getPlaceHolder()); } if (!StringUtils.isNullOrEmpty(this.field.getTip())) { hintTextView.setText(this.field.getTip()); hintTextView.setVisibility(VISIBLE); } }
Source:
public synchronized void updatePartitionStatistics(String databaseName, String tableName, String partitionName, Function<PartitionStatistics, PartitionStatistics> update) { PartitionStatistics originalStatistics = requireNonNull( getPartitionStatistics(databaseName, tableName, ImmutableSet.of(partitionName)).get(partitionName), "getPartitionStatistics() returned null"); PartitionStatistics updatedStatistics = update.apply(originalStatistics); Table table = getRequiredTable(databaseName, tableName); List<String> partitionValues = extractPartitionKeyValues(partitionName); Path partitionDirectory = getPartitionMetadataDirectory(table, partitionValues); PartitionMetadata partitionMetadata = readSchemaFile("partition", partitionDirectory, partitionCodec) .orElseThrow(() -> new PartitionNotFoundException(new SchemaTableName(databaseName, tableName), partitionValues)); PartitionMetadata updatedMetadata = partitionMetadata .withParameters(updateStatisticParameters(partitionMetadata.getParameters(), updatedStatistics.getBasicStatistics())) .withColumnStatistics(updatedStatistics.getColumnStatistics()); writeSchemaFile("partition", partitionDirectory, partitionCodec, updatedMetadata, true); }

Target:
public synchronized void updatePartitionStatistics(String databaseName, String tableName, String partitionName, Function<PartitionStatistics, PartitionStatistics> update) { PartitionStatistics originalStatistics = getPartitionStatistics(databaseName, tableName, ImmutableSet.of(partitionName)).get(partitionName); if (originalStatistics == null) { throw new PrestoException(HIVE_PARTITION_DROPPED_DURING_QUERY, "Statistics result does not contain entry for partition: " + partitionName); } PartitionStatistics updatedStatistics = update.apply(originalStatistics); Table table = getRequiredTable(databaseName, tableName); List<String> partitionValues = extractPartitionKeyValues(partitionName); Path partitionDirectory = getPartitionMetadataDirectory(table, partitionValues); PartitionMetadata partitionMetadata = readSchemaFile("partition", partitionDirectory, partitionCodec) .orElseThrow(() -> new PartitionNotFoundException(new SchemaTableName(databaseName, tableName), partitionValues)); PartitionMetadata updatedMetadata = partitionMetadata .withParameters(updateStatisticsParameters(partitionMetadata.getParameters(), updatedStatistics.getBasicStatistics())) .withColumnStatistics(updatedStatistics.getColumnStatistics()); writeSchemaFile("partition", partitionDirectory, partitionCodec, updatedMetadata, true); }
Source:
public boolean supports(DataHolder dataHolder) { return dataHolder instanceof ItemStack && ((ItemStack) dataHolder).getItem().equals(Item.getItemFromBlock(Blocks.sponge)); }

Target:
public boolean supports(DataHolder dataHolder) { return dataHolder instanceof EntityWolf || ((dataHolder instanceof ItemStack) && ((ItemStack) dataHolder).getItem().equals(ItemTypes.SPONGE)); }
Source:
public void testBuildWithPull() throws Exception { final String dockerDirectory = Resources.getResource("dockerDirectory").getPath(); final String pullMsg = "Pulling from"; sut.build(Paths.get(dockerDirectory)); final AtomicBoolean pulled = new AtomicBoolean(false); sut.build(Paths.get(dockerDirectory), "test", new ProgressHandler() { @Override public void progress(ProgressMessage message) throws DockerException { if (message.stream().contains(pullMsg)) { pulled.set(true); } } }, PULL); assertTrue(pulled.get()); }

Target:
public void testBuildWithPull() throws Exception { assumeTrue("We need Docker API >= v1.19 to run this test." + "This Docker API is " + sut.version().apiVersion(), versionCompare(sut.version().apiVersion(), "1.19") >= 0); final String dockerDirectory = Resources.getResource("dockerDirectory").getPath(); final String pullMsg = "Pulling from"; sut.build(Paths.get(dockerDirectory)); final AtomicBoolean pulled = new AtomicBoolean(false); sut.build(Paths.get(dockerDirectory), "test", new ProgressHandler() { @Override public void progress(ProgressMessage message) throws DockerException { if (message.status().contains(pullMsg)) { pulled.set(true); } } }, PULL_NEWER_IMAGE); assertTrue(pulled.get()); }
Source:
private Boolean hasUnavailableModifier(final List<SwiftParser.AttributeContext> attributes) { return attributes.stream().anyMatch(atr -> AVAILABLE_UNAVAILABLE.equals(atr.getText())); }

Target:
private boolean hasUnavailableModifier(final List<SwiftParser.AttributeContext> attributes) { return attributes.stream().anyMatch(atr -> AVAILABLE_UNAVAILABLE.equals(atr.getText())); }
Source:
public void testFromProductName() { assertThat(fromProductName("HSQL Database Engine")).isEqualTo(HSQL); assertThat(fromProductName("Oracle")).isEqualTo(ORACLE); assertThat(fromProductName("PostgreSQL")).isEqualTo(POSTGRES); assertThat(fromProductName("MySQL")).isEqualTo(MYSQL); assertThat(fromProductName("MariaDB")).isEqualTo(MYSQL); }

Target:
public void testFromProductName() { assertEquals(HSQL, fromProductName("HSQL Database Engine")); assertEquals(ORACLE, fromProductName("Oracle")); assertEquals(POSTGRES, fromProductName("PostgreSQL")); assertEquals(MYSQL, fromProductName("MySQL")); assertEquals(MYSQL, fromProductName("MariaDB")); }
Source:
protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) { BeanDefinitionBuilder builder = this.buildBeanDefinition(element, parserContext); AbstractBeanDefinition beanDefinition = builder.getBeanDefinition(); if (!BasicSingleFinalSubscriberChannel.class.getName().equals(builder.getBeanDefinition().getBeanClassName())) { ManagedList interceptors = null; Element interceptorsElement = DomUtils.getChildElementByTagName(element, "interceptors"); if (interceptorsElement != null) { ChannelInterceptorParser interceptorParser = new ChannelInterceptorParser(); interceptors = interceptorParser.parseInterceptors(interceptorsElement, parserContext); } if (interceptors == null) { interceptors = new ManagedList(); } String datatypeAttr = element.getAttribute("datatype"); if (StringUtils.hasText(datatypeAttr)) { builder.addPropertyValue("datatypes", datatypeAttr); } String messageConverter = element.getAttribute("message-converter"); if (StringUtils.hasText(messageConverter)) { builder.addPropertyReference("messageConverter", messageConverter); } builder.addPropertyValue("interceptors", interceptors); String scopeAttr = element.getAttribute("scope"); if (StringUtils.hasText(scopeAttr)) { builder.setScope(scopeAttr); } } beanDefinition.setSource(parserContext.extractSource(element)); return beanDefinition; }

Target:
protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) { BeanDefinitionBuilder builder = this.buildBeanDefinition(element, parserContext); AbstractBeanDefinition beanDefinition = builder.getBeanDefinition(); Element interceptorsElement = DomUtils.getChildElementByTagName(element, "interceptors"); String datatypeAttr = element.getAttribute("datatype"); String messageConverter = element.getAttribute("message-converter"); if (!FixedSubscriberChannel.class.getName().equals(builder.getBeanDefinition().getBeanClassName())) { ManagedList interceptors = null; if (interceptorsElement != null) { ChannelInterceptorParser interceptorParser = new ChannelInterceptorParser(); interceptors = interceptorParser.parseInterceptors(interceptorsElement, parserContext); } if (interceptors == null) { interceptors = new ManagedList(); } if (StringUtils.hasText(datatypeAttr)) { builder.addPropertyValue("datatypes", datatypeAttr); } if (StringUtils.hasText(messageConverter)) { builder.addPropertyReference("messageConverter", messageConverter); } builder.addPropertyValue("interceptors", interceptors); String scopeAttr = element.getAttribute("scope"); if (StringUtils.hasText(scopeAttr)) { builder.setScope(scopeAttr); } } else { if (interceptorsElement != null) { parserContext.getReaderContext().error("Cannot have interceptors when 'fixed-subscriber=\"true\"'", element); } if (StringUtils.hasText(datatypeAttr)) { parserContext.getReaderContext().error("Cannot have 'datatype' when 'fixed-subscriber=\"true\"'", element); } if (StringUtils.hasText(messageConverter)) { parserContext.getReaderContext().error("Cannot have 'message-converter' when 'fixed-subscriber=\"true\"'", element); } } beanDefinition.setSource(parserContext.extractSource(element)); return beanDefinition; }
Source:
public void setTreeElementVariables(CreatedOutput element) { if (element != null) { OutputDescriptor descriptor = element.getDescriptor(); if (descriptor != null && descriptor.getSourceElement() != null) { ctx.getInterpreter().setVariable(IInterpreterSiriusVariables.CONTAINER, descriptor.getSourceElement()); } EObject createdElement = element.getCreatedElement(); if (createdElement != null) { ctx.getInterpreter().setVariable(IInterpreterSiriusVariables.CONTAINER_VIEW, createdElement); if (createdElement.eContainer() != null) { ctx.getInterpreter().setVariable(IInterpreterSiriusVariables.VIEW, createdElement.eContainer()); } } } }

Target:
private void setTreeElementVariables(CreatedOutput element) { if (element != null) { OutputDescriptor descriptor = element.getDescriptor(); if (descriptor != null && descriptor.getSourceElement() != null) { ctx.getInterpreter().setVariable(IInterpreterSiriusVariables.CONTAINER, descriptor.getSourceElement()); } EObject createdElement = element.getCreatedElement(); if (createdElement != null) { ctx.getInterpreter().setVariable(IInterpreterSiriusVariables.CONTAINER_VIEW, createdElement); } } }
Source:
public boolean isLoggedIn() { return token != null && hub != null; }

Target:
public boolean isLoggedIn() { return token != null && user != null; }
Source:
public Socket createSocket(Socket socket, String host, int port, String clientCertificateAlias) throws NoSuchAlgorithmException, KeyManagementException, MessagingException, IOException { TrustManager[] trustManagers = new TrustManager[] { TrustManagerFactory.get(host, port) }; KeyManager[] keyManagers = null; if (!TextUtils.isEmpty(clientCertificateAlias)) { keyManagers = new KeyManager[] { new KeyChainKeyManager(context, clientCertificateAlias) }; } SSLContext sslContext = SSLContext.getInstance("TLS"); sslContext.init(keyManagers, trustManagers, null); SSLSocketFactory socketFactory = sslContext.getSocketFactory(); Socket trustedSocket; if (socket == null) { trustedSocket = socketFactory.createSocket(); } else { trustedSocket = socketFactory.createSocket(socket, host, port, true); } SSLSocket sslSocket = (SSLSocket) trustedSocket; if (hasWeakSslImplementation()) { hardenSocket(sslSocket); } setSniHost(socketFactory, sslSocket, host); return trustedSocket; }

Target:
public Socket createSocket(Socket socket, String host, int port, String clientCertificateAlias) throws NoSuchAlgorithmException, KeyManagementException, MessagingException, IOException { TrustManager[] trustManagers = new TrustManager[] { TrustManagerFactory.get(host, port) }; KeyManager[] keyManagers = null; if (!TextUtils.isEmpty(clientCertificateAlias)) { keyManagers = new KeyManager[] { new KeyChainKeyManager(context, clientCertificateAlias) }; } SSLContext sslContext = SSLContext.getInstance("TLS"); sslContext.init(keyManagers, trustManagers, null); SSLSocketFactory socketFactory = sslContext.getSocketFactory(); Socket trustedSocket; if (socket == null) { trustedSocket = socketFactory.createSocket(); } else { trustedSocket = socketFactory.createSocket(socket, host, port, true); } SSLSocket sslSocket = (SSLSocket) trustedSocket; hardenSocket(sslSocket); setSniHost(socketFactory, sslSocket, host); return trustedSocket; }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getIntent().getExtras() != null) { try { String link = getIntent().getExtras().get("link").toString(); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(link))); } catch (NullPointerException e) { Log.e(TAG, "Url not found with notification", e); } } if (!Utils.checkForExternalStorageAvailableAndDisplayErrorIfNot(this)) { return; } initializeFacebookSdk(); PreferenceManager.setDefaultValues(this, R.xml.preferences, true); UtilUi.updateScreenWidthAndHeight(this); Log.e(TAG, "Token : " + FirebaseInstanceId.getInstance().getToken()); if (STANDALONE_MODE) { getActionBar().hide(); setContentView(R.layout.activity_main_menu_splashscreen); unzipProgram(); } else { setContentView(R.layout.activity_main_menu); final ActionBar actionBar = getActionBar(); actionBar.setDisplayUseLogoEnabled(true); actionBar.setHomeButtonEnabled(false); actionBar.setDisplayHomeAsUpEnabled(false); actionBar.setTitle(R.string.app_name); findViewById(R.id.main_menu_button_continue).setEnabled(false); Uri loadExternalProjectUri = getIntent().getData(); getIntent().setData(null); if (loadExternalProjectUri != null) { loadProgramFromExternalSource(loadExternalProjectUri); } if (SettingsActivity.isCastSharedPreferenceEnabled(this)) { CastManager.getInstance().initializeCast(this); } } }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); checkCloudMessage(); if (!Utils.checkForExternalStorageAvailableAndDisplayErrorIfNot(this)) { return; } initializeFacebookSdk(); PreferenceManager.setDefaultValues(this, R.xml.preferences, true); UtilUi.updateScreenWidthAndHeight(this); if (STANDALONE_MODE) { getActionBar().hide(); setContentView(R.layout.activity_main_menu_splashscreen); unzipProgram(); } else { setContentView(R.layout.activity_main_menu); final ActionBar actionBar = getActionBar(); actionBar.setDisplayUseLogoEnabled(true); actionBar.setHomeButtonEnabled(false); actionBar.setDisplayHomeAsUpEnabled(false); actionBar.setTitle(R.string.app_name); findViewById(R.id.main_menu_button_continue).setEnabled(false); Uri loadExternalProjectUri = getIntent().getData(); getIntent().setData(null); if (loadExternalProjectUri != null) { loadProgramFromExternalSource(loadExternalProjectUri); } if (SettingsActivity.isCastSharedPreferenceEnabled(this)) { CastManager.getInstance().initializeCast(this); } } }
Source:
public DelegatingResourceDescription getRepresentationDescription(Representation representation) { if (representation instanceof DefaultRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("uuid"); description.addProperty("display"); description.addProperty("condition", Representation.REF); description.addProperty("patient", Representation.REF); description.addProperty("clinicalStatus"); description.addProperty("verificationStatus"); description.addProperty("previousVersion"); description.addProperty("onsetDate"); description.addProperty("voided"); description.addSelfLink(); description.addLink("full", ".?v=" + RestConstants.REPRESENTATION_FULL); return description; } else if (representation instanceof FullRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("uuid"); description.addProperty("display"); description.addProperty("condition", Representation.REF); description.addProperty("patient", Representation.REF); description.addProperty("clinicalStatus"); description.addProperty("verificationStatus"); description.addProperty("previousVersion"); description.addProperty("onsetDate"); description.addProperty("additionalDetail"); description.addProperty("voided"); description.addProperty("auditInfo"); description.addSelfLink(); return description; } return null; }

Target:
public DelegatingResourceDescription getRepresentationDescription(Representation representation) { if (representation instanceof DefaultRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("uuid"); description.addProperty("display"); description.addProperty("condition", Representation.REF); description.addProperty("patient", Representation.REF); description.addProperty("clinicalStatus"); description.addProperty("verificationStatus"); description.addProperty("previousVersion", Representation.REF); description.addProperty("onsetDate"); description.addProperty("endDate"); description.addProperty("voided"); description.addSelfLink(); description.addLink("full", ".?v=" + RestConstants.REPRESENTATION_FULL); return description; } else if (representation instanceof FullRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("uuid"); description.addProperty("display"); description.addProperty("condition"); description.addProperty("patient", Representation.REF); description.addProperty("clinicalStatus"); description.addProperty("verificationStatus"); description.addProperty("previousVersion"); description.addProperty("onsetDate"); description.addProperty("endDate"); description.addProperty("additionalDetail"); description.addProperty("voided"); description.addProperty("auditInfo"); description.addSelfLink(); return description; } return null; }
Source:
public ConfigurationClientBuilder() { policies = new ArrayList<>(); httpLogOptions = new HttpLogOptions().setLogLevel(HttpLogDetailLevel.NONE); headers = new HttpHeaders() .put(ECHO_REQUEST_ID_HEADER, "true") .put(CONTENT_TYPE_HEADER, CONTENT_TYPE_HEADER_VALUE) .put(ACCEPT_HEADER, ACCEPT_HEADER_VALUE); }

Target:
public ConfigurationClientBuilder() { policies = new ArrayList<>(); httpLogOptions = new HttpLogOptions(); headers = new HttpHeaders() .put(ECHO_REQUEST_ID_HEADER, "true") .put(CONTENT_TYPE_HEADER, CONTENT_TYPE_HEADER_VALUE) .put(ACCEPT_HEADER, ACCEPT_HEADER_VALUE); }
Source:
public static byte[] getNextStartRowUnlessTerminal(boolean reverse, @Nonnull byte[] rowName) { if (reverse) { if (isTerminalRow(reverse, rowName)) { return null; } else { return previousLexicographicName(rowName); } } else { return nextLexicographicNameInternal(rowName); } }

Target:
public static byte[] getNextStartRowUnlessTerminal(boolean reverse, @Nonnull byte[] rowName) { if (reverse) { if (isFirstRowName(rowName)) { return null; } else { return previousLexicographicName(rowName); } } else { return nextLexicographicNameInternal(rowName); } }
Source:
public Receive createReceive() { return receiveBuilder() .matchEquals("tick", tick -> { LOGGER.trace() .setMessage("Searching for added/updated/deleted hosts") .addData("actor", self()) .log(); LOGGER.debug().setMessage("No hosts found!").log(); }) .build(); }

Target:
public Receive createReceive() { return receiveBuilder() .matchEquals(TICK, tick -> { LOGGER.trace() .setMessage("Searching for added/updated/deleted hosts") .addData("actor", self()) .log(); LOGGER.debug().setMessage("No hosts found!").log(); }) .build(); }
Source:
public void remove(final Expression oldExpr) { final int idx = steps.indexOf(oldExpr); if (idx < 0) { if (LOG.isTraceEnabled()) { LOG.trace("Expression not found when trying to remove: " + ExpressionDumper.dump(oldExpr) + "; in: " + ExpressionDumper.dump(this)); } return; } steps.remove(idx); }

Target:
public void remove(final Expression oldExpr) { final int idx = steps.indexOf(oldExpr); if (idx < 0) { if (LOG.isTraceEnabled()) { LOG.trace("Expression not found when trying to remove: {}; in: {}", ExpressionDumper.dump(oldExpr), ExpressionDumper.dump(this)); } return; } steps.remove(idx); }
Source:
public ProtobufDataCodec(SymbolTable symbolTable, boolean supportsASCIIOnlyStrings) { this(symbolTable, supportsASCIIOnlyStrings, false); }

Target:
public ProtobufDataCodec(SymbolTable symbolTable, boolean supportsASCIIOnlyStrings) { this(new ProtobufCodecOptions.Builder() .setSymbolTable(symbolTable) .setEnableASCIIOnlyStrings(supportsASCIIOnlyStrings) .build()); }
Source:
public void addInstructorRespondant(String email, FeedbackSessionAttributes feedbackSession) throws InvalidParametersException, EntityDoesNotExistException { Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, email); Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, feedbackSession); feedbackSession.sanitizeForSaving(); if (!feedbackSession.isValid()) { throw new InvalidParametersException(feedbackSession.getInvalidityInfo()); } FeedbackSession fs = (FeedbackSession) getEntity(feedbackSession); if (fs == null) { throw new EntityDoesNotExistException( ERROR_UPDATE_NON_EXISTENT + feedbackSession.toString()); } fs.getRespondingInstructorList().add(email); getPM().close(); }

Target:
public void addInstructorRespondant(String email, FeedbackSessionAttributes feedbackSession) throws InvalidParametersException, EntityDoesNotExistException { List<String> emails = new ArrayList<String>(); emails.add(email); addInstructorRespondants(emails, feedbackSession); }
Source:
static WSTrustResponse execute(String mexURL, String cloudAudienceUrn, Proxy proxy, SSLSocketFactory sslSocketFactory) throws Exception { Map<String, String> headers = new HashMap<String, String>(); headers.put("Content-Type", "application/soap+xml"); headers.put("return-client-request-id", "true"); String mexResponse = HttpHelper.executeHttpGet(log, mexURL, proxy, sslSocketFactory); BindingPolicy policy = MexParser.getPolicyFromMexResponseForIntegrated(mexResponse); String soapAction = "<LINK_0>"; if (policy.getVersion() == WSTrustVersion.WSTRUST2005) { soapAction = "<LINK_1>"; } headers.put("SOAPAction", soapAction); String body = buildMessage(policy.getUrl(), null, null, policy.getVersion(), cloudAudienceUrn).toString(); String response = HttpHelper.executeHttpPost(log, policy.getUrl(), body, headers, proxy, sslSocketFactory); return WSTrustResponse.parse(response, policy.getVersion()); }

Target:
static WSTrustResponse execute(String mexURL, String cloudAudienceUrn, Proxy proxy, SSLSocketFactory sslSocketFactory) throws Exception { Map<String, String> headers = new HashMap<String, String>(); headers.put("Content-Type", "application/soap+xml"); headers.put("return-client-request-id", "true"); String mexResponse = HttpHelper.executeHttpGet(log, mexURL, proxy, sslSocketFactory); BindingPolicy policy = MexParser.getPolicyFromMexResponseForIntegrated(mexResponse); return getAndParseWSTrustResponse(cloudAudienceUrn, proxy, sslSocketFactory, headers, policy, null, null); }
Source:
public static Object wrap(Object object, boolean useJavaNullAsJsonNull) { try { if (object == null) { return NULL; } if (object instanceof JSONObject || object instanceof JSONArray || NULL.equals(object) || object instanceof JSONString || object instanceof Byte || object instanceof Character || object instanceof Short || object instanceof Integer || object instanceof Long || object instanceof Boolean || object instanceof Float || object instanceof Double || object instanceof String || object instanceof BigInteger || object instanceof BigDecimal || object instanceof Enum) { return object; } if (object instanceof Collection) { Collection<?> coll = (Collection<?>) object; return new JSONArray(coll); } if (object.getClass().isArray()) { return new JSONArray(object); } if (object instanceof Map) { Map<?, ?> map = (Map<?, ?>) object; return new JSONObject(map, useJavaNullAsJsonNull); } Package objectPackage = object.getClass().getPackage(); String objectPackageName = objectPackage != null ? objectPackage .getName() : ""; if (objectPackageName.startsWith("java.") || objectPackageName.startsWith("javax.") || object.getClass().getClassLoader() == null) { return object.toString(); } return new JSONObject(object); } catch (Exception exception) { return null; } }

Target:
public static Object wrap(Object object, boolean useJavaNullAsJsonNull) { try { if (object == null) { return NULL; } if (object instanceof JSONObject || object instanceof JSONArray || NULL.equals(object) || object instanceof JSONString || object instanceof Byte || object instanceof Character || object instanceof Short || object instanceof Integer || object instanceof Long || object instanceof Boolean || object instanceof Float || object instanceof Double || object instanceof String || object instanceof BigInteger || object instanceof BigDecimal || object instanceof Enum) { return object; } if (object instanceof Collection) { Collection<?> coll = (Collection<?>) object; return new JSONArray(coll, useJavaNullAsJsonNull); } if (object.getClass().isArray()) { return new JSONArray(object, useJavaNullAsJsonNull); } if (object instanceof Map) { Map<?, ?> map = (Map<?, ?>) object; return new JSONObject(map, useJavaNullAsJsonNull); } Package objectPackage = object.getClass().getPackage(); String objectPackageName = objectPackage != null ? objectPackage .getName() : ""; if (objectPackageName.startsWith("java.") || objectPackageName.startsWith("javax.") || object.getClass().getClassLoader() == null) { return object.toString(); } return new JSONObject(object, useJavaNullAsJsonNull); } catch (Exception exception) { return null; } }
Source:
private void setIdsToRemoveWithNewExtensions(IStorageUtilityIndexed<Case> caseStorage, Vector<String> owners) { DAG<String, int[], String> g = new DAG<String, int[], String>(); Vector<CaseIndex> indexHolder = new Vector<CaseIndex>(); for (IStorageIterator<Case> i = caseStorage.iterate(); i.hasMore(); ) { Case c = i.nextRecord(); boolean owned = true; if (owners != null) { owned = owners.contains(c.getUserId()); } for (CaseIndex index : c.getIndices()) { CaseIndex toReplace = null; boolean skip = false; for (CaseIndex existing : indexHolder) { if (existing.getTarget().equals(index.getTarget())) { if (existing.getRelationship().equals(CaseIndex.RELATIONSHIP_EXTENSION) && !index.getRelationship().equals(CaseIndex.RELATIONSHIP_EXTENSION)) { toReplace = existing; } else { skip = true; } break; } } if (toReplace != null) { indexHolder.removeElement(toReplace); } if (!skip) { indexHolder.addElement(index); } } int nodeStatus = 0; if(owned) { nodeStatus |= STATUS_OWNED; } if(!c.isClosed()) { nodeStatus |= STATUS_OPEN; } if(owned && !c.isClosed()) { nodeStatus |= STATUS_RELEVANT; } g.addNode(c.getCaseId(), new int[]{nodeStatus, c.getID()}); for (CaseIndex index : indexHolder) { g.setEdge(c.getCaseId(), index.getTarget(), index.getRelationship()); } indexHolder.removeAllElements(); } markRelevant(g); markAvailable(g); markLive(g); for (Enumeration<int[]> iterator = g.getNodes(); iterator.hasMoreElements(); ) { int[] node = (int[])iterator.nextElement(); if (!is(node, STATUS_ALIVE)) { idsToRemove.addElement(Integer.valueOf(node[1])); } } }

Target:
private void setIdsToRemoveWithNewExtensions(IStorageUtilityIndexed<Case> caseStorage, Vector<String> owners) { DAG<String, int[], String> graph = new DAG<String, int[], String>(); Vector<CaseIndex> indexHolder = new Vector<CaseIndex>(); for (IStorageIterator<Case> i = caseStorage.iterate(); i.hasMore(); ) { Case c = i.nextRecord(); boolean owned = true; if (owners != null) { owned = owners.contains(c.getUserId()); } for (CaseIndex index : c.getIndices()) { CaseIndex toReplace = null; boolean skip = false; for (CaseIndex existing : indexHolder) { if (existing.getTarget().equals(index.getTarget())) { if (existing.getRelationship().equals(CaseIndex.RELATIONSHIP_EXTENSION) && !index.getRelationship().equals(CaseIndex.RELATIONSHIP_EXTENSION)) { toReplace = existing; } else { skip = true; } break; } } if (toReplace != null) { indexHolder.removeElement(toReplace); } if (!skip) { indexHolder.addElement(index); } } int nodeStatus = 0; if (owned) { nodeStatus |= STATUS_OWNED; } if (!c.isClosed()) { nodeStatus |= STATUS_OPEN; } if (owned && !c.isClosed()) { nodeStatus |= STATUS_RELEVANT; } graph.addNode(c.getCaseId(), new int[]{nodeStatus, c.getID()}); for (CaseIndex index : indexHolder) { graph.setEdge(c.getCaseId(), index.getTarget(), index.getRelationship()); } indexHolder.removeAllElements(); } propogateRelevance(graph); propogateAvailabile(graph); propogateLive(graph); for (Enumeration iterator = graph.getNodes(); iterator.hasMoreElements(); ) { int[] node = (int[])iterator.nextElement(); if (!caseStatusIs(node[0], STATUS_ALIVE)) { idsToRemove.addElement(Integer.valueOf(node[1])); } } }
Source:
public void multipartSigned__shouldCallOpenPgpApiAsync() throws Exception { BodyPart signedBodyPart; Message message = messageFromBody( multipart("signed", "application/pgp-signature", signedBodyPart = spy(bodypart("text/plain", "content")), bodypart("application/pgp-signature", "content") ) ); message.setFrom(Address.parse("Test <test@example.org>")[0]); OutputStream outputStream = mock(OutputStream.class); processSignedMessageAndCaptureMocks(message, signedBodyPart, outputStream); assertEquals(OpenPgpApi.ACTION_DECRYPT_VERIFY, capturedApiIntent.getAction()); assertEquals("test@example.org", capturedApiIntent.getStringExtra(OpenPgpApi.EXTRA_SENDER_ADDRESS)); verify(autocryptOperations).addAutocryptPeerUpdateToIntentIfPresent(message, capturedApiIntent); verifyNoMoreInteractions(autocryptOperations); }

Target:
public void multipartSigned__shouldCallOpenPgpApiAsync() throws Exception { BodyPart signedBodyPart = spy(bodypart("text/plain", "content")); Message message = messageFromBody( multipart("signed", "protocol=\"application/pgp-signature\"", signedBodyPart, bodypart("application/pgp-signature", "content") ) ); message.setFrom(Address.parse("Test <test@example.org>")[0]); OutputStream outputStream = mock(OutputStream.class); processSignedMessageAndCaptureMocks(message, signedBodyPart, outputStream); assertEquals(OpenPgpApi.ACTION_DECRYPT_VERIFY, capturedApiIntent.getAction()); assertEquals("test@example.org", capturedApiIntent.getStringExtra(OpenPgpApi.EXTRA_SENDER_ADDRESS)); verify(autocryptOperations).addAutocryptPeerUpdateToIntentIfPresent(message, capturedApiIntent); verifyNoMoreInteractions(autocryptOperations); }
Source:
public int compareTo(RMEvent event) { return (int) this.getCounter() - (int) event.getCounter(); }

Target:
public int compareTo(RMEvent event) { return Long.compare(this.counter, event.counter); }
Source:
private void processShallow(@Nullable List<ObjectId> shallowCommits, List<ObjectId> unshallowCommits, boolean writeToPckOut) throws IOException { if (options.contains(OPTION_DEEPEN_RELATIVE) || shallowSince != 0 || shallowExcludeRefs.size() > 0) { throw new UnsupportedOperationException(); } int walkDepth = depth - 1; try (DepthWalk.RevWalk depthWalk = new DepthWalk.RevWalk( walk.getObjectReader(), walkDepth)) { for (ObjectId o : wantIds) { try { depthWalk.markRoot(depthWalk.parseCommit(o)); } catch (IncorrectObjectTypeException notCommit) { } } RevCommit o; while ((o = depthWalk.next()) != null) { DepthWalk.Commit c = (DepthWalk.Commit) o; if (c.getDepth() == walkDepth && !clientShallowCommits.contains(c)) { if (shallowCommits != null) { shallowCommits.add(c.copy()); } if (writeToPckOut) { pckOut.writeString("shallow " + o.name()); } } if (c.getDepth() < walkDepth && clientShallowCommits.remove(c)) { unshallowCommits.add(c.copy()); if (writeToPckOut) { pckOut.writeString("unshallow " + c.name()); } } } } if (writeToPckOut) { pckOut.end(); } }

Target:
private void processShallow(@Nullable List<ObjectId> shallowCommits, List<ObjectId> unshallowCommits, boolean writeToPckOut) throws IOException { if (options.contains(OPTION_DEEPEN_RELATIVE) || shallowSince != 0 || !shallowExcludeRefs.isEmpty()) { throw new UnsupportedOperationException(); } int walkDepth = depth - 1; try (DepthWalk.RevWalk depthWalk = new DepthWalk.RevWalk( walk.getObjectReader(), walkDepth)) { for (ObjectId o : wantIds) { try { depthWalk.markRoot(depthWalk.parseCommit(o)); } catch (IncorrectObjectTypeException notCommit) { } } RevCommit o; while ((o = depthWalk.next()) != null) { DepthWalk.Commit c = (DepthWalk.Commit) o; if (c.getDepth() == walkDepth && !clientShallowCommits.contains(c)) { if (shallowCommits != null) { shallowCommits.add(c.copy()); } if (writeToPckOut) { pckOut.writeString("shallow " + o.name()); } } if (c.getDepth() < walkDepth && clientShallowCommits.remove(c)) { unshallowCommits.add(c.copy()); if (writeToPckOut) { pckOut.writeString("unshallow " + c.name()); } } } } if (writeToPckOut) { pckOut.end(); } }
Source:
public List<String> getDependencies() { List<String> dependencies = new ArrayList<String>(); dependencies.add(AttributesManager.NS_ENTITYLESS_ATTR_DEF + ":namespace-minGID"); dependencies.add(AttributesManager.NS_ENTITYLESS_ATTR_DEF + ":namespace-maxGID"); dependencies.add(A_R_unixGroupName_namespace + ":*"); return dependencies; }

Target:
public List<String> getDependencies() { List<String> dependencies = new ArrayList<String>(); dependencies.add(AttributesManager.NS_ENTITYLESS_ATTR_DEF + ":namespace-minGID"); dependencies.add(AttributesManager.NS_ENTITYLESS_ATTR_DEF + ":namespace-maxGID"); return dependencies; }
Source:
public void addChild(TimeGraphEntry entry) { int index; for (index = 0; index < getChildren().size(); index++) { ResourcesEntry other = (ResourcesEntry) getChildren().get(index); if (entry.compareTo(other) < 0) { break; } } entry.setParent(this); getChildren().add(index, entry); }

Target:
public void addChild(TimeGraphEntry entry) { if (!(entry instanceof ResourcesEntry)) { throw new IllegalArgumentException(); } ResourcesEntry rEntry = (ResourcesEntry) entry; int index; for (index = 0; index < getChildren().size(); index++) { ResourcesEntry other = (ResourcesEntry) getChildren().get(index); if (rEntry.compareTo(other) < 0) { break; } } entry.setParent(this); getChildren().add(index, entry); }
Source:
private DayActivity createNewDayActivity(ActivityPayload payload, UserAnonymizedDTO userAnonymized, Goal matchingGoal) { DayActivity dayActivity = DayActivity.createInstance(userAnonymized.getID(), matchingGoal, getZonedStartOfDay(payload.startTime, userAnonymized)); ZonedDateTime zonedStartOfWeek = getZonedStartOfWeek(payload.startTime, userAnonymized); WeekActivity weekActivity = cacheService.fetchWeekActivityForUser(userAnonymized.getID(), matchingGoal.getID(), zonedStartOfWeek); if (weekActivity == null) { weekActivity = WeekActivity.createInstance(userAnonymized.getID(), matchingGoal, zonedStartOfWeek); } weekActivity.addActivity(dayActivity); cacheService.updateWeekActivityForUser(weekActivity); return dayActivity; }

Target:
private DayActivity createNewDayActivity(ActivityPayload payload, UserAnonymizedDTO userAnonymized, Goal matchingGoal) { UserAnonymized userAnonymizedEntity = userAnonymizedService.getUserAnonymizedEntity(userAnonymized.getID()); DayActivity dayActivity = DayActivity.createInstance(userAnonymizedEntity, matchingGoal, getStartOfDay(payload.startTime, userAnonymized)); ZonedDateTime startOfWeek = getStartOfWeek(payload.startTime, userAnonymized); WeekActivity weekActivity = cacheService.fetchWeekActivityForUser(userAnonymized.getID(), matchingGoal.getID(), startOfWeek); if (weekActivity == null) { weekActivity = WeekActivity.createInstance(userAnonymizedEntity, matchingGoal, startOfWeek); } weekActivity.addDayActivity(dayActivity); cacheService.updateWeekActivityForUser(weekActivity); return dayActivity; }
Source:
public Collection<Proposal> getProposals(JsonPointer pointer, JsonDocument document, Scope scope) { final ContextType type = contextTypes.get(document.getModel(), pointer); final IFile currentFile = getActiveFile(); final IPath basePath = currentFile.getParent().getFullPath(); final List<Proposal> proposals = Lists.newArrayList(); TypeDefinition schemaType = document.getModel().find(pointer).getType(); System.out.println("SCHEMA TYPE: " + schemaType.getPointer()); if (scope == Scope.LOCAL) { proposals.addAll(type.collectProposals(document, null)); } else if (!type.isLocalOnly()) { final SwaggerFileFinder fileFinder = new SwaggerFileFinder(fileContentType); for (IFile file : fileFinder.collectFiles(scope, currentFile)) { IPath relative = file.equals(currentFile) ? null : file.getFullPath().makeRelativeTo(basePath); if (file.equals(currentFile)) { proposals.addAll(type.collectProposals(document, relative)); } else { proposals.addAll(type.collectProposals(manager.getDocument(file.getLocationURI()), relative)); } } } return proposals; }

Target:
public Collection<Proposal> getProposals(JsonPointer pointer, JsonDocument document, Scope scope) { final ContextType type = contextTypes.get(document.getModel(), pointer); final IFile currentFile = getActiveFile(); final IPath basePath = currentFile.getParent().getFullPath(); final List<Proposal> proposals = Lists.newArrayList(); if (scope == Scope.LOCAL) { proposals.addAll(type.collectProposals(document, null)); } else if (!type.isLocalOnly()) { final SwaggerFileFinder fileFinder = new SwaggerFileFinder(fileContentType); for (IFile file : fileFinder.collectFiles(scope, currentFile)) { IPath relative = file.equals(currentFile) ? null : file.getFullPath().makeRelativeTo(basePath); if (file.equals(currentFile)) { proposals.addAll(type.collectProposals(document, relative)); } else { proposals.addAll(type.collectProposals(manager.getDocument(file.getLocationURI()), relative)); } } } return proposals; }