auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected boolean writeMetsFile(Process process, URI metaFile, Fileformat gdzfile, boolean writeLocalFileGroup) throws PreferencesException, WriteException, IOException, TypeNotAllowedForParentException { MetsModsImportExport mm = new MetsModsImportExport(this.myPrefs); mm.setWriteLocal(writeLocalFileGroup); mm = serviceManager.getSchemaService().tempConvert(gdzfile, this, mm, this.myPrefs, process); <START> User user = (User) Helper.getManagedBeanValue("#{LoginForm.myBenutzer}"); <END> if (user != null) { mm.write(ConfigCore.getParameter("dir_Users") + user.getLogin() + "/" + metaFile.toString()); Helper.setMeldung(null, process.getTitle() + ": ", "ExportFinished"); return true; } Helper.setMeldung(null, process.getTitle() + ": ", "ExportNotFinished"); return false; }</code><technical_language>This ProzessverwaltungForm class methods exportMets, exportPdf exportDMS</technical_language>

Target:
protected boolean writeMetsFile(Process process, URI metaFile, Fileformat gdzfile, boolean writeLocalFileGroup) throws PreferencesException, WriteException, IOException, TypeNotAllowedForParentException { MetsModsImportExport mm = new MetsModsImportExport(this.myPrefs); mm.setWriteLocal(writeLocalFileGroup); mm = serviceManager.getSchemaService().tempConvert(gdzfile, this, mm, this.myPrefs, process); mm.write(metaFile.toString()); Helper.setMeldung(null, process.getTitle() + ": ", "ExportFinished"); return true; }
Source:
<code><START> public Module load(String qualifiedName, File file, boolean toplevel, boolean isLifted) { <END> boolean loadingType = file.getName().endsWith(".wyt"); TypedAST ast = null; try { ast = TestUtil.getNewAST(file); } catch (ParseException e) { if (e.getCurrentToken() != null) { ToolError.reportError(ErrorMessage.PARSE_ERROR, new FileLocation(file.getPath(), e.getCurrentToken().beginLine, e.getCurrentToken().beginColumn), e.getMessage()); } else { ToolError.reportError(ErrorMessage.PARSE_ERROR, FileLocation.UNKNOWN, e.getMessage()); } } return loadContinuation(file, qualifiedName, ast, loadingType, toplevel, isLifted); }</code><technical_language>This entire method is copied, pass parameter through. instead refactor existing method avoid duplicating of body</technical_language>

Target:
private Module load(String qualifiedName, File file, boolean toplevel, boolean isLifted) { boolean loadingType = file.getName().endsWith(".wyt"); TypedAST ast = null; try { ast = TestUtil.getNewAST(file); } catch (ParseException e) { if (e.getCurrentToken() != null) { ToolError.reportError(ErrorMessage.PARSE_ERROR, new FileLocation(file.getPath(), e.getCurrentToken().beginLine, e.getCurrentToken().beginColumn), e.getMessage()); } else { ToolError.reportError(ErrorMessage.PARSE_ERROR, FileLocation.UNKNOWN, e.getMessage()); } } return loadContinuation(file, qualifiedName, ast, loadingType, toplevel, isLifted); }
Source:
<code>protected void executeVdsBrokerCommand() { GlusterVolumeSnapshotConfig cfgParam = getParameters() .getConfgParam(); String paramValue = cfgParam.getParamValue().endsWith("%") ? StringUtils.removeEnd(cfgParam.getParamValue(), "%") <START> : cfgParam.getParamValue(); <END> if (cfgParam.getVolumeId() != null) { GlusterVolumeEntity volume = DbFacade.getInstance().getGlusterVolumeDao().getById(cfgParam.getVolumeId()); status = getBroker().glusterVolumeSnapshotConfigSet(volume.getName(), cfgParam.getParamName(), paramValue); } else { status = getBroker().glusterSnapshotConfigSet(cfgParam.getParamName(), paramValue); } proceedProxyReturnValue(); }</code><technical_language>check required</technical_language>

