auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public StorageUsageRefresher.Listener getUsageRefresherListener() { <END> return new StorageUsageRefresher.Listener() { @Override public void onNewContainerStorageUsage(Map<String, Map<String, Long>> containerStorageUsage) { initMap(containerStorageUsage, storageUsage, true); } }; }</code><technical_language>time call getUsageRefresherListener(), instantiates a new StorageUsageRefresher.Listener, is this intended</technical_language>

Target:
StorageUsageRefresher.Listener getUsageRefresherListener() { return containerStorageUsage -> { initMap(containerStorageUsage, storageUsage, true); }; }
Source:
<code>public Iterable<OpenSshCertificate> loadCertificates(SessionContext session) throws IOException, GeneralSecurityException { List<OpenSshCertificate> certificates = new ArrayList<>(); for (Path file : files) { <START> List<String> lines = IoUtils.readAllLines(new FileInputStream(file.toFile())); <END> for (String line : lines) { PublicKeyEntry publicKeyEntry = PublicKeyEntry.parsePublicKeyEntry(line); PublicKey publicKey = publicKeyEntry.resolvePublicKey(session, null, null); certificates.add((OpenSshCertificate) publicKey); } } return certificates; }</code><technical_language>Please try-with-resource input stream - this code opens a stream close it. - Files.readAllLines(file, StandardCharset.UTF8)</technical_language>

Target:
public Iterable<OpenSshCertificate> loadCertificates(SessionContext session) throws IOException, GeneralSecurityException { List<OpenSshCertificate> certificates = new ArrayList<>(); for (Path file : files) { List<String> lines = Files.readAllLines(file, StandardCharsets.UTF_8); for (String line : lines) { line = GenericUtils.replaceWhitespaceAndTrim(line); if (line.isEmpty() || line.startsWith("#")) { continue; } PublicKeyEntry publicKeyEntry = PublicKeyEntry.parsePublicKeyEntry(line); if (publicKeyEntry == null) { continue; } PublicKey publicKey = publicKeyEntry.resolvePublicKey(session, null, null); if (publicKey == null) { continue; } if (!(publicKey instanceof OpenSshCertificate)) { throw new InvalidKeyException("Got unexpected key type in " + file + ". Expected OpenSSHCertificate."); } certificates.add((OpenSshCertificate) publicKey); } } return certificates; }
Source:
<code>public void test() { HazelcastInstance hz1 = Hazelcast.newHazelcastInstance(); final TcpIpConnectionManager connectionManager = (TcpIpConnectionManager) getNode(hz1).getConnectionManager(); HazelcastInstance hz2 = Hazelcast.newHazelcastInstance(); hz2.shutdown(); assertTrueAllTheTime(new AssertTask() { @Override <START> public void run() throws Exception { <END> assertEquals(0, connectionManager.acceptedChannels.size()); } }, 5); }</code><technical_language>is assertTrueAllTheTime used? sufficient a single check instead of 5 checks 1s delay them</technical_language>

Target:
public void test() { HazelcastInstance hz1 = Hazelcast.newHazelcastInstance(); final TcpIpConnectionManager connectionManager = (TcpIpConnectionManager) getNode(hz1).getConnectionManager(); HazelcastInstance hz2 = Hazelcast.newHazelcastInstance(); hz2.shutdown(); assertTrueAllTheTime(new AssertTask() { @Override public void run() throws Exception { assertEquals(0, connectionManager.getAcceptedChannels().size()); } }, 5); }
Source:
<code>private StringBuilder buildMainFileName(Artifact artifact) { StringBuilder mainName = new StringBuilder(); String versionString = "-" + getNormalizedVersion(artifact); String classifierString = StringUtils.EMPTY; <START> if (artifact.getClassifier() != null && !artifact.getClassifier().isEmpty()) { <END> classifierString = "-" + artifact.getClassifier(); } mainName.append(artifact.getArtifactId()).append(versionString); mainName.append(classifierString).append("."); return mainName; }</code><technical_language>please replace StringUtils.isNotBlank()</technical_language>

Target:
private StringBuilder buildMainFileName(Artifact artifact) { StringBuilder mainName = new StringBuilder(); String versionString = "-" + getNormalizedVersion(artifact); String classifierString = StringUtils.EMPTY; if (StringUtils.isNotBlank(artifact.getClassifier())) { classifierString = "-" + artifact.getClassifier(); } mainName.append(artifact.getArtifactId()).append(versionString); mainName.append(classifierString).append("."); return mainName; }
Source:
<code>public void showSavingsAccountCreatedSuccessfully(Savings savings) { Toast.makeText(getActivity(), <START> getResources().getString(R.string.savings_account_submitted), <END> Toast.LENGTH_LONG).show(); }</code><technical_language>need change savings_account_submitted_for_approval savings_account_submitted is type of saving account submission. 1. Submitting Saving for creating a new one. 2. Submitting for approval</technical_language>

