auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>@Test public void stepExecutionWithCredentials() { story.addStep(new Statement() { @Override public void evaluate() throws Throwable { assumeNotWindows(); IdCredentials serverCredentials = new DockerServerCredentials(CredentialsScope.GLOBAL, "serverCreds", null, "clientKey", "clientCertificate", "serverCaCertificate"); CredentialsProvider.lookupStores(story.j.jenkins).iterator().next().addCredentials(Domain.global(), serverCredentials); WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "prj"); p.setDefinition(new CpsFlowDefinition( "node {\n" + " withDockerServer(server: [uri: 'tcp://host:1234', credentialsId: 'serverCreds']) {\n" + " sh 'echo would be connecting to $DOCKER_HOST'\n" + " }\n" + "}", true)); WorkflowRun b = story.j.buildAndAssertSuccess(p); <START> story.j.assertLogContains("would be connecting to tcp://host:1234", b); <END> } }); }</code><technical_language>testing credentials here. src/main/ reverted? Is a build failure, credentials ignored, a warning logged</technical_language>

Target:
@Test public void stepExecutionWithCredentials() { story.addStep(new Statement() { @Override public void evaluate() throws Throwable { assumeNotWindows(); IdCredentials serverCredentials = new DockerServerCredentials(CredentialsScope.GLOBAL, "serverCreds", null, "clientKey", "clientCertificate", "serverCaCertificate"); CredentialsProvider.lookupStores(story.j.jenkins).iterator().next().addCredentials(Domain.global(), serverCredentials); WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "prj"); p.setDefinition(new CpsFlowDefinition( "node {\n" + " withDockerServer(server: [uri: 'tcp://host:1234', credentialsId: 'serverCreds']) {\n" + " sh 'echo would be connecting to $DOCKER_HOST'\n" + " sh 'echo DOCKER_TLS_VERIFY=$DOCKER_TLS_VERIFY'\n" + " sh 'echo DOCKER_CERT_PATH=$DOCKER_CERT_PATH is not empty'\n" + " }\n" + "}", true)); WorkflowRun b = story.j.buildAndAssertSuccess(p); story.j.assertLogContains("would be connecting to tcp://host:1234", b); story.j.assertLogContains("DOCKER_TLS_VERIFY=1", b); story.j.assertLogNotContains("DOCKER_CERT_PATH= is not empty", b); } }); }
Source:
<code>public String getValue(HttpContext httpContext) { List<String> headers = httpContext.getRequest().getRequestHeader(correlatorHeader); <START> if (headers == null || headers.size() == 0) { <END> LOGGER.error("Correlator Header not present", correlatorHeader); throw new WebApplicationException(Response.Status.BAD_REQUEST); } else if (headers.size() > 1) { LOGGER.error("Too many Correlator Headers {}:", correlatorHeader, headers); throw new WebApplicationException(Response.Status.BAD_REQUEST); } else { LOGGER.debug("correlator found {}:", headers.get(0)); MDC.put("client", headers.get(0)); return headers.get(0); } }</code><technical_language>wrong, this provider raise error if correlator is present incoming requests. Is right? If is, expected correlator behavior</technical_language>

Target:
public String getValue(HttpContext httpContext) { List<String> headers = httpContext.getRequest().getRequestHeader(correlatorHeader); if ( (headers != null) && (headers.size() > 0) ) { if (headers.size() == 1) { LOGGER.debug("correlator found {}:", headers.get(0)); MDC.put("client", headers.get(0)); return headers.get(0); } else { LOGGER.error("Too many Correlator Headers {}:", correlatorHeader, headers); throw new WebApplicationException(Response.Status.BAD_REQUEST); } } else { LOGGER.debug("correlator not found"); return null; } }
Source:
<code>public NeuralNetworkRule(ResourceBundle messages, Language language, ScoredConfusionSet confusionSet, Word2VecModel word2VecModel) { super(messages); super.setCategory(Categories.TYPOS.getCategory(messages)); this.subjects = confusionSet.getConfusionTokens(); this.descriptions = confusionSet.getTokenDescriptions(); this.minScore = confusionSet.getScore(); try { final InputStream W1Stream = streamFor(word2VecModel.getPath(), "W_fc1.txt"); final InputStream b1Stream = streamFor(word2VecModel.getPath(), "b_fc1.txt"); try { final InputStream W2Stream = streamFor(word2VecModel.getPath(), "W_fc2.txt"); final InputStream b2Stream = streamFor(word2VecModel.getPath(), "b_fc2.txt"); System.out.println("deep rule for" + confusionSet.toString()); classifier = new TwoLayerClassifier(word2VecModel.getEmbedding(), W1Stream, b1Stream, W2Stream, b2Stream); } catch (FileNotFoundException e) { classifier = new SingleLayerClassifier(word2VecModel.getEmbedding(), W1Stream, b1Stream); } } catch (FileNotFoundException e) { <START> throw new IllegalStateException("weights for confusion set " + confusionSet.toString() + " are missing"); <END> } this.id = createId(language); }</code><technical_language>This IOException? Also, please add e a argument original exception get lost</technical_language>

Target:
public NeuralNetworkRule(ResourceBundle messages, Language language, ScoredConfusionSet confusionSet, Word2VecModel word2VecModel) throws IOException { super(messages); super.setCategory(Categories.TYPOS.getCategory(messages)); this.subjects = confusionSet.getConfusionTokens(); this.descriptions = confusionSet.getTokenDescriptions(); this.minScore = confusionSet.getScore(); try { final InputStream W1Stream = streamFor(word2VecModel.getPath(), "W_fc1.txt"); final InputStream b1Stream = streamFor(word2VecModel.getPath(), "b_fc1.txt"); try { final InputStream W2Stream = streamFor(word2VecModel.getPath(), "W_fc2.txt"); final InputStream b2Stream = streamFor(word2VecModel.getPath(), "b_fc2.txt"); System.out.println("deep rule for" + confusionSet.toString()); classifier = new TwoLayerClassifier(word2VecModel.getEmbedding(), W1Stream, b1Stream, W2Stream, b2Stream); } catch (FileNotFoundException e) { classifier = new SingleLayerClassifier(word2VecModel.getEmbedding(), W1Stream, b1Stream); } } catch (FileNotFoundException e) { throw new IOException("weights for confusion set " + confusionSet.toString() + " are missing", e); } this.id = createId(language); }
Source:
<code><START> public void testUnknownInstallSourceIsParsedCorrectly() { <END> final InstallSource installSource = InstallSource.fromInstallerPackageName(null); assertTrue(installSource instanceof UnknownInstallSource); assertEquals("Unknown", installSource.toString()); }</code><technical_language><b>Reporter: </b>PMD<br /><b>Violation: </b><a target="_blank" href="<LINK_0>">JUnitTestContainsTooManyAsserts</a><br /><b>Notes: </b>JUnit tests more 1 assert(s)</technical_language>

