auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public GraphDatabaseService create() { final String dbLocationAbsolutePath = dbLocation.getAbsolutePath(); AtomicBoolean isNew = new AtomicBoolean( false ); FactoryHolder factoryHolder = GRAPH_DATABASE_SERVICE_MAP.computeIfAbsent( dbLocationAbsolutePath, ( String dbPath ) -> { LOG.infof( " Create new service instance for dbPath %s", dbLocationAbsolutePath ); GraphDatabaseFacade service = buildGraphDatabaseService(); FactoryHolder holder = new FactoryHolder(); holder.setCounter( 1 ); holder.setGraphDatabaseFacade( service ); isNew.set( true ); return holder; <START> } ); <END> if ( !isNew.get() ) { synchronized (GRAPH_DATABASE_SERVICE_MAP) { factoryHolder.getGraphDatabaseFacade(); boolean isAvailable = factoryHolder.getGraphDatabaseFacade().isAvailable( 100 ); if ( isAvailable ) { factoryHolder.setCounter( factoryHolder.getCounter() + 1 ); } else { LOG.infof( " Recreate service instance for dbPath %s", dbLocationAbsolutePath ); factoryHolder.setCounter( 1 ); factoryHolder.setGraphDatabaseFacade( buildGraphDatabaseService() ); } LOG.debugf( " Counter : %s for path %s", factoryHolder.getCounter(), dbLocationAbsolutePath ); } } return factoryHolder.getGraphDatabaseFacade(); }</code><technical_language>send a PR rename a method add changes in commit. harder figure out important changes in this commit</technical_language>

Target:
public GraphDatabaseService create() { final String dbLocationAbsolutePath = dbLocation.getAbsolutePath(); AtomicBoolean isNew = new AtomicBoolean( false ); FactoryHolder factoryHolder = GRAPH_DATABASE_SERVICE_MAP.computeIfAbsent( dbLocationAbsolutePath, ( String dbPath ) -> { LOG.infof( " Create new service instance for dbPath %s", dbLocationAbsolutePath ); GraphDatabaseFacade service = buildGraphDatabaseService(); FactoryHolder holder = new FactoryHolder(); holder.setCounter( 1 ); holder.setGraphDatabaseFacade( service ); isNew.set( true ); return holder; } ); if ( !isNew.get() ) { synchronized (GRAPH_DATABASE_SERVICE_MAP) { factoryHolder.getGraphDatabaseFacade(); boolean isAvailable = factoryHolder.getGraphDatabaseFacade().isAvailable( WAITING_TIME_MS ); if ( isAvailable ) { factoryHolder.setCounter( factoryHolder.getCounter() + 1 ); } else { LOG.infof( " Recreate service instance for dbPath %s", dbLocationAbsolutePath ); factoryHolder.setCounter( 1 ); factoryHolder.setGraphDatabaseFacade( buildGraphDatabaseService() ); } LOG.debugf( " Counter : %s for path %s", factoryHolder.getCounter(), dbLocationAbsolutePath ); } } return factoryHolder.getGraphDatabaseFacade(); }
Source:
<code>private void startServer() { Map<String, Object> opts = new Docopt(USAGE) .withVersion(GitRepositoryState.getRepositoryState().describe) .parse(args); printStartupMsg(opts); configureLogger(opts); log.info("Started with arguments: {}", opts); final ServerContext serverContext = new ServerContext(opts); if (opts.get("--network-interface") != null) { opts.put("--address", getAddressFromInterfaceName((String) opts.get("--network-interface"))); opts.put("--bind-to-all-interfaces", false); } else if (opts.get("--address") == null) { opts.put("--bind-to-all-interfaces", true); opts.put("--address", "localhost"); } else { opts.put("--bind-to-all-interfaces", false); } Thread shutdownThread = new Thread(new CleanupRunnable(this)); shutdownThread.setName("ShutdownThread"); Runtime.getRuntime().addShutdownHook(shutdownThread); while (!shutdownServer) { try { CompletableFuture<LogReplicationContext> discoveryServiceCallback = startDiscoveryService(serverContext); log.info("Wait for Discovery Service to provide a view of the topology..."); LogReplicationContext context = discoveryServiceCallback.get(); activeServer = new CorfuInterClusterReplicationServerNode(serverContext, context); activeServer.startAndListen(); } catch (Throwable th) { <START> if (!test) { <END> log.error("CorfuServer: Server exiting due to unrecoverable error: ", th); System.exit(EXIT_ERROR_CODE); } else { cleanShutdown(); } } if (cleanupServer) { cleanupServer = false; } if (!shutdownServer) { log.info("main: Server restarting."); } } log.info("main: Server exiting due to shutdown"); }</code><technical_language>I a bit confused this logic. do need cleanShutdown testing? Also, register shutdown hook earlier while loop? kick in system exit</technical_language>

Target:
private void startServer() { Map<String, Object> opts = new Docopt(USAGE) .withVersion(GitRepositoryState.getRepositoryState().describe) .parse(args); printStartupMsg(opts); configureLogger(opts); log.info("Started with arguments: {}", opts); ServerContext serverContext = getServerContext(opts); Thread shutdownThread = new Thread(this::cleanShutdown); shutdownThread.setName("ShutdownThread"); Runtime.getRuntime().addShutdownHook(shutdownThread); while (!shutdownServer) { try { CompletableFuture<CorfuInterClusterReplicationServerNode> discoveryServiceCallback = startDiscoveryService(serverContext); log.info("Wait for Discovery Service to provide a view of the topology..."); activeServer = discoveryServiceCallback.get(); log.info("Discovery Service completed. Start Log Replication Service..."); activeServer.startAndListen(); } catch (Throwable th) { log.error("CorfuServer: Server exiting due to unrecoverable error: ", th); System.exit(EXIT_ERROR_CODE); } if (cleanupServer) { cleanupServer = false; } if (!shutdownServer) { log.info("main: Server restarting."); } } log.info("main: Server exiting due to shutdown"); }
Source:
<code>static Statsd getInstance(String contextPath, String hostName) { final String statsdAddress = Parameter.STATSD_ADDRESS.getValue(); if (statsdAddress != null) { assert contextPath != null; assert hostName != null; final String address; final int port; final int index = statsdAddress.lastIndexOf(':'); if (index != -1) { address = statsdAddress.substring(0, index); port = Integer.parseInt(statsdAddress.substring(index + 1)); } else { address = statsdAddress; port = DEFAULT_STATSD_PORT; } String statsdPrefix = Parameter.STATSD_PREFIX.getValueOrDefault("javamelody.${context}.${host}."); statsdPrefix = statsdPrefix.replace("${context}", contextPath.replace("/", "")). <START> replace("${host}", hostName); <END> try { return new Statsd(InetAddress.getByName(address), port, statsdPrefix); } catch (final UnknownHostException e) { throw new IllegalArgumentException("Invalid host: " + address, e); } } return null; }</code><technical_language>I thinking of dynamic that. other parameters dynamic, remove replace default prefix</technical_language>

