auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public CaseMigrationReportInstance migrateCaseInstance(String containerId, String caseId, String targetContainerId, String payload, String marshallingType) { Map<String, Object> mapping = Collections.emptyMap(); if (payload != null) { logger.debug("About to unmarshal mapping from payload: '{}' using container marshaller", payload, containerId); mapping = marshallerHelper.unmarshal(containerId, payload, marshallingType, Map.class); } if (mapping == null || !mapping.containsKey("ProcessMapping")) { throw new IllegalArgumentException("Case instance migration requires ProcessMapping to be provided"); } Map<String, String> processMapping = (Map<String, String>) mapping.getOrDefault("ProcessMapping", Collections.emptyMap()); <START> Map<String, String> nodeMapping = (Map<String, String>) mapping.getOrDefault("ProcessMapping", Collections.emptyMap()); <END> logger.debug("About to migrate case instance with id from container '{}' to container '{}' with process mapping '{}' and with node mapping {}", caseId, containerId, targetContainerId, processMapping, nodeMapping); CaseMigrationReport report = caseInstanceMigrationService.migrate(caseId, targetContainerId, processMapping, nodeMapping); logger.debug("Migration of case instance finished with report {}", caseId, report); return ConvertUtils.convertCaseMigrationReport(caseId, report); }</code><technical_language>"NodeMapping" I guess</technical_language>

Target:
public CaseMigrationReportInstance migrateCaseInstance(String containerId, String caseId, String targetContainerId, String payload, String marshallingType) { Map<String, Object> mapping = Collections.emptyMap(); if (payload != null) { logger.debug("About to unmarshal mapping from payload: '{}' using container marshaller", payload, containerId); mapping = marshallerHelper.unmarshal(containerId, payload, marshallingType, Map.class); } if (mapping == null || !mapping.containsKey("ProcessMapping")) { throw new IllegalArgumentException("Case instance migration requires ProcessMapping to be provided"); } Map<String, String> processMapping = (Map<String, String>) mapping.get("ProcessMapping"); Map<String, String> nodeMapping = (Map<String, String>) mapping.getOrDefault("NodeMapping", Collections.emptyMap()); logger.debug("About to migrate case instance with id from container '{}' to container '{}' with process mapping '{}' and with node mapping {}", caseId, containerId, targetContainerId, processMapping, nodeMapping); CaseMigrationReport report = caseInstanceMigrationService.migrate(caseId, targetContainerId, processMapping, nodeMapping); logger.debug("Migration of case instance finished with report {}", caseId, report); return ConvertUtils.convertCaseMigrationReport(caseId, report); }
Source:
<code>public static boolean isOptionChecked_inCDT(IProject project, String optionIDString, String parentToolName) { IConfiguration ActiveConf = helper_getActiveConfiguration(project); ITool gccCompileriTool = helper_getGccCompilerTool(parentToolName, ActiveConf); IOption optionTemplate = gccCompileriTool.getOptionById(optionIDString); if (optionTemplate == null) { <START> MessageDialogSyncedRunnable.openErrorSyncedRunnable("Error", "Could not aquire Option template VREF__0000040"); END> return false; } try { IOption MutableOptionToSet = gccCompileriTool.getOptionToSet(optionTemplate, false); boolean value = (boolean) MutableOptionToSet.getValue(); return value; } catch (BuildException e) { MessageDialogSyncedRunnable.openErrorSyncedRunnable("Error", "Failed to get option for writing VREF__0000034"); e.printStackTrace(); } return false; }</code><technical_language>is VREF_ ? This doens't a usable error message me</technical_language>

Target:
public static boolean isOptionChecked_inCDT(IProject project, String optionIDString, String parentToolName) { IConfiguration ActiveConf = helper_getActiveConfiguration(project); ITool gccCompileriTool = helper_getGccCompilerTool(parentToolName, ActiveConf); IOption optionTemplate = gccCompileriTool.getOptionById(optionIDString); if (optionTemplate == null) { MessageDialogSyncedRunnable.openErrorSyncedRunnable("Error", "Could not aquire Option template"); return false; } try { IOption MutableOptionToSet = gccCompileriTool.getOptionToSet(optionTemplate, false); return (boolean) MutableOptionToSet.getValue(); } catch (BuildException e) { MessageDialogSyncedRunnable.openErrorSyncedRunnable("Error", "Failed to get option for writing"); } return false; }
Source:
<code>private void createFiveObservationsForPatientCodeCategory(IIdType thePatientId, String theObservationCode, String theCategoryCode, Integer theTimeOffset) { for (int idx=0; idx<5; idx++ ) { Observation obs = new Observation(); obs.getSubject().setReferenceElement(thePatientId); obs.getCode().addCoding().setCode(theObservationCode).setSystem(codeSystem); obs.setValue(new StringType(theObservationCode + "_0")); <START> Date effectiveDtm = new Date(observationDate.getTimeInMillis() - (3600*1000*(theTimeOffset+idx))); <END> obs.setEffective(new DateTimeType(effectiveDtm)); obs.getCategoryFirstRep().addCoding().setCode(theCategoryCode).setSystem(categorySystem); String observationId = myObservationDao.create(obs, mockSrd()).getId().toUnqualifiedVersionless().getValue(); observationPatientMap.put(observationId, thePatientId.getValue()); observationCategoryMap.put(observationId, theCategoryCode); observationCodeMap.put(observationId, theObservationCode); observationEffectiveMap.put(observationId, effectiveDtm); } }</code><technical_language>is this calculation doing? Consider ripping math out a constant explains purpose</technical_language>

