auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void createWidgets(final String popupText, final String currentPageLink) { projectsTab = new ProjectsTable() { @Override protected void movePointerTo(final int row, final boolean scroll) { super.movePointerTo(row, scroll); <START> handlerManager.fireEvent(new ProjectListPopupOnMovePointerEvent( <END> popingUp, getRowItem(row).getName())); } @Override protected void onOpenRow(final int row) { super.onOpenRow(row); handlerManager.fireEvent(new ProjectListPopupOnOpenRowEvent(getRowItem( row).getName())); } }; projectsTab.setSavePointerId(currentPageLink); close = new Button(Util.C.projectsClose()); close.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { closePopup(); handlerManager.fireEvent(new ProjectListPopupOnCloseEvent()); } }); popup = new PluginSafeDialogBox(); popup.setModal(false); popup.setText(popupText); }</code><technical_language>I is need fire this event. is listener this event is this ProjectListPopup class itself. instead of firing catching event, immdiately do is done in event handler remove custom handler event for move pointer</technical_language>

Target:
protected void createWidgets(final String popupText, final String currentPageLink) { projectsTab = new ProjectsTable() { @Override protected void movePointerTo(final int row, final boolean scroll) { super.movePointerTo(row, scroll); if (nameBox != null) { nameBox.setText(getRowItem(row).getName()); } } @Override protected void onOpenRow(final int row) { super.onOpenRow(row); handlerManager.fireEvent(new ProjectListPopupOnOpenRowEvent(getRowItem( row).getName())); } }; projectsTab.setSavePointerId(currentPageLink); close = new Button(Util.C.projectsClose()); close.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { closePopup(); } }); popup = new PluginSafeDialogBox(); popup.setModal(false); popup.setText(popupText); }
Source:
<code>public void testEmptyInput() { GroupedTopNBuilder groupedTopNBuilder = new GroupedTopNBuilder( ImmutableList.of(BIGINT), <START> new SimplePageComparator(ImmutableList.of(1), ImmutableList.of(ASC_NULLS_LAST), ImmutableList.of(BIGINT)), <END> 5, ImmutableList.of(), ImmutableList.of(), null); assertFalse(groupedTopNBuilder.buildResult().hasNext()); }</code><technical_language>comparator is invalid due 1.... replace throws UnsupportedOperationException</technical_language>

Target:
public void testEmptyInput() { GroupedTopNBuilder groupedTopNBuilder = new GroupedTopNBuilder( ImmutableList.of(BIGINT), (left, leftPosition, right, rightPosition) -> { throw new UnsupportedOperationException(); }, 5, false, new NoChannelGroupByHash()); assertFalse(groupedTopNBuilder.buildResult().hasNext()); }
Source:
<code>protected InputStream downloadRemoteFile(EncryptedSecret encryptedSecret) { String bucket = encryptedSecret.getParams().get(STORAGE_BUCKET); String objName = encryptedSecret.getParams().get(STORAGE_FILE_URI); ByteArrayOutputStream output = new ByteArrayOutputStream(); log.info("Getting contents of object from bucket {}", objName, bucket); try { applicationDefaultGoogleStorage .objects() .get(bucket, objName) <START> .executeMediaAndDownloadTo(output); <END> } catch (IOException e) { log.info( "Getting object contents of failed. Retrying with no authentication.", objName, e); output = new ByteArrayOutputStream(); try { unauthenticatedGoogleStorage .objects() .get(bucket, objName) .executeMediaAndDownloadTo(output); } catch (IOException otherEx) { throw new SecretException( String.format( "Error reading contents of GCS. Bucket: %s, Object: %s.\nError: %s", bucket, objName, otherEx.toString())); } } return new ByteArrayInputStream(output.toByteArray()); }</code><technical_language>need download this OutputStream convert InputStream. Instead call executeMediaAsInputStream() generate in InputStream return that</technical_language>

Target:
protected InputStream downloadRemoteFile(EncryptedSecret encryptedSecret) { String bucket = encryptedSecret.getParams().get(STORAGE_BUCKET); String objName = encryptedSecret.getParams().get(STORAGE_FILE_URI); log.info("Getting contents of object from bucket {}", objName, bucket); try { return googleStorage.objects().get(bucket, objName).executeMediaAsInputStream(); } catch (IOException e) { throw new SecretException( String.format( "Error reading contents of GCS. Bucket: %s, Object: %s.\nError: %s", bucket, objName, e.toString())); } }
Source:
<code>private boolean isBeingPassedElsewhere(Symbol objectSymbol, Tree element) { if (element.parent().is(Tree.Kind.INITIALIZED_BINDING_ELEMENT)) { <START> return !sameSymbol(objectSymbol, retrieveAssignmentIdentifier(element)); <END> } if (element.parent().is(Tree.Kind.ASSIGNMENT)) { AssignmentExpressionTree assignment = (AssignmentExpressionTree) element.parent(); if (assignment.variable().is(Tree.Kind.IDENTIFIER_REFERENCE)) { IdentifierTree identifier = (IdentifierTree) assignment.variable(); return !sameSymbol(objectSymbol, identifier); } } if (element.parent().is(Tree.Kind.ARGUMENT_LIST)) { return true; } if (element.parent().parent() != null && element.parent().parent().is(Tree.Kind.ARROW_FUNCTION)) { return true; } return false; }</code><technical_language>@inverno return true</technical_language>

Target:
private static boolean isBeingPassedElsewhere(Symbol objectSymbol, Tree element) { if (element.parent().is(Tree.Kind.ASSIGNMENT)) { AssignmentExpressionTree assignment = (AssignmentExpressionTree) element.parent(); if (assignment.variable().is(Tree.Kind.IDENTIFIER_REFERENCE)) { IdentifierTree identifier = (IdentifierTree) assignment.variable(); return !sameSymbol(objectSymbol, identifier); } } return element.parent().is(Tree.Kind.ARGUMENT_LIST, Tree.Kind.INITIALIZED_BINDING_ELEMENT); }
Source:
<code><START> public List<ImplementingTypeDefinition> getImplementationsOf(InterfaceTypeDefinition targetInterface) { <END> List<ImplementingTypeDefinition> objectTypeDefinitions = getTypes(ImplementingTypeDefinition.class); return objectTypeDefinitions.stream().filter(objectTypeDefinition -> { List<Type> implementsList = objectTypeDefinition.getImplements(); for (Type iFace : implementsList) { Optional<InterfaceTypeDefinition> interfaceTypeDef = getType(iFace, InterfaceTypeDefinition.class); if (interfaceTypeDef.isPresent()) { boolean equals = interfaceTypeDef.get().getName().equals(targetInterface.getName()); if (equals) { return true; } } } return false; }).collect(Collectors.toList()); }</code><technical_language>this is a breaking change. consider adding another keeping this for object implementations</technical_language>

