auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void setUp() { subject = mock(Subject.class); accessPlugin = new ShareableMetacardAccessPlugin() { @Override protected Subject getSubject() { return subject; } }; ShareableMetacardImpl.setShareableMetacardType( new MetacardTypeImpl( <START> "metacard.sharing", Arrays.asList(new SecurityAttributes(), new CoreAttributes()))); <END> }</code><technical_language>remove duplicated descriptor state in ShareableMetacardImpl descriptor state lives in MetacardImpl</technical_language>

Target:
public void setUp() { subject = mock(Subject.class); accessPlugin = new ShareableMetacardAccessPlugin() { @Override protected Subject getSubject() { return subject; } }; }
Source:
<code>public void onCustomizedStateConfigChange( CustomizedStateConfig customizedStateConfig, NotificationContext context) { <START> HelixManager helixManager = context.getManager(); <END> List<String> customizedStates = getEnabledCustomizedStates(helixManager); Map<String, LiveInstance> liveInstanceMap = helixManager.getHelixDataAccessor() .getChildValuesMap(helixManager.getHelixDataAccessor().keyBuilder().liveInstances()); List<String> liveInstances = liveInstanceMap.values().stream() .map(liveInstance -> liveInstance.getInstanceName()).collect(Collectors.toList()); for (String customizedState : customizedStates) { for (String instance : liveInstances) { addCustomizedStateListeners(helixManager, customizedState, instance); } } logger.info( "START: GenericClusterController.onCustomizedStateConfigChange() for cluster " + _clusterName); notifyCaches(context, ChangeType.CUSTOMIZED_STATE_CONFIG); pushToEventQueues(ClusterEventType.CustomizeStateAggregationConfigChange, context, Collections.<String, Object> emptyMap()); logger.info( "END: GenericClusterController.onCustomizedStateConfigChange() for cluster " + _clusterName); }</code><technical_language>I remember agreed moving this event processing logic. a major delay in ZK event callback thread</technical_language>

Target:
public void onCustomizedStateConfigChange( CustomizedStateConfig customizedStateConfig, NotificationContext context) { logger.info( "START: GenericClusterController.onCustomizedStateConfigChange() for cluster " + _clusterName); notifyCaches(context, ChangeType.CUSTOMIZED_STATE_CONFIG); pushToEventQueues(ClusterEventType.CustomizeStateConfigChange, context, Collections.<String, Object> emptyMap()); logger.info( "END: GenericClusterController.onCustomizedStateConfigChange() for cluster " + _clusterName); }
Source:
<code>public Optional<Object> apply( final Object... args ) { if(args.length == 0) { return Optional.empty(); } Object arg = args[0]; if(arg != null) { <START> if(arg instanceof Integer) { <END> return Optional.<Object>of( java.lang.Math.abs( (Integer) arg )); } else if(arg instanceof Double) { return Optional.<Object>of( java.lang.Math.abs( (Double) arg )); } } return Optional.empty(); }</code><technical_language>Long</technical_language>

Target:
public Optional<Object> apply( final Object... args ) { if(args.length == 0) { return Optional.empty(); } Object arg = args[0]; if(arg != null) { if(arg instanceof Integer) { return Optional.<Object>of( java.lang.Math.abs( (Integer) arg )); } else if(arg instanceof Double) { return Optional.<Object>of( java.lang.Math.abs( (Double) arg )); } else if(arg instanceof Long) { return Optional.<Object>of( java.lang.Math.abs( (Long) arg )); } } return Optional.empty(); }
Source:
<code>public void testSetDMNModel() { picker.setDMNModel(dmnModel); verify(qNameFieldConverter).setDMNModel(eq(dmnModel)); verify(typeSelector).clear(); final BuiltInType[] bits = BuiltInType.values(); verify(picker, times(bits.length)).makeTypeSelector(builtInTypeCaptor.capture()); final List<BuiltInType> builtInTypes = new ArrayList<>(Arrays.asList(bits)); <START> builtInTypes.removeAll(builtInTypeCaptor.getAllValues()); <END> assertTrue(builtInTypes.isEmpty()); final List<ItemDefinition> itemDefinitions = definitions.getItemDefinition(); verify(picker, times(itemDefinitions.size())).makeTypeSelector(itemDefinitionCaptor.capture()); itemDefinitions.removeAll(itemDefinitionCaptor.getAllValues()); assertTrue(itemDefinitions.isEmpty()); }</code><technical_language>assert builtInTypes empty removeAllcall</technical_language>

Target:
public void testSetDMNModel() { picker.setDMNModel(dmnModel); verify(qNameFieldConverter).setDMNModel(eq(dmnModel)); verify(typeSelector).clear(); final BuiltInType[] bits = BuiltInType.values(); verify(picker, times(bits.length)).makeTypeSelector(builtInTypeCaptor.capture()); final List<BuiltInType> builtInTypes = new ArrayList<>(Arrays.asList(bits)); assertFalse(builtInTypes.isEmpty()); builtInTypes.removeAll(builtInTypeCaptor.getAllValues()); assertTrue(builtInTypes.isEmpty()); final List<ItemDefinition> itemDefinitions = definitions.getItemDefinition(); verify(picker, times(itemDefinitions.size())).makeTypeSelector(itemDefinitionCaptor.capture()); assertFalse(itemDefinitions.isEmpty()); itemDefinitions.removeAll(itemDefinitionCaptor.getAllValues()); assertTrue(itemDefinitions.isEmpty()); }
Source:
<code>public void shouldConcatenateOneNonEmptyList() { final List<Integer> list = Collections.unmodifiableList( <START> IntStream.range(0, 4) <END> .boxed() .collect(Collectors.toList()) ); final List<Integer> actual = ListOps.concat(list); final List<Integer> expected = IntStream.range(0, 4) .boxed() .collect(Collectors.toList()); assertNotNull(actual); assertFalse(actual.isEmpty()); assertEquals(expected, actual); }</code><technical_language>Arrays.asList(...) for short lists</technical_language>

