auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public int delete(String table, String key) { try { MongoCollection<Document> collection = database.getCollection(table); Document query = new Document("_id", key); DeleteResult result = collection.withWriteConcern(writeConcern).deleteOne(query); if (result.wasAcknowledged() && result.getDeletedCount() == 0) { System.err.println("Nothing deleted for key " + key); return StatusCode.ERROR; } return StatusCode.OK; } catch (Exception e) { System.err.println(e.toString()); return StatusCode.ERROR; } }

Target:
public Status delete(String table, String key) { try { MongoCollection<Document> collection = database.getCollection(table); Document query = new Document("_id", key); DeleteResult result = collection.withWriteConcern(writeConcern).deleteOne(query); if (result.wasAcknowledged() && result.getDeletedCount() == 0) { System.err.println("Nothing deleted for key " + key); return Status.NOT_FOUND; } return Status.OK; } catch (Exception e) { System.err.println(e.toString()); return Status.ERROR; } }
Source:
private ValidationResult validateExternalNetwork() { if (!getNetwork().getProvidedBy().isSetPhysicalNetworkId()) { return ValidationResult.VALID; } Network physicalNetwork = networkDao.get(getNetwork().getProvidedBy().getPhysicalNetworkId()); return ValidationResult.failWith(EngineMessage.ACTIVATE_DEACTIVATE_NETWORK_NOT_IN_VDS) .when(!networkAttachedToVds(physicalNetwork.getName(), getVdsId())); }

Target:
private ValidationResult validateExternalNetwork() { if (!getNetwork().getProvidedBy().isSetPhysicalNetworkId()) { return ValidationResult.VALID; } Network physicalNetwork = networkDao.get(getNetwork().getProvidedBy().getPhysicalNetworkId()); return ValidationResult.failWith(EngineMessage.PHYSICAL_NETWORK_LINKED_TO_EXTERNAL_NOT_IN_VDS) .when(!networkAttachedToVds(physicalNetwork.getName(), getVdsId())); }
Source:
protected void parse(AddressParametersHeader addressParametersHeader) throws ParseException { dbg_enter("AddressParametersParser.parse"); try { AddressParser addressParser = new AddressParser(this.getLexer()); AddressImpl addr = addressParser.address(false); addressParametersHeader.setAddress(addr); lexer.SPorHT(); char la = this.lexer.lookAhead(0); if ( this.lexer.hasMoreChars() && la != '\0' && la != '\n' && this.lexer.startsId()) { super.parseNameValueList(addressParametersHeader); } else { lexer.SPorHT(); if (this.lexer.lookAhead(0) == ';') { if (this.allowParameters == false) { throw new ParseException(this.lexer.getBuffer() + "is not valid. This Header Field cannot has Parameters" , this.lexer.getPtr()); } } super.parse(addressParametersHeader); } } catch (ParseException ex) { throw ex; } finally { dbg_leave("AddressParametersParser.parse"); } }

Target:
protected void parse(AddressParametersHeader addressParametersHeader) throws ParseException { dbg_enter("AddressParametersParser.parse"); try { AddressParser addressParser = new AddressParser(this.getLexer()); AddressImpl addr = addressParser.address(false); addressParametersHeader.setAddress(addr); lexer.SPorHT(); char la = this.lexer.lookAhead(0); if ( this.lexer.hasMoreChars() && la != '\0' && la != '\n' && this.lexer.startsId()) { super.parseNameValueList(addressParametersHeader); } else { if (this.allowParameters == false) { lexer.SPorHT(); if (this.lexer.lookAhead(0) == ';') { throw new ParseException(this.lexer.getBuffer() + "is not valid. This Header Field cannot has Parameters" , this.lexer.getPtr()); } } super.parse(addressParametersHeader); } } catch (ParseException ex) { throw ex; } finally { dbg_leave("AddressParametersParser.parse"); } }
Source:
public void updataMaxVmsInPool() { AsyncDataProvider.getInstance().getInstance().getMaxVmsInPool(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { VmModelBehaviorBase behavior = (VmModelBehaviorBase) target; behavior.setMaxVmsInPool((Integer) returnValue); behavior.updateMaxNumOfVmCpus(); } } )); }

Target:
public void updataMaxVmsInPool() { AsyncDataProvider.getInstance().getMaxVmsInPool(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { VmModelBehaviorBase behavior = (VmModelBehaviorBase) target; behavior.setMaxVmsInPool((Integer) returnValue); behavior.updateMaxNumOfVmCpus(); } } )); }
Source:
private void disableRequestChunkingIfNecessary(Client client, Invocation.Builder requestBuilder) { if (client instanceof org.apache.cxf.jaxrs.client.spec.ClientImpl) { if (LOG.isDebugEnabled()) { LOG.debug("disableRequestChunkingIfNecessary: Explicitly disabling chunking because KFS is using a CXF JAX-RS client"); } ClientConfiguration cxfConfig = WebClient.getConfig(requestBuilder); HTTPConduit conduit = cxfConfig.getHttpConduit(); HTTPClientPolicy clientPolicy = conduit.getClient(); clientPolicy.setAllowChunking(false); } else if (LOG.isDebugEnabled()) { LOG.debug("disableRequestChunkingIfNecessary: The JAX-RS client implementation does not need to explicitly disable chunking"); } }

Target:
private void disableRequestChunkingIfNecessary(Client client, Invocation.Builder requestBuilder) { if (client instanceof org.apache.cxf.jaxrs.client.spec.ClientImpl) { LOG.info("disableRequestChunkingIfNecessary: Explicitly disabling chunking because KFS is using a JAX-RS client of CXF type " + client.getClass().getName()); ClientConfiguration cxfConfig = WebClient.getConfig(requestBuilder); HTTPConduit conduit = cxfConfig.getHttpConduit(); HTTPClientPolicy clientPolicy = conduit.getClient(); clientPolicy.setAllowChunking(false); } else { LOG.info("disableRequestChunkingIfNecessary: There is no need to explicitly disable chunking for a JAX-RS client of type " + client.getClass().getName()); } }
Source:
protected void onNewIntent(Intent intent) { super.onNewIntent(intent); if (mNotificationManager == null) { mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); } if (mBuilder == null) { mBuilder = (NotificationCompat.Builder) new NotificationCompat.Builder(this) .setContentTitle(getString(R.string.notif_title)) .setColor(ContextCompat.getColor(this, R.color.notif_background)); } String action = intent.getAction(); String type = intent.getType(); if (Intent.ACTION_SEND.equals(action) && type != null) { if ("text/plain".equals(type)) { handleSentText(intent); } else { handleSentFile((Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM)); } } String filePath = intent.getStringExtra(Intent.EXTRA_TEXT); if (action == null) { if (!TextUtils.isEmpty(filePath)) { File photoFile = new File(filePath); uploadFile(photoFile); } else { dispatchTakePictureIntent(); } } else if (action.equals(ACTION_MESSAGE_PUSH_NOTIFICATION)) { } }

