auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public HadoopDruidIndexerConfig( final @JsonProperty("spec") HadoopIngestionSpec spec, final @JsonProperty("schema") HadoopIngestionSpec schema ) { <START> if (schema != null) { <END> this.spec = schema; } else { this.spec = spec; } this.pathSpec = jsonMapper.convertValue(this.spec.getIOConfig().getPathSpec(), PathSpec.class); for (Map.Entry<DateTime, List<HadoopyShardSpec>> entry : spec.getTuningConfig().getShardSpecs().entrySet()) { if (entry.getValue() == null || entry.getValue().isEmpty()) { continue; } final ShardSpec actualSpec = entry.getValue().get(0).getActualSpec(); shardSpecLookups.put( entry.getKey(), actualSpec.getLookup( Lists.transform( entry.getValue(), new Function<HadoopyShardSpec, ShardSpec>() { @Override public ShardSpec apply(HadoopyShardSpec input) { return input.getActualSpec(); } } ) ) ); for (HadoopyShardSpec hadoopyShardSpec : entry.getValue()) { hadoopShardSpecLookup.put(hadoopyShardSpec.getActualSpec(), hadoopyShardSpec); } } this.rollupGran = this.spec.getDataSchema().getGranularitySpec().getQueryGranularity(); }</code><technical_language>prefer new (spec) if set</technical_language>

