auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected byte[] idSubmodule(File directory, Entry e) { final String gitDirPath = e.getName() + "/" + Constants.DOT_GIT; final File submoduleGitDir = new File(directory, gitDirPath); if (!submoduleGitDir.isDirectory()) return zeroid; final ObjectId head; try { <START> RepositoryBuilder builder = new RepositoryBuilder(); <END> builder.setMustExist(true); builder.setFS(FS.DETECTED); builder.setGitDir(submoduleGitDir); head = builder.build().resolve(Constants.HEAD); } catch (IOException exception) { return zeroid; } if (head == null) return zeroid; final byte[] id = new byte[Constants.OBJECT_ID_LENGTH]; head.copyRawTo(id, 0); return id; }</code><technical_language>style-nit: chain this call: Repository git = new FileRepositoryBuilder() .setMustExist(true) .setFS(getFS()) .setGitDir(submoduleGitDir) .build(); try { head = git.resolve(Constants.HEAD); } finally { git.close(); }</technical_language>

Target:
protected byte[] idSubmodule(File directory, Entry e) { final String gitDirPath = e.getName() + "/" + Constants.DOT_GIT; final File submoduleGitDir = new File(directory, gitDirPath); if (!submoduleGitDir.isDirectory()) return zeroid; final Repository submoduleRepo; try { FS fs = repository != null ? repository.getFS() : FS.DETECTED; submoduleRepo = new RepositoryBuilder().setGitDir(submoduleGitDir) .setMustExist(true).setFS(fs).setMustExist(true).build(); } catch (IOException exception) { return zeroid; } final ObjectId head; try { head = submoduleRepo.resolve(Constants.HEAD); } catch (IOException exception) { return zeroid; } finally { submoduleRepo.close(); } if (head == null) return zeroid; final byte[] id = new byte[Constants.OBJECT_ID_LENGTH]; head.copyRawTo(id, 0); return id; }
Source:
<code>public void trackStartup() { <START> if (hasTrackedStartup == false) { <END> trackEvent("Application-Startup", null, null); hasTrackedStartup = true; } }</code><technical_language>Reduce noise !hasTrackedStartup</technical_language>

Target:
public void trackStartup() { if (!hasTrackedStartup) { trackEvent("Application-Startup", null, null); hasTrackedStartup = true; } }
Source:
<code><START> public static String trimString(String string, int maxMessageLength) { <END> if (string == null) { return null; } else if (string.length() > maxMessageLength) { return string.substring(0, maxMessageLength); } else { return string; } }</code><technical_language>worth considering ellipisizing this? behavior is consistent other SDKs</technical_language>

Target:
public static String trimString(String string, int maxMessageLength) { if (string == null) { return null; } else if (string.length() > maxMessageLength) { return string.substring(0, maxMessageLength - 3) + "..."; } else { return string; } }
Source:
<code>public void onRenderFinished(RenderFinishedEvent event) { dependencyManager_.withRMarkdown("R Notebook", "Opening R Notebook", new Command() { @Override <START> public void execute() <END> { if (initialChunkDefs_ != null) { for (int i = 0; i < initialChunkDefs_.length(); i++) { createChunkOutput(initialChunkDefs_.get(i)); } if (initialChunkDefs_.length() > 0) loadInitialChunkOutput(); initialChunkDefs_ = null; editingTarget_.addEditorThemeStyleChangedHandler( TextEditingTargetNotebook.this); lastPlotWidth_ = notebookDoc_.getChunkRenderedWidth(); if (lastPlotWidth_ == 0) { lastPlotWidth_ = getPlotWidth(); } } else { syncHeightTimer_.schedule(250); } } }); }</code><technical_language>CommandWithArg<Boolean> variant output repopulation if package versions sufficient</technical_language>

Target:
public void onRenderFinished(RenderFinishedEvent event) { dependencyManager_.withRMarkdown("R Notebook", "Opening R Notebook", new CommandWithArg<Boolean>() { @Override public void execute(Boolean arg) { if (initialChunkDefs_ != null) { for (int i = 0; i < initialChunkDefs_.length(); i++) { createChunkOutput(initialChunkDefs_.get(i)); } if (initialChunkDefs_.length() > 0) loadInitialChunkOutput(); initialChunkDefs_ = null; editingTarget_.addEditorThemeStyleChangedHandler( TextEditingTargetNotebook.this); lastPlotWidth_ = notebookDoc_.getChunkRenderedWidth(); if (lastPlotWidth_ == 0) { lastPlotWidth_ = getPlotWidth(); } } else { syncHeightTimer_.schedule(250); } } } ); }
Source:
<code>public static Tenor of(Period period) { ArgChecker.notNull(period, "period"); int days = period.getDays(); long months = period.toTotalMonths(); if (months > 0 && days > 0) { return new Tenor(period, period.toString().substring(1)); } else if (months > 0) { return ofMonths(Math.toIntExact(months)); } else if (days > 0) { return ofDays(days); } else { <START> throw new IllegalArgumentException("Period must not be negative or zero"); <END> } }</code><technical_language>is reasoning for disallowing a zero tenor? period disallow, code (possibly tests) of</technical_language>

