auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> JSONObject toJSONObject() { <END> JSONObject json = new JSONObject(); try { json.put(SESSION, session); json.put(NOTIFICATION_IDS, notificationIds); json.put(OUTCOME_ID, name); json.put(TIMESTAMP, timestamp); json.put(WEIGHT, weight); } catch (JSONException exception) { OneSignal.Log(OneSignal.LOG_LEVEL.ERROR, "Generating OutcomeEvent toJSONObject ", exception); } return json; }</code><technical_language>public</technical_language>

Target:
public JSONObject toJSONObject() { JSONObject json = new JSONObject(); try { json.put(SESSION, session); json.put(NOTIFICATION_IDS, notificationIds); json.put(OUTCOME_ID, name); json.put(TIMESTAMP, timestamp); json.put(WEIGHT, weight); } catch (JSONException exception) { OneSignal.Log(OneSignal.LOG_LEVEL.ERROR, "Generating OutcomeEvent toJSONObject ", exception); } return json; }
Source:
<code>private void validateMessageSize(byte[] message) { if (!dropLargeMessage && isLargeMessage(message)) { <START> throw new SamzaException("Logged store message size " + message.length + " for store " + storeName <END> + " was larger than the maximum allowed message size " + maxMessageSize + "."); } }</code><technical_language>message refer Logged store here</technical_language>

Target:
private void validateMessageSize(byte[] message) { if (!dropLargeMessages && isLargeMessage(message)) { throw new RecordTooLargeException("The message size " + message.length + " for store " + storeName + " was larger than the maximum allowed message size " + maxMessageSize + "."); } }
Source:
<code>Slf4j(final String name) { <START> this(name, Slf4j.DEFAULT_LEVEL); <END> }</code><technical_language>I mean, replace this line this(name, Level.FINE)</technical_language>

