auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean canFlipToNextPage() { boolean result = false; setErrorMessage(null); ISelection selection = treeViewer.getSelection(); if (selection instanceof StructuredSelection && ((StructuredSelection) selection).getFirstElement() instanceof RepresentationDescription) { RepresentationDescription representationDescription = (RepresentationDescription) ((StructuredSelection) selection).getFirstElement(); result = true; if (root instanceof DAnalysisSession) { DRepresentationContainer representationContainer = DAnalysisSessionHelper.findContainerForRepresentationDescription((DAnalysisSession) root, representationDescription); <START> if (representationContainer != null) { <END> IPermissionAuthority permissionAuthority = PermissionAuthorityRegistry.getDefault().getPermissionAuthority(representationContainer); if (permissionAuthority != null && !permissionAuthority.canCreateIn(representationContainer)) { setErrorMessage(READ_ONLY_REPRESENTATION_CONTAINER); result = false; } } } if (result) { setRepresentation(representationDescription); } } return result; }</code><technical_language>if (representationContainer == null), result is true??</technical_language>

Target:
public boolean canFlipToNextPage() { boolean result = false; setErrorMessage(null); ISelection selection = treeViewer.getSelection(); if (selection instanceof StructuredSelection && ((StructuredSelection) selection).getFirstElement() instanceof RepresentationDescription) { RepresentationDescription representationDescription = (RepresentationDescription) ((StructuredSelection) selection).getFirstElement(); result = true; if (root instanceof DAnalysisSession) { Collection<DRepresentationContainer> containers = DAnalysisSessionHelper.findContainerCandidatesForRepresentationDescription((DAnalysisSession) root, representationDescription); if (!containers.isEmpty()) { result = false; for (DRepresentationContainer container : containers) { IPermissionAuthority permissionAuthority = PermissionAuthorityRegistry.getDefault().getPermissionAuthority(container); if (permissionAuthority == null || permissionAuthority.canCreateIn(container)) { result = true; break; } } } } if (result) { setRepresentation(representationDescription); } else { setErrorMessage(READ_ONLY_REPRESENTATION_CONTAINER); } } return result; }
Source:
<code>public void shouldParseAllTranscriptFieldsInVepOutput() { AnnotationLineMapper lineMapper = new AnnotationLineMapper(); VariantAnnotation variantAnnotation = lineMapper.mapLine(VepOutputContent.vepOutputContentTranscriptFields, 0); List<ConsequenceType> consequenceTypes = variantAnnotation.getConsequenceTypes(); assertNotNull(consequenceTypes); <START> assertTrue(consequenceTypes.size() == 1); <END> ConsequenceType consequenceType = consequenceTypes.get(0); assertEquals(Integer.valueOf(1), consequenceType.getcDnaPosition()); assertEquals(Integer.valueOf(4), consequenceType.getCdsPosition()); assertNull(consequenceType.getAaPosition()); assertEquals("7-?", consequenceType.getAaChange()); assertEquals("9-10", consequenceType.getCodon()); }</code><technical_language>assertEquals(1, consequenceTypes.size())</technical_language>

Target:
public void shouldParseAllTranscriptFieldsInVepOutput() { AnnotationLineMapper lineMapper = new AnnotationLineMapper(); VariantAnnotation variantAnnotation = lineMapper.mapLine(VepOutputContent.vepOutputContentTranscriptFields, 0); List<ConsequenceType> consequenceTypes = variantAnnotation.getConsequenceTypes(); assertNotNull(consequenceTypes); assertEquals(1, consequenceTypes.size()); ConsequenceType consequenceType = consequenceTypes.get(0); assertEquals(Integer.valueOf(1), consequenceType.getcDnaPosition()); assertEquals(Integer.valueOf(4), consequenceType.getCdsPosition()); assertNull(consequenceType.getAaPosition()); assertEquals("7-?", consequenceType.getAaChange()); assertEquals("9-10", consequenceType.getCodon()); }
Source:
<code>public PlayerProfile(String name, UUID uuid, List<PlayerProperty> properties) { Validate.notNull(uuid, "uuid must not be null"); <START> if (name == null) { <END> name = ProfileCache.getProfile(uuid).getName(); } Validate.notNull(properties, "properties must not be null"); this.name = name; this.uuid = uuid; this.properties = properties; }</code><technical_language>This is illogically</technical_language>

Target:
public PlayerProfile(String name, UUID uuid, List<PlayerProperty> properties) { Validate.notNull(uuid, "uuid must not be null"); Validate.notNull(properties, "properties must not be null"); if (null == name) { PlayerProfile profile = ProfileCache.getProfile(uuid); name = profile != null ? profile.getName() : null; } this.name = name; this.uuid = uuid; this.properties = properties; }
Source:
<code>public void run() { try { while (isOpen.get()) { List<NetworkSend> sends = pollForRequests(); <START> disconnectedIdsSet.clear(); <END> ConnectionManagerPollResponse pollResponse = connectionManager.sendAndPoll(POLL_TIMEOUT_MS, sends); onResponse(pollResponse); } } catch (Exception e) { logger.error("RequestResponseHandlerThread received exception: ", e); } finally { shutDownLatch.countDown(); close(); } }</code><technical_language>this done beginning of onResponse() instead of here</technical_language>

Target:
public void run() { try { while (isOpen.get()) { List<NetworkSend> sends = pollForRequests(); selector.poll(POLL_TIMEOUT_MS, sends); onResponse(selector.connected(), selector.disconnected(), selector.completedSends(), selector.completedReceives()); } } catch (Exception e) { logger.error("RequestResponseHandlerThread received exception: ", e); } finally { shutDownLatch.countDown(); close(); } }
Source:
<code>private void alignGraph() { UnifiedPositionTraverser upt = new UnifiedPositionTraverser(); if (Settings.getBoolean(SETTING_EMPTY)) { EmptySegmentTraverser est = new EmptySegmentTraverser(); <START> graph = est.addEmptySegmentsGraph(upt.unifyGraph(graph)); <END> } else { graph = upt.unifyGraph(graph); } }</code><technical_language>upt.unifyGraph(graph) is double code. this structure: new ReferencePositionTraverser(reference).referenceMapGraph(graph);. graph = needed</technical_language>

