auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Set<MacroId> getMacroIds(Syntax syntax) throws MacroLookupException { Set<MacroId> result = new HashSet<MacroId>(); Map<String, Macro> allMacros; try { allMacros = this.componentManager.get().getInstanceMap(Macro.class); } catch (ComponentLookupException e) { throw new MacroLookupException("Failed to lookup Macros", e); } for (Map.Entry<String, Macro> entry : allMacros.entrySet()) { MacroId macroId; try { macroId = this.macroIdFactory.createMacroId(entry.getKey()); } catch (ParseException e) { <START> this.logger.warn("Invalid Macro descriptor format for hint [ {}" + entry.getKey() <END> + " ]. The hint should contain either the macro name only or the macro name followed by " + "the syntax for which it is valid. In that case the macro name should be followed by a " + "\"/\" followed by the syntax name followed by another \"/\" followed by the syntax version. " + "For example \"html/xwiki/2.0\". This macro will not be available in the system."); continue; } if (syntax == null || macroId.getSyntax() == null || syntax.equals(macroId.getSyntax())) { result.add(macroId); } } return result; }</code><technical_language>a fix (which i slf4j syntax for a place holder) move entry.getKey() a parameter</technical_language>

Target:
public Set<MacroId> getMacroIds(Syntax syntax) throws MacroLookupException { Set<MacroId> result = new HashSet<MacroId>(); Map<String, Macro> allMacros; try { allMacros = this.componentManager.get().getInstanceMap(Macro.class); } catch (ComponentLookupException e) { throw new MacroLookupException("Failed to lookup Macros", e); } for (Map.Entry<String, Macro> entry : allMacros.entrySet()) { MacroId macroId; try { macroId = this.macroIdFactory.createMacroId(entry.getKey()); } catch (ParseException e) { this.logger.warn("Invalid Macro descriptor format for hint [{}" + "]. The hint should contain either the macro name only or the macro name followed by " + "the syntax for which it is valid. In that case the macro name should be followed by a " + "\"/\" followed by the syntax name followed by another \"/\" followed by the syntax version. " + "For example \"html/xwiki/2.0\"." + "This macro will not be available in the system.", entry.getKey()); continue; } if (syntax == null || macroId.getSyntax() == null || syntax.equals(macroId.getSyntax())) { result.add(macroId); } } return result; }
Source:
<code>public void verify_JSON_bind_work_with_setter_that_accept_object_type() throws Exception { final Stapler stapler = new Stapler(); stapler.setWebApp(new WebApp(Mockito.mock(ServletContext.class))); <START> final MockRequest mockRequest = mockRequest(generateMultipartData()); <END> RequestImpl req = new RequestImpl(stapler, mockRequest, Collections.<AncestorImpl>emptyList(), null); JSONObject json = new JSONObject(); json.put("stapler-class", SetterObject.class.getName()); json.put("$class", SetterObject.class.getName()); json.put("choices", "1\n2\n3"); SetterObject o = req.bindJSON(SetterObject.class, json); Assert.assertEquals(o.getChoices(), Arrays.asList("1", "2", "3")); }</code><technical_language>This test do form data. Suggest reverting changes a separate MockRequest minimum needed here</technical_language>

Target:
public void verify_JSON_bind_work_with_setter_that_accept_object_type() throws Exception { final Stapler stapler = new Stapler(); stapler.setWebApp(new WebApp(Mockito.mock(ServletContext.class))); HttpServletRequest request = Mockito.mock(HttpServletRequest.class); RequestImpl req = new RequestImpl(stapler, request, Collections.<AncestorImpl>emptyList(), null); JSONObject json = new JSONObject(); json.put("$class", SetterObject.class.getName()); json.put("choices", "1\n2\n3"); SetterObject o = req.bindJSON(SetterObject.class, json); Assert.assertEquals(o.getChoices(), Arrays.asList("1", "2", "3")); }
Source:
<code>public void testLoadConfigWithoutLoader() { Map<String, String> config = new HashMap<>(); config.put(JobConfig.JOB_NAME, "new-test-job"); Config actual = ConfigUtil.loadConfig(new MapConfig(config)); <START> assertEquals(config.size(), actual.size()); assertEquals("new-test-job", actual.get(JobConfig.JOB_NAME)); <END> }</code><technical_language>this assertEquals(config, actual)</technical_language>

Target:
public void testLoadConfigWithoutLoader() { Map<String, String> config = new HashMap<>(); config.put(JobConfig.JOB_NAME, "new-test-job"); ConfigUtil.loadConfig(new MapConfig(config)); }
Source:
<code>List<Object> projectRow(Row row) throws TranslatorException { ArrayList<Object> output = new ArrayList<Object>(this.visitor.getProjectedColumns().size()); int id = row.getRowNum()+1; int i = -1; for (int index:this.visitor.getProjectedColumns()) { i++; if (index == -1) { output.add(id); continue; } <START> Cell cell = row.getCell(index-1, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK); <END> if (cell == null) { output.add(null); continue; } switch (this.evaluator.evaluateInCell(cell).getCellType()) { case Cell.CELL_TYPE_NUMERIC: output.add(convertFromExcelType(cell.getNumericCellValue(), cell, this.expectedColumnTypes[i])); break; case Cell.CELL_TYPE_STRING: output.add(convertFromExcelType(cell.getStringCellValue(), this.expectedColumnTypes[i])); break; case Cell.CELL_TYPE_BOOLEAN: output.add(convertFromExcelType(cell.getBooleanCellValue(), this.expectedColumnTypes[i])); break; default: output.add(null); break; } } return output; }</code><technical_language>this Row.MissingCellPolicy.RETURN_BLANK_AS_NULL instead</technical_language>