Target:
public void testUnknownInstallSourceIsParsedCorrectly() { final InstallSource installSource = InstallSource.fromInstallerPackageName(null); assertTrue( "null package name is correctly identified as an unknown install source", installSource instanceof UnknownInstallSource); assertEquals( "Unknown install source has correct description", "Unknown", installSource.toString()); }
Source:
<code>public static short computeDuplicateScore(final SAMRecord record, final ScoringStrategy scoringStrategy, final boolean assumeMateCigar) { Short storedScore = (Short) record.getTransientAttribute(Attr.DuplicateScore); if (storedScore == null) { short score=0; switch (scoringStrategy) { case SUM_OF_BASE_QUALITIES: score += (short) Math.min(getSumOfBaseQualities(record), Short.MAX_VALUE / 2); break; case TOTAL_MAPPED_REFERENCE_LENGTH: if (!record.getReadUnmappedFlag()) { score += record.getCigar().getReferenceLength(); } if (assumeMateCigar && record.getReadPairedFlag() && !record.getMateUnmappedFlag()) { score += SAMUtils.getMateCigar(record).getReferenceLength(); } break; case RANDOM: <START> score += (short) (hasher.hashUnencodedChars(record.getReadName()) & 0b11_1111_1111_1111); <END> score -= Short.MIN_VALUE/4; } score = (short) Math.max(Short.MIN_VALUE, score); score += record.getReadFailsVendorQualityCheckFlag() ? (short) (Short.MIN_VALUE / 2) : 0; storedScore = score; record.setTransientAttribute(Attr.DuplicateScore, storedScore); } return storedScore; }</code><technical_language>This unecessarily complicated. java.util.Random::nextInt(Short.MAX_VALUE / 2)</technical_language>

Target:
public static short computeDuplicateScore(final SAMRecord record, final ScoringStrategy scoringStrategy, final boolean assumeMateCigar) { Short storedScore = (Short) record.getTransientAttribute(Attr.DuplicateScore); if (storedScore == null) { short score=0; switch (scoringStrategy) { case SUM_OF_BASE_QUALITIES: score += (short) Math.min(getSumOfBaseQualities(record), Short.MAX_VALUE / 2); break; case TOTAL_MAPPED_REFERENCE_LENGTH: if (!record.getReadUnmappedFlag()) { score = (short) Math.min(record.getCigar().getReferenceLength(), Short.MAX_VALUE / 2); } if (assumeMateCigar && record.getReadPairedFlag() && !record.getMateUnmappedFlag()) { score += (short) Math.min(SAMUtils.getMateCigar(record).getReferenceLength(), Short.MAX_VALUE / 2); } break; case RANDOM: score += (short) (hasher.hashUnencodedChars(record.getReadName()) & 0b11_1111_1111_1111); score -= Short.MIN_VALUE / 4; } score += record.getReadFailsVendorQualityCheckFlag() ? (short) (Short.MIN_VALUE / 2) : 0; storedScore = score; record.setTransientAttribute(Attr.DuplicateScore, storedScore); } return storedScore; }
Source:
<code>public void testSendNonExistingFile() throws Exception { server.requestHandler(req -> { <START> req.response().sendFile("/not/existing/path", event -> { <END> if (event.failed()) { req.response().end("failed"); } }); }); server.listen(onSuccess(s -> { client.request(HttpMethod.GET, DEFAULT_HTTP_PORT, DEFAULT_HTTP_HOST, DEFAULT_TEST_URI, resp -> { resp.bodyHandler(buff -> { assertEquals("failed", buff.toString()); testComplete(); }); }).end(); })); await(); }</code><technical_language>check this is correct Context in callback</technical_language>

Target:
public void testSendNonExistingFile() throws Exception { server.requestHandler(req -> { final Context ctx = vertx.getOrCreateContext(); req.response().sendFile("/not/existing/path", event -> { assertEquals(ctx, vertx.getOrCreateContext()); if (event.failed()) { req.response().end("failed"); } }); }); server.listen(onSuccess(s -> { client.request(HttpMethod.GET, DEFAULT_HTTP_PORT, DEFAULT_HTTP_HOST, DEFAULT_TEST_URI, resp -> { resp.bodyHandler(buff -> { assertEquals("failed", buff.toString()); testComplete(); }); }).end(); })); await(); }
Source:
<code>public void load() throws FailToParseHooksException, FieldNotFoundException { <START> BotUI.getInstance().getJMenuBar().remove(2); <END> Core.verbose(TranslationHelper.translate("PARSING_SERVER_JAR")); serverProvider.init(); serverProvider.parseJar(); Core.verbose(TranslationHelper.translate("DONE")); Core.verbose(TranslationHelper.translate("INJECTING_HOOKS")); serverProvider.injectHooks(); Core.verbose(TranslationHelper.translate("DONE")); Core.verbose(TranslationHelper.translate("FETCHING_GAME_APPLET")); if(Core.shouldDump()) { Core.verbose(TranslationHelper.translate("DUMPING_INJECTED_CLIENT")); classPath.dump(new File(Directories.getWorkspace(), "dump.jar")); Core.verbose(TranslationHelper.translate("DONE")); } Applet applet = serverProvider.fetchApplet(); if(applet != null) { setApplet(applet); } }</code><technical_language>Please do so</technical_language>

Target:
public void load() throws FailToParseHooksException, FieldNotFoundException { Core.verbose(TranslationHelper.translate("PARSING_SERVER_JAR")); serverProvider.init(); serverProvider.parseJar(); Core.verbose(TranslationHelper.translate("DONE")); Core.verbose(TranslationHelper.translate("INJECTING_HOOKS")); serverProvider.injectHooks(); Core.verbose(TranslationHelper.translate("DONE")); Core.verbose(TranslationHelper.translate("FETCHING_GAME_APPLET")); if (Core.shouldDump()) { Core.verbose(TranslationHelper.translate("DUMPING_INJECTED_CLIENT")); classPath.dump(new File(Directories.getWorkspace(), "dump.jar")); Core.verbose(TranslationHelper.translate("DONE")); } Applet applet = serverProvider.fetchApplet(); if (applet != null) { setApplet(applet); } }
Source:
<code>private static String getPermissionsTableName(Class<?> owner, Class<?> property) { String ownerName = owner.getSimpleName(); String propertyName = property.getSimpleName(); if (propertyName.equals("ManagedUser")) { propertyName = "User"; } <START> return ownerName.substring(0, 1).toLowerCase() + ownerName.substring(1) + "_" <END> + propertyName.substring(0, 1).toLowerCase() + propertyName.substring(1); }</code><technical_language>Introspector.decapitalize</technical_language>