Target:
static Statsd getInstance(String contextPath, String hostName) { final String statsdAddress = Parameter.STATSD_ADDRESS.getValue(); if (statsdAddress != null) { assert contextPath != null; assert hostName != null; final String address; final int port; final int index = statsdAddress.lastIndexOf(':'); if (index != -1) { address = statsdAddress.substring(0, index); port = Integer.parseInt(statsdAddress.substring(index + 1)); } else { address = statsdAddress; port = DEFAULT_STATSD_PORT; } String statsdPrefix = Parameter.STATSD_PREFIX.getValue(); if (statsdPrefix == null) { statsdPrefix = "javamelody." + contextPath.replace("/", "") + "." + hostName + "."; } try { return new Statsd(InetAddress.getByName(address), port, statsdPrefix); } catch (final UnknownHostException e) { throw new IllegalArgumentException("Invalid host: " + address, e); } } return null; }
Source:
<code>public String convertMemberName(Member member) { if (Modifier.isTransient(member.getModifiers())) { return null; } VisibilityChecker<?> visibilityChecker = mapper.getVisibilityChecker(); if (member instanceof Field) { Field f = (Field) member; if (f.isAnnotationPresent(JsonIgnore.class) || !visibilityChecker.isFieldVisible(f)) { return null; } if (f.isAnnotationPresent(JsonProperty.class)) { String propertyName = f.getDeclaredAnnotation(JsonProperty.class).value(); return CoreUtils.isNullOrEmpty(propertyName) ? f.getName() : propertyName; } return f.getName(); } if (member instanceof Method) { Method m = (Method) member; if (!verifyGetter(m) || m.isAnnotationPresent(JsonIgnore.class) <START> || !visibilityChecker.isGetterVisible(m)) { <END> return null; } String methodNameWithoutJavaBeans = removePrefix(m); if (m.isAnnotationPresent(JsonGetter.class)) { String propertyName = m.getDeclaredAnnotation(JsonGetter.class).value(); return CoreUtils.isNullOrEmpty(propertyName) ? methodNameWithoutJavaBeans : propertyName; } if (m.isAnnotationPresent(JsonProperty.class)) { String propertyName = m.getDeclaredAnnotation(JsonProperty.class).value(); return CoreUtils.isNullOrEmpty(propertyName) ? methodNameWithoutJavaBeans : propertyName; } return methodNameWithoutJavaBeans; } return null; }</code><technical_language>useful log a warning if method annotation is non-public. users visibility of method is reason for ignoring it. for field too</technical_language>

Target:
public String convertMemberName(Member member) { if (Modifier.isTransient(member.getModifiers())) { return null; } VisibilityChecker<?> visibilityChecker = mapper.getVisibilityChecker(); if (member instanceof Field) { Field f = (Field) member; if (f.isAnnotationPresent(JsonIgnore.class) || !visibilityChecker.isFieldVisible(f)) { if (f.isAnnotationPresent(JsonProperty.class)) { logger.info("Field is annotated with JsonProperty but isn't accessible to " + "JacksonJsonSerializer.", f.getName()); } return null; } if (f.isAnnotationPresent(JsonProperty.class)) { String propertyName = f.getDeclaredAnnotation(JsonProperty.class).value(); return CoreUtils.isNullOrEmpty(propertyName) ? f.getName() : propertyName; } return f.getName(); } if (member instanceof Method) { Method m = (Method) member; if (!verifyGetter(m) || m.isAnnotationPresent(JsonIgnore.class) || !visibilityChecker.isGetterVisible(m)) { if (m.isAnnotationPresent(JsonGetter.class) || m.isAnnotationPresent(JsonProperty.class)) { logger.info("Method is annotated with either JsonGetter or JsonProperty but isn't accessible " + "to JacksonJsonSerializer.", m.getName()); } return null; } String methodNameWithoutJavaBeans = removePrefix(m); if (m.isAnnotationPresent(JsonGetter.class)) { String propertyName = m.getDeclaredAnnotation(JsonGetter.class).value(); return CoreUtils.isNullOrEmpty(propertyName) ? methodNameWithoutJavaBeans : propertyName; } if (m.isAnnotationPresent(JsonProperty.class)) { String propertyName = m.getDeclaredAnnotation(JsonProperty.class).value(); return CoreUtils.isNullOrEmpty(propertyName) ? methodNameWithoutJavaBeans : propertyName; } return methodNameWithoutJavaBeans; } return null; }
Source:
<code>private boolean isVariableHeight(int lineIndex) { <START> if (styledText.wordWrap || styledText.visualWrap) { <END> return true; } StyleRange[] styles = getStylesForLine(lineIndex); if (styles != null) { for (StyleRange style : styles) { if (style.isVariableHeight(styledText.isWordWrap())) { return true; } } } return false; }</code><technical_language>styledText.isWordWrap()</technical_language>

Target:
private boolean isVariableHeight(int lineIndex) { if (styledText.isWordWrap()) { return true; } StyleRange[] styles = getStylesForLine(lineIndex); if (styles != null) { for (StyleRange style : styles) { if (style.isVariableHeight(false)) { return true; } } } return false; }
Source:
<code>private void assertInvalidPath(String path) { SubfieldTokenizer tokenizer = new SubfieldTokenizer(path); try { <START> ImmutableList<PathElement> pathElements = Streams.stream(tokenizer).collect(toImmutableList()); <END> fail("Expected failure"); } catch (PrestoException e) { assertTrue(e.getMessage().startsWith("Invalid subfield path: ")); } }</code><technical_language>nit: Streams.stream(tokenizer).collect(toImmutableList()); is good enough. (Assignment pathElements is necessary)</technical_language>

Target:
private void assertInvalidPath(String path) { SubfieldTokenizer tokenizer = new SubfieldTokenizer(path); try { Streams.stream(tokenizer).collect(toImmutableList()); fail("Expected failure"); } catch (PrestoException e) { assertTrue(e.getMessage().startsWith("Invalid subfield path: ")); } }
Source:
<code>protected Function<Object, IterableWithMarker<Discount>> markerToNextForArgs(List<Object> args) { return new Function<Object, IterableWithMarker<Discount>>() { @Override <START> public IterableWithMarker<Discount> apply(@Nullable Object input) { <END> PaginationOptions paginationOptions = PaginationOptions.class.cast(input); return api.listDiscounts(paginationOptions); } }; }</code><technical_language>This function called marker is present, in practice input parameter null. Remove @Nullable annotation (apply this parser classes)</technical_language>

