auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void activateCinderDomain(Guid storageDomainId, Guid storagePoolId) { <START> OpenStackVolumeProviderProxy proxy = OpenStackVolumeProviderProxy.getFromStorageDomainId(storageDomainId, providerProxyFactory); <END> if (proxy == null) { log.error("Couldn't create an OpenStackVolumeProviderProxy for storage domain ID: {}", storageDomainId); return; } try { proxy.testConnection(); updateCinderDomainStatus(storageDomainId, storagePoolId, StorageDomainStatus.Active); } catch (EngineException e) { AuditLogable loggable = new AuditLogableImpl(); loggable.addCustomValue("CinderException", e.getCause().getCause() != null ? e.getCause().getCause().getMessage() : e.getCause().getMessage()); new AuditLogDirector().log(loggable, AuditLogType.CINDER_PROVIDER_ERROR); throw e; } }</code><technical_language>line long</technical_language>

Target:
public void activateCinderDomain(Guid storageDomainId, Guid storagePoolId) { OpenStackVolumeProviderProxy proxy = OpenStackVolumeProviderProxy.getFromStorageDomainId(storageDomainId, Injector.get(ProviderProxyFactory.class)); if (proxy == null) { log.error("Couldn't create an OpenStackVolumeProviderProxy for storage domain ID: {}", storageDomainId); return; } try { proxy.testConnection(); updateCinderDomainStatus(storageDomainId, storagePoolId, StorageDomainStatus.Active); } catch (EngineException e) { AuditLogable loggable = new AuditLogableImpl(); loggable.addCustomValue("CinderException", e.getCause().getCause() != null ? e.getCause().getCause().getMessage() : e.getCause().getMessage()); new AuditLogDirector().log(loggable, AuditLogType.CINDER_PROVIDER_ERROR); throw e; } }
Source:
<code>public synchronized List<AsyncTaskStatus> pollTasks(List<Guid> vdsmTaskIdList) { <START> ArrayList<AsyncTaskStatus> <END> returnValue = new ArrayList<>(); if (vdsmTaskIdList != null && vdsmTaskIdList.size() > 0) { for (Guid vdsmTaskId : vdsmTaskIdList) { if (_tasks.containsKey(vdsmTaskId)) { _tasks.get(vdsmTaskId).setLastStatusAccessTime(); returnValue.add(_tasks.get(vdsmTaskId).getLastTaskStatus()); } else { log.warn( "Polling tasks. Task ID '{}' doesn't exist in the manager -> assuming 'finished'.", vdsmTaskId); AsyncTaskStatus tempVar = new AsyncTaskStatus(); tempVar.setStatus(AsyncTaskStatusEnum.finished); tempVar.setResult(AsyncTaskResultEnum.success); returnValue.add(tempVar); } } } return returnValue; }</code><technical_language>this</technical_language>

Target:
public synchronized List<AsyncTaskStatus> pollTasks(List<Guid> vdsmTaskIdList) { List<AsyncTaskStatus> returnValue = new ArrayList<>(); if (vdsmTaskIdList != null && vdsmTaskIdList.size() > 0) { for (Guid vdsmTaskId : vdsmTaskIdList) { if (_tasks.containsKey(vdsmTaskId)) { _tasks.get(vdsmTaskId).setLastStatusAccessTime(); returnValue.add(_tasks.get(vdsmTaskId).getLastTaskStatus()); } else { log.warn( "Polling tasks. Task ID '{}' doesn't exist in the manager -> assuming 'finished'.", vdsmTaskId); AsyncTaskStatus tempVar = new AsyncTaskStatus(); tempVar.setStatus(AsyncTaskStatusEnum.finished); tempVar.setResult(AsyncTaskResultEnum.success); returnValue.add(tempVar); } } } return returnValue; }
Source:
<code>public void VEGalleryTests_002_GalleryCart() { int numOfMedias = 7; int numToRemoveFirst = 1; int numToRemoveSecond = 2; <START> int numToAdd = 2; <END> articleName = PageContent.ARTICLE_NAME_PREFIX + article.getTimeStamp(); VisualEditorPageObject ve = article.launchVisualEditorWithMainEdit(articleName, wikiURL); ve.verifyVEToolBarPresent(); ve.verifyEditorSurfacePresent(); VisualEditorInsertGalleryDialog galleryDialog = (VisualEditorInsertGalleryDialog) ve.openDialogFromMenu(InsertDialog.GALLERY); galleryDialog = galleryDialog.searchMedia("he"); galleryDialog.addMediaToCart(numOfMedias); galleryDialog.verifyNumOfCartItems(numOfMedias); galleryDialog.removeMediaFromCart(numToRemoveFirst); numOfMedias = numOfMedias - numToRemoveFirst; galleryDialog.verifyNumOfCartItems(numOfMedias); galleryDialog = galleryDialog.searchMedia("a"); galleryDialog.addMediaToCart(numToAdd); numOfMedias = numOfMedias + numToAdd; galleryDialog.verifyNumOfCartItems(numOfMedias); galleryDialog = galleryDialog.searchMedia("he"); galleryDialog.removeMediaFromCart(numToRemoveSecond); numOfMedias = numOfMedias - numToRemoveSecond; galleryDialog.verifyNumOfCartItems(numOfMedias); }</code><technical_language>static finals more meaningful names, EXPECTED_NUM_OF_MEDIA ;)</technical_language>

Target:
public void VEGalleryTests_002_GalleryCart() { final int NUM_OF_MEDIA_TO_REMOVE_FIRST = 1; final int NUM_OF_MEDIA_TO_REMOVE_SECOND = 2; final int NUM_OF_MEDIA_TO_ADD = 2; final int INITIAL_NUM_OF_MEDIA = 7; int expectedNumOfMedia = INITIAL_NUM_OF_MEDIA; articleName = PageContent.ARTICLE_NAME_PREFIX + article.getTimeStamp(); VisualEditorPageObject ve = article.launchVisualEditorWithMainEdit(articleName, wikiURL); ve.verifyVEToolBarPresent(); ve.verifyEditorSurfacePresent(); VisualEditorInsertGalleryDialog galleryDialog = (VisualEditorInsertGalleryDialog) ve.openDialogFromMenu(InsertDialog.GALLERY); galleryDialog = galleryDialog.searchMedia("he"); galleryDialog.addMediaToCart(INITIAL_NUM_OF_MEDIA); galleryDialog.verifyNumOfCartItems(expectedNumOfMedia); galleryDialog.removeMediaFromCart(NUM_OF_MEDIA_TO_REMOVE_FIRST); expectedNumOfMedia = expectedNumOfMedia - NUM_OF_MEDIA_TO_REMOVE_FIRST; galleryDialog.verifyNumOfCartItems(expectedNumOfMedia); galleryDialog = galleryDialog.searchMedia("a"); galleryDialog.addMediaToCart(NUM_OF_MEDIA_TO_ADD); expectedNumOfMedia = expectedNumOfMedia + NUM_OF_MEDIA_TO_ADD; galleryDialog.verifyNumOfCartItems(expectedNumOfMedia); galleryDialog = galleryDialog.searchMedia("he"); galleryDialog.removeMediaFromCart(NUM_OF_MEDIA_TO_REMOVE_SECOND); expectedNumOfMedia = expectedNumOfMedia - NUM_OF_MEDIA_TO_REMOVE_SECOND; galleryDialog.verifyNumOfCartItems(expectedNumOfMedia); }
Source:
<code>public List<Object> getAll(List<Object> keys) { List<Object> values = new ArrayList<Object>(); try { final Map<Object, Object> entries = getRegion().getAll(keys); <START> for (int i = 0; i < keys.size(); i++) { <END> values.add(entries.get(keys.get(i))); } } catch (IOException ex) { LOG.info("error getting region ", ex); } return (values); }</code><technical_language>Iterate entries instead</technical_language>

