auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected MatchResult visitPlan(PlanNode node, PlanMatchPattern pattern) { List<PlanMatchingState> states = pattern.shapeMatches(node); if (states.isEmpty()) { return NO_MATCH; } <START> if (sources(node).isEmpty()) { <END> return matchLeaf(node, pattern, states); } MatchResult result = NO_MATCH; for (PlanMatchingState state : states) { MatchResult sourcesMatch = matchSources(node, state); if (!sourcesMatch.isMatch()) { continue; } SymbolAliases allSourceAliases = sourcesMatch.getAliases(); MatchResult matchResult = pattern.detailMatches(node, statsProvider, session, metadata, allSourceAliases); if (matchResult.isMatch()) { checkState(result == NO_MATCH, format("Ambiguous match on node %s", node)); result = match(allSourceAliases.withNewAliases(matchResult.getAliases())); } } return result; }</code><technical_language>undo... lets change visitGroupReference method</technical_language>

Target:
protected MatchResult visitPlan(PlanNode node, PlanMatchPattern pattern) { List<PlanMatchingState> states = pattern.shapeMatches(node); if (states.isEmpty()) { return NO_MATCH; } if (node.getSources().isEmpty()) { return matchLeaf(node, pattern, states); } MatchResult result = NO_MATCH; for (PlanMatchingState state : states) { MatchResult sourcesMatch = matchSources(node, state); if (!sourcesMatch.isMatch()) { continue; } SymbolAliases allSourceAliases = sourcesMatch.getAliases(); MatchResult matchResult = pattern.detailMatches(node, statsProvider, session, metadata, allSourceAliases); if (matchResult.isMatch()) { checkState(result == NO_MATCH, format("Ambiguous match on node %s", node)); result = match(allSourceAliases.withNewAliases(matchResult.getAliases())); } } return result; }
Source:
<code>public void testLoadingMixOfValidAndInvalidPlugins() throws Exception { TestPlugins.assertAvailable(); pluginPath.newFile("invalid.jar"); pluginPath.newFolder("my-plugin"); pluginPath.newFile("my-plugin/invalid.jar"); for (String fullPath : TestPlugins.pluginPath()) { <START> FileUtils.copyFileToDirectory(new File(fullPath), pluginPath.getRoot()); <END> } DelegatingClassLoader classLoader = new DelegatingClassLoader( Collections.singletonList(pluginPath.getRoot().getAbsolutePath())); classLoader.initLoaders(); for (String pluginClassName : TestPlugins.pluginClasses()) { assertNotNull(classLoader.loadClass(pluginClassName)); assertNotNull(classLoader.pluginClassLoader(pluginClassName)); } }</code><technical_language>Great tests. suggest nio (Files.copy Paths), bringing in dependency in org.codehaus.plexus util, is now, is listed explicitly in project dependencies. For simple standard java library stuff in tests</technical_language>

Target:
public void testLoadingMixOfValidAndInvalidPlugins() throws Exception { TestPlugins.assertAvailable(); pluginDir.newFile("invalid.jar"); pluginDir.newFolder("my-plugin"); pluginDir.newFile("my-plugin/invalid.jar"); Path pluginPath = this.pluginDir.getRoot().toPath(); for (String sourceJar : TestPlugins.pluginPath()) { Path source = new File(sourceJar).toPath(); Files.copy(source, pluginPath.resolve(source.getFileName())); } DelegatingClassLoader classLoader = new DelegatingClassLoader( Collections.singletonList(pluginDir.getRoot().getAbsolutePath())); classLoader.initLoaders(); for (String pluginClassName : TestPlugins.pluginClasses()) { assertNotNull(classLoader.loadClass(pluginClassName)); assertNotNull(classLoader.pluginClassLoader(pluginClassName)); } }
Source:
<code>public void handle(GlowSession session, InteractEntityMessage message) { <START> if (message.getAction() != InteractEntityMessage.Action.ATTACK_AT.ordinal()) { <END> return; } final GlowPlayer player = session.getPlayer(); if (player == null) return; final GlowWorld world = player.getWorld(); final GlowEntity entity = world.getEntityManager().getEntity(message.getId()); PlayerInteractEntityEvent event = EventFactory.callEvent(new PlayerInteractEntityEvent(player, entity)); if (!event.isCancelled()) { entity.entityInteract(player, message); } }</code><technical_language>This if statement breaks other behaviour, removing item item frame</technical_language>

Target:
public void handle(GlowSession session, InteractEntityMessage message) { GlowPlayer player = session.getPlayer(); if (player.isDead()) { GlowServer.logger.info("Player " + player.getName() + " tried to interact with an entity while dead"); return; } GlowEntity possibleTarget = player.getWorld().getEntityManager().getEntity(message.getId()); GlowLivingEntity target = possibleTarget instanceof GlowLivingEntity ? (GlowLivingEntity) possibleTarget : null; if (message.getAction() == InteractEntityMessage.Action.ATTACK.ordinal()) { if (target == null) { if (possibleTarget != null) { possibleTarget.entityInteract(player, message); } else { GlowServer.logger.info("Player " + player.getName() + " tried to attack an entity that does not exist"); } } else if (!target.isDead() && target.canTakeDamage(EntityDamageEvent.DamageCause.ENTITY_ATTACK)) { ItemStack hand = player.getItemInHand(); Material type = hand == null ? Material.AIR : hand.getType(); float damage = AttackDamage.getMeleeDamage(type, false); target.damage(damage, player, EntityDamageEvent.DamageCause.ENTITY_ATTACK); short durabilityLoss = AttackDamage.getMeleeDurabilityLoss(type); if (durabilityLoss > 0 && hand != null && player.getGameMode() != GameMode.CREATIVE) { hand.setDurability((short) (hand.getDurability() + durabilityLoss)); } } } else if (message.getAction() == InteractEntityMessage.Action.INTERACT_AT.ordinal()) { } else if (message.getAction() == InteractEntityMessage.Action.INTERACT.ordinal()) { PlayerInteractEntityEvent event = new PlayerInteractEntityEvent(player, possibleTarget); EventFactory.callEvent(event); if (!event.isCancelled()) { possibleTarget.entityInteract(player, message); } } else { GlowServer.logger.info("Player " + player.getName() + " sent unknown interact action: " + message.getAction()); } }
Source:
<code>public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) { if (!(msg instanceof Send)) { ctx.write(msg, promise); return; } Send send = (Send) msg; Http2Headers http2Headers; if (forServer) { logger.trace("Write content to channel as server {}", ctx.channel()); http2Headers = new DefaultHttp2Headers().status(HttpResponseStatus.OK.codeAsText()); } else { logger.trace("Write content to channel as client {}", ctx.channel()); http2Headers = new DefaultHttp2Headers().method(HttpMethod.POST.asciiName()).scheme("https").path("/"); } DefaultHttp2HeadersFrame headersFrame = new DefaultHttp2HeadersFrame(http2Headers, false); ctx.write(headersFrame); ByteBufChannel byteBufChannel = new ByteBufChannel(); try { send.writeTo(byteBufChannel); } catch (IOException e) { promise.setFailure(e); return; } DefaultHttp2DataFrame dataFrame = new DefaultHttp2DataFrame(byteBufChannel.getBuf(), true); <START> ctx.writeAndFlush(dataFrame, promise); <END> }</code><technical_language>I writeAndFlush here, this is a write method, call ctx.write caller do writeAndFlush</technical_language>

