auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public String getFileURI() { if (resolveHostsDynamically) { try { return VFSUtils.resolveUriHost(fileURI); } catch (UnknownHostException | FileSystemException e) { <START> log.warn("Unable to resolving hostname of transport.vfs.FileURI : " + VFSUtils.maskURLPassword(fileURI), e); <END> } } return fileURI; }</code><technical_language>change this "Unable resolve hostname of ....". other places error message</technical_language>

Target:
public String getFileURI() { if (resolveHostsDynamically) { try { return VFSUtils.resolveUriHost(fileURI); } catch (UnknownHostException | FileSystemException e) { log.warn("Unable to resolve the hostname of transport.vfs.FileURI : " + VFSUtils.maskURLPassword(fileURI), e); } } return fileURI; }
Source:
<code><START> public static String stateFor(String result) { <END> result = result == null ? "" : result; String state = PENDING; if (result.equalsIgnoreCase("Passed")) { state = SUCCESS; } else if (result.equalsIgnoreCase("Failed")) { state = FAILED; } else if (result.equalsIgnoreCase("Cancelled")) { state = CANCELED; } return state; }</code><technical_language>access package local for this method</technical_language>

Target:
static String stateFor(String result) { result = result == null ? "" : result; String state = PENDING; if (result.equalsIgnoreCase("Passed")) { state = SUCCESS; } else if (result.equalsIgnoreCase("Failed")) { state = FAILED; } else if (result.equalsIgnoreCase("Cancelled")) { state = CANCELED; } return state; }
Source:
<code>public Optional<BibEntry> extractBibtexEntry() { this.extractBibTexFields(); this.extractEditor(); this.extractAuthor(); this.extractYearAndMonth(); this.extractAbstract(); this.extractDOI(); this.extractPublisher(); this.extractRights(); this.extractSource(); this.extractSubject(); this.extractTitle(); this.extractType(); <START> if (bibEntry.equals(new BibEntry())) { <END> return Optional.empty(); } return Optional.of(bibEntry); }</code><technical_language>thought, adding a isEmpty method in BibEntry lead more readable code</technical_language>

Target:
public Optional<BibEntry> extractBibtexEntry() { this.extractBibTexFields(); this.extractEditor(); this.extractAuthor(); this.extractYearAndMonth(); this.extractAbstract(); this.extractDOI(); this.extractPublisher(); this.extractRights(); this.extractSource(); this.extractSubject(); this.extractTitle(); this.extractType(); if (bibEntry.getFieldMap().isEmpty()) { return Optional.empty(); } return Optional.of(bibEntry); }
Source:
<code>public void feedSessionOpen(Session session, @PathParam("feedId") String feedId) { <START> log.infoWsSessionOpened(session.getId(), endpoint); <END> wsEndpoints.getFeedSessions().addSession(feedId, session); }</code><technical_language>is "endpoint" helpful. want log actual feed ID string, "feed/{feedId}"</technical_language>

Target:
public void feedSessionOpen(Session session, @PathParam("feedId") String feedId) { log.infoWsSessionOpened(feedId, endpoint); wsEndpoints.getFeedSessions().addSession(feedId, session); }
Source:
<code>public PulsarContainer(String pulsarVersion) { super(TestcontainersConfiguration.getInstance().getPulsarImage() + ":" + pulsarVersion); withExposedPorts(BROKER_HTTP_PORT, BROKER_PORT); withCommand("/bin/bash", "-c", "/pulsar/bin/pulsar standalone --no-functions-worker -nss"); <START> waitingFor(Wait.forHttp(METRICS_ENDPOINT).forStatusCode(200)); <END> }</code><technical_language>port explicitly, "first exposed port" users change exposed ports needs</technical_language>

Target:
public PulsarContainer(String pulsarVersion) { super(TestcontainersConfiguration.getInstance().getPulsarImage() + ":" + pulsarVersion); withExposedPorts(BROKER_PORT, BROKER_HTTP_PORT); withCommand("/pulsar/bin/pulsar", "standalone", "--no-functions-worker", "-nss"); waitingFor(Wait.forHttp(METRICS_ENDPOINT).forStatusCode(200).forPort(BROKER_HTTP_PORT)); }
Source:
<code>public void shouldReturnStringWhenStringClassIdType() throws SQLException { given(resultSet.getString("class_id_type")).willReturn("java.lang.String"); <START> Serializable newIdentifier = aclClassIdUtils.identifierFrom(IDENTIFIER_AS_STRING, resultSet); <END> assertThat(newIdentifier).isEqualTo(IDENTIFIER_AS_STRING); }</code><technical_language>This extra variable needless. please DEFAULT_IDENTIFIER_AS_STRING instead</technical_language>

Target:
public void shouldReturnStringWhenStringClassIdType() throws SQLException { String identifier = "MY_STRING_IDENTIFIER"; given(resultSet.getString("class_id_type")).willReturn("java.lang.String"); Serializable newIdentifier = aclClassIdUtils.identifierFrom(identifier, resultSet); assertThat(newIdentifier).isEqualTo(identifier); }
Source:
<code>AllStoreHolder( StorageEngine engine, StorageStatement statement, Supplier<ExplicitIndexTransactionState> explicitIndexes ) { this.read = engine.storeReadLayer(); this.statement = statement; this.explicitIndexes = Suppliers.lazySingleton( explicitIndexes ); <START> StoreHolder stores = engine.stores(); <END> this.nodeStore = stores.getNodeStore(); this.relationshipStore = stores.getRelationshipStore(); this.groupStore = stores.getRelationshipGroupStore(); this.propertyStore = stores.getPropertyStore(); }</code><technical_language>StorageEngine ideally expose direct access underlying stores, instead hide interfaces StoreReadLayer, eventually org.neo4j.internal.kernel.api.Read I suppose</technical_language>

