auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void initUi() { <START> this.setTitle(R.string.dish_title); <END> LayoutInflater inflater = LayoutInflater.from(this.getApplicationContext()); RelativeLayout mainPage = (RelativeLayout) inflater.inflate(R.layout.main_list_activity, null); LinearLayout galleryFrame = (LinearLayout) mainPage.findViewById(R.id.gallery_frame); mCategoryGallery = new GridView[mCategoryNum]; for (int i = 0; i < mCategoryNum; i++) { LinearLayout categoryLayout = (LinearLayout) inflater.inflate(R.layout.main_list_item, null); TextView cagegoryNameTextView = (TextView) categoryLayout .findViewById(R.id.id_category_name); cagegoryNameTextView.setText("�Ȳ�"); mCategoryGallery[i] = (GridView) categoryLayout.findViewById(R.id.id_dish_grid); mCategoryGallery[i].setId(i); mCategoryGallery[i].setAdapter(new GridViewAdapter(this)); mCategoryGallery[i].setOnItemClickListener(this); int dishNumber = 9; int rowNum = (dishNumber % DISHNUM_IN_ONEROW == 0) ? dishNumber / DISHNUM_IN_ONEROW : dishNumber / DISHNUM_IN_ONEROW + 1; mCategoryGallery[i].getLayoutParams().height = rowNum * HEIGHT_ONEROW; galleryFrame.addView(categoryLayout); } Button buttonForOrderedList = (Button) mainPage.findViewById(R.id.id_orderedlist_button); buttonForOrderedList.setOnClickListener(this); setContentView(mainPage); }</code><technical_language>remove "this."</technical_language>

Target:
private void initUi() { setTitle(R.string.dish_title); setContentView(R.layout.main_list_activity); LinearLayout galleryFrame = (LinearLayout) findViewById(R.id.gallery_frame); Button orderListButton = (Button) findViewById(R.id.orderedlist_button); orderListButton.setOnClickListener(this); LayoutInflater inflater = LayoutInflater.from(getApplicationContext()); for (int i = 0; i < mCategoryNum; i++) { LinearLayout categoryLayout = (LinearLayout) inflater.inflate( R.layout.main_list_item, null); TextView cagegoryNameTextView = (TextView) categoryLayout.findViewById( R.id.category_name); cagegoryNameTextView.setText(CATEGORY_NAME); GridView categoryView = (GridView) categoryLayout.findViewById(R.id.dish_grid); categoryView.setId(i); categoryView.setAdapter(new GridViewAdapter(this)); categoryView.setOnItemClickListener(this); int dishNumber = 9; int rowNum = (dishNumber % DISHNUM_IN_ONEROW == 0) ? (dishNumber / DISHNUM_IN_ONEROW) : (dishNumber / DISHNUM_IN_ONEROW + 1); categoryView.getLayoutParams().height = rowNum * HEIGHT_ONEROW; galleryFrame.addView(categoryLayout); } }
Source:
<code>void hideItemElementIfParentIsCollapsed(final HTMLElement itemElement, final Element parent) { <START> final boolean isCollapsed = isCollapsed(parent.querySelector("[data-field=\"arrow-button\"]")); <END> final boolean isCollapsedParent = isHidden(parent); if (isCollapsed || isCollapsedParent) { hide(itemElement); } else { show(itemElement); } }</code><technical_language>Please extract "[data-field=\"arrow-button\"]" constant reuse in class</technical_language>

Target:
void hideItemElementIfParentIsCollapsed(final HTMLElement itemElement, final Element parent) { final boolean isCollapsedParent = isCollapsed(parent.querySelector(ARROW_BUTTON_SELECTOR)); final boolean isHiddenParent = isHidden(parent); if (isCollapsedParent || isHiddenParent) { hide(itemElement); } else { show(itemElement); } }
Source:
<code>public ServiceTest(TOptions options) { super(options); <START> String connectionString = System.getenv("STORAGE_CONNECTION_STRING"); <END> if (CoreUtils.isNullOrEmpty(connectionString)) { System.out.println("Environment variable STORAGE_CONNECTION_STRING must be set"); System.exit(1); } shareServiceClient = new ShareServiceClientBuilder().connectionString(connectionString). buildClient(); shareServiceAsyncClient = new ShareServiceClientBuilder().connectionString(connectionString). buildAsyncClient(); }</code><technical_language>Configuration pass STORAGE_CONNECTION_STRING system properties environment variables</technical_language>

Target:
public ServiceTest(TOptions options) { super(options); configuration = Configuration.getGlobalConfiguration().clone(); String connectionString = configuration.get("STORAGE_CONNECTION_STRING"); if (CoreUtils.isNullOrEmpty(connectionString)) { throw new IllegalStateException("Environment variable STORAGE_CONNECTION_STRING must be set"); } shareServiceClient = new ShareServiceClientBuilder().connectionString(connectionString). buildClient(); shareServiceAsyncClient = new ShareServiceClientBuilder().connectionString(connectionString). buildAsyncClient(); }
Source:
<code>private void sortHelper(Task root, Comparator<Task> comparator) { Task[] tasks = getNestedTasks(root); <START> for (int i = 0; i < tasks.length; i++) { <END> for (int j = 1; j < tasks.length - i; j++) { if (comparator.compare(tasks[j - 1], tasks[j]) > 0) { swap(tasks[j - 1], tasks[j]); Task tmp = tasks[j - 1]; tasks[j - 1] = tasks[j]; tasks[j] = tmp; } } } for (Task t : tasks) { sortHelper(t, comparator); } }</code><technical_language>If I I remove nodes parent, sort Collections.sort add parent in sorted order. This code more simple fragile</technical_language>

Target:
private void sortHelper(Task root, Comparator<Task> comparator) { Task[] tasks = getNestedTasks(root); Arrays.sort(tasks, comparator); for (Task t : tasks) { myTree.getModel().removeNodeFromParent(myTask2treeNode.get(t)); } for (int i = 0; i < tasks.length; i++) { myTree.getModel().insertNodeInto(myTask2treeNode.get(tasks[i]), myTask2treeNode.get(root), i); sortHelper(tasks[i], comparator); } }
Source:
<code><START> public void designDocCompare() throws MalformedURLException { <END> DesignDocument designDoc1 = DesignDocumentManager.fromFile(designDocExample); designManager.put(designDoc1); DesignDocument designDoc11 = db.getDesignDocumentManager().get("_design/example"); assertEquals(designDoc1, designDoc11); }</code><technical_language>Exception</technical_language>

