auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Decision decide(final RepositoryPath repositoryPath) throws IOException { RepositoryPath checksumRepositoryPath = resolveSiblingChecksum(repositoryPath, EncryptionAlgorithmsEnum.SHA1); String currentChecksum = readChecksum(checksumRepositoryPath); if (currentChecksum == null) { checksumRepositoryPath = resolveSiblingChecksum(repositoryPath, EncryptionAlgorithmsEnum.MD5); currentChecksum = readChecksum(checksumRepositoryPath); if (currentChecksum == null) { logger.debug("Unable to read local checksum for {}, will refetch metadata", repositoryPath.normalize()); return UNDECIDED; } } proxyRepositoryArtifactResolver.fetchRemoteResource(checksumRepositoryPath); final String newRemoteChecksum = readChecksum(checksumRepositoryPath); if (newRemoteChecksum == null) { logger.debug("Unable to fetch remote checksum for {}, will refetch metadata", repositoryPath.normalize()); return UNDECIDED; } if (currentChecksum.equals(newRemoteChecksum)) { logger.debug("Local and remote checksums match for {}, no need to refetch metadata", repositoryPath.normalize()); return USABLE; } else { logger.debug("Local and remote checksums differ for {}, will refetch metadata", repositoryPath.normalize()); return EXPIRED; } }

Target:
public Decision decide(final RepositoryPath repositoryPath) throws IOException { Decision decision = decideUsingChecksumAlgorithm(repositoryPath, EncryptionAlgorithmsEnum.SHA1); if (UNDECIDED.equals(decision)) { decision = decideUsingChecksumAlgorithm(repositoryPath, EncryptionAlgorithmsEnum.MD5); } return decision; }
Source:
public void start() { checkNotNull(bootstrap); server = bootstrap.start(); }

Target:
public void start() { server = createWithValidation(validators).start(); }
Source:
static ResourceMapping getContributedResourceMapping(IAdaptable element) { Object resourceAdapter = Adapters.getAdapter(element, IContributorResourceAdapter.class, true); if (resourceAdapter != null) { if (resourceAdapter instanceof IContributorResourceAdapter2) { IContributorResourceAdapter2 mappingAdapter = (IContributorResourceAdapter2) resourceAdapter; ResourceMapping mapping = mappingAdapter.getAdaptedResourceMapping(element); if (mapping != null) { return mapping; } } if (resourceAdapter instanceof IContributorResourceAdapter) { IResource resource = ((IContributorResourceAdapter) resourceAdapter).getAdaptedResource(element); if (resource != null) { ResourceMapping mapping = Adapters.getAdapter(resource, ResourceMapping.class, true); if (mapping != null) { return mapping; } } } } return null; }

Target:
static ResourceMapping getContributedResourceMapping(IAdaptable element) { IContributorResourceAdapter resourceAdapter = Adapters.getAdapter(element, IContributorResourceAdapter.class, true); if (resourceAdapter != null) { if (resourceAdapter instanceof IContributorResourceAdapter2) { IContributorResourceAdapter2 mappingAdapter = (IContributorResourceAdapter2) resourceAdapter; ResourceMapping mapping = mappingAdapter.getAdaptedResourceMapping(element); if (mapping != null) { return mapping; } } IResource resource = resourceAdapter.getAdaptedResource(element); if (resource != null) { ResourceMapping mapping = Adapters.getAdapter(resource, ResourceMapping.class, true); if (mapping != null) { return mapping; } } } return null; }
Source:
private static void registerTransformers_WF_17(ResourceTransformationDescriptionBuilder subsystem) { ResourceTransformationDescriptionBuilder externalConnectionFactory = subsystem.addChildResource(MessagingExtension.CONNECTION_FACTORY_PATH); rejectDefinedAttributeWithDefaultValue(externalConnectionFactory, ConnectionFactoryAttributes.Common.USE_TOPOLOGY); ResourceTransformationDescriptionBuilder externalPooledConnectionFactory = subsystem.addChildResource(MessagingExtension.POOLED_CONNECTION_FACTORY_PATH); rejectDefinedAttributeWithDefaultValue(externalPooledConnectionFactory, ConnectionFactoryAttributes.Common.USE_TOPOLOGY); ResourceTransformationDescriptionBuilder server = subsystem.addChildResource(SERVER_PATH); ResourceTransformationDescriptionBuilder connectionFactory = server.addChildResource(MessagingExtension.CONNECTION_FACTORY_PATH); rejectDefinedAttributeWithDefaultValue(connectionFactory, ConnectionFactoryAttributes.Common.USE_TOPOLOGY); ResourceTransformationDescriptionBuilder pooledConnectionFactory = server.addChildResource(MessagingExtension.POOLED_CONNECTION_FACTORY_PATH); rejectDefinedAttributeWithDefaultValue(pooledConnectionFactory, ConnectionFactoryAttributes.Common.USE_TOPOLOGY); rejectDefinedAttributeWithDefaultValue(server, ServerDefinition.JOURNAL_FILE_OPEN_TIMEOUT); }

Target:
private static void registerTransformers_WF_17(ResourceTransformationDescriptionBuilder subsystem) { ResourceTransformationDescriptionBuilder externalConnectionFactory = subsystem.addChildResource(MessagingExtension.CONNECTION_FACTORY_PATH); rejectDefinedAttributeWithDefaultValue(externalConnectionFactory, ConnectionFactoryAttributes.Common.USE_TOPOLOGY, ConnectionFactoryAttributes.External.ENABLE_AMQ1_PREFIX); ResourceTransformationDescriptionBuilder externalPooledConnectionFactory = subsystem.addChildResource(MessagingExtension.POOLED_CONNECTION_FACTORY_PATH); rejectDefinedAttributeWithDefaultValue(externalPooledConnectionFactory, ConnectionFactoryAttributes.Common.USE_TOPOLOGY, ConnectionFactoryAttributes.External.ENABLE_AMQ1_PREFIX); ResourceTransformationDescriptionBuilder server = subsystem.addChildResource(SERVER_PATH); ResourceTransformationDescriptionBuilder connectionFactory = server.addChildResource(MessagingExtension.CONNECTION_FACTORY_PATH); rejectDefinedAttributeWithDefaultValue(connectionFactory, ConnectionFactoryAttributes.Common.USE_TOPOLOGY); ResourceTransformationDescriptionBuilder pooledConnectionFactory = server.addChildResource(MessagingExtension.POOLED_CONNECTION_FACTORY_PATH); rejectDefinedAttributeWithDefaultValue(pooledConnectionFactory, ConnectionFactoryAttributes.Common.USE_TOPOLOGY); rejectDefinedAttributeWithDefaultValue(server, ServerDefinition.JOURNAL_FILE_OPEN_TIMEOUT); }
Source:
public boolean canHandle(Message<?> message) { return super.canHandle(message) && deadlineNameMatch((DeadlineMessage) message); }