Target:
protected Function<Object, IterableWithMarker<Discount>> markerToNextForArgs(List<Object> args) { return new Function<Object, IterableWithMarker<Discount>>() { @Override public IterableWithMarker<Discount> apply(Object input) { PaginationOptions paginationOptions = PaginationOptions.class.cast(input); return api.listDiscounts(paginationOptions); } }; }
Source:
<code>public void testContainsPolyline3Intervals() { String test = "LINESTRING (56.836 60.6126, 56.8393 60.6114, 56.83887 60.60811, 56.83782 60.5988)"; try { <START> GeofenceGeometry geofenceGeometry = new GeofencePolyline(test, 15); <END> Assert.assertTrue(geofenceGeometry.containsPoint(56.83847, 60.60458)); Assert.assertTrue(!geofenceGeometry.containsPoint(56.83764, 60.59725)); Assert.assertTrue(!geofenceGeometry.containsPoint(56.83861, 60.60822)); } catch (ParseException e){ Assert.assertTrue("ParseExceprion: " + e.getMessage(), true); } }</code><technical_language>Please fix formatting in this method</technical_language>

Target:
public void testContainsPolyline3Intervals() throws ParseException { String test = "LINESTRING (56.836 60.6126, 56.8393 60.6114, 56.83887 60.60811, 56.83782 60.5988)"; GeofenceGeometry geofenceGeometry = new GeofencePolyline(test, 15); Assert.assertTrue(geofenceGeometry.containsPoint(56.83847, 60.60458)); Assert.assertTrue(!geofenceGeometry.containsPoint(56.83764, 60.59725)); Assert.assertTrue(!geofenceGeometry.containsPoint(56.83861, 60.60822)); }
Source:
<code>private void lock(String key) throws InterruptedException { <START> synchronized (lockedKeys) { <END> while (!lockedKeys.add(key)) { LOG.debug(String.format("%s waits for %s", Thread.currentThread().getName(), key)); lockedKeys.wait(); } } }</code><technical_language>This is locking key level set object level</technical_language>

Target:
private void lock(String key) throws InterruptedException { synchronized (lockedKeys) { if (lockedKeys.contains(key)) { LOG.debug(String.format("%s waits for %s", Thread.currentThread().getName(), key)); lockedKeys.wait(); } LOG.debug(String.format("%s acquired key %s", Thread.currentThread().getName(), key)); lockedKeys.add(key); } }
Source:
<code>public synchronized void send(final EventualMessage msg) { assert msg.getTarget() == this; if (message == null) { message = msg; if (VmSettings.MESSAGE_TIMESTAMPS) { sendTimeStamp = System.currentTimeMillis(); } } else { <START> sendMoreMessages(msg); <END> } logMessageAddedToMailbox(msg); if (!isExecuting) { isExecuting = true; executeOnPool(); } }</code><technical_language>appendToMailbox(msg)</technical_language>

Target:
public synchronized void send(final EventualMessage msg) { assert msg.getTarget() == this; if (firstMessage == null) { firstMessage = msg; if (VmSettings.MESSAGE_TIMESTAMPS) { firstMessageTimeStamp = System.currentTimeMillis(); } } else { appendToMailbox(msg); } logMessageAddedToMailbox(msg); if (!isExecuting) { isExecuting = true; executeOnPool(); } }
Source:
<code>public Mono<Void> sendOne(Frame frame) { <START> ByteBuf content = frame.content().skipBytes(3); <END> return out.sendObject(new BinaryWebSocketFrame(content)).then(); }</code><technical_language>Please FrameHeaderFlyweight .FRAME_LENGTH_SIZE instead of hardcoding</technical_language>