Target:
public void showSavingsAccountCreatedSuccessfully(Savings savings) { Toast.makeText(getActivity(), getResources().getString(R.string.savings_account_submitted_for_approval), Toast.LENGTH_LONG).show(); }
Source:
<code><START> protected File getFile(Class<?> type, String qualifier, String fileName, boolean createIfNotExist) throws IOException { <END> final File path = new File(fileStorageDirectory + "/" + type.getSimpleName().toLowerCase() + "/" + qualifier + "/"); final File file = new File(path, fileName); log.info("Looking up " + file); if (path.exists()) { if (file.exists()) { if (file.canRead()) { log.info("OK"); return file; } else { throw new IOException("Access denied. Please check file permissions."); } } else { if (createIfNotExist && file.createNewFile()) { log.info("OK"); return file; } throw new IOException("No such file."); } } else { log.warn("MISO files directory doesn't seem to exist. Trying to create it..."); if (path.mkdirs()) { log.warn("MISO files directory created.. retrying file listing..."); return getFile(type, qualifier, fileName, createIfNotExist); } else { throw new IOException("Could not create MISO file directory (" + path + "). Please create this directory or allow the parent to be writable to MISO."); } } }</code><technical_language>![CRITICAL](<LINK_1> 'Severity: CRITICAL') Refactor this method reduce Cognitive Complexity 16 15 allowed. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
protected File getFile(Class<?> type, String qualifier, String fileName, boolean createIfNotExist) throws IOException { final File path = new File(fileStorageDirectory + "/" + type.getSimpleName().toLowerCase() + "/" + qualifier + "/"); final File file = new File(path, fileName); log.info("Looking up {}", file); if (path.exists()) { if (file.exists()) { if (file.canRead()) { log.info("OK"); return file; } else { throw new IOException("Access denied. Please check file permissions."); } } else { if (createIfNotExist && file.createNewFile()) { log.info("OK"); return file; } throw new IOException("No such file."); } } else { log.warn("MISO files directory doesn't seem to exist. Trying to create it..."); if (path.mkdirs()) { log.warn("MISO files directory created.. retrying file listing..."); return getFile(type, qualifier, fileName, createIfNotExist); } else { throw new IOException("Could not create MISO file directory (" + path + "). Please create this directory or allow the parent to be writable to MISO."); } } }
Source:
<code>public static MessageType getSubfieldType(GroupType baseType, Subfield subfield) { checkArgument(subfield.getPath().size() >= 1, "subfield size is less than 1"); ImmutableList.Builder<org.apache.parquet.schema.Type> typeBuilder = ImmutableList.builder(); org.apache.parquet.schema.Type parentType = getParquetTypeByName(subfield.getRootName(), baseType); for (PathElement field : subfield.getPath()) { if (field instanceof NestedField) { NestedField nestedField = (NestedField) field; org.apache.parquet.schema.Type childType = getParquetTypeByName(nestedField.getName(), parentType.asGroupType()); if (childType != null) { typeBuilder.add(childType); parentType = childType; } } else { break; } } <START> List<org.apache.parquet.schema.Type> paths = typeBuilder.build(); <END> if (paths.isEmpty()) { return new MessageType(subfield.getRootName(), ImmutableList.of()); } else { org.apache.parquet.schema.Type type = paths.get(paths.size() - 1); for (int i = paths.size() - 2; i >= 0; --i) { GroupType groupType = paths.get(i).asGroupType(); type = new MessageType(groupType.getName(), ImmutableList.of(type)); } MessageType result = new MessageType(subfield.getRootName(), ImmutableList.of(type)); return result; } }</code><technical_language>rename paths types subfieldTypes this variable holds a list of types, paths</technical_language>

Target:
public static MessageType getSubfieldType(GroupType baseType, Subfield subfield) { checkArgument(subfield.getPath().size() >= 1, "subfield size is less than 1"); ImmutableList.Builder<org.apache.parquet.schema.Type> typeBuilder = ImmutableList.builder(); org.apache.parquet.schema.Type parentType = getParquetTypeByName(subfield.getRootName(), baseType); for (PathElement field : subfield.getPath()) { if (field instanceof NestedField) { NestedField nestedField = (NestedField) field; org.apache.parquet.schema.Type childType = getParquetTypeByName(nestedField.getName(), parentType.asGroupType()); if (childType != null) { typeBuilder.add(childType); parentType = childType; } } else { typeBuilder.add(parentType.asGroupType().getFields().get(0)); break; } } List<org.apache.parquet.schema.Type> subfieldTypes = typeBuilder.build(); if (subfieldTypes.isEmpty()) { return new MessageType(subfield.getRootName(), ImmutableList.of()); } org.apache.parquet.schema.Type type = subfieldTypes.get(subfieldTypes.size() - 1); for (int i = subfieldTypes.size() - 2; i >= 0; --i) { GroupType groupType = subfieldTypes.get(i).asGroupType(); type = new MessageType(groupType.getName(), ImmutableList.of(type)); } return new MessageType(subfield.getRootName(), ImmutableList.of(type)); }
Source:
<code>private EnsembleProvider createEnsembleProvider() throws Exception { switch (conn.getType()) { case EXHIBITOR: <START> throw new RuntimeException("Exhibitor support is removed on 2020-12-15; use zookeeper connection"); <END> case ZOOKEEPER: final String addressesJoined = conn.getAddresses().stream() .map(AddressPort::asAddressPort) .collect(Collectors.joining(",")); return new ChrootedFixedEnsembleProvider(addressesJoined, conn.getPathPrepared()); default: throw new RuntimeException("Connection type " + conn.getType() + " is not supported"); } }</code><technical_language>a bit concerned this. In order flood - remove this enum constant all</technical_language>

Target:
private EnsembleProvider createEnsembleProvider() throws Exception { switch (conn.getType()) { case ZOOKEEPER: final String addressesJoined = conn.getAddresses().stream() .map(AddressPort::asAddressPort) .collect(Collectors.joining(",")); return new ChrootedFixedEnsembleProvider(addressesJoined, conn.getPathPrepared()); default: throw new RuntimeException("Connection type " + conn.getType() + " is not supported"); } }
Source:
<code>public SetViewportSizeOf(String fboName) { this.fboName = fboName; if (!fboName.equals(DEFAULT_FBO)) { fbo = frameBuffersManager.getFBO(fboName); <START> } <END> }</code><technical_language>this IF block. do need it? store fboName get fbo need it</technical_language>

Target:
public SetViewportSizeOf(String fboName) { this.fboName = fboName; }
Source:
<code>public boolean isForceTextMessageFormat() { if (!cryptoEnablePgpInline) { return false; <START> } <END> ComposeCryptoStatus cryptoStatus = getCurrentCryptoStatus(); return cryptoStatus.isEncryptionEnabled() || cryptoStatus.isSigningEnabled(); }</code><technical_language>This is a bit double negativey if (cryptoEnablePgpInline) { ComposeCryptoStatus .... } else { return false; } more readable</technical_language>

Target:
public boolean isForceTextMessageFormat() { if (cryptoEnablePgpInline) { ComposeCryptoStatus cryptoStatus = getCurrentCryptoStatus(); return cryptoStatus.isEncryptionEnabled() || cryptoStatus.isSigningEnabled(); } else { return false; } }
Source:
<code><START> public CacheOperationsTest cacheMode(CacheMode cacheMode) { <END> this.cacheMode = cacheMode; return this; }</code><technical_language>wrong return type in cacheMode(), transactional() lockingMode() methods</technical_language>