Target:
public boolean canHandle(Message<?> message) { return message instanceof DeadlineMessage && deadlineNameMatch((DeadlineMessage) message) && super.canHandle(message); }
Source:
public @Nullable Integer resolve(ITmfEvent event) { Integer cpu = TmfTraceUtils.resolveIntEventAspectOfClassForEvent(event.getTrace(), TmfCpuAspect.class, event); if (cpu == null) { return null; } TidAnalysisModule analysis = TmfTraceUtils.getAnalysisModuleOfClass(event.getTrace(), TidAnalysisModule.class, TidAnalysisModule.ID); if (analysis == null) { return null; } ITmfStateSystem stateSystem = analysis.getStateSystem(); if (stateSystem == null) { return null; } Integer tid = null; try { int cpuQuark = stateSystem.getQuarkAbsolute(Integer.toString(cpu)); ITmfStateInterval value = stateSystem.querySingleState(event.getTimestamp().toNanos(), cpuQuark); tid = value.getStateValue().unboxInt(); } catch (AttributeNotFoundException | StateSystemDisposedException e) { Activator.getDefault().logError(NonNullUtils.nullToEmptyString(e.getMessage()), e); } if (tid != null) { return tid; } return null; }

Target:
public @Nullable Integer resolve(ITmfEvent event) { Integer cpu = TmfTraceUtils.resolveIntEventAspectOfClassForEvent(event.getTrace(), TmfCpuAspect.class, event); if (cpu == null) { return null; } TidAnalysisModule analysis = TmfTraceUtils.getAnalysisModuleOfClass(event.getTrace(), TidAnalysisModule.class, TidAnalysisModule.ID); if (analysis == null) { return null; } return analysis.getThreadOnCpuAtTime(cpu, event.getTimestamp().toNanos()); }
Source:
public void loadDockerImages() { INIConfiguration config = Utilities.parseConfig(this.getConfigFile()); String dockerImageDirectory = config.getString("docker-images"); if (!StringUtils.isBlank(dockerImageDirectory)) { Path directoryPath = Paths.get(dockerImageDirectory); Supplier<Stream<Path>> list = () -> { try { return java.nio.file.Files.list(directoryPath); } catch (NotDirectoryException e) { System.out.println("Directory is a file: " + directoryPath.toAbsolutePath()); } catch (NoSuchFileException e) { System.out.println("Directory not found: " + directoryPath.toAbsolutePath()); } catch (IOException e) { System.out.println("Something is wrong with the directory: " + directoryPath.toAbsolutePath()); e.printStackTrace(); } return Stream.empty(); }; if (list.get().count() == 0) { System.out.println("There are no files in the docker image directory: " + directoryPath.toAbsolutePath()); return; } else { System.out.println("Loading docker images..."); list.get().forEach(path -> Utilities.executeCommand("docker load -i " + path, System.out, System.err)); } } else { LOG.info("No docker image directory specified in Dockstore config file"); } }

Target:
public void loadDockerImages() { INIConfiguration config = Utilities.parseConfig(this.getConfigFile()); String dockerImageDirectory = config.getString("docker-images"); if (!StringUtils.isBlank(dockerImageDirectory)) { Path directoryPath = Paths.get(dockerImageDirectory); Supplier<Stream<Path>> list = () -> { try { return java.nio.file.Files.list(directoryPath); } catch (NotDirectoryException e) { System.out.println("The specified Docker image directory is a file: " + directoryPath.toAbsolutePath()); } catch (NoSuchFileException e) { System.out.println("The specified Docker image directory not found: " + directoryPath.toAbsolutePath()); } catch (IOException e) { System.out.println("Something is wrong with the specified Docker image directory: " + directoryPath.toAbsolutePath()); System.out.println(e.toString()); } return Stream.empty(); }; if (list.get().count() == 0) { System.out.println("There are no files in the docker image directory: " + directoryPath.toAbsolutePath()); } else { System.out.println("Loading docker images..."); list.get().forEach(path -> Utilities.executeCommand("docker load -i \"" + path + "\"", System.out, System.err)); } } else { LOG.info("No docker image directory specified in Dockstore config file"); } }
Source:
public void testIsVariant() { assertTrue(VariantUtils.isVariant(DataUtils.makeVariant("chr7", 200000, 200001, "A", Arrays.asList("C"), (Call[]) null))); assertTrue(VariantUtils.isVariant(DataUtils.makeVariant("chr7", 200000, 200001, "CAG", Arrays.asList("C"), (Call[]) null))); assertTrue(VariantUtils.isVariant(DataUtils.makeVariant("chr7", 200000, 200001, "AG", emptyAlt, (Call[]) null))); assertTrue(VariantUtils.isVariant(DataUtils.makeVariant("chr7", 200000, 200001, "AG", null, (Call[]) null))); assertFalse(VariantUtils.isVariant(DataUtils.makeVariant("chr7", 200000, 200001, "A", emptyAlt, (Call[]) null))); assertFalse(VariantUtils.isVariant(DataUtils.makeVariant("chr7", 200000, 200001, "A", null, (Call[]) null))); }

