auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void update(CruiseConfig modifiedConfig) throws Exception { SCMs scms = modifiedConfig.getSCMs(); SCM scm = scms.find(globalScmConfig.getSCMId()); if (scm != null) { scm.setAutoUpdate(globalScmConfig.isAutoUpdate()); scm.setConfiguration(globalScmConfig.getConfiguration()); } else { result.notFound(LocalizedMessage.string("SCM_MATERIAL_NOT_FOUND"), HealthStateType.notFound()); throw new NullPointerException("The pluggable SCM Material is not found"); <START> } <END> }</code><technical_language>this check service instead of here? convoluted submit UpdateConfigCommand bubble up</technical_language>

Target:
public void update(CruiseConfig modifiedConfig) throws Exception { SCMs scms = modifiedConfig.getSCMs(); SCM scm = scms.find(globalScmConfig.getSCMId()); if (scm != null) { scm.setAutoUpdate(globalScmConfig.isAutoUpdate()); scm.setConfiguration(globalScmConfig.getConfiguration()); } else { result.notFound(LocalizedMessage.string("SCM_MATERIAL_NOT_FOUND"), HealthStateType.notFound()); throw new NullPointerException(String.format("The pluggable scm material with id '%s' is not found.", globalScmConfig.getSCMId())); } }
Source:
<code>public DiskSpaceRequirements(long segmentSizeInBytes, long segmentsNeeded, long swapSegmentsInUse) { <START> if (segmentSizeInBytes < 0 || segmentsNeeded < 0 || swapSegmentsInUse < 0) { <END> throw new IllegalArgumentException( "Arguments cannot be negative. segmentSizeInBytes: " + segmentSizeInBytes + ", segmentsNeeded: " + segmentsNeeded + ", swapSegmentsInUse: " + swapSegmentsInUse); } this.segmentSizeInBytes = segmentSizeInBytes; this.segmentsNeeded = segmentsNeeded; this.swapSegmentsInUse = swapSegmentsInUse; }</code><technical_language>segmentSizeInBytes <= 0</technical_language>

Target:
DiskSpaceRequirements(long segmentSizeInBytes, long segmentsNeeded, long swapSegmentsInUse) { if (segmentSizeInBytes <= 0 || segmentsNeeded < 0 || swapSegmentsInUse < 0) { throw new IllegalArgumentException( "Arguments cannot be negative. segmentSizeInBytes: " + segmentSizeInBytes + ", segmentsNeeded: " + segmentsNeeded + ", swapSegmentsInUse: " + swapSegmentsInUse); } this.segmentSizeInBytes = segmentSizeInBytes; this.segmentsNeeded = segmentsNeeded; this.swapSegmentsInUse = swapSegmentsInUse; }
Source:
<code>private void userHasLogin() { finish(); <START> startActivity(new Intent(this, MainActivity.class)); <END> }</code><technical_language>call finish() startActivity()</technical_language>

Target:
private void userHasLogin() { startActivity(new Intent(this, MainActivity.class)); finish(); }
Source:
<code>public List<String> tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException { Validate.notNull(sender, "Sender cannot be null", new Object[0]); Validate.notNull(args, "Arguments cannot be null", new Object[0]); Validate.notNull(alias, "Alias cannot be null", new Object[0]); if (args.length == 1) { String arg = args[0]; ArrayList<String> completion = new ArrayList<>(); for (EntityType type : EntityType.values()) { <START> if (!checkSummon(null, type)) { <END> continue; } if (StringUtils.startsWithIgnoreCase(type.getName(), arg)) { completion.add(type.getName()); } } return completion; } else { return ImmutableList.of(); } }</code><technical_language>Combine if statement</technical_language>

Target:
public List<String> tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException { Validate.notNull(sender, "Sender cannot be null", new Object[0]); Validate.notNull(args, "Arguments cannot be null", new Object[0]); Validate.notNull(alias, "Alias cannot be null", new Object[0]); if (args.length == 1) { String arg = args[0]; ArrayList<String> completion = new ArrayList<>(); for (EntityType type : EntityType.values()) { if (checkSummon(null, type) && StringUtils.startsWithIgnoreCase(type.getName(), arg)) { completion.add(type.getName()); } } return completion; } else { return ImmutableList.of(); } }
Source:
<code>private List<InetSocketAddress> parseAddresses(String addressString) { List<InetSocketAddress> addresses = new ArrayList<>(); for (String address : addressString.split(",")) { <START> addresses.add(new InetSocketAddress(address.split(":")[0], Integer.valueOf(address.split(":")[1]))); <END> } return addresses; }</code><technical_language>split do some verification. For example, check 2 parts throw useful error messages if port is a number</technical_language>

Target:
private List<InetSocketAddress> parseAddresses(String addressString) { List<InetSocketAddress> addresses = new ArrayList<>(); Map<String, String> ipPortMap = Splitter.on(",").omitEmptyStrings().trimResults() .withKeyValueSeparator(":").split(addressString); for (Map.Entry<String, String> ipPort : ipPortMap.entrySet()) { int port; try { port = Integer.valueOf(ipPort.getValue()); } catch (NumberFormatException e) { throw new IllegalArgumentException(String.format("Port should be an integer : %s", ipPort.getValue()), e); } addresses.add(new InetSocketAddress(ipPort.getKey(), port)); } return addresses; }
Source:
<code>public void testAsyncCallAllPartitionProcedureWithStringPartition() throws Exception{ Client client = getClient(); client.callAllPartitionProcedure(new CallBack(STRING_PARTITION_EXPECTED_COUNTS), "PartitionStringTestProc"); <START> Thread.sleep(2000); <END> }</code><technical_language>Async test version necessary validate result. "callAllPartitionProcedure" return anything. want ensure "clientCallback" executed</technical_language>

Target:
public void testAsyncCallAllPartitionProcedureWithStringPartition() throws Exception{ Client client = getClient(); CallBack cb = new CallBack(STRING_PARTITION_EXPECTED_COUNTS); client.callAllPartitionProcedure(cb, "PartitionStringTestProc"); Thread.sleep(2000); assertTrue(cb.m_callbackInvoked); }
Source:
<code>public void createRequestContextSubscriberWhenParentContextHasDataHolderThenShouldReuseParentContext() throws Exception { <START> RequestContextDataHolder testValue = mock(RequestContextDataHolder.class); <END> final Context parentContext = Context.of(RequestContextSubscriber.REQUEST_CONTEXT_DATA_HOLDER, testValue); BaseSubscriber<Object> parent = new BaseSubscriber<Object>() { @Override public Context currentContext() { return parentContext; } }; RequestContextSubscriber<Object> requestContextSubscriber = new RequestContextSubscriber<>(parent, null, null, authentication); Context resultContext = requestContextSubscriber.currentContext(); assertThat(resultContext) .describedAs("parent context was replaced") .isSameAs(parentContext); }</code><technical_language>Instead of a mock, set empty RequestContextDataHolder instance</technical_language>

