auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testApplyWayTags() { Graph graph = initExampleGraph(); EdgeIteratorState edge0 = GHUtility.getEdge(graph, 0, 1); ReaderWay way0 = new ReaderWay(1); wheelchairEncoder.applyWayTags(way0, edge0); IntsRef flags0 = edge0.getFlags(); <START> assertEquals(2, wheelchairEncoder.getSpeed(false, flags0), 1e-1); <END> assertEquals(5, wheelchairEncoder.getSpeed(true, flags0), 1e-1); EdgeIteratorState edge1 = GHUtility.getEdge(graph, 2, 3); ReaderWay way1 = new ReaderWay(2); wheelchairEncoder.applyWayTags(way1, edge1); IntsRef flags1 = edge1.getFlags(); assertEquals(0, wheelchairEncoder.getSpeed(false, flags1), 1e-1); assertEquals(0, wheelchairEncoder.getSpeed(true, flags1), 1e-1); }</code><technical_language>Instead of encoder DecimalEncodedValue: edge0.get(encoder.getAverageSpeedEnc()) edge0.getReverse(encoder.getAverageSpeedEnc())</technical_language>

Target:
public void testApplyWayTags() { Graph graph = initExampleGraph(); EdgeIteratorState edge0 = GHUtility.getEdge(graph, 0, 1); ReaderWay way0 = new ReaderWay(1); wheelchairEncoder.applyWayTags(way0, edge0); assertTrue(edge0.get(wheelchairAccessEnc)); assertTrue(edge0.getReverse(wheelchairAccessEnc)); assertEquals(2, edge0.get(wheelchairEncoder.getAverageSpeedEnc()), 0); assertEquals(5, edge0.getReverse(wheelchairEncoder.getAverageSpeedEnc()), 0); EdgeIteratorState edge1 = GHUtility.getEdge(graph, 2, 3); ReaderWay way1 = new ReaderWay(2); wheelchairEncoder.applyWayTags(way1, edge1); assertFalse(edge1.get(wheelchairAccessEnc)); assertFalse(edge1.getReverse(wheelchairAccessEnc)); }
Source:
<code>protected TmfXYChartViewer createChartViewer(Composite parent) { <START> PatternScatterGraphViewer viewer = new PatternScatterGraphViewer(NonNullUtils.checkNotNull(parent), "Duration vs Time", "Time", "Duration"); END> fViewer = viewer; loadNewLatencyView(); return viewer; }</code><technical_language>Externalize strings</technical_language>

Target:
protected TmfXYChartViewer createChartViewer(Composite parent) { PatternScatterGraphViewer viewer = new PatternScatterGraphViewer(checkNotNull(parent), checkNotNull(Messages.PatternLatencyViews_ScatterGraphTitle), checkNotNull(Messages.PatternLatencyViews_ScatterGraphXLabel), checkNotNull(Messages.PatternLatencyViews_ScatterGraphYLabel)); fViewer = viewer; loadLatencyView(); return viewer; }
Source:
<code>private void setUpFavTriggers() { Context context = this.getActivity(); SQLStore<Trigger> store = openStore(context); store.openSync(); Collection<Trigger> array = store.readAll(); triggers = new ArrayList<>(array); sortTriggers(this.triggers); list.setAdapter(new TriggersAdapter(getActivity(), this, triggers)); hideRefreshing(); if(triggers.isEmpty()){ showMessage(); } else{ showList(); } <START> store.close(); <END> }</code><technical_language>is generally good avoid mixing works in PR :)</technical_language>

Target:
private void setUpFavTriggers() { Context context = this.getActivity(); SQLStore<Trigger> store = openStore(context); store.openSync(); Collection<Trigger> array = store.readAll(); triggers = new ArrayList<>(array); sortTriggers(this.triggers); list.setAdapter(new TriggersAdapter(getActivity(), this, triggers)); hideRefreshing(); if(triggers.isEmpty()){ showMessage(); } else{ showList(); } }
Source:
<code>private static String getPattern (String regex, String hgvs) { Pattern p = Pattern.compile(regex); Matcher m = p.matcher(hgvs); <START> if (m.find()) <END> return hgvs.substring(m.start(), m.end()); return null; }</code><technical_language>suggestion if (m.find()) { ... }</technical_language>

Target:
private static String getPattern(String regex, String hgvs) { Pattern p = Pattern.compile(regex); Matcher m = p.matcher(hgvs); if (m.find()) { return hgvs.substring(m.start(), m.end()); } return null; }
Source:
<code>private void setupChildren() { int tileSize = getResources().getDimensionPixelSize(R.dimen.mcv_default_tile_size); root = new LinearLayout(getContext()); root.setOrientation(LinearLayout.VERTICAL); root.setWeightSum(8); root.setClipChildren(false); root.setClipToPadding(false); <START> LayoutParams p = new LayoutParams(tileSize * 7, tileSize * 8); <END> p.gravity = Gravity.CENTER; addView(root, p); LinearLayout topbar = new LinearLayout(getContext()); topbar.setOrientation(LinearLayout.HORIZONTAL); topbar.setWeightSum(7); topbar.setClipChildren(false); topbar.setClipToPadding(false); root.addView(topbar, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, 0, 1)); buttonPast.setScaleType(ImageView.ScaleType.CENTER_INSIDE); buttonPast.setImageResource(R.drawable.mcv_action_previous); topbar.addView(buttonPast, new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1)); title.setGravity(Gravity.CENTER); topbar.addView(title, new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 5)); buttonFuture.setScaleType(ImageView.ScaleType.CENTER_INSIDE); buttonFuture.setImageResource(R.drawable.mcv_action_next); topbar.addView(buttonFuture, new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1)); pager.setId(R.id.mcv_pager); pager.setOffscreenPageLimit(1); root.addView(pager, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, 0, 7)); }</code><technical_language>throw multipliers a constant? I reusing in a other spots</technical_language>