Target:
public void testIsVariant() { assertFalse(VariantUtils.IS_NON_VARIANT_SEGMENT.apply(DataUtils.makeVariant("chr7", 200000, 200001, "A", Arrays.asList("C"), (Call[]) null))); assertFalse(VariantUtils.IS_NON_VARIANT_SEGMENT.apply(DataUtils.makeVariant("chr7", 200000, 200001, "A", Arrays.asList("AC"), (Call[]) null))); assertFalse(VariantUtils.IS_NON_VARIANT_SEGMENT.apply(DataUtils.makeVariant("chr7", 200000, 200001, "CAG", Arrays.asList("C"), (Call[]) null))); assertFalse(VariantUtils.IS_NON_VARIANT_SEGMENT.apply(DataUtils.makeVariant("chr7", 200000, 200001, "AG", emptyAlt, (Call[]) null))); assertFalse(VariantUtils.IS_NON_VARIANT_SEGMENT.apply(DataUtils.makeVariant("chr7", 200000, 200001, "AG", null, (Call[]) null))); assertFalse(VariantUtils.IS_NON_VARIANT_SEGMENT.apply(DataUtils.makeVariant("chr7", 200000, 200001, "A", Arrays.asList("C", "AC"), (Call[]) null))); assertFalse(VariantUtils.IS_NON_VARIANT_SEGMENT.apply(DataUtils.makeVariant("chr7", 200000, 200001, "A", Arrays.asList("C", "G"), (Call[]) null))); assertTrue(VariantUtils.IS_NON_VARIANT_SEGMENT.apply(DataUtils.makeVariant("chr7", 200000, 200001, "A", emptyAlt, (Call[]) null))); assertTrue(VariantUtils.IS_NON_VARIANT_SEGMENT.apply(DataUtils.makeVariant("chr7", 200000, 200001, "A", null, (Call[]) null))); assertTrue(VariantUtils.IS_NON_VARIANT_SEGMENT.apply(DataUtils.makeVariant("chr7", 200000, 200001, "A", Arrays.asList(VariantUtils.GATK_NON_VARIANT_SEGMENT_ALT), (Call[]) null))); }
Source:
protected void postLoad(DAnalysis dAnalysis, Version loadedVersion) { if (Boolean.getBoolean(DBorderItemLocator.LABEL_ON_BORDER_IMPROVMENT) && loadedVersion.compareTo(MIGRATION_VERSION) < 0) { super.postLoad(dAnalysis, loadedVersion); StringBuilder sb = new StringBuilder(Messages.LabelOnBorderMigrationParticipant_title); dAnalysis.getOwnedViews().stream().flatMap(view -> new DViewQuery(view).getLoadedRepresentations().stream()).filter(rep -> rep instanceof DDiagram).map(DDiagram.class::cast) .filter(diag -> diag instanceof DSemanticDiagram).forEach(dDiagram -> { boolean isLabelMoved = false; Collection<Node> nodesWithLabelOnBorder = getNodesWithLabelOnBorder(dDiagram); for (Node node : nodesWithLabelOnBorder) { isLabelMoved = checkAndFixGMFCoordinatesOfLabelOnBorder(node) || isLabelMoved; } if (isLabelMoved) { migrationOccured = true; sb.append(MessageFormat.format(Messages.LabelOnBorderMigrationParticipant_labelsModified, dDiagram.getName())); } }); if (migrationOccured) { DiagramPlugin.getDefault().logInfo(sb.toString()); migrationOccured = false; } } }

Target:
protected void postLoad(DAnalysis dAnalysis, Version loadedVersion) { if (Boolean.getBoolean(DBorderItemLocator.LABEL_ON_BORDER_IMPROVMENT) && loadedVersion.compareTo(MIGRATION_VERSION) < 0) { super.postLoad(dAnalysis, loadedVersion); StringBuilder sb = new StringBuilder(Messages.LabelOnBorderMigrationParticipant_title); dAnalysis.getOwnedViews().stream().flatMap(view -> new DViewQuery(view).getLoadedRepresentations().stream()).filter(rep -> rep instanceof DDiagram).map(DDiagram.class::cast) .forEach(dDiagram -> { boolean isLabelMoved = false; Collection<Node> nodesWithLabelOnBorder = getNodesWithLabelOnBorder(dDiagram); for (Node node : nodesWithLabelOnBorder) { isLabelMoved = checkAndFixGMFCoordinatesOfLabelOnBorder(node) || isLabelMoved; } if (isLabelMoved) { migrationOccured = true; sb.append(MessageFormat.format(Messages.LabelOnBorderMigrationParticipant_labelsModified, dDiagram.getName())); } }); if (migrationOccured) { DiagramPlugin.getDefault().logInfo(sb.toString()); migrationOccured = false; } } }
Source:
protected boolean submitTopology(String[] appConfs) { if (!this.topologyName.equals(this.topologyName.toLowerCase())) { throw new TopologySubmissionException("K8S scheduler does not allow upper case topologies."); } for (String appConf : appConfs) { try { deployContainer(appConf); } catch (IOException ioe) { String message = (ioe instanceof java.net.ConnectException) ? "Error connecting to kubernetes api server" : ioe.getMessage(); LOG.log(Level.SEVERE, "Problem deploying container: " + message, ioe); LOG.log(Level.SEVERE, "Container config: " + appConf); throw new TopologySubmissionException(message); } } return true; }

Target:
protected boolean submitTopology(String[] appConfs) { if (!this.topologyName.equals(this.topologyName.toLowerCase())) { throw new TopologySubmissionException("K8S scheduler does not allow upper case topologies."); } for (String appConf : appConfs) { try { deployContainer(appConf); } catch (IOException ioe) { final String message = ioe.getMessage(); LOG.log(Level.SEVERE, "Problem deploying container: " + ioe.getMessage(), ioe); LOG.log(Level.SEVERE, "Container config: " + appConf); throw new TopologySubmissionException(message); } } return true; }
Source:
private LibrarySelector getLibrarySelectorService() { LibrarySelector librarySelector = Framework.getRuntime().getService(LibrarySelector.class); if (librarySelector == null) { log.error("Unable to get LibrarySelector runtime service"); throw new NuxeoException("Unable to get LibrarySelector runtime service"); } return librarySelector; }

