auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public MarketDataRequirements requirements() { CalculationRequirements calculationRequirements = function.requirements(target); MarketDataRequirementsBuilder requirementsBuilder = MarketDataRequirements.builder(); calculationRequirements.getTimeSeriesRequirements().stream() .map(marketDataMappings::getIdForObservableKey) .forEach(requirementsBuilder::timeSeries); for (MarketDataKey<?> key : calculationRequirements.getSingleValueRequirements()) { MarketDataId<?> id; if (key instanceof ObservableKey) { id = marketDataMappings.getIdForObservableKey((ObservableKey) key); } else { id = marketDataMappings.getIdForKey(key); <START> } <END> requirementsBuilder.values(id); } return requirementsBuilder.build(); }</code><technical_language>Move this logic getIdForKey</technical_language>

Target:
public MarketDataRequirements requirements() { CalculationRequirements calculationRequirements = function.requirements(target); MarketDataRequirementsBuilder requirementsBuilder = MarketDataRequirements.builder(); calculationRequirements.getTimeSeriesRequirements().stream() .map(marketDataMappings::getIdForObservableKey) .forEach(requirementsBuilder::timeSeries); for (MarketDataKey<?> key : calculationRequirements.getSingleValueRequirements()) { requirementsBuilder.values(marketDataMappings.getIdForKey(key)); } return requirementsBuilder.build(); }
Source:
<code>public Point computeSize (int wHint, int hHint, boolean changed) { checkWidget (); boolean visible = getVisible(); <START> if (OS.GTK3 && !visible) { <END> setVisible(true); } int width = 0, height = 0; String[] items = list.getItems (); GC gc = new GC (text); int spacer = gc.stringExtent (" ").x; int textWidth = gc.stringExtent (text.getText ()).x; for (int i = 0; i < items.length; i++) { textWidth = Math.max (gc.stringExtent (items[i]).x, textWidth); } gc.dispose (); Point textSize = text.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed); Point arrowSize = arrow.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed); Point listSize = list.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed); int borderWidth = getBorderWidth (); height = Math.max (textSize.y, arrowSize.y); width = Math.max (textWidth + 2*spacer + arrowSize.x + 2*borderWidth, listSize.x); if (wHint != SWT.DEFAULT) width = wHint; if (hHint != SWT.DEFAULT) height = hHint; if (OS.GTK3) { setVisible(visible); } return new Point (width + 2*borderWidth, height + 2*borderWidth); }</code><technical_language>CCombo is a platform agnostic widget, meaning GTK specific code here. Instead is: if (SWT.getPlatform().equals("gtk")) { } applies for CLabel, CoolBar, CTable -- platform agnostic widgets</technical_language>

Target:
public Point computeSize (int wHint, int hHint, boolean changed) { checkWidget (); boolean visible = getVisible(); if (SWT.getPlatform().equals("gtk") && !visible) { setVisible(true); } int width = 0, height = 0; String[] items = list.getItems (); GC gc = new GC (text); int spacer = gc.stringExtent (" ").x; int textWidth = gc.stringExtent (text.getText ()).x; for (int i = 0; i < items.length; i++) { textWidth = Math.max (gc.stringExtent (items[i]).x, textWidth); } gc.dispose (); Point textSize = text.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed); Point arrowSize = arrow.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed); Point listSize = list.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed); int borderWidth = getBorderWidth (); height = Math.max (textSize.y, arrowSize.y); width = Math.max (textWidth + 2*spacer + arrowSize.x + 2*borderWidth, listSize.x); if (wHint != SWT.DEFAULT) width = wHint; if (hHint != SWT.DEFAULT) height = hHint; if (SWT.getPlatform().equals("gtk")) { setVisible(visible); } return new Point (width + 2*borderWidth, height + 2*borderWidth); }
Source:
<code><START> private List<DiscoveryEnabledServer> loadListOfServers() { <END> if (Eureka2Clients.isPreferEureka2()) { return eureka2ServerList.getUpdatedListOfServers(); } return eureka1ServerList.getUpdatedListOfServers(); }</code><technical_language>this flipping eureka 2 eureka 1 & vice-versa requires reboot of application</technical_language>

Target:
private List<DiscoveryEnabledServer> loadListOfServers() { if (Eureka2Clients.isUseEureka2()) { if (eureka2ServerListRef.get() == null) { synchronized (eureka2ServerListRef) { Eureka2EnabledNIWSServerList eureka2ServerList = new Eureka2EnabledNIWSServerList(); eureka2ServerList.initWithNiwsConfig(clientConfig); eureka2ServerListRef.set(eureka2ServerList); } } return eureka2ServerListRef.get().getUpdatedListOfServers(); } Eureka2EnabledNIWSServerList eureka2ServerList = eureka2ServerListRef.getAndSet(null); if (eureka2ServerList != null) { eureka2ServerList.shutdown(); } return eureka1ServerList.getUpdatedListOfServers(); }
Source:
<code>public long getPositionsSizeInBytes(boolean[] positions) { checkValidPositions(positions, getPositionCount()); int usedPositionCount = 0; long sizeInBytes = 0; for (int i = 0; i < positions.length; i++) { if (positions[i]) { usedPositionCount++; int startFieldBlockOffset = getFieldBlockOffset(i); int endFieldBlockOffset = getFieldBlockOffset(i + 1); int fieldBlockLength = endFieldBlockOffset - startFieldBlockOffset; for (int j = 0; j < numFields; j++) { <START> sizeInBytes += getRawFieldBlocks()[j].getRegionSizeInBytes(startFieldBlockOffset, fieldBlockLength); <END> } } } return sizeInBytes + (Integer.BYTES + Byte.BYTES) * (long) usedPositionCount; }</code><technical_language>do this. This is O(n^2) bug fix here, in a kind of Block. Ditto for getRegionSizeInBytes implementation of this Block</technical_language>