Target:
public List<ObjectTypeDefinition> getImplementationsOf(InterfaceTypeDefinition targetInterface) { return this.getAllImplementationsOf(targetInterface) .stream() .filter(typeDefinition -> typeDefinition instanceof ObjectTypeDefinition) .map(typeDefinition -> (ObjectTypeDefinition) typeDefinition) .collect(Collectors.toList()); }
Source:
<code>public Map<String, Object> getHintsOnCluster(Cluster cluster) { Map<String, Object> hintClusterMap = new HashMap<>(); try (KafkaMetadataService kafkaMetadataService = KafkaMetadataService.newInstance(catalogService, cluster.getId())) { KafkaMetadataService.KafkaZkConnection zkConnection = kafkaMetadataService.getKafkaZkConnection(); KafkaMetadataService.Topics topics = kafkaMetadataService.getTopicsFromZk(); String zkUrl = zkConnection.createZkConnString(); <START> hintClusterMap.put(FIELD_NAME_ZK_URL, zkUrl); <END> hintClusterMap.put(FIELD_NAME_TOPICS, topics.getTopics()); } catch (ServiceNotFoundException e) { throw new IllegalStateException("Service " + SERVICE_NAME + " in cluster " + cluster.getName() + " not found but mapping information exists."); } catch (ServiceConfigurationNotFoundException e) { } catch (Exception e) { throw new RuntimeException(e); } return hintClusterMap; }</code><technical_language>add getChRoot for zkPath field for kafka component</technical_language>

Target:
public Map<String, Object> getHintsOnCluster(Cluster cluster) { Map<String, Object> hintClusterMap = new HashMap<>(); try (KafkaMetadataService kafkaMetadataService = KafkaMetadataService.newInstance(environmentService, cluster.getId())) { KafkaMetadataService.KafkaZkConnection zkConnection = kafkaMetadataService.getKafkaZkConnection(); KafkaMetadataService.Topics topics = kafkaMetadataService.getTopicsFromZk(); String zkUrl = zkConnection.createZkConnString(); String brokerPath = DEFAULT_BROKER_ZK_PATH; String zkRoot = zkConnection.getChRoot(); if (StringUtils.isNotEmpty(zkRoot)) { if (zkRoot.endsWith("/")) { brokerPath = zkRoot + brokerPath.substring(1); } else { brokerPath = zkRoot + brokerPath; } } hintClusterMap.put(FIELD_NAME_ZK_URL, zkUrl); hintClusterMap.put(FIELD_NAME_TOPIC, topics.getTopics()); hintClusterMap.put(FIELD_NAME_BROKER_ZK_PATH, brokerPath); fillZookeeperHints(cluster, hintClusterMap); } catch (ServiceNotFoundException e) { throw new IllegalStateException("Service " + SERVICE_NAME + " in cluster " + cluster.getName() + " not found but mapping information exists."); } catch (ServiceConfigurationNotFoundException e) { } catch (Exception e) { throw new RuntimeException(e); } return hintClusterMap; }
Source:
<code>public static void ensureEnvironmentIsSet() throws IOException, ParseException { if (suiteRunning) return; if (initialized) return; try { Field field = ClassLoader.class.getDeclaredField("classes"); field.setAccessible(true); System.out.println("Tests Running Standalone."); System.out.println("Test Classes To Run:"); @SuppressWarnings({ "unchecked", "rawtypes" }) Vector<Class> classes = (Vector<Class>) field.get(BaseTestCase.class.getClassLoader()); for (Class<?> clazz : classes) { if (!clazz.getSimpleName().equals("Test") && clazz.getName().endsWith("Test")) { System.out.println("\t"+clazz.getSimpleName()); System.out.println("\t\tTests:"); for (Method method : clazz.getDeclaredMethods()) { if (method.isAnnotationPresent(Test.class)) { <START> System.out.println("\t\t\t"+method.getName()); <END> } } testClassToRun++; } } } catch (Exception ignore) { } TmdbTestSuite.initializeEnvironment(); }</code><technical_language>This confusing output running a single test method is required anyhow. IDEs Maven show classes methods tested, need duplicate functionality</technical_language>

Target:
public static void ensureEnvironmentIsSet() throws IOException, ParseException, InterruptedException { if (initialized) { return; } initializeEnvironment(); initialized = true; }
Source:
<code>public static boolean awaitInactivity(long timeout, TimeUnit unit) throws InterruptedException { Thread watcherThread = ThreadDeathWatcher.watcherThread; if (watcherThread != null) { watcherThread.join( <START> ObjectUtil.checkNotNull(unit, "unit").toMillis(timeout)); <END> return !watcherThread.isAlive(); } else { return true; } }</code><technical_language>move null check action in method ensure throw if watcherThread == null unit is null</technical_language>

Target:
public static boolean awaitInactivity(long timeout, TimeUnit unit) throws InterruptedException { ObjectUtil.checkNotNull(unit, "unit"); Thread watcherThread = ThreadDeathWatcher.watcherThread; if (watcherThread != null) { watcherThread.join(unit.toMillis(timeout)); return !watcherThread.isAlive(); } else { return true; } }
Source:
<code>protected void addDirectMember(PerunSession sess, Group group, Member member) throws InternalErrorException, AlreadyMemberException, WrongAttributeValueException, WrongReferenceAttributeValueException, GroupNotExistsException, GroupOperationsException { if(this.groupsManagerImpl.isDirectGroupMember(sess, group, member)) throw new AlreadyMemberException(member); member = getGroupsManagerImpl().addMember(sess, group, member, MembershipType.DIRECT, group.getId()); getPerunBl().getAuditer().log(sess, "{} added to {}.", member, group); <START> setRequiredAttributes(sess, member, group); <END> List<Integer> relations = groupsManagerImpl.getGroupRelations(sess, group.getId()); for (Integer groupId : relations) { processRelationMembers(sess, groupsManagerImpl.getGroupById(sess, groupId), Collections.singletonList(member), group.getId(), true); } }</code><technical_language>Please move this line end of this method</technical_language>

