auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public String toString() { <START> return componentName + " " + taskId + " " + componentIndex; <END> }</code><technical_language>Instead of string concatenation, String.format("%s %d %d", ...)</technical_language>

Target:
public String toString() { return String.format("Component Name: %s, Task Id: %d, Component Index: %d", componentName, taskId, componentIndex); }
Source:
<code>@Override public Set<BlockMatrixKey> getAllKeys() { <START> int maxRowIndex = rows - 1; <END> int maxColIndex = cols - 1; IgnitePair<Long> maxBlockId = getBlockId(maxRowIndex, maxColIndex); Set<BlockMatrixKey> keyset = new HashSet<>(); for(int i = 0; i <= maxBlockId.get1(); i++) for(int j = 0; j <= maxBlockId.get2(); j++) keyset.add(getCacheKey(i,j)); return keyset; }</code><technical_language>Please abbreviation for Index(Idx), check coding guideline</technical_language>

Target:
@Override public Set<BlockMatrixKey> getAllKeys() { int maxRowIdx = rows - 1; int maxColIdx = cols - 1; IgnitePair<Long> maxBlockId = getBlockId(maxRowIdx, maxColIdx); Set<BlockMatrixKey> keyset = new HashSet<>(); for(int i = 0; i <= maxBlockId.get1(); i++) for(int j = 0; j <= maxBlockId.get2(); j++) keyset.add(getCacheKey(i,j)); return keyset; }
Source:
<code>private static List<List<ColumnEncoding>> toColumnEncoding(List<OrcType> types, List<DwrfProto.ColumnEncoding> columnEncodings) { Map<Integer, List<DwrfProto.ColumnEncoding>> columnEncodingsByColumn = new HashMap<>(columnEncodings.size()); for (int i = 0; i < columnEncodings.size(); i++) { DwrfProto.ColumnEncoding columnEncoding = columnEncodings.get(i); int column = columnEncoding.getColumn(); <START> if (column == 0) { <END> column = i; } List<DwrfProto.ColumnEncoding> columnEncodingsForColumn = columnEncodingsByColumn.getOrDefault(column, new ArrayList<>()); columnEncodingsForColumn.add(columnEncoding); columnEncodingsByColumn.put(column, columnEncodingsForColumn); } ImmutableList.Builder<List<ColumnEncoding>> resultBuilder = ImmutableList.builder(); for (Map.Entry<Integer, List<DwrfProto.ColumnEncoding>> entry : columnEncodingsByColumn.entrySet()) { OrcType type = types.get(entry.getKey()); List<ColumnEncoding> columnEncoding = entry.getValue().stream() .map(encoding -> toColumnEncoding(type, encoding)) .collect(toImmutableList()); resultBuilder.add(columnEncoding); } return resultBuilder.build(); }</code><technical_language>nit: behavior for Protocol Buffer read version data ? columnEncoding.hasColumn() return false? If case this instead of column == 0</technical_language>

Target:
private static List<ColumnEncoding> toColumnEncoding(List<OrcType> types, List<DwrfProto.ColumnEncoding> columnEncodings) { Map<Integer, List<DwrfProto.ColumnEncoding>> columnEncodingsByColumn = new HashMap<>(columnEncodings.size()); for (int i = 0; i < columnEncodings.size(); i++) { DwrfProto.ColumnEncoding columnEncoding = columnEncodings.get(i); int column = columnEncoding.getColumn(); if (!columnEncoding.hasColumn()) { column = i; } columnEncodingsByColumn.computeIfAbsent(column, key -> new ArrayList<>()).add(columnEncoding); } ImmutableList.Builder<ColumnEncoding> resultBuilder = ImmutableList.builder(); for (Map.Entry<Integer, List<DwrfProto.ColumnEncoding>> entry : columnEncodingsByColumn.entrySet()) { OrcType type = types.get(entry.getKey()); DwrfProto.ColumnEncoding columnEncoding = entry.getValue().get(0); resultBuilder.add( new ColumnEncoding( toColumnEncodingKind(type.getOrcTypeKind(), columnEncoding.getKind()), columnEncoding.getDictionarySize(), toAdditionalSequenceEncodings(entry.getValue(), type))); } return resultBuilder.build(); }
Source:
<code>private static IdentifierFactory locateFactories(ClassLoader classLoader, String classLoaderName) { logger.debug("Looking for IdentifierFactory implementation using the class loader", classLoaderName); IdentifierFactory found = null; Iterator<IdentifierFactory> services = ServiceLoader.load(IdentifierFactory.class, classLoader).iterator(); if (services.hasNext()) { try { found = services.next(); logger.debug("Found IdentifierFactory implementation using the class Loader", classLoaderName); } catch (ServiceConfigurationError error) { <START> logger.warn("A service configuration error occurred for the provided IdentifierFactory: {}", <END> error.getMessage()); } if (services.hasNext()) { logger.warn("More than one IdentifierFactory implementation was found using the " + "Class Loader. This may result in different selections being made after " + "restart of the application.", classLoaderName); } } return found; }</code><technical_language>wondering want continue iterating other services if issues configuring. @jorgheymans</technical_language>

Target:
private static IdentifierFactory locateFactories(ClassLoader classLoader, String classLoaderName) { IdentifierFactory found = null; Iterator<IdentifierFactory> services = ServiceLoader.load(IdentifierFactory.class, classLoader).iterator(); if (services.hasNext()) { logger.debug("Found IdentifierFactory implementation using the Class Loader", classLoaderName); found = services.next(); if (services.hasNext()) { logger.warn("More than one IdentifierFactory implementation was found using the " + "Class Loader. This may result in different selections being made after " + "restart of the application.", classLoaderName); } } return found; }
Source:
<code><START> public ICompletableFuture<Void> putAllAsync(@Nonnull Map<? extends K, ? extends V> m) { <END> SimpleCompletableFuture<Void> future = new SimpleCompletableFuture<>(ForkJoinPool.commonPool(), getClient().getLoggingService().getLogger(ClientMapProxy.class)); putAllInternal(m, future); return future; }</code><technical_language>I suggest add putAllAsync in IMap interface, wdyt</technical_language>