Target:
public long getPositionsSizeInBytes(boolean[] positions) { checkValidPositions(positions, getPositionCount()); int usedPositionCount = 0; boolean[] fieldPositions = new boolean[getRawFieldBlocks()[0].getPositionCount()]; for (int i = 0; i < positions.length; i++) { if (positions[i]) { usedPositionCount++; int startFieldBlockOffset = getFieldBlockOffset(i); int endFieldBlockOffset = getFieldBlockOffset(i + 1); for (int j = startFieldBlockOffset; j < endFieldBlockOffset; j++) { fieldPositions[j] = true; } } } long sizeInBytes = 0; for (int j = 0; j < numFields; j++) { sizeInBytes += getRawFieldBlocks()[j].getPositionsSizeInBytes(fieldPositions); } return sizeInBytes + (Integer.BYTES + Byte.BYTES) * (long) usedPositionCount; }
Source:
<code>protected void onStart() { super.onStart(); subscription = <START> LifecycleObservable.bindActivityLifecycle(this, ViewObservable.clicks(button)) <END> .subscribe(new Action1<OnClickEvent>() { @Override public void call(OnClickEvent onClickEvent) { Toast.makeText(LifecycleObservableActivityComposition.this, "Clicked button!", Toast.LENGTH_SHORT) .show(); } }); }</code><technical_language>Transformer < T , R > return R. Java's 7 Type Inference, R Object. do java LifecycleObservable.<Specific Object Class>bindActivityLifecycle(this) <LINK_0></technical_language>

Target:
protected void onStart() { super.onStart(); subscription = LifecycleObservable.bindActivityUntilLifecycle(this, ViewObservable.clicks(button), LifecycleEvent.STOP) .subscribe(new Action1<OnClickEvent>() { @Override public void call(OnClickEvent onClickEvent) { Toast.makeText(LifecycleObservableActivityComposition.this, "Clicked button!", Toast.LENGTH_SHORT) .show(); } }); }
Source:
<code>public @ResponseBody Map<String, String> getStatus() { if(updateSearchIndexAsync == null) throw new APIException("There was a problem rebuilding the search index"); Map<String, String> results = new HashMap<>(); if (updateSearchIndexAsync.isDone()) { results.put("status", updateSearchIndexAsync.isCancelled() ? "error" : "success"); updateSearchIndexAsync = null; <START> } else <END> results.put("status", "inProgress"); return results; }</code><technical_language>This code clearer safe if braces for else clause advised <LINK_0></technical_language>

Target:
public @ResponseBody Map<String, String> getStatus() { if (updateSearchIndexAsync == null) { throw new APIException("There was a problem rebuilding the search index"); } Map<String, String> results = new HashMap<>(); if (updateSearchIndexAsync.isDone()) { results.put("status", updateSearchIndexAsync.isCancelled() ? "error" : "success"); updateSearchIndexAsync = null; } else { results.put("status", "inProgress"); } return results; }
Source:
<code>public void setUp() throws IOException, RyaDAOException{ client = MockMongoSingleton.getInstance(); <START> client.dropDatabase(DB_NAME); <END> conf = new MongoDBRdfConfiguration(); conf.set(MongoDBRdfConfiguration.MONGO_DB_NAME, DB_NAME); conf.set(MongoDBRdfConfiguration.MONGO_COLLECTION_PREFIX, "rya_"); conf.set(RdfCloudTripleStoreConfiguration.CONF_TBL_PREFIX, "rya_"); conf.setAuths("A", "B", "C"); conf.setMongoClient(client); dao = new MongoDBRyaDAO(conf, client); }</code><technical_language>I this client.dropDatabase, DB_NAME pushed a JUnit @Rule similar RyaTestInstanceRule does. forget do if @Rule. cuts redundant code in tests deals singleton specific issues</technical_language>

Target:
public void setUp() throws IOException, RyaDAOException{ conf.setAuths("A", "B", "C"); client = super.getMongoClient(); dao = new MongoDBRyaDAO(conf, client); }
Source:
<code>private String getBrowserColorDepth(EpdqOrderRequestBuilder.EpdqTemplateData templateData) { String browserColorDepth = templateData.getAuthCardDetails().getJsScreenColorDepth().orElse("24"); <START> return VALID_SCREEN_COLOR_DEPTHS.contains(browserColorDepth) ? browserColorDepth : "24"; <END> }</code><technical_language>java return templateData.getAuthCardDetails().getJsScreenColorDepth() .filter(VALID_SCREEN_COLOR_DEPTHS::contains).orElse("24"); put "24" in a constant, give a meaningful name DEFAULT_BROWSER_COLOR_DEPTH</technical_language>

Target:
private String getBrowserColorDepth(EpdqOrderRequestBuilder.EpdqTemplateData templateData) { return templateData.getAuthCardDetails().getJsScreenColorDepth() .filter(VALID_SCREEN_COLOR_DEPTHS::contains).orElse(DEFAULT_BROWSER_COLOR_DEPTH); }
Source:
<code>public void trade() { Set<String> <START> set = <END> buyOrders.keySet(); for(String key: set){ Collections.sort( buyOrders.get(key)); } Set<String> set2 = sellOrders.keySet(); for(String key: set2){ Collections.sort( sellOrders.get(key)); } for(String bkey:set){ if(set2.contains(bkey)){ ArrayList<Order> bl = buyOrders.get(bkey); ArrayList<Order> temp = new ArrayList<Order>(); for(Order o : bl){ if(o.isMarketOrder()){ temp.add(o); }else{ break; } } for(Order o: temp){ bl.remove(o); bl.add(o); } int sellCumulative = 0; int buyCumulative = 0; double sellPrice = 0; ArrayList<Order> sl = sellOrders.get(bkey); for (int i = 0; i < sl.size(); i++){ sellCumulative += sl.get(i).getSize(); buyCumulative += bl.get(bl.size()-i-1).getSize(); if (buyCumulative >= sellCumulative ){ sellPrice = sl.get(i).getPrice(); break; } } PriceSetter ps = null; if(sellPrice != 0){ ps = new PriceSetter(); m.getMarketHistory().setSubject(ps); ps.registerObserver(m.getMarketHistory()); ps.setNewPrice(m, set2.toArray()[0].toString(), sellPrice); }else{ return; } for(Order order : sl){ try { order.getTrader().tradePerformed(order, sellPrice); } catch (StockMarketExpection e) { e.printStackTrace(); } } sl.clear(); for(Order order : bl){ try { order.getTrader().tradePerformed(order, sellPrice); } catch (StockMarketExpection e) { e.printStackTrace(); } } bl.clear(); ps.unRegisterObserver(m.getMarketHistory()); } } }</code><technical_language>name sets related buy sell easy distinguish in method</technical_language>

