auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public SharedSegment getHostSharedSegment(String mac) { LOG.debug("getHostNodeSharedSegment: founding segment for mac:{}", mac); final List<BridgeMacLink> links = new ArrayList<BridgeMacLink>(); m_bridgeMacLinkDao.findByMacAddress(mac). stream(). filter(maclink -> maclink.getLinkType() == BridgeMacLinkType.BRIDGE_LINK) <START> .forEach(maclink -> { <END> links.add(maclink); }); if (links.size() == 0 ) { LOG.info("getHostNodeSharedSegment: no segment found for mac:{}", mac); return SharedSegment.create(); } if (links.size() > 1 ) { LOG.error("getHostNodeSharedSegment: more then one segment for mac:{}", mac); return SharedSegment.create(); } BridgeMacLink link = links.iterator().next(); SharedSegment segment = null; try { for (BridgeBridgeLink bblink: m_bridgeBridgeLinkDao.getByDesignatedNodeIdBridgePort(link.getNode().getId(), link.getBridgePort())) { if (segment == null) { segment = SharedSegment.create(bblink); } else { segment.getBridgePortsOnSegment().add(BridgePort.getFromBridgeBridgeLink(bblink)); } } for (BridgeMacLink maclink :m_bridgeMacLinkDao.findByNodeIdBridgePort(link.getNode().getId(), link.getBridgePort())) { if (segment == null) { segment = SharedSegment.create(maclink); } else { segment.getMacsOnSegment().add(maclink.getMacAddress()); } } } catch (Exception e) { LOG.error("getHostNodeSharedSegment: cannot create shared segment for mac ", e.getMessage(), mac,e); return SharedSegment.create(); } return segment; }</code><technical_language>collect(...) instead of manually adding links list</technical_language>

Target:
public SharedSegment getHostSharedSegment(String mac) { LOG.debug("getHostNodeSharedSegment: founding segment for mac:{}", mac); final List<BridgeMacLink> links = m_bridgeMacLinkDao.findByMacAddress(mac). stream(). filter(maclink -> maclink.getLinkType() == BridgeMacLinkType.BRIDGE_LINK). collect(Collectors.toCollection(ArrayList::new)); if (links.size() == 0 ) { LOG.info("getHostNodeSharedSegment: no segment found for mac:{}", mac); return SharedSegment.create(); } if (links.size() > 1 ) { LOG.error("getHostNodeSharedSegment: more then one segment for mac:{}", mac); return SharedSegment.create(); } BridgeMacLink link = links.iterator().next(); SharedSegment segment = null; try { for (BridgeBridgeLink bblink: m_bridgeBridgeLinkDao.getByDesignatedNodeIdBridgePort(link.getNode().getId(), link.getBridgePort())) { if (segment == null) { segment = SharedSegment.create(bblink); } else { segment.getBridgePortsOnSegment().add(BridgePort.getFromBridgeBridgeLink(bblink)); } } for (BridgeMacLink maclink :m_bridgeMacLinkDao.findByNodeIdBridgePort(link.getNode().getId(), link.getBridgePort())) { if (segment == null) { segment = SharedSegment.create(maclink); } else { segment.getMacsOnSegment().add(maclink.getMacAddress()); } } } catch (Exception e) { LOG.error("getHostNodeSharedSegment: cannot create shared segment for mac ", e.getMessage(), mac,e); return SharedSegment.create(); } return segment; }
Source:
<code>protected Object doExecute() throws Exception { File destFile = new File(karafConfigPath + "overlord.properties"); <START> if (destFile.exists()) { <END> commonActions(); System.out.println(Messages.getString("overlord.configure.password.previous.installation")); return null; } else if (StringUtils.isBlank(adminPassword)) { throw new RuntimeException(Messages.getString("overlord.configure.password.required.first.install")); } else { commonActions(); ChangePasswordCommand passwordCommand = new ChangePasswordCommand(); passwordCommand.setCreationAllowed(true); passwordCommand.setBundleContext(bundleContext); passwordCommand.setPassword(adminPassword); passwordCommand.execute(session); } return null; }</code><technical_language>Nice changes</technical_language>

Target:
protected Object doExecute() throws Exception { File destFile = new File(karafConfigPath + "overlord.properties"); logger.info(Messages.getString("overlord.configure.execution")); if (destFile.exists()) { String message = Messages.getString("overlord.configure.password.previous.installation"); System.out.println(message); logger.info(message); return null; } else if (StringUtils.isBlank(password)) { throw new RuntimeException(Messages.getString("overlord.configure.password.required.first.install")); } else { logger.debug(Messages.getString("overlord.configure.execution.started")); commonActions(); ChangePasswordCommand passwordCommand = new ChangePasswordCommand(); passwordCommand.setCreationAllowed(true); passwordCommand.setBundleContext(bundleContext); passwordCommand.setPassword(password); passwordCommand.execute(session); logger.debug(Messages.getString("overlord.configure.execution.ended")); } return null; }
Source:
<code>@Override public void run() { try { while (!Thread.currentThread().isInterrupted()) { if (notifier.canOutputOperationLogs() && hiveStatement.hasMoreLogs()) { commands.debug("going to print operations logs"); updateQueryLog(); commands.debug("printed operations logs"); <START> } else { <END> Thread.sleep(queryProgressInterval); } } } catch (InterruptedException e) { commands.debug("Getting log thread is interrupted, since query is done!"); } finally { commands.showRemainingLogsIfAny(hiveStatement); } }</code><technical_language>need sleep if more lots generated. otherwise, this consume lot of cpu</technical_language>

Target:
@Override public void run() { try { while (hiveStatement.hasMoreLogs()) { if (notifier.canOutputOperationLogs()) { commands.debug("going to print operations logs"); updateQueryLog(); commands.debug("printed operations logs"); } Thread.sleep(queryProgressInterval); } } catch (InterruptedException e) { commands.debug("Getting log thread is interrupted, since query is done!"); } finally { commands.showRemainingLogsIfAny(hiveStatement); } }
Source:
<code>public void write(Location loc) throws Exception { <START> if (!Session.getInstance().hasDescription()) { <END> annotate("", loc); } }</code><technical_language>I this is needed annotate called needed</technical_language>