Target:
public static Tenor of(Period period) { ArgChecker.notNull(period, "period"); int days = period.getDays(); long months = period.toTotalMonths(); if (months == 0 && days != 0) { return ofDays(days); } return new Tenor(period, period.toString().substring(1)); }
Source:
<code>void doCompactEntryLogs(double threshold) { LOG.info("Do compaction to compact those files lower than {}", threshold); Comparator<EntryLogMetadata> usageComparator = (m1, m2) -> { double usage1 = m1.getUsage(); double usage2 = m2.getUsage(); return Double.compare(usage1, usage2); }; List<EntryLogMetadata> logsToCompact = new ArrayList<EntryLogMetadata>(); logsToCompact.addAll(entryLogMetaMap.values()); <START> Collections.sort(logsToCompact, usageComparator); <END> for (EntryLogMetadata meta : logsToCompact) { if (meta.getUsage() >= threshold) { break; } if (LOG.isDebugEnabled()) { LOG.debug("Compacting entry log below threshold {}", meta.getEntryLogId(), threshold); } compactEntryLog(meta); if (!running) { return; } } }</code><technical_language>this ? logsToCompact.sort(Comparator.comparing(EntryLogMetadata::getUsage)</technical_language>

Target:
void doCompactEntryLogs(double threshold) { LOG.info("Do compaction to compact those files lower than {}", threshold); List<EntryLogMetadata> logsToCompact = new ArrayList<EntryLogMetadata>(); logsToCompact.addAll(entryLogMetaMap.values()); logsToCompact.sort(Comparator.comparing(EntryLogMetadata::getUsage)); for (EntryLogMetadata meta : logsToCompact) { if (meta.getUsage() >= threshold) { break; } if (LOG.isDebugEnabled()) { LOG.debug("Compacting entry log below threshold {}", meta.getEntryLogId(), threshold); } compactEntryLog(meta); if (!running) { return; } } }
Source:
<code>public static ValueType fromString(String name) { if (name == null) { <START> return ValueType.STRING; <END> } return valueOf(name.toUpperCase()); }</code><technical_language>return null callers deal null want. This default STRING in _all_ cases of deserializing ValueType, unforeseen ideal behavior</technical_language>

Target:
public static ValueType fromString(String name) { if (name == null) { return null; } return valueOf(name.toUpperCase()); }
Source:
<code>private void placeSlimefunBlock(SlimefunItem sfItem, ItemStack item, Block block, Dispenser dispenser) { BlockPlacerPlaceEvent e = new BlockPlacerPlaceEvent(dispenser.getBlock(), item, block); Bukkit.getPluginManager().callEvent(e); <START> if(!dispenser.getInventory().getViewers().isEmpty()){ <END> e.setCancelled(true); } if (!e.isCancelled()) { boolean hasItemHandler = sfItem.callItemHandler(BlockPlaceHandler.class, handler -> { if (handler.isBlockPlacerAllowed()) { block.setType(item.getType()); block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, item.getType()); BlockStorage.store(block, sfItem.getId()); handler.onBlockPlacerPlace(e); if (dispenser.getInventory().containsAtLeast(item, 2)) { dispenser.getInventory().removeItem(new CustomItem(item, 1)); } else { SlimefunPlugin.runSync(() -> dispenser.getInventory().removeItem(item), 2L); } } }); if (!hasItemHandler) { block.setType(item.getType()); block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, item.getType()); BlockStorage.store(block, sfItem.getId()); if (dispenser.getInventory().containsAtLeast(item, 2)) { dispenser.getInventory().removeItem(new CustomItem(item, 1)); } else { SlimefunPlugin.runSync(() -> dispenser.getInventory().removeItem(item), 2L); } } } }</code><technical_language>Formatting, please adhere code style guidelines, a space if curly bracket {</technical_language>

Target:
private void placeSlimefunBlock(SlimefunItem sfItem, ItemStack item, Block block, Dispenser dispenser) { BlockPlacerPlaceEvent e = new BlockPlacerPlaceEvent(dispenser.getBlock(), item, block); Bukkit.getPluginManager().callEvent(e); if (!e.isCancelled()) { boolean hasItemHandler = sfItem.callItemHandler(BlockPlaceHandler.class, handler -> { if (handler.isBlockPlacerAllowed()) { block.setType(item.getType()); block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, item.getType()); BlockStorage.store(block, sfItem.getId()); handler.onBlockPlacerPlace(e); if (dispenser.getInventory().containsAtLeast(item, 2)) { dispenser.getInventory().removeItem(new CustomItem(item, 1)); } else { SlimefunPlugin.runSync(() -> dispenser.getInventory().removeItem(item), 2L); } } }); if (!hasItemHandler) { block.setType(item.getType()); block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, item.getType()); BlockStorage.store(block, sfItem.getId()); if (dispenser.getInventory().containsAtLeast(item, 2)) { dispenser.getInventory().removeItem(new CustomItem(item, 1)); } else { SlimefunPlugin.runSync(() -> dispenser.getInventory().removeItem(item), 2L); } } } }
Source:
<code>public View create(Context context, View convertView, ViewGroup parent, LayoutInflater inflater) { willCreate(); View v = inflater.inflate(R <START> .layout.global_actions_grid_item, parent, false); <END> ImageView icon = (ImageView) v.findViewById(R.id.icon); TextView messageView = (TextView) v.findViewById(R.id.message); TextView statusView = (TextView) v.findViewById(R.id.status); final boolean enabled = isEnabled(); if (messageView != null) { messageView.setText(mMessageResId); messageView.setEnabled(enabled); messageView.setSelected(true); } boolean on = ((mState == State.On) || (mState == State.TurningOn)); if (icon != null) { icon.setImageDrawable(context.getDrawable( (on ? mEnabledIconResId : mDisabledIconResid))); icon.setEnabled(enabled); } if (statusView != null) { statusView.setText(on ? mEnabledStatusMessageResId : mDisabledStatusMessageResId); statusView.setVisibility(View.VISIBLE); statusView.setEnabled(enabled); } v.setEnabled(enabled); return v; }</code><technical_language>need redesign toggle actions status text, new grid items support a single line of text due reduced size</technical_language>

Target:
public View create(Context context, View convertView, ViewGroup parent, LayoutInflater inflater) { willCreate(); View v = inflater.inflate(com.android.systemui.R .layout.global_actions_grid_item, parent, false); ImageView icon = (ImageView) v.findViewById(R.id.icon); TextView messageView = (TextView) v.findViewById(R.id.message); final boolean enabled = isEnabled(); boolean on = ((mState == State.On) || (mState == State.TurningOn)); if (messageView != null) { messageView.setText(on ? mEnabledStatusMessageResId : mDisabledStatusMessageResId); messageView.setEnabled(enabled); messageView.setSelected(true); } if (icon != null) { icon.setImageDrawable(context.getDrawable( (on ? mEnabledIconResId : mDisabledIconResid))); icon.setEnabled(enabled); } v.setEnabled(enabled); return v; }
Source:
<code>private void sendViaPatch(MessageContext msgContext, URL url, String soapActionString) throws AxisFault { HttpClient httpClient = getHttpClient(msgContext); PatchMethod patchMethod = new PatchMethod(); MessageFormatter messageFormatter = populateCommonProperties(msgContext, url, patchMethod, httpClient, soapActionString); patchMethod.setRequestEntity(new AxisRequestEntity(messageFormatter, msgContext, format, soapActionString, chunked, isAllowedRetry)); if (!httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10) && chunked) { patchMethod.setContentChunked(true); } String soapAction = messageFormatter.formatSOAPAction(msgContext, format, soapActionString); if (soapAction != null && !msgContext.isDoingREST()) { patchMethod.setRequestHeader(HTTPConstants.HEADER_SOAP_ACTION, soapAction); } try { executeMethod(httpClient, msgContext, url, patchMethod); handleResponse(msgContext, patchMethod); } catch (IOException e) { <START> log.info("Unable to sendViaPatch to url[" + url + " ]", e); <END> throw AxisFault.makeFault(e); } finally { cleanup(msgContext, patchMethod); } }</code><technical_language>This need error message. log throw. log throw</technical_language>