Target:
public AbstractTwoSitesTest cacheMode(CacheMode cacheMode) { this.cacheMode = cacheMode; return this; }
Source:
<code>public <K, V> CompletionStage<MarshallableEntry<K, V>> loadFromAllStores(Object key, int segment, boolean localInvocation, boolean includeStores) { return Maybe.using( this::acquireReadLock, ignore -> { checkStoreAvailability(); if (trace) { log.tracef("Loading entry for key %s with segment %d", key, segment); } return Flowable.fromIterable(stores.entrySet()) .filter(entry -> <START> !entry.getValue().characteristics.contains(Characteristic.WRITE_ONLY) <END> && allowLoad(entry.getValue(), localInvocation, includeStores)) .concatMapMaybe(entry -> Maybe.fromCompletionStage( PersistenceManagerImpl.<K, V>storeForEntry(entry).load(segment, key)), 1) .firstElement(); }, this::releaseReadLock ).toCompletionStage(null); }</code><technical_language>WRITE_ONLY check part of allowLoad method</technical_language>

Target:
public <K, V> CompletionStage<MarshallableEntry<K, V>> loadFromAllStores(Object key, int segment, boolean localInvocation, boolean includeStores) { return Maybe.using( this::acquireReadLock, ignore -> { checkStoreAvailability(); if (trace) { log.tracef("Loading entry for key %s with segment %d", key, segment); } return Flowable.fromIterable(stores) .filter(storeStatus -> allowLoad(storeStatus, localInvocation, includeStores)) .concatMapMaybe(storeStatus -> Maybe.fromCompletionStage( storeStatus.<K, V>store().load(segment, key)), 1) .firstElement(); }, this::releaseReadLock ).toCompletionStage(null); }
Source:
<code>public void memo() throws IOException { final String memo = "<memo></memo>"; final AttributeValue value = Mockito.mock(AttributeValue.class); final Item item = Mockito.mock(Item.class); Mockito.when(value.getS()).thenReturn(memo); Mockito.when(item.get(DyRepo.ATTR_MEMO)).thenReturn(value); MatcherAssert.assertThat( <START> new DyRepo(item).memo(), <END> Matchers.instanceOf(DyMemo.class) ); }</code><technical_language>Qulice complain this indentation</technical_language>

Target:
public void memo() throws IOException { final Region region = new MkRegion( new H2Data().with( DyRepo.TBL, new String[] {DyRepo.ATTR_MEMO}, new String[] {DyRepo.ATTR_UPDATED} ) ); final Table table = region.table(DyRepo.TBL); table.put( new Attributes() .with(DyRepo.ATTR_MEMO, "<memo></memo>") .with(DyRepo.ATTR_UPDATED, System.currentTimeMillis()) ); MatcherAssert.assertThat( new DyRepo(table.frame().iterator().next()).memo(), Matchers.instanceOf(DyMemo.class) ); }
Source:
<code>private void configureMemoryPools(NodeMemoryConfig config, long availableMemory) { validateHeapHeadroom(config, availableMemory); maxMemory = new DataSize(availableMemory - config.getHeapHeadroom().toBytes(), BYTE); checkArgument( config.getMaxQueryMemoryPerNode().toBytes() <= config.getMaxQueryTotalMemoryPerNode().toBytes(), "Max query memory per node (%s) cannot be greater than the max query total memory per node (%s).", QUERY_MAX_MEMORY_PER_NODE_CONFIG, QUERY_MAX_TOTAL_MEMORY_PER_NODE_CONFIG); ImmutableMap.Builder<MemoryPoolId, MemoryPool> builder = ImmutableMap.builder(); long generalPoolSize = maxMemory.toBytes(); <START> if (config.isLegacyReservedPoolEnabled()) { <END> builder.put(RESERVED_POOL, new MemoryPool(RESERVED_POOL, config.getMaxQueryTotalMemoryPerNode())); generalPoolSize -= config.getMaxQueryTotalMemoryPerNode().toBytes(); } verify(generalPoolSize > 0, "general memory pool size is 0"); builder.put(GENERAL_POOL, new MemoryPool(GENERAL_POOL, new DataSize(generalPoolSize, BYTE))); this.pools = builder.build(); }</code><technical_language>want remove legacy this name also</technical_language>

Target:
private void configureMemoryPools(NodeMemoryConfig config, long availableMemory) { validateHeapHeadroom(config, availableMemory); maxMemory = new DataSize(availableMemory - config.getHeapHeadroom().toBytes(), BYTE); checkArgument( config.getMaxQueryMemoryPerNode().toBytes() <= config.getMaxQueryTotalMemoryPerNode().toBytes(), "Max query memory per node (%s) cannot be greater than the max query total memory per node (%s).", QUERY_MAX_MEMORY_PER_NODE_CONFIG, QUERY_MAX_TOTAL_MEMORY_PER_NODE_CONFIG); ImmutableMap.Builder<MemoryPoolId, MemoryPool> builder = ImmutableMap.builder(); long generalPoolSize = maxMemory.toBytes(); if (config.isReservedPoolEnabled()) { builder.put(RESERVED_POOL, new MemoryPool(RESERVED_POOL, config.getMaxQueryTotalMemoryPerNode())); generalPoolSize -= config.getMaxQueryTotalMemoryPerNode().toBytes(); } verify(generalPoolSize > 0, "general memory pool size is 0"); builder.put(GENERAL_POOL, new MemoryPool(GENERAL_POOL, new DataSize(generalPoolSize, BYTE))); this.pools = builder.build(); }
Source:
<code>public synchronized void close() { <START> clearCache(); <END> if (instance != null) { instance.usageCount -= 1; if (instance.usageCount <= 0 && instance.isOpen()) { instance.usageCount = 0; instance.closeStatements(); try { instance.connection.close(); } catch (SQLException ex) { LOGGER.error("There was an error attempting to close the CveDB, see the log for more details."); LOGGER.debug("", ex); } catch (Throwable ex) { LOGGER.error("There was an exception attempting to close the CveDB, see the log for more details."); LOGGER.debug("", ex); } instance.statementBundle = null; instance.preparedStatements.clear(); instance.databaseProperties = null; instance.connection = null; } } }</code><technical_language>For performance reasons, if this clearCache() moved 5 lines next instance.usageCount = 0;. 'close()' called multiple threads - another thread need get vulnerabilities</technical_language>