Target:
public Mono<Void> sendOne(Frame frame) { return out.sendObject(new BinaryWebSocketFrame(frame.content().skipBytes(FRAME_LENGTH_SIZE))).then(); }
Source:
<code>public List<BranchStatistics> searchBranchStatistics(String projectUuid, List<String> branchUuids) { if (branchUuids.isEmpty()) { return Collections.emptyList(); } SearchRequestBuilder request = client.prepareSearch(IssueIndexDefinition.INDEX_TYPE_ISSUE) .setRouting(projectUuid) .setQuery( boolQuery() .must(termsQuery(IssueIndexDefinition.FIELD_ISSUE_BRANCH_UUID, branchUuids)) .must(termQuery(IssueIndexDefinition.FIELD_ISSUE_IS_MAIN_BRANCH, Boolean.toString(false)))) .setSize(0) .addAggregation(AggregationBuilders.terms("branchUuids") .field(IssueIndexDefinition.FIELD_ISSUE_BRANCH_UUID) .size(branchUuids.size()) .subAggregation(AggregationBuilders.terms("types") .field(IssueIndexDefinition.FIELD_ISSUE_TYPE))); SearchResponse response = request.get(); return ((StringTerms) response.getAggregations().get("branchUuids")).getBuckets().stream() .map(bucket -> new BranchStatistics(bucket.getKeyAsString(), <START> ((StringTerms) bucket.getAggregations().get("types")).getBuckets() <END> .stream() .collect(uniqueIndex(StringTerms.Bucket::getKeyAsString, InternalTerms.Bucket::getDocCount)))) .collect(MoreCollectors.toList(branchUuids.size())); }</code><technical_language>![MINOR](<LINK_2> 'Severity: MINOR') Remove this unnecessary cast "StringTerms". [![rule](<LINK_1>](<LINK_0></technical_language>

Target:
public List<BranchStatistics> searchBranchStatistics(String projectUuid, List<String> branchUuids) { if (branchUuids.isEmpty()) { return Collections.emptyList(); } SearchRequestBuilder request = client.prepareSearch(IssueIndexDefinition.INDEX_TYPE_ISSUE) .setRouting(projectUuid) .setQuery( boolQuery() .must(termsQuery(IssueIndexDefinition.FIELD_ISSUE_BRANCH_UUID, branchUuids)) .mustNot(existsQuery(IssueIndexDefinition.FIELD_ISSUE_RESOLUTION)) .must(termQuery(IssueIndexDefinition.FIELD_ISSUE_IS_MAIN_BRANCH, Boolean.toString(false)))) .setSize(0) .addAggregation(AggregationBuilders.terms("branchUuids") .field(IssueIndexDefinition.FIELD_ISSUE_BRANCH_UUID) .size(branchUuids.size()) .subAggregation(AggregationBuilders.terms("types") .field(IssueIndexDefinition.FIELD_ISSUE_TYPE))); SearchResponse response = request.get(); return ((StringTerms) response.getAggregations().get("branchUuids")).getBuckets().stream() .map(bucket -> new BranchStatistics(bucket.getKeyAsString(), ((StringTerms) bucket.getAggregations().get("types")).getBuckets() .stream() .collect(uniqueIndex(StringTerms.Bucket::getKeyAsString, InternalTerms.Bucket::getDocCount)))) .collect(MoreCollectors.toList(branchUuids.size())); }
Source:
<code>private void refreshStates() { <START> mSwitchActive.setChecked(mPlugin.isActive()); <END> mSwitchAutoupdates.setChecked(mPlugin.isAutoUpdateEnabled()); }</code><technical_language>worth adding isFinishing() check updating views. WDYT</technical_language>

Target:
private void refreshStates() { if (isFinishing()) { return; } mSwitchActive.setChecked(mPlugin.isActive()); mSwitchAutoupdates.setChecked(mPlugin.isAutoUpdateEnabled()); }
Source:
<code>public void unvoidDiagnosis_shouldUnvoidDiagnosisSuccessfully(){ String uuid = "77009cce-8804-17e4-8804-a68804d22fb7"; Diagnosis voidedDiagnosis = diagnosisService.getDiagnosisByUuid(uuid); Assert.assertTrue(voidedDiagnosis.getVoided()); Assert.assertNotNull(voidedDiagnosis.getVoidReason()); Assert.assertNotNull(voidedDiagnosis.getDateVoided()); Assert.assertNotNull(voidedDiagnosis.getVoidedBy()); <START> Diagnosis unVoidedDiagnosis= diagnosisService.unvoidDiagnosis(voidedDiagnosis); <END> Assert.assertEquals(ConditionVerificationStatus.PROVISIONAL, unVoidedDiagnosis.getCertainty()); Assert.assertEquals(uuid, unVoidedDiagnosis.getUuid()); Assert.assertFalse(unVoidedDiagnosis.getVoided()); Assert.assertNull(unVoidedDiagnosis.getVoidReason()); Assert.assertNull(unVoidedDiagnosis.getDateVoided()); Assert.assertNull(unVoidedDiagnosis.getVoidedBy()); }</code><technical_language>instead fetch this diagnosisService.getDiagnosisByUuid()</technical_language>

Target:
public void unvoidDiagnosis_shouldUnvoidDiagnosisSuccessfully(){ String uuid = "77009cce-8804-17e4-8804-a68804d22fb7"; Diagnosis voidedDiagnosis = diagnosisService.getDiagnosisByUuid(uuid); Assert.assertTrue(voidedDiagnosis.getVoided()); Assert.assertNotNull(voidedDiagnosis.getVoidReason()); Assert.assertNotNull(voidedDiagnosis.getDateVoided()); Assert.assertNotNull(voidedDiagnosis.getVoidedBy()); diagnosisService.unvoidDiagnosis(voidedDiagnosis); Diagnosis unVoidedDiagnosis= diagnosisService.getDiagnosisByUuid(uuid); Assert.assertEquals(ConditionVerificationStatus.PROVISIONAL, unVoidedDiagnosis.getCertainty()); Assert.assertEquals(uuid, unVoidedDiagnosis.getUuid()); Assert.assertFalse(unVoidedDiagnosis.getVoided()); Assert.assertNull(unVoidedDiagnosis.getVoidReason()); Assert.assertNull(unVoidedDiagnosis.getDateVoided()); Assert.assertNull(unVoidedDiagnosis.getVoidedBy()); }
Source:
<code>private static boolean isCandidateForReferenceView(TmfView tmfView, TmfTimeViewAlignmentInfo alignmentInfo, int lowestTimeAxisOffset) { ITmfTimeAligned alignedView = (ITmfTimeAligned) tmfView; TmfTimeViewAlignmentInfo timeViewAlignmentInfo = alignedView.getTimeViewAlignmentInfo(); <START> System.out.println(); <END> System.out.println(); Composite parentComposite = tmfView.getParentComposite(); if (parentComposite != null && parentComposite.isVisible() && timeViewAlignmentInfo != null && isViewLocationNear(alignmentInfo.getViewLocation(), getViewLocation(tmfView)) && getClampedTimeAxisOffset(timeViewAlignmentInfo) < lowestTimeAxisOffset) { int availableWidth = alignedView.getAvailableWidth(getClampedTimeAxisOffset(timeViewAlignmentInfo)); availableWidth = getClampedTimeAxisWidth(timeViewAlignmentInfo, availableWidth); if (availableWidth > 0) { return true; } } return false; }</code><technical_language>Oops</technical_language>

Target:
private static boolean isCandidateForReferenceView(TmfView tmfView, TmfTimeViewAlignmentInfo alignmentInfo, int lowestTimeAxisOffset) { ITmfTimeAligned alignedView = (ITmfTimeAligned) tmfView; TmfTimeViewAlignmentInfo timeViewAlignmentInfo = alignedView.getTimeViewAlignmentInfo(); Composite parentComposite = tmfView.getParentComposite(); if (parentComposite != null && parentComposite.isVisible() && timeViewAlignmentInfo != null && isViewLocationNear(alignmentInfo.getViewLocation(), getViewLocation(tmfView)) && getClampedTimeAxisOffset(timeViewAlignmentInfo) < lowestTimeAxisOffset) { int availableWidth = alignedView.getAvailableWidth(getClampedTimeAxisOffset(timeViewAlignmentInfo)); availableWidth = getClampedTimeAxisWidth(timeViewAlignmentInfo, availableWidth); if (availableWidth > 0) { return true; } } return false; }
Source:
<code>public String getLabel() { String result = ""; if (containedObject instanceof ITargetDefinition) { result = "Plugins"; } else if (containedObject instanceof ZipFile) { result = ((ZipFile) containedObject).getName(); int startPosition = result.lastIndexOf(folderSeparator) + folderSeparator.length(); int endPosition = <START> result.lastIndexOf("_"); <END> if (endPosition == -1) { endPosition = result.length() - 4; } result = result.substring(startPosition, endPosition); } else if (containedObject instanceof ZipEntry) { result = ((ZipEntry) containedObject).getName(); } return result; }</code><technical_language>if "_" string is part of path</technical_language>

Target:
public String getLabel() { String result = ""; if (containedObject instanceof ITargetDefinition) { result = "Plugins"; } else if (containedObject instanceof ZipFile) { result = ((ZipFile) containedObject).getName(); int startPosition = result.lastIndexOf(File.separator) + File.separator.length(); int endPosition = result.lastIndexOf("_"); if (endPosition <= startPosition) { endPosition = result.length() - 4; } result = result.substring(startPosition, endPosition); } else if (containedObject instanceof ZipEntry) { result = ((ZipEntry) containedObject).getName(); } return result; }
Source:
<code>@Override public CacheQuery<T> timeout(long timeout) { if (timeout >= 0) this.timeout = timeout; else <START> this.timeout = cctx.gridConfig().getDefaultQueryTimeout(); <END> return this; }</code><technical_language>glance changed behavior of this method counter intuitive: if a passed argument is lesser 0 a default timeout a configuration is used. For a check employed asserting negative values invalid. this change queries a default timeout? I suppose a small test answer this question</technical_language>

Target:
@Override public CacheQuery<T> timeout(long timeout) { A.ensure(timeout >= 0, "timeout >= 0"); this.timeout = timeout; return this; }
Source:
<code>public Guid getEntityGuid(Object entity) { if (entity instanceof BusinessEntity) { <START> Object id = getEntityGuid((BusinessEntity<? extends Guid>) entity); <END> if (id instanceof Guid) { return (Guid) id; } } if (entity instanceof VmPool) { return ((VmPool) entity).getVmPoolId(); } else if (entity instanceof DbUser) { return ((DbUser) entity).getId(); } else if (entity instanceof DbGroup) { return ((DbGroup) entity).getId(); } else { return Guid.Empty; } }</code><technical_language>I mentioned in previous patchset, while this work due type erasure, I this cast is confusing casting BusinessEntity<? extends Guid> - casting BusinessEntity<?>, in run time generic type... more correct instead call: Object id = ((BusinessEntity<?>) entity).getId();</technical_language>

Target:
public Guid getEntityGuid(Object entity) { if (entity instanceof BusinessEntity) { Object id = getEntityGuid((BusinessEntity) entity); if (id instanceof Guid) { return (Guid) id; } } if (entity instanceof VmPool) { return ((VmPool) entity).getVmPoolId(); } else if (entity instanceof DbUser) { return ((DbUser) entity).getId(); } else if (entity instanceof DbGroup) { return ((DbGroup) entity).getId(); } else { return Guid.Empty; } }
Source:
<code>protected String getId() { <START> return "GNU C compiler (gcc)"; <END> }</code><technical_language>ID is restore files (from older release) this changed</technical_language>

Target:
protected String getId() { return "GNU compiler (gcc)"; }
Source:
<code>public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { if (args.length != 1) { throw new NotEnoughArgumentsException(); } String kitname = args[0]; if (!ess.getSettings().isPastebinCreateKit()) { ess.getKits().removeKit(kitname); user.sendMessage(tl("deletedKit", kitname)); } else { <START> user.sendMessage("You have tried to remove the kit from pastebin.com which is not very easy."); <END> } }</code><technical_language>1. If user wants delete kit, want delete kit. I able delete kit add pastebin. 2. translatable messages</technical_language>

Target:
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { if (args.length != 1) { throw new NotEnoughArgumentsException(); } String kitname = args[0]; if (!ess.getSettings().isPastebinCreateKit()) { ess.getKits().removeKit(kitname); user.sendMessage(tl("deleteKit", kitname)); } else { user.sendMessage(tl("pastebinDeleteKit")); } }
Source:
<code>void checkChildren(TreeItem item) { TreeItem dummy; if (item.getItemCount() == 1 && (dummy = item.getItem(0)).getData() == null) { dummy.dispose(); Node node = (Node)item.getData(); NodeList childNodes = node.getChildNodes(); for (int i = 0, length = childNodes.getLength(); i < length; i++) { addChild(childNodes.item(i), item); } TreeItem[] items = item.getItems(); for (TreeItem item2 : items) { TreeItem[] children = item2.getItems(); int checkedCount = 0; for (TreeItem <START> element : <END> children) { if (element.getChecked()) checkedCount++; if (element.getGrayed()) break; } item2.setChecked(checkedCount != 0); item2.setGrayed(checkedCount != children.length); } } }</code><technical_language>rename child</technical_language>

Target:
void checkChildren(TreeItem item) { TreeItem dummy; if (item.getItemCount() == 1 && (dummy = item.getItem(0)).getData() == null) { dummy.dispose(); Node node = (Node)item.getData(); NodeList childNodes = node.getChildNodes(); for (int i = 0, length = childNodes.getLength(); i < length; i++) { addChild(childNodes.item(i), item); } for (TreeItem child : item.getItems()) { TreeItem[] children = child.getItems(); int checkedCount = 0; for (TreeItem element : children) { if (element.getChecked()) checkedCount++; if (element.getGrayed()) break; } child.setChecked(checkedCount != 0); child.setGrayed(checkedCount != children.length); } } }
Source:
<code>public String getNoVncPageUrl() { String noVncPageUrl = properties.get(NOVNC_PAGE_URL); <START> if (noVncPageUrl == null) { <END> String noVncPageUrlFromCurrentLocation = getWindowsLocationUrl(); noVncPageUrlFromCurrentLocation += "/rest/novnc.html"; return noVncPageUrlFromCurrentLocation; } return noVncPageUrl; }</code><technical_language>additionally (and this applies for VNC urls), colon character escaped, url passed another url a parameter</technical_language>

Target:
public String getNoVncPageUrl() { String noVncPageUrl = properties.get(NOVNC_PAGE_URL); if (noVncPageUrl == null) { String noVncPageUrlFromCurrentLocation = getWindowsLocationUrl(); noVncPageUrlFromCurrentLocation += "/rest/novnc.html"; noVncPageUrlFromCurrentLocation.replace(":","\\:"); return noVncPageUrlFromCurrentLocation; } return noVncPageUrl; }
Source:
<code>public void run() throws Exception { WebResource webResource = getClient().resource(endpoint + "/v1/catalog/policies"); ClientResponse clientResponse = webResource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class); <START> String jsonResponse = clientResponse.getEntity(String.class); <END> List<String> policies = getJsonParser().readValue(jsonResponse, new TypeReference<List<String>>() { }); for (String policy : policies) { getOut().println(policy); } }</code><technical_language>Again, check response code</technical_language>

Target:
public void run() throws Exception { WebResource webResource = getClient().resource(endpoint + "/v1/catalog/policies"); ClientResponse clientResponse = webResource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class); if (clientResponse.getStatus() != Response.Status.OK.getStatusCode()) { String err = getErrorMessage(clientResponse); throw new CommandExecutionException(err); } String jsonResponse = clientResponse.getEntity(String.class); List<String> policies = getJsonParser().readValue(jsonResponse, new TypeReference<List<String>>() {}); for (String policy : policies) { getOut().println(policy); } }
Source:
<code>private void subscribeToSession(Id sessionId) { subscriptions.add( dataRepository.getEvent(sessionId) .map(asSession()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new SessionObserver()) ); subscriptions.add( dataRepository.getScheduleSyncEvents() .observeOn(AndroidSchedulers.mainThread()) .subscribe(new SyncEventObserver()) ); subscriptions.add( dataRepository.getFavoriteIds() <START> .map(asFavouriteBoolean(sessionId)) <END> .observeOn(AndroidSchedulers.mainThread()) .subscribe(new FavouriteObserver()) ); }</code><technical_language>I this. I understand a filter/concat/take work if want favourite IDs a hot observable, this wrong too. @Dorvaryn suggestion</technical_language>