Target:
protected void addDirectMember(PerunSession sess, Group group, Member member) throws InternalErrorException, AlreadyMemberException, WrongAttributeValueException, WrongReferenceAttributeValueException, GroupNotExistsException, GroupOperationsException { if(this.groupsManagerImpl.isDirectGroupMember(sess, group, member)) throw new AlreadyMemberException(member); member = getGroupsManagerImpl().addMember(sess, group, member, MembershipType.DIRECT, group.getId()); getPerunBl().getAuditer().log(sess, "{} added to {}.", member, group); List<Integer> relations = groupsManagerImpl.getGroupRelations(sess, group.getId()); for (Integer groupId : relations) { processRelationMembers(sess, groupsManagerImpl.getGroupById(sess, groupId), Collections.singletonList(member), group.getId(), true); } setRequiredAttributes(sess, member, group); }
Source:
<code>protected Object doExecute() throws Exception { printInitCommand("Map Virtual Network Request"); try { VNTRequest vnt = new VNTRequest(); vnt = vnt.readVNTRequestFromXMLFile(requestFileURL); IResource resource = getResourceFromFriendlyName(resourceName); VNMappingCapability capab = (VNMappingCapability) resource.getCapabilityByType(VNMappingCapability.CAPABILITY_TYPE); <START> String resourceId = resource.getResourceIdentifier().getId(); <END> VNMapperOutput capabOutput = capab.mapVN(resourceId, vnt); System.out.println(capabOutput.toString()); } catch (Exception e) { printError("Error mapping with resource " + resourceName); printError(e); } finally { printEndCommand(); } printEndCommand(); return null; }</code><technical_language>This id of vnmapper resource, instead of id of a network resource capability is expecting. If I right, resource arrive capability a network, code throw a CapabilityException("Resource id belong a network resource."). check merging this pull request</technical_language>

Target:
protected Object doExecute() throws Exception { printInitCommand("Map Virtual Network Request"); try { VNTRequest vnt = new VNTRequest(); vnt = vnt.readVNTRequestFromXMLFile(requestFileURL); IResource vnmapperResource = getResourceFromFriendlyName(vnmapperResourceName); VNMappingCapability capab = (VNMappingCapability) vnmapperResource.getCapabilityByType(VNMappingCapability.CAPABILITY_TYPE); IResource networkResource = getResourceFromFriendlyName(networkResourceName); String resourceId = networkResource.getResourceIdentifier().getId(); VNMapperOutput capabOutput = capab.mapVN(resourceId, vnt); System.out.println(capabOutput.toString()); } catch (Exception e) { printError("Error mapping with resource " + vnmapperResourceName); printError(e); } finally { printEndCommand(); } printEndCommand(); return null; }
Source:
<code>private Map<String, Map> mergeMaps(Map<String, Map> configuration, Map<String, Map> servicesConfig) { if (servicesConfig == null) { return configuration; } MutableMap<String, Map> newConfigurationMap = MutableMap.copyOf(configuration); for (Map.Entry<String, Map> stringMapEntry : servicesConfig.entrySet()) { if(!newConfigurationMap.containsKey(stringMapEntry.getKey())) { newConfigurationMap.put(stringMapEntry.getKey(), stringMapEntry.getValue()); } else { if(stringMapEntry.getValue() != null) { <START> newConfigurationMap.putAll(stringMapEntry.getValue()); <END> } } } return newConfigurationMap; }</code><technical_language>if merge newConfigurationMap.get(stringMapEntry.getKey()) stringMapEntry.getValue()</technical_language>

Target:
protected Map<String, Map> mergeMaps(Map<String, Map> configuration, Map<String, Map> servicesConfig) { if (servicesConfig == null) { return configuration; } MutableMap<String, Map> newConfigurationMap = MutableMap.copyOf(configuration); for (Map.Entry<String, Map> stringMapEntry : servicesConfig.entrySet()) { if(!newConfigurationMap.containsKey(stringMapEntry.getKey())) { newConfigurationMap.put(stringMapEntry.getKey(), stringMapEntry.getValue()); } else { if(stringMapEntry.getValue() != null) { MutableMap<String, Map> tmpMap = MutableMap.copyOf(stringMapEntry.getValue()); tmpMap.putAll(newConfigurationMap.get(stringMapEntry.getKey())); newConfigurationMap.put(stringMapEntry.getKey(), ImmutableMap.copyOf(tmpMap)); } } } return newConfigurationMap; }
Source:
<code>protected Builder() { super(ShipyardApi.class); id("shipyard") .name("Shipyard Remote Docker Management API") .identityName("<service-key>") <START> .credentialName(null) <END> .documentation(URI.create("<LINK_0>")) .version("2.0.4") .defaultEndpoint("<LINK_1>") .defaultProperties(ShipyardApiMetadata.defaultProperties()) .view(typeToken(ComputeServiceContext.class)) .defaultModules(ImmutableSet.<Class<? extends Module>>of( OkHttpCommandExecutorServiceModule.class, ShipyardHttpApiModule.class)); }</code><technical_language>This _describe_ credential. If credential is needed, "not used" so, leave this null</technical_language>

Target:
protected Builder() { super(ShipyardApi.class); id("shipyard") .name("Shipyard Remote Docker Management API") .identityName("<shipyard-service-key>") .credentialName("not used") .documentation(URI.create("<LINK_0>")) .version("2.0.4") .defaultEndpoint("<LINK_1>") .defaultProperties(ShipyardApiMetadata.defaultProperties()) .defaultModules(ImmutableSet.<Class<? extends Module>>of( ShipyardHttpApiModule.class)); }
Source:
<code>private static void validateValue(Object value) { Class<?> clazz = value.getClass(); if (simples.contains(clazz)) return; if (simpleArrays.contains(clazz) || primitiveArrays.contains(clazz)) return; if (value instanceof Collection) { Collection<?> valueCollection = (Collection<?>) value; for (Object <START> name : <END> valueCollection) { Class<?> containedClazz = name.getClass(); if (!simples.contains(containedClazz)) { throw new IllegalArgumentException(containedClazz.getName() + " in " + clazz.getName()); } } return; } throw new IllegalArgumentException(clazz.getName()); }</code><technical_language>rename simple</technical_language>