Target:
public void createRequestContextSubscriberWhenParentContextHasDataHolderThenShouldReuseParentContext() throws Exception { RequestContextDataHolder testValue = new RequestContextDataHolder(null, null, null); final Context parentContext = Context.of(RequestContextSubscriber.REQUEST_CONTEXT_DATA_HOLDER, testValue); BaseSubscriber<Object> parent = new BaseSubscriber<Object>() { @Override public Context currentContext() { return parentContext; } }; RequestContextSubscriber<Object> requestContextSubscriber = new RequestContextSubscriber<>(parent, null, null, authentication); Context resultContext = requestContextSubscriber.currentContext(); assertThat(resultContext) .describedAs("parent context was replaced") .isSameAs(parentContext); }
Source:
<code>LRESULT wmTimer (long wParam, long lParam) { <START> checkWidget (); <END> if (wParam == ID_TOOLTIP_TIMER) { POINT pt = new POINT (); OS.GetCursorPos (pt); if (selectedMenuItem != null) { RECT rect = new RECT (); OS.GetMenuItemRect (0, selectedMenuItem.parent.handle, selectedMenuItem.index, rect); if (OS.PtInRect (rect, pt)) { selectedMenuItem.showTooltip (pt.x, pt.y + OS.GetSystemMetrics(OS.SM_CYCURSOR) / 2 + 5); } else { selectedMenuItem.showTooltip ((rect.right + rect.left) / 2, rect.bottom + 5); } } } return null; }</code><technical_language>1. For non-public methods checkWidget() is required. 2. Remove extra tab space line 1656 & 1673</technical_language>

Target:
LRESULT wmTimer (long wParam, long lParam) { if (wParam == ID_TOOLTIP_TIMER) { POINT pt = new POINT (); OS.GetCursorPos (pt); if (selectedMenuItem != null) { RECT rect = new RECT (); OS.GetMenuItemRect (0, selectedMenuItem.parent.handle, selectedMenuItem.index, rect); if (OS.PtInRect (rect, pt)) { selectedMenuItem.showTooltip (pt.x, pt.y + OS.GetSystemMetrics(OS.SM_CYCURSOR) / 2 + 5); } else { selectedMenuItem.showTooltip ((rect.right + rect.left) / 2, rect.bottom + 5); } } } return null; }
Source:
<code>public void tearUp() { IPath path = Activator.getDefault().getStateLocation(); File dir = path.toFile(); if (!dir.exists() || !dir.isDirectory()) { return; } <START> path = path.addTrailingSeparator().append(SESSION_FILENAME).addFileExtension(SessionConfigStrings.DEFAULT_SESSION_CONFIG_FILE_EXTENSION); <END> File sessionConfigurationFile = path.toFile(); if(sessionConfigurationFile.exists()) { sessionConfigurationFile.delete(); } }</code><technical_language>path file put a field, if change it, change below</technical_language>

Target:
public void tearUp() { File sessionConfigurationFile = fSessionFilePath.toFile(); if (sessionConfigurationFile.exists()) { sessionConfigurationFile.delete(); } fValidRequirements.clear(); }
Source:
<code>public Response deleteApplicationMember( @Parameter(name = "user", required = true) @NotNull @QueryParam("user") String userId) { applicationService.findById(application); try { userService.findById(userId); } catch (UserNotFoundException unfe) { return Response.status(Response.Status.BAD_REQUEST).entity(unfe.getMessage()).build(); } membershipService.deleteReferenceMember(MembershipReferenceType.APPLICATION, application, MembershipMemberType.USER, userId); <START> return Response.noContent().build(); <END> }</code><technical_language>right. a breaking change some users, API UI, affected this kind of changes. Please revert</technical_language>

Target:
public Response deleteApplicationMember( @Parameter(name = "user", required = true) @NotNull @QueryParam("user") String userId) { applicationService.findById(application); try { userService.findById(userId); } catch (UserNotFoundException unfe) { return Response.status(Response.Status.BAD_REQUEST).entity(unfe.getMessage()).build(); } membershipService.deleteReferenceMember(MembershipReferenceType.APPLICATION, application, MembershipMemberType.USER, userId); return Response.ok().build(); }
Source:
<code>private static Iterable<String> head(final Response origin, final int status, final CharSequence reason) throws IOException { if (status < 100 || status > 999) { throw new IllegalArgumentException( String.format( "according to RFC 7230 HTTP status code must have three digits: %d", status ) ); } return new Concat<String>( Collections.singleton( String.format("HTTP/1.1 %d %s", status, reason) ), new Concat<String>( origin.head(), <START> Collections.EMPTY_LIST, <END> new Condition<String>() { private boolean first = true; @Override public boolean add(final String element) { final boolean ret = this.first; if (this.first) { this.first = false; } return !ret; } } ) ); }</code><technical_language>@super132 please Collections.emptyList()</technical_language>

Target:
private static Iterable<String> head(final Response origin, final int status, final CharSequence reason) throws IOException { if (status < 100 || status > 999) { throw new IllegalArgumentException( String.format( "according to RFC 7230 HTTP status code must have three digits: %d", status ) ); } return new Concat<String>( Collections.singleton( String.format("HTTP/1.1 %d %s", status, reason) ), new Select<String>( origin.head(), new Condition<String>() { private boolean first = true; @Override public boolean fits(final String element) { final boolean ret = this.first; if (this.first) { this.first = false; } return !ret; } } ) ); }
Source:
<code>public void updateConditionFromEntity(boolean checkForDestruction) { if(null != unit) { if(IArmorState.ARMOR_DESTROYED == unit.getEntity().getInternal(loc)) { remove(false); } else { <START> damage = Math.max(unit.getEntity().getOInternal(loc) - unit.getEntity().getInternal(loc), 0); <END> if(unit.isLocationBreached(loc)) { breached = true; } } } }</code><technical_language>If getInternal(loc) is IArmorState.ARMOR_DESTROYED, damage original internal + 3</technical_language>