Target:
private void alignGraph() { UnifiedPositionTraverser upt = new UnifiedPositionTraverser(); graph = upt.unifyGraph(graph); if (Settings.getBoolean(SETTING_EMPTY)) { EmptySegmentTraverser est = new EmptySegmentTraverser(); graph = est.addEmptySegmentsGraph(graph); } }
Source:
<code>public SimpleBinaryTypes getDataType() { if (datatype.equals("byte")) { return SimpleBinaryTypes.BYTE; } if (datatype.equals("word")) { return SimpleBinaryTypes.WORD; } if (datatype.equals("dword")) { return SimpleBinaryTypes.DWORD; } if (datatype.equals("float")) { return SimpleBinaryTypes.FLOAT; } <START> if (datatype.equals("hsv")) { <END> return SimpleBinaryTypes.HSB; } if (datatype.equals("rgb")) { return SimpleBinaryTypes.RGB; } if (datatype.equals("rgbw")) { return SimpleBinaryTypes.RGBW; } Matcher matcher = Pattern.compile("^array\\[(\\d+)\\]$").matcher(datatype); if (matcher.matches()) { return SimpleBinaryTypes.ARRAY; } if (logger.isDebugEnabled()) { logger.debug("getDataType() - unresolved type: " + datatype); } return SimpleBinaryTypes.UNKNOWN; }</code><technical_language>this string "hsb"</technical_language>

Target:
public SimpleBinaryTypes getDataType() { if (datatype.equals("byte")) { return SimpleBinaryTypes.BYTE; } if (datatype.equals("word")) { return SimpleBinaryTypes.WORD; } if (datatype.equals("dword")) { return SimpleBinaryTypes.DWORD; } if (datatype.equals("float")) { return SimpleBinaryTypes.FLOAT; } if (datatype.equals("hsb")) { return SimpleBinaryTypes.HSB; } if (datatype.equals("rgb")) { return SimpleBinaryTypes.RGB; } if (datatype.equals("rgbw")) { return SimpleBinaryTypes.RGBW; } Matcher matcher = Pattern.compile("^array\\[(\\d+)\\]$").matcher(datatype); if (matcher.matches()) { return SimpleBinaryTypes.ARRAY; } if (logger.isDebugEnabled()) { logger.debug("getDataType() - unresolved type: {}", datatype); } return SimpleBinaryTypes.UNKNOWN; }
Source:
<code>private void checkPage() { try { boolean layoutChanged = false; GridData gd = (GridData) warningComposite.getLayoutData(); if (gd.exclude != !branchCombo.getText().startsWith(Constants.R_HEADS)) { gd.exclude = !branchCombo.getText().startsWith(Constants.R_HEADS); warningComposite.setVisible(!gd.exclude); layoutChanged = true; } gd = (GridData) upstreamConfigGroup.getLayoutData(); if (gd.exclude != branchCombo.getText().startsWith(Constants.R_TAGS)) { gd.exclude = branchCombo.getText().startsWith(Constants.R_TAGS); upstreamConfigGroup.setVisible(!gd.exclude); layoutChanged = true; } <START> if (layoutChanged) { <END> upstreamConfigGroup.getParent().layout(true); } if (!gd.exclude) buttonConfigMerge.setSelection(false); buttonConfigRebase.setSelection(false); buttonConfigNone.setSelection(false); switch (upstreamConfig) { case MERGE: buttonConfigMerge.setSelection(true); break; case REBASE: buttonConfigRebase.setSelection(true); break; case NONE: buttonConfigNone.setSelection(true); break; } if (branchCombo.getText().length() == 0) { setErrorMessage(UIText.CreateBranchPage_MissingSourceMessage); return; } if (nameText.getText().length() == 0) { setErrorMessage(UIText.CreateBranchPage_ChooseNameMessage); return; } String message = this.myValidator.isValid(nameText.getText()); if (message != null) { setErrorMessage(message); return; } setErrorMessage(null); } finally { setPageComplete(getErrorMessage() == null); } }</code><technical_language>style nit: curly braces single line blocks</technical_language>

Target:
private void checkPage() { try { boolean layoutChanged = false; GridData gd = (GridData) warningComposite.getLayoutData(); if (gd.exclude != !branchCombo.getText().startsWith(Constants.R_HEADS)) { gd.exclude = !branchCombo.getText().startsWith(Constants.R_HEADS); warningComposite.setVisible(!gd.exclude); layoutChanged = true; } warningComposite.getParent().getParent().layout(true); boolean showRebase = !branchCombo.getText().startsWith(Constants.R_TAGS) && !ObjectId.isId(branchCombo.getText()); gd = (GridData) upstreamConfigGroup.getLayoutData(); if (gd.exclude == showRebase) { gd.exclude = !showRebase; upstreamConfigGroup.setVisible(!gd.exclude); layoutChanged = true; } if (layoutChanged) upstreamConfigGroup.getParent().layout(true); if (!gd.exclude) buttonConfigMerge.setSelection(false); buttonConfigRebase.setSelection(false); buttonConfigNone.setSelection(false); switch (upstreamConfig) { case MERGE: buttonConfigMerge.setSelection(true); break; case REBASE: buttonConfigRebase.setSelection(true); break; case NONE: buttonConfigNone.setSelection(true); break; } if (branchCombo.getText().length() == 0) { setErrorMessage(UIText.CreateBranchPage_MissingSourceMessage); return; } if (nameText.getText().length() == 0) { setErrorMessage(UIText.CreateBranchPage_ChooseNameMessage); return; } String message = this.myValidator.isValid(nameText.getText()); if (message != null) { setErrorMessage(message); return; } setErrorMessage(null); } finally { setPageComplete(getErrorMessage() == null); } }
Source:
<code><START> private void handleController0() { <END> if (switchedUp(ControllerListener.BUTTON_TRIGGER)) { addButtonAction(ControllerId.ZERO, ButtonState.UP); } else if (switchedDown(ControllerListener.BUTTON_TRIGGER)) { addButtonAction(ControllerId.ZERO, ButtonState.DOWN); } else if (switchedUp(ControllerListener.BUTTON_GRIP)) { addButtonAction(ControllerId.ONE, ButtonState.UP); } else if (switchedDown(ControllerListener.BUTTON_GRIP)) { addButtonAction(ControllerId.ONE, ButtonState.DOWN); } else if (switchedUp(ControllerListener.BUTTON_APP_MENU)) { addButtonAction(ControllerId.TWO, ButtonState.UP); } else if (switchedDown(ControllerListener.BUTTON_APP_MENU)) { addButtonAction(ControllerId.TWO, ButtonState.DOWN); } else if (switchedDown(ControllerListener.BUTTON_TOUCHPAD)) { addAxisAction(ControllerId.X_AXIS, ButtonState.DOWN, -cachedStateAfter.rAxis[0].x); addAxisAction(ControllerId.Y_AXIS, ButtonState.DOWN, cachedStateAfter.rAxis[0].y); } else if (switchedUp(ControllerListener.BUTTON_TOUCHPAD)) { addAxisAction(ControllerId.X_AXIS, ButtonState.UP, 0.0f); addAxisAction(ControllerId.Y_AXIS, ButtonState.UP, 0.0f); } }</code><technical_language>Thank for improving this method, I better. Question: methods polling buttons check changed state. So, is button pressed asking of them</technical_language>