Target:
protected void onNewIntent(Intent intent) { super.onNewIntent(intent); if (mNotificationManager == null) { mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); } if (mBuilder == null) { mBuilder = (NotificationCompat.Builder) new NotificationCompat.Builder(this) .setContentTitle(getString(R.string.notif_title)) .setColor(ContextCompat.getColor(this, R.color.notif_background)); } String action = intent.getAction(); String type = intent.getType(); if (Intent.ACTION_SEND.equals(action) && type != null) { if ("text/plain".equals(type)) { handleSentText(intent); } else { handleSentFile((Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM)); } } else if (ACTION_MESSAGE_PUSH_NOTIFICATION.equals(action)) { return; } String filePath = intent.getStringExtra(Intent.EXTRA_TEXT); if (action == null) { if (!TextUtils.isEmpty(filePath)) { File photoFile = new File(filePath); uploadFile(photoFile); } else { dispatchTakePictureIntent(); } } }
Source:
public OwApplicability getOrCreateApplicability(OwArtifact artifact) { OwApplicability app = null; app = artifact.getAppId(); if (app == null) { app = new OwApplicability(); artifact.setAppId(app); } return app; }

Target:
public OwApplicability getOrCreateApplicability(OwArtifact artifact) { OwApplicability app = artifact.getAppId(); if (app == null) { app = new OwApplicability(); artifact.setAppId(app); } return app; }
Source:
public void write(DataIdentifier identifier, File file) throws DataStoreException { File dest = getFile(identifier, fsPathDir); if (dest.exists()) { long now = System.currentTimeMillis(); if (getLastModified(dest) < now + ACCESS_TIME_RESOLUTION) { setLastModified(dest, now + ACCESS_TIME_RESOLUTION); } } else { try { File parent = dest.getParentFile(); parent.mkdirs(); if (file.renameTo(dest)) { file = null; } else { throw new IOException( "Can not rename " + file.getAbsolutePath() + " to " + dest.getAbsolutePath() + " (media read only?)"); } } catch (IOException ie) { LOG.error("failed to copy to [{}]", file.getAbsolutePath(), dest.getAbsolutePath()); throw new DataStoreException("Not able to write file [" + identifier + "]", ie); } } }

Target:
public void write(DataIdentifier identifier, File file) throws DataStoreException { TransientFileFactory fileFactory = TransientFileFactory.getInstance(); File tmpFile = null; File dest = getFile(identifier, fsPathDir); if(dest.exists()) { long now = System.currentTimeMillis(); if (getLastModified(dest) < now + ACCESS_TIME_RESOLUTION) { setLastModified(dest, now + ACCESS_TIME_RESOLUTION); } } else { try { tmpFile = fileFactory.createTransientFile("fsbackend", null, fsPathDir); try { FileUtils.copyFile(file, tmpFile); } catch (IOException ie) { LOG.error("failed to copy to temporary file [{}]", file.getAbsolutePath(), tmpFile.getAbsolutePath()); throw new DataStoreException("Not able to copy file [" + identifier + "] to temporary file", ie); } File parent = dest.getParentFile(); parent.mkdirs(); synchronized (this) { if (tmpFile.renameTo(dest)) { tmpFile = null; } else { throw new IOException( "Can not rename " + tmpFile.getAbsolutePath() + " to " + dest.getAbsolutePath() + " (media read only?)"); } } } catch (IOException e) { throw new DataStoreException("Could not add record", e); } finally { if (tmpFile != null) { tmpFile.delete(); } } } }
Source:
public PostAggregator toPostAggregator( PlannerContext plannerContext, RowSignature rowSignature, RexNode rexNode, PostAggregatorVisitor postAggregatorVisitor ) { final List<RexNode> operands = ((RexCall) rexNode).getOperands(); final List<PostAggregator> inputPostAggs = new ArrayList<>(); Integer lgK = null; String tgtHllType = null; int operandCounter = 0; for (RexNode operand : operands) { final PostAggregator convertedPostAgg = OperatorConversions.toPostAggregator( plannerContext, rowSignature, operand, postAggregatorVisitor ); if (convertedPostAgg == null) { if (operandCounter == 0) { try { lgK = RexLiteral.intValue(operand); } catch (RuntimeException re) { return null; } } else if (operandCounter == 1) { if (lgK == null) { return null; } try { tgtHllType = RexLiteral.stringValue(operand); } catch (RuntimeException re) { return null; } } else { return null; } } else { inputPostAggs.add(convertedPostAgg); operandCounter++; } } return new HllSketchUnionPostAggregator( postAggregatorVisitor.getOutputNamePrefix() + postAggregatorVisitor.getAndIncrementCounter(), inputPostAggs, lgK, tgtHllType ); }