Target:
AllStoreHolder( StorageEngine engine, StorageStatement statement, Supplier<ExplicitIndexTransactionState> explicitIndexes ) { this.read = engine.storeReadLayer(); this.statement = statement; this.explicitIndexes = Suppliers.lazySingleton( explicitIndexes ); this.nodes = statement.nodes(); this.relationships = statement.relationships(); this.groups = statement.groups(); this.properties = statement.properties(); }
Source:
<code>private void addProfilePreferences() { final boolean canEditProfilePreferences = authorizationManager.authorize(WorkbenchFeatures.EDIT_PROFILE_PREFERENCES, sessionInfo.getIdentity()); profileService.call((Boolean force) -> { if(canEditProfilePreferences && !force) { adminPage.addPreference("root", "ProfilePreferences", translationService.format(PreferencesConstants.ProfilePreferences_Title), new Sets.Builder().add("fa").add("fa-list").build(), "advanced", scopeFactory.createScope(GuvnorPreferenceScopes.GLOBAL), AdminPageOptions.WITH_BREADCRUMBS); } }, (Object message, Throwable t) -> { <START> throw new RuntimeException(t); <END> }).isForce(); }</code><technical_language>throwing RuntimeException client-side? this error callback client side. relying default error handler (which I lead "Unexpected error modal" exception)</technical_language>

Target:
private void addProfilePreferences() { final boolean canEditProfilePreferences = authorizationManager.authorize(WorkbenchFeatures.EDIT_PROFILE_PREFERENCES, sessionInfo.getIdentity()); profileService.call((Boolean force) -> { if (canEditProfilePreferences && !force) { adminPage.addPreference("root", "ProfilePreferences", translationService.format(PreferencesConstants.ProfilePreferences_Title), new Sets.Builder().add("fa").add("fa-list").build(), "advanced", scopeFactory.createScope(GuvnorPreferenceScopes.GLOBAL), AdminPageOptions.WITH_BREADCRUMBS); } }).isForce(); }
Source:
<code>public void openConnection() { try { if (reader != null) reader.startserver(); } catch (IOException e) { <START> e.printStackTrace(); <END> } if (connection.getpairkey().length() == 0) { connection.requestpairkey(); } else { connection.sendpairkey(); } }</code><technical_language>please remove TODO - please propper logging instead of printStackTrace()</technical_language>

Target:
public void openConnection() { try { if (reader != null) reader.startserver(); } catch (IOException e) { logger.error("Error at openconnection", e); } if (connection.getpairkey().length() == 0) { connection.requestpairkey(); } else { connection.sendpairkey(); } }
Source:
<code>public List<CatalogItemSummary> listApplications(String regex, String fragment) { <START> ImmutableList.<String>of(); <END> Predicate<CatalogItem<Application, EntitySpec<? extends Application>>> filter = Predicates.and(CatalogPredicates.<Application,EntitySpec<? extends Application>>deprecated(false), CatalogPredicates.IS_TEMPLATE); return getCatalogItemSummariesMatchingRegexFragment(filter, regex, fragment); }</code><technical_language>Redundant line of code</technical_language>

Target:
public List<CatalogItemSummary> listApplications(String regex, String fragment) { Predicate<CatalogItem<Application, EntitySpec<? extends Application>>> filter = Predicates.and(CatalogPredicates.<Application,EntitySpec<? extends Application>>deprecated(false), CatalogPredicates.IS_TEMPLATE); return getCatalogItemSummariesMatchingRegexFragment(filter, regex, fragment); }
Source:
<code>public SpliceCatalogUpgradeScripts(SpliceDataDictionary sdd,Splice_DD_Version catalogVersion,TransactionController tc){ this.sdd=sdd; this.catalogVersion=catalogVersion; this.tc=tc; ddComparator=new Comparator<Splice_DD_Version>(){ @Override public int compare(Splice_DD_Version version1,Splice_DD_Version version2){ long v1=version1.toLong(); long v2=version2.toLong(); if(v1<v2) return -1; else if(v1==v2) return 0; else return 1; } }; scripts=new TreeMap<>(ddComparator); scripts.put(new Splice_DD_Version(sdd,1,0,0),new UpgradeScriptForFuji(sdd,tc)); scripts.put(new Splice_DD_Version(sdd,1,1,1),new LassenUpgradeScript(sdd,tc)); scripts.put(new Splice_DD_Version(sdd,2,6,0),new UpgradeScriptFor260(sdd,tc)); scripts.put(new Splice_DD_Version(sdd,2,8,1), new UpgradeScriptForModifySchemaPermissionAndDefaultRole(sdd,tc)); scripts.put(new Splice_DD_Version(sdd,2,8,0, 1812), new UpgradeScriptToCleanSysRoutinePerms(sdd,tc)); scripts.put(new Splice_DD_Version(sdd,2,8,0, 1817), new UpgradeScriptForSysTokens(sdd,tc)); <START> scripts.put(new Splice_DD_Version(sdd,2,8,0, 1840), new UpgradeScriptForDroppedConglomerates(sdd,tc)); <END> }</code><technical_language>this PR merge 1841 build, change 1840 1841. This basically if current running version is equal higher/larger version number(1841), upgrade script need triggered</technical_language>

Target:
public SpliceCatalogUpgradeScripts(SpliceDataDictionary sdd,Splice_DD_Version catalogVersion,TransactionController tc){ this.sdd=sdd; this.catalogVersion=catalogVersion; this.tc=tc; ddComparator=new Comparator<Splice_DD_Version>(){ @Override public int compare(Splice_DD_Version version1,Splice_DD_Version version2){ long v1=version1.toLong(); long v2=version2.toLong(); if(v1<v2) return -1; else if(v1==v2) return 0; else return 1; } }; scripts=new TreeMap<>(ddComparator); scripts.put(new Splice_DD_Version(sdd,1,0,0),new UpgradeScriptForFuji(sdd,tc)); scripts.put(new Splice_DD_Version(sdd,1,1,1),new LassenUpgradeScript(sdd,tc)); scripts.put(new Splice_DD_Version(sdd,2,6,0),new UpgradeScriptFor260(sdd,tc)); scripts.put(new Splice_DD_Version(sdd,2,8,1), new UpgradeScriptForModifySchemaPermissionAndDefaultRole(sdd,tc)); scripts.put(new Splice_DD_Version(sdd,2,8,0, 1812), new UpgradeScriptToCleanSysRoutinePerms(sdd,tc)); scripts.put(new Splice_DD_Version(sdd,2,8,0, 1817), new UpgradeScriptForSysTokens(sdd,tc)); scripts.put(new Splice_DD_Version(sdd,2,8,0, 1842), new UpgradeScriptForDroppedConglomerates(sdd,tc)); }
Source:
<code>public boolean changeAffiliations(HashMap<Jid, MUCLightAffiliation> affiliations) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { MUCLightChangeAffiliationsIQ changeAffiliationsIQ = new MUCLightChangeAffiliationsIQ(room, affiliations); StanzaFilter responseFilter = new IQReplyFilter(changeAffiliationsIQ, connection); <START> IQ responseIq = connection.createPacketCollectorAndSend(responseFilter, changeAffiliationsIQ) <END> .nextResultOrThrow(); return responseIq.getType().equals(IQ.Type.result); }</code><technical_language>I write :)</technical_language>