Target:
protected void executeVdsBrokerCommand() { GlusterVolumeSnapshotConfig cfgParam = getParameters() .getConfgParam(); String paramValue = StringUtils.removeEnd(cfgParam.getParamValue(), "%"); if (cfgParam.getVolumeId() != null) { GlusterVolumeEntity volume = DbFacade.getInstance().getGlusterVolumeDao().getById(cfgParam.getVolumeId()); status = getBroker().glusterVolumeSnapshotConfigSet(volume.getName(), cfgParam.getParamName(), paramValue); } else { status = getBroker().glusterSnapshotConfigSet(cfgParam.getParamName(), paramValue); } proceedProxyReturnValue(); }
Source:
<code>public SecurityWebFilterChain securityWebFilterChain(ServerHttpSecurity http) { <START> return http <END> .x509().authenticationManager(Mono::just) .and() .authorizeExchange().anyExchange().permitAll() .and() .build(); }</code><technical_language>Please fix this [indentation](<LINK_0> java // @formatter:off http .x509() .authenticationManager(Mono::just) .and() .authorizeExchange() .anyExchange().permitAll(); // @formatter:on return http.build();</technical_language>

Target:
public SecurityWebFilterChain securityWebFilterChain(ServerHttpSecurity http) { http .x509() .and() .authorizeExchange() .anyExchange().authenticated(); return http.build(); }
Source:
<code>public static boolean initBookie(ServerConfiguration conf) throws Exception { try (RegistrationManager rm = RegistrationManager.instantiateRegistrationManager(conf)) { File[] journalDirs = conf.getJournalDirs(); <START> for (File journalDir : journalDirs) { <END> File[] journalDirFiles = journalDir.listFiles(); if ((journalDirFiles != null) && journalDirFiles.length != 0) { LOG.error("JournalDir: is existing and its not empty, try formatting the bookie", journalDir); return false; } } File[] ledgerDirs = conf.getLedgerDirs(); for (File ledgerDir : ledgerDirs) { File[] ledgerDirFiles = ledgerDir.listFiles(); if ((ledgerDirFiles != null) && ledgerDirFiles.length != 0) { LOG.error("Atleast one LedgerDir: is existing and its not empty, try formatting the bookie", ledgerDir); return false; } } File[] indexDirs = conf.getIndexDirs(); if (indexDirs != null) { for (File indexDir : indexDirs) { File[] indexDirFiles = indexDir.listFiles(); if ((indexDirFiles != null) && indexDirFiles.length != 0) { LOG.error("Atleast one IndexDir: is existing and its not empty, try formatting the bookie", indexDir); return false; } } } String bookieId = Bookie.getBookieAddress(conf).toString(); if (rm.isBookieRegistered(bookieId)) { LOG.error("Bookie with bookieId: is still registered, " + "If this node is running bookie process, try stopping it first.", bookieId); return false; } try { rm.readCookie(bookieId); LOG.error("Cookie still exists in the ZK for this bookie: {}, try formatting the bookie", bookieId); return false; } catch (BookieException.CookieNotFoundException nfe) { } return true; } }</code><technical_language>line 1176-1182, 1185-1192, 1196-1204 duplicated logic. is abstract this logic a util function, duplicating code</technical_language>

Target:
public static boolean initBookie(ServerConfiguration conf) throws Exception { File[] journalDirs = conf.getJournalDirs(); if (!validateDirectoriesAreEmpty(journalDirs, "JournalDir")) { return false; } File[] ledgerDirs = conf.getLedgerDirs(); if (!validateDirectoriesAreEmpty(ledgerDirs, "LedgerDir")) { return false; } File[] indexDirs = conf.getIndexDirs(); if (indexDirs != null) { if (!validateDirectoriesAreEmpty(indexDirs, "IndexDir")) { return false; } } try (RegistrationManager rm = RegistrationManager.instantiateRegistrationManager(conf)) { String bookieId = Bookie.getBookieAddress(conf).toString(); if (rm.isBookieRegistered(bookieId)) { LOG.error("Bookie with bookieId: is still registered, " + "If this node is running bookie process, try stopping it first.", bookieId); return false; } try { rm.readCookie(bookieId); LOG.error("Cookie still exists in the ZK for this bookie: {}, try formatting the bookie", bookieId); return false; } catch (BookieException.CookieNotFoundException nfe) { } return true; } }
Source:
<code>private void updateExtensionField(Entry<String, Extension> extensionEntry, UserEntity userEntity) { String urn = extensionEntry.getKey(); Extension updatedScimExtension = extensionEntry.getValue(); ExtensionEntity extensionEntity = extensionDao.getExtensionByUrn(urn); for (String fieldName : updatedScimExtension.getFields().keySet()) { ExtensionFieldEntity extensionEntitiyField = null; try { extensionEntitiyField = extensionEntity.getFieldForName(fieldName, true); } catch (NoSuchElementException e) { <START> LOGGER.info("Update Extension failed: ", e.getMessage()); <END> throw e; } ExtensionFieldValueEntity extensionFieldValue = findExtensionFieldValue(extensionEntitiyField, userEntity); if (extensionFieldValue == null) { extensionFieldValue = new ExtensionFieldValueEntity(); } String newValue = getNewExtensionValue(extensionEntitiyField, updatedScimExtension, fieldName); if (!Strings.isNullOrEmpty(newValue)) { extensionFieldValue.setValue(newValue); extensionFieldValue.setExtensionField(extensionEntitiyField); userEntity.addOrUpdateExtensionValue(extensionFieldValue); } } }</code><technical_language>this logged warn level? if this occurred frequently recognized in logs level > info</technical_language>

Target:
private void updateExtensionField(Entry<String, Extension> extensionEntry, UserEntity userEntity) { String urn = extensionEntry.getKey(); Extension updatedScimExtension = extensionEntry.getValue(); ExtensionEntity extensionEntity = extensionDao.getExtensionByUrn(urn); for (String fieldName : updatedScimExtension.getFields().keySet()) { ExtensionFieldEntity extensionEntitiyField = null; try { extensionEntitiyField = extensionEntity.getFieldForName(fieldName, true); } catch (NoSuchElementException e) { LOGGER.warn("Update Extension failed: ", e.getMessage()); throw e; } ExtensionFieldValueEntity extensionFieldValue = findExtensionFieldValue(extensionEntitiyField, userEntity); if (extensionFieldValue == null) { extensionFieldValue = new ExtensionFieldValueEntity(); } String newValue = getNewExtensionValue(extensionEntitiyField, updatedScimExtension, fieldName); if (!Strings.isNullOrEmpty(newValue)) { extensionFieldValue.setValue(newValue); extensionFieldValue.setExtensionField(extensionEntitiyField); userEntity.addOrUpdateExtensionValue(extensionFieldValue); } } }
Source:
<code>private boolean checkQuota() { if (totalBufferUsed.get() > totalBufferQuota) { <START> LOG.warn("Can't read more edits from WAL as buffer usage {}B exceeds limit {}B", <END> totalBufferUsed.get(), totalBufferQuota); Threads.sleep(sleepForRetries); return false; } return true; }</code><technical_language>Nit: Worth log for peer source reader is sleeping</technical_language>

Target:
private boolean checkQuota() { if (totalBufferUsed.get() > totalBufferQuota) { LOG.warn("peer={}, can't read more edits from WAL as buffer usage {}B exceeds limit {}B", this.source.getPeerId(), totalBufferUsed.get(), totalBufferQuota); Threads.sleep(sleepForRetries); return false; } return true; }
Source:
<code>private static List<IndexableAdapter> toIndexableAdapters(List<QueryableIndex> indexes) { <START> return Lists.transform( <END> indexes, new Function<QueryableIndex, IndexableAdapter>() { @Override public IndexableAdapter apply(final QueryableIndex input) { return new QueryableIndexIndexableAdapter(input); } } ); }</code><technical_language>Stream API for new code, instead of Guava</technical_language>

Target:
private static List<IndexableAdapter> toIndexableAdapters(List<QueryableIndex> indexes) { return Lists.newArrayList( Iterables.transform( indexes, new Function<QueryableIndex, IndexableAdapter>() { @Override public IndexableAdapter apply(final QueryableIndex input) { return new QueryableIndexIndexableAdapter(input); } } ) ); }
Source:
<code>public List<Tree.Kind> nodesToVisit() { <START> return Arrays.asList(Tree.Kind.METHOD, Tree.Kind.CLASS); <END> }</code><technical_language>rule target properly METHOD, for CLASS more complicated. A JUnit 5 test class is a class contains test method. I register CLASS, check members for test methods. I time check if test method exists check if test method is compliant</technical_language>

Target:
public List<Tree.Kind> nodesToVisit() { return Collections.singletonList(Tree.Kind.CLASS); }
Source:
<code>public Block apply(Block block) { BlockBuilder blockBuilder = toType.createBlockBuilder(new BlockBuilderStatus(), block.getPositionCount()); ColumnarMap mapBlock = ColumnarMap.toColumnarMap(block); Block keysBlock = keyCoercer == null ? mapBlock.getKeysBlock() : keyCoercer.apply(mapBlock.getKeysBlock()); Block valuesBlock = valueCoercer == null ? mapBlock.getValuesBlock() : valueCoercer.apply(mapBlock.getValuesBlock()); for (int i = 0; i < mapBlock.getPositionCount(); i++) { if (mapBlock.isNull(i)) { blockBuilder.appendNull(); continue; } BlockBuilder singleMapBuilder = blockBuilder.beginBlockEntry(); if (keysBlock.isNull(i)) { singleMapBuilder.appendNull(); } else { keysBlock.writePositionTo(i, singleMapBuilder); singleMapBuilder.closeEntry(); } if (valuesBlock.isNull(i)) { singleMapBuilder.appendNull(); } else { valuesBlock.writePositionTo(i, singleMapBuilder); singleMapBuilder.closeEntry(); } <START> blockBuilder.closeEntry(); <END> } return blockBuilder.build(); }</code><technical_language>In Java, element in a newly initialized array a defined initial value. Therefore, this line is unnecessary. Consistency is important in a code base this. In this code base, chose avoid lines this, guaranteed no-op</technical_language>

Target:
public Block apply(Block block) { ColumnarMap mapBlock = toColumnarMap(block); Block keysBlock = keyCoercer == null ? mapBlock.getKeysBlock() : keyCoercer.apply(mapBlock.getKeysBlock()); Block valuesBlock = valueCoercer == null ? mapBlock.getValuesBlock() : valueCoercer.apply(mapBlock.getValuesBlock()); boolean[] valueIsNull = new boolean[mapBlock.getPositionCount()]; int[] offsets = new int[mapBlock.getPositionCount() + 1]; for (int i = 0; i < mapBlock.getPositionCount(); i++) { valueIsNull[i] = mapBlock.isNull(i); offsets[i + 1] = offsets[i] + mapBlock.getEntryCount(i); } return ((MapType) toType).createBlockFromKeyValue(valueIsNull, offsets, keysBlock, valuesBlock); }
Source:
<code>private void executePrecode(Connection connection, String propertyKey) throws SQLException { String precode = getProperty(String.format(PRECODE_KEY_TEMPLATE, propertyKey)); if (StringUtils.isNotBlank(precode)) { <START> List<String> precodeQueries = splitSqlQueries(precode); <END> try (Statement statement = connection.createStatement()) { for (String precodeQuery : precodeQueries) { logger.info("Run SQL precode '{}'", precodeQuery); statement.execute(precodeQuery); } if (!connection.getAutoCommit()) { connection.commit(); } } } }</code><technical_language>do need split this up</technical_language>

Target:
private void executePrecode(Connection connection, String propertyKey) throws SQLException { String precode = getProperty(String.format(PRECODE_KEY_TEMPLATE, propertyKey)); if (StringUtils.isNotBlank(precode)) { precode = StringUtils.trim(precode); logger.info("Run SQL precode '{}'", precode); try (Statement statement = connection.createStatement()) { statement.execute(precode); if (!connection.getAutoCommit()) { connection.commit(); } } } }
Source:
<code>private HttpResponse createTestUser(String appId) throws IOException, URISyntaxException { URL url = new URL(getURLCreateUser(appId)); CloseableHttpClient httpClient = HttpClientBuilder.create().disableAutomaticRetries().build(); HttpPost httpPost = getHttpPost(url); <START> if (getParams() != null) { <END> httpPost.setEntity(new UrlEncodedFormEntity(getParams(), StandardCharsets.UTF_8)); } return httpClient.execute(httpPost); }</code><technical_language>this method return a null</technical_language>

Target:
private HttpResponse createTestUser(String appId) throws IOException, URISyntaxException { URL url = new URL(getURLCreateUser(appId)); CloseableHttpClient httpClient = HttpClientBuilder.create().disableAutomaticRetries().build(); HttpPost httpPost = getHttpPost(url); httpPost.setEntity(new UrlEncodedFormEntity(getParams(), StandardCharsets.UTF_8)); return httpClient.execute(httpPost); }
Source:
<code>public ConnectorPartitioningHandle getPartitioningHandleForExchange(ConnectorSession session, int partitionCount, List<Type> partitionTypes) { if (!partitionTypes.isEmpty()) { return createPartitioningHandleWithPrestoType(partitionCount, partitionTypes, OptionalInt.empty()); } else { <START> return createPartitioningHandleWithHiveType(partitionCount, ImmutableList.of(), OptionalInt.empty()); <END> } }</code><technical_language>do create Hive compatible partitioning if partitionTypes is empty</technical_language>

Target:
public ConnectorPartitioningHandle getPartitioningHandleForExchange(ConnectorSession session, int partitionCount, List<Type> partitionTypes) { return createPrestoNativePartitioningHandle(partitionCount, partitionTypes, OptionalInt.empty()); }
Source:
<code>public static IStatus removeXmlFile(File toDelete) { <START> if (!xmlValidate(toDelete).isOK()) { <END> return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "The XML file is not an active XML Analysis"); } File activeXMLFolder = new File(XmlUtils.getXmlFilesPath().toString()); File[] activeXMLs = activeXMLFolder.listFiles(); for (int i = 0; i < activeXMLs.length; i++) { if (activeXMLs[i].getName().equals(toDelete.getName())) { activeXMLs[i].delete(); break; } } return Status.OK_STATUS; }</code><technical_language>If a tree item, is a file in XML folder, is in plug-in's state location. I delete file unconditionally. put baby pictures in there. better, validate input, create a tree item for corrupted unrelated files</technical_language>

