auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void setupMediaControls(Context context, Intent intent) { if (!Settings.showMediaStyleNotification(context) || activity == null) { return; } String template = intent.getStringExtra("template"); if (template == null || !template.contains("MediaStyle")) { return; } Log.i(TAG, "Show MediaStyle notification"); Log.i(TAG, "template = " + template); int iconId = intent.getIntExtra("iconId", -1); String packageName = intent.getStringExtra("packageName"); Drawable notificationMessageSmallIcon = getNotificationIcon(context, packageName, iconId); View clockLayout = contentView.findViewById(R.id.clockLayout); ConstraintLayout mediaStyleContainer = contentView.findViewById(R.id.notification_mediacontrol_bar); MediaControlLayout mediaControlLayout = new MediaControlLayout(mediaStyleContainer); mediaStyleContainer.removeAllViews(); mediaStyleContainer.addView(mediaControlLayout.getView()); mediaControlLayout.setupFromNotificationIntent(context, intent, notificationMessageSmallIcon); <START> NightDreamUI nightDreamUI = new NightDreamUI(context, NightDreamActivity.window ); <END> mediaControlLayout.setColor(nightDreamUI.getSecondaryColor()); clockLayout.postDelayed(new Runnable() { @Override public void run() { activity.onConfigurationChanged(activity.getResources().getConfiguration()); } }, 500); }</code><technical_language>I this step is necessary. color is set end of mediaControlLayout.setupFromNotificationIntent</technical_language>

Target:
private void setupMediaControls(Context context, Intent intent) { if (!Settings.showMediaStyleNotification(context) || activity == null) { return; } String template = intent.getStringExtra("template"); if (template == null || !template.contains("MediaStyle")) { return; } Log.i(TAG, "Show MediaStyle notification"); Log.i(TAG, "template = " + template); int iconId = intent.getIntExtra("iconId", -1); String packageName = intent.getStringExtra("packageName"); Drawable notificationMessageSmallIcon = getNotificationIcon(context, packageName, iconId); View clockLayout = contentView.findViewById(R.id.clockLayout); ConstraintLayout mediaStyleContainer = contentView.findViewById(R.id.notification_mediacontrol_bar); if (mediaStyleContainer != null) { View boundView = mediaStyleContainer.getChildAt(0); NotificationMediacontrolBinding mediaControlLayoutBinding = DataBindingUtil.getBinding(boundView); if (mediaControlLayoutBinding != null) { mediaControlLayoutBinding.getModel().setupFromNotificationIntent(context, intent, notificationMessageSmallIcon); mediaControlLayoutBinding.invalidateAll(); } else { MediaControlLayout mediaControlLayout = new MediaControlLayout(mediaStyleContainer); mediaStyleContainer.removeAllViews(); mediaStyleContainer.addView(mediaControlLayout.getView()); mediaControlLayout.setupFromNotificationIntent(context, intent, notificationMessageSmallIcon); } } clockLayout.postDelayed(new Runnable() { @Override public void run() { activity.onConfigurationChanged(activity.getResources().getConfiguration()); } }, 500); }
Source:
<code><START> static <T1> Tuple1<Seq<T1>> sequence1(Iterable<? extends Tuple1<? extends T1>> tuples) { <END> Objects.requireNonNull(tuples, "tuples is null"); return new Tuple1<>(Stream.narrow(Iterator.ofAll(tuples).map(Tuple1::_1).toStream())); }</code><technical_language>is a need for number end? distinguishable parameters</technical_language>

Target:
static <T1> Tuple1<Seq<T1>> sequence1(Iterable<? extends Tuple1<? extends T1>> tuples) { Objects.requireNonNull(tuples, "tuples is null"); final Stream<Tuple1<? extends T1>> s = Stream.ofAll(tuples); return new Tuple1<>(s.map(Tuple1::_1)); }
Source:
<code>public GroupInfo apply(GroupResource resource, Input input) throws MethodNotAllowedException, AuthException, BadRequestException, OrmException { AccountGroup internalGroup = resource.toAccountGroup(); if (internalGroup == null) { throw new MethodNotAllowedException(); } else if (!resource.getControl().isOwner()) { throw new AuthException("Not group owner"); } <START> if (input == null || Strings.emptyToNull(input.owner) == null) { <END> throw new BadRequestException("new owner is missing"); } GroupReference owner = GroupBackends.findExactSuggestion(groupBackend, input.owner); if (owner == null) { throw new BadRequestException(String.format("No such group: %s", input.owner)); } try { GroupControl c = controlFactory.validateFor(owner.getUUID()); if (!internalGroup.getOwnerGroupUUID().equals(owner.getUUID())) { internalGroup.setOwnerGroupUUID(owner.getUUID()); db.accountGroups().update(Collections.singleton(internalGroup)); groupCache.evict(internalGroup); } return new GroupInfo(c.getGroup()); } catch (NoSuchGroupException e) { throw new BadRequestException(String.format("No such group: %s", input.owner)); } }</code><technical_language>input == null || Strings.isNullOrEmpty(input.owner)</technical_language>

Target:
public GroupInfo apply(GroupResource resource, Input input) throws MethodNotAllowedException, AuthException, BadRequestException, ResourceNotFoundException, OrmException { AccountGroup group = resource.toAccountGroup(); if (group == null) { throw new MethodNotAllowedException(); } else if (!resource.getControl().isOwner()) { throw new AuthException("Not group owner"); } if (input == null || Strings.isNullOrEmpty(input.owner)) { throw new BadRequestException("owner is required"); } GroupReference owner = GroupBackends.findExactSuggestion(groupBackend, input.owner); if (owner == null) { throw new BadRequestException(String.format("No such group: %s", input.owner)); } try { GroupControl c = controlFactory.validateFor(owner.getUUID()); group = db.accountGroups().get(group.getId()); if (group == null) { throw new ResourceNotFoundException(); } if (!group.getOwnerGroupUUID().equals(owner.getUUID())) { group.setOwnerGroupUUID(owner.getUUID()); db.accountGroups().update(Collections.singleton(group)); groupCache.evict(group); } return new GroupInfo(c.getGroup()); } catch (NoSuchGroupException e) { throw new BadRequestException(String.format("No such group: %s", input.owner)); } }
Source:
<code>public void setup(final String headerKey, final String nameKey, final String valueKey) { <START> <END> getView().setHeader(translationService.format(headerKey)); getView().setNameLabel(translationService.format(nameKey)); getView().setValueLabel(translationService.format(valueKey)); superSetup(); }</code><technical_language>Isnt thing, needs changed</technical_language>

