auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private Credential getCredential(FrameworkInfo.Builder finfo) { LOG.info("Checking for mesos authentication"); Credential credential = null; String principal = Optional.fromNullable((String) _conf.get(CONF_MESOS_PRINCIPAL)).orNull(); String secretFilename = Optional.fromNullable((String) _conf.get(CONF_MESOS_SECRET_FILE)).orNull(); if (principal != null) { finfo.setPrincipal(principal); Credential.Builder credentialBuilder = Credential.newBuilder(); credentialBuilder.setPrincipal(principal); if (StringUtils.isNotEmpty(secretFilename)) { try { <START> credentialBuilder.setSecret(ByteString.readFrom(new FileInputStream(secretFilename)).toString()); <END> } catch (FileNotFoundException ex) { LOG.error("Mesos authentication secret file was not found", ex); throw new RuntimeException(ex); } catch (IOException ex) { LOG.error("Error reading Mesos authentication secret file", ex); throw new RuntimeException(ex); } } credential = credentialBuilder.build(); } return credential; }</code><technical_language>@DarinJ is changing this in a (using reflection) support mesos-0.26.0 earlier versions. #77</technical_language>

Target:
private Credential getCredential(FrameworkInfo.Builder finfo) { LOG.info("Checking for mesos authentication"); Credential credential = null; String principal = Optional.fromNullable((String) _conf.get(CONF_MESOS_PRINCIPAL)).orNull(); String secretFilename = Optional.fromNullable((String) _conf.get(CONF_MESOS_SECRET_FILE)).orNull(); if (principal != null) { finfo.setPrincipal(principal); Credential.Builder credentialBuilder = Credential.newBuilder(); credentialBuilder.setPrincipal(principal); if (StringUtils.isNotEmpty(secretFilename)) { try { credentialBuilder.setSecret(ByteString.readFrom(new FileInputStream(secretFilename))); } catch (FileNotFoundException ex) { LOG.error("Mesos authentication secret file was not found", ex); throw new RuntimeException(ex); } catch (IOException ex) { LOG.error("Error reading Mesos authentication secret file", ex); throw new RuntimeException(ex); } } credential = credentialBuilder.build(); } return credential; }
Source:
<code>public List<IDValue> get( @PathParam("itemID") List<PathSegment> pathSegmentsList, @DefaultValue("10") @QueryParam("howMany") int howMany, @DefaultValue("0") @QueryParam("offset") int offset, @QueryParam("rescorerParams") List<String> rescorerParams) throws OryxServingException { <START> check(pathSegmentsList.size() > 0, "Need atleast 1 item to determine similarity"); <END> check(howMany > 0, "howMany must be positive"); check(offset >= 0, "offset must be non-negative"); ALSServingModel alsServingModel = getALSServingModel(); Collection<String> allItemIDs = alsServingModel.getAllItemIDs(); List<Pair<String,Double>> similarItemsList = new ArrayList<>(pathSegmentsList.size()); for (String itemID : allItemIDs) { double total = 0.0; float[] entryFeatures = alsServingModel.getItemVector(itemID); double entryFeaturesNorm = VectorMath.norm(entryFeatures); for (PathSegment pathSegment : pathSegmentsList) { String pathItem = pathSegment.getPath(); if (!pathItem.equalsIgnoreCase(itemID)) { float[] itemFeatures = alsServingModel.getItemVector(pathItem); double cosineSimilarity = VectorMath.dot(entryFeatures, itemFeatures) / (entryFeaturesNorm * VectorMath.norm(itemFeatures)); total += cosineSimilarity; } } double result = total / pathSegmentsList.size(); Preconditions.checkState(!(Double.isInfinite(result) || Double.isNaN(result)), "Bad similarity value"); similarItemsList.add(new Pair<>(itemID,result)); } similarItemsList = alsServingModel.topN(similarItemsList, howMany); check(similarItemsList != null, Response.Status.NOT_FOUND, "No similar items found"); return toIDValueResponse(similarItemsList, howMany, offset); }</code><technical_language>Tiny: "atleast". check !isEmpty() that</technical_language>

Target:
public List<IDValue> get( @PathParam("itemID") List<PathSegment> pathSegmentsList, @DefaultValue("10") @QueryParam("howMany") int howMany, @DefaultValue("0") @QueryParam("offset") int offset, @QueryParam("rescorerParams") List<String> rescorerParams) throws OryxServingException { check(!pathSegmentsList.isEmpty() && pathSegmentsList.size() > 0, "Need atleast 1 item to determine similarity"); check(howMany > 0, "howMany must be positive"); check(offset >= 0, "offset must be non-negative"); ALSServingModel alsServingModel = getALSServingModel(); List<float[]> itemFeaturesList = new ArrayList<>(pathSegmentsList.size()); for (PathSegment pathSegment : pathSegmentsList) { float[] itemVector = alsServingModel.getItemVector(pathSegment.getPath()); if (itemVector != null) { itemFeaturesList.add(itemVector); } } List<Pair<String,Double>> topIDCosines = alsServingModel.topN( new CosineAverageFunction(itemFeaturesList), howMany + offset, null); return toIDValueResponse(topIDCosines, howMany, offset); }
Source:
<code>public static Properties loadProperties(File file){ Properties prop = new Properties(); InputStream input = null; try { input = new FileInputStream(file); prop.load(input); return prop; } catch (IOException ex) { <START> ex.printStackTrace(); <END> } finally { if (input != null) { try { input.close(); } catch (IOException e) { e.printStackTrace(); } } } return null; }</code><technical_language>comfortable this</technical_language>

Target:
public static Properties loadProperties(File file) throws IOException{ Properties prop = new Properties(); InputStream input = null; try { input = new FileInputStream(file); prop.load(input); return prop; } finally { if (input != null) { try { input.close(); } catch (IOException e) { e.printStackTrace(); } } } }
Source:
<code>public PagedIterable<GHRepository> listRepositories(final int pageSize, final RepositoryType repoType) { return new PagedIterable<GHRepository>() { public PagedIterator<GHRepository> iterator() { return new PagedIterator<GHRepository>(root.retrieve().asIterator("/user/repos?per_page=" + pageSize + <START> "&type=" + repoType.toString().toLowerCase(), GHRepository[].class)) { <END> @Override protected void wrapUp(GHRepository[] page) { for (GHRepository c : page) c.wrap(root); } }; } }; }</code><technical_language>name().toLowerCase() in case</technical_language>

