auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void createShippingMethodWithPredicateAndLocalizedDescription() throws Exception { final CurrencyUnit currencyUnit = USD; final TaxRateDraft taxRate = TaxRateDraft.of("x20", 0.20, true, COUNTRY_CODE); withZone(client(), zone -> { withTaxCategory(client(), TaxCategoryDraft.of("taxcat", asList(taxRate)), taxCategory -> { final ZoneRateDraft zoneRateDraft = ZoneRateDraftBuilder.of(zone.toResourceIdentifier(), asList(ShippingRate.of(MoneyImpl.of(30, currencyUnit)))).build(); final ShippingMethodDraft draft = ShippingMethodDraftBuilder.of("standard shipping", LocalizedString.of(ENGLISH, "description"), taxCategory.toReference(), asList(zoneRateDraft), false) .predicate(CartPredicate.of("customer.email = \"john@example.com\"")) .build(); <START> final ShippingMethod shippingMethod = client().executeBlocking(ShippingMethodCreateCommand.of(draft)); <END> client().executeBlocking(ShippingMethodDeleteCommand.of(shippingMethod)); }); }, COUNTRY_CODE); }</code><technical_language>above, I suggest add assert here</technical_language>

Target:
public void createShippingMethodWithPredicateAndLocalizedDescription() throws Exception { final CurrencyUnit currencyUnit = USD; final TaxRateDraft taxRate = TaxRateDraft.of("x20", 0.20, true, COUNTRY_CODE); withZone(client(), zone -> { withTaxCategory(client(), TaxCategoryDraft.of("taxcat", asList(taxRate)), taxCategory -> { LocalizedString localizedDescription = LocalizedString.of(ENGLISH, "description"); final ZoneRateDraft zoneRateDraft = ZoneRateDraftBuilder.of(zone.toResourceIdentifier(), asList(ShippingRate.of(MoneyImpl.of(30, currencyUnit)))).build(); final ShippingMethodDraft draft = ShippingMethodDraftBuilder.of("standard shipping", localizedDescription, taxCategory.toReference(), asList(zoneRateDraft), false) .predicate(CartPredicate.of("customer.email = \"john@example.com\"")) .build(); final ShippingMethod shippingMethod = client().executeBlocking(ShippingMethodCreateCommand.of(draft)); assertThat(shippingMethod.getLocalizedDescription()).isEqualTo(localizedDescription); client().executeBlocking(ShippingMethodDeleteCommand.of(shippingMethod)); }); }, COUNTRY_CODE); }
Source:
<code>public void applySecret(KubernetesEnvironment env, RuntimeIdentity runtimeIdentity, Secret secret) throws InfrastructureException { boolean secretAutomount = <START> Boolean.parseBoolean(secret.getMetadata().getAnnotations().get(ANNOTATION_AUTOMOUNT)); <END> for (PodData podData : env.getPodsData().values()) { if (!podData.getRole().equals(PodRole.DEPLOYMENT)) { continue; } for (Container container : podData.getSpec().getContainers()) { Optional<ComponentImpl> component = getComponent(env, container.getName()); if (component.isPresent() && isComponentAutomountFalse(component.get())) { continue; } if (!secretAutomount && (component.isEmpty() || !isComponentAutomountTrue(component.get()))) { continue; } for (Entry<String, String> secretDataEntry : secret.getData().entrySet()) { final String mountEnvName = envName(secret, secretDataEntry.getKey(), runtimeIdentity); container .getEnv() .add( new EnvVarBuilder() .withName(mountEnvName) .withValueFrom( new EnvVarSourceBuilder() .withSecretKeyRef( new SecretKeySelectorBuilder() .withName(secret.getMetadata().getName()) .withKey(secretDataEntry.getKey()) .build()) .build()) .build()); } } } }</code><technical_language>ensure secret.getMetadata().getAnnotations() of this part's null</technical_language>

Target:
public void applySecret(KubernetesEnvironment env, RuntimeIdentity runtimeIdentity, Secret secret) throws InfrastructureException { boolean secretAutomount = Boolean.parseBoolean(secret.getMetadata().getAnnotations().get(ANNOTATION_AUTOMOUNT)); for (PodData podData : env.getPodsData().values()) { if (!podData.getRole().equals(PodRole.DEPLOYMENT)) { continue; } for (Container container : podData.getSpec().getContainers()) { Optional<ComponentImpl> component = getComponent(env, container.getName()); if (component.isPresent() && isComponentAutomountFalse(component.get())) { continue; } if (!secretAutomount && (!component.isPresent() || !isComponentAutomountTrue(component.get()))) { continue; } for (Entry<String, String> secretDataEntry : secret.getData().entrySet()) { final String mountEnvName = envName(secret, secretDataEntry.getKey(), runtimeIdentity); container .getEnv() .add( new EnvVarBuilder() .withName(mountEnvName) .withValueFrom( new EnvVarSourceBuilder() .withSecretKeyRef( new SecretKeySelectorBuilder() .withName(secret.getMetadata().getName()) .withKey(secretDataEntry.getKey()) .build()) .build()) .build()); } } } }
Source:
<code><START> public void setValue(String value, boolean fireEvents) { <END> boolean newValue = false; if (value == null) { return; } List<String> values = getItemsToSelect(value); if (selectedItemsString == null || selectedItems.size() == values.size() && selectedItems.containsAll(values)) { return; } else { for (String item : values) { if (!checkBoxes.containsKey(item)) { addCheckBoxOptions(item); newValue = true; } } if (!newValue) { setSelections(values); } } }</code><technical_language>if fireEvents is true, supposed fire a ValueChangeEvent. appears missing. Or, if a reason fireEvents used, combine this method method above</technical_language>