Target:
List<Object> projectRow(Row row) throws TranslatorException { ArrayList<Object> output = new ArrayList<Object>(this.visitor.getProjectedColumns().size()); int id = row.getRowNum()+1; int i = -1; for (int index:this.visitor.getProjectedColumns()) { i++; if (index == -1) { output.add(id); continue; } Cell cell = row.getCell(index-1, Row.MissingCellPolicy.RETURN_BLANK_AS_NULL); if (cell == null) { output.add(null); continue; } switch (this.evaluator.evaluateInCell(cell).getCellType()) { case Cell.CELL_TYPE_NUMERIC: output.add(convertFromExcelType(cell.getNumericCellValue(), cell, this.expectedColumnTypes[i])); break; case Cell.CELL_TYPE_STRING: output.add(convertFromExcelType(cell.getStringCellValue(), this.expectedColumnTypes[i])); break; case Cell.CELL_TYPE_BOOLEAN: output.add(convertFromExcelType(cell.getBooleanCellValue(), this.expectedColumnTypes[i])); break; default: output.add(null); break; } } return output; }
Source:
<code>private void loadVitalsFromServer() { if (NetworkUtils.isOnline()) { new VisitApi().syncLastVitals(mPatient.getUuid(), new DefaultResponseCallbackListener() { @Override public void onResponse() { loadVitalsFromDB(); } @Override <START> public void onErrorResponse() { <END> } }); } }</code><technical_language>@AdamGrzybkowski This needs dealed :sunglasses:</technical_language>

Target:
private void loadVitalsFromServer() { if (NetworkUtils.isOnline()) { new VisitApi().syncLastVitals(mPatient.getUuid(), new DefaultResponseCallbackListener() { @Override public void onResponse() { loadVitalsFromDB(); } @Override public void onErrorResponse(String errorMessage) { mPatientVitalsView.showErrorToast(errorMessage); } }); } }
Source:
<code>public RadioGroup getView() { <START> return (RadioGroup) super.getView(); <END> }</code><technical_language>TimePicker</technical_language>

Target:
public TimePicker getView() { return (TimePicker) super.getView(); }
Source:
<code>public LogReplicationSourceManager(LogReplicationRuntimeParameters params, LogReplicationMetadataManager metadataManager, DataSender dataSender) { this.runtime = CorfuRuntime.fromParameters(CorfuRuntimeParameters.builder() .trustStore(params.getTrustStore()) .tsPasswordFile(params.getTsPasswordFile()) .keyStore(params.getKeyStore()) .ksPasswordFile(params.getKsPasswordFile()) .tlsEnabled(params.isTlsEnabled()).build()); runtime.parseConfigurationString(params.getLocalCorfuEndpoint()).connect(); this.parameters = params; this.config = parameters.getReplicationConfig(); if (config.getStreamsToReplicate() == null || config.getStreamsToReplicate().isEmpty()) { throw new IllegalArgumentException("Invalid Log Replication: Streams to replicate is EMPTY"); } ExecutorService logReplicationFSMWorkers = Executors.newFixedThreadPool(DEFAULT_FSM_WORKER_THREADS, new ThreadFactoryBuilder().setNameFormat("state-machine-worker").build()); ReadProcessor readProcessor = new DefaultReadProcessor(runtime); this.logReplicationFSM = new LogReplicationFSM(this.runtime, config, params.getRemoteClusterDescriptor(), dataSender, readProcessor, logReplicationFSMWorkers); this.logReplicationFSM.setTopologyConfigId(params.getTopologyConfigId()); this.metadataManager = metadataManager; lastAckedTsPoller = Executors.newSingleThreadScheduledExecutor( <START> new ThreadFactoryBuilder().setNameFormat("Last Ackd Ts Reader").build()); <END> lastAckedTsPoller.scheduleWithFixedDelay(new TsPollingTask(), 0, ACKED_TS_READ_INTERVAL_SECONDS, TimeUnit.SECONDS); }</code><technical_language>thread name : last-ackd-ts-reader</technical_language>

Target:
public LogReplicationSourceManager(LogReplicationRuntimeParameters params, LogReplicationMetadataManager metadataManager, DataSender dataSender) { this.runtime = CorfuRuntime.fromParameters(CorfuRuntimeParameters.builder() .trustStore(params.getTrustStore()) .tsPasswordFile(params.getTsPasswordFile()) .keyStore(params.getKeyStore()) .ksPasswordFile(params.getKsPasswordFile()) .tlsEnabled(params.isTlsEnabled()).build()); runtime.parseConfigurationString(params.getLocalCorfuEndpoint()).connect(); this.parameters = params; this.config = parameters.getReplicationConfig(); if (config.getStreamsToReplicate() == null || config.getStreamsToReplicate().isEmpty()) { throw new IllegalArgumentException("Invalid Log Replication: Streams to replicate is EMPTY"); } ExecutorService logReplicationFSMWorkers = Executors.newFixedThreadPool(DEFAULT_FSM_WORKER_THREADS, new ThreadFactoryBuilder().setNameFormat("state-machine-worker").build()); ReadProcessor readProcessor = new DefaultReadProcessor(runtime); this.metadataManager = metadataManager; ackReader = new LogReplicationAckReader(this.metadataManager, config, runtime, params.getRemoteClusterDescriptor().getClusterId()); this.logReplicationFSM = new LogReplicationFSM(this.runtime, config, params.getRemoteClusterDescriptor(), dataSender, readProcessor, logReplicationFSMWorkers, ackReader); this.logReplicationFSM.setTopologyConfigId(params.getTopologyConfigId()); }
Source:
<code>public void getTemplateContent_localFileTemplateExists_useLocalFileContent() { LitTemplateParser instance = LitTemplateParserImpl.getInstance(); TemplateData templateContent = instance.getTemplateContent( MyLitElementView.class, "my-lit-element-view", service); Assert.assertEquals("Parent element ID not the expected one.", "my-lit-element-view", templateContent.getTemplateElement().parent().id()); Assert.assertEquals("Expected template element to have 3 children", 3, templateContent.getTemplateElement().childNodeSize()); Assert.assertEquals( <START> "Template element should have contained a div element with the id 'test'", <END> "div", templateContent.getTemplateElement() .getElementById("label").tag().toString()); }</code><technical_language>Ok, a failed assertion message in test code expected id is label here</technical_language>

Target:
public void getTemplateContent_localFileTemplateExists_useLocalFileContent() { LitTemplateParser instance = LitTemplateParserImpl.getInstance(); TemplateData templateContent = instance.getTemplateContent( MyLitElementView.class, "my-lit-element-view", service); Assert.assertEquals("Parent element ID not the expected one.", "my-lit-element-view", templateContent.getTemplateElement().parent().id()); Assert.assertEquals("Expected template element to have 3 children", 3, templateContent.getTemplateElement().childNodeSize()); Assert.assertEquals( "Template element should have contained a div element with the id 'label'", "div", templateContent.getTemplateElement() .getElementById("label").tag().toString()); }
Source:
<code>public static void computeXTextSize(XText xText) { if (Widgets.isAccessible(xText.getStyledText())) { <START> int lineCount = xText.getStyledText().getLineCount(); <END> int lineLimit = Integer.valueOf(OseeInfo.getValue(ATTR_FORM_PART_LINE_LIMIT)); lineCount = lineCount > lineLimit ? lineLimit : lineCount; int height = lineCount * xText.getStyledText().getLineHeight(); GridData formTextGd = new GridData(SWT.FILL, SWT.FILL, true, true); if (xText.isFillVertically() && height < 60) { formTextGd.heightHint = 60; } else { formTextGd.heightHint = height; } formTextGd.widthHint = 200; xText.getStyledText().setLayoutData(formTextGd); } }</code><technical_language>Recommend getCachedValue this hit database for text field</technical_language>