Target:
private void createFiveObservationsForPatientCodeCategory(IIdType thePatientId, String theObservationCode, String theCategoryCode, Integer theTimeOffset) { for (int idx=0; idx<5; idx++ ) { Observation obs = new Observation(); obs.getSubject().setReferenceElement(thePatientId); obs.getCode().addCoding().setCode(theObservationCode).setSystem(codeSystem); obs.setValue(new StringType(theObservationCode + "_0")); Date effectiveDtm = calculateObservationDateFromOffset(theTimeOffset, idx); obs.setEffective(new DateTimeType(effectiveDtm)); obs.getCategoryFirstRep().addCoding().setCode(theCategoryCode).setSystem(categorySystem); String observationId = myObservationDao.create(obs, mockSrd()).getId().toUnqualifiedVersionless().getValue(); observationPatientMap.put(observationId, thePatientId.getValue()); observationCategoryMap.put(observationId, theCategoryCode); observationCodeMap.put(observationId, theObservationCode); observationEffectiveMap.put(observationId, effectiveDtm); } }
Source:
<code>protected List<FormModelCreationContainer> getRegisteredCreationManagers() { List<FormModelCreationContainer> registeredContainers = new ArrayList<>(); <START> SyncBeanDef<FormModelCreationContainer> containerDef = IOC.getBeanManager().lookupBean( <END> FormModelCreationContainer.class ); Collection<SyncBeanDef<FormModelCreationViewManager>> managerDefs = IOC.getBeanManager().lookupBeans( FormModelCreationViewManager.class ); managerDefs.forEach( managerDef -> { FormModelCreationContainer container = containerDef.newInstance(); container.setup( managerDef.newInstance(), aContainer -> selectContainer( aContainer ) ); registeredContainers.add( container ); } ); return registeredContainers; }</code><technical_language>BeanManager means need responsible for instances' destruction too. Errai offers ManagedInstance<T> (equivalent Instance<T>) create instances automatic life-cycle destruction. want consider it</technical_language>

Target:
protected List<FormModelCreationContainer> getRegisteredCreationManagers() { List<FormModelCreationContainer> registeredContainers = new ArrayList<>(); modelManagerInstance.forEach( modelManager -> { FormModelCreationContainer container = containerInstance.get(); container.setup( modelManager, this::selectContainer ); registeredContainers.add( container ); } ); return registeredContainers; }
Source:
<code>public DriverQueryPlan explain(String query, Configuration conf) throws GrillException { checkConfigured(); String rewrittenQuery = rewriteQuery(query,conf); String explainQuery = "explain " + rewrittenQuery; LOG.info("explain " + rewrittenQuery); Configuration explainConf = new Configuration(conf); explainConf.setBoolean(GrillConfConstants.QUERY_PERSISTENT_RESULT_INDRIVER, false); QueryContext explainQueryCtx = new QueryContext(explainQuery, null, explainConf); JdbcQueryContext queryContext = new JdbcQueryContext(explainQueryCtx); queryContext.setPrepared(false); queryContext.setRewrittenQuery(rewrittenQuery); <START> QueryResult result = new QueryCallable(queryContext).call(); <END> if (result.error != null) { throw new GrillException("Query explain failed!", result.error); } return new JDBCQueryPlan(); }</code><technical_language>move this a executeInternal() method call explain execute</technical_language>

Target:
public DriverQueryPlan explain(String query, Configuration conf) throws GrillException { checkConfigured(); String rewrittenQuery = rewriteQuery(query,conf); Configuration explainConf = new Configuration(conf); explainConf.setBoolean(GrillConfConstants.QUERY_PERSISTENT_RESULT_INDRIVER, false); String explainQuery = explainConf.get(JDBC_EXPLAIN_KEYWORD) + rewrittenQuery; LOG.info("Explain Query : " + explainQuery); QueryContext explainQueryCtx = new QueryContext(explainQuery, null, explainConf); QueryResult result = executeInternal(explainQueryCtx,explainQuery); if (result.error != null) { throw new GrillException("Query explain failed!", result.error); } return new JDBCQueryPlan(); }
Source:
<code>public boolean create(Identifier identifierRecord) { LOG.trace("IdentifierDAO.create() - Begin"); <START> boolean result = true; <END> if (identifierRecord != null) { result = super.create(identifierRecord); } LOG.trace("IdentifierDAO.create() - End"); return result; }</code><technical_language>need declare result</technical_language>

Target:
public boolean create(Identifier identifierRecord) { LOG.trace("IdentifierDAO.create()"); return identifierRecord != null ? super.create(identifierRecord) : true; }
Source:
<code>private void purgeReportRecords() { Calendar deadline = Calendar.getInstance(); deadline.add(Calendar.YEAR, ONE_YEAR_AGO); <START> log.info("Starting scan for Report entries, older than: " + deadline.getTime()); <END> ReportDao reportDao = new ReportDao(); List<Report> reportList = reportDao.list("all"); int retirees = 0; for (Report item : reportList) { if (item.getCreatedDateTime() != null && deadline.getTime().after(item.getCreatedDateTime())) { log.info("Deleting old Report entry: " + item.getKey().getId()); SurveyTaskUtil.spawnDeleteTask(SurveyTaskRequest.DELETE_REPORT_ACTION, item.getKey().getId()); retirees++; } } log.info("Attempted to retire " + retirees + " of " + reportList.size()); }</code><technical_language>change this debug well</technical_language>

Target:
private void purgeReportRecords() { Calendar deadline = Calendar.getInstance(); deadline.add(Calendar.YEAR, ONE_YEAR_AGO); log.fine("Starting scan for Report entries, older than: " + deadline.getTime()); ReportDao reportDao = new ReportDao(); List<Report> reportList = reportDao.listAllCreatedBefore(deadline.getTime()); log.fine("Attempting to retire " + reportList.size() + " old Report entries"); reportDao.delete(reportList); }
Source:
<code>public synchronized byte[] evaluateResponse(final byte[] response) throws SaslException { <START> try { <END> final byte[] challenge = delegate.evaluateResponse(response); if (isComplete() && ! complete) { complete = true; cancelTimeoutTask(); } return challenge; } catch (SaslException | RuntimeException | Error e) { if (isComplete() && ! complete) { complete = true; cancelTimeoutTask(); } throw e; } }</code><technical_language>problem - if authentication in fact time out, this method failing calling delegate (as easily called timeout occurred). delegate in fact invalid in this case (as disposed) some undesirable behavior a result</technical_language>