Target:
public void setValue(String value, boolean fireEvents) { boolean newValue = false; if (value == null) { return; } List<String> values = Arrays.asList(value.split(",")); if (selectedItemsString == null || selectedItems.size() == values.size() && selectedItems.containsAll(values)) { return; } else { for (String item : values) { if (!checkBoxes.containsKey(item)) { addCheckBox(item); newValue = true; } } if (!newValue) { setSelections(values); } } if (fireEvents) { ValueChangeEvent.fire(this, value); } }
Source:
<code>public void processAssignWorkAction() throws IOException, InterruptedException { <START> new SystemEnvironment().set(SystemEnvironment.WEBSOCKET_ENABLED, true); <END> ArgumentCaptor<Message> argumentCaptor = ArgumentCaptor.forClass(Message.class); agentController = createAgentController(); agentController.init(); agentController.process(new Message(Action.assignWork, MessageEncoding.encodeWork(new SleepWork("work1", 0)))); assertThat(agentController.getAgentRuntimeInfo().getRuntimeStatus(), is(AgentRuntimeStatus.Idle)); verify(webSocketSessionHandler, times(2)).sendAndWaitForAcknowledgement(argumentCaptor.capture()); verify(artifactsManipulator).setProperty(null, new Property("work1_result", "done")); Message message = argumentCaptor.getAllValues().get(1); assertThat(message.getAcknowledgementId(), notNullValue()); assertThat(message.getAction(), is(Action.ping)); assertThat(message.getData(), is(MessageEncoding.encodeData(agentController.getAgentRuntimeInfo()))); Message message2 = argumentCaptor.getAllValues().get(0); assertThat(message2.getAcknowledgementId(), notNullValue()); assertThat(message2.getAction(), is(Action.consoleOut)); assertThat(message2.getData(), is(MessageEncoding.encodeData(new ConsoleTransmission("Sleeping for 0 milliseconds", new JobIdentifier())))); }</code><technical_language>want remember reset this variable end of test</technical_language>

Target:
public void processAssignWorkAction() throws IOException, InterruptedException { ArgumentCaptor<Message> argumentCaptor = ArgumentCaptor.forClass(Message.class); agentController = createAgentController(); agentController.init(); agentController.process(new Message(Action.assignWork, MessageEncoding.encodeWork(new SleepWork("work1", 0)))); assertThat(agentController.getAgentRuntimeInfo().getRuntimeStatus(), is(AgentRuntimeStatus.Idle)); verify(webSocketSessionHandler, times(1)).sendAndWaitForAcknowledgement(argumentCaptor.capture()); verify(artifactsManipulator).setProperty(null, new Property("work1_result", "done")); Message message = argumentCaptor.getAllValues().get(0); assertThat(message.getAcknowledgementId(), notNullValue()); assertThat(message.getAction(), is(Action.ping)); assertThat(message.getData(), is(MessageEncoding.encodeData(agentController.getAgentRuntimeInfo()))); }
Source:
<code>public List<TKeyExtent> bulkImport(TInfo tinfo, TCredentials credentials, final long tid, final Map<TKeyExtent,Map<String,MapFileInfo>> files, final boolean setTime) throws ThriftSecurityException { if (!security.canPerformSystemActions(credentials)) throw new ThriftSecurityException(credentials.getPrincipal(), SecurityErrorCode.PERMISSION_DENIED); try { return watcher.run(Constants.BULK_ARBITRATOR_TYPE, tid, () -> { List<TKeyExtent> failures = new ArrayList<>(); <START> files.entrySet().forEach((entry) -> { <END> TKeyExtent tke = entry.getKey(); Map<String,MapFileInfo> fileMap = entry.getValue(); Map<FileRef,MapFileInfo> fileRefMap = new HashMap<>(); for (Entry<String,MapFileInfo> mapping : fileMap.entrySet()) { Path path = new Path(mapping.getKey()); FileSystem ns = fs.getVolumeByPath(path).getFileSystem(); path = ns.makeQualified(path); fileRefMap.put(new FileRef(path.toString(), path), mapping.getValue()); } Tablet importTablet = onlineTablets.get(new KeyExtent(tke)); if (importTablet == null) { failures.add(tke); } else { try { importTablet.importMapFiles(tid, fileRefMap, setTime); } catch (IOException ioe) { log.info("files not imported to {}: {}", fileMap.keySet(), new KeyExtent(tke), ioe.getMessage()); failures.add(tke); } } }); return failures; }); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } }</code><technical_language>files.forEach((k,v) -> {}) cleaner files.entrySet().forEach(entry -> { entry.getKey()... entry.getValue()...})</technical_language>

Target:
public List<TKeyExtent> bulkImport(TInfo tinfo, TCredentials credentials, final long tid, final Map<TKeyExtent,Map<String,MapFileInfo>> files, final boolean setTime) throws ThriftSecurityException { if (!security.canPerformSystemActions(credentials)) { throw new ThriftSecurityException(credentials.getPrincipal(), SecurityErrorCode.PERMISSION_DENIED); } try { return watcher.run(Constants.BULK_ARBITRATOR_TYPE, tid, () -> { List<TKeyExtent> failures = new ArrayList<>(); files.forEach((tke, fileMap) -> { Map<FileRef,MapFileInfo> fileRefMap = new HashMap<>(); fileMap.forEach((key, mapping) -> { Path path = new Path(key); FileSystem ns = fs.getVolumeByPath(path).getFileSystem(); path = ns.makeQualified(path); fileRefMap.put(new FileRef(path.toString(), path), mapping); }); Tablet importTablet = getOnlineTablet(new KeyExtent(tke)); if (importTablet == null) { failures.add(tke); } else { try { importTablet.importMapFiles(tid, fileRefMap, setTime); } catch (IOException ioe) { log.info("files not imported to {}: {}", fileMap.keySet(), new KeyExtent(tke), ioe.getMessage()); failures.add(tke); } } }); return failures; }); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } }
Source:
<code>private Query parseQuery(String queryString, Analyzer analyzer) throws ParseException { <START> Query query = null; <END> switch(queryParserType) { case "QueryParser": QueryParser qp = new QueryParser(docDef.getPrimaryField(), analyzer) ; qp.setAllowLeadingWildcard(true) ; query = qp.parse(queryString); break; case "AnalyzingQueryParser": qp = new QueryParser(docDef.getPrimaryField(), analyzer) ; qp.setAllowLeadingWildcard(true) ; query = qp.parse(queryString); break; case "ComplexPhraseQueryParser": qp = new ComplexPhraseQueryParser(docDef.getPrimaryField(), analyzer); qp.setAllowLeadingWildcard(true) ; query = qp.parse(queryString); break; case "SurroundQueryParser": try { query = org.apache.lucene.queryparser.surround.parser.QueryParser.parse(queryString).makeLuceneQueryField(docDef.getPrimaryField(), new BasicQueryFactory()); } catch(org.apache.lucene.queryparser.surround.parser.ParseException e) { throw new ParseException(e.getMessage()); } break; default: log.warn("Unknown query parser type '" + queryParserType + "'. Defaulting to standard QueryParser") ; qp = new QueryParser(docDef.getPrimaryField(), analyzer) ; qp.setAllowLeadingWildcard(true) ; query = qp.parse(queryString); } return query ; }</code><technical_language>This method a mix of tabs spaces line. Jena codebase spaces for indentation. Please change spaces</technical_language>