Target:
public void trade() { Set<String> buySet = buyOrders.keySet(); for(String key: buySet){ Collections.sort( buyOrders.get(key)); } Set<String> set2 = sellOrders.keySet(); for(String key: set2){ Collections.sort( sellOrders.get(key)); } for(String bkey:buySet){ if(set2.contains(bkey)){ ArrayList<Order> bl = buyOrders.get(bkey); ArrayList<Order> temp = new ArrayList<Order>(); for(Order o : bl){ if(o.isMarketOrder()){ temp.add(o); }else{ break; } } for(Order o: temp){ bl.remove(o); bl.add(o); } int sellCumulative = 0; int buyCumulative = 0; double sellPrice = 0; ArrayList<Order> sl = sellOrders.get(bkey); for (int i = 0; i < sl.size(); i++){ sellCumulative += sl.get(i).getSize(); buyCumulative += bl.get(bl.size()-i-1).getSize(); if (buyCumulative >= sellCumulative ){ sellPrice = sl.get(i).getPrice(); break; } } PriceSetter ps = null; if(sellPrice != 0){ ps = new PriceSetter(); market.getMarketHistory().setSubject(ps); ps.registerObserver(market.getMarketHistory()); ps.setNewPrice(m, set2.toArray()[0].toString(), sellPrice); }else{ return; } for(Order order : sl){ try { order.getTrader().tradePerformed(order, sellPrice); } catch (StockMarketExpection e) { e.printStackTrace(); } } sl.clear(); for(Order order : bl){ try { order.getTrader().tradePerformed(order, sellPrice); } catch (StockMarketExpection e) { e.printStackTrace(); } } bl.clear(); ps.unRegisterObserver(market.getMarketHistory()); } } }
Source:
<code>public static File getPhotoCacheDir(Context context, String cacheName) { File cacheDir = context.getCacheDir(); if (cacheDir != null) { File result = new File(cacheDir, cacheName); if (!result.mkdirs() && (!result.exists() || !result.isDirectory())) { <START> throw new IllegalStateException("Cannot create cache directory structure for " + result); <END> } return result; } if (Log.isLoggable(TAG, Log.ERROR)) { Log.e(TAG, "default disk cache dir is null"); } return null; }</code><technical_language>return null here. I argument for throwing a checked exception cacheDir is null, consistent callers handle failure themselves. devices storage, this is expected behavior</technical_language>

Target:
public static File getPhotoCacheDir(Context context, String cacheName) { File cacheDir = context.getCacheDir(); if (cacheDir != null) { File result = new File(cacheDir, cacheName); if (!result.mkdirs() && (!result.exists() || !result.isDirectory())) { return null; } return result; } if (Log.isLoggable(TAG, Log.ERROR)) { Log.e(TAG, "default disk cache dir is null"); } return null; }
Source:
<code>public Block getBlock(int[] positions, int positionCount) { <START> checkArgument(outputPositionCount > 0, "outputPositionCount must be greater than zero"); <END> checkState(outputRequired, "This stream reader doesn't produce output"); checkState(positionCount <= outputPositionCount, "Not enough values"); if (allNulls) { return new RunLengthEncodedBlock(outputType.createBlockBuilder(null, 1).appendNull().build(), outputPositionCount); } boolean includeNulls = nullsAllowed && presentStream != null; if (positionCount == outputPositionCount) { Block block = new VariableWidthBlock(positionCount, slice, offsetVector, Optional.ofNullable(includeNulls ? nulls : null)); nulls = null; offsetVector = null; data = null; slice = null; return block; } boolean[] nullsCopy = null; if (includeNulls) { nullsCopy = new boolean[positionCount]; } compactData(positions, positionCount, includeNulls, nullsCopy); Block block = new VariableWidthBlock(positionCount, slice, offsetVector, Optional.ofNullable(includeNulls ? nullsCopy : null)); nulls = null; offsetVector = null; return block; }</code><technical_language>check valuesInUse</technical_language>

Target:
public Block getBlock(int[] positions, int positionCount) { checkArgument(outputPositionCount > 0, "outputPositionCount must be greater than zero"); checkState(outputRequired, "This stream reader doesn't produce output"); checkState(positionCount <= outputPositionCount, "Not enough values"); checkState(!valuesInUse, "BlockLease hasn't been closed yet"); if (allNulls) { return new RunLengthEncodedBlock(outputType.createBlockBuilder(null, 1).appendNull().build(), outputPositionCount); } boolean includeNulls = nullsAllowed && presentStream != null; if (positionCount != outputPositionCount) { compactValues(positions, positionCount, includeNulls); } Block block = new VariableWidthBlock(positionCount, dataAsSlice, offsets, Optional.ofNullable(includeNulls ? nulls : null)); dataAsSlice = null; data = null; offsets = null; nulls = null; return block; }
Source:
<code>protected CONNECTCXFClient(ServicePortDescriptor<T> portDescriptor, String url, AssertionType assertion, ServicePortBuilder<T> portBuilder) { serviceEndpoint = super.configureBasePort(portBuilder.createPort(), url, assertion != null ? assertion.getTransactionTimeout() : null); <START> configCNCheck(); <END> }</code><technical_language>remove this</technical_language>

Target:
protected CONNECTCXFClient(ServicePortDescriptor<T> portDescriptor, String url, AssertionType assertion, ServicePortBuilder<T> portBuilder) { serviceEndpoint = super.configureBasePort(portBuilder.createPort(), url, assertion != null ? assertion.getTransactionTimeout() : null); }
Source:
<code>private void configureTimeSlotParametersStartingFromIndex(int index, Object[] policyParameters) { try { this.acquireTime = policyParameters[index++].toString(); this.releaseTime = policyParameters[index++].toString(); DATE_FORMAT.parse(this.acquireTime); DATE_FORMAT.parse(this.releaseTime); <START> if (policyParameters[index++].toString().length() > 0) { <END> this.period = Long.parseLong(policyParameters[index - 1].toString()); if (this.period < 0) { throw new RMException("Period cannot be less than zero"); } } else { this.period = 0L; } this.preemptive = Boolean.parseBoolean(policyParameters[index].toString()); } catch (Throwable t) { throw new IllegalArgumentException(t); } }</code><technical_language>replace toString().length() > 0 ! toString().isEmpty</technical_language>