Target:
public PagedIterable<GHRepository> listRepositories(final int pageSize, final RepositoryType repoType) { return new PagedIterable<GHRepository>() { public PagedIterator<GHRepository> iterator() { return new PagedIterator<GHRepository>(root.retrieve().asIterator("/user/repos?per_page=" + pageSize + "&type=" + repoType.name().toLowerCase(), GHRepository[].class)) { @Override protected void wrapUp(GHRepository[] page) { for (GHRepository c : page) c.wrap(root); } }; } }; }
Source:
<code>@Override protected String getDescription(MBeanInfo info) { String str = super.getDescription(info); MXBeanDescription desc = U.getAnnotation(getMBeanInterface(), MXBeanDescription.class); if (desc != null) { str = desc.value(); assert str != null; assert !str.trim().isEmpty(); <START> assert Character.isUpperCase(str.charAt(0)) : str; <END> assert str.charAt(str.length() - 1) == '.' : str; } return str; }</code><technical_language>please add clear message for case assert failed</technical_language>

Target:
@Override protected String getDescription(MBeanInfo info) { String str = super.getDescription(info); MXBeanDescription desc = U.getAnnotation(getMBeanInterface(), MXBeanDescription.class); if (desc != null) { str = desc.value(); assert str != null; assert !str.trim().isEmpty(); assert Character.isUpperCase(str.charAt(0)) : DESC_MUST_START_WITH_UPP_CASE + str; assert str.charAt(str.length() - 1) == '.' : DESC_MUST_END_WITH_PERIOD + str; } return str; }
Source:
<code><START> public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { <END> context.addStep(new OperationStepHandler() { @Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { ServiceController<KeytabService> serviceController = ManagementUtil.getKeytabService(context, operation); KeytabService keytabService = serviceController.getService().getValue(); SubjectIdentity si = null; try { si = keytabService.createSubjectIdentity(false); ModelNode result = context.getResult(); result.get(SUBJECT).set(si.getSubject().toString()); } catch (LoginException e) { throw SECURITY_LOGGER.unableToObtainTGT(e); } finally { if (si != null) { si.logout(); } } context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER); } }, Stage.RUNTIME); context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER); }</code><technical_language>Please add... // Validate this is called actual resource. // This valid subsequent assumption relevant service installed. context.readResource(PathAddress.EMPTY_ADDRESS, false); today I diagnosed a support case issue console calling datasource subsystem op this servers in a domain, resource. result a hard diagnose problem missing service failure understandable a NoSuchResourceException. I this subtlety mind. ;)</technical_language>

Target:
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { context.readResource(PathAddress.EMPTY_ADDRESS, false); context.addStep(new OperationStepHandler() { @Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { ServiceController<KeytabService> serviceController = ManagementUtil.getKeytabService(context, operation); KeytabService keytabService = serviceController.getService().getValue(); SubjectIdentity si = null; try { si = keytabService.createSubjectIdentity(false); ModelNode result = context.getResult(); result.get(SUBJECT).set(si.getSubject().toString()); } catch (LoginException e) { throw SECURITY_LOGGER.unableToObtainTGT(e); } finally { if (si != null) { si.logout(); } } context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER); } }, Stage.RUNTIME); context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER); }
Source:
<code>public List<Condition> getActiveConditions(Patient patient) { Query query = sessionFactory.getCurrentSession().createQuery( "from Condition c where c.patient.patientId = :patientId and c.voided = false and c.endDate is null order " + "by c.dateCreated desc"); query.setInteger("patientId", patient.getId()); return query.list(); <START> } <END></code><technical_language>add a method for deleting a condition</technical_language>

Target:
public List<Condition> getActiveConditions(Patient patient) { Query query = sessionFactory.getCurrentSession().createQuery( "from Condition c where c.patient.patientId = :patientId and c.voided = false and c.endDate is null order " + "by c.onsetDate desc"); query.setInteger("patientId", patient.getId()); return query.list(); }
Source:
<code>public void onSuccess() { log.debug("Command succeeded, releasing macs {}.", <START> Arrays.toString(super.macs.toArray())); <END> releaseMacs(); }</code><technical_language>rely AbstractCollection..toString</technical_language>

Target:
public void onSuccess() { log.debug("Command succeeded, releasing macs {}.", super.macs); releaseMacs(); }
Source:
<code>public boolean isModification() throws CoreException { <START> return (Boolean.valueOf(this.getMarker().getAttribute(MODIFICATION, "true"))) END> .booleanValue(); }</code><technical_language>Boolean.parseBoolen(),</technical_language>

Target:
public boolean isModification() throws CoreException { return Boolean.parseBoolean( this.getMarker().getAttribute(MODIFICATION, "true")); }
Source:
<code>public static void main(String[] args) { ISelectionStatusValidator validator= new ISelectionStatusValidator() { @Override public IStatus validate(Object[] selection) { if (selection != null && selection.length == 1) { return new StatusInfo(); } else { StatusInfo status= new StatusInfo(); status.setError("Single selection"); return status; } } }; Random random= new Random(); ILabelProvider elementRenderer= new org.eclipse.jface.viewers.LabelProvider() { @Override public String getText(Object element) { return element.toString(); } }; int nPages= 3; Object[][] elements= new Object[nPages][]; for (int i= 0; i < nPages; i++) { int size= random.nextInt(15); elements[i]= new String[size]; for (int k= 0; k < size; k++) { elements[i][k]= "elem-" + i + "-" + k; } } Display display= new Display(); MultiElementListSelectionDialog d= new MultiElementListSelectionDialog(new Shell(display), elementRenderer); d.setTitle("Title"); d.setIgnoreCase(true); d.setMessage("this is a message"); d.setValidator(validator); d.setElements(elements); d.open(); Object[] res= d.getResult(); if (res != null) { <START> for (Object re : res) { <END> System.out.println(re); } } }</code><technical_language>change element obj</technical_language>