Target:
public PostAggregator toPostAggregator( PlannerContext plannerContext, RowSignature rowSignature, RexNode rexNode, PostAggregatorVisitor postAggregatorVisitor ) { final List<RexNode> operands = ((RexCall) rexNode).getOperands(); final List<PostAggregator> inputPostAggs = new ArrayList<>(); Integer lgK = null; String tgtHllType = null; int operandCounter = 0; for (RexNode operand : operands) { final PostAggregator convertedPostAgg = OperatorConversions.toPostAggregator( plannerContext, rowSignature, operand, postAggregatorVisitor ); if (convertedPostAgg == null) { if (operandCounter == 0) { if (!operand.isA(SqlKind.LITERAL)) { return null; } try { lgK = RexLiteral.intValue(operand); } catch (ClassCastException re) { return null; } } else if (operandCounter == 1) { if (!operand.isA(SqlKind.LITERAL)) { return null; } if (lgK == null) { return null; } try { tgtHllType = RexLiteral.stringValue(operand); } catch (ClassCastException re) { return null; } } else { return null; } } else { inputPostAggs.add(convertedPostAgg); operandCounter++; } } return new HllSketchUnionPostAggregator( postAggregatorVisitor.getOutputNamePrefix() + postAggregatorVisitor.getAndIncrementCounter(), inputPostAggs, lgK, tgtHllType ); }
Source:
public void testSanity() throws Exception { File baseDir = Files.createTempDir(); baseDir.deleteOnExit(); try { FileSmoosher smoosher = new FileSmoosher(baseDir, 21); for (int i = 0; i < 20; ++i) { File tmpFile = File.createTempFile(String.format("smoosh-%s", i), ".bin"); tmpFile.deleteOnExit(); Files.write(Ints.toByteArray(i), tmpFile); smoosher.add(String.format("%d", i), tmpFile); tmpFile.delete(); } smoosher.close(); File[] files = baseDir.listFiles(); Arrays.sort(files); Assert.assertEquals(5, files.length); for (int i = 0; i < 4; ++i) { Assert.assertEquals(FileSmoosher.makeChunkFile(baseDir, i), files[i]); } Assert.assertEquals(FileSmoosher.metaFile(baseDir), files[files.length - 1]); SmooshedFileMapper mapper = SmooshedFileMapper.load(baseDir); for (int i = 0; i < 20; ++i) { ByteBuffer buf = mapper.mapFile(String.format("%d", i)); Assert.assertEquals(0, buf.position()); Assert.assertEquals(4, buf.remaining()); Assert.assertEquals(4, buf.capacity()); Assert.assertEquals(i, buf.getInt()); } mapper.close(); } finally { for (File file : baseDir.listFiles()) { file.delete(); } } }

Target:
public void testSanity() throws Exception { File baseDir = folder.newFolder("base"); try (FileSmoosher smoosher = new FileSmoosher(baseDir, 21)) { for (int i = 0; i < 20; ++i) { File tmpFile = folder.newFile(String.format("smoosh-%s.bin", i)); Files.write(Ints.toByteArray(i), tmpFile); smoosher.add(String.format("%d", i), tmpFile); } } File[] files = baseDir.listFiles(); Arrays.sort(files); Assert.assertEquals(5, files.length); for (int i = 0; i < 4; ++i) { Assert.assertEquals(FileSmoosher.makeChunkFile(baseDir, i), files[i]); } Assert.assertEquals(FileSmoosher.metaFile(baseDir), files[files.length - 1]); try (SmooshedFileMapper mapper = SmooshedFileMapper.load(baseDir)) { for (int i = 0; i < 20; ++i) { ByteBuffer buf = mapper.mapFile(String.format("%d", i)); Assert.assertEquals(0, buf.position()); Assert.assertEquals(4, buf.remaining()); Assert.assertEquals(4, buf.capacity()); Assert.assertEquals(i, buf.getInt()); } } }
Source:
public void closeEditors() { IFile file = getBookmarksFile(); FileEditorInput input = new FileEditorInput(file); IWorkbench wb = PlatformUI.getWorkbench(); for (IWorkbenchWindow wbWindow : wb.getWorkbenchWindows()) { for (IWorkbenchPage wbPage : wbWindow.getPages()) { for (IEditorReference editorReference : wbPage.getEditorReferences()) { try { if (editorReference.getEditorInput().equals(input)) { wbPage.closeEditor(editorReference.getEditor(false), false); } } catch (PartInitException e) { e.printStackTrace(); } } } } if (getParent() instanceof TmfTraceFolder) { TmfExperimentFolder experimentFolder = getProject().getExperimentsFolder(); for (ITmfProjectModelElement experiment : experimentFolder.getChildren()) { for (ITmfProjectModelElement child : experiment.getChildren()) { if (child.getName().equals(getName())) { ((TmfExperimentElement) experiment).closeEditors(); break; } } } } else if (getParent() instanceof TmfExperimentElement) { TmfExperimentElement experiment = (TmfExperimentElement) getParent(); experiment.closeEditors(); } }

Target:
public void closeEditors() { IFile file = getBookmarksFile(); FileEditorInput input = new FileEditorInput(file); IWorkbench wb = PlatformUI.getWorkbench(); for (IWorkbenchWindow wbWindow : wb.getWorkbenchWindows()) { for (IWorkbenchPage wbPage : wbWindow.getPages()) { for (IEditorReference editorReference : wbPage.getEditorReferences()) { try { if (editorReference.getEditorInput().equals(input)) { wbPage.closeEditor(editorReference.getEditor(false), false); } } catch (PartInitException e) { Activator.getDefault().logError("Error closing editor for trace " + getName(), e); } } } } if (getParent() instanceof TmfTraceFolder) { TmfExperimentFolder experimentFolder = getProject().getExperimentsFolder(); for (ITmfProjectModelElement experiment : experimentFolder.getChildren()) { for (ITmfProjectModelElement child : experiment.getChildren()) { if (child.getName().equals(getName())) { ((TmfExperimentElement) experiment).closeEditors(); break; } } } } else if (getParent() instanceof TmfExperimentElement) { TmfExperimentElement experiment = (TmfExperimentElement) getParent(); experiment.closeEditors(); } }
Source:
public Security withoutSecurity() { String bsUrl = "coap://" + bootstrapServer.getUnsecuredAddress().getHostString() + ":" + bootstrapServer.getUnsecuredAddress().getPort(); return new Security(bsUrl, true, 3, new byte[0], new byte[0], new byte[0], 0, CertificateUsage.DOMAIN_ISSUER_CERTIFICATE.code); }

Target:
public Security withoutSecurity() { String bsUrl = "coap://" + bootstrapServer.getUnsecuredAddress().getHostString() + ":" + bootstrapServer.getUnsecuredAddress().getPort(); return Security.noSecBootstap(bsUrl); }
Source:
public void setUp() { account = CloudantClientHelper.getClient(); db = account.database("lightcouch-db-test", true); db.syncDesignDocsWithDb(); }

Target:
public void setUp() { account = CloudantClientHelper.getClient(); dbName = "view-pagination-test-" + Utils.generateUUID(); db = account.database(dbName, true); db.syncDesignDocsWithDb(); }
Source:
public void initialise() { setAnimationSystem(MenuAnimationSystems.createDefaultSwipeAnimation()); WidgetUtil.trySubscribe(this, "close", button -> { final UniverseSetupScreen universeSetupScreen = getManager().createScreen(UniverseSetupScreen.ASSET_URI, UniverseSetupScreen.class); final WorldPreGenerationScreen worldPreGenerationScreen =getManager().createScreen(WorldPreGenerationScreen.ASSET_URI, WorldPreGenerationScreen.class ); UIText customWorldName = find("customisedWorldName", UIText.class); if(customWorldName.getText().isEmpty()==false) { newWorldName = new Name(customWorldName.getText()); world.setWorldName(newWorldName); } universeSetupScreen.refresh(worldsDropdown); worldPreGenerationScreen.setName(newWorldName); triggerBackAnimation(); }); }

