auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void whenCreateNewEventTypePersistItInTheDatabase() throws Exception { EventType eventType = buildEventType(); repository.saveEventType(eventType); final int rows = template.queryForObject("SELECT count(*) FROM event_type", Integer.class); assertThat("Number of rows should encrease", rows, equalTo(1)); <START> final PreparedStatement ps = connection.prepareStatement("SELECT et_name, et_event_type_object FROM event_type"); <END> ps.setMaxRows(1); final ResultSet rs = ps.executeQuery(); rs.next(); assertThat("Name is persisted", rs.getString(1), equalTo("event-name")); assertThat("Schema is persisted", rs.getString(2), equalTo("{\"name\": \"event-name\", \"type\": null, \"schema\": {\"type\": null, \"schema\": {\"price\": 1000}}, \"owning_application\": null}")); }</code><technical_language>do a jdbcTemplate in case a preparedStatement in a case</technical_language>

Target:
public void whenCreateNewEventTypePersistItInTheDatabase() throws Exception { EventType eventType = buildEventType(); repository.saveEventType(eventType); final int rows = template.queryForObject("SELECT count(*) FROM zn_data.event_type", Integer.class); assertThat("Number of rows should encrease", rows, equalTo(1)); SqlRowSet rs = template.queryForRowSet("SELECT et_name, et_event_type_object FROM zn_data.event_type"); rs.next(); assertThat("Name is persisted", rs.getString(1), equalTo("event-name")); ObjectMapper mapper = (new NakadiConfig()).jacksonObjectMapper(); EventType persisted = mapper.readValue(rs.getString(2), EventType.class); assertThat(persisted.getCategory(), equalTo(eventType.getCategory())); assertThat(persisted.getName(), equalTo(eventType.getName())); assertThat(persisted.getEventTypeSchema().getType(), equalTo(eventType.getEventTypeSchema().getType())); assertThat(persisted.getEventTypeSchema().getSchema(), equalTo(eventType.getEventTypeSchema().getSchema())); }
Source:
<code>private static DetailAST getNextNode(DetailAST node) { <START> final DetailAST nextNode; <END> if (node.getNextSibling() == null) { nextNode = node.getParent().getNextSibling(); } else { nextNode = node.getNextSibling(); } return nextNode; }</code><technical_language>other forms of writing this writing assignment standard one, change assignment if null. change here? DetailAST nextNode = node.getNextSibling(); if (nextNode == null) { nextNode = node.getParent().getNextSibling(); }</technical_language>

Target:
private static DetailAST getNextNode(DetailAST node) { DetailAST nextNode = node.getNextSibling(); if (nextNode == null) { nextNode = node.getParent().getNextSibling(); } return nextNode; }
Source:
<code>public void internalMapFailure() { Async<Integer> failure = Asyncs.failure(new Throwable()); Async<Integer> mapped = Asyncs.map(failure, new Function<Integer, Integer>() { @Override public Integer apply(Integer input) { return input + 1; } }, new SimpleAsync<Integer>()); <START> assertThat(mapped, AsyncMatchers.<Integer>failed()); <END> }</code><technical_language>I understand, get rid of explicit type parameters is calls</technical_language>

Target:
public void internalMapFailure() { Async<Integer> failure = Asyncs.failure(new Throwable()); Async<Integer> mapped = Asyncs.map(failure, new Function<Integer, Integer>() { @Override public Integer apply(Integer input) { return input + 1; } }, new SimpleAsync<Integer>()); assertThat(mapped, failed()); }
Source:
<code>private void listFilesInsideAcidDirectory(Path acidDir, FileSystem srcFs, List<Path> newFiles) throws HiveException { FileStatus[] acidFiles; try { acidFiles = srcFs.listStatus(acidDir); <START> } catch (IOException e) { <END> LOG.error("Error listing files", e); throw new HiveException(e); } if (acidFiles == null) { LOG.debug("No files added by this query in: " + acidDir); return; } for (FileStatus acidFile : acidFiles) { if (!acidFile.isDirectory()) { newFiles.add(acidFile.getPath()); } else { listFilesInsideAcidDirectory(acidFile.getPath(), srcFs, newFiles); } } }</code><technical_language>need catch IOException caller handle it</technical_language>

Target:
private void listFilesInsideAcidDirectory(Path acidDir, FileSystem srcFs, List<Path> newFiles) throws IOException { FileStatus[] acidFiles; acidFiles = srcFs.listStatus(acidDir); if (acidFiles == null) { LOG.debug("No files added by this query in: " + acidDir); return; } for (FileStatus acidFile : acidFiles) { if (!acidFile.isDirectory()) { newFiles.add(acidFile.getPath()); } else { listFilesInsideAcidDirectory(acidFile.getPath(), srcFs, newFiles); } } }
Source:
<code>public void wakeupExisting() throws InterruptedException { final ConstantTimeBackoff backoff = new ConstantTimeBackoff(); <START> backoff.setTimeToWait(1000); <END> Thread thread = new Thread(new Runnable() { @Override public void run() { LOG.debug("before"); backoff.waitBeforeRetry(); LOG.debug("after"); } }); thread.start(); LOG.debug("thread started"); Thread.sleep(100); LOG.debug("testing wakeup"); Assert.assertTrue(backoff.wakeup(thread.getName())); }</code><technical_language>is 1000 seconds miliseconds? need high</technical_language>

Target:
public void wakeupExisting() throws InterruptedException { final ConstantTimeBackoff backoff = new ConstantTimeBackoff(); backoff.setTimeToWait(10); Thread thread = new Thread(new Runnable() { @Override public void run() { LOG.debug("before"); backoff.waitBeforeRetry(); LOG.debug("after"); } }); thread.start(); LOG.debug("thread started"); Thread.sleep(100); LOG.debug("testing wakeup"); Assert.assertTrue(backoff.wakeup(thread.getName())); }
Source:
<code>protected void connect() { if (getEntity() != null) { getLogger().debug("Connecting to RDP console..."); boolean haveFqdn = false; if( getUseFqdnIfAvailable() ) { getLogger().debug("RDP connection is using FQDN if available"); if(!StringHelper.isNullOrEmpty(getEntity().getVmFQDN())) { getLogger().debug("RDP connection is using FQDN because it is available"); <START> getrdp().setAddress(getEntity().getVmFQDN()); <END> } } if( !haveFqdn ) { getLogger().debug("RDP connection is not using FQDN"); getrdp().setAddress(getEntity().getVmHost().split("[ ]", -1)[0]); } getrdp().setGuestID(getEntity().getId().toString()); try { getrdp().connect(); updateActionAvailability(); } catch (RuntimeException ex) { getLogger().error("Exception on RDP connect", ex); } } }</code><technical_language>I guess forgotten "haveFqdn = true" ;)</technical_language>

