auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void minimalConfig() { ClassPathXmlApplicationContext context = <START> new ClassPathXmlApplicationContext("outbound-gateway-parser-config.xml", this.getClass()); <END> MongoDbOutboundGateway gateway = TestUtils.getPropertyValue(context.getBean("minimalConfig"), "handler", MongoDbOutboundGateway.class); assertNotNull(TestUtils.getPropertyValue(gateway, "mongoTemplate")); assertEquals(context.getBean("mongoDbFactory"), TestUtils.getPropertyValue(gateway, "mongoDbFactory")); assertNotNull(TestUtils.getPropertyValue(gateway, "evaluationContext")); assertTrue(TestUtils.getPropertyValue(gateway, "collectionNameExpression") instanceof LiteralExpression); assertEquals("data", TestUtils.getPropertyValue(gateway, "collectionNameExpression.literalValue")); context.close(); }</code><technical_language>I @ContextConfiguration @RunWith(SpringRunner.class) @DirtiesContext avoid extra loads for config in test method. I case outbound-gateway-parser-config.xml renamed MongoDbOutboundGatewayParserTests-context.xml</technical_language>

Target:
public void minimalConfig() { MongoDbOutboundGateway gateway = TestUtils.getPropertyValue(context.getBean("minimalConfig"), "handler", MongoDbOutboundGateway.class); assertNotNull(TestUtils.getPropertyValue(gateway, "mongoTemplate")); assertEquals(context.getBean("mongoDbFactory"), TestUtils.getPropertyValue(gateway, "mongoDbFactory")); assertNotNull(TestUtils.getPropertyValue(gateway, "evaluationContext")); assertTrue(TestUtils.getPropertyValue(gateway, "collectionNameExpression") instanceof LiteralExpression); assertEquals("foo", TestUtils.getPropertyValue(gateway, "collectionNameExpression.literalValue")); }
Source:
<code>public abstract long length() throws IOException; public abstract long lastModified() throws IOException; <START> public int mode() throws IOException { <END> return -1; }</code><technical_language>CheckReturnValue</technical_language>

Target:
public abstract long length() throws IOException; public abstract long lastModified() throws IOException; @Restricted(Beta.class) public int mode() throws IOException { return -1; }
Source:
<code>private static void fetchRequestProcessorMetrics(long now, MBeanServer mbs, List<Metric> metrics) throws JMException { <START> final ObjectName globalName = new ObjectName("Catalina:type=GlobalRequestProcessor,*"); <END> final Set<ObjectName> names = mbs.queryNames(globalName, null); if (names == null) { return; } for (ObjectName name : names) { AttributeList list = mbs.getAttributes(name, GLOBAL_REQ_ATTRS); for (Attribute a : list.asList()) { if (!a.getName().equals("maxTime")) { metrics.add(toCounter(now, name, a)); } else { metrics.add(toGauge(now, name, a)); } } } LOGGER.info("GlobalReqProc={}", metrics); }</code><technical_language>is worth noting in order for this match service name needs set in server.xml: xml <Service name="Catalina"> nice if auto-detect set of tomcat services in jmx users picking a name bitten times. Unfortunately, of is modeled I this require a full scan of jmx for right sub-properties ObjectName</technical_language>

Target:
private static void fetchRequestProcessorMetrics(long now, MBeanServer mbs, List<Metric> metrics) throws JMException { final ObjectName globalName = new ObjectName("Catalina:type=GlobalRequestProcessor,*"); final Set<ObjectName> names = mbs.queryNames(globalName, null); if (names == null) { return; } for (ObjectName name : names) { AttributeList list = mbs.getAttributes(name, GLOBAL_REQ_ATTRS); for (Attribute a : list.asList()) { addMetric(metrics, a.getName().equals("maxTime") ? toGauge(now, name, a) : toCounter(now, name, a)); } } }
Source:
<code>public void testSpecialCharacterNames() throws Exception { XMLUnit.setXpathNamespaceContext(NS_XML); Document doc = getAsDOM("/rest/resource/po%c3%abzie?format=xml"); XMLAssert.assertXpathEvaluatesTo("http://localhost:8080/geoserver/rest/resource/po%c3%abzie/caf%c3%a9", "/ResourceDirectory/children/child/atom:link/@href", doc); <START> MockHttpServletResponse response = getAsServletResponse("/rest/resource/po%c3%abzie/caf%c3%a9"); <END> Assert.assertEquals(200, response.getStatusCode()); Assert.assertEquals("resource", response.getHeader("Resource-Type")); Assert.assertEquals("http://localhost:8080/geoserver/rest/resource/po%c3%abzie", response.getHeader("Resource-Parent")); }</code><technical_language>put "?format=xml" this request ensure is removed in Resource-Parent</technical_language>

Target:
public void testSpecialCharacterNames() throws Exception { XMLUnit.setXpathNamespaceContext(NS_XML); Document doc = getAsDOM("/rest/resource/po%c3%abzie?format=xml"); XMLAssert.assertXpathEvaluatesTo("http://localhost:8080/geoserver/rest/resource/po%C3%ABzie/caf%C3%A9", "/ResourceDirectory/children/child/atom:link/@href", doc); MockHttpServletResponse response = getAsServletResponse("/rest/resource/po%c3%abzie/caf%c3%a9?format=xml"); Assert.assertEquals(200, response.getStatusCode()); Assert.assertEquals("resource", response.getHeader("Resource-Type")); Assert.assertEquals("http://localhost:8080/geoserver/rest/resource/po%C3%ABzie", response.getHeader("Resource-Parent")); }
Source:
<code>public void getObjectWithSyncNoUpdate() throws Exception { final String bucketName = "test_get_object_with_sync_no_update"; final String objectName = "beowulf.txt"; try { Util.copyFile(objectName, Util.RESOURCE_BASE_NAME, Util.DOWNLOAD_BASE_NAME); File newFile = new File(Util.DOWNLOAD_BASE_NAME + "/" + objectName); <START> DateTime now = new DateTime(); <END> newFile.setLastModified(now.getMillis()); Util.createBucket(client, bucketName); Util.loadBookTestData(client, bucketName); final Arguments args = new Arguments(new String[]{"--http", "-c", "get_object", "-b", bucketName, "-o", objectName, "-d", Util.DOWNLOAD_BASE_NAME, "--sync"}); CommandResponse response = Util.command(client, args); assertThat(response.getMessage(), is("SUCCESS: No need to sync " + objectName)); } finally { Util.deleteBucket(client, bucketName); Util.deleteLocalFile(objectName); } }</code><technical_language>missing final</technical_language>