Target:
public void initialise() { setAnimationSystem(MenuAnimationSystems.createDefaultSwipeAnimation()); WidgetUtil.trySubscribe(this, "close", button -> { final UniverseSetupScreen universeSetupScreen = getManager().createScreen(UniverseSetupScreen.ASSET_URI, UniverseSetupScreen.class); final WorldPreGenerationScreen worldPreGenerationScreen = getManager().createScreen(WorldPreGenerationScreen.ASSET_URI, WorldPreGenerationScreen.class); UIText customWorldName = find("customisedWorldName", UIText.class); if (!customWorldName.getText().isEmpty()) { newWorldName = new Name(customWorldName.getText()); world.setWorldName(newWorldName); universeSetupScreen.refreshWorldDropdown(worldsDropdown); worldPreGenerationScreen.setName(newWorldName); } triggerBackAnimation(); }); }
Source:
private <T extends DAO> T getDao(Class<T> daoType) { for (DAO dao : daos) { if (daoType.isAssignableFrom(dao.getClass())) { if (dao instanceof BaseDAODbFacade) { initBaseDAO((BaseDAODbFacade) dao); } return (T) dao; } } log.error("Can't find dao for " + daoType); return null; }

Target:
private <T extends DAO> T getDao(Class<T> daoType) { for (DAO dao : daos) { if (daoType.isAssignableFrom(dao.getClass())) { return (T) dao; } } log.error("Can't find dao for " + daoType); return null; }
Source:
public synchronized boolean execute() throws IllegalStateException { if(hasExecuted) { throw new IllegalStateException("time bound operation has already executed"); } hasExecuted = true; thread = new Thread(new Runnable() { @Override public void run() { TimeBoundOperation.this.run(); } }); thread.start(); try { thread.join(timeout); }catch (InterruptedException e) { return false; }; commit(); return true; }

Target:
public synchronized boolean execute() throws IllegalStateException { if(hasExecuted) { throw new IllegalStateException("time bound operation has already executed"); } hasExecuted = true; Thread thread = new Thread(new Runnable() { @Override public void run() { TimeBoundOperation.this.run(); } }); thread.start(); try { thread.join(timeout); }catch (InterruptedException e) { return false; } commit(); return true; }
Source:
private static String _getNight(final long time) { final LocalDateTime dt = LocalDateTime.ofInstant(Instant.ofEpochMilli(time), ZoneId.systemDefault()); final int ampm = dt.get(ChronoField.AMPM_OF_DAY); final LocalDateTime start; final LocalDateTime end; if (ampm == 0) { start = dt.minus(1, ChronoUnit.DAYS); end = dt; } else { start = dt; end = dt.plus(1, ChronoUnit.DAYS); } final int startDay = start.get(ChronoField.DAY_OF_MONTH); final int endDay = end.get(ChronoField.DAY_OF_MONTH); final StringBuilder buf = new StringBuilder(); buf.append(startDay).append("/").append(endDay).append(" "); final DateTimeFormatter f = DateTimeFormatter.ofPattern("MMM yyyy").withZone(ZoneId.of("UTC")); buf.append(f.format(end)); return buf.toString(); }

Target:
private static String _getNight(final long time) { final LocalDateTime dt = LocalDateTime.ofInstant(Instant.ofEpochMilli(time), ZoneId.systemDefault()); final int ampm = dt.get(ChronoField.AMPM_OF_DAY); final LocalDateTime start; final LocalDateTime end; if (ampm == 0) { start = dt.minus(1, ChronoUnit.DAYS); end = dt; } else { start = dt; end = dt.plus(1, ChronoUnit.DAYS); } final int startDay = start.get(ChronoField.DAY_OF_MONTH); final int endDay = end.get(ChronoField.DAY_OF_MONTH); final StringBuilder buf = new StringBuilder(); buf.append(startDay).append("/").append(endDay).append(" "); final DateTimeFormatter f = DateTimeFormatter.ofPattern("MMM yyyy"); buf.append(f.format(end)); return buf.toString(); }
Source:
private Column getColumnForInfo(ColumnInfo c) { try { return Column.getColumn(c.getName()); } catch (IllegalArgumentException e) { throw new RuntimeException("Cannot compare non-Column enum ColumnInfo objects", e); } }

Target:
private Column getColumnForInfo(ColumnInfo c) { return Column.getColumn(c.getName()); }
Source:
new RelType("WinAggRelType") { protected boolean canImplement(RexFieldAccess field) { return false; } protected boolean canImplement(RexDynamicParam param) { return false; } protected boolean canImplement(RexLiteral literal) { return false; } protected boolean canImplement(RexCall call) { return call instanceof RexOver; } protected boolean supportsCondition() { return false; } protected RelNode makeRel(RelOptCluster cluster, RelTraitSet traitSet, RelBuilder relBuilder, RelNode input, RexProgram program) { Preconditions.checkArgument(program.getCondition() == null, "WindowedAggregateRel cannot accept a condition"); List<RelCollation> collations = traitSet.getTraits(RelCollationTraitDef.INSTANCE); RelNode window = LogicalWindow.create(cluster, relBuilder, input, program); if (collations == null || collations.isEmpty() || collations.size() != 1) { return window; } RelCollation collation = collations.get(0); if (Objects.equals(collation, RelCollations.EMPTY)) { return window; } return LogicalSort.create(window, collation, null, null); } }

Target:
new RelType("WinAggRelType") { protected boolean canImplement(RexFieldAccess field) { return false; } protected boolean canImplement(RexDynamicParam param) { return false; } protected boolean canImplement(RexLiteral literal) { return false; } protected boolean canImplement(RexCall call) { return call instanceof RexOver; } protected boolean supportsCondition() { return false; } protected RelNode makeRel(RelOptCluster cluster, RelTraitSet traitSet, RelBuilder relBuilder, RelNode input, RexProgram program) { Preconditions.checkArgument(program.getCondition() == null, "WindowedAggregateRel cannot accept a condition"); return LogicalWindow.create(cluster, traitSet, relBuilder, input, program); } }
Source:
public int hashCode() { int result = getAuthors() != null ? getAuthors().hashCode() : 0; result = 31 * result + (getStudyName() != null ? getStudyName().hashCode() : 0); result = 31 * result + (getLastSearchDate() != null ? getLastSearchDate().hashCode() : 0); result = 31 * result + (getResearchQuestions() != null ? getResearchQuestions().hashCode() : 0); result = 31 * result + (getQueries() != null ? getQueries().hashCode() : 0); result = 31 * result + (getLibraries() != null ? getLibraries().hashCode() : 0); return result; }