Target:
public static IStatus removeXmlFile(File toDelete) { if (!xmlValidate(toDelete).isOK()) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "The XML file is not an active XML Analysis"); } toDelete.delete(); return Status.OK_STATUS; }
Source:
<code>public void shouldForwardPluginNameOnDisable() { checkDisableHandling(ESSENTIALS, () -> verify(pluginHookService).unhookEssentials()); checkDisableHandling(ESSENTIALS_SPAWN, () -> verify(spawnLoader).unloadEssentialsSpawn()); checkDisableHandling(CMI, () -> { verify(pluginHookService).unhookCMI(); verify(spawnLoader).unloadCMISpawn(); <START> }); <END> checkDisableHandling(MULTIVERSE, () -> verify(pluginHookService).unhookMultiverse()); checkDisableHandling(PROTOCOL_LIB, () -> verify(protocolLibService).disable()); checkDisableHandling("UnknownPlugin", () -> verifyZeroInteractions(pluginHookService, spawnLoader)); }</code><technical_language>Good job</technical_language>

Target:
public void shouldForwardPluginNameOnDisable() { checkDisableHandling(ESSENTIALS, () -> verify(pluginHookService).unhookEssentials()); checkDisableHandling(ESSENTIALS_SPAWN, () -> verify(spawnLoader).unloadEssentialsSpawn()); checkDisableHandling(CMI, () -> { verify(pluginHookService).unhookCmi(); verify(spawnLoader).unloadCMISpawn(); }); checkDisableHandling(MULTIVERSE, () -> verify(pluginHookService).unhookMultiverse()); checkDisableHandling(PROTOCOL_LIB, () -> verify(protocolLibService).disable()); checkDisableHandling("UnknownPlugin", () -> verifyZeroInteractions(pluginHookService, spawnLoader)); }
Source:
<code>protected boolean canDoAction() { VM vm = getVm(); if (vm == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_FOUND); } if (vm.getStatus() == VMStatus.Paused) { return true; } if (!getRunVmValidator().canRunVm(vm, getReturnValue().getCanDoActionMessages(), getDiskDao().getAllForVm(vm.getId(), true), getParameters().getBootSequence(), getStoragePool(), isInternalExecution(), getParameters().getDiskPath(), getParameters().getFloppyPath(), getParameters().getRunAsStateless(), getRunVdssList(), getDestinationVds() != null ? getDestinationVds().getId() : null, getVdsGroup())) { return false; } if (!validateNetworkInterfaces()) { return false; } if (getParameters().getVmPayload() != null) { if (checkPayload(getParameters().getVmPayload(), getParameters().getDiskPath()) && !StringUtils.isEmpty(getParameters().getFloppyPath()) && getParameters().getVmPayload().getType() == VmDeviceType.FLOPPY) { return failCanDoAction(VdcBllMessages.VMPAYLOAD_FLOPPY_EXCEEDED); } getVm().setVmPayload(getParameters().getVmPayload()); } if (!vm.isAutoStartup() && !StringUtils.isEmpty(getVm().getIsoPath()) <START> && getIsoDomainListSyncronizer().findActiveISODomain(getVm().getStoragePoolId()) == null) { <END> return failCanDoAction(VdcBllMessages.VM_CANNOT_RUN_FROM_CD_WITHOUT_ACTIVE_STORAGE_DOMAIN_ISO); } return true; }</code><technical_language>explain this change</technical_language>