Target:
private static String getPermissionsTableName(Class<?> owner, Class<?> property) { String propertyName = property.getSimpleName(); if (propertyName.equals("ManagedUser")) { propertyName = "User"; } return Introspector.decapitalize(owner.getSimpleName()) + "_" + Introspector.decapitalize(propertyName); }
Source:
<code><START> private void checkPlaylist() { <END> if (isCheckingWhatsPlaying) return; isCheckingWhatsPlaying = true; connection.execute(new GetPlaylist(connection), new ApiCallback<ArrayList<GetPlaylist.GetPlaylistResult>>() { @Override public void onSuccess(ArrayList<GetPlaylist.GetPlaylistResult> result) { isCheckingWhatsPlaying = false; if (result.isEmpty()) return; for (PlaylistEventsObserver observer : playlistEventsObservers) { observer.playlistsAvailable(result); } } @Override public void onError(int errorCode, String description) { isCheckingWhatsPlaying = false; for (PlaylistEventsObserver observer : playlistEventsObservers) { observer.playlistOnError(errorCode, description); } } }, new Handler()); }</code><technical_language>isCheckingPlaylist a name</technical_language>

Target:
private void checkPlaylist() { if (isCheckingPlaylist) return; isCheckingPlaylist = true; connection.execute(new GetPlaylist(connection), new ApiCallback<ArrayList<GetPlaylist.GetPlaylistResult>>() { @Override public void onSuccess(ArrayList<GetPlaylist.GetPlaylistResult> result) { isCheckingPlaylist = false; if (result.isEmpty()) { callPlaylistsOnClear(prevGetPlaylistResults); return; } for (PlaylistEventsObserver observer : playlistEventsObservers) { observer.playlistsAvailable(result); } for (GetPlaylist.GetPlaylistResult getPlaylistResult : result) { for (int i = 0; i < prevGetPlaylistResults.size(); i++) { if (getPlaylistResult.id == prevGetPlaylistResults.get(i).id) { prevGetPlaylistResults.remove(i); break; } } } callPlaylistsOnClear(prevGetPlaylistResults); prevGetPlaylistResults = result; } @Override public void onError(int errorCode, String description) { isCheckingPlaylist = false; for (PlaylistEventsObserver observer : playlistEventsObservers) { observer.playlistOnError(errorCode, description); } } }, new Handler()); }
Source:
<code>private TopologyResources getResourcesForTopology(String topoId, StormBase base) throws NotAliveException, AuthorizationException, InvalidTopologyException, IOException { TopologyResources ret = idToResources.get().get(topoId); if (ret == null) { try { IStormClusterState state = stormClusterState; TopologyDetails details = readTopologyDetails(topoId, base); <START> Assignment assignment = getAssignmentInfo(state, topoId); <END> ret = new TopologyResources(details, assignment); } catch(KeyNotFoundException e) { LOG.error("Failed to get topology details", e); ret = new TopologyResources(); } } return ret; }</code><technical_language>stormClusterState making another state variable. (Here in next method.)</technical_language>

Target:
private TopologyResources getResourcesForTopology(String topoId, StormBase base) throws NotAliveException, AuthorizationException, InvalidTopologyException, IOException { TopologyResources ret = idToResources.get().get(topoId); if (ret == null) { try { TopologyDetails details = readTopologyDetails(topoId, base); Assignment assignment = getAssignmentInfo(topoId); ret = new TopologyResources(details, assignment); } catch(KeyNotFoundException e) { LOG.error("Failed to get topology details", e); ret = new TopologyResources(); } } return ret; }
Source:
<code>public String getUsage(ICommandSender commandSender) { <START> return new TextComponentTranslation("commands.bloodmagic.bind.usage").getFormattedText() + "\n" + help; <END> }</code><technical_language>getUsage(...) expects a localization key</technical_language>

Target:
public String getUsage(ICommandSender commandSender) { return "commands.bloodmagic.bind.usage"; }
Source:
<code>protected void onPostExecute(Void aVoid) { <START> LinearLayout multireddits_area = headerMain.findViewById(R.id.multireddits_area); <END> for (MultiReddit multiReddit : UserSubscriptions.multireddits) { final View t = getLayoutInflater().inflate(R.layout.multireddit_textview_white, multireddits_area, false); ((TextView) t.findViewById(R.id.name)).setText(multiReddit.getDisplayName()); t.setOnClickListener(v -> { Intent intent = new Intent(MainActivity.this, MultiredditOverview.class); intent.putExtra(MultiredditOverview.EXTRA_MULTI, multiReddit.getFullName()); startActivity(intent); }); multireddits_area.addView(t); } }</code><technical_language>This camelCase, multiredditsArea expandMultireddits id name change</technical_language>

Target:
protected void onPostExecute(Void aVoid) { LinearLayout multiredditsArea = headerMain.findViewById(R.id.expand_multireddits); for (MultiReddit multiReddit : UserSubscriptions.multireddits) { final View t = getLayoutInflater().inflate(R.layout.multireddit_textview_white, multiredditsArea, false); ((TextView) t.findViewById(R.id.name)).setText(multiReddit.getDisplayName()); t.setOnClickListener(v -> { Intent intent = new Intent(MainActivity.this, MultiredditOverview.class); intent.putExtra(MultiredditOverview.EXTRA_MULTI, multiReddit.getFullName()); startActivity(intent); }); multiredditsArea.addView(t); } }
Source:
<code>protected void beforeSave() { if (Strings.isEmpty(blobKey)) { blobKey = keyGen.generateId(); } updateFilenameFields(); if (isNew() || isChanged(FILENAME, NORMALIZED_FILENAME, FILE_EXTENSION)) { <START> changed = true; <END> } if (deleted) { changed = false; } }</code><technical_language>call createdOrRenamed instead of changed then</technical_language>