Target:
public void setup(final String headerKey, final String nameKey, final String valueKey) { getView().setHeader(translationService.format(headerKey)); getView().setNameLabel(translationService.format(nameKey)); getView().setValueLabel(translationService.format(valueKey)); setup(); }
Source:
<code>public CompletableFuture<Void> restoreSnapshot(String snapshotName) { <START> throw new UnsupportedOperationException("restoreSnapshot"); <END> }</code><technical_language>why</technical_language>

Target:
public CompletableFuture<Void> restoreSnapshot(String snapshotName) { throw new UnsupportedOperationException( "In place table restorations are not supported. Please use cloneSnapshot"); }
Source:
<code><START> public long quota() { <END> return this.quota; }</code><technical_language>noticing ShareGetPropertiesHeaders reference types for Integer Long, this class primitive types for int long. Is this intentional? standardise</technical_language>

Target:
public int quota() { return this.quota; }
Source:
<code>public static String forCurrentUser() { final User current = User.current(); if (current == null) { return null; } TimeZoneProperty tzp = current.getProperty(TimeZoneProperty.class); if(tzp.timeZoneName == null || tzp.timeZoneName.isEmpty()) { return null; } TimeZone tz = TimeZone.getTimeZone(tzp.timeZoneName); <START> if (!Objects.equals(tz.getID(), tzp.timeZoneName)) { <END> LOGGER.log(Level.WARNING, "Invalid user time zone {0} for {1}", new Object[]{tzp.timeZoneName, current.getId()}); return null; } return tz.getID(); }</code><technical_language>is a real defect. Unlikely, this type static inlined values. fixing hurt for</technical_language>

Target:
public static String forCurrentUser() { final User current = User.current(); if (current == null) { return null; } TimeZoneProperty tzp = current.getProperty(TimeZoneProperty.class); if(tzp.timeZoneName == null || tzp.timeZoneName.isEmpty()) { return null; } TimeZone tz = TimeZone.getTimeZone(tzp.timeZoneName); if (!tz.getID().equals(tzp.timeZoneName)) { LOGGER.log(Level.WARNING, "Invalid user time zone {0} for {1}", new Object[]{tzp.timeZoneName, current.getId()}); return null; } return tz.getID(); }
Source:
<code>public String getPersonSpecified() { if (q == null) { return null; <START> } else { <END> return q.personValue; } }</code><technical_language>remove else</technical_language>

Target:
public String getPersonSpecified() { if (q == null) { return null; } return q.personValue; }
Source:
<code>private boolean buildPayload( JSONObject json ) { environmentVariables = new HashMap<>(); boolean actionIdSet = false, actionClassSet = false, actionUserSet = false, actionParamsSet = false; try { JSONArray jsonArray = (JSONArray) json.get( environmentVariablesKey ); if ( json == null || StringUtils.isEmpty( jsonArray.toJSONString() ) ) { return false; } for ( Object var : jsonArray ) { JSONObject environmentVariable = (JSONObject) var; <START> String name = (String) environmentVariable.get( "name" ); <END> String value = (String) environmentVariable.get( "value" ); switch ( name ) { case actionId: actionIdSet = !StringUtils.isEmpty( value ); environmentVariables.put( actionId, value ); break; case actionClass: actionClassSet = !StringUtils.isEmpty( value ); environmentVariables.put( actionClass, value ); break; case actionUser: actionUserSet = !StringUtils.isEmpty( value ); environmentVariables.put( actionUser, value ); break; case actionParams: environmentVariables.put( actionParams, value ); actionParamsSet = !StringUtils.isEmpty( value ); break; } } return actionIdSet && actionClassSet && actionUserSet && actionParamsSet; } catch ( Exception e ) { logger.error( Arrays.toString( e.getStackTrace( ) ) ); return false; } }</code><technical_language>magic strings, constants</technical_language>

Target:
private boolean buildPayload( JSONObject json ) { try { actionClass = (String) json.get( ActionUtil.INVOKER_ACTIONCLASS ); actionId = (String) json.get( ActionUtil.INVOKER_ACTIONID ); actionParams = (String) json.get( ActionUtil.INVOKER_ACTIONPARAMS ); actionUser = (String) json.get( ActionUtil.INVOKER_ACTIONUSER ); return !StringUtils.isEmpty( actionClass ) && !StringUtils.isEmpty( actionId ) && !StringUtils.isEmpty( actionParams ) && !StringUtils.isEmpty( actionUser ); } catch ( Exception e ) { logger.error( Arrays.toString( e.getStackTrace( ) ) ); return false; } }
Source:
<code>public Map<String, Object> parse(List<String> args) throws Exception { List<String> others = new ArrayList<>(); Map<String, Object> argMap = new HashMap<>(); args.addAll(defaults); while(!args.isEmpty()) { String arg = args.remove(0); if(arg.equals(LONG_PREFIX)) { break; } if(!arg.startsWith(LONG_PREFIX)) { <START> others.add(arg); <END> } else { String[] argVal = parseArgument(arg.substring(2)); ParserArgument parserArgument = arguments.get(argVal[0]); if(parserArgument == null) { others.add(arg); continue; } if(parserArgument.getType() == ArgumentType.required_argument && argVal[1] == null) { throw new IllegalArgumentException( String.format("Argument's '%1$s' value is required", argVal[0]) ); } Matcher m = parserArgument.getMatcher().matcher(argVal[1]); if (!m.find()) { throw new IllegalArgumentException( String.format( "Argument's '%1$s' value don't match pattern: ", parserArgument.getMatcher().pattern() ) ); } if(!argMap.containsKey(argVal[0])) { argMap.put( argVal[0], Util.getObjectValueByString(parserArgument.getConvert(), argVal[1]) ); } } } mandatory.removeAll(argMap.keySet()); if(!mandatory.isEmpty()) { throw new IllegalArgumentException( String.format("Argument(s) '%1$s' required", StringUtils.join(mandatory, ", ")) ); } argMap.put("__other__", others); return argMap; }</code><technical_language>switch state, remaining tokens others, need break loop</technical_language>