Target:
public static void computeXTextSize(XText xText) { if (Widgets.isAccessible(xText.getStyledText())) { int lineCount = xText.getStyledText().getLineCount(); int lineLimit = Integer.valueOf(OseeInfo.getCachedValue(ATTR_FORM_PART_LINE_LIMIT)); lineCount = lineCount > lineLimit ? lineLimit : lineCount; int height = lineCount * xText.getStyledText().getLineHeight(); GridData formTextGd = new GridData(SWT.FILL, SWT.FILL, true, true); if (xText.isFillVertically() && height < 60) { formTextGd.heightHint = 60; } else { formTextGd.heightHint = height; } formTextGd.widthHint = 200; xText.getStyledText().setLayoutData(formTextGd); } }
Source:
<code>private static boolean inSameSubtree(long bitsA, long bitsB, int level) { <START> return (bitsA >>> level) == (bitsB >>> level) || level == MAX_BITS; <END> }</code><technical_language>flip ||</technical_language>

Target:
private static boolean inSameSubtree(long bitsA, long bitsB, int level) { return level == MAX_BITS || (bitsA >>> level) == (bitsB >>> level); }
Source:
<code><START> public Date getStartTime() <END> { return Date.from(zonedStartTime.toInstant()); }</code><technical_language>do need this? consumers? switch ZonedDateTime</technical_language>

Target:
public ZonedDateTime getStartTime() { return startTime; }
Source:
<code>private void generateFollowMethod() { javaBuffer.addImport("org.ovirt.engine.api.model.ActionableResource"); javaBuffer.addLine("default public void follow (ActionableResource entity) {"); javaBuffer.addLine("}"); <START> javaBuffer.addLine(""); <END> }</code><technical_language>need for empty string, is 'addLine' method parameters want</technical_language>

Target:
private void generateFollowMethod() { javaBuffer.addImport(javaPackages.getXjcPackageName(), "ActionableResource"); javaBuffer.addLine("default public void follow (ActionableResource entity) {"); javaBuffer.addLine("}"); javaBuffer.addLine(); }
Source:
<code>public List<Drug> getDrugsByMapping(String code, ConceptSource conceptSource, Collection<ConceptMapType> withAnyOfTheseTypes, boolean includeRetired) throws DAOException { Criteria searchCriteria = sessionFactory.getCurrentSession().createCriteria(DrugReferenceMap.class); searchCriteria.setProjection(Projections.property("drug")); searchCriteria.createAlias("conceptReferenceTerm", "term"); searchCriteria.add(Restrictions.eq("term.code", code)); <START> searchCriteria.createAlias("term.conceptSource", "source"); <END> searchCriteria.add(Restrictions.or(Restrictions.eq("source.name", conceptSource.getName()), Restrictions.eq("source.hl7Code", conceptSource.getHl7Code()))); for(ConceptMapType conceptMapType : withAnyOfTheseTypes) { if(conceptMapType != null) { searchCriteria.add(Restrictions.eq("conceptMapType", conceptMapType)); break; } } searchCriteria.createAlias("drug", "drug"); if (!includeRetired) { searchCriteria.add(Restrictions.eq("drug.retired", false)); } return (List<Drug>) searchCriteria.list(); }</code><technical_language>need check source is null</technical_language>

Target:
public List<Drug> getDrugsByMapping(String code, ConceptSource conceptSource, Collection<ConceptMapType> withAnyOfTheseTypes, boolean includeRetired) throws DAOException { Criteria criteria = createSearchDrugByMappingCriteria(code,conceptSource,includeRetired); if(withAnyOfTheseTypes !=null) { criteria.add(Restrictions.in("map.conceptMapType", withAnyOfTheseTypes)); } return (List<Drug>) criteria.list(); }
Source:
<code>public ContentValues mapToContentValues(@NonNull BoxedTypesMethodsConstructorIgnoreNull object) { ContentValues contentValues = new ContentValues(6); if (object.getFloatField() != null) { contentValues.put("floatField", object.getFloatField()); } if (object.getLongField() != null) { contentValues.put("longField", object.getLongField()); } if (object.getDoubleField() != null) { contentValues.put("doubleField", object.getDoubleField()); } if (object.isBooleanField() != null) { <START> contentValues.put("booleanField", object.isBooleanField()); <END> } if (object.getIntField() != null) { contentValues.put("intField", object.getIntField()); } if (object.getShortField() != null) { contentValues.put("shortField", object.getShortField()); } return contentValues; }</code><technical_language>huh, IDE tricked method name</technical_language>

Target:
public ContentValues mapToContentValues(@NonNull BoxedTypesMethodsConstructorIgnoreNull object) { ContentValues contentValues = new ContentValues(6); if (object.getField1() != null) { contentValues.put("field1", object.getField1()); } if (object.getField6() != null) { contentValues.put("field6", object.getField6()); } if (object.getField3() != null) { contentValues.put("field3", object.getField3()); } if (object.getField2() != null) { contentValues.put("field2", object.getField2()); } if (object.getField5() != null) { contentValues.put("field5", object.getField5()); } if (object.getField4() != null) { contentValues.put("field4", object.getField4()); } return contentValues; }
Source:
<code>public String getModerationHintButtonText() { <START> WebElement moderatorionHintButton = browser.driver.findElement(By.id("moderationHintButton")); <END> return moderatorionHintButton.getText(); }</code><technical_language>Oops, I missed this out: moderatorionHintButton --> moderationHintButton</technical_language>

Target:
public String getModerationHintButtonText() { WebElement moderationHintButton = browser.driver.findElement(By.id("moderationHintButton")); return moderationHintButton.getText(); }
Source:
<code>private boolean needBootstrapAcidTablesDuringIncrementalDump() { <START> return (work.oldReplScope != null) || conf.getBoolVar(HiveConf.ConfVars.REPL_BOOTSTRAP_ACID_TABLES); <END> }</code><technical_language>if acid table dump is enabled</technical_language>