Target:
public void designDocCompare() throws Exception { DesignDocument designDoc1 = DesignDocumentManager.fromFile(designDocExample); designManager.put(designDoc1); DesignDocument designDoc11 = db.getDesignDocumentManager().get("_design/example"); assertEquals(designDoc1, designDoc11); }
Source:
<code>public DataStorageConfiguration setWalSegmentSize(int walSegmentSize) { <START> if(walSegmentSize != 0){ <END> A.ensure(walSegmentSize >= 512 * 1024, "WAL segment size must be between 512Kb and 2Gb."); } this.walSegmentSize = walSegmentSize; return this; }</code><technical_language>Basic Java code style enforces spaces if clause condition</technical_language>

Target:
public DataStorageConfiguration setWalSegmentSize(int walSegmentSize) { if (walSegmentSize != 0) A.ensure(walSegmentSize >= 512 * 1024, "WAL segment size must be between 512Kb and 2Gb."); this.walSegmentSize = walSegmentSize; return this; }
Source:
<code>public Iterable<Container> listNodesByIds(final Iterable<String> ids) { <START> return filter(listNodes(), new Predicate<Container>() { <END> @Override public boolean apply(Container server) { return contains(ids, server.getId()); } }); }</code><technical_language>This generate a call inspect _every_ container, asking for a subset. Remove this call inspectContainer provided ids</technical_language>

Target:
public Iterable<Container> listNodesByIds(final Iterable<String> ids) { Set<Container> containers = Sets.newHashSet(); for (String id : ids) { containers.add(api.getRemoteApi().inspectContainer(id)); } return containers; }
Source:
<code>public void shouldFailWithAdditionalInfosWhenMimeTypeIsNotSupportedByConverter() throws IOException { String converterName = cs.getConverterName("image/jpeg", "application/pdf"); DocumentBlobHolder documentBlobHolder = getDocumentBlob("test-docs/" + "hello.xls", "application/vnd.ms-excel"); try { cs.convert(converterName, documentBlobHolder, Collections.emptyMap()); } catch (ConversionException e) { <START> assertTrue(e.getInfos().size() == 1); <END> assertTrue(e.getInfos().get(0).contains(documentBlobHolder.getDocument().getId())); } }</code><technical_language>assertEquals</technical_language>

Target:
public void shouldFailWithAdditionalInfosWhenMimeTypeIsNotSupportedByConverter() throws IOException { String converterName = cs.getConverterName("image/jpeg", "application/pdf"); DocumentBlobHolder documentBlobHolder = getDocumentBlob("test-docs/hello.xls", "application/vnd.ms-excel"); try { cs.convert(converterName, documentBlobHolder, Collections.emptyMap()); fail("Should have raised a ConversionException"); } catch (ConversionException e) { assertEquals(1, e.getInfos().size()); assertTrue(e.getInfos().get(0).contains(documentBlobHolder.getDocument().getId())); } }
Source:
<code>public WorkspaceShare( SeleniumWebDriver seleniumWebDriver, SeleniumWebDriverHelper seleniumWebDriverHelper) { <START> this.seleniumWebDriver = seleniumWebDriver; <END> this.seleniumWebDriverHelper = seleniumWebDriverHelper; PageFactory.initElements(seleniumWebDriver, this); }</code><technical_language>this.seleniumWebDriver bacame redundant</technical_language>

Target:
public WorkspaceShare( SeleniumWebDriver seleniumWebDriver, SeleniumWebDriverHelper seleniumWebDriverHelper) { this.seleniumWebDriverHelper = seleniumWebDriverHelper; PageFactory.initElements(seleniumWebDriver, this); }
Source:
<code>public String toString() { String s = "schemaType = " + schemaType + ", pixelType = " + pixelType + ", filePosition = " + filePosition + ", filePart = " + filePart + ", compression = " + compression + ", pyramidType = " + pyramidType + ", dimensionCount = " + dimensionCount; if (dimensionCount > 0) { <START> s += ", dimensions = ["; <END> StringBuilder sb = new StringBuilder(s); for (int i=0; i<dimensionCount; i++) { sb.append(dimensionEntries[i]); if (i < dimensionCount - 1) { sb.append("; "); } } sb.append(']'); s = sb.toString(); } return s; }</code><technical_language>move a line append</technical_language>

Target:
public String toString() { String s = "schemaType = " + schemaType + ", pixelType = " + pixelType + ", filePosition = " + filePosition + ", filePart = " + filePart + ", compression = " + compression + ", pyramidType = " + pyramidType + ", dimensionCount = " + dimensionCount; if (dimensionCount > 0) { StringBuilder sb = new StringBuilder(s); sb.append(", dimensions = ["); for (int i=0; i<dimensionCount; i++) { sb.append(dimensionEntries[i]); if (i < dimensionCount - 1) { sb.append("; "); } } sb.append(']'); s = sb.toString(); } return s; }
Source:
<code>private Observable<Map<String, CoinmateWebsocketBalance>> getCoinmateBalances() { String channelName = "channel/my-balances"; ObjectReader reader = StreamingObjectMapperHelper.getObjectMapper().readerFor(new TypeReference<Map<String, CoinmateWebsocketBalance>>() {}); CoinmateStreamingService service = serviceFactory.createAndConnect(channelName, true); return service.subscribeMessages() .map( (message) -> { <START> Map<String, CoinmateWebsocketBalance> balanceMap = reader.readValue(message.get("balances")); <END> return balanceMap; }); }</code><technical_language>nit: collapse this expression lambda</technical_language>

Target:
private Observable<Map<String, CoinmateWebsocketBalance>> getCoinmateBalances() { String channelName = "channel/my-balances"; ObjectReader reader = StreamingObjectMapperHelper.getObjectMapper().readerFor(new TypeReference<Map<String, CoinmateWebsocketBalance>>() {}); return serviceFactory.createConnection(channelName, true) .map((message) -> reader.readValue(message.get("balances"))); }
Source:
<code>public void shouldUseBothAnalyzer() { elasticsearchTemplate.createIndex(Book.class); elasticsearchTemplate.putMapping(Book.class); Map mapping = elasticsearchTemplate.getMapping(Book.class); <START> System.out.println(mapping); <END> Map descriptionMapping = (Map) ((Map) mapping.get("properties")).get("description"); Map prefixDescription = (Map) ((Map) descriptionMapping.get("fields")).get("prefix"); assertThat(prefixDescription).hasSize(3); assertThat(prefixDescription.get("type")).isEqualTo("text"); assertThat(prefixDescription.get("analyzer")).isEqualTo("stop"); assertThat(prefixDescription.get("search_analyzer")).isEqualTo("standard"); assertThat(descriptionMapping.get("type")).isEqualTo("text"); assertThat(descriptionMapping.get("analyzer")).isEqualTo("whitespace"); }</code><technical_language>left some test</technical_language>