Target:
public Map<String, Object> parse(List<String> args) throws Exception { List<String> others = new ArrayList<>(); Map<String, Object> argMap = new HashMap<>(); args.addAll(defaults); while(!args.isEmpty()) { String arg = args.remove(0); if(arg.equals(LONG_PREFIX)) { break; } if(!arg.startsWith(LONG_PREFIX)) { others.add(arg); break; } String[] argVal = parseArgument(arg.substring(2)); ParserArgument parserArgument = arguments.get(argVal[0]); if(parserArgument == null) { throw new IllegalArgumentException( String.format("Argument %1$s is not valid", arg) ); } if(parserArgument.getType() == ArgumentType.required_argument && argVal[1] == null) { throw new IllegalArgumentException( String.format("Argument's '%1$s' value is required", argVal[0]) ); } Matcher m = parserArgument.getMatcher().matcher(argVal[1]); if (!m.find()) { throw new IllegalArgumentException( String.format( "Argument's '%1$s' value don't match pattern: ", parserArgument.getMatcher().pattern() ) ); } if(!argMap.containsKey(argVal[0])) { argMap.put( argVal[0], Util.getObjectValueByString(parserArgument.getConvert(), argVal[1]) ); } } mandatory.removeAll(argMap.keySet()); if(!mandatory.isEmpty()) { throw new IllegalArgumentException( String.format("Argument(s) '%1$s' required", StringUtils.join(mandatory, ", ")) ); } others.addAll(args); argMap.put("__other__", others); return argMap; }
Source:
<code>private boolean downloadMedium(String mediaUrl) { File file = new File(getOfflineMediaPath(mediaUrl)); if (!file.exists()) { try { <START> Log.d(TAG, "Downloading: " + mediaUrl); <END> file.createNewFile(); HttpRequest request = HttpRequest.get(mediaUrl); request.receive(file); if (request.code() < 200 || request.code() >= 300) { Log.e(TAG, "MEDIA FAIL! " + mediaUrl); return false; } } catch (IOException e) { Log.e(TAG, "Failed to download medium", e); throw new ApiSyncException(ApiSyncException.CONNECTION_EXCEPTION, e); } catch (HttpRequest.HttpRequestException e) { Log.e(TAG, "Failed to download medium", e); throw new ApiSyncException(ApiSyncException.CONNECTION_EXCEPTION, e); } } else { Log.d(TAG, "Skipping: " + mediaUrl); } return true; }</code><technical_language>Leftover debug log</technical_language>

Target:
private boolean downloadMedium(String mediaUrl) { File file = new File(getOfflineMediaPath(mediaUrl)); if (!file.exists()) { try { if (BuildConfig.DEBUG) { Log.i(TAG, "Downloading: " + mediaUrl); } file.createNewFile(); HttpRequest request = HttpRequest.get(mediaUrl); request.receive(file); if (request.code() < 200 || request.code() >= 300) { if (BuildConfig.DEBUG) { Log.w(TAG, "MEDIA FAIL! " + mediaUrl); } return false; } } catch (IOException e) { if (BuildConfig.DEBUG) { Log.e(TAG, "Failed to download medium", e); } throw new ApiSyncException(ApiSyncException.CONNECTION_EXCEPTION, e); } catch (HttpRequest.HttpRequestException e) { if (BuildConfig.DEBUG) { Log.e(TAG, "Failed to download medium", e); } throw new ApiSyncException(ApiSyncException.CONNECTION_EXCEPTION, e); } } else if (BuildConfig.DEBUG) { Log.d(TAG, "Skipping: " + mediaUrl); } return true; }
Source:
<code>private void configure(ClientDescriptor clientDescriptor, ConfigureStoreManager message) throws ClusterException { validateClientConnected(clientDescriptor); <START> if (ehcacheStateService.getClientMessageTracker().isConfigureDuplicate(message.getClientId(), message.getId())) { <END> ehcacheStateService.configure(message); } this.clientStateMap.get(clientDescriptor).attach(); }</code><technical_language>Name is confusing - apply message is a duplicate?</technical_language>

Target:
private void configure(ClientDescriptor clientDescriptor, ConfigureStoreManager message) throws ClusterException { validateClientConnected(clientDescriptor); if (ehcacheStateService.getClientMessageTracker().isConfigureApplicable(message.getClientId(), message.getId())) { ehcacheStateService.configure(message); } this.clientStateMap.get(clientDescriptor).attach(); }
Source:
<code>private Converter createConverter(Type field) { <START> LogicalTypeAnnotation otype = field.getLogicalTypeAnnotation(); <END> if (field.isPrimitive()) { if (otype != null) { return otype.accept(new LogicalTypeAnnotation.LogicalTypeAnnotationVisitor<Converter>() { @Override public Optional<Converter> visit(LogicalTypeAnnotation.StringLogicalTypeAnnotation stringLogicalType) { return of(new StringConverter(field.getName())); } @Override public Optional<Converter> visit(LogicalTypeAnnotation.DecimalLogicalTypeAnnotation decimalLogicalType) { int scale = decimalLogicalType.getScale(); return of(new DecimalConverter(field.getName(), scale)); } }).orElse(new SimplePrimitiveConverter(field.getName())); } } GroupType groupType = field.asGroupType(); if (otype != null) { return otype.accept(new LogicalTypeAnnotation.LogicalTypeAnnotationVisitor<Converter>() { @Override public Optional<Converter> visit(LogicalTypeAnnotation.MapLogicalTypeAnnotation mapLogicalType) { return of(new SimpleMapRecordConverter(groupType, field.getName(), SimpleRecordConverter.this)); } @Override public Optional<Converter> visit(LogicalTypeAnnotation.ListLogicalTypeAnnotation listLogicalType) { return of(new SimpleListRecordConverter(groupType, field.getName(), SimpleRecordConverter.this)); } }).orElse(new SimpleRecordConverter(groupType, field.getName(), this)); } return new SimpleRecordConverter(groupType, field.getName(), this); }</code><technical_language>nit: otype -> ltype similar</technical_language>

Target:
private Converter createConverter(Type field) { LogicalTypeAnnotation ltype = field.getLogicalTypeAnnotation(); if (field.isPrimitive()) { if (ltype != null) { return ltype.accept(new LogicalTypeAnnotation.LogicalTypeAnnotationVisitor<Converter>() { @Override public Optional<Converter> visit(LogicalTypeAnnotation.StringLogicalTypeAnnotation stringLogicalType) { return of(new StringConverter(field.getName())); } @Override public Optional<Converter> visit(LogicalTypeAnnotation.DecimalLogicalTypeAnnotation decimalLogicalType) { int scale = decimalLogicalType.getScale(); return of(new DecimalConverter(field.getName(), scale)); } }).orElse(new SimplePrimitiveConverter(field.getName())); } } GroupType groupType = field.asGroupType(); if (ltype != null) { return ltype.accept(new LogicalTypeAnnotation.LogicalTypeAnnotationVisitor<Converter>() { @Override public Optional<Converter> visit(LogicalTypeAnnotation.MapLogicalTypeAnnotation mapLogicalType) { return of(new SimpleMapRecordConverter(groupType, field.getName(), SimpleRecordConverter.this)); } @Override public Optional<Converter> visit(LogicalTypeAnnotation.ListLogicalTypeAnnotation listLogicalType) { return of(new SimpleListRecordConverter(groupType, field.getName(), SimpleRecordConverter.this)); } }).orElse(new SimpleRecordConverter(groupType, field.getName(), this)); } return new SimpleRecordConverter(groupType, field.getName(), this); }
Source:
<code>public void testPullTimeoutAndRetry() throws NetworkException, InterruptedException, TimeoutException, ExecutionException, InjectionException { <START> final long pullRetryTimeoutMs = 1000; <END> setup(pullRetryTimeoutMs); ParameterWorkerTestUtil.pullTimeoutAndRetry(parameterWorker, workerHandler, mockSender, pullRetryTimeoutMs); }</code><technical_language>this a static final field in ParameterWorkerTestUtil AsyncParameterWorkerTest</technical_language>