Target:
private boolean needBootstrapAcidTablesDuringIncrementalDump() { return (ReplUtils.includeAcidTableInDump(conf) && ((work.oldReplScope != null) || conf.getBoolVar(HiveConf.ConfVars.REPL_BOOTSTRAP_ACID_TABLES))); }
Source:
<code>private URIish redirect(String location, String checkFor, int redirects) throws TransportException { if (location == null || location.isEmpty()) { throw new TransportException(MessageFormat.format( JGitText.get().redirectLocationMissing, uri, baseUrl)); } if (redirects >= http.maxRedirects) { throw new TransportException(MessageFormat.format( JGitText.get().redirectLimitExceeded, uri, Integer.valueOf(http.maxRedirects), baseUrl, location)); } try { if (!isValidRedirect(baseUrl, location, checkFor)) { throw new TransportException( MessageFormat.format(JGitText.get().redirectBlocked, uri, baseUrl, location)); } location = location.substring(0, location.indexOf(checkFor)); URIish result = new URIish(location); <START> LOG.info(MessageFormat.format(JGitText.get().redirectHttp, <END> uri, Integer.valueOf(redirects), baseUrl, result)); return result; } catch (URISyntaxException e) { throw new TransportException(MessageFormat.format( JGitText.get().invalidRedirectLocation, uri, baseUrl, location), e); } }</code><technical_language>I Log.info(String format, Object... args) exists. placeholder format is different, I confusing property placeholders. I find clearer {0}, {1}, ... placeholders everywhere</technical_language>

Target:
private URIish redirect(String location, String checkFor, int redirects) throws TransportException { if (location == null || location.isEmpty()) { throw new TransportException(MessageFormat.format( JGitText.get().redirectLocationMissing, uri, baseUrl)); } if (redirects >= http.maxRedirects) { throw new TransportException(MessageFormat.format( JGitText.get().redirectLimitExceeded, uri, Integer.valueOf(http.maxRedirects), baseUrl, location)); } try { if (!isValidRedirect(baseUrl, location, checkFor)) { throw new TransportException( MessageFormat.format(JGitText.get().redirectBlocked, uri, baseUrl, location)); } location = location.substring(0, location.indexOf(checkFor)); URIish result = new URIish(location); if (LOG.isInfoEnabled()) { LOG.info(MessageFormat.format(JGitText.get().redirectHttp, uri, Integer.valueOf(redirects), baseUrl, result)); } return result; } catch (URISyntaxException e) { throw new TransportException(MessageFormat.format( JGitText.get().invalidRedirectLocation, uri, baseUrl, location), e); } }
Source:
<code>public void onEvent(Event e) { try { Map<Type, TopicPublisher> m = this.producerMap.get(e.getTarget()); if (m != null) { TopicPublisher tp = m.get(e.getType()); if (tp != null) { log.debug("Sending event to tp"); tp.send(session.createTextMessage(this.apply(e))); } else { log.warn("TopicPublisher is NULL!"); } } } catch (JMSException ex) { log.warn("Unable to send event :" + e + " via AMQPBus", ex); } catch (JsonProcessingException jpe) { <START> log.warn("Unable to send event :" + jpe + " via AMQPBus", jpe); <END> } }</code><technical_language>of "jpe" in log line "e"</technical_language>

Target:
public void onEvent(Event e) { try { Map<Type, TopicPublisher> m = this.producerMap.get(e.getTarget()); if (m != null) { TopicPublisher tp = m.get(e.getType()); if (tp != null) { log.debug("Sending event to tp"); tp.send(session.createTextMessage(this.apply(e))); } else { log.warn("TopicPublisher is NULL!"); } } } catch (JMSException ex) { log.warn("Unable to send event :" + e + " via AMQPBus", ex); } catch (JsonProcessingException jpe) { log.warn("Unable to send event :" + e + " via AMQPBus", jpe); } }
Source:
<code>private int indexOfVersionForDate(final Date date) { for (int i = versions.size() - 1; i >= 0; i--) { final StaticCatalog c = versions.get(i); if (c.getEffectiveDate().getTime() <= date.getTime()) { return i; } } if (!versions.isEmpty()) { return 0; } <START> throw new IllegalStateException("No existing versions in the VersionedCatalog catalog ??"); <END> }</code><technical_language>add some debugging information (Date and/or versions)</technical_language>

Target:
private int indexOfVersionForDate(final Date date) { for (int i = versions.size() - 1; i >= 0; i--) { final StaticCatalog c = versions.get(i); if (c.getEffectiveDate().getTime() <= date.getTime()) { return i; } } if (!versions.isEmpty()) { return 0; } throw new IllegalStateException(String.format("No existing versions in the VersionedCatalog catalog for input date %s", date)); }
Source:
<code>public boolean onRestart(Scheduler.RestartTopologyRequest request) { <START> return false; <END> }</code><technical_language>some log</technical_language>

Target:
public boolean onRestart(Scheduler.RestartTopologyRequest request) { int appId = request.getContainerIndex(); return controller.restartApp(appId); }
Source:
<code>protected void post2(BuildListener listener) throws Exception { if(getResult()== Result.SUCCESS) getStatus().onSuccessfulPromotion(Promotion.this); getTarget().save(); if (getResult() == Result.SUCCESS) { PromotedBuildAction pba = getTarget().getAction(PromotedBuildAction.class); for (PromotionProcess pp : pba.getPendingPromotions()) { pp.considerPromotion2(getTarget()); } Jenkins jenkins = Jenkins.getInstance(); <START> if(jenkins != null){ <END> for (AbstractProject<?,?> p : jenkins.getAllItems(AbstractProject.class)) { PromotionTrigger pt = p.getTrigger(PromotionTrigger.class); if (pt!=null) pt.consider(Promotion.this); } } } }</code><technical_language>This update is reasonable, IMO polish code in a separate pull request. in JobDSL</technical_language>