Target:
public synchronized byte[] evaluateResponse(final byte[] response) throws SaslException { if (terminated) { throw log.mechServerTimedOut(getMechanismName()).toSaslException(); } try { final byte[] challenge = delegate.evaluateResponse(response); if (isComplete() && ! complete) { complete = true; cancelTimeoutTask(); } return challenge; } catch (SaslException | RuntimeException | Error e) { if (isComplete() && ! complete) { complete = true; cancelTimeoutTask(); } throw e; } }
Source:
<code>public static void register(Essentials plugin) { <START> if (!((Reserve)Bukkit.getServer().getPluginManager().getPlugin("Reserve")).economyProvided()) { <END> Reserve.instance().registerProvider(new ReserveEssentials(plugin)); } }</code><technical_language>suggestion if (!((Reserve) Bukkit.getServer().getPluginManager().getPlugin("Reserve")).economyProvided()) {</technical_language>

Target:
public static void register(Essentials plugin) { Reserve.instance().registerProvider(new ReserveEssentials(plugin)); }
Source:
<code>private void runOrQueueRunnable(Runnable runnable, long scheduledTime) { if(isExecutingRunnable) { queueRunnableAndSort(runnable, scheduledTime); return; } isExecutingRunnable = true; runnable.run(); <START> isExecutingRunnable = false; <END> }</code><technical_language>I this in a finally block in case runnable throws</technical_language>

Target:
private void runOrQueueRunnable(Runnable runnable, long scheduledTime) { if (isExecutingRunnable) { queueRunnableAndSort(runnable, scheduledTime); return; } isExecutingRunnable = true; try { runnable.run(); } finally { isExecutingRunnable = false; } }
Source:
<code>public V get(K key) { Map<K, V> map = cache.get(); <START> V value = map.get(key); <END> if (value != null) { return value; } value = loader.apply(key); requireNonNull(value, "value must not be null"); map.put(key, value); return value; }</code><technical_language>computeIfAbsent</technical_language>

Target:
public V get(K key) { V value = cache.get().computeIfAbsent(key, loader); return requireNonNull(value, "loader returned null value"); }
Source:
<code><START> private static Set<Symbol> typingModuleSymbols() { <END> Map<String, Symbol> typingPython3 = getModuleSymbols("3/typing.pyi", TYPING); Map<String, Symbol> typingPython2 = getModuleSymbols("2/typing.pyi", TYPING); Set<Symbol> typingModuleSymbols = new HashSet<>(); typingPython3.forEach((fqn, python3Symbol) -> { Symbol python2Symbol = typingPython2.get(fqn); if (python2Symbol == null) { typingModuleSymbols.add(python3Symbol); } else { typingModuleSymbols.add(new SymbolImpl(python3Symbol.name(), python3Symbol.fullyQualifiedName())); } }); typingPython2.forEach((fqn, python2Symbol) -> { if (typingPython3.get(fqn) == null) { typingModuleSymbols.add(python2Symbol); } }); return typingModuleSymbols; }</code><technical_language>Do a test similar for Union & Optional highlight behaviours for Python 3 specific symbols, Python 2 specific symbols overlaps</technical_language>

Target:
static Set<Symbol> typingModuleSymbols() { Map<String, Symbol> typingPython3 = getModuleSymbols("3/typing.pyi", TYPING); Map<String, Symbol> typingPython2 = getModuleSymbols("2/typing.pyi", TYPING); Set<Symbol> typingModuleSymbols = new HashSet<>(); typingPython3.forEach((fqn, python3Symbol) -> { Symbol python2Symbol = typingPython2.get(fqn); if (python2Symbol == null) { typingModuleSymbols.add(python3Symbol); } else { typingModuleSymbols.add(new SymbolImpl(python3Symbol.name(), python3Symbol.fullyQualifiedName())); } }); typingPython2.forEach((fqn, python2Symbol) -> { if (typingPython3.get(fqn) == null) { typingModuleSymbols.add(python2Symbol); } }); return typingModuleSymbols; }
Source:
<code>protected OptionParser buildOptionParser() { OptionParser parser = new OptionParser(); parser.accepts( "config", "location of config file" ).withRequiredArg(); parser.accepts( "__separator_1", "" ); parser.accepts( "database", "database that contains the table to bootstrap").withRequiredArg(); parser.accepts( "table", "table to bootstrap").withRequiredArg(); parser.accepts( "__separator_2", "" ); parser.accepts( "abort", "bootstrap_id to abort" ).withRequiredArg(); <START> parser.accepts( "monitor", "bootstrap_id to abort" ).withRequiredArg(); <END> parser.accepts( "__separator_3", "" ); parser.accepts( "log_level", "log level, one of DEBUG|INFO|WARN|ERROR. default: WARN" ).withRequiredArg(); parser.accepts( "host", "mysql host. default: localhost").withRequiredArg(); parser.accepts( "user", "mysql username. default: maxwell" ).withRequiredArg(); parser.accepts( "password", "mysql password" ).withRequiredArg(); parser.accepts( "port", "mysql port. default: 3306" ).withRequiredArg(); parser.accepts( "schema_database", "database that contains maxwell schema and state").withRequiredArg(); parser.accepts( "help", "display help").forHelp(); BuiltinHelpFormatter helpFormatter = new BuiltinHelpFormatter(200, 4) { @Override public String format(Map<String, ? extends OptionDescriptor> options) { this.addRows(options.values()); String output = this.formattedHelpOutput(); return output.replaceAll("--__separator_.*", ""); } }; parser.formatHelpWith(helpFormatter); return parser; }</code><technical_language>abort -> monitor</technical_language>

Target:
protected OptionParser buildOptionParser() { OptionParser parser = new OptionParser(); parser.accepts( "config", "location of config file" ).withRequiredArg(); parser.accepts( "__separator_1", "" ); parser.accepts( "database", "database that contains the table to bootstrap").withRequiredArg(); parser.accepts( "table", "table to bootstrap").withRequiredArg(); parser.accepts( "__separator_2", "" ); parser.accepts( "abort", "bootstrap_id to abort" ).withRequiredArg(); parser.accepts( "monitor", "bootstrap_id to monitor" ).withRequiredArg(); parser.accepts( "__separator_3", "" ); parser.accepts( "log_level", "log level, one of DEBUG|INFO|WARN|ERROR. default: WARN" ).withRequiredArg(); parser.accepts( "host", "mysql host. default: localhost").withRequiredArg(); parser.accepts( "user", "mysql username. default: maxwell" ).withRequiredArg(); parser.accepts( "password", "mysql password" ).withRequiredArg(); parser.accepts( "port", "mysql port. default: 3306" ).withRequiredArg(); parser.accepts( "schema_database", "database that contains maxwell schema and state").withRequiredArg(); parser.accepts( "help", "display help").forHelp(); BuiltinHelpFormatter helpFormatter = new BuiltinHelpFormatter(200, 4) { @Override public String format(Map<String, ? extends OptionDescriptor> options) { this.addRows(options.values()); String output = this.formattedHelpOutput(); return output.replaceAll("--__separator_.*", ""); } }; parser.formatHelpWith(helpFormatter); return parser; }
Source:
<code>public String toString() { StringBuilder result = new StringBuilder(); result.append("Channel(s): ").append(getNumberOfChannels()); if (getAudioDelay() != 0) { result.append(", Delay: ").append(getAudioDelay()); } <START> return result.toString(); <END> }</code><technical_language>@Sami32 removed result.append(", Sample Frequency: ").append(getSampleFrequency()).append(" Hz"); - I disagree. Remember sample frequency DLNAMediaAudio separate values place another another place. values debugging, if a bug</technical_language>

Target:
public String toString() { StringBuilder result = new StringBuilder(); result.append("Channel(s): ").append(getNumberOfChannels()); result.append(", Sample Frequency: ").append(getSampleFrequency()).append(" Hz"); if (getAudioDelay() != 0) { result.append(", Delay: ").append(getAudioDelay()); } return result.toString(); }
Source:
<code>public Observable<Id> deleteAllEntities(ApplicationScope applicationScope) { <START> if(applicationScope.getApplication().getUuid().equals(CpNamingUtils.MANAGEMENT_APPLICATION_ID)){ <END> throw new IllegalArgumentException("Can't delete from management app"); } Observable appObservable = Observable.just(applicationScope); Observable<Id> countObservable = allEntityIdsObservable.getEntities(appObservable) .doOnNext(entity -> asyncEventService.queueEntityDelete(applicationScope, entity.getId())) .map(entityIdScope -> entityIdScope.getId()); return countObservable; }</code><technical_language>Good call</technical_language>

Target:
public Observable<Id> deleteAllEntities(ApplicationScope applicationScope) { if (applicationScope.getApplication().getUuid().equals(CpNamingUtils.MANAGEMENT_APPLICATION_ID)) { throw new IllegalArgumentException("Can't delete from management app"); } Observable appObservable = Observable.just(applicationScope); EntityCollectionManager entityCollectionManager = entityCollectionManagerFactory.createCollectionManager(applicationScope); GraphManager graphManager = graphManagerFactory.createEdgeManager(applicationScope); MapManager mapManager = getMapManagerForTypes(applicationScope); Observable<Id> countObservable = allEntityIdsObservable.getEntities(appObservable) .map(entityIdScope -> ((EntityIdScope) entityIdScope).getId()) .skip(1) .map(id -> { entityCollectionManager.mark((Id) id) .mergeWith(graphManager.markNode((Id) id, createGraphOperationTimestamp())).toBlocking().last(); return id; }) .doOnNext(id -> deleteAsync(mapManager, applicationScope, (Id) id)); return countObservable; }
Source:
<code>private int sizeExcludingBlobAndCrcSize() { int sizeToReturn = (int) super.sizeInBytes() + blobId.sizeInBytes() + BlobPropertiesSerDe.getBlobPropertiesSerDeSize(properties) + UserMetadata_Size_InBytes + usermetadata.capacity() + Blob_Size_InBytes + BlobType_Size_InBytes; <START> if (getVersionId() == Put_Request_Version_V4) { <END> sizeToReturn += BlobKeyLength_Size_InBytes; if (blobKey != null) { sizeToReturn += blobKey.length; } } return sizeToReturn; }</code><technical_language>todo: remove this check also</technical_language>

Target:
private int sizeExcludingBlobAndCrcSize() { if (sizeExcludingBlobAndCrc == -1) { sizeExcludingBlobAndCrc = (int) super.sizeInBytes() + blobId.sizeInBytes() + BlobPropertiesSerDe.getBlobPropertiesSerDeSize(properties) + USERMETADATA_SIZE_IN_BYTES + usermetadata.capacity() + BLOB_SIZE_IN_BYTES + BLOBTYPE_SIZE_IN_BYTES; if (getVersionId() == PUT_REQUEST_VERSION_V4) { sizeExcludingBlobAndCrc += BLOBKEYLENGTH_SIZE_IN_BYTES; if (blobKey != null) { sizeExcludingBlobAndCrc += blobKey.remaining(); } } } return sizeExcludingBlobAndCrc; }
Source:
<code>private void createSocialOverflow(ViewGroup parent) { <START> SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity()); <END> socialOverflowButtonWrapper = (RelativeLayout) getActivity().getLayoutInflater().inflate(R.layout.navdrawer_overflow_button, parent, false); socialOverflowButton = (ImageButton) socialOverflowButtonWrapper.findViewById(R.id.es_navigationOverflowButton); setSocialOverflowButtonListener(); socialOverflowContainer = new LinearLayout(getContext()); socialOverflowContainer.setOrientation(LinearLayout.VERTICAL); socialOverflowContainer.setVisibility(View.GONE); boolean overflowIsShown = sp.getBoolean(IS_OVERFLOW_SHOWN, false); if (overflowIsShown) { openOverflow(); } else { closeOverflow(); } }</code><technical_language>Please Application.get().getPrefs() in app get shared preferences. Strange happen depending get instance of this, run method ensure consistency</technical_language>