Target:
private static void validateValue(Object value) { Class<?> clazz = value.getClass(); if (simples.contains(clazz)) return; if (simpleArrays.contains(clazz) || primitiveArrays.contains(clazz)) return; if (value instanceof Collection) { for (Object simple : (Collection<?>) value) { Class<?> containedClazz = simple.getClass(); if (!simples.contains(containedClazz)) { throw new IllegalArgumentException(containedClazz.getName() + " in " + clazz.getName()); } } return; } throw new IllegalArgumentException(clazz.getName()); }
Source:
<code>@Override protected IgniteConfiguration getConfiguration(final String gridName) throws Exception { final IgniteConfiguration cfg = super.getConfiguration(gridName); <START> cfg.setPeerClassLoadingEnabled(true); <END> cfg.setClientMode(gridName.contains("client")); return cfg; }</code><technical_language>peer class loading</technical_language>

Target:
@Override protected IgniteConfiguration getConfiguration(final String gridName) throws Exception { final IgniteConfiguration cfg = super.getConfiguration(gridName); cfg.setClientMode(gridName.contains("client")); return cfg; }
Source:
<code><START> public void setThreadKeepAliveTime(int threadKeepAliveTime) { <END> this.threadKeepAliveTime = threadKeepAliveTime; executor.setKeepAliveTime(threadKeepAliveTime, TimeUnit.SECONDS); }</code><technical_language>Needs MIN_RECEIVE_THREAD_KEEP_ALIVE_TIME guard in constructor</technical_language>

Target:
public void setThreadKeepAliveTime(int threadKeepAliveTime) { this.threadKeepAliveTime = Math.max(MIN_RECEIVE_THREAD_KEEP_ALIVE_TIME, threadKeepAliveTime); executor.setKeepAliveTime(threadKeepAliveTime, TimeUnit.SECONDS); }
Source:
<code>public static DFSHedgedReadMetrics getDFSHedgedReadMetrics(final Configuration c) throws IOException { <START> if (!isHDFS(c)) return null; <END> final String name = "getHedgedReadMetrics"; DFSClient dfsclient = ((DistributedFileSystem)FileSystem.get(c)).getClient(); Method m; try { m = dfsclient.getClass().getDeclaredMethod(name); } catch (NoSuchMethodException e) { LOG.warn("Failed find method " + name + " in dfsclient; no hedged read metrics: " + e.getMessage()); return null; } catch (SecurityException e) { LOG.warn("Failed find method " + name + " in dfsclient; no hedged read metrics: " + e.getMessage()); return null; } m.setAccessible(true); try { return (DFSHedgedReadMetrics)m.invoke(dfsclient); } catch (IllegalAccessException e) { LOG.warn("Failed invoking method " + name + " on dfsclient; no hedged read metrics: " + e.getMessage()); return null; } catch (IllegalArgumentException e) { LOG.warn("Failed invoking method " + name + " on dfsclient; no hedged read metrics: " + e.getMessage()); return null; } catch (InvocationTargetException e) { LOG.warn("Failed invoking method " + name + " on dfsclient; no hedged read metrics: " + e.getMessage()); return null; } }</code><technical_language>Checkstyle conflict. Need braces</technical_language>

Target:
public static DFSHedgedReadMetrics getDFSHedgedReadMetrics(final Configuration c) throws IOException { if (!isHDFS(c)) { return null; } final String name = "getHedgedReadMetrics"; DFSClient dfsclient = ((DistributedFileSystem)FileSystem.get(c)).getClient(); Method m; try { m = dfsclient.getClass().getDeclaredMethod(name); } catch (NoSuchMethodException e) { LOG.warn("Failed find method " + name + " in dfsclient; no hedged read metrics: " + e.getMessage()); return null; } catch (SecurityException e) { LOG.warn("Failed find method " + name + " in dfsclient; no hedged read metrics: " + e.getMessage()); return null; } m.setAccessible(true); try { return (DFSHedgedReadMetrics)m.invoke(dfsclient); } catch (IllegalAccessException e) { LOG.warn("Failed invoking method " + name + " on dfsclient; no hedged read metrics: " + e.getMessage()); return null; } catch (IllegalArgumentException e) { LOG.warn("Failed invoking method " + name + " on dfsclient; no hedged read metrics: " + e.getMessage()); return null; } catch (InvocationTargetException e) { LOG.warn("Failed invoking method " + name + " on dfsclient; no hedged read metrics: " + e.getMessage()); return null; } }
Source:
<code>void highlightView(View view, int mainColor) { mHighlightDrawables[0].setColor(mainColor); <START> for (HighlightDrawable mHighlightDrawable : mHighlightDrawables) { <END> mHighlightDrawable.highlightView(view); } }</code><technical_language>Prefer: java int N = mHighlightDrawables.length; for (int i = 0; i < N; i++) { ... } performs Android (_sigh_)</technical_language>

Target:
void highlightView(View view, int mainColor) { mMainHighlightDrawable.setColor(mainColor); int total = mHighlightDrawables.length; for (int i = 0; i < total; i++) { HighlightDrawable drawable = mHighlightDrawables[i]; drawable.highlightView(view); view.getOverlay().add(drawable); } }
Source:
<code>public void testClusterSnapshotWithCacheNodeFilter() throws Exception { int grids = 4; CacheConfiguration<Integer, Integer> ccfg = txCacheConfig(new CacheConfiguration<Integer, Integer>(DEFAULT_CACHE_NAME)) .setNodeFilter(node -> node.consistentId().toString().endsWith("1")); for (int i = 0; i < grids; i++) startGrid(optimize(getConfiguration(getTestIgniteInstanceName(i)).setCacheConfiguration())); IgniteEx ig0 = grid(0); ig0.cluster().baselineAutoAdjustEnabled(false); ig0.cluster().state(ACTIVE); for (int i = 0; i < CACHE_KEYS_RANGE; i++) ig0.getOrCreateCache(ccfg).put(i, i); <START> forceCheckpoint(); <END> ig0.snapshot().createSnapshot(SNAPSHOT_NAME).get(); stopAllGrids(); IgniteEx snp = startGridsFromSnapshot(grids, SNAPSHOT_NAME); assertSnapshotCacheKeys(snp.cache(ccfg.getName())); }</code><technical_language>Redundant</technical_language>