Target:
public void shouldConcatenateOneNonEmptyList() { final List<Integer> list = Collections.unmodifiableList( Arrays.asList(0, 1, 2, 3, 4) ); final List<Integer> actual = ListOps.concat(list); final List<Integer> expected = Arrays.asList(0, 1, 2, 3, 4); assertNotNull(actual); assertFalse(actual.isEmpty()); assertEquals(expected, actual); }
Source:
<code>private void close(SelectionKey key) { Transmission transmission = getTransmission(key); if (transmission != null) { logger.debug("Closing connection from {}", transmission.getConnectionId()); this.disconnected.add(transmission.getConnectionId()); this.keyMap.remove(transmission.getConnectionId()); activeConnections.set(this.keyMap.size()); try { transmission.close(); <START> if (pendingSslHandshakes.contains(transmission.getConnectionId())) { <END> pendingSslHandshakes.remove(transmission.getConnectionId()); sslHandshakeTimer.remove(transmission.getConnectionId()); } } catch (IOException e) { logger.error("IOException thrown during closing of transmission with connectionId :", transmission.getConnectionId(), e); } } else { key.attach(null); key.cancel(); SocketAddress address = null; try { SocketChannel socketChannel = channel(key); address = socketChannel.socket().getRemoteSocketAddress(); socketChannel.socket().close(); socketChannel.close(); } catch (IOException e) { metrics.selectorCloseSocketErrorCount.inc(); logger.error("Exception closing connection to remote host :", address, e); } } this.metrics.selectorConnectionClosed.inc(); }</code><technical_language>pendingSslHandshakes is a list of SSLTransmission, argument contains() call is wrong. is surprising Lists complain this</technical_language>

Target:
private void close(SelectionKey key) { Transmission transmission = getTransmission(key); if (transmission != null) { logger.debug("Closing connection from {}", transmission.getConnectionId()); this.disconnected.add(transmission.getConnectionId()); this.keyMap.remove(transmission.getConnectionId()); numActiveConnections.set(keyMap.size()); unreadyConnections.remove(transmission.getConnectionId()); try { transmission.close(); } catch (IOException e) { logger.error("IOException thrown during closing of transmission with connectionId :", transmission.getConnectionId(), e); } } else { key.attach(null); key.cancel(); SocketAddress address = null; try { SocketChannel socketChannel = channel(key); address = socketChannel.socket().getRemoteSocketAddress(); socketChannel.socket().close(); socketChannel.close(); } catch (IOException e) { metrics.selectorCloseSocketErrorCount.inc(); logger.error("Exception closing connection to remote host :", address, e); } } this.metrics.selectorConnectionClosed.inc(); }
Source:
<code>public Roles mapRoles(Roles rolesToMap) { <START> Roles res = new MappedRoles(rolesToMap, this.reverseRoleMap); <END> if (keepMapped) { res = res.or(rolesToMap.and(keyRoles)); } if (keepNonMapped) { res = res.or(rolesToMap.minus(keyRoles)); } return res; }</code><technical_language>options implemented logical operations, I dont reason part of mapped-role-mapper. If user need it, logical-role-mappers instead. Considering KeepItSimple rule, if requested, drop them</technical_language>

Target:
public Roles mapRoles(Roles rolesToMap) { if (!initialized) { throw log.roleMappedNotInitialized(); } return new MappedRoles(rolesToMap, this.reverseRoleMap); }
Source:
<code>public int hashCode() { return Objects.hashCode(tableName, <START> null != addNewColumn ? Objects.hashCode(addNewColumn) : addNewColumn, <END> null != alterTableOpType ? Objects.hashCode(alterTableOpType) : alterTableOpType, null != columnName ? Objects.hashCode(columnName) : columnName, null != newColumnName ? Objects.hashCode(newColumnName) : newColumnName, null != newTableName ? Objects.hashCode(newTableName) : newTableName, null != tableName ? Objects.hashCode(tableName) : tableName, null != properties ? Objects.hashCode(properties) : properties, null != columnNames ? Objects.hashCode(columnNames) : columnNames, null != partitionValues ? Objects.hashCode(partitionValues) : partitionValues, null != location ? Objects.hashCode(location) : location ); }</code><technical_language>Objects.hashCode() allows null parameters, this null checking is unnecessary. Anyway, I is more efficient Objects.hashCode(). However, I hashCode() methods written Objects.hashCode(). So, need improve hashCode() methods performance issue arises later</technical_language>

Target:
public int hashCode() { return Objects.hashCode(tableName, addNewColumn, alterTableOpType, columnName, newColumnName, newTableName, tableName, properties, partitionColumns, partitionValues, location, isPurge); }
Source:
<code>public Map<String, List<String>> getRoutingData() throws InvalidRoutingDataException { Map<String, List<String>> routingData = new HashMap<>(); List<String> allRealmAddresses; try { allRealmAddresses = _zkClient.getChildren(MetadataStoreRoutingConstants.ROUTING_DATA_PATH); } catch (ZkNoNodeException e) { throw new InvalidRoutingDataException( "Routing data directory ZNode " + MetadataStoreRoutingConstants.ROUTING_DATA_PATH + " does not exist. Routing ZooKeeper address: " + _zkAddress); } <START> for (String realmAddress : allRealmAddresses) { <END> ZNRecord record = _zkClient.readData(MetadataStoreRoutingConstants.ROUTING_DATA_PATH + "/" + realmAddress); if (record != null) { List<String> shardingKeys = record.getListField(MetadataStoreRoutingConstants.ZNRECORD_LIST_FIELD_KEY); routingData .put(realmAddress, shardingKeys != null ? shardingKeys : Collections.emptyList()); } } return routingData; }</code><technical_language>Null check allRealmAddress in case</technical_language>

Target:
public Map<String, List<String>> getRoutingData() throws InvalidRoutingDataException { Map<String, List<String>> routingData = new HashMap<>(); List<String> allRealmAddresses; try { allRealmAddresses = _zkClient.getChildren(MetadataStoreRoutingConstants.ROUTING_DATA_PATH); } catch (ZkNoNodeException e) { throw new InvalidRoutingDataException( "Routing data directory ZNode " + MetadataStoreRoutingConstants.ROUTING_DATA_PATH + " does not exist. Routing ZooKeeper address: " + _zkAddress); } if (allRealmAddresses != null) { for (String realmAddress : allRealmAddresses) { ZNRecord record = _zkClient .readData(MetadataStoreRoutingConstants.ROUTING_DATA_PATH + "/" + realmAddress); if (record != null) { List<String> shardingKeys = record.getListField(MetadataStoreRoutingConstants.ZNRECORD_LIST_FIELD_KEY); routingData .put(realmAddress, shardingKeys != null ? shardingKeys : Collections.emptyList()); } } } return routingData; }
Source:
<code>private List<Container> pickOpportunisticContainersToKill( ContainerId containerToStartId) { List<Container> extraOpportContainersToKill = new ArrayList<>(); ResourceUtilization resourcesToFreeUp = resourcesToFreeUp( containerToStartId); Iterator<Container> reverseContainerIterator = new LinkedList<>(scheduledToRunContainers.values()).descendingIterator(); while(reverseContainerIterator.hasNext() && !hasSufficientResources(resourcesToFreeUp)) { Container runningCont = reverseContainerIterator.next(); if (runningCont.getContainerTokenIdentifier().getExecutionType() == ExecutionType.OPPORTUNISTIC) { <START> if (oppContainersMarkedForKill.containsKey( <END> runningCont.getContainerId())) { continue; } extraOpportContainersToKill.add(runningCont); ResourceUtilizationManager.decreaseResourceUtilization( getContainersMonitor(), resourcesToFreeUp, runningCont.getResource()); } } if (!hasSufficientResources(resourcesToFreeUp)) { LOG.warn("There are no sufficient resources to start guaranteed [{}]" + "even after attempting to kill all running" + "opportunistic containers.", containerToStartId); } return extraOpportContainersToKill; }</code><technical_language>removing containers marked get this.. If runningOppContainers a stack oppContainersToKill a queue, do for (Container container : runningOppContainers.removeAll(oppContainersToKill)) { killContainer(container); if (hasSufficientResources()) { break; } }</technical_language>