Target:
private void createSocialOverflow(ViewGroup parent) { SharedPreferences sp = Application.getPrefs(); socialOverflowButton = (LinearLayout) getActivity().getLayoutInflater().inflate(R.layout.navdrawer_overflow_button, parent, false); setSocialOverflowButtonListener(); socialOverflowContainer = new LinearLayout(getContext()); socialOverflowContainer.setOrientation(LinearLayout.VERTICAL); socialOverflowContainer.setVisibility(View.GONE); boolean overflowIsShown = sp.getBoolean(IS_OVERFLOW_SHOWN, false); if (overflowIsShown) { openOverflow(); } else { closeOverflow(); } }
Source:
<code>public int decompress(byte[] input, int offset, int length, OutputBuffer output) throws OrcCorruptionException { try { <START> int uncompressedLength = (int) ZstdDecompressor.getDecompressedSize(input, offset, length); <END> if (uncompressedLength > maxBufferSize) { throw new OrcCorruptionException(orcDataSourceId, "Zstd requires buffer (%s) larger than max size (%s)", uncompressedLength, maxBufferSize); } byte[] buffer = output.initialize(uncompressedLength); return decompressor.decompress(input, offset, length, buffer, 0, buffer.length); } catch (MalformedInputException e) { throw new OrcCorruptionException(e, orcDataSourceId, "Invalid compressed stream"); } }</code><technical_language>I change this toIntExact</technical_language>

