auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected boolean shouldSkipAuthentication(HttpServletRequest request, String token) { if (token == null) { if (request.getRequestURI() != null && request.getRequestURI().endsWith("api/keycloak/OIDCKeycloak.js")) { return true; } return false; } try { jwtParser.parse(token); return false; } catch (ExpiredJwtException | MalformedJwtException | SignatureException ex) { return false; } catch (JwtException e) { return true; } }

Target:
boolean shouldSkipAuthentication(HttpServletRequest request, String token) { if (token == null) { return request.getRequestURI() != null && request.getRequestURI().endsWith("api/keycloak/OIDCKeycloak.js"); } try { jwtParser.parse(token); return false; } catch (MachineTokenJwtException e) { return true; } }
Source:
public static long getVirtualSize(InputStream inputStream) throws IOException { byte[] b = new byte[8]; if (inputStream.skip(VIRTUALSIZE_HEADER_LOCATION) != VIRTUALSIZE_HEADER_LOCATION) { throw new IOException("Unable to skip to the virtual size header"); } if (inputStream.read(b) != 8) { throw new IOException("Unable to properly read the size"); } return NumbersUtil.bytesToLong(b); }

Target:
public static long getVirtualSize(InputStream inputStream) throws IOException { byte[] bytes = new byte[VIRTUALSIZE_HEADER_LENGTH]; if (inputStream.skip(VIRTUALSIZE_HEADER_LOCATION) != VIRTUALSIZE_HEADER_LOCATION) { throw new IOException("Unable to skip to the virtual size header"); } if (inputStream.read(bytes) != VIRTUALSIZE_HEADER_LENGTH) { throw new IOException("Unable to properly read the size"); } return NumbersUtil.bytesToLong(bytes); }
Source:
protected Control createDialogArea(Composite parent) { Composite area = (Composite) super.createDialogArea(parent); Composite container = new Composite(area, SWT.NONE); container.setLayoutData(new GridData(GridData.FILL_BOTH)); GridLayout layout = new GridLayout(1, false); container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); container.setLayout(layout); Label label = new Label(container, 0); label.setText(this.bodyMsg); widgetButtonList = new ArrayList<>(); int ButtonCount = 1; for (Entry<String, String> usrbutton : userButtonList) { Button tmpButton = new Button(container, SWT.RADIO); tmpButton.setText(usrbutton.getValue()); if (ButtonCount == 1) { tmpButton.setSelection(true); ButtonCount++; } widgetButtonList.add(tmpButton); } return area; }

Target:
protected Control createDialogArea(Composite parent) { Composite area = (Composite) super.createDialogArea(parent); Composite container = new Composite(area, SWT.NONE); container.setLayoutData(new GridData(GridData.FILL_BOTH)); GridLayout layout = new GridLayout(1, false); container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); container.setLayout(layout); Label label = new Label(container, 0); label.setText(this.bodyMsg); widgetButtonList = new ArrayList<>(); int buttonCount = 1; for (Entry<String, String> usrbutton : userButtonList) { Button tmpButton = new Button(container, SWT.RADIO); tmpButton.setText(usrbutton.getValue()); if (buttonCount == 1) { tmpButton.setSelection(true); buttonCount++; } widgetButtonList.add(tmpButton); } return area; }
Source:
private static String toPatch(String type, PatchSet.Id diffBase, PatchSet.Id revision, String fileName) { Change.Id c = revision.getParentKey(); StringBuilder p = new StringBuilder(); p.append("/c/").append(c).append("/"); if (diffBase != null) { p.append(diffBase.get()).append(".."); } p.append(revision.get()).append("/").append(fileName); if (type != null && !type.isEmpty()) { p.append(",").append(type); } return p.toString(); }

Target:
private static String toPatch(String type, PatchSet.Id diffBase, PatchSet.Id revision, String fileName) { Change.Id c = revision.getParentKey(); StringBuilder p = new StringBuilder(); p.append("/c/").append(c).append("/"); if (diffBase != null) { p.append(diffBase.get()).append(".."); } p.append(revision.get()).append("/").append(KeyUtil.encode(fileName)); if (type != null && !type.isEmpty()) { p.append(",").append(type); } return p.toString(); }
Source:
protected void updateData(long start, long end, int nb, IProgressMonitor monitor) { if (fModules.isEmpty()) { return; } double[] xAxis = getXAxis(start, end, nb); setXAxis(xAxis); for (CounterAnalysis analysis : fModules) { ITmfStateSystem ss = analysis.getStateSystem(); if (ss == null) { continue; } for (Integer quark : fQuarks) { try { double[] steps = new double[nb]; ITmfStateValue prev = ss.querySingleState(Math.max(ss.getStartTime(), (long) (start - (xAxis[1]))), quark).getStateValue(); for (int i = 0; i < nb; i++) { ITmfStateValue next = ss.querySingleState(start + (long) xAxis[i] - 1, quark).getStateValue(); long stateValue = prev.isNull() ? next.unboxLong() : next.unboxLong() - prev.unboxLong(); steps[i] = next.isNull() ? 0 : stateValue; prev = next; } setSeries(createSeriesName(ss, quark), steps); } catch (StateSystemDisposedException e) { e.printStackTrace(); } } } updateDisplay(); }

Target:
protected void updateData(long start, long end, int nb, IProgressMonitor monitor) { if (fModules.isEmpty()) { return; } double[] xAxis = getXAxis(start, end, nb); setXAxis(xAxis); for (CounterAnalysis analysis : fModules) { ITmfStateSystem ss = analysis.getStateSystem(); if (ss == null) { continue; } for (Integer quark : fQuarks) { try { double[] steps = new double[nb]; ITmfStateValue prev = ss.querySingleState(Math.max(ss.getStartTime(), (long) (start - (xAxis[1]))), quark).getStateValue(); for (int i = 0; i < nb; i++) { ITmfStateValue next = ss.querySingleState(start + (long) xAxis[i] - 1, quark).getStateValue(); long stateValue = prev.isNull() ? next.unboxLong() : next.unboxLong() - prev.unboxLong(); steps[i] = next.isNull() ? 0 : stateValue; prev = next; } setSeries(createSeriesName(ss, quark), steps); } catch (StateSystemDisposedException e) { } } } updateDisplay(); }
Source:
private long[] sketchOutTransactionStartOffsets() throws IOException { long[] offsets = new long[10_000]; int offsetCursor = 0; long startOffset = channel.position(); while ( transactionCursor.next() ) { if ( offsetCursor == offsets.length ) { offsets = Arrays.copyOf( offsets, offsetCursor * 2 ); } offsets[offsetCursor++] = startOffset; long nextStartOffset = channel.position(); assert nextStartOffset > startOffset : "It looks like this channel moved over to another version"; startOffset = channel.position(); } offsetsLength = offsetCursor; chunkStartOffsetIndex = offsetCursor; totalSize = channel.position(); return offsets; }