Target:
private List<Container> pickOpportunisticContainersToKill( ContainerId containerToStartId) { List<Container> extraOpportContainersToKill = new ArrayList<>(); ResourceUtilization resourcesToFreeUp = resourcesToFreeUp( containerToStartId); Iterator<Container> lifoIterator = new LinkedList<>( runningContainers.values()).descendingIterator(); while(lifoIterator.hasNext() && !hasSufficientResources(resourcesToFreeUp)) { Container runningCont = lifoIterator.next(); if (runningCont.getContainerTokenIdentifier().getExecutionType() == ExecutionType.OPPORTUNISTIC) { if (oppContainersToKill.containsKey( runningCont.getContainerId())) { continue; } extraOpportContainersToKill.add(runningCont); ContainersMonitor.decreaseResourceUtilization( getContainersMonitor(), resourcesToFreeUp, runningCont.getResource()); } } if (!hasSufficientResources(resourcesToFreeUp)) { LOG.warn("There are no sufficient resources to start guaranteed [{}]" + "at the moment. Opportunistic containers are in the process of" + "being killed to make room.", containerToStartId); } return extraOpportContainersToKill; }
Source:
<code>private void parseIncompleteRoot(CommonTree root) throws ParseException { List<CommonTree> children = root.getChildren(); <START> List<CommonTree> events = new ArrayList<>(); <END> if (!fHasBeenParsed) { throw new ParseException("You need to run generate first"); } pushScope(); for (CommonTree child : children) { final int type = child.getType(); switch (type) { case CTFParser.DECLARATION: parseRootDeclaration(child); break; case CTFParser.TRACE: throw new ParseException("Trace block defined here, please use generate and not generateFragment to parse this fragment"); case CTFParser.STREAM: parseStream(child); break; case CTFParser.EVENT: events.add(child); break; case CTFParser.CLOCK: parseClock(child); break; case CTFParser.ENV: parseEnvironment(child); break; case CTFParser.CALLSITE: parseCallsite(child); break; default: childTypeError(child); } } parseEvents(!Iterables.isEmpty(fTrace.getStreams()), events); popScope(); }</code><technical_language>this declaration throw Exception, do if exception is thrown. minor thing</technical_language>

Target:
private void parseIncompleteRoot(CommonTree root) throws ParseException { if (!fHasBeenParsed) { throw new ParseException("You need to run generate first"); } List<CommonTree> children = root.getChildren(); List<CommonTree> events = new ArrayList<>(); pushScope(); for (CommonTree child : children) { final int type = child.getType(); switch (type) { case CTFParser.DECLARATION: parseRootDeclaration(child); break; case CTFParser.TRACE: throw new ParseException("Trace block defined here, please use generate and not generateFragment to parse this fragment"); case CTFParser.STREAM: parseStream(child); break; case CTFParser.EVENT: events.add(child); break; case CTFParser.CLOCK: parseClock(child); break; case CTFParser.ENV: parseEnvironment(child); break; case CTFParser.CALLSITE: parseCallsite(child); break; default: childTypeError(child); } } parseEvents(events, !Iterables.isEmpty(fTrace.getStreams())); popScope(); }
Source:
<code><START> private EventLogCategory getEventLogCategory(final Map<String, String> parameters) { <END> if (parameters.containsKey(PlatformSmartmeteringKeys.EVENT_TYPE)) { return EventLogCategory.fromValue(parameters.get(PlatformSmartmeteringKeys.EVENT_TYPE)); } return DEFAULT_EVENT_LOG_CATEGORY; }</code><technical_language>implementations fine, I if code a bit simpler if defaults stored String values, instead of parameters.containsKey(String) do like: return EventLogCategory.fromValue(Helpers.getString(parameters, PlatformSmartmeteringKeys.EVENT_TYPE, DEFAULT_EVENT_LOG_CATEGORY)); a one-liner</technical_language>

Target:
private EventLogCategory getEventLogCategory(final Map<String, String> parameters) { return Helpers.getEnum(parameters, PlatformSmartmeteringKeys.EVENT_TYPE, EventLogCategory.class, DEFAULT_EVENT_LOG_CATEGORY); }
Source:
<code><START> protected int getTitle(boolean move) { <END> return move ? R.string.crypt_decrypting : R.string.crypt_encrypting; }</code><technical_language>Recommend rename move decrypting more meaningful</technical_language>

Target:
protected int getTitle(boolean move) { return R.string.crypt_encrypting; }
Source:
<code>public void testPingPongFlowControlWhenAutoReadIsDisabled() { String text1 = "Hello, world #1"; String text2 = "Hello, world #2"; String text3 = "Hello, world #3"; String text4 = "Hello, world #4"; EmbeddedChannel channel = new EmbeddedChannel(); channel.config().setAutoRead(false); channel.pipeline().addLast(new FlowControlHandler()); channel.pipeline().addLast(new WebSocketProtocolHandler() { }); <START> channel.writeInbound( <END> new PingWebSocketFrame(Unpooled.copiedBuffer(text1, UTF_8)), new TextWebSocketFrame(text2), new TextWebSocketFrame(text3), new PingWebSocketFrame(Unpooled.copiedBuffer(text4, UTF_8)) ); assertNull(channel.readInbound()); assertNull(channel.readOutbound()); channel.read(); PongWebSocketFrame response1 = channel.readOutbound(); assertEquals(text1, response1.content().toString(UTF_8)); TextWebSocketFrame message2 = channel.readInbound(); assertEquals(text2, message2.text()); assertNull(channel.readInbound()); assertNull(channel.readOutbound()); channel.read(); TextWebSocketFrame message3 = channel.readInbound(); assertEquals(text3, message3.text()); assertNull(channel.readInbound()); assertNull(channel.readOutbound()); response1.release(); message2.release(); message3.release(); assertFalse(channel.finish()); }</code><technical_language>assert return</technical_language>