Target:
private void sendViaPatch(MessageContext msgContext, URL url, String soapActionString) throws AxisFault { HttpClient httpClient = getHttpClient(msgContext); PatchMethod patchMethod = new PatchMethod(); MessageFormatter messageFormatter = populateCommonProperties(msgContext, url, patchMethod, httpClient, soapActionString); patchMethod.setRequestEntity(new AxisRequestEntity(messageFormatter, msgContext, format, soapActionString, chunked, isAllowedRetry)); if (!httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10) && chunked) { patchMethod.setContentChunked(true); } String soapAction = messageFormatter.formatSOAPAction(msgContext, format, soapActionString); if (soapAction != null && !msgContext.isDoingREST()) { patchMethod.setRequestHeader(HTTPConstants.HEADER_SOAP_ACTION, soapAction); } try { executeMethod(httpClient, msgContext, url, patchMethod); handleResponse(msgContext, patchMethod); } catch (IOException e) { String message = "Unable to sendViaPatch to url[" + url + " ]"; throw new AxisFault(message,e); } finally { cleanup(msgContext, patchMethod); } }
Source:
<code>public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) { <START> for(Image image : disposableImages) { <END> image.dispose(); } disposableImages.clear(); checkInfoAndJob(viewer.getDocument()); if (info == null) { try { this.findInfoJob.getValue().join(COMPLETION_TIMEOUT, new NullProgressMonitor()); } catch (InterruptedException e) { LanguageServerPlugin.logError(e); } } ICompletionProposal[] res = new ICompletionProposal[0]; CompletableFuture<Either<List<CompletionItem>, CompletionList>> request = null; try { if (info != null) { TextDocumentPositionParams param = LSPEclipseUtils.toTextDocumentPosistionParams(info.getFileUri(), offset, info.getDocument()); request = info.getLanguageClient().getTextDocumentService().completion(param); res = toProposals(offset, request.get()); } } catch (Exception ex) { LanguageServerPlugin.logError(ex); if (request != null) { res = toProposals(offset, request.getNow(Either.forLeft(Collections.emptyList()))); this.errorMessage = ex.getMessage(); } } return res; }</code><technical_language>I try dispose this image. caching sufficient provide performances for people dealing colors</technical_language>

Target:
public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) { checkInfoAndJob(viewer.getDocument()); if (info == null) { try { this.findInfoJob.getValue().join(COMPLETION_TIMEOUT, new NullProgressMonitor()); } catch (InterruptedException e) { LanguageServerPlugin.logError(e); } } ICompletionProposal[] res = new ICompletionProposal[0]; CompletableFuture<Either<List<CompletionItem>, CompletionList>> request = null; try { if (info != null) { TextDocumentPositionParams param = LSPEclipseUtils.toTextDocumentPosistionParams(info.getFileUri(), offset, info.getDocument()); request = info.getLanguageClient().getTextDocumentService().completion(param); res = toProposals(offset, request.get()); } } catch (Exception ex) { LanguageServerPlugin.logError(ex); if (request != null) { res = toProposals(offset, request.getNow(Either.forLeft(Collections.emptyList()))); this.errorMessage = ex.getMessage(); } } return res; }
Source:
<code>private DbUser getDbUser() { DbUser dbUser = null; switch (getParameters().getQueryType()) { case ByInternalId: dbUser = dbUserDao.get(getParameters().getUserId()); break; case ByPrincipalName: dbUser = getDbUserForPrincipalName(getParameters().getPrincipalName(), getParameters().getAuthzName()); break; case ByExternalId: dbUser = dbUserDao.getByExternalId(getParameters().getAuthzName(), getParameters().getExternalId()); break; } if (dbUser == null) { <START> throw new RuntimeException("User not found in database"); <END> } return dbUser; }</code><technical_language>need fetch user in candoaction. this is user visible command anyway, is batch, engine.log is interface</technical_language>

Target:
private DbUser getDbUser() { DbUser dbUser = null; switch (getParameters().getQueryType()) { case ByInternalId: logInfo = String.format("for internal id %s", getParameters().getUserId()); dbUser = dbUserDao.get(getParameters().getUserId()); break; case ByPrincipalName: logInfo = String.format("for principal name: %s, authz name: %s", getParameters().getPrincipalName(), getParameters().getAuthzName()); dbUser = getDbUserForPrincipalName(getParameters().getPrincipalName(), getParameters().getAuthzName()); break; case ByExternalId: logInfo = String.format("for external id: %s, authz name: %s", getParameters().getExternalId(), getParameters().getAuthzName()); dbUser = dbUserDao.getByExternalId(getParameters().getAuthzName(), getParameters().getExternalId()); break; } if (dbUser == null) { throw new EngineException(EngineError.PRINCIPAL_NOT_FOUND, "User not found in database"); } return dbUser; }
Source:
<code>public static void importNodes( int numRunners, Input input, BatchingNeoStores stores, IdMapper idMapper, ExecutionMonitor executionMonitor, Monitor monitor ) throws IOException { importData( NODE_IMPORT_NAME, numRunners, input.nodes(), stores, () -> <START> new NodeImporter( stores, idMapper, monitor ), executionMonitor, new MemoryUsageStatsProvider( stores, idMapper ) ); <END> }</code><technical_language>methods for creating lambdas? NodeImporter is bad, RelationshipImporter involves a lot of fields</technical_language>