Target:
public ICompletableFuture<Void> putAllAsync(@Nonnull Map<? extends K, ? extends V> m) { SimpleCompletableFuture<Void> future = new SimpleCompletableFuture<>( getClient().getClientExecutionService().getUserExecutor(), getClient().getLoggingService().getLogger(ClientMapProxy.class)); putAllInternal(m, future); return future; }
Source:
<code>public void run() { started = true; if(!prepared) { logger.error("The StageRunner was not prepared prior to being started. Aborting!"); return; } if(stageGroup.getStages().size()<1) { logger.info("Stage group "+stageGroup.getName() + " has no stages, and can not be started."); return; } do { logger.info("Starting stage group " + stageGroup.getName() + ". Times started so far: " + timesStarted); timesStarted++; boolean cleanShutdown = runGroup(); if (cleanShutdown) { return; } if (!hasQueried()) { logger.error("The stage group " + stageGroup.getName() + " did not start. It will not be restarted until configuration changes."); return; } <START> } while ((timesToRetry == -1 || timesToRetry >= timesStarted) && !Main.isShuttingDown()); <END> logger.error("Stage group " + stageGroup.getName() + " has failed and cannot be restarted. "); }</code><technical_language>This static referencing is extremely scary is hard test. I suggest extracting interface contains method isShuttingDown dependency inject that</technical_language>

Target:
public void run() { started = true; if(!prepared) { logger.error("The StageRunner was not prepared prior to being started. Aborting!"); return; } if(stageGroup.getStages().size()<1) { logger.info("Stage group "+stageGroup.getName() + " has no stages, and can not be started."); return; } do { logger.info("Starting stage group " + stageGroup.getName() + ". Times started so far: " + timesStarted); timesStarted++; boolean cleanShutdown = runGroup(); if (cleanShutdown) { return; } if (!hasQueried()) { logger.error("The stage group " + stageGroup.getName() + " did not start. It will not be restarted until configuration changes."); return; } } while ((timesToRetry == -1 || timesToRetry >= timesStarted) && !terminationHandler.isTerminating()); logger.error("Stage group " + stageGroup.getName() + " has failed and cannot be restarted. "); }
Source:
<code>static long addExact(long usedBytes, long bytes) { try { return Math.addExact(usedBytes, bytes); } catch (ArithmeticException e) { <START> throw new RuntimeException(String.format("Overflow detected. usedBytes: %d, bytes: %d", usedBytes, bytes), e); <END> } }</code><technical_language>static import format</technical_language>

Target:
static long addExact(long usedBytes, long bytes) { try { return Math.addExact(usedBytes, bytes); } catch (ArithmeticException e) { throw new RuntimeException(format("Overflow detected. usedBytes: %d, bytes: %d", usedBytes, bytes), e); } }
Source:
<code>private static Node processNodeWithoutAttributes(Node node, Document doc) { <START> Node localNode = node; <END> Element elem = null; String URI = localNode.getNamespaceURI(); URI = (URI == null) ? "" : URI; String name = localNode.getNodeName().toLowerCase(); if (name.equals("#text")) { localNode = processTextNode(node, doc); } else if (name.length() == 1) { switch (name.charAt(0)) { case 'b': try { localNode = doc.renameNode(localNode, URI, "strong"); } catch (DOMException ex) { } break; case 'i': try { localNode = doc.renameNode(localNode, URI, "em"); } catch (DOMException ex) { } break; case 'u': if (localNode instanceof Element) { try { localNode = doc.renameNode(localNode, URI, "span"); elem = (Element) localNode; elem.setAttribute("style", "text-decoration: underline;"); } catch (DOMException ex) { } } break; } } else if (name.equals("strike")) { if (localNode instanceof Element) { try { localNode = doc.renameNode(localNode, URI, "span"); elem = (Element) localNode; elem.setAttribute("style", "text-decoration: line-through;"); } catch (DOMException ex) { } } } return localNode; }</code><technical_language>clone something? If not, manipulating reference passed in anyhow</technical_language>

Target:
private Node processNodeWithoutAttributes(Node node, Document doc) { Element elem = null; String URI = Strings.nullToEmpty(node.getNamespaceURI()); String name = node.getNodeName().toLowerCase(); if (name.equals("#text")) { node = processTextNode(node, doc); } else if (name.length() == 1) { switch (name.charAt(0)) { case 'b': try { node = doc.renameNode(node, URI, "strong"); } catch (DOMException ex) { } break; case 'i': try { node = doc.renameNode(node, URI, "em"); } catch (DOMException ex) { } break; case 'u': if (node instanceof Element) { try { node = doc.renameNode(node, URI, "span"); elem = (Element) node; elem.setAttribute("style", "text-decoration: underline;"); } catch (DOMException ex) { } } break; } } else if (name.equals("strike")) { if (node instanceof Element) { try { node = doc.renameNode(node, URI, "span"); elem = (Element) node; elem.setAttribute("style", "text-decoration: line-through;"); } catch (DOMException ex) { } } } return node; }
Source:
<code>public ProjectState next() { ProjectState n = next; if (n == null) { throw new NoSuchElementException(); } next = null; Project.NameKey parentName = n.getProject().getParent(); if (parentName != null && seen.add(parentName)) { ProjectState p = cache.get(parentName); if (p != null) { next = p; return n; } } if (seen.add(allProjectsName)) { next = cache.get(allProjectsName); } return n; <START> } <END></code><technical_language>nit: I next() call a method find next n next separated. ProjectState n = next; if (n == null) { throw new NoSuchElementException(); } next = findNext(); return n;</technical_language>

Target:
public ProjectState next() { ProjectState n = next; if (n == null) { throw new NoSuchElementException(); } next = computeNext(n); return n; }
Source:
<code>private void handleUnmanagedCommands() { List<AsyncTask> asyncTasks = asyncTaskDao.getAll(); Set<Guid> asyncTaskManagerManagedCommands = asyncTasks.stream().filter(x -> x.getVdsmTaskId() != null) .map(x -> x.getRootCommandId()).collect(Collectors.toSet()); asyncTaskManagerManagedCommands.addAll(asyncTasks.stream().filter(x -> x.getVdsmTaskId() != null) .map(x -> x.getCommandId()).collect(Collectors.toSet())); getCommands(false).stream() .filter(x -> x.getCommandStatus() == CommandStatus.ACTIVE) .filter(x -> !asyncTaskManagerManagedCommands.contains(x.getId())) <START> .forEach(x -> commandsCache.setReacquireLocks(x.getId(), true)); <END> ENDED_WITH_FAILURE. getCommands(false).stream() .filter(x -> !x.isCallbackEnabled()) .filter(x -> x.getCommandStatus() == CommandStatus.ACTIVE) .filter(x -> !asyncTaskManagerManagedCommands.contains(x.getId())) .forEach(x -> commandsCache.updateCommandStatus(x.getId(), CommandStatus.ENDED_WITH_FAILURE)); }</code><technical_language>reacquire lock in skip commandsCache.setReacquireLocks() commandEntity.setReacquireLocks()</technical_language>