Target:
private long[] sketchOutTransactionStartOffsets() throws IOException { long[] offsets = new long[10_000]; int offsetCursor = 0; long logVersion = channel.getVersion(); long startOffset = channel.position(); while ( transactionCursor.next() ) { if ( offsetCursor == offsets.length ) { offsets = Arrays.copyOf( offsets, offsetCursor * 2 ); } offsets[offsetCursor++] = startOffset; startOffset = channel.position(); } if ( channel.getVersion() != logVersion ) { throw new IllegalArgumentException( "The channel which was passed in bridged multiple log versions, it started at version " + logVersion + ", but continued through to version " + channel.getVersion() + ". This isn't supported" ); } offsetsLength = offsetCursor; chunkStartOffsetIndex = offsetCursor; totalSize = channel.position(); return offsets; }
Source:
public <M> OutputStream<M> getOutputStream(String streamId, Serde<M> serde) { StreamSpec streamSpec = runner.getStreamSpec(streamId); Preconditions.checkNotNull(serde, "serde must not be null for an output stream."); Preconditions.checkState(!outputStreams.containsKey(streamSpec), "getOutputStream must not be called multiple times with the same streamId: " + streamId); KV<Serde, Serde> kvSerdes = getKVSerdes(streamId, serde); if (inputOperators.containsKey(streamSpec)) { InputOperatorSpec inputOperatorSpec = inputOperators.get(streamSpec); Serde keySerde = inputOperatorSpec.getKeySerde(); Serde valueSerde = inputOperatorSpec.getValueSerde(); Preconditions.checkState(kvSerdes.getKey().equals(keySerde) && kvSerdes.getValue().equals(valueSerde), String.format("Stream %s is being used both as an input and an output stream. Serde in Samza happens at " + "stream level, so the same key and message Serde must be used for both.", streamId)); } boolean isKeyedOutput = serde instanceof KVSerde; outputStreams.put(streamSpec, new OutputStreamImpl<>(streamSpec, kvSerdes.getKey(), kvSerdes.getValue(), isKeyedOutput)); return outputStreams.get(streamSpec); }

Target:
public <M> OutputStream<M> getOutputStream(String streamId, Serde<M> serde) { StreamSpec streamSpec = runner.getStreamSpec(streamId); Preconditions.checkNotNull(serde, "serde must not be null for an output stream."); Preconditions.checkState(!outputStreams.containsKey(streamSpec), "getOutputStream must not be called multiple times with the same streamId: " + streamId); KV<Serde, Serde> kvSerdes = getKVSerdes(streamId, serde); if (inputOperators.containsKey(streamSpec)) { InputOperatorSpec inputOperatorSpec = inputOperators.get(streamSpec); Serde keySerde = inputOperatorSpec.getKeySerde(); Serde valueSerde = inputOperatorSpec.getValueSerde(); Preconditions.checkState(kvSerdes.getKey().equals(keySerde) && kvSerdes.getValue().equals(valueSerde), String.format("Stream %s is being used both as an input and an output stream. Serde in Samza happens at " + "stream level, so the same key and message Serde must be used for both.", streamId)); } boolean isKeyed = serde instanceof KVSerde; outputStreams.put(streamSpec, new OutputStreamImpl<>(streamSpec, kvSerdes.getKey(), kvSerdes.getValue(), isKeyed)); return outputStreams.get(streamSpec); }
Source:
public List<PermissionSubject> getPermissionCheckSubjects() { final List<PermissionSubject> permissionList = super.getPermissionCheckSubjects(); if (!StringUtils.isEmpty(getParameters().getCustomProperties())) { permissionList.add(new PermissionSubject(getParameters().getVmId(), VdcObjectType.VM, ActionGroup.CHANGE_VM_CUSTOM_PROPERTIES)); } final Guid destinationVdsId = getParameters().getDestinationVdsId(); if (destinationVdsId != null && !destinationVdsId.equals(getVm().getDedicatedVmForVds())) { permissionList.add(new PermissionSubject(getParameters().getVmId(), VdcObjectType.VM, ActionGroup.EDIT_VM_PROPERTIES)); } return permissionList; }

Target:
public List<PermissionSubject> getPermissionCheckSubjects() { final List<PermissionSubject> permissionList = super.getPermissionCheckSubjects(); if (!StringUtils.isEmpty(getParameters().getCustomProperties())) { permissionList.add(new PermissionSubject(getParameters().getVmId(), VdcObjectType.VM, ActionGroup.CHANGE_VM_CUSTOM_PROPERTIES)); } if (getVm() != null) { final Guid destinationVdsId = getParameters().getDestinationVdsId(); if (destinationVdsId != null && !destinationVdsId.equals(getVm().getDedicatedVmForVds())) { permissionList.add(new PermissionSubject(getParameters().getVmId(), VdcObjectType.VM, ActionGroup.EDIT_VM_PROPERTIES)); } } return permissionList; }
Source:
public void testTableTablesWithoutUpgrading() { long tableId = dao.insertTable("schema1", "table1", true, false, null, 0, false); assertNotNull(tableId); }

Target:
public void testTableTablesWithoutUpgrading() { dao.insertTable("schema1", "table1", true, false, null, 0, false); }
Source:
public void set(String name, Property property) throws PropertyException { try { int index = Integer.parseInt(name); children.set(index, property); setIsModified(); } catch (NumberFormatException e) { throw new UnsupportedOperationException("Property name: " + name + " can not be used on property: " + this); } }

Target:
public void set(String name, Property property) throws PropertyException { try { int index = Integer.parseInt(name); children.set(index, property); setIsModified(); } catch (NumberFormatException e) { throw new UnsupportedOperationException("Child name: " + name + " cannot be used on property: " + this); } }
Source:
public <R extends HttpRequest> R bindToRequest(R request, Object input) { List<String> blockIds = (List<String>)input; StringBuilder latestIds = new StringBuilder(); for (String id : blockIds) { latestIds.append("<Latest>").append(id).append("</Latest>"); } final String content = String.format("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<BlockList>%s</BlockList>", latestIds); request.setPayload(content); return request; }

