auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>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; <START> 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); } <END> if (tid != null) { return tid; } return null; }</code><technical_language>want put this a public method in analysis? I in general, analysis hide state system. in KernelThreadInformationProvider</technical_language>

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:
<code>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) { <START> System.out.println("Directory is a file: " + directoryPath.toAbsolutePath()); <END> } 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"); } }</code><technical_language>for, this error context, directory is a file</technical_language>

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:
<code>public void testIsVariant() { <START> assertTrue(VariantUtils.isVariant(DataUtils.makeVariant("chr7", 200000, 200001, "A", <END> 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))); }</code><technical_language>I do. assume processed correctly, right? 1 2337032 rs1129171 C T,<NON_REF> 480.77 . BaseQRankSum=0.218;ClippingRankSum=0.103;DB;DP=45;MLEAC=1,0;MLEAF=0.500,0.00;MQ=60.00;MQ0=0;MQRankSum=-1.344;ReadPosRankSum=1.046 GT:AD:DP:GQ:PL:SB 0/1:19,26,0:45:99:509,0,330,565,407,97 2:9,10,13,13</technical_language>

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:
<code>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); <START> 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 -> { <END> 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; } } }</code><technical_language>dAnalysis.getOwnedViews().stream().flatMap(view -> new DViewQuery(view).getLoadedRepresentations().stream()).filter(rep -> rep instanceof DSemanticDiagram).map(DDiagram.class::cast).forEach(dDiagram -> {</technical_language>

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:
<code>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) { <START> String message = (ioe instanceof java.net.ConnectException) <END> ? "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; }</code><technical_language>Instead of instanceof, catch ConnectException handle separately. like: try { ... } catch (ConnectException) { ... } catch (IOException) { ... }</technical_language>

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:
<code>private LibrarySelector getLibrarySelectorService() { <START> LibrarySelector librarySelector = Framework.getRuntime().getService(LibrarySelector.class); <END> if (librarySelector == null) { log.error("Unable to get LibrarySelector runtime service"); throw new NuxeoException("Unable to get LibrarySelector runtime service"); } return librarySelector; }</code><technical_language>Framework.getService(LibrarySelector.class);</technical_language>

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:
<code>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. " + <START> "Please configure SSO properly with SsoPostLoginServlet."); <END> } } catch (Exception ex) { log.error("Unable to get token for engine session {}", ex.getMessage()); } log.debug("Exiting SsoPostLoginFilter"); }</code><technical_language>this error? warning</technical_language>

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:
<code>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); <START> if (!AuthzResolver.authorizedInternal(sess, "", Collections.singletonList(member))) { <END> 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); }</code><technical_language>Missing policy name</technical_language>

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:
<code>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); <START> } catch (Exception e) { <END> } }</code><technical_language>CoreException logged. is general approach in freemarker ignore exceptions, fixed separate issue</technical_language>

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:
<code>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); <START> IContentProvider provider = getPageControl().getViewer().getContentProvider(); <END> 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); } } } } }); }</code><technical_language>For readability, getPageControl().getViewer() extracted local variable</technical_language>

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:
<code>private void checkImports(JavaNode node, Object data) { String name = node.getImage(); <START> matches.clear(); <END> 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(); }</code><technical_language>seen, matches is in this method, I remove field add a local variable here</technical_language>

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:
<code>public int read() throws IOException { synchronized ( InfinispanJF.this ) { if ( closed ) { throw new IOException( "Joint: " + jointIdx + "(" + originalThreadName + "): Cannot read from closed stream!" ); } } <START> if ( block.hasRemaining() ) END> { 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; }</code><technical_language>This contradictory block.isEOF()...it's a copy/paste error</technical_language>

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:
<code>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); } <START> return valid; <END> }</code><technical_language>java 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 valid. Nodes housekeeping deactivated.", e); return false; }</technical_language>

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:
<code>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(); } <START> Toolbar toolbar = findViewById(R.id.toolbar); <END> setSupportActionBar(toolbar); try { setupDrawer(); } catch (Exception e) { ErrorActivity.reportUiError(this, e); } if (AndroidTvUtils.isTv(this)) { FocusOverlayView.setupFocusObserver(this); } }</code><technical_language>Add final here, revert this change</technical_language>

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:
<code><START> public int getAnimation(View rowView, SectionListItem<H, I> rowValue) { <END> if (!rowValue.isSectionHeader()) { return itemRenderer.getAnimation(rowView, rowValue.getData()); } else return 0; }</code><technical_language>Please add a TODO here. I setting animations is broken. passing in animation Component set Animations appropriately in btw - need animation headers if bring in below. bringing in cards enough. need some mechanism define Animation of Header/Section in SectionListComponent inherit method setItemAnimation ListComponent</technical_language>

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:
<code>public void testExpandWithIsAInExternalValueSet() throws InterruptedException { createExternalCsAndLocalVs(); <START> waitForElasticToCatchUp(); <END> 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")); }</code><technical_language>waitForElasticToCatchUp() do anything. Is this statement needed</technical_language>

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:
<code>public void whenSealed() { <START> assertLine("whenSealed.when", ICounter.FULLY_COVERED, 0, 0); <END> assertLine("whenSealed.case1", ICounter.FULLY_COVERED, 0, 2); assertLine("whenSealed.case2", ICounter.FULLY_COVERED, 0, 0); assertLine("whenSealed.return", ICounter.FULLY_COVERED, 0, 0); }</code><technical_language>in conflict #722</technical_language>

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:
<code>public String toString() { LocaleData localeData = LocaleData.get(Locale.US); Calendar cal = new <START> GregorianCalendar(milliseconds); <END> 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(); }</code><technical_language>GregorianCalendar takes a locale too. OTTOMH, for "first day of week", included for completeness clear is throughout</technical_language>

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:
<code>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; } }); <START> request = MarshallingRequest.builder() <END> .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); }</code><technical_language>This stay in setUp method, is in tests</technical_language>

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:
<code><START> public NewTableConfiguration attachIterator(IteratorSetting setting) throws AccumuloException { <END> return attachIterator(setting, EnumSet.allOf(IteratorScope.class)); }</code><technical_language>I methods need throw a checked AccumuloException. preferable for throw IllegalArgumentException, problem is bad argument method, a problem Accumulo itself</technical_language>