Target:
public void write(Location loc) throws Exception { annotate("", loc); }
Source:
<code>public <T extends CommandResult> void execute(final Command<T> command, final AsyncCallback<T> callback) { JdbcScheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { Stopwatch stopwatch = Stopwatch.createStarted(); List<CommandResult> results = servlet .handleCommands(Collections .<Command>singletonList(command)); CommandResult result = results.get(0); long elapsedSeconds = stopwatch.elapsed(TimeUnit.SECONDS); if (elapsedSeconds > maximumCommandExecutionTimeInSeconds) { throw new RuntimeException("Command execution takes too long. Takes: " + elapsedSeconds + " seconds, " + ", maximum allowed execution time: " + maximumCommandExecutionTimeInSeconds + " seconds, command: " + command); <START> } else { <END> } if (result instanceof SyncRegionUpdate) { System.out.println(((SyncRegionUpdate) result).getSql()); } if (result instanceof Exception) { throw new Error((Throwable) result); } else { callback.onSuccess((T) result); } } }); JdbcScheduler.get().process(); }</code><technical_language>Remove empty branch</technical_language>

Target:
public <T extends CommandResult> void execute(final Command<T> command, final AsyncCallback<T> callback) { JdbcScheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { Stopwatch stopwatch = Stopwatch.createStarted(); List<CommandResult> results = servlet .handleCommands(Collections .<Command>singletonList(command)); CommandResult result = results.get(0); long elapsedSeconds = stopwatch.elapsed(TimeUnit.SECONDS); if (elapsedSeconds > maximumCommandExecutionTimeInSeconds) { throw new RuntimeException("Command execution takes too long. Takes: " + elapsedSeconds + " seconds, " + ", maximum allowed execution time: " + maximumCommandExecutionTimeInSeconds + " seconds, command: " + command); } if (result instanceof SyncRegionUpdate) { System.out.println(((SyncRegionUpdate) result).getSql()); } if (result instanceof Exception) { throw new Error((Throwable) result); } else { callback.onSuccess((T) result); } } }); JdbcScheduler.get().process(); }
Source:
<code><START> public JNDIObjectLocatorBuilder clearEnvironment() { <END> if (this.environmentKey != null) { this.environmentKey.clear(); this.environmentValue.clear(); } return this; }</code><technical_language>clean API. case of this</technical_language>

Target:
public JNDIObjectLocatorBuilder clearEnvironment() { if (this.environmentKeys != null) { this.environmentKeys.clear(); this.environmentValues.clear(); } return this; }
Source:
<code>public <T extends RealType<T>> DoubleType mae(final DoubleType out, final IterableInterval<T> reference, final IterableInterval<T> test) { final DoubleType result = (DoubleType) ops().run( <START> net.imagej.ops.image.quality.DefaultMAE.class, out, reference, test); <END> return result; }</code><technical_language>This ops().run(Ops.Image.MAE.class, out, reference, test);. if creates a more specific/specialized MAE op, matched. Otherwise, DefaultMAE used</technical_language>

Target:
public <T extends RealType<T>> DoubleType mae(final DoubleType out, final IterableInterval<T> reference, final IterableInterval<T> test) { final DoubleType result = (DoubleType) ops().run( net.imagej.ops.Ops.Image.MAE.class, out, reference, test); return result; }
Source:
<code>public void initTable() throws Exception { ts = nextTimestamp(); <START> initATableValues("aTable", tenantId, getDefaultSplits(tenantId), date=new Date(System.currentTimeMillis()), ts, getUrl()); <END> if (indexDDL != null && indexDDL.length() > 0) { Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts)); Connection conn = DriverManager.getConnection(getUrl(), props); conn.createStatement().execute(indexDDL); } }</code><technical_language>Is a need pass "aTable" here</technical_language>

Target:
public void initTable() throws Exception { ts = nextTimestamp(); initATableValues(ATABLE_NAME, tenantId, getDefaultSplits(tenantId), date=new Date(System.currentTimeMillis()), ts, getUrl()); if (indexDDL != null && indexDDL.length() > 0) { Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts)); Connection conn = DriverManager.getConnection(getUrl(), props); conn.createStatement().execute(indexDDL); } }
Source:
<code>public FilterMana getPhyrexianColors() { <START> return this.phyrexianColors.copy(); <END> }</code><technical_language>copies in getter call instead simple ref? Normal code: return ref objects create copy Copy/Create method (but ref in copy -- above/below)</technical_language>

Target:
public FilterMana getPhyrexianColors() { return this.phyrexianColors; }
Source:
<code>private void assertResponseContent(HttpResponseContext responseContext, OutgoingMessage outgoingMessage) { if (outgoingMessage.getBody().equalsIgnoreCase(responseContext.getRequestBody())) { <START> System.out.print("Equal"); <END> } else { System.out.print("Wrong"); } }</code><technical_language>Please get rid of System.out.print. Logger#info</technical_language>

Target:
private void assertResponseContent(HttpResponseContext responseContext, OutgoingMessage outgoingMessage) { if (outgoingMessage.getBody().equalsIgnoreCase(responseContext.getRequestBody())) { log.info("Equal"); } else { log.info("Wrong"); } }
Source:
<code>private Diamond3iIterable(Vector3ic origin, int maxDistance) { <START> Preconditions.checkArgument(maxDistance >= 0, "maxDistance must be > 0"); <END> this.origin.set(origin); this.endDistance = maxDistance; }</code><technical_language>Message > 0, argument validation checks for >= 0</technical_language>

Target:
private Diamond3iIterable(Vector3ic origin, int maxDistance) { Preconditions.checkArgument(maxDistance >= 0, "maxDistance must be >= 0"); this.origin.set(origin); this.endDistance = maxDistance; }
Source:
<code>public void testCreateTableDefaultCassandraMetadata() throws TException { String keyspace = CASSANDRA.getConfig().getKeyspaceOrThrow(); CfDef expectedCfDef = createDefaultCfDef(keyspace, CASSANDRA_DEFAULT_TABLE_NAME); TableReference tableReference = TableReference.createFromFullyQualifiedName(ATLAS_DEFAULT_TABLE_NAME); keyValueService.createTable(tableReference, AtlasDbConstants.GENERIC_TABLE_METADATA); List<CfDef> cfDefs = ((CassandraKeyValueService) keyValueService).getClientPool() .run(client -> client.describe_keyspace(keyspace).getCf_defs()); CfDef defaultCfDef = cfDefs.stream() .filter(cfDef -> cfDef.name.equals(CASSANDRA_DEFAULT_TABLE_NAME)) .findFirst() .get(); assertThat(defaultCfDef) <START> .isEqualTo(expectedCfDef); <END> }</code><technical_language>This a bit lenient. Is a reason do List<CfDef> matches = cfDefs.stream() .filter(cfDef -> cfDef.name.equals(CASSANDRA_DEFAULT_TABLE_NAME)) .collect(Collectors.toList()); assertThat(matches).containsExactly(expectedCfDef);</technical_language>