Target:
public void shouldUseBothAnalyzer() { elasticsearchTemplate.createIndex(Book.class); elasticsearchTemplate.putMapping(Book.class); Map mapping = elasticsearchTemplate.getMapping(Book.class); Map descriptionMapping = (Map) ((Map) mapping.get("properties")).get("description"); Map prefixDescription = (Map) ((Map) descriptionMapping.get("fields")).get("prefix"); assertThat(prefixDescription).hasSize(3); assertThat(prefixDescription.get("type")).isEqualTo("text"); assertThat(prefixDescription.get("analyzer")).isEqualTo("stop"); assertThat(prefixDescription.get("search_analyzer")).isEqualTo("standard"); assertThat(descriptionMapping.get("type")).isEqualTo("text"); assertThat(descriptionMapping.get("analyzer")).isEqualTo("whitespace"); }
Source:
<code>protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); removeEditPolicy(EditPolicy.CONNECTION_ENDPOINTS_ROLE); installEditPolicy(EditPolicy.CONNECTION_ENDPOINTS_ROLE, new SiriusConnectionEndPointEditPolicy()); removeEditPolicy(EditPolicyRoles.PROPERTY_HANDLER_ROLE); installEditPolicy(EditPolicyRoles.PROPERTY_HANDLER_ROLE, new SiriusPropertyHandlerEditPolicy()); installEditPolicy(EditPolicy.CONNECTION_ROLE, new SiriusConnectionEditPolicy()); installEditPolicy(RequestConstants.REQ_LAUNCH_TOOL, new LaunchToolEditPolicy()); final EditPolicy currentSelectionEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); final EditPolicy selectionFeedBackEditPolicy = new DEdgeSelectionFeedbackEditPolicy(); if (currentSelectionEditPolicy != null) { final CompoundEditPolicy selectionCompoundEditPolicy = new CompoundEditPolicy(); selectionCompoundEditPolicy.addEditPolicy(currentSelectionEditPolicy); selectionCompoundEditPolicy.addEditPolicy(selectionFeedBackEditPolicy); removeEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, selectionCompoundEditPolicy); } else { installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, selectionFeedBackEditPolicy); } <START> installEditPolicy(EditPolicyRoles.SNAP_FEEDBACK_ROLE, new SiriusSnapFeedbackPolicy()); installEditPolicy(EditPolicyRoles.SNAP_FEEDBACK_ROLE, new SiriusEdgeLabelSnapBackEditPolicy()); <END> }</code><technical_language>2 policies role, is a problem</technical_language>

Target:
protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); removeEditPolicy(EditPolicy.CONNECTION_ENDPOINTS_ROLE); installEditPolicy(EditPolicy.CONNECTION_ENDPOINTS_ROLE, new SiriusConnectionEndPointEditPolicy()); removeEditPolicy(EditPolicyRoles.PROPERTY_HANDLER_ROLE); installEditPolicy(EditPolicyRoles.PROPERTY_HANDLER_ROLE, new SiriusPropertyHandlerEditPolicy()); installEditPolicy(EditPolicy.CONNECTION_ROLE, new SiriusConnectionEditPolicy()); installEditPolicy(RequestConstants.REQ_LAUNCH_TOOL, new LaunchToolEditPolicy()); final EditPolicy currentSelectionEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); final EditPolicy selectionFeedBackEditPolicy = new DEdgeSelectionFeedbackEditPolicy(); if (currentSelectionEditPolicy != null) { final CompoundEditPolicy selectionCompoundEditPolicy = new CompoundEditPolicy(); selectionCompoundEditPolicy.addEditPolicy(currentSelectionEditPolicy); selectionCompoundEditPolicy.addEditPolicy(selectionFeedBackEditPolicy); removeEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, selectionCompoundEditPolicy); } else { installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, selectionFeedBackEditPolicy); } installEditPolicy(EditPolicyRoles.SNAP_FEEDBACK_ROLE, new SiriusEdgeLabelSnapBackEditPolicy()); }
Source:
<code>private void removeStatelessVmUnmanagedDevices() { VM vm = getVm(); <START> if (vm != null && vm.isStateless() || isRunOnce()) { <END> final List<VmDevice> vmDevices = DbFacade.getInstance() .getVmDeviceDao() .getUnmanagedDevicesByVmId(getVmId()); for (VmDevice device : vmDevices) { if (!VmDeviceCommonUtils.isInWhiteList(device.getType(), device.getDevice())) { DbFacade.getInstance().getVmDeviceDao().remove(device.getId()); } } } }</code><technical_language>please add brackets 'and'</technical_language>

Target:
private void removeStatelessVmUnmanagedDevices() { if (getVm().isStateless() || isRunOnce()) { final List<VmDevice> vmDevices = DbFacade.getInstance() .getVmDeviceDao() .getUnmanagedDevicesByVmId(getVmId()); for (VmDevice device : vmDevices) { if (!VmDeviceCommonUtils.isInWhiteList(device.getType(), device.getDevice())) { DbFacade.getInstance().getVmDeviceDao().remove(device.getId()); } } } }
Source:
<code>public RtGithub( @NotNull(message = "user name can't be NULL") final String user, @NotNull(message = "password can't be NULL") final String pwd) { <START> this(URI.create(DEFAULT_GITHUB_HOST), user, pwd); <END> }</code><technical_language>@perfa RtGithub.DEFAULT_GITHUB_HOST</technical_language>

Target:
public RtGithub( @NotNull(message = "user name can't be NULL") final String user, @NotNull(message = "password can't be NULL") final String pwd) { this(URI.create(RtGithub.DEFAULT_HOST), user, pwd); }
Source:
<code>private void putObject(WebContext ctx, Bucket bucket, String id, InputStreamHandler inputStream) throws IOException { StoredObject object = bucket.getObject(id); if (inputStream == null) { signalObjectError(ctx, bucket.getName(), id, S3ErrorCode.IncompleteBody, "No content posted"); return; } try (FileOutputStream out = new FileOutputStream(object.getFile())) { ByteStreams.copy(inputStream, out); } Map<String, String> properties = parseUploadProperties(ctx); <START> HashCode hash = Files.asByteSource(object.getFile()).hash(Hashing.md5()); <END> String md5 = BaseEncoding.base64().encode(hash.asBytes()); String contentMd5 = properties.get("Content-MD5"); if (properties.containsKey("Content-MD5") && !md5.equals(contentMd5)) { object.delete(); signalObjectError(ctx, bucket.getName(), id, S3ErrorCode.BadDigest, Strings.apply("Invalid MD5 checksum (Input: %s, Expected: %s)", contentMd5, md5)); return; } String etag = BaseEncoding.base16().encode(hash.asBytes()).toLowerCase(); properties.put(HTTP_HEADER_NAME_ETAG, etag); object.storeProperties(properties); Response response = ctx.respondWith(); response.addHeader(HTTP_HEADER_NAME_ETAG, etag(etag)).status(HttpResponseStatus.OK); response.addHeader(HttpHeaderNames.ACCESS_CONTROL_EXPOSE_HEADERS, HTTP_HEADER_NAME_ETAG); signalObjectSuccess(ctx); }</code><technical_language>s.a</technical_language>