Target:
public <R extends HttpRequest> R bindToRequest(R request, Object input) { List<String> blockIds = (List<String>)input; StringBuilder content = new StringBuilder(); content.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); content.append("<BlockList>"); for (String id : blockIds) { content.append("<Latest>").append(id).append("</Latest>"); } content.append("</BlockList>"); request.setPayload(content.toString()); return request; }
Source:
public static Message updatingRipeMaintainerSSOForbidden() { return new Message(Type.ERROR, "You cannot update sso attributes as maintainer is synchronized in LIR portal"); }

Target:
public static Message updatingRipeMaintainerSSOForbidden() { return new Message(Type.ERROR, "You cannot update SSO auth attribute(s), because the maintainer is synchronised from the LIR Portal"); }
Source:
public DIR.ServiceSet.Builder getOSDs(DIR.ServiceSet.Builder allOSDs) { List<DIR.Service> allServices = allOSDs.getServicesList(); List<DIR.Service> nonPreferredServices = new LinkedList<DIR.Service>(); DIR.Service preferredService = null; for (DIR.Service osd : allServices) { String currentUUID = new ServiceUUID(osd.getUuid()).toString(); if (currentUUID.equals(preferredUUID)) { preferredService = osd; } else { nonPreferredServices.add(osd); } } Collections.shuffle(nonPreferredServices); List<DIR.Service> OSDsInCorrectOrder = new LinkedList<DIR.Service>(); if (preferredService != null) { OSDsInCorrectOrder.add(0, preferredService); } OSDsInCorrectOrder.addAll(nonPreferredServices); return DIR.ServiceSet.newBuilder().addAllServices(OSDsInCorrectOrder); }

Target:
public DIR.ServiceSet.Builder getOSDs(DIR.ServiceSet.Builder allOSDs) { List<DIR.Service> allServices = allOSDs.getServicesList(); List<DIR.Service> nonPreferredServices = new LinkedList<DIR.Service>(); DIR.Service preferredService = null; for (DIR.Service osd : allServices) { String currentUUID = new ServiceUUID(osd.getUuid()).toString(); if (currentUUID.equals(preferredUUID)) { preferredService = osd; } else { nonPreferredServices.add(osd); } } List<DIR.Service> OSDsInCorrectOrder = new LinkedList<DIR.Service>(); if (preferredService != null) { OSDsInCorrectOrder.add(0, preferredService); } OSDsInCorrectOrder.addAll(nonPreferredServices); return DIR.ServiceSet.newBuilder().addAllServices(OSDsInCorrectOrder); }
Source:
protected Guid getUpServerId() { if (brick == null) { return super.getUpServerId(clusterId); } VDS brickServer = getVdsDao().get(brick.getServerId()); if (brickServer.getStatus() == VDSStatus.Up) { return brickServer.getId(); } return super.getUpServerId(clusterId); }

Target:
protected Guid getUpServerId() { if (brick == null) { return getUpServerId(clusterId); } VDS brickServer = getVdsDao().get(brick.getServerId()); if (brickServer.getStatus() == VDSStatus.Up) { return brickServer.getId(); } return super.getUpServerId(clusterId); }
Source:
private boolean isIsoFileValid(String isoFile, OVirtNodeInfo[] Info) { boolean result = false; String pathRepo = null; if (StringUtils.isNotBlank(isoFile)) { for (OVirtNodeInfo infoData: Info) { pathRepo = infoData.path + "/" + isoFile; File path = new File(pathRepo); log.infoFormat("Validating ISOs path: {0}", pathRepo); if (path.exists()) { _isoFullPath = pathRepo; result = true; log.infoFormat("ISO found: {0}", pathRepo); break; } else { log.infoFormat("{0} is not a valid ISO path!", pathRepo); } } } return result; }

Target:
private boolean isIsoFileValid(String isoFile, OVirtNodeInfo[] Info) { boolean result = false; if (StringUtils.isNotBlank(isoFile)) { for (OVirtNodeInfo infoData: Info) { if (infoData.path != null) { File path = new File(infoData.path, isoFile); log.infoFormat("Validating ISOs path: {0}", path); if (path.exists()) { _isoFullPath = path.getAbsolutePath(); result = true; log.infoFormat("ISO found: {0}", path); break; } else { log.infoFormat("{0} is not a valid ISO path!", path); } } } } return result; }
Source:
public boolean tryLock(long time, TimeUnit unit) throws InterruptedException { if (!this.delegate.tryLock(time, unit)) { return false; } try { return doLock(); } catch (Exception e) { this.delegate.unlock(); throw e; } }

Target:
public boolean tryLock(long time, TimeUnit unit) throws InterruptedException { if (!this.delegate.tryLock(time, unit)) { return false; } try { return doLock(); } catch (RuntimeException e) { this.delegate.unlock(); throw e; } }
Source:
public void putAll(final Map<? extends K, ? extends V> entries) throws BulkCacheWritingException { putAllObserver.begin(); statusTransitioner.checkAvailable(); checkNonNull(entries); if(entries.isEmpty()) { putAllObserver.end(PutAllOutcome.SUCCESS); return; } final Map<K, V> entriesToRemap = new HashMap<K, V>(); for (Map.Entry<? extends K, ? extends V> entry: entries.entrySet()) { if (entry.getKey() == null || entry.getValue() == null) { throw new NullPointerException(); } entriesToRemap.put(entry.getKey(), entry.getValue()); } PutAllFunction<K, V> putAllFunction = new PutAllFunction<K, V>(logger, entriesToRemap, runtimeConfiguration.getExpiry()); try { store.bulkCompute(entries.keySet(), putAllFunction); addBulkMethodEntriesCount(BulkOps.PUT_ALL, putAllFunction.getActualPutCount().get()); putAllObserver.end(PutAllOutcome.SUCCESS); } catch (StoreAccessException e) { try { resilienceStrategy.putAllFailure(entries, e); } finally { putAllObserver.end(PutAllOutcome.FAILURE); } } }