Target:
public void testPingPongFlowControlWhenAutoReadIsDisabled() { String text1 = "Hello, world #1"; String text2 = "Hello, world #2"; String text3 = "Hello, world #3"; String text4 = "Hello, world #4"; EmbeddedChannel channel = new EmbeddedChannel(); channel.config().setAutoRead(false); channel.pipeline().addLast(new FlowControlHandler()); channel.pipeline().addLast(new WebSocketProtocolHandler() { }); assertFalse(channel.writeInbound( new PingWebSocketFrame(Unpooled.copiedBuffer(text1, UTF_8)), new TextWebSocketFrame(text2), new TextWebSocketFrame(text3), new PingWebSocketFrame(Unpooled.copiedBuffer(text4, UTF_8)) )); assertNull(channel.readInbound()); assertNull(channel.readOutbound()); channel.read(); PongWebSocketFrame response1 = channel.readOutbound(); assertEquals(text1, response1.content().toString(UTF_8)); TextWebSocketFrame message2 = channel.readInbound(); assertEquals(text2, message2.text()); assertNull(channel.readInbound()); assertNull(channel.readOutbound()); channel.read(); TextWebSocketFrame message3 = channel.readInbound(); assertEquals(text3, message3.text()); assertNull(channel.readInbound()); assertNull(channel.readOutbound()); response1.release(); message2.release(); message3.release(); assertFalse(channel.finish()); }
Source:
<code>public void testLocationIndex() { final double small = 5e-7; final double big = 2e-6; locationIndexCase(makeList(), new LatLng(0, 0), -1); locationIndexCase(makeList(1, 2), new LatLng(1, 2), 0); locationIndexCase(makeList(1, 2), new LatLng(3, 5), -1); locationIndexCase(makeList(1, 2, 3, 5), new LatLng(1, 2), 0); <START> locationIndexCase(makeList(1, 2, 3, 5), new LatLng(3, 5), 1); <END> locationIndexCase(makeList(1, 2, 3, 5), new LatLng(4, 6), -1); locationIndexCase(makeList(0, 90-small, 0, 90, 0, 90+small), new LatLng(0, 90), 0); locationIndexCase(makeList(0, 90-big, 0, 90, 0, 90+big), new LatLng(0, 90), 1); locationIndexCase(makeList(0, 90-small, 0, 90, 0, 90+small), new LatLng(0, 90+big), -1); }</code><technical_language>a return of 0, (3,5) is considered part of segment [(1,2), (3,5)]. 1 get is a side-effect of current implem, considers [(1,2), (1,2)] segment0 [(1,2), (3,5)] segment1</technical_language>

Target:
public void testLocationIndex() { locationIndexCase(makeList(), new LatLng(0, 0), -1); locationIndexCase(makeList(1, 2), new LatLng(1, 2), 0); locationIndexCase(makeList(1, 2), new LatLng(3, 5), -1); locationIndexCase(makeList(1, 2, 3, 5), new LatLng(1, 2), 0); locationIndexCase(makeList(1, 2, 3, 5), new LatLng(3, 5), 0); locationIndexCase(makeList(1, 2, 3, 5), new LatLng(4, 6), -1); locationIndexCase(makeList(0, 80, 0, 90, 0, 100), new LatLng(0, 80), 0); locationIndexCase(makeList(0, 80, 0, 90, 0, 100), new LatLng(0, 85), 0); locationIndexCase(makeList(0, 80, 0, 90, 0, 100), new LatLng(0, 90), 0); locationIndexCase(makeList(0, 80, 0, 90, 0, 100), new LatLng(0, 95), 1); locationIndexCase(makeList(0, 80, 0, 90, 0, 100), new LatLng(0, 100), 1); locationIndexCase(makeList(0, 80, 0, 90, 0, 100), new LatLng(0, 110), -1); }
Source:
<code>public String extractScoreTypeFqn( final DataObject dataObject, final Path dataObjectPath ) { String superClassName = dataObject.getSuperClassName(); <START> if ( superClassName.matches( "(\\w+\\.)*AbstractSolution<(\\w+\\.)*\\w+>" ) ) { <END> String scoreType = superClassName.substring( superClassName.indexOf( "<" ) + 1, superClassName.lastIndexOf( ">" ) ); final String scoreTypeFqn; if ( scoreType.contains( "." ) ) { scoreTypeFqn = scoreType; } else { KieProject kieProject = kieProjectService.resolveProject( dataObjectPath ); Set<String> imports = dataObject.getImports().stream().map( i -> i.getName() ).collect( Collectors.toSet() ); ClassLoader projectClassLoader = classLoaderHelper.getProjectClassLoader( kieProject ); ClassTypeResolver classTypeResolver = new ClassTypeResolver( imports, projectClassLoader ); try { scoreTypeFqn = classTypeResolver.getFullTypeName( scoreType ); } catch ( ClassNotFoundException e ) { return null; } } return scoreTypeFqn; } return null; }</code><technical_language>Ouch.. is this identify opta-planner Score holder</technical_language>

Target:
public String extractScoreTypeFqn( final DataObject dataObject, final Path dataObjectPath ) { Matcher matcher = ABSTRACT_SOLUTION_PATTERN.matcher( dataObject.getSuperClassName() ); if ( matcher.matches() ) { String scoreType = matcher.group( 1 ); final String scoreTypeFqn; if ( scoreType.contains( "." ) ) { scoreTypeFqn = scoreType; } else { KieProject kieProject = kieProjectService.resolveProject( dataObjectPath ); Set<String> imports = dataObject.getImports().stream().map( i -> i.getName() ).collect( Collectors.toSet() ); ClassLoader projectClassLoader = classLoaderHelper.getProjectClassLoader( kieProject ); ClassTypeResolver classTypeResolver = new ClassTypeResolver( imports, projectClassLoader ); try { scoreTypeFqn = classTypeResolver.getFullTypeName( scoreType ); } catch ( ClassNotFoundException e ) { return null; } } return scoreTypeFqn; } return null; }
Source:
<code>void writeFileDirectories() throws Exception { metaData.setDefaultFileDirectory("\\Literature\\"); metaData.setUserFileDirectory("defaultOwner-user", "D:\\Documents"); metaData.setLaTexFileDirectory("defaultOwner-user", "D:\\Documents"); databaseWriter.savePartOfDatabase(bibtexContext, Collections.emptyList()); assertEquals(OS.NEWLINE + "@Comment{jabref-meta: fileDirectory:\\\\Literature\\\\;}" + OS.NEWLINE + OS.NEWLINE + "@Comment{jabref-meta: fileDirectory-defaultOwner-user:D:\\\\Documents;}" <START> + OS.NEWLINE + OS.NEWLINE + "@Comment{jabref-meta: fileDirectoryldefaultOwner-user:D:\\\\Documents;}" + OS.NEWLINE, stringWriter.toString()); <END> }</code><technical_language>nit-picking here, please a test path (e.g. D:\\Latex). test pass serializing wrong path. remark applies other tests too</technical_language>