Target:
private void putObject(WebContext ctx, Bucket bucket, String id, InputStreamHandler inputStream) throws IOException { StoredObject object = bucket.getObject(id); if (inputStream == null) { signalObjectError(ctx, bucket.getName(), id, S3ErrorCode.IncompleteBody, "No content posted"); return; } try (FileOutputStream out = new FileOutputStream(object.getFile())) { ByteStreams.copy(inputStream, out); } Map<String, String> properties = parseUploadProperties(ctx); byte[] hash = Hasher.md5().hashFile(object.getFile()).toHash(); String md5 = BaseEncoding.base64().encode(hash); String contentMd5 = properties.get("Content-MD5"); if (properties.containsKey("Content-MD5") && !md5.equals(contentMd5)) { object.delete(); signalObjectError(ctx, bucket.getName(), id, S3ErrorCode.BadDigest, Strings.apply("Invalid MD5 checksum (Input: %s, Expected: %s)", contentMd5, md5)); return; } String etag = BaseEncoding.base16().encode(hash).toLowerCase(); properties.put(HTTP_HEADER_NAME_ETAG, etag); object.storeProperties(properties); Response response = ctx.respondWith(); response.addHeader(HTTP_HEADER_NAME_ETAG, etag(etag)).status(HttpResponseStatus.OK); response.addHeader(HttpHeaderNames.ACCESS_CONTROL_EXPOSE_HEADERS, HTTP_HEADER_NAME_ETAG); signalObjectSuccess(ctx); }
Source:
<code>protected int logTransportErrorAndThrowExceptionIfNeeded(int i, HotRodClientException e) { String message = "Exception encountered. Retry %d out of %d"; if (i >= transportFactory.getMaxRetries() || transportFactory.getMaxRetries() < 0) { if (transportFactory.trySwitchCluster(cacheName)){ <START> log.debug("Switched to a different cluster"); <END> triedCompleteRestart = true; return -1; } else if (!triedCompleteRestart) { log.debug("Cluster might have completely shut down, try resetting transport layer and topology id", e); transportFactory.reset(cacheName); triedCompleteRestart = true; return -1; } else { log.exceptionAndNoRetriesLeft(i,transportFactory.getMaxRetries(), e); throw e; } } else { log.tracef(e, message, i, transportFactory.getMaxRetries()); return i; } }</code><technical_language>switching a cluster is a big thing, I suggest turning this info promoting Log.java complete name of cluster</technical_language>

Target:
protected int logTransportErrorAndThrowExceptionIfNeeded(int i, HotRodClientException e) { String message = "Exception encountered. Retry %d out of %d"; if (i >= transportFactory.getMaxRetries() || transportFactory.getMaxRetries() < 0) { if (transportFactory.trySwitchCluster(cacheName)){ triedCompleteRestart = true; return -1; } else if (!triedCompleteRestart) { log.debug("Cluster might have completely shut down, try resetting transport layer and topology id", e); transportFactory.reset(cacheName); triedCompleteRestart = true; return -1; } else { log.exceptionAndNoRetriesLeft(i,transportFactory.getMaxRetries(), e); throw e; } } else { log.tracef(e, message, i, transportFactory.getMaxRetries()); return i; } }
Source:
<code>public void errorOnNullBoardSize() { try { <START> grains.computeNumberOfGrainsOnSquare(0); <END> fail("Grains#compute should have thrown"); } catch (IllegalArgumentException e) { assertEquals(e.getMessage(), "square must be between 1 and 64"); } }</code><technical_language>Please [ExpectedException](<LINK_0> [phone-number tests](<LINK_1> for example of</technical_language>

Target:
public void errorOnNullBoardSize() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage(wrongSquareMessage); grains.computeNumberOfGrainsOnSquare(0); }
Source:
<code><START> public static String indexPath(final Path path) { <END> return indexFile(path.toAbsolutePath().toString()); }</code><technical_language>making this return path instead of a String. API, I of a string back</technical_language>

Target:
public static Path indexPath(final Path path) { return path.getFileSystem().getPath(indexFile(path.toAbsolutePath().toString())); }
Source:
<code>protected boolean doRollback() throws Exception { try { int size = 0; for (Set<ActionChange> cs : changeSets.values()) { size += cs.size(); } <START> List<Delete> rollbackDeletes = new ArrayList<Delete>(size); <END> for (Map.Entry<Long, Set<ActionChange>> entry : changeSets.entrySet()) { long transactionTimestamp = entry.getKey(); for (ActionChange change : entry.getValue()) { byte[] row = change.getRow(); byte[] family = change.getFamily(); byte[] qualifier = change.getQualifier(); Delete rollbackDelete = new Delete(row); rollbackDelete.setAttribute(TxConstants.TX_ROLLBACK_ATTRIBUTE_KEY, new byte[0]); switch (conflictLevel) { case ROW: case NONE: rollbackDelete.deleteFamilyVersion(change.getFamily(), transactionTimestamp); break; case COLUMN: if (family != null && qualifier == null) { rollbackDelete.deleteFamilyVersion(family, transactionTimestamp); } else if (family != null && qualifier != null) { rollbackDelete.deleteColumn(family, qualifier, transactionTimestamp); } break; default: throw new IllegalStateException("Unknown conflict detection level: " + conflictLevel); } rollbackDeletes.add(rollbackDelete); } } hTable.delete(rollbackDeletes); return true; } finally { try { hTable.flushCommits(); } catch (Exception e) { LOG.error("Could not flush HTable commits", e); } tx = null; changeSets.clear(); } }</code><technical_language>new ArrayList<>(size);. warning in IntelliJ (yellow). Please pay attention warnings</technical_language>

Target:
protected boolean doRollback() throws Exception { try { int size = 0; for (Set<ActionChange> cs : changeSets.values()) { size += cs.size(); } List<Delete> rollbackDeletes = new ArrayList<>(size); for (Map.Entry<Long, Set<ActionChange>> entry : changeSets.entrySet()) { long transactionTimestamp = entry.getKey(); for (ActionChange change : entry.getValue()) { byte[] row = change.getRow(); byte[] family = change.getFamily(); byte[] qualifier = change.getQualifier(); Delete rollbackDelete = new Delete(row); rollbackDelete.setAttribute(TxConstants.TX_ROLLBACK_ATTRIBUTE_KEY, new byte[0]); switch (conflictLevel) { case ROW: case NONE: rollbackDelete.deleteFamilyVersion(change.getFamily(), transactionTimestamp); break; case COLUMN: if (family != null && qualifier == null) { rollbackDelete.deleteFamilyVersion(family, transactionTimestamp); } else if (family != null && qualifier != null) { rollbackDelete.deleteColumn(family, qualifier, transactionTimestamp); } break; default: throw new IllegalStateException("Unknown conflict detection level: " + conflictLevel); } rollbackDeletes.add(rollbackDelete); } } hTable.delete(rollbackDeletes); return true; } finally { try { hTable.flushCommits(); } catch (Exception e) { LOG.error("Could not flush HTable commits", e); } tx = null; changeSets.clear(); } }
Source:
<code>private InsightCard createInsightCard(Map<String, AttributeValue> item) { <START> InsightCard.Category category = InsightCard.Category.fromInteger(Integer.valueOf(item.get(CATEGORY_ATTRIBUTE_NAME).getN())); <END> InsightCard.TimePeriod timePeriod = InsightCard.TimePeriod.fromString(item.get(TIME_PERIOD_ATTRIBUTE_NAME).getS()); return new InsightCard( Long.valueOf(item.get(ACCOUNT_ID_ATTRIBUTE_NAME).getN()), item.get(TITLE_ATTRIBUTE_NAME).getS(), item.get(MESSAGE_ATTRIBUTE_NAME).getS(), category, timePeriod, new DateTime(item.get(TIMESTAMP_UTC_ATTRIBUTE_NAME).getS(), DateTimeZone.UTC) ); }</code><technical_language>final :)</technical_language>