Target:
public synchronized void close() { if (instance != null) { instance.usageCount -= 1; if (instance.usageCount <= 0 && instance.isOpen()) { instance.usageCount = 0; clearCache(); instance.closeStatements(); try { instance.connection.close(); } catch (SQLException ex) { LOGGER.error("There was an error attempting to close the CveDB, see the log for more details."); LOGGER.debug("", ex); } catch (Throwable ex) { LOGGER.error("There was an exception attempting to close the CveDB, see the log for more details."); LOGGER.debug("", ex); } instance.statementBundle = null; instance.preparedStatements.clear(); instance.databaseProperties = null; instance.connection = null; } } }
Source:
<code>public void addQqxUselang() { String url = getCurrentUrl(); <START> getUrl(url + ggx); <END> }</code><technical_language>is appendToUrl method</technical_language>

Target:
public void addQqxUselang() { appendToUrl(URLsContent.translatableLanguage); }
Source:
<code>protected CommandStatus executeTransfer(Connection connection, String source, String destination, int permissions, int transferType) { ChannelSftp channel = null; try { channel = (ChannelSftp) connection.getChannel(); if (transferType == 1) { channel.put(source, destination); } else if (transferType == 2) { channel.get(source, destination); } else if (transferType == 3) { transferRemoteToRemote(connection, source, destination); } else { logger.info("Unknown handle type..."); status = CommandStatus.FAILED; return status; } if (permissions != -999) channel.chmod(permissions, destination); <START> <END> } catch (JSchException | SftpException e) { logger.error("Failed to connect or obtain file to/from remote host. Returning failed."); status = CommandStatus.FAILED; return status; } status = CommandStatus.SUCCESS; return status; }</code><technical_language>This is a situation I java logger.error(e.printStackTrace()); java logger.catching(e);</technical_language>

Target:
protected CommandStatus executeTransfer(Connection connection, String source, String destination, int permissions, int transferType) { ChannelSftp channel = null; try { channel = connection.getSftpChannel(); if (transferType == 1) { channel.put(source, destination); } else if (transferType == 2) { channel.get(source, destination); } else if (transferType == 3) { transferRemoteToRemote(connection, source, destination); } else { logger.info("Unknown handle type..."); status = CommandStatus.FAILED; return status; } if (permissions != -999) channel.chmod(permissions, destination); } catch (JSchException | SftpException e) { logger.error("Failed to connect or obtain file to/from remote host. Returning failed.", e); status = CommandStatus.FAILED; return status; } status = CommandStatus.SUCCESS; return status; }
Source:
<code>public void createPartControl(Composite parent) { super.createPartControl(parent); pinPropertySheetAction.addPropertyChangeListener(new IPropertyChangeListener(){ @Override public void propertyChange(PropertyChangeEvent event) { if (IAction.CHECKED.equals(event.getProperty())) { updateContentDescription(); } } }); IMenuManager menuManager = getViewSite().getActionBars() .getMenuManager(); menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); menuManager.add(pinPropertySheetAction); IToolBarManager toolBarManager = getViewSite().getActionBars() .getToolBarManager(); menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); toolBarManager.add(pinPropertySheetAction); SaveablesList saveables = <START> (SaveablesList) getSite().getService(ISaveablesLifecycleListener.class); <END> if (saveables != null) { saveables.addModelLifecycleListener(saveablesTracker); } getSite().getPage().getWorkbenchWindow().getWorkbench().getHelpSystem() .setHelp(getPageBook(), IPropertiesHelpContextIds.PROPERTY_SHEET_VIEW); }</code><technical_language>cast operation? asking for a service interface cast a concrete implementation instanceof check. perform check in tracker is added a SaveablesList</technical_language>

Target:
public void createPartControl(Composite parent) { super.createPartControl(parent); pinPropertySheetAction.addPropertyChangeListener(new IPropertyChangeListener(){ @Override public void propertyChange(PropertyChangeEvent event) { if (IAction.CHECKED.equals(event.getProperty())) { updateContentDescription(); } } }); IMenuManager menuManager = getViewSite().getActionBars() .getMenuManager(); menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); menuManager.add(pinPropertySheetAction); IToolBarManager toolBarManager = getViewSite().getActionBars() .getToolBarManager(); menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); toolBarManager.add(pinPropertySheetAction); ISaveablesLifecycleListener saveables = getSite().getService(ISaveablesLifecycleListener.class); if (saveables instanceof SaveablesList) { ((SaveablesList) saveables).addModelLifecycleListener(saveablesTracker); } getSite().getPage().getWorkbenchWindow().getWorkbench().getHelpSystem() .setHelp(getPageBook(), IPropertiesHelpContextIds.PROPERTY_SHEET_VIEW); }
Source:
<code>public static TypeName fromString(String typeName) { TypeName result = ANY_TYPENAME; if <START> (typeName != null) { <END> if ("ecore.EJavaObject".equals(typeName) || "EJavaObject".equals(typeName)) { result = ANY_TYPENAME; } else if ("ecore.EObject".equals(typeName) || "EObject".equals(typeName)) { result = EOBJECT_TYPENAME; } else { result = new TypeName(typeName.trim()); } } return result; }</code><technical_language>!StringUtil.isEmtpy(typeName) a choice</technical_language>

Target:
public static TypeName fromString(String typeName) { TypeName result = ANY_TYPENAME; if (!StringUtil.isEmpty(typeName)) { if ("ecore.EJavaObject".equals(typeName) || "EJavaObject".equals(typeName)) { result = ANY_TYPENAME; } else if ("ecore.EObject".equals(typeName) || "EObject".equals(typeName)) { result = EOBJECT_TYPENAME; } else { result = new TypeName(typeName.trim()); } } return result; }
Source:
<code>AbstractAccessor(T element) { this.element = element; <START> if (element.getEnclosingElement().getKind() == ElementKind.CLASS) { <END> Element enclosingClass = element.getEnclosingElement(); boolean isBuilder = enclosingClass.getEnclosingElement().getKind() == ElementKind.CLASS && MappedByBuilderPrism.getInstanceOn( enclosingClass.getEnclosingElement() ) != null; this.builderType = isBuilder ? enclosingClass.asType() : null; } else { this.builderType = null; } }</code><technical_language>This means build interfaces builders right</technical_language>