Target:
public void testClusterSnapshotWithCacheNodeFilter() throws Exception { int grids = 4; CacheConfiguration<Integer, Integer> ccfg = txCacheConfig(new CacheConfiguration<Integer, Integer>(DEFAULT_CACHE_NAME)) .setNodeFilter(node -> node.consistentId().toString().endsWith("1")); IgniteEx ig0 = startGridsWithoutCache(grids); for (int i = 0; i < CACHE_KEYS_RANGE; i++) ig0.getOrCreateCache(ccfg).put(i, i); ig0.snapshot().createSnapshot(SNAPSHOT_NAME).get(); stopAllGrids(); IgniteEx snp = startGridsFromSnapshot(grids, cfg -> resolveSnapshotWorkDirectory(cfg.setCacheConfiguration()).getAbsolutePath(), SNAPSHOT_NAME, true); awaitPartitionMapExchange(); checkCacheDiscoveryDataConsistent(); CacheGroupDescriptor descr = snp.context().cache().cacheGroupDescriptors() .get(CU.cacheId(ccfg.getName())); assertNotNull(descr); assertNotNull(descr.config().getNodeFilter()); assertEquals(ccfg.getNodeFilter().apply(grid(1).localNode()), descr.config().getNodeFilter().apply(grid(1).localNode())); assertSnapshotCacheKeys(snp.cache(ccfg.getName())); }
Source:
<code>public void maintainNotFoundCache( ResourceStoreRequest request ) throws ItemNotFoundException { if ( isNotFoundCacheActive() ) { if ( getNotFoundCache().contains( request.getRequestPath() ) ) { if ( getNotFoundCache().isExpired( request.getRequestPath() ) ) { if ( getLogger().isDebugEnabled() ) { getLogger().debug( "The path " + request.getRequestPath() + " is in NFC but expired." ); } removeFromNotFoundCache( request ); } else { if ( getLogger().isDebugEnabled() ) { getLogger().debug( "The path " + request.getRequestPath() + " is in NFC and still active, throwing ItemNotFoundException." ); } throw new ItemNotFoundException( reasonFor( request, this, <START> "The path %s is in NFC of repository %s.", request.getRequestPath(), this ) ); <END> } } } }</code><technical_language>minor: acronym for NFC? e.g. "The path %s is cached for repository %s."</technical_language>

Target:
public void maintainNotFoundCache( ResourceStoreRequest request ) throws ItemNotFoundException { if ( isNotFoundCacheActive() ) { if ( getNotFoundCache().contains( request.getRequestPath() ) ) { if ( getNotFoundCache().isExpired( request.getRequestPath() ) ) { if ( getLogger().isDebugEnabled() ) { getLogger().debug( "The path " + request.getRequestPath() + " is in NFC but expired." ); } removeFromNotFoundCache( request ); } else { if ( getLogger().isDebugEnabled() ) { getLogger().debug( "The path " + request.getRequestPath() + " is in NFC and still active, throwing ItemNotFoundException." ); } throw new ItemNotFoundException( reasonFor( request, this, "The path %s is still cached as not found for repository %s", request.getRequestPath(), this ) ); } } } }
Source:
<code>public void run() { boolean live = (liveLock != null); boolean lostLock; boolean keepMonitoring = true; while (keepMonitoring) { lostLock = true; try { lostLock = (liveLock != null && !liveLock.isValid()) || liveLock == null; if (!lostLock) { logger.debug("Server still has the lock, double check status is live"); byte state = getState(); if (state == LIVE) { logger.debug("Status is set to live"); } else { logger.debug("Status is not live"); } } } catch (Exception exception) { logger.error(exception.getMessage(), exception); lostLock = true; } if (lostLock) { logger.warn("Lost the lock according to the monitor, notifying listeners"); notifyLostLock(); } try { <START> Thread.sleep(LOCK_MONITOR_TIMEOUT_MILLIES); <END> } catch (InterruptedException e) { } live = liveLock != null; keepMonitoring = live && !lostLock; if (!keepMonitoring) { logger.info("Bailing out the locking monitoring"); } } }</code><technical_language>a schedule executor. Instead of sleeping threads blocking a thread</technical_language>

Target:
public void run() { boolean lostLock = true; try { if (liveLock == null) { logger.debug("Livelock is null"); } lostLock = (liveLock != null && !liveLock.isValid()) || liveLock == null; if (!lostLock) { logger.debug("Server still has the lock, double check status is live"); byte state = getState(); if (state == LIVE) { logger.debug("Status is set to live"); } else { logger.debug("Status is not live"); } } } catch (Exception exception) { logger.error(exception.getMessage(), exception); lostLock = true; } if (lostLock) { logger.warn("Lost the lock according to the monitor, notifying listeners"); notifyLostLock(); } }
Source:
<code><START> private Object borrow(GenericObjectPool pool) { <END> try { return pool.borrowObject(); } catch (Exception e) { throw new ParquetCompressionCodecException(e); } }</code><technical_language>generic do cast with: @SuppressWarning("unchecked") <T> T borrow(GenericObjectPool pool) { ... return (T) ... ... }</technical_language>

Target:
public <T> T borrow(GenericObjectPool pool) { try { return (T) pool.borrowObject(); } catch (Exception e) { throw new ParquetCompressionCodecException(e); } }
Source:
<code>public Disk mapRow(ResultSet rs, int rowNum) throws SQLException { Disk disk = DiskRowMapper.instance.mapRow(rs, rowNum); disk.setPlugged(rs.getBoolean("is_plugged")); disk.setReadOnly(rs.getBoolean("is_readonly")); disk.setLogicalName(rs.getString("logical_name")); if (disk.getDiskStorageType() == DiskStorageType.LUN) { ((LunDisk) disk).setUsingScsiReservation(rs.getBoolean("is_scsi_reservation_used")); <START> } <END> return disk; }</code><technical_language>Please add this LunDiskRowMapper</technical_language>