Target:
public int hashCode() { return Objects.hashCode(this); }
Source:
private void cleanOnlyInDbZombieTasks(long timeForZombieTasks) { Iterator<AsyncTasks> tasksInDbIterator = tasksInDbAfterRestart.iterator(); while (tasksInDbIterator.hasNext()) { AsyncTasks task = tasksInDbIterator.next(); if (!_tasks.containsKey(task.gettask_id())) { if (task.getStartTime().getTime() < timeForZombieTasks) { tasksInDbIterator.remove(); DbFacade.getInstance().getAsyncTaskDao().remove(task.gettask_id()); } } } }

Target:
private void cleanOnlyInDbZombieTasks(long timeForZombieTasks) { List<AsyncTasks> toRemove = new ArrayList<AsyncTasks>(); for (AsyncTasks task:tasksInDbAfterRestart) { if (!_tasks.containsKey(task.gettask_id())) { if (task.getStartTime().getTime() < timeForZombieTasks) { toRemove.add(task); DbFacade.getInstance().getAsyncTaskDao().remove(task.gettask_id()); } } } tasksInDbAfterRestart.removeAll(toRemove); }
Source:
public void getReserveTransactionByIdShouldReturnTheRequest() throws Exception { final AtomicReference<Request> bodyRef = new AtomicReference<>(); final CountDownLatch latch = new CountDownLatch(1); final RestAdapter adapter = new RestAdapter.Builder().setEndpoint(MOCK_URL).setRequestInterceptor(BitreserveRestAdapter.getRequestInterceptor(null)).setClient(new Client() { @Override public Response execute(Request request) throws IOException { bodyRef.set(request); latch.countDown(); return null; } }).build(); final ReserveService reserveService = adapter.create(ReserveService.class); reserveService.getReserveTransactionById("foobar", new RetrofitPromise<Transaction>()); latch.await(); Assert.assertEquals(bodyRef.get().getUrl(), String.format("%s/v0/reserve/transactions/%s", MOCK_URL, "foobar")); Assert.assertEquals(bodyRef.get().getMethod(), "GET"); }

Target:
public void getReserveTransactionByIdShouldReturnTheRequest() throws Exception { final AtomicReference<Request> bodyRef = new AtomicReference<>(); final CountDownLatch latch = new CountDownLatch(1); final RestAdapter adapter = new RestAdapter.Builder().setEndpoint(MOCK_URL).setClient(new Client() { @Override public Response execute(Request request) throws IOException { bodyRef.set(request); latch.countDown(); return null; } }).build(); final ReserveService reserveService = adapter.create(ReserveService.class); reserveService.getReserveTransactionById("foobar", new RetrofitPromise<Transaction>()); latch.await(); Assert.assertEquals(bodyRef.get().getMethod(), "GET"); Assert.assertEquals(bodyRef.get().getUrl(), String.format("%s/v0/reserve/transactions/%s", MOCK_URL, "foobar")); }
Source:
public String toJson() { StringBuffer json = new StringBuffer("["); for (int i = 0; i < size() - 1; i++) { json.append(get(i).toJson()); json.append(","); } json.append(get(size()-1).toJson()); json.append("]"); return json.toString(); }

Target:
public String toJson() { JsonArray array = new JsonArray(); for (int i = 0; i < size() - 1; i++) { array.add(get(i).toJsonObject()); } return array.toString(); }
Source:
public static double xOfShape(final DMNShape shape) { if (shape != null) { if (shape.getBounds() != null) { return shape.getBounds().getX(); } } return 0.0; }

Target:
public static double xOfShape(final DMNShape shape) { return extractValue(shape, org.kie.dmn.model.api.dmndi.Bounds::getX); }
Source:
public void testLoadAndStoreWithLifespanAndIdle() throws Exception { assertFalse(cl.contains("k")); long lifespan = 200000; long idle = 120000; InternalCacheEntry se = TestInternalCacheEntryFactory.create("k", wrap("k", "v"), lifespan, idle); InternalCacheValue icv = se.toInternalCacheValue(); assertEquals(se.getCreated(), icv.getCreated()); assertEquals(se.getLastUsed(), icv.getLastUsed()); cl.write(marshalledEntry(se, getMarshaller())); assert cl.contains("k"); MarshalledEntry ice = cl.load("k"); assertCorrectExpiry(ice, "v", lifespan, idle, false); assertCorrectExpiry(TestingUtil.allEntries(cl).iterator().next(), "v", lifespan, idle, false); idle = 1; se = TestInternalCacheEntryFactory.create("k", wrap("k", "v"), lifespan, idle); cl.write(marshalledEntry(se, getMarshaller())); Thread.sleep(100); CpurgeExpired(Collections.singleton("k"), 10000); assert se.isExpired(System.currentTimeMillis()); assertEventuallyExpires("k"); assertFalse(cl.contains("k")); assertIsEmpty(); }

Target:
public void testLoadAndStoreWithLifespanAndIdle() throws Exception { assertFalse(cl.contains("k")); long lifespan = 200000; long idle = 120000; InternalCacheEntry se = TestInternalCacheEntryFactory.create("k", wrap("k", "v"), lifespan, idle); InternalCacheValue icv = se.toInternalCacheValue(); assertEquals(se.getCreated(), icv.getCreated()); assertEquals(se.getLastUsed(), icv.getLastUsed()); cl.write(marshalledEntry(se, getMarshaller())); assert cl.contains("k"); MarshalledEntry ice = cl.load("k"); assertCorrectExpiry(ice, "v", lifespan, idle, false); assertCorrectExpiry(TestingUtil.allEntries(cl).iterator().next(), "v", lifespan, idle, false); idle = 1; se = TestInternalCacheEntryFactory.create("k", wrap("k", "v"), lifespan, idle); cl.write(marshalledEntry(se, getMarshaller())); Thread.sleep(100); purgeExpired(Collections.singleton("k"), 10000); assert se.isExpired(System.currentTimeMillis()); assertEventuallyExpires("k"); assertFalse(cl.contains("k")); assertIsEmpty(); }
Source:
public Set<Id> accountsOf(AccountGroup.UUID groupId) { try { return accountsOf.get(groupId); } catch (ExecutionException e) { log.warn("Cannot load account of group", e); return Collections.emptySet(); } }