Target:
public void changeAffiliations(HashMap<Jid, MUCLightAffiliation> affiliations) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { MUCLightChangeAffiliationsIQ changeAffiliationsIQ = new MUCLightChangeAffiliationsIQ(room, affiliations); connection.createPacketCollectorAndSend(changeAffiliationsIQ).nextResultOrThrow(); }
Source:
<code><START> public void testEnableFail() throws Exception { <END> MockWebServer server = mockOpenStackServer(); server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json")))); server.enqueue(addCommonHeaders(enabledResponse().setResponseCode(404))); try { CloudFilesApi api = api(server.getUrl("/").toString(), "rackspace-cloudfiles"); CDNApi cdnApi = api.cdnApiInRegion("DFW"); URI enabledContainer = cdnApi.enable("container-1"); assertNull(enabledContainer); assertEquals(server.getRequestCount(), 2); assertAuthentication(server); assertRequest(server.takeRequest(), "PUT", "/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9/container-1"); } finally { server.shutdown(); } }</code><technical_language>failure testing here? do a 404? In case, describe in test name</technical_language>

Target:
public void testEnableFail() throws Exception { MockWebServer server = mockOpenStackServer(); server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json")))); server.enqueue(addCommonHeaders(enabledResponse().setResponseCode(404))); try { CloudFilesApi api = api(server.getUrl("/").toString(), "rackspace-cloudfiles"); assertNull(api.cdnApiInRegion("DFW").enable("container-1")); assertEquals(server.getRequestCount(), 2); assertAuthentication(server); assertRequest(server.takeRequest(), "PUT", "/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9/container-1"); } finally { server.shutdown(); } }
Source:
<code>public String getEndpointsInfo() { final StringBuilder msg = new StringBuilder(1024); <START> final Set<EndpointLogLine> endpointLogLines = Sets.newTreeSet(); <END> msg.append("The following paths were found for the configured resources:"); msg.append(NEWLINE).append(NEWLINE); final Set<Class<?>> allResources = Sets.newHashSet(); for (Class<?> clazz : allClasses()) { if (!clazz.isInterface() && Resource.from(clazz) != null) { allResources.add(clazz); } } for (Class<?> klass : allResources) { new EndpointLogger(urlPattern, klass).populate(endpointLogLines); } if (!endpointLogLines.isEmpty()) { for (EndpointLogLine line : endpointLogLines) { msg.append(line).append(NEWLINE); } } else { msg.append(" NONE").append(NEWLINE); } return msg.toString(); }</code><technical_language>newTreeSet accepts a Comparator, reason reuse EndpointComparator</technical_language>

Target:
public String getEndpointsInfo() { final StringBuilder msg = new StringBuilder(1024); final Set<EndpointLogLine> endpointLogLines = Sets.newTreeSet(new EndpointComparator()); msg.append("The following paths were found for the configured resources:"); msg.append(NEWLINE).append(NEWLINE); final Set<Class<?>> allResources = Sets.newHashSet(); for (Class<?> clazz : allClasses()) { if (!clazz.isInterface() && Resource.from(clazz) != null) { allResources.add(clazz); } } for (Class<?> klass : allResources) { new EndpointLogger(urlPattern, klass).populate(endpointLogLines); } if (!endpointLogLines.isEmpty()) { for (EndpointLogLine line : endpointLogLines) { msg.append(line).append(NEWLINE); } } else { msg.append(" NONE").append(NEWLINE); } return msg.toString(); }
Source:
<code>private static String asString(Object v) { try { <START> return new String((byte[]) v, "utf8"); <END> } catch (UnsupportedEncodingException e) { throw new CacheException(e); } }</code><technical_language>new String(byte[], Charset.forName("UTF-8")); form avoid try/catch. Constify UTF-8 Charset for extra points ;)</technical_language>

Target:
private static String asString(Object v) { return new String((byte[]) v, CHARSET_UTF8); }
Source:
<code>public EC2HardwareBuilder virtualizationTypes(VirtualizationType ...virtualizationTypes) { <START> Preconditions.checkArgument(virtualizationTypes.length > 0, "At least one virtualization type is required."); <END> if (virtualizationTypes.length == 1) { this.virtualizationType = new RequiresVirtualizationType(virtualizationTypes[0]); } else { List<RequiresVirtualizationType> supportedVirtualizationTypes = Lists.newArrayList(); for (VirtualizationType virtualizationType : virtualizationTypes) { supportedVirtualizationTypes.add(new RequiresVirtualizationType(virtualizationType)); } this.virtualizationType = Predicates.or(supportedVirtualizationTypes); } return this; }</code><technical_language>[minor] check for nulls avoid a NPE</technical_language>

Target:
public EC2HardwareBuilder virtualizationTypes(VirtualizationType ...virtualizationTypes) { Preconditions.checkNotNull(virtualizationTypes, "virtualizationTypes"); Preconditions.checkArgument(virtualizationTypes.length > 0, "At least one virtualization type is required."); if (virtualizationTypes.length == 1) { this.virtualizationType = new RequiresVirtualizationType(virtualizationTypes[0]); } else { List<RequiresVirtualizationType> supportedVirtualizationTypes = Lists.newArrayList(); for (VirtualizationType virtualizationType : virtualizationTypes) { supportedVirtualizationTypes.add(new RequiresVirtualizationType( Preconditions.checkNotNull(virtualizationType, "virtualizationType"))); } this.virtualizationType = Predicates.or(supportedVirtualizationTypes); } return this; }
Source:
<code>private static double calculateT(final TargetCollection<TargetCoverage> targets, final List<ModeledSegment> segments) { final List<ModeledSegment> copyNeutralSegments = segments.stream().filter(s -> s.getSegmentMean() < COPY_NEUTRAL_CUTOFF).collect(Collectors.toList()); final List<TargetCoverage> copyNeutralTargets = copyNeutralSegments.stream() .flatMap(s -> targets.targets(s).stream()).collect(Collectors.toList()); final double copyNeutralTargetsCopyRatio = copyNeutralTargets.stream().mapToDouble(TargetCoverage::getCoverage).toArray(); final double meanCopyNeutralTargets = new Mean().evaluate(copyNeutralTargetsCopyRatio); final double sigmaCopyNeutralTargets = new StandardDeviation().evaluate(copyNeutralTargetsCopyRatio); final double filteredCopyNeutralTargetsCopyRatio = Arrays.stream(copyNeutralTargetsCopyRatio) <START> .filter(c -> Math.abs(c - meanCopyNeutralTargets) < sigmaCopyNeutralTargets * 2).toArray(); <END> return new StandardDeviation().evaluate(filteredCopyNeutralTargetsCopyRatio); }</code><technical_language>I prefer a named constant for Z-score threshold</technical_language>

Target:
private static double calculateT(final TargetCollection<TargetCoverage> targets, final List<ModeledSegment> segments) { final List<ModeledSegment> copyNeutralSegments = segments.stream().filter(s -> s.getSegmentMean() < COPY_NEUTRAL_CUTOFF).collect(Collectors.toList()); final List<TargetCoverage> copyNeutralTargets = copyNeutralSegments.stream() .flatMap(s -> targets.targets(s).stream()).collect(Collectors.toList()); final double copyNeutralTargetsCopyRatio = copyNeutralTargets.stream().mapToDouble(TargetCoverage::getCoverage).toArray(); final double meanCopyNeutralTargets = new Mean().evaluate(copyNeutralTargetsCopyRatio); final double sigmaCopyNeutralTargets = new StandardDeviation().evaluate(copyNeutralTargetsCopyRatio); final double filteredCopyNeutralTargetsCopyRatio = Arrays.stream(copyNeutralTargetsCopyRatio) .filter(c -> Math.abs(c - meanCopyNeutralTargets) < sigmaCopyNeutralTargets * Z_THRESHOLD).toArray(); return new StandardDeviation().evaluate(filteredCopyNeutralTargetsCopyRatio); }
Source:
<code>public void testCLIFsckDDbInternalParam() throws Exception { <START> final int result = run(S3GuardTool.Fsck.NAME, "-"+Fsck.DDB_MS_CONSISTENCY_FLAG, <END> "s3a://" + getFileSystem().getBucket()); LOG.info("This test serves the purpose to run fsck with the correct " + "parameters, so there will be no exception thrown. " + "The return value of the run: {}", result); }</code><technical_language>nit: checkstyle want some spaces. Check line width</technical_language>

Target:
public void testCLIFsckDDbInternalParam() throws Exception { describe("This test serves the purpose to run fsck with the correct " + "parameters, so there will be no exception thrown."); final int result = run(S3GuardTool.Fsck.NAME, "-" + Fsck.DDB_MS_CONSISTENCY_FLAG, "s3a://" + getFileSystem().getBucket()); LOG.info("The return value of the run: {}", result); }
Source:
<code>public Tracker(Context context) { <START> if (null == context) { <END> return; } mContext = context; }</code><technical_language>mContext is required of code, sense throw IllegalArgumentException exception if a null context is passed</technical_language>

Target:
public Tracker(Context context) throws IllegalArgumentException { if (null == context) { throw new IllegalArgumentException("Tracker requires a not-null context"); } mContext = context; }
Source:
<code>private ArrayList<JsonArrayEntry> lwM2mResourceToJsonArrayEntry(String resourcePath, Long timestamp, LwM2mResource resource) { ResourceModel rSpec = model.getResourceModel(objectId, resource.getId()); Type expectedType = rSpec != null ? rSpec.type : resource.getType(); ArrayList<JsonArrayEntry> resourcesList = new ArrayList<>(); if (resource.isMultiInstances()) { <START> for (Entry<Integer, ?> entry : resource.getValues().entrySet()) { <END> String resourceInstancePath; if (resourcePath == null || resourcePath.isEmpty()) { resourceInstancePath = Integer.toString(entry.getKey()); } else { resourceInstancePath = resourcePath + "/" + entry.getKey(); } JsonArrayEntry jsonArrayEntry = createJsonArrayEntry(resourceInstancePath, timestamp, resource.getType(), expectedType, entry.getValue()); resourcesList.add(jsonArrayEntry); } } else { JsonArrayEntry jsonArrayEntry = createJsonArrayEntry(resourcePath, timestamp, resource.getType(), expectedType, resource.getValue()); resourcesList.add(jsonArrayEntry); } return resourcesList; }</code><technical_language>I prefer deprecated getValues() (which deleted later)</technical_language>

Target:
private ArrayList<JsonArrayEntry> lwM2mResourceToJsonArrayEntry(String resourcePath, Long timestamp, LwM2mResource resource) { ResourceModel rSpec = model.getResourceModel(objectId, resource.getId()); Type expectedType = rSpec != null ? rSpec.type : resource.getType(); ArrayList<JsonArrayEntry> resourcesList = new ArrayList<>(); if (resource.isMultiInstances()) { for (Entry<Integer, LwM2mResourceInstance> entry : resource.getInstances().entrySet()) { String resourceInstancePath; LwM2mResourceInstance instance = entry.getValue(); if (resourcePath == null || resourcePath.isEmpty()) { resourceInstancePath = Integer.toString(entry.getKey()); } else { resourceInstancePath = resourcePath + "/" + entry.getKey(); } JsonArrayEntry jsonArrayEntry = createJsonArrayEntry(resourceInstancePath, timestamp, resource.getType(), expectedType, instance.getValue()); resourcesList.add(jsonArrayEntry); } } else { JsonArrayEntry jsonArrayEntry = createJsonArrayEntry(resourcePath, timestamp, resource.getType(), expectedType, resource.getValue()); resourcesList.add(jsonArrayEntry); } return resourcesList; }
Source:
<code>public Builder(DataSegment segment) { this.dataSource = segment.getDataSource(); this.interval = segment.getInterval(); this.version = segment.getVersion(); this.loadSpec = segment.getLoadSpec(); this.dimensions = segment.getDimensions(); this.metrics = segment.getMetrics(); this.shardSpec = segment.getShardSpec(); <START> this.compactionPartitionsSpec = segment.compactionPartitionsSpec; <END> this.binaryVersion = segment.getBinaryVersion(); this.size = segment.getSize(); }</code><technical_language>getter</technical_language>

Target:
public Builder(DataSegment segment) { this.dataSource = segment.getDataSource(); this.interval = segment.getInterval(); this.version = segment.getVersion(); this.loadSpec = segment.getLoadSpec(); this.dimensions = segment.getDimensions(); this.metrics = segment.getMetrics(); this.shardSpec = segment.getShardSpec(); this.lastCompactionState = segment.getLastCompactionState(); this.binaryVersion = segment.getBinaryVersion(); this.size = segment.getSize(); }
Source:
<code>private void applyChanges() { final HashMap<String, String> params = generatePostParams(); if (params.size() > 0) { WordPress.getRestClientUtils().setGeneralSiteSettings( String.valueOf(mBlog.getRemoteBlogId()), new RestRequest.Listener() { @Override public void onResponse(JSONObject response) { if (params.containsKey("blogname")) { mBlog.setBlogName(params.get("blogname")); } } }, new RestRequest.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { if (mTaglinePreference != null) { mTaglinePreference.setEnabled(false); <START> mTaglinePreference.setSummary("Failed to retrieve :("); <END> } } }, params); } }</code><technical_language>Hard-coded string "Failed retrieve :("</technical_language>