Target:
private void configureTimeSlotParametersStartingFromIndex(int index, Object[] policyParameters) { try { this.acquireTime = policyParameters[index++].toString(); this.releaseTime = policyParameters[index++].toString(); DATE_FORMAT.parse(this.acquireTime); DATE_FORMAT.parse(this.releaseTime); if (!policyParameters[index++].toString().isEmpty()) { this.period = Long.parseLong(policyParameters[index - 1].toString()); if (this.period < 0) { throw new RMException("Period cannot be less than zero"); } } else { this.period = 0L; } this.preemptive = Boolean.parseBoolean(policyParameters[index].toString()); } catch (Throwable t) { throw new IllegalArgumentException(t); } }
Source:
<code>public void onResponse(ReplicaId replicaId, TrackedRequestFinalState trackedRequestFinalState) { if (respondedReplicas.contains(replicaId)) { return; } respondedReplicas.add(replicaId); inflightCount--; if (trackedRequestFinalState == TrackedRequestFinalState.SUCCESS) { succeededCount++; } else { failedCount++; if (trackedRequestFinalState == TrackedRequestFinalState.NOT_FOUND && replicaId.getDataNodeId() .getDatacenterName() <START> .equals(this.originatingDcName)) { <END> originatingDcNotFoundCount++; } } }</code><technical_language>this removed</technical_language>

Target:
public void onResponse(ReplicaId replicaId, TrackedRequestFinalState trackedRequestFinalState) { inflightCount--; if (trackedRequestFinalState == TrackedRequestFinalState.SUCCESS) { succeededCount++; } else { failedCount++; if (trackedRequestFinalState == TrackedRequestFinalState.NOT_FOUND && replicaId.getDataNodeId() .getDatacenterName() .equals(originatingDcName)) { originatingDcNotFoundCount++; } } }
Source:
<code>public void addSteps(MigrationStepRegistry registry) { registry .add(1700, "Drop table AUTHORS", DropTableAuthors.class) .add(1701, "Clean orphans from USER_ROLES", CleanOrphanRowsInUserRoles.class) .add(1702, "Clean orphans from GROUP_ROLES", CleanOrphanRowsInGroupRoles.class) .add(1703, "Populate EVENTS.COMPONENT_UUID", PopulateEventsComponentUuid.class) .add(1704, "Drop index EVENTS_COMPONENT_UUID", DropIndexEventsComponentUuid.class) .add(1705, "Make EVENTS.COMPONENT_UUID not nullable", MakeEventsComponentUuidNotNullable.class) .add(1706, "Recreate index EVENTS_COMPONENT_UUID", RecreateIndexEventsComponentUuid.class) .add(1707, "Ensure ISSUE.PROJECT_UUID is consistent", EnsureIssueProjectUuidConsistencyOnIssues.class) .add(1708, "Clean orphans from PROJECT_LINKS", CleanOrphanRowsInProjectLinks.class) <START> .add(1709, "Clean orphans from SETTINGS", CleanOrphanRowsInProperties.class); <END> }</code><technical_language>"Clean orphans PROPERTIES" exact</technical_language>

Target:
public void addSteps(MigrationStepRegistry registry) { registry .add(1700, "Drop table AUTHORS", DropTableAuthors.class) .add(1701, "Clean orphans from USER_ROLES", CleanOrphanRowsInUserRoles.class) .add(1702, "Clean orphans from GROUP_ROLES", CleanOrphanRowsInGroupRoles.class) .add(1703, "Populate EVENTS.COMPONENT_UUID", PopulateEventsComponentUuid.class) .add(1704, "Drop index EVENTS_COMPONENT_UUID", DropIndexEventsComponentUuid.class) .add(1705, "Make EVENTS.COMPONENT_UUID not nullable", MakeEventsComponentUuidNotNullable.class) .add(1706, "Recreate index EVENTS_COMPONENT_UUID", RecreateIndexEventsComponentUuid.class) .add(1707, "Ensure ISSUE.PROJECT_UUID is consistent", EnsureIssueProjectUuidConsistencyOnIssues.class) .add(1708, "Clean orphans from PROJECT_LINKS", CleanOrphanRowsInProjectLinks.class) .add(1709, "Clean orphans from SETTINGS", CleanOrphanRowsInProperties.class) .add(1710, "Clean orphans from MANUAL_MEASURES", CleanOrphanRowsInManualMeasures.class) .add(1711, "Drop index MANUAL_MEASURES.COMPONENT_UUID", DropIndexManualMeasuresComponentUuid.class) .add(1712, "Make MANUAL_MEASURES.COMPONENT_UUID not nullable", MakeManualMeasuresComponentUuidNotNullable.class) .add(1713, "Recreate index MANUAL_MEASURES.COMPONENT_UUID", RecreateIndexManualMeasuresComponentUuid.class) ; }
Source:
<code>@Override protected RawClient[] fromConfig(ClusterConfig<PBClientConfig> clusterConfig) throws IOException { final List<PBClientAdapter> clients = new ArrayList<PBClientAdapter>(); int totalMaxConnections = clusterConfig.getTotalMaximumConnections(); Semaphore clusterSemaphore = null; <START> if (!(totalMaxConnections <= RiakConnectionPool.LIMITLESS)) { <END> clusterSemaphore = RiakConnectionPool.getSemaphore(totalMaxConnections); } for (PBClientConfig node : clusterConfig.getClients()) { final RiakConnectionPool hostPool = makePool(clusterSemaphore, node); clients.add(new PBClientAdapter(new RiakClient(hostPool))); } return clients.toArray(new RawClient[clients.size()]); }</code><technical_language>if (totalMaxConnections > RiakConnectionPool.LIMITLESS)</technical_language>