Target:
private void handleController0() { if (buttonUp(ControllerListener.TRIGGER_BUTTON)) { addButtonAction(ControllerId.ZERO, ButtonState.UP); } else if (buttonDown(ControllerListener.TRIGGER_BUTTON)) { addButtonAction(ControllerId.ZERO, ButtonState.DOWN); } else if (buttonUp(ControllerListener.GRIP_BUTTON)) { addButtonAction(ControllerId.ONE, ButtonState.UP); } else if (buttonDown(ControllerListener.GRIP_BUTTON)) { addButtonAction(ControllerId.ONE, ButtonState.DOWN); } else if (buttonUp(ControllerListener.APP_MENU_BUTTON)) { addButtonAction(ControllerId.TWO, ButtonState.UP); } else if (buttonDown(ControllerListener.APP_MENU_BUTTON)) { addButtonAction(ControllerId.TWO, ButtonState.DOWN); } else if (buttonDown(ControllerListener.TOUCHPAD_BUTTON)) { addAxisAction(ControllerId.X_AXIS, ButtonState.DOWN, -cachedStateAfter.rAxis[0].x); addAxisAction(ControllerId.Y_AXIS, ButtonState.DOWN, cachedStateAfter.rAxis[0].y); } else if (buttonUp(ControllerListener.TOUCHPAD_BUTTON)) { addAxisAction(ControllerId.X_AXIS, ButtonState.UP, 0.0f); addAxisAction(ControllerId.Y_AXIS, ButtonState.UP, 0.0f); } }
Source:
<code>public static List COMserialport() { List<String> list = new ArrayList<String>(); try { String[] ports = SerialPort.list(); for(String strName : ports) { <START> list.add(strName); <END> } } catch (IOException e) { StatusManager.getManager().handle(new Status(IStatus.ERROR, LaunchPlugin.PLUGIN_ID, "Debugger plugin has thrown IOException", e), StatusManager.SHOW); } if (list.size() < 1) { list.add("Please connect to EM Starter Kit"); } return list; }</code><technical_language>This repalced Collections.addAll(list, SerialPort.list());</technical_language>

Target:
public static List COMserialport() { List<String> list = new ArrayList<String>(); try { Collections.addAll(list, SerialPort.list()); } catch (IOException e) { StatusManager.getManager() .handle(new Status(IStatus.ERROR, LaunchPlugin.PLUGIN_ID, "An error happened when retrieving list of available serial ports.", e), StatusManager.SHOW); } if (list.size() < 1) { list.add("Please connect to EM Starter Kit"); } return list; }
Source:
<code><START> public static String readFileIntoString(String filename) throws java.io.IOException{ <END> InputStream jsonFileInputStream = FileUtils.class.getClassLoader() .getResourceAsStream(filename); StringWriter writer = new StringWriter(); IOUtils.copy(jsonFileInputStream, writer, "utf8"); return writer.toString(); }</code><technical_language>@hugeox unused imports in this class leaking resources IIUC</technical_language>

Target:
public static String readFileIntoString(String filename) throws java.io.IOException{ URL url = Resources.getResource(filename); return Resources.toString(url, Charsets.UTF_8); }
Source:
<code><START> private ReplicationFactor(int allReplicas, int transientReplicas) { <END> this.allReplicas = allReplicas; this.fullReplicas = allReplicas - transientReplicas; }</code><technical_language>nit: allReplicas totalReplicas names for thing, normalize it</technical_language>

Target:
public ReplicationFactor(int allReplicas, int transientReplicas) { this.allReplicas = allReplicas; this.transientReplicas = transientReplicas; this.fullReplicas = allReplicas - transientReplicas; }
Source:
<code>public Optional<Object> apply( final Object... args ) { if(args.length == 0) { return Optional.empty(); } Object arg = args[0]; if(arg != null && arg instanceof Number) { return Optional.<Object>of( ( (Number) arg ).intValue() ); } else { <START> return Optional.<Object>of( Double.NaN ); <END> } }</code><technical_language>eh, NaN absent</technical_language>

Target:
public Optional<Object> apply( final Object... args ) { if(args.length == 0) { return Optional.empty(); } Object arg = args[0]; if(arg != null && arg instanceof Number) { return Optional.<Object>of( ( (Number) arg ).intValue() ); } else { return Optional.empty(); } }
Source:
<code>public void canFindRecursiveDirectoriesAndFiles() throws IOException { List<String> level1Dirs = Arrays.asList( testPathPrefix + UUID.randomUUID(), testPathPrefix + UUID.randomUUID(), testPathPrefix + UUID.randomUUID() ); List<String> level1Files = Arrays.asList( testPathPrefix + UUID.randomUUID(), testPathPrefix + UUID.randomUUID() ); for (String dir : level1Dirs) { mantaClient.putDirectory(dir); } for (String file : level1Files) { mantaClient.put(file, TEST_DATA, StandardCharsets.UTF_8); } List<String> level2Files = level1Dirs .stream() .flatMap(dir -> Stream.of(dir + SEPARATOR + UUID.randomUUID(), dir + SEPARATOR + UUID.randomUUID())) .collect(Collectors.toList()); for (String file : level2Files) { mantaClient.put(file, TEST_DATA, StandardCharsets.UTF_8); } int totalObjects = level1Dirs.size() + level1Files.size() + level2Files.size(); try (Stream<MantaObject> stream = mantaClient.find(testPathPrefix)) { List<MantaObject> results = stream.collect(Collectors.toList()); Assert.assertFalse(results.isEmpty(), "We should have many objects returned"); Assert.assertEquals(results.size(), totalObjects, "We should return exactly as many objects as added"); Stream<MantaObject> resultsStream = results.stream(); List<String> allObjects = new LinkedList<>(); allObjects.addAll(level1Dirs); allObjects.addAll(level1Files); allObjects.addAll(level2Files); for (String dir : level1Dirs) { Assert.assertEquals( <START> resultsStream.filter(obj -> obj.getPath().equals(dir)).count(), <END> 1); } } }</code><technical_language>This test is failing this line java.lang.IllegalStateException: stream operated closed Moving call results.stream() for fix it</technical_language>