Target:
private void applyChanges() { final HashMap<String, String> params = generatePostParams(); if (params.size() > 0) { WordPress.getRestClientUtils().setGeneralSiteSettings( String.valueOf(mBlog.getRemoteBlogId()), new RestRequest.Listener() { @Override public void onResponse(JSONObject response) { if (params.containsKey("blogname")) { mBlog.setBlogName(params.get("blogname")); } } }, new RestRequest.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { AppLog.w(AppLog.T.API, "Error POSTing site settings changes: " + error); if (isAdded()) { ToastUtils.showToast(getActivity(), getString(R.string.error_post_remote_site_settings)); } } }, params); } }
Source:
<code>public void runDemoMode() { <START> PopulateDB.wipeSurveys(); <END> PreferencesState.getInstance().saveStringPreference(R.string.org_unit, ""); PreferencesState.getInstance().reloadPreferences(); android.support.v7.app.ActionBar actionBar = mBaseActivity.getSupportActionBar(); LayoutUtils.setActionBarLogo(actionBar); LayoutUtils.setActionBarText(actionBar, PreferencesState.getInstance().getContext().getResources().getString( R.string.malaria_case_based_reporting), ""); loginDemoMode(); }</code><technical_language>@idelcano clean architecture, presentation layer call data layer clean database, invoke LogoutUseCase clean database org units preferences</technical_language>