Target:
public int decompress(byte[] input, int offset, int length, OutputBuffer output) throws OrcCorruptionException { try { long uncompressedLength = ZstdDecompressor.getDecompressedSize(input, offset, length); if (uncompressedLength > maxBufferSize) { throw new OrcCorruptionException(orcDataSourceId, "Zstd requires buffer (%s) larger than max size (%s)", uncompressedLength, maxBufferSize); } byte[] buffer = output.initialize(toIntExact(uncompressedLength)); return decompressor.decompress(input, offset, length, buffer, 0, buffer.length); } catch (MalformedInputException e) { throw new OrcCorruptionException(e, orcDataSourceId, "Invalid compressed stream"); } }
Source:
<code>public static Object checkAndCopy(Object val) { if (val == null) { } else if (val instanceof Number && !(val instanceof BigDecimal)) { } else if (val instanceof Boolean) { } else if (val instanceof String) { } else if (val instanceof Character) { } else if (val instanceof CharSequence) { val = val.toString(); } else if (val instanceof JsonObject) { val = ((JsonObject) val).copy(); } else if (val instanceof JsonArray) { val = ((JsonArray) val).copy(); } else if (val instanceof Map) { val = (new JsonObject((Map) val)).copy(); } else if (val instanceof List) { val = (new JsonArray((List) val)).copy(); <START> } else if (val instanceof byte[]) { <END> val = BASE64_ENCODER.encodeToString((byte[]) val); } else if (val instanceof Instant) { val = ISO_INSTANT.format((Instant) val); } else if (val instanceof Enum) { val = ((Enum) val).name(); } else { throw new IllegalStateException("Illegal type in Json: " + val.getClass()); } return val; }</code><technical_language>want encode instead encoder do</technical_language>

Target:
public static Object checkAndCopy(Object val) { if (val == null) { } else if (val instanceof Number && !(val instanceof BigDecimal)) { } else if (val instanceof Boolean) { } else if (val instanceof String) { } else if (val instanceof Character) { } else if (val instanceof CharSequence) { val = val.toString(); } else if (val instanceof JsonObject) { val = ((JsonObject) val).copy(); } else if (val instanceof JsonArray) { val = ((JsonArray) val).copy(); } else if (val instanceof Map) { val = (new JsonObject((Map) val)).copy(); } else if (val instanceof List) { val = (new JsonArray((List) val)).copy(); } else if (val instanceof byte[]) { } else if (val instanceof Instant) { } else if (val instanceof Enum) { } else { throw new IllegalStateException("Illegal type in Json: " + val.getClass()); } return val; }
Source:
<code>public void next(T value) { <START> fluxSink.tryEmitNext(value).orThrow(); <END> }</code><technical_language>Sound judgement @stefanvozd, thanks for elaborating :+1:</technical_language>

Target:
public void next(T value) { fluxSink.next(value); }
Source:
<code>private boolean modifyOne(final Change.Id changeId) throws NoSuchChangeException, UnloggedFailure, OrmException, EmailException, Exception { final ChangeControl changeControl = changeControlFactory.validateFor(changeId); boolean ok = true; for (final Account.Id accountId: reviewersToRemove) { final ReviewerResult result = removeReviewerFactory.create(changeId, accountId).call(); for (ReviewerResult.Error resultError : result.getErrors()) { if (resultError.getType() == ReviewerResult.Error.Type.COULD_NOT_REMOVE) { final String message = resultError.getName(); String regex = accountId + "$"; if (message.matches("^.* " + regex)) { <START> writeError("error: " + message.replaceAll(regex, "\"" + allReviewers.get(accountId)) + "\"\n"); <END> } else { writeError("error: " + "\"" + allReviewers.get(accountId) + "\" could not be removed\n"); } ok = false; } } } final ReviewerResult result = addReviewerFactory.create(changeId, reviewersToAdd).call(); for (ReviewerResult.Error resultError : result.getErrors()) { ok = false; writeError("\"" + resultError.getName() + "\" could not be added\n"); } return ok; }</code><technical_language>cleaner refactor ReviewerResult store Account.Id of message string, play regex games here</technical_language>

Target:
private boolean modifyOne(final Change.Id changeId) throws NoSuchChangeException, UnloggedFailure, OrmException, EmailException, Exception { final ChangeControl changeControl = changeControlFactory.validateFor(changeId); boolean ok = true; for (final String nameOrEmail: reviewersToRemove) { final Account account = accountResolver.find(nameOrEmail); if (account == null) { writeError("error: reviewer does not exist \"" + nameOrEmail + "\"\n"); continue; } Account.Id accountId = account.getId(); final ReviewerResult result = removeReviewerFactory.create(changeId, accountId).call(); for (ReviewerResult.Error resultError : result.getErrors()) { if (resultError.getType() == ReviewerResult.Error.Type.COULD_NOT_REMOVE) { final String message = resultError.getName(); String regex = accountId + "$"; if (message.matches("^.* " + regex)) { writeError("error: " + message.replaceAll(regex, "\"" + nameOrEmail + "\"\n")); } else { writeError("error: " + "\"" + nameOrEmail + "\" could not be removed\n"); } ok = false; } } } final ReviewerResult result = addReviewerFactory.create(changeId, reviewersToAdd).call(); for (ReviewerResult.Error resultError : result.getErrors()) { ok = false; String message; switch (resultError.getType()) { case ACCOUNT_NOT_FOUND: message = "account not found"; break; case ACCOUNT_INACTIVE: message = "account inactive"; break; case CHANGE_NOT_VISIBLE: message = "change is not visible to user"; break; default: message = "could not add reviewer"; } writeError("error: " + message + "\"" + resultError.getName() + "\"\n"); } return ok; }
Source:
<code>protected void executeQueryCommand() { HashMap<String, List<String>> namespacesMap = new HashMap<>(); for (ExtensionProxy authz: EngineExtensionsManager.getInstance().getExtensionsByService(Authz.class.getName())) { <START> for (String namespace : authz.getContext().get(Authz.ContextKeys.AVAILABLE_NAMESPACES, (Collection<String>)Collections.<String>emptyList())) { <END> MultiValueMapUtils.addToMap(AuthzUtils.getName(authz), namespace, namespacesMap); } } for (List<String> entry : namespacesMap.values()) { Collections.sort(entry); } setReturnValue(namespacesMap); }</code><technical_language>I unsure need this well</technical_language>