Target:
private void handleUnmanagedCommands() { List<AsyncTask> asyncTasks = asyncTaskDao.getAll(); Set<Guid> asyncTaskManagerManagedCommands = asyncTasks.stream().filter(x -> x.getVdsmTaskId() != null) .map(x -> x.getRootCommandId()).collect(Collectors.toSet()); asyncTaskManagerManagedCommands.addAll(asyncTasks.stream().filter(x -> x.getVdsmTaskId() != null) .map(x -> x.getCommandId()).collect(Collectors.toSet())); getCommands(false).stream() .filter(x -> x.getCommandStatus() == CommandStatus.ACTIVE) .filter(x -> !asyncTaskManagerManagedCommands.contains(x.getId())) .forEach(x -> retrieveCommand(x.getId()).reacquireLocks()); ENDED_WITH_FAILURE. getCommands(false).stream() .filter(x -> !x.isCallbackEnabled()) .filter(x -> x.getCommandStatus() == CommandStatus.ACTIVE) .filter(x -> !asyncTaskManagerManagedCommands.contains(x.getId())) .forEach(x -> commandsCache.updateCommandStatus(x.getId(), CommandStatus.ENDED_WITH_FAILURE)); }
Source:
<code>protected void examineStorageSubSystemCommandFullCloneFlagForVmware(CopyCommand cmd, EnumMap<VmwareStorageProcessorConfigurableFields,Object> params) { HypervisorType hypervisor = cmd.getDestTO().getHypervisorType(); if (hypervisor == null || (hypervisor != null && ! hypervisor.equals(HypervisorType.VMware))) return; DataStoreTO destDataStore = cmd.getDestTO().getDataStore(); if (destDataStore instanceof PrimaryDataStoreTO){ PrimaryDataStoreTO dest = (PrimaryDataStoreTO) destDataStore; if (dest.isFullCloneFlag() != null){ <START> params.put(VmwareStorageProcessorConfigurableFields.FULL_CLONE_FLAG, dest.isFullCloneFlag().booleanValue()); <END> } } }</code><technical_language>Modifying a passed parameter creates side-effects increase coupling. Consider refactoring return a copy of params parameter contains new values</technical_language>

Target:
protected EnumMap<VmwareStorageProcessorConfigurableFields,Object> examineStorageSubSystemCommandFullCloneFlagForVmware(CopyCommand cmd, EnumMap<VmwareStorageProcessorConfigurableFields,Object> params) { EnumMap<VmwareStorageProcessorConfigurableFields, Object> paramsCopy = new EnumMap<VmwareStorageProcessorConfigurableFields, Object>(params); HypervisorType hypervisor = cmd.getDestTO().getHypervisorType(); if (hypervisor != null && hypervisor.equals(HypervisorType.VMware)){ DataStoreTO destDataStore = cmd.getDestTO().getDataStore(); if (destDataStore instanceof PrimaryDataStoreTO){ PrimaryDataStoreTO dest = (PrimaryDataStoreTO) destDataStore; if (dest.isFullCloneFlag() != null){ paramsCopy.put(VmwareStorageProcessorConfigurableFields.FULL_CLONE_FLAG, dest.isFullCloneFlag().booleanValue()); } } } return paramsCopy; }
Source:
<code>private void fillBuffer() { if (remaining > 0 || endOfFile) { return; } int next; while (true) { if (trunk == null) { trunk = trunkIterator.next(); trunkIndex = 0; logKey++; if (trunk == null || trunk.getLogKey() != logKey) { endOfFile = true; return; } <START> } else { <END> next = trunk.getPageData(trunkIndex++); if (next == -1) { trunk = null; } else if (dataPage == -1 || dataPage == next) { break; } } } if (trace.isDebugEnabled()) { trace.debug("pageIn.readPage " + next); } dataPage = -1; data = null; Page p = store.getPage(next); if (p instanceof PageStreamData) { data = (PageStreamData) p; } if (data == null || data.getLogKey() != logKey) { endOfFile = true; return; } dataPos = PageStreamData.getReadStart(); remaining = store.getPageSize() - dataPos; }</code><technical_language>no, right, assign trunk if block</technical_language>

Target:
private void fillBuffer() { if (remaining > 0 || endOfFile) { return; } int next; while (true) { if (trunk == null) { trunk = trunkIterator.next(); trunkIndex = 0; logKey++; if (trunk == null || trunk.getLogKey() != logKey) { endOfFile = true; return; } } if (trunk != null) { next = trunk.getPageData(trunkIndex++); if (next == -1) { trunk = null; } else if (dataPage == -1 || dataPage == next) { break; } } } if (trace.isDebugEnabled()) { trace.debug("pageIn.readPage " + next); } dataPage = -1; data = null; Page p = store.getPage(next); if (p instanceof PageStreamData) { data = (PageStreamData) p; } if (data == null || data.getLogKey() != logKey) { endOfFile = true; return; } dataPos = PageStreamData.getReadStart(); remaining = store.getPageSize() - dataPos; }
Source:
<code>protected SubtaskAllExecutionAttemptsDetailsInfo createSubtaskExecutionAttemptsDetailsInfo( AccessExecutionVertex executionVertex, JobID jobID, JobVertexID jobVertexID) { List<SubtaskExecutionAttemptDetailsInfo> allAttempts = new ArrayList<>(); executionVertex.getPriorExecutionAttempts().forEach(execution -> { <START> if (execution != null) { <END> allAttempts.add(SubtaskExecutionAttemptDetailsInfo.create(execution, metricFetcher, jobID, jobVertexID)); } }); allAttempts.add(SubtaskExecutionAttemptDetailsInfo.create(executionVertex.getCurrentExecutionAttempt(), metricFetcher, jobID, jobVertexID)); return new SubtaskAllExecutionAttemptsDetailsInfo(allAttempts); }</code><technical_language>explain execution null in prior execution attempts list</technical_language>

Target:
protected SubtaskAllExecutionAttemptsDetailsInfo createSubtaskExecutionAttemptsDetailsInfo( AccessExecutionVertex executionVertex, JobID jobID, JobVertexID jobVertexID) { List<SubtaskExecutionAttemptDetailsInfo> allAttempts = new ArrayList<>(); executionVertex .getPriorExecutionAttempts() .forEach(execution -> allAttempts.add(SubtaskExecutionAttemptDetailsInfo.create(execution, metricFetcher, jobID, jobVertexID))); allAttempts.add(SubtaskExecutionAttemptDetailsInfo.create(executionVertex.getCurrentExecutionAttempt(), metricFetcher, jobID, jobVertexID)); return new SubtaskAllExecutionAttemptsDetailsInfo(allAttempts); }
Source:
<code>protected void process(List<Integer> chunks) { <START> myUiFacade.setDownloadProgress(chunks.get(chunks.size() - 1)); <END> }</code><technical_language>I suggest UIFacade.setStatusText for this purpose (construct string shown right here). Currently method implementation, is trivial implement</technical_language>