Target:
protected boolean canDoAction() { VM vm = getVm(); if (vm == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_FOUND); } if (!canRunActionOnNonManagedVm()) { return false; } if (vm.getStatus() == VMStatus.Paused) { return true; } if (!getRunVmValidator().canRunVm(vm, getReturnValue().getCanDoActionMessages(), getDiskDao().getAllForVm(vm.getId(), true), getParameters().getBootSequence(), getStoragePool(), isInternalExecution(), getParameters().getDiskPath(), getParameters().getFloppyPath(), getParameters().getRunAsStateless(), getRunVdssList(), getDestinationVds() != null ? getDestinationVds().getId() : null, getVdsGroup())) { return false; } if (!validateNetworkInterfaces()) { return false; } if (getParameters().getVmPayload() != null) { if (checkPayload(getParameters().getVmPayload(), getParameters().getDiskPath()) && !StringUtils.isEmpty(getParameters().getFloppyPath()) && getParameters().getVmPayload().getType() == VmDeviceType.FLOPPY) { return failCanDoAction(VdcBllMessages.VMPAYLOAD_FLOPPY_EXCEEDED); } getVm().setVmPayload(getParameters().getVmPayload()); } if (!vm.isAutoStartup() && !StringUtils.isEmpty(getVm().getIsoPath()) && getIsoDomainListSyncronizer().findActiveISODomain(getVm().getStoragePoolId()) == null) { return failCanDoAction(VdcBllMessages.VM_CANNOT_RUN_FROM_CD_WITHOUT_ACTIVE_STORAGE_DOMAIN_ISO); } return true; }
Source:
<code>public static boolean configureGlobalTracer(OxdServerConfiguration configuration, String componentName) { String tracerName = configuration.getTracer(); Tracer tracer = null; if (!configuration.getEnableTracing() || Strings.isNullOrEmpty(tracerName)) { tracer = NoopTracerFactory.create(); } else if ("jaeger".equals(tracerName)) { Configuration.SamplerConfiguration samplerConfig = new Configuration.SamplerConfiguration() .withType(ConstSampler.TYPE) .withParam(1); Configuration.SenderConfiguration senderConfig = new Configuration.SenderConfiguration() .withAgentHost(configuration.getTracerHost()) .withAgentPort(configuration.getTracerPort()); Configuration.ReporterConfiguration reporterConfig = new Configuration.ReporterConfiguration() .withLogSpans(true) .withFlushInterval(1000) .withMaxQueueSize(10000) .withSender(senderConfig); <START> tracer = new Configuration(componentName).withSampler(samplerConfig).withReporter(reporterConfig).getTracer(); <END> } else if ("zipkin".equals(tracerName)) { OkHttpSender sender = OkHttpSender.create( "http://" + configuration.getTracerHost() + ":" + configuration.getTracerPort() + "/api/v1/spans"); Reporter<Span> reporter = AsyncReporter.builder(sender).build(); tracer = BraveTracer.create(Tracing.newBuilder() .localServiceName(componentName) .spanReporter(reporter) .build()); } else { tracer = NoopTracerFactory.create(); } GlobalTracer.register(tracer); return true; }</code><technical_language>formatting (withSampler in new line if follow above.)</technical_language>

Target:
public static boolean configureGlobalTracer(OxdServerConfiguration configuration, String componentName) { GlobalTracer.register(createTracer(configuration, componentName)); return true; }
Source:
<code>public static List<String> getProperties(String key) { final List<String> v; <START> v = _props.get(key); <END> return v; }</code><technical_language>return _props.get(key); in this method</technical_language>