Target:
protected void executeQueryCommand() { HashMap<String, List<String>> namespacesMap = new HashMap<>(); for (ExtensionProxy authz: EngineExtensionsManager.getInstance().getExtensionsByService(Authz.class.getName())) { for (String namespace : authz.getContext().<Collection<String>>get(Authz.ContextKeys.AVAILABLE_NAMESPACES, Collections.<String>emptyList())) { MultiValueMapUtils.addToMap(AuthzUtils.getName(authz), namespace, namespacesMap); } } for (List<String> entry : namespacesMap.values()) { Collections.sort(entry); } setReturnValue(namespacesMap); }
Source:
<code>private boolean isGenericIdpLinkingFlow(@NonNull String providerId) { <START> return !AuthUI.SOCIAL_PROVIDERS.contains(providerId) <END> && mRequestedSignInCredential != null && getAuth().getCurrentUser() != null && !getAuth().getCurrentUser().isAnonymous(); }</code><technical_language>I checks provider is in SOCIAL_PROVIDERS. I a positive assertion better. GENERIC_PROVIDERS.contaains(providerid)</technical_language>

Target:
private boolean isGenericIdpLinkingFlow(@NonNull String providerId) { return AuthUI.SUPPORTED_OAUTH_PROVIDERS.contains(providerId) && mRequestedSignInCredential != null && getAuth().getCurrentUser() != null && !getAuth().getCurrentUser().isAnonymous(); }
Source:
<code>private FormattedDomain parseDomain(Domain domain) { ImmutableList.Builder<FormattedRange> formattedRanges = ImmutableList.builder(); Type type = domain.getType(); domain.getValues().getValuesProcessor().consume( ranges -> formattedRanges.addAll( ranges.getOrderedRanges().stream() .map(range -> new FormattedRange(formatMarker(range.getLow()), formatMarker(range.getHigh()))) .collect(toImmutableList())), discreteValues -> formattedRanges.addAll( discreteValues.getValues().stream() .map(value -> castToVarchar(type, value)) <START> .sorted() END> .map(value -> new FormattedMarker(Optional.of(value), EXACTLY)) .map(marker -> new FormattedRange(marker, marker)) .collect(toImmutableList())), allOrNone -> {}); return new FormattedDomain(domain.isNullAllowed(), formattedRanges.build()); }</code><technical_language>underlying is orderable in this case. argue a predictable order is beneficial. this is a good idea. do want give user expectation able deliver. Sorting string representation this downside of appears working breaks surprising times</technical_language>

Target:
private FormattedDomain parseDomain(Domain domain) { ImmutableSet.Builder<FormattedRange> formattedRanges = ImmutableSet.builder(); Type type = domain.getType(); domain.getValues().getValuesProcessor().consume( ranges -> formattedRanges.addAll( ranges.getOrderedRanges().stream() .map(range -> new FormattedRange(formatMarker(range.getLow()), formatMarker(range.getHigh()))) .collect(toImmutableSet())), discreteValues -> formattedRanges.addAll( discreteValues.getValues().stream() .map(value -> getVarcharValue(type, value)) .map(value -> new FormattedMarker(Optional.of(value), EXACTLY)) .map(marker -> new FormattedRange(marker, marker)) .collect(toImmutableSet())), allOrNone -> { throw new IllegalStateException("Unreachable AllOrNone consumer"); }); return new FormattedDomain(domain.isNullAllowed(), formattedRanges.build()); }
Source:
<code>public void testUsingIteratorButPartitionOccursBeforeRetrievingRemoteValues() throws Exception { Cache<MagicKey, String> cache0 = cache(0); cache0.put(new MagicKey(cache(1), cache(2)), "not-local"); cache0.put(new MagicKey(cache(0), cache(1)), "local"); CheckPoint iteratorCP = new CheckPoint(); iteratorCP.triggerForever(Mocks.BEFORE_RELEASE); blockUntilRemoteNodesRespond(iteratorCP, cache0, TestingUtil.extractGlobalComponent(cache0.getCacheManager(), <START> Executor.class, KnownComponentNames.BLOCKING_EXECUTOR)); <END> try (CloseableIterator<?> iterator = Closeables.iterator(cache0.entrySet().stream())) { CheckPoint partitionCP = new CheckPoint(); blockNotifierPartitionStatusChanged(partitionCP, cache0); partitionCP.triggerForever(Mocks.BEFORE_RELEASE); partitionCP.triggerForever(Mocks.AFTER_RELEASE); splitCluster(new int[]{0, 1}, new int[]{2, 3}); partitionCP.awaitStrict(Mocks.AFTER_INVOCATION, 10, TimeUnit.SECONDS); iteratorCP.triggerForever(Mocks.AFTER_RELEASE); try { while (iterator.hasNext()) { iterator.next(); } fail("Expected AvailabilityException"); } catch (AvailabilityException e) { } } }</code><technical_language>I suggest extracting a variable for executor. Currently CheckPoint.future() executor parameter, block main thread triggering event, I if executor a CheckPoint constructor parameter AbstractInfinispanTest.testExecutor()</technical_language>