Target:
public void getObjectWithSyncNoUpdate() throws Exception { final String bucketName = "test_get_object_with_sync_no_update"; final String objectName = "beowulf.txt"; try { Util.copyFile(objectName, Util.RESOURCE_BASE_NAME, Util.DOWNLOAD_BASE_NAME); final File newFile = new File(Util.DOWNLOAD_BASE_NAME + File.separator + objectName); final DateTime now = new DateTime(); newFile.setLastModified(now.getMillis()); Util.createBucket(client, bucketName); Util.loadBookTestData(client, bucketName); final Arguments args = new Arguments(new String[]{"--http", "-c", "get_object", "-b", bucketName, "-o", objectName, "-d", Util.DOWNLOAD_BASE_NAME, "--sync"}); final CommandResponse response = Util.command(client, args); assertThat(response.getMessage(), is("SUCCESS: No need to sync " + objectName)); } finally { Util.deleteBucket(client, bucketName); Util.deleteLocalFile(objectName); } }
Source:
<code>public Hashtable<String, String> getPathStatus(final Path path) throws AzureBlobFileSystemException { <START> try (AbfsPerfInfo tracker = startTracking("getPathStatus", "getPathStatus")){ <END> LOG.debug("getPathStatus for filesystem: path: {}", client.getFileSystem(), path); final Hashtable<String, String> parsedXmsProperties; final AbfsRestOperation op = client.getPathStatus(AbfsHttpConstants.FORWARD_SLASH + getRelativePath(path)); tracker.registerResult(op.getResult()); final String xMsProperties = op.getResult().getResponseHeader(HttpHeaderConfigurations.X_MS_PROPERTIES); parsedXmsProperties = parseCommaSeparatedXmsProperties(xMsProperties); tracker.registerSuccess(true); return parsedXmsProperties; } }</code><technical_language>is avoid nested try catch logic here</technical_language>

Target:
public Hashtable<String, String> getPathStatus(final Path path) throws AzureBlobFileSystemException { try (AbfsPerfInfo perfInfo = startTracking("getPathStatus", "getPathStatus")){ LOG.debug("getPathStatus for filesystem: path: {}", client.getFileSystem(), path); final Hashtable<String, String> parsedXmsProperties; final AbfsRestOperation op = client.getPathStatus(AbfsHttpConstants.FORWARD_SLASH + getRelativePath(path)); perfInfo.registerResult(op.getResult()); final String xMsProperties = op.getResult().getResponseHeader(HttpHeaderConfigurations.X_MS_PROPERTIES); parsedXmsProperties = parseCommaSeparatedXmsProperties(xMsProperties); perfInfo.registerSuccess(true); return parsedXmsProperties; } }
Source:
<code>private ResponseEntity<?> sendRequest(String url, Object requestData, Method method, RestTemplate restTemplate, int retryCount, long retryInterval) { ResponseEntity<?> retValue = null; Callable<ResponseEntity<?>> task = new Callable<ResponseEntity<?>>() { public ResponseEntity<?> call() throws HttpException { LOGGER.info("Posting Http request -- Url: {}, Data: {}", url, String.valueOf(requestData)); ResponseEntity<?> response = null; String errorMessage = null; try { response = doExecuteForReturnType(url, requestData, method, restTemplate); <START> } catch (Exception e) { <END> errorMessage = e.getMessage(); throw (e instanceof HttpException) ? (HttpException) e : new HttpException("HTTP error when executing task", e); } finally { if (response != null) { sendAuditLog(url, requestData, response.getBody().toString(), response.getStatusCode().toString()); } else { sendAuditLog(url, requestData, errorMessage.substring(4), errorMessage.substring(0, 4)); } } if (response.getStatusCode().value() / HUNDRED == 2) { return response; } else { throw new HttpException(); } } }; RetriableTask<ResponseEntity<?>> r = new RetriableTask<>( retryCount, retryInterval, task); try { retValue = r.call(); } catch (Exception e) { LOGGER.error("Posting Http request -- Url: {}, Data: failed after retries at interval of ms.", url, String.valueOf(requestData), String.valueOf(retryCount), String.valueOf(retryInterval), e); } return retValue; }</code><technical_language>catch HttpException</technical_language>

Target:
private ResponseEntity<?> sendRequest(String url, Object requestData, Method method, RestTemplate restTemplate, int retryCount, long retryInterval) { ResponseEntity<?> retValue = null; Callable<ResponseEntity<?>> task = new Callable<ResponseEntity<?>>() { public ResponseEntity<?> call() throws HttpException { LOGGER.info("Posting Http request -- Url: {}, Data: {}", url, String.valueOf(requestData)); ResponseEntity<?> response = null; String errorMessage = null; response = doExecuteForReturnType(url, requestData, method, restTemplate); if(response != null) { return response; } else { throw new HttpException(); } } }; RetriableTask<ResponseEntity<?>> r = new RetriableTask<>( retryCount, retryInterval, task); try { retValue = r.call(); } catch (Exception e) { LOGGER.error("Posting Http request -- Url: {}, Data: failed after retries at interval of ms.", url, String.valueOf(requestData), String.valueOf(retryCount), String.valueOf(retryInterval), e); } return retValue; }
Source:
<code>public void whenSerializingJava8DateAndReadingValue_thenCorrect() throws IOException { final String stringDate = "\"2014-12-20\""; final ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new JavaTimeModule()); mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); final String result2 = mapper.readValue(stringDate, LocalDate.class) <START> .toString(); <END> assertThat(result2, containsString("2014-12-20")); }</code><technical_language>This is odd test serialization: load object do toString object. assert fields of LocalDate object? a glance, this string processing, a date object in middle</technical_language>

Target:
public void whenSerializingJava8DateAndReadingValue_thenCorrect() throws IOException { String stringDate = "\"2014-12-20\""; ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new JavaTimeModule()); mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); LocalDate result = mapper.readValue(stringDate, LocalDate.class); assertThat(result.toString(), containsString("2014-12-20")); }
Source:
<code>private HighResolutionClock createHighResClock(Config config) { MetricsConfig metricsConfig = new MetricsConfig(config); <START> if (metricsConfig.getMetricsTimerDebugEnabled()) { <END> return System::nanoTime; } else { return () -> 0; } }</code><technical_language>this Timer TimerDebug enabled</technical_language>