Target:
public void updateConditionFromEntity(boolean checkForDestruction) { if(null != unit) { if(IArmorState.ARMOR_DESTROYED == unit.getEntity().getInternal(loc)) { remove(false); } else { int originalInternal = unit.getEntity().getOInternal(loc); int internal = unit.getEntity().getInternal(loc); damage = originalInternal - Math.min(originalInternal, Math.max(internal, 0)); if(unit.isLocationBreached(loc)) { breached = true; } } } }
Source:
<code>public Work<GroupByIdBlock> getGroupIds(Page page) { updateGroupCount(page); <START> BlockBuilder blockBuilder = BIGINT.createFixedSizeBlockBuilder(page.getPositionCount()); <END> for (int i = 0; i < page.getPositionCount(); i++) { blockBuilder.writeLong(0); } return new CompletedWork<>(new GroupByIdBlock(page.getPositionCount() > 0 ? 1 : 0, blockBuilder.build())); }</code><technical_language>RLE block</technical_language>

Target:
public Work<GroupByIdBlock> getGroupIds(Page page) { updateGroupCount(page); return new CompletedWork<>(new GroupByIdBlock(page.getPositionCount() > 0 ? 1 : 0, RunLengthEncodedBlock.create(BIGINT, 0L, page.getPositionCount()))); }
Source:
<code>public static void main(String[] args) throws Exception { CliBuilder<Runnable> builder = Cli.<Runnable>builder("verifier") .withDescription("Presto Verifier") .withDefaultCommand(Help.class) <START> .withCommands(Help.class, VerifyCommand.class); <END> Cli<Runnable> verifierParser = builder.build(); verifierParser.parse(args).run(); }</code><technical_language>I multiple withCommand() cleaner add additional commands</technical_language>

Target:
public static void main(String[] args) throws Exception { Cli<Runnable> verifierParser = Cli.<Runnable>builder("verifier") .withDescription("Presto Verifier") .withDefaultCommand(Help.class) .withCommand(Help.class) .withCommand(VerifyCommand.class) .build(); verifierParser.parse(args).run(); }
Source:
<code>@Override public Result implement(EnumerableRelImplementor implementor, Prefer pref) { <START> if (!(readType == Type.LAZY && writeType == Type.LAZY)) { <END> throw new UnsupportedOperationException( "EnumerableTableSpool supports for the moment only LAZY read and LAZY write"); } BlockBuilder builder = new BlockBuilder(); RelNode input = getInput(); Result inputResult = implementor.visitChild(this, 0, (EnumerableRel) input, pref); Expression tableExp = Expressions.convert_( Expressions.call( Expressions.call( implementor.getRootExpression(), BuiltInMethod.DATA_CONTEXT_GET_ROOT_SCHEMA.method), BuiltInMethod.SCHEMA_GET_TABLE.method, Expressions.constant(tableName, String.class)), ModifiableTable.class); Expression collectionExp = Expressions.call( tableExp, BuiltInMethod.MODIFIABLE_TABLE_GET_MODIFIABLE_COLLECTION.method); Expression inputExp = builder.append("input", inputResult.block); Expression spoolExp = Expressions.call( BuiltInMethod.LAZY_COLLECTION_SPOOL.method, collectionExp, inputExp); builder.add(spoolExp); PhysType physType = PhysTypeImpl.of( implementor.getTypeFactory(), getRowType(), pref.prefer(inputResult.format)); return implementor.result(physType, builder.toBlock()); }</code><technical_language>Rewrite readType != Type.LAZY || writeType != Type.LAZY</technical_language>

Target:
@Override public Result implement(EnumerableRelImplementor implementor, Prefer pref) { if (readType != Type.LAZY || writeType != Type.LAZY) { throw new UnsupportedOperationException( "EnumerableTableSpool supports for the moment only LAZY read and LAZY write"); } BlockBuilder builder = new BlockBuilder(); RelNode input = getInput(); Result inputResult = implementor.visitChild(this, 0, (EnumerableRel) input, pref); Expression tableExp = Expressions.convert_( Expressions.call( Expressions.call( implementor.getRootExpression(), BuiltInMethod.DATA_CONTEXT_GET_ROOT_SCHEMA.method), BuiltInMethod.SCHEMA_GET_TABLE.method, Expressions.constant(tableName, String.class)), ModifiableTable.class); Expression collectionExp = Expressions.call( tableExp, BuiltInMethod.MODIFIABLE_TABLE_GET_MODIFIABLE_COLLECTION.method); Expression inputExp = builder.append("input", inputResult.block); Expression spoolExp = Expressions.call( BuiltInMethod.LAZY_COLLECTION_SPOOL.method, collectionExp, inputExp); builder.add(spoolExp); PhysType physType = PhysTypeImpl.of( implementor.getTypeFactory(), getRowType(), pref.prefer(inputResult.format)); return implementor.result(physType, builder.toBlock()); }
Source:
<code>public void update() { if (!world.isRemote && world.getTotalWorldTime() % 25 == 0 && world.isBlockPowered(getPos())) { <START> System.out.println(selectedSound); <END> BlockAlarm.setActive(true, world, pos); switch(selectedSound){ case 1: world.playSound(null, getPos().getX(), getPos().getY(), getPos().getZ(), ModSounds.ALARM, SoundCategory.BLOCKS, 4F, 1F); break; case 2: world.playSound(null, getPos().getX(), getPos().getY(), getPos().getZ(), ModSounds.ALARM_2, SoundCategory.BLOCKS, 4F, 1F); break; case 3: world.playSound(null, getPos().getX(), getPos().getY(), getPos().getZ(), ModSounds.ALARM_3, SoundCategory.BLOCKS, 4F, 1F); break; } } else if (!world.isRemote && world.getTotalWorldTime() % 25 == 0) { BlockAlarm.setActive(false, world, pos); } }</code><technical_language>This needs go</technical_language>