Target:
public void testPullTimeoutAndRetry() throws NetworkException, InterruptedException, TimeoutException, ExecutionException, InjectionException { prepare(ParameterWorkerTestUtil.PULL_RETRY_TIMEOUT_MS); ParameterWorkerTestUtil.pullTimeoutAndRetry(parameterWorker, workerHandler, mockSender); }
Source:
<code>public void fromJson(ObjectNode node) { JsonNode x = node.get("query"); if (x != null) { query = QueryExpression.fromJson(x); } x = node.get("projection"); if (x != null) { projection = Projection.fromJson(x); } x = node.get("sort"); if (x != null) { sort = Sort.fromJson(x); } x = node.get("range"); if (x instanceof ArrayNode && ((ArrayNode) x).size() == 2) { from = ((ArrayNode) x).get(0).asLong(); to = ((ArrayNode) x).get(1).asLong(); } else { x = node.get("from"); if (x != null) { from = x.asLong(); } x = node.get("to"); <START> if (x != null && x.asLong()>0) { <END> to = x.asLong(); } } }</code><technical_language>negative, x.asLong()>0</technical_language>

Target:
public void fromJson(ObjectNode node) { JsonNode x = node.get("query"); if (x != null) { query = QueryExpression.fromJson(x); } x = node.get("projection"); if (x != null) { projection = Projection.fromJson(x); } x = node.get("sort"); if (x != null) { sort = Sort.fromJson(x); } x = node.get("range"); if (x instanceof ArrayNode && ((ArrayNode) x).size() == 2) { from = ((ArrayNode) x).get(0).asLong(); if(!((ArrayNode) x).get(1).isNull()) to = ((ArrayNode) x).get(1).asLong(); else to = null; } else { x = node.get("from"); if (x != null) { from = x.asLong(); } x = node.get("to"); if (x != null) { to = x.asLong(); } } }
Source:
<code><START> protected String getInvalidCharsInName(final String value) { <END> return getInvalidCharsInName(regExp, value); }</code><technical_language>private? package protected access</technical_language>

Target:
private String getInvalidCharsInName(final String value) { return getInvalidCharsInName(regExp, value); }
Source:
<code>public void testGetAction() throws Exception { deployContrib("org.nuxeo.ecm.actions.jsf.tests", "test-actions-contrib.xml"); applyInlineDeployments(); <START> postSetUp(); <END> DocumentModel doc = new MockDocumentModel("Workspace", new String[0]); Action action = as.getAction("singleActionRetrievedWithFilter", getActionContext(doc), true); assertNotNull(action); assertTrue(action.getAvailable()); action = as.getAction("singleActionRetrievedWithFilter", getActionContext(doc), false); assertNotNull(action); assertTrue(action.getAvailable()); doc = new MockDocumentModel("File", new String[0]); action = as.getAction("singleActionRetrievedWithFilter", getActionContext(doc), true); assertNull(action); action = as.getAction("singleActionRetrievedWithFilter", getActionContext(doc), false); assertNotNull(action); assertFalse(action.getAvailable()); }</code><technical_language>postSetUp called applyInlineDeployments + pushInlineDeployments</technical_language>

Target:
public void testGetAction() throws Exception { pushInlineDeployments("org.nuxeo.ecm.actions.jsf.tests:test-actions-contrib.xml"); DocumentModel doc = new MockDocumentModel("Workspace", new String[0]); Action action = as.getAction("singleActionRetrievedWithFilter", getActionContext(doc), true); assertNotNull(action); assertTrue(action.getAvailable()); action = as.getAction("singleActionRetrievedWithFilter", getActionContext(doc), false); assertNotNull(action); assertTrue(action.getAvailable()); doc = new MockDocumentModel("File", new String[0]); action = as.getAction("singleActionRetrievedWithFilter", getActionContext(doc), true); assertNull(action); action = as.getAction("singleActionRetrievedWithFilter", getActionContext(doc), false); assertNotNull(action); assertFalse(action.getAvailable()); }
Source:
<code>private String getWeekCharacters(String label) { int labelCPCount = label.codePointCount(0, label.length()); <START> return label.substring(labelCPCount - 2, labelCPCount); <END> }</code><technical_language>need change here, is for Date type</technical_language>

Target:
private String getWeekCharacters(String label) { return label.substring(label.length() - 2); }
Source:
<code>public Operator createOperator(DriverContext driverContext) { OperatorContext operatorContext = driverContext.addOperatorContext(operatorId, planNodeId, PartitionedOutputOperator.class.getSimpleName()); return new PartitionedOutputOperator( operatorContext, sourceTypes, pagePreprocessor, partitionFunction, partitionChannels, partitionConstants, replicatesAnyRow, nullChannel, outputBuffer, serdeFactory, maxMemory, <START> SystemSessionProperties.isOptimizedRepartitioningEnabled(operatorContext.getSession())); <END> }</code><technical_language>static import</technical_language>