Target:
private void subscribeToSession(Id sessionId) { subscriptions.add( dataRepository.getEvent(sessionId) .map(asSession()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new SessionObserver()) ); subscriptions.add( dataRepository.getScheduleSyncEvents() .observeOn(AndroidSchedulers.mainThread()) .subscribe(new SyncEventObserver()) ); subscriptions.add( dataRepository.getFavoriteIds() .map(asFavoriteBoolean(sessionId)) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new FavouriteObserver()) ); }
Source:
<code>public void IAR_error2() throws IOException { <START> Collection<FileAnnotation> warnings = new IarParser().parse(openFile("issue8823.txt")); <END> Iterator<FileAnnotation> iterator = warnings.iterator(); FileAnnotation annotation = iterator.next(); annotation = iterator.next(); checkWarning(annotation, 3767, "enumerated type mixed with another type", "D:/continuousIntegration/modifiedcomps/forcedproduct/MHSM-Cascade/Cascade-Config/config/src/RDR_Config.c", "Pe188", Priority.NORMAL); }</code><technical_language>wrap a method integer parameter for warning number return? Collection<FileAnnotation> warnings = new IarParser().parse(openFile("issue8823.txt")); Iterator<FileAnnotation> iterator = warnings.iterator(); For loop: iterator.next(); return iterator.next();</technical_language>