Target:
private HighResolutionClock createHighResClock(Config config) { MetricsConfig metricsConfig = new MetricsConfig(config); if (metricsConfig.getMetricsTimerEnabled() && metricsConfig.getMetricsTimerDebugEnabled()) { return System::nanoTime; } else { return () -> 0; } }
Source:
<code>public ConfigureLocalStorageModel() { setStorage(new LocalStorageModel()); setDataCenter(new DataCenterModel()); getDataCenter().getVersion().getSelectedItemChangedEvent().addListener(this); setCluster(new ClusterModel()); getCluster().init(false); getCluster().setIsNew(true); <START> UIConstants constants = ConstantsManager.getInstance().getConstants(); <END> getCluster().getCPU().setIsChangeable(false, constants.cpuAutoDetect()); setFormattedStorageName(new EntityModel<String>()); for (Boolean bool : getDataCenter().getStoragePoolType().getItems()) { if (bool) { getDataCenter().getStoragePoolType().setSelectedItem(bool); break; } } setValidTab(TabName.GENERAL_TAB, true); }</code><technical_language>please move constants initialization a final class member, for re-usability</technical_language>

Target:
public ConfigureLocalStorageModel() { setStorage(new LocalStorageModel()); setDataCenter(new DataCenterModel()); getDataCenter().getVersion().getSelectedItemChangedEvent().addListener(this); setCluster(new ClusterModel()); getCluster().init(false); getCluster().setIsNew(true); getCluster().getCPU().setIsChangeable(false, constants.cpuAutoDetect()); setFormattedStorageName(new EntityModel<String>()); for (Boolean bool : getDataCenter().getStoragePoolType().getItems()) { if (bool) { getDataCenter().getStoragePoolType().setSelectedItem(bool); break; } } setValidTab(TabName.GENERAL_TAB, true); }
Source:
<code>public CommandCallback getCallback() { <START> return isCinderDisksExist() ? null : new ConcurrentChildCommandsExecutionCallback(); <END> }</code><technical_language>This is a bug, if cinder disks exists return call (not null). parameter added in previous patch</technical_language>

Target:
public CommandCallback getCallback() { return isCinderDisksExist() ? new ConcurrentChildCommandsExecutionCallback() : null; }
Source:
<code>public RepoStatistics getStatistics() throws IOException { RepoStatistics ret = new RepoStatistics(); Set<ObjectId> packedObjects = new HashSet<ObjectId>(); for (PackFile f : repo.getObjectDatabase().getPacks()) { for (MutableEntry e : f.getIndex()) packedObjects.add(e.toObjectId()); } ret.numberOfPackedObjects = packedObjects.size(); ret.numberOfPackFiles = repo.getObjectDatabase().getPacks().size(); <START> ret.numberOfLooseObjects = 0; <END> File objDir = repo.getObjectsDirectory(); String[] fanout = objDir.list(); if (fanout != null && fanout.length > 0) { for (String d : fanout) { if (d.length() != 2) continue; String[] entries = new File(objDir, d).list(); if (entries == null) continue; for (String e : entries) { if (e.length() != Constants.OBJECT_ID_STRING_LENGTH - 2) continue; ret.numberOfLooseObjects++; } } } return ret; }</code><technical_language>unnecessary assignment, is 0 in a new object</technical_language>

Target:
public RepoStatistics getStatistics() throws IOException { RepoStatistics ret = new RepoStatistics(); Collection<PackFile> packs = repo.getObjectDatabase().getPacks(); for (PackFile f : packs) ret.numberOfPackedObjects += f.getIndex().getObjectCount(); ret.numberOfPackFiles = packs.size(); File objDir = repo.getObjectsDirectory(); String[] fanout = objDir.list(); if (fanout != null && fanout.length > 0) { for (String d : fanout) { if (d.length() != 2) continue; String[] entries = new File(objDir, d).list(); if (entries == null) continue; for (String e : entries) { if (e.length() != Constants.OBJECT_ID_STRING_LENGTH - 2) continue; ret.numberOfLooseObjects++; } } } return ret; }
Source:
<code>private synchronized OutputStream addPostSteps(ProcessingStepHandler handler, IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) { ArrayList<ProcessingStep> steps = new ArrayList<ProcessingStep>(); steps.add(new SignatureVerifier()); <START> List<ChecksumVerifier> checksumVerifiers = ChecksumUtilities.getChecksumVerifiers(descriptor); <END> for (ChecksumVerifier checksumVerifier : checksumVerifiers) { steps.add(checksumVerifier); } if (steps.isEmpty()) return destination; ProcessingStep[] stepArray = steps.toArray(new ProcessingStep[steps.size()]); return handler.link(stepArray, destination, monitor); }</code><technical_language>I check checksums available, this costly. checksum verifier return strongest enabled</technical_language>

Target:
private synchronized OutputStream addPostSteps(ProcessingStepHandler handler, IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) { ArrayList<ProcessingStep> steps = new ArrayList<ProcessingStep>(); steps.add(new SignatureVerifier()); Iterable<ChecksumVerifier> checksumVerifiers = ChecksumUtilities.getChecksumVerifiers(descriptor); for (ChecksumVerifier checksumVerifier : checksumVerifiers) { steps.add(checksumVerifier); } if (steps.isEmpty()) return destination; ProcessingStep[] stepArray = steps.toArray(new ProcessingStep[steps.size()]); return handler.link(stepArray, destination, monitor); }
Source:
<code>private void restartIfRequestTimerExpired(long maxTimeBetweenRequests) { synchronized (lockObject) { if (lastRequestTime != null) { Instant now = Instant.now(); Duration timeSinceLastResponse = Duration.between(lastRequestTime, now); if (timeSinceLastResponse.toMillis() > maxTimeBetweenRequests) { log.error( <START> "{}: Last request was dispatched at {}, but no response as of ({}). Cancelling subscription, and restarting.", <END> shardConsumer.shardInfo().shardId(), lastRequestTime, now, timeSinceLastResponse, recordsPublisher.getLastRequestId()); cancel(); startSubscriptions(); } } } }</code><technical_language>Is this instance of "Last request of dispatched" log in ShardConsumerSubscriber</technical_language>