Target:
public void update() { if (!world.isRemote && world.getTotalWorldTime() % 25 == 0 && world.isBlockPowered(getPos())) { BlockAlarm.setActive(true, world, pos); switch(selectedSound){ case 1: world.playSound(null, getPos().getX(), getPos().getY(), getPos().getZ(), ModSounds.ALARM, SoundCategory.BLOCKS, 4F, 1F); break; case 2: world.playSound(null, getPos().getX(), getPos().getY(), getPos().getZ(), ModSounds.ALARM_2, SoundCategory.BLOCKS, 4F, 1F); break; case 3: world.playSound(null, getPos().getX(), getPos().getY(), getPos().getZ(), ModSounds.ALARM_3, SoundCategory.BLOCKS, 4F, 1F); break; } } else if (!world.isRemote && world.getTotalWorldTime() % 25 == 0) { BlockAlarm.setActive(false, world, pos); } }
Source:
<code>private void sendSuccesResponse(final MessageMetadata metadata, final ProtocolInfo protocolInfo, final FirmwareFileDto firmwareFileDto) { <START> final DeviceMessageMetadata deviceMessageMetadata = new DeviceMessageMetadata( <END> metadata.getDeviceIdentification(), metadata.getOrganisationIdentification(), metadata.getCorrelationUid(), metadata.getMessageType(), metadata.getMessagePriority(), metadata.getScheduleTime()); final ProtocolResponseMessage responseMessage = new ProtocolResponseMessage.Builder() .deviceMessageMetadata(deviceMessageMetadata).domain(metadata.getDomain()) .domainVersion(metadata.getDomainVersion()).result(ResponseMessageResultType.OK).osgpException(null) .dataObject(firmwareFileDto).retryCount(metadata.getRetryCount()).scheduled(metadata.isScheduled()) .build(); this.protocolResponseMessageSender.send(responseMessage, DeviceFunction.GET_FIRMWARE_FILE.name(), protocolInfo, metadata); }</code><technical_language>call constructor called (new DeviceMessageMetadata(metadata))</technical_language>

Target:
private void sendSuccesResponse(final MessageMetadata metadata, final ProtocolInfo protocolInfo, final FirmwareFileDto firmwareFileDto) { final ProtocolResponseMessage responseMessage = new ProtocolResponseMessage.Builder() .deviceMessageMetadata(new DeviceMessageMetadata(metadata)).domain(metadata.getDomain()) .domainVersion(metadata.getDomainVersion()).result(ResponseMessageResultType.OK).osgpException(null) .dataObject(firmwareFileDto).retryCount(metadata.getRetryCount()).scheduled(metadata.isScheduled()) .build(); this.protocolResponseMessageSender.send(responseMessage, DeviceFunction.GET_FIRMWARE_FILE.name(), protocolInfo, metadata); }
Source:
<code>public synchronized MultiModel removeRepoModelById(String repoId) { Optional<Model> repoModelToBeDeleted = getModelById(repoId); if (repoModelToBeDeleted.isPresent()) { this.models.remove(repoModelToBeDeleted.get().getRepoId()); <START> } <END> return this; }</code><technical_language>I guess log if repo exist, indicative of a bug</technical_language>

Target:
public synchronized MultiModel removeRepoModelById(String repoId) { Optional<Model> repoModelToBeDeleted = getModelById(repoId); if (repoModelToBeDeleted.isPresent()) { this.models.remove(repoModelToBeDeleted.get().getRepoId()); } else { logger.error("RepoModel to be deleted does not exist."); } return this; }
Source:
<code>public void firePostMessageFromUI(String data, String origin) { if (!isEnabledIncludingParents() || <START> !isVisible()) <END> { return; } interceptPostMessage(data, origin); }</code><technical_language>mayby check for isVisibleIncludingParents()</technical_language>

Target:
public void firePostMessageFromUI(String data, String origin) { if (!isEnabledIncludingParents() || !isVisibleIncludingParents()) { return; } interceptPostMessage(data, origin); }
Source:
<code>public void onConnect(IClient client, RequestFunction function, AMFDataList params) { WMSProperties properties = client.getProperties(); String rtmpUrl = properties.getPropertyStr(Constants.CLIENT_PROPERTY_CONNECT_URL); String IP = client.getIp(); logger.debug("Geting url: " + rtmpUrl+ " from client "+ IP); try { HashMap<String, String> queryParameters = Utils.getRtmpUrlParameters(rtmpUrl, client.getQueryStr()); <START> onClientConnect(properties, queryParameters, KalturaStreamType.RTMP); <END> } catch (Exception e) { logger.error("Entry authentication failed with url [" + rtmpUrl + "]: " + e.getMessage()); client.rejectConnection(); sendClientOnStatusError((IClient)client, "NetStream.Play.Failed","Unable to authenticate url; [" + rtmpUrl + "]: " + e.getMessage()); DiagnosticsProvider.addRejectedRTMPStream(client, e.getMessage()); } }</code><technical_language>please remove streamtype</technical_language>

Target:
public void onConnect(IClient client, RequestFunction function, AMFDataList params) { WMSProperties properties = client.getProperties(); String rtmpUrl = properties.getPropertyStr(Constants.CLIENT_PROPERTY_CONNECT_URL); String IP = client.getIp(); logger.debug("Geting url: " + rtmpUrl+ " from client "+ IP); try { HashMap<String, String> queryParameters = Utils.getRtmpUrlParameters(rtmpUrl, client.getQueryStr()); onClientConnect(properties, queryParameters); } catch (Exception e) { logger.error("Entry authentication failed with url [" + rtmpUrl + "]: " + e.getMessage()); client.rejectConnection(); sendClientOnStatusError((IClient)client, "NetStream.Play.Failed","Unable to authenticate url; [" + rtmpUrl + "]: " + e.getMessage()); DiagnosticsProvider.addRejectedRTMPStream(client, e.getMessage()); } }
Source:
<code>public SourceRecord extractRecord() throws SQLException { Struct record = DataConverter.convertRecord(schema, resultSet); <START> Map<String, String> partition = new HashMap<>(); <END> partition.put("table", name); return new SourceRecord(partition, null, name, null, null, record); }</code><technical_language>critical, for simple maps this nice Collections.singletonMap concise</technical_language>

Target:
public SourceRecord extractRecord() throws SQLException { Struct record = DataConverter.convertRecord(schema, resultSet); Map<String, String> partition = Collections.singletonMap(JdbcSourceConnectorConstants.TABLE_NAME_KEY, name); return new SourceRecord(partition, null, name, null, null, record); }
Source:
<code>private static void generateConfigIni(List<String> pluginList, Path configOutputPath) { try (FileWriter r = new FileWriter(configOutputPath.toFile())) { r.write("osgi.install.area=file\\:$eclipse.home$\n"); r.write("osgi.framework=file\\:$eclipse.home$/plugins/$osgi.jar$\n"); r.write("osgi.bundles="); for (int i =0; i < pluginList.size(); i++) { String pluginName = pluginList.get(i); if (PLUGINS_NOT_IN_SCRIPT_VERSION.contains(pluginName)) { continue; } r.write(pluginName); if (PLUGINS_WITH_START_LEVEL.containsKey(pluginName)) { r.write(PLUGINS_WITH_START_LEVEL.get(pluginName)); } if (i != pluginList.size() - 1) { <START> r.write(','); <END> } } r.write('\n'); r.write("osgi.configuration.cascaded=false\n"); r.write("osgi.bundles.defaultStartLevel=4\n"); } catch (IOException e) { e.printStackTrace(); System.exit(1); } }</code><technical_language>This work if PLUGINS_NOT_IN_SCRIPT_VERSION contains plugin end a , end. In fact, this is is happening :-) testing a comma end of plugin list, work fine leave comma simplify this code</technical_language>