Target:
public List<Object> getAll(List<Object> keys) { List<Object> values = new ArrayList<Object>(); try { final Map<Object, Object> entries = getRegion().getAll(keys); for (int i = 0; i < keys.size(); i++) { values.add(entries.get(keys.get(i))); } } catch (IOException ex) { logger.info("error getting region ", ex); } return (values); }
Source:
<code>public ByteBufferImpl readObject(ObjectInput input) throws IOException, ClassNotFoundException { int length = UnsignedNumeric.readUnsignedInt(input); byte[] data = new byte[length]; <START> input.read(data, 0, length); <END> return new ByteBufferImpl(data, 0, length); }</code><technical_language>readFully[2] read[1] ensure read length bytes. [1] <LINK_0>[], int, int) [2] <LINK_1>[], int, int)</technical_language>

Target:
public ByteBufferImpl readObject(ObjectInput input) throws IOException, ClassNotFoundException { int length = UnsignedNumeric.readUnsignedInt(input); byte[] data = new byte[length]; input.readFully(data, 0, length); return new ByteBufferImpl(data, 0, length); }
Source:
<code>public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_edit: FragUtils.replaceBackStack(R.id.container, EditAnnouncementFragment.newInstance(mAnnouncement), getActivity()); break; case R.id.menu_delete: <START> Requests.Announcements.with(getActivity()).makeDeleteRequest(mAnnouncement); <END> break; } return super.onOptionsItemSelected(item); }</code><technical_language>add confirm dialog</technical_language>

Target:
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_edit: FragUtils.replaceBackStack(R.id.container, EditAnnouncementFragment.newInstance(mAnnouncement), getActivity()); break; case R.id.menu_delete: confirmDelete(); break; } return super.onOptionsItemSelected(item); }
Source:
<code>public void onMessage(String data) { try { Map<String, Object> dataMap = objectMapper.readValue(data, <START> new TypeReference<Map<String, Object>>() {}); <END> String event = (String) dataMap.get("event"); if ("KEEP_ALIVE".equals(event)) { return; } String type = (String) dataMap.get("type"); if (type == null) { log.debug("type missing so ignoring message. {}", dataMap); return; } if (type.equals("authenticated")) { log.info("WebSocket connection authenticated as (in {})", dataMap.get("userId"), dataMap.get("orgId")); } else { String channelName = (String) dataMap.get("channel"); if (channelName != null) { TransportChannel channel = channels.get(channelName); if ((channel != null) && (!channel.isClosed())) { StreamMessage message = new StreamMessage(type, null, data); channel.offer(message); } else { log.debug("ignoring message. channel not found {}", channelName); } } } } catch (IOException ex) { log.error("failed to process messages", ex); } }</code><technical_language>need new time. a static</technical_language>

Target:
public void onMessage(String data) { try { Map<String, Object> dataMap = objectMapper.readValue(data, MAP_TYPE_REF); String event = (String) dataMap.get("event"); if ("KEEP_ALIVE".equals(event)) { return; } String type = (String) dataMap.get("type"); if (type == null) { log.debug("type missing so ignoring message. {}", dataMap); return; } if (type.equals("authenticated")) { log.info("WebSocket connection authenticated as (in {})", dataMap.get("userId"), dataMap.get("orgId")); } else { String channelName = (String) dataMap.get("channel"); if (channelName != null) { TransportChannel channel = channels.get(channelName); if ((channel != null) && (!channel.isClosed())) { StreamMessage message = new StreamMessage(type, null, data); channel.offer(message); } else { log.debug("ignoring message. channel not found {}", channelName); } } } } catch (IOException ex) { log.error("failed to process messages", ex); } }
Source:
<code>public void testCustomMessageWhileSpiIsStopping() throws Exception { List<DummyCustomDiscoveryMessage> messages = new CopyOnWriteArrayList<>(); IgniteEx coord = startGrid("coordinator"); IgniteEx node1 = startGrid("node1"); IgniteEx node2 = startGrid("node2"); CustomEventListener<DummyCustomDiscoveryMessage> listener = new CustomEventListener<DummyCustomDiscoveryMessage>() { @Override public void onCustomEvent( AffinityTopologyVersion topVer, ClusterNode snd, DummyCustomDiscoveryMessage msg) { messages.add(msg); } }; <START> coord.context().discovery().setCustomEventListener(DummyCustomDiscoveryMessage.class, listener); <END> node1.context().discovery().setCustomEventListener(DummyCustomDiscoveryMessage.class, listener); node2.context().discovery().setCustomEventListener(DummyCustomDiscoveryMessage.class, listener); coord.cluster().active(true); TcpDiscoverySpi coordDisco = (TcpDiscoverySpi)coord.configuration().getDiscoverySpi(); TcpDiscoverySpi nodeDisco = (TcpDiscoverySpi)node1.configuration().getDiscoverySpi(); TcpDiscoveryImpl impl = (TcpDiscoveryImpl)Whitebox.getInternalState(nodeDisco, "impl"); Whitebox.setInternalState(impl, "spiState", TcpDiscoverySpiState.DISCONNECTING); sendDummyCustomMessage(coordDisco, IgniteUuid.randomUuid()); stopAllGrids(); assertEquals(3, messages.size()); }</code><technical_language>prefer G.allGrids iterating here</technical_language>