Target:
public static void importNodes( int numRunners, Input input, BatchingNeoStores stores, IdMapper idMapper, ExecutionMonitor executionMonitor, Monitor monitor ) throws IOException { Supplier<EntityImporter> importers = () -> new NodeImporter( stores, idMapper, monitor ); importData( NODE_IMPORT_NAME, numRunners, input.nodes(), stores, importers, executionMonitor, new MemoryUsageStatsProvider( stores, idMapper ) ); }
Source:
<code>public void processImpl() { <START> try { <END> CIBACacheAuthReqIds cibaCacheAuthReqIds = grantService.getCacheCibaAuthReqIds(); for (Map.Entry<String, Long> entry : cibaCacheAuthReqIds.getAuthReqIds().entrySet()) { Date now = new Date(); if (entry.getValue() < now.getTime()) { CIBAGrant cibaGrant = authorizationGrantList.getCIBAGrant(entry.getKey()); if (cibaGrant != null) { processExpiredRequest(cibaGrant); } authorizationGrantList.removeCibaGrantFromProcessorCache(entry.getKey()); } } } catch (Exception e) { log.error("Failed to process CIBA request from cache.", e); } }</code><technical_language>This method means oxauth process single CIBA request period of time. Imagine code Authorization Code Flow in this way. get 1 request instead of hundreds. Yes, stable 1 req/s handle concurrently. (Between, correct code formatter in IDE code have? easier read get merging conflicts.)</technical_language>

Target:
public void processImpl() { try { int chunkSize = appConfiguration.getBackchannelRequestsProcessorJobChunkSize() <= 0 ? CHUNK_SIZE : appConfiguration.getBackchannelRequestsProcessorJobChunkSize(); List<CIBARequest> expiredRequests = cibaRequestService.loadExpiredByStatus( CIBAGrantUserAuthorization.AUTHORIZATION_PENDING, chunkSize); expiredRequests.forEach(cibaRequest -> cibaRequestService.updateStatus(cibaRequest, CIBAGrantUserAuthorization.AUTHORIZATION_IN_PROCESS)); for (CIBARequest expiredRequest : expiredRequests) { CIBAGrant cibaGrant = authorizationGrantList.getCIBAGrant(expiredRequest.getAuthReqId()); if (cibaGrant != null) { executorService.execute(() -> processExpiredRequest(cibaGrant, expiredRequest.getAuthReqId()) ); } cibaRequestService.removeCibaRequest(expiredRequest); } } catch (Exception e) { log.error("Failed to process CIBA request from cache.", e); } }
Source:
<code>public static void UpdateBiosSystemInformation(XmlRpcStruct biosInfo, VDS vds){ vds.sethost_manufacturer(AssignStringValue(biosInfo, VdsProperties.host_manufacturer)); vds.sethost_product_name(AssignStringValue(biosInfo, VdsProperties.host_product_name)); vds.sethost_version(AssignStringValue(biosInfo, VdsProperties.host_version)); vds.sethost_serial_number(AssignStringValue(biosInfo, VdsProperties.host_serial_number)); vds.sethost_uuid(AssignStringValue(biosInfo, VdsProperties.host_uuid)); <START> vds.sethost_family(AssignStringValue(biosInfo, VdsProperties.host_family)); <END> DbFacade.getInstance().getVdsStaticDao().update(vds.getStaticData()); }</code><technical_language>remove update of DB, method convert info retrieved host</technical_language>

Target:
public static void UpdateBiosSystemInformation(XmlRpcStruct biosInfo, VDS vds){ vds.setBiosManufacturer(AssignStringValue(biosInfo, VdsProperties.biosManufacturer)); vds.setBiosProductName(AssignStringValue(biosInfo, VdsProperties.biosProductName)); vds.setBiosVersion(AssignStringValue(biosInfo, VdsProperties.biosVersion)); vds.setBiosSerialNumber(AssignStringValue(biosInfo, VdsProperties.biosSerialNumber)); vds.setBiosUUID(AssignStringValue(biosInfo, VdsProperties.biosUUID)); vds.setBiosFamily(AssignStringValue(biosInfo, VdsProperties.biosFamily)); DbFacade.getInstance().getVdsStaticDao().update(vds.getStaticData()); }
Source:
<code>private String getErrorMessage(String name, String description) { if (savingComponentWithComponents()) { return "To be saved as a component, the configuration must have no components of its own."; } if (name.length() == 0) { return "Name cannot be blank"; } if (!name.matches("^[a-zA-Z].*")) { return "Name must start with a letter"; } if (!name.matches("[a-zA-Z0-9_]*")) { return "Name must only contain alphanumeric characters and underscores"; } if (nameMatchesCurrentConfig(name)) { return "Name matches the current configuration"; } try { if (compInProtectionMode(name) && !model.isInManagerMode()) { <START> return "Component with the name already exisist, try again in Manager mode to overwrite it"; <END> } if (configInProtectionMode(name) && !model.isInManagerMode()) { return "Configuration with the name already exsist, try again in Manager mode to overwrite it"; } } catch (ManagerModePvNotConnectedException e) { MessageDialog error = new MessageDialog(this.getShell(), "Error", null, e.getMessage(), MessageDialog.ERROR, new String[] {"OK"},0); error.open(); } BlockServerNameValidator configDescritpionRules = Configurations.getInstance() .variables().configDescriptionRules.getValue(); SummaryDescriptionValidator descriptionValidator = new SummaryDescriptionValidator(null, configDescritpionRules); IStatus status = descriptionValidator.validate(description); if (!status.isOK()) { return status.getMessage(); } return ""; }</code><technical_language>Typo "exisist"</technical_language>