Target:
private static void generateConfigIni(List<String> pluginList, Path configOutputPath) { try (FileWriter r = new FileWriter(configOutputPath.toFile())) { r.write("osgi.install.area=file\\:$eclipse.home$\n"); r.write("osgi.framework=file\\:$eclipse.home$/plugins/$osgi.jar$\n"); r.write("osgi.bundles="); for (int i =0; i < pluginList.size(); i++) { String pluginName = pluginList.get(i); if (PLUGINS_NOT_IN_SCRIPT_VERSION.contains(pluginName)) { continue; } r.write(pluginName); if (PLUGINS_WITH_START_LEVEL.containsKey(pluginName)) { r.write(PLUGINS_WITH_START_LEVEL.get(pluginName)); } r.write(','); } r.write('\n'); r.write("osgi.configuration.cascaded=false\n"); r.write("osgi.bundles.defaultStartLevel=4\n"); } catch (IOException e) { e.printStackTrace(); System.exit(1); } }
Source:
<code>public ImmutableCollection<IjFolder> createExcludes(final IjModule module) throws IOException { <START> final ImmutableList.Builder<IjFolder> excludesBuilder = ImmutableList.builder(); <END> final Path moduleBasePath = module.getModuleBasePath(); if (!projectFilesystem.exists(moduleBasePath)) { return ImmutableList.of(); } projectFilesystem.walkRelativeFileTree( moduleBasePath, new FileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { if (filesystemTraversalBoundaryPaths.contains(dir) && !moduleBasePath.equals(dir)) { return FileVisitResult.SKIP_SUBTREE; } if (isRootAndroidResourceDirectory(module, dir)) { return FileVisitResult.SKIP_SUBTREE; } if (!referencedFolderPaths.contains(dir)) { excludesBuilder.add(new ExcludeFolder(dir)); return FileVisitResult.SKIP_SUBTREE; } return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException { return FileVisitResult.CONTINUE; } @Override public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { return FileVisitResult.CONTINUE; } }); return excludesBuilder.build(); }</code><technical_language>Please, move this declaration if</technical_language>

Target:
public ImmutableCollection<IjFolder> createExcludes(final IjModule module) throws IOException { final Path moduleBasePath = module.getModuleBasePath(); if (!projectFilesystem.exists(moduleBasePath)) { return ImmutableList.of(); } final ImmutableList.Builder<IjFolder> excludesBuilder = ImmutableList.builder(); projectFilesystem.walkRelativeFileTree( moduleBasePath, new FileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { if (filesystemTraversalBoundaryPaths.contains(dir) && !moduleBasePath.equals(dir)) { return FileVisitResult.SKIP_SUBTREE; } if (isRootAndroidResourceDirectory(module, dir)) { return FileVisitResult.SKIP_SUBTREE; } if (!referencedFolderPaths.contains(dir)) { excludesBuilder.add(new ExcludeFolder(dir)); return FileVisitResult.SKIP_SUBTREE; } return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException { return FileVisitResult.CONTINUE; } @Override public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { return FileVisitResult.CONTINUE; } }); return excludesBuilder.build(); }
Source:
<code>public List<Community> findAll(Context context, MetadataField sortField, Integer limit, Integer offset) throws SQLException { StringBuilder queryBuilder = new StringBuilder(); queryBuilder.append("SELECT ").append(Community.class.getSimpleName()).append(" FROM Community as ") .append(Community.class.getSimpleName()).append(" "); addMetadataLeftJoin(queryBuilder, Community.class.getSimpleName(), Arrays.asList(sortField)); addMetadataSortQuery(queryBuilder, Arrays.asList(sortField), Collections.EMPTY_LIST); Query query = createQuery(context, queryBuilder.toString()); if (offset != null) { query.setFirstResult(offset); } if (limit != null) { query.setMaxResults(limit); } query.setParameter(sortField.toString(), sortField.getID()); <START> return new LinkedList<Community>(new LinkedHashSet<>(list(query))); <END> }</code><technical_language>I guess page size is respected in this way. If 11 communities of title in multiple language result in multiple entry in page, flatting this list left 10 result in page</technical_language>

Target:
public List<Community> findAll(Context context, MetadataField sortField, Integer limit, Integer offset) throws SQLException { StringBuilder queryBuilder = new StringBuilder(); queryBuilder.append("SELECT c" + " FROM Community c" + " left join c.metadata title on title.metadataField = :sortField and" + " title.dSpaceObject = c.id and" + " title.place = (select min(internal.place) " + "from c.metadata internal " + "where internal.metadataField = :sortField and" + " internal.dSpaceObject = c.id)" + " ORDER BY LOWER(title.value)"); Query query = createQuery(context, queryBuilder.toString()); if (offset != null) { query.setFirstResult(offset); } if (limit != null) { query.setMaxResults(limit); } query.setParameter("sortField", sortField); return list(query); }
Source:
<code>@Override public boolean isRebalanceEnabled() { <START> return kernal.context().cache().context().isRebalanceEnabled(); <END> }</code><technical_language>Lets isRebalanceEnabled kernal</technical_language>