Target:
protected void post2(BuildListener listener) throws Exception { if(getResult()== Result.SUCCESS) getStatus().onSuccessfulPromotion(Promotion.this); getTarget().save(); if (getResult() == Result.SUCCESS) { PromotedBuildAction pba = getTarget().getAction(PromotedBuildAction.class); for (PromotionProcess pp : pba.getPendingPromotions()) { pp.considerPromotion2(getTarget()); } for (AbstractProject<?,?> p : Jenkins.getInstance().getAllItems(AbstractProject.class)) { PromotionTrigger pt = p.getTrigger(PromotionTrigger.class); if (pt!=null) pt.consider(Promotion.this); } } }
Source:
<code>public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ( ( methodValidationConfiguration == null ) ? 0 : methodValidationConfiguration.hashCode() ); result = prime * result + ( ( parameterNameProvider == null ) ? 0 : parameterNameProvider.hashCode() ); <START> result = prime * result + ( ( valueExtractorManager == null ) ? 0 : valueExtractorManager.hashCode() ); <END> return result; }</code><technical_language>Wondering if worth compute this hashCode once? I called though</technical_language>

Target:
public int hashCode() { return hashCode; }
Source:
<code><START> public Set<FrameworkField> getAnnotatedFields() { <END> return createTreeSetWithMapValues(fFieldsForAnnotations, FIELD_COMPARATOR); }</code><technical_language>slightly odd this returns a set getAnnotatedFields(Class<? extends Annotation) returns a list</technical_language>

Target:
public List<FrameworkField> getAnnotatedFields() { return collectValues(fFieldsForAnnotations); }
Source:
<code>public List<BibEntry> performSearch(String query) throws FetcherException { TreeSet<String> plainReferences = new TreeSet<>(); <START> String[] plainReferencesArray = query.split(";;"); <END> for (int i = 0; i < plainReferencesArray.length; i++) { plainReferences.add(plainReferencesArray[i].trim()); } plainReferences.remove(""); if (plainReferences.size() == 0) { throw new FetcherException("Your entered References are empty."); } else { ArrayList<BibEntry> resultsList = new ArrayList<>(); for (String reference: plainReferences) { parseBibToBibEntry(parseUsingGrobid(reference)).ifPresentOrElse(resultsList::add, () -> failedEntries.add(reference)); } return resultsList; } }</code><technical_language>Arrays.stream( query.split( ";;" ) ) .map(trim) .filter(String::notempty) .collect(toTreeset); is a bit more readable</technical_language>

Target:
public List<BibEntry> performSearch(String query) { List<String> plainReferences = Arrays.stream( query.split( "\\r\\r+|\\n\\n+|\\r\\n(\\r\\n)+" ) ) .map(String::trim) .filter(str -> !str.isBlank()) .collect(Collectors.toCollection(ArrayList::new)); if (plainReferences.isEmpty()) { return Collections.emptyList(); } else { return plainReferences.stream() .map(reference -> parseBibToBibEntry(parseUsingGrobid(reference))) .flatMap(Optional::stream) .collect(Collectors.toList()); } }
Source:
<code>private static void appendTime(StringBuilder sb, int hours, int minutes, int seconds, int nanos) { sb.append(NUMBERS[hours]); sb.append(':'); sb.append(NUMBERS[minutes]); sb.append(':'); sb.append(NUMBERS[seconds]); <START> int microseconds = (int) Math.round(nanos / 1000.0); <END> if (microseconds == 0) { return; } sb.append('.'); int len = sb.length(); sb.append(microseconds); int needZeros = 6 - (sb.length() - len); if (needZeros > 0) { sb.insert(len, ZEROS, 0, needZeros); } int end = sb.length() - 1; while (sb.charAt(end) == '0') { sb.deleteCharAt(end); end--; } }</code><technical_language>a precision loss is here. I nanos/1000 + (nanos%1000+500)/1000 is (or if (nanos%1000>500) micros++;)</technical_language>

Target:
private static void appendTime(StringBuilder sb, int hours, int minutes, int seconds, int nanos) { sb.append(NUMBERS[hours]); sb.append(':'); sb.append(NUMBERS[minutes]); sb.append(':'); sb.append(NUMBERS[seconds]); int microseconds = (nanos / 1000) + (((nanos % 1000) + 500) / 1000); if (microseconds == 0) { return; } sb.append('.'); int len = sb.length(); sb.append(microseconds); int needZeros = 6 - (sb.length() - len); if (needZeros > 0) { sb.insert(len, ZEROS, 0, needZeros); } int end = sb.length() - 1; while (sb.charAt(end) == '0') { sb.deleteCharAt(end); end--; } }
Source:
<code>public int presentAsFile(final File file, final CertifiedProductDownloadResponse cpList) { try { Writer writer = null; XMLStreamWriter streamWriter = null; try { XMLOutputFactory factory = XMLOutputFactory.newInstance(); writer = new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8); streamWriter = new IndentingXMLStreamWriter(factory.createXMLStreamWriter(writer)); streamWriter.writeStartDocument("UTF-8", "1.0"); streamWriter.writeStartElement("ns2:results"); <START> streamWriter.writeNamespace("ns2", "<LINK_0>"); <END> CertifiedProductSearchDetailsXmlGenerator.add(cpList.getListings(), "listings", streamWriter); streamWriter.writeEndElement(); streamWriter.writeEndDocument(); } catch(Exception e) { e.printStackTrace(); LOGGER.error(e); } finally { if (streamWriter != null) { streamWriter.close(); } if (writer != null) { writer.close(); } } } catch (Exception e) { LOGGER.error("Error while writing XML file.", e); } return cpList.getListings().size(); }</code><technical_language>this environment.get(urlStart) for namespace? Also, namespace? I URL resolves anywhere; need to</technical_language>

Target:
public int presentAsFile(final File file, final CertifiedProductDownloadResponse cpList) { try { Writer writer = null; XMLStreamWriter streamWriter = null; try { XMLOutputFactory factory = XMLOutputFactory.newInstance(); writer = new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8); streamWriter = factory.createXMLStreamWriter(writer); streamWriter.writeStartDocument("UTF-8", "1.0"); streamWriter.writeStartElement("ns2:results"); streamWriter.writeNamespace("ns2", "<LINK_0>"); CertifiedProductSearchDetailsXmlGenerator.add(cpList.getListings(), "listings", streamWriter); streamWriter.writeEndElement(); streamWriter.writeEndDocument(); } catch(Exception e) { e.printStackTrace(); LOGGER.error(e); } finally { if (streamWriter != null) { streamWriter.close(); } if (writer != null) { writer.close(); } } } catch (Exception e) { LOGGER.error("Error while writing XML file.", e); } return cpList.getListings().size(); }
Source:
<code>public CostaRicaProviderLiveTest() { <START> super(new CostaRicaProvider(secretProperty("navitia.authorization"))); <END> }</code><technical_language>If server requires authorization (does it?), is of official navitia server, right? in case this a secret variable here</technical_language>