Target:
private LibrarySelector getLibrarySelectorService() { LibrarySelector librarySelector = Framework.getService(LibrarySelector.class); if (librarySelector == null) { log.error("Unable to get LibrarySelector runtime service"); throw new NuxeoException("Unable to get LibrarySelector runtime service"); } return librarySelector; }
Source:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { log.debug("Entered SsoPostLoginFilter"); HttpServletRequest req = (HttpServletRequest) request; try { String engineSessionId = (String) req.getAttribute(SessionConstants.HTTP_SESSION_ENGINE_SESSION_ID_KEY); if (StringUtils.isEmpty(engineSessionId) && req.getSession(false) != null) { engineSessionId = (String) req.getSession(false). getAttribute(SessionConstants.HTTP_SESSION_ENGINE_SESSION_ID_KEY); } if (StringUtils.isNotEmpty(engineSessionId)) { InitialContext ctx = new InitialContext(); try { String ssoToken = (String) runQuery(VdcQueryType.GetEngineSessionIdToken, engineSessionId, ctx); log.debug("Adding userInfo to session"); DbUser loggedInUser = (DbUser) runQuery(VdcQueryType.GetUserBySessionId, engineSessionId, ctx); req.getSession(true).setAttribute(ATTR_USER_INFO, getUserInfoObject(loggedInUser, ssoToken)); chain.doFilter(request, response); } finally { ctx.close(); } } else { log.info("Missing sessionId in either request or session scope. " + "Please configure SSO properly with SsoPostLoginServlet."); } } catch (Exception ex) { log.error("Unable to get token for engine session {}", ex.getMessage()); } log.debug("Exiting SsoPostLoginFilter"); }

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { log.debug("Entered SsoPostLoginFilter"); HttpServletRequest req = (HttpServletRequest) request; try { String engineSessionId = (String) req.getAttribute(SessionConstants.HTTP_SESSION_ENGINE_SESSION_ID_KEY); if (StringUtils.isEmpty(engineSessionId) && req.getSession(false) != null) { engineSessionId = (String) req.getSession(false). getAttribute(SessionConstants.HTTP_SESSION_ENGINE_SESSION_ID_KEY); } if (StringUtils.isNotEmpty(engineSessionId)) { InitialContext ctx = new InitialContext(); try { String ssoToken = (String) runQuery(VdcQueryType.GetEngineSessionIdToken, engineSessionId, ctx); log.debug("Adding userInfo to session"); DbUser loggedInUser = (DbUser) runQuery(VdcQueryType.GetUserBySessionId, engineSessionId, ctx); req.getSession(true).setAttribute(ATTR_USER_INFO, getUserInfoObject(loggedInUser, ssoToken)); chain.doFilter(request, response); } finally { ctx.close(); } } else { log.warn("Missing sessionId in either request or session scope. " + "Please configure SSO properly with SsoPostLoginServlet."); } } catch (Exception ex) { log.error("Unable to get token for engine session {}", ex.getMessage()); } log.debug("Exiting SsoPostLoginFilter"); }
Source:
public List<RichGroup> getMemberRichGroupsWithAttributesByNames(PerunSession sess, Member member, List<String> attrNames) throws InternalErrorException, MemberNotExistsException, PrivilegeException { Utils.checkPerunSession(sess); this.getPerunBl().getMembersManagerBl().checkMemberExists(sess, member); Vo vo = getPerunBl().getMembersManagerBl().getMemberVo(sess, member); if (!AuthzResolver.authorizedInternal(sess, "", Collections.singletonList(member))) { throw new PrivilegeException(sess, "getMemberRichGroupsWithAttributesByNames"); } List<RichGroup> richGroups = getGroupsManagerBl().getMemberRichGroupsWithAttributesByNames(sess, member, attrNames); richGroups.removeIf(richGroup -> !AuthzResolver.authorizedInternal(sess, "filter-getMemberRichGroupsWithAttributesByNames_Member_List<String>_policy", Arrays.asList(member, richGroup))); return getGroupsManagerBl().filterOnlyAllowedAttributes(sess, richGroups, member, null, true); }

Target:
public List<RichGroup> getMemberRichGroupsWithAttributesByNames(PerunSession sess, Member member, List<String> attrNames) throws InternalErrorException, MemberNotExistsException, PrivilegeException { Utils.checkPerunSession(sess); this.getPerunBl().getMembersManagerBl().checkMemberExists(sess, member); if (!AuthzResolver.authorizedInternal(sess, "getMemberRichGroupsWithAttributesByNames_Member_List<String>_policy", Collections.singletonList(member))) { throw new PrivilegeException(sess, "getMemberRichGroupsWithAttributesByNames"); } List<RichGroup> richGroups = getGroupsManagerBl().getMemberRichGroupsWithAttributesByNames(sess, member, attrNames); richGroups.removeIf(richGroup -> !AuthzResolver.authorizedInternal(sess, "filter-getMemberRichGroupsWithAttributesByNames_Member_List<String>_policy", Arrays.asList(member, richGroup))); return getGroupsManagerBl().filterOnlyAllowedAttributes(sess, richGroups, member, null, true); }
Source:
public void addProblemMarker(String aMessage, int aLine) { IFile file = ((IFileEditorInput)getEditorInput()).getFile(); try { Map<String, Object> attributes = new HashMap<String, Object>(5); attributes.put(IMarker.SEVERITY, Integer.valueOf(IMarker.SEVERITY_ERROR)); attributes.put(IMarker.LINE_NUMBER, Integer.valueOf(aLine)); attributes.put(IMarker.MESSAGE, aMessage); attributes.put(IMarker.TEXT, aMessage); MarkerUtilities.createMarker(file, attributes, IMarker.PROBLEM); } catch (Exception e) { } }

Target:
public void addProblemMarker(String aMessage, int aLine) { IFile file = ((IFileEditorInput) getEditorInput()).getFile(); try { Map<String, Object> attributes = new HashMap<String, Object>(5); attributes.put(IMarker.SEVERITY, Integer.valueOf(IMarker.SEVERITY_ERROR)); attributes.put(IMarker.LINE_NUMBER, Integer.valueOf(aLine)); attributes.put(IMarker.MESSAGE, aMessage); attributes.put(IMarker.TEXT, aMessage); MarkerUtilities.createMarker(file, attributes, IMarker.PROBLEM); } catch (CoreException e) { Plugin.log(e); } }
Source:
private void registerListeners() { getPageControl().getViewer().addDoubleClickListener(new IDoubleClickListener() { @Override public void doubleClick(DoubleClickEvent event) { NodeSelection nodeSelection = NodeSelection.from(event.getSelection()); OpenTestSourceFileAction openTestSourceFileAction = new OpenTestSourceFileAction(ExecutionPage.this); if (openTestSourceFileAction.isVisibleFor(nodeSelection) && openTestSourceFileAction.isEnabledFor(nodeSelection)) { openTestSourceFileAction.run(); } else if (nodeSelection.isSingleSelection()) { Object selected = nodeSelection.toList().get(0); IContentProvider provider = getPageControl().getViewer().getContentProvider(); if (provider instanceof ITreeContentProvider && ((ITreeContentProvider) provider).hasChildren(selected)) { if (getPageControl().getViewer().getExpandedState(selected)) { getPageControl().getViewer().collapseToLevel(selected, AbstractTreeViewer.ALL_LEVELS); } else { getPageControl().getViewer().expandToLevel(selected, 1); } } } } }); }