Target:
public void testUsingIteratorButPartitionOccursBeforeRetrievingRemoteValues() throws Exception { Cache<MagicKey, String> cache0 = cache(0); cache0.put(new MagicKey(cache(1), cache(2)), "not-local"); cache0.put(new MagicKey(cache(0), cache(1)), "local"); CheckPoint iteratorCP = new CheckPoint(); iteratorCP.triggerForever(Mocks.BEFORE_RELEASE); registerBlockingRpcManagerOnInitialPublisherCommand(iteratorCP, cache0, testExecutor()); try (CloseableIterator<?> iterator = Closeables.iterator(cache0.entrySet().stream())) { CheckPoint partitionCP = new CheckPoint(); registerBlockingCacheNotifierOnDegradedMode(partitionCP, cache0); partitionCP.triggerForever(Mocks.BEFORE_RELEASE); partitionCP.triggerForever(Mocks.AFTER_RELEASE); splitCluster(new int[]{0, 1}, new int[]{2, 3}); partitionCP.awaitStrict(Mocks.AFTER_INVOCATION, 10, TimeUnit.SECONDS); iteratorCP.triggerForever(Mocks.AFTER_RELEASE); try { while (iterator.hasNext()) { iterator.next(); } fail("Expected AvailabilityException"); } catch (AvailabilityException e) { } } }
Source:
<code>public RouterConfig(VerifiableProperties verifiableProperties) { <START> routerScalingUnitCount = verifiableProperties.getInt("router.scaling.unit.count", 1); <END> routerHostname = verifiableProperties.getString("router.hostname"); routerDatacenterName = verifiableProperties.getString("router.datacenter.name"); routerMaxConnectionsPerPortPlainText = verifiableProperties.getIntInRange("router.max.connections.per.port.plain.text", 5, 1, 20); routerMaxConnectionsPerPortSSL = verifiableProperties.getIntInRange("router.max.connections.per.port.ssl", 2, 1, 20); routerMaxChunkSize = verifiableProperties.getInt("router.max.chunk.size", 4*1024*1024); }</code><technical_language>getIntInRange() avoid negatives (I I function existed I wrote this)</technical_language>

Target:
public RouterConfig(VerifiableProperties verifiableProperties) { routerScalingUnitCount = verifiableProperties.getIntInRange("router.scaling.unit.count", 1, 0, 10); routerHostname = verifiableProperties.getString("router.hostname"); routerDatacenterName = verifiableProperties.getString("router.datacenter.name"); routerMaxConnectionsPerPortPlainText = verifiableProperties.getIntInRange("router.max.connections.per.port.plain.text", 5, 1, 20); routerMaxConnectionsPerPortSsl = verifiableProperties.getIntInRange("router.max.connections.per.port.ssl", 2, 1, 20); routerMaxPutChunkSizeBytes = verifiableProperties.getInt("router.max.put.chunk.size.bytes", 4 * 1024 * 1024); }
Source:
<code>public void processing_englishStandardDate_shouldWork() throws Exception { List<Date> output = target.processing("19 January 1983"); assertThat(output, hasSize(1)); final Date date = output.get(0); assertThat(date.getDay(), is(19)); assertThat(date.getMonth(), is(1)); assertThat(date.getYear(), is(1983)); assertThat(date.getDayString(), is("19")); assertThat(date.getMonthString(), is("January")); assertThat(date.getYearString(), is("1983")); <START> System.out.println(output.get(0)); <END> }</code><technical_language>remove assert ;-)</technical_language>

Target:
public void processing_englishStandardDate_shouldWork() throws Exception { List<Date> output = target.processing("19 January 1983"); assertThat(output, hasSize(1)); final Date date = output.get(0); assertThat(date.getDay(), is(19)); assertThat(date.getMonth(), is(1)); assertThat(date.getYear(), is(1983)); assertThat(date.getDayString(), is("19")); assertThat(date.getMonthString(), is("January")); assertThat(date.getYearString(), is("1983")); }
Source:
<code>private Model createModel(){ Model model = new Model(); model.setArtifactId("temp-project"); model.setVersion("1.0"); <START> model.setGroupId("org.temp"); <END> model.setPackaging("pom"); model.setModelVersion("4.0.0"); return model; }</code><technical_language>unique maven repo. Please change org.openmrs:openmrs-sdk-server-{serverId}:1.0.0-SNAPSHOT</technical_language>

Target:
private Model createModel(){ Model model = new Model(); model.setArtifactId(String.format("openmrs-sdk-server-%s", serverId)); model.setVersion("1.0.0-SNAPSHOT"); model.setGroupId("org.openmrs"); model.setPackaging("pom"); model.setModelVersion("4.0.0"); return model; }
Source:
<code>private void validateDuplicateAgents(ValidationContext validationContext) { ArrayList<String> allAgents = new ArrayList<>(); for (EnvironmentConfig part : this) { for (EnvironmentAgentConfig agent : part.getAgents()) { if (allAgents.contains(agent.getUuid())) { String message = String.format("Environment agent '%s' is defined more than once.", agent.getUuid()); <START> configErrors.add("pipeline", message); <END> } else { allAgents.add(agent.getUuid()); } } } }</code><technical_language>I guess key agent, pipeline</technical_language>

Target:
private void validateDuplicateAgents(ValidationContext validationContext) { ArrayList<String> allAgents = new ArrayList<>(); for (EnvironmentConfig part : this) { for (EnvironmentAgentConfig agent : part.getAgents()) { if (allAgents.contains(agent.getUuid())) { String message = String.format("Environment agent '%s' is defined more than once.", agent.getUuid()); configErrors.add("agent", message); } else { allAgents.add(agent.getUuid()); } } } }
Source:
<code>private ValidationResult validateHostIsReadyToRun(final VDS vds, StringBuilder sb, boolean isMigrate) { sb.append(" VDS ").append(vds.getvds_name()).append(" ").append(vds.getId()).append(" "); <START> if (!AttestationCacheManager.exists(vds.gethost_name())){ <END> AttestationValue newValue = new AttestationValue(); newValue.setHostName(vds.gethost_name()); newValue.setTrustLevel(AttestationResult.UNKNOWN); AttestationCacheManager.addToCache(newValue); } for(HostValidator validator : this.hostValidators) { VdcBllMessages result = validator.validate(vds, sb, isMigrate); if(result != null) { return new ValidationResult(result); } } return ValidationResult.VALID; }</code><technical_language>please fix formatting</technical_language>