Target:
protected void connect() { if (getEntity() != null) { getLogger().debug("Connecting to RDP console..."); boolean haveFqdn = false; if (getUseFqdnIfAvailable()) { getLogger().debug("RDP connection is using FQDN if available"); if (!StringHelper.isNullOrEmpty(getEntity().getVmFQDN())) { getLogger().debug("RDP connection is using FQDN because it is available"); haveFqdn = true; getrdp().setAddress(getEntity().getVmFQDN()); } } if (!haveFqdn) { getLogger().debug("RDP connection is not using FQDN"); getrdp().setAddress(getEntity().getVmHost().split("[ ]", -1)[0]); } getrdp().setGuestID(getEntity().getId().toString()); try { getrdp().connect(); updateActionAvailability(); } catch (RuntimeException ex) { getLogger().error("Exception on RDP connect", ex); } } }
Source:
<code>protected void onHandleIntent(Intent intent) { String catName = intent.getStringExtra(KEY_CATEGORY_NAME); Account curAccount = intent.getParcelableExtra(KEY_ACCOUNT); int parentId = intent.getIntExtra(KEY_PARENT_CATEGORY_ID, 0); RestService restService = restServiceFactory.createForAccount(curAccount); Call<AddCategoryResponse> call = restService.addCategory(catName, parentId, null, null, null, null); call.enqueue(new Callback<AddCategoryResponse>() { @Override public void onResponse(Call<AddCategoryResponse> call, Response<AddCategoryResponse> response) { if (response.raw().code() == 200) { if (response.body().stat.equals("ok")) Toast.makeText(getApplicationContext(), R.string.create_album_success, Toast.LENGTH_LONG).show(); else Toast.makeText(getApplicationContext(), R.string.create_album_error, Toast.LENGTH_LONG).show(); } else Toast.makeText(getApplicationContext(), R.string.create_album_error, Toast.LENGTH_LONG).show(); } @Override public void onFailure(Call<AddCategoryResponse> call, Throwable t) { <START> t.printStackTrace(); <END> } }); }</code><technical_language>this printing, I fear</technical_language>

Target:
protected void onHandleIntent(Intent intent) { String catName = intent.getStringExtra(KEY_CATEGORY_NAME); Account curAccount = intent.getParcelableExtra(KEY_ACCOUNT); int parentId = intent.getIntExtra(KEY_PARENT_CATEGORY_ID, 0); RestService restService = restServiceFactory.createForAccount(curAccount); Call<AddCategoryResponse> call = restService.addCategory(catName, parentId, null, null, null, null); call.enqueue(new Callback<AddCategoryResponse>() { @Override public void onResponse(Call<AddCategoryResponse> call, Response<AddCategoryResponse> response) { if (response.raw().code() == 200 && response.body().stat.equals("ok")) Toast.makeText(getApplicationContext(), R.string.create_album_success, Toast.LENGTH_LONG).show(); else Toast.makeText(getApplicationContext(), R.string.create_album_error, Toast.LENGTH_LONG).show(); } @Override public void onFailure(Call<AddCategoryResponse> call, Throwable t) { Toast.makeText(getApplicationContext(), R.string.create_album_error, Toast.LENGTH_LONG).show(); Log.e("AlbumService", "Unable to create a new album:", t); } }); }
Source:
<code>public void testSetBuffer() { SampleTester.test((Sample sample) -> { Buffer buffer = sample.getBuffer(); int refCount = buffer.getRefCount(); <START> if (Gst.getVersion().checkSatisfies(new Version(1, 16))) { <END> assertEquals(2, sample.getRefCount()); Natives.unref(sample); sample.setBuffer(null); Natives.ref(sample); assertEquals(2, sample.getRefCount()); assertEquals(refCount-1, buffer.getRefCount()); } }); }</code><technical_language>This is test features requiring 1.8. Firstly, call init() Gst.init(Gst.getVersion(), ...testName...); <LINK_0> call TestAssumptions.requireGstVersion(1, 16); line of test - <LINK_1></technical_language>

Target:
public void testSetBuffer() { TestAssumptions.requireGstVersion(1, 16); SampleTester.test((Sample sample) -> { Buffer buffer = sample.getBuffer(); int refCount = buffer.getRefCount(); assertEquals(2, sample.getRefCount()); Natives.unref(sample); sample.setBuffer(null); Natives.ref(sample); assertEquals(2, sample.getRefCount()); assertEquals(refCount-1, buffer.getRefCount()); }); }
Source:
<code>public boolean isPdfValid(@NonNull File file) { PdfPDImageXFactory factory = new PdfPDImageXFactoryFactory(context, new PDDocument(), file).get(); try { factory.open(); return factory.nextPage(); } catch (IOException e) { <START> e.printStackTrace(); <END> return false; } finally { IOUtils.closeQuietly(factory); } }</code><technical_language>change this Logger.error(this, "Invalid PDF File", e); part of a future CR</technical_language>

Target:
public boolean isPdfValid(@NonNull File file) { PdfPDImageXFactory factory = new PdfPDImageXFactoryFactory(context, new PDDocument(), file).get(); try { factory.open(); return factory.nextPage(); } catch (IOException e) { Logger.error(this, "Invalid PDF File", e); return false; } finally { IOUtils.closeQuietly(factory); } }
Source:
<code>public void start() { if (stepClassWithSpringContext != null) { testContextManager = new CucumberTestContextManager(stepClassWithSpringContext); } else { if (beanFactory == null) { beanFactory = createFallbackContext(); } } notifyContextManagerAboutTestClassStarted(); if (beanFactory == null || isNewContextCreated()) { beanFactory = testContextManager.getBeanFactory(); <START> synchronized (beanFactory) { <END> for (Class<?> stepClass : stepClasses) { registerStepClassBeanDefinition(beanFactory, stepClass); } } } GlueCodeContext.getInstance().start(); }</code><technical_language>a synchronization step a lines CucumberTestContextManager. For clarity synchronize operations in start method</technical_language>