Target:
public void putAll(final Map<? extends K, ? extends V> entries) throws BulkCacheWritingException { putAllObserver.begin(); statusTransitioner.checkAvailable(); checkNonNull(entries); if(entries.isEmpty()) { putAllObserver.end(PutAllOutcome.SUCCESS); return; } final Map<K, V> entriesToRemap = new HashMap<K, V>(); for (Map.Entry<? extends K, ? extends V> entry: entries.entrySet()) { if (entry.getKey() == null || entry.getValue() == null) { throw new NullPointerException(); } entriesToRemap.put(entry.getKey(), entry.getValue()); } try { PutAllFunction<K, V> putAllFunction = new PutAllFunction<K, V>(logger, entriesToRemap, runtimeConfiguration.getExpiry()); store.bulkCompute(entries.keySet(), putAllFunction); addBulkMethodEntriesCount(BulkOps.PUT_ALL, putAllFunction.getActualPutCount().get()); putAllObserver.end(PutAllOutcome.SUCCESS); } catch (StoreAccessException e) { try { resilienceStrategy.putAllFailure(entries, e); } finally { putAllObserver.end(PutAllOutcome.FAILURE); } } }
Source:
public void testDataInfo() throws IOException, TasteException { MovieRecommender recommender = new MovieRecommender("/Users/alonso/Documents/big-data-exercises/movies.txt.gz"); assertEquals(7911684, recommender.getTotalReviews()); assertEquals(253059, recommender.getTotalProducts()); assertEquals(889176, recommender.getTotalUsers()); List<String> recommendations = recommender.getRecommendationsForUser("A141HP4LYPWMSR"); assertThat(recommendations, hasItem("B0002O7Y8U")); assertThat(recommendations, hasItem("B00004CQTF")); assertThat(recommendations, hasItem("B000063W82")); }

Target:
public void testDataInfo() throws IOException, TasteException { MovieRecommender recommender = new MovieRecommender("movies.txt.gz"); assertEquals(7911684, recommender.getTotalReviews()); assertEquals(253059, recommender.getTotalProducts()); assertEquals(889176, recommender.getTotalUsers()); List<String> recommendations = recommender.getRecommendationsForUser("A141HP4LYPWMSR"); assertThat(recommendations, hasItem("B0002O7Y8U")); assertThat(recommendations, hasItem("B00004CQTF")); assertThat(recommendations, hasItem("B000063W82")); }
Source:
public void testMdbUsable(Control control) throws Exception { InitialContext ctx = new InitialContext(); QueueConnectionFactory factory = (QueueConnectionFactory) ctx.lookup("ConnectionFactory"); QueueConnection connection = factory.createQueueConnection(); QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue = (Queue) ctx.lookup("java:jboss/exported/jms/queue/test"); QueueSender sender = session.createSender(queue); sender.send(session.createTextMessage(MESSAGE)); control.getLatch().await(); Assert.assertTrue(control.isMessageDelivered()); Assert.assertTrue(control.isContextSet()); }

Target:
public void testMdbUsable(Control control) throws Exception { InitialContext ctx = new InitialContext(); QueueConnectionFactory factory = (QueueConnectionFactory) ctx.lookup("ConnectionFactory"); QueueConnection connection = factory.createQueueConnection(); QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue = (Queue) ctx.lookup(WildFly8EEResourceManager.TEST_QUEUE_DESTINATION); QueueSender sender = session.createSender(queue); sender.send(session.createTextMessage(MESSAGE)); control.getLatch().await(); Assert.assertTrue(control.isMessageDelivered()); Assert.assertTrue(control.isContextSet()); }
Source:
private SchemaTableName parseTableName(String schemaTableName) { try { checkArgument(!isNullOrEmpty(schemaTableName), "schemaTableName is null or is empty"); List<String> parts = Splitter.on('.').splitToList(schemaTableName); checkArgument(parts.size() == 2, "Invalid schemaTableName: %s", schemaTableName); return new SchemaTableName(parts.get(0), parts.get(1)); } catch (IllegalArgumentException iae) { return new SchemaTableName(defaultSchema, schemaTableName); } }

Target:
private SchemaTableName parseTableName(String schemaTableName) { try { checkArgument(!isNullOrEmpty(schemaTableName), "schemaTableName is null or is empty"); List<String> parts = Splitter.on('.').splitToList(schemaTableName); checkArgument(parts.size() == 2, "Invalid schemaTableName: %s", schemaTableName); return new SchemaTableName(parts.get(0), parts.get(1)); } catch (IllegalArgumentException ignored) { return new SchemaTableName(defaultSchema, schemaTableName); } }
Source:
public List<ContainerUUID> getContainersUUID(TemplateLayout layout) { final List<ContainerUUID> containerUUIDS = new ArrayList<>(); if (layout == null) { return containerUUIDS; } final List<TemplateLayoutRow> rows = layout.getBody().getRows(); for (final TemplateLayoutRow row : rows) { final List<TemplateLayoutColumn> columns = row.getColumns(); for (final TemplateLayoutColumn column : columns) { final List<ContainerUUID> columnContainers = column.getContainers(); containerUUIDS.addAll(columnContainers); } } Sidebar sidebar = layout.getSidebar(); if (sidebar != null && sidebar.getContainers() != null) { containerUUIDS.addAll(sidebar.getContainers()); } return containerUUIDS; }

Target:
public List<ContainerUUID> getContainersUUID(TemplateLayout layout) { final List<ContainerUUID> containerUUIDS = new ArrayList<>(); final List<TemplateLayoutRow> rows = layout.getBody().getRows(); for (final TemplateLayoutRow row : rows) { final List<TemplateLayoutColumn> columns = row.getColumns(); for (final TemplateLayoutColumn column : columns) { final List<ContainerUUID> columnContainers = column.getContainers(); containerUUIDS.addAll(columnContainers); } } Sidebar sidebar = layout.getSidebar(); if (sidebar != null && sidebar.getContainers() != null) { containerUUIDS.addAll(sidebar.getContainers()); } return containerUUIDS; }
Source:
public void doPost(final HttpServletRequest req, final HttpServletResponse rsp) throws IOException { if (!UPLOAD_PACK_REQUEST_TYPE.equals(req.getContentType())) { rsp.sendError(SC_UNSUPPORTED_MEDIA_TYPE); return; } if (ClientVersionUtil.hasChunkedRequestBug(req)) { GitSmartHttpTools.sendError(req, rsp, SC_BAD_REQUEST, "\n\n" + HttpServerText.get().clientHas175ChunkedEncodingBug); return; } SmartOutputStream out = new SmartOutputStream(req, rsp) { @Override public void flush() throws IOException { doFlush(); } }; UploadPack up = (UploadPack) req.getAttribute(ATTRIBUTE_HANDLER); try { up.setBiDirectionalPipe(false); rsp.setContentType(UPLOAD_PACK_RESULT_TYPE); up.upload(getInputStream(req), out, null); out.close(); } catch (ServiceMayNotContinueException e) { if (e.isOutput()) { consumeRequestBody(req); out.close(); } else if (!rsp.isCommitted()) { rsp.reset(); sendError(req, rsp, SC_FORBIDDEN, e.getMessage()); } return; } catch (UploadPackInternalServerErrorException e) { getServletContext().log( HttpServerText.get().internalErrorDuringUploadPack, e.getCause()); consumeRequestBody(req); out.close(); } catch (Throwable e) { getServletContext().log(HttpServerText.get().internalErrorDuringUploadPack, e); if (!rsp.isCommitted()) { rsp.reset(); sendError(req, rsp, SC_INTERNAL_SERVER_ERROR); } return; } }