Target:
@Override protected RawClient[] fromConfig(ClusterConfig<PBClientConfig> clusterConfig) throws IOException { final List<PBClientAdapter> clients = new ArrayList<PBClientAdapter>(); int totalMaxConnections = clusterConfig.getTotalMaximumConnections(); Semaphore clusterSemaphore = null; if (totalMaxConnections > RiakConnectionPool.LIMITLESS) { clusterSemaphore = RiakConnectionPool.getSemaphore(totalMaxConnections); } for (PBClientConfig node : clusterConfig.getClients()) { final RiakConnectionPool hostPool = makePool(clusterSemaphore, node); clients.add(new PBClientAdapter(new RiakClient(hostPool))); } return clients.toArray(new RawClient[clients.size()]); }
Source:
<code>private Symbol getDeclarationSymbol(FunctionCallTree tree) { ExpressionTree callee = tree.callee(); <START> if (callee.is(Tree.Kind.NAMESPACE_NAME)) { return context().symbolTable().getSymbol(((NamespaceNameTree) callee).name()); } else if(isVerifiableObjectMemberAccess(callee)) { return context().symbolTable().getSymbol(((MemberAccessTree) callee).member()); } else if(isVerifiableClassMemberAccess(callee)) { return context().symbolTable().getSymbol(((MemberAccessTree) callee).member()); } <END> return null; }</code><technical_language>I created [SONARPHP-966](<LINK_0> I do this filtering</technical_language>

Target:
private Symbol getDeclarationSymbol(FunctionCallTree tree) { ExpressionTree callee = tree.callee(); if (callee.is(Kind.NAMESPACE_NAME)) { return context().symbolTable().getSymbol(((NamespaceNameTree) callee).name()); } else if(isVerifiableObjectMemberAccess(callee)) { return context().symbolTable().getSymbol(((MemberAccessTree) callee).member()); } else if(isVerifiableClassMemberAccess(callee)) { return context().symbolTable().getSymbol(((MemberAccessTree) callee).member()); } return null; }
Source:
<code>public void registerQuery(Query query, final ListenableFuture future) { final String id = query.getId(); queries.put(id, future); <START> if(queryDatasources.get(id) == null) { <END> queryDatasources.put(id, getDataSources(query)); } future.addListener( new Runnable() { @Override public void run() { queries.remove(id, future); queryDatasources.remove(id); } }, MoreExecutors.sameThreadExecutor() ); }</code><technical_language>suggest queryDatasources a concurrent map do putIfAbsent</technical_language>

Target:
public void registerQuery(Query query, final ListenableFuture future) { final String id = query.getId(); final List<String> datasources = query.getDataSource().getNames(); queries.put(id, future); queryDatasources.putAll(id, datasources); future.addListener( new Runnable() { @Override public void run() { queries.remove(id, future); for (String datasource : datasources) { queryDatasources.remove(id, datasource); } } }, MoreExecutors.sameThreadExecutor() ); }
Source:
<code>public static OrderingScheme toOrderingScheme(OrderBy orderBy, TypeProvider types) { return toOrderingScheme( orderBy.getSortItems().stream().map(SortItem::getSortKey).map(item -> { checkArgument(item instanceof SymbolReference, "must be symbol reference"); Symbol symbol = Symbol.from(item); return variable(symbol.getName(), types.get(symbol)); <START> }), <END> orderBy.getSortItems().stream().map(PlannerUtils::toSortOrder)); }</code><technical_language>nit: I personally for-loop lambda mapping operation is trivial :). I strong opinion you</technical_language>

Target:
public static OrderingScheme toOrderingScheme(OrderBy orderBy, TypeProvider types) { return toOrderingScheme( orderBy.getSortItems().stream() .map(SortItem::getSortKey) .map(item -> { checkArgument(item instanceof SymbolReference, "must be symbol reference"); Symbol symbol = Symbol.from(item); return variable(symbol.getName(), types.get(symbol)); }).collect(toImmutableList()), orderBy.getSortItems().stream() .map(PlannerUtils::toSortOrder) .collect(toImmutableList())); }
Source:
<code>private void submitPutsAndAssertSuccess(boolean shouldCloseRouterAfter) throws Exception { <START> submitPut().await(5, TimeUnit.SECONDS); <END> assertSuccess(); if (shouldCloseRouterAfter) { assertCloseCleanup(); } }</code><technical_language>Create a constant for timeout length</technical_language>

Target:
private void submitPutsAndAssertSuccess(boolean shouldCloseRouterAfter) throws Exception { submitPut().await(MAX_WAIT_MS, TimeUnit.MILLISECONDS); assertSuccess(); if (shouldCloseRouterAfter) { assertCloseCleanup(); } }
Source:
<code>public void importSources(FolderEntry baseFolder, String location) throws IOException { try { final String absoluteBaseFolderPath = localPathResolver.resolve(baseFolder.getVirtualFile()); GitConnection gitConnection = nativeGitConnectionFactory.getConnection(absoluteBaseFolderPath); CloneRequest cloneRequest = DtoFactory.getInstance().createDto(CloneRequest.class).withWorkingDir(absoluteBaseFolderPath).withRemoteName("origin") .withRemoteUri(location); gitConnection.clone(cloneRequest); String propertyFileContent = "{\"type\":\"" + Constants.NAMELESS_ID + "\"}"; FolderEntry projectMetaFolder = baseFolder.createFolder(".codenvy"); projectMetaFolder.createFile("project", propertyFileContent.getBytes(), MediaType.APPLICATION_JSON_TYPE.getType()); } catch (VirtualFileSystemException | GitException | URISyntaxException e) { <START> final String error = "Selected project cannot be imported."; <END> LOG.error(error); throw new IOException(error, e); } }</code><technical_language>remove Log.error() need</technical_language>

Target:
public void importSources(FolderEntry baseFolder, String location) throws IOException { try { final String absoluteBaseFolderPath = localPathResolver.resolve(baseFolder.getVirtualFile()); GitConnection gitConnection = nativeGitConnectionFactory.getConnection(absoluteBaseFolderPath); CloneRequest cloneRequest = DtoFactory.getInstance().createDto(CloneRequest.class).withWorkingDir(absoluteBaseFolderPath).withRemoteName("origin") .withRemoteUri(location); gitConnection.clone(cloneRequest); String propertyFileContent = "{\"type\":\"" + Constants.NAMELESS_ID + "\"}"; FolderEntry projectMetaFolder = baseFolder.createFolder(".codenvy"); projectMetaFolder.createFile("project", propertyFileContent.getBytes(), MediaType.APPLICATION_JSON_TYPE.getType()); } catch (VirtualFileSystemException | GitException | URISyntaxException e) { throw new IOException("Selected project cannot be imported.", e); } }
Source:
<code>protected String visitLikePredicate(LikePredicate node, Void context) { StringBuilder builder = new StringBuilder(); builder.append('(') .append(process(node.getValue(), context)) .append(" LIKE ") .append(process(node.getPattern(), context)); node.getEscape().ifPresent(escape -> { if (node.getEscape().isPresent()) { builder.append(" ESCAPE ") .append(process(node.getEscape().get(), context)); <START> } <END> }); builder.append(')'); return builder.toString(); }</code><technical_language>node.getEscape().ifPresent(escape -> builder.append(" ESCAPE ").append(process(escape), context)));</technical_language>