Target:
private void setupChildren() { int tileSize = (int) TypedValue.applyDimension( TypedValue.COMPLEX_UNIT_DIP, getResources().getInteger(R.integer.mcv_default_tile_size), getResources().getDisplayMetrics() ); root = new LinearLayout(getContext()); root.setOrientation(LinearLayout.VERTICAL); root.setClipChildren(false); root.setClipToPadding(false); LayoutParams p = new LayoutParams( tileSize * MonthView.DEFAULT_DAYS_IN_WEEK, tileSize * (MonthView.DEFAULT_MONTH_TILE_HEIGHT + 1) ); p.gravity = Gravity.CENTER; addView(root, p); LinearLayout topbar = new LinearLayout(getContext()); topbar.setOrientation(LinearLayout.HORIZONTAL); topbar.setClipChildren(false); topbar.setClipToPadding(false); root.addView(topbar, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, 0, 1)); buttonPast.setScaleType(ImageView.ScaleType.CENTER_INSIDE); buttonPast.setImageResource(R.drawable.mcv_action_previous); topbar.addView(buttonPast, new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1)); title.setGravity(Gravity.CENTER); topbar.addView(title, new LinearLayout.LayoutParams( 0, LayoutParams.MATCH_PARENT, MonthView.DEFAULT_DAYS_IN_WEEK - 2 )); buttonFuture.setScaleType(ImageView.ScaleType.CENTER_INSIDE); buttonFuture.setImageResource(R.drawable.mcv_action_next); topbar.addView(buttonFuture, new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1)); pager.setId(R.id.mcv_pager); pager.setOffscreenPageLimit(1); root.addView(pager, new LinearLayout.LayoutParams( LayoutParams.MATCH_PARENT, 0, MonthView.DEFAULT_MONTH_TILE_HEIGHT )); }
Source:
<code>public OutputStream write(URI uri) throws IOException { if (!fileExist(uri)) { boolean newFileCreated = new File(mapUriToKitodoDataDirectoryUri(uri)).createNewFile(); if (!newFileCreated) { <START> logger.info("File was not created!"); <END> } } return new FileOutputStream(new File(mapUriToKitodoDataDirectoryUri(uri))); }</code><technical_language>I think, is a wrong behaviour: If file created exception thrown if logging file including path added log message</technical_language>

Target:
public OutputStream write(URI uri) throws IOException { if (!fileExist(uri)) { boolean newFileCreated = new File(mapUriToKitodoDataDirectoryUri(uri)).createNewFile(); if (!newFileCreated) { logger.error("File was not created!"); throw new IOException( "File: " + new File(mapUriToKitodoDataDirectoryUri(uri)).getPath() + " couldn't be created!"); } } return new FileOutputStream(new File(mapUriToKitodoDataDirectoryUri(uri))); }
Source:
<code>private void postDatabaseChanged() { synchronized (lock) { if (c4DBObserver == null || c4db == null || getC4Database().isInTransaction()) return; boolean external = false; int nChanges; List<String> docIDs = new ArrayList<>(); do { C4DatabaseChange[] c4DBChanges = c4DBObserver.getChanges(MAX_CHANGES); nChanges = c4DBChanges.length; boolean newExternal = nChanges > 0 ? c4DBChanges[0].isExternal() : false; if (c4DBChanges == null || c4DBChanges.length == 0 || external != newExternal || docIDs.size() > 1000) { if (docIDs.size() > 0) { DatabaseChange change = new DatabaseChange(this, docIDs); <START> synchronized (dbListenerTokens) { <END> for (DatabaseChangeListenerToken token : dbListenerTokens) token.notify(change); } docIDs = new ArrayList<>(); } } external = newExternal; for (int i = 0; i < nChanges; i++) docIDs.add(c4DBChanges[i].getDocID()); } while (nChanges > 0); } }</code><technical_language>this is synchronized (lock), is this synchronized required</technical_language>

Target:
private void postDatabaseChanged() { synchronized (lock) { if (c4DBObserver == null || c4db == null || getC4Database().isInTransaction()) return; boolean external = false; int nChanges; List<String> docIDs = new ArrayList<>(); do { C4DatabaseChange[] c4DBChanges = c4DBObserver.getChanges(MAX_CHANGES); nChanges = c4DBChanges.length; boolean newExternal = nChanges > 0 ? c4DBChanges[0].isExternal() : false; if (c4DBChanges == null || c4DBChanges.length == 0 || external != newExternal || docIDs.size() > 1000) { if (docIDs.size() > 0) { DatabaseChange change = new DatabaseChange(this, docIDs); for (DatabaseChangeListenerToken token : dbListenerTokens) token.notify(change); docIDs = new ArrayList<>(); } } external = newExternal; for (int i = 0; i < nChanges; i++) docIDs.add(c4DBChanges[i].getDocID()); } while (nChanges > 0); } }
Source:
<code>void parse(VoltXMLElement stmtNode) { assert(stmtNode.children.isEmpty()); assert(m_tableList.isEmpty()); <START> String theName = stmtNode.attributes.get("thetable"); <END> assert(theName != null); Table theTable = getTableFromDB(theName); if (theTable == null) { throw new PlanningErrorException("TABLE object not found: " + theName); } m_tableList.add(theTable); String otherName = stmtNode.attributes.get("othertable"); assert(otherName != null); Table otherTable = getTableFromDB(otherName); if (otherTable == null) { throw new PlanningErrorException("TABLE object not found: " + otherName); } m_tableList.add(otherTable); }</code><technical_language>this repeated part wrapped a function</technical_language>

Target:
void parse(VoltXMLElement stmtNode) { assert(stmtNode.children.isEmpty()); assert(m_tableList.isEmpty()); addTabletoList(stmtNode, "thetable"); addTabletoList(stmtNode, "othertable"); }
Source:
<code>public static String convertStreamToString(java.io.InputStream is) { <START> java.util.Scanner scanner = null; <END> String result=""; try { scanner = new java.util.Scanner(is).useDelimiter("\\A"); result = scanner.hasNext() ? scanner.next() : ""; scanner.close(); } finally { if(scanner!=null) scanner.close(); } return result; }</code><technical_language>public</technical_language>

Target:
private static String convertStreamToString(java.io.InputStream is) { java.util.Scanner scanner = null; String result=""; try { scanner = new java.util.Scanner(is).useDelimiter("\\A"); result = scanner.hasNext() ? scanner.next() : ""; scanner.close(); } finally { if(scanner!=null) { scanner.close(); } } return result; }
Source:
<code>private void editCatalog(String catalogName, String catalogFile, String description, boolean verify) { selectCatalog(catalogName); new PushButton(EDIT_CATALOG).click(); new DefaultCombo().setText(catalogFile); new LabeledText(CATALOG_DESCRIPTION).setText(description); if (verify) { <START> new PushButton(VERIFY_BUTTON).click(); <END> } new OkButton().click(); }</code><technical_language>line 89, effect of clicking ot Verify button</technical_language>