Target:
public void IAR_error2() throws IOException { FileAnnotation annotation = getErrorNumber(2); checkWarning(annotation, 3767, "enumerated type mixed with another type", "D:/continuousIntegration/modifiedcomps/forcedproduct/MHSM-Cascade/Cascade-Config/config/src/RDR_Config.c", "Pe188", Priority.NORMAL); }
Source:
<code>public void purgeConceptStateConversion_shouldTestPurgeConceptStateConversion() { ConceptStateConversion conceptStateConversion = pws.getAllConceptStateConversions().get(0); Context.getProgramWorkflowService().purgeConceptStateConversion(conceptStateConversion, false); List<ConceptStateConversion> list = pws.getAllConceptStateConversions(); <START> int len = list.size(); <END> assertEquals(len, 0); }</code><technical_language>unnecessary variable</technical_language>

Target:
public void purgeConceptStateConversion_shouldTestPurgeConceptStateConversion() { ConceptStateConversion conceptStateConversion = pws.getAllConceptStateConversions().get(0); Context.getProgramWorkflowService().purgeConceptStateConversion(conceptStateConversion, false); List<ConceptStateConversion> list = pws.getAllConceptStateConversions(); assertEquals(list.size(), 0); }
Source:
<code>SpacesAPIImpl getSpaces(BeanManager bm) { <START> final Bean<SpacesAPIImpl> spacesBean = (Bean<SpacesAPIImpl>) bm.getBeans(SpacesAPIImpl.class).iterator().next(); <END> final CreationalContext<SpacesAPIImpl> spacesCtx = bm.createCreationalContext(spacesBean); return (SpacesAPIImpl) bm.getReference(spacesBean, SpacesAPIImpl.class, spacesCtx); }</code><technical_language>IMO, this interface</technical_language>

Target:
SpacesAPI getSpaces(BeanManager bm) { final Bean<SpacesAPI> spacesBean = (Bean<SpacesAPI>) bm.getBeans(SpacesAPI.class).iterator().next(); final CreationalContext<SpacesAPI> spacesCtx = bm.createCreationalContext(spacesBean); return (SpacesAPI) bm.getReference(spacesBean, SpacesAPI.class, spacesCtx); }
Source:
<code>public String filePath() { <START> return fileName; <END> }</code><technical_language>i is return Strings.format("%i/%s/%s", task.getId(), language, fileName)</technical_language>

Target:
public String filePath() { return String.format("%d/%s/%s", task.getId(), language, fileName); }
Source:
<code>protected boolean canDoAction() { <START> List<Network> all = getNetworks(); <END> return validate(vmNetworkSetCorrectly()) && validate(stpForVmNetworkOnly()) && validate(mtuValid()) && validate(networkPrefixValid()) && validate(networkDoesNotExist(all)) && validate(vlanIsFree(all)); }</code><technical_language>I agree this is clean, getNetworks() a simple getter called if fail beforehand. separate ifs</technical_language>

Target:
protected boolean canDoAction() { if (!validate(vmNetworkSetCorrectly()) || !validate(stpForVmNetworkOnly()) || !validate(mtuValid()) || !validate(networkPrefixValid()) || !validate(storagePoolExists())) { return false; } List<Network> all = getNetworks(); return validate(networkDoesNotExist(all)) && validate(vlanIsFree(all)); }
Source:
<code>public void processAttributeSet(String msg, MessageBeans beans) { Perun perun = ldapcManager.getPerunBl(); if(beans.getAttribute() == null || beans.getFacility() == null) { return; } try { log.debug("Getting resources assigned to facility {}", beans.getFacility().getId()); List<Resource> resources = perun.getFacilitiesManager().getAssignedResources(ldapcManager.getPerunSession(), beans.getFacility()); Attribute virtAttributeWithValue = null; if (beans.getAttribute().getNamespace().contains(":virt")) { <START> virtAttributeWithValue = ldapcManager.getPerunBl().getAttributesManager().getAttribute(ldapcManager.getPerunSession(), <END> beans.getFacility(), beans.getAttribute().getName()); } for(Resource resource: resources) { log.debug("Setting attribute for resource {}", beans.getAttribute(), resource); if (virtAttributeWithValue != null) { perunResource.modifyEntry(resource, virtAttributeWithValue); } else { perunResource.modifyEntry(resource, beans.getAttribute()); } } } catch (PerunException e) { log.error("Error setting attribute:", e); } }</code><technical_language>Bl layer prevent unnecessary nested transaction creation. this: ((PerunBl)ldapcManager.getPerunBl()).getAttributesManagerBl().getAttribute(...)</technical_language>