Target:
Slf4j(final String name) { this(name, Level.FINE); }
Source:
<code>private JDBCFieldConverter createConverter(LogicalType type) { LogicalTypeRoot root = type.getTypeRoot(); <START> if (root == LogicalTypeRoot.SMALLINT) { return new SmallJDBCFieldConverter(); } else { return new DefaultJDBCFieldConverter(); } <END> }</code><technical_language>simplified Java lambda: java if (root == LogicalTypeRoot.SMALLINT) { // Converter for smallint type casts int return short value, // JDBC 1.0 int type for smallint values. return -> ((Integer) value).shortValue(); } return -> value;</technical_language>

Target:
private JDBCFieldConverter createConverter(LogicalType type) { LogicalTypeRoot root = type.getTypeRoot(); if (root == LogicalTypeRoot.SMALLINT) { return v -> ((Integer) v).shortValue(); } else { return v -> v; } }
Source:
<code>private static void populateSubsystems(TerasologyEngineBuilder builder) { if (isHeadless) { builder.add(new HeadlessGraphics()) .add(new HeadlessTimer()) .add(new HeadlessAudio()) .add(new HeadlessInput()); } else { EngineSubsystem audio = soundEnabled ? new LwjglAudio() : new HeadlessAudio(); builder.add(audio) .add(new LwjglGraphics()) .add(new LwjglTimer()) .add(new LwjglInput()) .add(new BindsSubsystem()) .add(new OpenVRInput()); } builder.add(new HibernationSubsystem()); <START> builder.add(new DiscordRPCSubSystem()); <END> }</code><technical_language>I suggest move this a lines - put else block for headless check. need enable this running a headless server</technical_language>

Target:
private static void populateSubsystems(TerasologyEngineBuilder builder) { if (isHeadless) { builder.add(new HeadlessGraphics()) .add(new HeadlessTimer()) .add(new HeadlessAudio()) .add(new HeadlessInput()); } else { EngineSubsystem audio = soundEnabled ? new LwjglAudio() : new HeadlessAudio(); builder.add(audio) .add(new LwjglGraphics()) .add(new LwjglTimer()) .add(new LwjglInput()) .add(new BindsSubsystem()) .add(new OpenVRInput()); builder.add(new DiscordRPCSubSystem()); } builder.add(new HibernationSubsystem()); }
Source:
<code>protected abstract void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception; protected final void setRequiredBytes(int exact) { if (exact < 1) { <START> throw new DecoderException( <END> "setRequiredBytes called with invalid value " + exact + ", must be > 0"); } setRequiredBytes(exact, exact); }</code><technical_language>nit: setRequiredBytes(int,int) enforce this</technical_language>

Target:
protected abstract void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception; protected final void setRequiredBytes(int exact) { setRequiredBytes(exact, exact); }
Source:
<code>public void onResponse(Map<String, Object> response) { try { final AtomicBoolean processHardwareNeededAtomic = new AtomicBoolean(); <START> VDSReturnValue caps = (VDSReturnValue) response.get("result"); if (caps.getSucceeded()) { vdsManager.getHardwareInfo(vds); } <END> VDSStatus refreshReturnStatus = vdsManager.continueRefreshCapabilities(processHardwareNeededAtomic, vds, oldVds, caps); continueRefreshCapabilities(refreshReturnStatus, processHardwareNeededAtomic); refreshVdsRunTimeInfo(false); } catch (Throwable t) { onFailure(t); } }</code><technical_language>This code is 3 times. do new method</technical_language>

Target:
public void onResponse(Map<String, Object> response) { try { final AtomicBoolean processHardwareNeededAtomic = new AtomicBoolean(); VDSReturnValue caps = (VDSReturnValue) response.get("result"); vdsManager.invokeGetHardwareInfo(vds, caps); VDSStatus refreshReturnStatus = vdsManager.processRefreshCapabilitiesResponse(processHardwareNeededAtomic, vds, oldVds, caps); processRefreshCapabilitiesResponse(refreshReturnStatus, processHardwareNeededAtomic); refreshVdsRunTimeInfo(false); } catch (Throwable t) { onFailure(t); } }
Source:
<code>private void setScroller(final ListView listView) { if (mScrollMode == null) { return; } switch (mScrollMode) { case SCROLL_MODE_VEHICLE: { final Integer nextStop = mAdapter.getNextStopIndex(); if (nextStop != null) { listView.post(new Runnable() { @Override public void run() { listView.setSelection(nextStop - 1); } }); } else { mStopIndex = findIndexForStop(mTripInfo.getSchedule().getStopTimes(), mStopId); if (mStopIndex != null) { listView.post(new Runnable() { @Override public void run() { listView.setSelection(mStopIndex); } }); } } <START> } <END> case SCROLL_MODE_STOP: { if (mStopId != null) { mStopIndex = findIndexForStop(mTripInfo.getSchedule().getStopTimes(), mStopId); if (mStopIndex != null) { listView.post(new Runnable() { @Override public void run() { listView.setSelection(mStopIndex); } }); } } else { final Integer nextStop = mAdapter.getNextStopIndex(); if (nextStop != null) { listView.post(new Runnable() { @Override public void run() { listView.setSelection(nextStop - 1); } }); } } } } mAdapter.notifyDataSetChanged(); }</code><technical_language>I missing a break - testing PR w/ breakpoints execute case blocks</technical_language>

Target:
private void setScroller(final ListView listView) { if (mScrollMode == null) { return; } switch (mScrollMode) { case SCROLL_MODE_VEHICLE: { final Integer nextStop = mAdapter.getNextStopIndex(); if (nextStop != null) { listView.post(new Runnable() { @Override public void run() { listView.setSelection(nextStop - 1); } }); } else { mStopIndex = findIndexForStop(mTripInfo.getSchedule().getStopTimes(), mStopId); if (mStopIndex != null) { listView.post(new Runnable() { @Override public void run() { listView.setSelection(mStopIndex); } }); } } break; } case SCROLL_MODE_STOP: { if (mStopId != null) { mStopIndex = findIndexForStop(mTripInfo.getSchedule().getStopTimes(), mStopId); if (mStopIndex != null) { listView.post(new Runnable() { @Override public void run() { listView.setSelection(mStopIndex); } }); } } else { final Integer nextStop = mAdapter.getNextStopIndex(); if (nextStop != null) { listView.post(new Runnable() { @Override public void run() { listView.setSelection(nextStop - 1); } }); } } break; } } mAdapter.notifyDataSetChanged(); }
Source:
<code>public boolean accept(TabFolderPart part) { CTabFolder tabFolder = part.getTabFolder(); int itemCount = tabFolder.getItemCount(); if (itemCount > 1) { int selectionIndex = <START> tabFolder.getSelectionIndex(); <END> if (isPrevious) { selectionIndex--; if (selectionIndex < 0) { selectionIndex = itemCount - 1; } } else { selectionIndex++; if (selectionIndex >= itemCount) { selectionIndex = 0; } } if (expectedClass != null && expectedClass.isInstance(part.getPagePart(selectionIndex))) { nextPages.add(part.getPagePart(selectionIndex)); } else if (expectedClass == null) { nextPages.add(part.getPagePart(selectionIndex)); } } return true; }</code><technical_language>tab folder a selected index. is checking tab folder is active folder. is behaviour of 'next' 'previous' tab-folders? is order in navigation cycle sash panes tab-folders</technical_language>

Target:
public boolean accept(TabFolderPart part) { PagePart activePage = activePageTracker.getActiveEditor(); PagePart visiblePage = part.getVisiblePagePart(); if (activePage == visiblePage) { CTabFolder tabFolder = part.getTabFolder(); int itemCount = tabFolder.getItemCount(); if (itemCount > 1) { int selectionIndex = tabFolder.getSelectionIndex(); if (isPrevious) { selectionIndex--; if (selectionIndex < 0) { selectionIndex = itemCount - 1; } } else { selectionIndex++; if (selectionIndex >= itemCount) { selectionIndex = 0; } } IPage nextPage = part.getPagePart(selectionIndex); if (nextPage != null) { nextPages.add(nextPage); } } } return true; }
Source:
<code>private void startRmAndCheckInitialState() throws Exception { startRmWithConfig(START_CONFIG); <START> Assert.assertTrue("Nodes preservation should be activated on RM start for the test", <END> PAResourceManagerProperties.RM_PRESERVE_NODES_ON_EXIT.getValueAsBoolean()); assertThat(rmHelper.isRMStarted()).isTrue(); assertThat(resourceManager.getState().getAllNodes().size()).isEqualTo(0); rmHelper.createNodeSource(NODE_SOURCE_NAME, NODE_NUMBER); RMMonitorEventReceiver resourceManagerMonitor = (RMMonitorEventReceiver) resourceManager; ArrayList<RMNodeSourceEvent> nodeSourceEventPerNodeSource = resourceManagerMonitor.getInitialState() .getNodeSource(); assertThat(nodeSourceEventPerNodeSource.size()).isEqualTo(1); assertThat(nodeSourceEventPerNodeSource.get(0).getSourceName()).isEqualTo(NODE_SOURCE_NAME); assertThat(resourceManagerMonitor.getState().getAllNodes().size()).isEqualTo(NODE_NUMBER); }</code><technical_language>Replace Assert.assertTrue assertThat library in class</technical_language>

Target:
private void startRmAndCheckInitialState() throws Exception { startRmWithConfig(START_CONFIG); assertThat(PAResourceManagerProperties.RM_PRESERVE_NODES_ON_EXIT.getValueAsBoolean()).isTrue(); assertThat(rmHelper.isRMStarted()).isTrue(); assertThat(resourceManager.getState().getAllNodes().size()).isEqualTo(0); rmHelper.createNodeSource(NODE_SOURCE_NAME, NODE_NUMBER); RMMonitorEventReceiver resourceManagerMonitor = (RMMonitorEventReceiver) resourceManager; ArrayList<RMNodeSourceEvent> nodeSourceEventPerNodeSource = resourceManagerMonitor.getInitialState() .getNodeSource(); assertThat(nodeSourceEventPerNodeSource.size()).isEqualTo(1); assertThat(nodeSourceEventPerNodeSource.get(0).getSourceName()).isEqualTo(NODE_SOURCE_NAME); assertThat(resourceManagerMonitor.getState().getAllNodes().size()).isEqualTo(NODE_NUMBER); }
Source:
<code>boolean hasUpdateIntervalElapsedForScmMaterial(Material material) { Long lastMaterialUpdateTime = materialLastUpdateTimeMap.get(material); if (lastMaterialUpdateTime != null) { boolean shouldUpdateMaterial = (DateTimeUtils.currentTimeMillis() - lastMaterialUpdateTime) >= materialUpdateInterval; if (!shouldUpdateMaterial) { <START> LOGGER.info(format("[Material Update] Skipping update of material %s which has been last updated at %s", material, new Date(lastMaterialUpdateTime))); <END> } return shouldUpdateMaterial; } return true; }</code><technical_language>this common logged INFO level</technical_language>

Target:
boolean hasUpdateIntervalElapsedForScmMaterial(Material material) { Long lastMaterialUpdateTime = materialLastUpdateTimeMap.get(material); if (lastMaterialUpdateTime != null) { boolean shouldUpdateMaterial = (DateTimeUtils.currentTimeMillis() - lastMaterialUpdateTime) >= materialUpdateInterval; if (LOGGER.isDebugEnabled() && !shouldUpdateMaterial) { LOGGER.debug(format("[Material Update] Skipping update of material %s which has been last updated at %s", material, new Date(lastMaterialUpdateTime))); } return shouldUpdateMaterial; } return true; }
Source:
<code>private String getLocal(final Server server, final User user, final long radius) { final Location loc = user.getLocation(); final World world = loc.getWorld(); final StringBuilder output = new StringBuilder(); final long radiusSquared = radius * radius; boolean showHidden = user.canInteractVanished(); Queue<User> nearbyPlayers = new PriorityQueue<>((o1, o2) -> (int) (o1.getLocation().distanceSquared(loc) - o2.getLocation().distanceSquared(loc))); for (User player : ess.getOnlineUsers()) { <START> if (!player.equals(user) && !player.getBase().hasPermission("essentials.near.exclude") && (!player.isHidden(user.getBase()) || showHidden || user.getBase().canSee(player.getBase()))) { <END> final Location playerLoc = player.getLocation(); if (playerLoc.getWorld() != world) { continue; } final long delta = (long) playerLoc.distanceSquared(loc); if (delta < radiusSquared) { nearbyPlayers.offer(player); } } } while (!nearbyPlayers.isEmpty()) { if (output.length() > 0) { output.append(", "); } User nearbyPlayer = nearbyPlayers.poll(); output.append(nearbyPlayer.getDisplayName()).append("§f(§4").append((long) nearbyPlayer.getLocation().distance(loc)).append("m§f)"); } return output.length() > 1 ? output.toString() : tl("none"); }</code><technical_language>player.isAuthorized("essentials.near.exclude") right</technical_language>

Target:
private String getLocal(final Server server, final User user, final long radius) { final Location loc = user.getLocation(); final World world = loc.getWorld(); final StringBuilder output = new StringBuilder(); final long radiusSquared = radius * radius; boolean showHidden = user.canInteractVanished(); Queue<User> nearbyPlayers = new PriorityQueue<>((o1, o2) -> (int) (o1.getLocation().distanceSquared(loc) - o2.getLocation().distanceSquared(loc))); for (User player : ess.getOnlineUsers()) { if (!player.equals(user) && !player.isAuthorized("essentials.near.exclude") && (!player.isHidden(user.getBase()) || showHidden || user.getBase().canSee(player.getBase()))) { final Location playerLoc = player.getLocation(); if (playerLoc.getWorld() != world) { continue; } final long delta = (long) playerLoc.distanceSquared(loc); if (delta < radiusSquared) { nearbyPlayers.offer(player); } } } while (!nearbyPlayers.isEmpty()) { if (output.length() > 0) { output.append(", "); } User nearbyPlayer = nearbyPlayers.poll(); output.append(nearbyPlayer.getDisplayName()).append("§f(§4").append((long) nearbyPlayer.getLocation().distance(loc)).append("m§f)"); } return output.length() > 1 ? output.toString() : tl("none"); }
Source:
<code>public static LookupJoinMatcher create( LookupExtractor extractor, ColumnSelectorFactory leftSelectorFactory, JoinConditionAnalysis condition, boolean remainderNeeded ) { final List<Expr> keyExprs; if (condition.isAlwaysTrue()) { keyExprs = null; } else if (condition.isAlwaysFalse()) { keyExprs = null; } else if (condition.getNonEquiConditions().isEmpty() && condition.getEquiConditions() .stream() .allMatch(eq -> eq.getRightColumn().equals(LookupColumnSelectorFactory.KEY_COLUMN))) { keyExprs = condition.getEquiConditions().stream() .map(Equality::getLeftExpr) .collect(Collectors.toList()); } else { <START> throw new IAE("Cannot join lookup with condition: %s", condition); <END> } return new LookupJoinMatcher(extractor, leftSelectorFactory, condition, keyExprs, remainderNeeded); }</code><technical_language>Suggest splitting non-equiconditions check lookup key column check, a specific exception message for case</technical_language>

Target:
public static LookupJoinMatcher create( LookupExtractor extractor, ColumnSelectorFactory leftSelectorFactory, JoinConditionAnalysis condition, boolean remainderNeeded ) { final List<Expr> keyExprs; if (condition.isAlwaysTrue()) { keyExprs = null; } else if (condition.isAlwaysFalse()) { keyExprs = null; } else if (!condition.getNonEquiConditions().isEmpty()) { throw new IAE("Cannot join lookup with non-equi condition: %s", condition); } else if (!condition.getEquiConditions() .stream() .allMatch(eq -> eq.getRightColumn().equals(LookupColumnSelectorFactory.KEY_COLUMN))) { throw new IAE("Cannot join lookup with condition referring to non-key column: %s", condition); } else { keyExprs = condition.getEquiConditions().stream().map(Equality::getLeftExpr).collect(Collectors.toList()); } return new LookupJoinMatcher(extractor, leftSelectorFactory, condition, keyExprs, remainderNeeded); }
Source:
<code>public boolean isExcluded(final InetAddress address, String location) { getReadLock().lock(); try { final List<ExcludeRange> excludeRanges = getConfiguration().getExcludeRanges(); <START> getConfiguration().getDefinitions().forEach(def -> { <END> setLocationFromDefinition(def); excludeRanges.addAll(def.getExcludeRanges()); }); if (!excludeRanges.isEmpty()) { final byte[] laddr = address.getAddress(); for (final ExcludeRange range : excludeRanges) { if(!isLocationMatched(range.getLocation(), location)) { continue; } if (InetAddressUtils.isInetAddressInRange(laddr, range.getBegin(), range.getEnd())) { return true; } } } return false; } finally { getReadLock().unlock(); } }</code><technical_language>this performed configuration is loaded/reloaded opposed done call isExcluded</technical_language>

Target:
public boolean isExcluded(final InetAddress address, String location) { String defaultLocation = LocationUtils.DEFAULT_LOCATION_NAME; if (!m_excludeRanges.isEmpty()) { final byte[] laddr = address.getAddress(); for (final ExcludeRange range : m_excludeRanges) { if (!isLocationMatched(range.getLocation().orElse(defaultLocation), location)) { continue; } if (InetAddressUtils.isInetAddressInRange(laddr, range.getBegin(), range.getEnd())) { return true; } } } return false; }
Source:
<code>private KafkaSystemAdmin createSystemAdmin(String system) { String kafkaConsumerPropertyPrefix = "systems." + system + ".consumer."; Map<String, String> map = new HashMap<>(); map.put(kafkaConsumerPropertyPrefix + BOOTSTRAP_SERVERS_CONFIG, brokerList()); map.put(JobConfig.JOB_NAME(), "test.job"); <START> map.put(kafkaConsumerPropertyPrefix + KafkaConsumerConfig.ZOOKEEPER_CONNECT, zkConnect()); <END> Config config = new MapConfig(map); HashMap<String, Object> consumerConfig = KafkaConsumerConfig.getKafkaSystemConsumerConfig(config, system, KafkaConsumerConfig.createClientId("kafka-admin-consumer", config)); return new KafkaSystemAdmin(system, new MapConfig(map), KafkaSystemConsumer.createKafkaConsumerImpl(system, consumerConfig)); }</code><technical_language>Zookeeper connect is required new kafka AdminClient, remove it</technical_language>

Target:
private KafkaSystemAdmin createSystemAdmin(String system) { String kafkaConsumerPropertyPrefix = "systems." + system + ".consumer."; Map<String, String> map = new HashMap<>(); map.put(kafkaConsumerPropertyPrefix + CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, brokerList()); map.put(JobConfig.JOB_NAME(), "test.job"); Config config = new MapConfig(map); HashMap<String, Object> consumerConfig = KafkaConsumerConfig.getKafkaSystemConsumerConfig(config, system, KafkaConsumerConfig.createClientId("kafka-admin-consumer", config)); return new KafkaSystemAdmin(system, new MapConfig(map), KafkaSystemConsumer.createKafkaConsumerImpl(system, consumerConfig)); }
Source:
<code>private void parseLibraryClassLoader() { if (null == libraryDir) { return; } Path libraryPath = Paths.get(libraryDir); <START> if( Files.notExists(libraryPath) || !Files.isDirectory(libraryPath) ) { <END> return; } try { List<URI> jarUris = Files.list(libraryPath) .filter(file -> file.toString().endsWith(".jar")) .map(Path::toUri) .collect(Collectors.toList()); List<URL> jarUrls = new ArrayList<>(jarUris.size()); for (URI jarUri : jarUris) { try { jarUrls.add(jarUri.toURL()); } catch (MalformedURLException malformedURLException) { LOG.error("Unable to load the stack library {}", jarUri, malformedURLException); } } URL[] jarUrlArray = new URL[jarUris.size()]; libraryClassLoader = new URLClassLoader(jarUrls.toArray(jarUrlArray), ClassUtils.getDefaultClassLoader()); try { @SuppressWarnings("unchecked") Class<UpgradeCheck> clazz = (Class<UpgradeCheck>) libraryClassLoader.loadClass( "testbed.FooCheck"); UpgradeCheck check = clazz.newInstance(); check.perform(null); } catch (Exception exception) { exception.printStackTrace(); } } catch (IOException ioException) { LOG.error("Unable to load libraries from {}", libraryPath, ioException); } }</code><technical_language>work a symlink pointing a directory</technical_language>

Target:
private void parseLibraryClassLoader() { if (null == libraryDir) { return; } Path libraryPath = Paths.get(libraryDir); if (Files.notExists(libraryPath) || !Files.isDirectory(libraryPath)) { return; } try { List<URI> jarUris = Files.list(libraryPath).filter( file -> file.toString().endsWith(".jar")).map(Path::toUri).collect(Collectors.toList()); List<URL> jarUrls = new ArrayList<>(jarUris.size()); for (URI jarUri : jarUris) { try { jarUrls.add(jarUri.toURL()); } catch (MalformedURLException malformedURLException) { LOG.error("Unable to load the stack library {}", jarUri, malformedURLException); } } URL[] jarUrlArray = new URL[jarUris.size()]; libraryClassLoader = new URLClassLoader(jarUrls.toArray(jarUrlArray), ClassUtils.getDefaultClassLoader()); } catch (IOException ioException) { LOG.error("Unable to load libraries from {}", libraryPath, ioException); } }
Source:
<code>public void testConstantBoolean() { <START> Assume.assumeFalse("Skip: Pig/Hadoop tests do not work on Windows", isWindows()); <END> checkTranslation("g == false", inTree("NOT($6)")); }</code><technical_language>Instead of repeating assumeFalse call in method I guess achieve @Before @BeforeClass annotation</technical_language>

Target:
public void testConstantBoolean() { checkTranslation("g == false", inTree("NOT($6)")); }
Source:
<code>public static Sla getSLA(String clusterName, Process process) { Cluster cluster = getCluster(process, clusterName); <START> return cluster != null ? getSLA(cluster, process) : null; <END> }</code><technical_language>throw exception too, cluster is invalid</technical_language>

Target:
public static Sla getSLA(String clusterName, Process process) throws FalconException{ Cluster cluster = getCluster(process, clusterName); if (cluster == null){ throw new FalconException("Invalid cluster: " + clusterName + " for process: " + process.getName()); } return getSLA(cluster, process); }
Source:
<code>private <R> R accessInner(ICorfuSMRAccess<R, T> accessMethod, Object[] conflictObject, boolean isMetricsEnabled) { if (TransactionalContext.isInTransaction()) { try { return TransactionalContext.getCurrentContext() .access(this, accessMethod, conflictObject); } catch (Exception e) { log.error("Access[{}]", this, e); this.abortTransaction(e); } } for (int x = 0; x < rt.getParameters().getTrimRetry(); x++) { final long timestamp = rt.getSequencerView() .query(getStreamID()); log.debug("Access[{}] conflictObj={} version={}", this, conflictObject, timestamp); try { return underlyingObject.access(o -> o.getVersionUnsafe() >= timestamp && !o.isOptimisticallyModifiedUnsafe(), o -> o.syncObjectUnsafe(timestamp), o -> accessMethod.access(o)); } catch (TrimmedException te) { log.warn("accessInner: Encountered a trim exception while accessing version on attempt {}", timestamp, x); underlyingObject.update(o -> { <START> o.resetUnsafe(); <END> return null; }); } } throw new TrimmedException(String.format("Encounter TrimmedException %d times during Non-transactional " + "object access.", rt.getParameters().getTrimRetry())); }</code><technical_language>discussed this changed similar getUpcallRersult()</technical_language>

Target:
private <R> R accessInner(ICorfuSMRAccess<R, T> accessMethod, Object[] conflictObject, boolean isMetricsEnabled) { if (TransactionalContext.isInTransaction()) { try { return TransactionalContext.getCurrentContext() .access(this, accessMethod, conflictObject); } catch (Exception e) { log.error("Access[{}]", this, e); this.abortTransaction(e); } } for (int x = 0; x < rt.getParameters().getTrimRetry(); x++) { final long timestamp = rt.getSequencerView() .query(getStreamID()); log.debug("Access[{}] conflictObj={} version={}", this, conflictObject, timestamp); try { return underlyingObject.access(o -> o.getVersionUnsafe() >= timestamp && !o.isOptimisticallyModifiedUnsafe(), o -> o.syncObjectUnsafe(timestamp), o -> accessMethod.access(o)); } catch (TrimmedException te) { log.warn("accessInner: Encountered a trim exception while accessing version on attempt {}", timestamp, x); } } throw new TrimmedException(String.format("Encounter TrimmedException %d times during Non-transactional " + "object access.", rt.getParameters().getTrimRetry())); }
Source:
<code>public Void visitMethodInvocation(MethodInvocationTree tree, AnnotatedTypeMirror type) { if (returnsThis(tree)) { ExpressionTree receiverTree = TreeUtils.getReceiverTree(tree.getMethodSelect()); AnnotatedTypeMirror receiverType; AnnotationMirror receiverAnno; if (receiverTree != null <START> && (receiverType = getAnnotatedType(receiverTree)) != null) { <END> receiverAnno = receiverType.getAnnotationInHierarchy(TOP); } else { receiverAnno = TOP; } type.replaceAnnotation(receiverAnno); } return super.visitMethodInvocation(tree, type); }</code><technical_language>I a strong negative reaction assignments conditionals. * surprising liable overlooked misinterpreted, especially "=" is a mathematical symbol for equality. * hard reason about. Please rewrite this code avoid assignments conditionals</technical_language>

Target:
public Void visitMethodInvocation(MethodInvocationTree tree, AnnotatedTypeMirror type) { if (returnsThis(tree)) { ExpressionTree receiverTree = TreeUtils.getReceiverTree(tree.getMethodSelect()); AnnotatedTypeMirror receiverType = receiverTree == null ? null : getAnnotatedType(receiverTree); AnnotationMirror receiverAnno = receiverType == null ? top : receiverType.getAnnotationInHierarchy(top); AnnotationMirror returnAnno = type.getAnnotationInHierarchy(top); type.replaceAnnotation(qualHierarchy.greatestLowerBound(returnAnno, receiverAnno)); } return super.visitMethodInvocation(tree, type); }
Source:
<code>private SolrQuery addFieldQueryParameters(SolrQuery query) { query.set(DisMaxParams.PF, "name^40 nameSpell^70 synonym^15 synonymSpell^25 text^3 textSpell^5"); <START> query.set(DisMaxParams.QF, "name^10 short_name^5 included_name^5 nameSpell^18 nameStub^5 " <END> + "synonym^6 synonymSpell^10 synonymStub^3 text^1 textSpell^2 textStub^0.5"); return query; }</code><technical_language>Stub Spell versions of short_name included_name included</technical_language>

Target:
private SolrQuery addFieldQueryParameters(SolrQuery query) { query.set(DisMaxParams.PF, "name^40 nameSpell^70 synonym^15 synonymSpell^25 " + "included_name^15 included_nameSpell^25 text^3 textSpell^5"); query.set(DisMaxParams.QF, "id^40 name^10 nameSpell^18 nameStub^5 " + "short_name^18 short_nameStub^5 " + "synonym^6 synonymSpell^10 synonymStub^3 " + "included_name^6 included_nameSpell^10 included_nameStub^3 " + "text^1 textSpell^2 textStub^0.5"); return query; }
Source:
<code>public String toString() { return MoreObjects.toStringHelper(this) .add("level", level) .add("loggers", loggers) .add("appenders", appenders) .add("loggerContext", loggerContext) <START> .add("configurationErrorsStream", configurationErrorsStream) <END> .toString(); }</code><technical_language>I printing configurationErrorsStream loggerContext is useful here</technical_language>

Target:
public String toString() { return MoreObjects.toStringHelper(this) .add("level", level) .add("loggers", loggers) .add("appenders", appenders) .toString(); }
Source:
<code>public static void waitTillInstancesAreCreated(ColoHelper cluster, Entity entity, String startTime, String endTime, int totalMinutesToWait) throws URISyntaxException, AuthenticationException, InterruptedException, IOException { String entityName = entity.getName(); EntityType type = entity.getEntityType(); String params = "?start=" + startTime; params += (endTime.isEmpty() ? "" : "&end=" + endTime); <START> for (int sleepCount = 0; sleepCount < totalMinutesToWait; sleepCount++) { <END> InstancesResult statusResult = cluster.getProcessHelper().getProcessInstanceStatus(entityName, params); if (statusResult.getInstances() != null) { break; } LOGGER.info(type + " " + entityName + " still doesn't have instance created"); TimeUtil.sleepSeconds(5); } }</code><technical_language>I assume loop checking status for "totalMinutesToWait" minutes. In end, TimeUtil.sleepSeconds(5) ideally TimeUtil.sleepSeconds(60)</technical_language>

Target:
public static void waitTillInstancesAreCreated(ColoHelper cluster, Entity entity, String startTime, String endTime, int totalMinutesToWait) throws URISyntaxException, AuthenticationException, InterruptedException, IOException { String entityName = entity.getName(); EntityType type = entity.getEntityType(); String params = "?start=" + startTime; params += (endTime.isEmpty() ? "" : "&end=" + endTime); int totalSecondsToWait = totalMinutesToWait * 60; for (int sleepSeconds = 0; sleepSeconds < totalSecondsToWait; sleepSeconds = sleepSeconds+10) { InstancesResult statusResult = cluster.getProcessHelper().getProcessInstanceStatus(entityName, params); if (statusResult.getInstances() != null) { return; } LOGGER.info(type + " " + entityName + " still doesn't have instance created"); TimeUtil.sleepSeconds(10); } Assert.fail("Instances not created"); }
Source:
<code>private List<CrewMember> getOtherPublisherPeople(Film film) { ImmutableList.Builder<CrewMember> builder = ImmutableList.builder(); for (CrewMember crewMember : film.getPeople()) { if (crewMember.publisher() != Publisher.RADIO_TIMES) { builder.add(crewMember); } } <START> return builder.build(); <END> }</code><technical_language>this done a stream, filter & collect this return film.getPeople().stream() .filter(crewMember -> crewMember.publisher() != Publisher.RADIO_TIMES) .collect(MoreCollectors.toImmutableList);</technical_language>

Target:
private List<CrewMember> getOtherPublisherPeople(Film film) { return film.getPeople().stream() .filter(crewMember -> crewMember.publisher() != Publisher.RADIO_TIMES) .collect(MoreCollectors.toImmutableList()); }
Source:
<code>public void testGetAndSetConfiguration() throws IOException, JAXBException { SpringClient client = new SpringClient().getTestInstanceLoggedInAsAdmin(); final String storageId = "storage2"; final String repositoryId1 = "repository0"; Storage storage2 = new Storage(storageId); Storage storage1 = new Storage("storage1"); client.addStorage(storage1); <START> System.out.println("111111111111111"); <END> ProxyConfiguration proxyConfiguration = createProxyConfiguration(); System.out.println("22222222222222222222222"); System.out.println(client.setProxyConfiguration(proxyConfiguration) + " ++++++++++++++++ "); client.getProxyConfiguration(storageId, repositoryId1); client.deleteStorage("storage1", true); Repository r1 = new Repository(repositoryId1); r1.setAllowsRedeployment(true); r1.setSecured(true); r1.setStorage(storage2); r1.setProxyConfiguration(createProxyConfiguration()); client.addRepository(r1); final Configuration configuration = client.getConfiguration(); Storage storage = new Storage("storage3"); configuration.addStorage(storage); final int response = client.setConfiguration(configuration); assertEquals("Failed to retrieve configuration!", 200, response); final Configuration c = client.getConfiguration(); Assert.assertNotNull("Failed to create storage3!", c.getStorage("storage3")); }</code><technical_language>@yurygrishechkin : please commit this kind of dummy logging? Thanks</technical_language>

Target:
public void testGetAndSetConfiguration() throws IOException, JAXBException { Configuration configuration = getConfiguration(); Storage storage = new Storage("storage3"); configuration.addStorage(storage); String url = getContextBaseUrl() + "/configuration/strongbox/xml"; GenericParser<Configuration> parser2 = new GenericParser<>(Configuration.class); String serializedConfiguration = parser2.serialize(configuration); given().contentType(MediaType.TEXT_PLAIN_VALUE) .body(serializedConfiguration) .when() .put(url) .then() .statusCode(200); final Configuration c = getConfiguration(); assertNotNull("Failed to create storage3!", c.getStorage("storage3")); }
Source:
<code>public WebSocketClientHandshaker00 setForceCloseTimeoutMillis(long forceCloseTimeoutMillis) { <START> this.forceCloseTimeoutMillis = forceCloseTimeoutMillis; <END> return this; }</code><technical_language>nit: jut call super.setForceCloseTimeoutMillis(...) this ensure do correct if change super method content allow forceCloseTimeMillis private</technical_language>

Target:
public WebSocketClientHandshaker00 setForceCloseTimeoutMillis(long forceCloseTimeoutMillis) { super.setForceCloseTimeoutMillis(forceCloseTimeoutMillis); return this; }
Source:
<code>private void setLogInfo(final TaskEventType type, final TaskEventSummary model) { String logInfoContent = constants.ByUser() + " " + model.getUserId() + " "; switch (type) { case ADDED: { if (model.getUserId() != null && !model.getUserId().isEmpty()) { <START> logInfoContent = constants.ByProcess() + " '" + model.getUserId() + "' "; <END> } else { logInfoContent = ""; } break; } case UPDATED: { logInfoContent += " (" + model.getMessage() + " ) "; break; } } logInfo.setTextContent(logInfoContent); }</code><technical_language>Do need end string whitespace apostrophe</technical_language>

Target:
private void setLogInfo(final TaskEventType type, final TaskEventSummary model) { String logInfoContent = constants.ByUser() + " " + model.getUserId(); switch (type) { case ADDED: { if (model.getUserId() != null && !model.getUserId().isEmpty()) { logInfoContent = constants.ByProcess() + " '" + model.getUserId() + "'"; } else { logInfoContent = ""; } break; } case UPDATED: { logInfoContent += " (" + model.getMessage() + ")"; break; } } logInfo.setTextContent(logInfoContent); }
Source:
<code>private void traverseXObjectsOnUpdate(Map<DocumentReference, List<BaseObject>> oldXObjects, Map<DocumentReference, List<BaseObject>> xObjects, DocumentReference documentReference, DocumentReference authorReference, Syntax syntax) { for (Map.Entry<DocumentReference, List<BaseObject>> entry : xObjects.entrySet()) { List<BaseObject> oldEntry = oldXObjects.get(entry.getKey()); for (BaseObject baseObject : entry.getValue()) { if (baseObject != null) { <START> handBaseObject(oldEntry, baseObject, documentReference, authorReference, syntax); <END> } } } }</code><technical_language>typo? hand handle</technical_language>

Target:
private void traverseXObjectsOnUpdate(Map<DocumentReference, List<BaseObject>> oldXObjects, Map<DocumentReference, List<BaseObject>> xObjects, DocumentReference documentReference, DocumentReference authorReference, Syntax syntax) { for (Map.Entry<DocumentReference, List<BaseObject>> entry : xObjects.entrySet()) { List<BaseObject> oldEntry = oldXObjects.get(entry.getKey()); for (BaseObject baseObject : entry.getValue()) { if (baseObject != null) { handleBaseObject(oldEntry, baseObject, documentReference, authorReference, syntax); } } } }
Source:
<code>static void recursiveUnmanage(IContainer container, IProgressMonitor monitor) { try { monitor.beginTask(null, 10); monitor.subTask(NLS.bind(CVSMessages.EclipseFolder_0, new String[] {container.getFullPath().toString() })); EclipseSynchronizer.getInstance().deleteFolderSync(container); IResource[] members = container.members(true); for (IResource member : members) { monitor.worked(1); <START> IResource resource = member; <END> if (resource.getType() == IResource.FILE) { ResourceAttributes attrs = resource.getResourceAttributes(); if (attrs != null && attrs.isReadOnly()) { attrs.setReadOnly(false); resource.setResourceAttributes(attrs); } } else { recursiveUnmanage((IContainer) resource, monitor); } } } catch (CoreException e) { } finally { monitor.done(); } }</code><technical_language>in loop</technical_language>

Target:
static void recursiveUnmanage(IContainer container, IProgressMonitor monitor) { try { monitor.beginTask(null, 10); monitor.subTask(NLS.bind(CVSMessages.EclipseFolder_0, new String[] {container.getFullPath().toString() })); EclipseSynchronizer.getInstance().deleteFolderSync(container); IResource[] members = container.members(true); for (IResource resource : members) { monitor.worked(1); if (resource.getType() == IResource.FILE) { ResourceAttributes attrs = resource.getResourceAttributes(); if (attrs != null && attrs.isReadOnly()) { attrs.setReadOnly(false); resource.setResourceAttributes(attrs); } } else { recursiveUnmanage((IContainer) resource, monitor); } } } catch (CoreException e) { } finally { monitor.done(); } }
Source:
<code>public String getText(Object object) { <START> String label = ((ViewValidationRule) object).getName(); <END> return label == null || label.length() == 0 ? getString("_UI_ViewValidationRule_type") : getString("_UI_ViewValidationRule_type") + " " + label; }</code><technical_language>IdentifiedElementQuery.getLabel Do forget: * @not-generated</technical_language>

Target:
public String getText(Object object) { IdentifiedElementQuery query = new IdentifiedElementQuery((SemanticValidationRule) object); String label = query.getLabel(); return label == null || label.length() == 0 ? getString("_UI_ViewValidationRule_type") : getString("_UI_ViewValidationRule_type") + " " + label; }
Source:
<code>private String getValidationKey(final VAbstractCategorization categorization) { switch (categorization.getDiagnostic().getHighestSeverity()) { case <START> 1: <END> return VALIDATION_ERRORS + "_info"; case 2: return VALIDATION_ERRORS + "_warning"; case 4: return VALIDATION_ERRORS + "_error"; case 8: return VALIDATION_ERRORS + "_cancel"; default: return VALIDATION_ERRORS; } }</code><technical_language>constant in org.eclipse.emf.common.util.Diagnostic</technical_language>

Target:
private String getValidationKey(final VAbstractCategorization categorization) { switch (categorization.getDiagnostic().getHighestSeverity()) { case Diagnostic.INFO: return VALIDATION_ERRORS + "_info"; case Diagnostic.WARNING: return VALIDATION_ERRORS + "_warning"; case Diagnostic.ERROR: return VALIDATION_ERRORS + "_error"; case Diagnostic.CANCEL: return VALIDATION_ERRORS + "_cancel"; default: return VALIDATION_ERRORS; } }
Source:
<code>public void testServiceUnregistration() throws Exception { MemoryDirectoryDescriptor descr = new MemoryDirectoryDescriptor(); descr.name = "mydir"; descr.schemaName = SCHEMA_NAME; descr.idField = "i"; descr.passwordField = "pw"; descr.schemaSet = new HashSet<>(Arrays.asList("i")); deployBundle("org.nuxeo.ecm.core.cache"); deployBundle("org.nuxeo.ecm.directory"); applyInlineDeployments(); <START> postSetUp(); <END> DirectoryService service = Framework.getService(DirectoryService.class); service.registerDirectoryDescriptor(descr); Directory dir = service.getDirectory("mydir"); assertNotNull(dir); List<Directory> dirs = service.getDirectories(); assertEquals(1, dirs.size()); assertNotNull(dirs.get(0)); assertEquals(dir, dirs.get(0)); service.unregisterDirectoryDescriptor(descr); dir = service.getDirectory("mydir"); assertNull(dir); dirs = service.getDirectories(); assertEquals(0, dirs.size()); }</code><technical_language>postSetUp called applyInlineDeployments</technical_language>

Target:
public void testServiceUnregistration() throws Exception { MemoryDirectoryDescriptor descr = new MemoryDirectoryDescriptor(); descr.name = "mydir"; descr.schemaName = SCHEMA_NAME; descr.idField = "i"; descr.passwordField = "pw"; descr.schemaSet = new HashSet<>(Arrays.asList("i")); deployBundle("org.nuxeo.ecm.core.cache"); deployBundle("org.nuxeo.ecm.directory"); applyInlineDeployments(); DirectoryService service = Framework.getService(DirectoryService.class); service.registerDirectoryDescriptor(descr); Directory dir = service.getDirectory("mydir"); assertNotNull(dir); List<Directory> dirs = service.getDirectories(); assertEquals(1, dirs.size()); assertNotNull(dirs.get(0)); assertEquals(dir, dirs.get(0)); service.unregisterDirectoryDescriptor(descr); dir = service.getDirectory("mydir"); assertNull(dir); dirs = service.getDirectories(); assertEquals(0, dirs.size()); }
Source:
<code>public void deallocateFlow(String flowId) throws FlowNotFoundException, ProvisionerException { try { String netId = getNetworkSelector().findNetworkForFlowId(flowId); <START> getNclController().deallocateFlow(netId, flowId); <END> } catch (Exception e) { throw new ProvisionerException(e); } }</code><technical_language>this method expects flowId, netId parameters. careful order</technical_language>

Target:
public void deallocateFlow(String flowId) throws FlowNotFoundException, ProvisionerException { try { String netId = getNetworkSelector().findNetworkForFlowId(flowId); getNclController().deallocateFlow(flowId, netId); } catch (Exception e) { throw new ProvisionerException(e); } }
Source:
<code>private byte[] readElement(ByteBuffer buffer) { byte[] element = null; try { int length = UnsignedNumeric.readUnsignedInt(buffer); element = new byte[length]; buffer.get(element); } catch (Exception ex) { <START> <END> } return element; }</code><technical_language>I missed this... log error if wrong</technical_language>

Target:
private byte[] readElement(ByteBuffer buffer) { if (buffer.remaining() == 0) return null; int length = UnsignedNumeric.readUnsignedInt(buffer); byte[] element = new byte[length]; buffer.get(element); return element; }
Source:
<code>public static boolean isMethod(MethodInvocation node, String typeQualifiedName, <START> String methodName, String... parameterTypesQualifiedNames) { <END> if (node == null) { return false; } final IMethodBinding methodBinding = node.resolveMethodBinding(); return isMethod(methodBinding, typeQualifiedName, methodName, parameterTypesQualifiedNames); }</code><technical_language>Please move isMethod(MethodInvocation, ...) isMethod(IMethodBinding, ...). This helps in reading code top (See Clean Code book Uncle Bob). diff better</technical_language>

Target:
public static boolean isMethod(MethodInvocation node, String typeQualifiedName, String methodName, String... parameterTypesQualifiedNames) { return node != null && isMethod(node.resolveMethodBinding(), typeQualifiedName, methodName, parameterTypesQualifiedNames); }
Source:
<code>public CompleteBuilder limit(final int limit) { if (limit <= 0) { <START> throw new IllegalStateException("Limit should have a positive value"); <END> } this.limit = String.valueOf(limit); return this; }</code><technical_language>please add limit exception message? easier problem</technical_language>

Target:
public CompleteBuilder limit(final int limit) { if (limit <= 0) { throw new IllegalStateException("Parameter `limit` should be positive, but was = " + limit); } this.limit = String.valueOf(limit); return this; }
Source:
<code>private boolean hasReviewsIncoming(ITask task) { Set<String> reviewUrls = Collections.emptySet(); boolean anyIncomingReviews = false; for (String reviewUrl : reviewUrls) { AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager() .getConnectorForRepositoryTaskUrl(reviewUrl); String taskId = connector.getTaskIdFromTaskUrl(reviewUrl); String repositoryUrl = connector.getRepositoryUrlFromTaskUrl(reviewUrl); ITask reviewTask = taskList.getTask(repositoryUrl, taskId); <START> anyIncomingReviews |= (reviewTask.getSynchronizationState() == SynchronizationState.INCOMING <END> || reviewTask.getSynchronizationState() == SynchronizationState.INCOMING_NEW); } return anyIncomingReviews; }</code><technical_language>return true if incoming fall returning false</technical_language>

Target:
private boolean hasReviewsIncoming(ITask task) { Set<String> reviewUrls = Collections.emptySet(); for (String reviewUrl : reviewUrls) { AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager() .getConnectorForRepositoryTaskUrl(reviewUrl); String taskId = connector.getTaskIdFromTaskUrl(reviewUrl); String repositoryUrl = connector.getRepositoryUrlFromTaskUrl(reviewUrl); ITask reviewTask = taskList.getTask(repositoryUrl, taskId); boolean anyIncomingReviews = (reviewTask.getSynchronizationState().isIncoming()); if (anyIncomingReviews) { return true; } } return false; }
Source:
<code>private void updateAngularObjectRegistry(NotebookSocket conn, Note note) { for(Paragraph paragraph : note.getParagraphs()) { InterpreterGroup interpreterGroup = null; try { interpreterGroup = findInterpreterGroupForParagraph(note, paragraph.getId()); } catch (Exception e) { <START> LOG.error(e.getMessage(), e); <END> } if (null == interpreterGroup) { return; } RemoteAngularObjectRegistry registry = (RemoteAngularObjectRegistry) interpreterGroup.getAngularObjectRegistry(); List<AngularObject> angularObjects = note.getAngularObjects(interpreterGroup.getId()); for (AngularObject ao : angularObjects) { if (StringUtils.equals(ao.getNoteId(), note.getId()) && StringUtils.equals(ao.getParagraphId(), paragraph.getId())) { pushAngularObjectToRemoteRegistry(ao.getNoteId(), ao.getParagraphId(), ao.getName(), ao.get(), registry, interpreterGroup.getId(), conn); } } } }</code><technical_language>this error? I a paragraph a %repl in case interpreterGroup null (which is valid) consider LOG.warn</technical_language>

Target:
private void updateAngularObjectRegistry(NotebookSocket conn, Note note) { for(Paragraph paragraph : note.getParagraphs()) { InterpreterGroup interpreterGroup = null; try { interpreterGroup = findInterpreterGroupForParagraph(note, paragraph.getId()); } catch (Exception e) { LOG.warn(e.getMessage(), e); } if (null == interpreterGroup) { return; } RemoteAngularObjectRegistry registry = (RemoteAngularObjectRegistry) interpreterGroup.getAngularObjectRegistry(); List<AngularObject> angularObjects = note.getAngularObjects(interpreterGroup.getId()); for (AngularObject ao : angularObjects) { if (StringUtils.equals(ao.getNoteId(), note.getId()) && StringUtils.equals(ao.getParagraphId(), paragraph.getId())) { pushAngularObjectToRemoteRegistry(ao.getNoteId(), ao.getParagraphId(), ao.getName(), ao.get(), registry, interpreterGroup.getId(), conn); } } } }
Source:
<code>private Quota mockBasicQuota() { dbWasCalled = true; Quota quota = new Quota(); quota.setId(Guid.NewGuid()); <START> quota.setStoragePoolId(new Guid("00000000-0000-0000-0000-000000001111")); <END> quota.setDescription("My Quota description"); quota.setQuotaName("My Quota Name"); quota.setGraceStoragePercentage(20); quota.setGraceVdsGroupPercentage(20); quota.setThresholdStoragePercentage(80); quota.setThresholdVdsGroupPercentage(80); quota.setQuotaEnforcementType(QuotaEnforcementTypeEnum.HARD_ENFORCEMENT); return quota; }</code><technical_language>why</technical_language>

Target:
private Quota mockBasicQuota() { dbWasCalled = true; Quota quota = new Quota(); quota.setId(Guid.NewGuid()); quota.setStoragePoolId(storage_pool.getId().getValue()); quota.setDescription("My Quota description"); quota.setQuotaName("My Quota Name"); quota.setGraceStoragePercentage(20); quota.setGraceVdsGroupPercentage(20); quota.setThresholdStoragePercentage(80); quota.setThresholdVdsGroupPercentage(80); quota.setQuotaEnforcementType(QuotaEnforcementTypeEnum.HARD_ENFORCEMENT); return quota; }