Target:
private String getErrorMessage(String name, String description) { if (savingComponentWithComponents()) { return "To be saved as a component, the configuration must have no components of its own."; } if (name.length() == 0) { return "Name cannot be blank"; } if (!name.matches("^[a-zA-Z].*")) { return "Name must start with a letter"; } if (!name.matches("[a-zA-Z0-9_]*")) { return "Name must only contain alphanumeric characters and underscores"; } if (nameMatchesCurrentConfig(name)) { return "Name matches the current configuration"; } try { if (compInProtectionMode(name) && !model.isInManagerMode()) { return "Component with the name already exists, try again in Manager mode to overwrite it"; } if (configInProtectionMode(name) && !model.isInManagerMode()) { return "Configuration with the name already exists, try again in Manager mode to overwrite it"; } } catch (ManagerModePvNotConnectedException e) { MessageDialog error = new MessageDialog(this.getShell(), "Error", null, e.getMessage(), MessageDialog.ERROR, new String[] {"OK"},0); error.open(); } BlockServerNameValidator configDescritpionRules = Configurations.getInstance() .variables().configDescriptionRules.getValue(); SummaryDescriptionValidator descriptionValidator = new SummaryDescriptionValidator(null, configDescritpionRules); IStatus status = descriptionValidator.validate(description); if (!status.isOK()) { return status.getMessage(); } return ""; }
Source:
<code>protected Set<ConstraintCheckIssue> doCheck(Element element, AnnotationMirror annotation) { String lang = (String) annotationApiHelper.getAnnotationValue( annotation, "lang" ).getValue(); String script = (String) annotationApiHelper.getAnnotationValue( annotation, "script" ).getValue(); String reportOn = annotationApiHelper.getAnnotationValue( annotation, "reportOn" ) != null ? (String) annotationApiHelper.getAnnotationValue( annotation, "reportOn" ).getValue() : ""; String alias = annotationApiHelper.getAnnotationValue( annotation, "alias" ) != null ? (String) annotationApiHelper.getAnnotationValue( annotation, "alias" ).getValue() : "_this"; Set<ConstraintCheckIssue> issues = CollectionHelper.newHashSet(); if ( ( lang.trim().length() == 0 ) || ( script.trim().length() == 0 ) || ( alias.trim().length() == 0 ) ) { issues.add( ConstraintCheckIssue.error( element, annotation, "INVALID_SCRIPT_ASSERT_ANNOTATION_PARAMETERS" ) ); } if ( !reportOn.isEmpty() ) { boolean hasReportOnField = false; for ( Element member : elementUtils.getAllMembers( (TypeElement) element ) ) { if ( !member.getKind().isField() ) { continue; } if ( member.getSimpleName().toString().equals( reportOn ) ) { hasReportOnField = true; } } if ( !hasReportOnField ) { <START> issues.add( <END> ConstraintCheckIssue.error( element, annotation, "INVALID_SCRIPT_ASSERT_REPORT_ON_ANNOTATION_PARAMETERS", reportOn ) ); } } return issues; }</code><technical_language>a good consideration check presence of field, needed. getPropertyNode() in node builder API mandate property exists, intended pass "fake fields", e.g. for map keys. enforce this here</technical_language>

Target:
protected Set<ConstraintCheckIssue> doCheck(Element element, AnnotationMirror annotation) { String lang = (String) annotationApiHelper.getAnnotationValue( annotation, "lang" ).getValue(); String script = (String) annotationApiHelper.getAnnotationValue( annotation, "script" ).getValue(); String alias = annotationApiHelper.getAnnotationValue( annotation, "alias" ) != null ? (String) annotationApiHelper.getAnnotationValue( annotation, "alias" ).getValue() : "_this"; if ( ( lang.trim().length() == 0 ) || ( script.trim().length() == 0 ) || ( alias.trim().length() == 0 ) ) { return CollectionHelper.asSet( ConstraintCheckIssue.error( element, annotation, "INVALID_SCRIPT_ASSERT_ANNOTATION_PARAMETERS" ) ); } return Collections.emptySet(); }
Source:
<code>public static KijiTableImportDescriptor createFromEffectiveJson(InputStream istream) throws IOException { try { final TableImportDescriptorDesc desc = readTableImportMappingDescFromJSON(istream); final KijiTableImportDescriptor layout = new KijiTableImportDescriptor(desc); return layout; } finally { <START> IOUtils.closeQuietly(istream); <END> } }</code><technical_language>ResourceUtils.closeOrLog(istream)</technical_language>

Target:
public static KijiTableImportDescriptor createFromEffectiveJson(InputStream istream) throws IOException { try { final TableImportDescriptorDesc desc = readTableImportMappingDescFromJSON(istream); final KijiTableImportDescriptor layout = new KijiTableImportDescriptor(desc); return layout; } finally { ResourceUtils.closeOrLog(istream); } }
Source:
<code>public Address read(Long id) { <START> LOG.debug("AddressDAO.read() - Begin"); <END> if (id == null) { LOG.info("-- id Parameter is required for Address Query --"); LOG.debug("AddressDAO.read() - End"); return null; } Address foundRecord = super.read(id, Address.class); LOG.debug("AddressDAO.read() - End"); return foundRecord; }</code><technical_language>Inconsistent log level. one. Stick trace level for in this method</technical_language>

Target:
public Address read(Long id) { LOG.trace("AddressDAO.read() - Begin"); if (id == null) { LOG.trace("-- id Parameter is required for Address Query --"); LOG.trace("AddressDAO.read() - End"); return null; } Address foundRecord = super.read(id, Address.class); LOG.trace("AddressDAO.read() - End"); return foundRecord; }
Source:
<code>private boolean isAnnotationPresentAnywhere(Class<?> clazz) { Set<Annotation> processedAnnotations = new HashSet<>(); return Arrays.stream( clazz.getDeclaredAnnotations() ) .anyMatch( annotation -> isAnnotationAllowed( annotation, processedAnnotations ) ) || Arrays.stream( clazz.getDeclaredFields() ) .flatMap( field -> Arrays.stream( field.getDeclaredAnnotations() ) ) .anyMatch( annotation -> isAnnotationAllowed( annotation, processedAnnotations ) ) || Arrays.stream( clazz.getDeclaredConstructors() ) .flatMap( this::fromExecutable ) .anyMatch( annotation -> isAnnotationAllowed( annotation, processedAnnotations ) ) || Arrays.stream( clazz.getDeclaredMethods() ) .flatMap( this::fromExecutable ) <START> .anyMatch( annotation -> isAnnotationAllowed( annotation, processedAnnotations ) ); <END> }</code><technical_language>I love streams lambdas :) but... avoid is clear benefit is a cost it. In this case, I a bunch of for loops more readable, especially return serve a break</technical_language>

Target:
private boolean isAnnotationPresentAnywhere(Class<?> clazz) { Set<Annotation> processedAnnotations = new HashSet<>(); if ( isAnnotationPresentIn( clazz.getDeclaredAnnotations(), processedAnnotations ) ) { return true; } for ( Field field : clazz.getDeclaredFields() ) { if ( isAnnotationPresent( field.getAnnotatedType(), processedAnnotations ) ) { return true; } if ( isAnnotationPresentIn( field.getDeclaredAnnotations(), processedAnnotations ) ) { return true; } } for ( Constructor<?> constructor : clazz.getDeclaredConstructors() ) { if ( isAnnotationPresentOn( constructor, processedAnnotations ) ) { return true; } } for ( Method method : clazz.getDeclaredMethods() ) { if ( isAnnotationPresentOn( method, processedAnnotations ) ) { return true; } } return false; }
Source:
<code>private Map<String, GlusterServiceStatus> mergeServiceStatusMaps(List<Map<String, GlusterServiceStatus>> serviceStatusMaps) { <START> Map<String, GlusterServiceStatus> serviceStatusMap = new HashMap<String, GlusterServiceStatus>(); <END> for (Map<String, GlusterServiceStatus> pairResult : serviceStatusMaps) { for (Entry<String, GlusterServiceStatus> entry : pairResult.entrySet()) { String serviceName = entry.getKey(); GlusterServiceStatus status = entry.getValue(); GlusterServiceStatus alreadyFoundStatus = serviceStatusMap.get(serviceName); if (alreadyFoundStatus == null) { serviceStatusMap.put(serviceName, status); } else if (alreadyFoundStatus != status && alreadyFoundStatus != GlusterServiceStatus.MIXED) { serviceStatusMap.put(serviceName, GlusterServiceStatus.MIXED); } } } return serviceStatusMap; }</code><technical_language>Suggestion - rename this mergedServiceStatusMap pairResult in loop serviceStatusMap follow this code better</technical_language>