Target:
public void testCreateTableDefaultCassandraMetadata() throws TException { String keyspace = CASSANDRA.getConfig().getKeyspaceOrThrow(); CfDef expectedCfDef = createDefaultCfDef(keyspace, CASSANDRA_DEFAULT_TABLE_NAME); keyValueService.createTable(ATLAS_DEFAULT_TABLE_REFERENCE, AtlasDbConstants.GENERIC_TABLE_METADATA); List<CfDef> cfDefs = ((CassandraKeyValueService) keyValueService).getClientPool() .run(client -> client.describe_keyspace(keyspace).getCf_defs()); List<CfDef> matches = cfDefs.stream() .filter(cfDef -> cfDef.name.equals(CASSANDRA_DEFAULT_TABLE_NAME)) .collect(Collectors.toList()); assertThat(matches).containsExactly(expectedCfDef); }
Source:
<code>public SocketChannel requestForConnection(InetSocketAddress hostAddr) throws IOException, JSONException { SocketChannel socket = connectToHost(hostAddr); ByteBuffer currentTimeBuf = ByteBuffer.allocate(8); while (currentTimeBuf.hasRemaining()) { socket.read(currentTimeBuf); } <START> assert(currentTimeBuf.position() == 8); <END> JSONObject jsObj = new JSONObject(); jsObj.put(TYPE, ConnectionType.REQUEST_CONNECTION.name()); jsObj.put(VERSION_STRING, m_acceptor.getVersionChecker().getVersionString()); jsObj.put(HOST_ID, m_localHostId); jsObj.put(PORT, m_internalPort); jsObj.put(ADDRESS, m_internalInterface.isEmpty() ? m_reportedInternalInterface : m_internalInterface); byte[] jsBytes = jsObj.toString(4).getBytes(StandardCharsets.UTF_8); ByteBuffer addConnection = ByteBuffer.allocate(4 + jsBytes.length); addConnection.putInt(jsBytes.length); addConnection.put(jsBytes).flip(); while (addConnection.hasRemaining()) { socket.write(addConnection); } final String remoteAddress = socket.socket().getRemoteSocketAddress().toString(); processJSONResponse(socket, remoteAddress, null, false); return socket; }</code><technical_language>fyi write assertions java assert currentTimeBuf.position() == 8 : "time buffer is unexpected position";</technical_language>

Target:
public SocketChannel requestForConnection(InetSocketAddress hostAddr) throws IOException, JSONException { SocketChannel socket = connectToHost(hostAddr); ByteBuffer currentTimeBuf = ByteBuffer.allocate(8); while (currentTimeBuf.hasRemaining()) { socket.read(currentTimeBuf); } assert currentTimeBuf.position() == 8 : "time buffer is at an unexpected position"; JSONObject jsObj = new JSONObject(); jsObj.put(TYPE, ConnectionType.REQUEST_CONNECTION.name()); jsObj.put(VERSION_STRING, m_acceptor.getVersionChecker().getVersionString()); jsObj.put(HOST_ID, m_localHostId); jsObj.put(PORT, m_internalPort); jsObj.put(ADDRESS, m_internalInterface.isEmpty() ? m_reportedInternalInterface : m_internalInterface); byte[] jsBytes = jsObj.toString(4).getBytes(StandardCharsets.UTF_8); ByteBuffer addConnection = ByteBuffer.allocate(4 + jsBytes.length); addConnection.putInt(jsBytes.length); addConnection.put(jsBytes).flip(); while (addConnection.hasRemaining()) { socket.write(addConnection); } final String remoteAddress = socket.socket().getRemoteSocketAddress().toString(); processJSONResponse(socket, remoteAddress, null, false); return socket; }
Source:
<code><START> public QualifierStep family(byte[] colFam, int colFamLength) { <END> columnFamily = colFam; columnFamilyLength = colFamLength; return this; }</code><technical_language>add @Override annotation other methods. Eclipse automatically do this</technical_language>

Target:
private QualifierStep family(byte[] colFam, int colFamLength) { columnFamily = colFam; columnFamilyLength = colFamLength; return this; }
Source:
<code>private boolean isTooLarge(BigDecimal value) { return ( value.compareTo( BigDecimal.valueOf( Long.MAX_VALUE, decimalScale ) ) > 0 || <START> value.compareTo( BigDecimal.valueOf( Long.MIN_VALUE, decimalScale ) ) < 0 <END> ); }</code><technical_language>put BigDecimal.valueOf( Long.MAX_VALUE ) BigDecimal.valueOf( Long.MIN_VALUE ) in constants instead of computing for call of this method</technical_language>

Target:
private boolean isTooLarge(BigDecimal value) { return ( value.compareTo( minScaledValue ) < 0 || value.compareTo( maxScaledValue ) > 0 ); }
Source:
<code>public Long deserialize(JsonParser jsonParser, DeserializationContext ctxt) throws IOException, JsonProcessingException { Object memLimit = jsonParser.readValueAs(Object.class); if (memLimit instanceof Long) { return (Long) memLimit; } if (memLimit instanceof Integer) { return ((Integer) memLimit).longValue(); } if (memLimit instanceof String) { try { return Size.parseSize((String) memLimit); } catch (IllegalArgumentException e) { <START> throw ctxt.mappingException(format(UNSUPPORTED_VALUE_MESSAGE, memLimit)); <END> } } throw ctxt.mappingException(format(UNSUPPORTED_VALUE_MESSAGE, memLimit)); }</code><technical_language>ignore this exception operation throws exception</technical_language>