Target:
void writeFileDirectories() throws Exception { metaData.setDefaultFileDirectory("\\Literature\\"); metaData.setUserFileDirectory("defaultOwner-user", "D:\\Documents"); metaData.setLaTexFileDirectory("defaultOwner-user", Paths.get("D:\\Latex")); databaseWriter.savePartOfDatabase(bibtexContext, Collections.emptyList()); assertEquals(OS.NEWLINE + "@Comment{jabref-meta: fileDirectory:\\\\Literature\\\\;}" + OS.NEWLINE + OS.NEWLINE + "@Comment{jabref-meta: fileDirectory-defaultOwner-user:D:\\\\Documents;}" + OS.NEWLINE + OS.NEWLINE + "@Comment{jabref-meta: fileDirectoryLatex-defaultOwner-user:D:\\\\Latex;}" + OS.NEWLINE, stringWriter.toString()); }
Source:
<code><START> private String extractString(QueryMetadata metadata) throws Exception { <END> FluoQueryStringBuilder builder = new FluoQueryStringBuilder(); return builder.setQueryId(metadata.getNodeId()).setQueryType(metadata.getQueryType()) .setExportStrategies(metadata.getExportStrategies()).setQuery(metadata.getSparql()).build(); }</code><technical_language>static</technical_language>

Target:
private static String extractString(QueryMetadata metadata) throws Exception { FluoQueryStringBuilder builder = new FluoQueryStringBuilder(); return builder.setQueryId(metadata.getNodeId()).setQueryType(metadata.getQueryType()) .setExportStrategies(metadata.getExportStrategies()).setQuery(metadata.getSparql()).build(); }
Source:
<code>public ClosableIterator<Tuple> executeBackendQuery(BackendQuery<InfinispanRemoteQueryDescriptor> backendQuery, QueryParameters queryParameters) { InfinispanRemoteQueryDescriptor queryDescriptor = backendQuery.getQuery(); RemoteCache<ProtostreamId, ProtostreamPayload> cache = provider.getCache( queryDescriptor.getCache() ); QueryFactory queryFactory = Search.getQueryFactory( cache ); Query query = queryFactory.create( queryDescriptor.getText() ); <START> applyNamedParamters( queryParameters, query ); <END> applyRowSelection( queryParameters, query ); boolean hasProjection = !queryDescriptor.getProjections().isEmpty(); EntityKeyMetadata entityKeyMetadata = backendQuery.getSingleEntityMetadataInformationOrNull() == null ? null : backendQuery.getSingleEntityMetadataInformationOrNull().getEntityKeyMetadata(); if ( hasProjection && entityKeyMetadata != null ) { throw log.addEntityNotAllowedInNativeQueriesUsingProjection( entityKeyMetadata.getTable(), backendQuery.toString() ); } return hasProjection ? new RawTypeClosableIterator( query.list(), queryDescriptor.getProjections() ) : new ProtostreamPayloadClosableIterator( query.list() ); }</code><technical_language>applyNamedParameters</technical_language>

Target:
public ClosableIterator<Tuple> executeBackendQuery(BackendQuery<InfinispanRemoteQueryDescriptor> backendQuery, QueryParameters queryParameters) { InfinispanRemoteQueryDescriptor queryDescriptor = backendQuery.getQuery(); RemoteCache<ProtostreamId, ProtostreamPayload> cache = provider.getCache( queryDescriptor.getCache() ); QueryFactory queryFactory = Search.getQueryFactory( cache ); Query query = queryFactory.create( queryDescriptor.getText() ); applyNamedParameters( queryParameters, query ); applyRowSelection( queryParameters, query ); boolean hasProjection = !queryDescriptor.getProjections().isEmpty(); EntityKeyMetadata entityKeyMetadata = backendQuery.getSingleEntityMetadataInformationOrNull() == null ? null : backendQuery.getSingleEntityMetadataInformationOrNull().getEntityKeyMetadata(); if ( hasProjection && entityKeyMetadata != null ) { throw log.addEntityNotAllowedInNativeQueriesUsingProjection( entityKeyMetadata.getTable(), backendQuery.toString() ); } return hasProjection ? new RawTypeClosableIterator( query.list(), queryDescriptor.getProjections() ) : new ProtostreamPayloadClosableIterator( query.list() ); }
Source:
<code>public static SWTBotShell openPreferences(SWTBot bot) { if (SWTUtils.isMac()) { try { bot.activeShell().pressShortcut(KeyStroke.getInstance(IKeyLookup.COMMAND_NAME + "+"), KeyStroke.getInstance(",")); } catch (ParseException e) { fail(); } } else { <START> bot.menu("Window").menu("Preferences").click(); <END> } bot.waitUntil(Conditions.shellIsActive("Preferences")); return bot.activeShell(); }</code><technical_language>extract constants please</technical_language>

Target:
public static SWTBotShell openPreferences(SWTBot bot) { if (SWTUtils.isMac()) { try { bot.activeShell().pressShortcut(KeyStroke.getInstance(IKeyLookup.COMMAND_NAME + "+"), KeyStroke.getInstance(",")); } catch (ParseException e) { fail(); } } else { bot.menu(WINDOW_MENU).menu(PREFERENCES_MENU_ITEM).click(); } bot.waitUntil(Conditions.shellIsActive(PREFERENCES_MENU_ITEM)); return bot.activeShell(); }
Source:
<code><START> public void shouldSendEventIfTheUserShouldResetPassword() throws Exception { <END> List<MotechUser> users = prepareMotechUsersOne(); when(settingService.isPasswordResetReminderEnabled()).thenReturn(true); when(allUsers.retrieveAll()).thenReturn(users); eventHandler.handleEvent(event); MotechEvent expectedEvent = prepareExpectedEvent(users.get(1)); verify(allUsers, times(1)).retrieveAll(); verify(eventRelay, times(1)).sendEventMessage(eventCaptor.capture()); verify(settingService, times(1)).isPasswordResetReminderEnabled(); verify(settingService, times(1)).getNumberOfDaysForReminder(); verify(settingService, times(1)).getNumberOfDaysToChangePassword(); assertEquals(expectedEvent, eventCaptor.getValue()); }</code><technical_language>good test more 1 user in tests</technical_language>