Target:
public Disk mapRow(ResultSet rs, int rowNum) throws SQLException { Disk disk = DiskRowMapper.instance.mapRow(rs, rowNum); disk.setPlugged(rs.getBoolean("is_plugged")); disk.setReadOnly(rs.getBoolean("is_readonly")); disk.setLogicalName(rs.getString("logical_name")); if (disk.getDiskStorageType() == DiskStorageType.LUN) { ((LunDisk) disk).setUsingScsiReservation(rs.getBoolean("is_using_scsi_reservation")); } return disk; }
Source:
<code>private Map<String,Set<String>> getAgentNamesForMonitoringParameters(Set<PlotNode> plotNodeList) { Map<String,Set<String>> agentNames = new HashMap<String, Set<String>>(); for (PlotNode plotNode : plotNodeList) { for (MetricNameDto metricNameDto : plotNode.getMetricNameDtoList()) { if ((metricNameDto.getOrigin() == MetricNameDto.Origin.MONITORING) || (metricNameDto.getOrigin() == MetricNameDto.Origin.TEST_GROUP_METRIC) || <START> (metricNameDto.getOrigin()== MetricNameDto.Origin.SESSION_SCOPE_TG)) { <END> MonitoringIdUtils.MonitoringId monitoringId = MonitoringIdUtils.splitMonitoringMetricId(metricNameDto.getMetricName()); if (monitoringId != null) { for (String key : defaultMonitoringParams.keySet()) { if (defaultMonitoringParams.get(key).contains(monitoringId.getMonitoringName())) { if (!agentNames.containsKey(key)) { agentNames.put(key,new HashSet<String>()); } agentNames.get(key).add(monitoringId.getAgentName()); } } } } } } return agentNames; }</code><technical_language>need MetricNameDto.Origin.SESSION_SCOPE_TG</technical_language>

Target:
private Map<String,Set<String>> getAgentNamesForMonitoringParameters(Set<PlotNode> plotNodeList) { Map<String,Set<String>> agentNames = new HashMap<String, Set<String>>(); for (PlotNode plotNode : plotNodeList) { for (MetricNameDto metricNameDto : plotNode.getMetricNameDtoList()) { if ((metricNameDto.getOrigin() == MetricNameDto.Origin.MONITORING) || (metricNameDto.getOrigin() == MetricNameDto.Origin.TEST_GROUP_METRIC)) { MonitoringIdUtils.MonitoringId monitoringId = MonitoringIdUtils.splitMonitoringMetricId(metricNameDto.getMetricName()); if (monitoringId != null) { for (String key : defaultMonitoringParams.keySet()) { if (defaultMonitoringParams.get(key).contains(monitoringId.getMonitoringName())) { if (!agentNames.containsKey(key)) { agentNames.put(key,new HashSet<String>()); } agentNames.get(key).add(monitoringId.getAgentName()); } } } } } } return agentNames; }
Source:
<code>public void buildTranslationCaches() { myTranslationCache = Caffeine.newBuilder() .maximumSize(10000) <START> .expireAfterWrite(1, TimeUnit.HOURS) <END> .build(); myTranslationWithReverseCache = Caffeine.newBuilder() .maximumSize(10000) .expireAfterWrite(1, TimeUnit.HOURS) .build(); }</code><technical_language>For timeouts, 60 minutes instead of 1 hour timeout configurable a setter (with 60 mins default). thinking this configurable in Smile CDR config (and of HAPI FHIR users adjust this setting in Spring Config)</technical_language>

Target:
public void buildTranslationCaches() { Long timeout = myDaoConfig.getTranslationCachesExpireAfterWriteInMinutes(); myTranslationCache = Caffeine.newBuilder() .maximumSize(10000) .expireAfterWrite(timeout, TimeUnit.MINUTES) .build(); myTranslationWithReverseCache = Caffeine.newBuilder() .maximumSize(10000) .expireAfterWrite(timeout, TimeUnit.MINUTES) .build(); }
Source:
<code>private void displayJSONMessages(){ String result = ""; ServiceId serviceId = call.getService(); MethodId mid = call.getMethod(); if(serviceId == null){ String serviceNotSet = new StringResourceModel("json.view.ServiceNotSet", this, null).getString(); info(serviceNotSet); return; } if(mid == null){ String methodNotSet = new StringResourceModel("json.view.MethodNotSet", this, null).getString(); info(methodNotSet); return; } org.openengsb.core.api.remote.MethodCall mc = new org.openengsb.core.api.remote.MethodCall(mid.getName(),call.getArgumentsAsArray()); <START> Map<String,String> metaData = new HashMap<String,String>(); <END> if(serviceId.getServiceId() == null){ metaData.put("serviceId", serviceId.getDomainName()); }else{ metaData.put("serviceId", serviceId.getServiceId()); } metaData.put("contextId", this.getSessionContextId()); mc.setMetaData(metaData); MethodCallRequest mcr = new MethodCallRequest(mc,"randomCallId"); BeanDescription auth = BeanDescription.fromObject(new Password("yourpassword")); SecureRequest secureRequest = SecureRequest.create(mcr, "yourusername", auth); try { result = JsonUtils.createObjectMapperWithIntroSpectors().writeValueAsString(secureRequest); } catch (IOException ex) { handleExceptionWithFeedback(ex); } String jsonPrefix = new StringResourceModel("json.view.MessagePrefix", this, null).getString(); String typeToReplace = ",\"type\":"; while(result.contains(typeToReplace)){ int posAfterType = result.indexOf(typeToReplace)+typeToReplace.length(); String firstPart = result.substring(0,result.indexOf(typeToReplace)); String lastPart = result.substring(posAfterType,result.length()); int endOfArgs = lastPart.indexOf("}]"); int firstSemicolon = lastPart.indexOf(","); if(firstSemicolon < endOfArgs){ lastPart = lastPart.substring(lastPart.indexOf(","), lastPart.length()); } result = firstPart + lastPart; } result = result.replaceAll(",\"processId\":null,\"origin\":null", ""); info(jsonPrefix+" "+result); }</code><technical_language>want guava lib for this</technical_language>

Target:
private void displayJSONMessages(){ ServiceId serviceId = fetchCurrentSelectService(); MethodId methodId = fetchCurrentSelectMethod(); if(serviceId == null){ String serviceNotSet = new StringResourceModel("json.view.ServiceNotSet", this, null).getString(); info(serviceNotSet); return; } if(methodId == null){ String methodNotSet = new StringResourceModel("json.view.MethodNotSet", this, null).getString(); info(methodNotSet); return; } String jsonResult = parseRequestToJsonString(createSecureRequest(serviceId, methodId)); String jsonPrefix = new StringResourceModel("json.view.MessagePrefix", this, null).getString(); jsonResult = filterUnnessecaryArgumentsFromJsonMessage(jsonResult); info(String.format("%s %s", jsonPrefix, jsonResult)); }
Source:
<code>private String mountNfs(Connection conn, String remoteDir, String localDir) { if (localDir == null) { <START> localDir = "/var/cloud_mount/" + UUID.nameUUIDFromBytes(remoteDir.getBytes()); <END> } return callHostPlugin(conn, "cloud-plugin-storage", "mountNfsSecondaryStorage", "localDir", localDir, "remoteDir", remoteDir); }</code><technical_language>please factor out this hardcoded path segment</technical_language>