Target:
public static void main(String[] args) { ISelectionStatusValidator validator= new ISelectionStatusValidator() { @Override public IStatus validate(Object[] selection) { if (selection != null && selection.length == 1) { return new StatusInfo(); } else { StatusInfo status= new StatusInfo(); status.setError("Single selection"); return status; } } }; Random random= new Random(); ILabelProvider elementRenderer= new org.eclipse.jface.viewers.LabelProvider() { @Override public String getText(Object element) { return element.toString(); } }; int nPages= 3; Object[][] elements= new Object[nPages][]; for (int i= 0; i < nPages; i++) { int size= random.nextInt(15); elements[i]= new String[size]; for (int k= 0; k < size; k++) { elements[i][k]= "elem-" + i + "-" + k; } } Display display= new Display(); MultiElementListSelectionDialog d= new MultiElementListSelectionDialog(new Shell(display), elementRenderer); d.setTitle("Title"); d.setIgnoreCase(true); d.setMessage("this is a message"); d.setValidator(validator); d.setElements(elements); d.open(); Object[] res= d.getResult(); if (res != null) { for (Object obj : res) { System.out.println(obj); } } }
Source:
<code>public void prepareRun(StageSubmitterContext context) throws Exception { <START> super.prepareRun(context); <END> context.record( TransformLineageRecorderUtils.oneToOneIn(TransformLineageRecorderUtils.getFields(outSchema), "encode", "Encode the input fields based on specified encoder.")); }</code><technical_language>This is similar Compressor</technical_language>

Target:
public void prepareRun(StageSubmitterContext context) throws Exception { super.prepareRun(context); parseConfiguration(config.encode, context.getFailureCollector()); List<String> inFields = TransformLineageRecorderUtils.getFields(context.getInputSchema()); List<String> outFields = TransformLineageRecorderUtils.getFields(context.getOutputSchema()); List<String> identityFields = outFields.stream() .filter(field -> !encodeMap.containsKey(field) || encodeMap.get(field) == EncodeType.NONE) .collect(Collectors.toList()); List<String> processedFields = new ArrayList<>(outFields); processedFields.removeAll(identityFields); List<String> droppedFields = new ArrayList<>(inFields); droppedFields.removeAll(outFields); List<FieldOperation> output = new ArrayList<>(); output.addAll(TransformLineageRecorderUtils.generateOneToOnes(processedFields, "encode", "Encoded the input fields based on expected encoder.")); output.addAll(TransformLineageRecorderUtils.generateDrops(droppedFields)); output.addAll(TransformLineageRecorderUtils.generateOneToOnes(identityFields, "identity", TransformLineageRecorderUtils.IDENTITY_TRANSFORM_DESCRIPTION)); context.record(output); }
Source:
<code><START> public void empty_file_should_raise_no_issue() throws Exception { <END> analyseSingleFile(context, "empty.php"); assertThat(context.allIssues()).as("No issue must be raised").hasSize(0); }</code><technical_language>@ivandalbosco this test? is rule activated, matter of file content, issue</technical_language>

Target:
public void empty_file_should_raise_no_issue() throws Exception { sensor = createSensorWithParsingErrorCheckActivated(); analyseSingleFile(context, "empty.php"); assertThat(context.allIssues()).as("No issue must be raised").hasSize(0); }
Source:
<code>public void preProcess(BindContext context) { preProcessIndex++; <START> if (preProcessIndex < operations.size()) { <END> operations.get(preProcessIndex).preProcess(context, this); } }</code><technical_language>opt for a one-time-use chain requires manual stepping part of client? Also, this state is synchronized operation count, forces users fully understand this class properly hang themselves</technical_language>

Target:
private boolean preProcess(BindContext context) { for (BindOperation operation : operations) { log.debug("Starting preprocess of {}", operation.getClass().getSimpleName()); if (operation.preProcess(context)) { log.debug("Finished preprocess of {}", operation.getClass().getSimpleName()); } else { log.error("Skipped chain in preprocess of operation {}", operation.getClass().getSimpleName()); return false; } } return true; }
Source:
<code>public boolean sameObject(DocFormRequestKey other) { System.out.println("compare " + this); <START> System.out.println("with " + other); <END> return (this.classRef != null) && (this.objNb != null) && (this.objNb >= 0) && ObjectUtils.equals(this.classRef, other.classRef) && ObjectUtils.equals(this.objNb, other.objNb); }</code><technical_language>Please change log remove</technical_language>

Target:
public boolean sameObject(DocFormRequestKey other) { return (this.classRef != null) && (this.objNb != null) && (this.objNb >= 0) && ObjectUtils.equals(this.classRef, other.classRef) && ObjectUtils.equals(this.objNb, other.objNb); }
Source:
<code>private static List<ITimeGraphState> getKernelStates(CallStackDepth callStackDepth, Collection<ISegment> states, Collection<Long> times) { List<ITimeGraphState> eventList = new ArrayList<>(states.size()); for (ISegment state : states) { if (!(state instanceof ICalledFunction)) { eventList.add(new TimeGraphState(state.getStart(), state.getLength(), Integer.MIN_VALUE)); continue; } ICalledFunction function = (ICalledFunction) state; Iterator<ProcessStatusInterval> kernelStatuses = <START> callStackDepth.getCallStack().getKernelStatuses(function, <END> times); while (kernelStatuses.hasNext()) { ProcessStatusInterval status = kernelStatuses.next(); eventList.add(new TimeGraphState(status.getStart(), status.getLength() + 1, status.getProcessStatus().getStateValue().unboxLong(), status.getProcessStatus().name())); } } return eventList; }</code><technical_language>this iterable</technical_language>

Target:
private static List<ITimeGraphState> getKernelStates(CallStackDepth callStackDepth, Collection<ISegment> states, Collection<Long> times) { List<ITimeGraphState> eventList = new ArrayList<>(states.size()); for (ISegment state : states) { if (!(state instanceof ICalledFunction)) { eventList.add(new TimeGraphState(state.getStart(), state.getLength(), Integer.MIN_VALUE)); continue; } ICalledFunction function = (ICalledFunction) state; Iterable<ProcessStatusInterval> kernelStatuses = callStackDepth.getCallStack().getKernelStatuses(function, times); for (ProcessStatusInterval status : kernelStatuses) { eventList.add(new TimeGraphState(status.getStart(), status.getLength() + 1, status.getProcessStatus().getStateValue().unboxLong(), status.getProcessStatus().name())); } } return eventList; }
Source:
<code><START> public static ArtifactType getType(Long id) { <END> return getTypeById(id); }</code><technical_language>remove this redundant method</technical_language>