Target:
private InsightCard createInsightCard(Map<String, AttributeValue> item) { final InsightCard.Category category = InsightCard.Category.fromInteger(Integer.valueOf(item.get(CATEGORY_ATTRIBUTE_NAME).getN())); final InsightCard.TimePeriod timePeriod = InsightCard.TimePeriod.fromString(item.get(TIME_PERIOD_ATTRIBUTE_NAME).getS()); return new InsightCard( Long.valueOf(item.get(ACCOUNT_ID_ATTRIBUTE_NAME).getN()), item.get(TITLE_ATTRIBUTE_NAME).getS(), item.get(MESSAGE_ATTRIBUTE_NAME).getS(), category, timePeriod, new DateTime(item.get(TIMESTAMP_UTC_ATTRIBUTE_NAME).getS(), DateTimeZone.UTC) ); }
Source:
<code>public List<CDORevision> getRevisions(List<CDOID> ids, CDOBranchPoint branchPoint, int referenceChunk, int prefetchDepth, boolean loadOnDemand, SyntheticCDORevision[] synthetics) { RevisionInfo[] infos = new RevisionInfo[ids.size()]; List<RevisionInfo> infosToLoad = createRevisionInfos(ids, branchPoint, prefetchDepth, loadOnDemand, infos); List<CDORevision> primaryLoadedRevisions = null; <START> List<InternalCDORevision> additionalRevisions = null; <END> if (infosToLoad != null) { additionalRevisions = loadRevisions(infosToLoad, branchPoint, referenceChunk, prefetchDepth); primaryLoadedRevisions = getResultsAndSynthetics(infosToLoad.toArray(new RevisionInfo[0]), null); } if (primaryLoadedRevisions != null && !primaryLoadedRevisions.isEmpty() || additionalRevisions != null && !additionalRevisions.isEmpty()) { List<CDORevision> additional = Collections.emptyList(); if (additionalRevisions != null && !additionalRevisions.isEmpty()) { additional = new ArrayList<CDORevision>(additionalRevisions); } fireEvent(new RevisionsLoadedEvent(this, primaryLoadedRevisions, additional)); } return getResultsAndSynthetics(infos, synthetics); }</code><technical_language>additionalLoadedRevisions</technical_language>

Target:
public List<CDORevision> getRevisions(List<CDOID> ids, CDOBranchPoint branchPoint, int referenceChunk, int prefetchDepth, boolean loadOnDemand, SyntheticCDORevision[] synthetics) { RevisionInfo[] infos = new RevisionInfo[ids.size()]; List<RevisionInfo> infosToLoad = createRevisionInfos(ids, branchPoint, prefetchDepth, loadOnDemand, infos); List<CDORevision> primaryLoadedRevisions = null; List<? extends CDORevision> additionalLoadedRevisions = null; if (infosToLoad != null) { additionalLoadedRevisions = loadRevisions(infosToLoad, branchPoint, referenceChunk, prefetchDepth); primaryLoadedRevisions = getResultsAndSynthetics(infosToLoad.toArray(new RevisionInfo[0]), null); } if (primaryLoadedRevisions != null && !primaryLoadedRevisions.isEmpty() || additionalLoadedRevisions != null && !additionalLoadedRevisions.isEmpty()) { List<? extends CDORevision> additional = Collections.emptyList(); if (additionalLoadedRevisions != null && !additionalLoadedRevisions.isEmpty()) { additional = additionalLoadedRevisions; } fireEvent(new RevisionsLoadedEvent(this, primaryLoadedRevisions, additional)); } return getResultsAndSynthetics(infos, synthetics); }
Source:
<code>public ResponseEntity<?> getSubscription(@PathVariable("id") final String subscriptionId, final NativeWebRequest request) { if (!featureToggleService.isFeatureEnabled(HIGH_LEVEL_API)) { return new ResponseEntity<>(NOT_IMPLEMENTED); } <START> return WrappableResult.resultWrapper(() -> <END> subscriptionService.getSubscription(subscriptionId), request); }</code><technical_language>for long. Result.wrap()</technical_language>