Target:
public void testCustomMessageWhileSpiIsStopping() throws Exception { List<DummyCustomDiscoveryMessage> messages = new CopyOnWriteArrayList<>(); startGrids(3); CustomEventListener<DummyCustomDiscoveryMessage> listener = new CustomEventListener<DummyCustomDiscoveryMessage>() { @Override public void onCustomEvent( AffinityTopologyVersion topVer, ClusterNode snd, DummyCustomDiscoveryMessage msg) { messages.add(msg); } }; G.allGrids().forEach(new Consumer<Ignite>() { @Override public void accept(Ignite ignite) { ((IgniteEx)ignite) .context() .discovery() .setCustomEventListener(DummyCustomDiscoveryMessage.class, listener); } }); grid(0).cluster().active(true); TcpDiscoverySpi coordDisco = (TcpDiscoverySpi)grid(0).configuration().getDiscoverySpi(); TcpDiscoverySpi nodeDisco = (TcpDiscoverySpi)grid(1).configuration().getDiscoverySpi(); TcpDiscoveryImpl impl = (TcpDiscoveryImpl)Whitebox.getInternalState(nodeDisco, "impl"); Whitebox.setInternalState(impl, "spiState", TcpDiscoverySpiState.DISCONNECTING); sendDummyCustomMessage(coordDisco, IgniteUuid.randomUuid()); GridTestUtils.waitForCondition(new GridAbsPredicate() { @Override public boolean apply() { return messages.size() == 3; } }, 10000); stopAllGrids(); }
Source:
<code>public void extractResults(Iterable<byte[]> canonicalRows, Map<ByteBuffer, List<ColumnOrSuperColumn>> colsByKey, long startTs) { Map<Sha256Hash, byte[]> canonicalRowsByHash = Maps.uniqueIndex(canonicalRows, Sha256Hash::computeHash); for (Map.Entry<ByteBuffer, List<ColumnOrSuperColumn>> colEntry : colsByKey.entrySet()) { byte[] rawRow = CassandraKeyValueServices.getBytesFromByteBuffer(colEntry.getKey()); byte[] row = canonicalRowsByHash.get(Sha256Hash.computeHash(rawRow)); List<ColumnOrSuperColumn> columns = colEntry.getValue(); <START> updateAppropriateDataStructures(row, columns); <END> for (ColumnOrSuperColumn c : columns) { Pair<byte[], Long> pair = CassandraKeyValueServices.decomposeName(c.getColumn()); internalExtractResult(startTs, row, pair.lhSide, c.getColumn().getValue(), pair.rhSide); } } }</code><technical_language>this is a pretty vague name</technical_language>

Target:
public void extractResults(Iterable<byte[]> canonicalRows, Map<ByteBuffer, List<ColumnOrSuperColumn>> colsByKey, long startTs) { Map<Sha256Hash, byte[]> canonicalRowsByHash = Maps.uniqueIndex(canonicalRows, Sha256Hash::computeHash); for (Map.Entry<ByteBuffer, List<ColumnOrSuperColumn>> colEntry : colsByKey.entrySet()) { byte[] rawRow = CassandraKeyValueServices.getBytesFromByteBuffer(colEntry.getKey()); byte[] row = canonicalRowsByHash.get(Sha256Hash.computeHash(rawRow)); List<ColumnOrSuperColumn> columns = colEntry.getValue(); if (!columns.isEmpty()) { rowsToLastCompositeColumns.put(row, columns.get(columns.size() - 1).getColumn()); } else { emptyRows.add(row); } rowsToRawColumnCount.put(row, columns.size()); for (ColumnOrSuperColumn c : columns) { Pair<byte[], Long> pair = CassandraKeyValueServices.decomposeName(c.getColumn()); internalExtractResult(startTs, row, pair.lhSide, c.getColumn().getValue(), pair.rhSide); } } }
Source:
<code>public void analyze() { <START> for ( Node node : nodes.values() ) { <END> depthFirstSearch( node ); } }</code><technical_language>This changes state of instance calling addNode illegal this. sense prevent that? API adding a check in addNode</technical_language>

Target:
private void analyze() { for ( Node node : nodes.values() ) { depthFirstSearch( node ); } }
Source:
<code>public void filter(final MethodNode methodNode, final IFilterContext context, final IFilterOutput output) { if (context.getSourceDebugExtension() == null) { return; } if (!context.getClassAnnotations() .contains(KotlinGeneratedFilter.KOTLIN_METADATA_DESC)) { return; } <START> final int max = parseSMAP(context.getSourceDebugExtension()); <END> int line = 0; for (AbstractInsnNode i = methodNode.instructions .getFirst(); i != null; i = i.getNext()) { if (AbstractInsnNode.LINE == i.getType()) { line = ((LineNumberNode) i).line; } if (line >= max) { output.ignore(i, i); } } }</code><technical_language>Another option return SourceDebugExtension object IFilterContext.getSourceDebugExtension(). instance do String parsing lazily once</technical_language>

Target:
public void filter(final MethodNode methodNode, final IFilterContext context, final IFilterOutput output) { if (context.getSourceDebugExtension() == null) { return; } if (!KotlinGeneratedFilter.isKotlinClass(context)) { return; } if (firstGeneratedLineNumber == -1) { firstGeneratedLineNumber = getFirstGeneratedLineNumber( context.getSourceFileName(), context.getSourceDebugExtension()); } int line = 0; for (AbstractInsnNode i = methodNode.instructions .getFirst(); i != null; i = i.getNext()) { if (AbstractInsnNode.LINE == i.getType()) { line = ((LineNumberNode) i).line; } if (line >= firstGeneratedLineNumber) { output.ignore(i, i); } } }
Source:
<code>public Map<Integer, String> getColumnNames() { return m_colNames; <START> } <END></code><technical_language>building this map in place (correct if I wrong please) please ImmutableSortedMap guava. This returning unmodifiable version of map</technical_language>

Target:
public Map<Integer, String> getColumnNames() { return ImmutableSortedMap.copyOf(m_colNames); }
Source:
<code>public PartSite(MPart model, IWorkbenchPart part, IWorkbenchPartReference ref, IConfigurationElement element) { this.model = model; this.part = part; this.partReference = ref; this.element = element; MElementContainer<?> parent = (MElementContainer<?>) ((EObject) model).eContainer(); while (!(parent instanceof MWindow)) { parent = (MElementContainer<?>) ((EObject) parent).eContainer(); } setWindow((MWindow) parent); e4Context = model.getContext(); IServiceLocatorCreator slc = (IServiceLocatorCreator) e4Context .get(IServiceLocatorCreator.class.getName()); IWorkbenchWindow workbenchWindow = getWorkbenchWindow(); this.serviceLocator = (ServiceLocator) slc.createServiceLocator(workbenchWindow, null, new IDisposable() { public void dispose() { } }, e4Context); initializeDefaultServices(); e4Context.set(IWorkbenchPart.class, part); <START> e4Context.set(IStatusLineManager.class.getName(), new ContextFunction() { <END> @Override public Object compute(IEclipseContext context, String contextKey) { return getActionBars().getStatusLineManager(); } }); }</code><technical_language>If set in EditorSite/ViewSite, is needed here</technical_language>