Target:
@Override public boolean isRebalanceEnabled() { return kernal.isRebalanceEnabled(); }
Source:
<code>public void doesNotHangWhenClearWithConcurrentPutsAndInvalidates() throws Exception { InternalCache cache = server.getCache(); Region<Object, Object> region = server.createPartitionRegion("regionA", f -> { }, f -> f.setTotalNumBuckets(1)); cache.getQueryService().createIndex("indexA", "r", "/regionA r"); region.put(0, "value0"); CompletableFuture<Void> put = executor.runAsync(() -> { Thread.currentThread().setName("put-Thread"); IntStream.range(0, 10).forEach(i -> region.put(i, "value" + i)); }); CompletableFuture<Void> invalidate = executor.runAsync(() -> { Thread.currentThread().setName("invalidate-Thread"); IntStream.range(0, 10).forEach(i -> { try { region.invalidate(i); } catch (EntryNotFoundException e) { } }); }); CompletableFuture<Void> clear = executor.runAsync(() -> { Thread.currentThread().setName("Clear-Thread"); region.clear(); }); <START> put.get(5, TimeUnit.SECONDS); <END> invalidate.get(5, TimeUnit.SECONDS); clear.get(5, TimeUnit.SECONDS); }</code><technical_language>add some kind of validation put/invalidate clear is performed expected. region contents</technical_language>

Target:
public void doesNotHangWhenClearWithConcurrentPutsAndInvalidates() throws Exception { InternalCache cache = server.getCache(); Region<Object, Object> region = server.createPartitionRegion("regionA", f -> { }, f -> f.setTotalNumBuckets(1)); cache.getQueryService().createIndex("indexA", "r", "/regionA r"); region.put(0, "value0"); CompletableFuture<Void> put = executor.runAsync(() -> { Thread.currentThread().setName("put-Thread"); IntStream.range(0, 10).forEach(i -> region.put(i, "value" + i)); }); CompletableFuture<Void> invalidate = executor.runAsync(() -> { Thread.currentThread().setName("invalidate-Thread"); IntStream.range(0, 10).forEach(i -> { try { region.invalidate(i); } catch (EntryNotFoundException e) { } }); }); CompletableFuture<Void> clear = executor.runAsync(() -> { Thread.currentThread().setName("Clear-Thread"); IntStream.range(0, 10).forEach(i -> region.clear()); }); put.get(5, TimeUnit.SECONDS); invalidate.get(5, TimeUnit.SECONDS); clear.get(5, TimeUnit.SECONDS); }
Source:
<code>public String getEmail() { final List<Google2Email> list = getEmails(); <START> if (list != null && list.size() > 0) <END> return list.get(0).getEmail(); else return null; }</code><technical_language>get right. code conventions, I brackets if else clauses</technical_language>

Target:
public String getEmail() { final List<Google2Email> list = getEmails(); if (list != null && list.size() > 0) { return list.get(0).getEmail(); } else { return null; } }
Source:
<code>@Test public void testItemOperatorException() { sql("select ^name^[0] from dept") <START> .fails("Cannot apply item operator to 'VARCHAR' for field 'DEPT.NAME'"); <END> }</code><technical_language>afraid message is understandable. is original, is confusing. error message for case select ^(2+2)^[0] dept</technical_language>

Target:
@Test public void testItemOperatorException() { sql("select ^name[0]^ from dept") .fails("Cannot apply 'ITEM' to arguments of type 'ITEM\\(<VARCHAR\\(10\\)>, " + "<INTEGER>\\)'\\. Supported form\\(s\\): <ARRAY>\\[<INTEGER>\\]\n" + "<MAP>\\[<VALUE>\\].*"); }
Source:
<code>private boolean isSmartMeter(final Map<String, String> settings) { <START> final String devtype = settings.get(Keys.KEY_DEVICE_TYPE); <END> return SMART_METER_E.equals(devtype) || SMART_METER_G.equals(devtype) ; }</code><technical_language>devtype is camelcased, deviceType more descriptive</technical_language>

Target:
private boolean isSmartMeter(final Map<String, String> settings) { final String deviceType = settings.get(Keys.KEY_DEVICE_TYPE); return SMART_METER_E.equals(deviceType) || SMART_METER_G.equals(deviceType); }
Source:
<code>public void requestDone(HttpServerExchange exchange) { try { Session<LocalSessionContext> session = this.entry.getKey(); if (session.isValid()) { Batcher<Batch> batcher = this.manager.getSessionManager().getBatcher(); try (BatchContext context = batcher.resumeBatch(this.batch)) { if (this.batch.getState() == Batch.State.DISCARDED) { this.batch.close(); } try (Batch batch = (this.batch.getState() == Batch.State.CLOSED) ? batcher.createBatch() : this.batch) { session.close(); } } catch (Throwable e) { UndertowClusteringLogger.ROOT_LOGGER.warn(e.getLocalizedMessage(), e); } <START> } else if (this.batch.getState() != Batch.State.CLOSED) { <END> this.batch.close(); } } finally { this.closeTask.accept(exchange); } }</code><technical_language>is this case</technical_language>

Target:
public void requestDone(HttpServerExchange exchange) { try { Session<LocalSessionContext> session = this.entry.getKey(); if (session.isValid()) { Batcher<Batch> batcher = this.manager.getSessionManager().getBatcher(); try (BatchContext context = batcher.resumeBatch(this.batch)) { if (this.batch.getState() == Batch.State.DISCARDED) { this.batch.close(); } try (Batch batch = (this.batch.getState() == Batch.State.CLOSED) ? batcher.createBatch() : this.batch) { session.close(); } } catch (Throwable e) { UndertowClusteringLogger.ROOT_LOGGER.warn(e.getLocalizedMessage(), e); } } else if (this.batch.getState() != Batch.State.CLOSED) { Batcher<Batch> batcher = this.manager.getSessionManager().getBatcher(); try (BatchContext context = batcher.resumeBatch(this.batch)) { this.batch.close(); } } } finally { this.closeTask.accept(exchange); } }
Source:
<code>public void testDialogAndTextBoxAfterReopenDialog() { enterTestText(); selectFormatting(FormattingOptions.SANS_SERIF); selectFormatting(FormattingOptions.UNDERLINE); selectFormatting(FormattingOptions.ITALIC); selectFormatting(FormattingOptions.BOLD); selectFormatting(FormattingOptions.STRIKETHROUGH); selectFormatting(FormattingOptions.SIZE_40); onToolBarView() .performCloseToolOptionsView(); PointF boxPosition = getToolMemberBoxPosition(); PointF newBoxPosition = new PointF(boxPosition.x + 20, boxPosition.y + 20); setToolMemberBoxPosition(newBoxPosition); setToolMemberBoxHeight(50.0f); setToolMemberBoxWidth(50.0f); onToolBarView() .performOpenToolOptionsView(); assertEquals(TEST_TEXT, textEditText.getText().toString()); assertEquals(FONT_SANS_SERIF, fontSpinner.getSelectedItem()); assertTrue(underlinedToggleButton.isChecked()); assertTrue(italicToggleButton.isChecked()); assertTrue(boldToggleButton.isChecked()); <START> assertEquals("Wrong text size selected after reopen dialog", <END> TEXT_SIZE_40_STRING, textSizeSpinner.getSelectedItem()); checkTextBoxDimensions(); }</code><technical_language>this line deleted</technical_language>