Target:
protected void beforeSave() { if (Strings.isEmpty(blobKey)) { blobKey = keyGen.generateId(); } updateFilenameFields(); if (isNew() || isChanged(FILENAME, NORMALIZED_FILENAME, FILE_EXTENSION)) { createdOrRenamed = true; } if (deleted) { createdOrRenamed = false; } }
Source:
<code>public AnsibleCommandBuilder hosts(VdsStatic... hosts) { this.hostnames = Arrays.stream(hosts) .map(h -> <START> String.format("[%1$s]:%2$s", <END> h.getHostName(), h.getSshPort())) .collect(Collectors.toList()); return this; }</code><technical_language>fail for v4</technical_language>

Target:
public AnsibleCommandBuilder hosts(VdsStatic... hosts) { this.hostnames = Arrays.stream(hosts) .map(h -> formatHostPort(h.getHostName(), h.getSshPort())) .collect(Collectors.toList()); return this; }
Source:
<code>public static void openFolderAndSelectFile(Path fileLink) throws IOException { if (Objects.isNull(fileLink)) { return; } boolean usingDefault = Globals.prefs.getBoolean(JabRefPreferences.USE_DEFAULT_FILE_BROWSER_APPLICATION); if(usingDefault) { NATIVE_DESKTOP.openFolderAndSelectFile(fileLink); }else{ String absolutePath = fileLink.toAbsolutePath().getParent().toString(); String command = Globals.prefs.get(JabRefPreferences.FILE_BROWSER_COMMAND); if (!command.isEmpty()) { command = command.replaceAll("\\s+", " "); command = command.replace("%DIR", absolutePath); String[] subcommands = command.split(" "); <START> JabRefGUI.getMainFrame().output(Localization.lang("Executing command \"%0\"...", command)); <END> LOGGER.info("Executing command \"" + command + "\"..."); try { new ProcessBuilder(subcommands).start(); } catch (IOException exception) { LOGGER.error("Open File Browser", exception); JOptionPane.showMessageDialog(null, Localization.lang("Error occured while executing the command \"%0\".", command), Localization.lang("Open File Browser") + " - " + Localization.lang("Error"), JOptionPane.ERROR_MESSAGE); } } } }</code><technical_language>I output is deprecated, instead DialogService</technical_language>

Target:
public static void openFolderAndSelectFile(Path fileLink) throws IOException { if (fileLink == null) { return; } boolean usingDefault = Globals.prefs.getBoolean(JabRefPreferences.USE_DEFAULT_FILE_BROWSER_APPLICATION); if (usingDefault) { NATIVE_DESKTOP.openFolderAndSelectFile(fileLink); } else { String absolutePath = fileLink.toAbsolutePath().getParent().toString(); String command = Globals.prefs.get(JabRefPreferences.FILE_BROWSER_COMMAND); if (!command.isEmpty()) { command = command.replaceAll("\\s+", " "); command = command.replace("%DIR", absolutePath); String[] subcommands = command.split(" "); LOGGER.info("Executing command \"" + command + "\"..."); try { new ProcessBuilder(subcommands).start(); } catch (IOException exception) { LOGGER.error("Open File Browser", exception); JabRefGUI.getMainFrame().getDialogService().notify(Localization.lang("Error occured while executing the command \"%0\".", command)); } } } }
Source:
<code>private void validate(short version) { if (version == 0) { final boolean unsupported = acls().stream() .anyMatch(acl -> acl.patternType() != PatternType.LITERAL.code()); if (unsupported) { throw new UnsupportedVersionException("Version 0 only supports literal resource pattern types"); } } final boolean unknown = acls().stream() .map(DescribeAclsResponse::aclBindings) <START> .anyMatch(bindings -> bindings.stream().anyMatch(AclBinding::isUnknown)); <END> if (unknown) { throw new IllegalArgumentException("Contain UNKNOWN elements"); } }</code><technical_language>pretty inefficient create AclBinding instances, check for unknowns. Is avoid that</technical_language>

Target:
private void validate(short version) { if (version == 0) { final boolean unsupported = acls().stream() .anyMatch(acl -> acl.patternType() != PatternType.LITERAL.code()); if (unsupported) { throw new UnsupportedVersionException("Version 0 only supports literal resource pattern types"); } } for (DescribeAclsResource resource : acls()) { if (resource.patternType() == PatternType.UNKNOWN.code() || resource.type() == ResourceType.UNKNOWN.code()) throw new IllegalArgumentException("Contain UNKNOWN elements"); for (AclDescription acl : resource.acls()) { if (acl.operation() == AclOperation.UNKNOWN.code() || acl.permissionType() == AclPermissionType.UNKNOWN.code()) { throw new IllegalArgumentException("Contain UNKNOWN elements"); } } } }
Source:
<code>public static void update(IProject project, Optional<List<OmniEclipseBuildCommand>> buildCommands, PersistentModelBuilder persistentModel, IProgressMonitor monitor) throws CoreException { IProjectDescription description = project.getDescription(); <START> Set<ICommand> current = Sets.newLinkedHashSet(Arrays.asList(description.getBuildSpec())); <END> Set<ICommand> model = toCommands(buildCommands, description); PersistentModel previousModel = persistentModel.getPrevious(); Set<ICommand> managed = previousModel.isPresent() ? Sets.newLinkedHashSet(previousModel.getManagedBuilders()) : Sets.<ICommand>newLinkedHashSet(); Result<ICommand> result = GradleBuilderAndNatureMergingStrategy.calculate(current, model, managed); description.setBuildSpec(result.getNextElements().toArray(new ICommand[0])); project.setDescription(description, monitor); persistentModel.managedBuilders(result.getNextManaged()); }</code><technical_language>ImmutableSet.copyOf() read here</technical_language>