Target:
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) { if (!ctx.channel().isOpen()) { logger.debug("Channel closed when write. Channel: {}", ctx.channel()); promise.setFailure(new ChannelException("Channel has been closed when write.")); } if (!(msg instanceof Send)) { ctx.write(msg, promise); return; } Send send = (Send) msg; Http2Headers http2Headers; if (forServer) { logger.trace("Write content to channel as server {}", ctx.channel()); http2Headers = new DefaultHttp2Headers().status(HttpResponseStatus.OK.codeAsText()); } else { logger.trace("Write content to channel as client {}", ctx.channel()); http2Headers = new DefaultHttp2Headers().method(HttpMethod.POST.asciiName()).scheme("https").path("/"); } DefaultHttp2HeadersFrame headersFrame = new DefaultHttp2HeadersFrame(http2Headers, false); ctx.write(headersFrame); ByteBufChannel byteBufChannel = new ByteBufChannel(); try { send.writeTo(byteBufChannel); } catch (IOException e) { promise.setFailure(e); return; } DefaultHttp2DataFrame dataFrame = new DefaultHttp2DataFrame(byteBufChannel.getBuf(), true); ctx.write(dataFrame, promise); }
Source:
<code>protected void refresh() { <START> long startTime = System.currentTimeMillis(); <END> cacheRefreshTimer.record(new Runnable() { public void run() { allItemsCache.set(fetchAllItems(allItemsCache.get())); } }); long endTime = System.currentTimeMillis(); log.debug("Refreshed (" + (endTime - startTime) + "ms)"); }</code><technical_language>switch nanoTime for elapsed time (monotonic clock)</technical_language>

Target:
protected void refresh() { long startTime = System.nanoTime(); allItemsCache.set(fetchAllItems(allItemsCache.get())); long elapsed = System.nanoTime() - startTime; registry.timer("storageServiceSupport.cacheRefreshTime", "objectType", objectType.name()) .record(elapsed, TimeUnit.NANOSECONDS); log.debug("Refreshed (" + TimeUnit.NANOSECONDS.toMillis(elapsed) + "ms)"); }
Source:
<code>public void testToMapWithNull() throws Exception { Map<?, ?> entries = PROPERTIES_LOADER.toMap(null); <START> Assert.assertEquals("Returns an empty map", Collections.emptyMap(), entries); <END> }</code><technical_language>Note message parameters assertion functions error messages displayed test failure. I do "Returns empty map" is descriptive enough assist troubleshooting. like: format("Expected returned map empty, %s", entries.toString()) assertThat Hamcrest matchers, this assertion longer needs a call Collections.emptyMap() test conditions communicated. assertThat(entries, is(empty())); more concise! readable</technical_language>

Target:
public void testToMapWithNull() throws Exception { Map<?, ?> entries = PROPERTIES_LOADER.toMap(null); assertThat(entries.entrySet(), is(empty())); }
Source:
<code>public JdbcEnvironmentRepository(JdbcTemplate jdbc, JdbcEnvironmentProperties properties) { this.jdbc = jdbc; <START> if (properties != null) { <END> this.order = properties.getOrder() == null ? this.order : properties.getOrder(); this.sql = properties.getSql() == null ? this.sql : properties.getSql(); } }</code><technical_language>in general assume null</technical_language>

Target:
public JdbcEnvironmentRepository(JdbcTemplate jdbc, JdbcEnvironmentProperties properties) { this.jdbc = jdbc; this.order = properties.getOrder(); this.sql = properties.getSql(); }
Source:
<code>private void setupPlaybackSpeedPreference() { ListPreference feedPlaybackSpeedPreference = (ListPreference) findPreference(PREF_FEED_PLAYBACK_SPEED); String[] speeds = UserPreferences.getPlaybackSpeedArray(); String[] values = new String[speeds.length + 1]; values[0] = "global"; String[] entries = new String[speeds.length + 1]; entries[0] = getString(R.string.feed_auto_download_global); for (int i = 0; i < speeds.length; i++) { values[i + 1] = speeds[i]; <START> entries[i + 1] = speeds[i]; <END> } feedPlaybackSpeedPreference.setEntryValues(values); feedPlaybackSpeedPreference.setEntries(entries); feedPlaybackSpeedPreference.setOnPreferenceChangeListener((preference, newValue) -> { feedPreferences.setFeedPlaybackSpeed((String) newValue); feed.savePreferences(); updatePlaybackSpeedPreference(); return false; }); }</code><technical_language>easier understand more efficient if system provided arraycopy function</technical_language>

