auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void validateCustomProperties() { String version = vds.getVdsGroupCompatibilityVersion().getValue(); SimpleCustomPropertiesUtil util = SimpleCustomPropertiesUtil.getInstance(); Map<String, String> validProperties = util.convertProperties(Config.<String> getValue(ConfigValues.PreDefinedNetworkCustomProperties, version)); validProperties.putAll(util.convertProperties(Config.<String> getValue(ConfigValues.UserDefinedNetworkCustomProperties, version))); Map<String, String> validPropertiesNonVm = new HashMap<String, String>(validProperties); validPropertiesNonVm.remove("bridge_opts"); for (VdsNetworkInterface iface : params.getInterfaces()) { String networkName = iface.getNetworkName(); <START> if (iface.hasCustomProperties() && !StringUtils.isEmpty(networkName)) { <END> if (!networkCustomPropertiesSupported) { addViolation(VdcBllMessages.ACTION_TYPE_FAILED_NETWORK_CUSTOM_PROPERTIES_NOT_SUPPORTED, networkName); } Network network = existingClusterNetworks.get(networkName); List<ValidationError> errors = util.validateProperties(network == null || network.isVmNetwork() ? validProperties : validPropertiesNonVm, iface.getCustomProperties()); if (!errors.isEmpty()) { addViolation(VdcBllMessages.ACTION_TYPE_FAILED_NETWORK_CUSTOM_PROPERTIES_BAD_INPUT, networkName); List<String> messages = new ArrayList<>(); util.handleCustomPropertiesError(errors, messages); log.error(StringUtils.join(translateErrorMessages(messages), ',')); } } } }</code><technical_language>StringUtils.isNotEmpty())</technical_language>

Target:
private void validateCustomProperties() { String version = vds.getVdsGroupCompatibilityVersion().getValue(); SimpleCustomPropertiesUtil util = SimpleCustomPropertiesUtil.getInstance(); Map<String, String> validProperties = util.convertProperties(Config.<String> getValue(ConfigValues.PreDefinedNetworkCustomProperties, version)); validProperties.putAll(util.convertProperties(Config.<String> getValue(ConfigValues.UserDefinedNetworkCustomProperties, version))); Map<String, String> validPropertiesNonVm = new HashMap<String, String>(validProperties); validPropertiesNonVm.remove("bridge_opts"); for (VdsNetworkInterface iface : params.getInterfaces()) { String networkName = iface.getNetworkName(); if (iface.hasCustomProperties() && StringUtils.isNotEmpty(networkName)) { if (!networkCustomPropertiesSupported) { addViolation(VdcBllMessages.ACTION_TYPE_FAILED_NETWORK_CUSTOM_PROPERTIES_NOT_SUPPORTED, networkName); } Network network = existingClusterNetworks.get(networkName); List<ValidationError> errors = util.validateProperties(network == null || network.isVmNetwork() ? validProperties : validPropertiesNonVm, iface.getCustomProperties()); if (!errors.isEmpty()) { addViolation(VdcBllMessages.ACTION_TYPE_FAILED_NETWORK_CUSTOM_PROPERTIES_BAD_INPUT, networkName); List<String> messages = new ArrayList<>(); util.handleCustomPropertiesError(errors, messages); log.error(StringUtils.join(translateErrorMessages(messages), ',')); } } } }
Source:
<code>public void addSong(PlaylistEntry entry) { <START> if (isLocalPlayer) { <END> mPlaylist.add(entry); if (isLocalPlayer) { mDataManager.addToLoadQueue(entry); } new LocalBroadcastIntent(ACTION_SONG_ADDED) .putExtra(EXTRA_SONG, entry) .send(this); new LocalBroadcastIntent(ACTION_PLAYLIST_UPDATED).send(this); getMessagingService().sendPlaylistMessage(mPlaylist.getSongsToPlay()); } else { getMessagingService().sendAddToPlaylistMessage(entry); } }</code><technical_language>I dont this is right. if isLocalPlayer a check for isLocalPlayer</technical_language>

Target:
public void addSong(PlaylistEntry entry) { entry.setEntryId(++lastEntryId); mPlaylist.add(entry); if (isLocalPlayer) { mDataManager.addToLoadQueue(entry); new LocalBroadcastIntent(ACTION_SONG_ADDED).putExtra(EXTRA_SONG, entry).send(this); new LocalBroadcastIntent(ACTION_PLAYLIST_UPDATED).send(this); getMessagingService().sendPlaylistMessage( mPlaylist.getSongsToPlay()); } else { getMessagingService().sendAddToPlaylistMessage(entry); } }
Source:
<code>public void MercurySEOTest_002_MetaTags_Robots_SectionToMainPage() { SEOUtils seoUtils = new SEOUtils(driver); wikiURL = urlBuilder.getUrlForWiki(MercuryWikis.MERCURY_CC); CuratedContentPageObject section = new CuratedContentPageObject(driver); section.openCuratedContentPage(wikiURL, MercurySubpages.CC_SECTION_CATEGORIES); <START> Assertion.assertTrue(seoUtils.isRobots(ROBOTS_TAG_ATTRIBUTES_NOINDEX)); <END> section.clickOnMainPageLink(); Assertion.assertTrue(seoUtils.isRobots(ROBOTS_TAG_ATTRIBUTES_INDEX)); }</code><technical_language>change method name isRobots isValuePresentInRobotsMetaTags</technical_language>

Target:
public void MercurySEOTest_002_MetaTags_Robots_SectionToMainPage() { SEOUtils seoUtils = new SEOUtils(driver); wikiURL = urlBuilder.getUrlForWiki(MercuryWikis.MERCURY_CC); CuratedContentPageObject section = new CuratedContentPageObject(driver); section.openCuratedContentPage(wikiURL, MercurySubpages.CC_SECTION_CATEGORIES); Assertion.assertTrue(seoUtils.isRobotsMetaTagSet(), ROBOTS_META_TAG_NOT_PRESENT_MESSAGE); Assertion.assertTrue(seoUtils.isAttributesListPresentInRobotsMetaTag( ROBOTS_TAG_ATTRIBUTES_NOINDEX_FOLLOW), ROBOTS_META_TAG_DIFFERENT_MESSAGE); section.clickOnMainPageLink(); Assertion.assertFalse(seoUtils.isRobotsMetaTagSet(), ROBOTS_META_TAG_PRESENT_MESSAGE); }
Source:
<code><START> public void setUp() { <END> RulesDefinition rulesDefinition = new AemRulesRulesDefinition(); RulesDefinition.Context context = new RulesDefinition.Context(); rulesDefinition.define(context); RulesDefinition.Repository htlRepository = context.repository(HtlCheckClasses.REPOSITORY_KEY); List<NewActiveRule> ar = new ArrayList<>(); for (RulesDefinition.Rule rule : htlRepository.rules()) { ar.add(new ActiveRulesBuilder().create(RuleKey.of(HtlCheckClasses.REPOSITORY_KEY, rule.key()))); } ActiveRules activeRules = new DefaultActiveRules(ar); CheckFactory checkFactory = new CheckFactory(activeRules); FileLinesContextFactory fileLinesContextFactory = mock(FileLinesContextFactory.class); when(fileLinesContextFactory.createFor(Mockito.any(InputFile.class))).thenReturn(mock(FileLinesContext.class)); Configuration configuration = mock(Configuration.class); when(configuration.getStringArray(Constants.FILE_EXTENSIONS_PROP_KEY)).thenReturn(Constants.FILE_EXTENSIONS_DEF_VALUE.split(",")); when(configuration.getStringArray(Constants.HTL_FILES_RELATIVE_PATHS_KEY)).thenReturn(new String[]{}); sensor = new HtlSensor(fileLinesContextFactory, configuration, checkFactory); tester = SensorContextTester.create(TEST_DIR); }</code><technical_language>This method is long divide smaller methods</technical_language>