Target:
public PartSite(MPart model, IWorkbenchPart part, IWorkbenchPartReference ref, IConfigurationElement element) { this.model = model; this.part = part; this.partReference = ref; this.element = element; MElementContainer<?> parent = (MElementContainer<?>) ((EObject) model).eContainer(); while (!(parent instanceof MWindow)) { parent = (MElementContainer<?>) ((EObject) parent).eContainer(); } setWindow((MWindow) parent); e4Context = model.getContext(); IServiceLocatorCreator slc = (IServiceLocatorCreator) e4Context .get(IServiceLocatorCreator.class.getName()); IWorkbenchWindow workbenchWindow = getWorkbenchWindow(); this.serviceLocator = (ServiceLocator) slc.createServiceLocator(workbenchWindow, null, new IDisposable() { public void dispose() { } }, e4Context); initializeDefaultServices(); }
Source:
<code>public ItemStack insertItem( int slot, ItemStack stack, boolean simulate ) { <START> if( stack.isEmpty() ) <END> { return ItemStack.EMPTY; } ItemStack existing = getStackInSlot( slot ); int limit = getStackLimit( slot, stack ); if( !existing.isEmpty() ) { if( !ItemHandlerHelper.canItemStacksStack( stack, existing ) ) return stack; limit -= existing.getCount(); } if( limit <= 0 ) return stack; boolean reachedLimit = stack.getCount() > limit; if( !simulate ) { if( existing.isEmpty() ) { this.inv[slot] = AEApi.instance().storage().createItemStack( reachedLimit ? ItemHandlerHelper.copyStackWithSize( stack, limit ) : stack ); } else { existing.grow( reachedLimit ? limit : stack.getCount() ); } if( this.te != null && Platform.isServer() ) { this.te.onChangeInventory( this, slot, InvOperation.insert, ItemStack.EMPTY, reachedLimit ? ItemHandlerHelper.copyStackWithSize( stack, limit ) : stack ); } } return reachedLimit ? ItemHandlerHelper.copyStackWithSize( stack, stack.getCount() - limit ) : ItemStack.EMPTY; }</code><technical_language>![CRITICAL](<LINK_0> 'Severity: CRITICAL') Cyclomatic Complexity of this method "insertItem" is 11 is greater 10 authorized. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
public ItemStack insertItem( int slot, ItemStack stack, boolean simulate ) { if( stack.isEmpty() ) { return ItemStack.EMPTY; } ItemStack existing = getStackInSlot( slot ); int limit = getStackLimit( slot, stack ); if( !existing.isEmpty() ) { if( !ItemHandlerHelper.canItemStacksStack( stack, existing ) ) { return stack; } limit -= existing.getCount(); } if( limit <= 0 ) { return stack; } boolean reachedLimit = stack.getCount() > limit; if( !simulate ) { if( existing.isEmpty() ) { this.inv[slot] = AEApi.instance().storage().createItemStack( reachedLimit ? ItemHandlerHelper.copyStackWithSize( stack, limit ) : stack ); } else { existing.grow( reachedLimit ? limit : stack.getCount() ); } fireOnChangeInventory( slot, InvOperation.INSERT, ItemStack.EMPTY, reachedLimit ? ItemHandlerHelper.copyStackWithSize( stack, limit ) : stack ); } return reachedLimit ? ItemHandlerHelper.copyStackWithSize( stack, stack.getCount() - limit ) : ItemStack.EMPTY; }
Source:
<code>public void testIntersect() throws Exception { conn.tableOperations().create(tableName); BatchWriter bw = conn.createBatchWriter(tableName, new BatchWriterConfig()); Mutation m = new Mutation("part1"); m.put("bar", "doc1", "value"); m.put("bar", "doc2", "value"); m.put("dog", "doc3", "value"); m.put("foo", "doc2", "value"); m.put("foo", "doc3", "value"); bw.addMutation(m); m = new Mutation("part2"); m.put("bar", "DOC1", "value"); m.put("bar", "DOC2", "value"); m.put("dog", "DOC3", "value"); m.put("foo", "DOC2", "value"); m.put("foo", "DOC3", "value"); bw.addMutation(m); bw.flush(); final ClientSideIteratorScanner csis = new ClientSideIteratorScanner(conn.createScanner(tableName, new Authorizations())); final IteratorSetting si = new IteratorSetting(10, tableName, IntersectingIterator.class); IntersectingIterator.setColumnFamilies(si, new Text[] {new Text("bar"), new Text("foo")}); csis.addScanIterator(si); <START> csis.close(); <END> checkResults(csis, resultSet3, PartialKey.ROW_COLFAM_COLQUAL); }</code><technical_language>Another case of closed is used. I switching more try-with-resources syntax in cases fix a lot of kinds of errors</technical_language>

Target:
public void testIntersect() throws Exception { conn.tableOperations().create(tableName); BatchWriter bw = conn.createBatchWriter(tableName, new BatchWriterConfig()); Mutation m = new Mutation("part1"); m.put("bar", "doc1", "value"); m.put("bar", "doc2", "value"); m.put("dog", "doc3", "value"); m.put("foo", "doc2", "value"); m.put("foo", "doc3", "value"); bw.addMutation(m); m = new Mutation("part2"); m.put("bar", "DOC1", "value"); m.put("bar", "DOC2", "value"); m.put("dog", "DOC3", "value"); m.put("foo", "DOC2", "value"); m.put("foo", "DOC3", "value"); bw.addMutation(m); bw.flush(); final IteratorSetting si = new IteratorSetting(10, tableName, IntersectingIterator.class); try (ClientSideIteratorScanner csis = new ClientSideIteratorScanner(conn.createScanner(tableName, new Authorizations()))) { IntersectingIterator.setColumnFamilies(si, new Text[] {new Text("bar"), new Text("foo")}); csis.addScanIterator(si); checkResults(csis, resultSet3, PartialKey.ROW_COLFAM_COLQUAL); } }
Source:
<code>private String getJMXUrlForProcessRegex(String processRegex) throws com.sun.tools.attach.AttachNotSupportedException, IOException { for (com.sun.tools.attach.VirtualMachineDescriptor vmd : com.sun.tools.attach.VirtualMachine.list()) { if (vmd.displayName().matches(processRegex)) { LOGGER.info("Matched JVM '" + vmd.displayName() + "' against regex '" + processRegex + "'"); com.sun.tools.attach.VirtualMachine vm = com.sun.tools.attach.VirtualMachine.attach(vmd); String connectorAddress = vm.getAgentProperties().getProperty(CONNECTOR_ADDRESS); if (connectorAddress == null) { loadJMXAgent(vm); connectorAddress = vm.getAgentProperties().getProperty( CONNECTOR_ADDRESS); } return connectorAddress; } } List<String> jvms = new ArrayList<String>(); for (com.sun.tools.attach.VirtualMachineDescriptor vmd : com.sun.tools.attach.VirtualMachine.list()) { <START> jvms.add( vmd.displayName() ); <END> } throw new IOException("Cannot find JVM matching regex: '" + processRegex + "'; available JVMs (for this user account): " + jvms ); }</code><technical_language>This done previous loop for loop, c.f. <LINK_0></technical_language>