Target:
private void setupPlaybackSpeedPreference() { ListPreference feedPlaybackSpeedPreference = findPreference(PREF_FEED_PLAYBACK_SPEED); String[] speeds = UserPreferences.getPlaybackSpeedArray(); String[] values = new String[speeds.length + 1]; values[0] = decimalFormat.format(SPEED_USE_GLOBAL); String[] entries = new String[speeds.length + 1]; entries[0] = getString(R.string.feed_auto_download_global); System.arraycopy(speeds, 0, values, 1, speeds.length); System.arraycopy(speeds, 0, entries, 1, speeds.length); feedPlaybackSpeedPreference.setEntryValues(values); feedPlaybackSpeedPreference.setEntries(entries); feedPlaybackSpeedPreference.setOnPreferenceChangeListener((preference, newValue) -> { feedPreferences.setFeedPlaybackSpeed(Float.parseFloat((String) newValue)); feed.savePreferences(); updatePlaybackSpeedPreference(); return false; }); }
Source:
<code>private boolean isDrop(TcpDiscoveryAbstractMessage msg) { if (!drop) { if (msg instanceof TcpDiscoveryNodeAddFinishedMessage) { TcpDiscoveryNodeAddFinishedMessage finishMsg = (TcpDiscoveryNodeAddFinishedMessage)msg; if ((finishMsg.nodeId().getLeastSignificantBits() & 0xFFFF) == dropNodeIdx) { drop = true; dropLatch.countDown(); } } } <START> if (drop && msg != null) <END> ignite.log().info(">> Drop message " + msg); return drop; }</code><technical_language>@aleksey-kurinov , here. Try removing FailingDiscoverySpi.writeToSocket(Socket sock, TcpDiscoveryAbstractMessage msg, byte[] data, long timeout ). Onve do it, need this change. I right</technical_language>

Target:
private boolean isDrop(TcpDiscoveryAbstractMessage msg) { if (!drop) { if (msg instanceof TcpDiscoveryNodeAddFinishedMessage) { TcpDiscoveryNodeAddFinishedMessage finishMsg = (TcpDiscoveryNodeAddFinishedMessage)msg; if ((finishMsg.nodeId().getLeastSignificantBits() & 0xFFFF) == dropNodeIdx) { drop = true; dropLatch.countDown(); } } } if (drop) ignite.log().info(">> Drop message " + msg); return drop; }
Source:
<code>public void testLoadOrderedPublicEvents_11() throws Throwable { UserDetails user = new OAuth2TestUtils.UserBuilder("jack_bauer", "0x24") .withAuthorization(Group.FREE_GROUP_NAME, "tempRole", Permission.BACKOFFICE).build(); String accessToken = mockOAuthInterceptor(user); ResultActions result = mockMvc .perform(get("/plugins/cms/contents") .param("status", IContentService.STATUS_ONLINE) .param("sort", IContentManager.CONTENT_CREATION_DATE_FILTER_KEY) .param("direction", FieldSearchFilter.DESC_ORDER) .param("filters[0].attribute", IContentManager.ENTITY_TYPE_CODE_FILTER_KEY) .param("filters[0].operator", "eq") .param("filters[0].value", "EVN") .sessionAttr("user", user) .header("Authorization", "Bearer " + accessToken)); <START> String bodyResult = result.andReturn().getResponse().getContentAsString(); result.andExpect(status().isOk()); String[] expectedFreeContentsId = {"EVN21", "EVN25", "EVN24", "EVN23", "EVN20", "EVN194", "EVN193", "EVN192", "EVN191"}; int payloadSize = JsonPath.read(bodyResult, "$.payload.size()"); Assert.assertEquals(expectedFreeContentsId.length, payloadSize); for (int i = 0; i < expectedFreeContentsId.length; i++) { String expectedId = expectedFreeContentsId[i]; String extractedId = JsonPath.read(bodyResult, "$.payload[" + i + "].id"); Assert.assertEquals(expectedId, extractedId); } <END> }</code><technical_language>Code style</technical_language>

Target:
public void testLoadOrderedPublicEvents_11() throws Throwable { UserDetails user = new OAuth2TestUtils.UserBuilder("jack_bauer", "0x24") .withAuthorization(Group.FREE_GROUP_NAME, "tempRole", Permission.BACKOFFICE).build(); String accessToken = mockOAuthInterceptor(user); ResultActions result = mockMvc .perform(get("/plugins/cms/contents") .param("status", IContentService.STATUS_ONLINE) .param("sort", IContentManager.CONTENT_CREATION_DATE_FILTER_KEY) .param("direction", FieldSearchFilter.DESC_ORDER) .param("filters[0].attribute", IContentManager.ENTITY_TYPE_CODE_FILTER_KEY) .param("filters[0].operator", "eq") .param("filters[0].value", "EVN") .sessionAttr("user", user) .header("Authorization", "Bearer " + accessToken)); result.andDo(print()) .andExpect(status().isOk()) .andExpect(jsonPath("$.payload.size()", is(9))) .andExpect(jsonPath("$.payload[0].id", is("EVN21"))) .andExpect(jsonPath("$.payload[1].id", is("EVN25"))) .andExpect(jsonPath("$.payload[2].id", is("EVN24"))) .andExpect(jsonPath("$.payload[3].id", is("EVN23"))) .andExpect(jsonPath("$.payload[4].id", is("EVN20"))) .andExpect(jsonPath("$.payload[5].id", is("EVN194"))) .andExpect(jsonPath("$.payload[6].id", is("EVN193"))) .andExpect(jsonPath("$.payload[7].id", is("EVN192"))) .andExpect(jsonPath("$.payload[8].id", is("EVN191"))); }
Source:
<code>protected void paintLine(int line, int y, int lineheight, GC gc, Display display) { int widgetLine= JFaceTextUtil.modelLineToWidgetLine(fCachedTextViewer, line); String s= createDisplayString(line); <START> if (s.length() == 0) { return; } <END> int indentation= fIndentation[s.length()]; int baselineBias= getBaselineBias(gc, widgetLine); gc.drawString(s, indentation, y + baselineBias, true); }</code><technical_language>this change</technical_language>

Target:
protected void paintLine(int line, int y, int lineheight, GC gc, Display display) { int widgetLine= JFaceTextUtil.modelLineToWidgetLine(fCachedTextViewer, line); String s= createDisplayString(line); int indentation= fIndentation[s.length()]; int baselineBias= getBaselineBias(gc, widgetLine); gc.drawString(s, indentation, y + baselineBias, true); }
Source:
<code>private IndexClient() { try { if (ElasticSearchClient.getClient() == null) { ElasticSearchClient.init(); } } catch (IOException e) { <START> e.printStackTrace(); <END> } this.client = ElasticSearchClient.getClient(); }</code><technical_language>log</technical_language>