Target:
public static List<String> getProperties(String key) { return _props.get(key); }
Source:
<code>public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Checkpoint)) return false; Checkpoint that = (Checkpoint) o; return (checkpointId.equals(that.checkpointId)) && <START> (Objects.equals(inputOffsets, that.inputOffsets)) && <END> (Objects.equals(stateCheckpoint, that.stateCheckpoint)); }</code><technical_language>Objects.equals do a deep equality comparison for Map types is default Map.equals (comparing references)</technical_language>

Target:
public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Checkpoint)) return false; Checkpoint that = (Checkpoint) o; return (checkpointId.equals(that.checkpointId)) && (Objects.equals(inputOffsets, that.inputOffsets)) && (Objects.equals(stateCheckpoints, that.stateCheckpoints)); }
Source:
<code>protected Boolean doInBackgroundInternal(final Geocache[] caches) { boolean success = true; <START> for (final IConnector connector : ConnectorFactory.getConnectors()) { <END> if (connector instanceof PersonalNoteCapability) { success &= uploadPersonalNotes((PersonalNoteCapability) connector, caches); } } return success; }</code><technical_language>I suggest remove iteration connectors, iterate geocaches instead. In contrast field notes is _aggregated_ file similar needed</technical_language>

Target:
protected Boolean doInBackgroundInternal(final Geocache[] caches) { try { int i = 0; for (final Geocache cache : caches) { final IConnector connector = ConnectorFactory.getConnector(cache); publishProgress(++i); if (connector instanceof PersonalNoteCapability && StringUtils.isNotBlank(cache.getPersonalNote())) { ((PersonalNoteCapability)connector).uploadPersonalNote(cache); persNotesCount++; } } } catch (final Exception e) { Log.e("PersonalnoteExport.ExportTask uploading personal notes", e); return false; } return true; }
Source:
<code>public void testFormat() { Date novFifth2016 = new Date(17110); DateFields novFifth2016Fields = DateUtils.getFields(novFifth2016, null); Map escapesResults = new HashMap(); escapesResults.put("%a": "Sat"); escapesResults.put("%A": "Saturday"); escapesResults.put("%b": "Nov"); <START> escapesResults.put("%B": "November"); <END> escapesResults.put("%d": "05"); escapesResults.put("%e": "5"); for (String escape : escapesResults.keySet()) { String result = escapesResults.get(escape); String formatted = DateUtils.format(novFifth2016Fields, escape); assertEquals(formatted, result); } }</code><technical_language>put("...": "..."); -> put("...", "...");</technical_language>

Target:
public void testFormat() { Date novFifth2016 = new Date(17110); DateFields novFifth2016Fields = DateUtils.getFields(novFifth2016, null); Map escapesResults = new HashMap(); escapesResults.put("%a", "Sat"); escapesResults.put("%A", "Saturday"); escapesResults.put("%b", "Nov"); escapesResults.put("%B", "November"); escapesResults.put("%d", "05"); escapesResults.put("%e", "5"); for (String escape : escapesResults.keySet()) { String result = escapesResults.get(escape); String formatted = DateUtils.format(novFifth2016Fields, escape); assertEquals(formatted, result); } }
Source:
<code><START> public static File getFile(Object source, String filename) throws IOException { <END> throw new AssertionFailedError("Please use org.eclipse.mylyn.commons.sdk.util.CommonTestUtil"); }</code><technical_language>IMO mark method deprecated (if class marked is enough) delegate call SDK utility class. suggested in error msg</technical_language>

Target:
public static File getFile(Object source, String filename) throws IOException { return org.eclipse.mylyn.commons.sdk.util.CommonTestUtil.getFile(source, filename); }
Source:
<code>private Bitmap getFullSizePhoto(Uri contactUri) { <START> Uri displayPhotoUri = Uri.withAppendedPath(contactUri, Contacts.Photo.DISPLAY_PHOTO); <END> try { AssetFileDescriptor fd = context.getContentResolver().openAssetFileDescriptor(displayPhotoUri, "r"); InputStream input; input = fd.createInputStream(); return BitmapFactory.decodeStream(input); } catch (IOException e) { e.printStackTrace(); } return null; }</code><technical_language>want protected this if block if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH)</technical_language>

Target:
private Bitmap getFullSizePhoto(Uri contactUri) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { Uri displayPhotoUri = Uri.withAppendedPath(contactUri, Contacts.Photo.DISPLAY_PHOTO); try { AssetFileDescriptor fd = context.getContentResolver().openAssetFileDescriptor(displayPhotoUri, "r"); InputStream input; input = fd.createInputStream(); return BitmapFactory.decodeStream(input); } catch (IOException e) { logger.error("Could not get the photoStream.", e); e.printStackTrace(); } } return null; }
Source:
<code>private void orchestrateStorageMigration(final String vmUuid, final StoragePool destPool) { final VMInstanceVO vm = _vmDao.findByUuid(vmUuid); preStorageMigrationStateCheck(destPool, vm); try { if(s_logger.isDebugEnabled()) { s_logger.debug( String.format("Offline migration of %s vm %s with volumes", vm.getHypervisorType().toString(), vm.getInstanceName())); } migrateThroughHypervisorOrStorage(destPool, vm); } catch (ConcurrentOperationException | InsufficientCapacityException | StorageUnavailableException e) { <START> s_logger.debug("Failed to migration: " + e.toString()); <END> throw new CloudRuntimeException("Failed to migration: " + e.toString()); } finally { try { stateTransitTo(vm, Event.AgentReportStopped, null); } catch (final NoTransitionException e) { s_logger.debug("Failed to change vm state: " + e.toString()); throw new CloudRuntimeException("Failed to change vm state: " + e.toString()); } } }</code><technical_language>do need check if debug log level is enabled? simply log it, logging framework manage it</technical_language>