Target:
public Long deserialize(JsonParser jsonParser, DeserializationContext ctxt) throws IOException, JsonProcessingException { Object memLimit = jsonParser.readValueAs(Object.class); if (memLimit instanceof Long) { return (Long) memLimit; } if (memLimit instanceof Integer) { return ((Integer) memLimit).longValue(); } if (memLimit instanceof String) { return Size.parseSize((String) memLimit); } throw ctxt.mappingException(format(UNSUPPORTED_VALUE_MESSAGE, memLimit)); }
Source:
<code>public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mDrawerListView = (ListView) inflater.inflate(R.layout.fragment_navigation_drawer, container, false); mDrawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { selectItem(position); } }); String[] menuOptions = getResources().getStringArray(R.array.menuOptions); <START> mDrawerListView.setAdapter(new ArrayAdapter<>(getActionBar().getThemedContext(), R.layout.drawer_list_item, menuOptions)); <END> mDrawerListView.setItemChecked(mCurrentSelectedPosition, true); return mDrawerListView; }</code><technical_language>updated getSupportActionBar() instead of getActionBar() in [guidelines](<LINK_0> ensure compatibility</technical_language>

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mDrawerListView = (ListView) inflater.inflate(R.layout.fragment_navigation_drawer, container, false); mDrawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { selectItem(position); } }); String[] menuOptions = getResources().getStringArray(R.array.menuOptions); mDrawerListView.setAdapter(new ArrayAdapter<>(getSupportActionBar().getThemedContext(), R.layout.drawer_list_item, menuOptions)); mDrawerListView.setItemChecked(mCurrentSelectedPosition, true); return mDrawerListView; }
Source:
<code>private boolean shouldNotCache(@NotNull String path) { <START> Intrinsics.checkParameterIsNotNull(bundleContext, "path"); <END> return path.endsWith(".map"); }</code><technical_language>path</technical_language>

Target:
private boolean shouldNotCache(@NotNull String path) { Intrinsics.checkParameterIsNotNull(path, "path"); return path.endsWith(".map"); }
Source:
<code>public void add(Boolean bool) { if (bool == null) { elements.add(JsonNull.INSTANCE); <START> } <END> elements.add(new JsonPrimitive(bool)); }</code><technical_language>lack of return add both. I want: java elements.add(bool == null ? JsonNull.INSTANCE : new JsonPrimitive(bool)); for methods</technical_language>

Target:
public void add(Boolean bool) { elements.add(bool == null ? JsonNull.INSTANCE : new JsonPrimitive(bool)); }
Source:
<code>public void resourceSetChanged(ResourceSetChangeEvent event) { super.resourceSetChanged(event); this.toRefreshInViewer = Sets.newLinkedHashSet(); this.toUpdateInViewer = Sets.newLinkedHashSet(); this.toCollapse = Sets.newLinkedHashSet(); this.toExpand = Sets.newLinkedHashSet(); for (Notification notif : event.getNotifications()) { notifyChanged(notif); } if (this.toRefreshInViewer.size() > 0 || this.toUpdateInViewer.size() > 0 || this.toCollapse.size() > 0 || this.toExpand.size() > 0) { PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { @Override public void run() { if (dTreeViewer != null && dTreeViewer.getControl() != null && !dTreeViewer.getControl().isDisposed()) { for (Object itemtoExpand : toExpand) { dTreeViewer.setExpandedState(itemtoExpand, true); } for (Object itemToCollapse : toCollapse) { dTreeViewer.setExpandedState(itemToCollapse, false); } for (Object itemToRefresh : toRefreshInViewer) { dTreeViewer.refresh(itemToRefresh, true); } <START> Object[] objectsToUpdateInViewer = Sets.difference(toUpdateInViewer, toRefreshInViewer).toArray(new Object[0]); <END> dTreeViewer.update(objectsToUpdateInViewer, null); } } }); } }</code><technical_language>This potentially costly difference computation lifted out of runnable is done while lock UI thread</technical_language>

Target:
public void resourceSetChanged(ResourceSetChangeEvent event) { super.resourceSetChanged(event); this.toRefreshInViewer = Sets.newLinkedHashSet(); this.toUpdateInViewer = Sets.newLinkedHashSet(); this.toCollapse = Sets.newLinkedHashSet(); this.toExpand = Sets.newLinkedHashSet(); for (Notification notif : event.getNotifications()) { notifyChanged(notif); } if (this.toRefreshInViewer.size() > 0 || this.toUpdateInViewer.size() > 0 || this.toCollapse.size() > 0 || this.toExpand.size() > 0) { final Object[] objectsToUpdateInViewer = Sets.difference(toUpdateInViewer, toRefreshInViewer).toArray(new Object[0]); PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { @Override public void run() { if (dTreeViewer != null && dTreeViewer.getControl() != null && !dTreeViewer.getControl().isDisposed()) { for (Object itemtoExpand : toExpand) { dTreeViewer.setExpandedState(itemtoExpand, true); } for (Object itemToCollapse : toCollapse) { dTreeViewer.setExpandedState(itemToCollapse, false); } for (Object itemToRefresh : toRefreshInViewer) { dTreeViewer.refresh(itemToRefresh, true); } dTreeViewer.update(objectsToUpdateInViewer, null); } } }); } }
Source:
<code>protected boolean OnLongClickListOffline(int position) { final int lapos = position; new MaterialDialog.Builder(getActivity()) .title(R.string.txtDialogsTitle) .content(R.string.txtDialogsContentDelete) .positiveText(R.string.txtYes) .negativeText(R.string.txtNo) .onPositive((dialog, which) -> { String barcode = saveItems.get(lapos).getBarcode(); <START> Utils.getAppDaoSession(getActivity()).getSendProductDao().deleteInTx(Utils.getAppDaoSession(getActivity()).getSendProductDao().queryBuilder().where(SendProductDao.Properties.Barcode.eq(barcode)).list()); <END> final SaveListAdapter sl = (SaveListAdapter) listView.getAdapter(); saveItems.remove(lapos); getActivity().runOnUiThread(() -> sl.notifyDataSetChanged()); }) .show(); return true; }</code><technical_language>consider extract Utils.getAppDaoSession(getActivity()).getSendProductDao() in a class field this expression is times</technical_language>

Target:
protected boolean OnLongClickListOffline(int position) { final int lapos = position; new MaterialDialog.Builder(getActivity()) .title(R.string.txtDialogsTitle) .content(R.string.txtDialogsContentDelete) .positiveText(R.string.txtYes) .negativeText(R.string.txtNo) .onPositive((dialog, which) -> { String barcode = saveItems.get(lapos).getBarcode(); mSendProductDao.deleteInTx(mSendProductDao.queryBuilder().where(SendProductDao.Properties.Barcode.eq(barcode)).list()); final SaveListAdapter sl = (SaveListAdapter) listView.getAdapter(); saveItems.remove(lapos); getActivity().runOnUiThread(() -> sl.notifyDataSetChanged()); }) .show(); return true; }
Source:
<code>public ConnectorBucketNodeMap getBucketNodeMap(ConnectorTransactionHandle transactionHandle, ConnectorSession session, ConnectorPartitioningHandle partitioningHandle) { Set<Node> nodes = nodeManager.getRequiredWorkerNodes(); checkState(!nodes.isEmpty(), "No TPCH nodes available"); <START> return new ConnectorBucketNodeMap(nodes.size() * splitsPerNode); <END> }</code><technical_language>ditto overflow question</technical_language>