Target:
private IndexClient() { try { if (ElasticSearchClient.getClient() == null) { ElasticSearchClient.init(); } } catch (IOException e) { logError(e) .addMessage("Caught exception initialising Elasticsearch client") .log(); throw new RuntimeException(e); } this.client = ElasticSearchClient.getClient(); }
Source:
<code>public void seek(LogOffset offset) { log.debug("Seek to: " + offset + " from tailer: " + id); TopicPartition topicPartition = new TopicPartition(prefix + offset.partition().name(), offset.partition().partition()); consumer.seek(topicPartition, offset.offset()); lastOffsets.remove(topicPartition); List<ConsumerRecord<String, Bytes>> toRemove = records.stream().filter(rec -> rec.partition() == topicPartition.partition()).collect(Collectors.toList()); <START> toRemove.forEach(records::remove); <END> }</code><technical_language>instead records.removeIf(rec -> rec.partition() == topicPartition.partition()) put topicPartition.partition() in a local variable first</technical_language>

Target:
public void seek(LogOffset offset) { log.debug("Seek to: " + offset + " from tailer: " + id); TopicPartition topicPartition = new TopicPartition(prefix + offset.partition().name(), offset.partition().partition()); consumer.seek(topicPartition, offset.offset()); lastOffsets.remove(topicPartition); int partition = topicPartition.partition(); records.removeIf(rec -> rec.partition() == partition); }
Source:
<code>private ImmutableList<Ds3Property> toDs3Properties() { final ImmutableList.Builder<Ds3Property> ds3PropertyBuilder = ImmutableList.builder(); <START> for (Property property : properties) { <END> ds3PropertyBuilder.add(property.toDs3Property()); } return ds3PropertyBuilder.build(); }</code><technical_language>Missing final</technical_language>

Target:
private ImmutableList<Ds3Property> toDs3Properties() { final ImmutableList.Builder<Ds3Property> ds3PropertyBuilder = ImmutableList.builder(); for (final Property property : properties) { ds3PropertyBuilder.add(property.toDs3Property()); } return ds3PropertyBuilder.build(); }
Source:
<code>AwsCredentialSource(Map<String, Object> credentialSourceMap) { super(credentialSourceMap); <START> this.regionUrl = (String) checkNotNull(credentialSourceMap.get("region_url")); <END> this.url = (String) checkNotNull(credentialSourceMap.get("url")); this.regionalCredentialVerificationUrl = (String) checkNotNull(credentialSourceMap.get("regional_cred_verification_url")); }</code><technical_language>NullPointerException right if problem is element is missing. IllegalArgumentException that</technical_language>