Target:
private void restartIfRequestTimerExpired(long maxTimeBetweenRequests) { synchronized (lockObject) { if (lastRequestTime != null) { Instant now = Instant.now(); Duration timeSinceLastResponse = Duration.between(lastRequestTime, now); if (timeSinceLastResponse.toMillis() > maxTimeBetweenRequests) { log.error( "{}: Last request was dispatched at {}, but no response as of ({}). Cancelling subscription, and restarting. Last successful request details -- {}", shardConsumer.shardInfo().shardId(), lastRequestTime, now, timeSinceLastResponse, recordsPublisher.getLastSuccessfulRequestDetails()); cancel(); startSubscriptions(); } } } }
Source:
<code>public Object execute(ExecutionEvent event) throws ExecutionException { if (fRoot == null) { <START> throw new ExecutionException("root is null"); END> } IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window == null) { return false; } IRemoteConnection connection = getConnection(event.getParameters()); if (connection != null) { fLock.lock(); try { if (fRoot == null) { return null; } TargetNodeComponent node = null; if (!fRoot.containsChild(connection.getName())) { node = new TargetNodeComponent(connection.getName(), fRoot, connection); fRoot.addChild(node); } else { node = (TargetNodeComponent)fRoot.getChild(connection.getName()); } node.connect(); } finally { fLock.unlock(); } } return null; }</code><technical_language>return false</technical_language>

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { if (fRoot == null) { return false; } IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window == null) { return false; } IRemoteConnection connection = getConnection(event.getParameters()); if (connection != null) { fLock.lock(); try { if (fRoot == null) { return null; } TargetNodeComponent node = null; if (!fRoot.containsChild(connection.getName())) { node = new TargetNodeComponent(connection.getName(), fRoot, connection); fRoot.addChild(node); } else { node = (TargetNodeComponent)fRoot.getChild(connection.getName()); } node.connect(); } finally { fLock.unlock(); } } return null; }
Source:
<code>public Position scrollToRowHeader(Position position, int scrollableRow, int headerColumn) { int row = scrollViewport(position, scrollableRow, <START> position.column).row; <END> return new Position(row, headerColumn); }</code><technical_language>position parameter is in NatTable coordinates out of range in scrollableLayer. Ideally scrollableColumn underlying scrollable layer column is NatTable position, change scrolling. I get this: Position viewportPosition = new Position(position); ViewportLayer viewportLayer = getViewportLayer(viewportPosition); if (viewportLayer == null) { throw new IllegalArgumentException("No viewport layer position " + position); } int scrollableColumn = viewportLayer.localToUnderlyingColumnPosition(viewportPosition.column);</technical_language>

Target:
public Position scrollToRowHeader(Position position, int scrollableRow, int headerColumn) { Position viewportPosition = new Position(position); ViewportLayer viewportLayer = getViewportLayer(viewportPosition); if (viewportLayer == null) { throw new IllegalArgumentException("No viewport layer found at position " + position); } int scrollableColumn = viewportLayer.localToUnderlyingColumnPosition(viewportPosition.column); int row = scrollViewport(position, scrollableRow, scrollableColumn).row; return new Position(row, headerColumn); }
Source:
<code>public int onStartCommand(Intent intent, int flags, int startId) { Logger.d(TAG, "SchedulerService started"); super.onStartCommand(intent, flags, startId); statusManager.setLatestSchedulerServiceSystemTimestampToNow(); statusManager.checkLatestLocationPointServiceWasAgesAgo(); startSyncService(); if (!statusManager.areParametersUpdated()) { <START> Logger.d(TAG, "Parameters not updated yet. aborting scheduling."); <END> } else { scheduleProbe(intent.getBooleanExtra(SCHEDULER_DEBUGGING, false)); } if (!statusManager.areBeginQuestionnairesCompleted()) { scheduleBeginQuestionnaire(intent.getBooleanExtra(SCHEDULER_DEBUGGING, true)); } else { Logger.d(TAG, "BeginQuestionnaire all answered . no need to schedule notif."); } stopSelf(); return START_REDELIVER_INTENT; }</code><technical_language>questions/remarks for 10 lines follow: - if parameters updated yet, need schedule questionnaires either, leave return START_REDELIVER_INTENT remove else - SchedulerService runs (each time a probe is opened for instance). a check beginningQuestionnaire is scheduled get rescheduled time? is. If isn't, reread code limit number of times Scheduler is started</technical_language>

Target:
public int onStartCommand(Intent intent, int flags, int startId) { Logger.d(TAG, "SchedulerService started"); super.onStartCommand(intent, flags, startId); statusManager.setLatestSchedulerServiceSystemTimestampToNow(); statusManager.checkLatestLocationPointServiceWasAgesAgo(); startSyncService(); if (!statusManager.areParametersUpdated()) { Logger.d(TAG, "Parameters not updated yet. aborting scheduling."); return START_REDELIVER_INTENT; } scheduleProbe(intent.getBooleanExtra(SCHEDULER_DEBUGGING, false)); if (!statusManager.areBeginQuestionnairesCompleted()) { scheduleBeginQuestionnaire(intent.getBooleanExtra(SCHEDULER_DEBUGGING, false)); } else { Logger.d(TAG, "BeginQuestionnaire all answered . no need to schedule notif."); } stopSelf(); return START_REDELIVER_INTENT; }
Source:
<code>public GenericItem createItem(String itemTypeName, String itemName) { <START> if (itemTypeName != null) { <END> switch (itemTypeName) { case CALL: return new CallItem(itemName); case COLOR: return new ColorItem(itemName); case CONTACT: return new ContactItem(itemName); case DATETIME: return new DateTimeItem(itemName); case DIMMER: return new DimmerItem(itemName); case IMAGE: return new ImageItem(itemName); case LOCATION: return new LocationItem(itemName); case NUMBER: return new NumberItem(itemName); case PLAYER: return new PlayerItem(itemName); case ROLLERSHUTTER: return new RollershutterItem(itemName); case STRING: return new StringItem(itemName); case SWITCH: return new SwitchItem(itemName); } } return null; }</code><technical_language>Good thought it! Please invert this statement in order reduce nesting level</technical_language>