Target:
private String editCatalog(String catalogName, String catalogFile, String description, boolean verify) { String verificationResult = ""; selectCatalog(catalogName); new PushButton(EDIT_CATALOG).click(); new DefaultCombo().setText(catalogFile); new LabeledText(CATALOG_DESCRIPTION).setText(description); if (verify) { verificationResult = verifyURL(); } log.info(verificationResult); new OkButton().click(); return verificationResult; }
Source:
<code>public List<LogicalNode> getLogicalNodes() { <START> return logicalNodes; <END> }</code><technical_language>add "this" qualifier</technical_language>

Target:
public List<LogicalNode> getLogicalNodes() { return this.logicalNodes; }
Source:
<code>private void scheduleManagerUpdate(IContributionManager mgr) { if (this.mgrsToUpdate.isEmpty()) { Display display = context.get(Display.class); if (display == null || display.isDisposed()) { return; } <START> display.asyncExec(new Runnable() { <END> @Override public void run() { Collection<IContributionManager> toUpdate = new HashSet<>(mgrsToUpdate); mgrsToUpdate.clear(); for (IContributionManager mgr : toUpdate) { mgr.update(false); } } }); } this.mgrsToUpdate.add(mgr); }</code><technical_language>If I undrestood right, want display.timerExec(X) here. X 50 - 100 ms. I prefer smaller values</technical_language>

Target:
private void scheduleManagerUpdate(IContributionManager mgr) { synchronized (mgrToUpdate) { if (this.mgrToUpdate.isEmpty()) { Display display = context.get(Display.class); if (display != null && !display.isDisposed()) { display.timerExec(100, new Runnable() { @Override public void run() { Collection<IContributionManager> toUpdate = new LinkedHashSet<>(); synchronized (mgrToUpdate) { toUpdate.addAll(mgrToUpdate); mgrToUpdate.clear(); } for (IContributionManager mgr : toUpdate) { mgr.update(false); } } }); } this.mgrToUpdate.add(mgr); } } }
Source:
<code>private String equalFilterBuilder(String property, String value) { <START> return "(" + property + "=" + value + ")"; <END> }</code><technical_language>Define a constant for strings in more places. Example :- Define a constant for "(" reuse it</technical_language>

Target:
private String equalFilterBuilder(String property, String value) { StringBuilder filter = new StringBuilder(); filter.append(OPEN_PARENTHESIS).append(property).append(EQUALS_SIGN).append(value).append(CLOSE_PARENTHESIS); return filter.toString(); }
Source:
<code>public Response healthCheck() { SortedMap<String, HealthCheck.Result> results = environment.healthChecks().runHealthChecks(); Map<String, Map<String, Boolean>> response = results.entrySet() .stream() .collect(Collectors.toMap(Map.Entry::getKey, healthCheck -> ImmutableMap.of("healthy", healthCheck.getValue().isHealthy()))); boolean allHealthy = results.values().stream().allMatch(HealthCheck.Result::isHealthy); <START> return (allHealthy ? Response.ok() : Response.status(503)).entity(response).build(); <END> }</code><technical_language>I prefer do this: java Response res = allHealthy ? Response.ok() : Response.status(503); return res.entity(response).build();</technical_language>

Target:
public Response healthCheck() { SortedMap<String, HealthCheck.Result> results = environment.healthChecks().runHealthChecks(); Map<String, Map<String, Boolean>> response = results.entrySet() .stream() .collect(Collectors.toMap(Map.Entry::getKey, healthCheck -> ImmutableMap.of("healthy", healthCheck.getValue().isHealthy()))); boolean allHealthy = results.values().stream().allMatch(HealthCheck.Result::isHealthy); Response.ResponseBuilder res = allHealthy ? Response.ok() : Response.status(503); return res.entity(response).build(); }
Source:
<code>public void execute(QueryMaster.QueryMasterContext context, QueryContext queryContext, Query query, ExecutionBlockId finalExecBlockId, Path finalOutputDir) throws Exception { Stage lastStage = query.getStage(finalExecBlockId); TableMeta meta = lastStage.getTableMeta(); String nullChar = queryContext.get(SessionVars.NULL_CHAR); meta.putProperty(StorageConstants.TEXT_NULL, nullChar); TableStats stats = lastStage.getResultStats(); TableDesc resultTableDesc = new TableDesc( query.getId().toString(), lastStage.getOutSchema(), meta, finalOutputDir.toUri()); resultTableDesc.setExternal(true); if (query.hasUnionPlan()) { TableStats aggregated = query.aggregateTableStatsOfTerminalBlock(); stats.setNumRows(aggregated.getNumRows()); <START> stats.setNumBytes(aggregated.getNumBytes()); <END> } else { stats.setNumBytes(getTableVolume(query.systemConf, finalOutputDir)); } resultTableDesc.setStats(stats); query.setResultDesc(resultTableDesc); }</code><technical_language>Copying numRows numBytes is insufficient. aggretated set stats of resultTableDesc</technical_language>

Target:
public void execute(QueryMaster.QueryMasterContext context, QueryContext queryContext, Query query, ExecutionBlockId finalExecBlockId, Path finalOutputDir) throws Exception { Stage lastStage = query.getStage(finalExecBlockId); TableMeta meta = lastStage.getTableMeta(); String nullChar = queryContext.get(SessionVars.NULL_CHAR); meta.putProperty(StorageConstants.TEXT_NULL, nullChar); TableStats stats = lastStage.getResultStats(); TableDesc resultTableDesc = new TableDesc( query.getId().toString(), lastStage.getOutSchema(), meta, finalOutputDir.toUri()); resultTableDesc.setExternal(true); if (query.hasUnionPlan()) { TableStats aggregated = query.aggregateTableStatsOfTerminalBlock(); resultTableDesc.setStats(aggregated); } else { stats.setNumBytes(getTableVolume(query.systemConf, finalOutputDir)); resultTableDesc.setStats(stats); } query.setResultDesc(resultTableDesc); }
Source:
<code>default Map<Integer, Filter> getFilters() { <START> return ImmutableMap.of(); <END> }</code><technical_language>correct default implementation for getFilters return empty map. Throwing unsupported exception better. Is reason this change instead of add getFilters implementation TRUE instance</technical_language>