Target:
AwsCredentialSource(Map<String, Object> credentialSourceMap) { super(credentialSourceMap); if (!credentialSourceMap.containsKey("region_url")) { throw new IllegalArgumentException( "A region_url representing the targeted region must be specified."); } if (!credentialSourceMap.containsKey("url")) { throw new IllegalArgumentException( "A url representing the metadata server endpoint must be specified."); } if (!credentialSourceMap.containsKey("regional_cred_verification_url")) { throw new IllegalArgumentException( "A regional_cred_verification_url representing the" + " GetCallerIdentity action URL must be specified."); } this.regionUrl = (String) credentialSourceMap.get("region_url"); this.url = (String) credentialSourceMap.get("url"); this.regionalCredentialVerificationUrl = (String) credentialSourceMap.get("regional_cred_verification_url"); }
Source:
<code>public void validate(final PreparedUpdate update, final UpdateContext updateContext) { final RpslObject updatedObject = update.getUpdatedObject(); if (updatedObject == null) { return; } final Optional<CIString> prefix = getPrefix(updatedObject); <START> if (prefix.isPresent() && isBogon(prefix.get().toString())) { <END> updateContext.addMessage(update, UpdateMessages.bogonPrefixNotAllowed(prefix.get().toString())); } }</code><technical_language>use: prefix.ifPresent(prefix -> if (isBogon(prefix.toString())) ..</technical_language>

Target:
public void validate(final PreparedUpdate update, final UpdateContext updateContext) { final RpslObject updatedObject = update.getUpdatedObject(); if (updatedObject == null) { return; } getPrefix(updatedObject).ifPresent(prefix -> { if (isBogon(prefix.toString())) { updateContext.addMessage(update, UpdateMessages.bogonPrefixNotAllowed(prefix.toString())); } }); }
Source:
<code>public void aRetrieveConfigurationRequestForOBISCodeIsReceivedAsPartOfABundledRequest(final int obisCodeA, final int obisCodeB, final int obisCodeC, final int obisCodeD, final int obisCodeE, final int obisCodeF) throws Throwable { this.setDeviceAndOrganisationProperties(); PROPERTIES_MAP.put("ObisCodeA", Integer.toString(obisCodeA)); PROPERTIES_MAP.put("ObisCodeB", Integer.toString(obisCodeB)); PROPERTIES_MAP.put("ObisCodeC", Integer.toString(obisCodeC)); PROPERTIES_MAP.put("ObisCodeD", Integer.toString(obisCodeD)); PROPERTIES_MAP.put("ObisCodeE", Integer.toString(obisCodeE)); PROPERTIES_MAP.put("ObisCodeF", Integer.toString(obisCodeF)); <START> this.RequestRunner(PROPERTIES_MAP, TEST_CASE_NAME_REQUEST, "501 Retrieve specific configuration object bundle", <END> TEST_SUITE_XML); }</code><technical_language>I suggest put "501 Retrieve specific configuration object bundle" in a parameter following: private static final String TEST_CASE_XML_501 = "501 Retrieve specific configuration object bundle";</technical_language>

Target:
public void aRetrieveConfigurationRequestForOBISCodeIsReceivedAsPartOfABundledRequest(final int obisCodeA, final int obisCodeB, final int obisCodeC, final int obisCodeD, final int obisCodeE, final int obisCodeF) throws Throwable { this.setDeviceAndOrganisationProperties(); PROPERTIES_MAP.put("ObisCodeA", Integer.toString(obisCodeA)); PROPERTIES_MAP.put("ObisCodeB", Integer.toString(obisCodeB)); PROPERTIES_MAP.put("ObisCodeC", Integer.toString(obisCodeC)); PROPERTIES_MAP.put("ObisCodeD", Integer.toString(obisCodeD)); PROPERTIES_MAP.put("ObisCodeE", Integer.toString(obisCodeE)); PROPERTIES_MAP.put("ObisCodeF", Integer.toString(obisCodeF)); this.RequestRunner(PROPERTIES_MAP, TEST_CASE_NAME_REQUEST, TEST_CASE_XML_501, TEST_SUITE_XML); }
Source:
<code><START> public String toString() { <END> try { return "TypedString[" + new String(getBytes(), "UTF-8") + "]"; } catch (UnsupportedEncodingException e) { throw new AssertionError("Must be able to decode UTF-8"); } }</code><technical_language>@Override</technical_language>

Target:
@Override public String toString() { try { return "TypedString[" + new String(getBytes(), "UTF-8") + "]"; } catch (UnsupportedEncodingException e) { throw new AssertionError("Must be able to decode UTF-8"); } }
Source:
<code>protected BulkCommand readEntity(JsonNode jn) throws IOException { Function<String, String> getter = fieldName -> jn.get(fieldName).asText(); Map<String, Serializable> params = emptyMap(); if (jn.has(COMMAND_PARAMS)) { <START> params = BulkParameters.paramsToMap(new ObjectMapper().writeValueAsString(jn.get(COMMAND_PARAMS))); <END> } return new BulkCommand().withUsername(getter.apply(COMMAND_USERNAME)) .withRepository(getter.apply(COMMAND_REPOSITORY)) .withQuery(getter.apply(COMMAND_QUERY)) .withAction(getter.apply(COMMAND_ACTION)) .withParams(params); }</code><technical_language>create a BulkParameters#paramsToMap(JsonNode) allow serialise deserialise JsonNode</technical_language>

Target:
protected BulkCommand readEntity(JsonNode jn) { Function<String, String> getter = fieldName -> jn.get(fieldName).asText(); Map<String, Serializable> params = emptyMap(); if (jn.has(COMMAND_PARAMS)) { params = BulkParameters.paramsToMap(jn.get(COMMAND_PARAMS)); } return new BulkCommand().withUsername(getter.apply(COMMAND_USERNAME)) .withRepository(getter.apply(COMMAND_REPOSITORY)) .withQuery(getter.apply(COMMAND_QUERY)) .withAction(getter.apply(COMMAND_ACTION)) .withParams(params); }
Source:
<code>public void selectionChanged(SelectionChangedEvent event) { ISelection selection = event.getSelection(); if (selection instanceof IStructuredSelection) { if <START> (event.getSource() != getActivePartSource()) { <END> return; } if (event.getSource().equals(navigator.getCommonViewer())) { IWorkbenchPage page = EclipseUIUtil.getActivePage(); IEditorPart activeEditor = page.getActiveEditor(); if (activeEditor instanceof DialectEditor) { DialectEditor dialectEditor = (DialectEditor) activeEditor; page.bringToTop(dialectEditor); selectRepresentationElements(selection, dialectEditor); } } else { Set<EObject> targets = getTargetsFromSelection((IStructuredSelection) selection); if (!targets.isEmpty()) { Set<Object> currentSelection = getCurrentNavigatorSelection(); if (!targets.equals(currentSelection)) { navigator.selectReveal(new StructuredSelection(targets.toArray())); } } } } }</code><technical_language>replace !(event.getSource().equals(getActivePartSource()) No</technical_language>

Target:
public void selectionChanged(SelectionChangedEvent event) { ISelection selection = event.getSelection(); if (selection instanceof IStructuredSelection) { if (event.getSource() != getActivePartSource()) { return; } if (event.getSource().equals(navigator.getCommonViewer())) { IWorkbenchPage page = EclipseUIUtil.getActivePage(); IEditorPart activeEditor = page.getActiveEditor(); if (activeEditor instanceof DialectEditor) { DialectEditor dialectEditor = (DialectEditor) activeEditor; page.bringToTop(dialectEditor); selectRepresentationElements(selection, dialectEditor); } } else { Set<EObject> targets = getTargetsFromSelection((IStructuredSelection) selection); if (!targets.isEmpty()) { navigator.selectReveal(new StructuredSelection(targets.toArray())); } } } }
Source:
<code>private void updateStatusAndpeerProbeOtherIface(Network glusterNetwork, VDS host, GlusterServerInfo fetchedServerInfo) { if (glusterNetwork == null || host.getStatus() != VDSStatus.Up) { return; } GlusterServer glusterServer = getGlusterServerDao().get(host.getId()); if (glusterServer == null) { return; } if (glusterServer.getPeerStatus() == PeerStatus.DISCONNECTED && fetchedServerInfo.getStatus() == PeerStatus.CONNECTED) { getGlusterServerDao().updatePeerStatus(host.getId(), <START> PeerStatus.DISCONNECTED); <END> } List<VdsNetworkInterface> interfaces = getInterfaceDao().getAllInterfacesForVds(host.getId()); for (VdsNetworkInterface iface : interfaces) { if (glusterNetwork.getName().equals(iface.getNetworkName()) && StringUtils.isNotBlank(iface.getIpv4Address()) && !glusterServer.getKnownAddresses().contains(iface.getIpv4Address())) { VDS upServer = getAlternateUpServerInCluster(host.getClusterId(), host.getId()); if (upServer != null) { boolean peerProbed = glusterPeerProbeAdditionalInterface(upServer.getId(), iface.getIpv4Address()); if (peerProbed) { getGlusterServerDao().addKnownAddress(host.getId(), iface.getIpv4Address()); } } else { log.warn("probe could not be done for server '{}' as no alternate UP server found", host.getHostName()); } } } }</code><technical_language>I need update Connected</technical_language>

Target:
private void updateStatusAndpeerProbeOtherIface(Network glusterNetwork, VDS host, GlusterServerInfo fetchedServerInfo) { if (glusterNetwork == null || host.getStatus() != VDSStatus.Up) { return; } GlusterServer glusterServer = getGlusterServerDao().get(host.getId()); if (glusterServer == null) { return; } if (glusterServer.getPeerStatus() == PeerStatus.DISCONNECTED && fetchedServerInfo.getStatus() == PeerStatus.CONNECTED) { getGlusterServerDao().updatePeerStatus(host.getId(), PeerStatus.CONNECTED); } List<VdsNetworkInterface> interfaces = getInterfaceDao().getAllInterfacesForVds(host.getId()); for (VdsNetworkInterface iface : interfaces) { if (glusterNetwork.getName().equals(iface.getNetworkName()) && StringUtils.isNotBlank(iface.getIpv4Address()) && !glusterServer.getKnownAddresses().contains(iface.getIpv4Address())) { VDS upServer = getAlternateUpServerInCluster(host.getClusterId(), host.getId()); if (upServer != null) { boolean peerProbed = glusterPeerProbeAdditionalInterface(upServer.getId(), iface.getIpv4Address()); if (peerProbed) { getGlusterServerDao().addKnownAddress(host.getId(), iface.getIpv4Address()); } } else { log.warn("probe could not be done for server '{}' as no alternate UP server found", host.getHostName()); } } } }
Source:
<code>public boolean sendLogs(String payload) { if(logCollectionPort == null){ logger.severe("Datadog Log Collection Port is not set properly"); throw new RuntimeException("Datadog Log Collection Port not set properly"); } if(this.ddLogger == null) { boolean status = reinitializeLogger(true); if(!status) { return false; } } try { this.ddLogger.info(payload); <START> if(this.ddLogger.getHandlers().length == 0){ <END> this.ddLogger = null; return false; } Handler handler = this.ddLogger.getHandlers()[0]; DatadogErrorManager errorManager = (DatadogErrorManager)handler.getErrorManager(); if(errorManager.hadReportedIssue()){ reinitializeLogger(true); this.ddLogger.info(previousPayload); previousPayload = payload; return false; } previousPayload = payload; }catch(Exception e){ DatadogUtilities.severe(logger, e, null); reinitialize(true); previousPayload = payload; return false; } return true; }</code><technical_language>Nit: move this if(this.ddLogger == null) line checking health of logger anyway? Thinking out loud: this code is this try block, lose this log line if logger initialized properly. fair</technical_language>

Target:
public boolean sendLogs(String payload) { if(logCollectionPort == null){ logger.severe("Datadog Log Collection Port is not set properly"); return false; } if(this.ddLogger == null) { boolean status = reinitializeLogger(true); if(!status) { return false; } } if(this.ddLogger.getHandlers().length == 0){ this.ddLogger = null; return false; } try { this.ddLogger.info(payload); Handler handler = this.ddLogger.getHandlers()[0]; DatadogErrorManager errorManager = (DatadogErrorManager)handler.getErrorManager(); if(errorManager.hadReportedIssue()){ reinitializeLogger(true); this.ddLogger.info(previousPayload); previousPayload = payload; return false; } previousPayload = payload; }catch(Exception e){ DatadogUtilities.severe(logger, e, null); reinitialize(true); previousPayload = payload; return false; } return true; }
Source:
<code><START> public Hosts list() { <END> ApplicationMode appMode = getCurrent().get(ApplicationMode.class); if (isFiltered()) { if (appMode == ApplicationMode.GlusterOnly) { return mapGlusterOnlyCollection(getBackendCollection(VdcQueryType.GetAllHosts, new VdcQueryParametersBase())); } else { return mapCollection(getBackendCollection(VdcQueryType.GetAllHosts, new VdcQueryParametersBase())); } } else { if (appMode == ApplicationMode.GlusterOnly) { return mapGlusterOnlyCollection(getBackendCollection(SearchType.VDS)); } else { return mapCollection(getBackendCollection(SearchType.VDS)); } } }</code><technical_language>prefer separating list in methods: 1. listall 2. glusteronly return</technical_language>

Target:
public Hosts list() { ApplicationMode appMode = getCurrent().get(ApplicationMode.class); if (appMode == ApplicationMode.GlusterOnly) { return listGlusterOnly(); } else { return listAll(); } }
Source:
<code>public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Avatar avatar = (Avatar) o; return url.equals(avatar.url) && timestamp.equals(avatar.timestamp); <START> <END> }</code><technical_language>Please remove this empty line</technical_language>

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Avatar avatar = (Avatar) o; return url.equals(avatar.url) && timestamp.isEqual(avatar.timestamp); }
Source:
<code>public ASTNode transform(Collection collection) { <START> throw new UnsupportedOperationException(); <END> }</code><technical_language>I need understand some of throw exceptions others turn backend terms</technical_language>