Target:
public ResponseEntity<?> getSubscription(@PathVariable("id") final String subscriptionId, final NativeWebRequest request) { if (!featureToggleService.isFeatureEnabled(HIGH_LEVEL_API)) { return new ResponseEntity<>(NOT_IMPLEMENTED); } return WebResult.wrap(() -> subscriptionService.getSubscription(subscriptionId), request); }
Source:
<code>public void addEffect(int potionID, int strength, int seconds, boolean ambient, boolean particles, Target t) { PotionEffect pe = new PotionEffect(PotionEffectType.getById(potionID), (int)Static.msToTicks(seconds * 1000), strength, ambient, particles); try{ if(le != null){ le.addPotionEffect(pe, true); } } catch(NullPointerException e){ <START> Logger.getLogger(BukkitMCLivingEntity.class.getName()).log(Level.SEVERE, <END> "Bukkit appears to have derped. This is a problem with Bukkit, not CommandHelper. The effect should have still been applied.", e); } }</code><technical_language>Um, add it</technical_language>

Target:
public void addEffect(int potionID, int strength, int seconds, boolean ambient, boolean particles, Target t) { PotionEffect pe; if (Static.getServer().getMinecraftVersion().lt(MCVersion.MC1_8)) { pe = new PotionEffect(PotionEffectType.getById(potionID), (int)Static.msToTicks(seconds * 1000), strength, ambient); } else { pe = new PotionEffect(PotionEffectType.getById(potionID), (int) Static.msToTicks(seconds * 1000), strength, ambient, particles); } try{ if(le != null){ le.addPotionEffect(pe, true); } } catch(NullPointerException e){ Logger.getLogger(BukkitMCLivingEntity.class.getName()).log(Level.SEVERE, "Bukkit appears to have derped. This is a problem with Bukkit, not CommandHelper. The effect should have still been applied.", e); } }
Source:
<code>ServiceRegistrationImpl getOrCreateRegistration(final ServiceName name) { ServiceRegistrationImpl registration; <START> registration = registry.get(name); <END> if (registration == null) { registration = new ServiceRegistrationImpl(name); ServiceRegistrationImpl existing = registry.putIfAbsent(name, registration); if(existing != null) { return existing; } else { return registration; } } else { return registration; } }</code><technical_language>remove this? JDK optimize multiple reads of instance field (even if field is final)</technical_language>

Target:
ServiceRegistrationImpl getOrCreateRegistration(final ServiceName name) { final ConcurrentMap<ServiceName, ServiceRegistrationImpl> registry = this.registry; ServiceRegistrationImpl registration; registration = registry.get(name); if (registration == null) { registration = new ServiceRegistrationImpl(name); ServiceRegistrationImpl existing = registry.putIfAbsent(name, registration); return existing != null ? existing : registration; } else { return registration; } }
Source:
<code>public void setUp() throws Exception { int commonTimeout = stoppingTimeotInaciveWorkspace + shedulerRequstTimeout <START> + TOASTLOADER_WIDGET_LATECY_TIMEOUT_IN_MILLISEC; <END> ide.open(testWorkspace); projectExplorer.waitProjectExplorer(); WaitUtils.sleepQuietly(commonTimeout, TimeUnit.MILLISECONDS); }</code><technical_language>encapsulate int commonTimeout = stoppingTimeotInaciveWorkspace shedulerRequstTimeout TOASTLOADER_WIDGET_LATECY_TIMEOUT_IN_MILLISEC; private method, "getCommonTimeout()"? This is necessarily, in opinion, more clean: public void setUp() throws Exception { ide.open(testWorkspace); projectExplorer.waitProjectExplorer(); WaitUtils.sleepQuietly(getCommonTimeout(), TimeUnit.MILLISECONDS); }</technical_language>

Target:
public void setUp() throws Exception { ide.open(testWorkspace); projectExplorer.waitProjectExplorer(); sleepQuietly(getCommonTimeoutInMilliSec(), MILLISECONDS); }
Source:
<code>public static Map<String, Object> getVariablesPojo(String basePath) throws JsonProcessingException, ProcessingException { String filePath = basePath + VARIABLE_CONFIG_PATH; File variableFile = new File(filePath); if (variableFile.exists()) { String jsonConfig = hjsonToJson(readConfigFile(variableFile)); if (verifySchema(VARIABLE, jsonConfig)) { return getModelPojo(jsonConfig, Map.class); } <START> return null; <END> } else { log.info("Variables config file not found at " + filePath); return null; } }</code><technical_language>instead of multiple return store results in a variable, single return</technical_language>

Target:
public static Map<String, Object> getVariablesPojo(String basePath) throws IOException { Map<String, Object> variables = null; String filePath = basePath + VARIABLE_CONFIG_PATH; File variableFile = new File(filePath); if (variableFile.exists()) { String jsonConfig = hjsonToJson(readConfigFile(variableFile)); try { if (DynamicConfigSchemaValidator.verifySchema(VARIABLE, jsonConfig)) { variables = getModelPojo(jsonConfig, Map.class); } } catch (ProcessingException e) { log.error("Error Validating variable config : " + e.getMessage()); throw new IOException(e); } } else { log.info("Variables config file not found at " + filePath); } return (variables == null ? new HashMap<String, Object>() : variables); }
Source:
<code>public CurrencyAmount rpv01( ResolvedCdsIndex cdsIndex, CreditRatesProvider ratesProvider, LocalDate referenceDate, PriceType priceType, ReferenceData refData) { if (isExpired(cdsIndex, ratesProvider)) { return CurrencyAmount.of(cdsIndex.getCurrency(), 0d); } ResolvedCds cds = cdsIndex.toSingleNameCds(); LocalDate stepinDate = cds.getStepinDateOffset().adjust(ratesProvider.getValuationDate(), refData); LocalDate effectiveStartDate = cds.calculateEffectiveStartDate(stepinDate); Triple<CreditDiscountFactors, LegalEntitySurvivalProbabilities, Double> rates = reduceDiscountFactors(cds, ratesProvider); double riskyAnnuity = underlyingPricer.riskyAnnuity( cds, rates.getFirst(), rates.getSecond(), referenceDate, stepinDate, effectiveStartDate, priceType); <START> return CurrencyAmount.of(cds.getCurrency(), cds.getBuySell().normalize(cds.getNotional()) * riskyAnnuity * rates.getThird()); <END> }</code><technical_language>Split calculation a little. double amount = cds.getNotional()) * riskyAnnuity * rates.getThird(); other places</technical_language>