Target:
public void testDialogAndTextBoxAfterReopenDialog() { enterTestText(); selectFormatting(FormattingOptions.SANS_SERIF); selectFormatting(FormattingOptions.UNDERLINE); selectFormatting(FormattingOptions.ITALIC); selectFormatting(FormattingOptions.BOLD); selectFormatting(FormattingOptions.STRIKETHROUGH); selectFormatting(FormattingOptions.SIZE_40); onToolBarView() .performCloseToolOptionsView(); PointF boxPosition = getToolMemberBoxPosition(); PointF newBoxPosition = new PointF(boxPosition.x + 20, boxPosition.y + 20); setToolMemberBoxPosition(newBoxPosition); setToolMemberBoxHeight(50.0f); setToolMemberBoxWidth(50.0f); onToolBarView() .performOpenToolOptionsView(); assertEquals(TEST_TEXT, textEditText.getText().toString()); assertEquals(FONT_SANS_SERIF, fontSpinner.getSelectedItem()); assertTrue(underlinedToggleButton.isChecked()); assertTrue(italicToggleButton.isChecked()); assertTrue(boldToggleButton.isChecked()); assertTrue(strikeThroughToggleButton.isChecked()); assertEquals("Wrong text size selected after reopen dialog", TEXT_SIZE_40_STRING, textSizeSpinner.getSelectedItem()); checkTextBoxDimensions(); }
Source:
<code>private void showFeed() { Log.d(TAG, "Language is " + feed.getLanguage()); Log.d(TAG, "Author is " + feed.getAuthor()); Log.d(TAG, "URL is " + feed.getDownload_url()); Glide.with(getContext()) .load(feed.getImageLocation()) .apply(new RequestOptions() .placeholder(R.color.light_gray) .error(R.color.light_gray) .diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY) .fitCenter() .dontAnimate()) .into(imgvCover); Glide.with(getContext()) .load(feed.getImageLocation()) .apply(new RequestOptions() <START> .placeholder(R.color.image_readability_tint) <END> .error(R.color.image_readability_tint) .diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY) .transform(new FastBlurTransformation()) .dontAnimate()) .into(imgvBackground); txtvTitle.setText(feed.getTitle()); String description = HtmlToPlainText.getPlainText(feed.getDescription()); txtvDescription.setText(description); txtvUrl.setText(feed.getDownload_url() + " {fa-paperclip}"); Iconify.addIcons(txtvUrl); getActivity().invalidateOptionsMenu(); }</code><technical_language>author in header displayed. Please remove author actual page, blurred header</technical_language>

Target:
private void showFeed() { Log.d(TAG, "Language is " + feed.getLanguage()); Log.d(TAG, "Author is " + feed.getAuthor()); Log.d(TAG, "URL is " + feed.getDownload_url()); Glide.with(getContext()) .load(feed.getImageLocation()) .apply(new RequestOptions() .placeholder(R.color.light_gray) .error(R.color.light_gray) .diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY) .fitCenter() .dontAnimate()) .into(imgvCover); Glide.with(getContext()) .load(feed.getImageLocation()) .apply(new RequestOptions() .placeholder(R.color.image_readability_tint) .error(R.color.image_readability_tint) .diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY) .transform(new FastBlurTransformation()) .dontAnimate()) .into(imgvBackground); txtvTitle.setText(feed.getTitle()); String description = HtmlToPlainText.getPlainText(feed.getDescription()); txtvDescription.setText(description); if (!TextUtils.isEmpty(feed.getAuthor())) { txtvAuthorHeader.setText(feed.getAuthor()); } txtvUrl.setText(feed.getDownload_url() + " {fa-paperclip}"); Iconify.addIcons(txtvUrl); getActivity().invalidateOptionsMenu(); }
Source:
<code>private static Set<String> getSchemaNames(DatabaseMetaData meta, String schemaFilter) { Set<String> res = new HashSet<>(); try { ResultSet schemas = meta.getSchemas(); try { while (schemas.next()) { String schemaName = schemas.getString("TABLE_SCHEM"); if (schemaFilter.equals("") || schemaFilter == null || schemaName.matches( schemaFilter.replace("_", ".").replace("%", ".*?"))) { res.add(schemaName); } } } finally { schemas.close(); } <START> } catch (Throwable t) { <END> logger.error("Failed to retrieve the schema names", t); } return res; }</code><technical_language>Is Exception ok? Throwable</technical_language>

Target:
private static Set<String> getSchemaNames(DatabaseMetaData meta, String schemaFilter) { Set<String> res = new HashSet<>(); try { ResultSet schemas = meta.getSchemas(); try { while (schemas.next()) { String schemaName = schemas.getString("TABLE_SCHEM"); if (schemaFilter.equals("") || schemaFilter == null || schemaName.matches( schemaFilter.replace("_", ".").replace("%", ".*?"))) { res.add(schemaName); } } } finally { schemas.close(); } } catch (SQLException t) { logger.error("Failed to retrieve the schema names", t); } return res; }
Source:
<code>void onRunSchedulerExampleButtonClicked() { Observable.defer(new Func0<Observable<String>>() { @Override public Observable<String> call() { try { Thread.sleep(TimeUnit.SECONDS.toMillis(5)); } catch (InterruptedException e) { throw OnErrorThrowable.from(e); } return Observable.just("one", "two", "three", "four", "five"); } }) .subscribeOn(handlerThread(backgroundThreadHandler)) <START> .observeOn(AndroidSchedulers.mainThread()) END> .subscribe(new Subscriber<String>() { @Override public void onCompleted() { Log.d(TAG, "onCompleted()"); } @Override public void onError(Throwable e) { Log.e(TAG, "onError()", e); } @Override public void onNext(String string) { Log.d(TAG, "onNext(" + string + ")"); } }); }</code><technical_language>static import mainThread() un-static import handlerThread()</technical_language>