Target:
public ASTNode transform(Collection collection) { throw new UnsupportedOperationException("This method should never be called"); }
Source:
<code><START> private HashSet<String> getAllJarModuleNames(IJavaProject javaProject2) { <END> HashSet<String> autoModules = new HashSet<>(); try { for (IPackageFragmentRoot root : javaProject2.getAllPackageFragmentRoots()) { if (root instanceof JarPackageFragmentRoot) { IModuleDescription desc = ((JarPackageFragmentRoot) root).getAutomaticModuleDescription(); String name = desc != null ? desc.getElementName() : null; if (name != null && name.length() > 0) autoModules.add(name); } } } catch (JavaModelException e) { e.printStackTrace(); } return autoModules; }</code><technical_language>Name implies get module names, including auto non-auto module names, implementation retrieves automodules only. for modules automodules? some-api.jar exposes some.core.api module. return some.api some.core.api module names? returned</technical_language>

Target:
private HashSet<String> getAllJarModuleNames(IJavaProject javaProject2) { HashSet<String> modules = new HashSet<>(); try { for (IPackageFragmentRoot root : javaProject2.getAllPackageFragmentRoots()) { if (root instanceof JarPackageFragmentRoot) { IModuleDescription desc = root.getModuleDescription(); desc = desc == null ? ((JarPackageFragmentRoot) root).getAutomaticModuleDescription() : desc; String name = desc != null ? desc.getElementName() : null; if (name != null && name.length() > 0) modules.add(name); } } } catch (JavaModelException e) { } return modules; }
Source:
<code>public void setUp() throws Exception { now = System.currentTimeMillis(); <START> response = new HttpToolResponse(responseCode, ImmutableMap.of(headerName, ImmutableList.of("myvalue")), body.getBytes(), now-fullLatency, fullLatency/2, fullLatency); <END> }</code><technical_language>Whitespace binary operators, please! (pet peeve)</technical_language>

Target:
public void setUp() throws Exception { now = System.currentTimeMillis(); response = new HttpToolResponse(responseCode, ImmutableMap.of(headerName, ImmutableList.of(headerVal)), body.getBytes(), now-fullLatency, fullLatency / 2, fullLatency); }
Source:
<code>protected SearchResult getFallback() { <START> LOGGER.error("Error during the execution of the command. Falling back to the cache"); <END> return new FallbackViaLDAPServerProblemCommand(cacheKey, getFailedExecutionException()).execute(); }</code><technical_language>log this error level lower, warn? a fallback, a warning if fallback fails error</technical_language>