Target:
public GenericItem createItem(String itemTypeName, String itemName) { if (itemTypeName == null) { return null; } switch (itemTypeName) { case CALL: return new CallItem(itemName); case COLOR: return new ColorItem(itemName); case CONTACT: return new ContactItem(itemName); case DATETIME: return new DateTimeItem(itemName); case DIMMER: return new DimmerItem(itemName); case IMAGE: return new ImageItem(itemName); case LOCATION: return new LocationItem(itemName); case NUMBER: return new NumberItem(itemName); case PLAYER: return new PlayerItem(itemName); case ROLLERSHUTTER: return new RollershutterItem(itemName); case STRING: return new StringItem(itemName); case SWITCH: return new SwitchItem(itemName); default: return null; } }
Source:
<code><START> public boolean isChanged() { <END> return this.changed; }</code><technical_language>I change this package scope</technical_language>

Target:
boolean isChanged() { return this.changed; }
Source:
<code>public EncryptedSageFile(SageFileSource sageFileSource, byte crypt[]) throws IOException { <START> if (sageFileSource instanceof EncryptedSageFile) <END> throw new IOException("Cannot layer the same encryption on top of itself."); this.sageFileSource = sageFileSource; cryptoKeys = crypt; System.out.println("Opening encrypted IO: crypt.length=" + crypt.length); }</code><technical_language>I this is exception...of need for in current code...but wants double encrypt in future for some reason. :) fine though</technical_language>

Target:
public EncryptedSageFile(SageFileSource sageFileSource, byte crypt[]) throws IOException { if (getEncryptedRandomFile(sageFileSource) != null) throw new IOException("Cannot layer the same encryption on top of itself."); this.sageFileSource = sageFileSource; cryptoKeys = crypt; }
Source:
<code>public SavedRow(Page page, int position, long joinPositionWithinPartition, boolean currentProbePositionProducedRow, int joinSourcePositions) { <START> this.row = mask(page, new int[] {position}); <END> this.row.compact(); this.joinPositionWithinPartition = joinPositionWithinPartition; this.currentProbePositionProducedRow = currentProbePositionProducedRow; this.joinSourcePositions = joinSourcePositions; }</code><technical_language>This retain entire page. I want build a new Page calling getSingleValueBlock block</technical_language>

Target:
public SavedRow(Page page, int position, long joinPositionWithinPartition, boolean currentProbePositionProducedRow, int joinSourcePositions) { this.row = page.mask(new int[] {position}); this.row.compact(); this.joinPositionWithinPartition = joinPositionWithinPartition; this.currentProbePositionProducedRow = currentProbePositionProducedRow; this.joinSourcePositions = joinSourcePositions; }
Source:
<code>private ObservableList<Label> generateLabels() { ObservableList<Label> sequenceItems = FXCollections .observableArrayList(); for (final Sequence sequence : sequences.values()) { <START> String ident = sequence.getIdentifier(); <END> Label label = new Label(ident); Color color = SequenceColor.getColor(sequence); label.setStyle("-fx-background-color: rgba(" + ColorUtils.rgbaFormat(color) + ")"); String styleClassFilter = "filtered"; if (getVisible().contains(sequence)) { label.getStyleClass().add(styleClassFilter); } label.setOnMouseClicked((mouseEvent) -> { Set<Sequence> visible = getVisible(); if (label.getStyleClass().contains(styleClassFilter)) { visible.remove(sequence); label.getStyleClass().remove(styleClassFilter); } else { visible.add(sequence); label.getStyleClass().add(styleClassFilter); } setVisible(visible, true); }); sequenceItems.add(label); } return sequenceItems; }</code><technical_language>Making variable names longer yield more meaning, _ident_ is more vague _id_; _identifier_ clearer</technical_language>

Target:
private ObservableList<Label> generateLabels() { ObservableList<Label> sequenceItems = FXCollections .observableArrayList(); for (final Sequence sequence : sequences.values()) { String identifier = sequence.getIdentifier(); Label label = new Label(identifier); Color color = SequenceColor.getColor(sequence); label.setStyle("-fx-background-color: rgba(" + ColorUtils.rgbaFormat(color) + ")"); String styleClassFilter = "filtered"; if (getVisible().contains(sequence)) { label.getStyleClass().add(styleClassFilter); } label.setOnMouseClicked((mouseEvent) -> { Set<Sequence> visible = getVisible(); if (label.getStyleClass().contains(styleClassFilter)) { visible.remove(sequence); label.getStyleClass().remove(styleClassFilter); } else { visible.add(sequence); label.getStyleClass().add(styleClassFilter); } setVisible(visible, true); }); sequenceItems.add(label); } return sequenceItems; }
Source:
<code><START> private static final IModelAccessFacade getModelAccess() { <END> return Utils.getComponent(IModelAccessFacade.class); }</code><technical_language>needs this method static</technical_language>

Target:
private final IModelAccessFacade getModelAccess() { return Utils.getComponent(IModelAccessFacade.class); }
Source:
<code>public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns) { KafkaTableHandle handle = convertTableHandle(table); <START> Long startTs = null; <END> Long endTs = null; Optional<Map<ColumnHandle, Domain>> domains = constraint.getSummary().getDomains(); if (domains.isPresent()) { Map<ColumnHandle, Domain> columnHandleDomainMap = domains.get(); for (Map.Entry<ColumnHandle, Domain> entry : columnHandleDomainMap.entrySet()) { if (entry.getKey() instanceof KafkaColumnHandle && ((KafkaColumnHandle) entry.getKey()).getName().equals(KafkaInternalFieldDescription.OFFSET_TIMESTAMP_FIELD.getColumnName())) { Range span = entry.getValue().getValues().getRanges().getSpan(); Marker low = span.getLow(); Marker high = span.getHigh(); if (!low.isLowerUnbounded()) { startTs = (Long) low.getValue(); } if (!high.isUpperUnbounded()) { endTs = (Long) high.getValue(); } } } } ConnectorTableLayout layout = new ConnectorTableLayout(new KafkaTableLayoutHandle(handle, startTs, endTs)); return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary())); }</code><technical_language>need Long? long get rid of boxing overhead</technical_language>