Target:
protected String visitLikePredicate(LikePredicate node, Void context) { StringBuilder builder = new StringBuilder(); builder.append('(') .append(process(node.getValue(), context)) .append(" LIKE ") .append(process(node.getPattern(), context)); node.getEscape().ifPresent(escape -> { builder.append(" ESCAPE ") .append(process(escape, context)); }); builder.append(')'); return builder.toString(); }
Source:
<code>public String getHelpNote() { <START> String s = "\n\n\n" + <END> "### Notes:\n" + "## 1. Passwords: password can be set in interactive mode ie:\n" + "### engine-config -s PasswordEntry=interactive\n" + "### or via file with one of the following options:\n" + "### engine-config -s PasswordEntry --admin-pass-file=/tmp/mypass\n" + "### engine-config -s PasswordEntry=/tmp/mypass\n" + "### 2. In order for your change(s) to take effect,\n" + "### restart the oVirt engine service (using: 'service ovirt-engine restart').\n" + "################################################################################\n\n"; return s; }</code><technical_language>please StringFormat %n instead of \n, platform dependent</technical_language>

Target:
public String getHelpNote() { return String.format("%n%n%n" + "### Notes:%n" + "### 1. Passwords: password can be set in interactive mode ie:%n" + "### engine-config -s PasswordEntry=interactive%n" + "### or via file with one of the following options:%n" + "### engine-config -s PasswordEntry --admin-pass-file=/tmp/mypass%n" + "### engine-config -s PasswordEntry=/tmp/mypass%n" + "### 2. In order for your change(s) to take effect,%n" + "### restart the oVirt engine service (using: 'service ovirt-engine restart').%n" + "################################################################################%n%n"); }
Source:
<code>public String toString() { <START> StringBuilder ret = new StringBuilder(); <END> ret.append( this.attributeName ); if ( NO_LOOP.getAttributeName().equals( attributeName ) ) { ret.append( " " ); ret.append( this.value == null ? "true" : this.value ); } else if ( SALIENCE.getAttributeName().equals( this.attributeName ) || DURATION.getAttributeName().equals( this.attributeName ) ) { ret.append( " " ); ret.append( this.value ); } else if (ENABLED.getAttributeName().equals( this.attributeName ) || AUTO_FOCUS.getAttributeName().equals( this.attributeName ) || LOCK_ON_ACTIVE.getAttributeName().equals( this.attributeName ) ) { ret.append( " " ); ret.append( this.value.equals( "true" ) ? "true" : "false" ); } else if (TIMER.getAttributeName().equals( this.attributeName ) ) { ret.append( " " ); if ( this.value.startsWith( "(" ) && this.value.endsWith( ")" ) ) { ret.append( this.value ); } else { ret.append( "(" ).append( this.value ).append( ")" ); } } else if (CALENDARS.getAttributeName().equals( this.attributeName ) ) { final String raw = this.value.replaceAll( "\"|\\s", "" ); final String[] calendars = raw.split( "," ); ret.append( " " ); for ( String calendar : calendars ) { ret.append( "\"" ).append( calendar ).append( "\", " ); } ret.delete( ret.length() - 2, ret.length() ); } else if ( this.value != null ) { ret.append( " \"" ); ret.append( this.value ); ret.append( "\"" ); } return ret.toString(); }</code><technical_language>final</technical_language>

Target:
public String toString() { final StringBuilder ret = new StringBuilder(); ret.append( this.attributeName ); ret.append( ' ' ); if ( NO_LOOP.getAttributeName().equals( attributeName ) ) { ret.append( this.value == null ? "true" : this.value ); } else if ( SALIENCE.getAttributeName().equals( this.attributeName ) || DURATION.getAttributeName().equals( this.attributeName ) ) { ret.append( this.value ); } else if (ENABLED.getAttributeName().equals( this.attributeName ) || AUTO_FOCUS.getAttributeName().equals( this.attributeName ) || LOCK_ON_ACTIVE.getAttributeName().equals( this.attributeName ) ) { ret.append( this.value.equals( "true" ) ? "true" : "false" ); } else if (TIMER.getAttributeName().equals( this.attributeName ) ) { if ( this.value.startsWith( "(" ) && this.value.endsWith( ")" ) ) { ret.append( this.value ); } else { ret.append( '(' ).append( this.value ).append( ')' ); } } else if (CALENDARS.getAttributeName().equals( this.attributeName ) ) { final String raw = this.value.replaceAll( "\"|\\s", "" ); final String[] calendars = raw.split( "," ); for ( String calendar : calendars ) { ret.append( '"' ).append( calendar ).append( "\", " ); } ret.delete( ret.length() - 2, ret.length() ); } else if ( this.value != null ) { ret.append( '"' ); ret.append( this.value ); ret.append( '"' ); } return ret.toString(); }
Source:
<code>private <T> T getOrInstantiate(Class<T> tClass) { try { return applicationContext.getBean(tClass); } catch (NoSuchBeanDefinitionException e) { try { <START> return tClass.cast(tClass.newInstance()); <END> } catch (Exception exception) { throw new IllegalStateException(e.getMessage(), exception); } } }</code><technical_language>spring create beans. ribbon this</technical_language>

Target:
private <T> T getOrInstantiate(Class<T> tClass) { try { return applicationContext.getBean(tClass); } catch (NoSuchBeanDefinitionException e) { return BeanUtils.instantiateClass(tClass); } }
Source:
<code>public void onStart() { Log.d(TAG, "onStart()"); handler.postDelayed(moveAround, 30000); handler.postDelayed(fadeClock, 30000); <START> handler.postDelayed(backgroundChange, 15000 * settings.backgroundImageDuration); <END> }</code><technical_language>This is triggered in onResume. reason do here. suggestion</technical_language>

Target:
public void onStart() { Log.d(TAG, "onStart()"); handler.postDelayed(moveAround, 30000); handler.postDelayed(fadeClock, 30000); }
Source:
<code>static void dbconnect(Config config) throws InterruptedException, Exception { final Splitter COMMA_SPLITTER = Splitter.on(",").omitEmptyStrings().trimResults(); log.info("Connecting to VoltDB Interface..."); ClientConfig clientConfig = new ClientConfig(config.username, config.password); clientConfig.setMaxTransactionsPerSecond(config.ratelimit); if (config.sslfile.trim().length() > 0) { clientConfig.setTrustStoreConfigFromPropertyFile(config.sslfile); clientConfig.enableSSL(); } <START> if (config.autoreconnect) { <END> clientConfig.setReconnectOnConnectionLoss(true); } else { clientConfig.setTopologyChangeAware(true); } client = ClientFactory.createClient(clientConfig); for (String server: COMMA_SPLITTER.split(config.servers)) { log.info("..." + server); client.createConnection(server); } }</code><technical_language>I thought option -</technical_language>