Target:
protected void process(List<Integer> chunks) { String statusText = ""; int chunk = chunks.get(chunks.size() - 1); if (chunk > -1) { statusText = GanttLanguage.getInstance().formatText("downloadProgress", chunk); } myUiFacade.setStatusText(statusText); }
Source:
<code>private JsonElement serializeModule(ProjectConfig moduleConfig, JsonSerializationContext context) { JsonObject object = new JsonObject(); <START> <END> object.addProperty("name", moduleConfig.getName()); object.addProperty("path", moduleConfig.getPath()); object.addProperty("type", moduleConfig.getType()); object.addProperty("description", moduleConfig.getDescription()); object.addProperty("content_root", moduleConfig.getContentRoot()); object.add("mixins", context.serialize(moduleConfig.getMixins())); object.add("attributes", context.serialize(moduleConfig.getAttributes())); object.add("modules", serializeModules(moduleConfig, context)); object.add("links", context.serialize(moduleConfig.getLinks())); object.add("problems", context.serialize(moduleConfig.getProblems())); object.add("source", context.serialize(moduleConfig.getSource())); return object; }</code><technical_language>Need check need store Workspace. attributes stored some of calculate runtime</technical_language>

Target:
private JsonElement serializeModule(ProjectConfig moduleConfig, JsonSerializationContext context) { JsonObject object = new JsonObject(); object.addProperty("name", moduleConfig.getName()); object.addProperty("path", moduleConfig.getPath()); object.addProperty("type", moduleConfig.getType()); object.addProperty("content_root", moduleConfig.getContentRoot()); object.add("attributes", context.serialize(moduleConfig.getAttributes())); object.add("modules", serializeModules(moduleConfig, context)); object.add("source", context.serialize(moduleConfig.getSource())); return object; }
Source:
<code>public AzureEnvironment environment() { <START> if (this.environment == null) { this.environment = AzureEnvironment.AZURE; } <END> return environment; }</code><technical_language>Prefer a null environment start</technical_language>

Target:
public AzureEnvironment environment() { return environment; }
Source:
<code>public void incrementValue(ITmfEvent event, int quark, long timestamp) throws StateValueTypeException, TimeRangeException, AttributeNotFoundException { ITmfStateSystemBuilder ss = fProvider.getAssignedStateSystem(); int increment = 0; ITmfStateValue incrementValue = getValue(event); <START> if (incrementValue.getType() == ITmfStateValue.Type.INTEGER) { <END> increment = incrementValue.unboxInt(); } else if (incrementValue.getType() == ITmfStateValue.Type.LONG) { increment = (int) incrementValue.unboxLong(); } else { Activator.logWarning(String.format("TmfXmlStateValue: The event field increment %s is not a number type but a %s", fFieldName, incrementValue.getType())); } int currentValue = ss.queryOngoingState(quark).unboxInt(); ITmfStateValue value = TmfStateValue.newValueInt(increment + currentValue); processValue(quark, timestamp, value); }</code><technical_language>switch/case</technical_language>

Target:
public void incrementValue(ITmfEvent event, int quark, long timestamp) throws StateValueTypeException, TimeRangeException, AttributeNotFoundException { ITmfStateSystemBuilder ss = fProvider.getAssignedStateSystem(); ITmfStateValue incrementValue = getValue(event); switch (incrementValue.getType()) { case INTEGER: { int increment = incrementValue.unboxInt(); int currentValue = ss.queryOngoingState(quark).unboxInt(); ITmfStateValue value = TmfStateValue.newValueInt(increment + currentValue); processValue(quark, timestamp, value); break; } case LONG: { long incrementLong = incrementValue.unboxLong(); long currentValue = ss.queryOngoingState(quark).unboxLong(); ITmfStateValue value = TmfStateValue.newValueLong(incrementLong + currentValue); processValue(quark, timestamp, value); break; } case DOUBLE: case NULL: case STRING: default: Activator.logWarning(String.format("TmfXmlStateValue: The event field increment %s is not a number type but a %s", fFieldName, incrementValue.getType())); break; } }
Source:
<code>protected void playMedia(String mediaType) { Intent i = new Intent("android.intent.action.VIEW"); File mediaFile = new File(mInstanceFolder + mBinaryName); Uri mediaUri = FileUtil.getUriForExternalFile(getContext(), mediaFile); i.setDataAndType(mediaUri, mediaType); UriToFilePath.grantPermissionForUri(getContext(), i, mediaUri, Intent.FLAG_GRANT_READ_URI_PERMISSION); try { getContext().startActivity(i); } catch (ActivityNotFoundException e) { Toast.makeText(getContext(), StringUtils.getStringSpannableRobust(getContext(), R.string.activity_not_found, <START> "play media"), <END> Toast.LENGTH_SHORT).show(); } }</code><technical_language>I valuable type of media activity able find</technical_language>

Target:
protected void playMedia(String mediaType) { Intent i = new Intent("android.intent.action.VIEW"); File mediaFile = new File(mInstanceFolder + mBinaryName); Uri mediaUri = FileUtil.getUriForExternalFile(getContext(), mediaFile); i.setDataAndType(mediaUri, mediaType); UriToFilePath.grantPermissionForUri(getContext(), i, mediaUri, Intent.FLAG_GRANT_READ_URI_PERMISSION); try { getContext().startActivity(i); } catch (ActivityNotFoundException e) { Toast.makeText(getContext(), StringUtils.getStringSpannableRobust(getContext(), R.string.activity_not_found, "play " + mediaType.substring(0, mediaType.indexOf("/"))), Toast.LENGTH_SHORT).show(); } }
Source:
<code>protected Pool assembleDevPool(Consumer consumer, String sku) { Set<Product> providedProducts = new HashSet<Product>(); Date now = new Date(); <START> Product prod = getCdkInstalledProduct(consumer, sku); <END> if (StringUtils.isEmpty(prod.getAttributeValue("support_level"))) { prod.setAttribute("support_level", this.DEFAULT_CDK_SLA); prod = productCurator.createOrUpdate(prod); } for (ConsumerInstalledProduct ip : consumer.getInstalledProducts()) { providedProducts.add(getCdkInstalledProduct(consumer, ip.getProductId())); } Date then = new Date(now.getTime() + getPoolInterval(prod)); Pool p = new Pool(consumer.getOwner(), prod, providedProducts, 1L, now, then, "", "", ""); p.setAttribute(Pool.DEVELOPMENT_POOL_ATTRIBUTE, "true"); p.setAttribute(Pool.REQUIRES_CONSUMER_ATTRIBUTE, consumer.getUuid()); return p; }</code><technical_language>This is installed product, is SKU. reusing this method here, get error missing installed product if found</technical_language>