Target:
AbstractAccessor(T element ) { this( element, false ); }
Source:
<code>public String toString() { return "SocketInfo {Type:" + ipTypeToString(mIpFamily) + ", " + mTcpInfo + <START> " mark:" <END> + mMark + " updated at " + updateTime + "}"; }</code><technical_language>nit: l.403, want comma seperate fields. So, lost a comma here, do want unify format</technical_language>

Target:
public String toString() { return "SocketInfo {Type:" + ipTypeToString(iIpFamily) + ", " + iTcpInfo + ", mark:" + iMark + " updated at " + iUpdateTime + "}"; }
Source:
<code>public void VideosModuleTest_001() { <START> wikiURL = urlBuilder.getUrlForWiki(URLsContent.videoTestWiki); <END> WikiBasePageObject base = new WikiBasePageObject(driver); VideosModuleComponentObject videosModule = new VideosModuleComponentObject(driver); base.openRandomArticle(wikiURL); videosModule.verifyVideosModuleShowing(); base.openFilePage(wikiURL, VideoContent.youtubeVideoURL2Filename); videosModule.verifyVideosModuleShowing(); }</code><technical_language>I guess need put "String" this variable, cuz assigned? I put "String" in front of I I noticed else done that. I donno, this updating a global variable mess in tests? guessing here</technical_language>

Target:
public void VideosModuleTest_001() { wikiURL = urlBuilder.getUrlForWiki(URLsContent.videoTestWiki); WikiBasePageObject base = new WikiBasePageObject(driver); VideosModuleComponentObject videosModule = new VideosModuleComponentObject(driver); base.openRandomArticle(wikiURL); videosModule.verifyVideosModuleShowing(); base.openFilePage(wikiURL, VideoContent.youtubeVideoURL2FileName); videosModule.verifyVideosModuleShowing(); }
Source:
<code>public void actionPerformed(final ActionEvent e) { final MapController mapController = Controller.getCurrentModeController().getMapController(); final ViewerController vc = Controller.getCurrentController().getModeController() .getExtension(ViewerController.class); final NodeModel selectedNode = mapController.getSelectedNode(); if (selectedNode == null) { return; } final Controller controller = Controller.getCurrentController(); final MapStyle mapStyle = controller.getModeController().getExtension(MapStyle.class); final MapModel model = controller.getMap(); <START> final ExternalResource extRes = (ExternalResource) vc.createExtension(selectedNode); <END> if (extRes == null) { return; } else { final URI absoluteUri = extRes.getAbsoluteUri(selectedNode.getMap()); mapStyle.setProperty(model, MapStyle.RESOURCES_BACKGROUND_IMAGE, absoluteUri.toString()); } }</code><technical_language>I vc.createExtension is. I refactor this method, separate a returns URI rest call extracted method need URI, extension object</technical_language>

Target:
public void actionPerformed(final ActionEvent e) { final Controller controller = Controller.getCurrentController(); final MapController mapController = Controller.getCurrentModeController().getMapController(); final ViewerController vc = controller.getModeController().getExtension(ViewerController.class); final NodeModel selectedNode = mapController.getSelectedNode(); if (selectedNode == null) { return; } final MapStyle mapStyle = controller.getModeController().getExtension(MapStyle.class); final URI uri = vc.createURI(selectedNode); if (uri == null) { return; } final MapModel model = controller.getMap(); mapStyle.setProperty(model, MapStyle.RESOURCES_BACKGROUND_IMAGE, uri.toString()); }
Source:
<code>public void prepareMockGitHub() throws Exception { new File("src/test/resources/api/mappings").mkdirs(); new File("src/test/resources/api/__files").mkdirs(); new File("src/test/resources/raw/mappings").mkdirs(); new File("src/test/resources/raw/__files").mkdirs(); githubApi.enableRecordMappings(new SingleRootFileSource("src/test/resources/api/mappings"), new SingleRootFileSource("src/test/resources/api/__files")); githubRaw.enableRecordMappings(new SingleRootFileSource("src/test/resources/raw/mappings"), new SingleRootFileSource("src/test/resources/raw/__files")); githubApi.stubFor( get(urlMatching(".*")).atPriority(10).willReturn(aResponse().proxiedFrom("<LINK_0>"))); githubRaw.stubFor(get(urlMatching(".*")).atPriority(10) .willReturn(aResponse().proxiedFrom("<LINK_1>"))); <START> if (source.isConfiguredByUrl()) { <END> source = new GitHubSCMSource("cloudbeers", "yolo", "http://localhost:" + githubApi.port() + "/cloudbeers/yolo", true); } else { source.setApiUri("http://localhost:" + githubApi.port()); } source.setTraits(Arrays.asList(new BranchDiscoveryTrait(true, true), new ForkPullRequestDiscoveryTrait(EnumSet.of(ChangeRequestCheckoutStrategy.MERGE), new ForkPullRequestDiscoveryTrait.TrustContributors()))); github = Connector.connect("http://localhost:" + githubApi.port(), null); repo = github.getRepository("cloudbeers/yolo"); }</code><technical_language>Remove</technical_language>

Target:
public void prepareMockGitHub() throws Exception { new File("src/test/resources/api/mappings").mkdirs(); new File("src/test/resources/api/__files").mkdirs(); new File("src/test/resources/raw/mappings").mkdirs(); new File("src/test/resources/raw/__files").mkdirs(); githubApi.enableRecordMappings(new SingleRootFileSource("src/test/resources/api/mappings"), new SingleRootFileSource("src/test/resources/api/__files")); githubRaw.enableRecordMappings(new SingleRootFileSource("src/test/resources/raw/mappings"), new SingleRootFileSource("src/test/resources/raw/__files")); githubApi.stubFor( get(urlMatching(".*")).atPriority(10).willReturn(aResponse().proxiedFrom("<LINK_0>"))); githubRaw.stubFor(get(urlMatching(".*")).atPriority(10) .willReturn(aResponse().proxiedFrom("<LINK_1>"))); source.setApiUri("http://localhost:" + githubApi.port()); source.setTraits(Arrays.asList(new BranchDiscoveryTrait(true, true), new ForkPullRequestDiscoveryTrait(EnumSet.of(ChangeRequestCheckoutStrategy.MERGE), new ForkPullRequestDiscoveryTrait.TrustContributors()))); github = Connector.connect("http://localhost:" + githubApi.port(), null); repo = github.getRepository("cloudbeers/yolo"); }
Source:
<code>public boolean hasNext() { if (bufferedRecord != null) { return true; } try { readNextRecord(bufferedReader); } catch (IOException e) { <START> LOG.error("Exception from BufferedReader:", e); <END> return false; } return bufferedRecord != null; }</code><technical_language>update index counter</technical_language>