Target:
public void runDemoMode() { mLogoutUseCase.execute(new LogoutUseCase.Callback() { @Override public void onLogoutSuccess() { PreferencesState.getInstance().reloadPreferences(); updateActionBarTitleAfterLogout(); loginDemoMode(); } @Override public void onLogoutError(String message) { Log.e(TAG, message); } }); }
Source:
<code>public ThriftMessageParser(SecorConfig config) { super(config); mDeserializer = new TDeserializer(); <START> this.fieldName = config.getMessageTimestampName(); <END> }</code><technical_language>here, config.getMessageTimestampName() appropriate</technical_language>

Target:
public ThriftMessageParser(SecorConfig config) { super(config); mDeserializer = new TDeserializer(); }
Source:
<code>public void parsePaymentRequest_withReturnUrlAndLanguageAndDelayedCapture_shouldParseSuccessfully() throws Exception { String payload = "{\n" + " \"amount\": 1000,\n" + " \"reference\": \"Some reference\",\n" + " \"description\": \"Some description\",\n" + " \"return_url\": \"<LINK_0>\",\n" + " \"language\": \"en\",\n" + <START> " \"delayed_capture\": false\n" + <END> "}"; JsonNode jsonNode = objectMapper.readTree(payload); CreatePaymentRequest createPaymentRequest = parsePaymentRequest(jsonNode); assertThat(createPaymentRequest, is(notNullValue())); assertThat(createPaymentRequest.getAmount(), is(1000)); assertThat(createPaymentRequest.getReference(), is("Some reference")); assertThat(createPaymentRequest.getDescription(), is("Some description")); assertThat(createPaymentRequest.getReturnUrl(), is("<LINK_0>")); assertThat(createPaymentRequest.getLanguage(), is("en")); assertThat(createPaymentRequest.getDelayedCapture(), is(false)); }</code><technical_language>I prefer if this true more confident relying default of a boolean field false</technical_language>

Target:
public void parsePaymentRequest_withReturnUrlAndLanguageAndDelayedCapture_shouldParseSuccessfully() throws Exception { String payload = "{\n" + " \"amount\": 1000,\n" + " \"reference\": \"Some reference\",\n" + " \"description\": \"Some description\",\n" + " \"return_url\": \"<LINK_0>\",\n" + " \"language\": \"en\",\n" + " \"delayed_capture\": true\n" + "}"; JsonNode jsonNode = objectMapper.readTree(payload); CreatePaymentRequest createPaymentRequest = parsePaymentRequest(jsonNode); assertThat(createPaymentRequest, is(notNullValue())); assertThat(createPaymentRequest.getAmount(), is(1000)); assertThat(createPaymentRequest.getReference(), is("Some reference")); assertThat(createPaymentRequest.getDescription(), is("Some description")); assertThat(createPaymentRequest.getReturnUrl(), is("<LINK_0>")); assertThat(createPaymentRequest.getLanguage(), is("en")); assertThat(createPaymentRequest.getDelayedCapture(), is(true)); }
Source:
<code>public void getPaths(GroupType schema, List<String> paths, String parent) { List<Type> fields = schema.getFields(); String prefix = (parent == null) ? "" : parent + "."; for (Type field : fields) { paths.add(prefix + field.getName()); if (field instanceof GroupType) { getPaths(field.asGroupType(), paths, prefix + field.getName()); <START> } <END> } }</code><technical_language>is great factored out methods parquet-hadoop do copy-paste in parquet-cli. Meanwhile, I do a step further. I do public methods is clear for. I suggest moving other related code parts in parquet-cli parquet-tools (and unit test) public method invoked input file, output file columns pruned</technical_language>