Target:
void onRunSchedulerExampleButtonClicked() { sampleObservable() .subscribeOn(handlerThread(backgroundThreadHandler)) .observeOn(mainThread()) .subscribe(new Subscriber<String>() { @Override public void onCompleted() { Log.d(TAG, "onCompleted()"); } @Override public void onError(Throwable e) { Log.e(TAG, "onError()", e); } @Override public void onNext(String string) { Log.d(TAG, "onNext(" + string + ")"); } }); }
Source:
<code>public List<MapGenStructure> getStructuresImmutable() { <START> return ImmutableList.copyOf(structureList); <END> }</code><technical_language>returned a Collections.unmodifiableList avoid extra copying</technical_language>

Target:
public List<MapGenStructure> getStructuresImmutable() { return Collections.unmodifiableList(structureList); }
Source:
<code>public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); FragmentActivity activity = getActivity(); if (!(activity instanceof EmailLinkEmailPromptFragment.EmailLinkPromptEmailListener)) { throw new IllegalStateException("Activity must implement EmailLinkPromptEmailListener"); } <START> mListener = (FinishEmailLinkSignInListener) activity; <END> }</code><technical_language>do check for EmailLinkEmailPromptFragment.EmailLinkPromptEmailListener cast FinishEmailLinkSignInListener</technical_language>

Target:
public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); FragmentActivity activity = getActivity(); if (!(activity instanceof FinishEmailLinkSignInListener)) { throw new IllegalStateException("Activity must implement EmailLinkPromptEmailListener"); } mListener = (FinishEmailLinkSignInListener) activity; }
Source:
<code>private void print(Rules rule, Severity severity, String msg, Location location) { ViolationMessage violationMessage; <START> if (rule != null) { <END> violationMessage = new ViolationMessage(rule, location.line, location.column, severity, msg); } else { violationMessage = new ViolationMessage(location.line, location.column, severity, msg); } try { violationMessage.setFilePath(this.inputFile.getCanonicalPath()); } catch (IOException e) { System.err.println("Error in getting canonical path of input file: " + e.getMessage()); } this.msgBuffer.put(violationMessage.toString(), violationMessage); }</code><technical_language>overloaded function print(Severity, String, Location) this check? alternatively, create a rule for on-off mismatch? If storing warning ViolationMessage, I should</technical_language>

Target:
private void print(Rules rule, Severity severity, String msg, Location location) { ViolationMessage violationMessage = new ViolationMessage(rule, location.line, location.column, severity, msg); addToMsgBuffer(violationMessage); }
Source:
<code>public HtlChecks addChecks(String repositoryKey, Iterable<Class<? extends HtlCheck>> checkClass) { <START> checksByRepository.add(checkFactory <END> .<HtlCheck>create(repositoryKey) .addAnnotatedChecks(checkClass)); return this; }</code><technical_language>divide this creation of Check adding Set</technical_language>

Target:
public HtlChecks addChecks(String repositoryKey, Iterable<Class<? extends HtlCheck>> checkClass) { Checks<HtlCheck> htlChecks = checkFactory .<HtlCheck>create(repositoryKey) .addAnnotatedChecks(checkClass); checksByRepository.add(htlChecks); return this; }
Source:
<code>@Bean OAuthInterceptor getAuthenticationInterceptor() { OAuthInterceptor interceptor = new OAuthInterceptor(userFetcher(), idCodec); interceptor.setUrlsToProtect(ImmutableSet.of( "/4.0/applications", "/4.0/sources", "/4.0/requests", "/4.0/users", "/4.0/auth/user")); interceptor.setUrlsNotRequiringCompleteProfile(ImmutableSet.of( "/4.0/auth/user", <START> "/4.0/users/:uid")); <END> return interceptor; }</code><technical_language>Is reason pass in constructor</technical_language>

Target:
@Bean OAuthInterceptor getAuthenticationInterceptor() { return OAuthInterceptor .builder() .withUserFetcher(userFetcher()) .withIdCodec(idCodec) .withUrlsToProtect(ImmutableSet.of( "/4.0/applications", "/4.0/sources", "/4.0/requests", "/4.0/users", "/4.0/auth/user")) .withUrlsNotNeedingCompleteProfile(ImmutableSet.of( "/4.0/auth/user", "/4.0/users/:uid")) .build(); }
Source:
<code>public void fixPrjFile() throws IOException { CoordinateReferenceSystem crs = readPrjToCRS(); if (crs == null) { return; } try { CoordinateReferenceSystem epsgCrs = null; Integer epsgCode = EPSG_LOOKUP_CACHE.lookupEPSGCode(crs); if (epsgCode != null) { epsgCrs = CRS.decode("EPSG:" + epsgCode); } if (epsgCrs != null) { String epsgWKT = epsgCrs.toWKT(); final PrintStream printStream = new PrintStream(getPrjFile().out()); printStream.print(epsgWKT); <START> printStream.close(); <END> } } catch (FactoryException e) { throw (IOException) new IOException().initCause(e); } }</code><technical_language>@NielsCharlier is this a resource leak (if print throws)? need a try-with-resource block</technical_language>

Target:
public void fixPrjFile() throws IOException { CoordinateReferenceSystem crs = readPrjToCRS(); if (crs == null) { return; } try { CoordinateReferenceSystem epsgCrs = null; Integer epsgCode = EPSG_LOOKUP_CACHE.lookupEPSGCode(crs); if (epsgCode != null) { epsgCrs = CRS.decode("EPSG:" + epsgCode); } if (epsgCrs != null) { String epsgWKT = epsgCrs.toWKT(); try (PrintStream printStream = new PrintStream(getPrjFile().out())) { printStream.print(epsgWKT); } } } catch (FactoryException e) { throw (IOException) new IOException().initCause(e); } }
Source:
<code>private static void waitForHBaseToComeOnline(MiniHBaseCluster hbaseCluster) throws IOException { while (true) { <START> if (hbaseCluster.getRegionServer(0).isOnline()) { <END> break; } } HTable t = new HTable(hbaseCluster.getConf(), HBASE_META_TABLE); ResultScanner s = t.getScanner(new Scan()); while (s.next() != null) { continue; } s.close(); t.close(); }</code><technical_language>Is isOnline a time-consuming method? change this check 10ms spin-lock</technical_language>

Target:
private static void waitForHBaseToComeOnline(MiniHBaseCluster hbaseCluster) throws IOException, InterruptedException { while (!hbaseCluster.getMaster().isInitialized()) { Thread.sleep(1000); } hbaseCluster.getRegionServer(0).waitForServerOnline(); HTable t = new HTable(hbaseCluster.getConf(), HBASE_META_TABLE); ResultScanner s = t.getScanner(new Scan()); while (s.next() != null) { continue; } s.close(); t.close(); }