Target:
public boolean hasNext() { if (bufferedRecord != null) { return true; } try { readNextRecord(bufferedReader); } catch (IOException | RuntimeException e) { LOG.error("Exception from BufferedReader:", e); return false; } return bufferedRecord != null; }
Source:
<code>private void evaluateConstantFilterFunction(FilterFunction filter, Block[] constantBlocks, QualifyingSet qualifyingSet) { int[] channels = filter.getInputChannels(); Block[] inputs = new Block[channels.length]; for (int i = 0; i < channels.length; i++) { inputs[i] = constantBlocks[channels[i]]; } <START> int[] filterResults = new int[qualifyingSet.getPositionCount()]; <END> PageSourceOptions.ErrorSet errors = qualifyingSet.getOrCreateErrorSet(); int numHits = filter.filter(new Page(qualifyingSet.getPositionCount(), inputs), filterResults, errors); qualifyingSet.compactPositionsAndErrors(filterResults, numHits); }</code><technical_language>static</technical_language>

Target:
private static void evaluateConstantFilterFunction(FilterFunction filter, Block[] constantBlocks, QualifyingSet qualifyingSet) { int[] channels = filter.getInputChannels(); Block[] inputs = new Block[channels.length]; for (int i = 0; i < channels.length; i++) { inputs[i] = constantBlocks[channels[i]]; } int[] filterResults = new int[qualifyingSet.getPositionCount()]; PageSourceOptions.ErrorSet errors = qualifyingSet.getOrCreateErrorSet(); int numHits = filter.filter(new Page(qualifyingSet.getPositionCount(), inputs), filterResults, errors); qualifyingSet.compactPositionsAndErrors(filterResults, numHits); }
Source:
<code>public synchronized void inputChanged(Viewer viewer, Object oldInput, Object newInput) { <START> if (oldInput != newInput) { <END> if (newInput != null) { ImportTraceContentProvider input = (ImportTraceContentProvider) newInput; clearCandidates(); fTraceTypes.putAll(input.fTraceTypes); fTraceFiles.putAll(fTraceFiles); } } }</code><technical_language>join ifs. a content assist for that, awesome</technical_language>

Target:
public synchronized void inputChanged(Viewer viewer, Object oldInput, Object newInput) { if (oldInput != newInput && newInput != null) { ImportTraceContentProvider input = (ImportTraceContentProvider) newInput; clearCandidates(); fTraceTypes.putAll(input.fTraceTypes); fTraceFiles.putAll(fTraceFiles); } }
Source:
<code>public Version() { major = minor = build = revision = <START> -1; <END> }</code><technical_language>new constant here</technical_language>

Target:
public Version() { major = minor = build = revision = VERSION_NOT_SET; }
Source:
<code>public void fanoutBinding() { FanoutExchange fanoutExchange = new FanoutExchange("f"); Binding binding = BindingBuilder.bind(queue).to(fanoutExchange); assertEquals(fanoutExchange.getName(), binding.getExchange()); assertEquals("", binding.getRoutingKey()); assertEquals(Binding.DestinationType.QUEUE, binding.getDestinationType()); assertEquals(queue.getName(), binding.getDestination()); <START> assertNotNull(binding); <END> }</code><technical_language>Thank for fast turnaround @neetkee ! Well, this assertNotNull() way. end NPE a binding.getExchange(). Please, fix name @author list update for Copyright current year - 2002-2017. merge it</technical_language>

Target:
public void fanoutBinding() { FanoutExchange fanoutExchange = new FanoutExchange("f"); Binding binding = BindingBuilder.bind(queue).to(fanoutExchange); assertNotNull(binding); assertEquals(fanoutExchange.getName(), binding.getExchange()); assertEquals("", binding.getRoutingKey()); assertEquals(Binding.DestinationType.QUEUE, binding.getDestinationType()); assertEquals(queue.getName(), binding.getDestination()); }
Source:
<code>public void apply(ExtensionLoadingContext extensionLoadingContext) { ExtensionDeclarer extensionDeclarer = extensionLoadingContext.getExtensionDeclarer(); <START> this.typeCatalog = extensionLoadingContext.getDslResolvingContext().getTypeCatalog(); <END> this.typeLoader = new DefaultExtensionsTypeLoaderFactory().createTypeLoader(extensionLoadingContext.getExtensionClassLoader()); ExtensionDeclaration declaration = extensionLoadingContext.getExtensionDeclarer().getDeclaration(); this.namespace = getStereotypePrefix(extensionDeclarer); this.processorParent = newStereotype(PROCESSOR.getType(), namespace).withParent(PROCESSOR).build(); this.sourceParent = newStereotype(SOURCE.getType(), namespace).withParent(SOURCE).build(); IdempotentDeclarationWalker enricher = declaration.getModelProperty(ImplementingTypeModelProperty.class).isPresent() ? getJavaBasedStereotypeEnricher() : getDefaultStereotypeEnricher(); enricher.walk(declaration); resolveDeclaredTypesStereotypes(declaration, namespace); }</code><technical_language>is this used</technical_language>