Target:
protected SearchResult getFallback() { LOGGER.warn("Error during the execution of the command. Falling back to the cache"); return new FallbackViaLDAPServerProblemCommand(cacheKey, getFailedExecutionException()).execute(); }
Source:
<code>private void handleClickWebpackLiveReload(ClickEvent event) { addPageReloadingSpan(); <START> String css = "\nconsole.log('Hello world');"; <END> writeToFrontendJSFile(VaadinService.getCurrent(), css); }</code><technical_language>if raise issues Windows, replace \n %n</technical_language>

Target:
private void handleClickWebpackLiveReload(ClickEvent event) { addPageReloadingSpan(); String js = String.format("%nconsole.log('Hello world');"); writeToFrontendJSFile(VaadinService.getCurrent(), js); }
Source:
<code>private void parseConfiguration(String config) throws IllegalArgumentException { String[] mappings = config.split(","); for (String mapping : mappings) { String[] params = mapping.split(":"); if (params.length < 2) { throw new IllegalArgumentException("Configuration " + mapping + " is in-correctly formed. " + "Format should be <fieldname>:<decompressor-type>"); } String field = params[0]; String type = params[1].toUpperCase(); DecompressorType cType = DecompressorType.NONE; <START> switch(type) { <END> case "SNAPPY": cType = DecompressorType.SNAPPY; break; case "GZIP": cType = DecompressorType.GZIP; break; case "ZIP": cType = DecompressorType.ZIP; break; case "NONE": cType = DecompressorType.NONE; break; default: throw new IllegalArgumentException("Unknown decompressor type " + type + " found in mapping " + mapping); } if (deCompMap.containsKey(field)) { throw new IllegalArgumentException("Field " + field + " already has decompressor set. Check the mapping."); } else { deCompMap.put(field, cType); } } }</code><technical_language>DecompressorType.valueOf(type) instead of this switch case</technical_language>