Target:
public void doPost(final HttpServletRequest req, final HttpServletResponse rsp) throws IOException { if (!UPLOAD_PACK_REQUEST_TYPE.equals(req.getContentType())) { rsp.sendError(SC_UNSUPPORTED_MEDIA_TYPE); return; } int[] version = parseVersion(req.getHeader(HDR_USER_AGENT)); if (hasChunkedEncodingRequestBug(version, req)) { GitSmartHttpTools.sendError(req, rsp, SC_BAD_REQUEST, "\n\n" + HttpServerText.get().clientHas175ChunkedEncodingBug); return; } SmartOutputStream out = new SmartOutputStream(req, rsp) { @Override public void flush() throws IOException { doFlush(); } }; UploadPack up = (UploadPack) req.getAttribute(ATTRIBUTE_HANDLER); try { up.setBiDirectionalPipe(false); rsp.setContentType(UPLOAD_PACK_RESULT_TYPE); up.upload(getInputStream(req), out, null); out.close(); } catch (ServiceMayNotContinueException e) { if (e.isOutput()) { consumeRequestBody(req); out.close(); } else if (!rsp.isCommitted()) { rsp.reset(); sendError(req, rsp, SC_FORBIDDEN, e.getMessage()); } return; } catch (UploadPackInternalServerErrorException e) { getServletContext().log( HttpServerText.get().internalErrorDuringUploadPack, e.getCause()); consumeRequestBody(req); out.close(); } catch (Throwable e) { getServletContext().log(HttpServerText.get().internalErrorDuringUploadPack, e); if (!rsp.isCommitted()) { rsp.reset(); sendError(req, rsp, SC_INTERNAL_SERVER_ERROR); } return; } }
Source:
public VisualEditorPageObject clickInsertInfoboxFromInsertToolMenu() { for (int i=0; i<insertMenuTools.size(); i++) { if (insertMenuTools.get(i).getText().contentEquals("Infobox")) { insertMenuTools.get(i).click(); } } return this; }

Target:
public VisualEditorPageObject clickInsertInfoboxFromInsertToolMenu() { wait.forElementVisible(infoboxInDropdownMenu); infoboxInDropdownMenu.click(); return this; }
Source:
public void testDeleteNonEmptyNonRecursiveNonUniqueStoreOnWorkspace() throws Exception { removeStore("sf", "newDataStore"); String store1 = "aa_sf"; String store2 = "zz_sf"; createDataStore("sf", store1); createDataStore("sf", store2); List<DataStoreInfo> dataStoresByWorkspace = catalog.getDataStoresByWorkspace("sf"); assertEquals(3, dataStoresByWorkspace.size()); assertEquals( 200, deleteAsServletResponse(ROOT_PATH + "/workspaces/sf/datastores/" + store1) .getStatus()); assertEquals( 200, deleteAsServletResponse(ROOT_PATH + "/workspaces/sf/datastores/" + store2) .getStatus()); assertNull(catalog.getDataStoreByName("sf", store1)); assertNull(catalog.getDataStoreByName("sf", store2)); }

Target:
public void testDeleteNonEmptyNonRecursiveNonUniqueStoreOnWorkspace() throws Exception { String store1 = "aa_sf"; String store2 = "zz_sf"; createDataStore("sf", store1); createDataStore("sf", store2); try { List<DataStoreInfo> dataStoresByWorkspace = catalog.getDataStoresByWorkspace("sf"); assertEquals(3, dataStoresByWorkspace.size()); assertEquals( 200, deleteAsServletResponse(ROOT_PATH + "/workspaces/sf/datastores/" + store1) .getStatus()); assertEquals( 200, deleteAsServletResponse(ROOT_PATH + "/workspaces/sf/datastores/" + store2) .getStatus()); assertNull(catalog.getDataStoreByName("sf", store1)); assertNull(catalog.getDataStoreByName("sf", store2)); } finally { removeStore("sf", store1); removeStore("sf", store2); } }
Source:
protected void addMemberCheckNull(Object member, boolean addSeparator) { ConditionalExpression cExpression= fAst.newConditionalExpression(); InfixExpression infExpression= fAst.newInfixExpression(); infExpression.setLeftOperand(createMemberAccessExpression(member, true, true)); infExpression.setRightOperand(fAst.newNullLiteral()); infExpression.setOperator(Operator.NOT_EQUALS); cExpression.setExpression(infExpression); SumExpressionBuilder builder= new SumExpressionBuilder(null); for (String a : getContext().getTemplateParser().getBody()) { addElement(processElement(a, member), builder); } if (addSeparator) addElement(getContext().getTemplateParser().getSeparator(), builder); cExpression.setThenExpression(builder.getExpression()); StringLiteral literal= fAst.newStringLiteral(); literal.setLiteralValue(getContext().isSkipNulls() ? "" : "null"); cExpression.setElseExpression(literal); ParenthesizedExpression pExpression= fAst.newParenthesizedExpression(); pExpression.setExpression(cExpression); toStringExpressionBuilder.addExpression(pExpression); }