Target:
public HadoopDruidIndexerConfig( final @JsonProperty("spec") HadoopIngestionSpec spec, final @JsonProperty("schema") HadoopIngestionSpec schema ) { if (spec != null) { this.spec = spec; } else { this.spec = schema; } this.pathSpec = jsonMapper.convertValue(this.spec.getIOConfig().getPathSpec(), PathSpec.class); for (Map.Entry<DateTime, List<HadoopyShardSpec>> entry : spec.getTuningConfig().getShardSpecs().entrySet()) { if (entry.getValue() == null || entry.getValue().isEmpty()) { continue; } final ShardSpec actualSpec = entry.getValue().get(0).getActualSpec(); shardSpecLookups.put( entry.getKey(), actualSpec.getLookup( Lists.transform( entry.getValue(), new Function<HadoopyShardSpec, ShardSpec>() { @Override public ShardSpec apply(HadoopyShardSpec input) { return input.getActualSpec(); } } ) ) ); for (HadoopyShardSpec hadoopyShardSpec : entry.getValue()) { hadoopShardSpecLookup.put(hadoopyShardSpec.getActualSpec(), hadoopyShardSpec); } } this.rollupGran = this.spec.getDataSchema().getGranularitySpec().getQueryGranularity(); }
Source:
<code>public boolean test(final Node<? extends View<?>, ? extends Edge> nodeA, final Node<? extends View<?>, ? extends Edge> nodeB) { checkNotNull("nodeA", nodeA); checkNotNull("nodeB", nodeB); final Optional<Element<?>> parentInstance = getParentInstance(nodeA, parentType); Optional<Element<?>> parentInstanceB = getParentInstance(nodeB, parentType); boolean b = (parentInstance.isPresent() && parentInstanceB.isPresent()) && (Objects.equals(parentInstance.get(), parentInstanceB.get())) <START> && (hasParent(nodeA, parentInstance.get()) && hasParent(nodeB, parentInstance.get())); <END> return b; }</code><technical_language>This evaluation wrong... right? line, (hasParent(nodeA, parentInstance.get()) && hasParent(nodeB, parentInstanceB.get()) instead</technical_language>

Target:
public boolean test(final Node<? extends View<?>, ? extends Edge> nodeA, final Node<? extends View<?>, ? extends Edge> nodeB) { checkNotNull("nodeA", nodeA); checkNotNull("nodeB", nodeB); final Optional<Element<?>> parentInstanceA = getParentInstance(nodeA, parentType); final Optional<Element<?>> parentInstanceB = getParentInstance(nodeB, parentType); return (parentInstanceA.isPresent() && parentInstanceB.isPresent()) && (Objects.equals(parentInstanceA.get(), parentInstanceB.get())) && (hasParent(nodeA, parentInstanceA.get()) && hasParent(nodeB, parentInstanceB.get())); }
Source:
<code>public int hashCode() { <START> return operand != null ? operand.hashCode() : 0; <END> }</code><technical_language>operand null</technical_language>

Target:
public int hashCode() { return operand.hashCode(); }
Source:
<code>public static void destroyAll(ManagementContext mgmt) { Exception error = null; if (mgmt instanceof NonDeploymentManagementContext) { <START> log.warn("Entities.destroyAll invoked on non-deployment "+mgmt+" - not likely to have much effect!"); <END> } if (!mgmt.isRunning()) return; log.debug("destroying all apps in "+mgmt+": "+mgmt.getApplications()); for (Application app: mgmt.getApplications()) { log.debug("destroying app "+app+" (managed? "+isManaged(app)+"; mgmt is "+mgmt+")"); try { destroy(app); log.debug("destroyed app "+app+"; mgmt now "+mgmt); } catch (Exception e) { log.warn("problems destroying app "+app+" (mgmt now "+mgmt+", will rethrow at least one exception): "+e); if (error==null) error = e; } } if (mgmt instanceof ManagementContextInternal) ((ManagementContextInternal)mgmt).terminate(); if (error!=null) throw Exceptions.propagate(error); }</code><technical_language>This message a problem resolve it. Logging correct approach destroying management context useful</technical_language>

Target:
public static void destroyAll(ManagementContext mgmt) { Exception error = null; if (mgmt instanceof NonDeploymentManagementContext) { log.warn("Entities.destroyAll invoked on non-deployment "+mgmt+" - not likely to have much effect! " + "(This usually means the mgmt context has been taken from entity has been destroyed. " + "To destroy other things on the management context ensure you keep a handle to the context " + "before the entity is destroyed, such as by creating the management context first.)"); } if (!mgmt.isRunning()) return; log.debug("destroying all apps in "+mgmt+": "+mgmt.getApplications()); for (Application app: mgmt.getApplications()) { log.debug("destroying app "+app+" (managed? "+isManaged(app)+"; mgmt is "+mgmt+")"); try { destroy(app); log.debug("destroyed app "+app+"; mgmt now "+mgmt); } catch (Exception e) { log.warn("problems destroying app "+app+" (mgmt now "+mgmt+", will rethrow at least one exception): "+e); if (error==null) error = e; } } if (mgmt instanceof ManagementContextInternal) ((ManagementContextInternal)mgmt).terminate(); if (error!=null) throw Exceptions.propagate(error); }
Source:
<code>private void showEmailAutoCompleteHint() { try { startIntentSenderForResult(getEmailHintIntent().getIntentSender(), <START> RC_HINT, <END> null, 0, 0, 0, null); } catch (IntentSender.SendIntentException e) { Log.e(TAG, "Unable to start hint intent", e); } }</code><technical_language>nit: do this (argument alignment) project, reason start this method</technical_language>

Target:
private void showEmailAutoCompleteHint() { try { mHelper.startIntentSenderForResult(getEmailHintIntent().getIntentSender(), RC_HINT); } catch (IntentSender.SendIntentException e) { Log.e(TAG, "Unable to start hint intent", e); } }
Source:
<code>protected void init(final Repository repository, final String gitDir) { try { final String outputEncoding = repository != null ? repository .getConfig() .getString("i18n", null, "logOutputEncoding") : null; if (outputEncoding != null) <START> out = new PrintWriter(new OutputStreamWriter(System.out, <END> outputEncoding)); else out = new PrintWriter(new OutputStreamWriter(System.out)); } catch (IOException e) { throw die(CLIText.get().cannotCreateOutputStream); } if (repository != null && repository.getDirectory() != null) { db = repository; gitdir = repository.getDirectory().getAbsolutePath(); } else { db = repository; gitdir = gitDir; } }</code><technical_language>Actually, in this change relate adding a new status command? this change affects other CLI commands deserve separate commit. Anyway, making this change landed voluntarily a result of mingling another context..</technical_language>

Target:
protected void init(final Repository repository, final String gitDir) { try { final String outputEncoding = repository != null ? repository .getConfig() .getString("i18n", null, "logOutputEncoding") : null; if (outputEncoding != null) out = new PrintWriter(new BufferedWriter( new OutputStreamWriter(System.out, outputEncoding))); else out = new PrintWriter(new BufferedWriter( new OutputStreamWriter(System.out))); } catch (IOException e) { throw die(CLIText.get().cannotCreateOutputStream); } if (repository != null && repository.getDirectory() != null) { db = repository; gitdir = repository.getDirectory().getAbsolutePath(); } else { db = repository; gitdir = gitDir; } }
Source:
<code>public void applyStreamWork(LuceneWork singleOperation, IndexingMonitor monitor, DirectoryBasedIndexManager indexManager) { IndexUpdateStreamCommand streamCommand = new IndexUpdateStreamCommand(cacheName); byte[] serializedModel = indexManager.getSerializer().toSerializedModel(Collections.singletonList(singleOperation)); streamCommand.setSerializedWorkList(serializedModel); streamCommand.setIndexName(this.indexName); <START> sendCommand(streamCommand,Collections.singletonList(singleOperation)); <END> }</code><technical_language>create singletonlist twice</technical_language>

Target:
public void applyStreamWork(LuceneWork singleOperation, IndexingMonitor monitor, DirectoryBasedIndexManager indexManager) { final IndexUpdateStreamCommand streamCommand = new IndexUpdateStreamCommand(cacheName); final List<LuceneWork> operations = Collections.singletonList(singleOperation); final byte[] serializedModel = indexManager.getSerializer().toSerializedModel(operations); streamCommand.setSerializedWorkList(serializedModel); streamCommand.setIndexName(this.indexName); sendCommand(streamCommand, operations); }
Source:
<code>public static String minWindow(String s, String t) { if(s.length() == 0 || t.length() ==0 || s.length() < t.length()) { return ""; } HashMap<Character, Integer> map = new HashMap<Character, Integer>(); for(char c : t.toCharArray()) { <START> if(map.containsKey(c)) { <END> map.put(c, map.get(c) + 1); } else { map.put(c, 1); } } int left = 0; int count = 0; int minStart = 0; int minLength = s.length() + 1; for(int right = 0; right < s.length(); right++) { if(map.containsKey(s.charAt(right))) { map.put(s.charAt(right), map.get(s.charAt(right)) - 1); if(map.get(s.charAt(right)) >= 0) { count++; } while(count == t.length()) { if((right - left + 1) < minLength) { minStart = left; minLength = right - left + 1; } if(map.containsKey(s.charAt(left))) { map.put(s.charAt(left), map.get(s.charAt(left)) + 1 ); if(map.get(s.charAt(left)) > 0) { count--; } } left ++; } } } if(minLength == s.length()+1) { return ""; } return s.substring(minStart, minStart + minLength); }</code><technical_language>more concise map.put(c, (map.containsKey(c) ? map.get(c) : 0) + 1);</technical_language>

Target:
public static String minWindow(String s, String t) { if(s.length() == 0 || t.length() ==0 || s.length() < t.length()) { return ""; } HashMap<Character, Integer> map = new HashMap<Character, Integer>(); for(char c : t.toCharArray()) { map.put(c, (map.containsKey(c) ? map.get(c) : 0) + 1); } int left = 0; int count = 0; int minStart = 0; int minLength = s.length() + 1; for(int right = 0; right < s.length(); right++) { if(map.containsKey(s.charAt(right))) { map.put(s.charAt(right), map.get(s.charAt(right)) - 1); if(map.get(s.charAt(right)) >= 0) { count++; } while(count == t.length()) { if((right - left + 1) < minLength) { minStart = left; minLength = right - left + 1; } if(map.containsKey(s.charAt(left))) { map.put(s.charAt(left), map.get(s.charAt(left)) + 1 ); if(map.get(s.charAt(left)) > 0) { count--; } } left++; } } } if(minLength == s.length()+1) { return ""; } return s.substring(minStart, minStart + minLength); }
Source:
<code>private void getMasterLock(final String zMasterLoc) throws KeeperException, InterruptedException { log.info("Acquiring Master lock"); final String masterClientAddress = hostname + ":" + getConfiguration().getPort(Property.MASTER_CLIENTPORT)[0]; while (true) { MasterLockWatcher masterLockWatcher = new MasterLockWatcher(); masterLock = new ZooLock(zMasterLoc); masterLock.lockAsync(masterLockWatcher, masterClientAddress.getBytes()); masterLockWatcher.waitForChange(); if (masterLockWatcher.acquiredLock) { break; } if (!masterLockWatcher.failedToAcquireLock) { throw new IllegalStateException("master lock in unknown state"); } masterLock.tryToCancelAsyncLockOrUnlock(); sleepUninterruptibly(TIME_TO_WAIT_BETWEEN_LOCK_CHECKS, TimeUnit.MILLISECONDS); } <START> log.info("Got Master lock."); <END> setMasterState(MasterState.HAVE_LOCK); }</code><technical_language>wording consistent services. I "Attempting acquire" "Acquired". drop periods end of log message. complete sentences anyway</technical_language>

Target:
private void getMasterLock(final String zMasterLoc) throws KeeperException, InterruptedException { log.info("Attempting to acquire Master Lock"); final String masterClientAddress = hostname + ":" + getConfiguration().getPort(Property.MASTER_CLIENTPORT)[0]; while (true) { MasterLockWatcher masterLockWatcher = new MasterLockWatcher(); masterLock = new ZooLock(zMasterLoc); masterLock.lockAsync(masterLockWatcher, masterClientAddress.getBytes()); masterLockWatcher.waitForChange(); if (masterLockWatcher.acquiredLock) { break; } if (!masterLockWatcher.failedToAcquireLock) { throw new IllegalStateException("master lock in unknown state"); } masterLock.tryToCancelAsyncLockOrUnlock(); sleepUninterruptibly(TIME_TO_WAIT_BETWEEN_LOCK_CHECKS, TimeUnit.MILLISECONDS); } log.info("Acquired Master Lock"); setMasterState(MasterState.HAVE_LOCK); }
Source:
<code>public void testGetVersion() throws Exception { <START> assertTrue(atsVersionCache.getVersion(teamWf).getName().equals("Test Version")); <END> }</code><technical_language>assertEquals instead - output match. assertEquals("Test Version", atsVersionCache.getVersion(teamWf).getName());</technical_language>

Target:
public void testGetVersion() throws Exception { assertEquals("Test Version", atsVersionCache.getVersion(teamWf).getName()); }
Source:
<code>public IsaacApplicationRegister() { singletons = new HashSet<Object>(); SegueGuiceConfigurationModule segueGuiceConfigurationModule = new SegueGuiceConfigurationModule(); IsaacGuiceConfigurationModule isaacGuiceConfigurationModule = new IsaacGuiceConfigurationModule(); <START> injector = Guice.createInjector(isaacGuiceConfigurationModule, segueGuiceConfigurationModule); <END> SegueConfigurationModule segueConfigurationModule = injector.getInstance(SegueConfigurationModule.class); ContentMapper mapper = injector.getInstance(ContentMapper.class); if (segueConfigurationModule != null) { log.info("Registering isaac specific datatypes with the segue content mapper."); mapper.registerJsonTypes(segueConfigurationModule.getContentDataTransferObjectMap()); } setupMetricsExporter(); setupSwaggerApiAdvertiser(); }</code><technical_language>this remove school one</technical_language>

Target:
public IsaacApplicationRegister() { singletons = new HashSet<Object>(); SegueGuiceConfigurationModule segueGuiceConfigurationModule = new SegueGuiceConfigurationModule(); IsaacGuiceConfigurationModule isaacGuiceConfigurationModule = new IsaacGuiceConfigurationModule(); injector = Guice.createInjector(isaacGuiceConfigurationModule, segueGuiceConfigurationModule); SegueConfigurationModule segueConfigurationModule = injector.getInstance(SegueConfigurationModule.class); ContentMapper mapper = injector.getInstance(ContentMapper.class); if (segueConfigurationModule != null) { log.info("Registering isaac specific datatypes with the segue content mapper."); mapper.registerJsonTypes(segueConfigurationModule.getContentDataTransferObjectMap()); } setupSwaggerApiAdvertiser(); }
Source:
<code>public void handleMessage(Message message) throws Fault { LOG.trace("Begin HttpHeaderRequestOutInterceptor"); Map<String, List> headers = (Map<String, List>) message.get(Message.PROTOCOL_HEADERS); if(headers == null) { headers = new HashMap<>(); } final Map<String, String> customHttpHeaders = getCustomHttpHeaders(message); if(customHttpHeaders != null && !customHttpHeaders.isEmpty()) { <START> for(String key : customHttpHeaders.keySet()) { <END> String value = customHttpHeaders.get(key); headers.put(key, Collections.singletonList(value)); LOG.debug("Adding custom CONNECT HTTP header: " , key, ", ", value); } } message.put(Message.PROTOCOL_HEADERS, headers); }</code><technical_language>![MAJOR](<LINK_0> Iterate "entrySet" instead of "keySet". [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
public void handleMessage(Message message) { LOG.trace("Begin HttpHeaderRequestOutInterceptor"); Map<String, List> headers = (Map<String, List>) message.get(Message.PROTOCOL_HEADERS); if(headers == null) { headers = new HashMap<>(); } final Map<String, String> customHttpHeaders = getCustomHttpHeaders(message); if(MapUtils.isNotEmpty(customHttpHeaders)) { for(Entry<String,String> entry : customHttpHeaders.entrySet()) { headers.put(entry.getKey(), Collections.singletonList(entry.getValue())); LOG.debug("Adding custom CONNECT HTTP header: {}, {}" , entry.getKey(), entry.getValue()); } } message.put(Message.PROTOCOL_HEADERS, headers); }
Source:
<code>public void onActivate(ActivateEvent event, EntityRef entity) { LASTeam teleporterTeamComponent = entity.getComponent(LASTeam.class); EntityRef player = event.getInstigator(); LASTeam playerTeamComponent = player.getComponent(LASTeam.class); if (teleporterTeamComponent.team.equals("red")) { <START> playerTeamComponent.team = "red"; <END> player.send(new CharacterTeleportEvent(new Vector3f(RED_TELEPORT_DESTINATION))); } if (teleporterTeamComponent.team.equals("black")) { playerTeamComponent.team = "black"; player.send(new CharacterTeleportEvent(new Vector3f(BLACK_TELEPORT_DESTINATION))); } }</code><technical_language>necessary save updated component entity, i.e., java player.saveComponent(playerTeamComponent);</technical_language>

Target:
public void onActivate(ActivateEvent event, EntityRef entity) { LASTeam teleporterTeamComponent = entity.getComponent(LASTeam.class); EntityRef player = event.getInstigator(); LASTeam playerTeamComponent = player.getComponent(LASTeam.class); if (teleporterTeamComponent.team.equals(teleporterTeamComponent.RED)) { playerTeamComponent.team = teleporterTeamComponent.team; player.saveComponent(playerTeamComponent); player.send(new CharacterTeleportEvent(new Vector3f(RED_TELEPORT_DESTINATION))); } if (teleporterTeamComponent.team.equals(teleporterTeamComponent.BLACK)) { playerTeamComponent.team = teleporterTeamComponent.team; player.saveComponent(playerTeamComponent); player.send(new CharacterTeleportEvent(new Vector3f(BLACK_TELEPORT_DESTINATION))); } }
Source:
<code>public synchronized PublisherSession newSession() { <START> Window<PublisherPush> it = pushStream.newIterator(2); <END> PublisherSession session = new PublisherSession(it, generator .generate()); sessions.put(session.getKey(), session); return session; }</code><technical_language>magic number</technical_language>

Target:
public synchronized PublisherSession newSession() { Window it = pushStream.newWindow(sessionRollbackCount); PublisherSession session = new PublisherSession(it, generator .generate()); sessions.put(session.getKey(), session); return session; }
Source:
<code>public void testLeakingInstanceAfterClose() throws Exception { final String file= "/ceditor/src/main.cpp"; fCProject= EditorTestHelper.createCProject("ceditor", "resources/ceditor", false, false); setUpEditor(file); fSourceViewer= EditorTestHelper.getSourceViewer(fEditor); assertTrue(EditorTestHelper.joinReconciler(fSourceViewer, 0, 10000, 100)); WeakReference<CEditor> ref = new WeakReference<>(fEditor); EditorTestHelper.closeEditor(fEditor); fEditor = null; fSourceViewer = null; int ngc = 10; while (ref.get() != null && ngc-- > 0) { System.gc(); <START> EditorTestHelper.runEventQueue(20000); <END> } assertNull("CEditor instance seems to be leaking after close", ref.get()); }</code><technical_language>Unrelated change, please remove</technical_language>

Target:
public void testLeakingInstanceAfterClose() throws Exception { final String file= "/ceditor/src/main.cpp"; fCProject= EditorTestHelper.createCProject("ceditor", "resources/ceditor", false, false); setUpEditor(file); fSourceViewer= EditorTestHelper.getSourceViewer(fEditor); assertTrue(EditorTestHelper.joinReconciler(fSourceViewer, 0, 10000, 100)); WeakReference<CEditor> ref = new WeakReference<>(fEditor); EditorTestHelper.closeEditor(fEditor); fEditor = null; fSourceViewer = null; int ngc = 10; while (ref.get() != null && ngc-- > 0) { System.gc(); EditorTestHelper.runEventQueue(200); } assertNull("CEditor instance seems to be leaking after close", ref.get()); }
Source:
<code>protected Object encode(ChannelHandlerContext ctx, Channel channel, Object message) throws Exception { if (message instanceof ControlMessage) { ControlMessage controlMessage = (ControlMessage) message; switch (controlMessage.getKind()) { case PREPARED: return encodePreparedMessage(ctx, channel, (PreparedMessage) controlMessage); case STARTED: return encodeStartedMessage(ctx, channel, (StartedMessage) controlMessage); case ERROR: return encodeErrorMessage(ctx, channel, (ErrorMessage) controlMessage); case FINISHED: return encodeFinishedMessage(ctx, channel, (FinishedMessage) controlMessage); case NOTIFY: return encodeNotifyMessage(ctx, channel, (NotifyMessage) controlMessage); case NOTIFIED: <START> return encodiedNotifiedMessage(ctx, channel, (NotifiedMessage) controlMessage); <END> default: break; } } return message; }</code><technical_language>typo in method name</technical_language>

Target:
protected Object encode(ChannelHandlerContext ctx, Channel channel, Object message) throws Exception { if (message instanceof ControlMessage) { ControlMessage controlMessage = (ControlMessage) message; switch (controlMessage.getKind()) { case PREPARED: return encodePreparedMessage(ctx, channel, (PreparedMessage) controlMessage); case STARTED: return encodeStartedMessage(ctx, channel, (StartedMessage) controlMessage); case ERROR: return encodeErrorMessage(ctx, channel, (ErrorMessage) controlMessage); case FINISHED: return encodeFinishedMessage(ctx, channel, (FinishedMessage) controlMessage); case NOTIFY: return encodeNotifyMessage(ctx, channel, (NotifyMessage) controlMessage); case NOTIFIED: return encodedNotifiedMessage(ctx, channel, (NotifiedMessage) controlMessage); default: break; } } return message; }
Source:
<code>public static void main(String[] args) { String queueURL = String.format("<LINK_0>", ACCOUNT_NAME, QUEUE_NAME, SAS_TOKEN); QueueAsyncClient queueAsyncClient = new QueueClientBuilder().endpoint(queueURL).buildAsyncClient(); queueAsyncClient.create() <START> .flatMap(response -> queueAsyncClient.enqueueMessage("This is message 1")) <END> .flatMap(response -> queueAsyncClient.enqueueMessage("This is message 2")) .subscribe( response -> { System.out.println("Message successfully equeueed by queueAsyncClient. Message id:" + response.value().messageId()); }, err -> { System.out.println("Error thrown when enqueue the message. Error message: " + err.getMessage()); }, () -> { System.out.println("The enqueue has been completed."); } ); }</code><technical_language>This correct chain Reactor requests, I then()</technical_language>

Target:
public static void main(String[] args) { String queueURL = String.format("<LINK_0>", ACCOUNT_NAME, QUEUE_NAME, SAS_TOKEN); QueueAsyncClient queueAsyncClient = new QueueClientBuilder().endpoint(queueURL).buildAsyncClient(); queueAsyncClient.create() .doOnSuccess(response -> queueAsyncClient.enqueueMessage("This is message 1")) .then(queueAsyncClient.enqueueMessage("This is message 2")) .subscribe( response -> { System.out.println("Message successfully equeueed by queueAsyncClient. Message id:" + response.value().messageId()); }, err -> { System.out.println("Error thrown when enqueue the message. Error message: " + err.getMessage()); }, () -> { System.out.println("The enqueue has been completed."); } ); }
Source:
<code>public Sample(long timeMillis, double numericValue, String textValue) { setTimeMillis(timeMillis); setNumericValue(numericValue); <START> this.textValue = textValue; <END> }</code><technical_language>Add checking: if (StringUtils.isNotEmpty(textValue)) { this.textValue = textValue; } add setter checking for this field constructors BigDecimal value</technical_language>

Target:
public Sample(long timeMillis, double numericValue, String textValue) { this(timeMillis, null, null, textValue); setNumericValueFromDouble(numericValue); }
Source:
<code>public FileObject addDescription(InputStream sourceMdStream, String sourceProfile, InputStream modsStream) { fileObj = createFileObject(); BinaryObject orig = fileObj.addOriginalFile(sourceMdStream, null, "text/plain", null); <START> repository.createRelationship(pid, PcdmModels.hasRelatedObject, orig.getResource()); <END> orig.getResource().addProperty(Cdr.hasSourceMetadataProfile, sourceProfile); BinaryObject mods = fileObj.addDerivative(null, modsStream, null, "text/plain", null); repository.createRelationship(pid, IanaRelation.describedby, mods.getResource()); return fileObj; }</code><technical_language>pcdm:hasRelatedObject pointing description fileObject a specific binary. diagram for example</technical_language>

Target:
public FileObject addDescription(InputStream sourceMdStream, String sourceProfile, InputStream modsStream) throws InvalidRelationshipException { if (sourceProfile == null || sourceProfile == "") { throw new InvalidRelationshipException("No source profile was provided"); } FileObject fileObj = createFileObject(); BinaryObject orig = fileObj.addOriginalFile(sourceMdStream, null, "text/plain", null); repository.createProperty(orig.getPid(), Cdr.hasSourceMetadataProfile, sourceProfile); repository.createRelationship(orig.getPid(), RDF.type, Cdr.SourceMetadata); repository.createRelationship(pid, PcdmModels.hasRelatedObject, fileObj.getResource()); BinaryObject mods = fileObj.addDerivative(null, modsStream, null, "text/plain", null); repository.createRelationship(pid, Cdr.hasMods, mods.getResource()); return fileObj; }
Source:
<code>private boolean containsNullOrEmpty(List<String> values) { if(values == null) return true ; <START> if(values.isEmpty()) return true ; <END> for(String str : values) { if(StringUtils.isBlank(str)) return true ; } return false; }</code><technical_language>Another minor note, reason merge this a single check? if(values == null || values.isEmpty()) return true ;</technical_language>

Target:
private boolean containsNullOrEmpty(List<String> values) { if(values == null || values.isEmpty()) return true ; for(String str : values) { if(StringUtils.isBlank(str)) return true ; } return false; }
Source:
<code>public boolean pingAllEndpoint() { refreshCacheEndpoints(); if (CollectionUtils.isEmpty(endpoints)) { LOG.debug("ping-all connection-endpoints: none found."); return false; } <START> endpoints.contains(selectedEndpoint); <END> for (ConnectionEndpoint connEndpoint : endpoints) { exchangeService.pingService(connEndpoint); } return true; }</code><technical_language>Whats this check needed for</technical_language>

Target:
public boolean pingAllEndpoint() { refreshCacheEndpoints(); if (CollectionUtils.isEmpty(endpoints)) { LOG.debug("ping-all connection-endpoints: none found."); return false; } for (ConnectionEndpoint connEndpoint : endpoints) { exchangeService.pingService(connEndpoint); } return true; }
Source:
<code><START> public static <T> T createInstance(String clazz, Object... args) { <END> try { Class classObj = Class.forName(clazz); Class[] argTypes = new Class[args.length]; IntStream.range(0, args.length).forEach(i -> argTypes[i] = args[i].getClass()); Constructor<T> ctor = classObj.getDeclaredConstructor(argTypes); return ctor.newInstance(args); } catch (Exception e) { return null; } }</code><technical_language>factory pattern, create instance arguments reflection. is usecase for this</technical_language>

Target:
public static <T> T createInstance(String clazz, Object... args) { Objects.requireNonNull(clazz, "null class name"); try { Class classObj = Class.forName(clazz); Class[] argTypes = new Class[args.length]; IntStream.range(0, args.length).forEach(i -> argTypes[i] = args[i].getClass()); Constructor<T> ctor = classObj.getDeclaredConstructor(argTypes); return ctor.newInstance(args); } catch (Exception e) { return null; } }
Source:
<code>public void connectWithRetry(ExecutorService executorService) { tryConnect = true; try { connect(); <START> isConnected = true; <END> } catch (ConnectionUnavailableException | RuntimeException e) { log.error(e.getMessage(), e); } }</code><technical_language>this AtomicBoolean</technical_language>

Target:
public void connectWithRetry(ExecutorService executorService) { tryConnect = true; try { connect(); isConnected.set(true); } catch (ConnectionUnavailableException | RuntimeException e) { log.error(e.getMessage(), e); } }
Source:
<code>private boolean hasGlobalPermission(String userName, Permission permission, RoleBasedAuthorizationStrategy rbas) { <START> LOGGER.debug("Check the global permission of the user " + userName + " " + rbas.getGrantedRoles(RoleBasedAuthorizationStrategy.GLOBAL)); <END> return hasPermission(userName, permission, rbas.getGrantedRoles(RoleBasedAuthorizationStrategy.GLOBAL)); }</code><technical_language>Slow logging</technical_language>

Target:
private boolean hasGlobalPermission(String userName, Permission permission, RoleBasedAuthorizationStrategy rbas) { return hasPermission(userName, permission, rbas.getGrantedRoles(RoleBasedAuthorizationStrategy.GLOBAL)); }
Source:
<code>static Object[] regionAndGatewayTypes() { ArrayList<Object[]> parameters = new ArrayList<>(); <START> parameters.add(new Object[] {RegionShortcut.PARTITION, true}); parameters.add(new Object[] {RegionShortcut.REPLICATE, false}); <END> return parameters.toArray(); }</code><technical_language>cases region is PARTITION parallel is false, region is REPLICATE parallel is true? Do need covered</technical_language>

Target:
static Object[] regionAndGatewayTypes() { ArrayList<Object[]> parameters = new ArrayList<>(); parameters.add(new Object[] {RegionShortcut.PARTITION, true}); parameters.add(new Object[] {RegionShortcut.PARTITION, false}); parameters.add(new Object[] {RegionShortcut.REPLICATE, false}); return parameters.toArray(); }
Source:
<code>public Map<String, String> getFacts() { <START> return facts; <END> }</code><technical_language>Encapsulate this here. returning a MapView here</technical_language>

Target:
public Map<String, String> getFacts() { return this.facts != null ? new MapView<String, String>(facts) : null; }
Source:
<code>public void windowClosed(IWorkbenchWindow window) { IWorkbenchWindow windows[] = PlatformUI.getWorkbench() .getWorkbenchWindows(); if (windows.length > 1) { return; } ILaunchManager manager = DebugPlugin.getDefault() .getLaunchManager(); ILaunchConfigurationType programType = manager .getLaunchConfigurationType(IExternalToolConstants.ID_PROGRAM_LAUNCH_CONFIGURATION_TYPE); if (programType == null) { return; } ILaunch launches[] = manager.getLaunches(); ILaunchConfigurationType configType; ILaunchConfiguration config; <START> for (ILaunch launche : launches) { <END> try { config = launche.getLaunchConfiguration(); if (config == null) { continue; } configType = config.getType(); }catch (CoreException e) { continue; } if (configType.equals(programType)) { if (!launche.isTerminated()) { MessageDialog .openWarning( window.getShell(), ExternalToolsProgramMessages.ProgramLaunchDelegate_Workbench_Closing_1, ExternalToolsProgramMessages.ProgramLaunchDelegate_The_workbench_is_exiting); break; } } } }</code><technical_language>typo in var name</technical_language>

Target:
public void windowClosed(IWorkbenchWindow window) { IWorkbenchWindow windows[] = PlatformUI.getWorkbench() .getWorkbenchWindows(); if (windows.length > 1) { return; } ILaunchManager manager = DebugPlugin.getDefault() .getLaunchManager(); ILaunchConfigurationType programType = manager .getLaunchConfigurationType(IExternalToolConstants.ID_PROGRAM_LAUNCH_CONFIGURATION_TYPE); if (programType == null) { return; } ILaunch launches[] = manager.getLaunches(); ILaunchConfigurationType configType; ILaunchConfiguration config; for (ILaunch launch : launches) { try { config = launch.getLaunchConfiguration(); if (config == null) { continue; } configType = config.getType(); }catch (CoreException e) { continue; } if (configType.equals(programType)) { if (!launch.isTerminated()) { MessageDialog .openWarning( window.getShell(), ExternalToolsProgramMessages.ProgramLaunchDelegate_Workbench_Closing_1, ExternalToolsProgramMessages.ProgramLaunchDelegate_The_workbench_is_exiting); break; } } } }
Source:
<code>public void unbindProducers(String outputChannelName) { <START> String transport = this.channelBindingServiceProperties.getBinder(outputChannelName); <END> Binder<MessageChannel> binder = binderFactory.getBinder(transport); binder.unbindProducers(outputChannelName); }</code><technical_language>factor out a private getBinderForChannel() method times 2 lines duplicated: String transport = this.channelBindingServiceProperties.getBinder(channelName); Binder<MessageChannel> binder = binderFactory.getBinder(transport);</technical_language>

Target:
public void unbindProducers(String outputChannelName) { Binder<MessageChannel> binder = getBinderForChannel(outputChannelName); binder.unbindProducers(outputChannelName); }
Source:
<code>public void testOneFlowInSplit() { try { <START> new ClassPathXmlApplicationContext("/org/springframework/batch/core/jsr/configuration/xml/invalid-split-context.xml.invalid"); <END> } catch (BeanDefinitionParsingException bdpe) { assertTrue(bdpe.getMessage().contains("A <split/> must contain at least two 'flow' elements.")); return; } fail("Expected exception was not thrown"); }</code><technical_language>this in a couple places, .invalid? move .xml</technical_language>

Target:
public void testOneFlowInSplit() { try { new ClassPathXmlApplicationContext("/org/springframework/batch/core/jsr/configuration/xml/invalid-split-context.xml"); } catch (BeanDefinitionParsingException bdpe) { assertTrue(bdpe.getMessage().contains("A <split/> must contain at least two 'flow' elements.")); return; } fail("Expected exception was not thrown"); }
Source:
<code>public PrebuiltAppleFramework( BuildRuleParams params, BuildRuleResolver ruleResolver, SourcePathResolver pathResolver, SourcePath frameworkPath, ImmutableSet<FrameworkPath> frameworks, Optional<Pattern> supportedPlatformsRegex, Function<? super CxxPlatform, ImmutableList<String>> exportedLinkerFlags) { super(params, pathResolver); this.params = params; this.frameworkPath = frameworkPath; this.ruleResolver = ruleResolver; this.exportedLinkerFlags = exportedLinkerFlags; this.frameworks = frameworks; this.supportedPlatformsRegex = supportedPlatformsRegex; BuildTarget target = params.getBuildTarget(); this.frameworkName = pathResolver.getAbsolutePath(frameworkPath).getFileName().toString(); <START> this.out = <END> getProjectFilesystem().getBuckPaths().getGenDir() .resolve(target.getBasePath()).resolve(target.getShortNameAndFlavorPostfix()).resolve(frameworkName); }</code><technical_language>Easier BuildTargets.getGenPath( getProjectFilesystem(), target, "%s")</technical_language>

Target:
public PrebuiltAppleFramework( BuildRuleParams params, BuildRuleResolver ruleResolver, SourcePathResolver pathResolver, SourcePath frameworkPath, ImmutableSet<FrameworkPath> frameworks, Optional<Pattern> supportedPlatformsRegex, Function<? super CxxPlatform, ImmutableList<String>> exportedLinkerFlags) { super(params, pathResolver); this.params = params; this.frameworkPath = frameworkPath; this.ruleResolver = ruleResolver; this.exportedLinkerFlags = exportedLinkerFlags; this.frameworks = frameworks; this.supportedPlatformsRegex = supportedPlatformsRegex; BuildTarget target = params.getBuildTarget(); this.frameworkName = pathResolver.getAbsolutePath(frameworkPath).getFileName().toString(); this.out = BuildTargets.getGenPath(getProjectFilesystem(), target, "%s").resolve(frameworkName); }
Source:
<code>protected void throwExeptionIfRestError(InputStream is, InputStreamReader in) throws IOException, BugzillaRestException { <START> is.mark(25); <END> byte[] b = new byte[20]; is.read(b); String str = new String(b); if (str.startsWith("{\"code\":") || str.startsWith("{\"message\":") || str.startsWith("{\"error\":")) { is.reset(); ErrorResponse resp = parseErrorResponseFromJson(in); throw new BugzillaRestResourceNotFoundException( NLS.bind("Error {1}: {0}", new Object[] { resp.getMessage(), resp.getCode() })); } is.reset(); }</code><technical_language>25</technical_language>

Target:
protected void throwExeptionIfRestError(InputStream is, InputStreamReader in) throws IOException, BugzillaRestException { try { is.mark(18); byte[] b = new byte[17]; is.read(b); String str = new String(b); if (str.startsWith("{\"code\":") || str.startsWith("{\"message\":") || str.startsWith("{\"error\":") || str.startsWith("{\"documentation\":")) { is.reset(); ErrorResponse resp = parseErrorResponseFromJson(in); throw new BugzillaRestResourceNotFoundException( NLS.bind("Error {1}: {0}", new Object[] { resp.getMessage(), resp.getCode() })); } } finally { is.reset(); } }
Source:
<code>protected void verifySchemaVersion(Object record, Long recordId, boolean forTrash) { String schemaField; if (forTrash) { <START> schemaField = "schemaVersion"; <END> } else { schemaField = HistoryTrashClassHelper.historySchemaVersion(record.getClass()); } Long recordSchemaVersion = (Long) PropertyUtil.safeGetProperty(record, schemaField); if (!schemaVersion.equals(recordSchemaVersion)) { throw new SchemaVersionException(schemaVersion, recordSchemaVersion, recordId, record.getClass().getName()); } }</code><technical_language>is this for trash history? "schemaVersion" is a consatant</technical_language>

Target:
protected void verifySchemaVersion(Object record, Long recordId, boolean forTrash) { String schemaField; if (forTrash) { schemaField = Constants.Util.SCHEMA_VERSION_FIELD_NAME; } else { schemaField = HistoryTrashClassHelper.historySchemaVersion(record.getClass()); } Long recordSchemaVersion = (Long) PropertyUtil.safeGetProperty(record, schemaField); if (!schemaVersion.equals(recordSchemaVersion)) { throw new SchemaVersionException(schemaVersion, recordSchemaVersion, recordId, record.getClass().getName()); } }
Source:
<code>public boolean isAuthenticated(Request request) { String authheader = request.getHeader(Constants.AUTHORIZATION_HEADER); if (authheader != null && authheader.startsWith(Constants.BASIC_AUTH_HEADER)) { String base64Credentials = authheader.substring(Constants.BASIC_AUTH_HEADER.length()).trim(); String credentials = new String(Base64.decode(base64Credentials), Charset.forName("UTF-8")); final String[] values = credentials.split(":", 2); String username = values[0]; String password = values[1]; <START> if ("".equals(username) || username == null || "".equals(password) || password == null) { <END> return false; } String tenantDomain = MultitenantUtils.getTenantDomain(username); String tenantLessUserName = MultitenantUtils.getTenantAwareUsername(username); try { RealmService realmService = (RealmService) PrivilegedCarbonContext .getThreadLocalCarbonContext().getOSGiService(RealmService.class); if (realmService != null) { int tenantId = realmService.getTenantManager().getTenantId(tenantDomain); if (tenantId == MultitenantConstants.INVALID_TENANT_ID) { log.error("Invalid tenant domain " + tenantDomain); return false; } UserRealm userRealm = realmService.getTenantUserRealm(tenantId); return userRealm.getUserStoreManager().authenticate(tenantLessUserName, password); } } catch (UserStoreException e) { log.error("Can't access the user realm of the user : " + username,e); } } return false; }</code><technical_language>StringUtils.isEmpty</technical_language>

Target:
public boolean isAuthenticated(Request request) { String authheader = request.getHeader(Constants.AUTHORIZATION_HEADER); if (authheader != null && authheader.startsWith(Constants.BASIC_AUTH_HEADER)) { String base64Credentials = authheader.substring(Constants.BASIC_AUTH_HEADER.length()).trim(); String credentials = new String(Base64.decode(base64Credentials), Charset.forName("UTF-8")); final String[] values = credentials.split(":", 2); String username = values[0]; String password = values[1]; if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password)) { return false; } String tenantDomain = MultitenantUtils.getTenantDomain(username); String tenantLessUserName = MultitenantUtils.getTenantAwareUsername(username); try { RealmService realmService = (RealmService) PrivilegedCarbonContext .getThreadLocalCarbonContext().getOSGiService(RealmService.class); if (realmService != null) { int tenantId = realmService.getTenantManager().getTenantId(tenantDomain); if (tenantId == MultitenantConstants.INVALID_TENANT_ID) { log.error("Invalid tenant domain " + tenantDomain); return false; } UserRealm userRealm = realmService.getTenantUserRealm(tenantId); return userRealm.getUserStoreManager().authenticate(tenantLessUserName, password); } } catch (UserStoreException e) { log.error("Can't access the user realm of the user : " + username,e); } } return false; }
Source:
<code>public void excludesIncorrectClassFormCheck() throws Exception { final byte[] bytecode = new BytecodeMocker() .withSource("class Foo { public Foo clone() { return this; } }") .mock(); final Environment env = new Environment.Mock() .withFile("target/classes/Foo.class", bytecode) <START> .withExcludes("findbugs", "Foo") <END> .withDefaultClasspath(); new FindBugsValidator().validate(env); }</code><technical_language>@ilyakharlamov put findbugs in a constant try avoid @SuppressWarnings("PMD.AvoidDuplicateLiterals") start of file</technical_language>

Target:
public void excludesIncorrectClassFormCheck() throws Exception { final byte[] bytecode = new BytecodeMocker() .withSource("class Foo { public Foo clone() { return this; } }") .mock(); final Environment env = new Environment.Mock() .withFile("target/classes/Foo.class", bytecode) .withExcludes(FindBugsValidator.EXCLUDE, "Foo") .withDefaultClasspath(); new FindBugsValidator().validate(env); }
Source:
<code>public int isStart(){ long investAmount = (long)getActivityChristmasInvestAmountAndCount().get("investAmount"); <START> if(investAmount >= 420000000 && !redisWrapperClient.exists(redisKey) && activityChristmasEndTime.after(new Date())) <END> redisWrapperClient.setex(redisKey, timeout, sdf.format(new Date())); return ((investAmount >= 420000000 && redisWrapperClient.exists(redisKey)) || (investAmount >= 420000000 && activityChristmasEndTime.before(new Date()))) ? 1 : 0; }</code><technical_language>const</technical_language>

Target:
public int isStart(){ long investAmount = (long)getActivityChristmasInvestAmountAndCount().get("investAmount"); if(investAmount >= CHRISTMAS_ACTIVITY_2_START_MIN_AMOUNT && !redisWrapperClient.exists(redisKey) && activityChristmasEndTime.after(new Date())) redisWrapperClient.setex(redisKey, timeout, sdf.format(new Date())); return ((investAmount >= CHRISTMAS_ACTIVITY_2_START_MIN_AMOUNT && redisWrapperClient.exists(redisKey)) || (investAmount >= CHRISTMAS_ACTIVITY_2_START_MIN_AMOUNT && activityChristmasEndTime.before(new Date()))) ? 1 : 0; }
Source:
<code>public void setCheckedElements(Object[] elements) { Object[] oldCheckedElements = getCheckedElements(); super.setCheckedElements(elements); <START> ArrayList<Object> changedElements = new ArrayList<>(Arrays.asList(elements)); <END> changedElements.removeAll(Arrays.asList(oldCheckedElements)); Control tree = getControl(); try { tree.setRedraw(false); doCheckStateChanged(changedElements.toArray()); } finally { tree.setRedraw(true); } }</code><technical_language>'elements' hundreds of entries. is converted ArrayList, removeAll operation sequential search. a HashSet better. oldCheckedElements is empty conversion/intersection necessary. In this case doCheckedElements called original elements array. I propose change to: public void setCheckedElements(Object[] elements) { Object[] oldCheckedElements = getCheckedElements(); super.setCheckedElements(elements); Control tree = getControl(); try { tree.setRedraw(false); if (oldCheckedElements.length > 0) { // calculate intersection of previously newly checked elements avoid // no-op updates HashSet<Object> changedElements = new HashSet<>(Arrays.asList(elements)); changedElements.removeAll(Arrays.asList(oldCheckedElements)); doCheckStateChanged(changedElements.toArray()); } else { doCheckStateChanged(elements); } } finally { tree.setRedraw(true); } }</technical_language>

Target:
public void setCheckedElements(Object[] elements) { Object[] oldCheckedElements = getCheckedElements(); super.setCheckedElements(elements); Control tree = getControl(); try { tree.setRedraw(false); if (oldCheckedElements.length > 0) { HashSet<Object> changedElements = new HashSet<>(Arrays.asList(elements)); changedElements.removeAll(Arrays.asList(oldCheckedElements)); doCheckStateChanged(changedElements.toArray()); } else { doCheckStateChanged(elements); } } finally { tree.setRedraw(true); } }
Source:
<code>private InvocationStage checkPendingAndLockAllKeys(TxInvocationContext<?> ctx, VisitableCommand command, Collection<Object> keys, long lockTimeout) { PendingLockPromise pendingLockPromise = pendingLockManager.checkPendingTransactionsForKeys(ctx, keys, lockTimeout, TimeUnit.MILLISECONDS); if (pendingLockPromise.isReady()) { return lockAllAndRecord(ctx, command, keys, lockTimeout); } <START> return makeStage(pendingLockPromise.toInvocationStage().thenApply(ctx, command, ((rCtx, rCommand, rv) -> { <END> long remaining = pendingLockPromise.getRemainingTimeout(); return lockAllAndRecord(ctx, command, keys, remaining); }))); }</code><technical_language>thenApplyMakeStage() here</technical_language>

Target:
private InvocationStage checkPendingAndLockAllKeys(TxInvocationContext<?> ctx, VisitableCommand command, Collection<Object> keys, long lockTimeout) { PendingLockPromise pendingLockPromise = pendingLockManager.checkPendingTransactionsForKeys(ctx, keys, lockTimeout, TimeUnit.MILLISECONDS); if (pendingLockPromise.isReady()) { return lockAllAndRecord(ctx, command, keys, lockTimeout); } return pendingLockPromise.toInvocationStage().thenApplyMakeStage(ctx, command, ((rCtx, rCommand, rv) -> { long remaining = pendingLockPromise.getRemainingTimeout(); return lockAllAndRecord(ctx, command, keys, remaining); })); }
Source:
<code>public Set<Name> suggest(EntityRef sender, Object... resolvedParameters) { Collection<ConsoleCommand> commands = console.getCommands(); Set<Name> suggestions = Sets.newHashSetWithExpectedSize(commands.size()); <START> suggestions.addAll(commands.stream().map(ConsoleCommand::getName).collect(Collectors.toList())); <END> return suggestions; }</code><technical_language>I find original version easier read in this case</technical_language>

Target:
public Set<Name> suggest(EntityRef sender, Object... resolvedParameters) { Collection<ConsoleCommand> commands = console.getCommands(); Set<Name> suggestions = Sets.newHashSetWithExpectedSize(commands.size()); for (ConsoleCommand command : commands) { suggestions.add(command.getName()); } return suggestions; }
Source:
<code>public Optional<LogEntry> getEntry() { <START> if (entry == null) { <END> return Optional.empty(); } return Optional.of(entry); }</code><technical_language>return Optional.ofNullable(entry);</technical_language>

Target:
public Optional<LogEntry> getEntry() { return Optional.ofNullable(entry); }
Source:
<code>int getMacCodeLength() { <START> return 8; <END> }</code><technical_language>reason a dummy digest manager needs a 8 bytes here? 0? digest is useless, no</technical_language>

Target:
int getMacCodeLength() { return 0; }
Source:
<code>public RepositoryBuild triggerWithOptions(@PathParam("id") int branchId, BuildOptions buildOptions, @QueryParam("username") Optional<String> username) { Optional<GitInfo> gitInfo = branchService.get(branchId); if (!gitInfo.isPresent()) { throw new NotFoundException("No branch found with id: " + branchId); } BuildTrigger buildTrigger; if (username.isPresent()) { buildTrigger = BuildTrigger.forUser(username.get()); } else { buildTrigger = BuildTrigger.forUser("unknown"); <START> } <END> long repositoryBuildId = repositoryBuildService.enqueue(gitInfo.get(), buildTrigger, buildOptions); return repositoryBuildService.get(repositoryBuildId).get(); }</code><technical_language>do BuildTrigger buildTrigger = BuildTrigger.forUser(username.or("unknown"));</technical_language>

Target:
public RepositoryBuild triggerWithOptions(@PathParam("id") int branchId, BuildOptions buildOptions, @QueryParam("username") Optional<String> username) { Optional<GitInfo> gitInfo = branchService.get(branchId); if (!gitInfo.isPresent()) { throw new NotFoundException("No branch found with id: " + branchId); } BuildTrigger buildTrigger = BuildTrigger.forUser(username.or("unknown")); long repositoryBuildId = repositoryBuildService.enqueue(gitInfo.get(), buildTrigger, buildOptions); return repositoryBuildService.get(repositoryBuildId).get(); }