Target:
public void shouldSendEventIfTheUserShouldResetPassword() throws Exception { List<MotechUser> users = prepareMotechUsersOne(); when(settingService.isPasswordResetReminderEnabled()).thenReturn(true); when(allUsers.retrieveAll()).thenReturn(users); eventHandler.handleEvent(event); List<MotechEvent> expectedEvent = prepareExpectedEvent(users); verify(allUsers, times(1)).retrieveAll(); verify(eventRelay, times(2)).sendEventMessage(eventCaptor.capture()); verify(settingService, times(1)).isPasswordResetReminderEnabled(); verify(settingService, times(1)).getNumberOfDaysForReminder(); verify(settingService, times(1)).getNumberOfDaysToChangePassword(); assertEquals(expectedEvent, eventCaptor.getAllValues()); }
Source:
<code>public void testUUIDType() throws Exception { Schema fromAvro = Schema.createRecord("myrecord", null, null, false, Arrays.asList(new Schema.Field("uuid", LogicalTypes.uuid().addToSchema(Schema.create(STRING)), null, null))); String parquet = "message myrecord {\n" + " required binary uuid (STRING);\n" + "}\n"; Schema toAvro = Schema.createRecord("myrecord", null, null, false, Arrays.asList(new Schema.Field("uuid", Schema.create(STRING), null, null))); testAvroToParquetConversion(fromAvro, parquet); testParquetToAvroConversion(toAvro, parquet); <START> } <END></code><technical_language>checkReaderWriterCompatibility() verify if parquet avro schema compatible for UUID? issues PARQUET-1681 for avro schema parquet schema conversion for other types</technical_language>

Target:
public void testUUIDType() throws Exception { Schema fromAvro = Schema.createRecord("myrecord", null, null, false, Arrays.asList(new Schema.Field("uuid", LogicalTypes.uuid().addToSchema(Schema.create(STRING)), null, null))); String parquet = "message myrecord {\n" + " required binary uuid (STRING);\n" + "}\n"; Schema toAvro = Schema.createRecord("myrecord", null, null, false, Arrays.asList(new Schema.Field("uuid", Schema.create(STRING), null, null))); testAvroToParquetConversion(fromAvro, parquet); testParquetToAvroConversion(toAvro, parquet); assertEquals(COMPATIBLE, checkReaderWriterCompatibility(fromAvro, toAvro).getType()); }
Source:
<code>public static BillTrade ofYield(TradeInfo info, Bill product, double quantity, double yield) { ArgChecker.isTrue(info.getSettlementDate().isPresent(), <START> "Bill trades from yield need a settlement date."); <END> LocalDate settlementDate = info.getSettlementDate().get(); double price = product.priceFromYield(yield, settlementDate); return BillTrade.builder() .info(info) .product(product) .quantity(quantity) .price(price).build(); }</code><technical_language>full stop end of error message</technical_language>

Target:
public static BillTrade ofYield(TradeInfo info, Bill product, double quantity, double yield) { ArgChecker.isTrue(info.getSettlementDate().isPresent(), "Bill trades from yield need a settlement date"); LocalDate settlementDate = info.getSettlementDate().get(); double price = product.priceFromYield(yield, settlementDate); return BillTrade.builder() .info(info) .product(product) .quantity(quantity) .price(price) .build(); }
Source:
<code>private void performSingleNodeSolrRestore() throws URISyntaxException { String restoreUrl = getReplicationUrl(coreName); try { createSolrCore(); URIBuilder uriBuilder = new URIBuilder(restoreUrl); uriBuilder.addParameter("command", "restore"); if (StringUtils.isNotBlank(backupLocation)) { uriBuilder.addParameter("location", backupLocation); } URI restoreUri = uriBuilder.build(); LOGGER.debug("Sending request to {}", restoreUri); HttpWrapper httpClient = getHttpClient(); processResponse(httpClient.execute(restoreUri)); } catch (IOException | SolrServerException e) { <START> LOGGER.info("Unable to perform single node Solr restore", e); <END> } }</code><technical_language>add core name here</technical_language>

Target:
private void performSingleNodeSolrRestore() throws URISyntaxException { String restoreUrl = getReplicationUrl(coreName); try { createSolrCore(); httpBuilder = new org.codice.solr.factory.impl.HttpClientBuilder(encryptionService); URIBuilder uriBuilder = new URIBuilder(restoreUrl); uriBuilder.addParameter("command", "restore"); if (StringUtils.isNotBlank(backupLocation)) { uriBuilder.addParameter("location", backupLocation); } URI restoreUri = uriBuilder.build(); LOGGER.debug("Sending request to {}", restoreUri); printResponse(sendGetRequest(restoreUri)); } catch (IOException | SolrServerException e) { LOGGER.info("Unable to perform single node Solr restore, core: {}", coreName, e); } }
Source:
<code>public void validate() { assertTrue(!studentEnrollRequests.isEmpty(), ERROR_MESSAGE_EMPTY_ENROLLMENT); <START> assertTrue(studentEnrollRequests.size() <= 100, ERROR_MESSAGE_TOO_MANY_ENROLLMENTS); <END> for (StudentEnrollRequest request : studentEnrollRequests) { request.validate(); } Set<String> emails = new HashSet<>(); for (StudentEnrollRequest request : studentEnrollRequests) { assertTrue(!emails.contains(request.getEmail()), String.format(ERROR_MESSAGE_DUPLICATE_EMAIL, request.getEmail())); emails.add(request.getEmail()); } Map<String, String> teamInSection = new HashMap<>(); for (StudentEnrollRequest request : studentEnrollRequests) { if (teamInSection.containsKey(request.getTeam())) { assertTrue(request.getSection().equals(teamInSection.get(request.getTeam())), String.format(ERROR_MESSAGE_SAME_TEAM_IN_DIFFERENT_SECTION, request.getTeam(), request.getSection(), teamInSection.get(request.getTeam()))); } else { teamInSection.put(request.getTeam(), request.getSection()); } } }</code><technical_language>magic number 100? I is a constant in Const.java</technical_language>