Target:
private Query parseQuery(String queryString, Analyzer analyzer) throws ParseException { Query query = null; QueryParser qp = null; switch(queryParserType) { case "SurroundQueryParser": try { query = org.apache.lucene.queryparser.surround.parser.QueryParser.parse(queryString).makeLuceneQueryField(docDef.getPrimaryField(), new BasicQueryFactory()); } catch(org.apache.lucene.queryparser.surround.parser.ParseException e) { throw new ParseException(e.getMessage()); } return query; case "ComplexPhraseQueryParser": qp = new ComplexPhraseQueryParser(docDef.getPrimaryField(), analyzer); break; case "AnalyzingQueryParser": log.warn("Deprecated query parser type 'AnalyzingQueryParser'. Defaulting to standard QueryParser"); break; default: log.warn("Unknown query parser type '" + queryParserType + "'. Defaulting to standard QueryParser"); } if (qp == null) qp = new QueryParser(docDef.getPrimaryField(), analyzer); qp.setAllowLeadingWildcard(true); query = qp.parse(queryString); return query ; }
Source:
<code>public <T extends RegisteredService> T findServiceByName(final String name, final Class<T> clazz) { <START> var result= this.serviceRegistry.findServiceByExactServiceName(name, clazz); <END> services.get(result.getId(), k-> result); return result; }</code><technical_language>suggestion var result = this.serviceRegistry.findServiceByExactServiceName(name, clazz);</technical_language>

Target:
public <T extends RegisteredService> T findServiceByName(final String name, final Class<T> clazz) { if (StringUtils.isBlank(name)) { return null; } var service = getService(name, 0); if (service != null && service.getClass().equals(clazz)) { return (T) service; } else { LOGGER.trace("The service with name and type is not found in the cache; trying to find it from [{}]", name, clazz, serviceRegistry.getName()); service = this.serviceRegistry.findServiceByExactServiceName(name, clazz); if (service != null) { services.put(service.getId(), service); LOGGER.trace("The service is found in and populated to the cache ", serviceRegistry.getName(), service); } } return (T) validateRegisteredService(service); }
Source:
<code>private GridFutureAdapter<?> startWrite(String key, byte[] valBytes) throws IgniteCheckedException { GridFutureAdapter<?> validationRes = validateBeforeWrite(key); if (validationRes != null) return validationRes; UUID reqId = UUID.randomUUID(); GridFutureAdapter<Boolean> fut = new GridFutureAdapter<>(); updateFutsStopLock.readLock().lock(); try { <START> if (stopped) { fut.onDone(nodeStoppingException()); <END> return fut; } updateFuts.put(reqId, fut); } finally { updateFutsStopLock.readLock().unlock(); } DiscoveryCustomMessage msg = new DistributedMetaStorageUpdateMessage(reqId, key, valBytes); ctx.discovery().sendCustomEvent(msg); return fut; }</code><technical_language>sense move this 'validateBeforeWrite' ? 'validateBeforeWrite' executed read-lock in normal case return null</technical_language>

Target:
private GridFutureAdapter<?> startWrite(String key, byte[] valBytes) throws IgniteCheckedException { UUID reqId = UUID.randomUUID(); GridFutureAdapter<?> fut = prepareWriteFuture(key, reqId); if (fut.isDone()) return fut; DiscoveryCustomMessage msg = new DistributedMetaStorageUpdateMessage(reqId, key, valBytes); ctx.discovery().sendCustomEvent(msg); return fut; }
Source:
<code>public void expire() { if (super.isExpired()) { return; } super.expire(); try { updateStatsOnExpire(); this.transceiver.stop(); if (logger.isDebugEnabled() && getConference().includeInStatistics()) { logger.debug(transceiver.getNodeStats().prettyPrint(0)); } transceiver.teardown(); AbstractEndpointMessageTransport messageTransport = getMessageTransport(); if (messageTransport != null) { messageTransport.close(); } if (sctpManager != null) { sctpManager.closeConnection(); } } catch (Exception e) { logger.error("Exception while expiring: ", e); } bandwidthProbing.enabled = false; recurringRunnableExecutor.deRegisterRecurringRunnable(bandwidthProbing); <START> getConference().encodingsManager.unsubscribe(this); <END> dtlsTransport.close(); logger.info("Expired."); }</code><technical_language>AbstractEndpoint implements EncodingsManager.EncodingsUpdateListener, is implementation in OctoEndpoint well. intention for Octo endpoint subscribe (though I need verify detils). I move subscribe unsubscribe AbstractEndpoint</technical_language>

Target:
public void expire() { if (super.isExpired()) { return; } super.expire(); try { updateStatsOnExpire(); this.transceiver.stop(); if (logger.isDebugEnabled() && getConference().includeInStatistics()) { logger.debug(transceiver.getNodeStats().prettyPrint(0)); } transceiver.teardown(); AbstractEndpointMessageTransport messageTransport = getMessageTransport(); if (messageTransport != null) { messageTransport.close(); } if (sctpManager != null) { sctpManager.closeConnection(); } } catch (Exception e) { logger.error("Exception while expiring: ", e); } bandwidthProbing.enabled = false; recurringRunnableExecutor.deRegisterRecurringRunnable(bandwidthProbing); dtlsTransport.close(); logger.info("Expired."); }
Source:
<code>public void populateDAG(DAG dag, Configuration conf) { POJOGenerator salesGenerator = dag.addOperator("Input1", new POJOGenerator()); POJOGenerator productGenerator = dag.addOperator("Input2", new POJOGenerator()); productGenerator.setSalesEvent(false); POJOInnerJoinOperator join = dag.addOperator("Join", new POJOInnerJoinOperator()); ConsoleOutputOperator output = dag.addOperator("Output", new ConsoleOutputOperator()); dag.addStream("SalesToJoin", salesGenerator.output, join.input1); dag.addStream("ProductToJoin", productGenerator.output, join.input2); dag.addStream("JoinToConsole", join.outputPort, output.input); dag.setInputPortAttribute(join.input1, Context.PortContext.TUPLE_CLASS, POJOGenerator.SalesEvent.class); dag.setInputPortAttribute(join.input2, Context.PortContext.TUPLE_CLASS, POJOGenerator.ProductEvent.class); dag.setOutputPortAttribute(join.outputPort,Context.PortContext.TUPLE_CLASS, POJOGenerator.SalesEvent.class); <START> dag.setAttribute(join, Context.OperatorContext.PARTITIONER, new StatelessPartitioner<POJOInnerJoinOperator>(3)); <END> }</code><technical_language>please move this properties.xml instead</technical_language>