Target:
private String mountNfs(Connection conn, String remoteDir, String localDir) { if (localDir == null) { localDir = BASE_MOUNT_POINT_ON_REMOTE + UUID.nameUUIDFromBytes(remoteDir.getBytes()); } return callHostPlugin(conn, "cloud-plugin-storage", "mountNfsSecondaryStorage", "localDir", localDir, "remoteDir", remoteDir); }
Source:
<code>public String getMessage() { <START> return String.format("No items to createDefault feed %s", spec); <END> }</code><technical_language>I is is a rename refactoring a bit wrong :)</technical_language>

Target:
public String getMessage() { return String.format("No items to create feed %s", spec); }
Source:
<code>private void setVdsmId(String eventName, String eventUrl) { if (!eventName.equals(AnsibleConstants.TASK_VDSM_ID)) { return; } String vdsmid = runnerClient.getVdsmId(eventUrl); log.info( "Host reports unique id {}", getVds().getHostName(), vdsmid ); final List<String> hosts = vdsDao.getAllWithUniqueId(vdsmid) .stream() .filter(vds -> !vds.getId().equals(getVds().getId())) .map(VDS::getName) .collect(Collectors.toList()); if (!hosts.isEmpty()) { log.error( "Host reports duplicate unique id of following hosts {}", getVds().getHostName(), vdsmid, <START> hosts <END> ); throw new SoftError( String.format( "Host %1$s reports unique id which already registered for %2$s", getVds().getHostName(), hosts ) ); } log.info("Assigning unique id to Host {}", vdsmid, getVds().getHostName()); getVds().setUniqueId(vdsmid); TransactionSupport.executeInNewTransaction(() -> { vdsStaticDao.update(getVds().getStaticData()); return null; }); }</code><technical_language>'hosts.stream().collect(Collectors.joining(","))' instead of 'hosts'</technical_language>

Target:
private void setVdsmId(String eventName, String eventUrl) { if (!eventName.equals(AnsibleConstants.TASK_VDSM_ID)) { return; } String vdsmid = runnerClient.getVdsmId(eventUrl); log.info( "Host reports unique id {}", getVds().getHostName(), vdsmid ); final String hosts = vdsDao.getAllWithUniqueId(vdsmid) .stream() .filter(vds -> !vds.getId().equals(getVds().getId())) .map(VDS::getName) .collect(Collectors.joining(",")); if (!hosts.isEmpty()) { log.error( "Host reports duplicate unique id of following hosts {}", getVds().getHostName(), vdsmid, hosts ); throw new SoftError( String.format( "Host %1$s reports unique id which already registered for %2$s", getVds().getHostName(), hosts ) ); } log.info("Assigning unique id to Host {}", vdsmid, getVds().getHostName()); getVds().setUniqueId(vdsmid); TransactionSupport.executeInNewTransaction(() -> { vdsStaticDao.update(getVds().getStaticData()); return null; }); }
Source:
<code>public byte[] toByteArray() { <START> return ByteBuffer.allocate(8).putLong(valueLong).array(); <END> }</code><technical_language>I implement this (just return null). A long a fixed size, putLong() in HTInterval write file. This method more for string, structs, etc. want serialize</technical_language>

Target:
public byte[] toByteArray() { return null; }
Source:
<code>public static String[] splitName(String fullName){ fullName = fullName.trim().replaceAll("\\s+", " "); String lastName = fullName.substring(fullName.lastIndexOf(" ")+1).trim(); String firstName = fullName.replace(lastName, "").trim(); <START> String[] splited ={firstName, lastName}; <END> return splited; }</code><technical_language>splited is a word</technical_language>

Target:
public static String[] splitName(String fullName){ if(fullName == null){ return null; } String lastName = fullName.substring(fullName.lastIndexOf(" ")+1).trim(); String firstName = fullName.replace(lastName, "").trim(); String[] splitNames = {firstName, lastName}; return splitNames; }
Source:
<code>private void updateInfo() { if(selectedMsg != null) { statusView.setVisibility(View.VISIBLE); final LatLong msgCoord = coordFromMsgGlobalPositionInt(selectedMsg); if(lastGCSPosition == null || lastGCSPosition.getLatitude() == 0 || lastGCSPosition .getLongitude() == 0) { distanceView.setText(R.string.status_waiting_for_gps, TextView.BufferType.NORMAL); azimuthView.setText(""); } else { <START> String distance = getString(R.string.editor_info_window_distance) + String.format(" %.01fm", <END> MathUtils.getDistance(lastGCSPosition, msgCoord)); if(lastGCSBearingTo != Float.MAX_VALUE) { final String bearing = String.format(" @ %.0f°", lastGCSBearingTo); distance += bearing; } distanceView.setText(distance); if(lastGCSAzimuth != Double.MAX_VALUE) { final String azimuth = String.format("Heading: %.0f°", lastGCSAzimuth); azimuthView.setText(azimuth); } } latView.setText(getString(R.string.waypoint_latitude) + String.format(" %f°", msgCoord.getLatitude())); lonView.setText(getString(R.string.waypoint_longitude) + String.format(" %f°", msgCoord.getLongitude())); } else { statusView.setVisibility(View.INVISIBLE); latView.setText(""); lonView.setText(""); distanceView.setText(""); azimuthView.setText(""); } }</code><technical_language>@zumbrunnen merge getString(int) String.format(String, Object...) [getString(int, Object...)](<LINK_0>, java.lang.Object...%29)</technical_language>