Target:
private void registerListeners() { getPageControl().getViewer().addDoubleClickListener(new IDoubleClickListener() { @Override public void doubleClick(DoubleClickEvent event) { NodeSelection nodeSelection = NodeSelection.from(event.getSelection()); OpenTestSourceFileAction openTestSourceFileAction = new OpenTestSourceFileAction(ExecutionPage.this); if (openTestSourceFileAction.isVisibleFor(nodeSelection) && openTestSourceFileAction.isEnabledFor(nodeSelection)) { openTestSourceFileAction.run(); } else if (nodeSelection.isSingleSelection()) { Object selected = nodeSelection.toList().get(0); TreeViewer viewer = getPageControl().getViewer(); IContentProvider provider = viewer.getContentProvider(); if (provider instanceof ITreeContentProvider && ((ITreeContentProvider) provider).hasChildren(selected)) { if (viewer.getExpandedState(selected)) { viewer.collapseToLevel(selected, AbstractTreeViewer.ALL_LEVELS); } else { viewer.expandToLevel(selected, 1); } } } } }); }
Source:
private void checkImports(JavaNode node, Object data) { String name = node.getImage(); matches.clear(); for (ASTImportDeclaration importDeclaration : imports) { if (!importDeclaration.isImportOnDemand()) { if (name.equals(importDeclaration.getImportedName())) { matches.add(importDeclaration); continue; } } if (declarationMatches(importDeclaration, name)) { matches.add(importDeclaration); } } if (matches.isEmpty()) { for (ASTImportDeclaration importDeclaration : imports) { if (importDeclaration.isStatic()) { String[] importParts = importDeclaration.getImportedName().split("\\."); String[] nameParts = name.split("\\."); if (importDeclaration.isImportOnDemand()) { if (nameParts[nameParts.length - 2].equals(importParts[importParts.length - 1])) { matches.add(importDeclaration); } } else { if (nameParts[nameParts.length - 1].equals(importParts[importParts.length - 1]) && nameParts[nameParts.length - 2].equals(importParts[importParts.length - 2])) { matches.add(importDeclaration); } } } } } if (!matches.isEmpty()) { ASTImportDeclaration firstMatch = matches.get(0); if (!isAvoidingConflict(node, name, firstMatch)) { String importStr = firstMatch.getImportedName() + (firstMatch.isImportOnDemand() ? ".*" : ""); String type = firstMatch.isStatic() ? "static " : ""; addViolation(data, node, new Object[] { node.getImage(), importStr, type }); } } matches.clear(); }

Target:
private void checkImports(JavaNode node, Object data) { String name = node.getImage(); List<ASTImportDeclaration> matches = new ArrayList<>(); for (ASTImportDeclaration importDeclaration : imports) { if (!importDeclaration.isImportOnDemand()) { if (name.equals(importDeclaration.getImportedName())) { matches.add(importDeclaration); continue; } } if (declarationMatches(importDeclaration, name)) { matches.add(importDeclaration); } } if (matches.isEmpty()) { for (ASTImportDeclaration importDeclaration : imports) { if (importDeclaration.isStatic()) { String[] importParts = importDeclaration.getImportedName().split("\\."); String[] nameParts = name.split("\\."); if (importDeclaration.isImportOnDemand()) { if (nameParts[nameParts.length - 2].equals(importParts[importParts.length - 1])) { matches.add(importDeclaration); } } else { if (nameParts[nameParts.length - 1].equals(importParts[importParts.length - 1]) && nameParts[nameParts.length - 2].equals(importParts[importParts.length - 2])) { matches.add(importDeclaration); } } } } } if (!matches.isEmpty()) { ASTImportDeclaration firstMatch = matches.get(0); if (!isAvoidingConflict(node, name, firstMatch)) { String importStr = firstMatch.getImportedName() + (firstMatch.isImportOnDemand() ? ".*" : ""); String type = firstMatch.isStatic() ? "static " : ""; addViolation(data, node, new Object[] { node.getImage(), importStr, type }); } } }
Source:
public int read() throws IOException { synchronized ( InfinispanJF.this ) { if ( closed ) { throw new IOException( "Joint: " + jointIdx + "(" + originalThreadName + "): Cannot read from closed stream!" ); } } if ( block.hasRemaining() ) { if ( block.isEOF() ) { return -1; } try { FileBlock next = filesystem.getNextBlock( block, metadata ); block = next; if ( block == null ) { return -1; } } catch ( final IOException e ) { return -1; } } final int result = block.readFromBuffer(); return result; }

Target:
public int read() throws IOException { if ( closed ) { throw new IOException( "Joint: " + jointIdx + "(" + originalThreadName + "): Cannot read from closed stream!" ); } if ( block.isEOF() ) { return -1; } try { FileBlock next = filesystem.getNextBlock( block, metadata ); block = next; if ( block == null ) { return -1; } } catch ( final IOException e ) { return -1; } final int result = block.readFromBuffer(); return result; }
Source:
private boolean validProperties() { boolean valid = false; try { valid = PAResourceManagerProperties.RM_UNAVAILABLE_NODES_REMOVAL_FREQUENCY.isSet() && PAResourceManagerProperties.RM_UNAVAILABLE_NODES_MAX_PERIOD.isSet() && PAResourceManagerProperties.RM_UNAVAILABLE_NODES_MAX_PERIOD.getValueAsInt() > 0; } catch (RuntimeException e) { logger.error("Nodes housekeeping properties are not valid. Nodes housekeeping will be deactivated.", e); } return valid; }

Target:
private boolean validProperties() { try { return PAResourceManagerProperties.RM_UNAVAILABLE_NODES_REMOVAL_FREQUENCY.isSet() && PAResourceManagerProperties.RM_UNAVAILABLE_NODES_MAX_PERIOD.isSet() && PAResourceManagerProperties.RM_UNAVAILABLE_NODES_MAX_PERIOD.getValueAsInt() > 0; } catch (RuntimeException e) { logger.error("Nodes housekeeping properties are not valid. Nodes housekeeping will be deactivated.", e); return false; } }
Source:
protected void onCreate(final Bundle savedInstanceState) { if (DEBUG) { Log.d(TAG, "onCreate() called with: " + "savedInstanceState = [" + savedInstanceState + "]"); } if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) { TLSSocketFactoryCompat.setAsDefault(); } ThemeHelper.setTheme(this, ServiceHelper.getSelectedServiceId(this)); assureCorrectAppLanguage(this); super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window w = getWindow(); w.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); } if (getSupportFragmentManager() != null && getSupportFragmentManager().getBackStackEntryCount() == 0) { initFragments(); } Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); try { setupDrawer(); } catch (Exception e) { ErrorActivity.reportUiError(this, e); } if (AndroidTvUtils.isTv(this)) { FocusOverlayView.setupFocusObserver(this); } }