Target:
private Map<String, GlusterServiceStatus> mergeServiceStatusMaps(List<Map<String, GlusterServiceStatus>> serviceStatusMaps) { Map<String, GlusterServiceStatus> mergedServiceStatusMap = new HashMap<String, GlusterServiceStatus>(); for (Map<String, GlusterServiceStatus> serviceStatusMap : serviceStatusMaps) { for (Entry<String, GlusterServiceStatus> entry : serviceStatusMap.entrySet()) { String serviceName = entry.getKey(); GlusterServiceStatus status = entry.getValue(); GlusterServiceStatus alreadyFoundStatus = mergedServiceStatusMap.get(serviceName); if (alreadyFoundStatus == null) { mergedServiceStatusMap.put(serviceName, status); } else if (alreadyFoundStatus != status && alreadyFoundStatus != GlusterServiceStatus.MIXED) { mergedServiceStatusMap.put(serviceName, GlusterServiceStatus.MIXED); } } } return mergedServiceStatusMap; }
Source:
<code>private ConcurrentHashMap<String, ClientRegistration> toConcurrentMap(List<ClientRegistration> registrations) { <START> final ConcurrentHashMap<String, ClientRegistration> result = new ConcurrentHashMap<>(); <END> for (ClientRegistration registration : registrations) { result.put(registration.getRegistrationId(), registration); } return result; }</code><technical_language>For consistency project, please remove final keyword here</technical_language>

Target:
private ConcurrentHashMap<String, ClientRegistration> toConcurrentMap(List<ClientRegistration> registrations) { ConcurrentHashMap<String, ClientRegistration> result = new ConcurrentHashMap<>(); for (ClientRegistration registration : registrations) { result.put(registration.getRegistrationId(), registration); } return result; }
Source:
<code>public static final void assertJenkinsInQuietMode(final JenkinsRule j) { await().pollInterval(250, TimeUnit.MILLISECONDS) .atMost(10, TimeUnit.SECONDS) <START> .until(() -> j.jenkins.get().getQueue().isBlockedByShutdown(task)); <END> }</code><technical_language>suggestion .until(() -> j.jenkins.getQueue().isBlockedByShutdown(task));</technical_language>

Target:
public static final void assertJenkinsInQuietMode(final JenkinsRule j) { await().pollInterval(250, TimeUnit.MILLISECONDS) .atMost(10, TimeUnit.SECONDS) .until(() -> j.jenkins.getQueue().isBlockedByShutdown(task)); }
Source:
<code>public void onTrimMemory(final int level) { boolean evictBitmaps = false; switch (level) { case TRIM_MEMORY_COMPLETE: case TRIM_MEMORY_MODERATE: case TRIM_MEMORY_RUNNING_MODERATE: case TRIM_MEMORY_RUNNING_CRITICAL: case TRIM_MEMORY_RUNNING_LOW: evictBitmaps = true; break; case TRIM_MEMORY_BACKGROUND: case TRIM_MEMORY_UI_HIDDEN: <START> onAppGoesToBackground(); <END> break; default: break; } if (evictBitmaps && mBitmapCache != null) { mBitmapCache.evictAll(); } }</code><technical_language>need check level we? kotlin if (level == ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN) { lifecycleListener.onAppGoesToBackground() }</technical_language>

Target:
public void onTrimMemory(final int level) { boolean evictBitmaps = false; switch (level) { case TRIM_MEMORY_COMPLETE: case TRIM_MEMORY_MODERATE: case TRIM_MEMORY_RUNNING_MODERATE: case TRIM_MEMORY_RUNNING_CRITICAL: case TRIM_MEMORY_RUNNING_LOW: evictBitmaps = true; break; case TRIM_MEMORY_UI_HIDDEN: onAppGoesToBackground(); break; case TRIM_MEMORY_BACKGROUND: default: break; } if (evictBitmaps && mBitmapCache != null) { mBitmapCache.evictAll(); } }
Source:
<code>DistributedDelayQueue ( CuratorFramework client, QueueConsumer<T> consumer, QueueSerializer<T> serializer, String queuePath, ThreadFactory threadFactory, Executor executor, int minItemsBeforeRefresh, String lockPath, int maxItems, boolean putInBackground, int finalFlushMs ) { Preconditions.checkArgument(minItemsBeforeRefresh >= 0, "minItemsBeforeRefresh cannot be negative"); queue = new DistributedQueue<T> ( client, consumer, serializer, queuePath, threadFactory, executor, minItemsBeforeRefresh, true, lockPath, maxItems, putInBackground, finalFlushMs ) { @Override protected long getDelay(String itemNode) { return getDelay(itemNode, System.currentTimeMillis()); } <START> protected long getDelay(String itemNode, long sortTime) <END> { long epoch = getEpoch(itemNode); return epoch - sortTime; } @Override protected void sortChildren(List<String> children) { final long sortTime = System.currentTimeMillis(); Collections.sort ( children, new Comparator<String>() { @Override public int compare(String o1, String o2) { long diff = getDelay(o1, sortTime) - getDelay(o2, sortTime); return (diff < 0) ? -1 : ((diff > 0) ? 1 : 0); } } ); } }; }</code><technical_language>This private, right</technical_language>