Target:
public void populateDAG(DAG dag, Configuration conf) { POJOGenerator salesGenerator = dag.addOperator("Input1", new POJOGenerator()); POJOGenerator productGenerator = dag.addOperator("Input2", new POJOGenerator()); productGenerator.setSalesEvent(false); POJOInnerJoinOperator join = dag.addOperator("Join", new POJOInnerJoinOperator()); ConsoleOutputOperator output = dag.addOperator("Output", new ConsoleOutputOperator()); dag.addStream("SalesToJoin", salesGenerator.output, join.input1); dag.addStream("ProductToJoin", productGenerator.output, join.input2); dag.addStream("JoinToConsole", join.outputPort, output.input); dag.setInputPortAttribute(join.input1, Context.PortContext.TUPLE_CLASS, POJOGenerator.SalesEvent.class); dag.setInputPortAttribute(join.input2, Context.PortContext.TUPLE_CLASS, POJOGenerator.ProductEvent.class); dag.setOutputPortAttribute(join.outputPort,Context.PortContext.TUPLE_CLASS, POJOGenerator.SalesEvent.class); }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { <START> PreferenceManager.setDefaultValues(this, R.layout.fragment_settings, false); <END> Utilities.setThemeToActivity(this, getApplicationContext()); super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_budget); mBudgetNameView = (EditText) findViewById(R.id.budget_name); mBudgetAmountView = (EditText) findViewById(R.id.budget_amount); mBudgetDateView = (DatePicker) findViewById(R.id.budget_date); mRecurringView = (CheckBox) findViewById(R.id.budget_recur); createButtonView = (Button) findViewById(R.id.create_budget_button); mBudgetDurationView = (Spinner) findViewById(R.id.budget_duration); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.duration_array, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mBudgetDurationView.setAdapter(adapter); }</code><technical_language>this line called Utilities.setThemeToActivity() method? called activities sort of intuitively fits in method</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { Utilities.setActivityTheme(this, getApplicationContext()); super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_budget); mBudgetNameView = (EditText) findViewById(R.id.budget_name); mBudgetAmountView = (EditText) findViewById(R.id.budget_amount); mBudgetDateView = (DatePicker) findViewById(R.id.budget_date); mRecurringView = (CheckBox) findViewById(R.id.budget_recur); createButtonView = (Button) findViewById(R.id.create_budget_button); mBudgetDurationView = (Spinner) findViewById(R.id.budget_duration); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.duration_array, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mBudgetDurationView.setAdapter(adapter); }
Source:
<code>protected ScheduleExpression getScheduleExpression(String cronExpression, Date start, Date end, String timeZone) { String[] splittedCronJob = cronExpression.split(" "); ScheduleExpression scheduledExpression = new ScheduleExpression(); scheduledExpression .second(splittedCronJob[0]) .minute(splittedCronJob[1]) .hour(splittedCronJob[2]) .dayOfMonth(splittedCronJob[3]) .month(splittedCronJob[4]) .dayOfWeek(StringUtils.equals(splittedCronJob[5], "?") ? "*" : splittedCronJob[5]) .year(splittedCronJob[6]) .start(start); if (end != null) { scheduledExpression.end(end); } if <START> (timeZone != null && !timeZone.isEmpty()) { <END> scheduledExpression.timezone(timeZone); } return scheduledExpression; }</code><technical_language>please use: StringUtils.isNotBlank(timeZone)</technical_language>

Target:
protected ScheduleExpression getScheduleExpression(String cronExpression, Date start, Date end, String timeZone) { String[] splittedCronJob = cronExpression.split(" "); ScheduleExpression scheduledExpression = new ScheduleExpression(); scheduledExpression .second(splittedCronJob[0]) .minute(splittedCronJob[1]) .hour(splittedCronJob[2]) .dayOfMonth(splittedCronJob[3]) .month(splittedCronJob[4]) .dayOfWeek(StringUtils.equals(splittedCronJob[5], "?") ? "*" : splittedCronJob[5]) .year(splittedCronJob[6]) .start(start); if (end != null) { scheduledExpression.end(end); } if (StringUtils.isNotBlank(timeZone)) { scheduledExpression.timezone(timeZone); } return scheduledExpression; }
Source:
<code>public SpecialAdminDashboardPageObject openSpecialAdminDashboard() { <START> getUrl(Domain + "wiki/Special:AdminDashboard"); <END> return new SpecialAdminDashboardPageObject(driver); }</code><technical_language>put "Special:..." Strings in URLContentPattern file</technical_language>

Target:
public SpecialAdminDashboardPageObject openSpecialAdminDashboard() { getUrl(Global.DOMAIN + URLsContent.specialAdminDashboard); return new SpecialAdminDashboardPageObject(driver); }
Source:
<code>public void testPut() { await( <START> multimapCache.put("names", "julien").thenCompose(r1 -> <END> multimapCache.put("names", "oihana").thenCompose(r2 -> multimapCache.put("names", "julien").thenCompose(r3 -> multimapCache.get("names").thenAccept(v -> { assertTrue(v.contains("julien")); assertEquals(1, v.stream().filter(n -> n.equals("julien")).count()); } ) ) ) ) ); await( multimapCache.get("names").thenAccept(v -> { assertFalse(v.contains("koldo")); assertEquals(2, v.size()); } ) ); }</code><technical_language>chaining wrong, be: java multimapCache.put("names", "julien") .thenCompose(r -> multimapCache.put("names", "oihana")) .thenCompose(r -> multimapCache.put("names", "julien")) .thenCompose(r -> multimapCache.get("names")) applies rest of chains well</technical_language>