Target:
public static ArtifactType getType(Long id) { if (id == null) { throw new OseeArgumentException("[%s] is not a valid guid", id); } ArtifactType artifactType = getCache().getByGuid(id); if (artifactType == null) { getCacheService().reloadTypes(); artifactType = getCache().getByGuid(id); if (artifactType == null) { throw new OseeTypeDoesNotExist("Artifact type [%s] is not available.", id); } } return artifactType; }
Source:
<code>public boolean isRecommendationEnabled(String tenantDomain) { if (recommendationEnvironment != null) { if (recommendationEnvironment.isApplyForAllTenants()) { return true; } else { try { org.json.JSONObject tenantConfig; <START> Cache tenantConfigCache = CacheProvider.getTenantConfigCache(); <END> String cacheName = tenantDomain + "_" + APIConstants.TENANT_CONFIG_CACHE_NAME; if (tenantConfigCache.containsKey(cacheName)) { tenantConfig = (org.json.JSONObject) tenantConfigCache.get(cacheName); } else { String content = apimRegistryService .getConfigRegistryResourceContent(tenantDomain, APIConstants.API_TENANT_CONF_LOCATION); tenantConfig = new org.json.JSONObject(content); tenantConfigCache.put(cacheName, tenantConfig); } if (tenantConfig.has(APIConstants.API_TENANT_CONF_ENABLE_RECOMMENDATION_KEY)) { Object value = tenantConfig.get(APIConstants.API_TENANT_CONF_ENABLE_RECOMMENDATION_KEY); return Boolean.parseBoolean(value.toString()); } } catch (UserStoreException | RegistryException e) { log.error("Error occurred when getting API tenant config from registry", e); } } } return false; }</code><technical_language>new method abstract apiutil.getTenantConfig</technical_language>

Target:
public boolean isRecommendationEnabled(String tenantDomain) { return APIUtil.isRecommendationEnabled(tenantDomain); }
Source:
<code><START> public final synchronized byte[] encode(Object val) throws IOException { <END> if (val == null) { return null; } if (val instanceof byte[]) { byte[] arrayValue = (byte[]) val; byte[] encodedValue = new byte[arrayValue.length + 1]; encodedValue[0] = ID_NULL_ENCODER; System.arraycopy(arrayValue, 0, encodedValue, 1, arrayValue.length); return encodedValue; } else { final ByteArrayOutputStream bos = new InitiallyReusableByteArrayOutputStream(getReusableByteBuffer()); final ObjectOutputStream oos = new ObjectOutputStream(bos); oos.writeObject(val); return bos.toByteArray(); } }</code><technical_language>replace synchronized a ReentrantLock in else part is need due reusable byte buffer</technical_language>

Target:
public final byte[] encode(Object val) throws IOException { if (val == null) { return null; } if (val instanceof byte[]) { byte[] arrayValue = (byte[]) val; byte[] encodedValue = new byte[arrayValue.length + 1]; encodedValue[0] = ID_NULL_ENCODER; System.arraycopy(arrayValue, 0, encodedValue, 1, arrayValue.length); return encodedValue; } else { bufferLock.lock(); try { final ByteArrayOutputStream bos = new InitiallyReusableByteArrayOutputStream(getReusableByteBuffer()); final ObjectOutputStream oos = new ObjectOutputStream(bos); oos.writeObject(val); return bos.toByteArray(); } finally { bufferLock.unlock(); } } }
Source:
<code>private Map setupPySparkEnv() throws IOException{ Map env = EnvironmentUtils.getProcEnvironment(); if (!env.containsKey("PYTHONPATH")) { SparkConf conf = getSparkConf(); <START> env.put("PYTHONPATH", conf.get("spark.files").replaceAll(",", ":")); <END> } return env; }</code><technical_language>this spark.submit.pyFiles (or spark.files spark.submit.pyFiles)? <LINK_0></technical_language>

Target:
private Map setupPySparkEnv() throws IOException{ Map env = EnvironmentUtils.getProcEnvironment(); if (!env.containsKey("PYTHONPATH")) { SparkConf conf = getSparkConf(); env.put("PYTHONPATH", conf.get("spark.submit.pyFiles").replaceAll(",", ":")); } return env; }
Source:
<code>public void testObtainProductInstanceName() throws Exception { ProductInstallatorSdcImpl installator = new ProductInstallatorSdcImpl(); installator.setSDCClient(sdcClient); installator.setSystemPropertiesProvider(systemPropertiesProvider); installator.setProductReleaseManager(productReleaseManager); installator.setSDCUtil(sDCUtil); installator.setTierInstanceManager(tierInstanceManager); expectedProductInstance.setName("deploytm-contextbrokr-1_mongos_2.2.3"); String name = installator.getProductInstanceName(data, expectedProductInstance); assertEquals(name, <START> "FIWARE.customers.60b4125450fc4a109f50357894ba2e28.services.deploytm.vees.contextbrokr.replicas.1_mongos_2.2.3"); <END> }</code><technical_language>120 characters</technical_language>

Target:
public void testObtainProductInstanceName() throws Exception { ProductInstallatorSdcImpl installator = new ProductInstallatorSdcImpl(); installator.setSDCClient(sdcClient); installator.setSystemPropertiesProvider(systemPropertiesProvider); installator.setProductReleaseManager(productReleaseManager); installator.setSDCUtil(sDCUtil); installator.setTierInstanceManager(tierInstanceManager); expectedProductInstance.setName("deploytm-contextbrokr-1_mongos_2.2.3"); String name = installator.getProductInstanceName(data, expectedProductInstance); assertEquals(name, "FIWARE.customers.60b4125450fc4a109f50357894ba2e28.services." + "deploytm.vees.contextbrokr.replicas.1_mongos_2.2.3"); }
Source:
<code>protected MutableBoundedValue<Integer> constructValue(Integer defaultValue) { <START> return new SpongeBoundedValue<Integer>(this.getKey(), defaultValue, intComparator(), defaultValue, defaultValue); <END> }</code><technical_language>No.... please please please read arguments mean</technical_language>