Target:
public CostaRicaProviderLiveTest() { super(new CostaRicaProvider(null)); }
Source:
<code>public Map<String, Metric> getMetrics() { Map<String, Metric> metrics = new HashMap<>(); metrics.put(buildMetricName("numDatastreamTasks"), _numDatastreamTasks); <START> metrics.putAll(MysqlBinlogEventListener.getMetrics()); <END> metrics.putAll(MysqlSourceBinlogRowEventFilter.getMetrics()); return Collections.unmodifiableMap(metrics); }</code><technical_language>Optional.ofNullable(MysqlBinlogEventListener.getMetrics()).map(m -> metrics.putAll(m)); Optional.ofNullable(MysqlSourceBinlogRowEventFilter.getMetrics()).map(m -> metrics.putAll(m));</technical_language>

Target:
public Map<String, Metric> getMetrics() { Map<String, Metric> metrics = new HashMap<>(); metrics.put(buildMetricName("numDatastreamTasks"), _numDatastreamTasks); Optional.of(MysqlBinlogEventListener.getMetrics()).ifPresent(metrics::putAll); Optional.of(MysqlSourceBinlogRowEventFilter.getMetrics()).ifPresent(metrics::putAll); return Collections.unmodifiableMap(metrics); }
Source:
<code>public void initMethod() { session.execute("TRUNCATE tenants"); session.execute("TRUNCATE data"); session.execute(String.format("TRUNCATE %s", DataAccessImpl.OUT_OF_ORDER_TABLE_NAME)); session.execute("TRUNCATE data_compressed"); session.execute("TRUNCATE metrics_idx"); session.execute("TRUNCATE retentions_idx"); session.execute("TRUNCATE metrics_tags_idx"); session.execute("TRUNCATE leases"); for (TableMetadata tableMetadata : session.getCluster().getMetadata().getKeyspace(session.getLoggedKeyspace()) .getTables()) { if(tableMetadata.getName().startsWith(DataAccessImpl.TEMP_TABLE_NAME_PROTOTYPE)) { try { session.execute(String.format("TRUNCATE %s", tableMetadata.getName())); <START> } catch (Exception e) { <END> } } } NumericDataPointCollector.createPercentile = defaultCreatePercentile; }</code><technical_language>part of this PR</technical_language>

Target:
public void initMethod() { session.execute("TRUNCATE tenants"); session.execute("TRUNCATE data"); session.execute(String.format("TRUNCATE %s", DataAccessImpl.OUT_OF_ORDER_TABLE_NAME)); session.execute("TRUNCATE data_compressed"); session.execute("TRUNCATE metrics_idx"); session.execute("TRUNCATE retentions_idx"); session.execute("TRUNCATE metrics_tags_idx"); session.execute("TRUNCATE leases"); for (TableMetadata tableMetadata : session.getCluster().getMetadata().getKeyspace(session.getLoggedKeyspace()) .getTables()) { if(tableMetadata.getName().startsWith(DataAccessImpl.TEMP_TABLE_NAME_PROTOTYPE)) { session.execute(String.format("TRUNCATE %s", tableMetadata.getName())); } } NumericDataPointCollector.createPercentile = defaultCreatePercentile; }
Source:
<code>public void readData(ObjectDataInput in) throws IOException { key = IOUtil.readObject(in); value = IOUtil.readObject(in); creationTime = in.readLong(); hits = in.readLong(); lastAccessTime = in.readLong(); lastUpdateTime = in.readLong(); ttl = in.readLong(); <START> maxIdle = in.readLong(); <END> }</code><technical_language>RU compatibility</technical_language>

Target:
public void readData(ObjectDataInput in) throws IOException { key = IOUtil.readObject(in); value = IOUtil.readObject(in); creationTime = in.readLong(); hits = in.readLong(); lastAccessTime = in.readLong(); lastUpdateTime = in.readLong(); ttl = in.readLong(); if (in.getVersion().isGreaterOrEqual(V3_11)) { maxIdle = in.readLong(); } }
Source:
<code><START> private DataTypeHelper() { <END> }</code><technical_language>throw IllegalAccessError private constructors invoked reflection</technical_language>

Target:
private DataTypeHelper() { throw new IllegalAccessError(); }
Source:
<code>private SortedMap<byte[], RowResult<byte[]>> filterRowResults(TableReference tableRef, Map<Cell, Value> rawResults, ImmutableMap.Builder<Cell, byte[]> result) { getWithPostFiltering(tableRef, rawResults, result, Value.GET_VALUE); <START> Map<Cell, byte[]> withDeletedValues = result.build(); <END> Map<Cell, byte[]> filterDeletedValues = Maps.filterValues(result.build(), Predicates.not(Value.IS_EMPTY)); getMeter(AtlasDbMetricNames.CellFilterMetrics.EMPTY_VALUE, tableRef) .mark(withDeletedValues.size() - filterDeletedValues.size()); return RowResults.viewOfSortedMap(Cells.breakCellsUpByRow(filterDeletedValues)); }</code><technical_language>code reuse <LINK_0></technical_language>

Target:
private SortedMap<byte[], RowResult<byte[]>> filterRowResults(TableReference tableRef, Map<Cell, Value> rawResults, ImmutableMap.Builder<Cell, byte[]> result) { getWithPostFiltering(tableRef, rawResults, result, Value.GET_VALUE); Map<Cell, byte[]> filterDeletedValues = removeEmptyColumns(result.build(), tableRef); return RowResults.viewOfSortedMap(Cells.breakCellsUpByRow(filterDeletedValues)); }
Source:
<code>public void init() { criteriaNoQuerySize = Integer.valueOf(properties.getProperty(CRITERIA_NO_QUERY_SIZE, CRITERIA_NO_QUERY_SIZE_ENV, CRITERIA_NO_QUERY_SIZE_DEFAULT)); batchSize = Integer.valueOf(properties.getProperty(BATCH_SIZE, BATCH_SIZE_ENV, BATCH_SIZE_DEFAULT)); String propTypeValue = properties.getProperty(BATCH_TYPE, BATCH_TYPE_ENV, BATCH_TYPE_DEFAULT); switch (propTypeValue) { case "LOGGED": batchType = BatchStatement.Type.LOGGED; break; case "COUNTER": batchType = BatchStatement.Type.COUNTER; break; default: <START> batchType = BatchStatement.Type.UNLOGGED; <END> } }</code><technical_language>need UNLOGGED, correct</technical_language>