Target:
public void testPut() { await( multimapCache.put(NAMES_KEY, JULIEN) .thenCompose(r1 -> multimapCache.put(NAMES_KEY, OIHANA)) .thenCompose(r2 -> multimapCache.put(NAMES_KEY, JULIEN)) .thenCompose(r3 -> multimapCache.get(NAMES_KEY)) .thenAccept(v -> { assertTrue(v.contains(JULIEN)); assertEquals(1, v.stream().filter(n -> n.equals(JULIEN)).count()); } ) ); await( multimapCache.get(NAMES_KEY).thenAccept(v -> { assertFalse(v.contains(KOLDO)); assertEquals(2, v.size()); } ) ); await( multimapCache.put(EMPTY_KEY, RAMON) .thenCompose(r1 -> multimapCache.get(EMPTY_KEY) .thenAccept(v -> { assertTrue(v.contains(RAMON)); assertEquals(1, v.stream().filter(n -> n.equals(RAMON)).count()); })) ); await( multimapCache.put(NAMES_KEY, PEPE) .thenCompose(r1 -> multimapCache.get(NAMES_KEY) .thenAccept(v -> { assertTrue(v.contains(PEPE)); assertEquals(1, v.stream().filter(n -> n.equals(PEPE)).count()); })) ); }
Source:
<code>public void edit(final GlusterVolumeGeoRepCreateModel object) { driver.edit(object); setSuggestedConfigViolations(object.getRecommendationViolations()); <START> setQueryFailureMessage(object.getQueryFailureMessage()); <END> }</code><technical_language>This is required, care presenter</technical_language>

Target:
public void edit(final GlusterVolumeGeoRepCreateModel object) { driver.edit(object); setSuggestedConfigViolations(object.getRecommendationViolations()); object.getShowEligibleVolumes().getEntityChangedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { boolean overrideSuggestedConfig = object.getShowEligibleVolumes().getEntity(); if(!overrideSuggestedConfig) { object.getVolumesForForceSessionCreate(); } else { object.getEligibleVolumes(); } } }); IEventListener<EventArgs> clusterEventListener = new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { String selectedCluster = object.getSlaveClusters().getSelectedItem(); List<GlusterVolumeEntity> volumesInCurrentCluster = new ArrayList<GlusterVolumeEntity>(); if(selectedCluster != null) { volumesInCurrentCluster = object.getVolumesInCluster(selectedCluster, object.getVolumeList()); } if(volumesInCurrentCluster.size() > 0) { object.getSlaveVolumes().setItems(volumesInCurrentCluster, volumesInCurrentCluster.get(0)); } else { object.getSlaveVolumes().setItems(volumesInCurrentCluster); } } }; object.getSlaveClusters().getSelectedItemChangedEvent().addListener(clusterEventListener); IEventListener<EventArgs> slaveVolumeEventListener = new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { GlusterVolumeEntity selectedSlaveVolume = object.getSlaveVolumes().getSelectedItem(); Set<String> hostsInCurrentVolume = new HashSet<String>(); if(!object.getShowEligibleVolumes().getEntity() && selectedSlaveVolume != null) { object.updateRecommendatonViolations(); } if(selectedSlaveVolume != null) { hostsInCurrentVolume = object.getHostNamesForVolume(selectedSlaveVolume); } object.getSlaveHosts().setItems(hostsInCurrentVolume); } }; object.getSlaveVolumes().getSelectedItemChangedEvent().addListener(slaveVolumeEventListener); }
Source:
<code>public void setValueList(List<String> valueList) { <START> StringBuilder valueBilder = new StringBuilder(); <END> for (String val : valueList) { valueBilder.append(val); valueBilder.append("; "); } this.value = valueBilder.toString(); }</code><technical_language>valueBuilder instead of valueBilder</technical_language>

Target:
public void setValueList(List<String> valueList) { StringBuilder valueBuilder = new StringBuilder(); for (String val : valueList) { valueBuilder.append(val); valueBuilder.append("; "); } this.value = valueBuilder.toString(); }
Source:
<code><START> public void processEvent(DiscoveryServiceEvent event) throws LogReplicationDiscoveryServiceException { <END> log.info("Process event {}", event.getType()); switch (event.type) { case DISCOVER_INIT_TOPOLOGY: startDiscovery(); break; case ACQUIRE_LOCK: processLockAcquire(); break; case RELEASE_LOCK: processLockRelease(); break; case DISCOVERED_TOPOLOGY: processTopologyChangeNotification(event); break; case UPGRADE: processUpgrade(event); break; default: log.error("Invalid event type {}", event.type); } }</code><technical_language>same, delete LogReplicationDiscoveryServiceException.java file now</technical_language>

Target:
public void processEvent(DiscoveryServiceEvent event) { log.info("Process event {}", event.getType()); switch (event.getType()) { case DISCOVER_INIT_TOPOLOGY: startDiscovery(); break; case ACQUIRE_LOCK: processLockAcquire(); break; case RELEASE_LOCK: processLockRelease(); break; case DISCOVERED_TOPOLOGY: processTopologyChangeNotification(event); break; case UPGRADE: processUpgrade(event); break; default: log.error("Invalid event type {}", event.getType()); } }
Source:
<code>public Object construct(String componentName) { if (componentName.equals(StreamingMarshaller.class.getName())) { return ComponentAlias.of(KnownComponentNames.INTERNAL_MARSHALLER); } else if (componentName.equals(PersistenceMarshaller.class.getName())) { <START> return ComponentAlias.of(KnownComponentNames.PERSISTENCE_MARSHALLER); <END> } switch (componentName) { case KnownComponentNames.PERSISTENCE_MARSHALLER: return new PersistenceMarshallerImpl(); case KnownComponentNames.INTERNAL_MARSHALLER: return new GlobalMarshaller(); default: throw new IllegalArgumentException(String.format("Marshaller name '%s' not recognised", componentName)); } }</code><technical_language>I prefer registering aliases a "legacy" name deprecated. PersistenceMarshaller is a new component, name for it</technical_language>