Target:
protected void onCreate(final Bundle savedInstanceState) { if (DEBUG) { Log.d(TAG, "onCreate() called with: " + "savedInstanceState = [" + savedInstanceState + "]"); } if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) { TLSSocketFactoryCompat.setAsDefault(); } ThemeHelper.setTheme(this, ServiceHelper.getSelectedServiceId(this)); assureCorrectAppLanguage(this); super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window w = getWindow(); w.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); } if (getSupportFragmentManager() != null && getSupportFragmentManager().getBackStackEntryCount() == 0) { initFragments(); } setSupportActionBar(findViewById(R.id.toolbar)); try { setupDrawer(); } catch (Exception e) { ErrorActivity.reportUiError(this, e); } if (AndroidTvUtils.isTv(this)) { FocusOverlayView.setupFocusObserver(this); } }
Source:
public int getAnimation(View rowView, SectionListItem<H, I> rowValue) { if (!rowValue.isSectionHeader()) { return itemRenderer.getAnimation(rowView, rowValue.getData()); } else return 0; }

Target:
public int getAnimation(View rowView, SectionListItem<H, I> rowValue) { if (rowValue.isSectionHeader()) { return headerRenderer.getAnimation(rowView, rowValue.getSectionHeader()); } else { return itemRenderer.getAnimation(rowView, rowValue.getData()); } }
Source:
public void testExpandWithIsAInExternalValueSet() throws InterruptedException { createExternalCsAndLocalVs(); waitForElasticToCatchUp(); ValueSet vs = new ValueSet(); ValueSet.ConceptSetComponent include = vs.getCompose().addInclude(); include.setSystem(URL_MY_CODE_SYSTEM); include.addFilter().setOp(ValueSet.FilterOperator.ISA).setValue("childAA").setProperty("concept"); ValueSet result = myValueSetDao.expand(vs, null); logAndValidateValueSet(result); ArrayList<String> codes = toCodesContains(result.getExpansion().getContains()); assertThat(codes, containsInAnyOrder("childAAA", "childAAB")); }

Target:
public void testExpandWithIsAInExternalValueSet() { createExternalCsAndLocalVs(); ValueSet vs = new ValueSet(); ValueSet.ConceptSetComponent include = vs.getCompose().addInclude(); include.setSystem(URL_MY_CODE_SYSTEM); include.addFilter().setOp(ValueSet.FilterOperator.ISA).setValue("childAA").setProperty("concept"); ValueSet result = myValueSetDao.expand(vs, null); logAndValidateValueSet(result); ArrayList<String> codes = toCodesContains(result.getExpansion().getContains()); assertThat(codes, containsInAnyOrder("childAAA", "childAAB")); }
Source:
public void whenSealed() { assertLine("whenSealed.when", ICounter.FULLY_COVERED, 0, 0); assertLine("whenSealed.case1", ICounter.FULLY_COVERED, 0, 2); assertLine("whenSealed.case2", ICounter.FULLY_COVERED, 0, 0); assertLine("whenSealed.return", ICounter.FULLY_COVERED, 0, 0); }

Target:
public void whenSealed() { assertLine("whenSealed.when", ICounter.FULLY_COVERED); assertLine("whenSealed.case1", ICounter.FULLY_COVERED, 0, 2); assertLine("whenSealed.case2", ICounter.FULLY_COVERED); assertLine("whenSealed.return", ICounter.FULLY_COVERED); }
Source:
public String toString() { LocaleData localeData = LocaleData.get(Locale.US); Calendar cal = new GregorianCalendar(milliseconds); TimeZone tz = cal.getTimeZone(); StringBuilder result = new StringBuilder(); result.append(localeData.shortWeekdayNames[cal.get(Calendar.DAY_OF_WEEK)]); result.append(' '); result.append(localeData.shortMonthNames[cal.get(Calendar.MONTH)]); result.append(' '); appendTwoDigits(result, cal.get(Calendar.DAY_OF_MONTH)); result.append(' '); appendTwoDigits(result, cal.get(Calendar.HOUR_OF_DAY)); result.append(':'); appendTwoDigits(result, cal.get(Calendar.MINUTE)); result.append(':'); appendTwoDigits(result, cal.get(Calendar.SECOND)); result.append(' '); result.append(tz.getDisplayName(tz.inDaylightTime(this), TimeZone.SHORT, Locale.US)); result.append(' '); result.append(cal.get(Calendar.YEAR)); return result.toString(); }

Target:
public String toString() { LocaleData localeData = LocaleData.get(Locale.US); TimeZone tz = TimeZone.getDefault(); Calendar cal = new GregorianCalendar(tz, Locale.US); cal.setTimeInMillis(milliseconds); StringBuilder result = new StringBuilder(); result.append(localeData.shortWeekdayNames[cal.get(Calendar.DAY_OF_WEEK)]); result.append(' '); result.append(localeData.shortMonthNames[cal.get(Calendar.MONTH)]); result.append(' '); appendTwoDigits(result, cal.get(Calendar.DAY_OF_MONTH)); result.append(' '); appendTwoDigits(result, cal.get(Calendar.HOUR_OF_DAY)); result.append(':'); appendTwoDigits(result, cal.get(Calendar.MINUTE)); result.append(':'); appendTwoDigits(result, cal.get(Calendar.SECOND)); result.append(' '); result.append(tz.getDisplayName(tz.inDaylightTime(this), TimeZone.SHORT, Locale.US)); result.append(' '); result.append(cal.get(Calendar.YEAR)); return result.toString(); }
Source:
public void unmarshallWithValidation() throws Exception { tested = spy(new DiagramMarshaller() { @Override public Graph unmarshall(Metadata metadata, InputStream input) { return graph; } @Override public String marshall(Diagram diagram) { return null; } @Override public DiagramMetadataMarshaller getMetadataMarshaller() { return null; } }); request = MarshallingRequest.builder() .metadata(metadata) .input(input) .mode(MarshallingRequest.Mode.ERROR) .build(); final MarshallingResponse response = tested.unmarshallWithValidation(request); verify(tested).unmarshall(metadata, input); assertEquals(response.getResult().orElse(null), graph); assertEquals(response.getState(), MarshallingResponse.State.SUCCESS); }

Target:
public void unmarshallWithValidation() throws Exception { tested = spy(new DiagramMarshaller() { @Override public Graph unmarshall(Metadata metadata, InputStream input) { return graph; } @Override public String marshall(Diagram diagram) { return null; } @Override public DiagramMetadataMarshaller getMetadataMarshaller() { return null; } }); final MarshallingResponse response = tested.unmarshallWithValidation(request); verify(tested).unmarshall(metadata, input); assertEquals(response.getResult().orElse(null), graph); assertEquals(response.getState(), MarshallingResponse.State.SUCCESS); }
Source:
public NewTableConfiguration attachIterator(IteratorSetting setting) throws AccumuloException { return attachIterator(setting, EnumSet.allOf(IteratorScope.class)); }