Target:
public List<ConnectorTableLayoutResult> getTableLayouts(ConnectorSession session, ConnectorTableHandle table, Constraint<ColumnHandle> constraint, Optional<Set<ColumnHandle>> desiredColumns) { KafkaTableHandle handle = convertTableHandle(table); long startTimestamp = 0; long endTimestamp = 0; Optional<Map<ColumnHandle, Domain>> domains = constraint.getSummary().getDomains(); if (domains.isPresent()) { Map<ColumnHandle, Domain> columnHandleDomainMap = domains.get(); for (Map.Entry<ColumnHandle, Domain> entry : columnHandleDomainMap.entrySet()) { if (entry.getKey() instanceof KafkaColumnHandle && ((KafkaColumnHandle) entry.getKey()).getName().equals(KafkaInternalFieldDescription.OFFSET_TIMESTAMP_FIELD.getColumnName())) { Range span = entry.getValue().getValues().getRanges().getSpan(); Marker low = span.getLow(); Marker high = span.getHigh(); if (!low.isLowerUnbounded()) { startTimestamp = (long) low.getValue(); } if (!high.isUpperUnbounded()) { endTimestamp = (long) high.getValue(); } } } } ConnectorTableLayout layout = new ConnectorTableLayout(new KafkaTableLayoutHandle(handle, startTimestamp, endTimestamp)); return ImmutableList.of(new ConnectorTableLayoutResult(layout, constraint.getSummary())); }
Source:
<code>private boolean addStyleToTemplate( final VTStyleSelector styleSelector, final TemplateModelEditorPart templateEditor) { final VTViewTemplate template = templateEditor.getTemplate(); if (template == null) { return false; } final TreeIterator<EObject> templateContents = EcoreUtil.getAllContents(template, true); while (templateContents.hasNext()) { final EObject next = templateContents.next(); if (!VTStyleSelector.class.isInstance(next)) { continue; } if (EcoreUtil.equals(next, styleSelector)) { templateEditor.reveal(next); return true; } } final VTStyle style = VTTemplateFactory.eINSTANCE.createStyle(); style.setSelector(styleSelector); final EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor(template); Command command = AddCommand.create(domain, template, VTTemplatePackage.eINSTANCE.getViewTemplate_Styles(), style); if (VTDomainModelReferenceSelector.class.isInstance(styleSelector)) { EObject view = vElement.get(); while (!VView.class.isInstance(view) && view != null) { view = view.eContainer(); } <START> if (view != null) { <END> final String ecorePath = VView.class.cast(view).getEcorePath(); if (!template.getReferencedEcores().contains(ecorePath)) { final Command ecorePathCommand = AddCommand.create(domain, template, VTTemplatePackage.eINSTANCE.getViewTemplate_ReferencedEcores(), ecorePath); command = new CompoundCommand(Arrays.asList(command, ecorePathCommand)); } } } if (!command.canExecute()) { return false; } domain.getCommandStack().execute(command); templateEditor.reveal(styleSelector); return true; }</code><technical_language>invert more clear avoid nesting: if (x==null) { return}</technical_language>

Target:
private boolean addStyleToTemplate( final VTStyleSelector styleSelector, final TemplateModelEditorPart templateEditor) { final VTViewTemplate template = templateEditor.getTemplate(); if (template == null) { return false; } final TreeIterator<EObject> templateContents = EcoreUtil.getAllContents(template, true); while (templateContents.hasNext()) { final EObject next = templateContents.next(); if (!VTStyleSelector.class.isInstance(next)) { continue; } if (EcoreUtil.equals(next, styleSelector)) { templateEditor.reveal(next); return true; } } final VTStyle style = VTTemplateFactory.eINSTANCE.createStyle(); style.setSelector(styleSelector); final EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor(template); Command command = AddCommand.create(domain, template, VTTemplatePackage.eINSTANCE.getViewTemplate_Styles(), style); if (VTDomainModelReferenceSelector.class.isInstance(styleSelector)) { EObject view = vElement.get(); while (!VView.class.isInstance(view) && view != null) { view = view.eContainer(); } command = addEcorePathIfRequired(template, domain, command, view); } if (!command.canExecute()) { return false; } domain.getCommandStack().execute(command); templateEditor.reveal(styleSelector); return true; }
Source:
<code>private synchronized boolean addToSubIdList(int slotIndex, int subId) { if <START> (slotIndex > 0) { <END> ArrayList<Integer> singleSubIdList = new ArrayList<>(Arrays.asList(subid)); sSlotIndexToSubIds.put(slotIndex, singleSubIdList); return true; } ArrayList<Integer> subIdsList = sSlotIndexToSubIds.get(slotIndex); if (subIdsList == null) { subIdsList = new ArrayList<>(); sSlotIndexToSubIds.put(slotIndex, subIdsList); } if (!subIdsList.contains(subId)) { subIdsList.add(subId); return true; } return false; }</code><technical_language>nit: change this isValidSlotIndex(), assuming API of sort. If not, this is ok I guess</technical_language>

Target:
private synchronized boolean addToSubIdList(int slotIndex, int subId) { if (slotIndex >= 0) { ArrayList<Integer> singleSubIdList = new ArrayList<>(Arrays.asList(subid)); sSlotIndexToSubIds.put(slotIndex, singleSubIdList); return true; } ArrayList<Integer> subIdsList = sSlotIndexToSubIds.get(slotIndex); if (subIdsList == null) { subIdsList = new ArrayList<>(); sSlotIndexToSubIds.put(slotIndex, subIdsList); } if (!subIdsList.contains(subId)) { subIdsList.add(subId); return true; } return false; }
Source:
<code>public void onInstanceConfigChange(List<InstanceConfig> configs, NotificationContext changeContext) { try { synchronized (notificationLock) { if (!instanceConfigInitialized.get()) { logger.info("Received initial notification for instance config change from {}", dcName); } else { logger.info("Instance config change triggered from {}", dcName); } logger.debug("Detailed instance configs in are: {}", dcName, configs); try { addOrUpdateInstanceInfos(configs); <START> instanceConfigInitialized.set(true); <END> } catch (Exception e) { if (!instanceConfigInitialized.get()) { logger.error("Exception occurred when initializing instances in {}: ", dcName, e); initializationFailureMap.putIfAbsent(dcName, e); instanceConfigInitialized.set(true); } else { logger.error("Exception occurred at runtime when handling instance config changes in {}: ", dcName, e); } } sealedStateChangeCounter.incrementAndGet(); helixClusterManagerMetrics.instanceConfigChangeTriggerCount.inc(); } } catch (Throwable t) { errorCount.incrementAndGet(); throw t; } }</code><technical_language>nit: do instanceConfigInitalized.set(true) in finally block</technical_language>