Target:
public void canFindRecursiveDirectoriesAndFiles() throws IOException { List<String> level1Dirs = Arrays.asList( testPathPrefix + UUID.randomUUID(), testPathPrefix + UUID.randomUUID(), testPathPrefix + UUID.randomUUID() ); List<String> level1Files = Arrays.asList( testPathPrefix + UUID.randomUUID(), testPathPrefix + UUID.randomUUID() ); for (String dir : level1Dirs) { mantaClient.putDirectory(dir); } for (String file : level1Files) { mantaClient.put(file, TEST_DATA, StandardCharsets.UTF_8); } List<String> level2Files = level1Dirs .stream() .flatMap(dir -> Stream.of(dir + SEPARATOR + UUID.randomUUID(), dir + SEPARATOR + UUID.randomUUID())) .collect(Collectors.toList()); for (String file : level2Files) { mantaClient.put(file, TEST_DATA, StandardCharsets.UTF_8); } List<String> allObjects = new LinkedList<>(); allObjects.addAll(level1Dirs); allObjects.addAll(level1Files); allObjects.addAll(level2Files); final List<MantaObject> results; try (Stream<MantaObject> stream = mantaClient.find(testPathPrefix)) { results = stream.collect(Collectors.toList()); } Assert.assertFalse(results.isEmpty(), "We should have many objects returned"); Assert.assertEquals(results.size(), allObjects.size(), "We should return exactly as many objects as added"); for (String expectedObject : allObjects) { try (Stream<MantaObject> resultsStream = results.stream()) { long count = resultsStream .filter(obj -> obj.getPath().equals(expectedObject)).count(); Assert.assertEquals(count, 1L); } } }
Source:
<code>public void addTeam(Team team) { <START> if(team == null || this.teams.contains(team)) { <END> return; } this.teams.add(team); System.out.println("Game added!"); }</code><technical_language>if game reached maximum number of teams</technical_language>

Target:
public int addTeam(Team team) { if(team == null || this.teams.contains(team)) { return -1; } if(this.teams.size()==tournament.TEAMS_PER_GAME) { return 0; } this.teams.add(team); return 1; }
Source:
<code>public int getContentLength() { Header contentLength = resp.getFirstHeader("content-length"); if (contentLength == null) { return -1; } try { long l = Long.parseLong(contentLength.getValue()); <START> if (l > Integer.MAX_VALUE) { <END> return -1; } return (int) l; } catch (NumberFormatException e) { return -1; } }</code><technical_language>confused. parsing a long checking > Integer.MAX_VALUE instead of parsing integer</technical_language>

Target:
public int getContentLength() { Header contentLength = resp.getFirstHeader("content-length"); if (contentLength == null) { return -1; } try { int l = Integer.parseInt(contentLength.getValue()); return l < 0 ? -1 : l; } catch (NumberFormatException e) { return -1; } }
Source:
<code>private void storeUpdates(boolean isCompatible, HttpServletRequest req, HttpServletResponse resp) throws OseeCoreException { IDataTranslationService service = getTranslationService(); IOseeCachingService caching = getCachingService(); TransactionCache txCache = caching.getTransactionCache(); BranchCacheStoreRequest updateRequest = null; InputStream inputStream = null; try { inputStream = req.getInputStream(); updateRequest = service.convert(inputStream, CoreTranslatorId.BRANCH_CACHE_STORE_REQUEST); } catch (IOException ex) { OseeExceptions.wrapAndThrow(ex); } finally { Lib.close(inputStream); } Collection<Branch> updated = new BranchCacheUpdateUtil(factoryService.getBranchFactory(), txCache).updateCache(updateRequest, caching.getBranchCache()); BranchCache cache = caching.getBranchCache(); if (updateRequest.isServerUpdateMessage()) { for (Branch branch : updated) { if (StorageState.CREATED == branch.getStorageState()) { branch.setStorageState(StorageState.MODIFIED); } branch.clearDirty(); cache.decache(branch); <START> if (branch.getStorageState() != StorageState.PURGED) { <END> cache.cache(branch); } } } else { cache.storeItems(updated); } try { resp.setStatus(HttpServletResponse.SC_ACCEPTED); resp.setContentType("text/plain"); resp.setCharacterEncoding("UTF-8"); resp.getWriter().write("Branch Store Successful"); } catch (IOException ex) { OseeExceptions.wrapAndThrow(ex); } }</code><technical_language>fancy new isPurged() method Branch? Heck, nice methods hanging Branch BranchState code Branch need compare BranchState objects</technical_language>

Target:
private void storeUpdates(boolean isCompatible, HttpServletRequest req, HttpServletResponse resp) throws OseeCoreException { IDataTranslationService service = getTranslationService(); IOseeCachingService caching = getCachingService(); TransactionCache txCache = caching.getTransactionCache(); BranchCacheStoreRequest updateRequest = null; InputStream inputStream = null; try { inputStream = req.getInputStream(); updateRequest = service.convert(inputStream, CoreTranslatorId.BRANCH_CACHE_STORE_REQUEST); } catch (IOException ex) { OseeExceptions.wrapAndThrow(ex); } finally { Lib.close(inputStream); } Collection<Branch> updated = new BranchCacheUpdateUtil(factoryService.getBranchFactory(), txCache).updateCache(updateRequest, caching.getBranchCache()); BranchCache cache = caching.getBranchCache(); if (updateRequest.isServerUpdateMessage()) { for (Branch branch : updated) { if (branch.isCreated()) { branch.setStorageState(StorageState.MODIFIED); } branch.clearDirty(); cache.decache(branch); if (!branch.isPurged()) { cache.cache(branch); } } } else { cache.storeItems(updated); } try { resp.setStatus(HttpServletResponse.SC_ACCEPTED); resp.setContentType("text/plain"); resp.setCharacterEncoding("UTF-8"); resp.getWriter().write("Branch Store Successful"); } catch (IOException ex) { OseeExceptions.wrapAndThrow(ex); } }
Source:
<code>public boolean equals(Object o) { <START> if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; ProcessingDetailsImpl that = (ProcessingDetailsImpl) o; return Objects.equals(sourceId, that.sourceId) && Objects.equals(exception, that.exception); <END> }</code><technical_language>Do lines conform formatter? If not, need format. If so, update formatter. This difficult debugging result of condition a chance stack context lost immediately. want stack immediately change in debugger window this == o evals true, want extra frame verify flow losing stack</technical_language>