Target:
public ConnectorBucketNodeMap getBucketNodeMap(ConnectorTransactionHandle transactionHandle, ConnectorSession session, ConnectorPartitioningHandle partitioningHandle) { Set<Node> nodes = nodeManager.getRequiredWorkerNodes(); return createBucketNodeMap(toIntExact((long) nodes.size() * splitsPerNode)); }
Source:
<code>private void waitForView(int viewId, long timeout, TimeUnit timeUnit) throws InterruptedException { try { transport.withView(viewId).get(timeout, timeUnit); } catch (ExecutionException e) { <START> log.errorf(e, "Unexpected exception waiting for view %d, current view is %d", viewId, transport.getViewId()); <END> } catch (TimeoutException e) { throw log.timeoutWaitingForView(viewId, transport.getViewId()); } }</code><technical_language>a method in Log interface</technical_language>

Target:
private void waitForView(int viewId, long timeout, TimeUnit timeUnit) throws InterruptedException { try { transport.withView(viewId).get(timeout, timeUnit); } catch (ExecutionException e) { throw new CacheException(e.getCause()); } catch (TimeoutException e) { throw log.timeoutWaitingForView(viewId, transport.getViewId()); } }
Source:
<code>public void readResolveContainerCapZero() { KubernetesCloud cloud = j.jenkins.clouds.get(KubernetesCloud.class); <START> assertTrue(cloud.getRemainingGlobalSlots(Collections.emptyList(), 1) > 0); <END> }</code><technical_language>is a Matcher for this, FWIW</technical_language>

Target:
public void readResolveContainerCapZero() { KubernetesCloud cloud = j.jenkins.clouds.get(KubernetesCloud.class); assertEquals(cloud.getContainerCap(), Integer.MAX_VALUE); assertThat(cloud.getRemainingGlobalSlots(Collections.emptyList(), 1), greaterThan(0)); }
Source:
<code>public void writeTo(final OutputStream httpOut) throws IOException { multipartStream.setNext(httpOut); try { <START> final int bufferSize = 128; <END> IOUtils.copy(getContent(), cipherStream, bufferSize); cipherStream.flush(); } finally { IOUtils.closeQuietly(httpOut); } }</code><technical_language>I suppose pull this out a static class constant</technical_language>

Target:
public void writeTo(final OutputStream httpOut) throws IOException { multipartStream.setNext(httpOut); try { IOUtils.copy(getContent(), cipherStream, BUFFER_SIZE); cipherStream.flush(); } finally { IOUtils.closeQuietly(httpOut); } }
Source:
<code><START> private String getContentTypePostfix(String contentTypeValue) { <END> String[] ctvArray = contentTypeValue.split(";"); String contentType = ""; String charset = ""; if (ctvArray.length > 1) { for (String segment : ctvArray) { if (segment.toLowerCase(Locale.ROOT).contains("charset")) { charset = segment.trim(); } else if (!segment.toLowerCase(Locale.ROOT).contains("boundary") && !segment.toLowerCase(Locale.ROOT).contains("charset") && !StringUtils.isBlank(segment)) { contentType = segment.trim(); } } if (StringUtils.isBlank(charset)) { return ctvArray[0].trim(); } return contentType + "; " + charset; } return ctvArray[0].trim(); }</code><technical_language>static</technical_language>

Target:
private static String getContentTypePostfix(String contentTypeValue) { String[] ctvArray = contentTypeValue.split(";"); if (ctvArray.length == 1) { return ctvArray[0].trim(); } return Arrays.stream(ctvArray) .filter(StringUtils::isNotBlank) .filter(segment -> !segment.toLowerCase(Locale.ROOT).contains("boundary")) .map(String::trim) .collect(Collectors.joining("; ")); }
Source:
<code>public PaymentWorksNewVendorPayeeAchBatchReportData() { super(); this.disapprovedVendorsSummary = new PaymentWorksBatchReportSummaryItem(); this.noAchDataProvidedVendorsSummary = new PaymentWorksBatchReportSummaryItem(); this.recordsWithForeignAchSummary = new PaymentWorksBatchReportSummaryItem(); this.noAchDataProvidedVendors = new ArrayList<PaymentWorksBatchReportVendorItem>(); this.pmwVendorAchsThatCouldNotBeProcessed = new ArrayList<PaymentWorksBatchReportVendorItem>(); this.disapprovedVendors = new ArrayList<PaymentWorksBatchReportVendorItem>(); this.recordsGeneratingException = new ArrayList<PaymentWorksBatchReportVendorItem>(); <START> this.foreignAchItems = new ArrayList<PaymentWorksBatchReportVendorItem>();; <END> }</code><technical_language>This line unneeded extra semicolon</technical_language>

Target:
public PaymentWorksNewVendorPayeeAchBatchReportData() { super(); this.disapprovedVendorsSummary = new PaymentWorksBatchReportSummaryItem(); this.noAchDataProvidedVendorsSummary = new PaymentWorksBatchReportSummaryItem(); this.recordsWithForeignAchSummary = new PaymentWorksBatchReportSummaryItem(); this.noAchDataProvidedVendors = new ArrayList<PaymentWorksBatchReportVendorItem>(); this.pmwVendorAchsThatCouldNotBeProcessed = new ArrayList<PaymentWorksBatchReportVendorItem>(); this.disapprovedVendors = new ArrayList<PaymentWorksBatchReportVendorItem>(); this.recordsGeneratingException = new ArrayList<PaymentWorksBatchReportVendorItem>(); this.foreignAchItems = new ArrayList<PaymentWorksBatchReportVendorItem>(); }
Source:
<code>@Test public void requestAfterExecuteThrowingAlsoThrows() throws IOException { Retrofit retrofit = new Retrofit.Builder() .baseUrl(server.url("/")) .addConverterFactory(new ToStringConverterFactory()) .build(); Service service = retrofit.create(Service.class); server.enqueue(new MockResponse()); final AtomicInteger writeCount = new AtomicInteger(); Object a = new Object() { @Override public String toString() { writeCount.incrementAndGet(); throw new RuntimeException("Broken!"); } }; Call<String> call = service.postRequestBody(a); try { <START> call.execute(); <END> } catch (RuntimeException e) { assertThat(e).hasMessage("Broken!"); } assertThat(writeCount.get()).isEqualTo(1); try { call.request(); } catch (RuntimeException e) { assertThat(e).hasMessage("Broken!"); } assertThat(writeCount.get()).isEqualTo(1); }</code><technical_language>fail()</technical_language>