Target:
public void start() { synchronized (monitor) { if (stepClassWithSpringContext != null) { testContextManager = new CucumberTestContextManager(stepClassWithSpringContext); } else { if (beanFactory == null) { beanFactory = createFallbackContext(); } } notifyContextManagerAboutTestClassStarted(); if (beanFactory == null || isNewContextCreated()) { beanFactory = testContextManager.getBeanFactory(); for (Class<?> stepClass : stepClasses) { registerStepClassBeanDefinition(beanFactory, stepClass); } } GlueCodeContext.getInstance().start(); } }
Source:
<code>JarFileUtils(IPostProcessor processor, String xmlPathInJar, List<String> testNames) { this.processor = processor; this.xmlPathInJar = xmlPathInJar; <START> this.testNames = (testNames == null ? null : new ArrayList<>(testNames)); <END> }</code><technical_language>revert this change need in this specific class</technical_language>

Target:
JarFileUtils(IPostProcessor processor, String xmlPathInJar, List<String> testNames) { this.processor = processor; this.xmlPathInJar = xmlPathInJar; this.testNames = testNames; }
Source:
<code><START> public boolean charTyped(char p_charTyped_1_, int p_charTyped_2_) { <END> if (super.charTyped(p_charTyped_1_, p_charTyped_2_) || !canEdit) { return true; } else if (SharedConstants.isAllowedCharacter(p_charTyped_1_)) { this.insertTextIntoPage(Character.toString(p_charTyped_1_)); return true; } else { return false; } }</code><technical_language>Again, parameter names</technical_language>

Target:
public boolean charTyped(char p_charTyped_1_, int p_charTyped_2_) { if (super.charTyped(p_charTyped_1_, p_charTyped_2_) || !canEdit) return true; else if (SharedConstants.isAllowedCharacter(p_charTyped_1_)) { this.insertTextIntoPage(Character.toString(p_charTyped_1_)); return true; } else return false; }
Source:
<code>public void shouldIncrementTransactionMonitorBeforeCheckingDatabaseAvailability() throws Exception { AvailabilityGuard availabilityGuard = spy( new AvailabilityGuard( Clock.systemUTC(), NullLog.getInstance() ) ); TransactionMonitor transactionMonitor = mock( TransactionMonitor.class ); Dependencies dependencies = new Dependencies(); dependencies.satisfyDependencies( availabilityGuard, transactionMonitor ); NeoStoreDataSource dataSource = neoStoreRule.getDataSource( pageCacheRule.directory().absolutePath(), pageCacheRule.fileSystem(), pageCacheRule.pageCache(), dependencies ); dataSource.start(); KernelAPI kernel = dataSource.getKernel(); try ( KernelTransaction tx = kernel.newTransaction( explicit, AUTH_DISABLED ) ) { InOrder order = inOrder( transactionMonitor, availabilityGuard ); order.verify( transactionMonitor, times( 1 ) ).transactionStarted(); <START> } <END> }</code><technical_language>forgot verify call availability guard</technical_language>

Target:
public void shouldIncrementTransactionMonitorBeforeCheckingDatabaseAvailability() throws Exception { AvailabilityGuard availabilityGuard = spy( new AvailabilityGuard( Clock.systemUTC(), NullLog.getInstance() ) ); TransactionMonitor transactionMonitor = mock( TransactionMonitor.class ); Dependencies dependencies = new Dependencies(); dependencies.satisfyDependencies( availabilityGuard, transactionMonitor ); NeoStoreDataSource dataSource = neoStoreRule.getDataSource( pageCacheRule.directory().absolutePath(), pageCacheRule.fileSystem(), pageCacheRule.pageCache(), dependencies ); dataSource.start(); KernelAPI kernel = dataSource.getKernel(); try ( KernelTransaction tx = kernel.newTransaction( explicit, AUTH_DISABLED ) ) { InOrder order = inOrder( transactionMonitor, availabilityGuard ); order.verify( transactionMonitor, times( 1 ) ).transactionStarted(); order.verify( availabilityGuard, times( 1 ) ).await( anyLong() ); } }
Source:
<code>private void scheduleLocalBackup(BackupPRequest request) { mLocalBackupFuture = mExecutorService.submit(() -> { try (LockResource stateLockResource = <START> new LockResource(mStatePauseLock, mStateLockTimeout, TimeUnit.MILLISECONDS)) { <END> mBackupTracker.updateState(BackupState.Running); AlluxioURI backupUri = takeBackup(request, mBackupTracker.getEntryCounter()); mBackupTracker.updateBackupUri(backupUri); mBackupTracker.updateState(BackupState.Completed); } catch (Exception e) { mBackupTracker.updateError( new BackupException(String.format("Local backup failed: %s", e.getMessage()), e)); } }); }</code><technical_language>If this times out, backup scheduled next time, some sort of retry</technical_language>

Target:
private void scheduleLocalBackup(BackupPRequest request) { mLocalBackupFuture = mExecutorService.submit(() -> { try (LockResource stateLockResource = new LockResource(mStatePauseLock, request.getOptions().getStateLockTryDurationMs(), request.getOptions().getStateLockSleepDurationMs(), request.getOptions().getStateLockTimeoutMs())) { mBackupTracker.updateState(BackupState.Running); AlluxioURI backupUri = takeBackup(request, mBackupTracker.getEntryCounter()); mBackupTracker.updateBackupUri(backupUri); mBackupTracker.updateState(BackupState.Completed); } catch (Exception e) { mBackupTracker.updateError( new BackupException(String.format("Local backup failed: %s", e.getMessage()), e)); } }); }
Source:
<code>public static Period fromString(final String sleepPeriodName) { if (sleepPeriodName != null) { for (final Period period : Period.values()) { if (sleepPeriodName.equalsIgnoreCase(period.toString())) { return period; } } } <START> throw new IllegalArgumentException(); <END> }</code><technical_language>throw new IllegalArgumentException("invalid sleep period: " + sleepPeriodName)</technical_language>

Target:
public static Period fromString(final String sleepPeriodName) { if (sleepPeriodName != null) { for (final Period period : Period.values()) { if (sleepPeriodName.equalsIgnoreCase(period.toString())) { return period; } } } throw new IllegalArgumentException("invalid sleep period: " + sleepPeriodName); }
Source:
<code><START> protected String getScanStatus(int contextId) { <END> AccessControlScannerThread scannerThread = threadManager.getScannerThread(contextId); String result = null; if (scannerThread.isRunning()) { result = "RUNNING"; } else if (scannerThread.isPaused()) { result = "PAUSED"; } else if (scannerThread.isInterrupted()) { result = "INTERRUPTED"; } else { result = "SCAN NOT RUNNING"; } return result; }</code><technical_language>other method, this ends creating AccessControlScannerThread unnecessarily</technical_language>