Target:
public static void update(IProject project, Optional<List<OmniEclipseBuildCommand>> buildCommands, PersistentModelBuilder persistentModel, IProgressMonitor monitor) throws CoreException { IProjectDescription description = project.getDescription(); Set<ICommand> current = ImmutableSet.copyOf(description.getBuildSpec()); Set<ICommand> model = toCommands(buildCommands, description); PersistentModel previousModel = persistentModel.getPrevious(); Set<ICommand> managed = previousModel.isPresent() ? Sets.newLinkedHashSet(previousModel.getManagedBuilders()) : Sets.<ICommand>newLinkedHashSet(); Result<ICommand> result = ManagedModelMergingStrategy.calculate(current, model, managed); description.setBuildSpec(result.getNextElements().toArray(new ICommand[0])); project.setDescription(description, monitor); persistentModel.managedBuilders(result.getNextManaged()); }
Source:
<code>public static Change translateAttributesToOtherUnits( final Unit unitGivingAttributes, final Collection<Unit> unitsThatWillGetAttributes, final Territory territory) { final CompositeChange changes = unitsThatWillGetAttributes.stream() .findFirst() .map( <START> receivingUnit -> { <END> final CompositeChange unitChange = new CompositeChange(); final List<Unit> unloaded = unitGivingAttributes.getUnloaded(); if (!unloaded.isEmpty()) { unitChange.add( ChangeFactory.unitPropertyChange(receivingUnit, unloaded, Unit.UNLOADED)); } final List<Unit> transporting = unitGivingAttributes.getTransporting(); return transporting.stream() .map( transported -> new CompositeChange( ChangeFactory.unitPropertyChange( transported, receivingUnit, Unit.TRANSPORTED_BY))) .reduce(unitChange, CompositeChange::new); }) .orElse(new CompositeChange()); return unitsThatWillGetAttributes.stream() .map( receivingUnit -> { final CompositeChange unitChange = new CompositeChange(); final int transferHits = Math.min( unitGivingAttributes.getHits(), receivingUnit.getUnitAttachment().getHitPoints() - 1); if (transferHits > 0) { unitChange.add( ChangeFactory.unitsHit( IntegerMap.of(Map.of(receivingUnit, transferHits)), List.of(territory))); } final int transferDamage = Math.min( unitGivingAttributes.getUnitDamage(), receivingUnit.getHowMuchDamageCanThisUnitTakeTotal(territory)); if (transferDamage > 0) { unitChange.add( ChangeFactory.bombingUnitDamage( IntegerMap.of(Map.of(receivingUnit, transferDamage)), List.of(territory))); } return unitChange; }) .reduce(changes, CompositeChange::new); }</code><technical_language>of extracting this map a helper function? AFAIK practice for lambda's is line, try method references. done making a method accepts 'receivingUnit' input parameter</technical_language>

Target:
public static Change translateAttributesToOtherUnits( final Unit unitGivingAttributes, final Collection<Unit> unitsThatWillGetAttributes, final Territory territory) { final CompositeChange changes = unitsThatWillGetAttributes.stream() .findFirst() .map( receivingUnit -> translateDependentUnitsToOtherUnit(unitGivingAttributes, receivingUnit)) .orElse(new CompositeChange()); return unitsThatWillGetAttributes.stream() .map( receivingUnit -> translateHitPointsAndDamageToOtherUnit( unitGivingAttributes, territory, receivingUnit)) .reduce(changes, CompositeChange::new); }
Source:
<code>public void handleData(final ITmfEvent event) { super.handleData(event); if (isCancelled()) { return; } try { if (fFilter == null || fFilter.matches(event)) { if (fTable != null) { <START> String[] entries = fTable.getCurrentItemStrings(event); <END> boolean needTab = false; for (String entry : entries) { if (needTab) { fWriter.write('\t'); } printValue(entry); needTab = true; } } else { fWriter.write(event.getTimestamp().toString()); fWriter.write('\t'); fWriter.write(event.getSource()); fWriter.write('\t'); fWriter.write(event.getType().getName()); fWriter.write('\t'); fWriter.write(event.getReference()); fWriter.write('\t'); ITmfEventField content = event.getContent(); printValue(content.getValue()); } fWriter.write('\n'); } } catch (IOException ex) { fIOException = ex; fail(); } }</code><technical_language>Change necessary long getItemStrings() current order</technical_language>

Target:
public void handleData(final ITmfEvent event) { super.handleData(event); if (isCancelled()) { return; } try { if (fFilter == null || fFilter.matches(event)) { if (fTable != null) { String[] entries = fTable.getItemStrings(event); boolean needTab = false; for (String entry : entries) { if (needTab) { fWriter.write('\t'); } printValue(entry); needTab = true; } } else { fWriter.write(event.getTimestamp().toString()); fWriter.write('\t'); fWriter.write(event.getSource()); fWriter.write('\t'); fWriter.write(event.getType().getName()); fWriter.write('\t'); fWriter.write(event.getReference()); fWriter.write('\t'); ITmfEventField content = event.getContent(); printValue(content.getValue()); } fWriter.write('\n'); } } catch (IOException ex) { fIOException = ex; fail(); } }
Source:
<code>protected Quip doTargetableComplimentRequest(VoiceInput voiceInput, ServiceOutput serviceOutput) throws DerpwizardException { QuipMetadata outputMetadata = (QuipMetadata) serviceOutput.getMetadata(); Map<String,String> messageMap = voiceInput.getMessageAsMap(); if(!messageMap.containsKey("target") || StringUtils.isEmpty(messageMap.get("target"))){ return doComplimentRequest(voiceInput, serviceOutput); } String target = messageMap.get("target"); if(target.toLowerCase().equals("me")){ return doComplimentRequest(voiceInput, serviceOutput); } target = target.substring(0,1).toUpperCase()+target.substring(1); Queue<String> complimentsUsed = outputMetadata.getComplimentsUsed(); Quip quip = getRandomTargetableQuip(QuipType.COMPLIMENT, complimentsUsed, target); String plaintext = quip.getText(); String ssml = quip.getSsml(); if(quip.isTargetable()){ plaintext = quip.getTargetableText(); ssml = quip.getTargetableSsml(); } serviceOutput.getVisualOutput().setTitle("CompliBot compliment"); serviceOutput.getVisualOutput().setText(plaintext); serviceOutput.getVoiceOutput().setPlaintext(plaintext); serviceOutput.getVoiceOutput().setSsmltext(ssml); if(handholdMode){ serviceOutput.getDelayedVoiceOutput().setPlaintext(COMPLIBOT_QUIP_FOLLOW_UP); <START> serviceOutput.getDelayedVoiceOutput().setSsmltext("<p> " + COMPLIBOT_QUIP_FOLLOW_UP + " </p>"); <END> } return quip; }</code><technical_language>need wrap paragraph sentence tags anymore</technical_language>