Target:
public Set<Id> accountsOf(AccountGroup.UUID groupId) { try { return accounts.get(groupId); } catch (ExecutionException e) { log.warn("Cannot load accounts of group", e); return Collections.emptySet(); } }
Source:
public void addValue(String key, String value) { if (StringUtils.isBlank(value)) return; String[] existingvals = md.get(key); if (existingvals == null || existingvals.length == 0) { setValue(key, value); return; } ArrayList<String> existing = new ArrayList<String>(existingvals.length); for (String v : existingvals) existing.add(v); existing.add(value); md.put(key, existing.toArray(new String[existing.size()])); }

Target:
public void addValue(String key, String value) { if (StringUtils.isBlank(value)) return; String[] existingvals = md.get(key); if (existingvals == null || existingvals.length == 0) { setValue(key, value); return; } int currentLength = existingvals.length; String[] newvals = new String[currentLength + 1]; newvals[currentLength] = value; System.arraycopy(existingvals, 0, newvals, 0, currentLength); md.put(key, newvals); }
Source:
private ThrowingFunction<LogPosition,TransactionCursor,IOException> log( int... transactionCounts ) throws IOException { long baseOffset = LogPosition.start( 0 ).getByteOffset(); @SuppressWarnings( "unchecked" ) ThrowingFunction<LogPosition,TransactionCursor,IOException> result = mock( ThrowingFunction.class ); AtomicLong txId = new AtomicLong( 0 ); CommittedTransactionRepresentation[][] logs = new CommittedTransactionRepresentation[transactionCounts.length][]; for ( int logVersion = 0; logVersion < transactionCounts.length; logVersion++ ) { logs[logVersion] = transactions( transactionCounts[logVersion], txId ); } when( result.apply( any( LogPosition.class ) ) ).thenAnswer( new Answer<TransactionCursor>() { @Override public TransactionCursor answer( InvocationOnMock invocation ) throws Throwable { LogPosition position = invocation.getArgumentAt( 0, LogPosition.class ); if ( position == null ) { return null; } CommittedTransactionRepresentation[] transactions = logs[toIntExact( position.getLogVersion() )]; CommittedTransactionRepresentation[] subset = copyOfRange( transactions, toIntExact( position.getByteOffset() - baseOffset ), transactions.length ); ArrayUtil.reverse( subset ); return given( subset ); } } ); return result; }

Target:
private ThrowingFunction<LogPosition,TransactionCursor,IOException> log( int... transactionCounts ) throws IOException { long baseOffset = LogPosition.start( 0 ).getByteOffset(); @SuppressWarnings( "unchecked" ) ThrowingFunction<LogPosition,TransactionCursor,IOException> result = mock( ThrowingFunction.class ); AtomicLong txId = new AtomicLong( 0 ); CommittedTransactionRepresentation[][] logs = new CommittedTransactionRepresentation[transactionCounts.length][]; for ( int logVersion = 0; logVersion < transactionCounts.length; logVersion++ ) { logs[logVersion] = transactions( transactionCounts[logVersion], txId ); } when( result.apply( any( LogPosition.class ) ) ).thenAnswer( invocation -> { LogPosition position = invocation.getArgumentAt( 0, LogPosition.class ); if ( position == null ) { return null; } CommittedTransactionRepresentation[] transactions = logs[toIntExact( position.getLogVersion() )]; CommittedTransactionRepresentation[] subset = copyOfRange( transactions, toIntExact( position.getByteOffset() - baseOffset ), transactions.length ); ArrayUtil.reverse( subset ); return given( subset ); } ); return result; }
Source:
public ResponseEntity<String> repositories(@ApiParam(value = "The storageId", required = true) @PathVariable("storageId") String storageId) { try { Storage storage = configurationManager.getConfiguration().getStorage(storageId); if (storage == null) { return ResponseEntity.status(HttpStatus.NOT_FOUND) .body("{ 'error': 'The requested storage was not found.' }"); } Map<String,SortedSet<String>> repos = new HashMap<>(); repos.put("repositories", new TreeSet<String>(storage.getRepositories().keySet())); return ResponseEntity.ok(new ObjectMapper().writeValueAsString(repos)); } catch (Exception e) { logger.error(e.getMessage(), e); return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) .body(String.format("{ 'error': '%s' }", e.getMessage())); } }

Target:
public ResponseEntity<String> repositories(@ApiParam(value = "The storageId", required = true) @PathVariable("storageId") String storageId) { try { Storage storage = configurationManager.getConfiguration().getStorage(storageId); if (storage == null) { return ResponseEntity.status(HttpStatus.NOT_FOUND) .body("{ 'error': 'The requested storage was not found.' }"); } Map<String,SortedSet<String>> repos = new HashMap<>(); repos.put("repositories", new TreeSet<String>(storage.getRepositories().keySet())); return ResponseEntity.ok(objectMapper.writer().writeValueAsString(repos)); } catch (Exception e) { logger.error(e.getMessage(), e); return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) .body(String.format("{ 'error': '%s' }", e.getMessage())); } }
Source:
public OAuth2Authentication loadAuthentication(final String accessToken) throws AuthenticationException { final Timer.Context context = timer.time(); try { if (featureToggleService.isFeatureEnabled(FeatureToggleService.Feature.REMOTE_TOKENINFO)) { return remoteService.loadAuthentication(accessToken); } else { return localService.loadAuthentication(accessToken); } } catch (OAuth2Exception e) { throw e; } catch (Exception e) { throw new OAuth2Exception(e.getMessage(), e); } finally { context.stop(); } }