Target:
private void getPaths(GroupType schema, List<String> paths, String parent) { List<Type> fields = schema.getFields(); String prefix = (parent == null) ? "" : parent + "."; for (Type field : fields) { paths.add(prefix + field.getName()); if (field instanceof GroupType) { getPaths(field.asGroupType(), paths, prefix + field.getName()); } } }
Source:
<code>public Partition[] listPartitions() { getLog().info("fetching partitions information"); final List<String> zkPartitions; try { zkPartitions = getCurator().getChildren().forPath(getSubscriptionPath("/topics")); } catch (KeeperException.NoNodeException ex) { throw new SubscriptionNotInitializedException(getSubscriptionId()); } catch (final Exception e) { <START> throw new NakadiRuntimeException(e); <END> } try { final List<Partition> partitions = new ArrayList<>(); for (final String topic : zkPartitions) { for (final String partition : getCurator().getChildren().forPath(getSubscriptionPath("/topics/" + topic))) { partitions.add(deserializeNode( getTopicToEventType().get(topic), partition, getCurator().getData().forPath(getPartitionPath( new EventTypePartition(getTopicToEventType().get(topic), partition))))); } } return partitions.toArray(new Partition[partitions.size()]); } catch (final Exception e) { throw new NakadiRuntimeException(e); } }</code><technical_language>some of runtime exceptions MyNakadiRuntimeException1</technical_language>

Target:
public Partition[] listPartitions() throws NakadiRuntimeException { getLog().info("fetching partitions information"); final List<String> zkPartitions; try { zkPartitions = getCurator().getChildren().forPath(getSubscriptionPath("/topics")); } catch (KeeperException.NoNodeException ex) { throw new SubscriptionNotInitializedException(getSubscriptionId()); } catch (final Exception e) { throw new NakadiRuntimeException(e); } try { final List<Partition> partitions = new ArrayList<>(); for (final String topic : zkPartitions) { for (final String partition : getCurator().getChildren().forPath(getSubscriptionPath("/topics/" + topic))) { partitions.add(deserializeNode( getTopicToEventType().get(topic), partition, getCurator().getData().forPath(getPartitionPath( new EventTypePartition(getTopicToEventType().get(topic), partition))))); } } return partitions.toArray(new Partition[partitions.size()]); } catch (final Exception e) { throw new NakadiRuntimeException(e); } }
Source:
<code>public static Edge of(Name name) { for (Edge e : values()) { if (e.name.equals(name)) { <START> return e; <END> } } throw new IllegalArgumentException("Invalid name " + name.toString()); }</code><technical_language>I worked Scala - this simplified streams/a more functional interface</technical_language>

Target:
public static Edge of(Name name) { Edge edge = nameEdgeMap.get(name); if (edge == null) { throw new IllegalArgumentException("Invalid name " + name.toString()); } return edge; }
Source:
<code>Predicate<FiringUnitFilterData> getFiringUnits() { return firingUnits.and( firingUnitFilterData -> <START> Matches.unitIsBeingTransported().negate().test(firingUnitFilterData.getFiringUnit())); <END> }</code><technical_language>isCargo terminology. matches check include transported planes</technical_language>

Target:
public Predicate<FiringUnitFilterData> getFiringUnits() { return firingUnits.and(firingUnitFilterData -> notCargo(firingUnitFilterData.getFiringUnit())); }
Source:
<code>public int compare(Object o1, Object o2) { int c = 0; if (o1 == null && o2 == null) { c = 0; } else if (o1 == null) { c = -1; } <START> else if (o2 == null && o2 == null) { <END> c = 1; } else if ((o1 instanceof String) && (o2 instanceof String)) { c = StringUtility.compareIgnoreCase(m_locale, (String) o1, (String) o2); } else if ((o1 instanceof Comparable) && (o2 instanceof Comparable)) { c = ((Comparable) o1).compareTo(o2); } else { c = StringUtility.compareIgnoreCase(m_locale, o1.toString(), o2.toString()); } return c; }</code><technical_language>"else if (o2 == null)" only, it</technical_language>

Target:
public int compare(Object o1, Object o2) { int c = 0; if (o1 == null && o2 == null) { c = 0; } else if (o1 == null) { c = -1; } else if (o2 == null) { c = 1; } else if ((o1 instanceof String) && (o2 instanceof String)) { c = StringUtility.compareIgnoreCase(m_locale, (String) o1, (String) o2); } else if ((o1 instanceof Comparable) && (o2 instanceof Comparable)) { c = ((Comparable) o1).compareTo(o2); } else { c = StringUtility.compareIgnoreCase(m_locale, o1.toString(), o2.toString()); } return c; }
Source:
<code>public JobDeploymentsPath() { <START> elements[JOBS] = Paths.JOBS; <END> }</code><technical_language>This issue. elements[DEPLOYMENTS] set Paths.DEPLOYMENTS here</technical_language>

Target:
public JobDeploymentsPath() { elements[DEPLOYMENTS] = Paths.DEPLOYMENTS; elements[JOBS] = Paths.JOBS; }
Source:
<code>public void initialize() { <START> final Map<?, Vector> centroidsMap = memoryStore.getLocalStore().getAll(ClusteringPreCtrlTask.KEY_CENTROIDS); <END> centroids.addAll(centroidsMap.values()); final int numClusters = centroids.size(); for (int clusterID = 0; clusterID < numClusters; clusterID++) { final Vector vector = centroids.get(clusterID); final int dimension = vector.size(); clusterSummaries.add(new ClusterSummary(1.0, vector, DiagonalMatrix.identity(dimension))); } }</code><technical_language>longer stored values in local store. call removeAll instead of getAll</technical_language>

Target:
public void initialize() { final Map<?, Vector> centroidsMap = memoryStore.getLocalStore().removeAll(ClusteringPreCtrlTask.KEY_CENTROIDS); centroids.addAll(centroidsMap.values()); final int numClusters = centroids.size(); for (int clusterID = 0; clusterID < numClusters; clusterID++) { final Vector vector = centroids.get(clusterID); final int dimension = vector.size(); clusterSummaries.add(new ClusterSummary(1.0, vector, DiagonalMatrix.identity(dimension))); } }
Source:
<code>private void init() { setMaxLines(mMaxLines); setTextSize(TypedValue.COMPLEX_UNIT_SP, mTextSizeSp); <START> mMinTextSizePx = getTextSize() / 1.3f; <END> }</code><technical_language>is this 1.3f? put in a static variable name it</technical_language>