Target:
public void setUp() { RulesDefinition rulesDefinition = new AemRulesRulesDefinition(); RulesDefinition.Context context = new RulesDefinition.Context(); rulesDefinition.define(context); RulesDefinition.Repository htlRepository = context.repository(HtlCheckClasses.REPOSITORY_KEY); FileLinesContextFactory fileLinesContextFactory = getMockedFileLinesContextFactory(); Configuration configuration = getMockedConfiguration(); CheckFactory checkFactory = getCheckFactory(htlRepository); sensor = new HtlSensor(fileLinesContextFactory, configuration, checkFactory); tester = SensorContextTester.create(TEST_DIR); }
Source:
<code>public void testJSON() throws Exception { PartitionByPlanNode pn = new PartitionByPlanNode(); addPartitionByExpressions(pn); addSortExpressions(pn); JSONStringer stringer = new JSONStringer(); stringer.object(); try { pn.toJSONString(stringer); stringer.endObject(); <START> } catch (Exception ex) { <END> ex.printStackTrace(); assertTrue(false); } String json = stringer.toString(); JSONObject jobj = new JSONObject(new JSONTokener(json)); PartitionByPlanNode pn2 = new PartitionByPlanNode(); pn2.loadFromJSONObject(jobj, m_voltdb.getDatabase()); assertEquals(pn.numberSortExpressions(), pn2.numberSortExpressions()); for (int idx = 0; idx < pn2.numberSortExpressions(); idx += 1) { assertEquals(pn2.getSortExpression(idx), pn.getSortExpression(idx)); assertEquals(pn2.getSortDirection(idx), pn.getSortDirection(idx)); } assertEquals(SortDirectionType.ASC, pn.getSortDirection(0)); assertEquals(SortDirectionType.DESC, pn.getSortDirection(1)); assertEquals(VoltType.FLOAT, pn.getSortExpression(0).getValueType()); assertEquals(8, pn.getSortExpression(0).getValueSize()); assertEquals(ExpressionType.VALUE_TUPLE, pn.getSortExpression(0).getExpressionType()); assertEquals(VoltType.INTEGER, pn.getSortExpression(1).getValueType()); assertEquals(4, pn.getSortExpression(1).getValueSize()); assertEquals(ExpressionType.VALUE_TUPLE, pn.getSortExpression(1).getExpressionType()); }</code><technical_language>yet, fyi, (after hearing Chris out) I prefer close-brace-on-its-own-line else, catch, finally, a (do's) while. This in spite of similar diff effects</technical_language>

Target:
public void testJSON() throws Exception { PartitionByPlanNode pn = new PartitionByPlanNode(); addPartitionByExpressions(pn); addSortExpressions(pn); JSONStringer stringer = new JSONStringer(); stringer.object(); try { pn.toJSONString(stringer); stringer.endObject(); } catch (Exception ex) { ex.printStackTrace(); fail(); } String json = stringer.toString(); JSONObject jobj = new JSONObject(new JSONTokener(json)); PartitionByPlanNode pn2 = new PartitionByPlanNode(); pn2.loadFromJSONObject(jobj, m_voltdb.getDatabase()); assertEquals(pn.numberSortExpressions(), pn2.numberSortExpressions()); for (int idx = 0; idx < pn2.numberSortExpressions(); idx += 1) { assertEquals(pn2.getSortExpression(idx), pn.getSortExpression(idx)); assertEquals(pn2.getSortDirection(idx), pn.getSortDirection(idx)); } assertEquals(SortDirectionType.ASC, pn.getSortDirection(0)); assertEquals(SortDirectionType.DESC, pn.getSortDirection(1)); assertEquals(VoltType.FLOAT, pn.getSortExpression(0).getValueType()); assertEquals(8, pn.getSortExpression(0).getValueSize()); assertEquals(ExpressionType.VALUE_TUPLE, pn.getSortExpression(0).getExpressionType()); assertEquals(VoltType.INTEGER, pn.getSortExpression(1).getValueType()); assertEquals(4, pn.getSortExpression(1).getValueSize()); assertEquals(ExpressionType.VALUE_TUPLE, pn.getSortExpression(1).getExpressionType()); }
Source:
<code>WalkFetchConnection(final WalkTransport t, final WalkRemoteObjectDatabase w) { Transport wt = (Transport)t; local = wt.local; objCheck = wt.getObjectChecker(); inserter = local.newObjectInserter(); reader = local.newObjectReader(); remotes = new ArrayList<WalkRemoteObjectDatabase>(); remotes.add(w); unfetchedPacks = new LinkedList<RemotePack>(); packsConsidered = new HashSet<String>(); noPacksYet = new LinkedList<WalkRemoteObjectDatabase>(); noPacksYet.add(w); noAlternatesYet = new LinkedList<WalkRemoteObjectDatabase>(); noAlternatesYet.add(w); fetchErrors = new HashMap<ObjectId, List<Throwable>>(); packLocks = new ArrayList<PackLock>(4); revWalk = new RevWalk(reader); revWalk.setRetainBody(false); <START> treeWalk = new TreeWalk(local, reader); <END> COMPLETE = revWalk.newFlag("COMPLETE"); IN_WORK_QUEUE = revWalk.newFlag("IN_WORK_QUEUE"); LOCALLY_SEEN = revWalk.newFlag("LOCALLY_SEEN"); localCommitQueue = new DateRevQueue(); workQueue = new LinkedList<ObjectId>(); }</code><technical_language>Attribute handling git transports? Is this required</technical_language>

Target:
WalkFetchConnection(final WalkTransport t, final WalkRemoteObjectDatabase w) { Transport wt = (Transport)t; local = wt.local; objCheck = wt.getObjectChecker(); inserter = local.newObjectInserter(); reader = local.newObjectReader(); remotes = new ArrayList<WalkRemoteObjectDatabase>(); remotes.add(w); unfetchedPacks = new LinkedList<RemotePack>(); packsConsidered = new HashSet<String>(); noPacksYet = new LinkedList<WalkRemoteObjectDatabase>(); noPacksYet.add(w); noAlternatesYet = new LinkedList<WalkRemoteObjectDatabase>(); noAlternatesYet.add(w); fetchErrors = new HashMap<ObjectId, List<Throwable>>(); packLocks = new ArrayList<PackLock>(4); revWalk = new RevWalk(reader); revWalk.setRetainBody(false); treeWalk = new TreeWalk(reader); COMPLETE = revWalk.newFlag("COMPLETE"); IN_WORK_QUEUE = revWalk.newFlag("IN_WORK_QUEUE"); LOCALLY_SEEN = revWalk.newFlag("LOCALLY_SEEN"); localCommitQueue = new DateRevQueue(); workQueue = new LinkedList<ObjectId>(); }
Source:
<code>public void start(Stage stage) throws Exception { final VBox pane = new VBox(); pane.setSpacing(30); pane.setStyle("-fx-background-color:#EEE; -fx-padding: 40;"); ToggleButton button = new ToggleButton("JavaFx Toggle"); pane.getChildren().add(button); JFXToggleButton toggleButton = new JFXToggleButton(); toggleButton.setText("New Skin"); pane.getChildren().add(toggleButton); JFXToggleNode node = new JFXToggleNode(); node.setGraphic(new FontIcon(FontAwesomeSolid.HEART)); pane.getChildren().add(node); <START> final Scene scene = new Scene(pane, 600, 400, Color.valueOf("#EEE")); <END> stage.setTitle("JFX Toggle Button Demo "); scene.getStylesheets() .add(ToggleButtonDemo.class.getResource("/css/jfoenix-components.css").toExternalForm()); stage.setScene(scene); stage.setResizable(false); stage.show(); }</code><technical_language>padding :), feel free add PR</technical_language>