Target:
private void orchestrateStorageMigration(final String vmUuid, final StoragePool destPool) { final VMInstanceVO vm = _vmDao.findByUuid(vmUuid); preStorageMigrationStateCheck(destPool, vm); try { if(s_logger.isDebugEnabled()) { s_logger.debug(String.format("Offline migration of %s vm %s with volumes", vm.getHypervisorType().toString(), vm.getInstanceName())); } migrateThroughHypervisorOrStorage(destPool, vm); } catch (ConcurrentOperationException | InsufficientCapacityException | StorageUnavailableException e) { String msg = String.format("Failed to migrate VM: %s", vmUuid); s_logger.debug(msg); throw new CloudRuntimeException(msg, e); } finally { try { stateTransitTo(vm, Event.AgentReportStopped, null); } catch (final NoTransitionException e) { String anotherMEssage = String.format("failed to change vm state of VM: %s", vmUuid); s_logger.debug(anotherMEssage); throw new CloudRuntimeException(anotherMEssage, e); } } }
Source:
<code>public void shutdown() { if (m_executionSite != null) { m_executionSite.startShutdown(); } try { if (m_term != null) { m_term.shutdown(); } } catch (Exception e) { tmLog.info("Exception during shutdown.", e ); } try { if (m_initiatorMailbox != null) { m_initiatorMailbox.shutdown(); } } catch (Exception e) { tmLog.info("Exception during shutdown.", e); } if (m_siteThread != null) { try { <START> m_scheduler.getQueue().offer(Scheduler.m_nullTask); <END> m_siteThread.join(); } catch (InterruptedException e) { tmLog.info("Interrupted during shutdown", e); } } }</code><technical_language>SpScheduler in SpScheduler.shutdown(), need offer a null task MpScheduler. MpScheduler owns m_tasks offer null task</technical_language>

Target:
public void shutdown() { if (m_executionSite != null) { m_executionSite.startShutdown(); } try { if (m_term != null) { m_term.shutdown(); } } catch (Exception e) { tmLog.info("Exception during shutdown.", e ); } try { if (m_initiatorMailbox != null) { m_initiatorMailbox.shutdown(); } } catch (Exception e) { tmLog.info("Exception during shutdown.", e); } if (m_siteThread != null) { try { m_siteThread.join(); } catch (InterruptedException e) { tmLog.info("Interrupted during shutdown", e); } } }
Source:
<code><START> public boolean equals(Object o) { <END> InheritedRefRight inheritedRefRight = (InheritedRefRight) o; RefRight refRight = inheritedRefRight.getRight(); if (refRight.getAccountGroupId().equals(this.getRight().getAccountGroupId()) && refRight.getApprovalCategoryId().equals(this.getRight().getApprovalCategoryId()) && refRight.getMinValue() == this.getRight().getMinValue() && refRight.getMaxValue() == this.getRight().getMaxValue() && refRight.getRefPattern().equals(this.getRight().getRefPattern())) { return true; } return false; }</code><technical_language>If implement equals() please implement a stable hashCode()</technical_language>

Target:
public boolean equals(Object o) { if (o instanceof InheritedRefRight) { RefRight myRight = getRight(); RefRight otherRight = ((InheritedRefRight)o).getRight(); if (otherRight.getAccountGroupId().equals(myRight.getAccountGroupId()) && otherRight.getApprovalCategoryId().equals(myRight.getApprovalCategoryId()) && otherRight.getMinValue() == myRight.getMinValue() && otherRight.getMaxValue() == myRight.getMaxValue() && otherRight.getRefPattern().equals(myRight.getRefPattern())) { return true; } } return false; }
Source:
<code>public boolean matches(String type, URI uri, String realm) { <START> boolean match = true; <END> match &= AuthScheme.NEGOTIATE.toString().equalsIgnoreCase(type); match &= getServiceUri().getScheme().equalsIgnoreCase(uri.getScheme()); match &= getServiceUri().getHost().equalsIgnoreCase(uri.getHost()); return match; }</code><technical_language>Rewrite this a single boolean expression: java return AuthScheme.NEGOTIATE... && getServiceUri().getScheme()..... && ...</technical_language>

Target:
public boolean matches(String type, URI uri, String realm) { return NEGOTIATE.equalsIgnoreCase(type); }
Source:
<code>public void setEndpoints(@NonNull String notify, @NonNull String sessions) throws IllegalArgumentException { boolean invalidNotify = TextUtils.isEmpty(notify); invalidSessionsEndpoint = TextUtils.isEmpty(sessions); if (invalidNotify) { throw new IllegalArgumentException("Notify endpoint cannot be empty or null."); } if (invalidSessionsEndpoint) { Logger.warn("The session tracking endpoint has not been set. " + "Session tracking is disabled"); autoCaptureSessions = false; } this.endpoint = notify; <START> this.sessionEndpoint = sessions; <END> this.autoCaptureSessions = !invalidNotify && !invalidSessionsEndpoint; }</code><technical_language>if invalidSessionsEndpoint is true, this set null? send a session determined endpoint is null adding a new property. reduce odds of unexpected behavior if Bugsnag.setAutoCaptureSessions() is called configuration</technical_language>

Target:
public void setEndpoints(@NonNull String notify, @NonNull String sessions) throws IllegalArgumentException { if (TextUtils.isEmpty(notify)) { throw new IllegalArgumentException("Notify endpoint cannot be empty or null."); } else { this.endpoint = notify; } boolean invalidSessionsEndpoint = TextUtils.isEmpty(sessions); if (invalidSessionsEndpoint) { Logger.warn("The session tracking endpoint has not been set. " + "Session tracking is disabled"); this.sessionEndpoint = null; this.autoCaptureSessions = false; } else { this.sessionEndpoint = sessions; } }
Source:
<code>public boolean checkMessages(String messageID, String queueName) throws IOException { <START> System.out.println("Checking message id: " + messageID + " in queue: " + queueName); <END> if (DLCQueueUtils.isDeadLetterQueue(queueName)) { DLCBrowsePage dlcBrowsePage = homePage.getDLCBrowsePage(); dlcBrowsePage.getDLCContent(); if (isElementPresent(UIElementMapper.getInstance().getElement("mb.dlc.browse.content.table"))) { return checkMessagesInTable(driver.findElement(By.xpath(UIElementMapper.getInstance(). getElement("mb.dlc.browse.content.table"))), messageID, MESSAGE_ID_COLUMN_IN_DLC); } else { log.debug("No messages in: " + queueName); return false; } } else { QueuesBrowsePage queuesBrowsePage1 = homePage.getQueuesBrowsePage(); queuesBrowsePage1.browseQueue(queueName); if (isElementPresent(UIElementMapper.getInstance().getElement("mb.queue.browse.content.table"))) { return checkMessagesInTable(driver.findElement(By.xpath(UIElementMapper.getInstance(). getElement("mb.queue.browse.content.table"))), messageID, MESSAGE_ID_COLUMN_IN_QUEUE); } else { log.debug("No messages in: " + queueName); return false; } } }</code><technical_language>do a sysout here? convert a log? remove it</technical_language>