Target:
public OAuth2Authentication loadAuthentication(final String accessToken) throws AuthenticationException { final Timer.Context context = timer.time(); try { if (featureToggleService.isFeatureEnabled(FeatureToggleService.Feature.REMOTE_TOKENINFO)) { return remoteService.loadAuthentication(accessToken); } else { return localService.loadAuthentication(accessToken); } } catch (final OAuth2Exception e) { throw e; } catch (final RuntimeException e) { throw new OAuth2Exception(e.getMessage(), e); } finally { context.stop(); } }
Source:
private InstructorAttributes extractUpdatedInstructor(String courseId, String instructorId, String instructorName, String instructorEmail) { String instructorRole = getNonNullRequestParamValue(Const.ParamsNames.INSTRUCTOR_ROLE_NAME); boolean isDisplayedToStudents = true; if (getRequestParamValue(Const.ParamsNames.INSTRUCTOR_IS_DISPLAYED_TO_STUDENT) != null) { isDisplayedToStudents = Boolean.parseBoolean(getRequestParamValue( Const.ParamsNames.INSTRUCTOR_IS_DISPLAYED_TO_STUDENT)); } String displayedName = getRequestParamValue(Const.ParamsNames.INSTRUCTOR_DISPLAY_NAME); if (displayedName == null || displayedName.isEmpty()) { displayedName = InstructorAttributes.DEFAULT_DISPLAY_NAME; } instructorRole = SanitizationHelper.sanitizeName(instructorRole); displayedName = SanitizationHelper.sanitizeName(displayedName); InstructorAttributes instructorToEdit = updateBasicInstructorAttributes(courseId, instructorId, instructorName, instructorEmail, instructorRole, isDisplayedToStudents, displayedName); if (instructorRole.equals(Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_CUSTOM)) { updateInstructorCourseLevelPrivileges(instructorToEdit); } updateInstructorWithSectionLevelPrivileges(courseId, instructorToEdit); instructorToEdit.privileges.validatePrivileges(); return instructorToEdit; }

Target:
private InstructorAttributes extractUpdatedInstructor(String courseId, String instructorId, String instructorName, String instructorEmail) { String instructorRole = getNonNullRequestParamValue(Const.ParamsNames.INSTRUCTOR_ROLE_NAME); boolean isDisplayedToStudents = getBooleanRequestParamValue(Const.ParamsNames.INSTRUCTOR_IS_DISPLAYED_TO_STUDENT); String displayedName = getRequestParamValue(Const.ParamsNames.INSTRUCTOR_DISPLAY_NAME); if (displayedName == null || displayedName.isEmpty()) { displayedName = InstructorAttributes.DEFAULT_DISPLAY_NAME; } instructorRole = SanitizationHelper.sanitizeName(instructorRole); displayedName = SanitizationHelper.sanitizeName(displayedName); InstructorAttributes instructorToEdit = updateBasicInstructorAttributes(courseId, instructorId, instructorName, instructorEmail, instructorRole, isDisplayedToStudents, displayedName); if (instructorRole.equals(Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_CUSTOM)) { updateInstructorCourseLevelPrivileges(instructorToEdit); } updateInstructorWithSectionLevelPrivileges(courseId, instructorToEdit); instructorToEdit.privileges.validatePrivileges(); return instructorToEdit; }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } PreSharedKeyIdentity other = (PreSharedKeyIdentity) obj; if (identity == null) { if (other.identity != null) { return false; } } else if (!identity.equals(other.identity)) { return false; } if (virtualHost == null) { if (other.virtualHost != null) { return false; } } else if (!virtualHost.equals(other.virtualHost)) { return false; } return true; }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } PreSharedKeyIdentity other = (PreSharedKeyIdentity) obj; if (name == null) { if (other.name != null) { return false; } } else if (!name.equals(other.name)) { return false; } return true; }
Source:
public void theStoredEventsAreFilteredAndRetrieved(final Map<String, String> expectedResponse) throws Throwable { final List<Event> events; if (getString(expectedResponse, Keys.KEY_DEVICE_IDENTIFICATION).equals("")) { events = this.retrieveStoredEvents(); } else { events = this.retrieveStoredEvents(getString(expectedResponse, Keys.KEY_DEVICE_IDENTIFICATION)); } Assert.assertEquals((int) getInteger(expectedResponse, Keys.KEY_RESULT), events.size()); }

Target:
public void theStoredEventsAreFilteredAndRetrieved(final Map<String, String> expectedResponse) throws Throwable { final List<Event> events; if (getString(expectedResponse, Keys.KEY_DEVICE_IDENTIFICATION).isEmpty()) { events = this.retrieveStoredEvents(); } else { events = this.retrieveStoredEvents(getString(expectedResponse, Keys.KEY_DEVICE_IDENTIFICATION)); } Assert.assertEquals((int) getInteger(expectedResponse, Keys.KEY_RESULT), events.size()); }
Source:
public ICPPExecution getExecution() { if (declarators == null) { return new ExecSimpleDeclaration(new ICPPExecution[] {}); } else { ICPPExecution[] declaratorExecutions = new ICPPExecution[declarators.length]; for (int i = 0; i < declarators.length; ++i) { declaratorExecutions[i] = ((ICPPExecutionOwner) declarators[i]).getExecution(); } return new ExecSimpleDeclaration(declaratorExecutions); } }

Target:
public ICPPExecution getExecution() { IASTDeclarator[] declarators = getDeclarators(); ICPPExecution[] declaratorExecutions = new ICPPExecution[declarators.length]; for (int i = 0; i < declarators.length; ++i) { declaratorExecutions[i] = ((ICPPExecutionOwner) declarators[i]).getExecution(); } return new ExecSimpleDeclaration(declaratorExecutions); }
Source:
public void snapshotState(FunctionSnapshotContext context) throws Exception { try { bufferedResultsLock.lock(); bufferedResultsState.clear(); bufferedResultsState.addAll(bufferedResults); firstBufferedResultOffsetState.clear(); firstBufferedResultOffsetState.add(firstBufferedResultOffset); } finally { bufferedResultsLock.unlock(); } }

Target:
public void snapshotState(FunctionSnapshotContext context) throws Exception { bufferedResultsLock.lock(); try { bufferedResultsState.clear(); bufferedResultsState.addAll(bufferedResults); offsetState.clear(); offsetState.add(offset); uncompletedCheckpointMap.put(context.getCheckpointId(), offset); if (LOG.isDebugEnabled()) { LOG.debug("Checkpoint begin with checkpointId = " + context.getCheckpointId() + ", lastCheckpointedOffset = " + lastCheckpointedOffset + ", num buffered results = " + bufferedResults.size()); } } finally { bufferedResultsLock.unlock(); } }
Source:
private void waitNotificationEqualsTo(String notificationMessage, String parentWindowHandle) { seleniumWebDriverHelper.waitSuccessCondition( driver -> { if (seleniumWebDriverHelper.isOpenedSomeWin()) { seleniumWebDriver.switchTo().window(parentWindowHandle); theiaIde.switchToIdeFrame(); } return theiaIde.isDisplayedNotificationEqualsTo(notificationMessage); }, LOADER_TIMEOUT_SEC); }