Target:
protected Quip doTargetableComplimentRequest(VoiceInput voiceInput, ServiceOutput serviceOutput) throws DerpwizardException { QuipMetadata outputMetadata = (QuipMetadata) serviceOutput.getMetadata(); Map<String,String> messageMap = voiceInput.getMessageAsMap(); if(!messageMap.containsKey("target") || StringUtils.isEmpty(messageMap.get("target"))){ return doComplimentRequest(voiceInput, serviceOutput); } String target = messageMap.get("target"); if(target.toLowerCase().equals("me")){ return doComplimentRequest(voiceInput, serviceOutput); } target = target.substring(0,1).toUpperCase()+target.substring(1); Queue<String> complimentsUsed = outputMetadata.getComplimentsUsed(); Quip quip = getRandomTargetableQuip(QuipType.COMPLIMENT, complimentsUsed, target); String plaintext = quip.getText(); String ssml = quip.getSsml(); if(quip.isTargetable()){ plaintext = quip.getTargetableText(); ssml = quip.getTargetableSsml(); } serviceOutput.getVisualOutput().setTitle("CompliBot compliment"); serviceOutput.getVisualOutput().setText(plaintext); serviceOutput.getVoiceOutput().setPlaintext(plaintext); serviceOutput.getVoiceOutput().setSsmltext(ssml); if(handholdMode){ serviceOutput.getDelayedVoiceOutput().setPlaintext(COMPLIBOT_QUIP_FOLLOW_UP); serviceOutput.getDelayedVoiceOutput().setSsmltext(COMPLIBOT_QUIP_FOLLOW_UP); } return quip; }
Source:
<code>protected Object handleRequestMessage(Message<?> requestMessage) { MessageHeaders requestMessageHeaders = requestMessage.getHeaders(); PollableChannel gatherResultChannel = new QueueChannel(); Message<?> scatterMessage = getMessageBuilderFactory() .fromMessage(requestMessage) .setHeader(GATHER_RESULT_CHANNEL, gatherResultChannel) .setHeader(ORIGINAL_REPLY_CHANNEL, requestMessageHeaders.getReplyChannel()) .setHeader(ORIGINAL_ERROR_CHANNEL, requestMessageHeaders.getErrorChannel()) .setReplyChannel(this.gatherChannel) .setErrorChannelName(this.errorChannelName) .build(); this.messagingTemplate.send(this.scatterChannel, scatterMessage); Message<?> gatherResult = gatherResultChannel.receive(this.gatherTimeout); <START> if (gatherResult != null && (requestMessageHeaders.containsKey(ORIGINAL_REPLY_CHANNEL) <END> || requestMessageHeaders.containsKey(ORIGINAL_ERROR_CHANNEL) || requestMessageHeaders.containsKey(GATHER_RESULT_CHANNEL))) { return getMessageBuilderFactory() .fromMessage(gatherResult) .removeHeader(GATHER_RESULT_CHANNEL) .setHeader(GATHER_RESULT_CHANNEL, requestMessageHeaders.get(GATHER_RESULT_CHANNEL)) .setHeader(ORIGINAL_REPLY_CHANNEL, requestMessageHeaders.get(ORIGINAL_REPLY_CHANNEL)) .setHeader(ORIGINAL_ERROR_CHANNEL, requestMessageHeaders.get(ORIGINAL_ERROR_CHANNEL)) .setHeader(MessageHeaders.REPLY_CHANNEL, requestMessage.getHeaders().getReplyChannel()) .build(); } return gatherResult; }</code><technical_language>I fix is simpler: if (gatherResult != null) { return gatherResult.getPayload(); } AbstractReplyProducingMessageHandler super class care proper request message headers copying. I logic is fully happen default. So, problem return fro this handleRequestMessage() message some headers. headers overridden in super class</technical_language>

Target:
protected Object handleRequestMessage(Message<?> requestMessage) { MessageHeaders requestMessageHeaders = requestMessage.getHeaders(); PollableChannel gatherResultChannel = new QueueChannel(); Message<?> scatterMessage = getMessageBuilderFactory() .fromMessage(requestMessage) .setHeader(GATHER_RESULT_CHANNEL, gatherResultChannel) .setHeader(ORIGINAL_ERROR_CHANNEL, requestMessageHeaders.getErrorChannel()) .setReplyChannel(this.gatherChannel) .setErrorChannelName(this.errorChannelName) .build(); this.messagingTemplate.send(this.scatterChannel, scatterMessage); Message<?> gatherResult = gatherResultChannel.receive(this.gatherTimeout); if (gatherResult != null) { return getMessageBuilderFactory() .fromMessage(gatherResult) .setHeader(GATHER_RESULT_CHANNEL, requestMessageHeaders.get(GATHER_RESULT_CHANNEL)) .setHeader(ORIGINAL_ERROR_CHANNEL, requestMessageHeaders.get(ORIGINAL_ERROR_CHANNEL)) .setHeader(MessageHeaders.REPLY_CHANNEL, requestMessage.getHeaders().getReplyChannel()) .setHeader(MessageHeaders.ERROR_CHANNEL, requestMessage.getHeaders().getErrorChannel()) .build(); } return gatherResult; }
Source:
<code>public TemplateBundle(Bundle bundle, List<ServiceReference<Object>> services) { this.bundle = bundle; <START> this.initServices = services; <END> init(); }</code><technical_language>need initial services in a field? pass a parameter in init() method? I get literally copy Kotlin init behavior, in Java this init a part of ctor</technical_language>

Target:
public TemplateBundle(Bundle bundle, List<ServiceReference<Object>> services) { if(bundle == null){ throw new NullArgumentException("bundle"); } this.bundle = bundle; init(services); }
Source:
<code>public void setUp() { <START> manager = new TaskRepositoryManager(); <END> manager.addRepository(actualFixture.repository()); connector = new BugzillaRestConnector(); }</code><technical_language>Do need this? used</technical_language>

Target:
public void setUp() { connector = new BugzillaRestConnector(); }
Source:
<code>public CompositeDescriptorProvider(List<DescriptorProvider> delegates) { this.delegates = delegates; serverChecker = new ServerChecker(); <START> serverCheckerThread = new Thread(serverChecker); <END> serverCheckerThread.start(); }</code><technical_language>thread a daemon thread, give a name is easy identify investigating thread dumps</technical_language>

Target:
public CompositeDescriptorProvider(List<DescriptorProvider> delegates) { this.delegates = delegates; serverChecker = new ServerChecker(); serverCheckerThread = new Thread(serverChecker); serverCheckerThread.setDaemon(true); serverCheckerThread.setName("ServerChecker"); serverCheckerThread.start(); }
Source:
<code>private static void addSecondaryLocations(PreciseIssue issue, Expression expression) { Expression unwrappedExpression = Expressions.removeParentheses(expression); if (unwrappedExpression.is(Tree.Kind.CONDITIONAL_EXPR)) { ConditionalExpression conditionalExpression = (ConditionalExpression) unwrappedExpression; ignoreList.add(conditionalExpression); <START> addSecondaryLocations(issue, (conditionalExpression).trueExpression()); <END> addSecondaryLocations(issue, (conditionalExpression).falseExpression()); } else { issue.secondary(unwrappedExpression, null); } }</code><technical_language>I parenthesis conditionalExpression necessary</technical_language>