Target:
private void updateInfo() { if(selectedMsg != null) { statusView.setVisibility(View.VISIBLE); final LatLong msgCoord = coordFromMsgGlobalPositionInt(selectedMsg); if(lastGCSPosition == null || lastGCSPosition.getLatitude() == 0 || lastGCSPosition .getLongitude() == 0) { distanceView.setText(R.string.status_waiting_for_gps, TextView.BufferType.NORMAL); azimuthView.setText(""); } else { String distance = getString(R.string.editor_info_window_distance, MathUtils.getDistance(lastGCSPosition, msgCoord)); if(lastGCSBearingTo != Float.MAX_VALUE) { final String bearing = String.format(" @ %.0f°", lastGCSBearingTo); distance += bearing; } distanceView.setText(distance); if(lastGCSAzimuth != Double.MAX_VALUE) { final String azimuth = getString(R.string.editor_info_window_heading, lastGCSAzimuth); azimuthView.setText(azimuth); } } latView.setText(getString(R.string.waypoint_latitude, msgCoord.getLatitude())); lonView.setText(getString(R.string.waypoint_longitude, msgCoord.getLongitude())); } else { statusView.setVisibility(View.INVISIBLE); latView.setText(""); lonView.setText(""); distanceView.setText(""); azimuthView.setText(""); } }
Source:
<code>public Pair<IOperatorDescriptor, AlgebricksPartitionConstraint> getInsertRuntime(IDataSource<String> dataSource, IOperatorSchema propagatedSchema, IVariableTypeEnvironment typeEnv, List<LogicalVariable> keys, LogicalVariable payLoadVar, List<LogicalVariable> additionalFilterKeyFields, List<LogicalVariable> additionalNonFilteringFields, RecordDescriptor recordDesc, JobGenContext context, JobSpecification jobSpec, boolean bulkload) throws AlgebricksException { <START> return null; <END> }</code><technical_language>UnsupportedOperationException reasonable here</technical_language>

Target:
public Pair<IOperatorDescriptor, AlgebricksPartitionConstraint> getInsertRuntime(IDataSource<String> dataSource, IOperatorSchema propagatedSchema, IVariableTypeEnvironment typeEnv, List<LogicalVariable> keys, LogicalVariable payLoadVar, List<LogicalVariable> additionalFilterKeyFields, List<LogicalVariable> additionalNonFilteringFields, RecordDescriptor recordDesc, JobGenContext context, JobSpecification jobSpec, boolean bulkload) throws AlgebricksException { throw new UnsupportedOperationException(); }
Source:
<code>public void run() { Repository repo = historyPage.getCurrentRepo(); if (repo != null) { String repoSepcificKey = getRepositorySpecificFirstParentPreferenceKey( repo); String newValue = isChecked() ? IPreferenceStore.TRUE : IPreferenceStore.FALSE; <START> historyPage.store.putValue(repoSepcificKey, <END> newValue); if (historyPage.store.needsSaving()) try { historyPage.store.save(); } catch (IOException e) { Activator.handleError(e.getMessage(), e, false); } } historyPage.refresh(); }</code><technical_language>equals current *default* (and I should) remove repo specific key/value completely prefs unsetProjectSpecificFirstParentPreference</technical_language>

Target:
public void run() { final String prefKey = UIPreferences.RESOURCEHISTORY_SHOW_FIRST_PARENT_ONLY_DEFAULT; Repository repo = historyPage.getCurrentRepo(); if (repo != null) { String repoSepcificKey = getRepoSpecificKey(repo, prefKey); boolean newBoolean = isChecked(); if (newBoolean == historyPage.store.getBoolean(prefKey)) { historyPage.store.setToDefault(repoSepcificKey); } else { String newValue = newBoolean ? IPreferenceStore.TRUE : IPreferenceStore.FALSE; historyPage.store.putValue(repoSepcificKey, newValue); } historyPage.saveStoreIfNeeded(); } historyPage.refresh(); }
Source:
<code>private static String getUserAgent() { final String defaultVersion = "dev-" + System.currentTimeMillis(); try (InputStream stream = BigtableConstants.class.getResourceAsStream("bigtable-hbase.properties")) { if (stream == null) { LOG.error("Could not load properties file bigtable-hbase.properties"); return defaultVersion; } Properties properties = new Properties(); properties.load(stream); String value = properties.getProperty("bigtable.hbase.user_agent"); if (value == null) { LOG.error("bigtable.hbase.user_agent not found in bigtable-hbase.properties."); } else if (value.startsWith("$")){ <START> LOG.info("project.version token is not replaced."); <END> } else { return value; } } catch (IOException e) { LOG.error( String.format("Error while trying to get project.version from bigtable-hbase.properties"), e); } return defaultVersion; }</code><technical_language>update log mention ${project.artifactId}-${project.version} "Tokens replaced"</technical_language>

Target:
private static String getUserAgent() { final String defaultUserAgent = "bigtable-hbase/dev-" + System.currentTimeMillis(); try (InputStream stream = BigtableConstants.class.getResourceAsStream("bigtable-hbase.properties")) { if (stream == null) { LOG.error("Could not load properties file bigtable-hbase.properties"); return defaultUserAgent; } Properties properties = new Properties(); properties.load(stream); String value = properties.getProperty("bigtable.hbase.user_agent"); if (value == null) { LOG.error("bigtable.hbase.user_agent not found in bigtable-hbase.properties."); } else if (value.startsWith("$")){ LOG.info("bigtable.hbase.user_agent property is not replaced."); } else { return value; } } catch (IOException e) { LOG.error( String.format("Error while trying to get user agent name from bigtable-hbase.properties"), e); } return defaultUserAgent; }
Source:
<code>private String getContentType(String name) { <START> name = name.toLowerCase(); <END> if (name.endsWith(".class")) { return ClassfileComparator.TYPE; } if (name.endsWith(".jar") || name.endsWith(".zip")) { return NestedZipComparator.TYPE; } if (name.endsWith(".properties") || name.endsWith(".mappings")) { return PropertiesComparator.TYPE; } if ("meta-inf/manifest.mf".equals(name)) { return ManifestComparator.TYPE; } return DefaultContentsComparator.TYPE; }</code><technical_language>toLowerCase(Locale.ENGLISH)</technical_language>

Target:
private String getContentType(String name) { name = name.toLowerCase(Locale.ENGLISH); if (name.endsWith(".class")) { return ClassfileComparator.TYPE; } if (name.endsWith(".jar") || name.endsWith(".zip")) { return NestedZipComparator.TYPE; } if (name.endsWith(".properties") || name.endsWith(".mappings")) { return PropertiesComparator.TYPE; } if ("meta-inf/manifest.mf".equals(name)) { return ManifestComparator.TYPE; } return DefaultContentsComparator.TYPE; }