Target:
protected String getScanStatus(int contextId) { AccessControlScannerThread scannerThread = threadManager.getScannerThread(contextId); String result = null; if (scannerThread.isRunning()) { result = "RUNNING"; } else if (scannerThread.isPaused()) { result = "PAUSED"; } else if (scannerThread.isInterrupted()) { result = "INTERRUPTED"; } else { result = "NOT RUNNING"; } return result; }
Source:
<code>private void writeOffset64() throws IOException { for (final PackedObjectInfo oe : entries) { final long o = oe.getOffset(); <START> if (o >= Integer.MAX_VALUE) { <END> NB.encodeInt64(tmp, 0, o); out.write(tmp, 0, 8); } } }</code><technical_language>nit-pick: change writeOffset32 instead? funny offset of 0x7FFFFFFF requires a 64-bit offset in JGit, in C Git</technical_language>

Target:
private void writeOffset64() throws IOException { for (final PackedObjectInfo oe : entries) { final long o = oe.getOffset(); if (OFFSET_64 <= o) { NB.encodeInt64(tmp, 0, o); out.write(tmp, 0, 8); } } }
Source:
<code>public final void endVisit(final SuperMethodInvocation node) { final IMethodBinding superBinding= node.resolveMethodBinding(); if (superBinding != null) { endVisit(node.arguments(), superBinding); ASTNode methodOrLambda= fCurrentMethodsAndLambdas.peek(); if (methodOrLambda instanceof MethodDeclaration){ <START> MethodDeclaration declaration= (MethodDeclaration) methodOrLambda; <END> final IMethodBinding subBinding= declaration.resolveBinding(); if (subBinding != null) { final ConstraintVariable2 ancestor= fModel.createReturnTypeVariable(superBinding); if (ancestor != null) { node.setProperty(PROPERTY_CONSTRAINT_VARIABLE, ancestor); final ConstraintVariable2 descendant= fModel.createReturnTypeVariable(subBinding); if (descendant != null) fModel.createEqualityConstraint(descendant, ancestor); } } } } }</code><technical_language>Inline 'declaration'</technical_language>

Target:
public final void endVisit(final SuperMethodInvocation node) { final IMethodBinding superBinding= node.resolveMethodBinding(); if (superBinding != null) { endVisit(node.arguments(), superBinding); ASTNode methodOrLambda= fCurrentMethodsAndLambdas.peek(); if (methodOrLambda instanceof MethodDeclaration){ final IMethodBinding subBinding= ((MethodDeclaration) methodOrLambda).resolveBinding(); if (subBinding != null) { final ConstraintVariable2 ancestor= fModel.createReturnTypeVariable(superBinding); if (ancestor != null) { node.setProperty(PROPERTY_CONSTRAINT_VARIABLE, ancestor); final ConstraintVariable2 descendant= fModel.createReturnTypeVariable(subBinding); if (descendant != null) fModel.createEqualityConstraint(descendant, ancestor); } } } } }
Source:
<code>public JsonElement serialize(JoinBatchInformation batch, Type typeOfSrc, JsonSerializationContext context) { JsonObject result = new JsonObject(); result.add("class", new JsonPrimitive(batch.getClass().getName())); result.add("batchSize", new JsonPrimitive(batch.getBatchSize())); result.add("task", new JsonPrimitive(batch.getTask().name())); Column column = batch.getColumn(); result.add("column", new JsonPrimitive(column.getsFamily() + "\u0000" + column.getsQualifier())); Span span = batch.getSpan(); result.add("span", new JsonPrimitive(span.getStart().getsRow() + "\u0000" + span.getEnd().getsRow())); result.add("startInc", new JsonPrimitive(span.isStartInclusive())); result.add("endInc", new JsonPrimitive(span.isEndInclusive())); if(batch.getAggregationStateMeta().isPresent()) { CommonNodeMetadataImpl stateMeta = batch.getAggregationStateMeta().get(); <START> result.add("aggStateMeta", new JsonPrimitive(stateMeta.getNodeId() + "\u0000" + stateMeta.getVariableOrder().toString())); <END> } result.add("side", new JsonPrimitive(batch.getSide().name())); result.add("joinType", new JsonPrimitive(batch.getJoinType().name())); String updateVarOrderString = Joiner.on(";").join(batch.getBs().getBindingNames()); VariableOrder updateVarOrder = new VariableOrder(updateVarOrderString); result.add("bindingSet", new JsonPrimitive(converter.convert(batch.getBs(), updateVarOrder))); result.add("updateVarOrder", new JsonPrimitive(updateVarOrderString)); return result; }</code><technical_language>move null character common</technical_language>

Target:
public JsonElement serialize(JoinBatchInformation batch, Type typeOfSrc, JsonSerializationContext context) { JsonObject result = new JsonObject(); result.add("class", new JsonPrimitive(batch.getClass().getName())); result.add("batchSize", new JsonPrimitive(batch.getBatchSize())); result.add("task", new JsonPrimitive(batch.getTask().name())); Column column = batch.getColumn(); result.add("column", new JsonPrimitive(column.getsFamily() + DELIM + column.getsQualifier())); Span span = batch.getSpan(); result.add("span", new JsonPrimitive(span.getStart().getsRow() + DELIM + span.getEnd().getsRow())); result.add("startInc", new JsonPrimitive(span.isStartInclusive())); result.add("endInc", new JsonPrimitive(span.isEndInclusive())); if(batch.getAggregationStateMeta().isPresent()) { CommonNodeMetadataImpl stateMeta = batch.getAggregationStateMeta().get(); result.add("aggStateMeta", new JsonPrimitive(stateMeta.getNodeId() + DELIM + stateMeta.getVariableOrder().toString())); } result.add("side", new JsonPrimitive(batch.getSide().name())); result.add("joinType", new JsonPrimitive(batch.getJoinType().name())); String updateVarOrderString = Joiner.on(";").join(batch.getBs().getBindingNames()); VariableOrder updateVarOrder = new VariableOrder(updateVarOrderString); result.add("bindingSet", new JsonPrimitive(converter.convert(batch.getBs(), updateVarOrder))); result.add("updateVarOrder", new JsonPrimitive(updateVarOrderString)); return result; }
Source:
<code>public int read(ByteBuffer dst) throws IOException { <START> final int total = dst.remaining(); <END> final byte[] tmp = getBuf(); int read = 0; int remaining = total; while (remaining > 0) { final int n = in.read(tmp, 0, Math.min(remaining, bufferSize)); if (n == -1) { if (read == 0) { read = -1; } break; } else if (n > 0) { dst.put(tmp, 0, n); read += n; remaining -= n; } } return read; }</code><technical_language>total is for int remaining = total; remove total and: int remaining = dst.remaining(); perfect</technical_language>