Target:
private static void addSecondaryLocations(PreciseIssue issue, Expression expression) { Expression unwrappedExpression = Expressions.removeParentheses(expression); if (unwrappedExpression.is(Tree.Kind.CONDITIONAL_EXPR)) { ConditionalExpression conditionalExpression = (ConditionalExpression) unwrappedExpression; ignoreList.add(conditionalExpression); addSecondaryLocations(issue, conditionalExpression.trueExpression()); addSecondaryLocations(issue, conditionalExpression.falseExpression()); } else { issue.secondary(unwrappedExpression, null); } }
Source:
<code>public Object getResult() throws Exception { try { final Unmarshaller unmarshaller = MethodInvocationResponseHandler.this.prepareForUnMarshalling(MethodInvocationResponseHandler.this.marshallerFactory, this.input); final Object result = unmarshaller.readObject(); final Map<String, Object> attachments = MethodInvocationResponseHandler.this.readAttachments(unmarshaller); <START> for(Map.Entry<String,Object> entry : attachments.entrySet()) <END> this.clientInvocationContext.getContextData().put(entry.getKey(), entry.getValue()); unmarshaller.finish(); if (this.clientInvocationContext != null && attachments != null && attachments.containsKey(Affinity.WEAK_AFFINITY_CONTEXT_KEY)) { final Affinity weakAffinity = (Affinity) attachments.get(Affinity.WEAK_AFFINITY_CONTEXT_KEY); this.clientInvocationContext.putAttachment(AttachmentKeys.WEAK_AFFINITY, weakAffinity); } return result; } finally { this.input.close(); } }</code><technical_language>Needs a null check attachments (failing CI)</technical_language>

Target:
public Object getResult() throws Exception { try { final Unmarshaller unmarshaller = MethodInvocationResponseHandler.this.prepareForUnMarshalling(MethodInvocationResponseHandler.this.marshallerFactory, this.input); final Object result = unmarshaller.readObject(); final Map<String, Object> attachments = MethodInvocationResponseHandler.this.readAttachments(unmarshaller); if(attachments != null) { for(Map.Entry<String,Object> entry : attachments.entrySet()) this.clientInvocationContext.getContextData().put(entry.getKey(), entry.getValue()); } unmarshaller.finish(); if (this.clientInvocationContext != null && attachments != null && attachments.containsKey(Affinity.WEAK_AFFINITY_CONTEXT_KEY)) { final Affinity weakAffinity = (Affinity) attachments.get(Affinity.WEAK_AFFINITY_CONTEXT_KEY); this.clientInvocationContext.putAttachment(AttachmentKeys.WEAK_AFFINITY, weakAffinity); } return result; } finally { this.input.close(); } }
Source:
<code>public void onError(Throwable t) { Status s = Status.fromThrowable(t); String statusDesc = s == null ? "" : s.getDescription(); if (t.getClass() == StatusException.class || t.getClass() == StatusRuntimeException.class) { Code code = t.getClass() == StatusException.class ? ((StatusException) t).getStatus().getCode() : ((StatusRuntimeException) t).getStatus().getCode(); <START> if (code == Code.DEADLINE_EXCEEDED <END> || code == Code.RESOURCE_EXHAUSTED || code == Code.INTERNAL || code == Code.UNAVAILABLE) { transientError = t; } } if (transientError == null) { nonTransientError = new Throwable( String.format( "Caught exception for '%s', while uploading to uploadId %s at writeOffset %d." + " Status: %s", resourceId, uploadId, writeOffset, statusDesc), t); } done.countDown(); }</code><technical_language>Create a HashSet of transient error codes check if code is in this set instead of || statements</technical_language>

Target:
public void onError(Throwable t) { Status s = Status.fromThrowable(t); String statusDesc = s == null ? "" : s.getDescription(); if (t.getClass() == StatusException.class || t.getClass() == StatusRuntimeException.class) { Code code = t.getClass() == StatusException.class ? ((StatusException) t).getStatus().getCode() : ((StatusRuntimeException) t).getStatus().getCode(); if (TRANSIENT_ERRORS.contains(code)) { transientError = t; objectFinalized = false; } } if (transientError == null) { nonTransientError = new IOException( String.format( "Caught exception for '%s', while uploading to uploadId %s at writeOffset %d." + " Status: %s", resourceId, uploadId, writeOffset, statusDesc), t); objectFinalized = true; } done.countDown(); }
Source:
<code>public void testExistingIncorrectChildrenInConfigFile() throws Exception { exit.expectSystemExitWithStatus(-2); exit.checkAssertionAfterwards(() -> { final LocalizedMessage errorCounterMessage = new LocalizedMessage(0, Definitions.CHECKSTYLE_BUNDLE, ERROR_COUNTER_MESSAGE, <START> new String[] {String.valueOf(1)}, null, getClass(), null); <END> final String output = String.format(Locale.ROOT, errorCounterMessage.getMessage() + "%n"); assertEquals(output, systemOut.getLog()); final String errorOutput = "com.puppycrawl.tools.checkstyle.api." + "CheckstyleException: cannot initialize module RegexpSingleline" + " - RegexpSingleline is not allowed as a child in RegexpSingleline"; assertTrue(systemErr.getLog().startsWith(errorOutput)); }); Main.main("-c", getPath("config-incorrectChildren.xml"), getPath("InputMain.java")); }</code><technical_language>please move this variable class field in cases. 7 of</technical_language>

Target:
public void testExistingIncorrectChildrenInConfigFile() throws Exception { exit.expectSystemExitWithStatus(-2); exit.checkAssertionAfterwards(() -> { final String output = errorCounterOneMessage.getMessage() + EOL; assertEquals(output, systemOut.getLog()); final String errorOutput = "com.puppycrawl.tools.checkstyle.api." + "CheckstyleException: cannot initialize module RegexpSingleline" + " - RegexpSingleline is not allowed as a child in RegexpSingleline"; assertTrue(systemErr.getLog().startsWith(errorOutput)); }); Main.main("-c", getPath("config-incorrectChildren.xml"), getPath("InputMain.java")); }
Source:
<code>public void notifyAboutStartProcess(String id) { Long processInstanceId = Long.parseLong(id); newProcessInstanceEvent.fire(new NewProcessInstanceEvent(serverTemplateId, deploymentId, processInstanceId, processDefId, processName, <START> 1)); <END> final String message = Constants.INSTANCE.ProcessStarted(processInstanceId.longValue()); notificationEvent.fire(new NotificationEvent(message, NotificationEvent.NotificationType.SUCCESS)); close(); }</code><technical_language>pass null in for status, I refactored similar code, status part of event</technical_language>