Target:
public boolean checkMessages(String messageID, String queueName) throws IOException { if (DLCQueueUtils.isDeadLetterQueue(queueName)) { homePage.getDLCBrowsePage().getDLCContent(); if (isElementPresent(UIElementMapper.getInstance().getElement(DLC_MESSAGE_CONTENT_TABLE))) { return checkMessagesInTable(driver.findElement(By.xpath(UIElementMapper.getInstance(). getElement(DLC_MESSAGE_CONTENT_TABLE))), messageID, MESSAGE_ID_COLUMN_IN_DLC); } else { log.debug("No messages in: " + queueName); return false; } } else { homePage.getQueuesBrowsePage().browseQueue(queueName); if (isElementPresent(UIElementMapper.getInstance().getElement(QUEUE_MESSAGE_CONTENT_TABLE))) { return checkMessagesInTable(driver.findElement(By.xpath(UIElementMapper.getInstance(). getElement(QUEUE_MESSAGE_CONTENT_TABLE))), messageID, MESSAGE_ID_COLUMN_IN_QUEUE); } else { log.debug("No messages in: " + queueName); return false; } } }
Source:
<code>public void getZeroScore() { HardSoftDoubleScore score = new HardSoftDoubleScoreDefinition().getZeroScore(); <START> assertThat(score.toLevelNumbers()).containsOnly(0d); <END> }</code><technical_language>code style: "0.0" instead of "0d"</technical_language>

Target:
public void getZeroScore() { HardSoftDoubleScore score = new HardSoftDoubleScoreDefinition().getZeroScore(); assertThat(score).isEqualTo(HardSoftDoubleScore.ZERO); }
Source:
<code><START> public ZonedDateTime getWhenRun() { <END> return _whenRun; }</code><technical_language>expose this state; publicly. (although I suspect removing this field entirely)</technical_language>

Target:
public ZonedDateTime getWhenRun() { return getRunAtAndAfter(); }
Source:
<code>protected Map<String, String> getExclusiveLocks() { <START> if (getVdsGroup().supportsGlusterService() && !isInternalExecution()) { <END> return Collections.singletonMap(getVdsGroupId().toString(), LockingGroup.GLUSTER.name()); } return null; }</code><technical_language>this canDoAction, getVdsGroup() null</technical_language>

Target:
protected Map<String, String> getExclusiveLocks() { VDSGroup cluster = getVdsGroup(); if (cluster != null && cluster.supportsGlusterService() && !isInternalExecution()) { return Collections.singletonMap(cluster.getId().toString(), LockingGroup.GLUSTER.name()); } return null; }
Source:
<code>public void startDefaultWorkbench() { kieSecurityService.call( new RemoteCallback<String>() { public void callback( final String str ) { initializeWorkbench( str ); customSecurityLoadedCallback(); } } ).loadPolicy(); <START> pmas.call().initActivities( activityBeansCache.getActivitiesById() ); <END> }</code><technical_language>@Override - public void initActivities( List<String> activities ) { - this.availableActivities = activities; } method name is wrong</technical_language>

Target:
public void startDefaultWorkbench() { kieSecurityService.call( new RemoteCallback<String>() { public void callback( final String policy ) { initializeWorkbench( policy ); for ( Callback<String> callback : customSecurityLoadedCallbacks ) { callback.callback( policy ); } } } ).loadPolicy(); pmas.call().initActivities( activityBeansCache.getActivitiesById() ); }
Source:
<code>private static String getUniqueName(Set<String> existingNameList, String nameProposal) { String temp = nameProposal; final String <START> END_IN_NO_PATTERN <END> = "^.*\\d$"; Pattern pattern = Pattern.compile("\\d+$"); while (existingNameList.contains(temp)) { if (temp.matches(END_IN_NO_PATTERN)) { Matcher matchString = pattern.matcher(temp); matchString.find(); Integer number = Integer.valueOf(temp.substring(matchString.start(), matchString.end())) + 1; temp = nameProposal.substring(0, matchString.start()) + number; } else { temp = nameProposal + "_" + 1; } } return temp; }</code><technical_language>I change this NUMBER I read in</technical_language>

Target:
private static String getUniqueName(Set<String> existingNameList, String nameProposal) { String temp = nameProposal; while (existingNameList.contains(temp)) { if (END_IN_NUMBER_PATTERN.matcher(temp).matches()) { Matcher matchNumber = GET_LAST_NUMBER_PATTERN.matcher(temp); matchNumber.find(); Integer number = Integer.valueOf(temp.substring(matchNumber.start(), matchNumber.end())) + 1; temp = nameProposal.substring(0, matchNumber.start()) + number; } else { temp = nameProposal + "_" + 1; } } return temp; }
Source:
<code>private void disableProject(@NonNull AbstractProject project, @NonNull TaskListener listener) throws IOException { if (project.supportsMakeDisabled()) { project.makeDisabled(true); <START> listener.getLogger().println(Messages.SubversionSCN_disableProject_disabled()); <END> } else { listener.getLogger().println(Messages.SubversionSCN_disableProject_unsupported()); } }</code><technical_language>SubversionSCN</technical_language>

Target:
private void disableProject(@NonNull AbstractProject project, @NonNull TaskListener listener) throws IOException { if (project.supportsMakeDisabled()) { project.makeDisabled(true); listener.getLogger().println(Messages.SubversionSCM_disableProject_disabled()); } else { listener.getLogger().println(Messages.SubversionSCM_disableProject_unsupported()); } }
Source:
<code>private String getAccessToken() { if (ssoToken == null) { <START> URI ssoURI = null; if (ssoUrl != null) { ssoURI = SsoUtils.buildUrl(ssoUrl); } else { if (kerberos) { ssoURI = SsoUtils.buildSsoUrlKerberos(url); } else { ssoURI = SsoUtils.buildSsoUrlBasic(url, user, password); } } <END> JsonNode node = getSsoResponse(ssoURI); if (node.isArray()) { node = node.get(0); } if (node.get("error") != null) { throw new RuntimeException( String.format( "Error during SSO authentication %1$s : %2$s", node.get("error_code"), node.get("error") ) ); } ssoToken = node.get(ssoTokenName).getTextValue(); } return ssoToken; }</code><technical_language>shortened URI ssoURI = ssoUrl != null ? SsoUtils.buildUrl(ssoUrl) : kerberos ? SsoUtils.buildSsoUrlKerberos(url) : SsoUtils.buildSsoUrlBasic(url, user, password);</technical_language>