Target:
public void start(Stage stage) throws Exception { final VBox pane = new VBox(); pane.setSpacing(30); pane.setStyle("-fx-background-color:#EEE; -fx-padding: 40;"); ToggleButton button = new ToggleButton("JavaFx Toggle"); pane.getChildren().add(button); JFXToggleButton toggleButton = new JFXToggleButton(); toggleButton.setText("New Skin"); pane.getChildren().add(toggleButton); JFXToggleNode node = new JFXToggleNode(); node.setStyle("-fx-padding: 10"); node.setGraphic(new FontIcon(FontAwesomeSolid.HEART)); pane.getChildren().add(node); final Scene scene = new Scene(pane, 600, 400, Color.valueOf("#EEE")); stage.setTitle("JFX Toggle Button Demo "); scene.getStylesheets() .add(ToggleButtonDemo.class.getResource("/css/jfoenix-components.css").toExternalForm()); stage.setScene(scene); stage.setResizable(false); stage.show(); }
Source:
<code>public void onTraversalStart() { final VCFHeader inputHeader = getHeaderForVariants(); <START> final String tumorSample = inputHeader.getMetaDataLine(Mutect2Engine.TUMOR_SAMPLE_KEY_IN_VCF_HEADER).getValue(); <END> final Set<VCFHeaderLine> headerLines = new HashSet<>(inputHeader.getMetaDataInSortedOrder()); Mutect2FilteringEngine.M_2_FILTER_NAMES.stream().map(GATKVCFHeaderLines::getFilterLine).forEach(headerLines::add); headerLines.add(new VCFFilterHeaderLine(Mutect2FilteringEngine.ARTIFACT_IN_NORMAL_FILTER_NAME, "artifact_in_normal")); headerLines.add(new VCFFilterHeaderLine(Mutect2FilteringEngine.CONTAMINATION_FILTER_NAME, "contamination")); final VCFHeader vcfHeader = new VCFHeader(headerLines, inputHeader.getGenotypeSamples()); vcfWriter = createVCFWriter(new File(outputVcf)); vcfWriter.writeHeader(vcfHeader); }</code><technical_language>tumorSample is</technical_language>

Target:
public void onTraversalStart() { final VCFHeader inputHeader = getHeaderForVariants(); final Set<VCFHeaderLine> headerLines = new HashSet<>(inputHeader.getMetaDataInSortedOrder()); Mutect2FilteringEngine.M_2_FILTER_NAMES.stream().map(GATKVCFHeaderLines::getFilterLine).forEach(headerLines::add); headerLines.add(new VCFFilterHeaderLine(Mutect2FilteringEngine.ARTIFACT_IN_NORMAL_FILTER_NAME, "artifact_in_normal")); headerLines.add(new VCFFilterHeaderLine(Mutect2FilteringEngine.CONTAMINATION_FILTER_NAME, "contamination")); final VCFHeader vcfHeader = new VCFHeader(headerLines, inputHeader.getGenotypeSamples()); vcfWriter = createVCFWriter(new File(outputVcf)); vcfWriter.writeHeader(vcfHeader); }
Source:
<code>public ByteBuffer getUserMetadata(BlobId blobId, ClusterMap map, boolean expiredBlobs) throws MessageFormatException, IOException { List<ReplicaId> replicas = blobId.getPartition().getReplicaIds(); ByteBuffer userMetadata = null; for (ReplicaId replicaId : replicas) { try { userMetadata = getUserMetadata(blobId, map, replicaId, expiredBlobs); break; } catch (Exception e) { <START> } <END> } return userMetadata; }</code><technical_language>Exception message stack trace</technical_language>

Target:
public ByteBuffer getUserMetadata(BlobId blobId, ClusterMap map, boolean expiredBlobs) throws MessageFormatException, IOException { List<ReplicaId> replicas = blobId.getPartition().getReplicaIds(); ByteBuffer userMetadata = null; for (ReplicaId replicaId : replicas) { try { userMetadata = getUserMetadata(blobId, map, replicaId, expiredBlobs); break; } catch (Exception e) { System.out.println("Get user metadata error "); e.printStackTrace(); } } return userMetadata; }
Source:
<code>public Builder setStrokeDashArray(final String strokeDashArray) { String[] tempStrokeDashArray = strokeDashArray.split(","); <START> int i = 0; <END> this.strokeDashArray = new Double[tempStrokeDashArray.length]; while (i < tempStrokeDashArray.length) { this.strokeDashArray[i] = Double.valueOf(tempStrokeDashArray[i].trim()); i++; } return this; }</code><technical_language>@alepintus , this replaced by: Double[] doubles = Stream.of(tempStrokeDashArray) .map(Double::valueOf) .toArray(Double[]::new);</technical_language>