Target:
public void onInstanceConfigChange(List<InstanceConfig> configs, NotificationContext changeContext) { try { synchronized (notificationLock) { if (!instanceConfigInitialized) { logger.info("Received initial notification for instance config change from {}", dcName); } else { logger.info("Instance config change triggered from {}", dcName); } logger.debug("Detailed instance configs in are: {}", dcName, configs); try { addOrUpdateInstanceInfos(configs); } catch (Exception e) { if (!instanceConfigInitialized) { logger.error("Exception occurred when initializing instances in {}: ", dcName, e); initializationFailureMap.putIfAbsent(dcName, e); } else { logger.error("Exception occurred at runtime when handling instance config changes in {}: ", dcName, e); } } finally { instanceConfigInitialized = true; } sealedStateChangeCounter.incrementAndGet(); helixClusterManagerMetrics.instanceConfigChangeTriggerCount.inc(); } } catch (Throwable t) { errorCount.incrementAndGet(); throw t; } }
Source:
<code>private HandlerMethod findHandlerMethodForParameters(ParametersWrapper parameters) { final Class<?> payloadType = parameters.getFirstParameterType(); HandlerMethod closestMatch = this.findClosestMatch(payloadType); if (closestMatch != null) { return closestMatch; } else if (this.handlerMethods.size() == 1) { return this.handlerMethods.values().iterator().next(); <START> } else { <END> return this.handlerMethods.get(Void.class); } }</code><technical_language>new line for else</technical_language>

Target:
private HandlerMethod findHandlerMethodForParameters(ParametersWrapper parameters) { if (this.handlerMethod != null) { return this.handlerMethod; } final Class<?> payloadType = parameters.getFirstParameterType(); HandlerMethod closestMatch = this.findClosestMatch(payloadType); if (closestMatch != null) { return closestMatch; } if (Iterable.class.isAssignableFrom(payloadType) && this.handlerMethods.containsKey(Iterator.class)) { return this.handlerMethods.get(Iterator.class); } else { return this.handlerMethods.get(Void.class); } }
Source:
<code>private static List<HttpSessionActivationListener> findListeners(ImmutableSession session) { ImmutableSessionAttributes attributes = session.getAttributes(); <START> List<HttpSessionActivationListener> list = new ArrayList<>(); <END> for (String name : attributes.getAttributeNames()) { Object attribute = attributes.getAttribute(name); if (attribute instanceof HttpSessionActivationListener) { HttpSessionActivationListener httpSessionActivationListener = (HttpSessionActivationListener) attribute; list.add(httpSessionActivationListener); } } return list; }</code><technical_language>ArrayList constructed estimated capacity, e.g. number of attributes</technical_language>

Target:
private static List<HttpSessionActivationListener> findListeners(ImmutableSession session) { ImmutableSessionAttributes attributes = session.getAttributes(); final Set<String> names = attributes.getAttributeNames(); List<HttpSessionActivationListener> list = new ArrayList<>(names.size()); for (String name : names) { Object attribute = attributes.getAttribute(name); if (attribute instanceof HttpSessionActivationListener) { HttpSessionActivationListener httpSessionActivationListener = (HttpSessionActivationListener) attribute; list.add(httpSessionActivationListener); } } return list; }
Source:
<code>private boolean canBeLeaked(Tree exp) { AnnotatedTypeMirror type = atypeFactory.getAnnotatedType(exp); boolean isMethodInvocation = exp.getKind() == Kind.METHOD_INVOCATION; boolean isNewClass = exp.getKind() == Kind.NEW_CLASS; <START> boolean isArray = type.getUnderlyingType().getKind().toString().equalsIgnoreCase("array"); <END> boolean isNull = exp.getKind() == Kind.NULL_LITERAL; if (type.getUnderlyingType().toString().startsWith("java.lang") || isArray || isNull) { return type.hasExplicitAnnotation(Unique.class) && !isMethodInvocation && !isNewClass; } else { return type.hasAnnotation(Unique.class) && !isMethodInvocation && !isNewClass; } }</code><technical_language>try avoid operations strings. Is TypeKind compare against</technical_language>

Target:
private boolean canBeLeaked(Tree exp) { AnnotatedTypeMirror type = atypeFactory.getAnnotatedType(exp); boolean isMethodInvocation = exp.getKind() == Kind.METHOD_INVOCATION; boolean isNewClass = exp.getKind() == Kind.NEW_CLASS; boolean isUniqueType = isUniqueClass(type) || type.hasExplicitAnnotation(Unique.class); return isUniqueType && !isMethodInvocation && !isNewClass; }
Source:
<code>public void testEmptyIfRootIsEmpty() throws Exception { final File r = new File(trash, "not-existing-file"); assertFalse(r.exists()); <START> assertTrue(r.mkdir()); <END> assertTrue(r.isDirectory()); final FileTreeIterator fti = new FileTreeIterator(r, db.getFS(), db.getConfig().get(WorkingTreeOptions.KEY)); assertTrue(fti.first()); assertTrue(fti.eof()); }</code><technical_language>FileUtils.mkdirs</technical_language>