Target:
public Object construct(String componentName) { if (componentName.equals(StreamingMarshaller.class.getName())) { return ComponentAlias.of(KnownComponentNames.INTERNAL_MARSHALLER); } switch (componentName) { case KnownComponentNames.PERSISTENCE_MARSHALLER: return new PersistenceMarshallerImpl(); case KnownComponentNames.INTERNAL_MARSHALLER: return new GlobalMarshaller(); default: throw new IllegalArgumentException(String.format("Marshaller name '%s' not recognised", componentName)); } }
Source:
<code>public long getLong(int length, boolean signed) throws CTFReaderException { if (length > BIT_LONG) { throw new CTFReaderException("Cannot read a long longer than 64 bits. Rquested: " + length); } if (length > BIT_INT) { final int highShift = length-BIT_INT; long a = getInt() & 0x00000000FFFFFFFFL; long b = getInt(highShift, false); long retVal; a &= 0xFFFFFFFFL; b &= ((1L << highShift) - 1L); retVal = (this.byteOrder == ByteOrder.BIG_ENDIAN) ? ((a << highShift) | b) : ((b << BIT_INT) | a); <START> if (signed && ((retVal & (1L << (length - 1))) != 0L)) { <END> int signExtendBits = BIT_LONG - length; long l = retVal << signExtendBits; long m = l >> signExtendBits; retVal = m; } return retVal; } return getInt(length, signed); }</code><technical_language>if (signed) is useless test bit. is more expensive test shifting</technical_language>

Target:
public long getLong(int length, boolean signed) throws CTFReaderException { if (length > BIT_LONG) { throw new CTFReaderException("Cannot read a long longer than 64 bits. Rquested: " + length); } if (length > BIT_INT) { final int highShift = length - BIT_INT; long a = getInt() & 0x00000000FFFFFFFFL; long b = getInt(highShift, false); long retVal; a &= 0xFFFFFFFFL; b &= ((1L << highShift) - 1L); retVal = (this.byteOrder == ByteOrder.BIG_ENDIAN) ? ((a << highShift) | b) : ((b << BIT_INT) | a); if (signed) { int signExtendBits = BIT_LONG - length; retVal = (retVal << signExtendBits) >> signExtendBits; } return retVal; } return getInt(length, signed); }
Source:
<code><START> private static WebArchive createDeployment() { <END> WebArchive war = ShrinkWrap.create(WebArchive.class, DEPLOYMENT_FILE_NAME); war.addPackage(SimpleWebserviceEndpointImpl.class.getPackage()); war.addClass(SimpleWebserviceEndpointImpl.class); war.addAsWebInfResource("web.xml", "web.xml"); return war; }</code><technical_language>changing static</technical_language>

Target:
private WebArchive createDeployment() { WebArchive war = ShrinkWrap.create(WebArchive.class, DEPLOYMENT_FILE_NAME); war.addPackage(SimpleWebserviceEndpointImpl.class.getPackage()); war.addClass(SimpleWebserviceEndpointImpl.class); war.addAsWebInfResource("web.xml", "web.xml"); return war; }
Source:
<code>public Config loadConfiguration(ConfigType configType, StorageType stype, int tenantId) throws I18nMgtEmailConfigException { Config config = null; switch (stype) { case REGISTRY: cm.setReader(new RegistryConfigReader()); switch (configType) { case EMAIL: cm.setConfig(new EmailNotificationConfig()); cm.setResourcePath(I18nMgtConstants.EMAIL_TEMPLATE_PATH); config = cm.loadConfig(tenantId); if (config == null) { throw new I18nMgtEmailConfigException("Default email templates haven't written successfully"); } break; default: throw new I18nMgtEmailConfigException("Configuration type not supported"); } break; case DB: <START> break; <END> case FILE: break; default: throw new I18nMgtEmailConfigException("Configuration storage type not supported"); } return config; }</code><technical_language>Redundant "break" statement</technical_language>

Target:
public Config loadConfiguration(ConfigType configType, StorageType stype, int tenantId) throws I18nMgtEmailConfigException { Config config = null; switch (stype) { case REGISTRY: cm.setReader(new RegistryConfigReader()); switch (configType) { case EMAIL: cm.setConfig(new EmailNotificationConfig()); cm.setResourcePath(I18nMgtConstants.EMAIL_TEMPLATE_PATH); config = cm.loadConfig(tenantId); if (config == null) { throw new I18nMgtEmailConfigException("Default email templates haven't written successfully"); } break; default: throw new I18nMgtEmailConfigException("Configuration type not supported"); } break; case DB: case FILE: break; default: throw new I18nMgtEmailConfigException("Configuration storage type not supported"); } return config; }
Source:
<code>private ByteBuffer parsePacketSPB(ByteBuffer pcapPacketHeader, int blockLength) throws IOException, BadPcapFileException { ByteBuffer pcapPacketData; int packetLen = pcapPacketHeader.getInt(); long includedPacketLength = ConversionHelper.unsignedIntToLong(packetLen); SeekableByteChannel fFileChannel = getFileChannel(); if (fFileChannel.size() - fFileChannel.position() < includedPacketLength) { throw new BadPcapFileException(String.format("%04x", includedPacketLength) + " is causing buffer overrun."); } if (packetLen > Integer.MAX_VALUE) { throw new BadPcapFileException(String.format("%04x", packetLen) + " is bigger than 2^31-1 bytes are not supported."); } pcapPacketData = ByteBuffer.allocate((int) includedPacketLength); pcapPacketData.clear(); ByteOrder fByteOrder = getByteOrder(); pcapPacketHeader.order(fByteOrder); fFileChannel.read(pcapPacketData); pcapPacketData.flip(); <START> fFileChannel.position(fFileChannel.position() + blockLength - packetLen - PcapFileValues.PCAPNG_PACKET_HEADER_SIZE - PcapFileValues.PCAPNG_HEADER_SIZE * 2); <END> return pcapPacketData; }</code><technical_language>position file channel? I is end of packet data</technical_language>