Target:
DistributedDelayQueue ( CuratorFramework client, QueueConsumer<T> consumer, QueueSerializer<T> serializer, String queuePath, ThreadFactory threadFactory, Executor executor, int minItemsBeforeRefresh, String lockPath, int maxItems, boolean putInBackground, int finalFlushMs ) { Preconditions.checkArgument(minItemsBeforeRefresh >= 0, "minItemsBeforeRefresh cannot be negative"); queue = new DistributedQueue<T> ( client, consumer, serializer, queuePath, threadFactory, executor, minItemsBeforeRefresh, true, lockPath, maxItems, putInBackground, finalFlushMs ) { @Override protected long getDelay(String itemNode) { return getDelay(itemNode, System.currentTimeMillis()); } private long getDelay(String itemNode, long sortTime) { long epoch = getEpoch(itemNode); return epoch - sortTime; } @Override protected void sortChildren(List<String> children) { final long sortTime = System.currentTimeMillis(); Collections.sort ( children, new Comparator<String>() { @Override public int compare(String o1, String o2) { long diff = getDelay(o1, sortTime) - getDelay(o2, sortTime); return (diff < 0) ? -1 : ((diff > 0) ? 1 : 0); } } ); } }; }
Source:
<code>public T one(final String id) { try { return reactiveSupport.one(id).block(); } catch(DocumentNotFoundException dnfe){ <START> dnfe.printStackTrace(); <END> return null; } }</code><technical_language>this is a leftover I assume</technical_language>

Target:
public T one(final String id) { return reactiveSupport.one(id).block(); }
Source:
<code>public void testGetTrackInfo() throws Exception { prepareLooper(); final List<SessionPlayer.TrackInfo> testTracks = MediaTestUtils.createTrackInfoList(); Bundle playerConfig = RemoteMediaSession.createMockPlayerConnectorConfigForTrackInfo(testTracks); mRemoteSession.updatePlayer(playerConfig); MediaController controller = createController(mRemoteSession.getToken()); List<SessionPlayer.TrackInfo> testTracksFromController = controller.getTrackInfo(); <START> for (int i = 0; i < testTracks.size(); i++) { <END> SessionPlayer.TrackInfo track = testTracks.get(i); SessionPlayer.TrackInfo trackFromController = testTracksFromController.get(i); assertEquals(track, trackFromController); assertEquals(track.getId(), trackFromController.getId()); assertEquals(track.getLanguage(), trackFromController.getLanguage()); assertEquals(track.getTrackType(), trackFromController.getTrackType()); } }</code><technical_language>ditto (compare size)</technical_language>

Target:
public void testGetTrackInfo() throws Exception { prepareLooper(); final List<SessionPlayer.TrackInfo> testTracks = MediaTestUtils.createTrackInfoList(); Bundle playerConfig = RemoteMediaSession.createMockPlayerConnectorConfigForTrackInfo(testTracks); mRemoteSession.updatePlayer(playerConfig); MediaController controller = createController(mRemoteSession.getToken()); List<SessionPlayer.TrackInfo> testTracksFromController = controller.getTrackInfo(); assertEquals(testTracks.size(), testTracksFromController.size()); for (int i = 0; i < testTracks.size(); i++) { SessionPlayer.TrackInfo track = testTracks.get(i); SessionPlayer.TrackInfo trackFromController = testTracksFromController.get(i); assertEquals(track, trackFromController); assertEquals(track.getLanguage(), trackFromController.getLanguage()); assertEquals(track.getTrackType(), trackFromController.getTrackType()); } }
Source:
<code>public void createRelationship(PID subject, Property property, Resource object) { <START> String sparqlUpdate = SparqlUpdateHelper.createSparqlReplace(subject.getRepositoryPath(), property, object); <END> persistTripleToFedora(subject, sparqlUpdate); }</code><technical_language>I suggest making another method named "createExclusiveRelationship", other methods need support repeating relationships, other createRelationship method replace existing relations</technical_language>

Target:
public void createRelationship(PID subject, Property property, Resource object) { String sparqlUpdate = SparqlUpdateHelper.createSparqlInsert(subject.getRepositoryPath(), property, object); persistTripleToFedora(subject, sparqlUpdate); }
Source:
<code>public JsonObject json() { return Json.createObjectBuilder().add("event", this.type).add( "actor", Json.createObjectBuilder().add("login", "test").build() <START> ).add("created_at", "2008-01-14T04:33:35Z").build(); <END> }</code><technical_language>brrr... a current time better</technical_language>

Target:
public JsonObject json() { return Json.createObjectBuilder().add("event", this.type).add( "actor", Json.createObjectBuilder().add("login", "test").build() ).add("created_at", new Github.Time().toString()).build(); }
Source:
<code>public VisitRescheduleDto saveVisitReschedule(VisitRescheduleDto visitRescheduleDto, Boolean ignoreLimitation) { VisitBookingDetails visitBookingDetails = visitBookingDetailsDataService.findById(visitRescheduleDto.getVisitBookingDetailsId()); if (visitBookingDetails == null) { throw new IllegalArgumentException("Cannot reschedule, because details for Visit not found"); } Clinic clinic = visitBookingDetails.getClinic(); if (clinic != null && !ignoreLimitation) { checkNumberOfPatients(visitRescheduleDto, clinic); } Visit visit = visitBookingDetails.getVisit(); if (!visitRescheduleDto.getIgnoreDateLimitation()) { <START> validateDate(visitRescheduleDto, visit); <END> } updateVisitPlannedDate(visit, visitRescheduleDto); return new VisitRescheduleDto(updateVisitDetailsWithDto(visitBookingDetails, visitRescheduleDto)); }</code><technical_language>validateDate check if date is null if is in done checkNumberOfPatients</technical_language>

Target:
public VisitRescheduleDto saveVisitReschedule(VisitRescheduleDto visitRescheduleDto, Boolean ignoreLimitation) { VisitBookingDetails visitBookingDetails = visitBookingDetailsDataService.findById(visitRescheduleDto.getVisitBookingDetailsId()); if (visitBookingDetails == null) { throw new IllegalArgumentException("Cannot reschedule, because details for Visit not found"); } Clinic clinic = visitBookingDetails.getClinic(); Visit visit = visitBookingDetails.getVisit(); validateDate(visitRescheduleDto, visit); if (clinic != null && !ignoreLimitation) { checkNumberOfPatients(visitRescheduleDto, clinic); } updateVisitPlannedDate(visit, visitRescheduleDto); return new VisitRescheduleDto(updateVisitDetailsWithDto(visitBookingDetails, visitRescheduleDto)); }
Source:
<code>public String docs() { return "void {player, url} Sends a resourcepack URL to the player's client." + " If the client has not been requested to change resources in the" + " past, they will recieve a confirmation dialog before downloading" + " and switching to the new pack. Clients that ignore server resources" + " will not recieve the request, so this function will not affect them." <START> + " This function is no longer useful, use send_resourcepack()."; <END> }</code><technical_language>"This function is longer useful, send_resourcepack()." This is send_resourcepack()</technical_language>