Target:
public boolean equals(Object o) { if (!super.equals(o)) { return false; } ProcessingDetailsImpl that = (ProcessingDetailsImpl) o; return Objects.equals(this.sourceId, that.sourceId) && Objects.equals(this.exception, that.exception); }
Source:
<code>public double readDouble() { try { gatherElementDataFromStreams(valueByteBuffer); long b1 = valueByteBuffer[0] & 0xFF; long b2 = valueByteBuffer[1] & 0xFF; long b3 = valueByteBuffer[2] & 0xFF; long b4 = valueByteBuffer[3] & 0xFF; long b5 = valueByteBuffer[4] & 0xFF; long b6 = valueByteBuffer[5] & 0xFF; long b7 = valueByteBuffer[6] & 0xFF; long b8 = valueByteBuffer[7] & 0xFF; long value = b1 | (b2 << 8) | (b3 << 16) | (b4 << 24) | (b5 << 32) | (b6 << 40) | (b7 << 48) | (b8 << 56); return Double.longBitsToDouble(value); } catch (IOException | ArrayIndexOutOfBoundsException ex) { <START> throw new ParquetDecodingException("Could not read double."); <END> } }</code><technical_language>hard troubleshoot error especially throws in production env, show a simple string "Could read double.". I suggest include 'ex' wrap ParquetDecodingException exception more information. is recommended print out more information of data stream is easy troubleshoot error</technical_language>

Target:
public double readDouble() { gatherElementDataFromStreams(valueByteBuffer); return Double.longBitsToDouble(BytesUtils.bytesToLong(valueByteBuffer)); }
Source:
<code>private Map<String, JSONObject> parseJsonFiles() throws IOException { Map<String, JSONObject> dotJsons = new HashMap<>( ); final String solutionPath = PentahoSystem.getApplicationContext().getSolutionPath( DEFAULT_CONTENT_FOLDER ); <START> if ( solutionPath == null || solutionPath.isEmpty() ) { <END> logger.info( getClass().getName() + " Empty solution path" ); } else { File[] jsonFiles = listFiles( new File( solutionPath ), WORK_ITEM_FILE_EXTENSION ); if ( jsonFiles != null ) { for ( File jsonFile : jsonFiles ) { JSONObject jsonObject = getJsonFromFile( jsonFile ); if ( jsonObject != null ) { dotJsons.put( jsonFile.getAbsolutePath(), jsonObject ); } } } } return dotJsons; }</code><technical_language>StringUtils.isEmpty (...) a convenience method of checks</technical_language>

Target:
private Map<String, JSONObject> parseJsonFiles( ) { Map<String, JSONObject> dotJsons = new HashMap<>(); final String solutionPath = PentahoSystem.getApplicationContext().getSolutionPath( DEFAULT_CONTENT_FOLDER ); if ( StringUtils.isEmpty( solutionPath ) ) { logger.info( getClass().getName() + " Empty solution path" ); } else { File[] jsonFiles = listFiles( new File( solutionPath ), WORK_ITEM_FILE_EXTENSION ); if ( jsonFiles != null ) { for ( File jsonFile : jsonFiles ) { JSONObject jsonObject = getJsonFromFile( jsonFile ); if ( jsonObject != null ) { dotJsons.put( jsonFile.getAbsolutePath(), jsonObject ); } } } } return dotJsons; }
Source:
<code>protected void setupContent(ViewGroup rootView) { mEmailInput = (WPLoginInputRow) rootView.findViewById(R.id.login_email_row); autoFillFromBuildConfig("DEBUG_DOTCOM_LOGIN_EMAIL", mEmailInput.getEditText()); mEmailInput.addTextChangedListener(this); mEmailInput.setOnEditorCommitListener(this); LinearLayout googleLoginButton = (LinearLayout) rootView.findViewById(R.id.login_google_button); googleLoginButton.setOnClickListener(new OnClickListener() { @SuppressWarnings("PrivateMemberAccessBetweenOuterAndInnerClass") @Override public void onClick(View view) { AnalyticsTracker.track(AnalyticsTracker.Stat.LOGIN_SOCIAL_BUTTON_CLICK); ActivityUtils.hideKeyboardForced(getActivity().getCurrentFocus()); if (NetworkUtils.checkConnection(getActivity())) { if (isAdded()) { mOldSitesIDs = SiteUtils.getCurrentSiteIds(mSiteStore, false); isSocialLogin = true; addGoogleFragment(); } else { <START> AppLog.e(T.NUX, "Google login could not be started. LoginEmailFragment was not attached."); <END> } } } }); }</code><technical_language>Is do other fail silently in this situation? odd user tap "Log in Google" happen</technical_language>