Target:
protected MutableBoundedValue<Integer> constructValue(Integer defaultValue) { return new SpongeBoundedValue<Integer>(this.getKey(), defaultValue, intComparator(), 0, Integer.MAX_VALUE, defaultValue); }
Source:
<code>public JInvocation getSuperPutExtraInvocation(TypeMirror elementType, JVar extraParam, JFieldVar extraKeyField) { JExpression extraParameterArg = extraParam; if (elementType.getKind() == TypeKind.DECLARED) { Elements elementUtils = environment.getProcessingEnvironment().getElementUtils(); TypeMirror parcelableType = elementUtils.getTypeElement(PARCELABLE).asType(); if (typeUtils.isSubtype(elementType, parcelableType)) { TypeMirror serializableType = elementUtils.getTypeElement(SERIALIZABLE).asType(); if (typeUtils.isSubtype(elementType, serializableType)) { extraParameterArg = cast(environment.getClasses().PARCELABLE, extraParameterArg); } <START> } else if (!BundleHelper.METHOD_SUFFIX_BY_TYPE_NAME.containsKey(elementType.toString()) && annotationHelper.isParcelType(elementType)) { <END> extraParameterArg = environment.getCodeModel().ref("org.parceler.Parcels").staticInvoke("wrap").arg(extraParameterArg); } else { TypeMirror stringType = elementUtils.getTypeElement(STRING).asType(); if (!typeUtils.isSubtype(elementType, stringType)) { extraParameterArg = cast(environment.getClasses().SERIALIZABLE, extraParameterArg); } } } return _super().invoke("extra").arg(extraKeyField).arg(extraParameterArg); }</code><technical_language>I realized METHOD_SUFFIX_BY_TYPE_NAME is is supported Bundle</technical_language>

Target:
public JInvocation getSuperPutExtraInvocation(TypeMirror elementType, JVar extraParam, JFieldVar extraKeyField) { IJExpression extraParameterArg = extraParam; if (elementType.getKind() == TypeKind.DECLARED) { Elements elementUtils = environment.getProcessingEnvironment().getElementUtils(); TypeMirror parcelableType = elementUtils.getTypeElement(PARCELABLE).asType(); if (typeUtils.isSubtype(elementType, parcelableType)) { TypeMirror serializableType = elementUtils.getTypeElement(SERIALIZABLE).asType(); if (typeUtils.isSubtype(elementType, serializableType)) { extraParameterArg = cast(environment.getClasses().PARCELABLE, extraParameterArg); } } else if (!BundleHelper.METHOD_SUFFIX_BY_TYPE_NAME.containsKey(elementType.toString()) && parcelerHelper.isParcelType(elementType)) { extraParameterArg = environment.getCodeModel().ref(CanonicalNameConstants.PARCELS_UTILITY_CLASS).staticInvoke("wrap").arg(extraParameterArg); } else { TypeMirror stringType = elementUtils.getTypeElement(STRING).asType(); if (!typeUtils.isSubtype(elementType, stringType)) { extraParameterArg = cast(environment.getClasses().SERIALIZABLE, extraParameterArg); } } } return _super().invoke("extra").arg(extraKeyField).arg(extraParameterArg); }
Source:
<code>public void testOctagonTree() { OGCGeometryWrapper octagonA = new OGCGeometryWrapper(POLYGON_A); OGCGeometryWrapper octagonB = new OGCGeometryWrapper(POLYGON_B); OGCGeometryWrapper pointX = new OGCGeometryWrapper(POINT_X); OGCGeometryWrapper pointY = new OGCGeometryWrapper(POINT_Y); OGCGeometryWrapper pointZ = new OGCGeometryWrapper(POINT_Z); OGCGeometryWrapper pointW = new OGCGeometryWrapper(POINT_W); Flatbush rtree = new Flatbush<OGCGeometryWrapper>(new OGCGeometryWrapper[] {octagonA, octagonB}); <START> List<OGCGeometryWrapper> resultsX = rtree.findIntersections(pointX.getExtent()); <END> assertEquals(resultsX, Arrays.asList(octagonA)); List<OGCGeometryWrapper> resultsY = rtree.findIntersections(pointY.getExtent()); resultsY.sort(Comparator.naturalOrder()); assertEquals(resultsY, Arrays.asList(octagonA, octagonB)); List<OGCGeometryWrapper> resultsZ = rtree.findIntersections(pointZ.getExtent()); assertEquals(resultsZ, Arrays.asList(octagonB)); List<OGCGeometryWrapper> resultsW = rtree.findIntersections(pointW.getExtent()); assertTrue(resultsW.isEmpty()); }</code><technical_language>inline: assertEquals(findIntersections(rtree, pointX.getExtent()), ImmutableList.of(octagonA));</technical_language>

Target:
public void testOctagonTree() { OGCGeometryWrapper octagonA = new OGCGeometryWrapper(POLYGON_A); OGCGeometryWrapper octagonB = new OGCGeometryWrapper(POLYGON_B); OGCGeometryWrapper pointX = new OGCGeometryWrapper(POINT_X); OGCGeometryWrapper pointY = new OGCGeometryWrapper(POINT_Y); OGCGeometryWrapper pointZ = new OGCGeometryWrapper(POINT_Z); OGCGeometryWrapper pointW = new OGCGeometryWrapper(POINT_W); Flatbush<OGCGeometryWrapper> rtree = new Flatbush<>(new OGCGeometryWrapper[] {octagonA, octagonB}); assertEquals(findIntersections(rtree, pointX.getExtent()), ImmutableList.of(octagonA)); List<OGCGeometryWrapper> results = findIntersections(rtree, pointY.getExtent()); assertEqualsSorted(results, ImmutableList.of(octagonA, octagonB), Comparator.naturalOrder()); assertEquals(findIntersections(rtree, pointZ.getExtent()), ImmutableList.of(octagonB)); assertEquals(findIntersections(rtree, pointW.getExtent()), ImmutableList.of()); }
Source:
<code>public static PersistenceStrategy<?, ?, ?> getPerTableStrategy(EmbeddedCacheManager externalCacheManager, URL configUrl, JtaPlatform platform, Set<EntityKeyMetadata> entityTypes, <START> Set<AssociationKeyMetadata> associationTypes, <END> Set<IdSourceKeyMetadata> idSourceTypes) { PerTableKeyProvider keyProvider = new PerTableKeyProvider(); PerTableCacheManager cacheManager = externalCacheManager != null ? new PerTableCacheManager( externalCacheManager, entityTypes, associationTypes, idSourceTypes ) : new PerTableCacheManager( configUrl, platform, entityTypes, associationTypes, idSourceTypes ); return new PersistenceStrategy<PersistentEntityKey, PersistentAssociationKey, PersistentIdSourceKey>( cacheManager, keyProvider ); }</code><technical_language>Strange indentation for this method parameters, happend? :)</technical_language>