Target:
private String getJMXUrlForProcessRegex(String processRegex) throws com.sun.tools.attach.AttachNotSupportedException, IOException { List<String> jvms = new ArrayList<String>(); for (com.sun.tools.attach.VirtualMachineDescriptor vmd : com.sun.tools.attach.VirtualMachine.list()) { if (vmd.displayName().matches(processRegex)) { com.sun.tools.attach.VirtualMachine vm = com.sun.tools.attach.VirtualMachine.attach(vmd); LOGGER.info("Matched JVM '" + vmd.displayName() + "' against regex '" + processRegex + "'"); String connectorAddress = vm.getAgentProperties().getProperty(CONNECTOR_ADDRESS); if (connectorAddress == null) { loadJMXAgent(vm); connectorAddress = vm.getAgentProperties().getProperty( CONNECTOR_ADDRESS); } return connectorAddress; } jvms.add( vmd.displayName() ); } throw new IOException("Cannot find JVM matching regex: '" + processRegex + "'; available JVMs (for this user account): " + jvms ); }
Source:
<code>private void getReport(MetricGroupNode metricGroupNode, Long testId) { try { if (metricGroupNode.getMetricGroupNodeList() != null) { for (MetricGroupNode metricGroup : (List<MetricGroupNode>) metricGroupNode.getMetricGroupNodeList()) getReport(metricGroup, testId); } if (metricGroupNode.getMetricsWithoutChildren() != null) { String groupTitle = metricGroupNode.getDisplayName(); for (MetricNode node : (List<MetricNode>) metricGroupNode.getMetricsWithoutChildren()) { <START> if (plotsReal.get(node).getPlotSeries().isEmpty()) <END> continue; if (!plots.containsKey(testId)) plots.put(testId, new MetricPlotDTOs()); plots.get(testId).getMetricPlotDTOs().add(new MetricPlotDTO(node.getDisplayName(), node.getDisplayName(), groupTitle, makePlot(plotsReal.get(node)))); groupTitle = ""; } } } catch (Exception e) { log.error("Unable to take plot information about {}", metricGroupNode.getDisplayName()); } }</code><technical_language>please, log warning in case. warning info failed node</technical_language>