Target:
public int read(ByteBuffer dst) throws IOException { int remaining = dst.remaining(); final byte[] tmp = getBuf(); int read = 0; while (remaining > 0) { final int n = in.read(tmp, 0, Math.min(remaining, bufferSize)); if (n == -1) { if (read == 0) { read = -1; } break; } else if (n > 0) { dst.put(tmp, 0, n); read += n; remaining -= n; } } return read; }
Source:
<code>public Collection<Order> getOrder(String... orderIds) throws IOException { Collection<Order> orders = new ArrayList<>(orderIds.length); for (String orderId : orderIds) { try { final GDAXOrder order = super.getOrder(orderId); orders.add(GDAXAdapters.adaptOrder(order)); } catch (final ExchangeException e) { if ( e.getCause() instanceof HttpStatusExceptionSupport && ((HttpStatusExceptionSupport)e.getCause()).getHttpStatusCode() == 404) { <START> orders.add(new Order(null, null, null, orderId, null, null, null, Order.OrderStatus.CANCELED) { }); <END> } else { throw e; } } } return orders; }</code><technical_language>ExchangeException caught handled client code. module is implemented</technical_language>

Target:
public Collection<Order> getOrder(String... orderIds) throws IOException { Collection<Order> orders = new ArrayList<>(orderIds.length); for (String orderId : orderIds) { orders.add(GDAXAdapters.adaptOrder(super.getOrder(orderId))); } return orders; }
Source:
<code>public T blockDevices(VirtualGuestBlockDevice... in) { <START> return blockDevices(ImmutableSet.copyOf(in)); <END> }</code><technical_language>Add a check prevent a null input</technical_language>

Target:
public T blockDevices(VirtualGuestBlockDevice... in) { return blockDevices(ImmutableSet.copyOf(checkNotNull(in, "blockDevices"))); }
Source:
<code><START> abstract public void doRequest(HttpServletRequest req, HttpServletResponse res) <END> throws IOException; private String getReqUrl(HttpServletRequest req) { String reqUrl = req.getRequestURL().toString(); if (req.getQueryString() != null) { reqUrl += "?" + req.getQueryString(); } return reqUrl; }</code><technical_language>nit: public abstract void</technical_language>

Target:
protected abstract void doRequest(HttpServletRequest req, HttpServletResponse res) throws IOException; private static String getReqUrl(HttpServletRequest req) { StringBuffer url = req.getRequestURL(); if (req.getQueryString() != null) { url.append('?').append(req.getQueryString()); } return url.toString(); }
Source:
<code>protected boolean canDoAction() { boolean returnValue = true; final VmStatic vmStatic = DbFacade.getInstance().getVmStaticDao().get(getParameters().getVmId()); if (vmStatic != null) { setComputerName(vmStatic.getName()); returnValue = ((Boolean) LdapFactory .getInstance(getParameters().getDomain()) .RunAdAction(AdActionType.IsComputerWithTheSameNameExists, new LdapIsComputerWithSameNameExistsParameters(getActualDomain(), getActualUser(), getActualPassword(), getComputerName())) .getReturnValue()).booleanValue(); if (returnValue) { <START> addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_NAME_ALREADY_USED); <END> } } else { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__CREATE); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__COMPUTER_ACCOUNT); addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_EXIST); } return !returnValue; }</code><technical_language>set ${type} ${action} for this work. worth while moving setActionMessageParameters() while it</technical_language>

Target:
protected boolean canDoAction() { boolean returnValue = true; final VmStatic vmStatic = DbFacade.getInstance().getVmStaticDao().get(getParameters().getVmId()); if (vmStatic != null) { setComputerName(vmStatic.getName()); returnValue = ((Boolean) LdapFactory .getInstance(getParameters().getDomain()) .RunAdAction(AdActionType.IsComputerWithTheSameNameExists, new LdapIsComputerWithSameNameExistsParameters(getActualDomain(), getActualUser(), getActualPassword(), getComputerName())) .getReturnValue()).booleanValue(); if (returnValue) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_NAME_ALREADY_USED); } } else { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_EXIST); } addCanDoActionMessage(VdcBllMessages.VAR__ACTION__CREATE); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__COMPUTER_ACCOUNT); return !returnValue; }
Source:
<code>Observable createRequestObservable(final Callable<ResponseWrapper> request) { return Observable.create(new Observable.OnSubscribe<Object>() { @Override public void call(Subscriber<? super Object> subscriber) { if (subscriber.isUnsubscribed()) { return; } try { ResponseWrapper wrapper = request.call(); if (subscriber.isUnsubscribed()) { return; } <START> subscriber.onNext(wrapper.responseBody); <END> subscriber.onCompleted(); } catch (RetrofitError e) { subscriber.onError(errorHandler.handleError(e)); } catch (Exception e) { throw new RuntimeException(e); } } }).subscribeOn(scheduler); }</code><technical_language>change this method onNext is called of try/catch invokes request. I do in a follow-up</technical_language>

Target:
Observable createRequestObservable(final Callable<ResponseWrapper> request) { return Observable.create(new Observable.OnSubscribe<Object>() { @Override public void call(Subscriber<? super Object> subscriber) { if (subscriber.isUnsubscribed()) { return; } final FutureTask<Void> task = new FutureTask<Void>(getRunnable(subscriber, request), null); final Subscription s = Subscriptions.from(task); subscriber.add(s); executor.execute(task); } }); }
Source:
<code>private static IBinding createLabelReferenceBinding(IASTName name, IASTUnaryExpression expression) { IBinding binding = null; IScope scope = getContainingScope(name); IASTInternalScope s = (IASTInternalScope) scope; IASTNode node = s.getPhysicalNode(); while (node != null && !(node instanceof IASTFunctionDefinition)) { node = node.getParent(); } if (node != null) { IASTFunctionDefinition definition = (IASTFunctionDefinition) node; CPPASTFunctionDeclarator declarator = (CPPASTFunctionDeclarator) definition.getDeclarator(); scope = declarator.getFunctionScope(); if (scope != null) { binding = scope.getBinding(name, false); <START> if (binding == null || !(binding instanceof ILabel)) { <END> binding = new CPPLabel(name); ASTInternal.addName(scope, name); } } } if (binding == null) { binding = new CPPScope.CPPScopeProblem(expression, IProblemBinding.SEMANTIC_BAD_SCOPE, expression.getRawSignature().toCharArray()); } return binding; }</code><technical_language>is redundant check !(binding instanceof ILabel) sufficient catch null case</technical_language>