Target:
@Test public void requestAfterExecuteThrowingAlsoThrows() throws IOException { Retrofit retrofit = new Retrofit.Builder() .baseUrl(server.url("/")) .addConverterFactory(new ToStringConverterFactory()) .build(); Service service = retrofit.create(Service.class); server.enqueue(new MockResponse()); final AtomicInteger writeCount = new AtomicInteger(); Object a = new Object() { @Override public String toString() { writeCount.incrementAndGet(); throw new RuntimeException("Broken!"); } }; Call<String> call = service.postRequestBody(a); try { call.execute(); fail(); } catch (RuntimeException e) { assertThat(e).hasMessage("Broken!"); } assertThat(writeCount.get()).isEqualTo(1); try { call.request(); fail(); } catch (RuntimeException e) { assertThat(e).hasMessage("Broken!"); } assertThat(writeCount.get()).isEqualTo(1); }
Source:
<code>public void postOpenAppEvent_appLastOpenedDateOnEarlierDay_appLastOpenedDateUpdated() <START> throws IllegalArgumentException, IllegalAccessException <END> { UserDevice device = addDeviceToRichard(0, "First", OperatingSystem.ANDROID); LocalDate originalDate = TimeUtil.utcNow().toLocalDate().minusDays(1); richard.setAppLastOpenedDate(originalDate); appLastOpenedDateField.set(device, originalDate); service.postOpenAppEvent(richard.getId(), device.getId(), Optional.empty(), Optional.of(SOME_APP_VERSION), SUPPORTED_APP_VERSION_CODE); assertThat(richard.getAppLastOpenedDate().get(), equalTo(currentDateInAmsterdam())); assertThat(device.getAppLastOpenedDate(), equalTo(currentDateInAmsterdam())); verify(userRepository, times(1)).save(any(User.class)); }</code><technical_language>move setting app opened date field a helper method throws do repeated</technical_language>

Target:
public void postOpenAppEvent_appLastOpenedDateOnEarlierDay_appLastOpenedDateUpdated() { UserDevice device = addDeviceToRichard(0, "First", OperatingSystem.ANDROID); LocalDate originalDate = TimeUtil.utcNow().toLocalDate().minusDays(1); richard.setAppLastOpenedDate(originalDate); setAppLastOpenedDateField(device, originalDate); service.postOpenAppEvent(richard.getId(), device.getId(), Optional.empty(), Optional.of(SOME_APP_VERSION), SUPPORTED_APP_VERSION_CODE); assertThat(richard.getAppLastOpenedDate().get(), equalTo(currentDateInAmsterdam())); assertThat(device.getAppLastOpenedDate(), equalTo(currentDateInAmsterdam())); verify(userRepository, times(1)).save(any(User.class)); }
Source:
<code>private List<StepDefinitionMatch> stepDefinitionMatches(String featurePath, PickleStep step) { List<StepDefinitionMatch> result = new ArrayList<StepDefinitionMatch>(); String stepText = step.getText(); CacheEntry cacheEntry = matchedStepDefinitionsCache.get(stepText); if (cacheEntry != null) { result.add(new StepDefinitionMatch(cacheEntry.arguments, cacheEntry.stepDefinition, featurePath, step, localizedXStreams)); return result; } boolean notFound = true; for (StepDefinition stepDefinition : stepDefinitionsByPattern.values()) { List<Argument> arguments = stepDefinition.matchedArguments(step); if (arguments != null) { if (notFound) { matchedStepDefinitionsCache.put(stepText, new CacheEntry(stepDefinition, arguments)); notFound = false; } else { matchedStepDefinitionsCache.remove(stepText); <START> } <END> result.add(new StepDefinitionMatch(arguments, stepDefinition, featurePath, step, localizedXStreams)); } } return result; }</code><technical_language>invalidating cache entry dealing a duplicate step store a list of cache entries. fetching list cache, list contains multiple entries throw AmbiguousStepDefinitionsException</technical_language>

Target:
private List<StepDefinitionMatch> stepDefinitionMatches(String featurePath, PickleStep step) { List<StepDefinitionMatch> result = new ArrayList<StepDefinitionMatch>(); for (StepDefinition stepDefinition : stepDefinitionsByPattern.values()) { List<Argument> arguments = stepDefinition.matchedArguments(step); if (arguments != null) { result.add(new StepDefinitionMatch(arguments, stepDefinition, featurePath, step, localizedXStreams)); } } return result; }
Source:
<code>public void testQueryEvent() throws IOException, ServletException { List<Event> receivedEvents = new ArrayList<>(); QueryEventGenerator eventGenerator = mock(QueryEventGenerator.class); QueryEvent generatedEvent = mock(QueryEvent.class); String headerFlag = "headerFlag"; when(eventGenerator.instant()) .thenReturn(Instant.EPOCH) .thenReturn(Instant.EPOCH.plus(1, <START> ChronoUnit.SECONDS)); <END> HttpServletRequest request = mock(HttpServletRequest.class); when(request.getPathInfo()).thenReturn("/namespace/ns/sparql"); when(request.getParameter(eq(QueryEventGenerator.QUERY_PARAM))).thenReturn(SPARQL_QUERY); when(request.getHeader(eq(headerFlag))).thenReturn("yes"); HttpServletResponse response = mock(HttpServletResponse.class); when(eventGenerator.generateQueryEvent(eq(request), eq(200), eq(new HashMap<String, String>() {{ put("response_header", "header_value"); }}), eq(Duration.ofSeconds(1)), eq(Instant.EPOCH)) ).thenReturn(generatedEvent); FilterChain filterChain = mock(FilterChain.class); when(response.getStatus()).thenReturn(200); when(response.getHeaderNames()).thenReturn(Collections.singletonList("response_header")); when(response.getHeaders(eq("response_header"))).thenReturn(Collections.singletonList("header_value")); QueryEventSenderFilter filter = new QueryEventSenderFilter(receivedEvents::add, eventGenerator, headerFlag); filter.doFilter(request, response, filterChain); assertThat(receivedEvents).containsExactly(generatedEvent); verify(filterChain, times(1)).doFilter(eq(request), eq(response)); }</code><technical_language>static import</technical_language>