Target:
public Operator createOperator(DriverContext driverContext) { OperatorContext operatorContext = driverContext.addOperatorContext(operatorId, planNodeId, PartitionedOutputOperator.class.getSimpleName()); return new PartitionedOutputOperator( operatorContext, sourceTypes, pagePreprocessor, partitionFunction, partitionChannels, partitionConstants, replicatesAnyRow, nullChannel, outputBuffer, serdeFactory, maxMemory); }
Source:
<code>public boolean restore_state(InputObjectState os, int ot) { if (!super.restore_state(os, ot) || !restore_list(os, ot, pendingList) || !restore_list(os, ot, preparedList)) { return false; } uid = get_uid().fileStringForm(); try { String s = os.unpackString(); id = s == null ? null : new URI(s); s = os.unpackString(); parentId = s == null ? null : new URI(s); clientId = os.unpackString(); startTime = os.unpackBoolean() ? LocalDateTime.ofInstant(Instant.ofEpochMilli(os.unpackLong()), ZoneOffset.UTC) : null; finishTime = os.unpackBoolean() ? LocalDateTime.ofInstant(Instant.ofEpochMilli(os.unpackLong()), ZoneOffset.UTC) : null; status = os.unpackBoolean() ? LRAStatus.valueOf(os.unpackString()) : null; int cnt = os.unpackInt(); if (cnt == 0) { afterLRAListeners = null; } else { afterLRAListeners = new ArrayList<>(); for (int i = 0; i < cnt; i++) { afterLRAListeners.add(new AfterLRAListener(new URI(os.unpackString()), new URI(os.unpackString()))); } } if (finishTime != null) { long ttl = ChronoUnit.MILLIS.between(LocalDateTime.now(ZoneOffset.UTC), finishTime); if (ttl <= 0) { <START> System.out.printf("TIMER has expired since last reload%n"); <END> status = LRAStatus.Cancelling; } else { System.out.printf("RESTARTING TIMER%n"); } setTimeLimit(ttl); } return true; } catch (IOException | URISyntaxException e) { if (LRALogger.logger.isDebugEnabled()) { LRALogger.logger.debugf(e, "Cannot restore state of objec type '%s'", ot); } return false; } }</code><technical_language>log statements instead of system.out</technical_language>

Target:
public boolean restore_state(InputObjectState os, int ot) { if (!super.restore_state(os, ot) || !restore_list(os, ot, pendingList) || !restore_list(os, ot, preparedList)) { return false; } uid = get_uid().fileStringForm(); try { String s = os.unpackString(); id = s == null ? null : new URI(s); s = os.unpackString(); parentId = s == null ? null : new URI(s); clientId = os.unpackString(); startTime = os.unpackBoolean() ? LocalDateTime.ofInstant(Instant.ofEpochMilli(os.unpackLong()), ZoneOffset.UTC) : null; finishTime = os.unpackBoolean() ? LocalDateTime.ofInstant(Instant.ofEpochMilli(os.unpackLong()), ZoneOffset.UTC) : null; status = os.unpackBoolean() ? LRAStatus.valueOf(os.unpackString()) : null; int cnt = os.unpackInt(); if (cnt == 0) { afterLRAListeners = null; } else { afterLRAListeners = new ArrayList<>(); for (int i = 0; i < cnt; i++) { afterLRAListeners.add(new AfterLRAListener(new URI(os.unpackString()), new URI(os.unpackString()))); } } if (finishTime != null) { long ttl = ChronoUnit.MILLIS.between(LocalDateTime.now(ZoneOffset.UTC), finishTime); if (ttl <= 0) { if (LRALogger.logger.isDebugEnabled()) { LRALogger.logger.debugf("Timer for LRA '%s' has expired since last reload", id); } status = LRAStatus.Cancelling; } else { if (LRALogger.logger.isDebugEnabled()) { LRALogger.logger.debugf("Restarting time for LRA '%s'", id); } } setTimeLimit(ttl); } return true; } catch (IOException | URISyntaxException e) { if (LRALogger.logger.isDebugEnabled()) { LRALogger.logger.debugf(e, "Cannot restore state of objec type '%s'", ot); } return false; } }
Source:
<code>public void clear(String sceneName) { <START> if (!broadcastSequenceMap.containsKey(sceneName)) { <END> return; } broadcastSequenceMap.get(sceneName).clear(); }</code><technical_language>please change to: if (broadcastSequenceMap.containsKey(sceneName)) { broadcastSequenceMap.get(sceneName).clear(); } a lot easier read..</technical_language>

Target:
public void clear(String sceneName) { if (broadcastSequenceMap.containsKey(sceneName)) { broadcastSequenceMap.get(sceneName).clear(); } }
Source:
<code>public ResourceVerifier verifyListAttributeDoesNotContainValue(String attributeName, ModelNode value, String errorMessageSuffix) throws Exception { waitFor(() -> { ModelNodeResult actualResult = ops.readAttribute(resourceAddress, attributeName); return actualResult.isSuccess() && <START> actualResult.hasDefined(Constants.RESULT); <END> }); final ModelNodeResult modelNodeResult = ops.readAttribute(resourceAddress, attributeName); modelNodeResult.assertSuccess(); Assert.assertFalse("Given value '" + value.toString() + "' should not be present in list attribute '" + attributeName + "'!" + (errorMessageSuffix == null || errorMessageSuffix.isEmpty() ? "" : " " + errorMessageSuffix), isModelNodePresentInListAttributeValue(attributeName, value)); return this; }</code><technical_language>I suggest add && !isModelNodePresentInListAttributeValue(attributeName, value) condition</technical_language>

Target:
public ResourceVerifier verifyListAttributeDoesNotContainValue(String attributeName, ModelNode value, String errorMessageSuffix) throws Exception { waitFor(() -> { ModelNodeResult actualResult = ops.readAttribute(resourceAddress, attributeName); return actualResult.isSuccess() && actualResult.hasDefined(Constants.RESULT) && !isModelNodePresentInListAttributeValue(attributeName, value); }); final ModelNodeResult modelNodeResult = ops.readAttribute(resourceAddress, attributeName); modelNodeResult.assertSuccess(); Assert.assertFalse("Given value '" + value.toString() + "' should not be present in list attribute '" + attributeName + "'!" + (errorMessageSuffix == null || errorMessageSuffix.isEmpty() ? "" : " " + errorMessageSuffix), isModelNodePresentInListAttributeValue(attributeName, value)); return this; }
Source:
<code><START> public void setDurability(float durability) { if (durability <= 0) { logger.error("Invalid value for the durability. It can't be less than or equal to zero."); this.durability = 1; } this.durability = durability; } <END></code><technical_language>setting this.durability a potentially bad</technical_language>

Target:
public void setDurability(float durability) { if (durability <= 0) { logger.error("Invalid value for the durability. It can't be less than or equal to zero."); this.durability = 1; } else { this.durability = durability; } }
Source:
<code>private void requestActivityRecognition() { ActivityRecognitionClient client = ActivityRecognition.getClient(mContext); Intent intent = new Intent(mContext, RecognitionBroadcastReceiver.class); intent.putExtra(TravelBehaviorConstants.RECORD_ID, mRecordId); <START> PendingIntent pi = PendingIntent.getBroadcast(mContext, 100, intent, PendingIntent.FLAG_ONE_SHOT); <END> client.requestActivityUpdates(10000l, pi); }</code><technical_language>Instead of 100, I of requests a unique requestCode, for location</technical_language>