Target:
private void parseConfiguration(String config) throws IllegalArgumentException { String[] mappings = config.split(","); for (String mapping : mappings) { String[] params = mapping.split(":"); if (params.length < 2) { throw new IllegalArgumentException("Configuration " + mapping + " is in-correctly formed. " + "Format should be <fieldname>:<decompressor-type>"); } String field = params[0]; String type = params[1].toUpperCase(); DecompressorType cType = DecompressorType.valueOf(type); if (deCompMap.containsKey(field)) { throw new IllegalArgumentException("Field " + field + " already has decompressor set. Check the mapping."); } else { deCompMap.put(field, cType); } } }
Source:
<code>private String getDirFromTopic(String dir, String topic, int maxIndexParts) { dir = dir.replace("${topic}", topic); if (topixRegexCaptureGroup != null) { Matcher matcher = topixRegexCaptureGroup.matcher(topic); if (!matcher.matches()) { throw new ConfigException( String.format( "Topic %s does not fully match the specified regex %s in %s", <START> topic, <END> topixRegexCaptureGroup.pattern(), TOPIC_REGEX_CAPTURE_GROUP_CONFIG ) ); } if (maxIndexParts > 0 && maxIndexParts > matcher.groupCount()) { throw new ConfigException( String.format( "Topic %s must have at least %d capture groups using regex pattern %s, " + "but actually had %d capture groups.", topic, maxIndexParts, topixRegexCaptureGroup.pattern(), matcher.groupCount() ) ); } for (int index = 1; index < matcher.groupCount() + 1; index++) { dir = dir.replace("${" + index + "}", matcher.group(index)); } } return dir; }</code><technical_language>provide configuration ConfigException for formatting of error. suggestion throw new ConfigException( TOPIC_REGEX_CAPTURE_GROUP_CONFIG, topixRegexCaptureGroup.pattern(),</technical_language>

Target:
private String getDirFromTopic(String dir, String topic, int maxIndexParts) { dir = dir.replace("${topic}", topic); if (topicRegexCaptureGroup != null) { Matcher matcher = topicRegexCaptureGroup.matcher(topic); if (!matcher.matches()) { throw new ConfigException( TOPIC_CAPTURE_GROUPS_REGEX_CONFIG, topicRegexCaptureGroup.pattern(), String.format("Topic %s does not fully match the specified regex.", topic) ); } if (maxIndexParts > matcher.groupCount()) { throw new ConfigException( String.format( "Topic %s must have at least %d capture groups using regex pattern %s, " + "but actually had %d capture groups.", topic, maxIndexParts, topicRegexCaptureGroup.pattern(), matcher.groupCount() ) ); } for (int index = 0; index < matcher.groupCount() + 1; index++) { dir = dir.replace("${" + index + "}", matcher.group(index)); } } return dir; }
Source:
<code>public void patchRequireCertificateMissingValue() throws Exception { context.turnOffAuthorisationSystem(); EPerson ePerson = EPersonBuilder.createEPerson(context) .withNameInMetadata("John", "Doe") .withEmail("Johndoe@fake-email.com") .build(); List<Operation> ops = new ArrayList<Operation>(); ReplaceOperation replaceOperation = new ReplaceOperation("/certificate", null); ops.add(replaceOperation); String patchBody = getPatchContent(ops); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(patch("/api/eperson/epersons/" + ePerson.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isBadRequest()); <START> <END> }</code><technical_language>check changes occurred</technical_language>

Target:
public void patchRequireCertificateMissingValue() throws Exception { context.turnOffAuthorisationSystem(); EPerson ePerson = EPersonBuilder.createEPerson(context) .withNameInMetadata("John", "Doe") .withEmail("Johndoe@fake-email.com") .build(); String token = getAuthToken(admin.getEmail(), password); List<Operation> ops = new ArrayList<Operation>(); ReplaceOperation replaceOperation = new ReplaceOperation("/certificate", true); ops.add(replaceOperation); String patchBody = getPatchContent(ops); getClient(token).perform(patch("/api/eperson/epersons/" + ePerson.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isOk()) .andExpect(jsonPath("$.requireCertificate", Matchers.is(true)));; List<Operation> ops2 = new ArrayList<Operation>(); ReplaceOperation replaceOperation2 = new ReplaceOperation("/certificate",null); ops2.add(replaceOperation2); patchBody = getPatchContent(ops2); getClient(token).perform(patch("/api/eperson/epersons/" + ePerson.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isBadRequest()); getClient(token).perform(get("/api/eperson/epersons/" + ePerson.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$.requireCertificate", Matchers.is(true))) .andExpect(jsonPath("$.email", Matchers.is("johndoe@fake-email.com"))) .andExpect(jsonPath("$.canLogIn", Matchers.is(false))); }
Source:
<code><START> public void updateTimeRangeSelectionPieChart() { <END> if (getTimeRangePC() == null) { fTimeRangePC = new PieChart(this, SWT.NONE); getTimeRangePC().getTitle().setText(fTimeRangePCname); getTimeRangePC().getAxisSet().getXAxis(0).getTitle().setText(""); getTimeRangePC().getLegend().setPosition(SWT.BOTTOM); getTimeRangePC().getLegend().setVisible(true); getTimeRangePC().addListener(SWT.MouseMove, fMouseListener); } else if (getTimeRangePC().isDisposed()) { return; } updatePieChartWithData(fTimeRangePC, fTimeRangeSelectionEventTypes, MIN_PRECENTAGE_TO_SHOW_SLICE, fOthersSliceName); }</code><technical_language>For this method package visible</technical_language>

Target:
void updateTimeRangeSelectionPieChart() { if (getTimeRangePC() == null) { fTimeRangePC = new PieChart(this, SWT.NONE); getTimeRangePC().getTitle().setText(fTimeRangePCname); getTimeRangePC().getAxisSet().getXAxis(0).getTitle().setText(""); getTimeRangePC().getLegend().setPosition(SWT.BOTTOM); getTimeRangePC().getLegend().setVisible(true); getTimeRangePC().addListener(SWT.MouseMove, fMouseListener); } else if (getTimeRangePC().isDisposed()) { return; } Map<String, Long> totalEventCountForChart = getTotalEventCountForChart(false); if(totalEventCountForChart == null){ return; } updatePieChartWithData(fTimeRangePC, totalEventCountForChart, MIN_PRECENTAGE_TO_SHOW_SLICE, fOthersSliceName); }
Source:
<code>LedgerEntryRequest(ArrayList<BookieSocketAddress> ensemble, long lId, long eId) { this.entryImpl = LedgerEntryImpl.create(lId, eId); this.ensemble = ensemble; if (lh.bk.isReorderReadSequence()) { DistributionSchedule.WriteSet unorderedWriteSet = lh.getDistributionSchedule().getWriteSet(entryId); BookKeeperServerHealthInfo bookKeeperServerHealthInfo = generateHealthInfoForWriteSet( unorderedWriteSet, ensemble, lh ); writeSet = lh.bk.getPlacementPolicy() .reorderReadSequence( ensemble, bookKeeperServerHealthInfo, <START> lh.distributionSchedule.getWriteSet(eid)); <END> } else { writeSet = lh.distributionSchedule.getWriteSet(eId); } }</code><technical_language>eid? I this defined in local scope</technical_language>

Target:
LedgerEntryRequest(ArrayList<BookieSocketAddress> ensemble, long lId, long eId) { this.entryImpl = LedgerEntryImpl.create(lId, eId); this.ensemble = ensemble; this.eId = eId; if (lh.bk.isReorderReadSequence()) { writeSet = lh.bk.getPlacementPolicy() .reorderReadSequence( ensemble, lh.getBookiesHealthInfo(), lh.distributionSchedule.getWriteSet(eId)); } else { writeSet = lh.distributionSchedule.getWriteSet(eId); } }
Source:
<code>public GeoEntry queryById(String id) throws GeoEntryQueryException { SolrQuery solrQuery = new SolrQuery(String.format("id_txt:\"%s\"", ClientUtils.escapeQueryChars(id))); solrQuery.setRows(1); QueryResponse response = null; try { response = client.query(solrQuery, METHOD.POST); } catch (SolrServerException | IOException e) { <START> throw new GeoEntryQueryException("Error while querying", e); <END> } return response .getResults() .stream() .map(this::transformMetacardToGeoEntry) .findFirst() .orElseThrow(() -> new GeoEntryQueryException("Could not find id")); }</code><technical_language>mention a query id. Error while querying ID. Nice sanity check instead of relying fully stacktrace line number. differentiate this exception thrown in other query method</technical_language>

Target:
public GeoEntry queryById(String id) throws GeoEntryQueryException { SolrQuery solrQuery = new SolrQuery(String.format("%s:\"%s\"", ID, ClientUtils.escapeQueryChars(id))); solrQuery.setRows(1); QueryResponse response = null; try { response = client.query(solrQuery, METHOD.POST); } catch (SolrServerException | IOException e) { throw new GeoEntryQueryException("Error while querying by ID", e); } return response .getResults() .stream() .map(this::transformMetacardToGeoEntry) .findFirst() .orElseThrow(() -> new GeoEntryQueryException("Could not find id")); }
Source:
<code><START> protected void setTupleToStringConverter(Converter<Tuple, String> tupleToStringConverter) { <END> this.tupleToStringConverter = tupleToStringConverter; }</code><technical_language>Assert.notNull ensure a simple toString call end a NPE</technical_language>

Target:
protected void setTupleToStringConverter(Converter<Tuple, String> tupleToStringConverter) { Assert.notNull(tupleToStringConverter,"tupleToStringConverter cannot be null"); this.tupleToStringConverter = tupleToStringConverter; }
Source:
<code>public URI getFeatureURI(String id, String version) { SiteFeature[] entries = site.getFeatures(); for (SiteFeature <START> entrie : <END> entries) { if (id.equals(entrie.getFeatureIdentifier()) && version.equals(entrie.getFeatureVersion())) { return getSiteFeatureURI(entrie); } } URI base = getBaseURI(); URI url = getArchiveURI(base, FEATURE_DIR + id + VERSION_SEPARATOR + version + JAR_EXTENSION); if (url != null) return url; return URIUtil.append(base, FEATURE_DIR + id + VERSION_SEPARATOR + version + JAR_EXTENSION); }</code><technical_language>entry</technical_language>

Target:
public URI getFeatureURI(String id, String version) { SiteFeature[] entries = site.getFeatures(); for (SiteFeature entry : entries) { if (id.equals(entry.getFeatureIdentifier()) && version.equals(entry.getFeatureVersion())) { return getSiteFeatureURI(entry); } } URI base = getBaseURI(); URI url = getArchiveURI(base, FEATURE_DIR + id + VERSION_SEPARATOR + version + JAR_EXTENSION); if (url != null) return url; return URIUtil.append(base, FEATURE_DIR + id + VERSION_SEPARATOR + version + JAR_EXTENSION); }