Target:
protected void addMemberCheckNull(Object member, boolean addSeparator) { ConditionalExpression cExpression= fAst.newConditionalExpression(); InfixExpression infExpression= fAst.newInfixExpression(); infExpression.setLeftOperand(createMemberAccessExpression(member, true, true)); infExpression.setRightOperand(fAst.newNullLiteral()); infExpression.setOperator(Operator.NOT_EQUALS); cExpression.setExpression(infExpression); SumExpressionBuilder builder= new SumExpressionBuilder(null); for (String s : getContext().getTemplateParser().getBody()) { addElement(processElement(s, member), builder); } if (addSeparator) addElement(getContext().getTemplateParser().getSeparator(), builder); cExpression.setThenExpression(builder.getExpression()); StringLiteral literal= fAst.newStringLiteral(); literal.setLiteralValue(getContext().isSkipNulls() ? "" : "null"); cExpression.setElseExpression(literal); ParenthesizedExpression pExpression= fAst.newParenthesizedExpression(); pExpression.setExpression(cExpression); toStringExpressionBuilder.addExpression(pExpression); }
Source:
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { DiagramElementsSelectionDialog dlg = new DiagramElementsSelectionDialog(Messages.SelectPinnedElementsAction_label, Messages.PinnedElementsSelectionCommand_messageTitle); dlg.setSelectionPredicate(isPinned); dlg.setSelectedAction(pinElement); dlg.setDeselectedAction(unpinElement); dlg.setGrayedPredicate(getNonSelectablePredicate()); boolean executed = dlg.open(getShell(), diagram, false); if (executed) { return CommandResult.newOKCommandResult(); } else { return CommandResult.newCancelledCommandResult(); } }

Target:
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { DiagramElementsSelectionDialog dlg = new DiagramElementsSelectionDialog(Messages.SelectPinnedElementsAction_label, Messages.PinnedElementsSelectionCommand_dialogMessage); dlg.setSelectionPredicate(isPinned); dlg.setSelectedAction(pinElement); dlg.setDeselectedAction(unpinElement); dlg.setGrayedPredicate(getNonSelectablePredicate()); boolean executed = dlg.open(getShell(), diagram, false); if (executed) { return CommandResult.newOKCommandResult(); } else { return CommandResult.newCancelledCommandResult(); } }
Source:
public String convertToNormalizedHTML(String inputHTML) throws SAXException, IOException, TransformerException { DOMParser parser = new DOMParser(); Document doc = null; String resultString = ""; InputSource source = new InputSource(new StringReader(inputHTML)); parser.setProperty(HTMLConfig.getNamesElementFeature(), "lower"); parser.setProperty(HTMLConfig.getNamesAttrFeatures(), "lower"); parser.parse(source); doc = parser.getDocument(); doc.normalizeDocument(); Element elem = doc.getDocumentElement(); Node node = elem.getFirstChild(); while (node != null) { node = processNodeWithChildren(node, doc); node = node.getNextSibling(); } TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); DOMSource DOMsource = new DOMSource(doc); ByteArrayOutputStream output = new ByteArrayOutputStream(); StreamResult result = new StreamResult(output); transformer.transform(DOMsource, result); resultString = output.toString("UTF-8"); return resultString; }

Target:
public String convertToNormalizedHTML(String inputHTML) throws SAXException, IOException, TransformerException { DOMParser parser = new DOMParser(); InputSource source = new InputSource(new StringReader(inputHTML)); parser.setProperty(HTMLConfig.getNamesElementFeature(), "lower"); parser.setProperty(HTMLConfig.getNamesAttrFeature(), "lower"); parser.parse(source); Document doc = parser.getDocument(); doc.normalizeDocument(); Element elem = doc.getDocumentElement(); Node node = elem.getFirstChild(); while (node != null) { node = processNodeWithChildren(node, doc); node = node.getNextSibling(); } TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); DOMSource DOMsource = new DOMSource(doc); ByteArrayOutputStream output = new ByteArrayOutputStream(); StreamResult result = new StreamResult(output); transformer.transform(DOMsource, result); return output.toString("UTF-8"); }
Source:
public List<String> listCatalogs(String sessionid) throws SqlExecutionException { return null; }

Target:
public List<String> listCatalogs(String sessionid) throws SqlExecutionException { throw new UnsupportedOperationException("Not implemented."); }
Source:
public DataSharingSettings load() { if (cachedSettings == null) { cachedSettings = transactionTemplate.execute(status -> (DataSharingSettings) sessionFactory.getCurrentSession().getNamedQuery("load.datasharing.settings").uniqueResult()); } return cachedSettings; }

Target:
public DataSharingSettings load() { String cacheKey = cacheKeyForDataSharingSettings(); DataSharingSettings settings = (DataSharingSettings) goCache.get(cacheKey); if (settings == null) { synchronized (cacheKey) { if (settings == null) { settings = transactionTemplate.execute(status -> (DataSharingSettings) sessionFactory.getCurrentSession().getNamedQuery("load.datasharing.settings").uniqueResult()); goCache.put(cacheKey, settings); } } } return settings; }
Source:
public Repository lookupRepository(final File gitDir) throws IOException { File normalizedGitDir = new Path(gitDir.getAbsolutePath()).toFile(); synchronized (repositoryCache) { Reference<Repository> r = repositoryCache.get(normalizedGitDir); Repository result = r != null ? r.get() : null; if (result == null || !result.getDirectory().exists()) { result = FileRepositoryBuilder.create(normalizedGitDir); repositoryCache.put(normalizedGitDir, new WeakReference<>(result)); } return result; } }

Target:
public Repository lookupRepository(final File gitDir) throws IOException { File normalizedGitDir = new Path(gitDir.getAbsolutePath()).toFile(); synchronized (repositoryCache) { Reference<Repository> r = repositoryCache.get(normalizedGitDir); if (r == null) { Repository result = FileRepositoryBuilder .create(normalizedGitDir); repositoryCache.put(normalizedGitDir, new WeakReference<>(result)); return result; } else { Repository result = r.get(); if (result != null && result.getDirectory().exists()) { return result; } else { repositoryCache.remove(normalizedGitDir); } } } IndexDiffCache cache = Activator.getDefault().getIndexDiffCache(); if (cache != null) { cache.remove(normalizedGitDir); } return lookupRepository(gitDir); }
Source:
public boolean isKeyRequired() { return keyParts.stream().noneMatch(k -> k.isRequired() || k.getDefaultValue() != null); }

Target:
public boolean isKeyRequired() { return keyParts.stream().anyMatch(ParameterModel::isRequired); }
Source:
ClientMetadata(final String endPoint) { hostInfo = endPoint != null ? HostInfo.buildFromEndpoint(endPoint) : null; consumers = new HashSet<>(); state = new ClientState(); }