Target:
public NewTableConfiguration attachIterator(IteratorSetting setting) { return attachIterator(setting, EnumSet.allOf(IteratorScope.class)); }
Source:
<code>public void createControl(Composite parent, FormToolkit toolkit) { final Section section = createSection(parent, toolkit, true); <START> section.setText("Task Activity Tracing"); END> 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); }</code><technical_language>"Activity" embedded in task editor clear task related activity</technical_language>

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:
<code>private void activateTopologyHandler(String topologyName) throws TMasterException { <START> assert isRunning; <END> 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); }</code><technical_language>topology in running state</technical_language>

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:
<code>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); } <START> if (urls == null) { <END> 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); } }</code><technical_language>is put line Line 374, log warn message return</technical_language>

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:
<code>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..."); <START> TimeUnit.SECONDS.sleep(3); <END> } } while (!posted); final String sessionCookie = extractSessionCookie(responseEntity); LOGGER.info("Environment successfully registered to JaaS with session cookie - {}", envId, sessionCookie); return sessionCookie; }</code><technical_language>'statusReportIntervalSeconds'</technical_language>

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:
<code>public void callPrivateMethodWithSeveralShortParams(String containerType, String endpoint) { <START> short value1 = 1, value2 = 2; <END> 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)); }</code><technical_language>final please do create 2 vars in 1 line</technical_language>

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:
<code>public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); <START> ApplicationlessInjection <END> .getInstance(getActivity().getApplicationContext()) .getCommonsApplicationComponent() .inject(this); }</code><technical_language>required</technical_language>

Target:
public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); }
Source:
<code><START> public byte[] wrapAvro(byte[] data, String id, long timestamp, Topic topic, CompiledSchema<Schema> schema, Map<String, String> externalMetadata) { <END> byte[] wrapped = avroMessageContentWrapper.wrapContent(data, id, timestamp, schema.getSchema(), externalMetadata); return topic.isSchemaVersionAwareSerializationEnabled() ? SchemaAwareSerializer.serialize(schema.getVersion(), wrapped) : wrapped; }</code><technical_language>params passed message.getX() - pass Message interface</technical_language>

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:
<code>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( <START> JavaScalaConversionUtil$.MODULE$.toScala(fieldNames), <END> 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)); }</code><technical_language>add a method FlinkTypeFactory work Java? This hack nice</technical_language>

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:
<code><START> public static long getRemoteSize(String url) { <END> 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; }</code><technical_language>@marcaurele I this needs changed Long, else method is called type Long</technical_language>

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:
<code>public int hashCode() { final int prime = 31; int result = 1; result = prime * result <START> + ((section == null) ? 0 : section.hashCode()); <END> result = prime * result + ((subsection == null) ? 0 : subsection.hashCode()); return result; }</code><technical_language>I OK assume section != null here</technical_language>

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; }
Source:
<code>protected Operator translateToDataFlow(Operator input) { PlanMapOperator<IN, Long> countMapOperator = new PlanMapOperator<IN, Long>( new CountingMapUdf<IN>(), "Count: map to ones", getInputType(), BasicTypeInfo.LONG_TYPE_INFO); <START> countMapOperator.setInput(input); <END> PlanReduceOperator<Long> countReduceOperator = new PlanReduceOperator<Long>( new CountingReduceUdf(), new int[0], "Count: sum up ones", BasicTypeInfo.LONG_TYPE_INFO); countReduceOperator.setInput(countMapOperator); return countReduceOperator; }</code><technical_language>I need set parallelism here. a operators inject key extracting mappers do it</technical_language>

Target:
protected ReduceOperatorBase<Long, GenericReduce<Long>> translateToDataFlow(Operator input) { MapOperatorBase<IN, Long, GenericMap<IN, Long>> mapToOnes = new MapOperatorBase<IN, Long, GenericMap<IN, Long>>( new CountingMapUdf<IN>(), new UnaryOperatorInformation<IN, Long>(getInputType(), BasicTypeInfo.LONG_TYPE_INFO), "Count: map to ones"); mapToOnes.setInput(input); mapToOnes.setDegreeOfParallelism(input.getDegreeOfParallelism()); GenericDataSourceBase<Long, CollectionInputFormat<Long>> dummySource = new GenericDataSourceBase( new CollectionInputFormat<Long>(Arrays.asList(new Long[]{0L})), new OperatorInformation<Long>(BasicTypeInfo.LONG_TYPE_INFO), "Count: dummy source (for 0 count)"); Union<Long> unionMapToOnesAndZero = new Union<Long>(mapToOnes, dummySource); ReduceOperatorBase<Long, GenericReduce<Long>> sumOnes = new ReduceOperatorBase<Long, GenericReduce<Long>>( new CountingReduceUdf(), new UnaryOperatorInformation<Long, Long>(BasicTypeInfo.LONG_TYPE_INFO, BasicTypeInfo.LONG_TYPE_INFO), new int[0], "Count: sum up ones"); sumOnes.setInput(unionMapToOnesAndZero); sumOnes.setDegreeOfParallelism(1); return sumOnes; }