Target:
public Builder setStrokeDashArray(final String strokeDashArray) { String[] tempStrokeDashArray = strokeDashArray.split(","); this.strokeDashArray = Stream.of(tempStrokeDashArray).map(Double::valueOf).toArray(Double[]::new); return this; }
Source:
<code>protected SecondaryToolbar createSecondaryToolbar() { SecondaryToolbar replaceToolbar = new SecondaryToolbar("Replace"); replaceMode_ = true; replaceTextBox_ = new TextBox(); replaceTextBox_.addKeyUpHandler(new KeyUpHandler() { public void onKeyUp(KeyUpEvent event) { displayPreview_.nudge(); } }); FormLabel replaceLabel = new FormLabel("Replace with: ", replaceTextBox_); replaceToolbar.addLeftWidget(replaceLabel); replaceToolbar.addLeftWidget(replaceTextBox_); <START> Roles.getButtonRole().setAriaLabelProperty(replaceTextBox_.getElement(), "Replace with"); <END> stopReplace_ = new ToolbarButton( ToolbarButton.NoText, "Stop replace", commands_.interruptR().getImageResource()); stopReplace_.setVisible(false); replaceToolbar.addRightWidget(stopReplace_); replaceAllButton_ = new ToolbarButton("Replace All", "Replace All", null); replaceToolbar.addRightWidget(replaceAllButton_); replaceProgress_ = new ProgressBar(); replaceProgress_.setHeight("10px"); replaceProgress_.setWidth("195px"); replaceProgress_.setVisible(false); replaceToolbar.addLeftWidget(replaceProgress_); return replaceToolbar; }</code><technical_language>this added? replaceTextBox_ accessible label FormLabel replaceLabel</technical_language>

Target:
protected SecondaryToolbar createSecondaryToolbar() { SecondaryToolbar replaceToolbar = new SecondaryToolbar("Replace"); replaceMode_ = true; replaceTextBox_ = new TextBox(); replaceTextBox_.addKeyUpHandler(new KeyUpHandler() { public void onKeyUp(KeyUpEvent event) { displayPreview_.nudge(); } }); FormLabel replaceLabel = new FormLabel("Replace with: ", replaceTextBox_); replaceToolbar.addLeftWidget(replaceLabel); replaceToolbar.addLeftWidget(replaceTextBox_); stopReplace_ = new ToolbarButton( ToolbarButton.NoText, "Stop replace", commands_.interruptR().getImageResource()); stopReplace_.setVisible(false); replaceToolbar.addRightWidget(stopReplace_); replaceAllButton_ = new ToolbarButton("Replace All", "Replace All", null); replaceToolbar.addRightWidget(replaceAllButton_); replaceProgress_ = new ProgressBar(); replaceProgress_.setHeight("10px"); replaceProgress_.setWidth("195px"); replaceProgress_.setVisible(false); replaceToolbar.addLeftWidget(replaceProgress_); return replaceToolbar; }
Source:
<code>public float readFloat() { try { gatherElementDataFromStreams(valueByteBuffer); <START> int b1 = valueByteBuffer[0] & 0xFF; <END> int b2 = valueByteBuffer[1] & 0xFF; int b3 = valueByteBuffer[2] & 0xFF; int b4 = valueByteBuffer[3] & 0xFF; int value = b1 | (b2 << 8) | (b3 << 16) | (b4 << 24); return Float.intBitsToFloat(value); } catch (IOException | ArrayIndexOutOfBoundsException ex) { throw new ParquetDecodingException("Could not read float."); } }</code><technical_language>name 0, b0, b1, b2, b3 matches index of array</technical_language>

Target:
public float readFloat() { gatherElementDataFromStreams(valueByteBuffer); return Float.intBitsToFloat(BytesUtils.bytesToInt(valueByteBuffer)); }
Source:
<code>protected CacheConfiguration<?, ?> getCacheDefinitionFrom(String resourcePath, String cacheName) throws SAXException, JAXBException, ParserConfigurationException, IOException, ClassNotFoundException { final URL resource = this.getClass().getResource(resourcePath); ConfigurationParser rootParser = new ConfigurationParser(resource.toExternalForm()); <START> CacheDefinition cacheDefinition = StreamSupport.stream(rootParser.getCacheElements().spliterator(), true) <END> .filter(def -> def.id().equals(cacheName)).findAny().get(); return parser.parseServiceConfiguration(cacheDefinition, classLoader, cacheConfigurationBuilder).build(); }</code><technical_language>parallel stream</technical_language>

Target:
protected CacheConfiguration<?, ?> getCacheDefinitionFrom(String resourcePath, String cacheName) throws SAXException, JAXBException, ParserConfigurationException, IOException, ClassNotFoundException { final URL resource = this.getClass().getResource(resourcePath); ConfigurationParser rootParser = new ConfigurationParser(resource.toExternalForm()); CacheDefinition cacheDefinition = StreamSupport.stream(rootParser.getCacheElements().spliterator(), false) .filter(def -> def.id().equals(cacheName)).findAny().get(); return parser.parseServiceConfiguration(cacheDefinition, classLoader, cacheConfigurationBuilder).build(); }
Source:
<code>public static InetAddress getCurrentIp() { int bestScore = -1; InetAddress bestAddr = null; try { Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces(); while (networkInterfaces.hasMoreElements()) { NetworkInterface iface = (NetworkInterface) networkInterfaces.nextElement(); Enumeration<InetAddress> addrs = iface.getInetAddresses(); while (addrs.hasMoreElements()) { InetAddress addr = (InetAddress) addrs.nextElement(); int score = scoreAddr(iface, addr); if (score >= bestScore) { bestScore = score; bestAddr = addr; } } } } catch (IOException e) { <START> ; <END> } return bestAddr; }</code><technical_language>log exception</technical_language>

Target:
public static InetAddress getCurrentIp() { int bestScore = -1; InetAddress bestAddr = null; try { Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces(); while (networkInterfaces.hasMoreElements()) { NetworkInterface iface = (NetworkInterface) networkInterfaces.nextElement(); Enumeration<InetAddress> addrs = iface.getInetAddresses(); while (addrs.hasMoreElements()) { InetAddress addr = (InetAddress) addrs.nextElement(); int score = scoreAddr(iface, addr); if (score >= bestScore) { bestScore = score; bestAddr = addr; } } } } catch (IOException e) { logger.error("Problem getting local IP", e); } return bestAddr; }
Source:
<code>private IllegalReferenceCountException handleIllegalReferenceCountException(IllegalReferenceCountException e) { String accessRecord = leak.toString(); if (StringUtil.isNullOrEmpty(accessRecord)) { return e; } <START> return new TrackedIllegalReferenceCountException(e.getMessage(), accessRecord); <END> }</code><technical_language>wrap original e</technical_language>