Target:
ClientMetadata(final String endPoint) { hostInfo = HostInfo.buildFromEndpoint(endPoint); consumers = new HashSet<>(); state = new ClientState(); }
Source:
public void run() { Set<SubscriptionInfo> subscriptions = new HashSet<>(); for (Product product : products) { Collection<? extends SubscriptionInfo> subs = subAdapter .getSubscriptionsByProductId(product.getId()); log.debug("Will refresh subscriptions in all orgs using product: ", subs.size(), product.getId()); if (log.isDebugEnabled()) { for (SubscriptionInfo s : subs) { OwnerInfo so = s.getOwner(); if (so == null || so.getKey() == null) { log.debug(" Received a subscription without a well-defined owner: {}", s.getId()); continue; } if (!this.owners.containsKey(so.getKey())) { log.debug(" {}", s); } } } subscriptions.addAll(subs); } for (SubscriptionInfo subscription : subscriptions) { OwnerInfo so = subscription.getOwner(); if (so == null || so.getKey() == null) { log.error("Received a subscription without a well-defined owner: {}", subscription.getId()); continue; } if (this.owners.containsKey(so.getKey())) { log.debug("Skipping subscription \"{}\" for owner: {}", subscription.getId(), so); continue; } Pool masterPool = poolManager.convertToMasterPool(subscription); masterPool.setLocked(true); poolManager.refreshPoolsForMasterPool(masterPool, true, lazy, Collections.<String, Product>emptyMap()); } for (Owner owner : this.owners.values()) { poolManager.refreshPoolsWithRegeneration(this.subAdapter, owner, this.lazy); poolManager.recalculatePoolQuantitiesForOwner(owner); ownerManager.refreshContentAccessMode(this.ownerAdapter, owner); ownerManager.updateRefreshDate(owner); } }

Target:
public void run() { Set<SubscriptionInfo> subscriptions = new HashSet<>(); for (Product product : products) { Collection<? extends SubscriptionInfo> subs = subAdapter .getSubscriptionsByProductId(product.getId()); log.debug("Will refresh subscriptions in all orgs using product: ", subs.size(), product.getId()); if (log.isDebugEnabled()) { for (SubscriptionInfo s : subs) { OwnerInfo so = s.getOwner(); if (so == null || so.getKey() == null) { log.debug(" Received a subscription without a well-defined owner: {}", s.getId()); continue; } if (!this.owners.containsKey(so.getKey())) { log.debug(" {}", s); } } } subscriptions.addAll(subs); } for (SubscriptionInfo subscription : subscriptions) { OwnerInfo so = subscription.getOwner(); if (so == null || so.getKey() == null) { log.error("Received a subscription without a well-defined owner: {}", subscription.getId()); continue; } if (this.owners.containsKey(so.getKey())) { log.debug("Skipping subscription \"{}\" for owner: {}", subscription.getId(), so); continue; } Pool masterPool = poolManager.convertToMasterPool(subscription); poolManager.refreshPoolsForMasterPool(masterPool, true, lazy, Collections.<String, Product>emptyMap()); } for (Owner owner : this.owners.values()) { poolManager.refreshPoolsWithRegeneration(this.subAdapter, owner, this.lazy); poolManager.recalculatePoolQuantitiesForOwner(owner); ownerManager.refreshContentAccessMode(this.ownerAdapter, owner); ownerManager.updateRefreshDate(owner); } }
Source:
public IStatus validate(final IProject project, final String path) { IStatus validTrace = Status.OK_STATUS; try { final CTFTrace temp = new CTFTrace(path); if (!temp.majortIsSet()) { validTrace = new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.CtfTmfTrace_MajorNotSet); } else { CTFTraceReader ctfTraceReader = new CTFTraceReader(temp); if (!ctfTraceReader.hasMoreEvents()) { validTrace = new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.CtfTmfTrace_NoEvent); } ctfTraceReader.dispose(); } temp.dispose(); } catch (final CTFReaderException e) { validTrace = new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.CtfTmfTrace_ReadingError +": " + e.toString()); } catch (final BufferOverflowException e){ validTrace = new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.CtfTmfTrace_ReadingError +": " + Messages.CtfTmfTrace_bufferOverflowErrorMessage ); } return validTrace; }

Target:
public IStatus validate(final IProject project, final String path) { IStatus validTrace = Status.OK_STATUS; try { final CTFTrace temp = new CTFTrace(path); if (!temp.majortIsSet()) { validTrace = new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.CtfTmfTrace_MajorNotSet); } else { CTFTraceReader ctfTraceReader = new CTFTraceReader(temp); if (!ctfTraceReader.hasMoreEvents()) { validTrace = new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.CtfTmfTrace_NoEvent); } ctfTraceReader.dispose(); } temp.dispose(); } catch (final CTFReaderException e) { validTrace = new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.CtfTmfTrace_ReadingError +": " + e.toString()); } catch (final BufferOverflowException e){ validTrace = new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.CtfTmfTrace_ReadingError +": " + Messages.CtfTmfTrace_BufferOverflowErrorMessage); } return validTrace; }
Source:
public void resourceChanged(IResourceChangeEvent event) { if (event.getType() == IResourceChangeEvent.PRE_DELETE && event.getResource().getType() == IResource.PROJECT) { IProject aboutToBeDeleted = (IProject) event.getResource(); IContainer parent = getParent(aboutToBeDeleted); if (parent != null) { parentsToRefresh.add(parent); } } else if (event.getType() == IResourceChangeEvent.POST_CHANGE) { if (event.getDelta().getKind() == IResourceDelta.CHANGED && event.getDelta().getResource().getType() == IResource.ROOT) { for (IResourceDelta delta : event.getDelta().getAffectedChildren()) { if (delta.getResource().getType() == IResource.PROJECT && delta.getKind() == IResourceDelta.ADDED) { IProject newProject = (IProject) delta.getResource(); IContainer parent = getParent(newProject); if (parent != null) { parentsToRefresh.add(parent); } } } } if (!parentsToRefresh.isEmpty()) { this.viewer.getTree().getDisplay().asyncExec(new Runnable() { @Override public void run() { for (IContainer parent : parentsToRefresh) { NestedProjectsContentProvider.this.viewer.refresh(parent); } parentsToRefresh.clear(); } }); } } }