Target:
public void init() { criteriaNoQuerySize = Integer.valueOf(properties.getProperty(CRITERIA_NO_QUERY_SIZE, CRITERIA_NO_QUERY_SIZE_ENV, CRITERIA_NO_QUERY_SIZE_DEFAULT)); batchSize = Integer.valueOf(properties.getProperty(BATCH_SIZE, BATCH_SIZE_ENV, BATCH_SIZE_DEFAULT)); }
Source:
<code>private SlaOption parseSlaSetting(final String set, String flowName, List<String> emails) throws ScheduleManagerException { logger.info("Trying to set sla with the following set: " + set); final String[] parts = set.split(",", -1); final String id = parts[0]; final String rule = parts[1]; final String duration = parts[2]; final String emailAction = parts[3]; final String killAction = parts[4]; SlaType type; if (id.length() == 0) { if (rule.equals(SLA_STATUS_SUCCESS)) { type = SlaType.FLOW_SUCCEED; } else { type = SlaType.FLOW_FINISH; } } else { if (rule.equals(SLA_STATUS_SUCCESS)) { type = SlaType.JOB_SUCCEED; } else { type = SlaType.JOB_FINISH; } } HashSet<SlaAction> actions = new HashSet<>(); if (emailAction.equals("true")) { actions.add(SlaAction.ALERT); } if (killAction.equals("true")) { actions.add(SlaAction.KILL); } final Duration dur; try { dur = parseDuration(duration); } catch (final Exception e) { throw new ScheduleManagerException( "Unable to parse duration for a SLA that needs to take actions!", e); } <START> if (actions.size() == 0) { <END> throw new ScheduleManagerException("Unable to create SLA as there is no action set"); } logger.info("Parsing sla as id:" + id + " type:" + type + " sla:" + rule + " Duration:" + duration + " actions:" + actions); return new SlaOptionBuilder(type, flowName, dur).setJobName(id).setActions(actions) .setEmails(emails).createSlaOption(); }</code><technical_language>nit: consider isEmpty()</technical_language>

Target:
private SlaOption parseSlaSetting(final String set, String flowName, List<String> emails) throws ScheduleManagerException { logger.info("Trying to set sla with the following set: " + set); final String[] parts = set.split(",", -1); final String id = parts[0]; final String rule = parts[1]; final String duration = parts[2]; final String emailAction = parts[3]; final String killAction = parts[4]; SlaType type; if (id.length() == 0) { if (rule.equals(SLA_STATUS_SUCCESS)) { type = SlaType.FLOW_SUCCEED; } else { type = SlaType.FLOW_FINISH; } } else { if (rule.equals(SLA_STATUS_SUCCESS)) { type = SlaType.JOB_SUCCEED; } else { type = SlaType.JOB_FINISH; } } HashSet<SlaAction> actions = new HashSet<>(); if (emailAction.equals("true")) { actions.add(SlaAction.ALERT); } if (killAction.equals("true")) { actions.add(SlaAction.KILL); } final Duration dur; try { dur = parseDuration(duration); } catch (final Exception e) { throw new ScheduleManagerException( "Unable to parse duration for a SLA that needs to take actions!", e); } if (actions.isEmpty()) { throw new ScheduleManagerException("Unable to create SLA as there is no action set"); } logger.info("Parsing sla as id:" + id + " type:" + type + " sla:" + rule + " Duration:" + duration + " actions:" + actions); return new SlaOptionBuilder(type, flowName, dur).setJobName(id).setActions(actions) .setEmails(emails).createSlaOption(); }
Source:
<code>public void setOnHeaderClickListener(OnHeaderClickListener listener) { mOnHeaderClickListener = listener; if (mAdapter != null) { if (mOnHeaderClickListener != null) { mAdapter.setOnHeaderClickListener(new AdapterWrapperHeaderClickHandler()); } else { mAdapter.setOnHeaderClickListener(null); } } <START> if (mHeader != null && mOnHeaderClickListener != null) { <END> mHeader.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mOnHeaderClickListener.onHeaderClick( StickyListHeadersListView.this, mHeader, mHeaderPosition, mHeaderId, true); } }); } }</code><technical_language>please move this if (mAdapter != null) check. While current code bugs more clear this effect is adapter present</technical_language>

Target:
public void setOnHeaderClickListener(OnHeaderClickListener listener) { mOnHeaderClickListener = listener; if (mAdapter != null) { if (mOnHeaderClickListener != null) { mAdapter.setOnHeaderClickListener(new AdapterWrapperHeaderClickHandler()); if (mHeader != null) { mHeader.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mOnHeaderClickListener.onHeaderClick( StickyListHeadersListView.this, mHeader, mHeaderPosition, mHeaderId, true); } }); } } else { mAdapter.setOnHeaderClickListener(null); } } }
Source:
<code>public void init() { initState(); <START> AsyncDataProvider.getRedirectServletReportsPage(new <END> AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { setReportBaseUrl((String) returnValue); parseReportsXML(); } })); }</code><technical_language>callback is needed more (the values cached). AsyncDataProvider.getConfigValuePreConverted(ConfigurationValues.RedirectServletReportsPage) get value</technical_language>

Target:
public void init() { initState(); setReportBaseUrl((String) AsyncDataProvider.getConfigValuePreConverted(ConfigurationValues.RedirectServletReportsPage)); parseReportsXML(); }
Source:
<code>public IMUAngularPositionMessage(double[][] rotMat) { this.timestamp = new Date().getTime(); this.rot = rotMat.clone(); <START> this.IMU = 0; <END> }</code><technical_language>set this invalid ID, -1</technical_language>

Target:
public IMUAngularPositionMessage(double[][] rotMat) { this.timestamp = new Date().getTime(); this.rot = rotMat.clone(); this.imuID = -1; }
Source:
<code>public static com.couchbase.client.java.query.dsl.Sort[] createSort(Sort sort, CouchbaseConverter converter) { List<com.couchbase.client.java.query.dsl.Sort> cbSortList = new ArrayList<com.couchbase.client.java.query.dsl.Sort>(); for (Sort.Order order : sort) { String orderProperty = order.getProperty(); Expression orderFieldName = i(orderProperty); if (order.isIgnoreCase()) { <START> orderFieldName = lower(orderFieldName); <END> } if (order.isAscending()) { cbSortList.add(com.couchbase.client.java.query.dsl.Sort.asc(orderFieldName)); } else { cbSortList.add(com.couchbase.client.java.query.dsl.Sort.desc(orderFieldName)); } } return cbSortList.toArray(new com.couchbase.client.java.query.dsl.Sort[cbSortList.size()]); }</code><technical_language>in N1QL a String return null. TOSTRING function well, is accessible TypeFunctions.toString(Expression x) in DSL</technical_language>