Target:
private ByteBuffer parsePacketSPB(ByteBuffer pcapPacketHeader, int blockLength) throws IOException, BadPcapFileException { ByteBuffer pcapPacketData; int packetLen = pcapPacketHeader.getInt(); long includedPacketLength = ConversionHelper.unsignedIntToLong(packetLen); SeekableByteChannel fFileChannel = getFileChannel(); if (fFileChannel.size() - fFileChannel.position() < includedPacketLength) { throw new BadPcapFileException(String.format("%04x", includedPacketLength) + " is causing buffer overrun."); } if (packetLen > Integer.MAX_VALUE) { throw new BadPcapFileException(String.format("%04x", packetLen) + " is bigger than 2^31-1 bytes are not supported."); } pcapPacketData = ByteBuffer.allocate((int) includedPacketLength); pcapPacketData.clear(); ByteOrder byteOrder = getByteOrder(); pcapPacketHeader.order(byteOrder); fFileChannel.read(pcapPacketData); pcapPacketData.flip(); return pcapPacketData; }
Source:
<code>private void setupVdsNetworkInterfaceDao() { List<VdsNetworkInterface> expectedVdsNetworkInterface = Collections.singletonList(vdsNetworkInterface); InterfaceDao vdsNetworkInterfaceDaoMock = mock(InterfaceDao.class); when(vdsNetworkInterfaceDaoMock.getVdsInterfacesByNetworkId(networkId)).thenReturn(expectedVdsNetworkInterface); when(getDbFacadeMockInstance().getInterfaceDao()).thenReturn(vdsNetworkInterfaceDaoMock); <START> NetworkDao networkDaoMock = mock(NetworkDao.class); <END> when(getDbFacadeMockInstance().getNetworkDao()).thenReturn(networkDaoMock); }</code><technical_language>I would: 1. Put this in a separate method. 2. Create a mock network returned networkDao - reflect proper behavior... return null for a network, happen in real-life scenarios. 3. mock qosDao (in a separate method). out-of-sync functionality tested in NetworkUtilsTest, necessary test here</technical_language>

Target:
private void setupVdsNetworkInterfaceDao() { when(getDbFacadeMockInstance().getInterfaceDao()).thenReturn(vdsNetworkInterfaceDaoMock); List<VdsNetworkInterface> expectedVdsNetworkInterface = Collections.singletonList(vdsNetworkInterface); when(vdsNetworkInterfaceDaoMock.getVdsInterfacesByNetworkId(networkId)).thenReturn( expectedVdsNetworkInterface); }
Source:
<code>public void testQueryCache_with_mapAttribute_inPredicate() { String MAP_ATTRIBUTE_NAME = "booleanMapAttribute"; Config config = new Config(); config.getMapConfig(mapName) .addQueryCacheConfig( new QueryCacheConfig(cacheName) .setIncludeValue(true) .setPredicateConfig( new PredicateConfig(Predicates.equal(MAP_ATTRIBUTE_NAME, true)) )) .addMapAttributeConfig( new MapAttributeConfig() .setExtractor(EvenNumberEmployeeValueExtractor.class.getName()) .setName(MAP_ATTRIBUTE_NAME)); IMap<Integer, Employee> map = getIMap(config); QueryCache<Integer, Employee> queryCache = map.getQueryCache(cacheName); populateMap(map, 100); <START> assertEquals(queryCache.keySet().size(), 50); <END> }</code><technical_language>This assertQueryCacheSizeEventually in other tests in this test class. queryCache population is async process</technical_language>

Target:
public void testQueryCache_with_mapAttribute_inPredicate() { String MAP_ATTRIBUTE_NAME = "booleanMapAttribute"; Config config = new Config(); config.getMapConfig(mapName) .addQueryCacheConfig( new QueryCacheConfig(cacheName) .setIncludeValue(true) .setPredicateConfig( new PredicateConfig(Predicates.equal(MAP_ATTRIBUTE_NAME, true)) )) .addMapAttributeConfig( new MapAttributeConfig() .setExtractor(EvenNumberEmployeeValueExtractor.class.getName()) .setName(MAP_ATTRIBUTE_NAME)); IMap<Integer, Employee> map = getIMap(config); QueryCache<Integer, Employee> queryCache = map.getQueryCache(cacheName); populateMap(map, 100); assertQueryCacheSizeEventually(50, queryCache); }
Source:
<code><START> public PickerMilestone setMatching(boolean isMatching) { <END> this.isMatching = isMatching; return this; }</code><technical_language>need return here? return is anywhere</technical_language>

Target:
public void setMatching(boolean isMatching) { this.isMatching = isMatching; }
Source:
<code>public Object call() throws Exception { LOG.info("Begin plan changes: {}", requests); <START> LogicalPlan lp = plan.cloneLogicalPlan(); <END> PlanModifier pm = new PlanModifier(lp); for (LogicalPlanRequest request : requests) { LOG.debug("Dry run plan change: {}", request); request.execute(pm); } lp.validate(); pm = new PlanModifier(plan); for (LogicalPlanRequest request : requests) { request.execute(pm); recordEventAsync(new StramEvent.ChangeLogicalPlanEvent(request)); } pm.applyChanges(StreamingContainerManager.this); LOG.info("Plan changes applied: {}", requests); return null; }</code><technical_language>SerializationUtils.clone(...)</technical_language>

Target:
public Object call() throws Exception { LOG.info("Begin plan changes: {}", requests); LogicalPlan lp = (LogicalPlan)SerializationUtils.clone(plan.getLogicalPlan()); PlanModifier pm = new PlanModifier(lp); for (LogicalPlanRequest request : requests) { LOG.debug("Dry run plan change: {}", request); request.execute(pm); } lp.validate(); pm = new PlanModifier(plan); for (LogicalPlanRequest request : requests) { request.execute(pm); recordEventAsync(new StramEvent.ChangeLogicalPlanEvent(request)); } pm.applyChanges(StreamingContainerManager.this); LOG.info("Plan changes applied: {}", requests); return null; }
Source:
<code>private String formatQueries(final Set<StreamsQuery> queries) { final StringBuilder sb = new StringBuilder(); sb.append("\n"); sb.append("Queries in Rya Streams:\n"); sb.append("---------------------------------------------------------\n"); queries.forEach(query -> { sb.append("ID: ").append(query.getQueryId()) .append(" ") .append("Is Active: ").append(query.isActive()) <START> .append( query.isActive() ? " " : " " ) <END> .append("Query: ").append(query.getSparql()).append("\n"); }); return sb.toString(); }</code><technical_language>change to: <code> .append("Is Active: ") .append(StringUtils.rightPad(query.isActive(), 9)) </code></technical_language>