Target:
private static IBinding createLabelReferenceBinding(IASTName name, IASTUnaryExpression expression) { IBinding binding = null; IScope scope = getContainingScope(name); IASTInternalScope s = (IASTInternalScope) scope; IASTNode node = s.getPhysicalNode(); while (node != null && !(node instanceof IASTFunctionDefinition)) { node = node.getParent(); } if (node != null) { IASTFunctionDefinition definition = (IASTFunctionDefinition) node; CPPASTFunctionDeclarator declarator = (CPPASTFunctionDeclarator) definition.getDeclarator(); scope = declarator.getFunctionScope(); if (scope != null) { binding = scope.getBinding(name, false); if (!(binding instanceof ILabel)) { binding = new CPPLabel(name); ASTInternal.addName(scope, name); } } } if (binding == null) { binding = new CPPScope.CPPScopeProblem(expression, IProblemBinding.SEMANTIC_BAD_SCOPE, expression.getRawSignature().toCharArray()); } return binding; }
Source:
<code>private Reference newInfo(Integer position, ColumnIdent column, DataType type, @Nullable String formattedDefaultExpression, ColumnPolicy columnPolicy, Reference.IndexType indexType, boolean nullable, boolean columnStoreEnabled) { Symbol defaultExpression = null; if (formattedDefaultExpression != null) { ExpressionAnalyzer expressionAnalyzer <START> = new ExpressionAnalyzer(functions, <END> CoordinatorTxnCtx.systemTransactionContext(), ParamTypeHints.EMPTY, FieldProvider.UNSUPPORTED, null); Expression expression = SqlParser.createExpression(formattedDefaultExpression); defaultExpression = expressionAnalyzer.convert(expression, new ExpressionAnalysisContext()); } return new Reference( refIdent(column), granularity(column), type, columnPolicy, indexType, nullable, columnStoreEnabled, position, defaultExpression ); }</code><technical_language>I sense create this once? in constructor</technical_language>

Target:
private Reference newInfo(Integer position, ColumnIdent column, DataType type, @Nullable String formattedDefaultExpression, ColumnPolicy columnPolicy, Reference.IndexType indexType, boolean nullable, boolean columnStoreEnabled) { Symbol defaultExpression = null; if (formattedDefaultExpression != null) { Expression expression = SqlParser.createExpression(formattedDefaultExpression); defaultExpression = expressionAnalyzer.convert(expression, new ExpressionAnalysisContext()); } return new Reference( refIdent(column), granularity(column), type, columnPolicy, indexType, nullable, columnStoreEnabled, position, defaultExpression ); }
Source:
<code>void updatePrimaryStar() { if (_env == null || !OTOptions.isEditable(_obsComp.getProgram(), _obsComp.getContextObservation())) return; final Option<SPTarget> targetOpt = getSelectedPos(); if (targetOpt.isDefined()) { final boolean autoGroup = targetOpt.flatMap(this::getTargetGroup).exists(igg -> igg.group().isAutomatic()); if (!autoGroup) PrimaryTargetToggle.instance.toggle(_dataObject, targetOpt.getValue()); } else { getSelectedGroup().foreach(igg -> { final TargetEnvironment env = _dataObject.getTargetEnvironment(); final GuideGroup primary = env.getOrCreatePrimaryGuideGroup(); final GuideGrp grp = igg.group().grp(); <START> final GuideEnvironment ge = env.getGuideEnvironment(); <END> if (ge != null && grp instanceof AutomaticGroup.Disabled$) { final TargetEnvironment envNew = env.setGuideEnvironment(ge.setAutomaticGroup(GuideGroup.AutomaticInitial()).setPrimaryIndex(0)); _dataObject.setTargetEnvironment(envNew); _model.enableAutoRow(envNew); } else if (ge != null && primary != igg.group() && confirmGroupChange(primary, igg.group())) { _dataObject.setTargetEnvironment(env.setGuideEnvironment(ge.setPrimaryIndex(igg.index()))); if (grp instanceof AutomaticGroup.Active) { updatePosAngle(((AutomaticGroup.Active) grp).posAngle()); } } }); } }</code><technical_language>wrap ge in Option/Optional a foreach avoid null check</technical_language>

Target:
void updatePrimaryStar() { if (_env == null || !OTOptions.isEditable(_obsComp.getProgram(), _obsComp.getContextObservation())) return; final Option<SPTarget> targetOpt = getSelectedPos(); if (targetOpt.isDefined()) { final boolean autoGroup = targetOpt.flatMap(this::getTargetGroup).exists(igg -> igg.group().isAutomatic()); if (!autoGroup) PrimaryTargetToggle.instance.toggle(_dataObject, targetOpt.getValue()); } else { getSelectedGroup().foreach(igg -> { final TargetEnvironment env = _dataObject.getTargetEnvironment(); final GuideGroup primary = env.getOrCreatePrimaryGuideGroup(); ImOption.apply(env.getGuideEnvironment()).foreach(ge -> { final GuideGrp grp = igg.group().grp(); if (ge != null && grp instanceof AutomaticGroup.Disabled$) { final TargetEnvironment envNew = env.setGuideEnvironment(ge.setAutomaticGroup(GuideGroup.AutomaticInitial()).setPrimaryIndex(0)); _dataObject.setTargetEnvironment(envNew); _model.enableAutoRow(envNew); } else if (ge != null && primary != igg.group() && confirmGroupChange(primary, igg.group())) { _dataObject.setTargetEnvironment(env.setGuideEnvironment(ge.setPrimaryIndex(igg.index()))); if (grp instanceof AutomaticGroup.Active) { updatePosAngle(((AutomaticGroup.Active) grp).posAngle()); } } }); }); } }
Source:
<code>public static void main(String[] args) throws IOException, InterruptedException, IllegalArgumentException { SecretAsyncClient secretAsyncClient = new SecretClientBuilder() .endpoint("https://{YOUR_VAULT_NAME}.vault.azure.net") .credential(new DefaultAzureCredentialBuilder().build()) .buildAsyncClient(); secretAsyncClient.setSecret(new Secret("StorageAccountPassword", "f4G34fMh8v-fdsgjsk2323=-asdsdfsdf") .setExpires(OffsetDateTime.now().plusYears(1))) .subscribe(secretResponse -> System.out.printf("Secret is created with name %s and value %s \n", secretResponse.getName(), secretResponse.getValue())); Thread.sleep(2000); String backupFilePath = "YOUR_BACKUP_FILE_PATH"; secretAsyncClient.backupSecret("StorageAccountPassword").subscribe(backupResponse -> { byte[] backupBytes = backupResponse; writeBackupToFile(backupBytes, backupFilePath); }); Thread.sleep(7000); secretAsyncClient.deleteSecret("StorageAccountPassword").subscribe(deletedSecretResponse -> System.out.printf("Deleted Secret's Recovery Id %s \n", deletedSecretResponse.getRecoveryId())); Thread.sleep(30000); secretAsyncClient.purgeDeletedSecretWithResponse("StorageAccountPassword").subscribe(purgeResponse -> <START> System.out.printf("Purge Status response %d \n", purgeResponse.getStatusCode())); <END> Thread.sleep(15000); byte[] backupFromFile = Files.readAllBytes(new File(backupFilePath).toPath()); secretAsyncClient.restoreSecret(backupFromFile).subscribe(secretResponse -> System.out.printf("Restored Secret with name %s \n", secretResponse.getName())); Thread.sleep(15000); }</code><technical_language>%n</technical_language>