Target:
default Map<Integer, Filter> getFilters() { throw new UnsupportedOperationException(); }
Source:
<code>public void setup() { validator = spy(new NetworkValidator(network)); doReturn(dbFacade).when(validator).getDbFacade(); when(dbFacade.getStoragePoolDao()).thenReturn(dataCenterDao); when(dbFacade.getNetworkDao()).thenReturn(networkDao); when(dataCenterDao.get(any(Guid.class))).thenReturn(dataCenter); when(networkDao.getAllForDataCenter(any(Guid.class))).thenReturn(networks); Version version = mock(Version.class); <START> when(version.getValue()).thenReturn(null); <END> when(dataCenter.getcompatibility_version()).thenReturn(version); }</code><technical_language>This line is unnecessary this is default behaviour of mock</technical_language>

Target:
public void setup() { validator = spy(new NetworkValidator(network)); doReturn(dbFacade).when(validator).getDbFacade(); when(dbFacade.getStoragePoolDao()).thenReturn(dataCenterDao); when(dbFacade.getNetworkDao()).thenReturn(networkDao); when(dataCenterDao.get(any(Guid.class))).thenReturn(dataCenter); when(networkDao.getAllForDataCenter(any(Guid.class))).thenReturn(networks); Version version = mock(Version.class); when(dataCenter.getcompatibility_version()).thenReturn(version); }
Source:
<code><START> public OneCoreTickCounters(Integer[] c) { <END> fUser = c[0]; fNice = c[1]; fSystem = c[2]; fIdle = c[3]; fIowait = c[4]; fIrq = c[5]; fSoftirq = c[6]; }</code><technical_language>For safety, checking c != null && c.length >=7 if not, leave 0</technical_language>

Target:
public OneCoreTickCounters(Integer[] c) { assert (c != null && c.length >= 7); fUser = c[0]; fNice = c[1]; fSystem = c[2]; fIdle = c[3]; fIowait = c[4]; fIrq = c[5]; fSoftirq = c[6]; }
Source:
<code>public ExpressionEvaluatingMessageHandler(Expression expression) { <START> Assert.notNull(expression, "Expression must not be null"); <END> this.processor = new ExpressionEvaluatingMessageProcessor<Void>(expression, Void.class); setPrimaryExpression(expression); }</code><technical_language>Expression in message odd. param name. fix merge</technical_language>