Target:
private void requestActivityRecognition() { ActivityRecognitionClient client = ActivityRecognition.getClient(mContext); Intent intent = new Intent(mContext, RecognitionBroadcastReceiver.class); intent.putExtra(TravelBehaviorConstants.RECORD_ID, mRecordId); int reqCode = PreferenceUtils.getInt(TravelBehaviorConstants.RECOGNITION_REQUEST_CODE, 0); PendingIntent pi = PendingIntent.getBroadcast(mContext, reqCode++, intent, PendingIntent.FLAG_ONE_SHOT); PreferenceUtils.saveInt(TravelBehaviorConstants.RECOGNITION_REQUEST_CODE, reqCode); client.requestActivityUpdates(TimeUnit.SECONDS.toMillis(10), pi); }
Source:
<code>public List<AttestationValue> parsePostedResp(String str) throws JsonParseException, IOException { JsonFactory jfactory = new JsonFactory(); List<AttestationValue> values = new ArrayList<AttestationValue>(); JsonParser jParser = jfactory.createJsonParser(str); try { jParser.nextToken(); <START> while (jParser.nextToken() != JsonToken.END_OBJECT) { <END> if (jParser.getCurrentName().equalsIgnoreCase(HEADER_HOSTS)) { jParser.nextToken(); jParser.nextToken(); jParser.nextToken(); AttestationValue value = new AttestationValue(); while (jParser.getCurrentToken() != JsonToken.END_ARRAY) { String fieldname = jParser.getCurrentName(); if (fieldname.equalsIgnoreCase(HEADER_HOST_NAME)) { jParser.nextToken(); value.setHostName(jParser.getText()); } else if (fieldname.equalsIgnoreCase(HEADER_RESULT)) { jParser.nextToken(); value.setTrustLevel(AttestationResultEnum .valueOf(jParser.getText().toUpperCase())); } else if (fieldname.equalsIgnoreCase(HEADER_VTIME)) { jParser.nextToken(); } else if (!jParser.nextToken().isScalarValue()) { jParser.skipChildren(); } if (jParser.nextToken() == JsonToken.END_OBJECT) { log.debug("host_name:" + value.getHostName() + ", trustLevel:" + value.getTrustLevel()); values.add(value); value = new AttestationValue(); if (jParser.nextToken() == JsonToken.START_OBJECT) { jParser.nextToken(); } } } break; } else if (!jParser.nextToken().isScalarValue()) { jParser.skipChildren(); } } } finally { jParser.close(); } return values; }</code><technical_language>do iterate tokens key? (HEADER_HOSTS, HEADER_VTIME, etc.). this prevent current future bugs</technical_language>

Target:
public List<AttestationValue> parsePostedResp(String str) throws JsonProcessingException, IOException { List<AttestationValue> values = new ArrayList<>(); ObjectMapper mapper = new ObjectMapper(); JsonNode tree = mapper.readTree(str); JsonNode hosts = tree.get(HEADER_HOSTS); if (hosts != null) { for (JsonNode host : hosts) { String name = host.get(HEADER_HOST_NAME).asText(); String level = host.get(HEADER_RESULT).asText(); AttestationValue value = new AttestationValue(); value.setHostName(name); value.setTrustLevel(AttestationResultEnum.valueOf(level.toUpperCase())); values.add(value); } } return values; }
Source:
<code>public void deallocateIfExternal() { if (getNetwork() != null && getNetwork().isExternal()) { Provider<?> provider = DbFacade.getInstance().getProviderDao().get(getNetwork().getProvidedBy().getProviderId()); NetworkProviderProxy providerProxy = ProviderProxyFactory.getInstance().create(provider); try { providerProxy.deallocate(nic); } catch (VdcBLLException e) { AuditLogableBase removePortFailureEvent = new AuditLogableBase(); removePortFailureEvent.addCustomValue("PortName", nic.getName()); <START> removePortFailureEvent.addCustomValue("PortId", nic.getId().toString()); <END> removePortFailureEvent.addCustomValue("ProviderName", provider.getName()); AuditLogDirector.log(removePortFailureEvent, AuditLogType.REMOVE_PORT_FROM_EXTERNAL_PROVIDER_FAILED); } } }</code><technical_language>This is internal ID, NicID</technical_language>

Target:
public void deallocateIfExternal() { if (getNetwork() != null && getNetwork().isExternal()) { Provider<?> provider = DbFacade.getInstance().getProviderDao().get(getNetwork().getProvidedBy().getProviderId()); NetworkProviderProxy providerProxy = ProviderProxyFactory.getInstance().create(provider); try { providerProxy.deallocate(nic); } catch (VdcBLLException e) { AuditLogableBase removePortFailureEvent = new AuditLogableBase(); removePortFailureEvent.addCustomValue("NicName", nic.getName()); removePortFailureEvent.addCustomValue("NicId", nic.getId().toString()); removePortFailureEvent.addCustomValue("ProviderName", provider.getName()); AuditLogDirector.log(removePortFailureEvent, AuditLogType.REMOVE_PORT_FROM_EXTERNAL_PROVIDER_FAILED); } } }
Source:
<code><START> public void clickOnVideoCloseButon() { wait.forElementVisible(closeVideoButton).click(); } <END></code><technical_language>Is this a valid formatting</technical_language>

Target:
public void clickOnVideoCloseButon() { wait.forElementVisible(closeVideoButtonSelector).click(); }
Source:
<code>public EvaluatedVisitData evaluate(VisitDataDefinition definition, EvaluationContext context) throws EvaluationException { OrderForVisitDataDefinition visitDef = (OrderForVisitDataDefinition) definition; EvaluatedVisitData evaluatedData = new EvaluatedVisitData(visitDef, context); if (context.getBaseCohort() != null && context.getBaseCohort().isEmpty()) { return evaluatedData; } HqlQueryBuilder q = new HqlQueryBuilder(); q.select("v.visitId", "o"); q.from(Order.class, "o"); q.whereIn("o.orderType", visitDef.getTypes()); q.innerJoin("o.encounter", "e"); q.innerJoin("e.visit", "v"); q.whereVisitIn("v.visitId", context); <START> List<Object[]> queryResult = evaluationService.evaluateToList(q, context); <END> ListMap<Integer, Order> ordersForVisits = new ListMap<Integer, Order>(); for (Object[] row : queryResult) { ordersForVisits.putInList((Integer)row[0], (Order)row[1]); } for (Integer vid : ordersForVisits.keySet()) { List<Order> l = ordersForVisits.get(vid); evaluatedData.addData(vid, l); } return evaluatedData; }</code><technical_language>This good, result is a List<Order> for visit, I inclined orderBy clause in order ensure a predictable order of results executions</technical_language>