Target:
public CurrencyAmount rpv01( ResolvedCdsIndex cdsIndex, CreditRatesProvider ratesProvider, LocalDate referenceDate, PriceType priceType, ReferenceData refData) { if (isExpired(cdsIndex, ratesProvider)) { return CurrencyAmount.of(cdsIndex.getCurrency(), 0d); } ResolvedCds cds = cdsIndex.toSingleNameCds(); LocalDate stepinDate = cds.getStepinDateOffset().adjust(ratesProvider.getValuationDate(), refData); LocalDate effectiveStartDate = cds.calculateEffectiveStartDate(stepinDate); Triple<CreditDiscountFactors, LegalEntitySurvivalProbabilities, Double> rates = reduceDiscountFactors(cds, ratesProvider); double riskyAnnuity = underlyingPricer.riskyAnnuity( cds, rates.getFirst(), rates.getSecond(), referenceDate, stepinDate, effectiveStartDate, priceType); double amount = cds.getBuySell().normalize(cds.getNotional()) * riskyAnnuity * rates.getThird(); return CurrencyAmount.of(cds.getCurrency(), amount); }
Source:
<code><START> public NodeStats stats() <END> { NodeStats nodeStats = null; for(RawClient rc : cluster) { if (nodeStats == null) nodeStats = rc.stats(); else nodeStats.add(rc.stats()); } return nodeStats; }</code><technical_language>Style points before. In this case class existing code in a style</technical_language>

Target:
public NodeStats stats() throws IOException { NodeStats nodeStats = null; for(RawClient rc : cluster) { if (nodeStats == null) nodeStats = rc.stats(); else nodeStats.add(rc.stats()); } return nodeStats; }
Source:
<code>protected List<ILogData> getNextEntries(T context, long maxGlobal, Function<ILogData, Boolean> contextCheckFn) { final List<ILogData> dataList = new ArrayList<>(); ILogData thisData; <START> while ((thisData = streamReadWithCheck(()->getNextEntry(context, maxGlobal), maxGlobal)) != null) { <END> dataList.add(thisData); updatePointer(thisData); if (contextCheckFn.apply(thisData)) { break; } } return dataList; }</code><technical_language>This getNextEntries is super class impl, a overridden impl. need change that</technical_language>

Target:
protected List<ILogData> getNextEntries(T context, long maxGlobal, Function<ILogData, Boolean> contextCheckFn) { final List<ILogData> dataList = new ArrayList<>(); ILogData thisData; while ((thisData = getNextEntry(context, maxGlobal)) != null) { dataList.add(thisData); updatePointer(thisData); if (contextCheckFn.apply(thisData)) { break; } } return dataList; }
Source:
<code>static List<Path> getSourceFiles(ImmutableSet<SourcePath> srcPaths, BuildContext context) { List<Path> srcFiles = new ArrayList<>(); for (SourcePath path : srcPaths) { Path srcPath = context.getSourcePathResolver().getAbsolutePath(path); <START> if (path instanceof BuildTargetSourcePath && Files.isDirectory(srcPath)) { <END> try (Stream<Path> sourcePaths = Files.list(srcPath)) { srcFiles.addAll(sourcePaths.filter(Files::isRegularFile).collect(Collectors.toList())); } catch (IOException e) { throw new RuntimeException("An error occur when listing the files under " + srcPath, e); } } else { srcFiles.add(srcPath); } } return srcFiles; }</code><technical_language>@linzhp is this needed? I removed instanceof tests passing, if this is required update test reflect case?: path instanceof BuildTargetSourcePath</technical_language>

Target:
static List<Path> getSourceFiles(ImmutableSet<SourcePath> srcPaths, BuildContext context) { List<Path> srcFiles = new ArrayList<>(); for (SourcePath path : srcPaths) { Path srcPath = context.getSourcePathResolver().getAbsolutePath(path); if (Files.isDirectory(srcPath)) { try (Stream<Path> sourcePaths = Files.list(srcPath)) { srcFiles.addAll(sourcePaths.filter(Files::isRegularFile).collect(Collectors.toList())); } catch (IOException e) { throw new RuntimeException("An error occur when listing the files under " + srcPath, e); } } else { srcFiles.add(srcPath); } } return srcFiles; }
Source:
<code>public void supports_xlsforms_value_and_label_refs_in_itemsets_using_secondary_external_instances_csv() throws URISyntaxException { <START> supports_xlsforms_value_and_label_refs_in_itemsets_using_secondary_external_instances("external_secondary_instance_non_standard_use_csv.xml"); <END> }</code><technical_language>For some reason this catch eye pattern introduced in #69 -- "non-standard use" refer to</technical_language>

Target:
public void supports_xlsforms_value_and_label_refs_in_itemsets_using_secondary_external_instances_csv() throws URISyntaxException { supports_xlsforms_value_and_label_refs_in_itemsets_using_secondary_external_instances("external_secondary_instance_csv.xml"); }
Source:
<code>private void runLibertyMojoCreate() throws MojoExecutionException { createParams.addAll(commonParams); <START> createParams.addAll(commonServerParams); <END> Xpp3Dom config = stripConfigElements(getLibertyPluginConfig(), createParams); log.info("Running liberty:create goal"); runLibertyMojo("create", config); }</code><technical_language>If createParams commonParams commonServerParams, define start with? I collection a static final variable class level</technical_language>

Target:
private void runLibertyMojoCreate() throws MojoExecutionException { Xpp3Dom config = stripConfigElements(getLibertyPluginConfig(), createParams); log.info("Running liberty:create goal"); runLibertyMojo("create", config); }
Source:
<code><START> public void checkConditions(Map<Tree, Collection<Constraint>> conditions) { <END> for (Entry<Tree, Collection<Constraint>> entry : conditions.entrySet()) { JavaScriptTree condition = (JavaScriptTree) entry.getKey(); if (loopConditions.contains(condition) && !conditionsWithIssue.contains(condition)) { IterationStatementTree loop = getLoop(condition); if (alwaysTrue(entry.getValue()) && !isBrokenLoop(condition, loop, CheckUtils.buildControlFlowGraph(loop))) { loop.accept(new LoopIssueCreator()); } } } }</code><technical_language>a bit more explicit role of loopConditions conditions provided this method delegating TreeVisitor filtering of conditions iterate those. treeVisitor.retainOnlyLoopConditions(conditions)</technical_language>

Target:
public void checkConditions(Map<Tree, Collection<Constraint>> conditions) { alwaysTrueConditions.addAll(conditions.entrySet().stream() .filter(treeCollectionEntry -> alwaysTrue(treeCollectionEntry.getValue())) .map(Map.Entry::getKey) .collect(Collectors.toSet())); }
Source:
<code>public String getFileName(String principalName, Object parsedFileContents, String userIdentifier) { <START> String fileName = "cbcp_" + principalName; <END> if (StringUtils.isNotBlank(userIdentifier)) { fileName += "_" + userIdentifier; } fileName += "_" + getDateTimeService().toDateTimeStringForFilename(getDateTimeService().getCurrentDate()); fileName = StringUtils.remove(fileName, " "); return fileName; }</code><technical_language>defined file prefix instead of hard coded "cbcp_"? time I code this is based of thing</technical_language>