Target:
public void resourceChanged(IResourceChangeEvent event) { IResource resource = event.getResource(); if (event.getType() == IResourceChangeEvent.PRE_DELETE && resource != null && resource.getType() == IResource.PROJECT) { IProject aboutToBeDeleted = (IProject) resource; IContainer parent = getParent(aboutToBeDeleted); if (parent != null) { parentsToRefresh.add(parent); } } else if (event.getType() == IResourceChangeEvent.POST_CHANGE) { IResourceDelta delta = event.getDelta(); if (delta != null) { resource = delta.getResource(); if (delta.getKind() == IResourceDelta.CHANGED && resource != null && resource.getType() == IResource.ROOT) { for (IResourceDelta childDelta : event.getDelta().getAffectedChildren()) { IResource childResource = childDelta.getResource(); if (childResource != null && childResource.getType() == IResource.PROJECT && childDelta.getKind() == IResourceDelta.ADDED) { IProject newProject = (IProject) childResource; IContainer parent = getParent(newProject); if (parent != null) { parentsToRefresh.add(parent); } } } } } if (!parentsToRefresh.isEmpty()) { this.viewer.getTree().getDisplay().asyncExec(new Runnable() { @Override public void run() { for (IContainer parent : parentsToRefresh) { NestedProjectsContentProvider.this.viewer.refresh(parent); } parentsToRefresh.clear(); } }); } } }
Source:
public boolean isFinished() { if (finished) { return true; } boolean finished = finishing && probe == null && pageBuilder.isEmpty() && outputPage == null; if (finished) { close(); } return finished; }

Target:
public boolean isFinished() { boolean finished = this.finished && probe == null && pageBuilder.isEmpty() && outputPage == null; if (finished) { close(); } return finished; }
Source:
protected URI[] getSelectedLocations(Object[] selectionArray) { List<URI> urls = new ArrayList<>(); for (Object element : selectionArray) { if (element instanceof MetadataRepositoryElement) urls.add(((MetadataRepositoryElement) element).getLocation()); } return urls.toArray(new URI[urls.size()]); }

Target:
protected URI[] getSelectedLocations(Object[] selectionArray) { List<URI> urls = new ArrayList<>(); for (Object element : selectionArray) { if (element instanceof MetadataRepositoryElement) { urls.add(((MetadataRepositoryElement) element).getLocation()); } } return urls.toArray(new URI[urls.size()]); }
Source:
private void persistEngineSession(String sessionId) { SessionInfo sessionInfo = getSessionInfo(sessionId); if (sessionInfo != null) { EngineSession engineSession = new EngineSession(); engineSession.setEngineSessionId(sessionId); DbUser user = getUser(sessionId, false); engineSession.setUserId(user.getId()); engineSession.setUserName(user.getLoginName()); engineSession.setGroupIds(user.getGroupIds()); sessionToIdMap.put(sessionId, getDbFacade().getEngineSessionDao().save(engineSession)); } }

Target:
private void persistEngineSession(String sessionId) { SessionInfo sessionInfo = getSessionInfo(sessionId); if (sessionInfo != null) { EngineSession engineSession = new EngineSession(); engineSession.setEngineSessionId(sessionId); DbUser user = getUser(sessionId, false); engineSession.setUserId(user.getId()); engineSession.setUserName(user.getLoginName()); engineSession.setGroupIds(user.getGroupIds()); sessionInfo.contentOfSession.put(ENGINE_SESSION_SEQ_ID, getDbFacade().getEngineSessionDao().save(engineSession)); } }
Source:
private static boolean validSortLimit(Sort sort, DruidQuery query) { if (sort.offset != null && RexLiteral.intValue(sort.offset) != 0) { return false; } if (query.getTopNode() instanceof Aggregate) { final Aggregate topAgg = (Aggregate) query.getTopNode(); final ImmutableBitSet.Builder positionsReferenced = ImmutableBitSet.builder(); int metricsRefs = 0; for (RelFieldCollation col : sort.collation.getFieldCollations()) { int idx = col.getFieldIndex(); if (idx >= topAgg.getGroupCount()) { metricsRefs++; continue; } positionsReferenced.set(topAgg.getGroupSet().nth(idx)); } if (checkIsFlooringTimestampRefOnQuery(topAgg.getGroupSet(), topAgg.getInput(), query) && topAgg.getGroupCount() == 1) { return !RelOptUtil.isLimit(sort) && sort.collation.getFieldCollations().size() == 1 && checkTimestampRefOnQuery(positionsReferenced.build(), topAgg.getInput(), query); } return true; } return RelOptUtil.isPureLimit(sort); }

Target:
private static boolean validSortLimit(Sort sort, DruidQuery query) { if (sort.offset != null && RexLiteral.intValue(sort.offset) != 0) { return false; } if (query.getTopNode() instanceof Aggregate) { final Aggregate topAgg = (Aggregate) query.getTopNode(); final ImmutableBitSet.Builder positionsReferenced = ImmutableBitSet.builder(); for (RelFieldCollation col : sort.collation.getFieldCollations()) { int idx = col.getFieldIndex(); if (idx >= topAgg.getGroupCount()) { continue; } positionsReferenced.set(topAgg.getGroupSet().nth(idx)); } if (checkIsFlooringTimestampRefOnQuery(topAgg.getGroupSet(), topAgg.getInput(), query) && topAgg.getGroupCount() == 1) { return !RelOptUtil.isLimit(sort) && sort.collation.getFieldCollations().size() == 1 && checkTimestampRefOnQuery(positionsReferenced.build(), topAgg.getInput(), query); } return true; } return RelOptUtil.isPureLimit(sort); }
Source:
private void sendErrorFrame(String message, String description, ChannelHandlerContext ctx) { StompFrame errorFrame = new DefaultStompFrame(StompCommand.ERROR); errorFrame.headers().set(MESSAGE, message); if (description != null) { ByteBuf content = encodeString(ctx.alloc(), CharBuffer.wrap(description), UTF_8); errorFrame.content().writeBytes(content); } ctx.writeAndFlush(errorFrame).addListener(ChannelFutureListener.CLOSE); }

Target:
private static void sendErrorFrame(String message, String description, ChannelHandlerContext ctx) { StompFrame errorFrame = new DefaultStompFrame(StompCommand.ERROR); errorFrame.headers().set(MESSAGE, message); if (description != null) { errorFrame.content().writeCharSequence(description, CharsetUtil.UTF_8); } ctx.writeAndFlush(errorFrame).addListener(ChannelFutureListener.CLOSE); }