Target:
protected Pool assembleDevPool(Consumer consumer, String sku) { Set<Product> providedProducts = new HashSet<Product>(); Date now = new Date(); List<String> devProductIds = new ArrayList<String>(); Product skuProd = null; devProductIds.add(sku); for (ConsumerInstalledProduct ip : consumer.getInstalledProducts()) { devProductIds.add(ip.getProductId()); } List<Product> prods = productAdapter.getProductsByIds(consumer.getOwner(), devProductIds); verifyDevProducts(devProductIds, prods); for (Product prod : prods) { prod.setOwner(consumer.getOwner()); for (ProductContent pc : prod.getProductContent()) { pc.getContent().setOwner(consumer.getOwner()); } if (sku.equals(prod.getId())) { if (StringUtils.isEmpty(prod.getAttributeValue("support_level"))) { prod.setAttribute("support_level", this.DEFAULT_DEV_SLA); } skuProd = prod; } else { providedProducts.add(prod); } productCurator.createOrUpdate(prod); } Date then = new Date(now.getTime() + getPoolInterval(skuProd)); Pool p = new Pool(consumer.getOwner(), skuProd, providedProducts, 1L, now, then, "", "", ""); log.info("Created development pool with SKU " + skuProd.getId()); p.setAttribute(Pool.DEVELOPMENT_POOL_ATTRIBUTE, "true"); p.setAttribute(Pool.REQUIRES_CONSUMER_ATTRIBUTE, consumer.getUuid()); return p; }
Source:
<code>public boolean isAssignedSeveralTimes() { if (Objects.nonNull(selectedLogicalNode) && selectedLogicalNode.getData() instanceof StructureTreeNode) { StructureTreeNode structureTreeNode = (StructureTreeNode) selectedLogicalNode.getData(); <START> if (Objects.nonNull(structureTreeNode.getDataObject()) && structureTreeNode.getDataObject() instanceof View) { <END> View view = (View) structureTreeNode.getDataObject(); return view.getMediaUnit().getIncludedStructuralElements().size() > 1; } } return false; }</code><technical_language>suggestion if (structureTreeNode.getDataObject() instanceof View) { instanceof checks null</technical_language>

Target:
public boolean isAssignedSeveralTimes() { if (Objects.nonNull(selectedLogicalNode) && selectedLogicalNode.getData() instanceof StructureTreeNode) { StructureTreeNode structureTreeNode = (StructureTreeNode) selectedLogicalNode.getData(); if (structureTreeNode.getDataObject() instanceof View) { View view = (View) structureTreeNode.getDataObject(); return view.getMediaUnit().getIncludedStructuralElements().size() > 1; } } return false; }
Source:
<code>private void populateNodeParameters(PreparedStatement statement, int initialIndex, Node node) { <START> int prmIndex = 0; <END> if (node.getTimestamp() == null) { throw new OsmosisRuntimeException("Node " + node.getId() + " does not have a timestamp set."); } try { statement.setLong(++prmIndex, node.getId()); statement.setTimestamp(++prmIndex, new Timestamp(node.getTimestamp().getTime())); statement.setInt(++prmIndex, node.getVersion()); statement.setBoolean(++prmIndex, true); statement.setLong(++prmIndex, node.getChangesetId()); statement.setInt(++prmIndex, FixedPrecisionCoordinateConvertor.convertToFixed(node.getLatitude())); statement.setInt(++prmIndex, FixedPrecisionCoordinateConvertor.convertToFixed(node.getLongitude())); statement.setLong(++prmIndex, tileCalculator.calculateTile(node.getLatitude(), node.getLongitude())); } catch (SQLException e) { throw new OsmosisRuntimeException("Unable to set a prepared statement parameter for a node.", e); } }</code><technical_language>This is ignoring initialIndex parameter prmIndex initialised incorrectly. initialIndex parameter ignored</technical_language>

Target:
private void populateNodeParameters(PreparedStatement statement, int initialIndex, Node node) { int prmIndex = initialIndex; if (node.getTimestamp() == null) { throw new OsmosisRuntimeException("Node " + node.getId() + " does not have a timestamp set."); } try { statement.setLong(++prmIndex, node.getId()); statement.setTimestamp(++prmIndex, new Timestamp(node.getTimestamp().getTime())); statement.setInt(++prmIndex, node.getVersion()); statement.setBoolean(++prmIndex, true); statement.setLong(++prmIndex, node.getChangesetId()); statement.setInt(++prmIndex, FixedPrecisionCoordinateConvertor.convertToFixed(node.getLatitude())); statement.setInt(++prmIndex, FixedPrecisionCoordinateConvertor.convertToFixed(node.getLongitude())); statement.setLong(++prmIndex, tileCalculator.calculateTile(node.getLatitude(), node.getLongitude())); } catch (SQLException e) { throw new OsmosisRuntimeException("Unable to set a prepared statement parameter for a node.", e); } }
Source:
<code>public AbstractLayoutEditPartProvider getLayoutNodeProvider(final IGraphicalEditPart container) { ExtendableLayoutProvider layoutProvider = <START> (ExtendableLayoutProvider) getGenericLayoutProvider(container); <END> if (layoutProvider != null) { final CompoundLayoutProvider clp = new CompoundLayoutProvider(); clp.addProvider((AbstractLayoutEditPartProvider) layoutProvider); clp.addProvider(new PinnedElementsLayoutProvider(layoutProvider)); ArrangeSelectionLayoutProvider layoutNodeProvider = null; if (ENABLE_BORDERED_NODES_ARRANGE_ALL) { AbstractLayoutProvider abstractLayoutProvider = new BorderItemAwareLayoutProvider(clp); layoutNodeProvider = new ArrangeSelectionLayoutProvider(abstractLayoutProvider); } else { layoutNodeProvider = new ArrangeSelectionLayoutProvider(clp); } return new ArrangeSelectionLayoutProvider(layoutNodeProvider); } return null; }</code><technical_language>ELKLayoutNodeProvider is a ExtendableMayoutProvider getGenericLayoutProvider return a ExtendableLayoutProvider? I check it</technical_language>

Target:
public AbstractLayoutEditPartProvider getLayoutNodeProvider(final IGraphicalEditPart container) { DefaultLayoutProvider defaultLayoutProvider = getGenericLayoutProvider(container); if (defaultLayoutProvider != null) { final CompoundLayoutProvider clp = new CompoundLayoutProvider(); clp.addProvider(defaultLayoutProvider); if (defaultLayoutProvider instanceof ExtendableLayoutProvider) { ExtendableLayoutProvider layoutProvider = (ExtendableLayoutProvider) getGenericLayoutProvider(container); clp.addProvider(new PinnedElementsLayoutProvider(layoutProvider)); } ArrangeSelectionLayoutProvider layoutNodeProvider = null; if (ENABLE_BORDERED_NODES_ARRANGE_ALL) { AbstractLayoutProvider abstractLayoutProvider = new BorderItemAwareLayoutProvider(clp); layoutNodeProvider = new ArrangeSelectionLayoutProvider(abstractLayoutProvider); } else { layoutNodeProvider = new ArrangeSelectionLayoutProvider(clp); } return layoutNodeProvider; } return null; }
Source:
<code>public static boolean sameElementValues(AnnotationMirror am1, AnnotationMirror am2) { if (am1 == am2) { return true; } Map<? extends ExecutableElement, ? extends AnnotationValue> vals1 = am1.getElementValues(); Map<? extends ExecutableElement, ? extends AnnotationValue> vals2 = am2.getElementValues(); for (ExecutableElement meth : ElementFilter.methodsIn( am1.getAnnotationType().asElement().getEnclosedElements())) { AnnotationValue aval1 = vals1.get(meth); AnnotationValue aval2 = vals2.get(meth); if (aval1 == null) { aval1 = meth.getDefaultValue(); } if (aval2 == null) { aval2 = meth.getDefaultValue(); } <START> if (0 != compareAnnotationValue(aval1, aval2)) { <END> return false; } } return true; }</code><technical_language>change this line original is easier read</technical_language>

Target:
public static boolean sameElementValues(AnnotationMirror am1, AnnotationMirror am2) { if (am1 == am2) { return true; } Map<? extends ExecutableElement, ? extends AnnotationValue> vals1 = am1.getElementValues(); Map<? extends ExecutableElement, ? extends AnnotationValue> vals2 = am2.getElementValues(); for (ExecutableElement meth : ElementFilter.methodsIn( am1.getAnnotationType().asElement().getEnclosedElements())) { AnnotationValue aval1 = vals1.get(meth); AnnotationValue aval2 = vals2.get(meth); if (aval1 == null) { aval1 = meth.getDefaultValue(); } if (aval2 == null) { aval2 = meth.getDefaultValue(); } if (!sameAnnotationValue(aval1, aval2)) { return false; } } return true; }
Source:
<code>public FenceOperationResult getFenceAgentStatus(FenceAgent fenceAgent) { if (fenceAgent == null) { return new FenceOperationResult( Status.ERROR, PowerStatus.UNKNOWN, "Invalid fence agent specified."); } <START> List<FenceAgent> fenceAgents = new ArrayList<>(); <END> fenceAgents.add(fenceAgent); return fence(FenceActionType.STATUS, fenceAgents); }</code><technical_language>instead of 3 lines one? return fence(FenceActionType.STATUS, Arrays.asList(fenceAgent) )</technical_language>

Target:
public FenceOperationResult getFenceAgentStatus(FenceAgent fenceAgent) { if (fenceAgent == null) { return new FenceOperationResult( Status.ERROR, PowerStatus.UNKNOWN, "Invalid fence agent specified."); } return fence(FenceActionType.STATUS, Arrays.asList(fenceAgent)); }
Source:
<code>public static void setAppContext(@NonNull Context context) { OneSignal.onesignalLog(LOG_LEVEL.VERBOSE, "setAppContext(context) called!"); if (context == null) { Log(LOG_LEVEL.WARN, "context is null, ignoring!"); return; } boolean wasAppContextNull = (appContext == null); appContext = context.getApplicationContext(); setupActivityLifecycleListener(wasAppContextNull); OneSignal.onesignalLog(LOG_LEVEL.VERBOSE, "setAppContext(context) finished, checking if appId has been set before proceeding..."); if (appId == null) { String oldAppId = getSavedAppId(); if (oldAppId == null) { OneSignal.onesignalLog(LOG_LEVEL.WARN, "appContext set, but please call setAppId(appId) with a valid appId to complete OneSignal init!"); } else { <START> OneSignal.onesignalLog(LOG_LEVEL.VERBOSE, "appContext set and an old appId was found, attempting to call setAppId(oldAppId)"); <END> setAppId(oldAppId); } return; } OneSignal.onesignalLog(LOG_LEVEL.VERBOSE, "setAppContext(context) successful and appId is set, continuing OneSignal init..."); init(context); }</code><technical_language>logger.verbose here</technical_language>

Target:
public static void setAppContext(@NonNull Context context) { logger.verbose("setAppContext(context) called!"); if (context == null) { Log(LOG_LEVEL.WARN, "context is null, ignoring!"); return; } boolean wasAppContextNull = (appContext == null); appContext = context.getApplicationContext(); setupActivityLifecycleListener(wasAppContextNull); logger.verbose("setAppContext(context) finished, checking if appId has been set before proceeding..."); if (appId == null) { String oldAppId = getSavedAppId(); if (oldAppId == null) { logger.warning("appContext set, but please call setAppId(appId) with a valid appId to complete OneSignal init!"); } else { logger.verbose("appContext set and an old appId was found, attempting to call setAppId(oldAppId)"); setAppId(oldAppId); } return; } logger.verbose("setAppContext(context) successful and appId is set, continuing OneSignal init..."); init(context); }
Source:
<code>public UpdateExecutionPageJob(TreeViewer treeViewer) { super("Updating duration of non-finished operations"); this.treeViewer = treeViewer; <START> this.operationItems = Sets.newConcurrentHashSet(); <END> this.removeableItems = Sets.newConcurrentHashSet(); this.running = true; }</code><technical_language>A general caution concurrency: concurrent sets guarantee safety sets a combined meaning/need coordinated. In this special case is fine object is unique started end events thread in right order. I thought deeply it, a race condition missing. synchronization overhead is a measurable problem, I suggest a simple synchronized block access of fields</technical_language>

Target:
public UpdateExecutionPageJob(TreeViewer treeViewer) { super("Updating duration of non-finished operations"); this.treeViewer = treeViewer; this.activeItems = new MapMaker().concurrencyLevel(2).makeMap(); this.running = true; }
Source:
<code>public HudsonP4Executor newExecutor() { <START> return new HudsonP4RemoteExecutor(hudsonLauncher, env, filePath); <END> }</code><technical_language>This is exact of (much simpler) fix I attempted in <LINK_0></technical_language>

Target:
public HudsonP4Executor newExecutor() { if(hudsonLauncher instanceof RemoteLauncher){ return new HudsonP4RemoteExecutor(hudsonLauncher, env, filePath); } else { return new HudsonP4DefaultExecutor(hudsonLauncher, env, filePath); } }
Source:
<code>public MultiBucketContentRepoEndpoint getCorpusStorage() { return (corpusStorageView != null) ? corpusStorageView : (input.contentRepo == null) ? NULL_CONTENT_REPO_ENDPOINT : (input.contentRepo.corpus == null) ? NULL_CONTENT_REPO_ENDPOINT : (corpusStorageView = new MultiBucketContentRepoEndpoint() { private final ImmutableSet<String> buckets; <START> { <END> ImmutableSet.Builder<String> buckets = ImmutableSet.builder(); buckets.add(getDefaultBucket()); if (input.contentRepo.corpus.secondaryBuckets != null) { buckets.addAll(input.contentRepo.corpus.secondaryBuckets); } this.buckets = null; } @Override public URI getAddress() { return input.contentRepo.corpus.address; } @Override public String getDefaultBucket() { return input.contentRepo.corpus.bucket; } @Override public ImmutableSet<String> getAllBuckets() { return buckets; } }); }</code><technical_language>This bracket misplaced</technical_language>

Target:
public MultiBucketContentRepoEndpoint getCorpusStorage() { return (corpusStorageView != null) ? corpusStorageView : (input.contentRepo == null) ? NULL_CONTENT_REPO_ENDPOINT : (input.contentRepo.corpus == null) ? NULL_CONTENT_REPO_ENDPOINT : (corpusStorageView = new MultiBucketContentRepoEndpoint() { private final ImmutableSet<String> buckets; { ImmutableSet.Builder<String> buckets = ImmutableSet.builder(); buckets.add(getDefaultBucket()); if (input.contentRepo.corpus.secondaryBuckets != null) { buckets.addAll(input.contentRepo.corpus.secondaryBuckets); } this.buckets = buckets.build(); } @Override public URI getAddress() { return input.contentRepo.corpus.address; } @Override public String getDefaultBucket() { return input.contentRepo.corpus.bucket; } @Override public ImmutableSet<String> getAllBuckets() { return buckets; } }); }
Source:
<code><START> public boolean shouldRefreshCoordinator(Errors error) { <END> return error == Errors.COORDINATOR_LOAD_IN_PROGRESS || error == Errors.COORDINATOR_NOT_AVAILABLE; }</code><technical_language>This method static depend local state. for hasCoordinatorMoved</technical_language>

Target:
public static boolean shouldRefreshCoordinator(Errors error) { return error == Errors.COORDINATOR_LOAD_IN_PROGRESS || error == Errors.COORDINATOR_NOT_AVAILABLE; }
Source:
<code>public String renderArticleRelatedContent(HttpServletRequest request, Model model, @SiteParam Site site, @RequestParam("id") String articleId) throws IOException { <START> enforceDevFeature("relatedContentTab"); <END> Map<?, ?> articleMetadata = requestArticleMetadata(articleId); validateArticleVisibility(site, articleMetadata); model.addAttribute("article", articleMetadata); model.addAttribute("containingLists", getContainingArticleLists(articleId, site)); model.addAttribute("categoryTerms", getCategoryTerms(articleMetadata)); addCrossPublishedJournals(request, model, site, articleMetadata); requestAuthors(model, articleId); requestComments(model, articleId); String recaptchaPublicKey = site.getTheme().getConfigMap("captcha").get("publicKey").toString(); model.addAttribute("recaptchaPublicKey", recaptchaPublicKey); return site + "/ftl/article/relatedContent"; }</code><technical_language>Please add this: requireNonemptyParameter(articleId);</technical_language>

Target:
public String renderArticleRelatedContent(HttpServletRequest request, Model model, @SiteParam Site site, @RequestParam("id") String articleId) throws IOException { enforceDevFeature("relatedContentTab"); requireNonemptyParameter(articleId); Map<?, ?> articleMetadata = requestArticleMetadata(articleId); validateArticleVisibility(site, articleMetadata); model.addAttribute("article", articleMetadata); model.addAttribute("containingLists", getContainingArticleLists(articleId, site)); model.addAttribute("categoryTerms", getCategoryTerms(articleMetadata)); addCrossPublishedJournals(request, model, site, articleMetadata); requestAuthors(model, articleId); requestComments(model, articleId); String recaptchaPublicKey = site.getTheme().getConfigMap("captcha").get("publicKey").toString(); model.addAttribute("recaptchaPublicKey", recaptchaPublicKey); return site + "/ftl/article/relatedContent"; }
Source:
<code>private void update() { DebugCollector.update(); if (DebugOptions.SHOW_FPS) { DebugCollector.debug("Fps", Gdx.graphics.getFramesPerSecond()); } inputManager.update(this); <START> if (solGame == null) { <END> menuBackgroundManager.update(); } else { solGame.update(); } SolMath.checkVectorsTaken(null); }</code><technical_language>I do this check all. if want a screen free animation</technical_language>

Target:
private void update() { DebugCollector.update(); if (DebugOptions.SHOW_FPS) { DebugCollector.debug("Fps", Gdx.graphics.getFramesPerSecond()); } inputManager.update(this); if (solGame != null) { solGame.update(); } SolMath.checkVectorsTaken(null); }
Source:
<code>private void generateSurface(World world, Random rand, int chunkX, int chunkZ) { for (int k = 0; k < 16; k++) { int firstBlockXCoord = chunkX + rand.nextInt(16); int firstBlockZCoord = chunkZ + rand.nextInt(16); int basaltHeight = 35; int marbleHeight = 100; int limestoneHeight = 40; int basaltY = rand.nextInt(basaltHeight); BlockPos basaltPos = new BlockPos(firstBlockXCoord, basaltY, firstBlockZCoord); if (Configurations.basaltAmount > 0) <START> (new WorldGenMinable(ForgeRegistries.BLOCKS.getValue(new ResourceLocation("chisel", "basaltextra")).getStateFromMeta(7), Configurations.basaltAmount)).generate(world, rand, basaltPos); <END> int marbleY = rand.nextInt(marbleHeight); BlockPos marblePos = new BlockPos(firstBlockXCoord, marbleY, firstBlockZCoord); if (Configurations.marbleAmount > 0) (new WorldGenMinable(ForgeRegistries.BLOCKS.getValue(new ResourceLocation("chisel", "marbleextra")).getStateFromMeta(7), Configurations.marbleAmount)).generate(world, rand, marblePos); int limestoneY = rand.nextInt(limestoneHeight); BlockPos limestonePos = new BlockPos(firstBlockXCoord, limestoneY, firstBlockZCoord); if (Configurations.limestoneAmount > 0) (new WorldGenMinable(ForgeRegistries.BLOCKS.getValue(new ResourceLocation("chisel", "limestoneextra")).getStateFromMeta(7), Configurations.limestoneAmount)).generate(world, rand, limestonePos); } }</code><technical_language>do this lookup time, cache in a field. Also, add a //TODO for do finally easy Block reference class</technical_language>

Target:
private void generateSurface(World world, Random rand, int chunkX, int chunkZ) { for (int k = 0; k < 16; k++) { int firstBlockXCoord = chunkX + rand.nextInt(16); int firstBlockZCoord = chunkZ + rand.nextInt(16); int basaltY = rand.nextInt(basaltHeight); BlockPos basaltPos = new BlockPos(firstBlockXCoord, basaltY, firstBlockZCoord); if (Configurations.basaltAmount > 0) (new WorldGenMinable(ChiselBlocks.basaltextra.getStateFromMeta(7), Configurations.basaltAmount)).generate(world, rand, basaltPos); int marbleY = rand.nextInt(marbleHeight); BlockPos marblePos = new BlockPos(firstBlockXCoord, marbleY, firstBlockZCoord); if (Configurations.marbleAmount > 0) (new WorldGenMinable(ChiselBlocks.marbleextra.getStateFromMeta(7), Configurations.marbleAmount)).generate(world, rand, marblePos); int limestoneY = rand.nextInt(limestoneHeight); BlockPos limestonePos = new BlockPos(firstBlockXCoord, limestoneY, firstBlockZCoord); if (Configurations.limestoneAmount > 0) (new WorldGenMinable(ChiselBlocks.limestoneextra.getStateFromMeta(7), Configurations.limestoneAmount)).generate(world, rand, limestonePos); } }
Source:
<code>public void testConcurrency() throws InterruptedException, IOException, ConfigurationException { double badness = DatabaseDescriptor.getDynamicBadnessThreshold(); DatabaseDescriptor.setDynamicBadnessThreshold(0.0); try { final int ITERATIONS = 10000; StorageService.instance.unsafeInitialize(); SimpleSnitch ss = new SimpleSnitch(); DynamicEndpointSnitch dsnitch = new DynamicEndpointSnitch(ss, String.valueOf(ss.hashCode())); InetAddressAndPort self = FBUtilities.getBroadcastAddressAndPort(); ReplicaList replicas = new ReplicaList(); for (int i = 0; i < 100; i++) for (int j = 0; j < 256; j++) <START> replicas.add(Replica.fullStandin(InetAddressAndPort.getByAddress(new byte[]{ 127, 0, (byte)i, (byte)j}))); <END> ScoreUpdater updater = new ScoreUpdater(dsnitch, replicas); updater.start(); ReplicaList result = null; for (int i = 0; i < ITERATIONS; i++) result = dsnitch.getSortedListByProximity(self, replicas); updater.stopped = true; updater.join(); } finally { DatabaseDescriptor.setDynamicBadnessThreshold(badness); } }</code><technical_language>Full standin, avoid it? snitch is generally concerned transientness ranges endpoints need replicas</technical_language>

Target:
public void testConcurrency() throws InterruptedException, IOException, ConfigurationException { double badness = DatabaseDescriptor.getDynamicBadnessThreshold(); DatabaseDescriptor.setDynamicBadnessThreshold(0.0); try { final int ITERATIONS = 10000; StorageService.instance.unsafeInitialize(); SimpleSnitch ss = new SimpleSnitch(); DynamicEndpointSnitch dsnitch = new DynamicEndpointSnitch(ss, String.valueOf(ss.hashCode())); InetAddressAndPort self = FBUtilities.getBroadcastAddressAndPort(); ReplicaList replicas = new ReplicaList(); for (int i = 0; i < 100; i++) for (int j = 0; j < 256; j++) replicas.add(ReplicaUtils.full(InetAddressAndPort.getByAddress(new byte[]{ 127, 0, (byte)i, (byte)j}))); ScoreUpdater updater = new ScoreUpdater(dsnitch, replicas); updater.start(); ReplicaList result = null; for (int i = 0; i < ITERATIONS; i++) result = dsnitch.getSortedListByProximity(self, replicas); updater.stopped = true; updater.join(); } finally { DatabaseDescriptor.setDynamicBadnessThreshold(badness); } }
Source:
<code>public MafEntry(String entry) { String fields = entry.split("\\s+"); if (fields.length != 7) throw new RuntimeException("Unexpected MAF line: "+entry); if (! fields[0].equals("s")) throw new RuntimeException("Unexpected MAF line: "+entry); src = fields[1]; <START> start = new Position0(Long.parseLong(fields[2])); <END> size = Integer.parseInt(fields[3]); strand = fields[4].equals("+"); if (! strand && !fields[4].equals("-") ) throw new RuntimeException("Unexpected MAF line: "+entry); srcSize = Integer.parseInt(fields[5]); text = fields[6]; }</code><technical_language>want add a parseSomething static method Position life easier</technical_language>

Target:
public MafEntry(String entry) { String fields = entry.split("\\s+"); if (fields.length != 7) throw new RuntimeException("Unexpected MAF line: "+entry); if (! fields[0].equals("s")) throw new RuntimeException("Unexpected MAF line: "+entry); src = fields[1]; start = Position0.valueOf(fields[2],0); size = Integer.parseInt(fields[3]); strand = fields[4].equals("+"); if (! strand && !fields[4].equals("-") ) throw new RuntimeException("Unexpected MAF line: "+entry); srcSize = Integer.parseInt(fields[5]); text = fields[6]; }
Source:
<code>public ImagesListReturn(Map<String, Object> innerMap) { super(innerMap); Object[] tempObj = (Object[]) innerMap.get(IMAGES_LIST); if (tempObj != null) { imageList = Arrays.stream(tempObj) <START> .map(id -> (String)id) <END> .filter(id -> isValidUUID(id)) .toArray(String[]::new); } }</code><technical_language>Consider method reference: String.class::cast</technical_language>

Target:
public ImagesListReturn(Map<String, Object> innerMap) { super(innerMap); Object[] tempObj = (Object[]) innerMap.get(IMAGES_LIST); if (tempObj != null) { imageList = Arrays.stream(tempObj) .map(String.class::cast) .filter(this::isValidUUID) .toArray(String[]::new); } }