Target:
public String docs() { return "void {player, url} Sends a texturepack URL to the player's client." + " If the client has not been requested to change textures in the" + " past, they will recieve a confirmation dialog before downloading" + " and switching to the new pack. Clients that ignore server textures" + " will not recieve the request, so this function will not affect them."; }
Source:
<code>public void xmlFileFailsToLoad() throws Exception { MockFolder folder = r.createFolder("folder"); assertNotNull(folder); AbstractProject project = folder.createProject(FreeStyleProject.class, "job1"); AbstractProject project2 = folder.createProject(FreeStyleProject.class, "job2"); AbstractProject project3 = folder.createProject(FreeStyleProject.class, "job3"); File configFile = project.getConfigFile().getFile(); List<String> lines = FileUtils.readLines(configFile).subList(0, 5); configFile.delete(); FileUtils.writeByteArrayToFile(configFile, lines.toString().getBytes()); for (int i = lines.size() / 2; i < lines.size(); i++) { FileUtils.writeStringToFile(configFile, lines.get(i), true); } r.jenkins.reload(); <START> assertNotNull("Folder failed to load.", folder); <END> assertNull("Job should have failed to load.", r.jenkins.getItemByFullName("folder/job1")); assertNotNull("Other job in folder should have loaded.", r.jenkins.getItemByFullName("folder/job2")); assertNotNull("Other job in folder should have loaded.", r.jenkins.getItemByFullName("folder/job3")); }</code><technical_language>need get folder Jenkins again. this pass</technical_language>

Target:
public void xmlFileFailsToLoad() throws Exception { MockFolder folder = r.createFolder("folder"); assertNotNull(folder); AbstractProject project = folder.createProject(FreeStyleProject.class, "job1"); AbstractProject project2 = folder.createProject(FreeStyleProject.class, "job2"); AbstractProject project3 = folder.createProject(FreeStyleProject.class, "job3"); File configFile = project.getConfigFile().getFile(); List<String> lines = FileUtils.readLines(configFile).subList(0, 5); configFile.delete(); FileUtils.writeByteArrayToFile(configFile, lines.toString().getBytes()); for (int i = lines.size() / 2; i < lines.size(); i++) { FileUtils.writeStringToFile(configFile, lines.get(i), true); } r.jenkins.reload(); assertNotNull("Folder failed to load.", r.jenkins.getItemByFullName("folder")); assertNull("Job should have failed to load.", r.jenkins.getItemByFullName("folder/job1")); assertNotNull("Other job in folder should have loaded.", r.jenkins.getItemByFullName("folder/job2")); assertNotNull("Other job in folder should have loaded.", r.jenkins.getItemByFullName("folder/job3")); }
Source:
<code>private void lubWildcard( AnnotatedTypeMirror type1LowerBound, AnnotatedTypeMirror type1UpperBound, AnnotatedTypeMirror type2LowerBound, AnnotatedTypeMirror type2UpperBound, AnnotatedTypeMirror lubLowerBound, AnnotatedTypeMirror lubUpperBound) { visit(type1UpperBound, type2UpperBound, lubUpperBound); visit(type1LowerBound, type2LowerBound, lubLowerBound); for (AnnotationMirror top : qualifierHierarchy.getTopAnnotations()) { AnnotationMirror anno1 = type1LowerBound.getAnnotationInHierarchy(top); AnnotationMirror anno2 = type2LowerBound.getAnnotationInHierarchy(top); AnnotationMirror glb = null; <START> if (anno1 != null && anno2 != null) { <END> glb = qualifierHierarchy.greatestLowerBound(anno1, anno2); } if (glb != null) { lubLowerBound.replaceAnnotation(glb); } } }</code><technical_language>Is this equivalent a bit clearer: java if (anno1 != null && anno2 != null) { AnnotationMirror glb = qualifierHierarchy.greatestLowerBound(anno1, anno2); lubLowerBound.replaceAnnotation(glb); } anno1 anno2 hierarchy, glb exist. ifs confusing logic for me</technical_language>

Target:
private void lubWildcard( AnnotatedTypeMirror type1LowerBound, AnnotatedTypeMirror type1UpperBound, AnnotatedTypeMirror type2LowerBound, AnnotatedTypeMirror type2UpperBound, AnnotatedTypeMirror lubLowerBound, AnnotatedTypeMirror lubUpperBound) { visit(type1UpperBound, type2UpperBound, lubUpperBound); visit(type1LowerBound, type2LowerBound, lubLowerBound); for (AnnotationMirror top : qualifierHierarchy.getTopAnnotations()) { AnnotationMirror anno1 = type1LowerBound.getAnnotationInHierarchy(top); AnnotationMirror anno2 = type2LowerBound.getAnnotationInHierarchy(top); AnnotationMirror glb = null; if (anno1 != null && anno2 != null) { glb = qualifierHierarchy.greatestLowerBound(anno1, anno2); lubLowerBound.replaceAnnotation(glb); } } }
Source:
<code>public static String transliterate(String text) { <START> if (tokenizer == null) { <END> tokenizer = new Tokenizer(); } switch (country) { case DEFAULT: return Junidecode.unidecode(text); case JAPAN: return japanese2Romaji(text); } return text; }</code><technical_language>do init tokenizer in japanese2Romaji</technical_language>

Target:
public static String transliterate(String text) { switch (countryName) { case DEFAULT: return Junidecode.unidecode(text); case JAPAN: return japanese2Romaji(text); } return text; }
Source:
<code>public <T extends Storable> T remove(StorableKey key) throws StorageException { Storable storable = (Storable) writer.remove(key); if (storable != null && storable.isCacheable()) { <START> storable = cache.get(key); <END> cache.remove(key); } return (T) storable; }</code><technical_language>reasoning overriding storable variable retrieved DB in cache</technical_language>

Target:
public <T extends Storable> T remove(StorableKey key) throws StorageException { Storable storable = (Storable) writer.remove(key); if (storable != null && storable.isCacheable()) { Storable cachedStorable = cache.get(key); if (!storable.equals(cachedStorable)) { LOG.warn("Possible cache inconsistency. Storable from DB '{}', Storable from cache '{}'", storable, cachedStorable); storable = cachedStorable; } cache.remove(key); } return (T) storable; }