Target:
private ValidationResult validateHostIsReadyToRun(final VDS vds, StringBuilder sb, boolean isMigrate) { sb.append(" VDS ").append(vds.getvds_name()).append(" ").append(vds.getId()).append(" "); if (!AttestationCacheManager.exists(vds.gethost_name())) { AttestationValue newValue = new AttestationValue(); newValue.setHostName(vds.gethost_name()); newValue.setTrustLevel(AttestationResult.UNKNOWN); AttestationCacheManager.addToCache(newValue); } if (privateVm.isTrustedHostFlag() == true) { hostValidators.add(new HostValidator() { @Override public VdcBllMessages validate(VDS vds, StringBuilder sb, boolean isMigrate) { if (AttestationService.getInstance().validateHostIsTrusted(vds) != AttestationResultEnum.TRUSTED) { sb.append("have failed running this VM in a trusted host"); return VdcBllMessages.ACTION_TYPE_FAILED_VDS_VM_CLUSTER; } return null; } }); } for(HostValidator validator : this.hostValidators) { VdcBllMessages result = validator.validate(vds, sb, isMigrate); if(result != null) { return new ValidationResult(result); } } return ValidationResult.VALID; }
Source:
<code>public static byte[] serializeAuthorizerRoleMap(ObjectMapper objectMapper, Map<String, BasicAuthorizerRole> roleMap) { try { return objectMapper.writeValueAsBytes(roleMap); } catch (IOException ioe) { <START> throw new ISE("WTF? Couldn't serialize roleMap!"); <END> } }</code><technical_language>Please add ioe exception</technical_language>

Target:
public static byte[] serializeAuthorizerRoleMap(ObjectMapper objectMapper, Map<String, BasicAuthorizerRole> roleMap) { try { return objectMapper.writeValueAsBytes(roleMap); } catch (IOException ioe) { throw new ISE(ioe, "WTF? Couldn't serialize roleMap!"); } }
Source:
<code><START> protected boolean checkAndInitializeSdk(@NonNull Activity launcherActivity, @NonNull Map<String, Object> localExtras, @NonNull Map<String, String> serverExtras) throws Exception { <END> if (serverExtras.get("applicationKey") != null) { applicationKey = serverExtras.get("applicationKey"); } else if (serverExtras.get("appKey") != null) { applicationKey = serverExtras.get("appKey"); } if (serverExtras.get("placementName") != null) { placementName = serverExtras.get("placementName"); } if (serverExtras.get("isTestEnabled") != null) { isTestEnabled = Boolean.valueOf(serverExtras.get("isTestEnabled")); } onLog("server extras: " + Arrays.toString(serverExtras.entrySet().toArray())); IronSource.setRewardedVideoListener(sIronSrcRvListener); initIronSourceSDK(launcherActivity); return true; }</code><technical_language>@artemkuzmenko checkAndInitializeSdk() is for initialization. Adapters loading ads (initIronSourceSDK()). this moved loadWithSdkInitialized()</technical_language>

Target:
protected boolean checkAndInitializeSdk(@NonNull Activity launcherActivity, @NonNull Map<String, Object> localExtras, @NonNull Map<String, String> serverExtras) throws Exception { try { String applicationKey = ""; mInstanceId = "0"; if (serverExtras != null) { if (serverExtras.get(APPLICATION_KEY) != null) { applicationKey = serverExtras.get(APPLICATION_KEY); } else if (serverExtras.get(APP_KEY) != null) { applicationKey = serverExtras.get(APP_KEY); } if (serverExtras.get(PLACEMENT_KEY) != null) { mPlacementName = serverExtras.get(PLACEMENT_KEY); } if (serverExtras.get(TEST_ENABLED_KEY) != null) { mIsTestEnabled = Boolean.valueOf(serverExtras.get(TEST_ENABLED_KEY)); } if (serverExtras.get(INSTANCE_ID_KEY) != null) { mInstanceId = serverExtras.get(INSTANCE_ID_KEY); } } if (mInitRewardedVideoSuccessfully) return true; if (!TextUtils.isEmpty(applicationKey)) { onLog("server extras: " + Arrays.toString(serverExtras.entrySet().toArray())); initIronSourceSDK(launcherActivity, applicationKey); } else { onLog("Initialization Failed, make sure that 'applicationKey' server parameter is added"); return false; } return true; } catch (Exception e) { onLog(e.toString()); return false; } }
Source:
<code>protected @Nullable String getOutputFromCommand(List<String> command) { <START> Activator.instance().logInfo(LOG_RUNNING_MESSAGE + ' ' + command.toString()); <END> try { ProcessBuilder builder = new ProcessBuilder(command); builder.redirectErrorStream(true); Process p = builder.start(); try (BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));) { int ret = p.waitFor(); String output = br.lines().collect(Collectors.joining()); return (ret == 0 ? output : null); } } catch (IOException | InterruptedException e) { return null; } }</code><technical_language>too, this LOGGER.info()</technical_language>

Target:
protected @Nullable String getOutputFromCommand(List<String> command) { LOGGER.info(() -> LOG_RUNNING_MESSAGE + ' ' + command.toString()); try { ProcessBuilder builder = new ProcessBuilder(command); builder.redirectErrorStream(true); Process p = builder.start(); try (BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));) { int ret = p.waitFor(); String output = br.lines().collect(Collectors.joining()); return (ret == 0 ? output : null); } } catch (IOException | InterruptedException e) { return null; } }
Source:
<code>private String getSwaggerResource() { if (swaggerResource == null) { try (InputStream is = this.getClass().getResourceAsStream("/mvn.properties")) { Properties p = new Properties(); p.load(is); if (StringUtils.isNotEmpty(p.getProperty("swagger.ui.path"))) { swaggerResource = p.getProperty("swagger.ui.path"); } else { <START> log.log(Level.WARN, "swagger.ui.path is not configured correctly"); <END> swaggerResource = DEFAULT_LIB; } } catch (Exception e) { log.log(Level.WARN, e.getMessage()); swaggerResource = DEFAULT_LIB; } } return swaggerResource; }</code><technical_language>is log.log(Level.Warn,.. in StatusResource.java is log.warn(...? Is same</technical_language>

Target:
private String getSwaggerResource() { if (swaggerResource == null) { try (InputStream is = this.getClass().getResourceAsStream("/mvn.properties")) { Properties p = new Properties(); p.load(is); if (StringUtils.isNotEmpty(p.getProperty("swagger.ui.path"))) { swaggerResource = p.getProperty("swagger.ui.path"); } else { log.warn("swagger.ui.path is not configured correctly"); swaggerResource = DEFAULT_LIB; } } catch (Exception e) { log.warn(e.getMessage()); swaggerResource = DEFAULT_LIB; } } return swaggerResource; }