Target:
public void validate() { assertTrue(!studentEnrollRequests.isEmpty(), ERROR_MESSAGE_EMPTY_ENROLLMENT); assertTrue(studentEnrollRequests.size() <= Const.SIZE_LIMIT_PER_ENROLLMENT, ERROR_MESSAGE_TOO_MANY_ENROLLMENTS); for (StudentEnrollRequest request : studentEnrollRequests) { request.validate(); } Set<String> emails = new HashSet<>(); for (StudentEnrollRequest request : studentEnrollRequests) { assertTrue(!emails.contains(request.getEmail()), String.format(ERROR_MESSAGE_DUPLICATE_EMAIL, request.getEmail())); emails.add(request.getEmail()); } }
Source:
<code>public static PoolDto asDto(Pool<? extends Poolable<?, ?>> from) { PoolDto dto = new PoolDto(); dto.setId(from.getId()); dto.setName(from.getName()); dto.setAlias(from.getAlias()); dto.setConcentration(from.getConcentration()); dto.setIdentificationBarcode(from.getIdentificationBarcode()); dto.setReadyToRun(from.getReadyToRun()); dto.setQcPassed(from.getQcPassed()); dto.setCreationDate(from.getCreationDate()); if (from.getLastModified() != null) { dto.setLastModified(getDateAsString(from.getLastModified())); } Set<DilutionDto> pooledElements = new HashSet<DilutionDto>(); for (Dilution ld : from.getDilutions()) { if (ld != null) { pooledElements.add(asDto(ld)); } } dto.setPooledElements(pooledElements); if (!isStringEmptyOrNull(from.getIdentificationBarcode())) { <START> dto.setIdentificationBarcode(from.getIdentificationBarcode()); <END> } dto.setLocationLabel(BoxUtils.makeLocationLabel(from)); return dto; }</code><technical_language>set above, null/empty check</technical_language>

Target:
public static PoolDto asDto(Pool<? extends Poolable<?, ?>> from) { PoolDto dto = new PoolDto(); dto.setId(from.getId()); dto.setName(from.getName()); dto.setAlias(from.getAlias()); dto.setConcentration(from.getConcentration()); dto.setReadyToRun(from.getReadyToRun()); dto.setQcPassed(from.getQcPassed()); dto.setCreationDate(from.getCreationDate()); if (from.getLastModified() != null) { dto.setLastModified(getDateAsString(from.getLastModified())); } Set<DilutionDto> pooledElements = new HashSet<DilutionDto>(); for (Dilution ld : from.getDilutions()) { if (ld != null) { pooledElements.add(asDto(ld)); } } dto.setPooledElements(pooledElements); if (!isStringEmptyOrNull(from.getIdentificationBarcode())) { dto.setIdentificationBarcode(from.getIdentificationBarcode()); } dto.setLocationLabel(BoxUtils.makeLocationLabel(from)); return dto; }
Source:
<code>public RefactoringStatus checkFinalConditions(IProgressMonitor pm, CheckConditionsContext context, IReorgQueries reorgQueries) throws CoreException { Assert.isNotNull(reorgQueries); ResourceChangeChecker checker= context.getChecker(ResourceChangeChecker.class); RefactoringModifications modifications= getModifications(); IResourceChangeDescriptionFactory deltaFactory= checker.getDeltaFactory(); for (IFile <START> allModifiedFile : <END> getAllModifiedFiles()) { deltaFactory.change(allModifiedFile); } if (modifications != null) { modifications.buildDelta(deltaFactory); modifications.buildValidateEdits(context.getChecker(ValidateEditChecker.class)); } return new RefactoringStatus(); }</code><technical_language>rename file modifiedFile</technical_language>