Target:
public void testEmptyIfRootIsEmpty() throws Exception { final File r = new File(trash, "not-existing-file"); assertFalse(r.exists()); FileUtils.mkdir(r); final FileTreeIterator fti = new FileTreeIterator(r, db.getFS(), db.getConfig().get(WorkingTreeOptions.KEY)); assertTrue(fti.first()); assertTrue(fti.eof()); }
Source:
<code><START> private UrlBuilder(String wiki, String env, Boolean forceHttps, Boolean forceLanguageInPath, String language) { <END> super(env); areLanguageTestsEnabled = (Configuration.getForceLanguageInPath() && "szl".equals(Configuration.getWikiLanguage())); if (FANDOM_EXCLUDED_WIKIS.contains(wiki) || areLanguageTestsEnabled) { this.wikiName = wiki; } else { this.wikiName = Configuration.getForceFandomDomain() ? wiki + WIKI_NAME_FANDOM_SUFFIX : wiki; } this.forceHttps = forceHttps; this.forceLanguageInPath = forceLanguageInPath; this.language = language; }</code><technical_language>![MAJOR](<LINK_0> 'Severity: MAJOR') Remove this unused private "UrlBuilder" constructor. [![rule](<LINK_1>](http://sonar-s4/coding_rules#rule_key=squid%3AUnusedPrivateMethod)</technical_language>

Target:
private UrlBuilder(String wiki, String env, Boolean forceHttps, Boolean forceLanguageInPath, String language) { super(env); areLanguageTestsEnabled = Configuration.getForceLanguageInPath() && "szl".equals(Configuration.getWikiLanguage()); if (FANDOM_EXCLUDED_WIKIS.contains(wiki) || areLanguageTestsEnabled) { this.wikiName = wiki; } else { this.wikiName = Configuration.getForceFandomDomain() ? wiki + WIKI_NAME_FANDOM_SUFFIX : wiki; } this.forceHttps = forceHttps; this.forceLanguageInPath = forceLanguageInPath; this.language = language; }
Source:
<code>private void parseRewindOrDelete(final ReceiveCommand cmd) { if (isHead(cmd) && cmd.getType() == Type.DELETE && projectControl.canDeleteRef(cmd.getRefName())) { <START> } else if (isHead(cmd) && canPerform(PUSH_HEAD, PUSH_HEAD_REPLACE) <END> && projectControl.canUploadToRef(cmd.getRefName())) { } else if (isHead(cmd) && cmd.getType() == Type.UPDATE_NONFASTFORWARD) { cmd.setResult(ReceiveCommand.Result.REJECTED_NONFASTFORWARD); } else { reject(cmd); } }</code><technical_language>NAK. I a RefControl for refName asking refControl.canPerform(PUSH_HEAD, PUSH_HEAD_REPLACE)</technical_language>

Target:
private void parseRewindOrDelete(final ReceiveCommand cmd) { RefControl refControl = projectControl.controlForRef(cmd.getRefName()); if (isHead(cmd) && cmd.getType() == Type.DELETE && projectControl.canDeleteRef(cmd.getRefName())) { } else if (isHead(cmd) && refControl.canPerform(PUSH_HEAD, PUSH_HEAD_REPLACE)) { } else if (isHead(cmd) && cmd.getType() == Type.UPDATE_NONFASTFORWARD) { cmd.setResult(ReceiveCommand.Result.REJECTED_NONFASTFORWARD); } else { reject(cmd); } }
Source:
<code><START> public static String normalizePath(String pathname) { <END> if (pathname == null || pathname.length() == 0) { return "/"; } StringBuilder ibuf = new StringBuilder(pathname.length() + 1); if (pathname.charAt(0) != '/') { ibuf.append('/'); } ibuf.append(pathname); int i = 0; while (i < ibuf.length()) { if (ibuf.charAt(i) == '%') { decodeUnreserved(ibuf, i); } i++; } return removeDots(ibuf); }</code><technical_language>I disallow null</technical_language>

Target:
public static String normalizePath(String pathname) { if (pathname == null) { return null; } if (pathname.length() == 0) { return "/"; } StringBuilder ibuf = new StringBuilder(pathname.length() + 1); if (pathname.charAt(0) != '/') { ibuf.append('/'); } ibuf.append(pathname); int i = 0; while (i < ibuf.length()) { if (ibuf.charAt(i) == '%') { decodeUnreserved(ibuf, i); } i++; } return removeDots(ibuf); }
Source:
<code>public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { if (!children.get(0).evaluate(tuple, ptr)) { return false; } if (ptr.getLength() == 0) { return true; } byte[] lhsBytes = ptr.get(); int lhsOffset = ptr.getOffset(); int lhsLength = ptr.getLength(); PDataType lhsDataType = children.get(0).getDataType(); SortOrder lhsSortOrder = children.get(0).getSortOrder(); if (!children.get(1).evaluate(tuple, ptr)) { return false; } if (ptr.getLength() == 0) { return true; } byte[] rhsBytes = ptr.get(); int rhsOffset = ptr.getOffset(); int rhsLength = ptr.getLength(); PDataType rhsDataType = children.get(1).getDataType(); SortOrder rhsSortOrder = children.get(1).getSortOrder(); <START> if(children.get(0) instanceof BaseJSONExpression && ((BaseJSONExpression)children.get(0)).getRealDataType() != null){ <END> lhsDataType=((BaseJSONExpression)children.get(0)).getRealDataType(); if(!(lhsDataType.isComparableTo(rhsDataType))){ ptr.set(PDataType.FALSE_BYTES); return true; } } if (rhsDataType == PChar.INSTANCE) { rhsLength = StringUtil.getUnpaddedCharLength(rhsBytes, rhsOffset, rhsLength, rhsSortOrder); } if (lhsDataType == PChar.INSTANCE) { lhsLength = StringUtil.getUnpaddedCharLength(lhsBytes, lhsOffset, lhsLength, lhsSortOrder); } int comparisonResult = lhsDataType.compareTo(lhsBytes, lhsOffset, lhsLength, lhsSortOrder, rhsBytes, rhsOffset, rhsLength, rhsSortOrder, rhsDataType); ptr.set(ByteUtil.compare(op, comparisonResult) ? PDataType.TRUE_BYTES : PDataType.FALSE_BYTES); return true; }</code><technical_language>is purpose of this check</technical_language>

Target:
public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { if (!children.get(0).evaluate(tuple, ptr)) { return false; } if (ptr.getLength() == 0) { return true; } byte[] lhsBytes = ptr.get(); int lhsOffset = ptr.getOffset(); int lhsLength = ptr.getLength(); PDataType lhsDataType = children.get(0).getDataType(); SortOrder lhsSortOrder = children.get(0).getSortOrder(); if (!children.get(1).evaluate(tuple, ptr)) { return false; } if (ptr.getLength() == 0) { return true; } byte[] rhsBytes = ptr.get(); int rhsOffset = ptr.getOffset(); int rhsLength = ptr.getLength(); PDataType rhsDataType = children.get(1).getDataType(); SortOrder rhsSortOrder = children.get(1).getSortOrder(); if (rhsDataType == PChar.INSTANCE) { rhsLength = StringUtil.getUnpaddedCharLength(rhsBytes, rhsOffset, rhsLength, rhsSortOrder); } if (lhsDataType == PChar.INSTANCE) { lhsLength = StringUtil.getUnpaddedCharLength(lhsBytes, lhsOffset, lhsLength, lhsSortOrder); } int comparisonResult = lhsDataType.compareTo(lhsBytes, lhsOffset, lhsLength, lhsSortOrder, rhsBytes, rhsOffset, rhsLength, rhsSortOrder, rhsDataType); ptr.set(ByteUtil.compare(op, comparisonResult) ? PDataType.TRUE_BYTES : PDataType.FALSE_BYTES); return true; }