Target:
protected void setupContent(ViewGroup rootView) { mEmailInput = (WPLoginInputRow) rootView.findViewById(R.id.login_email_row); autoFillFromBuildConfig("DEBUG_DOTCOM_LOGIN_EMAIL", mEmailInput.getEditText()); mEmailInput.addTextChangedListener(this); mEmailInput.setOnEditorCommitListener(this); LinearLayout googleLoginButton = (LinearLayout) rootView.findViewById(R.id.login_google_button); googleLoginButton.setOnClickListener(new OnClickListener() { @SuppressWarnings("PrivateMemberAccessBetweenOuterAndInnerClass") @Override public void onClick(View view) { AnalyticsTracker.track(AnalyticsTracker.Stat.LOGIN_SOCIAL_BUTTON_CLICK); ActivityUtils.hideKeyboardForced(getActivity().getCurrentFocus()); if (NetworkUtils.checkConnection(getActivity())) { if (isAdded()) { mOldSitesIDs = SiteUtils.getCurrentSiteIds(mSiteStore, false); isSocialLogin = true; addGoogleFragment(); } else { AppLog.e(T.NUX, "Google login could not be started. LoginEmailFragment was not attached."); showErrorDialog(getString(R.string.login_error_generic_start)); } } } }); }
Source:
<code>List<String> upscaleCluster(HostGroup hostGroup, Collection<InstanceMetaData> metas) throws CloudbreakException; void stopCluster(boolean full) throws CloudbreakException; int startCluster(Set<InstanceMetaData> hostsInCluster) throws CloudbreakException; Map<String, String> getComponentsByCategory(String blueprintName, String hostGroupName); String getStackRepositoryJson(StackRepoDetails repoDetails, String stackRepoId); void cleanupCluster(Telemetry telemetry) throws CloudbreakException; void upgradeClusterRuntime(Set<ClusterComponent> components) throws CloudbreakException; <START> default Map<String, String> gatherInstalledParcels(String stackName) { <END> throw new UnsupportedOperationException("Interface not implemented."); }</code><technical_language>unnecessary default implementation</technical_language>

Target:
List<String> upscaleCluster(HostGroup hostGroup, Collection<InstanceMetaData> metas) throws CloudbreakException; void stopCluster(boolean full) throws CloudbreakException; int startCluster(Set<InstanceMetaData> hostsInCluster) throws CloudbreakException; Map<String, String> getComponentsByCategory(String blueprintName, String hostGroupName); String getStackRepositoryJson(StackRepoDetails repoDetails, String stackRepoId); void cleanupCluster(Telemetry telemetry) throws CloudbreakException; void upgradeClusterRuntime(Set<ClusterComponent> components) throws CloudbreakException; Map<String, String> gatherInstalledParcels(String stackName); default void removeUnusedParcels(Set<ClusterComponent> usedParcelComponents) throws CloudbreakException { throw new UnsupportedOperationException("Interface not implemented."); }
Source:
<code><START> private void addAppsTable(SQLiteDatabase db) { <END> db.execSQL("CREATE TABLE custom_apps ( _id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL DEFAULT '', component_name TEXT NOT NULL UNIQUE, custom_flags INTEGER DEFAULT 0 )"); db.execSQL("CREATE INDEX index_component ON custom_apps(component_name);"); }</code><technical_language>suggestion private void addAppsTable(SQLiteDatabase db) {</technical_language>

Target:
private void addAppsTable(SQLiteDatabase db) { db.execSQL("CREATE TABLE custom_apps ( _id INTEGER PRIMARY KEY AUTOINCREMENT, custom_flags INTEGER DEFAULT 0, component_name TEXT NOT NULL UNIQUE, name TEXT NOT NULL DEFAULT '' )"); db.execSQL("CREATE INDEX index_component ON custom_apps(component_name);"); }
Source:
<code>public String getNameTokenUnitImport() { if (nameTokenPsiClass == null) { return ""; } <START> String importString = "import " + nameTokenPsiClass.getQualifiedName() + ";"; <END> return importString; }</code><technical_language>nl return</technical_language>

Target:
public String getNameTokenUnitImport() { if (nameTokenPsiClass == null) { return ""; } return "import " + nameTokenPsiClass.getQualifiedName() + ";"; }
Source:
<code>public void writeExternal(ObjectOutput out) throws IOException { out.writeBoolean(isNull); <START> out.writeInt(sqlCharSize); <END> if (isNull()) { return; } if ( _clobValue != null ) { writeClobUTF( out ); return; } String lvalue = null; char[] data = null; int strlen = rawLength; boolean isRaw; if (strlen < 0) { lvalue = value; strlen = lvalue.length(); isRaw = false; } else { data = rawData; isRaw = true; } int utflen = strlen; for (int i = 0 ; (i < strlen) && (utflen <= 65535); i++) { int c = isRaw ? data[i] : lvalue.charAt(i); if ((c >= 0x0001) && (c <= 0x007F)) { } else if (c > 0x07FF) { utflen += 2; } else { utflen += 1; } } StreamHeaderGenerator header = getStreamHeaderGenerator(); if (SanityManager.DEBUG) { SanityManager.ASSERT(!header.expectsCharCount()); } header.generateInto(out, utflen); writeUTF(out, strlen, isRaw, null ); header.writeEOF(out, utflen); }</code><technical_language>main concern of this fix is Serde change for a basic data type. This break compatibility. For example, column stats info in system table read correctly. if other data dictionary tables affected. If is column stats table is affected, fix is a major release 3.0, is OK, assuming a re-collection of stats is acceptable for a major release upgrade</technical_language>

Target:
public void writeExternal(ObjectOutput out) throws IOException { out.writeBoolean(isNull); if (isNull()) { return; } if ( _clobValue != null ) { writeClobUTF( out ); return; } String lvalue = null; char[] data = null; int strlen = rawLength; boolean isRaw; if (strlen < 0) { lvalue = value; strlen = lvalue.length(); isRaw = false; } else { data = rawData; isRaw = true; } int utflen = strlen; for (int i = 0 ; (i < strlen) && (utflen <= 65535); i++) { int c = isRaw ? data[i] : lvalue.charAt(i); if ((c >= 0x0001) && (c <= 0x007F)) { } else if (c > 0x07FF) { utflen += 2; } else { utflen += 1; } } StreamHeaderGenerator header = getStreamHeaderGenerator(); if (SanityManager.DEBUG) { SanityManager.ASSERT(!header.expectsCharCount()); } header.generateInto(out, utflen); writeUTF(out, strlen, isRaw, null ); header.writeEOF(out, utflen); }
Source:
<code>public static void executeTest(ZephyrConfigModel zephyrData, Long testId) { final String executeTestsURL = String.format(URL_EXECUTE_TEST, zephyrData.getRestClient().getUrl(), testId); final Header[] headers = new Header[1]; headers[0] = new BasicHeader("Content-Type", "application/json"); final TestCaseResultModel testCase = zephyrData.getTestcase(); final JsonObject obj = new JsonObject(); obj.addProperty("status", testCase.getIsPassed() ? PASS : FAIL); obj.addProperty("comment", testCase.getComment()); StringEntity entity = null; try { entity = new StringEntity(obj.toString()); } catch (UnsupportedEncodingException e) { ZephyrPlugin.log(e); } <START> final CloseableHttpResponse response = zephyrData.getRestClient().put(executeTestsURL, headers, entity); <END> final int statusCode = response.getStatusLine().getStatusCode(); if (statusCode < 200 && statusCode >= 300) { ZephyrPlugin.log("Unexpected response status: " + statusCode); } if (response != null) { try { response.close(); } catch (IOException e) { ZephyrPlugin.log(e); } } }</code><technical_language>Response is closed if code throws</technical_language>

Target:
public static void executeTest(ZephyrConfigModel zephyrData, Long testId) { final String url = String.format(URL_EXECUTE_TEST, zephyrData.getRestClient().getUrl(), testId); final Header[] headers = new Header[1]; headers[0] = new BasicHeader("Content-Type", "application/json"); final TestCaseResultModel testCase = zephyrData.getTestcase(); final JsonObject obj = new JsonObject(); obj.addProperty("status", testCase.getIsPassed() ? PASS : FAIL); obj.addProperty("comment", testCase.getComment()); StringEntity entity = null; try { entity = new StringEntity(obj.toString()); } catch (UnsupportedEncodingException e) { throw new IllegalArgumentException(String.format("Bad response entity upon execute test <%s>", url), e); } try (final CloseableHttpResponse response = zephyrData.getRestClient().put(url, headers, entity)) { final int statusCode = response.getStatusLine().getStatusCode(); if (statusCode < 200 && statusCode >= 300) { throw new IllegalArgumentException( String.format("Unexpected response status <%s> upon execute test <%s>", statusCode, url)); } } catch (IOException e) { throw new IllegalArgumentException(e); } }
Source:
<code>private void updateRemoteVideoSurfaceDimensions() { <START> if (mVideoCallScreen == null) { LogUtil.i("VideoCallPresenter.updateRemoteVideoSurfaceDimensions", "mVideoCallScreen is null"); return; } <END> Activity activity = mVideoCallScreen.getVideoCallScreenFragment().getActivity(); if (activity != null) { Point screenSize = new Point(); activity.getWindowManager().getDefaultDisplay().getSize(screenSize); getRemoteVideoSurfaceTexture().setSurfaceDimensions(screenSize); } }</code><technical_language>this update is mVideoCallScreen is null? fix crash</technical_language>

Target:
private void updateRemoteVideoSurfaceDimensions() { if (mVideoCallScreen == null) { LogUtil.e("VideoCallPresenter.updateRemoteVideoSurfaceDimensions", "mVideoCallScreen is null"); return; } Activity activity = mVideoCallScreen.getVideoCallScreenFragment().getActivity(); if (activity != null) { Point screenSize = new Point(); activity.getWindowManager().getDefaultDisplay().getSize(screenSize); getRemoteVideoSurfaceTexture().setSurfaceDimensions(screenSize); } }
Source:
<code>protected void bindToEntry(BibEntry entry) { <START> setupSearchPane(); <END> EasyBind.subscribe(viewModel.statusProperty(), status -> { switch (status) { case IN_PROGRESS: searchPane.getChildren().setAll(progressIndicator); break; case CITATIONS_FOUND: graphicCitationList.setAll(EasyBind.map(viewModel.getCitationList(), this::citationToGraphic)); searchPane.getChildren().setAll(getCitationsPane()); break; case NO_RESULTS: searchPane.getChildren().setAll(getNotFoundPane()); break; case ERROR: searchPane.getChildren().setAll(getErrorPane()); break; case INACTIVE: default: searchPane.getChildren().clear(); break; } }); viewModel.init(entry); }</code><technical_language>this need called time entry is changed? (I a reason css class max size of progress indicator changed)</technical_language>

Target:
protected void bindToEntry(BibEntry entry) { viewModel.init(entry); }
Source:
<code>public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final AuthorityPrincipal other = (AuthorityPrincipal) obj; <START> if (m_name == null) { <END> if (other.m_name != null) { return false; } } else if (!m_name.equals(other.m_name)) { return false; } return true; }</code><technical_language>Please Objects.equals(...) (<LINK_0>,%20java.lang.Object%29) instead of manually check for equality</technical_language>