Target:
private void getReport(MetricGroupNode metricGroupNode, Long testId) { try { if (metricGroupNode.getMetricGroupNodeList() != null) { for (MetricGroupNode metricGroup : (List<MetricGroupNode>) metricGroupNode.getMetricGroupNodeList()) getReport(metricGroup, testId); } if (metricGroupNode.getMetricsWithoutChildren() != null) { String groupTitle = metricGroupNode.getDisplayName(); for (MetricNode node : (List<MetricNode>) metricGroupNode.getMetricsWithoutChildren()) { if (plotsReal.get(node).getPlotSeries().isEmpty()) { log.warn("No plot data for "+ node.getDisplayName()); continue; } if (!plots.containsKey(testId)) plots.put(testId, new MetricPlotDTOs()); plots.get(testId).getMetricPlotDTOs().add(new MetricPlotDTO(node.getDisplayName(), node.getDisplayName(), groupTitle, makePlot(plotsReal.get(node)))); groupTitle = ""; } } } catch (Exception e) { log.error("Unable to take plot data for {}", metricGroupNode.getDisplayName()); } }
Source:
<code>private ConfigSource createGuessConfig() { ConfigSource configSource = Exec.newConfigSource(); <START> configSource.set("guess_plugins", new ObjectMapper().createArrayNode().add("jira")); <END> configSource.set("guess_sample_buffer_bytes", GUESS_BUFFER_SIZE); return configSource; }</code><technical_language>@tvhung83 (extracted <LINK_0> suggestion return Exec.newConfigSource() .set("guess_plugins", ImmutableList.of("jira")) .set("guess_sample_buffer_bytes", GUESS_BUFFER_SIZE);</technical_language>

Target:
private ConfigSource createGuessConfig() { return Exec.newConfigSource() .set("guess_plugins", ImmutableList.of("jira")) .set("guess_sample_buffer_bytes", GUESS_BUFFER_SIZE); }
Source:
<code>static ILogData getLogData(CorfuRuntime runtime, boolean loadInCache, long address) { if (loadInCache) { return runtime.getAddressSpaceView().read(address); } else { <START> return runtime.getAddressSpaceView().fetch(address, false); <END> } }</code><technical_language>caching determine behavior of fetch? handle trimmed exception higher level. This overloaded semantics me</technical_language>

Target:
static ILogData getLogData(CorfuRuntime runtime, boolean loadInCache, long address) { if (loadInCache) { return runtime.getAddressSpaceView().read(address); } else { return runtime.getAddressSpaceView().fetch(address); } }
Source:
<code><START> public Property[] getProperties(String propertyName) { <END> ArrayList<Property> ret = new ArrayList<>(); for (Property property : m_properties) { if (property.getName().equals(propertyName)) { ret.add(property); } } return ret.toArray(new Property[ret.size()]); }</code><technical_language>change List<Properties> is this API fixed</technical_language>

Target:
public List<Property> getProperties(String propertyName) { List<Property> found = new ArrayList<>(); for (Property property : m_properties) { if (property.getName().equals(propertyName)) { found.add(property); } } return found; }
Source:
<code><START> public Integer getRefundAmountAvailable() { <END> return refundAmountAvailable; }</code><technical_language>minor: Optional<Integer></technical_language>

Target:
public Optional<Integer> getRefundAmountAvailable() { return Optional.ofNullable(refundAmountAvailable); }
Source:
<code>private void initConnection (Activity activity, long accountId, long providerId) { <START> if (activity == null) <END> return; IImConnection conn = ((ImApp)activity.getApplication()).getConnection(providerId); if (conn == null) { try { conn = ((ImApp)getActivity().getApplication()).createConnection(providerId, accountId); } catch (RemoteException e) { Log.e(ImApp.LOG_TAG,"error creating connection",e); } } if (conn != null) { mFilterView.setConnection(conn); mPresenceView.setConnection(conn); try { mPresenceView.loggingIn(conn.getState() == ImConnection.LOGGING_IN); } catch (RemoteException e) { mPresenceView.loggingIn(false); } Uri.Builder builder = Imps.Contacts.CONTENT_URI_CONTACTS_BY.buildUpon(); ContentUris.appendId(builder, providerId); ContentUris.appendId(builder, accountId); mFilterView.doFilter(builder.build(), null); } }</code><technical_language>is this guard meant protect against? I code path activity == null is possible</technical_language>

Target:
private void initConnection (Activity activity, long accountId, long providerId) { IImConnection conn = ((ImApp)activity.getApplication()).getConnection(providerId); if (conn == null) { try { conn = ((ImApp)getActivity().getApplication()).createConnection(providerId, accountId); } catch (RemoteException e) { Log.e(ImApp.LOG_TAG,"error creating connection",e); } } if (conn != null) { mFilterView.setConnection(conn); mPresenceView.setConnection(conn); try { mPresenceView.loggingIn(conn.getState() == ImConnection.LOGGING_IN); } catch (RemoteException e) { mPresenceView.loggingIn(false); } Uri.Builder builder = Imps.Contacts.CONTENT_URI_CONTACTS_BY.buildUpon(); ContentUris.appendId(builder, providerId); ContentUris.appendId(builder, accountId); mFilterView.doFilter(builder.build(), null); } }
Source:
<code>private DbSpace getBdbStats() { <START> return new DbSpace(environment, sorted); <END> }</code><technical_language>Is nt sorted false here? remove variable</technical_language>

Target:
private DbSpace getBdbStats() { return new DbSpace(environment); }
Source:
<code>public Loader<Cursor> onCreateLoader(int id, Bundle args) { WhereClause whereClause = new WhereClause.Builder() .where(PublicContract.Truck.OWNED_BY_CURRENT_USER, EQUALS, 1) .build(); String[] projection = TrucksOwnedByUserQuery.PROJECTION; <START> Uri uri = Contract.TRUCK_PROPERTIES_URI; <END> return new CursorLoader(this, uri, projection, whereClause.selection, whereClause.selectionArgs, null); }</code><technical_language>a query, PublicContract.TRUCK_URI. internal in Contract class b/c do a write a SQL view</technical_language>

Target:
public Loader<Cursor> onCreateLoader(int id, Bundle args) { WhereClause whereClause = new WhereClause.Builder() .where(PublicContract.Truck.OWNED_BY_CURRENT_USER, EQUALS, 1) .build(); String[] projection = TrucksOwnedByUserQuery.PROJECTION; Uri uri = PublicContract.TRUCK_URI; return new CursorLoader(this, uri, projection, whereClause.selection, whereClause.selectionArgs, null); }
Source:
<code>public static int getPeristentExportTrigger(List<String> triggers) { int tableType = 0; Collections.sort(triggers); for (String trigger : triggers) { <START> if(trigger.equals("INSERT")) { <END> tableType += TableType.PERSISTENT_EXPORT_INSERT.get(); } else if(trigger.equals("DELETE")) { tableType += TableType.PERSISTENT_EXPORT_DELETE.get(); } else if(trigger.equals("UPDATE_OLD")) { tableType += TableType.PERSISTENT_EXPORT_UPDATEOLD.get(); } else if(trigger.equals("UPDATE_NEW")) { tableType += TableType.PERSISTENT_EXPORT_UPDATENEW.get(); } else if (trigger.equals("UPDATE")) { tableType += TableType.PERSISTENT_EXPORT_UPDATE.get(); } } return tableType; }</code><technical_language>a switch statement here</technical_language>

Target:
public static int getPeristentExportTrigger(List<String> triggers) { int tableType = 0; for (String trigger : triggers) { if(trigger.equalsIgnoreCase("INSERT")) { tableType += TableType.PERSISTENT_EXPORT_INSERT.get(); } else if(trigger.equalsIgnoreCase("DELETE")) { tableType += TableType.PERSISTENT_EXPORT_DELETE.get(); } else if(trigger.equalsIgnoreCase("UPDATE_OLD")) { tableType += TableType.PERSISTENT_EXPORT_UPDATEOLD.get(); } else if(trigger.equalsIgnoreCase("UPDATE_NEW")) { tableType += TableType.PERSISTENT_EXPORT_UPDATENEW.get(); } else if (trigger.equalsIgnoreCase("UPDATE")) { tableType += TableType.PERSISTENT_EXPORT_UPDATE.get(); } } return tableType; }
Source:
<code>public void createThumbnail() { String imagePath = filePathInfo.getAbsolutePath(); BitmapFactory.Options options = new BitmapFactory.Options(); <START> options.inPreferredConfig = Bitmap.Config.ARGB_8888; <END> Bitmap bitmap = BitmapFactory.decodeFile(imagePath, options); bitmap = ThumbnailUtils.extractThumbnail(bitmap, THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT); thumbnail = RoundedBitmapDrawableFactory.create(Resources.getSystem(), bitmap); thumbnail.setCircular(true); }</code><technical_language>Bitmap config is below, moved interface</technical_language>

Target:
public void createThumbnail() { String imagePath = filePathInfo.getAbsolutePath(); BitmapFactory.Options options = new BitmapFactory.Options(); options.inPreferredConfig = BITMAP_CONFIG; Bitmap bitmap = BitmapFactory.decodeFile(imagePath, options); bitmap = ThumbnailUtils.extractThumbnail(bitmap, THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT); thumbnail = RoundedBitmapDrawableFactory.create(Resources.getSystem(), bitmap); thumbnail.setCircular(true); }
Source:
<code>public static void fixNmMdAndUq(final SAMRecord record, final ReferenceSequenceFileWalker refSeqWalker, final boolean isBisulfiteSequence) { <START> final ReferenceSequence refSeq = refSeqWalker.get(refSeqWalker.getSequenceDictionary().getSequenceIndex(record.getReferenceName())); <END> final byte[] referenceBases = refSeq.getBases(); SequenceUtil.calculateMdAndNmTags(record, referenceBases, true, !isBisulfiteSequence); if (isBisulfiteSequence) { record.setAttribute(SAMTag.NM.name(), SequenceUtil.calculateSamNmTag(record, referenceBases, 0, isBisulfiteSequence)); } fixUq(record, refSeqWalker, isBisulfiteSequence); }</code><technical_language>part I meant extract index...refSeqWalker.getSequenceDictionary().getSequenceIndex(record.getReferenceName())</technical_language>

Target:
public static void fixNmMdAndUq(final SAMRecord record, final ReferenceSequenceFileWalker refSeqWalker, final boolean isBisulfiteSequence) { final byte[] referenceBases = refSeqWalker.get(record.getReferenceIndex()).getBases(); SequenceUtil.calculateMdAndNmTags(record, referenceBases, true, !isBisulfiteSequence); if (isBisulfiteSequence) { record.setAttribute(SAMTag.NM.name(), SequenceUtil.calculateSamNmTag(record, referenceBases, 0, isBisulfiteSequence)); } fixUq(record, refSeqWalker, isBisulfiteSequence); }
Source:
<code>protected void verifyToken(JsonNode node, String serviceName, String clientId, String nxuser, String creationDate) { if (node.isArray()) { JsonNode token = null; for (int i = 0; i < node.size(); i++) { if (node.get(i).get("entity-type").textValue().equals(OAUTH2_TOKEN_TYPE) && node.get(i).get("serviceName").textValue().equals(serviceName) && node.get(i).get("nuxeoLogin").textValue().equals(nxuser) && <START> node.get(i).get("creationDate").textValue().equals(creationDate) && <END> (clientId != null ? node.get(i).get("clientId").textValue().equals(clientId) : true)) { token = node.get(i); } } assertNotNull(token); } else { assertEquals(OAUTH2_TOKEN_TYPE, node.get("entity-type").textValue()); assertEquals(serviceName, node.get("serviceName").textValue()); assertEquals(nxuser, node.get("nuxeoLogin").textValue()); assertEquals(creationDate, node.get("creationDate").textValue()); if (clientId != null) { assertEquals(clientId, node.get("clientId").textValue()); } } }</code><technical_language>Put node.get(i) in a local variable</technical_language>

Target:
protected void verifyToken(JsonNode node, String serviceName, String clientId, String nxuser, String creationDate) { if (node.isArray()) { JsonNode token = null; JsonNode child = null; for (int i = 0; i < node.size(); i++) { child = node.get(i); if (child.get("entity-type").textValue().equals(OAUTH2_TOKEN_TYPE) && child.get("serviceName").textValue().equals(serviceName) && child.get("nuxeoLogin").textValue().equals(nxuser) && child.get("creationDate").textValue().equals(creationDate) && (clientId != null ? child.get("clientId").textValue().equals(clientId) : true)) { return; } } fail("No token found."); } else { assertEquals(OAUTH2_TOKEN_TYPE, node.get("entity-type").textValue()); assertEquals(serviceName, node.get("serviceName").textValue()); assertEquals(nxuser, node.get("nuxeoLogin").textValue()); assertEquals(creationDate, node.get("creationDate").textValue()); if (clientId != null) { assertEquals(clientId, node.get("clientId").textValue()); } } }
Source:
<code>public Object visitCast(Cast node, Object context) { Object value = process(node.getExpression(), context); Type type = metadata.getType(parseTypeSignature(node.getType())); <START> if (type.equals(type(node.getExpression())) || node.isTypeOnly()) { <END> return value; } if (value instanceof Expression) { return new Cast((Expression) value, node.getType(), node.isSafe(), node.isTypeOnly()); } if (optimize && !FunctionRegistry.isSupportedLiteralType(type(node))) { return new Cast(toExpression(value, type(node.getExpression())), node.getType(), node.isSafe(), node.isTypeOnly()); } if (value == null) { return null; } if (type == null) { throw new IllegalArgumentException("Unsupported type: " + node.getType()); } Signature operator = metadata.getFunctionRegistry().getCoercion(type(node.getExpression()), type); try { return functionInvoker.invoke(operator, session, ImmutableList.of(value)); } catch (RuntimeException e) { if (node.isSafe()) { return null; } throw e; } }</code><technical_language>I remove type casts (if is Expression). I purpose is preserve type information for execution operators. Also, type cast fail (e.g: precision small)</technical_language>

Target:
public Object visitCast(Cast node, Object context) { Object value = process(node.getExpression(), context); Type targetType = metadata.getType(parseTypeSignature(node.getType())); if (targetType == null) { throw new IllegalArgumentException("Unsupported type: " + node.getType()); } Type sourceType = type(node.getExpression()); if (value instanceof Expression) { if (targetType.equals(sourceType)) { return value; } return new Cast((Expression) value, node.getType(), node.isSafe(), node.isTypeOnly()); } if (node.isTypeOnly()) { return value; } if (optimize && !FunctionRegistry.isSupportedLiteralType(type(node))) { return new Cast(toExpression(value, sourceType), node.getType(), node.isSafe(), node.isTypeOnly()); } if (value == null) { return null; } Signature operator = metadata.getFunctionRegistry().getCoercion(sourceType, targetType); try { return functionInvoker.invoke(operator, session, ImmutableList.of(value)); } catch (RuntimeException e) { if (node.isSafe()) { return null; } throw e; } }
Source:
<code>static Bitmap decodeStream(InputStream stream, Request request) throws IOException { MarkableInputStream markStream = new MarkableInputStream(stream, true); stream = markStream; <START> long mark = markStream.savePosition(65536); <END> final BitmapFactory.Options options = RequestHandler.createBitmapOptions(request); final boolean calculateSize = RequestHandler.requiresInSampleSize(options); boolean isWebPFile = Utils.isWebPFile(stream); boolean isPurgeable = request.purgeable && android.os.Build.VERSION.SDK_INT < 21; markStream.reset(mark); if (isWebPFile || isPurgeable) { byte[] bytes = Utils.toByteArray(stream); if (calculateSize) { BitmapFactory.decodeByteArray(bytes, 0, bytes.length, options); RequestHandler.calculateInSampleSize(request.targetWidth, request.targetHeight, options, request); } return BitmapFactory.decodeByteArray(bytes, 0, bytes.length, options); } else { if (calculateSize) { BitmapFactory.decodeStream(stream, null, options); RequestHandler.calculateInSampleSize(request.targetWidth, request.targetHeight, options, request); markStream.reset(mark); } Bitmap bitmap = BitmapFactory.decodeStream(stream, null, options); if (bitmap == null) { throw new IOException("Failed to decode stream."); } return bitmap; } }</code><technical_language>This 1024</technical_language>

Target:
static Bitmap decodeStream(InputStream stream, Request request) throws IOException { MarkableInputStream markStream = new MarkableInputStream(stream); stream = markStream; markStream.allowMarksToExpire(false); long mark = markStream.savePosition(1024); final BitmapFactory.Options options = RequestHandler.createBitmapOptions(request); final boolean calculateSize = RequestHandler.requiresInSampleSize(options); boolean isWebPFile = Utils.isWebPFile(stream); boolean isPurgeable = request.purgeable && android.os.Build.VERSION.SDK_INT < 21; markStream.reset(mark); if (isWebPFile || isPurgeable) { byte[] bytes = Utils.toByteArray(stream); if (calculateSize) { BitmapFactory.decodeByteArray(bytes, 0, bytes.length, options); RequestHandler.calculateInSampleSize(request.targetWidth, request.targetHeight, options, request); } return BitmapFactory.decodeByteArray(bytes, 0, bytes.length, options); } else { if (calculateSize) { BitmapFactory.decodeStream(stream, null, options); RequestHandler.calculateInSampleSize(request.targetWidth, request.targetHeight, options, request); markStream.reset(mark); } markStream.allowMarksToExpire(true); Bitmap bitmap = BitmapFactory.decodeStream(stream, null, options); if (bitmap == null) { throw new IOException("Failed to decode stream."); } return bitmap; } }
Source:
<code>protected Object setSkipRemoteGetsAndInvokeNextForManyEntriesCommand(InvocationContext ctx, WriteCommand command, CompletionStage<Void> delay) { if (CompletionStages.isCompletedSuccessfully(delay)) { <START> return asyncValue(delay).thenApply(ctx, command, (rCtx, rCommand, rValue) -> <END> invokeNextThenApply(rCtx, rCommand, applyAndFixVersionForMany)); } return invokeNextThenApply(ctx, command, applyAndFixVersionForMany); }</code><technical_language>delay is completed; need wait :)</technical_language>