Target:
static void dbconnect(Config config) throws InterruptedException, Exception { final Splitter COMMA_SPLITTER = Splitter.on(",").omitEmptyStrings().trimResults(); log.info("Connecting to VoltDB Interface..."); ClientConfig clientConfig = new ClientConfig(config.username, config.password); clientConfig.setMaxTransactionsPerSecond(config.ratelimit); if (config.sslfile.trim().length() > 0) { clientConfig.setTrustStoreConfigFromPropertyFile(config.sslfile); clientConfig.enableSSL(); } if (config.connectoption.equalsIgnoreCase("autoreconnect")) { clientConfig.setReconnectOnConnectionLoss(true); } else { clientConfig.setTopologyChangeAware(true); } client = ClientFactory.createClient(clientConfig); for (String server: COMMA_SPLITTER.split(config.servers)) { log.info("..." + server); client.createConnection(server); } }
Source:
<code>public void run() { super.run(); isClosed = false; if (endingDocument != null) { endingDocument.prepareDocument(); } if (getDocument() != null && endingDocument != null) { String startingContent = getDocument().getContent(); String endingContent = endingDocument.getContent(); if (startingContent != null && endingContent != null) { int startLength = startingContent.length(); int endLength = endingContent.length(); <START> charLengthDiffBetweenStartAndEndDoc = Math.abs(startLength - endLength); <END> long lengthProduct = startLength*endLength; if(startLength == 0) { lengthProduct = endLength; } else if (endLength == 0) { lengthProduct = startLength; } if(lengthProduct <= LENGTH_PRODUCT_THRESHOLD) { editDistance = new JsonifiedLong( StringUtils.getLevenshteinDistance(startingContent, endingContent)); } } } isClosed = true; }</code><technical_language>Shorten charLengthDiff</technical_language>

Target:
public void run() { super.run(); isClosed = false; if (endingDocument != null) { endingDocument.prepareDocument(); } if (getDocument() != null && endingDocument != null) { String startingContent = getDocument().getContent(); String endingContent = endingDocument.getContent(); if (startingContent != null && endingContent != null) { int startLength = startingContent.length(); int endLength = endingContent.length(); charLengthDiff = Math.abs(startLength - endLength); long lengthProduct = startLength*endLength; if(startLength == 0) { lengthProduct = endLength; } else if (endLength == 0) { lengthProduct = startLength; } if(lengthProduct <= LENGTH_PRODUCT_THRESHOLD) { editDistance = new JsonifiedLong( StringUtils.getLevenshteinDistance(startingContent, endingContent)); } } } isClosed = true; }
Source:
<code>public double priceDerivativeStrike(double strike, PutCall putCall) { <START> double pDK = 0.0; <END> if (strike <= cutOffStrike) { BlackPriceFunction blackFunction = new BlackPriceFunction(); ValueDerivatives volatilityAdjoint = sabrFunction.getVolatilityAdjoint(forward, strike, timeToExpiry, sabrData); EuropeanVanillaOption option = EuropeanVanillaOption.of(strike, timeToExpiry, putCall); BlackFunctionData dataBlack = BlackFunctionData.of(forward, 1.0, volatilityAdjoint.getValue()); ValueDerivatives bsAdjoint = blackFunction.getPriceAdjoint(option, dataBlack); pDK = bsAdjoint.getDerivative(2) + bsAdjoint.getDerivative(1) * volatilityAdjoint.getDerivative(1); } else { pDK = extrapolationDerivative(strike); if (putCall.isPut()) { pDK += 1.0; } } return pDK; }</code><technical_language>declaring a local variable, return if statements</technical_language>

Target:
public double priceDerivativeStrike(double strike, PutCall putCall) { if (strike <= cutOffStrike) { BlackPriceFunction blackFunction = new BlackPriceFunction(); ValueDerivatives volatilityAdjoint = sabrFunction.getVolatilityAdjoint(forward, strike, timeToExpiry, sabrData); EuropeanVanillaOption option = EuropeanVanillaOption.of(strike, timeToExpiry, putCall); BlackFunctionData dataBlack = BlackFunctionData.of(forward, 1.0, volatilityAdjoint.getValue()); ValueDerivatives bsAdjoint = blackFunction.getPriceAdjoint(option, dataBlack); return bsAdjoint.getDerivative(2) + bsAdjoint.getDerivative(1) * volatilityAdjoint.getDerivative(1); } double pDK = extrapolationDerivative(strike); if (putCall.isPut()) { pDK += 1.0; } return pDK; }
Source:
<code>public InternalPushConnection(PackTransport transport, final ReceivePackFactory<C> receivePackFactory, final C req, final Repository remote) throws TransportException { super(transport); final PipedInputStream in_r; final PipedOutputStream in_w; final PipedInputStream out_r; final PipedOutputStream out_w; try { in_r = new PipedInputStream(); in_w = new PipedOutputStream(in_r); out_r = new PipedInputStream(); out_w = new PipedOutputStream(out_r); } catch (IOException err) { remote.close(); throw new TransportException(uri, JGitText.get().cannotConnectPipes, err); } worker = new Thread("JGit-Receive-Pack") { @Override public void run() { try { final ReceivePack rp = receivePackFactory.create(req, remote); rp.receive(out_r, in_w, System.err); <START> } catch (Exception e) { <END> System.err.println("Exception while receiving pack: " + e.toString()); } finally { try { out_r.close(); } catch (IOException e2) { } try { in_w.close(); } catch (IOException e2) { } remote.close(); } } }; worker.start(); init(in_r, out_w); readAdvertisedRefs(); }</code><technical_language>catch (Exception) overwide. code catches RuntimeException problematic, for reason. exception in imagining? rethrow handling</technical_language>