Target:
public void testQueryEvent() throws IOException, ServletException { List<Event> receivedEvents = new ArrayList<>(); QueryEventGenerator eventGenerator = mock(QueryEventGenerator.class); QueryEvent generatedEvent = mock(QueryEvent.class); String headerFlag = "headerFlag"; String defaultNS = "defaultNS"; when(eventGenerator.instant()) .thenReturn(Instant.EPOCH) .thenReturn(Instant.EPOCH.plus(1, SECONDS)); HttpServletRequest request = mock(HttpServletRequest.class); ServletContext context = mock(ServletContext.class); when(context.getAttribute(eq(WikibaseContextListener.BLAZEGRAPH_DEFAULT_NAMESPACE))).thenReturn(defaultNS); when(request.getPathInfo()).thenReturn("/namespace/ns/sparql"); when(request.getParameter(eq(QueryEventGenerator.QUERY_PARAM))).thenReturn(SPARQL_QUERY); when(request.getHeader(eq(headerFlag))).thenReturn("yes"); when(request.getServletContext()).thenReturn(context); HttpServletResponse response = mock(HttpServletResponse.class); when(eventGenerator.generateQueryEvent(eq(request), eq(200), eq(Duration.ofSeconds(1)), eq(Instant.EPOCH), eq(defaultNS))) .thenReturn(generatedEvent); FilterChain filterChain = mock(FilterChain.class); when(response.getStatus()).thenReturn(200); QueryEventSenderFilter filter = new QueryEventSenderFilter(receivedEvents::add, eventGenerator, headerFlag); filter.doFilter(request, response, filterChain); assertThat(receivedEvents).containsExactly(generatedEvent); verify(filterChain, times(1)).doFilter(eq(request), eq(response)); }
Source:
<code>protected void executeCommand() { <START> getParameters().setLifeInMinutes(LIFETIME); <END> verifyImageRemoval(); }</code><technical_language>hmm, crucial, set in command caller (i.e. RemoveSnapshotSingleDiskLiveCommand)? in case want a timeout values..</technical_language>

Target:
protected void executeCommand() { verifyImageRemoval(); }
Source:
<code>private static TimeLimiterRegistry createTimeLimiterRegistry( TimeLimiterConfigurationProperties timeLimiterConfigurationProperties, RegistryEventConsumer<TimeLimiter> timeLimiterRegistryEventConsumer, CompositeCustomizer<TimeLimiterConfigCustomizer> compositeTimeLimiterCustomizer) { Map<String, TimeLimiterConfig> configs = timeLimiterConfigurationProperties.getConfigs() .entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, entry -> timeLimiterConfigurationProperties.createTimeLimiterConfig( entry.getKey(), entry.getValue(), compositeTimeLimiterCustomizer))); <START> return TimeLimiterRegistry.of(configs, timeLimiterRegistryEventConsumer, timeLimiterConfigurationProperties.getTags()); <END> }</code><technical_language>I create a defensive copy of Map</technical_language>

Target:
private static TimeLimiterRegistry createTimeLimiterRegistry( TimeLimiterConfigurationProperties timeLimiterConfigurationProperties, RegistryEventConsumer<TimeLimiter> timeLimiterRegistryEventConsumer, CompositeCustomizer<TimeLimiterConfigCustomizer> compositeTimeLimiterCustomizer) { Map<String, TimeLimiterConfig> configs = timeLimiterConfigurationProperties.getConfigs() .entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, entry -> timeLimiterConfigurationProperties.createTimeLimiterConfig( entry.getKey(), entry.getValue(), compositeTimeLimiterCustomizer))); return TimeLimiterRegistry.of(configs, timeLimiterRegistryEventConsumer, Map.copyOf(timeLimiterConfigurationProperties.getTags())); }
Source:
<code>public Map<String,Object> getKeyStructureFields (String structureInode) { Map<String,Object> result = new HashMap<String, Object>(); boolean allowImport = true; Structure struct = CacheLocator.getContentTypeCache().getStructureByInode(structureInode); List<Field> fields = struct.getFields(); ArrayList<Map> searchableFields = new ArrayList<Map> (); for (Field field : fields) { if (!field.getFieldType().equals(Field.FieldType.LINE_DIVIDER.toString()) && !field.getFieldType().equals(Field.FieldType.FILE.toString()) && !field.getFieldType().equals(Field.FieldType.IMAGE.toString())&& !field.getFieldType().equals(Field.FieldType.LINE_DIVIDER.toString()) && !field.getFieldType().equals(Field.FieldType.TAB_DIVIDER.toString())) { try { Map fieldMap = field.getMap(); searchableFields.add(fieldMap); } catch (Exception e) { Logger.error(this, "Error getting the map of properties of a field: " + field.getInode()); } } } try { <START> List<WorkflowScheme> schemes = APILocator.getWorkflowAPI().findSchemeForStruct(struct); <END> for(WorkflowScheme scheme : schemes) { if (scheme.isMandatory() && !UtilMethods.isSet(scheme.getEntryActionId())) { allowImport = false; } } } catch (DotDataException e) { Logger.error(this, e.getMessage()); } result.put("keyStructureFields",searchableFields); result.put("allowImport", allowImport); return result; }</code><technical_language>name of method plural</technical_language>

Target:
public Map<String,Object> getKeyStructureFields (String structureInode) { Map<String,Object> result = new HashMap<String, Object>(); boolean allowImport = true; Structure struct = CacheLocator.getContentTypeCache().getStructureByInode(structureInode); List<Field> fields = struct.getFields(); ArrayList<Map> searchableFields = new ArrayList<Map> (); for (Field field : fields) { if (!field.getFieldType().equals(Field.FieldType.LINE_DIVIDER.toString()) && !field.getFieldType().equals(Field.FieldType.FILE.toString()) && !field.getFieldType().equals(Field.FieldType.IMAGE.toString())&& !field.getFieldType().equals(Field.FieldType.LINE_DIVIDER.toString()) && !field.getFieldType().equals(Field.FieldType.TAB_DIVIDER.toString())) { try { Map fieldMap = field.getMap(); searchableFields.add(fieldMap); } catch (Exception e) { Logger.error(this, "Error getting the map of properties of a field: " + field.getInode()); } } } try { List<WorkflowScheme> schemes = APILocator.getWorkflowAPI().findSchemesForStruct(struct); for(WorkflowScheme scheme : schemes) { if (scheme.isMandatory() && !UtilMethods.isSet(scheme.getEntryActionId())) { allowImport = false; break; } } } catch (DotDataException e) { Logger.error(this, e.getMessage()); } result.put("keyStructureFields",searchableFields); result.put("allowImport", allowImport); return result; }
Source:
<code>protected void checkInitialData(final INattableModelManager currentManager) { final List<Object> rowElements = currentManager.getRowElementsList(); final Object firstRowRepresentedElement = rowElements.get(0); <START> Assert.assertEquals("The first row element is not the expected one", REQUIREMENT_1, ((org.eclipse.uml2.uml.NamedElement) firstRowRepresentedElement).getName()); END> final Object secondRowRepresentedElement = rowElements.get(1); Assert.assertEquals("The second row element is not the expected one", REQUIREMENT_2, ((org.eclipse.uml2.uml.NamedElement) secondRowRepresentedElement).getName()); final Object thirdRowRepresentedElement = rowElements.get(2); Assert.assertEquals("The third row element is not the expected one", REQUIREMENT_3, ((org.eclipse.uml2.uml.NamedElement) thirdRowRepresentedElement).getName()); final Object fourthRowRepresentedElement = rowElements.get(3); Assert.assertEquals("The fourth row element is not the expected one", REQUIREMENT_4, ((org.eclipse.uml2.uml.NamedElement) fourthRowRepresentedElement).getName()); }</code><technical_language>import NamedElement (replace x8)</technical_language>