Target:
protected Object setSkipRemoteGetsAndInvokeNextForManyEntriesCommand(InvocationContext ctx, WriteCommand command, CompletionStage<Void> delay) { return makeStage(asyncInvokeNext(ctx, command, delay)).thenApply(ctx, command, applyAndFixVersionForMany); }
Source:
<code>void put(SystemStreamPartition ssp, IncomingMessageEnvelope envelope) { List<IncomingMessageEnvelope> messages = bufferedMessages.get(ssp); <START> bufferedMessages.get(ssp).add(envelope); <END> }</code><technical_language>Need ensure offset inserted queue is increasing equals message offset + 1 otherwise, poll logic impacted</technical_language>

Target:
void put(SystemStreamPartition ssp, IncomingMessageEnvelope envelope) { List<IncomingMessageEnvelope> messages = bufferedMessages.get(ssp); String offset = String.valueOf(messages.size()); if (envelope.getOffset().equals(offset)) { throw new SamzaException( String.format("Offset mismatch for ssp %s, expected %s found %s, please set the correct offset", ssp, offset, envelope.getOffset())); } bufferedMessages.get(ssp).add(envelope); }
Source:
<code>public static MassRepairUnitAction performUnitMassRepairOrSalvage(CampaignGUI campaignGUI, Unit unit, boolean isSalvage, List<MassRepairOption> mroList, MassRepairConfiguredOptions configuredOptions) { Campaign campaign = campaignGUI.getCampaign(); <START> ArrayList<Person> techs = campaign.getTechs(true); <END> if (techs.isEmpty()) { return new MassRepairUnitAction(unit, isSalvage, MassRepairUnitAction.STATUS.NO_TECHS); } MassRepairUnitAction unitAction = new MassRepairUnitAction(unit, isSalvage, MassRepairUnitAction.STATUS.NO_ACTIONS); for (int i = techs.size() - 1; i >= 0; i--) { Person tech = techs.get(i); if (!tech.canTech(unit.getEntity())) { techs.remove(i); } } Map<Integer, MassRepairOption> mroByTypeMap = new HashMap<Integer, MassRepairOption>(); for (int i = 0; i < mroList.size(); i++) { mroByTypeMap.put(mroList.get(i).getType(), mroList.get(i)); } boolean performMoreRepairs = true; long time = System.nanoTime(); while (performMoreRepairs) { MassRepairUnitAction currentUnitAction = performUnitMassTechAction(campaignGUI, unit, techs, mroByTypeMap, isSalvage, configuredOptions); performMoreRepairs = currentUnitAction.getPartSet().isHasRepairs(); unitAction.merge(currentUnitAction); if (unitAction.isStatusNoActions()) { unitAction.setStatus(currentUnitAction.getStatus()); } } debugLog("Finished fixing %s in %s ns", unit.getName(), System.nanoTime() - time); return unitAction; }</code><technical_language>List</technical_language>