Target:
public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (obj instanceof AuthorityPrincipal) { final AuthorityPrincipal other = (AuthorityPrincipal) obj; return Objects.equals(m_name, other.m_name); } return false; }
Source:
<code>void calculateIdle () { if (idleRunning) return; Runnable runnable = new Runnable() { @Override public void run() { if (styledText == null) return; int i; long start = System.currentTimeMillis(); for (i = 0; i < lineCount; i++) { LineSizeInfo line = getLineSize(i); <START> if (line.height == -1 || line.width == -1) { <END> calculate(i, 1); if (System.currentTimeMillis() - start > IDLE_TIME) break; } } if (i < lineCount) { Display display = styledText.getDisplay(); display.asyncExec(this); } else { idleRunning = false; styledText.setScrollBars(true); ScrollBar bar = styledText.getVerticalBar(); if (bar != null) { bar.setSelection(styledText.getVerticalScrollOffset()); } } } }; Display display = styledText.getDisplay(); display.asyncExec(runnable); idleRunning = true; }</code><technical_language>wrap this condition line.needsRecaculateSize());</technical_language>

Target:
void calculateIdle () { if (idleRunning) return; Runnable runnable = new Runnable() { @Override public void run() { if (styledText == null) return; int i; long start = System.currentTimeMillis(); for (i = 0; i < lineCount; i++) { LineSizeInfo line = getLineSize(i); if (line.needsRecaculateSize()) { calculate(i, 1); if (System.currentTimeMillis() - start > IDLE_TIME) break; } } if (i < lineCount) { Display display = styledText.getDisplay(); display.asyncExec(this); } else { idleRunning = false; styledText.setScrollBars(true); ScrollBar bar = styledText.getVerticalBar(); if (bar != null) { bar.setSelection(styledText.getVerticalScrollOffset()); } } } }; Display display = styledText.getDisplay(); display.asyncExec(runnable); idleRunning = true; }
Source:
<code>private int hostScore(VM vm, VDS host) { if (vm.getVmType() != VmType.HighPerformance) { return 1; } int vmSockets = vm.getNumOfSockets(); int vmCores = vmSockets * vm.getCpuPerSocket(); int vmThreads = vmCores * vm.getThreadsPerCpu(); <START> if (vmSockets <= host.getCpuSockets() && vmCores <= host.getCpuCores() && vmThreads <= host.getCpuThreads()) { <END> return 1; } return getMaxSchedulerWeight(); }</code><technical_language>This calculation avoids choosing right host in example: host 1: sockets 3 cores socket 2 threads core 1 host 2: sockets: 6 cores socket: 1 threads core: 1 For a vm configured with: sockets 3 cores socket 2 threads core 1 Considering other host parameters equal, hosts get weight ("host 1") chosen instead of ("host 2"). I calculation "cores socket" comparision instead of "total number of cores" for threads</technical_language>