Target:
public void apply(ExtensionLoadingContext extensionLoadingContext) { ExtensionDeclarer extensionDeclarer = extensionLoadingContext.getExtensionDeclarer(); this.typeLoader = new DefaultExtensionsTypeLoaderFactory().createTypeLoader(extensionLoadingContext.getExtensionClassLoader()); ExtensionDeclaration declaration = extensionLoadingContext.getExtensionDeclarer().getDeclaration(); this.namespace = getStereotypePrefix(extensionDeclarer); this.processorParent = newStereotype(PROCESSOR.getType(), namespace).withParent(PROCESSOR).build(); this.sourceParent = newStereotype(SOURCE.getType(), namespace).withParent(SOURCE).build(); IdempotentDeclarationWalker enricher = declaration.getModelProperty(ImplementingTypeModelProperty.class).isPresent() ? getJavaBasedStereotypeEnricher() : getDefaultStereotypeEnricher(); enricher.walk(declaration); resolveDeclaredTypesStereotypes(declaration, namespace); }
Source:
<code>void testSubList(int subListDepth, int filterDepth, int sortDepth) { <START> if (!(test instanceof ReplicaCollection.Builder<?>)) <END> Assert.assertSame(test, test.subList(0, test.size())); if (test.isEmpty()) return; TestCase<C> skipFront = new TestCase<>(test.subList(1, test.size()), canonicalList.subList(1, canonicalList.size())); assertSubList(skipFront.test, 1, canonicalList.size()); skipFront.testAll(subListDepth - 1, filterDepth, sortDepth); TestCase<C> skipBack = new TestCase<>(test.subList(0, test.size() - 1), canonicalList.subList(0, canonicalList.size() - 1)); assertSubList(skipBack.test, 0, canonicalList.size() - 1); skipBack.testAll(subListDepth - 1, filterDepth, sortDepth); }</code><technical_language>isBuilder?.</technical_language>

Target:
void testSubList(int subListDepth, int filterDepth, int sortDepth) { if (!isBuilder) Assert.assertSame(test, test.subList(0, test.size())); if (test.isEmpty()) return; Assert.assertSame(test.list.contents, test.subList(0, 1).list.contents); TestCase<C> skipFront = new TestCase<>(false, test.subList(1, test.size()), canonicalList.subList(1, canonicalList.size())); assertSubList(skipFront.test, 1, canonicalList.size()); skipFront.testAll(subListDepth - 1, filterDepth, sortDepth); TestCase<C> skipBack = new TestCase<>(false, test.subList(0, test.size() - 1), canonicalList.subList(0, canonicalList.size() - 1)); assertSubList(skipBack.test, 0, canonicalList.size() - 1); skipBack.testAll(subListDepth - 1, filterDepth, sortDepth); }
Source:
<code><START> public void replaceNote(Note newNote) { <END> int position = getPositionForNoteUnfiltered(newNote.getId()); mNotes.set(position, newNote); }</code><technical_language>a check for null in this method</technical_language>

Target:
public void replaceNote(Note newNote) { if (newNote != null) { int position = getPositionForNoteUnfiltered(newNote.getId()); if (position != RecyclerView.NO_POSITION && position < mNotes.size()) { mNotes.set(position, newNote); } } }
Source:
<code>public void testFilteredChanges() throws Exception { Repository repo = repoProvider.createGeogig("repo1", null); repoProvider.getTestRepository("repo1").initializeRpository(); new TestData(repo).init("testGeoGig", "geogig@geogig.org").loadDefaultData(); Optional<RevObject> masterRevObject = repo.command(RevObjectParse.class) .setRefSpec("master").call(); String commitId = masterRevObject.get().getId().toString(); JsonObject json = new JsonObject(); json.addProperty("commitId", commitId); MockHttpServletRequestBuilder post = MockMvcRequestBuilders.post("/repos/repo1/repo/filteredchanges").contentType( MediaType.APPLICATION_JSON).content(getBytes(json)); perform(post).andExpect(status().isOk()) <START> .andExpect(content().contentType(MediaType.APPLICATION_OCTET_STREAM)); <END> }</code><technical_language>this response read verified</technical_language>

Target:
public void testFilteredChanges() throws Exception { Repository repo = repoProvider.createGeogig("repo1", null); repoProvider.getTestRepository("repo1").initializeRpository(); new TestData(repo).init("testGeoGig", "geogig@geogig.org").loadDefaultData(); Optional<RevObject> masterRevObject = repo.command(RevObjectParse.class) .setRefSpec("master").call(); String commitId = masterRevObject.get().getId().toString(); JsonObject json = new JsonObject(); json.addProperty("commitId", commitId); MockHttpServletRequestBuilder post = MockMvcRequestBuilders.post("/repos/repo1/repo/filteredchanges").contentType( MediaType.APPLICATION_JSON).content(getBytes(json)); byte[] content = perform(post).andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_OCTET_STREAM)) .andReturn().getResponse().getContentAsByteArray(); FilteredChangesReader reader = new FilteredChangesReader(content, DataStreamSerializationFactoryV1.INSTANCE); while (reader.hasNext()) { DiffPacket diff = reader.next(); assertNotNull(diff.revObject); assertNotNull(diff.metadataObject); assertNotNull(diff.diffEntry); } assertFalse(reader.isFiltered()); repo.close(); }
Source:
<code>private DruidExpression handleFunction( CallExpression function, Map<VariableReferenceExpression, DruidQueryGeneratorContext.Selection> context) { <START> switch (function.getDisplayName().toLowerCase(ENGLISH)) { <END> case "date_trunc": return handleDateTruncationViaDateTruncation(function, context); default: throw new PrestoException(DRUID_PUSHDOWN_UNSUPPORTED_EXPRESSION, "Unsupported function: " + function.getDisplayName() + " to pushdown for Druid connector "); } }</code><technical_language>if</technical_language>

Target:
private DruidExpression handleFunction( CallExpression function, Map<VariableReferenceExpression, DruidQueryGeneratorContext.Selection> context) { if (function.getDisplayName().toLowerCase(ENGLISH).equals(DATE_TRUNC)) { return handleDateTruncationViaDateTruncation(function, context); } throw new PrestoException(DRUID_PUSHDOWN_UNSUPPORTED_EXPRESSION, "Unsupported function: " + function.getDisplayName() + " to pushdown for Druid connector."); }
Source:
<code>public void queryOneNonExistedObjectObservable() { putUsersBlocking(3); final Observable<User> userObservable = storIOSQLite .get() .object(User.class) .withQuery(Query.builder() .table(UserTableMeta.TABLE) .where(UserTableMeta.COLUMN_EMAIL + "=?") .whereArgs("some arg") .build()) .prepare() .createObservable(); TestSubscriber<User> testSubscriber = new TestSubscriber<User>(); userObservable.subscribe(testSubscriber); <START> testSubscriber.awaitTerminalEvent(500, MILLISECONDS); <END> testSubscriber.assertValueCount(1); testSubscriber.assertValue(null); testSubscriber.assertNoErrors(); testSubscriber.unsubscribe(); }</code><technical_language>needed</technical_language>