Target:
private IllegalReferenceCountException handleIllegalReferenceCountException(IllegalReferenceCountException e) { String accessRecord = leak.toString(); if (StringUtil.isNullOrEmpty(accessRecord)) { return e; } return new TrackedIllegalReferenceCountException(accessRecord, e); }
Source:
<code>private static Comparable<?> encodeDecimal(Type type, BigDecimal value) { BigInteger unscaled = Decimals.rescale(value, (DecimalType) type).unscaledValue(); if (Decimals.isShortDecimal(type)) { return unscaled.longValueExact(); } <START> else { <END> return Decimals.encodeUnscaledValue(unscaled); } }</code><technical_language>Nit: else is redundant</technical_language>

Target:
private static Comparable<?> encodeDecimal(Type type, BigDecimal value) { BigInteger unscaled = Decimals.rescale(value, (DecimalType) type).unscaledValue(); if (Decimals.isShortDecimal(type)) { return unscaled.longValueExact(); } return Decimals.encodeUnscaledValue(unscaled); }
Source:
<code>public Workflow getWorkflow(String repositoryId, Optional<Workflow> existingWorkflow) { Workflow workflow = initializeWorkflow(repositoryId); if (!existingWorkflow.isPresent()){ <START> workflow.setDescriptorType("cwl"); <END> return workflow; } if (existingWorkflow.get().getMode() == WorkflowMode.STUB){ return workflow; } workflow.setMode(WorkflowMode.FULL); Map<String, String> existingDefaults = new HashMap<>(); if (existingWorkflow.isPresent()){ existingWorkflow.get().getWorkflowVersions().forEach(existingVersion -> existingDefaults.put(existingVersion.getReference(), existingVersion.getWorkflowPath())); copyWorkflow(existingWorkflow.get(), workflow); } setupWorkflowVersions(repositoryId, workflow, existingWorkflow, existingDefaults); if (workflow.getDescriptorType().equals("cwl")) { updateEntryMetadata(workflow, AbstractEntryClient.Type.CWL); } else { updateEntryMetadata(workflow, AbstractEntryClient.Type.WDL); } return workflow; }</code><technical_language>Hook bare "cwl" entries AbstractEntryClient.Type (lower-cased)</technical_language>

Target:
public Workflow getWorkflow(String repositoryId, Optional<Workflow> existingWorkflow) { Workflow workflow = initializeWorkflow(repositoryId); if (!existingWorkflow.isPresent()){ workflow.setDescriptorType(AbstractEntryClient.Type.CWL.toString()); return workflow; } if (existingWorkflow.get().getMode() == WorkflowMode.STUB){ return workflow; } workflow.setMode(WorkflowMode.FULL); Map<String, String> existingDefaults = new HashMap<>(); if (existingWorkflow.isPresent()){ existingWorkflow.get().getWorkflowVersions().forEach(existingVersion -> existingDefaults.put(existingVersion.getReference(), existingVersion.getWorkflowPath())); copyWorkflow(existingWorkflow.get(), workflow); } setupWorkflowVersions(repositoryId, workflow, existingWorkflow, existingDefaults); if (workflow.getDescriptorType().equals(AbstractEntryClient.Type.CWL.toString())) { updateEntryMetadata(workflow, AbstractEntryClient.Type.CWL); } else { updateEntryMetadata(workflow, AbstractEntryClient.Type.WDL); } return workflow; }
Source:
<code>private LogQuery buildQuery(String offset, boolean includeAppLogs, List<String> versions) { LogQuery query = LogQuery.Builder.withDefaults(); query.includeAppLogs(includeAppLogs); query.batchSize(1000); if(versions != null && !versions.isEmpty()){ try{ query.majorVersionIds(versions); } catch (Exception e){ isError = true; statusToUser.add(e.getMessage()); } }else{ String currentVersion = Config.inst().getAppVersion(); List<String> appVersions = new ArrayList<String>(); if (currentVersion.matches(".*[A-z.*]")) { appVersions.add(currentVersion.replace(".", "-")); } else { double versionDouble = Double.parseDouble(currentVersion); String curVer = ("" + versionDouble).replace(".", "-"); String[] preVer = { null, null, null }; preVer[0] = (versionDouble - 0.01) >= 0 ? (String.format("%.2f", (versionDouble - 0.01)).replace(".", "-")) : null; preVer[1] = (versionDouble - 0.02) >= 0 ? (String.format("%.2f", (versionDouble - 0.02)).replace(".", "-")) : null; preVer[2] = (versionDouble - 0.03) >= 0 ? (String.format("%.2f", (versionDouble - 0.03)).replace(".", "-")) : null; appVersions.add(curVer); for (int i = 0; i < 3; i++) { if (preVer[i] != null) { appVersions.add(preVer[i]); } } } query.majorVersionIds(appVersions); <START> } <END> if (offset != null && !offset.equals("null")) { query.offset(offset); } return query; }</code><technical_language>This code is easy understand. Improve readability</technical_language>

Target:
private LogQuery buildQuery(String offset, boolean includeAppLogs, List<String> versions) { LogQuery query = LogQuery.Builder.withDefaults(); query.includeAppLogs(includeAppLogs); query.batchSize(1000); try { query.majorVersionIds(getVersionIdsForQuery(versions)); } catch (Exception e) { isError = true; statusToUser.add(e.getMessage()); } if (offset != null && !offset.equals("null")) { query.offset(offset); } return query; }
Source:
<code>public void checkConvertToProjectWithPomFile() throws Exception { createNewFolder(PROJECT_NAME, NEW_FOLDER_NAME); projectExplorer.selectVisibleItem(NEW_FOLDER_NAME); projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME + "/" + NEW_FOLDER_NAME); projectExplorer.clickOnItemInContextMenu(CONVERT_TO_PROJECT); wizard.waitOpenProjectConfigForm(); wizard.waitTextParentDirectoryName("/" + PROJECT_NAME); wizard.waitTextProjectNameInput(NEW_FOLDER_NAME); wizard.selectSample(Wizard.TypeProject.MAVEN); informationDialog.acceptInformDialogWithText("pom.xml does not exist."); wizard.selectSample(Wizard.TypeProject.BLANK); loader.waitOnClosed(); wizard.clickSaveButton(); wizard.waitCloseProjectConfigForm(); createNewFolder(PROJECT_NAME, NEW_MODULE_NAME); createNewFile("pom", PATH_TO_POM_FILE, XML_FILE); projectExplorer.waitItemInVisibleArea("pom.xml"); projectExplorer.openItemByPath(PATH_TO_POM_FILE + "/pom.xml"); editor.waitActive(); editor.waitTabIsPresent("pom.xml"); editor.deleteAllContent(); actionsFactory.createAction(seleniumWebDriver).sendKeys(EXPECTED_TEXT).perform(); editor.waitTextIntoEditor(EXPECTED_TEXT); <START> WaitUtils.sleepQuietly(5); <END> editor.waitTabIsPresent("pom.xml"); projectExplorer.waitFolderDefinedTypeOfFolderByPath(PATH_TO_POM_FILE, "simpleFolder"); editor.closeAllTabs(); seleniumWebDriver.navigate().refresh(); projectExplorer.waitProjectExplorer(); projectExplorer.waitFolderDefinedTypeOfFolderByPath(PATH_TO_POM_FILE, "simpleFolder"); }</code><technical_language>big sleep. Please, add explanation is needed</technical_language>