Target:
public EvaluatedVisitData evaluate(VisitDataDefinition definition, EvaluationContext context) throws EvaluationException { OrderForVisitDataDefinition visitDef = (OrderForVisitDataDefinition) definition; EvaluatedVisitData evaluatedData = new EvaluatedVisitData(visitDef, context); if (context.getBaseCohort() != null && context.getBaseCohort().isEmpty()) { return evaluatedData; } HqlQueryBuilder q = new HqlQueryBuilder(); q.select("v.visitId", "o"); q.from(Order.class, "o"); q.whereIn("o.orderType", visitDef.getTypes()); q.innerJoin("o.encounter", "e"); q.innerJoin("e.visit", "v"); q.whereVisitIn("v.visitId", context); q.orderAsc("o.startDate"); List<Object[]> queryResult = evaluationService.evaluateToList(q, context); ListMap<Integer, Order> ordersForVisits = new ListMap<Integer, Order>(); for (Object[] row : queryResult) { ordersForVisits.putInList((Integer)row[0], (Order)row[1]); } for (Integer vid : ordersForVisits.keySet()) { List<Order> l = ordersForVisits.get(vid); evaluatedData.addData(vid, l); } return evaluatedData; }
Source:
<code>public void run() throws Exception { IConfigurationElement[] configElements = extension.getConfigurationElements(); if (configElements.length == 0) { <START> handleException(null); <END> } for (IConfigurationElement element : configElements) { if (element != null&& element.getName().equals(IWorkbenchConstants.TAG_STARTUP)) { runEarlyStartup(getExecutableExtension(element)); } } }</code><technical_language>I prefer dedicated message "The startup extension provide a valid '" + IWorkbenchConstants.TAG_STARTUP + "' element."</technical_language>

Target:
public void run() throws Exception { IConfigurationElement[] configElements = extension.getConfigurationElements(); if (configElements.length == 0) { missingStartupElementMessage("The org.eclipse.ui.IStartup extension from '" + extension.getNamespaceIdentifier() + "' does not provide a valid '" + IWorkbenchConstants.TAG_STARTUP + "' element."); } for (IConfigurationElement element : configElements) { if (element != null&& element.getName().equals(IWorkbenchConstants.TAG_STARTUP)) { runEarlyStartup(getExecutableExtension(element)); } } }
Source:
<code>private void deleteRecursive(File fileOrFolder) throws IOException { if (fileOrFolder.isDirectory()) { <START> for (File child : fileOrFolder.listFiles()) { <END> deleteRecursive(child); } } if (!fileOrFolder.delete()) throw new IOException("Could not delete " + fileOrFolder.getPath()); }</code><technical_language>If I recall listFiles() return null if read directory, stat determine is a directory. (E.g. x r bit.) prefer like: File[] children = fileOrFolder.listFiles(); if (children != null) { for (File child : children) deleteRecursive(child); } listFiles() returns null fileOrFolder is a directory, skip isDirectory() test</technical_language>

Target:
private void deleteRecursive(File fileOrFolder) throws IOException { File[] children = fileOrFolder.listFiles(); if (children != null) { for (File child : children) deleteRecursive(child); } if (!fileOrFolder.delete()) throw new IOException("Could not delete " + fileOrFolder.getPath()); }
Source:
<code>public void initialise() { setAnimationSystem(MenuAnimationSystems.createDefaultSwipeAnimation()); UILabel versionLabel = find("version", UILabel.class); versionLabel.setText(TerasologyVersion.getInstance().getHumanVersion()); SelectGameScreen selectScreen = getManager().createScreen(SelectGameScreen.ASSET_URI, SelectGameScreen.class); WidgetUtil.trySubscribe(this, "singleplayer", button -> { selectScreen.setLoadingAsServer(false); triggerForwardAnimation(selectScreen); }); WidgetUtil.trySubscribe(this, "multiplayer", button -> { selectScreen.setLoadingAsServer(true); triggerForwardAnimation(selectScreen); }); WidgetUtil.trySubscribe(this, "join", button -> triggerForwardAnimation(JoinGameScreen.ASSET_URI)); WidgetUtil.trySubscribe(this, "settings", button -> triggerForwardAnimation(SettingsMenuScreen.ASSET_URI)); WidgetUtil.trySubscribe(this, "credits", button -> triggerForwardAnimation(CreditsScreen.ASSET_URI)); WidgetUtil.trySubscribe(this, "exit", button -> engine.shutdown()); <START> WidgetUtil.trySubscribe(this, "crashReporter", widget -> CrashReporter.report(new Throwable("Report a error."), LoggingContext.getLoggingPath(), false)); <END> }</code><technical_language>I "Report error" is more correct in this case "Report a error" - English is weird way. *generally* if next word starts a vovel a exceptions ..</technical_language>

Target:
public void initialise() { setAnimationSystem(MenuAnimationSystems.createDefaultSwipeAnimation()); UILabel versionLabel = find("version", UILabel.class); versionLabel.setText(TerasologyVersion.getInstance().getHumanVersion()); SelectGameScreen selectScreen = getManager().createScreen(SelectGameScreen.ASSET_URI, SelectGameScreen.class); WidgetUtil.trySubscribe(this, "singleplayer", button -> { selectScreen.setLoadingAsServer(false); triggerForwardAnimation(selectScreen); }); WidgetUtil.trySubscribe(this, "multiplayer", button -> { selectScreen.setLoadingAsServer(true); triggerForwardAnimation(selectScreen); }); WidgetUtil.trySubscribe(this, "join", button -> triggerForwardAnimation(JoinGameScreen.ASSET_URI)); WidgetUtil.trySubscribe(this, "settings", button -> triggerForwardAnimation(SettingsMenuScreen.ASSET_URI)); WidgetUtil.trySubscribe(this, "credits", button -> triggerForwardAnimation(CreditsScreen.ASSET_URI)); WidgetUtil.trySubscribe(this, "exit", button -> engine.shutdown()); WidgetUtil.trySubscribe(this, "crashReporter", widget -> CrashReporter.report(new Throwable("There is no error."), LoggingContext.getLoggingPath(), CrashReporter.MODE.ISSUE_REPORTER)); }
Source:
<code>public StorageEngine<ByteArray, byte[], byte[]> getStore(StoreDefinition storeDef, RoutingStrategy strategy) { String storeName = storeDef.getName(); if(!stores.containsKey(storeName)) { String dataDir = this.voldemortconfig.getRdbDataDirectory() + "/" + storeName; new File(dataDir).mkdirs(); try { <START> Options rdbOptions = new Options().setCreateIfMissing(true) <END> .createStatistics() .setWriteBufferSize(8 * SizeUnit.KB) .setMaxWriteBufferNumber(3) .setMaxBackgroundCompactions(10) .setCompressionType(org.rocksdb.CompressionType.SNAPPY_COMPRESSION); RocksDB rdbStore = null; RocksDbStorageEngine rdbStorageEngine; if(this.voldemortconfig.getRocksdbPrefixKeysWithPartitionId()) { rdbOptions.useFixedLengthPrefixExtractor(StoreBinaryFormat.PARTITIONID_PREFIX_SIZE); rdbStore = RocksDB.open(rdbOptions, dataDir); rdbStorageEngine = new PartitionPrefixedRocksDbStorageEngine(storeName, rdbStore, lockStripes, strategy); } else { rdbStore = RocksDB.open(rdbOptions, dataDir); rdbStorageEngine = new RocksDbStorageEngine(storeName, rdbStore, lockStripes); } stores.put(storeName, rdbStorageEngine); } catch(Exception e) { throw new StorageInitializationException(e); } } return stores.get(storeName); }</code><technical_language>put in a good default for rocksdb's block cache</technical_language>