Target:
public void processAttributeSet(String msg, MessageBeans beans) { PerunBl perun = (PerunBl) ldapcManager.getPerunBl(); if (beans.getAttribute() == null || beans.getFacility() == null) { return; } try { log.debug("Setting attribute for facility {}", beans.getAttribute(), beans.getFacility()); perunFacility.modifyEntry(beans.getFacility(), beans.getAttribute()); log.debug("Getting resources assigned to facility {}", beans.getFacility().getId()); List<Resource> resources = perun.getFacilitiesManagerBl().getAssignedResources(ldapcManager.getPerunSession(), beans.getFacility()); for (Resource resource : resources) { log.debug("Setting attribute for resource {}", beans.getAttribute(), resource); perunResource.modifyEntry(resource, beans.getAttribute()); } } catch (NamingException | InternalErrorException e) { log.error("Error setting attribute:", e); } }
Source:
<code>public DeviceBinaryInput(JsonObject jsonObject) { try { for (Entry<String, JsonElement> entry : jsonObject.entrySet()) { try { getClass().getDeclaredField(entry.getKey()).set(this, entry.getValue().getAsShort()); } catch (NoSuchFieldException e) { } catch (NumberFormatException e) { } } if (stateValue == null && jsonObject.get(JSONApiResponseKeysEnum.STATE.getKey()) != null) { stateValue = jsonObject.get(JSONApiResponseKeysEnum.STATE.getKey()).getAsShort(); } } catch (IllegalArgumentException e) { <START> logger.error("A IllegalArgumentException occurred: ", e); <END> } catch (IllegalAccessException e) { logger.error("A IllegalAccessException occurred: ", e); } catch (SecurityException e) { logger.error("A SecurityException occurred: ", e); } }</code><technical_language>This end in users logfile this is... change severity debug if want user report error, please give a description exception in this context. This applies for other exceptions catching here</technical_language>

Target:
public DeviceBinaryInput(JsonObject jsonObject) { if (jsonObject.get(JSONApiResponseKeysEnum.TARGET_GROUP_TYPE.getKey()) != null) { targetGroupType = jsonObject.get(JSONApiResponseKeysEnum.TARGET_GROUP_TYPE.getKey()).getAsShort(); } else { targetGroupType = null; } if (jsonObject.get(JSONApiResponseKeysEnum.TARGET_GROUP.getKey()) != null) { targetGroup = jsonObject.get(JSONApiResponseKeysEnum.TARGET_GROUP.getKey()).getAsShort(); } else { targetGroup = null; } if (jsonObject.get(JSONApiResponseKeysEnum.INPUT_TYPE.getKey()) != null) { inputType = jsonObject.get(JSONApiResponseKeysEnum.INPUT_TYPE.getKey()).getAsShort(); } else { inputType = null; } if (jsonObject.get(JSONApiResponseKeysEnum.INPUT_ID.getKey()) != null) { inputId = jsonObject.get(JSONApiResponseKeysEnum.INPUT_ID.getKey()).getAsShort(); } else { inputId = null; } if (jsonObject.get(JSONApiResponseKeysEnum.STATE_VALUE.getKey()) != null) { stateValue = jsonObject.get(JSONApiResponseKeysEnum.STATE_VALUE.getKey()).getAsShort(); } if (stateValue == null && jsonObject.get(JSONApiResponseKeysEnum.STATE.getKey()) != null) { stateValue = jsonObject.get(JSONApiResponseKeysEnum.STATE.getKey()).getAsShort(); } else { stateValue = null; } }
Source:
<code>protected void initDefaultOutput(ISCTFileSystemAccess access, GeneratorEntry entry) { String folderName = helper.getTargetFolderValue(entry).getStringValue(); access.setOutputPath(IFileSystemAccess.DEFAULT_OUTPUT, <START> helper.getTargetFolderValue(entry).getStringValue()); <END> access.getOutputConfigurations().get(IFileSystemAccess.DEFAULT_OUTPUT).setCreateOutputDirectory(true); checkWriteAccess(access, IFileSystemAccess.DEFAULT_OUTPUT, folderName); }</code><technical_language>reuse folderName</technical_language>

Target:
protected void initDefaultOutput(ISCTFileSystemAccess access, GeneratorEntry entry) { String folderName = helper.getTargetFolderValue(entry).getStringValue(); access.setOutputPath(IFileSystemAccess.DEFAULT_OUTPUT, folderName); access.getOutputConfigurations().get(IFileSystemAccess.DEFAULT_OUTPUT).setCreateOutputDirectory(true); checkWriteAccess(access, IFileSystemAccess.DEFAULT_OUTPUT, folderName); }
Source:
<code>public List<Future<Boolean>> primeConnectionsAsync(final List<Server> servers, final PrimeConnectionListener listener) { if (servers == null) { return Collections.emptyList(); } List<Server> allServers = new ArrayList<Server>(); allServers.addAll(servers); if (allServers.size() == 0){ logger.debug("RestClient:" + name + ". No nodes/servers to prime connections"); return Collections.emptyList(); } logger.info("Priming Connections for RestClient:" + name + ", numServers:" + allServers.size()); List<Future<Boolean>> ftList = new ArrayList<Future<Boolean>>(); for (Server s : allServers) { s.setReadyToServe(false); if (aSync) { Future<Boolean> ftC = null; try { ftC = makeConnectionASync(s, listener); ftList.add(ftC); } catch (RejectedExecutionException ree) { logger.error("executor submit failed", ree); } <START> catch (Throwable e) { <END> logger.error("general error", e); } } else { connectToServer(s, listener); } } return ftList; }</code><technical_language>catch Throwable. change this Exception</technical_language>