Target:
public void checkConvertToProjectWithPomFile() throws Exception { createNewFolder(PROJECT_NAME, NEW_FOLDER_NAME); projectExplorer.selectVisibleItem(NEW_FOLDER_NAME); projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME + "/" + NEW_FOLDER_NAME); projectExplorer.clickOnItemInContextMenu(CONVERT_TO_PROJECT); wizard.waitOpenProjectConfigForm(); wizard.waitTextParentDirectoryName("/" + PROJECT_NAME); wizard.waitTextProjectNameInput(NEW_FOLDER_NAME); wizard.selectSample(Wizard.TypeProject.MAVEN); informationDialog.acceptInformDialogWithText("pom.xml does not exist."); wizard.selectSample(Wizard.TypeProject.BLANK); loader.waitOnClosed(); wizard.clickSaveButton(); wizard.waitCloseProjectConfigForm(); createNewFolder(PROJECT_NAME, NEW_MODULE_NAME); createNewFile("pom", PATH_TO_POM_FILE, XML_FILE); editor.waitActive(); editor.waitTabIsPresent("pom.xml"); editor.deleteAllContent(); actionsFactory.createAction(seleniumWebDriver).sendKeys(EXPECTED_TEXT).perform(); editor.waitTextIntoEditor(EXPECTED_TEXT); WaitUtils.sleepQuietly(5); editor.waitTabIsPresent("pom.xml"); projectExplorer.waitFolderDefinedTypeOfFolderByPath(PATH_TO_POM_FILE, "simpleFolder"); editor.closeAllTabs(); seleniumWebDriver.navigate().refresh(); projectExplorer.waitProjectExplorer(); projectExplorer.waitFolderDefinedTypeOfFolderByPath(PATH_TO_POM_FILE, "simpleFolder"); }
Source:
<code>public VDSInfoReturn getVdsStats(BrokerCommandCallback callback) { JsonRpcRequest request = new RequestBuilder("Host.getStats").build(); Map<String, Object> response = new FutureMap(this.client, request, ResourceManager.getInstance().getExecutor(), callback) .withResponseKey("info"); <START> return new VDSInfoReturn(response); <END> }</code><technical_language>enable lazyEval here</technical_language>

Target:
public VDSInfoReturn getVdsStats(BrokerCommandCallback callback) { JsonRpcRequest request = new RequestBuilder("Host.getStats").build(); Map<String, Object> response = new FutureMap(this.client, request, callback) .withResponseKey("info"); return new VDSInfoReturn(response, true); }
Source:
<code>public TimestampRange incrementBy(long delta) { if (delta <= 0) { <START> throw new IllegalArgumentException("Timestamp must be increased by a positive number. Found " + delta); <END> } long upperBound = value.addAndGet(delta); long lowerBound = upperBound - delta + 1L; return TimestampRange.createInclusiveRange(lowerBound, upperBound); }</code><technical_language>fine remove this check test</technical_language>

Target:
public TimestampRange incrementBy(long delta) { long upperBound = value.addAndGet(delta); long lowerBound = upperBound - delta + 1L; return TimestampRange.createInclusiveRange(lowerBound, upperBound); }
Source:
<code>public void sendFile(Path path) { try { long startTime = System.currentTimeMillis(); byte[] name = path.getFileName().toString().getBytes("UTF-8"); byte[] data = Files.readAllBytes(path); byte[] array = BigInteger.valueOf(1).toByteArray(); byte[] array2 = BigInteger.valueOf(name.length).toByteArray(); int bufferSize = (array.length + array2.length + name.length + data.length) * 2; ByteBuffer buffer = ByteBuffer.allocate(bufferSize); buffer.put(array); buffer.put(array2); buffer.put(name); buffer.put(data); buffer.flip(); System.out.println("Last Session Binary size >> " + wsOutbound.getMaxBinaryMessageBufferSize()); System.out.println("Last Session Text size >> " + wsOutbound.getMaxTextMessageBufferSize()); synchronized(wsOutbound) { if (wsOutbound.isOpen()) { wsOutbound.getBasicRemote().sendBinary(buffer); } } String debug = ((long) System.currentTimeMillis() - startTime) + "ms were spent sending a file of " + bufferSize / 1024 + "KB to the client"; logger.info(debug); } <START> catch(Exception e) <END> { logger.warn("Failed to send file, " + path, e); notifyListeners(MessageSenderEvent.Type.MESSAGE_SEND_FAILED); } }</code><technical_language>@jrmartin check if a exception catch</technical_language>

Target:
public void sendFile(Path path) { try { long startTime = System.currentTimeMillis(); byte[] name = path.getFileName().toString().getBytes("UTF-8"); byte[] data = Files.readAllBytes(path); byte[] array = BigInteger.valueOf(1).toByteArray(); byte[] array2 = BigInteger.valueOf(name.length).toByteArray(); int bufferSize = (array.length + array2.length + name.length + data.length) * 2; ByteBuffer buffer = ByteBuffer.allocate(bufferSize); buffer.put(array); buffer.put(array2); buffer.put(name); buffer.put(data); buffer.flip(); System.out.println("Last Session Binary size >> " + wsOutbound.getMaxBinaryMessageBufferSize()); System.out.println("Last Session Text size >> " + wsOutbound.getMaxTextMessageBufferSize()); synchronized(wsOutbound) { if (wsOutbound.isOpen()) { wsOutbound.getBasicRemote().sendBinary(buffer); } } String debug = ((long) System.currentTimeMillis() - startTime) + "ms were spent sending a file of " + bufferSize / 1024 + "KB to the client"; logger.info(debug); } catch(IOException e) { logger.warn("Failed to send file, " + path, e); notifyListeners(MessageSenderEvent.Type.MESSAGE_SEND_FAILED); } }
Source:
<code>public TableReference createLockTable() throws TException { <START> TableReference lockTable = TableReference.createWithEmptyNamespace(LOCK_TABLE_PREFIX); <END> log.info("Creating lock table {}", SafeArg.of("schemaMutationTableName", lockTable)); createTableWithCustomId(lockTable); return lockTable; }</code><technical_language>Do need a suffix in table name for other schema mutation lock code work</technical_language>