Target:
public ExpressionEvaluatingMessageHandler(Expression expression) { Assert.notNull(expression, "'expression' must not be null"); this.processor = new ExpressionEvaluatingMessageProcessor<Void>(expression, Void.class); setPrimaryExpression(expression); }
Source:
<code>protected void operations(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException { try { <START> monitor.beginTask("Task ID Update", IProgressMonitor.UNKNOWN); <END> Map<ITask, ITask> map = new HashMap<>(); TaskActivityManager activityManager = TasksUiPlugin.getTaskActivityManager(); AbstractTaskContextStore contextStore = TasksUiPlugin.getContextStore(); TaskDataManager taskDataManager = TasksUiPlugin.getTaskDataManager(); for (ITask task : newTaskIdMap.keySet()) { ITask newTask = getTaskList().refactorTaskId(task, newTaskIdMap.get(task)); map.put(task, newTask); activityManager.setScheduledFor((AbstractTask) newTask, ((AbstractTask) task).getScheduledForDate()); activityManager.setDueDate(newTask, task.getDueDate()); if (task.isActive()) { activityManager.activateTask(newTask); } taskDataManager.refactorTaskId(task, newTask); } contextStore.refactorContext(map); } finally { monitor.done(); } }</code><technical_language>is this unknown? 1 tick task in map? + some work for context store</technical_language>

Target:
protected void operations(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException { try { monitor.beginTask("Task ID Update", newTaskIdMap.size() * 2); Map<ITask, ITask> map = new HashMap<>(); TaskActivityManager activityManager = TasksUiPlugin.getTaskActivityManager(); AbstractTaskContextStore contextStore = TasksUiPlugin.getContextStore(); TaskDataManager taskDataManager = TasksUiPlugin.getTaskDataManager(); for (ITask task : newTaskIdMap.keySet()) { AbstractTask newTask = getTaskList().refactorTaskId(task, newTaskIdMap.get(task)); map.put(task, newTask); activityManager.setDueDate(newTask, task.getDueDate()); if (task.isActive()) { activityManager.activateTask(newTask); } if (task instanceof AbstractTask) { activityManager.setScheduledFor(newTask, ((AbstractTask) task).getScheduledForDate()); taskDataManager.refactorTaskId((AbstractTask) task, newTask); } monitor.worked(1); } contextStore.refactorContext(map); monitor.worked(newTaskIdMap.size()); } finally { monitor.done(); } }
Source:
<code>public void addComponentChangeListener(ComponentChangeListener l) { checkState(); <START> if( ! listenerList.contains(l)) { <END> listenerList.add(l); } log.trace("Added ComponentChangeListener " + l + ", current number of listeners is " + listenerList.size()); }</code><technical_language>Hmm, switch listenerList a set</technical_language>

Target:
public void addComponentChangeListener(ComponentChangeListener l) { checkState(); listenerList.add(l); log.trace("Added ComponentChangeListener " + l + ", current number of listeners is " + listenerList.size()); }
Source:
<code>public Map<Integer, UploadPartDetail> getUploadStatePartDetails(String objectId, String uploadId) { val uploadStateKey = getUploadStateKey(objectId, uploadId, PART); val details = Maps.<Integer, UploadPartDetail> newHashMap(); eachObjectSummary(objectId, uploadStateKey, (objectSummary) -> { CompletedPart part = readCompletedPart(objectId, uploadId, objectSummary); UploadPartDetail detail = new UploadPartDetail(); PartETag etag = new PartETag(part.getPartNumber(), part.getEtag()); <START> detail.setEtag(etag); <END> detail.setPartNumber(part.getPartNumber()); detail.setMd5(part.getMd5()); details.put(part.getPartNumber(), detail); }); return details; }</code><technical_language>Ya @Value @Builder more appropriate. thread safety invariant guarantees</technical_language>

Target:
public Map<Integer, UploadPartDetail> getUploadStatePartDetails(String objectId, String uploadId) { val uploadStateKey = getUploadStateKey(objectId, uploadId, PART); val details = Maps.<Integer, UploadPartDetail> newHashMap(); eachObjectSummary(objectId, uploadStateKey, (objectSummary) -> { CompletedPart part = readCompletedPart(objectId, uploadId, objectSummary); PartETag etag = new PartETag(part.getPartNumber(), part.getEtag()); UploadPartDetailBuilder detailBuilder = UploadPartDetail.builder().etag(etag).partNumber(part.getPartNumber()).md5(part.getMd5()); details.put(part.getPartNumber(), detailBuilder.build()); }); return details; }
Source:
<code>private Optional<Set<String>> getFilteredStringObjectMap( final IndexEdge indexEdge ) { Id mapOwner = new SimpleId( indexEdge.getNodeId().getUuid(), TYPE_APPLICATION ); final MapScope ms = CpNamingUtils.getEntityTypeMapScope( mapOwner ); MapManager mm = mapManagerFactory.createMapManager( ms ); Set<String> defaultProperties; ArrayList fieldsToKeep; String collectionName = CpNamingUtils.getCollectionNameFromEdgeName( indexEdge.getEdgeName() ); String jsonSchemaMap = mm.getString( collectionName ); <START> if ( jsonSchemaMap != null ) { <END> Map jsonMapData = ( Map ) JsonUtils.parse( jsonSchemaMap ); Schema schema = Schema.getDefaultSchema(); defaultProperties = schema.getRequiredProperties( collectionName ); fieldsToKeep = ( ArrayList ) jsonMapData.get( "fields" ); defaultProperties.addAll( fieldsToKeep ); } else { return Optional.empty(); } return Optional.of(defaultProperties); }</code><technical_language>this logic is duplicated in a couple classes, lets if a simplify</technical_language>

Target:
private Optional<Set<String>> getFilteredStringObjectMap( final IndexEdge indexEdge ) { Id mapOwner = new SimpleId( indexEdge.getNodeId().getUuid(), TYPE_APPLICATION ); final MapScope ms = CpNamingUtils.getEntityTypeMapScope( mapOwner ); MapManager mm = mapManagerFactory.createMapManager( ms ); Set<String> defaultProperties; ArrayList fieldsToKeep; String collectionName = CpNamingUtils.getCollectionNameFromEdgeName( indexEdge.getEdgeName() ); IndexSchemaCache indexSchemaCache = indexSchemaCacheFactory.getInstance( mm ); Optional<Map> collectionIndexingSchema = indexSchemaCache.getCollectionSchema( collectionName ); if ( collectionIndexingSchema.isPresent()) { Map jsonMapData = collectionIndexingSchema.get(); Schema schema = Schema.getDefaultSchema(); defaultProperties = schema.getRequiredProperties( collectionName ); fieldsToKeep = ( ArrayList ) jsonMapData.get( "fields" ); if(fieldsToKeep.contains( "*" )){ return Optional.absent(); } defaultProperties.addAll( fieldsToKeep ); } else { return Optional.absent(); } return Optional.of(defaultProperties); }
Source:
<code>private void lockImageInDb() { final DiskImage diskImage = getDiskImage(); TransactionSupport.executeInNewTransaction(() -> { getCompensationContext().snapshotEntityStatus(diskImage.getImage()); getCompensationContext().stateChanged(); diskImage.setImageStatus(ImageStatus.LOCKED); ImagesHandler.updateImageStatus(diskImage.getImageId(), ImageStatus.LOCKED); return null; <START> }); <END> }</code><technical_language>This command is currently transactional (should transactional?), I guess set transactional compensation, so: 1. stateChanged need called actual change 2. need add NonTransactive annotation 3. need add empty constructor</technical_language>

Target:
private void lockImageInDb() { final DiskImage diskImage = getDiskImage(); TransactionSupport.executeInNewTransaction(() -> { getCompensationContext().snapshotEntityStatus(diskImage.getImage()); diskImage.setImageStatus(ImageStatus.LOCKED); ImagesHandler.updateImageStatus(diskImage.getImageId(), ImageStatus.LOCKED); getCompensationContext().stateChanged(); return null; }); }
Source:
<code>public void scroll(boolean up) { <START> LinearLayoutManager listLayout = getCurrentFragment().recyclerViewLayoutManager; <END> int numberOfVisibleItems = listLayout.findLastCompletelyVisibleItemPosition() - listLayout.findFirstCompletelyVisibleItemPosition() + 1; int oldPositionOnTop = listLayout.findFirstCompletelyVisibleItemPosition(); int newPositionOnTop; if (up) { newPositionOnTop = oldPositionOnTop - numberOfVisibleItems + 1; } else { newPositionOnTop = oldPositionOnTop + numberOfVisibleItems - 1; } if (newPositionOnTop >= listLayout.getItemCount()) { newPositionOnTop = listLayout.getItemCount() - numberOfVisibleItems - 1; } else if (newPositionOnTop < 0) { newPositionOnTop = 0; } Log.v(TAG, " scrolling to position: " + newPositionOnTop); listLayout.scrollToPositionWithOffset(newPositionOnTop, 0); }</code><technical_language>Null-checks for getCurrentFragment() recyclerViewLayoutManager hurt here</technical_language>

Target:
public void scroll(boolean up) { ArticleListFragment currentFragment = getCurrentFragment(); if( currentFragment != null && currentFragment.recyclerViewLayoutManager != null) { LinearLayoutManager listLayout = currentFragment.recyclerViewLayoutManager; int numberOfVisibleItems = listLayout.findLastCompletelyVisibleItemPosition() - listLayout.findFirstCompletelyVisibleItemPosition() + 1; int oldPositionOnTop = listLayout.findFirstCompletelyVisibleItemPosition(); int newPositionOnTop; if (up) { newPositionOnTop = oldPositionOnTop - numberOfVisibleItems + 1; } else { newPositionOnTop = oldPositionOnTop + numberOfVisibleItems - 1; } if (newPositionOnTop >= listLayout.getItemCount()) { newPositionOnTop = listLayout.getItemCount() - numberOfVisibleItems - 1; } else if (newPositionOnTop < 0) { newPositionOnTop = 0; } Log.v(TAG, " scrolling to position: " + newPositionOnTop); listLayout.scrollToPositionWithOffset(newPositionOnTop, 0); } }
Source:
<code>public DataSection genesBody(Patient patient) throws Exception { String sectionName = "genes"; Set<String> present = this.enabledHeaderIdsBySection.get(sectionName); if (present == null || present.isEmpty()) { return null; } DataSection section = new DataSection(); int y = 0; PatientData<Map<String, String>> allGenes = patient.getData("genes"); if (allGenes == null || !allGenes.isIndexed()) { for (int i = 0; i < present.size(); i++) { DataCell cell = new DataCell("", i, y); section.addCell(cell); } return section; } List<String> fields = Arrays.asList("status", "strategy", "comments"); List<String> strategyTranslates = <START> Arrays.asList("sequencing", "deletion", "familial_mutation", "common_mutations"); <END> DataCell cell = new DataCell(this.translationManager.translate("PhenoTips.GeneClass_genes"), 0, y); section.addCell(cell); for (Map<String, String> gene : allGenes) { int x = 0; String geneName = gene.get("gene"); cell = new DataCell(geneName, x++, y); section.addCell(cell); for (String field : fields) { if (!present.contains(field)) { continue; } String value = gene.get(field); if (field.equals("strategy")) { value = parseMultivalueField(value, strategyTranslates, "PhenoTips.GeneClass_"); } else { value = "comments".equals(field) ? value : this.translationManager.translate("PhenoTips.GeneClass_" + value); } cell = new DataCell(value, x++, y); section.addCell(cell); } y++; } return section; }</code><technical_language>"solved"/"rejected"/"candidate"? This is a big commit I missed those, gene/variant design changed</technical_language>

Target:
public DataSection genesBody(Patient patient) throws Exception { String sectionName = "genes"; Set<String> present = this.enabledHeaderIdsBySection.get(sectionName); if (present == null || present.isEmpty()) { return null; } DataSection section = new DataSection(); int y = 0; PatientData<Map<String, String>> allGenes = patient.getData("genes"); if (allGenes == null || !allGenes.isIndexed()) { for (int i = 0; i < present.size(); i++) { DataCell cell = new DataCell("", i, y); section.addCell(cell); } return section; } List<String> fields = Arrays.asList("status", "strategy", "comments"); List<String> strategyTranslates = Arrays.asList("sequencing", "deletion", "familial_mutation", "common_mutations"); DataCell cell; for (Map<String, String> gene : allGenes) { int x = 0; String geneName = gene.get("gene"); cell = new DataCell(geneName, x++, y); section.addCell(cell); for (String field : fields) { if (!present.contains(field) || gene.get(field) == null) { continue; } String value = gene.get(field); if ("strategy".equals(field)) { value = parseMultivalueField(value, strategyTranslates, "PhenoTips.GeneClass_strategy_"); } else if ("status".equals(field)) { value = this.translationManager.translate("PhenoTips.GeneClass_status_" + value); } cell = new DataCell(value, x++, y); section.addCell(cell); } y++; } return section; }
Source:
<code>private OperationController getOperationController() { ArrayList<OperationController> ocList = ocListRef.get(); if (ocList.size() == 0) { return null; } else { <START> return ocList.get(ThreadLocalRandom.current().nextInt(ocList.size())); <END> } }</code><technical_language>ThreadLocalRandom generate numbers for a seed? For example, if local random generating series, a balanced scheduling</technical_language>

Target:
private OperationController getOperationController() { return ocList.get(ThreadLocalRandom.current().nextInt(ocList.size())); }
Source:
<code>public PlanNode makeSegmentPlanNode(IndexSegment indexSegment, QueryContext queryContext) { <START> if (QueryContextUtils.isSelectionQuery(queryContext)) { <END> return new SelectionPlanNode(indexSegment, queryContext); } else if (QueryContextUtils.isDistinctQuery(queryContext)) { return new DistinctPlanNode(indexSegment, queryContext); } else { assert QueryContextUtils.isAggregationQuery(queryContext); List<ExpressionContext> groupByExpressions = queryContext.getGroupByExpressions(); if (groupByExpressions != null) { QueryOptions queryOptions = new QueryOptions(queryContext.getQueryOptions()); if (queryOptions.isGroupByModeSQL()) { return new AggregationGroupByOrderByPlanNode(indexSegment, queryContext, _maxInitialResultHolderCapacity, _numGroupsLimit); } return new AggregationGroupByPlanNode(indexSegment, queryContext, _maxInitialResultHolderCapacity, _numGroupsLimit); } else { if (queryContext.getFilter() == null && indexSegment.getValidDocIndex() == null) { if (isFitForMetadataBasedPlan(queryContext)) { return new MetadataBasedAggregationPlanNode(indexSegment, queryContext); } else if (isFitForDictionaryBasedPlan(queryContext, indexSegment)) { return new DictionaryBasedAggregationPlanNode(indexSegment, queryContext); } } return new AggregationPlanNode(indexSegment, queryContext); } } }</code><technical_language>here, common case first</technical_language>

Target:
public PlanNode makeSegmentPlanNode(IndexSegment indexSegment, QueryContext queryContext) { if (QueryContextUtils.isAggregationQuery(queryContext)) { List<ExpressionContext> groupByExpressions = queryContext.getGroupByExpressions(); if (groupByExpressions != null) { QueryOptions queryOptions = new QueryOptions(queryContext.getQueryOptions()); if (queryOptions.isGroupByModeSQL()) { return new AggregationGroupByOrderByPlanNode(indexSegment, queryContext, _maxInitialResultHolderCapacity, _numGroupsLimit); } return new AggregationGroupByPlanNode(indexSegment, queryContext, _maxInitialResultHolderCapacity, _numGroupsLimit); } else { if (queryContext.getFilter() == null && indexSegment.getValidDocIndex() == null) { if (isFitForMetadataBasedPlan(queryContext)) { return new MetadataBasedAggregationPlanNode(indexSegment, queryContext); } else if (isFitForDictionaryBasedPlan(queryContext, indexSegment)) { return new DictionaryBasedAggregationPlanNode(indexSegment, queryContext); } } return new AggregationPlanNode(indexSegment, queryContext); } } else if (QueryContextUtils.isSelectionQuery(queryContext)) { return new SelectionPlanNode(indexSegment, queryContext); } else { assert QueryContextUtils.isDistinctQuery(queryContext); return new DistinctPlanNode(indexSegment, queryContext); } }
Source:
<code>public void testFailForCheckDisksNotInBackupStorage() { final VM vm = new VM(); command.setVm(vm); when(vmDao.get(command.getParameters().getVmId())).thenReturn(vm); command.setCluster(new Cluster()); Guid storageDomainId = initDiskImage(vm); when(storageDomainStaticDao.get(storageDomainId)).thenReturn(backupStorageDomain(true)); <START> assertFalse("checkDisksNotInBackupStorage() fails to run because one or more disk is in backup domain", <END> command.checkDisksInBackupStorage()); }</code><technical_language>this return true, disks storage domain (Remember check validate method checkDisksInBackupStorage) Change assertTrue</technical_language>

Target:
public void testFailForCheckDisksNotInBackupStorage() { final VM vm = new VM(); command.setVm(vm); when(vmDao.get(command.getParameters().getVmId())).thenReturn(vm); command.setCluster(new Cluster()); Guid storageDomainId = initDiskImage(vm); when(storageDomainStaticDao.get(storageDomainId)).thenReturn(backupStorageDomain(true)); assertTrue("checkDisksNotInBackupStorage() fails to run because one or more disk is in backup domain", command.checkDisksInBackupStorage()); }
Source:
<code>public boolean intersect(Shape o) { <START> return false; <END> }</code><technical_language>throw UnsupportedException return a potentially wrong result, for contains calculateArea</technical_language>

Target:
public boolean intersect(Shape o) { throw new UnsupportedOperationException("Not supported yet."); }
Source:
<code>public void clearAllRevisions(String siddhiAppId) { <START> <END> }</code><technical_language>need clear this</technical_language>

Target:
public void clearAllRevisions(String siddhiAppId) { List<String> revisionList = revisionMap.remove(siddhiAppId); if (revisionList == null) { log.info("No revisions were found to delete for the Siddhi App " + siddhiAppId); return; } log.info("All revisions were deleted for the Siddhi App " + siddhiAppId); }
Source:
<code>private static BinaryResult stackBase64(HttpServletResponse res, final BinaryResult src) throws IOException { BinaryResult b64; long len = src.getContentLength(); if (0 <= len && len <= (7 << 20)) { b64 = base64(src); } else { b64 = new BinaryResult() { @Override public void writeTo(final OutputStream out) throws IOException { try (OutputStreamWriter w = new OutputStreamWriter( <START> new OutputStream() { <END> @Override public void write(int b) throws IOException { out.write(b); } @Override public void close() { } }, ISO_8859_1); OutputStream e = BaseEncoding.base64().encodingStream(w)) { src.writeTo(e); e.flush(); } } }; } res.setHeader("X-FYI-Content-Encoding", "base64"); res.setHeader("X-FYI-Content-Type", src.getContentType()); return b64.setContentType("text/plain").setCharacterEncoding("ISO-8859-1"); }</code><technical_language>this delegate for flush other forms of write, too</technical_language>

Target:
private static BinaryResult stackBase64(HttpServletResponse res, final BinaryResult src) throws IOException { BinaryResult b64; long len = src.getContentLength(); if (0 <= len && len <= (7 << 20)) { b64 = base64(src); } else { b64 = new BinaryResult() { @Override public void writeTo(final OutputStream out) throws IOException { try (OutputStreamWriter w = new OutputStreamWriter( new FilterOutputStream(out) { @Override public void close() { } }, ISO_8859_1); OutputStream e = BaseEncoding.base64().encodingStream(w)) { src.writeTo(e); } } }; } res.setHeader("X-FYI-Content-Encoding", "base64"); res.setHeader("X-FYI-Content-Type", src.getContentType()); return b64.setContentType("text/plain").setCharacterEncoding("ISO-8859-1"); }
Source:
<code>public void deleteSession(Session session, MicroServiceContext microServiceContext) { String microServiceSessionDir = microServiceContext.getService().getClass().getName(); <START> String pathname = Paths.get(SESSION_DIR + "/" + microServiceSessionDir, session.getId()).toString(); <END> if (!new File(pathname).delete()) { throw new IllegalStateException("File " + pathname + " deletion failed"); } }</code><technical_language>get rid of "/" Paths API construct OS dependent path</technical_language>

Target:
public void deleteSession(Session session, MicroServiceContext microServiceContext) { String microServiceSessionDir = microServiceContext.getService().getClass().getName(); String pathname = Paths.get(SESSION_DIR, microServiceSessionDir, session.getId()).toString(); if (!new File(pathname).delete()) { throw new IllegalStateException("File " + pathname + " deletion failed"); } }
Source:
<code>public float reportRayFixture(Fixture fixture, Vector2 point, Vector2 normal, float fraction) { Object userData = fixture.getBody().getUserData(); if (userData instanceof EntityRef) { userData = new SolObjectEntityWrapper((EntityRef) userData); } <START> SolObject o = (SolObject) userData; <END> boolean oIsMassless = o instanceof Projectile && ((Projectile) o).isMassless(); if (!oIsMassless && projectile.shouldCollide(o, fixture, game.getFactionMan())) { position.set(point); projectile.setObstacle(o, game); return 0; } return -1; }</code><technical_language>If userData is a SolObject this point break / return -1</technical_language>

Target:
public float reportRayFixture(Fixture fixture, Vector2 point, Vector2 normal, float fraction) { Object userData = fixture.getBody().getUserData(); if (userData instanceof EntityRef) { userData = new SolObjectEntityWrapper((EntityRef) userData); } SolObject solObject = (SolObject) userData; boolean objectIsMassless = solObject instanceof Projectile && ((Projectile) solObject).isMassless(); if (!objectIsMassless && projectile.shouldCollide(solObject, fixture, game.getFactionMan())) { position.set(point); projectile.setObstacle(solObject, game); return 0; } return -1; }
Source:
<code>public void update(CruiseConfig preprocessedConfig) throws Exception { preprocessedRole = findExistingRole(preprocessedConfig); if (preprocessedRole == null) { throw new RoleNotFoundException(); } removeFromServerRole(preprocessedConfig, preprocessedRole); <START> removeFromAdmins(preprocessedConfig); <END> removeFromAllGroups(preprocessedConfig); removeFromAllTemplates(preprocessedConfig); removeFromSecurity(preprocessedConfig); }</code><technical_language>this bad configuration needs cleanup (via XSL transform)</technical_language>

Target:
public void update(CruiseConfig preprocessedConfig) throws Exception { preprocessedRole = findExistingRole(preprocessedConfig); if (preprocessedRole == null) { throw new RoleNotFoundException(); } removeFromServerRole(preprocessedConfig, preprocessedRole); removeFromServerAdmins(preprocessedConfig); removeFromAllGroups(preprocessedConfig); removeFromAllTemplates(preprocessedConfig); removeFromSecurity(preprocessedConfig); }
Source:
<code>void shouldSetTransactionTimeout() { session.run( "CREATE (:Node)" ).consume(); try ( Session otherSession = session.driver().session() ) { try ( Transaction otherTx = otherSession.beginTransaction() ) { otherTx.run( "MATCH (n:Node) SET n.prop = 1" ).consume(); TransactionConfig config = TransactionConfig.builder() <START> .withTimeout( ofSeconds( 1 ) ) <END> .build(); TransientException error = assertThrows( TransientException.class, () -> { try ( Transaction tx = session.beginTransaction( config ) ) { tx.run( "MATCH (n:Node) SET n.prop = 2" ); tx.success(); } } ); assertThat( error.getMessage(), containsString( "terminated" ) ); } } }</code><technical_language>need 1s? give 1ms speed this test? This 1s slow fancy new compute run tests. (The minimal legal server accept is 1ms) Similar for async one</technical_language>

Target:
void shouldSetTransactionTimeout() { session.run( "CREATE (:Node)" ).consume(); try ( Session otherSession = session.driver().session() ) { try ( Transaction otherTx = otherSession.beginTransaction() ) { otherTx.run( "MATCH (n:Node) SET n.prop = 1" ).consume(); TransactionConfig config = TransactionConfig.builder() .withTimeout( ofMillis( 1 ) ) .build(); TransientException error = assertThrows( TransientException.class, () -> { try ( Transaction tx = session.beginTransaction( config ) ) { tx.run( "MATCH (n:Node) SET n.prop = 2" ); tx.success(); } } ); assertThat( error.getMessage(), containsString( "terminated" ) ); } } }
Source:
<code>public JsonPattern() { <START> pattern = new ArrayList<Integer>(); <END> }</code><technical_language>this(new ArrayList<Integer>());</technical_language>

Target:
public JsonPattern() { this(new ArrayList<Integer>()); }
Source:
<code><START> public void testSerializeAndDeserialize() { <END> testSerializeAndDeserialize("Hello", S(0, 0)); testSerializeAndDeserialize(1, S(0, 1), CM("package", "name", 0, 10, "Bad")); testSerializeAndDeserialize("What", S(0, 1), CM("package", "name", 0, 10, "Bad"), CM("package", "b", 10, 20, "Very Bad")); }</code><technical_language>Is this method worth weight in characters written</technical_language>

Target:
public void testSerializeAndDeserialize() throws IOException { assertSerializeAndDeserialize("Hello", S(0, 0)); assertSerializeAndDeserialize(1, S(0, 1), CM("package", "name", S(0, 10), "Bad")); assertSerializeAndDeserialize("What", S(0, 1), CM("package", "name", S(0, 10), "Bad"), CM("package", "b", S(10, 20), "Very Bad")); }
Source:
<code>public void testPatchRequestScope() { DataStoreTransaction tx = mock(DataStoreTransaction.class); <START> PatchRequestScope parentScope = <END> new PatchRequestScope(null, tx, new User(1), elideSettings); PatchRequestScope scope = new PatchRequestScope( parentScope.getPath(), parentScope.getJsonApiDocument(), parentScope); Parent parent = newParent(7); PersistentResource<Parent> parentResource = new PersistentResource<>(parent, null, "1", scope); parentResource.updateAttribute("firstName", "foobar"); verify(tx, times(1)).setAttribute(parent, "firstName", "foobar", scope); }</code><technical_language>code nest patch scopes this? I thought patch parent scope - child scopes normal request scopes</technical_language>

Target:
public void testPatchRequestScope() { DataStoreTransaction tx = mock(DataStoreTransaction.class); PatchRequestScope parentScope = new PatchRequestScope(null, tx, new User(1), elideSettings); PatchRequestScope scope = new PatchRequestScope( parentScope.getPath(), parentScope.getJsonApiDocument(), parentScope); assertEquals(parentScope.isUseFilterExpressions(), scope.isUseFilterExpressions()); assertEquals(parentScope.getSorting(), scope.getSorting()); assertEquals(parentScope.getUpdateStatusCode(), scope.getUpdateStatusCode()); assertEquals(parentScope.getObjectEntityCache(), scope.getObjectEntityCache()); Parent parent = newParent(7); PersistentResource<Parent> parentResource = new PersistentResource<>(parent, null, "1", scope); parentResource.updateAttribute("firstName", "foobar"); verify(tx, times(1)).setAttribute(parent, "firstName", "foobar", scope); }
Source:
<code>private String getCacheKey(String kind, String name) { <START> return NLS.bind("{0}/{1}", new Object[] { kind, name }); <END> }</code><technical_language>This is a private method is heavily used. fast. Now, NLS.bind is efficient, is ok for messages/labels in UI reporting, outrageously slow for hard use. I suggest kind + "/" + name</technical_language>

Target:
private String getCacheKey(String kind, String name) { return kind+"/"+name; }
Source:
<code>public void onBootstrap() { String historyToken = History.getToken(); PlaceRequest currentPlaceRequest = tokenFormatter.toPlaceRequest(historyToken.isEmpty() ? NameTokens.HOME : historyToken); String nameToken = currentPlaceRequest.getNameToken(); if (localeHelper.isEnglish()) { <START> if (!Strings.isNullOrEmpty(nameToken) && !NameTokens.isEnglish(nameToken)) { <END> revealTranslatedNameToken(currentPlaceRequest); return; } } else if (localeHelper.isFrench()) { if (NameTokens.isEnglish(nameToken)) { revealTranslatedNameToken(currentPlaceRequest); return; } } placeManager.revealCurrentPlace(); }</code><technical_language>nameToken null empty now, content of conditions is same. create a method this: private boolean localeAndNameTokensAreNotSame(nameToken) { return (localeHelper.isEnglish() && !NameTokens.isEnglish(nameToken)) || (localeHelper.isFrench() && NameTokens.isEnglish(nameToken)); }</technical_language>

Target:
public void onBootstrap() { String historyToken = History.getToken(); PlaceRequest currentPlaceRequest = tokenFormatter.toPlaceRequest(historyToken.isEmpty() ? NameTokens.HOME : historyToken); String nameToken = currentPlaceRequest.getNameToken(); if (nameTokenInWrongLanguage(nameToken)) { revealTranslatedNameToken(currentPlaceRequest); } else { placeManager.revealCurrentPlace(); } }