Target:
private void init() { setMaxLines(MAX_LINES); setTextSize(TypedValue.COMPLEX_UNIT_SP, TEXT_SIZE_SP); mMinTextSizePx = getTextSize() / MIN_TEXT_SIZE_FACTOR; }
Source:
<code>private Set<String> sourceLocationsToCopy(Path externalTableInfo) throws IOException { Set<String> locationsToCopy = new HashSet<>(); FileSystem fileSystem = externalTableInfo.getFileSystem(hiveConf); if (!fileSystem.exists(externalTableInfo)) { return locationsToCopy; } int currentRetry = 0; BufferedReader reader = null; while (currentRetry < MAX_RETRIES) { try { reader = reader(fileSystem, externalTableInfo); for (String line = reader.readLine(); line != null; line = reader.readLine()) { String[] splits = line.split(FIELD_SEPARATOR); locationsToCopy .add(new String(Base64.getDecoder().decode(splits[1]), StandardCharsets.UTF_8)); } return locationsToCopy; } catch (IOException e) { <START> if ((currentRetry + 1) < MAX_RETRIES) { <END> closeQuietly(reader); LOG.warn("failed to read {}", externalTableInfo.toString(), e); currentRetry++; } else { LOG.error("failed to read {}", externalTableInfo.toString(), e); throw e; } } finally { closeQuietly(reader); } } throw new IllegalStateException("we should never reach this condition"); }</code><technical_language>do currentRetry++ avoid +1</technical_language>

Target:
private Set<String> sourceLocationsToCopy(Path externalTableInfo) throws IOException { Set<String> locationsToCopy = new HashSet<>(); FileSystem fileSystem = externalTableInfo.getFileSystem(hiveConf); if (!fileSystem.exists(externalTableInfo)) { return locationsToCopy; } int currentRetry = 0; BufferedReader reader = null; while (currentRetry < MAX_RETRIES) { try { reader = reader(fileSystem, externalTableInfo); for (String line = reader.readLine(); line != null; line = reader.readLine()) { String[] splits = line.split(FIELD_SEPARATOR); locationsToCopy .add(new String(Base64.getDecoder().decode(splits[1]), StandardCharsets.UTF_8)); } return locationsToCopy; } catch (IOException e) { currentRetry++; if (currentRetry < MAX_RETRIES) { closeQuietly(reader); LOG.warn("failed to read {}", externalTableInfo.toString(), e); } else { LOG.error("failed to read {}", externalTableInfo.toString(), e); throw e; } } finally { closeQuietly(reader); } } throw new IllegalStateException("we should never reach this condition"); }
Source:
<code>public List<String> getPathTokens() { <START> return asList(path.substring(1).split("/")); <END> }</code><technical_language>I assume substring(1) is skip leading /. this there? I feel more confident if Arrays.stream(path.split("/")).skip(1).collect(Collectors.toList()), blow if isn't</technical_language>

Target:
public List<String> getPathTokens() { return Arrays.stream(path.split("/")).skip(1).collect(Collectors.toList()); }
Source:
<code>public void log(LogLevel level, String category, Context context, Throwable throwable, String message) { Context actualContext = context == null ? ContextBuilder.emptyContext() : ContextBuilder.create(context).build(); <START> try { <END> backend.setNewContext(actualContext); this.backend.log(category, level, message, throwable); } finally { backend.resetContext(null); } }</code><technical_language>get backend's current context, store in a "previousContext" variable, do a backend.resetContext(previousContext) in finally clause</technical_language>

Target:
public void log(LogLevel level, String category, Context context, Throwable throwable, String message) { Context actualContext = context == null ? ContextBuilder.emptyContext() : ContextBuilder.create(context).build(); Map<String, String> currentContext = backend.getCopyOfContextMap(); try { backend.setNewContext(actualContext); backend.log(category, level, message, throwable); } finally { backend.resetContext(currentContext); } }
Source:
<code>public void waitErrorMessage(String message) { <START> webDriverWaitFactory <END> .get() .until( (ExpectedCondition<Boolean>) driver -> seleniumWebDriverHelper .waitVisibilityAndGetText(By.id(ERROR_MESSAGE)) .equals(message)); }</code><technical_language>**seleniumWebDriverHelper.waitTextEqualsTo()** here, we</technical_language>

Target:
public void waitErrorMessage(String message) { seleniumWebDriverHelper.waitTextEqualsTo(By.id(ERROR_MESSAGE), message); }
Source:
<code>public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ReferencePointImpl other = (ReferencePointImpl) obj; <START> if (path == null) { <END> if (other.path != null) return false; } else if (!path.equals(other.path)) return false; return true; }</code><technical_language>simplify if-else block Java if (path == null) { return other.path == null; } else { return path.equals(other.path); }</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ReferencePointImpl other = (ReferencePointImpl) obj; if (!path.equals(other.path)) return false; return true; }
Source:
<code><START> public void getMemberships_shouldNotGetMatchingMembershipsAsOfADate() throws Exception { <END> executeDataSet(COHORT_XML); Cohort cohort = Context.getCohortService().getCohort(1); CohortMembership newMember = new CohortMembership((new Patient(4))); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date startDate = dateFormat.parse("2017-11-01 00:00:00"); newMember.setStartDate(startDate); service.addMembershipToCohort(cohort, newMember); Date dateToTest = dateFormat.parse("2016-11-01 00:00:00"); List<CohortMembership> membersAsOfDate = cohort.getMemberships(dateToTest); assertTrue(membersAsOfDate.isEmpty()); assertFalse(membersAsOfDate.stream().anyMatch(m -> m.getStartDate().equals(dateToTest))); }</code><technical_language>unit test style please update</technical_language>