Target:
public void queryOneNonExistedObjectObservable() { putUsersBlocking(3); final Observable<User> userObservable = storIOSQLite .get() .object(User.class) .withQuery(Query.builder() .table(UserTableMeta.TABLE) .where(UserTableMeta.COLUMN_EMAIL + "=?") .whereArgs("some arg") .build()) .prepare() .createObservable() .take(1); TestSubscriber<User> testSubscriber = new TestSubscriber<User>(); userObservable.subscribe(testSubscriber); testSubscriber.awaitTerminalEvent(5, SECONDS); testSubscriber.assertValue(null); testSubscriber.assertNoErrors(); testSubscriber.unsubscribe(); }
Source:
<code>public void emitTuples() { <START> <END> output.emit(jsonSample); }</code><technical_language>Remove space</technical_language>

Target:
public void emitTuples() { output.emit(jsonSample.getBytes()); }
Source:
<code>public void finish() { finished = true; blocked.set(null); if (source != null) { <START> recordSourceRawInputStats(); <END> try { source.close(); } catch (IOException e) { throw new UncheckedIOException(e); } systemMemoryContext.setBytes(source.getSystemMemoryUsage()); } }</code><technical_language>@pettyjamesm is this call needed</technical_language>

Target:
public void finish() { finished = true; blocked.set(null); if (source != null) { try { source.close(); } catch (IOException e) { throw new UncheckedIOException(e); } systemMemoryContext.setBytes(source.getSystemMemoryUsage()); } }
Source:
<code>void updateErrors(JSONObject nodeRoot) { synchronized (errorMap) { try { removeAllErrors(); JSONArray sPoints = nodeRoot.getJSONArray("values"); for (int i = 0; i < sPoints.length(); i++) { JSONObject subJSON = sPoints.getJSONObject(i); HashMap<String, String> valMap = new HashMap<String, String>(); Map<String, Object> oMap = subJSON.toMap(); for (String para : oMap.keySet()) { <START> logger.debug("Set: val: {}", para, oMap.get(para).toString()); <END> valMap.put(para, oMap.get(para).toString()); } errorMap.add(valMap); } } catch (Exception e) { logger.error("Error in parsing of the errorlist: {}", e.getMessage()); e.printStackTrace(); } } }</code><technical_language>toString() is needed here</technical_language>

Target:
void updateErrors(JSONObject nodeRoot) { synchronized (errorMap) { try { removeAllErrors(); JSONArray sPoints = nodeRoot.getJSONArray("values"); for (int i = 0; i < sPoints.length(); i++) { JSONObject subJSON = sPoints.getJSONObject(i); HashMap<String, String> valMap = new HashMap<String, String>(); Map<String, Object> oMap = subJSON.toMap(); for (String para : oMap.keySet()) { logger.debug("Set: val: {}", para, oMap.get(para)); valMap.put(para, oMap.get(para).toString()); } errorMap.add(valMap); } } catch (Exception e) { logger.error("Error in parsing of the errorlist: {}", e.getMessage()); e.printStackTrace(); } } }
Source:
<code><START> public static ChatColor getColor(char colorChar) { <END> return charToColor.get(colorChar); }</code><technical_language>Please throw exception returning if chat color is found</technical_language>

Target:
public static ChatColor getColor(char colorChar) { ChatColor c = charToColor.get(colorChar); if (c == null) throw new IllegalArgumentException("no color with character " + colorChar); return c; }
Source:
<code>public CompletableFuture<Void> hideMapVersion(MapBean map) { String id = map.getId(); MapVersion mapVersion = new MapVersion(); mapVersion.setHidden(true); mapVersion.setId(map.getId()); fafApiAccessor.updateMapVersion(id, mapVersion); <START> return null; <END> }</code><technical_language>This needs return a completable future, null</technical_language>

Target:
public CompletableFuture<Void> hideMapVersion(MapBean map) { String id = map.getId(); MapVersion mapVersion = new MapVersion(); mapVersion.setHidden(true); mapVersion.setId(map.getId()); fafApiAccessor.updateMapVersion(id, mapVersion); return CompletableFuture.completedFuture(null); }
Source:
<code>public Stddev(String fieldName, Schema fieldSchema) { this.fieldName = fieldName; boolean isNullable = fieldSchema.isNullable(); Schema.Type fieldType = isNullable ? fieldSchema.getNonNullable().getType() : fieldSchema.getType(); <START> if (!(fieldType == Schema.Type.INT || fieldType == Schema.Type.LONG || <END> fieldType == Schema.Type.FLOAT || fieldType == Schema.Type.DOUBLE)) { throw new IllegalArgumentException(String.format( "Cannot compute avg on field %s because its type %s is not numeric", fieldName, fieldType)); } outputSchema = isNullable ? Schema.nullableOf(Schema.of(Schema.Type.DOUBLE)) : Schema.of(Schema.Type.DOUBLE); }</code><technical_language>This reused check, sense part of type</technical_language>

Target:
public Stddev(String fieldName, Schema fieldSchema) { this.fieldName = fieldName; boolean isNullable = fieldSchema.isNullable(); Schema.Type fieldType = isNullable ? fieldSchema.getNonNullable().getType() : fieldSchema.getType(); if (!AggregationUtils.isNumericType(fieldType)) { throw new IllegalArgumentException(String.format( "Cannot compute standard deviation on field %s because its type %s is not numeric", fieldName, fieldType)); } outputSchema = isNullable ? Schema.nullableOf(Schema.of(Schema.Type.DOUBLE)) : Schema.of(Schema.Type.DOUBLE); }
Source:
<code><START> private void addVolumeToDb(final GlusterVolumeEntity createdVolume) { <END> TransactionSupport.executeInNewTransaction( new TransactionMethod<Void>() { @Override public Void runInTransaction() { createdVolume.setClusterId(getVdsGroupId()); DbFacade.getInstance().getGlusterVolumeDao().save(createdVolume); return null; } }); }</code><technical_language>need explicitly open transaction, save DB, transaction open automaticly</technical_language>

Target:
private void addVolumeToDb(final GlusterVolumeEntity createdVolume) { createdVolume.setClusterId(getVdsGroupId()); DbFacade.getInstance().getGlusterVolumeDao().save(createdVolume); }