Target:
public static MassRepairUnitAction performUnitMassRepairOrSalvage(CampaignGUI campaignGUI, Unit unit, boolean isSalvage, List<MassRepairOption> mroList, MassRepairConfiguredOptions configuredOptions) { Campaign campaign = campaignGUI.getCampaign(); List<Person> techs = campaign.getTechs(true); if (techs.isEmpty()) { return new MassRepairUnitAction(unit, isSalvage, MassRepairUnitAction.STATUS.NO_TECHS); } MassRepairUnitAction unitAction = new MassRepairUnitAction(unit, isSalvage, MassRepairUnitAction.STATUS.NO_ACTIONS); for (int i = techs.size() - 1; i >= 0; i--) { Person tech = techs.get(i); if (!tech.canTech(unit.getEntity())) { techs.remove(i); } } Map<Integer, MassRepairOption> mroByTypeMap = new HashMap<Integer, MassRepairOption>(); for (int i = 0; i < mroList.size(); i++) { mroByTypeMap.put(mroList.get(i).getType(), mroList.get(i)); } boolean performMoreRepairs = true; long time = System.nanoTime(); while (performMoreRepairs) { MassRepairUnitAction currentUnitAction = performUnitMassTechAction(campaignGUI, unit, techs, mroByTypeMap, isSalvage, configuredOptions); performMoreRepairs = currentUnitAction.getPartSet().isHasRepairs(); unitAction.merge(currentUnitAction); if (unitAction.isStatusNoActions()) { unitAction.setStatus(currentUnitAction.getStatus()); } } debugLog("Finished fixing %s in %s ns", "performUnitMassRepairOrSalvage", unit.getName(), System.nanoTime() - time); return unitAction; }
Source:
<code>private StringBuffer createBaseQueryBlock(FieldSearchFilter[] filters, boolean selectAll, List<String> categories) { StringBuffer query = super.createBaseQueryBlock(filters, selectAll); <START> for(int i = 0; i < categories.size(); i++) { <END> query.append(String.format("INNER JOIN resourcerelations res%d ON resources.resid = res%d.resid AND res%d.refcategory= ? ", i, i, i)); } return query; }</code><technical_language>Categories null based code</technical_language>

Target:
private StringBuffer createBaseQueryBlock(FieldSearchFilter[] filters, boolean selectAll, List<String> categories) { StringBuffer query = super.createBaseQueryBlock(filters, selectAll); if (categories != null) { for (int i = 0; i < categories.size(); i++) { query.append(String.format( "INNER JOIN resourcerelations res%d ON resources.resid = res%d.resid AND res%d.refcategory= ? ", i, i, i)); } } return query; }