Target:
protected void checkInitialData(final INattableModelManager currentManager) { final List<Object> rowElements = currentManager.getRowElementsList(); final Object firstRowRepresentedElement = rowElements.get(0); Assert.assertEquals("The first row element is not the expected one", REQUIREMENT_1, ((NamedElement) firstRowRepresentedElement).getName()); final Object secondRowRepresentedElement = rowElements.get(1); Assert.assertEquals("The second row element is not the expected one", REQUIREMENT_2, ((NamedElement) secondRowRepresentedElement).getName()); final Object thirdRowRepresentedElement = rowElements.get(2); Assert.assertEquals("The third row element is not the expected one", REQUIREMENT_3, ((NamedElement) thirdRowRepresentedElement).getName()); final Object fourthRowRepresentedElement = rowElements.get(3); Assert.assertEquals("The fourth row element is not the expected one", REQUIREMENT_4, ((NamedElement) fourthRowRepresentedElement).getName()); }
Source:
<code>public void testShouldSelectPoolWhenRoleMatchesButOtherSysPurposeAttributesAndSocketsRamCoresMismatch() { Product product69 = new Product(); product69.setId("compliant-69"); consumer.setRole("myrole"); consumer.setFact("cpu.cpu_socket(s)", "1"); consumer.setFact("cpu.core(s)_per_socket", "1"); consumer.setFact("memory.memtotal", "9980456"); ConsumerInstalledProduct consumerInstalledProduct = new ConsumerInstalledProduct(product69); consumer.addInstalledProduct(consumerInstalledProduct); Product prodMCT1650 = createSysPurposeProduct(null, "myrole", "random_addon", "random_sla", "random_usage"); prodMCT1650.setAttribute(Product.Attributes.SOCKETS, "32"); prodMCT1650.setAttribute(Product.Attributes.CORES, "32"); prodMCT1650.setAttribute(Product.Attributes.RAM, "19960912"); Pool MCT1650 = TestUtil.createPool(owner, prodMCT1650); MCT1650.setId("MCT1650"); <START> MCT1650.getProduct().addProvidedProduct(product69); <END> MCT1650.setQuantity(1L); Product genericProduct = createSysPurposeProduct(null, null, null, null, null); Pool genericPool = TestUtil.createPool(owner, genericProduct); genericPool.setId("genericPool"); genericPool.setQuantity(1L); genericPool.getProduct().addProvidedProduct(product69); List<Pool> pools = new ArrayList<>(); pools.add(MCT1650); pools.add(genericPool); List<PoolQuantity> bestPools = autobindRules.selectBestPools(consumer, new String[]{"compliant-69"}, pools, compliance, null, new HashSet<>(), false); assertEquals(1, bestPools.size()); assertTrue(bestPools.contains(new PoolQuantity(MCT1650, 1))); }</code><technical_language>Add product product declaration</technical_language>

Target:
public void testShouldSelectPoolWhenRoleMatchesButOtherSysPurposeAttributesAndSocketsRamCoresMismatch() { Product product69 = new Product(); product69.setId("compliant-69"); consumer.setRole("myrole"); consumer.setFact("cpu.cpu_socket(s)", "1"); consumer.setFact("cpu.core(s)_per_socket", "1"); consumer.setFact("memory.memtotal", "9980456"); ConsumerInstalledProduct consumerInstalledProduct = new ConsumerInstalledProduct(product69); consumer.addInstalledProduct(consumerInstalledProduct); Product prodMCT1650 = createSysPurposeProduct(null, "myrole", "random_addon", "random_sla", "random_usage"); prodMCT1650.setAttribute(Product.Attributes.SOCKETS, "32"); prodMCT1650.setAttribute(Product.Attributes.CORES, "32"); prodMCT1650.setAttribute(Product.Attributes.RAM, "19960912"); prodMCT1650.addProvidedProduct(product69); Pool MCT1650 = TestUtil.createPool(owner, prodMCT1650); MCT1650.setId("MCT1650"); MCT1650.setQuantity(1L); Product genericProduct = createSysPurposeProduct(null, null, null, null, null); Pool genericPool = TestUtil.createPool(owner, genericProduct); genericPool.setId("genericPool"); genericPool.setQuantity(1L); genericPool.getProduct().addProvidedProduct(product69); List<Pool> pools = new ArrayList<>(); pools.add(MCT1650); pools.add(genericPool); List<PoolQuantity> bestPools = autobindRules.selectBestPools(consumer, new String[]{"compliant-69"}, pools, compliance, null, new HashSet<>(), false); assertEquals(1, bestPools.size()); assertTrue(bestPools.contains(new PoolQuantity(MCT1650, 1))); }
Source:
<code>public String getIdentityKeystorePath() { <START> return getGatewayKeystoreDir() + "/" + DEFAULT_GATEWAY_KEYSTORE_NAME; <END> }</code><technical_language>Paths.get os specific separator</technical_language>

Target:
public String getIdentityKeystorePath() { return getGatewayKeystorePath().resolve(DEFAULT_GATEWAY_KEYSTORE_NAME).toString(); }
Source:
<code>protected void moveTo(int index) { super.moveTo(index); if (index > -1) { <START> ((ResettableIterator<T>) get(index)).reset(); <END> } }</code><technical_language>this cast avoided thanks changes generics MultiIterator</technical_language>

Target:
protected void moveTo(int index) { super.moveTo(index); if (index > -1) { get(index).reset(); } }