Target:
public TableReference createLockTable() throws TException { TableReference lockTable = TableReference.createWithEmptyNamespace(LOCK_TABLE_PREFIX); try { log.info("Creating lock table {}", SafeArg.of("schemaMutationTableName", lockTable.getQualifiedName())); createTableWithCustomId(lockTable); return lockTable; } catch (InvalidRequestException ire) { Set<TableReference> lockTables = getAllLockTables(); if (lockTables.size() == 1) { log.info("Lock table was created by another node - returning it."); return Iterables.getOnlyElement(lockTables); } else { throw new IllegalStateException(String.format("Expected 1 locks table to exist, but found %d", lockTables.size())); } } }
Source:
<code>public CharacterSprite(int width, int height, boolean[] shape) { this.width = width; this.height = height; this.shape = shape; <START> if (shape.length != width*height) { <END> throw new IllegalArgumentException("Shape for a character must match it's dimensions"); } }</code><technical_language>Move top of ctor, and: checkState(shape.length == width * height, "Shape for a character match dimensions");</technical_language>

Target:
public CharacterSprite(int width, int height, boolean[] shape) { checkState(shape.length == width * height, "Shape for a character must match it's dimensions"); this.width = width; this.height = height; this.shape = new boolean[shape.length]; System.arraycopy(shape, 0, this.shape, 0, shape.length); }
Source:
<code>public void allTests() throws Exception { testPersistenceCheck(); testLogin(); testContent(); testAjaxCourseTableLoad(); testShowFeedbackStatsLink(); testHelpLink(); testCourseLinks(); testSearchAction(); testSortAction(); testRemindActions(); <START> testPublishUnpublishResendLinksActions(); <END> testArchiveCourseAction(); testCopyToFsAction(); testDeleteCourseAction(); }</code><technical_language>Links -> Link</technical_language>

Target:
public void allTests() throws Exception { testPersistenceCheck(); testLogin(); testContent(); testAjaxCourseTableLoad(); testShowFeedbackStatsLink(); testHelpLink(); testCourseLinks(); testSearchAction(); testSortAction(); testRemindActions(); testPublishUnpublishResendLinkActions(); testArchiveCourseAction(); testCopyToFsAction(); testDeleteCourseAction(); }
Source:
<code>public void testUnauthorizedSetTableStateInMeta() throws Exception { AccessTestAction action = new AccessTestAction() { @Override public Object run() throws Exception { <START> Connection conn = ConnectionFactory.createConnection(TEST_UTIL.getConfiguration()) ; <END> Hbck hbck = conn.getHbck(); hbck.setTableStateInMeta(new TableState(TEST_TABLE, TableState.State.DISABLED)); return null; } }; verifyDenied(action, USER_CREATE, USER_OWNER, USER_RW, USER_RO, USER_NONE, USER_GROUP_READ, USER_GROUP_WRITE, USER_GROUP_CREATE); }</code><technical_language>Please try-with-resources close connection</technical_language>

Target:
public void testUnauthorizedSetTableStateInMeta() throws Exception { AccessTestAction action = () -> { try(Connection conn = ConnectionFactory.createConnection(TEST_UTIL.getConfiguration()); Hbck hbck = conn.getHbck()){ hbck.setTableStateInMeta(new TableState(TEST_TABLE, TableState.State.DISABLED)); } return null; }; verifyDenied(action, USER_CREATE, USER_OWNER, USER_RW, USER_RO, USER_NONE, USER_GROUP_READ, USER_GROUP_WRITE, USER_GROUP_CREATE); }
Source:
<code><START> void claimSlot( int slot, long[] key ) <END> { int offset = slot * width; System.arraycopy( key, 0, keys, offset, width ); numberOfEntries++; }</code><technical_language>I contract for this method requires do overwrite slots, numberOfEntries broken. Add assert? Allow overwrite</technical_language>

Target:
void claimSlot( int slot, long[] key ) { int offset = slot * width; assert keys[offset] == NOT_IN_USE : "Tried overwriting an already used slot"; System.arraycopy( key, 0, keys, offset, width ); numberOfEntries++; }
Source:
<code>private void initOpenAL(Config config) { if (config.getAudio().isDisableSound()) { audioManager = new NullAudioManager(); } else { try { audioManager = new OpenALManager(config.getAudio()); } catch (Exception e) { <START> audioManager = new NullAudioManager(); <END> } } CoreRegistry.putPermanently(AudioManager.class, audioManager); AssetManager assetManager = CoreRegistry.get(AssetManager.class); assetManager.setAssetFactory(AssetType.SOUND, audioManager.getStaticSoundFactory()); assetManager.setAssetFactory(AssetType.MUSIC, audioManager.getStreamingSoundFactory()); }</code><technical_language>log exception well</technical_language>

Target:
private void initOpenAL(Config config) { if (config.getAudio().isDisableSound()) { audioManager = new NullAudioManager(); } else { try { audioManager = new OpenALManager(config.getAudio()); } catch (LWJGLException | OpenALException e) { logger.warn("Could not load OpenAL manager - sound is disabled", e); audioManager = new NullAudioManager(); } } CoreRegistry.putPermanently(AudioManager.class, audioManager); AssetManager assetManager = CoreRegistry.get(AssetManager.class); assetManager.setAssetFactory(AssetType.SOUND, audioManager.getStaticSoundFactory()); assetManager.setAssetFactory(AssetType.MUSIC, audioManager.getStreamingSoundFactory()); }
Source:
<code><START> public void setHeader(HttpRequest request, String name, String value) { <END> if (StringUtils.hasText(value) && !request.getHeaders().containsKey(name) && this.accessor.isTracing()) { request.getHeaders().add(name, value); } }</code><technical_language>I see, conditionally setting (vs adding a header) nm</technical_language>