Target:
private static PersistenceStrategy<?, ?, ?> getPerTableStrategy( EmbeddedCacheManager externalCacheManager, URL configUrl, JtaPlatform platform, Set<EntityKeyMetadata> entityTypes, Set<AssociationKeyMetadata> associationTypes, Set<IdSourceKeyMetadata> idSourceTypes) { PerTableKeyProvider keyProvider = new PerTableKeyProvider(); PerTableCacheManager cacheManager = externalCacheManager != null ? new PerTableCacheManager( externalCacheManager, entityTypes, associationTypes, idSourceTypes ) : new PerTableCacheManager( configUrl, platform, entityTypes, associationTypes, idSourceTypes ); return new PersistenceStrategy<PersistentEntityKey, PersistentAssociationKey, PersistentIdSourceKey>( cacheManager, keyProvider ); }
Source:
<code>public List<String> getNames() { final Iterable<DataSourceWithSegmentSpec> sourceSpecs = query.getDataSources(); return StreamSupport.stream(sourceSpecs.spliterator(), false) .flatMap(spec -> spec.getDataSource().getNames().stream()) <START> .collect(Collectors.toList()); <END> }</code><technical_language>if duplicates in this stream</technical_language>

Target:
public List<String> getNames() { return query.getDataSources().stream() .flatMap(spec -> spec.getDataSource().getNames().stream()) .collect(Collectors.toList()); }
Source:
<code>public synchronized void startup() throws DatastreamException { if (_coordinator != null) { _coordinator.start(); } try { _nettyLauncher.start(); _isStarted = true; } catch (IOException ex) { String errorMessage = "Failed to start netty."; LOG.error(errorMessage, ex); <START> throw new DatastreamException(errorMessage, ex); <END> } }</code><technical_language>new logAndThrow() mentioned above</technical_language>

Target:
public synchronized void startup() throws DatastreamException { if (_coordinator != null) { _coordinator.start(); } try { _nettyLauncher.start(); _isStarted = true; } catch (IOException ex) { String errorMessage = "Failed to start netty."; ErrorLogger.logAndThrowDatastreamRuntimeException(LOG, errorMessage, ex); } }
Source:
<code>public void connect( final String tokenKeyName, final String token, final String tokenSignature, final String customAuthorizer, final AWSIotMqttClientStatusCallback statusCallback) { <START> if (tokenKeyName == null || token == null || tokenSignature == null) { throw new IllegalArgumentException("tokenKeyName/token/tokenSignature cannot be null"); } <END> this.userStatusCallback = statusCallback; if (connectionState != MqttManagerConnectionState.Disconnected) { userConnectionCallback(); return; } authMode = AuthenticationMode.CUSTOM_AUTH; String endpointWithHttpPort = getEndpointWithHttpPort(); LOGGER.debug("MQTT broker endpoint: " + endpointWithHttpPort); try { if (mqttClient == null) { mqttClient = new MqttAsyncClient( "wss://" + endpointWithHttpPort + "/mqtt", mqttClientId, new MemoryPersistence()); } customWebsocketHeaders = new Properties(); customWebsocketHeaders.setProperty("X-Amz-CustomAuthorizer-Name", customAuthorizer); customWebsocketHeaders.setProperty("X-Amz-CustomAuthorizer-Signature", tokenSignature); customWebsocketHeaders.setProperty(tokenKeyName, token); final MqttConnectOptions options = new MqttConnectOptions(); if (mqttLWT != null) { options.setWill(mqttLWT.getTopic(), mqttLWT.getMessage().getBytes(), mqttLWT.getQos().asInt(), false); } options.setCustomWebSocketHeaders(customWebsocketHeaders); mqttConnect(options); } catch (final MqttException e) { connectionState = MqttManagerConnectionState.Disconnected; userConnectionCallback(new AmazonClientException("An error occurred in the MQTT client.", e)); } }</code><technical_language>This is Objects.requireNonNull(obj, message) is</technical_language>

Target:
public void connect( final String tokenKeyName, final String token, final String tokenSignature, final String customAuthorizer, final AWSIotMqttClientStatusCallback statusCallback) { if (tokenKeyName == null || token == null || tokenSignature == null) { throw new IllegalArgumentException("tokenKeyName/token/tokenSignature cannot be null"); } this.userStatusCallback = statusCallback; if (!MqttManagerConnectionState.Disconnected.equals(connectionState)) { userConnectionCallback(); return; } authMode = AuthenticationMode.CUSTOM_AUTH; String endpointWithHttpPort = getEndpointWithHttpPort(); LOGGER.debug("MQTT broker endpoint: " + endpointWithHttpPort); try { if (mqttClient == null) { mqttClient = new MqttAsyncClient( "wss://" + endpointWithHttpPort + "/mqtt", mqttClientId, new MemoryPersistence()); } customWebsocketHeaders.setProperty("X-Amz-CustomAuthorizer-Name", customAuthorizer); customWebsocketHeaders.setProperty("X-Amz-CustomAuthorizer-Signature", tokenSignature); customWebsocketHeaders.setProperty(tokenKeyName, token); final MqttConnectOptions options = new MqttConnectOptions(); if (mqttLWT != null) { options.setWill(mqttLWT.getTopic(), mqttLWT.getMessage().getBytes(), mqttLWT.getQos().asInt(), false); } options.setCustomWebSocketHeaders(customWebsocketHeaders); mqttConnect(options); } catch (final MqttException e) { connectionState = MqttManagerConnectionState.Disconnected; userConnectionCallback(new AmazonClientException("An error occurred in the MQTT client.", e)); } }
Source:
<code>public void testNanHash() { <START> int nanValues[] = new int[] {floatToIntBits(Float.NaN), floatToRawIntBits(Float.NaN), -0x400000, 0x7fc00000}; <END> assertEquals(RealOperators.hashCode(nanValues[0]), RealOperators.hashCode(nanValues[1])); assertEquals(RealOperators.hashCode(nanValues[0]), RealOperators.hashCode(nanValues[2])); assertEquals(RealOperators.hashCode(nanValues[0]), RealOperators.hashCode(nanValues[3])); }</code><technical_language>replace -0x400000 normal hex repr, 0xffc00000 - 0x7fc00000 == floatToIntBits(Float.NaN) == floatToRawIntBits(Float.NaN), thrice list (i a in explicit hex Float.NaN yields). want 0x7fc01234 - new int[] is redundant in all, this int nanRepresentations[] = {floatToIntBits(Float.NaN), 0xffc00000, 0x7fc00000, 0x7fc01234, 0xffc01234}; for (int nanRepresentation : nanRepresentations) { assertTrue(isNaN(Float.intBitsToFloat(nanRepresentation))); assertEquals(RealOperators.hashCode(nanRepresentations[0]), RealOperators.hashCode(nanRepresentation)); }</technical_language>