Target:
public void notifyAboutStartProcess(String id) { Long processInstanceId = Long.parseLong(id); newProcessInstanceEvent.fire(new NewProcessInstanceEvent(serverTemplateId, deploymentId, processInstanceId, processDefId, processName, null)); final String message = Constants.INSTANCE.ProcessStarted(processInstanceId.longValue()); notificationEvent.fire(new NotificationEvent(message, NotificationEvent.NotificationType.SUCCESS)); close(); }
Source:
<code>public static void commitHeaders(BuiltResponse jaxrsResponse, HttpResponse response) { if (jaxrsResponse.getMetadata() != null) { List<Object> cookies = jaxrsResponse.getMetadata().get( HttpHeaderNames.SET_COOKIE); if (cookies != null) { Iterator<Object> it = cookies.iterator(); while (it.hasNext()) { Object next = it.next(); if (next instanceof NewCookie) { NewCookie cookie = (NewCookie) next; response.addNewCookie(cookie); it.remove(); } <START> else if (next instanceof Object) <END> { response.getOutputHeaders().add(javax.ws.rs.core.HttpHeaders.SET_COOKIE, next); it.remove(); } } jaxrsResponse.getMetadata().remove(HttpHeaderNames.SET_COOKIE); } } if (jaxrsResponse.getMetadata() != null && jaxrsResponse.getMetadata().size() > 0) { response.getOutputHeaders().putAll(jaxrsResponse.getMetadata()); } }</code><technical_language>next instance Object true right</technical_language>

Target:
public static void commitHeaders(BuiltResponse jaxrsResponse, HttpResponse response) { if (jaxrsResponse.getMetadata() != null) { List<Object> cookies = jaxrsResponse.getMetadata().get( HttpHeaderNames.SET_COOKIE); if (cookies != null) { Iterator<Object> it = cookies.iterator(); while (it.hasNext()) { Object next = it.next(); if (next instanceof NewCookie) { NewCookie cookie = (NewCookie) next; response.addNewCookie(cookie); it.remove(); } else { response.getOutputHeaders().add(javax.ws.rs.core.HttpHeaders.SET_COOKIE, next); it.remove(); } } jaxrsResponse.getMetadata().remove(HttpHeaderNames.SET_COOKIE); } } if (jaxrsResponse.getMetadata() != null && jaxrsResponse.getMetadata().size() > 0) { response.getOutputHeaders().putAll(jaxrsResponse.getMetadata()); } }
Source:
<code>protected boolean checkUserNameValid(String userName) throws UserStoreException { if (!isSecureCall.get()) { Class argTypes[] = new Class[]{String.class}; Object object = callSecure("checkUserNameValid", new Object[]{userName}, argTypes); return (Boolean) object; } if (userName == null || CarbonConstants.REGISTRY_SYSTEM_USERNAME.equals(userName)) { return false; } userName = userName.trim(); if (userName.length() < 1) { return false; } String regularExpression = realmConfig .getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_USER_NAME_JAVA_REG_EX); if (MultitenantUtils.isEmailUserName()) { regularExpression = realmConfig .getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_USER_NAME_WITH_EMAIL_JS_REG_EX); if (regularExpression == null) { regularExpression = UserCoreConstants.RealmConfig.EMAIL_VALIDATION_REGEX; } } if (regularExpression != null) { regularExpression = regularExpression.trim(); } <START> if (regularExpression != null && !regularExpression.equals("")) { <END> if (isFormatCorrect(regularExpression, userName)) { return true; } else { if (log.isDebugEnabled()) { log.debug("Username " + userName + " does not match with the regex " + regularExpression); } return false; } } return regularExpression == null || regularExpression.equals(""); }</code><technical_language>StringUtils.isNotEmpty()</technical_language>

Target:
protected boolean checkUserNameValid(String userName) throws UserStoreException { if (!isSecureCall.get()) { Class argTypes[] = new Class[]{String.class}; Object object = callSecure("checkUserNameValid", new Object[]{userName}, argTypes); return (Boolean) object; } if (userName == null || CarbonConstants.REGISTRY_SYSTEM_USERNAME.equals(userName)) { return false; } userName = userName.trim(); if (userName.length() < 1) { return false; } String regularExpression = realmConfig .getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_USER_NAME_JAVA_REG_EX); if (MultitenantUtils.isEmailUserName()) { regularExpression = realmConfig .getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_USER_NAME_WITH_EMAIL_JS_REG_EX); if (regularExpression == null) { regularExpression = UserCoreConstants.RealmConfig.EMAIL_VALIDATION_REGEX; } } if (regularExpression != null) { regularExpression = regularExpression.trim(); } if (StringUtils.isNotEmpty(regularExpression)) { if (isFormatCorrect(regularExpression, userName)) { return true; } else { if (log.isDebugEnabled()) { log.debug("Username " + userName + " does not match with the regex " + regularExpression); } return false; } } return true; }
Source:
<code>private void handlePutManagerClosed(BlobProperties blobProperties, boolean stitchOperation, FutureResult<String> futureResult, Callback<String> callback) { RouterException routerException = new RouterException("Cannot accept operation because Router is closed", RouterErrorCode.RouterClosed); routerMetrics.operationDequeuingRate.mark(); <START> routerMetrics.onPutBlobError(routerException, blobProperties != null && blobProperties.isEncrypted(), <END> stitchOperation); completeOperation(futureResult, callback, null, routerException); close(); }</code><technical_language>blobProperties != null removed, checked in callers</technical_language>

Target:
private void handlePutManagerClosed(BlobProperties blobProperties, boolean stitchOperation, FutureResult<String> futureResult, Callback<String> callback) { RouterException routerException = new RouterException("Cannot accept operation because Router is closed", RouterErrorCode.RouterClosed); routerMetrics.operationDequeuingRate.mark(); routerMetrics.onPutBlobError(routerException, blobProperties.isEncrypted(), stitchOperation); completeOperation(futureResult, callback, null, routerException); close(); }