Target:
public StorageEngine<ByteArray, byte[], byte[]> getStore(StoreDefinition storeDef, RoutingStrategy strategy) { String storeName = storeDef.getName(); if(!stores.containsKey(storeName)) { String dataDir = this.voldemortconfig.getRdbDataDirectory() + "/" + storeName; new File(dataDir).mkdirs(); try { Options rdbOptions = new Options().setCreateIfMissing(true) .createStatistics() .setWriteBufferSize(8 * SizeUnit.KB) .setMaxWriteBufferNumber(3) .setMaxBackgroundCompactions(10) .setCompressionType(org.rocksdb.CompressionType.SNAPPY_COMPRESSION); RocksDB rdbStore = null; RocksDbStorageEngine rdbStorageEngine; if(this.voldemortconfig.getRocksdbPrefixKeysWithPartitionId()) { rdbOptions.useFixedLengthPrefixExtractor(StoreBinaryFormat.PARTITIONID_PREFIX_SIZE); rdbStore = RocksDB.open(rdbOptions, dataDir); rdbStorageEngine = new PartitionPrefixedRocksDbStorageEngine(storeName, rdbStore, lockStripes, strategy, voldemortconfig.isRocksdbEnableReadLocks()); } else { rdbStore = RocksDB.open(rdbOptions, dataDir); rdbStorageEngine = new RocksDbStorageEngine(storeName, rdbStore, lockStripes, voldemortconfig.isRocksdbEnableReadLocks()); } stores.put(storeName, rdbStorageEngine); } catch(Exception e) { throw new StorageInitializationException(e); } } return stores.get(storeName); }
Source:
<code>private boolean isEditable(Entity entity) { return clientgui.getBots().containsKey(entity.getOwner().getName()) <START> || entity.getOwnerId() == clientgui.getClient().getLocalPlayer().getId(); <END> }</code><technical_language>suggestion || (entity.getOwnerId() == clientgui.getClient().getLocalPlayer().getId());</technical_language>

Target:
private boolean isEditable(Entity entity) { return clientgui.getBots().containsKey(entity.getOwner().getName()) || (entity.getOwnerId() == clientgui.getClient().getLocalPlayer().getId()); }
Source:
<code>private List<ContentType> dbSearch(String search, int baseType, String orderBy, int limit, int offset) throws DotDataException { int bottom = (baseType == 0) ? 0 : baseType; int top = (baseType == 0) ? 100000 : baseType; if (limit == 0) throw new DotDataException("limit param must be more than 0"); limit = (limit < 0) ? 10000 : limit; SearchCondition searchCondition = new SearchCondition(search); if(SQLUtil.sanitizeSortBy(orderBy).isEmpty()){ orderBy = "mod_date"; } DotConnect dc = new DotConnect(); dc.setSQL( String.format( this.contentTypeSql.SELECT_QUERY_CONDITION, SQLUtil.sanitizeCondition( searchCondition.condition ), orderBy ) ); dc.setMaxRows(limit); dc.setStartRow(offset); <START> dc.addParam( SQLUtil.sanitizeParameter( searchCondition.search ) ); <END> dc.addParam( SQLUtil.sanitizeParameter( searchCondition.search ) ); dc.addParam( SQLUtil.sanitizeParameter( searchCondition.search ) ); dc.addParam(bottom); dc.addParam(top); Logger.debug(this, "QUERY " + dc.getSQL()); return new DbContentTypeTransformer(dc.loadObjectResults()).asList(); }</code><technical_language>need sanitize a parameter in a prepared statement, drive care of this for us, right</technical_language>

Target:
private List<ContentType> dbSearch(String search, int baseType, String orderBy, int limit, int offset) throws DotDataException { int bottom = (baseType == 0) ? 0 : baseType; int top = (baseType == 0) ? 100000 : baseType; if (limit == 0) throw new DotDataException("limit param must be more than 0"); limit = (limit < 0) ? 10000 : limit; SearchCondition searchCondition = new SearchCondition(search); if(SQLUtil.sanitizeSortBy(orderBy).isEmpty()){ orderBy = "mod_date"; } DotConnect dc = new DotConnect(); dc.setSQL( String.format( this.contentTypeSql.SELECT_QUERY_CONDITION, SQLUtil.sanitizeCondition( searchCondition.condition ), orderBy ) ); dc.setMaxRows(limit); dc.setStartRow(offset); dc.addParam( searchCondition.search ); dc.addParam( searchCondition.search ); dc.addParam( searchCondition.search ); dc.addParam(bottom); dc.addParam(top); Logger.debug(this, "QUERY " + dc.getSQL()); return new DbContentTypeTransformer(dc.loadObjectResults()).asList(); }
Source:
<code>public synchronized T removeItem(int index) { <START> if (selectedIndex > -1 && !items.isEmpty()) { <END> items.remove(index); if (selectedIndex >= items.size()) { selectedIndex--; } invalidate(); } return self(); }</code><technical_language>this check "index" here? index checked items.size() well, IndexOutOfBoundsException is intended</technical_language>

Target:
public synchronized T removeItem(int index) { if (index >= 0 && index < items.size()) { items.remove(index); if (selectedIndex >= items.size()) { selectedIndex--; } invalidate(); } return self(); }