Target:
private String formatQueries(final Set<StreamsQuery> queries) { final StringBuilder sb = new StringBuilder(); sb.append("\n"); sb.append("Queries in Rya Streams:\n"); sb.append("---------------------------------------------------------\n"); queries.forEach(query -> { sb.append("ID: ").append(query.getQueryId()) .append(" ") .append("Is Active: ").append(query.isActive()) .append(StringUtils.rightPad("" + query.isActive(), 9)) .append("Query: ").append(query.getSparql()).append("\n"); }); return sb.toString(); }
Source:
<code>protected boolean validate() { if (!super.validate()) { return false; } macPool = getMacPool(); Map<Guid, StorageDomain> domainsMap = new HashMap<>(); if (!validateBeforeCloneVm(domainsMap)) { return false; } VmHandler.updateMaxMemorySize(getVm().getStaticData(), getEffectiveCompatibilityVersion()); if (getParameters().isImportAsNewEntity()) { initImportClonedVm(); if (getVm().getInterfaces().size() > macPool.getAvailableMacsCount()) { return failValidation(EngineMessage.MAC_POOL_NOT_ENOUGH_MAC_ADDRESSES); } } if (!validateBallonDevice()) { return false; } if (!validateSoundDevice()) { return false; } <START> if (!validate(VmHandler.validateMaxMemorySize(getVm().getStaticData(), getEffectiveCompatibilityVersion()))) { <END> return false; } return validateAfterCloneVm(domainsMap); }</code><technical_language>scenario happen? - in engine 5.7 create a VM vm1 max memory X - in engine 4.1 max memory MAX is X - export vm1 engine 5.7 - import in engine 4.1 --> import fail X is higher maximum allowed</technical_language>

Target:
protected boolean validate() { if (!super.validate()) { return false; } macPool = getMacPool(); Map<Guid, StorageDomain> domainsMap = new HashMap<>(); if (!validateBeforeCloneVm(domainsMap)) { return false; } VmHandler.updateMaxMemorySize(getVm().getStaticData(), getEffectiveCompatibilityVersion()); if (getParameters().isImportAsNewEntity()) { initImportClonedVm(); if (getVm().getInterfaces().size() > macPool.getAvailableMacsCount()) { return failValidation(EngineMessage.MAC_POOL_NOT_ENOUGH_MAC_ADDRESSES); } } if (!validateBallonDevice()) { return false; } if (!validateSoundDevice()) { return false; } return validateAfterCloneVm(domainsMap); }
Source:
<code>public static ExpectedCondition<WebDriverElement> visible(final Hook hook) { return new ExpectedCondition<WebDriverElement>() { @Override public WebDriverElement apply(WebDriver driver) { try { WebElement element = findElement(hook, driver); return element.isDisplayed()? createWebDriverElement(hook, element, driver) : null; <START> } catch (CandybeanException e) { <END> return null; } catch (StaleElementReferenceException e) { return null; } } @Override public String toString() { return "visibility of " + hook; } }; }</code><technical_language>multi-catch here</technical_language>

Target:
public static ExpectedCondition<WebDriverElement> visible(final Hook hook) { return new ExpectedCondition<WebDriverElement>() { @Override public WebDriverElement apply(WebDriver driver) { try { WebElement element = findElement(hook, driver); return element.isDisplayed()? createWebDriverElement(hook, element, driver) : null; } catch (CandybeanException | StaleElementReferenceException e) { return null; } } @Override public String toString() { return "visibility of " + hook; } }; }
Source:
<code>private static String typedNull(int targetSqlType) throws SQLException { switch (targetSqlType) { case Types.BOOLEAN: return typedNull("BOOLEAN"); case Types.TINYINT: return typedNull("TINYINT"); case Types.SMALLINT: return typedNull("SMALLINT"); case Types.INTEGER: return typedNull("INTEGER"); case Types.BIGINT: return typedNull("BIGINT"); case Types.FLOAT: case Types.REAL: return typedNull("REAL"); case Types.DOUBLE: return typedNull("DOUBLE"); case Types.DECIMAL: case Types.NUMERIC: return typedNull("DECIMAL"); case Types.CHAR: case Types.NCHAR: return typedNull("CHAR"); case Types.VARCHAR: case Types.NVARCHAR: case Types.LONGVARCHAR: case Types.LONGNVARCHAR: return typedNull("VARCHAR"); case Types.BINARY: case Types.VARBINARY: case Types.LONGVARBINARY: return typedNull("VARBINARY"); case Types.DATE: return typedNull("DATE"); case Types.TIME: return typedNull("TIME"); case Types.TIMESTAMP: return typedNull("TIMESTAMP"); case Types.TIME_WITH_TIMEZONE: return typedNull("TIME WITH TIME ZONE"); case Types.TIMESTAMP_WITH_TIMEZONE: return typedNull("TIMESTAMP WITH TIME ZONE"); case Types.OTHER: <START> return "null"; <END> } throw new SQLException("Unsupported target SQL type: " + targetSqlType); }</code><technical_language>nit: uppercase NULL</technical_language>

Target:
private static String typedNull(int targetSqlType) throws SQLException { switch (targetSqlType) { case Types.BOOLEAN: case Types.BIT: return typedNull("BOOLEAN"); case Types.TINYINT: return typedNull("TINYINT"); case Types.SMALLINT: return typedNull("SMALLINT"); case Types.INTEGER: return typedNull("INTEGER"); case Types.BIGINT: return typedNull("BIGINT"); case Types.FLOAT: case Types.REAL: return typedNull("REAL"); case Types.DOUBLE: return typedNull("DOUBLE"); case Types.DECIMAL: case Types.NUMERIC: return typedNull("DECIMAL"); case Types.CHAR: case Types.NCHAR: return typedNull("CHAR"); case Types.VARCHAR: case Types.NVARCHAR: case Types.LONGVARCHAR: case Types.LONGNVARCHAR: case Types.CLOB: case Types.NCLOB: return typedNull("VARCHAR"); case Types.BINARY: case Types.VARBINARY: case Types.LONGVARBINARY: case Types.BLOB: return typedNull("VARBINARY"); case Types.DATE: return typedNull("DATE"); case Types.TIME: return typedNull("TIME"); case Types.TIMESTAMP: return typedNull("TIMESTAMP"); case Types.NULL: return "NULL"; } throw new SQLException("Unsupported target SQL type: " + targetSqlType); }
Source:
<code>@Test public void emptyModifierSet() throws IOException { javaWriter.emitPackage("com.blah"); <START> javaWriter.beginType("com.blah.Foo", "class", new HashSet<Modifier>()) <END> .endType(); }</code><technical_language>Collections.emptySet()</technical_language>

Target:
@Test public void emptyModifierSet() throws IOException { javaWriter.emitPackage("com.blah"); javaWriter.beginType("com.blah.Foo", "class", Collections.<Modifier>emptySet()) .endType(); assertCode("" + "package com.blah;\n" + "\n" + "class Foo {\n" + "}\n"); }