Target:
public RefactoringStatus checkFinalConditions(IProgressMonitor pm, CheckConditionsContext context, IReorgQueries reorgQueries) throws CoreException { Assert.isNotNull(reorgQueries); ResourceChangeChecker checker= context.getChecker(ResourceChangeChecker.class); RefactoringModifications modifications= getModifications(); IResourceChangeDescriptionFactory deltaFactory= checker.getDeltaFactory(); for (IFile file : getAllModifiedFiles()) { deltaFactory.change(file); } if (modifications != null) { modifications.buildDelta(deltaFactory); modifications.buildValidateEdits(context.getChecker(ValidateEditChecker.class)); } return new RefactoringStatus(); }
Source:
<code>private boolean areBricksInTheList(final List<GlusterBrickEntity> bricks, final List<GlusterBrickEntity> searchBricks) { boolean found = false; for (GlusterBrickEntity paramBrick : bricks) { for (GlusterBrickEntity brick : searchBricks) { if (paramBrick.getId().equals(brick.getId()) || (paramBrick.getBrickDirectory().equals(brick.getBrickDirectory()) && paramBrick.getServerId().equals(brick.getServerId()))) { found = true; break; } if (!found) { return found; } <START> found = false; <END> } } return found; }</code><technical_language>reach here, break found=true. Add = false for (GlusterBrickEntity paramBrick : bricks) {</technical_language>

Target:
private boolean areBricksInTheList(final List<GlusterBrickEntity> bricks, final List<GlusterBrickEntity> searchBricks) { boolean found = false; for (GlusterBrickEntity paramBrick : bricks) { found = false; for (GlusterBrickEntity brick : searchBricks) { if ((paramBrick.getId() != null && brick.getId() !=null && paramBrick.getId().equals(brick.getId())) || (paramBrick.getBrickDirectory() != null && brick.getBrickDirectory() != null && paramBrick.getServerId() != null && brick.getServerId() != null && paramBrick.getBrickDirectory().equals(brick.getBrickDirectory()) && paramBrick.getServerId().equals(brick.getServerId()))) { found = true; break; } } } return found; }
Source:
<code>public boolean isNegotiationAuth() { <START> return context.get(ExtensionProperties.AAA_AUTHENTICATION_CAPABILITIES) != null ? (Extension.AAAFlags.AAA_NEGOTIATION_AUTH_FLAG & (int) context.get(ExtensionProperties.AAA_AUTHENTICATION_CAPABILITIES)) == Extension.AAAFlags.AAA_NEGOTIATION_AUTH_FLAG <END> : false; }</code><technical_language>hmmm... this is wrong. Integer capabilities = context.get(capabilities); if (capabilities == null) { return false; } else { return capabilities & Extension.AAAFlags.AAA_NEGOTIATION_AUTH_FLAG != 0; }</technical_language>

Target:
public boolean isNegotiationAuth() { Integer capabilities = (Integer) context.get(ExtensionProperties.AAA_AUTHENTICATION_CAPABILITIES); if (capabilities == null) { return false; } else { return (capabilities & AAA_AUTH_CAP_FLAGS_NEGOTIATING) != 0; } }
Source:
<code>public ISnapshotInfo getSnapshotInfo(String sessionName, IProgressMonitor monitor) throws ExecutionException { <START> return new SnapshotInfo(EMPTY_STRING); <END> }</code><technical_language>This create a new object time method is called. Is this wanted? If store object return (static field)</technical_language>

Target:
public ISnapshotInfo getSnapshotInfo(String sessionName, IProgressMonitor monitor) throws ExecutionException { return null; }
Source:
<code>void hideToolTip () { <START> checkWidget (); <END> if (itemToolTip == null) return; itemToolTip.setVisible (false); }</code><technical_language>For non-public methods checkWidget() is required</technical_language>

Target:
void hideToolTip () { if (itemToolTip == null) return; itemToolTip.setVisible (false); }
Source:
<code>public Artifact makeNewArtifact(IOseeBranch branch, IArtifactType artifactTypeToken, String artifactName, String guid, Long uuid) { ArtifactType artifactType = ArtifactTypeManager.getType(artifactTypeToken); Conditions.checkExpressionFailOnTrue(artifactType.isAbstract(), "Cannot create an instance of abstract type [%s]", artifactType); if (guid == null) { guid = GUID.create(); } else { Conditions.checkExpressionFailOnTrue(!GUID.isValid(guid), "Invalid guid [%s] during artifact creation [name: %s]", guid, artifactName); } Artifact artifact = getArtifactInstance(guid, BranchManager.getBranch(branch), artifactType, false); Integer artId = <START> uuid == null ? ConnectionHandler.getSequence().getNextArtifactId() : new Integer(String.valueOf(uuid)); <END> artifact.setArtId(artId); artifact.meetMinimumAttributeCounts(true); ArtifactCache.cache(artifact); artifact.setLinksLoaded(true); if (Strings.isValid(artifactName)) { artifact.setName(artifactName); } return artifact; }</code><technical_language>Instead of making a string, parsing it, cast long int</technical_language>

Target:
public Artifact makeNewArtifact(IOseeBranch branch, IArtifactType artifactTypeToken, String artifactName, String guid, Long uuid) { ArtifactType artifactType = ArtifactTypeManager.getType(artifactTypeToken); Conditions.checkExpressionFailOnTrue(artifactType.isAbstract(), "Cannot create an instance of abstract type [%s]", artifactType); if (guid == null) { guid = GUID.create(); } else { Conditions.checkExpressionFailOnTrue(!GUID.isValid(guid), "Invalid guid [%s] during artifact creation [name: %s]", guid, artifactName); } Artifact artifact = getArtifactInstance(guid, BranchManager.getBranch(branch), artifactType, false); Integer artId = uuid == null ? ConnectionHandler.getSequence().getNextArtifactId() : uuid.intValue(); artifact.setArtId(artId); artifact.meetMinimumAttributeCounts(true); ArtifactCache.cache(artifact); artifact.setLinksLoaded(true); if (Strings.isValid(artifactName)) { artifact.setName(artifactName); } return artifact; }
Source:
<code>public void render(int mouseX, int mouseY, float partialTicks) { this.modList.render(mouseX, mouseY, partialTicks); if (this.modInfo != null) this.modInfo.render(mouseX, mouseY, partialTicks); String text = I18n.format("fml.menu.mods.search"); <START> int x = getFontRenderer().getStringWidth(text); <END> getFontRenderer().drawString(text, x, modList.getBottom() + 5, 0xFFFFFF); this.search.render(mouseX, mouseY, partialTicks); super.render(mouseX, mouseY, partialTicks); }</code><technical_language>This is correct, change getRight</technical_language>

Target:
public void render(int mouseX, int mouseY, float partialTicks) { this.modList.render(mouseX, mouseY, partialTicks); if (this.modInfo != null) this.modInfo.render(mouseX, mouseY, partialTicks); String text = I18n.format("fml.menu.mods.search"); int x = ((modList.getRight()) / 2) - (getFontRenderer().getStringWidth(text) / 2); getFontRenderer().drawString(text, x, modList.getBottom() + 5, 0xFFFFFF); this.search.render(mouseX, mouseY, partialTicks); super.render(mouseX, mouseY, partialTicks); }
Source:
<code>public InfinispanCodeGenerator(CompilerArgs compArgs, DomainModel domainModel) { super(compArgs, domainModel); <START> if (compArgs.getParams().get(COLLECTION_CLASS_NAME_KEY) == "") { <END> setCollectionToUse("pt.ist.fenixframework.core.adt.bplustree.BPlusTree"); } }</code><technical_language>@nmldiegues this line like: if (compArgs.getParams().get(COLLECTION_CLASS_NAME_KEY) == null) { most: if (compArgs.getParams().get(COLLECTION_CLASS_NAME_KEY) == null || compArgs.getParams().get(COLLECTION_CLASS_NAME_KEY).isEmpty()) {</technical_language>

Target:
public InfinispanCodeGenerator(CompilerArgs compArgs, DomainModel domainModel) { super(compArgs, domainModel); String collectionName = compArgs.getParams().get(COLLECTION_CLASS_NAME_KEY); if (collectionName == null || collectionName.isEmpty()) { setCollectionToUse("pt.ist.fenixframework.core.adt.bplustree.BPlusTree"); } }
Source:
<code>private Mirror createMirror(ArtifactRepository repo, Mirror toMirror) { Mirror mirror = toMirror.clone(); String urlToReplace = toMirror.getMirrorOf(); <START> mirror.setUrl(repo.getUrl().replace(urlToReplace, <END> toMirror.getUrl())); mirror.setId(toMirror.getId() + "_" + repo.getId()); return mirror; }</code><technical_language>happen in real life, this replaces occurrences,</technical_language>

Target:
private Mirror createMirror(ArtifactRepository repo, Mirror toMirror) { Mirror mirror = toMirror.clone(); String urlToReplace = toMirror.getMirrorOf(); String newUrl = StringUtils.replaceOnce(repo.getUrl(), urlToReplace, toMirror.getUrl()); mirror.setUrl(newUrl); mirror.setId(toMirror.getId()); return mirror; }