Target:
private void waitNotificationEqualsTo(String notificationMessage, String parentWindowHandle) { seleniumWebDriverHelper.waitSuccessCondition( driver -> { if (seleniumWebDriverHelper.isTwoOrMoreWindowsOpened()) { driver.switchTo().window(parentWindowHandle); theiaIde.switchToIdeFrame(); } return theiaIde.isNotificationEqualsTo(notificationMessage); }, LOADER_TIMEOUT_SEC); }
Source:
public String display() { StringBuilder sb = new StringBuilder(); sb.append("<meta "); for (String attrib : attribs.keySet()) { sb.append(attrib).append("=\"").append(attribs.get(attrib)).append("\" "); } if (content.isPresent()) { sb.append("content=\"").append(content.get()).append("\" "); } sb.append("/>"); return sb.toString(); }

Target:
public @NotNull String display() { StringBuilder sb = new StringBuilder(); sb.append("<meta "); for (String attrib : attribs.keySet()) { sb.append(attrib).append("=\"").append(attribs.get(attrib)).append("\" "); } if (content.isPresent()) { sb.append("content=\"").append(content.get()).append("\" "); } sb.append("/>"); return sb.toString(); }
Source:
public Status read(String table, String key, Set<String> fields, Map<String, ByteIterator> result) { try { PreparedStatement stmt = (fields == null) ? readAllStmt.get() : readStmts.get(fields); if (stmt == null) { Select.Builder selectBuilder; if (fields == null) { selectBuilder = QueryBuilder.select().all(); } else { selectBuilder = QueryBuilder.select(); for (String col : fields) { ((Select.Selection) selectBuilder).column(col); } } stmt = session.prepare(selectBuilder.from(table) .where(QueryBuilder.eq(YCSB_KEY, QueryBuilder.bindMarker())) .limit(1)); stmt.setConsistencyLevel(readConsistencyLevel); if (trace) { stmt.enableTracing(); } PreparedStatement prevStmt = (fields == null) ? readAllStmt.getAndSet(stmt) : readStmts.putIfAbsent(new HashSet(fields), stmt); if (prevStmt != null) { stmt = prevStmt; } } if (debug) { System.out.println(stmt.getQueryString()); System.out.println("key = " + key); } ResultSet rs = session.execute(stmt.bind(key)); if (rs.isExhausted()) { return Status.NOT_FOUND; } Row row = rs.one(); ColumnDefinitions cd = row.getColumnDefinitions(); for (ColumnDefinitions.Definition def : cd) { ByteBuffer val = row.getBytesUnsafe(def.getName()); if (val != null) { result.put(def.getName(), new ByteArrayByteIterator(val.array())); } else { result.put(def.getName(), null); } } return Status.OK; } catch (Exception e) { e.printStackTrace(); System.out.println("Error reading key: " + key); return Status.ERROR; } }

Target:
public Status read(String table, String key, Set<String> fields, Map<String, ByteIterator> result) { try { PreparedStatement stmt = (fields == null) ? readAllStmt.get() : readStmts.get(fields); if (stmt == null) { Select.Builder selectBuilder; if (fields == null) { selectBuilder = QueryBuilder.select().all(); } else { selectBuilder = QueryBuilder.select(); for (String col : fields) { ((Select.Selection) selectBuilder).column(col); } } stmt = session.prepare(selectBuilder.from(table) .where(QueryBuilder.eq(YCSB_KEY, QueryBuilder.bindMarker())) .limit(1)); stmt.setConsistencyLevel(readConsistencyLevel); if (trace) { stmt.enableTracing(); } PreparedStatement prevStmt = (fields == null) ? readAllStmt.getAndSet(stmt) : readStmts.putIfAbsent(new HashSet(fields), stmt); if (prevStmt != null) { stmt = prevStmt; } } logger.debug(stmt.getQueryString()); logger.debug("key = {}", key); ResultSet rs = session.execute(stmt.bind(key)); if (rs.isExhausted()) { return Status.NOT_FOUND; } Row row = rs.one(); ColumnDefinitions cd = row.getColumnDefinitions(); for (ColumnDefinitions.Definition def : cd) { ByteBuffer val = row.getBytesUnsafe(def.getName()); if (val != null) { result.put(def.getName(), new ByteArrayByteIterator(val.array())); } else { result.put(def.getName(), null); } } return Status.OK; } catch (Exception e) { logger.error(MessageFormatter.format("Error reading key: {}", key).getMessage(), e); return Status.ERROR; } }
Source:
private boolean addOperation(final VdcOperation<?, ?> operation, final boolean isPublic) { final boolean isAllowedToExecute = loggedIn || isPublic; final boolean operationCanBeAdded = !operationQueue.contains(operation) || operation.allowDuplicates(); if (isAllowedToExecute) { if (operationCanBeAdded && operationQueue.add(operation)) { processor.processOperation(this); VdcOperationExecutedEvent.fire(eventBus, operation); } } return isAllowedToExecute; }

Target:
private boolean addOperation(final VdcOperation<?, ?> operation, final boolean isPublic) { final boolean isAllowedToExecute = loggedIn || isPublic; final boolean operationCanBeAdded = !operationQueue.contains(operation) || operation.allowDuplicates(); if (isAllowedToExecute) { if (operationCanBeAdded && operationQueue.add(operation)) { processor.processOperation(this); if (engineSessionRefreshed(operation)) { EngineSessionRefreshedEvent.fire(eventBus); } } } return isAllowedToExecute; }
Source:
protected void renderArguments(FunctionRenderContext context, WindowFunction windowFunction) { Iterator<String> argumentIterator = windowFunction.getArguments().iterator(); while (argumentIterator.hasNext()) { context.addChunk(argumentIterator.next()); if (argumentIterator.hasNext()) { context.addChunk(", "); } } }

Target:
protected void renderArguments(FunctionRenderContext context, WindowFunction windowFunction) { List<String> arguments = windowFunction.getArguments(); int size = arguments.size(); if (size != 0) { List<String> filterExpressions = windowFunction.getFilterExpressions(); int filtersSize = filterExpressions.size(); if (supportsFilterClause || filtersSize == 0) { renderArgument(context, windowFunction, null, null, arguments.get(0), 0); for (int i = 1; i < size; i++) { context.addChunk(", "); renderArgument(context, windowFunction, null, null, arguments.get(i), i); } } else { String caseWhenPre = getCaseWhenPre(filterExpressions); String caseWhenPost = getCaseWhenPost(); renderArgument(context, windowFunction, caseWhenPre, caseWhenPost, arguments.get(0), 0); for (int i = 1; i < size; i++) { context.addChunk(", "); renderArgument(context, windowFunction, caseWhenPre, caseWhenPost, arguments.get(i), i); } } } }