Target:
public static com.couchbase.client.java.query.dsl.Sort[] createSort(Sort sort, CouchbaseConverter converter) { List<com.couchbase.client.java.query.dsl.Sort> cbSortList = new ArrayList<com.couchbase.client.java.query.dsl.Sort>(); for (Sort.Order order : sort) { String orderProperty = order.getProperty(); Expression orderFieldName = i(orderProperty); if (order.isIgnoreCase()) { orderFieldName = lower(TypeFunctions.toString(orderFieldName)); } if (order.isAscending()) { cbSortList.add(com.couchbase.client.java.query.dsl.Sort.asc(orderFieldName)); } else { cbSortList.add(com.couchbase.client.java.query.dsl.Sort.desc(orderFieldName)); } } return cbSortList.toArray(new com.couchbase.client.java.query.dsl.Sort[cbSortList.size()]); }
Source:
<code>private void setupHelixClusterConstraints() { String maxMessageLimit = _config.getString(CommonConstants.Helix.CONFIG_OF_HELIX_INSTANCE_MAX_MESSAGES, CommonConstants.Helix.DEFAULT_HELIX_INSTANCE_MAX_MESSAGES); <START> Map<ClusterConstraints.ConstraintAttribute, String> constraintAttributes = Maps.newHashMap(); <END> constraintAttributes.put(ClusterConstraints.ConstraintAttribute.INSTANCE, ".*"); constraintAttributes.put(ClusterConstraints.ConstraintAttribute.MESSAGE_TYPE, "STATE_TRANSITION"); ConstraintItem constraintItem = new ConstraintItem(constraintAttributes, maxMessageLimit); getHelixAdmin().setConstraint(_helixClusterName, ClusterConstraints.ConstraintType.MESSAGE_CONSTRAINT, MAX_MESSAGES_PER_INSTANCE_NAME, constraintItem); }</code><technical_language>need guava for this. experienced backward-incompatible issues guava. suggestion Map<ClusterConstraints.ConstraintAttribute, String> constraintAttributes = new HashMap()<>;</technical_language>

Target:
private void setupHelixClusterConstraints() { String maxStateTransitions = _config .getProperty(CommonConstants.Helix.CONFIG_OF_HELIX_INSTANCE_MAX_STATE_TRANSITIONS, CommonConstants.Helix.DEFAULT_HELIX_INSTANCE_MAX_STATE_TRANSITIONS); Map<ClusterConstraints.ConstraintAttribute, String> constraintAttributes = new HashMap<>(); constraintAttributes.put(ClusterConstraints.ConstraintAttribute.INSTANCE, ".*"); constraintAttributes .put(ClusterConstraints.ConstraintAttribute.MESSAGE_TYPE, Message.MessageType.STATE_TRANSITION.name()); ConstraintItem constraintItem = new ConstraintItem(constraintAttributes, maxStateTransitions); _helixControllerManager.getClusterManagmentTool() .setConstraint(_helixClusterName, ClusterConstraints.ConstraintType.MESSAGE_CONSTRAINT, MAX_STATE_TRANSITIONS_PER_INSTANCE, constraintItem); }
Source:
<code>public void renderHtml(String htmlOutput) { if (StringUtil.isNullOrEmpty(htmlOutput)) return; <START> final RenderTimer renderTimer = new RenderTimer(); <END> presenter_.showCallbackHtml(htmlOutput); }</code><technical_language>create a render timer it</technical_language>

Target:
public void renderHtml(String htmlOutput) { if (StringUtil.isNullOrEmpty(htmlOutput)) return; presenter_.showCallbackHtml(htmlOutput); }
Source:
<code>public SecondaryIndexTable(TransactionServiceClient transactionServiceClient, HTableInterface hTable, byte[] secondaryIndex) { secondaryIndexTableName = TableName.valueOf(hTable.getName().getNameAsString() + ".idx"); HTable secondaryIndexHTable = null; HBaseAdmin hBaseAdmin = null; try { hBaseAdmin = new HBaseAdmin(hTable.getConfiguration()); if (!hBaseAdmin.tableExists(secondaryIndexTableName)) { hBaseAdmin.createTable(new HTableDescriptor(secondaryIndexTableName)); } secondaryIndexHTable = new HTable(hTable.getConfiguration(), secondaryIndexTableName); } catch (Exception e) { Throwables.propagate(e); } finally { try { <START> hBaseAdmin.close(); <END> } catch (Exception e) { Throwables.propagate(e); } } this.secondaryIndex = secondaryIndex; this.transactionAwareHTable = new TransactionAwareHTable(hTable); this.secondaryIndexTable = new TransactionAwareHTable(secondaryIndexHTable); this.transactionContext = new TransactionContext(transactionServiceClient, transactionAwareHTable, secondaryIndexTable); }</code><technical_language>Java 7 ARM syntax. java try (HBaseAdmin admin = new HBaseAdmin(...)) { }</technical_language>

Target:
public SecondaryIndexTable(TransactionServiceClient transactionServiceClient, HTableInterface hTable, byte[] secondaryIndex) { secondaryIndexTableName = TableName.valueOf(hTable.getName().getNameAsString() + ".idx"); HTable secondaryIndexHTable = null; try (HBaseAdmin hBaseAdmin = new HBaseAdmin(hTable.getConfiguration())) { if (!hBaseAdmin.tableExists(secondaryIndexTableName)) { hBaseAdmin.createTable(new HTableDescriptor(secondaryIndexTableName)); } secondaryIndexHTable = new HTable(hTable.getConfiguration(), secondaryIndexTableName); } catch (Exception e) { Throwables.propagate(e); } this.secondaryIndex = secondaryIndex; this.transactionAwareHTable = new TransactionAwareHTable(hTable); this.secondaryIndexTable = new TransactionAwareHTable(secondaryIndexHTable); this.transactionContext = new TransactionContext(transactionServiceClient, transactionAwareHTable, secondaryIndexTable); }