Target:
public String getFileName(String principalName, Object parsedFileContents, String userIdentifier) { String fileName = "fp_cbcp_" + principalName; if (StringUtils.isNotBlank(userIdentifier)) { fileName += "_" + userIdentifier; } fileName += "_" + getDateTimeService().toDateTimeStringForFilename(getDateTimeService().getCurrentDate()); fileName = StringUtils.remove(fileName, " "); return fileName; }
Source:
<code>public String getLabel(Object object) { <START> return "feature model"; END> }</code><technical_language>this NLS</technical_language>

Target:
public String getLabel(Object object) { return PDEUIMessages.FeaturesView_loadingDescription; }
Source:
<code>public void testUserAgent() { Internet.USER_AGENT[] agents = Internet.USER_AGENT.values(); for(Internet.USER_AGENT agent : agents){ <START> assertThat(faker.internet().userAgent(agent), IsNot.not(isEmptyOrNullString())); <END> assertThat(faker.resolve("internet.user_agent." + agent.toString()), IsNot.not(isEmptyOrNullString())); } assertThat(faker.internet().userAgentAny(), IsNot.not(isEmptyOrNullString())); }</code><technical_language>static import for IsNot need fully qualify</technical_language>

Target:
public void testUserAgent() { Internet.UserAgent[] agents = Internet.UserAgent.values(); for(Internet.UserAgent agent : agents) { assertThat(faker.internet().userAgent(agent), not(isEmptyOrNullString())); } assertThat(faker.internet().userAgentAny(), not(isEmptyOrNullString())); }
Source:
<code>protected void ExecuteVmCommand() { lockVmWithCompensationIfNeeded(); if (!isInternalExecution()) { freeLock(); } restoreSnapshotAndRemoveObsoleteSnapshots(); boolean succeeded = true; <START> boolean hasAsyncTasks = false; <END> if (getImagesList().size() > 0) { for (DiskImage image : getImagesList()) { if (image.getimageStatus() != ImageStatus.ILLEGAL) { ImagesContainterParametersBase params = new RestoreFromSnapshotParameters(image.getImageId(), getVmId(), targetSnapshot, removedSnapshotId); VdcReturnValueBase returnValue = runAsyncTask(VdcActionType.RestoreFromSnapshot, params); if (!returnValue.getSucceeded()) { succeeded = false; getReturnValue().setFault(returnValue.getFault()); } } } hasAsyncTasks = !getTaskIdList().isEmpty(); } removeSnapshotsFromDB(); if (hasAsyncTasks) { deleteOrphanedImages(); } else { endActionOnVmConfiguration(); } setSucceeded(succeeded); }</code><technical_language>need init boolean false, false default JLS</technical_language>

Target:
protected void ExecuteVmCommand() { lockVmWithCompensationIfNeeded(); if (!isInternalExecution()) { freeLock(); } restoreSnapshotAndRemoveObsoleteSnapshots(); boolean succeeded = true; boolean hasAsyncTasks = false; if (!getImagesList().isEmpty()) { for (DiskImage image : getImagesList()) { if (image.getimageStatus() != ImageStatus.ILLEGAL) { ImagesContainterParametersBase params = new RestoreFromSnapshotParameters(image.getImageId(), getVmId(), targetSnapshot, removedSnapshotId); VdcReturnValueBase returnValue = runAsyncTask(VdcActionType.RestoreFromSnapshot, params); if (succeeded && !returnValue.getSucceeded()) { succeeded = false; getReturnValue().setFault(returnValue.getFault()); } } } hasAsyncTasks = !getTaskIdList().isEmpty(); } removeSnapshotsFromDB(); if (hasAsyncTasks) { deleteOrphanedImages(); } else { endActionOnVmConfiguration(); } setSucceeded(succeeded); }
Source:
<code>public void prepareLastAddedPartitionMap() throws InterruptedException { prepareStreamHcatEnableMap(); HCatClient hcatClient = getHCatClient(); if (hcatClient == null) { LOG.warn("Did not get hcatclient"); return; } try { for (String stream : streamsToProcess) { if (isStreamHCatEnabled(stream)) { try { hcatClient.getTable(Conduit.getHcatDBName(), getTableName(stream)); findLastPartition(hcatClient, stream); } catch (HCatException e) { if (e.getCause() instanceof NoSuchObjectException) { <START> stopped = true; <END> LOG.error("Got noSuchObject exception while trying to get table" + " or finding last partition " + e.getMessage()); throw new RuntimeException(e.getCause()); } LOG.warn("Got Exception while finding the last added partition for" + " stream " + stream, e); setFailedToGetPartitions(true); } } else { LOG.info("Hcatalog is not enabled for " + stream + " stream"); } } } finally { submitBack(hcatClient); } }</code><technical_language>remove this,we dont want stop a service effect other streams processed thread</technical_language>

Target:
public void prepareLastAddedPartitionMap() throws InterruptedException { prepareStreamHcatEnableMap(); HCatClient hcatClient = getHCatClient(); if (hcatClient == null) { LOG.warn("Did not get hcatclient hence not finding the last added partition"); for (String stream : streamsToProcess) { if (isStreamHCatEnabled(stream)) { updateLastAddedPartitionMap(getTableName(stream), FAILED_GET_PARTITIONS); ConduitMetrics.updateSWGuage(getServiceType(), FAILED_TO_GET_HCAT_CLIENT_COUNT, stream, 1); } } return; } try { for (String stream : streamsToProcess) { if (isStreamHCatEnabled(stream)) { try { hcatClient.getTable(Conduit.getHcatDBName(), getTableName(stream)); findLastPartition(hcatClient, stream); } catch (HCatException e) { if (e.getCause() instanceof NoSuchObjectException) { LOG.error("Got noSuchObject exception while trying to get table" + " or finding last partition " + e.getMessage()); throw new RuntimeException(e); } LOG.warn("Got Exception while finding the last added partition for" + " stream " + stream, e); updateLastAddedPartitionMap(getTableName(stream), FAILED_GET_PARTITIONS); } } else { LOG.debug("Hcatalog is not enabled for " + stream + " stream"); } } } finally { addToPool(hcatClient); } }