Target:
public InternalPushConnection(PackTransport transport, final ReceivePackFactory<C> receivePackFactory, final C req, final Repository remote) throws TransportException { super(transport); final PipedInputStream in_r; final PipedOutputStream in_w; final PipedInputStream out_r; final PipedOutputStream out_w; try { in_r = new PipedInputStream(); in_w = new PipedOutputStream(in_r); out_r = new PipedInputStream(); out_w = new PipedOutputStream(out_r); } catch (IOException err) { remote.close(); throw new TransportException(uri, JGitText.get().cannotConnectPipes, err); } worker = new Thread("JGit-Receive-Pack") { @Override public void run() { try { final ReceivePack rp = receivePackFactory.create(req, remote); rp.receive(out_r, in_w, System.err); } catch (ServiceNotEnabledException e) { } catch (ServiceNotAuthorizedException e) { } catch (IOException e) { throw new RuntimeException(e); } finally { try { out_r.close(); } catch (IOException e2) { } try { in_w.close(); } catch (IOException e2) { } remote.close(); } } }; worker.start(); init(in_r, out_w); readAdvertisedRefs(); }
Source:
<code>public void addNewMailNotification(Account account, LocalMessage message, int previousUnreadMessageCount) { boolean hasHighPriority = false; <START> for (String iter : message.getHeader("X-Priority")) { <END> if (iter.contains(context.getString(R.string.x_priority))) hasHighPriority = true; } newMailNotifications.addNewMailNotification(account, message, previousUnreadMessageCount, hasHighPriority); }</code><technical_language>this logic part of Message. unnecessary check headers, suffice</technical_language>

Target:
public void addNewMailNotification(Account account, LocalMessage message, int previousUnreadMessageCount) { newMailNotifications.addNewMailNotification(account, message, previousUnreadMessageCount); }
Source:
<code>setVoiceMessageWaiting(int line, int countWaiting) { if (line != 1) { return; } if (countWaiting < 0) { countWaiting = -1; } else if (countWaiting > 0xff) { countWaiting = 0xff; } countVoiceMessages = countWaiting; phone.setSystemProperty(PROPERTY_LINE1_VOICE_MAIL_WAITING, (countVoiceMessages != 0) ? "true" : "false"); <START> ((GSMPhone) phone).notifyMessageWaitingIndicator(); <END> try { if (efMWIS != null) { efMWIS[0] = (byte)((efMWIS[0] & 0xfe) | (countVoiceMessages == 0 ? 0 : 1)); if (countWaiting < 0) { efMWIS[1] = 0; } else { efMWIS[1] = (byte) countWaiting; } ((SIMFileHandler)phone.getIccFileHandler()).updateEFLinearFixed( EF_MWIS, 1, efMWIS, null, obtainMessage (EVENT_UPDATE_DONE, EF_MWIS)); } if (efCPHS_MWI != null) { efCPHS_MWI[0] = (byte)((efCPHS_MWI[0] & 0xf0) | (countVoiceMessages == 0 ? 0x5 : 0xa)); ((SIMFileHandler)phone.getIccFileHandler()).updateEFTransparent( EF_VOICE_MAIL_INDICATOR_CPHS, efCPHS_MWI, obtainMessage (EVENT_UPDATE_DONE, EF_VOICE_MAIL_INDICATOR_CPHS)); } } catch (ArrayIndexOutOfBoundsException ex) { Log.w(LOG_TAG, "Error saving voice mail state to SIM. Probably malformed SIM record", ex); } }</code><technical_language>Cast necessary</technical_language>

Target:
setVoiceMessageWaiting(int line, int countWaiting) { if (line != 1) { return; } if (countWaiting < 0) { countWaiting = -1; } else if (countWaiting > 0xff) { countWaiting = 0xff; } countVoiceMessages = countWaiting; phone.setSystemProperty(PROPERTY_LINE1_VOICE_MAIL_WAITING, (countVoiceMessages != 0) ? "true" : "false"); ((GSMPhone) phone).notifyMessageWaitingIndicator(); try { if (efMWIS != null) { efMWIS[0] = (byte)((efMWIS[0] & 0xfe) | (countVoiceMessages == 0 ? 0 : 1)); if (countWaiting < 0) { efMWIS[1] = 0; } else { efMWIS[1] = (byte) countWaiting; } phone.getIccFileHandler().updateEFLinearFixed( EF_MWIS, 1, efMWIS, null, obtainMessage (EVENT_UPDATE_DONE, EF_MWIS)); } if (efCPHS_MWI != null) { efCPHS_MWI[0] = (byte)((efCPHS_MWI[0] & 0xf0) | (countVoiceMessages == 0 ? 0x5 : 0xa)); phone.getIccFileHandler().updateEFTransparent( EF_VOICE_MAIL_INDICATOR_CPHS, efCPHS_MWI, obtainMessage (EVENT_UPDATE_DONE, EF_VOICE_MAIL_INDICATOR_CPHS)); } } catch (ArrayIndexOutOfBoundsException ex) { Log.w(LOG_TAG, "Error saving voice mail state to SIM. Probably malformed SIM record", ex); } }
Source:
<code>public void should_warn_when_non_bind_marker_has_cql_name() { should_succeed_with_expected_warning( <START> "Parameter id does not refer " + "to a bind marker, @CqlName annotation will be ignored", <END> MethodSpec.methodBuilder("delete") .addAnnotation( AnnotationSpec.builder(Delete.class) .addMember("entityClass", ENTITY_CLASS_NAME + ".class") .addMember("customIfClause", "$S", "description = :description") .build()) .addParameter( ParameterSpec.builder(UUID.class, "id") .addAnnotation( AnnotationSpec.builder(CqlName.class) .addMember("value", "$S", "irrelevant") .build()) .build()) .addParameter(String.class, "description") .addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT) .build()); }</code><technical_language>Nit: strings joined</technical_language>

Target:
public void should_warn_when_non_bind_marker_has_cql_name() { should_succeed_with_expected_warning( "Parameter id does not refer to a bind marker, @CqlName annotation will be ignored", MethodSpec.methodBuilder("delete") .addAnnotation( AnnotationSpec.builder(Delete.class) .addMember("entityClass", ENTITY_CLASS_NAME + ".class") .addMember("customIfClause", "$S", "description = :description") .build()) .addParameter( ParameterSpec.builder(UUID.class, "id") .addAnnotation( AnnotationSpec.builder(CqlName.class) .addMember("value", "$S", "irrelevant") .build()) .build()) .addParameter(String.class, "description") .addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT) .build()); }
Source:
<code><START> private static boolean isEjbModule(IModule module) { <END> IModuleType type = module.getModuleType(); return IWTPConstants.FACET_EJB.equals(type.getId()); }</code><technical_language>some thoughs, check module is a Web module instead of excluding EJB modules</technical_language>

Target:
private static boolean isEjbModule(IModule module) { IModuleType type = module.getModuleType(); if (type == null) { return false; } return IWTPConstants.FACET_EJB.equals(type.getId()); }