Target:
public NewTableConfiguration attachIterator(IteratorSetting setting) { return attachIterator(setting, EnumSet.allOf(IteratorScope.class)); }
Source:
public void createControl(Composite parent, FormToolkit toolkit) { final Section section = createSection(parent, toolkit, true); section.setText("Task Activity Tracing"); Composite activityComposite = toolkit.createComposite(section); activityComposite.setLayout(new GridLayout(1, false)); activityComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); toolkit.paintBordersFor(activityComposite); section.setClient(activityComposite); setSection(toolkit, section); }

Target:
public void createControl(Composite parent, FormToolkit toolkit) { final Section section = createSection(parent, toolkit, false); section.setText("Activity"); Composite activityComposite = toolkit.createComposite(section); activityComposite.setLayout(new GridLayout(1, false)); activityComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); toolkit.paintBordersFor(activityComposite); section.setClient(activityComposite); setSection(toolkit, section); }
Source:
private void activateTopologyHandler(String topologyName) throws TMasterException { assert isRunning; NetworkUtils.TunnelConfig tunnelConfig = NetworkUtils.TunnelConfig.build(config, NetworkUtils.HeronSystem.SCHEDULER); TMasterUtils.transitionTopologyState(topologyName, TMasterUtils.TMasterCommand.ACTIVATE, Runtime.schedulerStateManagerAdaptor(runtime), TopologyAPI.TopologyState.PAUSED, TopologyAPI.TopologyState.RUNNING, tunnelConfig); }

Target:
private void activateTopologyHandler(String topologyName) throws TMasterException { assert !potentialStaleExecutionData; NetworkUtils.TunnelConfig tunnelConfig = NetworkUtils.TunnelConfig.build(config, NetworkUtils.HeronSystem.SCHEDULER); TMasterUtils.transitionTopologyState(topologyName, TMasterUtils.TMasterCommand.ACTIVATE, Runtime.schedulerStateManagerAdaptor(runtime), TopologyAPI.TopologyState.PAUSED, TopologyAPI.TopologyState.RUNNING, tunnelConfig); }
Source:
protected void notify(URL url, NotifyListener listener, List<URL> urls) { if (url == null) { throw new IllegalArgumentException("notify url == null"); } if (listener == null) { throw new IllegalArgumentException("notify listener == null"); } if ((urls == null || urls.isEmpty()) && !Constants.ANY_VALUE.equals(url.getServiceInterface())) { logger.warn("Ignore empty notify urls for subscribe url " + url); return; } if (logger.isInfoEnabled()) { logger.info("Notify urls for subscribe url " + url + ", urls: " + urls); } if (urls == null) { return; } Map<String, List<URL>> result = new HashMap<>(); for (URL u : urls) { if (UrlUtils.isMatch(url, u)) { String category = u.getParameter(Constants.CATEGORY_KEY, Constants.DEFAULT_CATEGORY); List<URL> categoryList = result.computeIfAbsent(category, k -> new ArrayList<>()); categoryList.add(u); } } if (result.size() == 0) { return; } Map<String, List<URL>> categoryNotified = notified.get(url); if (categoryNotified == null) { notified.putIfAbsent(url, new ConcurrentHashMap<>()); categoryNotified = notified.get(url); } for (Map.Entry<String, List<URL>> entry : result.entrySet()) { String category = entry.getKey(); List<URL> categoryList = entry.getValue(); categoryNotified.put(category, categoryList); saveProperties(url); listener.notify(categoryList); } }

Target:
protected void notify(URL url, NotifyListener listener, List<URL> urls) { if (url == null) { throw new IllegalArgumentException("notify url == null"); } if (listener == null) { throw new IllegalArgumentException("notify listener == null"); } if ((urls == null || urls.isEmpty()) && !Constants.ANY_VALUE.equals(url.getServiceInterface())) { logger.warn("Ignore empty notify urls for subscribe url " + url); return; } if (urls == null) { logger.warn("Ignore empty notify urls for subscribe url " + url); return; } if (logger.isInfoEnabled()) { logger.info("Notify urls for subscribe url " + url + ", urls: " + urls); } Map<String, List<URL>> result = new HashMap<>(); for (URL u : urls) { if (UrlUtils.isMatch(url, u)) { String category = u.getParameter(Constants.CATEGORY_KEY, Constants.DEFAULT_CATEGORY); List<URL> categoryList = result.computeIfAbsent(category, k -> new ArrayList<>()); categoryList.add(u); } } if (result.size() == 0) { return; } Map<String, List<URL>> categoryNotified = notified.get(url); if (categoryNotified == null) { notified.putIfAbsent(url, new ConcurrentHashMap<>()); categoryNotified = notified.get(url); } for (Map.Entry<String, List<URL>> entry : result.entrySet()) { String category = entry.getKey(); List<URL> categoryList = entry.getValue(); categoryNotified.put(category, categoryList); saveProperties(url); listener.notify(categoryList); } }
Source:
private String doRegister() throws InterruptedException { URI envsUri = UriComponentsBuilder.newInstance().uri(jaasEndpoint).path("/envs").build().toUri(); TestEnvironmentEntity testEnvironmentEntity = buildTestEnvironmentEntityWith(TestEnvironmentStatus.PENDING); ResponseEntity<String> responseEntity = null; boolean posted = false; do { try { responseEntity = restTemplate.postForEntity(envsUri, testEnvironmentEntity, String.class); posted = true; LOGGER.info("POST request sent to with body {}.", envsUri, testEnvironmentEntity); } catch (HttpClientErrorException e) { if (!isEnvIdUnacceptable(e)) { throw e; } envId = UUID.randomUUID().toString(); LOGGER.warn("Changing env id from to {}", testEnvironmentEntity.getEnvironmentId(), envId); testEnvironmentEntity.setEnvironmentId(envId); } catch (HttpServerErrorException e) { LOGGER.warn("Didn't manage to reach out JaaS..."); TimeUnit.SECONDS.sleep(3); } } while (!posted); final String sessionCookie = extractSessionCookie(responseEntity); LOGGER.info("Environment successfully registered to JaaS with session cookie - {}", envId, sessionCookie); return sessionCookie; }