Target:
public static void main(String[] args) throws IOException, InterruptedException, IllegalArgumentException { SecretAsyncClient secretAsyncClient = new SecretClientBuilder() .endpoint("https://{YOUR_VAULT_NAME}.vault.azure.net") .credential(new DefaultAzureCredentialBuilder().build()) .buildAsyncClient(); secretAsyncClient.setSecret(new Secret("StorageAccountPassword", "f4G34fMh8v-fdsgjsk2323=-asdsdfsdf") .setExpires(OffsetDateTime.now().plusYears(1))) .subscribe(secretResponse -> System.out.printf("Secret is created with name %s and value %s %n", secretResponse.getName(), secretResponse.getValue())); Thread.sleep(2000); String backupFilePath = "YOUR_BACKUP_FILE_PATH"; secretAsyncClient.backupSecret("StorageAccountPassword").subscribe(backupResponse -> { byte[] backupBytes = backupResponse; writeBackupToFile(backupBytes, backupFilePath); }); Thread.sleep(7000); secretAsyncClient.deleteSecret("StorageAccountPassword").subscribe(deletedSecretResponse -> System.out.printf("Deleted Secret's Recovery Id %s %n", deletedSecretResponse.getRecoveryId())); Thread.sleep(30000); secretAsyncClient.purgeDeletedSecretWithResponse("StorageAccountPassword").subscribe(purgeResponse -> System.out.printf("Purge Status response %d %n", purgeResponse.getStatusCode())); Thread.sleep(15000); byte[] backupFromFile = Files.readAllBytes(new File(backupFilePath).toPath()); secretAsyncClient.restoreSecret(backupFromFile).subscribe(secretResponse -> System.out.printf("Restored Secret with name %s %n", secretResponse.getName())); Thread.sleep(15000); }
Source:
<code>private void handleForcedToPayOnlyForCurrentPayment(Game game, ManaPool pool, ManaCosts referenceCosts) { if (pool.isForcedToPay()) { <START> if (referenceCosts != null && this.getPayment().equals(referenceCosts.getPayment())) { <END> UUID playerId = pool.getPlayerId(); Player player = game.getPlayer(playerId); if (player != null) { game.undo(playerId); this.clearPaid(); game.bookmarkState(); } } } }</code><technical_language>I reading this correctly: if referenceCosts null current payment is equal referenceCosts payment --> rollback. I thought for word of command wanted opposite? is, if current payment is **not** equal reference cost of commanded card, rollback (since player produced mana pay for commanded card, is illegal casting of Word of Command). new Java I missing here</technical_language>

Target:
private void handleForcedToPayOnlyForCurrentPayment(Game game, ManaPool pool, ManaCosts referenceCosts) { if (pool.isForcedToPay()) { if (referenceCosts != null && this.getText().equals(referenceCosts.getText())) { UUID playerId = pool.getPlayerId(); Player player = game.getPlayer(playerId); if (player != null) { game.undo(playerId); this.clearPaid(); this.setX(referenceCosts.getX()); player.getManaPool().restoreMana(pool.getPoolBookmark()); game.bookmarkState(); } } } }
Source:
<code>protected void onMethodInvocationFound(MethodInvocationTree mit) { ExpressionTree argument = mit.arguments().get(0); if (mit.symbolType().is(PATTERN)) { <START> if (argument.is(Tree.Kind.NULL_LITERAL) || (checkArgs(argument) && invokedOnlyOnce(mit))) { <END> return; } } else { if (!argument.is(Tree.Kind.STRING_LITERAL) || ("split".equals(((MemberSelectExpressionTree) mit.methodSelect()).identifier().name()) && specialCaseNotReported(argument))) { return; } } reportIssue(mit, "Refactor this code to use a \"static final\" Pattern."); }</code><technical_language>I understand, rule description, null literal is a case part of condition appears a bit coming out of nowhere. I understand, this means a variable passed argument of a compile method raise issue is expected (false positive)</technical_language>

Target:
protected void onMethodInvocationFound(MethodInvocationTree mit) { ExpressionTree firstArgument = ExpressionUtils.skipParentheses(mit.arguments().get(0)); if (isSplitMethod(mit) && firstArgument.is(Tree.Kind.STRING_LITERAL)) { String argValue = LiteralUtils.trimQuotes(((LiteralTree) firstArgument).value()); if ((exceptionSplitMethod(argValue) && !SPLIT_EXCLUSION.matcher(argValue).matches()) || metaCharactersInSplit(argValue)) { return; } } if (!storedInStaticFinal(mit) && (firstArgument.is(Tree.Kind.STRING_LITERAL) || isConstant(firstArgument))) { reportIssue(ExpressionUtils.methodName(mit), mit.arguments(), "Refactor this code to use a \"static final\" Pattern."); } }
Source:
<code>public void pageFindByCandidateEntityShouldFindSingleApplicationForCandidateWithSingleApplication() { CandidateEntity candidateEntityA = this.candidateRepository.findOne(CANDIDATE_A_ID); ChannelEntity expectedChannelEntity = ChannelEntity.builder() .id(1L) .name("direkt") .build(); PositionEntity expectedPositionEntity = PositionEntity.builder() .id(1L) .name("Fejlesztő") .build(); Date nearNow = currentDateMinus(5); <START> Page<ApplicationEntity> <END> pageResult = this.repository.findByCandidateEntity(candidateEntityA, DEFAULT_PAGE_REQUEST); List<ApplicationEntity> result = pageResult.getContent(); assertThat(pageResult.getTotalPages(), is(1)); assertThat(pageResult.getTotalElements(), is(1L)); assertThat(result, notNullValue()); assertThat(result.size(), is(1)); assertApplicationEntity(result.get(0), candidateEntityA, expectedChannelEntity, expectedPositionEntity, nearNow); }</code><technical_language>local variables final</technical_language>