Target:
private void setHeader(HttpRequest request, String name, String value) { if (StringUtils.hasText(value) && !request.getHeaders().containsKey(name) && this.accessor.isTracing()) { request.getHeaders().add(name, value); } }
Source:
<code>public Roles decodeRoles(AuthorizationIdentity identity) { Attributes attributes = identity.getAttributes(); Entry realmAccess = attributes.get(CLAIM_REALM_ACCESS); Set<String> roleSet = new HashSet<>(); if (realmAccess != null) { String realmAccessValue = realmAccess.get(0); try { Map<String, List<String>> jsonNode = mapper.readValue(realmAccessValue, Map.class); List<String> roles = jsonNode.get(CLAIM_ROLES); if (roles != null) { roleSet.addAll(roles); } } catch (IOException cause) { throw new RuntimeException("Failed to decode realm access roles", cause); } } Entry resourceAccess = attributes.get(CLAIM_RESOURCE_ACCESS); if (resourceAccess != null) { Iterator<String> iterator = resourceAccess.iterator(); <START> while (iterator.hasNext()) { <END> try { Map<String, Map<String, List<String>>> resources = mapper.readValue(iterator.next(), Map.class); for (String resourceKey : resources.keySet()) { List<String> roles = resources.get(resourceKey).get("roles"); if (roles != null) { roleSet.addAll(roles); } } } catch (IOException cause) { throw new RuntimeException("Failed to decode resource access roles", cause); } } } return Roles.fromSet(roleSet); }</code><technical_language>replace iterator for (String s : resourceAccess) {}</technical_language>

Target:
public Roles decodeRoles(AuthorizationIdentity identity) { Attributes attributes = identity.getAttributes(); Entry realmAccess = attributes.get(CLAIM_REALM_ACCESS); Set<String> roleSet = new HashSet<>(); if (realmAccess != null) { String realmAccessValue = realmAccess.get(0); try { Map<String, List<String>> jsonNode = mapper.readValue(realmAccessValue, Map.class); List<String> roles = jsonNode.get(CLAIM_ROLES); if (roles != null) { roleSet.addAll(roles); } } catch (IOException cause) { throw new RuntimeException("Failed to decode realm access roles", cause); } } Entry resourceAccess = attributes.get(CLAIM_RESOURCE_ACCESS); if (resourceAccess != null) { for(String resource : resourceAccess) { try { Map<String, Map<String, List<String>>> resources = mapper.readValue(resource, Map.class); for (String resourceKey : resources.keySet()) { List<String> roles = resources.get(resourceKey).get("roles"); if (roles != null) { roleSet.addAll(roles); } } } catch (IOException cause) { throw new RuntimeException("Failed to decode resource access roles", cause); } } } return Roles.fromSet(roleSet); }
Source:
<code>public STGroup getTemplates() { <START> STGroup templates = getTarget().getTemplates(); <END> ST version = templates.getInstanceOf("VERSION"); if ( version==null || !version.render().equals(Tool.VERSION) ) { tool.errMgr.toolError(ErrorType.INCOMPATIBLE_TOOL_AND_TEMPLATES, version, Tool.VERSION, language); } return templates; }</code><technical_language>version check easier a method in Target class, especially considering Target implementation is responsible for loading template files</technical_language>

Target:
public STGroup getTemplates() { return getTarget().getTemplates(); }
Source:
<code>private PaymentWorksVendor getPaymentWorksVendorByDocumentNumber(String documentNumber) { Map criteria = new HashMap(); criteria.put(PaymentWorksPropertiesConstants.PaymentWorksVendor.KFS_VENDOR_DOCUMENT_NUMBER, documentNumber); Collection<PaymentWorksVendor> newVendors = getBusinessObjectService().findMatching(PaymentWorksVendor.class, criteria); <START> if (newVendors.isEmpty()) { <END> return null; } else { return newVendors.iterator().next(); } }</code><technical_language>do need check for null</technical_language>

Target:
private PaymentWorksVendor getPaymentWorksVendorByDocumentNumber(String documentNumber) { Map criteria = new HashMap(); criteria.put(PaymentWorksPropertiesConstants.PaymentWorksVendor.KFS_VENDOR_DOCUMENT_NUMBER, documentNumber); Collection<PaymentWorksVendor> newVendors = getBusinessObjectService().findMatching(PaymentWorksVendor.class, criteria); if (ObjectUtils.isNull(newVendors) || newVendors.isEmpty()) { return null; } else { return newVendors.iterator().next(); } }
Source:
<code>protected void processOptions(Map<String, String> options) { isFullReport = true; performGeoRollup = true; maxSteps = FULL_STEPS; generateCharts = true; if (options != null) { <START> if (log.isDebugEnabled()) { <END> log.debug(options); } locale = options.get(LOCALE_OPT); imagePrefix = options.get(IMAGE_PREFIX_OPT); if (RAW_ONLY_TYPE.equalsIgnoreCase(options.get(TYPE_OPT))) { isFullReport = false; maxSteps = RAW_STEPS; } if (options.get(DO_ROLLUP_OPT) != null) { if ("false".equalsIgnoreCase(options.get(DO_ROLLUP_OPT))) { performGeoRollup = false; } } if (options.get(NO_CHART_OPT) != null) { if ("true".equalsIgnoreCase(options.get(NO_CHART_OPT))) { generateCharts = false; } } if (options.get(LAST_COLLECTION_OPT) != null && "true".equals(options.get(LAST_COLLECTION_OPT))) { lastCollection = true; } } if (locale != null) { locale = locale.trim().toLowerCase(); if (DEFAULT.equalsIgnoreCase(locale)) { locale = DEFAULT_LOCALE; } } else { locale = DEFAULT_LOCALE; } if (imagePrefix != null) { imagePrefix = imagePrefix.trim(); if (!imagePrefix.endsWith("/")) { imagePrefix = imagePrefix + "/"; } } else { imagePrefix = DEFAULT_IMAGE_PREFIX; } }</code><technical_language>is this check needed elsewhere</technical_language>

Target:
protected void processOptions(Map<String, String> options) { isFullReport = true; performGeoRollup = true; maxSteps = FULL_STEPS; generateCharts = true; if (options != null) { log.debug(options); locale = options.get(LOCALE_OPT); imagePrefix = options.get(IMAGE_PREFIX_OPT); if (RAW_ONLY_TYPE.equalsIgnoreCase(options.get(TYPE_OPT))) { isFullReport = false; maxSteps = RAW_STEPS; } if (options.get(DO_ROLLUP_OPT) != null) { if ("false".equalsIgnoreCase(options.get(DO_ROLLUP_OPT))) { performGeoRollup = false; } } if (options.get(NO_CHART_OPT) != null) { if ("true".equalsIgnoreCase(options.get(NO_CHART_OPT))) { generateCharts = false; } } if (options.get(LAST_COLLECTION_OPT) != null && "true".equals(options.get(LAST_COLLECTION_OPT))) { lastCollection = true; } } if (locale != null) { locale = locale.trim().toLowerCase(); if (DEFAULT.equalsIgnoreCase(locale)) { locale = DEFAULT_LOCALE; } } else { locale = DEFAULT_LOCALE; } if (imagePrefix != null) { imagePrefix = imagePrefix.trim(); if (!imagePrefix.endsWith("/")) { imagePrefix = imagePrefix + "/"; } } else { imagePrefix = DEFAULT_IMAGE_PREFIX; } }