Target:
private int hostScore(VM vm, VDS host) { if (!policyUnitEnabled(vm)) { return 1; } int hostCoresPerSocket = host.getCpuCores() / host.getCpuSockets(); int hostThreadsPerCore = host.getCpuThreads() / host.getCpuCores(); if (vm.getNumOfSockets() <= host.getCpuSockets() && vm.getCpuPerSocket() <= hostCoresPerSocket && vm.getThreadsPerCpu() <= hostThreadsPerCore) { return 1; } return getMaxSchedulerWeight(); }
Source:
<code>public ResourceResponse retrieveResource(URI resourceUri, Map<String, Serializable> arguments) throws IOException, ResourceNotFoundException, ResourceNotSupportedException { LOGGER.trace("ENTERING: retrieveResource"); ResourceResponse response = null; if (resourceUri == null) { throw new ResourceNotFoundException("Unable to find resource - resource URI was null"); } if (resourceUri.getScheme().equals(ContentItem.CONTENT_SCHEME)) { LOGGER.debug("Resource URI is content scheme"); String contentId = resourceUri.getSchemeSpecificPart(); if (contentId != null && !contentId.isEmpty()) { resourceUri = getUriWithQualifier(resourceUri, arguments); ReadStorageRequest readRequest = new ReadStorageRequestImpl(resourceUri, arguments); try { ReadStorageResponse readResponse = storage.read(readRequest); ContentItem contentItem = readResponse.getContentItem(); String fileName = contentItem.getFilename(); LOGGER.debug("resource name: {}", fileName); InputStream is = contentItem.getInputStream(); response = new ResourceResponseImpl( new ResourceImpl( new BufferedInputStream(is), contentItem.getMimeType(), fileName)); <START> } catch (StorageException | NullPointerException e) { <END> throw new ResourceNotFoundException(e); } } else { throw new IOException(String.format("Invalid URI %s received", resourceUri)); } } LOGGER.trace("EXITING: retrieveResource"); return response; }</code><technical_language>catching a NPE</technical_language>

Target:
public ResourceResponse retrieveResource(URI resourceUri, Map<String, Serializable> arguments) throws IOException, ResourceNotFoundException, ResourceNotSupportedException { LOGGER.trace("ENTERING: retrieveResource"); ResourceResponse response = null; if (resourceUri == null) { throw new ResourceNotFoundException("Unable to find resource - resource URI was null"); } if (resourceUri.getScheme().equals(ContentItem.CONTENT_SCHEME)) { LOGGER.debug("Resource URI is content scheme"); String contentId = resourceUri.getSchemeSpecificPart(); if (contentId != null && !contentId.isEmpty()) { ReadStorageRequest readRequest = new ReadStorageRequestImpl(resourceUri, arguments); try { ReadStorageResponse readResponse = storage.read(readRequest); ContentItem contentItem = readResponse.getContentItem(); String fileName = contentItem.getFilename(); LOGGER.debug("resource name: {}", fileName); InputStream is = contentItem.getInputStream(); response = new ResourceResponseImpl( new ResourceImpl( new BufferedInputStream(is), contentItem.getMimeType(), fileName)); } catch (StorageException e) { throw new ResourceNotFoundException(e); } } else { throw new ResourceNotSupportedException( String.format("Invalid URI %s received", resourceUri)); } } LOGGER.trace("EXITING: retrieveResource"); return response; }
Source:
<code>private PhoneAccountHandle getAccountHandleFromNumber(String dialNumber) { Cursor cursor = mContentResolver.query(Calls.CONTENT_URI, PHONE_ACCOUNT_STRING, Calls.TYPE + "=" + Calls.OUTGOING_TYPE + " AND " + Calls.NUMBER + "=\"" + PhoneNumberUtils.normalizeNumber(dialNumber) + "\"", null, Calls.DEFAULT_SORT_ORDER + " LIMIT 1"); if (cursor == null) { return null; } <START> if (cursor.getCount() < 1) { cursor.close(); retrun null; } cursor.moveToNext(); <END> String componentName = cursor.getString( cursor.getColumnIndex(Calls.PHONE_ACCOUNT_COMPONENT_NAME)); String accountId = cursor.getString(cursor.getColumnIndex(Calls.PHONE_ACCOUNT_ID)); cursor.close(); if (TextUtils.isEmpty(componentName) || TextUtils.isEmpty(accountId)) { return null; } return new PhoneAccountHandle( ComponentName.unflattenFromString(componentName), accountId); }</code><technical_language>more suggestion, lines replaced if (!cursor.moveToNext()) { cursor.close(); return null; } Rationale: cursor.moveToNext() return false passing entry of result, checking return of cursor.moveToNext(), longer needs check cursor.getCount(). Also, confirm, is reason of calling cursor.moveToNext() is default row index is -1 call cursor.moveToNext() point 0th row of data</technical_language>

Target:
private PhoneAccountHandle getAccountHandleFromNumber(String dialNumber) { Cursor cursor = mContentResolver.query(Calls.CONTENT_URI, PHONE_ACCOUNT_STRING, Calls.TYPE + "=" + Calls.OUTGOING_TYPE + " AND " + Calls.NUMBER + "=\"" + PhoneNumberUtils.normalizeNumber(dialNumber) + "\"", null, Calls.DEFAULT_SORT_ORDER + " LIMIT 1"); if (cursor == null) { return null; } if (!cursor.moveToNext()) { cursor.close(); retrun null; } String componentName = cursor.getString( cursor.getColumnIndex(Calls.PHONE_ACCOUNT_COMPONENT_NAME)); String accountId = cursor.getString(cursor.getColumnIndex(Calls.PHONE_ACCOUNT_ID)); cursor.close(); if (TextUtils.isEmpty(componentName) || TextUtils.isEmpty(accountId)) { return null; } return new PhoneAccountHandle( ComponentName.unflattenFromString(componentName), accountId); }