Target:
public void pageFindByCandidateEntityShouldFindSingleApplicationForCandidateWithSingleApplication() { CandidateEntity candidateEntityA = this.candidateRepository.findOne(CANDIDATE_A_ID); ChannelEntity expectedChannelEntity = ChannelEntity.builder() .id(1L) .name(CHANNEL_NAME_DIRECT) .deleted(false) .build(); PositionEntity expectedPositionEntity = PositionEntity.builder() .id(1L) .name(POSITION_NAME_DEVELOPER) .deleted(false) .build(); Date nearNow = currentDateMinus(5); final Page<ApplicationEntity> pageResult = this.repository.findByCandidateEntity(candidateEntityA, DEFAULT_PAGE_REQUEST); final List<ApplicationEntity> result = pageResult.getContent(); assertThat(pageResult.getTotalPages(), is(1)); assertThat(pageResult.getTotalElements(), is(1L)); assertThat(result, notNullValue()); assertThat(result.size(), is(1)); assertApplicationEntity(result.get(0), candidateEntityA, expectedChannelEntity, expectedPositionEntity, nearNow); }
Source:
<code>public void testDrawTextAlignment() throws Exception { git.commit().setMessage("initial commit").call(); git.branchCreate().setName("topic").call(); git.checkout().setName("topic").call(); git.commit().setMessage("commit 1 on topic").call(); git.commit().setMessage("commit 2 on topic").call(); git.checkout().setName("master").call(); git.commit().setMessage("commit on master").call(); MergeResult mergeCall = merge(db.resolve("topic")); ObjectId start = mergeCall.getNewHead(); PlotCommitList<PlotLane> commitList = createCommitList(start); <START> for (int i = 0; i < commitList.size(); i++) { <END> plotRenderer.paintCommit(commitList.get(i), 30); } List<Integer> indentations = plotRenderer.indentations; assertEquals(indentations.get(2), indentations.get(3)); }</code><technical_language>style nit: braces single line blocks</technical_language>

Target:
public void testDrawTextAlignment() throws Exception { git.commit().setMessage("initial commit").call(); git.branchCreate().setName("topic").call(); git.checkout().setName("topic").call(); git.commit().setMessage("commit 1 on topic").call(); git.commit().setMessage("commit 2 on topic").call(); git.checkout().setName("master").call(); git.commit().setMessage("commit on master").call(); MergeResult mergeCall = merge(db.resolve("topic")); ObjectId start = mergeCall.getNewHead(); PlotCommitList<PlotLane> commitList = createCommitList(start); for (int i = 0; i < commitList.size(); i++) plotRenderer.paintCommit(commitList.get(i), 30); List<Integer> indentations = plotRenderer.indentations; assertEquals(indentations.get(2), indentations.get(3)); }
Source:
<code>public void initProperties(IMemento memento) { IMemento presentationMemento = null; for (IMemento <START> memento2 : <END> memento.getChildren(PRESENTATION_CONTEXT_PROPERTIES)) { if (getId().equals(memento2.getID())) { presentationMemento = memento2; break; } } if (presentationMemento != null) { for (IMemento stringPropertie : presentationMemento.getChildren(STRING)) { fProperties.put(stringPropertie.getID(), stringPropertie.getString(STRING)); } for (IMemento integerMemento : presentationMemento.getChildren(INTEGER)) { fProperties.put(integerMemento.getID(), integerMemento.getInteger(INTEGER)); } for (IMemento booleanMemento : presentationMemento.getChildren(BOOLEAN)) { fProperties.put(booleanMemento.getID(), booleanMemento.getBoolean(BOOLEAN)); } for (IMemento persistableMemento : presentationMemento.getChildren(PERSISTABLE)) { String factoryID = persistableMemento.getString(PERSISTABLE); if (factoryID != null) { IElementFactory factory = PlatformUI.getWorkbench().getElementFactory(factoryID); if (factory != null) { Object element = factory.createElement(persistableMemento); if (element != null) { fProperties.put(persistableMemento.getID(), element); } } } } } }</code><technical_language>rename mem childMemento</technical_language>

Target:
public void initProperties(IMemento memento) { IMemento presentationMemento = null; for (IMemento childMemento : memento.getChildren(PRESENTATION_CONTEXT_PROPERTIES)) { if (getId().equals(childMemento.getID())) { presentationMemento = childMemento; break; } } if (presentationMemento != null) { for (IMemento stringProperty : presentationMemento.getChildren(STRING)) { fProperties.put(stringProperty.getID(), stringProperty.getString(STRING)); } for (IMemento integerMemento : presentationMemento.getChildren(INTEGER)) { fProperties.put(integerMemento.getID(), integerMemento.getInteger(INTEGER)); } for (IMemento booleanMemento : presentationMemento.getChildren(BOOLEAN)) { fProperties.put(booleanMemento.getID(), booleanMemento.getBoolean(BOOLEAN)); } for (IMemento persistableMemento : presentationMemento.getChildren(PERSISTABLE)) { String factoryID = persistableMemento.getString(PERSISTABLE); if (factoryID != null) { IElementFactory factory = PlatformUI.getWorkbench().getElementFactory(factoryID); if (factory != null) { Object element = factory.createElement(persistableMemento); if (element != null) { fProperties.put(persistableMemento.getID(), element); } } } } } }
Source:
<code>public void testListAllLibraryTypes() throws Exception { List<LibraryType> libraryTypes = dao.listAllLibraryTypes(); <START> assertTrue(libraryTypes.size() > 0); <END> }</code><technical_language>ideal clear repopulate LibraryType table in V9000 test data migration. easier test exact controlled number of LibraryTypes, making tests more lenient. LibrarySelectionType</technical_language>

Target:
public void testListAllLibraryTypes() throws Exception { List<LibraryType> libraryTypes = dao.listAllLibraryTypes(); assertEquals(10, libraryTypes.size()); }