Target:
private String getAccessToken() { if (ssoToken == null) { URI ssoURI = ssoUrl != null ? SsoUtils.buildUrl(ssoUrl) : kerberos ? SsoUtils.buildSsoUrlKerberos(url) : SsoUtils.buildSsoUrlBasic(url, user, password); JsonNode node = getSsoResponse(ssoURI); if (node.isArray()) { node = node.get(0); } if (node.get("error") != null) { throw new RuntimeException( String.format( "Error during SSO authentication %1$s : %2$s", node.get("error_code"), node.get("error") ) ); } ssoToken = node.get(ssoTokenName).getTextValue(); } return ssoToken; }
Source:
<code>void fullWURefresh(WorkunitInfo wu, boolean includeGraphs, boolean includeResults, boolean includeSourceFiles, boolean includeApplicationValues) throws Exception { getSoapProxy(); WUInfoRequestWrapper request = new WUInfoRequestWrapper(); request.setWuid(wu.getWuid()); request.setIncludeGraphs(includeGraphs); request.setIncludeResults(includeResults); request.setIncludeResultsViewNames(includeResults); request.setSuppressResultSchemas(!includeResults); request.setIncludeSourceFiles(includeSourceFiles); request.setIncludeApplicationValues(includeApplicationValues); WUInfoResponseWrapper response = null; <START> if (targetVersion.major==6) { <END> response=new WUInfoResponseWrapper(this.version6WorkunitsServiceSoapProxy.WUInfo(request.getRawVersion6())); } else if (targetVersion.major==7) { response=new WUInfoResponseWrapper(this.wsWorkunitsServiceSoapProxy.WUInfo(request.getRaw())); } else { throw new NotImplementedException("Can only handle cluster versions 6 and 7, not version " + String.valueOf(targetVersion.major)); } if (response.getWorkunit() == null) { for (ECLExceptionInfo e : response.getExceptions()) { if (e.getCode().equals("20082") || e.getCode().equals("20080")) { wu.setStateID(999); break; } } } else { wu.update(response.getWorkunit()); } }</code><technical_language>if gain much, org.hpccsystems.ws.client.platform.Version.compareTo()</technical_language>

Target:
void fullWURefresh(WorkunitInfo wu, boolean includeGraphs, boolean includeResults, boolean includeSourceFiles, boolean includeApplicationValues) throws Exception { getSoapProxy(); WUInfoRequestWrapper request = new WUInfoRequestWrapper(); request.setWuid(wu.getWuid()); request.setIncludeGraphs(includeGraphs); request.setIncludeResults(includeResults); request.setIncludeResultsViewNames(includeResults); request.setSuppressResultSchemas(!includeResults); request.setIncludeSourceFiles(includeSourceFiles); request.setIncludeApplicationValues(includeApplicationValues); WUInfoResponseWrapper response = soapWrapper.WUInfo(request); if (response.getWorkunit() == null) { for (WUExceptionWrapper e : response.getExceptions()) { if (e.getCode().equals("20082") || e.getCode().equals("20080")) { wu.setStateID(999); break; } } } else { wu.update(response.getWorkunit()); } }
Source:
<code>public void checkEndOfExecution(CheckerContext context) { EvaluatedConditions ec = evaluatedConditions.pop(); for (Tree condition : Sets.difference(ec.evaluatedToFalse.keySet(), ec.evaluatedToTrue.keySet())) { context.reportIssue(condition, this, "Change this condition so that it does not always evaluate to \"false\"", ec.evaluatedToFalse.get(condition).stream().map(node -> flow(node.parent, node.programState.peekValue())).collect(Collectors.toSet())); } for (Tree condition : Sets.difference(ec.evaluatedToTrue.keySet(), ec.evaluatedToFalse.keySet())) { context.reportIssue(condition, this, "Change this condition so that it does not always evaluate to \"true\"", <START> ec.evaluatedToTrue.get(condition).stream().map(node -> flow(node.parent, node.programState.peekValue())).collect(Collectors.toSet())); <END> } }</code><technical_language>#flow is static, called in static (i.e. SECheck.flow )</technical_language>

Target:
public void checkEndOfExecution(CheckerContext context) { EvaluatedConditions ec = evaluatedConditions.pop(); for (Tree condition : Sets.difference(ec.evaluatedToFalse.keySet(), ec.evaluatedToTrue.keySet())) { context.reportIssue(condition, this, "Change this condition so that it does not always evaluate to \"false\"", ec.evaluatedToFalse.get(condition).stream().map(node -> SECheck.flow(node.parent, node.programState.peekValue())).collect(Collectors.toSet())); } for (Tree condition : Sets.difference(ec.evaluatedToTrue.keySet(), ec.evaluatedToFalse.keySet())) { context.reportIssue(condition, this, "Change this condition so that it does not always evaluate to \"true\"", ec.evaluatedToTrue.get(condition).stream().map(node -> SECheck.flow(node.parent, node.programState.peekValue())).collect(Collectors.toSet())); } }
Source:
<code>public void run() { try { if (thriftServerType == null) { LOG.error("Unknow thrift server type configured, " + "it should be one of {THshaServer, TThreadedSelectorServer, TThreadPoolServer}"); return; } Scribe.Processor processor = new Scribe.Processor(new Receiver()); TNonblockingServerTransport transport = new TNonblockingServerSocket(port); LOG.info("Initializing thrift server:" + thriftServerType.getValue()); <START> switch (thriftServerType) { <END> case THSHA_SERVER: server = createThshaServer(processor, transport); break; case TTHREADED_SELECTOR_SERVER: server = createTThreadedSelectorServer(processor, transport); break; case TTHREADPOOL_SERVER: server = createTThreadPoolServer(processor, transport); break; default: LOG.error("Unsupported thrift server type, should happen!"); } LOG.info("Starting Scribe Source on port " + port); server.serve(); } catch (Exception e) { LOG.warn("Scribe failed", e); } }</code><technical_language>this in a factory readable more organized. expose ThriftServer configuration parameters in source params in HTTPSource FlumeBeanConfigurator <LINK_0></technical_language>

Target:
public void run() { try { Receiver receiver = new Receiver(); server = ScribeSourceThriftServerFactory.create(scribeSourceConfiguration, receiver); LOG.info("Starting Scribe Source on port " + scribeSourceConfiguration.port + ", thrift server type:" + scribeSourceConfiguration.thriftServerType); server.serve(); } catch (Exception e) { LOG.warn("Scribe failed", e); } }