Target:
public void testNanHash() { int[] nanRepresentations = {floatToIntBits(Float.NaN), 0xffc00000, 0x7fc00000, 0x7fc01234, 0xffc01234}; for (int nanRepresentation : nanRepresentations) { assertTrue(isNaN(intBitsToFloat(nanRepresentation))); assertEquals(RealOperators.hashCode(nanRepresentation), RealOperators.hashCode(nanRepresentations[0])); } }
Source:
<code>public void testInitialization() { assertNull(fModule.getStateSystem()); fModule.schedule(); <START> assertEquals("Initialization succeeded", true, fModule.waitForInitialization()); <END> assertNotNull(fModule.getStateSystem()); }</code><technical_language>assertTrue instead</technical_language>

Target:
public void testInitialization() { assertNull(fModule.getStateSystem()); fModule.schedule(); assertTrue("Initialization succeeded", fModule.waitForInitialization()); assertNotNull(fModule.getStateSystem()); }
Source:
<code>private boolean isDetailFileLineValidCashAdvanceRequest(ConcurRequestExtractRequestDetailFileLine detailFileLine) { <START> if (detailFileLine.getValidationResult().isCashAdvanceLine() && detailFileLine.getValidationResult().isValidCashAdvanceLine()) { <END> return true; } else { return false; } }</code><technical_language>return boolean expression</technical_language>

Target:
private boolean isDetailFileLineValidCashAdvanceRequest(ConcurRequestExtractRequestDetailFileLine detailFileLine) { return (detailFileLine.getValidationResult().isCashAdvanceLine() && detailFileLine.getValidationResult().isValidCashAdvanceLine()); }
Source:
<code>public CopyDepthNode(Context context) { DisplayResolutionDependentFBOs displayResolutionDependentFBOs = context.get(DisplayResolutionDependentFBOs.class); lastUpdatedGBuffer = displayResolutionDependentFBOs.getGBufferPair().getLastUpdatedFbo(); <START> copyDepthFbo = requiresFBO(new FBOConfig(COPY_DEPTH_FBO_URI, FULL_SCALE, FBO.Type.HDR).useDepthBuffer(), displayResolutionDependentFBOs); <END> addDesiredStateChange(new BindFbo(copyDepthFbo)); lastUpdatedGBuffer.attachDepthBufferTo(copyDepthFbo); activeCamera = context.get(WorldRenderer.class).getActiveCamera(); addDesiredStateChange(new EnableMaterial(COPY_DEPTH_MATERIAL_URN)); copyDepthMaterial = getMaterial(COPY_DEPTH_MATERIAL_URN); int textureSlot = 0; addDesiredStateChange(new SetInputTextureFromFbo(textureSlot++, lastUpdatedGBuffer, ColorTexture, displayResolutionDependentFBOs, COPY_DEPTH_MATERIAL_URN, "texSceneOpaque")); addDesiredStateChange(new SetInputTextureFromFbo(textureSlot++, lastUpdatedGBuffer, DepthStencilTexture, displayResolutionDependentFBOs, COPY_DEPTH_MATERIAL_URN, "texSceneOpaqueDepth")); addDesiredStateChange(new SwapGBuffers(displayResolutionDependentFBOs.getGBufferPair())); }</code><technical_language>Firstly, call this outputFbo output of this node goes. Second, FBO.Type.NO_COLOR generate FBO color attachments (but please in code remove FBO. part, leaving Type.NO_COLOR</technical_language>

Target:
public CopyDepthNode(Context context) { DisplayResolutionDependentFBOs displayResolutionDependentFBOs = context.get(DisplayResolutionDependentFBOs.class); lastUpdatedGBuffer = displayResolutionDependentFBOs.getGBufferPair().getLastUpdatedFbo(); outputFbo = requiresFBO(new FBOConfig(COPY_DEPTH_FBO_URI, FULL_SCALE, Type.NO_COLOR).useDepthBuffer(), displayResolutionDependentFBOs); addDesiredStateChange(new BindFbo(outputFbo)); addDesiredStateChange(new SetViewportToSizeOf(outputFbo)); addDesiredStateChange(new EnableMaterial(COPY_DEPTH_MATERIAL_URN)); copyDepthMaterial = getMaterial(COPY_DEPTH_MATERIAL_URN); int textureSlot = 0; addDesiredStateChange(new SetInputTextureFromFbo(textureSlot++, lastUpdatedGBuffer, DepthStencilTexture, displayResolutionDependentFBOs, COPY_DEPTH_MATERIAL_URN, "texSceneOpaqueDepth")); }
Source:
<code>public void equalsAndHashCodeEqualTest() throws Exception { final Take take = new TkText("text"); new Assertion<>( "Must evaluate true equality", new TkConsumes( take, <START> "Content-Type: text/plain" <END> ), new IsEqual<>( new TkConsumes( take, "Content-Type: text/plain" ) ) ).affirm(); }</code><technical_language>@fanifieiev put content share this in local variable</technical_language>

Target:
public void equalsAndHashCodeEqualTest() throws Exception { final Take take = new TkText("text"); final String type = "Content-Type: text/plain"; new Assertion<>( "Must evaluate true equality", new TkConsumes(take, type), new IsEqual<>(new TkConsumes(take, type)) ).affirm(); }
Source:
<code>public EntityManagerFactory getEntityManagerFactory() { <START> if (entityManagerFactory == null) { <END> return synchronizedGetEntityManagerFactory(); } return entityManagerFactory; }</code><technical_language>recreateEntityManagerFactory entityManagerFactory null, closed. In addition, synchronizing synchronizedGetEntityManagerFactory recreateEntityManagerFactory is enough EntityManager retrieved refresh close. For instance, if refresh is done lines: final EntityManager em = getEntityManager(); final T entity = em.find(entityClass, primaryKey);</technical_language>

Target:
public EntityManagerFactory getEntityManagerFactory() { if (entityManagerFactory != null && !entityManagerFactory.isOpen()) { return synchronizedGetEntityManagerFactory(); } return entityManagerFactory; }
Source:
<code>private String getActionName(Action action, Command command) { if (command.getClass().isAnonymousClass()) { return action.getText(); } else { String ans = command.getClass().getSimpleName(); if (ans.contains("OldDatabaseCommandWrapper")) { OldDatabaseCommandWrapper tmp = (OldDatabaseCommandWrapper) command; return tmp.getActions().toString(); } else if (ans.contains("EditAction")) { return command.toString(); } else { return command.getClass().getSimpleName(); <START> } <END> } }</code><technical_language>I testing this method is a small bug in some EditAction cases (it shows org.jabref.gui.entryeditor.SourceTab$EditAction@56048e40FromMenu). Due classes Actions OldDatabaseCommandWrapper, is a bit complicated deal of them, I this work... } else { String commandName = command.getClass().getSimpleName(); if (command instanceof OldDatabaseCommandWrapper || commandName.equals("EditAction")) { return action.toString(); } else { return commandName; } } a proposal, please adapt in :"D</technical_language>