Target:
public void getMemberships_shouldNotGetMatchingMembershipsAsOfADate() throws Exception { executeDataSet(COHORT_XML); Cohort cohort = Context.getCohortService().getCohort(1); CohortMembership newMember = new CohortMembership(4); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date startDate = dateFormat.parse("2017-11-01 00:00:00"); newMember.setStartDate(startDate); service.addMembershipToCohort(cohort, newMember); Date dateToTest = dateFormat.parse("2016-11-01 00:00:00"); List<CohortMembership> membersAsOfDate = cohort.getActiveMemberships(dateToTest); assertFalse(membersAsOfDate.stream().anyMatch(m -> m.getStartDate().equals(dateToTest))); }
Source:
<code>protected void translateAndSendBatch(ConsumerRecords<?, ?> records, Instant readTime) { for (TopicPartition topicPartition : records.partitions()) { for (ConsumerRecord<?, ?> record : records.records(topicPartition)) { try { boolean skipRecord; synchronized (_sendFailureTopicPartitionExceptionMap) { skipRecord = _autoPausedSourcePartitions.containsKey(topicPartition) || _sendFailureTopicPartitionExceptionMap.containsKey(topicPartition); } if (skipRecord) { <START> _logger.warn("Abort sending as is auto-paused or saw a send failure, rewind offset", topicPartition); <END> seekToLastCheckpoint(Collections.singleton(topicPartition)); break; } else { DatastreamProducerRecord datastreamProducerRecord = translate(record, readTime); int numBytes = record.serializedKeySize() + record.serializedValueSize(); sendDatastreamProducerRecord(datastreamProducerRecord, topicPartition, numBytes, null); } } catch (Exception e) { _logger.warn(String.format("Got exception while sending record %s, exception: ", record), e); rewindAndPausePartitionOnException(topicPartition, e); break; } } } }</code><technical_language>Do a in clarifying in warning skipping record of autoPausedSourcePartition send failure</technical_language>

Target:
protected void translateAndSendBatch(ConsumerRecords<?, ?> records, Instant readTime) { for (TopicPartition topicPartition : records.partitions()) { for (ConsumerRecord<?, ?> record : records.records(topicPartition)) { try { boolean partitionPaused; boolean sendFailure; synchronized (_sendFailureTopicPartitionExceptionMap) { partitionPaused = _autoPausedSourcePartitions.containsKey(topicPartition); sendFailure = _sendFailureTopicPartitionExceptionMap.containsKey(topicPartition); } if (partitionPaused || sendFailure) { _logger.warn("Abort sending for {}, auto-paused: {}, send failure: {}, rewind offset", topicPartition, partitionPaused, sendFailure); seekToLastCheckpoint(Collections.singleton(topicPartition)); break; } else { DatastreamProducerRecord datastreamProducerRecord = translate(record, readTime); int numBytes = record.serializedKeySize() + record.serializedValueSize(); sendDatastreamProducerRecord(datastreamProducerRecord, topicPartition, numBytes, null); } } catch (Exception e) { _logger.warn(String.format("Got exception while sending record %s, exception: ", record), e); rewindAndPausePartitionOnException(topicPartition, e); break; } } } }
Source:
<code>public X509Certificate createX509Certificate(Entitlement ent, Product product, Set<Product> products, List<org.candlepin.model.dto.Product> productModels, BigInteger serialNumber, KeyPair keyPair, boolean useContentPrefix) throws GeneralSecurityException, IOException { Set<X509ExtensionWrapper> extensions; Set<X509ByteExtensionWrapper> byteExtensions = new LinkedHashSet<X509ByteExtensionWrapper>(); products.add(product); Map<String, EnvironmentContent> promotedContent = getPromotedContent(ent); String contentPrefix = getContentPrefix(ent, useContentPrefix); if (shouldGenerateV3(ent)) { extensions = prepareV3Extensions(ent, contentPrefix, promotedContent); byteExtensions = prepareV3ByteExtensions(product, productModels, ent, contentPrefix, promotedContent); } else { extensions = prepareV1Extensions(products, ent, contentPrefix, promotedContent); } setupEntitlementEndDate(ent); Calendar cal = Calendar.getInstance(); cal.add(Calendar.HOUR, -1); <START> Date startDate = ent.getStartDate().getTime() < cal.getTime().getTime() ? <END> ent.getStartDate() : cal.getTime(); X509Certificate x509Cert = this.pki.createX509Certificate( createDN(ent), extensions, byteExtensions, startDate, ent.getEndDate(), keyPair, serialNumber, null); return x509Cert; }</code><technical_language>want Date's function here. (ent.getStartDate().before(cal.getTime()) ? ... : ..</technical_language>

Target:
public X509Certificate createX509Certificate(Entitlement ent, Product product, Set<Product> products, List<org.candlepin.model.dto.Product> productModels, BigInteger serialNumber, KeyPair keyPair, boolean useContentPrefix) throws GeneralSecurityException, IOException { Set<X509ExtensionWrapper> extensions; Set<X509ByteExtensionWrapper> byteExtensions = new LinkedHashSet<X509ByteExtensionWrapper>(); products.add(product); Map<String, EnvironmentContent> promotedContent = getPromotedContent(ent); String contentPrefix = getContentPrefix(ent, useContentPrefix); if (shouldGenerateV3(ent)) { extensions = prepareV3Extensions(ent, contentPrefix, promotedContent); byteExtensions = prepareV3ByteExtensions(product, productModels, ent, contentPrefix, promotedContent); } else { extensions = prepareV1Extensions(products, ent, contentPrefix, promotedContent); } setupEntitlementEndDate(ent); Calendar cal = Calendar.getInstance(); cal.add(Calendar.HOUR, -1); Date startDate = ent.getStartDate().before(cal.getTime()) ? ent.getStartDate() : cal.getTime(); X509Certificate x509Cert = this.pki.createX509Certificate( createDN(ent), extensions, byteExtensions, startDate, ent.getEndDate(), keyPair, serialNumber, null); return x509Cert; }
Source:
<code>private boolean downloadSingleFile(FTPClient ftpClient, String remoteFilePath, String savePath) throws IOException { getOut().println("About to download the file: " + remoteFilePath); File downloadFile = new File(savePath); File parentDir = downloadFile.getParentFile(); if (parentDir != null && !parentDir.exists()) { parentDir.mkdirs(); } OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(downloadFile)); try { return ftpClient.retrieveFile(remoteFilePath, outputStream); } catch (IOException ex) { <START> throw ex; <END> } finally { if (outputStream != null) { outputStream.close(); } } }</code><technical_language>![MINOR](<LINK_2> 'Severity: MINOR') Add logic this catch clause eliminate rethrow exception automatically. [![rule](<LINK_1>](<LINK_0></technical_language>

Target:
private boolean downloadSingleFile(FTPClient ftpClient, String remoteFilePath, String savePath) throws IOException { getOut().println("About to download the file: " + remoteFilePath); File downloadFile = new File(savePath); File parentDir = downloadFile.getParentFile(); if (parentDir != null && !parentDir.exists()) { parentDir.mkdirs(); } OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(downloadFile)); try { return ftpClient.retrieveFile(remoteFilePath, outputStream); } catch (IOException ex) { throw ex; } finally { outputStream.close(); } }