Target:
public List<Future<Boolean>> primeConnectionsAsync(final List<Server> servers, final PrimeConnectionListener listener) { if (servers == null) { return Collections.emptyList(); } List<Server> allServers = new ArrayList<Server>(); allServers.addAll(servers); if (allServers.size() == 0){ logger.debug("RestClient:" + name + ". No nodes/servers to prime connections"); return Collections.emptyList(); } logger.info("Priming Connections for RestClient:" + name + ", numServers:" + allServers.size()); List<Future<Boolean>> ftList = new ArrayList<Future<Boolean>>(); for (Server s : allServers) { s.setReadyToServe(false); if (aSync) { Future<Boolean> ftC = null; try { ftC = makeConnectionASync(s, listener); ftList.add(ftC); } catch (RejectedExecutionException ree) { logger.error("executor submit failed", ree); } catch (Exception e) { logger.error("general error", e); } } else { connectToServer(s, listener); } } return ftList; }
Source:
<code>public Promise<? extends Location> getStackFrameLocation(long threadId, int frameIndex) { if (isConnected()) { return service.getStackFrameLocation(debugSessionDto.getId(), threadId, frameIndex); } <START> return Promises.reject(JsPromiseError.create("Debugger is not connected")); <END> }</code><technical_language>If mistaken this method is deprecated org.eclipse.che.api.promises.client.PromiseProvider#reject(org.eclipse.che.api.promises.client.PromiseError), no</technical_language>

Target:
public Promise<? extends Location> getStackFrameLocation(long threadId, int frameIndex) { if (isConnected()) { return service.getStackFrameLocation(debugSessionDto.getId(), threadId, frameIndex); } return promiseProvider.reject(JsPromiseError.create("Debugger is not connected")); }
Source:
<code>public ConfiguredTarget create(RuleContext ruleContext) throws InterruptedException, RuleErrorException, ActionConflictException { ProtoCommon.checkRuleHasValidMigrationTag(ruleContext); NestedSetBuilder<Artifact> blacklistedProtos = NestedSetBuilder.stableOrder(); for (TransitiveInfoCollection protos : ruleContext.getPrerequisites("blacklisted_protos", TARGET)) { ProtoInfo protoInfo = protos.get(ProtoInfo.PROVIDER); <START> if (ruleContext.getFragment(ProtoConfiguration.class).blacklistedProtosRequiresProtoInfo() <END> && protoInfo == null) { ruleContext.ruleError( "'" + ruleContext.getLabel().toString() + "' does not have mandatory provider 'ProtoInfo'."); } if (protoInfo != null) { blacklistedProtos.addTransitive(protoInfo.getOriginalTransitiveProtoSources()); } else { blacklistedProtos.addTransitive(protos.getProvider(FileProvider.class).getFilesToBuild()); } } return new RuleConfiguredTargetBuilder(ruleContext) .addProvider( ProtoLangToolchainProvider.create( ruleContext.attributes().get("command_line", Type.STRING), ruleContext.getPrerequisite("plugin", HOST, FilesToRunProvider.class), ruleContext.getPrerequisite("runtime", TARGET), blacklistedProtos.build())) .setFilesToBuild(NestedSetBuilder.<Artifact>emptySet(STABLE_ORDER)) .addProvider(RunfilesProvider.simple(Runfiles.EMPTY)) .build(); }</code><technical_language>swap conjuncts, i.e (protoInfo == null && ...). This in case protoInfo is null, configuration fragment is required. adding requiredConfigurationFragment RuleConfiguredTargetBuilder below</technical_language>

Target:
public ConfiguredTarget create(RuleContext ruleContext) throws InterruptedException, RuleErrorException, ActionConflictException { ProtoCommon.checkRuleHasValidMigrationTag(ruleContext); NestedSetBuilder<Artifact> blacklistedProtos = NestedSetBuilder.stableOrder(); for (TransitiveInfoCollection protos : ruleContext.getPrerequisites("blacklisted_protos", TARGET)) { ProtoInfo protoInfo = protos.get(ProtoInfo.PROVIDER); if (protoInfo == null && ruleContext .getFragment(ProtoConfiguration.class) .blacklistedProtosRequiresProtoInfo()) { ruleContext.ruleError( "'" + ruleContext.getLabel().toString() + "' does not have mandatory provider 'ProtoInfo'."); } if (protoInfo != null) { blacklistedProtos.addTransitive(protoInfo.getOriginalTransitiveProtoSources()); } else { blacklistedProtos.addTransitive(protos.getProvider(FileProvider.class).getFilesToBuild()); } } return new RuleConfiguredTargetBuilder(ruleContext) .addProvider( ProtoLangToolchainProvider.create( ruleContext.attributes().get("command_line", Type.STRING), ruleContext.getPrerequisite("plugin", HOST, FilesToRunProvider.class), ruleContext.getPrerequisite("runtime", TARGET), blacklistedProtos.build())) .setFilesToBuild(NestedSetBuilder.<Artifact>emptySet(STABLE_ORDER)) .addProvider(RunfilesProvider.simple(Runfiles.EMPTY)) .build(); }
Source:
<code>private ExporterJob createCVSExportJob(final File outputFile) { ExporterJob result = new ExporterJob("Export project") { @Override protected IStatus run() { OutputStream outputStream = null; try { outputFile.createNewFile(); outputStream = new BufferedOutputStream(new FileOutputStream(outputFile)); GanttCSVExport exporter = new GanttCSVExport(getProject(), ((GanttProject) getProject()).getGanttOptions().getCSVOptions()); <START> exporter.save(outputStream, myFileTypeOption.proposeFileExtension()); <END> } catch (IOException e) { getUIFacade().showErrorDialog(e); return Status.CANCEL_STATUS; } finally { if (outputStream != null) { try { outputStream.close(); } catch (IOException e) { GPLogger.logToLogger(e); } } } return Status.OK_STATUS; } }; return result; }</code><technical_language>Notice call "fileFormat" in classes undeline is a format -- is file extension. This kinda smells. I suggest creating enum SpreadsheetFormat format ids, values in FileTypeOption pass enum save</technical_language>

Target:
private ExporterJob createCVSExportJob(final File outputFile) { ExporterJob result = new ExporterJob("Export project") { @Override protected IStatus run() { OutputStream outputStream = null; try { outputFile.createNewFile(); outputStream = new BufferedOutputStream(new FileOutputStream(outputFile)); CSVOptions csvOptions = ((GanttProject) getProject()).getGanttOptions().getCSVOptions(); GanttCSVExport exporter = new GanttCSVExport(getProject(), csvOptions); exporter.save(outputStream, myFileTypeOption.proposeFileExtension()); } catch (IOException e) { getUIFacade().showErrorDialog(e); return Status.CANCEL_STATUS; } finally { if (outputStream != null) { try { outputStream.close(); } catch (IOException e) { GPLogger.logToLogger(e); } } } return Status.OK_STATUS; } }; return result; }