Target:
private String getActionName(Action action, Command command) { if (command.getClass().isAnonymousClass()) { return action.getText(); } else { String commandName = command.getClass().getSimpleName(); if ((command instanceof OldDatabaseCommandWrapper) || (command instanceof OldCommandWrapper) || commandName.contains("EditAction")) { return command.toString(); } else { return commandName; } } }
Source:
<code>public Bucket couchbaseClient() throws Exception { Cluster cluster = couchbaseCluster(); if(getUserName().compareTo(getBucketName()) != 0) { cluster.authenticate(getUserName(), getBucketPassword()); <START> } else if (getBucketPassword().compareTo("") != 0) { <END> return cluster.openBucket(getBucketName(), getBucketPassword()); } return cluster.openBucket(getBucketName()); }</code><technical_language>NIT: prefer isEmpty() equals(""). in this case: } else if (!getBucketPassword().isEmpty()) { Of this depends password field null</technical_language>

Target:
public Bucket couchbaseClient() throws Exception { Cluster cluster = couchbaseCluster(); if(!getUsername().contentEquals(getBucketName())){ cluster.authenticate(getUsername(), getBucketPassword()); } else if (!getBucketPassword().isEmpty()) { return cluster.openBucket(getBucketName(), getBucketPassword()); } return cluster.openBucket(getBucketName()); }
Source:
<code>public void useDefaultTrustStoreMechanism() throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException { SSLContext c = SSLContext.getInstance(this.sslAlgorithm); <START> c.init(null, new TrustManager[] { getDefaultTrustManager(TrustManagerFactory.getDefaultAlgorithm(), null) }, null); <END> this.connectionFactory.useSslProtocol(c); }</code><technical_language>this? TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509"); tmf.init(null); c.init(null, tmf.getTrustManagers(), null);</technical_language>

Target:
private void useDefaultTrustStoreMechanism() throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException { SSLContext sslContext = SSLContext.getInstance(this.sslAlgorithm); TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); trustManagerFactory.init((KeyStore) null); sslContext.init(null, trustManagerFactory.getTrustManagers(), null); this.connectionFactory.useSslProtocol(sslContext); }
Source:
<code>private File[] pack(final Repository src, final RevObject... list) throws IOException { <START> try (final PackWriter pw = new PackWriter(src)) { <END> for (final RevObject o : list) { pw.addObject(o); } final ObjectId name = pw.computeName(); final File packFile = fullPackFileName(name, ".pack"); final File idxFile = fullPackFileName(name, ".idx"); final File[] files = new File[] { packFile, idxFile }; write(files, pw); return files; } }</code><technical_language>(optional)</technical_language>

Target:
private File[] pack(final Repository src, final RevObject... list) throws IOException { try (PackWriter pw = new PackWriter(src)) { for (final RevObject o : list) { pw.addObject(o); } final ObjectId name = pw.computeName(); final File packFile = fullPackFileName(name, ".pack"); final File idxFile = fullPackFileName(name, ".idx"); final File[] files = new File[] { packFile, idxFile }; write(files, pw); return files; } }
Source:
<code>public String renderAfterConstructorJs() { StringBuilder builder = new StringBuilder(); <START> if (getModel().getObject().getLayers() != null) { <END> for (Layer layer : getModel().getObject().getLayers()) { if (layer.getSource() != null && layer.getSource() instanceof VectorSource) { VectorSource vectorSource = (VectorSource) layer.getSource(); if (vectorSource.getFeatures() != null) { for (Feature feature : vectorSource.getFeatures()) { builder.append(feature.renderAfterConstructorJs()); } } } } } return builder.toString(); }</code><technical_language>cache layers in a local variable</technical_language>

Target:
public String renderAfterConstructorJs() { StringBuilder builder = new StringBuilder(); Map map = getModelObject(); if (map.getLayers() != null) { for (Layer layer : map.getLayers()) { if (layer.getSource() != null && layer.getSource() instanceof VectorSource) { VectorSource vectorSource = (VectorSource) layer.getSource(); if (vectorSource.getFeatures() != null) { for (Feature feature : vectorSource.getFeatures()) { builder.append(feature.renderAfterConstructorJs()); } } } } } return builder.toString(); }