Target:
private String doRegister() throws InterruptedException { URI envsUri = UriComponentsBuilder.newInstance().uri(jaasEndpoint).path("/envs").build().toUri(); TestEnvironmentEntity testEnvironmentEntity = buildTestEnvironmentEntityWith(TestEnvironmentStatus.PENDING); ResponseEntity<String> responseEntity = null; boolean posted = false; do { try { responseEntity = restTemplate.postForEntity(envsUri, testEnvironmentEntity, String.class); posted = true; LOGGER.info("POST request sent to with body {}.", envsUri, testEnvironmentEntity); } catch (HttpClientErrorException e) { if (!isEnvIdUnacceptable(e)) { throw e; } envId = UUID.randomUUID().toString(); LOGGER.warn("Changing env id from to {}", testEnvironmentEntity.getEnvironmentId(), envId); testEnvironmentEntity.setEnvironmentId(envId); } catch (HttpServerErrorException | ResourceAccessException e) { LOGGER.warn("Error during registration to '{}'", envsUri, e); TimeUnit.SECONDS.sleep(statusReportIntervalSeconds); } } while (!posted); final String sessionCookie = extractSessionCookie(responseEntity); LOGGER.info("Environment successfully registered to JaaS with session cookie - {}", envId, sessionCookie); return sessionCookie; }
Source:
public void callPrivateMethodWithSeveralShortParams(String containerType, String endpoint) { short value1 = 1, value2 = 2; short result = (short) (value1 + value2); performActionForShort(containerType, endpoint, PRIVATE_WITH_SEVERAL_SHORT_PARAMS_ACTION, result, new Param(PARAM_NAME_1, value1), new Param(PARAM_NAME_2, value2)); }

Target:
public void callPrivateMethodWithSeveralShortParams(String containerType, String endpoint) { final short value1 = 1; final short value2 = 2; final short result = (short) (value1 + value2); performActionForShort(containerType, endpoint, PRIVATE_WITH_SEVERAL_SHORT_PARAMS_ACTION, result, new Param(PARAM_NAME_1, value1), new Param(PARAM_NAME_2, value2)); }
Source:
public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); ApplicationlessInjection .getInstance(getActivity().getApplicationContext()) .getCommonsApplicationComponent() .inject(this); }

Target:
public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); }
Source:
public byte[] wrapAvro(byte[] data, String id, long timestamp, Topic topic, CompiledSchema<Schema> schema, Map<String, String> externalMetadata) { byte[] wrapped = avroMessageContentWrapper.wrapContent(data, id, timestamp, schema.getSchema(), externalMetadata); return topic.isSchemaVersionAwareSerializationEnabled() ? SchemaAwareSerializer.serialize(schema.getVersion(), wrapped) : wrapped; }

Target:
public byte[] wrapAvro(byte[] data, String id, long timestamp, Topic topic, CompiledSchema<Schema> schema, Map<String, String> externalMetadata) { byte[] wrapped = avroMessageContentWrapper.wrapContent(data, id, timestamp, schema.getSchema(), externalMetadata); return topic.isSchemaVersionAwareSerializationEnabled() ? SchemaAwareSerDe.serialize(schema.getVersion(), wrapped) : wrapped; }
Source:
public ResolvedExpression parseSqlExpression(String sqlExpression, TableSchema inputSchema) { FlinkTypeFactory typeFactory = typeFactorySupplier.get(); List<String> fieldNames = Arrays.asList(inputSchema.getFieldNames()); List<LogicalType> fieldTypes = Arrays.stream(inputSchema.getFieldDataTypes()) .map(LogicalTypeDataTypeConverter::toLogicalType) .collect(Collectors.toList()); RelDataType inputType = typeFactory.buildRelNodeRowType( JavaScalaConversionUtil$.MODULE$.toScala(fieldNames), JavaScalaConversionUtil$.MODULE$.toScala(fieldTypes)); SqlExprToRexConverter sqlExprToRexConverter = sqlExprToRexConverterSupplier.get().create(inputType); RexNode rexNode = sqlExprToRexConverter.convertToRexNode(sqlExpression); LogicalType logicalType = FlinkTypeFactory.toLogicalType(rexNode.getType()); return new RexNodeExpression(rexNode, TypeConversions.fromLogicalToDataType(logicalType)); }

Target:
public ResolvedExpression parseSqlExpression(String sqlExpression, TableSchema inputSchema) { SqlExprToRexConverter sqlExprToRexConverter = sqlExprToRexConverterCreator.apply(inputSchema); RexNode rexNode = sqlExprToRexConverter.convertToRexNode(sqlExpression); LogicalType logicalType = FlinkTypeFactory.toLogicalType(rexNode.getType()); return new RexNodeExpression(rexNode, TypeConversions.fromLogicalToDataType(logicalType)); }
Source:
public static long getRemoteSize(String url) { long remoteSize = 0L; HttpURLConnection httpConn = null; try { URI uri = new URI(url); httpConn = (HttpURLConnection)uri.toURL().openConnection(); httpConn.setRequestMethod("HEAD"); httpConn.setConnectTimeout(2000); httpConn.setReadTimeout(5000); String contentLength = httpConn.getHeaderField("Content-Length"); if (contentLength != null) { remoteSize = Long.parseLong(contentLength); } } catch (URISyntaxException e) { throw new IllegalArgumentException("Invalid URL " + url); } catch (IOException e) { throw new IllegalArgumentException("Unable to establish connection with URL " + url); } finally { if (httpConn != null) { httpConn.disconnect(); } } return remoteSize; }

Target:
public static long getRemoteSize(String url) { long remoteSize = 0L; final String[] methods = new String[]{"HEAD", "GET"}; IllegalArgumentException exception = null; for (String method : methods) { HttpURLConnection httpConn = null; try { URI uri = new URI(url); httpConn = (HttpURLConnection)uri.toURL().openConnection(); httpConn.setRequestMethod(method); httpConn.setConnectTimeout(2000); httpConn.setReadTimeout(5000); String contentLength = httpConn.getHeaderField("Content-Length"); if (contentLength != null) { remoteSize = Long.parseLong(contentLength); } else if (method.equals("GET") && httpConn.getResponseCode() < 300) { byte[] buf = new byte[1024]; int length; while ((length = httpConn.getInputStream().read(buf, 0, buf.length)) != -1) { remoteSize += length; } } return remoteSize; } catch (URISyntaxException e) { throw new IllegalArgumentException("Invalid URL " + url); } catch (IOException e) { exception = new IllegalArgumentException("Unable to establish connection with URL " + url); } finally { if (httpConn != null) { httpConn.disconnect(); } } } if (exception != null) { throw exception; } return 0L; }
Source:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((section == null) ? 0 : section.hashCode()); result = prime * result + ((subsection == null) ? 0 : subsection.hashCode()); return result; }

Target:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + section.hashCode(); result = prime * result + ((subsection == null) ? 0 : subsection.hashCode()); return result; }