auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public void writeTo(WritableByteChannel channel) throws IOException { <END> if (bufferToSend == null) { bufferToSend = ByteBuffer.allocate((int) sizeInBytes()); writeHeader(); bufferToSend.putLong(partitionId); bufferToSend.putShort((short)blobId.length()); bufferToSend.put(blobId.getBytes()); bufferToSend.flip(); } if (bufferToSend.remaining() > 0) { int written = channel.write(bufferToSend); sizeSent += written; } }</code><technical_language>I cleaner implement writeTo in RequestOrResponse follows: @Override public void writeTo(WritableByteChannel channel) throws IOException { if (bufferToSend == null) { bufferToSend = ByteBuffer.allocate((int) sizeInBytes()); writeHeader(); writeBody(); bufferToSend.flip(); } bufferToSend.flip(); } if (bufferToSend.remaining() > 0) { int written = channel.write(bufferToSend); sizeSent += written; } } protected void writeBody(); then, in DeleteRequest (or FooRequest) implement writeBody(): @Override protected void writeBody() { bufferToSend.putLong(partitionId); bufferToSend.putShort((short)blobId.length()); bufferToSend.put(blobId.getBytes()); } I this varies a bit Response Request, means abstract classes extend RequestOrResponse needed..</technical_language>

Target:
public void writeTo(WritableByteChannel channel) throws IOException { if (bufferToSend == null) { bufferToSend = ByteBuffer.allocate((int) sizeInBytes()); writeHeader(); bufferToSend.putLong(partitionId); bufferToSend.putShort(blobId.sizeInBytes()); bufferToSend.put(blobId.toBytes()); bufferToSend.flip(); } if (bufferToSend.remaining() > 0) { int written = channel.write(bufferToSend); sizeSent += written; } }
Source:
<code>public synchronized void scheduled(ChangeBasedEvent event, ParametersAction parameters, String projectName) { IGerritHudsonTriggerConfig serverConfig = getServerConfig(event); if (serverConfig != null && !serverConfig.isGerritBuildCurrentPatchesOnly() || event instanceof ManualPatchsetCreated) { return; } Iterator<Entry<GerritTriggeredEvent, ParametersAction>> it = runningJobs.entrySet().iterator(); while (it.hasNext()) { Entry<GerritTriggeredEvent, ParametersAction> pairs = it.next(); if (pairs.getKey() instanceof ChangeBasedEvent) { ChangeBasedEvent runningChangeBasedEvent = ((ChangeBasedEvent)pairs.getKey()); if (!(runningChangeBasedEvent instanceof ManualPatchsetCreated) && runningChangeBasedEvent.getChange().equals(event.getChange()) && Integer.parseInt(runningChangeBasedEvent.getPatchSet().getNumber()) <START> < Integer.parseInt(event.getPatchSet().getNumber())) { <END> logger.debug("Cancelling build for " + pairs.getKey()); try { cancelJob(pairs.getKey()); } catch (Exception e) { logger.error("Error canceling job", e); } it.remove(); } } } runningJobs.put(event, parameters); }</code><technical_language>runningChangeBasedEvent.getPatchSet().compareTo(event.getPatchSet()) < 0 lines nicer</technical_language>

Target:
public synchronized void scheduled(ChangeBasedEvent event, ParametersAction parameters, String projectName) { IGerritHudsonTriggerConfig serverConfig = getServerConfig(event); if (serverConfig == null) { runningJobs.put(event, parameters); return; } BuildCancellationPolicy buildCurrentPatchesOnly = serverConfig.getBuildCurrentPatchesOnly(); if (!buildCurrentPatchesOnly.isEnabled() || (event instanceof ManualPatchsetCreated && !buildCurrentPatchesOnly.isAbortManualPatchsets())) { runningJobs.put(event, parameters); return; } Iterator<Entry<GerritTriggeredEvent, ParametersAction>> it = runningJobs.entrySet().iterator(); while (it.hasNext()) { Entry<GerritTriggeredEvent, ParametersAction> pairs = it.next(); if (pairs.getKey() instanceof ChangeBasedEvent) { ChangeBasedEvent runningChangeBasedEvent = ((ChangeBasedEvent)pairs.getKey()); boolean shouldCancelManual = (runningChangeBasedEvent instanceof ManualPatchsetCreated && buildCurrentPatchesOnly.isAbortManualPatchsets() || !(runningChangeBasedEvent instanceof ManualPatchsetCreated)); boolean shouldCancelPatchsetNumber = buildCurrentPatchesOnly.isAbortNewPatchsets() || Integer.parseInt(runningChangeBasedEvent.getPatchSet().getNumber()) < Integer.parseInt(event.getPatchSet().getNumber()); if (shouldCancelManual && shouldCancelPatchsetNumber) { logger.debug("Cancelling build for " + pairs.getKey()); try { cancelJob(pairs.getKey()); } catch (Exception e) { logger.error("Error canceling job", e); } it.remove(); } } } runningJobs.put(event, parameters); }
Source:
<code>public ValidationResult checkAccountingString(String chartOfAccountsCode, String accountNumber, String subAccountNumber, String objectCode, String subObjectCode, String projectCode) { ValidationResult requiredFieldsValidationResult = checkRequiredAccountInfo(chartOfAccountsCode, accountNumber, objectCode); if (requiredFieldsValidationResult.isNotValid()) { return requiredFieldsValidationResult; } else { ValidationResult accountValidationResult = checkAccount(chartOfAccountsCode, accountNumber); if (accountValidationResult.isNotValid()) { return accountValidationResult; } else { <START> ValidationResult objectCodeValidationResult = checkObjectCode(chartOfAccountsCode, objectCode); <END> ValidationResult subAccountValidationResult = checkSubAccount(chartOfAccountsCode, accountNumber, subAccountNumber); ValidationResult subObjectCodeValidationResult = checkSubObjectCode(chartOfAccountsCode, accountNumber, objectCode, subObjectCode); ValidationResult projectCodeValidationResult = checkProjectCode(projectCode); ValidationResult validationResult = new ValidationResult(true, new ArrayList<String>()); if (objectCodeValidationResult.isNotValid()) { validationResult.setValid(false); validationResult.addMessages(objectCodeValidationResult.getMessages()); } if (subAccountValidationResult.isNotValid()) { validationResult.setValid(false); validationResult.addMessages(subAccountValidationResult.getMessages()); } if (subObjectCodeValidationResult.isNotValid()) { validationResult.setValid(false); validationResult.addMessages(subObjectCodeValidationResult.getMessages()); } if (projectCodeValidationResult.isNotValid()) { validationResult.setValid(false); validationResult.addMessages(projectCodeValidationResult.getMessages()); } return validationResult; } } }</code><technical_language>This is a lot of code extracted a separate method</technical_language>

Target:
public ValidationResult checkAccountingString(String chartOfAccountsCode, String accountNumber, String subAccountNumber, String objectCode, String subObjectCode, String projectCode) { ValidationResult requiredFieldsValidationResult = checkRequiredAccountInfo(chartOfAccountsCode, accountNumber, objectCode); if (requiredFieldsValidationResult.isNotValid()) { return requiredFieldsValidationResult; } else { return checkValuesAreValid(chartOfAccountsCode, accountNumber, subAccountNumber, objectCode, subObjectCode, projectCode); } }
Source:
<code>public List<TablePartitionProto> getAllPartitions() throws CatalogException { Connection conn = null; Statement stmt = null; ResultSet resultSet = null; List<TablePartitionProto> partitions = new ArrayList<TablePartitionProto>(); try { String sql = "SELECT A." + COL_PARTITIONS_PK + ", A." + COL_TABLES_PK + ", A.PARTITION_NAME, " + <START> " A.PATH FROM " + TB_PARTTIONS + " A JOIN " + TB_TABLES + " B " <END> + " ON A." + COL_TABLES_PK + " = B." + COL_TABLES_PK + " WHERE A." + COL_PARTITIONS_PK + " > 0 "; conn = getConnection(); stmt = conn.createStatement(); resultSet = stmt.executeQuery(sql); while (resultSet.next()) { TablePartitionProto.Builder builder = TablePartitionProto.newBuilder(); builder.setPartitionId(resultSet.getInt(COL_PARTITIONS_PK)); builder.setTid(resultSet.getInt(COL_TABLES_PK)); builder.setPartitionName(resultSet.getString("PARTITION_NAME")); builder.setPath(resultSet.getString("PATH")); partitions.add(builder.build()); } } catch (SQLException se) { throw new TajoInternalError(se); } finally { CatalogUtil.closeQuietly(stmt, resultSet); } return partitions; }</code><technical_language>is guaranteed tables partitions exist, join necessary</technical_language>

Target:
public List<TablePartitionProto> getAllPartitions() { Connection conn = null; Statement stmt = null; ResultSet resultSet = null; List<TablePartitionProto> partitions = new ArrayList<TablePartitionProto>(); try { String sql = "SELECT " + COL_PARTITIONS_PK + ", " + COL_TABLES_PK + ", PARTITION_NAME, " + " PATH FROM " + TB_PARTTIONS; conn = getConnection(); stmt = conn.createStatement(); resultSet = stmt.executeQuery(sql); while (resultSet.next()) { TablePartitionProto.Builder builder = TablePartitionProto.newBuilder(); builder.setPartitionId(resultSet.getInt(COL_PARTITIONS_PK)); builder.setTid(resultSet.getInt(COL_TABLES_PK)); builder.setPartitionName(resultSet.getString("PARTITION_NAME")); builder.setPath(resultSet.getString("PATH")); partitions.add(builder.build()); } } catch (SQLException se) { throw new TajoInternalError(se); } finally { CatalogUtil.closeQuietly(stmt, resultSet); } return partitions; }
Source:
<code>private static Entry parseEntry(String line) throws IOException { String pattern = null; final List<Attribute> attributes = new ArrayList<Attribute>(); <START> final String[] tokens = line.replace('\t', ' ').split(" "); <END> for (int index = 0; index < tokens.length; index++) { String token = tokens[index].trim(); if (index == tokens.length - 1) token = token.trim(); if (token.length() == 0) continue; if (pattern == null) { if (token.startsWith("#") || token.startsWith("<<<<<<<") || token.startsWith("=======") || token.startsWith(">>>>>>>")) return null; pattern = token; continue; } final Attribute attribute = parseAttribute(token); if (attribute == null) return null; attributes.add(attribute); } if (pattern == null) return null; try { return new Entry(pattern, attributes.toArray(new Attribute[attributes.size()]), line); } catch (InvalidPatternException ex) { throw new IOException(ex.getMessage()); } }</code><technical_language>FWIW try split in lower-level parsing routines. instead prefer do loop characters ourselves, avoids allocation of String[], internal Pattern Matcher objects needed perform regex search split</technical_language>

Target:
private static Entry parseEntry(String line) throws IOException { line = line.trim(); if (line.startsWith("#") || line.startsWith("<<<<<<<") || line.startsWith("========") || line.startsWith(">>>>>>>>")) return null; String pattern = null; final List<Attribute> attributes = new ArrayList<Attribute>(); final String[] tokens = line.replace('\t', ' ').split(" "); for (int index = 0; index < tokens.length; index++) { String token = tokens[index].trim(); if (index == tokens.length - 1) token = token.trim(); if (token.length() == 0) continue; if (pattern == null) { pattern = token; continue; } final Attribute attribute = parseAttribute(token); if (attribute == null) return null; attributes.add(attribute); } if (pattern == null) return null; try { return new Entry(pattern, attributes.toArray(new Attribute[attributes.size()]), line); } catch (InvalidPatternException ex) { throw new IOException(ex.getMessage()); } }
Source:
<code>public static void addImages(Described content, String anImage) { if (! Strings.isNullOrEmpty(anImage)) { Matcher matcher = IMAGE_PATTERN.matcher(anImage); if (matcher.matches()) { Matcher genericMatcher = GENERIC_PATTERN.matcher(anImage); <START> if(genericMatcher.matches()){ <END> content.setThumbnail(matcher.group(1) + THUMBNAIL_SIZE + matcher.group(2)); content.setImage((matcher.group(1) + IMAGE_SIZE + matcher.group(2))); Image image = new Image(anImage); image.setType(ImageType.GENERIC); content.setImages(ImmutableSet.of(image)); } content.setThumbnail(matcher.group(1) + THUMBNAIL_SIZE + matcher.group(2)); content.setImage((matcher.group(1) + IMAGE_SIZE + matcher.group(2))); } } }</code><technical_language>difference generic non-generic images set type ImageType.GENERIC in generic case? Why, in genericMatcher.matches() case, setting other fields</technical_language>

Target:
public static void addImages(Described content, String anImage) { if (! Strings.isNullOrEmpty(anImage)) { Matcher matcher = IMAGE_PATTERN.matcher(anImage); if (matcher.matches()) { String url = matcher.group(1) + IMAGE_SIZE + matcher.group(2); Image image = new Image(url); List<String> genericImageUrlList = createGenerateImageUrlList(); if(genericImageUrlList.contains(url)){ image.setType(ImageType.GENERIC_IMAGE_CONTENT_PLAYER); } content.setThumbnail(matcher.group(1) + THUMBNAIL_SIZE + matcher.group(2)); content.setImages(ImmutableSet.of(image)); } } for(Image image : content.getImages()) { if(image.getType() != ImageType.GENERIC_IMAGE_CONTENT_PLAYER) { content.setImage(image.getCanonicalUri()); return; } } }
Source:
<code><START> public static void onEnemyKill(int level) { <END> System.out.println("OnEnemyKill reached"); if (level == 1) { smallachieve21.setOpacity(1); System.out.println("OnEnemyKill lvl1 reached"); } if (level == 2) { smallachieve22.setOpacity(1); } if (level == 3) { smallachieve23.setOpacity(1); } if (level == 4) { smallachieve24.setOpacity(1); } if (level == 5) { smallachieve25.setOpacity(1); } }</code><technical_language>Basically, static in Controllers. If need a reference a controller, (AchievementScreenController) Preloader.loadScreen("achievementScreen").getProperties().get("Controller"); <bug</technical_language>

Target:
public void onEnemyKill(int level) { if (level >= 1) { smallachieve21.setOpacity(1); } if (level >= 2) { smallachieve22.setOpacity(1); } if (level >= 3) { smallachieve23.setOpacity(1); } if (level >= 4) { smallachieve24.setOpacity(1); } if (level >= 5) { smallachieve25.setOpacity(1); } }
Source:
<code>private FactoryMethod getFactoryMethod(List<MapperReference> mapperReferences, List<Method> methods, Type returnType) { FactoryMethod result = null; for ( Method method : methods ) { if ( !method.requiresImplementation() && !method.isIterableMapping() && !method.isMapMapping() && method.getMappings().isEmpty() && method.getParameters().isEmpty() ) { if ( method.getReturnType().equals( returnType ) ) { if ( result == null ) { MapperReference mapperReference = null; for ( MapperReference ref : mapperReferences ) { if ( ref.getMapperType().equals( method.getDeclaringMapper() ) ) { mapperReference = ref; break; } } result = new FactoryMethod(method, mapperReference); } else { <START> messager.printMessage( <END> Kind.ERROR, String.format( "Ambigious factory method: \"%s\" conflicts with \"%s\".", result.getName(), method.getName() ), method.getExecutable() ); } } } } return result; }</code><technical_language>Good thinking report this case. nice a test for (e.g. in _erroneous_ package)</technical_language>

Target:
private MethodReference getFactoryMethod(List<MapperReference> mapperReferences, List<Method> methods, Type returnType) { MethodReference result = null; for ( Method method : methods ) { if ( !method.requiresImplementation() && !method.isIterableMapping() && !method.isMapMapping() && method.getMappings().isEmpty() && method.getParameters().isEmpty() ) { if ( method.getReturnType().equals( returnType ) ) { if ( result == null ) { MapperReference mapperReference = null; for ( MapperReference ref : mapperReferences ) { if ( ref.getMapperType().equals( method.getDeclaringMapper() ) ) { mapperReference = ref; break; } } result = new MethodReference(method, mapperReference); } else { messager.printMessage( Kind.ERROR, String.format( "Ambigious factory method: \"%s\" conflicts with \"%s\".", result, method ), method.getExecutable() ); } } } } return result; }
Source:
<code>public void randomTestFilterMetaData() { Random random = new Random(System.currentTimeMillis()); for (int j = 0; j < 100; j++) { long[] rgs = new long[random.nextInt(50)]; for (int i = 0; i < rgs.length; i++) { rgs[i] = random.nextInt(10000) + 1; } int splitSize = random.nextInt(10000); try { verifyAllFilters(metadata(rgs), splitSize); } catch (AssertionError e) { AssertionError e2 = new AssertionError("fail verifyAllFilters(metadata(" + Arrays.toString(rgs) + "), " + splitSize + ")"); <START> e2.initCause(e); <END> } } }</code><technical_language>need throw e2</technical_language>

Target:
public void randomTestFilterMetaData() { Random random = new Random(System.currentTimeMillis()); for (int j = 0; j < 100; j++) { long[] rgs = new long[random.nextInt(50)]; for (int i = 0; i < rgs.length; i++) { rgs[i] = random.nextInt(10000) + 1; } int splitSize = random.nextInt(10000); try { verifyAllFilters(metadata(rgs), splitSize); } catch (AssertionError e) { AssertionError aException = new AssertionError("fail verifyAllFilters(metadata(" + Arrays.toString(rgs) + "), " + splitSize + ")"); aException.initCause(e); throw aException; } } }
Source:
<code><START> public boolean isSniEnabled() { <END> return sniEnabled; }</code><technical_language>getter is intended return a "Boolean" reference, test for null check, if default is intended used. check leshan builders see, is intended work</technical_language>

Target:
public Boolean isSniEnabled() { return sniEnabled; }
Source:
<code>private void doBackupCheck() { AuditLogableBase alert = new AuditLogableBase(); <START> EngineBackupLog lastDbBackup = engineBackupLogDao.getLastSuccessfulEngineBackup(DB_SCOPE); <END> EngineBackupLog lastFilesBackup = engineBackupLogDao.getLastSuccessfulEngineBackup(FILES_SCOPE); if (lastDbBackup == null || lastFilesBackup == null) { auditLogDirector.log(alert, AuditLogType.ENGINE_NO_FULL_BACKUP); } else { Integer backupAlertPeriodInDays = Config.<Integer>getValue(ConfigValues.BackupAlertPeriodInDays); Date lastDbBackupDate = lastDbBackup.getDoneAt(); Date lastFilesBackupDate = lastFilesBackup.getDoneAt(); Date lastFullBackupDate = lastDbBackupDate.compareTo(lastFilesBackupDate) < 0 ? lastDbBackupDate : lastFilesBackupDate; long diffInDays = (Calendar.getInstance().getTimeInMillis() - lastFullBackupDate.getTime()) / TimeUnit.DAYS.toMillis(1); if (diffInDays > backupAlertPeriodInDays) { alert.addCustomValue("Date", lastFullBackupDate.toString()); auditLogDirector.log(alert, AuditLogType.ENGINE_NO_WARM_BACKUP); } } }</code><technical_language>one-lines, this is a repeated logic "methodized" by: private EngineBackupLog getLastBackupByScope(scope);</technical_language>

Target:
private void doBackupCheck() { AuditLogableBase alert = new AuditLogableBase(); EngineBackupLog lastDbBackup = getLastBackupByScope(BACKUP_SCOPE.DB); EngineBackupLog lastFilesBackup = getLastBackupByScope(BACKUP_SCOPE.FILES); if (lastDbBackup == null || lastFilesBackup == null) { auditLogDirector.log(alert, AuditLogType.ENGINE_NO_FULL_BACKUP); } else { Integer backupAlertPeriodInDays = Config.<Integer>getValue(ConfigValues.BackupAlertPeriodInDays); Date lastDbBackupDate = lastDbBackup.getDoneAt(); Date lastFilesBackupDate = lastFilesBackup.getDoneAt(); Date lastFullBackupDate = lastDbBackupDate.compareTo(lastFilesBackupDate) < 0 ? lastDbBackupDate : lastFilesBackupDate; long diffInDays = (Calendar.getInstance().getTimeInMillis() - lastFullBackupDate.getTime()) / TimeUnit.DAYS.toMillis(1); if (diffInDays > backupAlertPeriodInDays) { alert.addCustomValue("Date", lastFullBackupDate.toString()); auditLogDirector.log(alert, AuditLogType.ENGINE_NO_WARM_BACKUP); } } }
Source:
<code>public synchronized void onClosedSource(String tableName, int partition) { boolean removed = m_dataSourcesClosing.remove(tableName, partition); if (exportLog.isDebugEnabled()) { if (removed) { exportLog.debug("Closed " + tableName + ", partition " + partition); } else { <START> exportLog.info("Closed untracked " + tableName + ", partition " + partition + " (ok on shutdown)"); <END> } } }</code><technical_language>This logged if debug is enabled is in this block want reorder if statements if (!m_dataSourcesClosing.remove(tableName, partition)) <log info message> else if (log.isDebugEnabled()) <log closed message></technical_language>

Target:
public synchronized void onClosedSource(String tableName, int partition) { boolean removed = m_dataSourcesClosing.remove(tableName, partition); if (exportLog.isDebugEnabled()) { if (removed) { exportLog.debug("Closed " + tableName + ", partition " + partition); } else { exportLog.debug("Closed untracked " + tableName + ", partition " + partition + " (ok on shutdown)"); } } }
Source:
<code>public void testDefaultAcl() throws Exception { Configuration config = new Configuration(); try (PrestoS3FileSystem fs = new PrestoS3FileSystem()) { MockAmazonS3 s3 = new MockAmazonS3(); String expectedBucketName = "test-bucket"; fs.initialize(new URI("s3n://" + expectedBucketName + "/"), config); fs.setS3Client(s3); <START> FSDataOutputStream stream = fs.create(new Path("s3n://test-bucket/test")); <END> stream.close(); assertEquals(CannedAccessControlList.Private, s3.getAcl()); } }</code><technical_language>do try (FSDataOutputStream stream = fs.create(new Path("s3n://test-bucket/test"))) { assertEquals(CannedAccessControlList.Private, s3.getAcl()); }</technical_language>

Target:
public void testDefaultAcl() throws Exception { Configuration config = new Configuration(); try (PrestoS3FileSystem fs = new PrestoS3FileSystem()) { MockAmazonS3 s3 = new MockAmazonS3(); String expectedBucketName = "test-bucket"; fs.initialize(new URI("s3n://" + expectedBucketName + "/"), config); fs.setS3Client(s3); try (FSDataOutputStream stream = fs.create(new Path("s3n://test-bucket/test"))) { } assertEquals(CannedAccessControlList.Private, s3.getAcl()); } }
Source:
<code>private Guid getPrestartedVmToAttach(Guid vmPoolId) { <START> VmPool vmPool = getVmPoolDao().get(vmPoolId); <END> List<VmPoolMap> vmPoolMaps = getVmPoolDao().getVmMapsInVmPoolByVmPoolIdAndStatus(vmPoolId, VMStatus.Up); if (vmPoolMaps != null) { for (VmPoolMap map : vmPoolMaps) { if (canAttachPrestartedVmToUser(map.getVmId(), vmPool.isStateful(), getReturnValue().getValidationMessages())) { return map.getVmId(); } } } return Guid.Empty; }</code><technical_language>reason getVmPool()</technical_language>

Target:
private Guid getPrestartedVmToAttach(Guid vmPoolId) { List<VmPoolMap> vmPoolMaps = getVmPoolDao().getVmMapsInVmPoolByVmPoolIdAndStatus(vmPoolId, VMStatus.Up); if (vmPoolMaps != null) { for (VmPoolMap map : vmPoolMaps) { if (canAttachPrestartedVmToUser(map.getVmId(), getVmPool().isStateful(), getReturnValue().getValidationMessages())) { return map.getVmId(); } } } return Guid.Empty; }
Source:
<code>public void testSimpleWritable() throws IOException { Range[] ranges = {new Range(new Key("a"), new Key("b"))}; <START> BatchInputSplit split = new BatchInputSplit("table", Table.ID.of("1"), Arrays.asList(ranges), <END> new String[] {"localhost"}); ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(baos); split.write(dos); BatchInputSplit newSplit = new BatchInputSplit(); ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); DataInputStream dis = new DataInputStream(bais); newSplit.readFields(dis); Assert.assertEquals(split.getTableName(), newSplit.getTableName()); Assert.assertEquals(split.getTableId(), newSplit.getTableId()); Assert.assertEquals(split.getRanges(), newSplit.getRanges()); Assert.assertTrue(Arrays.equals(split.getLocations(), newSplit.getLocations())); }</code><technical_language>This simplified Collections.singletonList() instead of allocating intermediate array. I a cases of this "array of singleton" case</technical_language>

Target:
public void testSimpleWritable() throws IOException { List<Range> ranges = Collections.singletonList(new Range(new Key("a"), new Key("b"))); BatchInputSplit split = new BatchInputSplit("table", Table.ID.of("1"), ranges, new String[] {"localhost"}); ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(baos); split.write(dos); BatchInputSplit newSplit = new BatchInputSplit(); ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); DataInputStream dis = new DataInputStream(bais); newSplit.readFields(dis); Assert.assertEquals(split.getTableName(), newSplit.getTableName()); Assert.assertEquals(split.getTableId(), newSplit.getTableId()); Assert.assertEquals(split.getRanges(), newSplit.getRanges()); Assert.assertTrue(Arrays.equals(split.getLocations(), newSplit.getLocations())); }
Source:
<code>public Properties getKafkaProducerProperties() { final Properties producerProps = (Properties) kafkaProperties.clone(); producerProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringSerializer"); producerProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringSerializer"); producerProps.put(ProducerConfig.ACKS_CONFIG, "all"); producerProps.put(ProducerConfig.REQUEST_TIMEOUT_MS_CONFIG, kafkaSettings.getRequestTimeoutMs()); producerProps.put(ProducerConfig.BATCH_SIZE_CONFIG, kafkaSettings.getBatchSize()); producerProps.put(ProducerConfig.LINGER_MS_CONFIG, kafkaSettings.getLingerMs()); producerProps.put(ProducerConfig.COMPRESSION_TYPE_CONFIG, "lz4"); producerProps.put(ProducerConfig.MAX_REQUEST_SIZE_CONFIG, kafkaSettings.getMaxRequestSize()); producerProps.put(ProducerConfig.DELIVERY_TIMEOUT_MS_CONFIG, kafkaSettings.getDeliveryTimeoutMs()); producerProps.put(ProducerConfig.RETRIES_CONFIG, 0); return producerProps; <START> } <END></code><technical_language>I remember a conversation wanted sure. This code working expected brokers IPs refreshing. Right</technical_language>

Target:
public Properties getKafkaProducerProperties() { final Properties producerProps = (Properties) kafkaProperties.clone(); producerProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringSerializer"); producerProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringSerializer"); producerProps.put(ProducerConfig.ACKS_CONFIG, "all"); producerProps.put(ProducerConfig.REQUEST_TIMEOUT_MS_CONFIG, kafkaSettings.getRequestTimeoutMs()); producerProps.put(ProducerConfig.BATCH_SIZE_CONFIG, kafkaSettings.getBatchSize()); producerProps.put(ProducerConfig.LINGER_MS_CONFIG, kafkaSettings.getLingerMs()); producerProps.put(ProducerConfig.COMPRESSION_TYPE_CONFIG, "lz4"); producerProps.put(ProducerConfig.MAX_REQUEST_SIZE_CONFIG, kafkaSettings.getMaxRequestSize()); producerProps.put(ProducerConfig.DELIVERY_TIMEOUT_MS_CONFIG, kafkaSettings.getDeliveryTimeoutMs()); producerProps.put(ProducerConfig.RETRIES_CONFIG, 0); producerProps.put(ProducerConfig.MAX_BLOCK_MS_CONFIG, kafkaSettings.getMaxBlockMs()); return producerProps; }
Source:
<code><START> private static void printComputerSystem(final ComputerSystem computerSystem) { <END> System.out.println("manufacturer: " + computerSystem.getManufacturer()); System.out.println("model: " + computerSystem.getModel()); System.out.println("serialnumber: " + computerSystem.getSerialNumber()); final Firmware firmware = computerSystem.getFirmware(); System.out.println("firmware:"); System.out.println(" manufacturer: " + firmware.getManufacturer()); System.out.println(" name: " + firmware.getName()); System.out.println(" description: " + firmware.getDescription()); System.out.println(" version: " + firmware.getVersion()); System.out.println(" release date: " + (firmware.getReleaseDate() == null ? "unknown" : firmware.getReleaseDate() == null ? "unknown" : firmware.getReleaseDate())); final Baseboard baseboard = computerSystem.getBaseboard(); System.out.println("baseboard:"); System.out.println(" manufacturer: " + baseboard.getManufacturer()); System.out.println(" model: " + baseboard.getModel()); System.out.println(" version: " + baseboard.getVersion()); System.out.println(" serialnumber: " + baseboard.getSerialNumber()); }</code><technical_language>Minor point, tabs in editor spaces. This unneeded whitespace changes in diffs. set editor 4 spaces a tab? If not, I easily reformat commit branch, if easy switch easier</technical_language>

Target:
private static void printComputerSystem(final ComputerSystem computerSystem) { System.out.println("manufacturer: " + computerSystem.getManufacturer()); System.out.println("model: " + computerSystem.getModel()); System.out.println("serialnumber: " + computerSystem.getSerialNumber()); final Firmware firmware = computerSystem.getFirmware(); System.out.println("firmware:"); System.out.println(" manufacturer: " + firmware.getManufacturer()); System.out.println(" name: " + firmware.getName()); System.out.println(" description: " + firmware.getDescription()); System.out.println(" version: " + firmware.getVersion()); System.out.println(" release date: " + (firmware.getReleaseDate() == null ? "unknown" : firmware.getReleaseDate() == null ? "unknown" : firmware.getReleaseDate())); final Baseboard baseboard = computerSystem.getBaseboard(); System.out.println("baseboard:"); System.out.println(" manufacturer: " + baseboard.getManufacturer()); System.out.println(" model: " + baseboard.getModel()); System.out.println(" version: " + baseboard.getVersion()); System.out.println(" serialnumber: " + baseboard.getSerialNumber()); if (Util.identifyVM().length() > 0) { System.out.println("virtualization: " + Util.identifyVM()); } }
Source:
<code>public ImmutableSet<Object> read(Kryo kryo, Input input, Class<ImmutableSet<Object>> type) { final int size = input.readInt(true); <START> final Object[] set = new Object[size]; <END> for (int i = 0; i < size; ++i) { set[i] = kryo.readClassAndObject(input); } return ImmutableSet.copyOf(set); }</code><technical_language>ImmutableSet.Builder, more efficient</technical_language>

Target:
public ImmutableSet<Object> read(Kryo kryo, Input input, Class<ImmutableSet<Object>> type) { final int size = input.readInt(true); ImmutableSet.Builder<Object> builder = ImmutableSet.builder(); for (int i = 0; i < size; ++i) { builder.add(kryo.readClassAndObject(input)); } return builder.build(); }
Source:
<code>protected void autoLoad() { if (SessionContext.isLoggedIn() && (entryId != 0 || (className != null && classPK != 0))) { load(); } else { loadBlogsEntry(); <START> } <END> }</code><technical_language>blogsEntry != null check is missing, it</technical_language>

Target:
protected void autoLoad() { if (SessionContext.isLoggedIn() && (entryId != 0 || (className != null && classPK != 0))) { load(); } else if (blogsEntry != null) { loadBlogsEntry(); } }
Source:
<code>public static Unit<Length> lookup( final String name ) { if (!name.equals(name.toLowerCase())) { return lookup(name.toLowerCase()); } Unit<Length> unit = lookup( SI.class, name); if (unit != null) { return unit; } unit = lookup( NonSI.class, name); if (unit != null) { return unit; } if (name.endsWith("s")) { return lookup(name.substring( 0, name.length() - 1)); } <START> if (name.toLowerCase().startsWith( <END> "kilo") && (name.length() > 4)) { Unit<Length> u = lookup(name.substring(4)); if (u != null) { return u.multiply(1000); } } if (name.equalsIgnoreCase("feet")) { return USCustomary.FOOT; } if (name.equalsIgnoreCase("meter")) { return SI.METRE; } if (name.equalsIgnoreCase("unity")) { return (Unit) AbstractUnit.ONE; } return null; }</code><technical_language>name case this point</technical_language>

Target:
public static Unit<Length> lookup( final String name ) { String lowerCaseName = name.toLowerCase(); Unit<Length> unit = lookup( SI.class, lowerCaseName); if (unit != null) { return unit; } unit = lookup( NonSI.class, lowerCaseName); if (unit != null) { return unit; } if (lowerCaseName.endsWith("s")) { return lookup(lowerCaseName.substring( 0, lowerCaseName.length() - 1)); } if (lowerCaseName.startsWith("kilo") && (lowerCaseName.length() > 4)) { Unit<Length> u = lookup(lowerCaseName.substring(4)); if (u != null) { return u.multiply(1000); } } if (lowerCaseName.equals("feet")) { return USCustomary.FOOT; } if (lowerCaseName.equals("meter")) { return SI.METRE; } if (lowerCaseName.equals("unity")) { return (Unit) AbstractUnit.ONE; } return null; }
Source:
<code>protected void triggerShutdown() { latch.countDown(); <START> super.triggerShutdown(); <END> }</code><technical_language>need call super</technical_language>

Target:
protected void triggerShutdown() { latch.countDown(); }
Source:
<code>public static void viewBlogPlans(Context context, int blogLocalTableId) { Intent intent = new Intent(context, PlansActivity.class); intent.putExtra(PlansActivity.ARG_LOCAL_TABLE_BLOG_ID, blogLocalTableId); slideInFromRight(context, intent); <START> AnalyticsUtils.trackWithCurrentBlogDetails(AnalyticsTracker.Stat.OPENED_PLANS); <END> }</code><technical_language>trackWithCurrentBlogDetails problematic this routine accepts a blogLocalTableId parameter. This works fine right ID of current blog, this change in future, this is sort of fall cracks. I need a trackWithBlogDetails accepts a blogId in order resolve this</technical_language>

Target:
public static void viewBlogPlans(Context context, int blogLocalTableId) { Intent intent = new Intent(context, PlansActivity.class); intent.putExtra(PlansActivity.ARG_LOCAL_TABLE_BLOG_ID, blogLocalTableId); slideInFromRight(context, intent); AnalyticsUtils.trackWithBlogDetails(AnalyticsTracker.Stat.OPENED_PLANS, WordPress.getBlog(blogLocalTableId)); }
Source:
<code><START> public static Long toTimeMicros(String seconds, String microseconds) { <END> return NumberUtils.parseNumber(seconds, Long.class) * 1000 * 1000L + NumberUtils.parseNumber(microseconds, Long.class); }</code><technical_language>method introduce a new break compatibility. Also, TimeUnit.MILLIS/MICROS for conversion for more expressive code. sense update toTimeMillis well</technical_language>

Target:
public static Long toTimeMicros(String seconds, String microseconds) { return TimeUnit.SECONDS.toMicros(NumberUtils.parseNumber(seconds, Long.class)) + NumberUtils.parseNumber(microseconds, Long.class); }
Source:
<code>public UserAgentInterceptor(String userAgent) { <START> this.userAgent = userAgent; <END> }</code><technical_language>I want validate userAgent is a valid form</technical_language>

Target:
private UserAgentInterceptor(String userAgent) { checkArgument(VALID_USER_AGENT.matcher(userAgent).matches(), "User Agent must match pattern '%s': %s", VALID_USER_AGENT, userAgent); this.userAgent = userAgent; }
Source:
<code>protected IOReport execute(ProgressIndicator progress, IOReporter reporter) throws IOProviderConfigurationException, IOException { progress.begin("Loading SKOS code list", ProgressIndicator.UNKNOWN); try { URI loc = getSource().getLocation(); InputStream in = getSource().getInput(); codelist = new SkosCodeList(in, loc); progress.setCurrentTask("Code list loaded."); } catch (Exception ex) { <START> throw new RuntimeException(ex); <END> } reporter.setSuccess(true); return reporter; }</code><technical_language>handle exception here, report error report process failed</technical_language>

Target:
protected IOReport execute(ProgressIndicator progress, IOReporter reporter) throws IOProviderConfigurationException, IOException { progress.begin("Loading SKOS code list", ProgressIndicator.UNKNOWN); try { URI loc = getSource().getLocation(); InputStream in = getSource().getInput(); codelist = new SkosCodeList(in, loc); progress.setCurrentTask("Code list loaded."); reporter.setSuccess(true); } catch (Exception ex) { reporter.error(new IOMessageImpl("Error in loading skos code list", ex)); reporter.setSuccess(false); } return reporter; }
Source:
<code>public void testServerShouldTerminateConnectionIdleForTooLong() throws InterruptedException { int inactivityTime = 3; int concurrentConnections = 10; final Random random = new Random(); final CountDownLatch latch = new CountDownLatch(concurrentConnections); final Server server = new Server(host, randomPort, inactivityTime); final AtomicBoolean otherCause = new AtomicBoolean(false); server.setMessageListener(new MessageListener() { public void onNewConnection(ChannelHandlerContext ctx) { <START> if (random.nextInt(10) < 1) { <END> throw new RuntimeException("Dummy"); } } @Override public void onConnectionClose(ChannelHandlerContext ctx) { latch.countDown(); } @Override public void onNewMessage(ChannelHandlerContext ctx, Message message) { if (random.nextInt(10) < 1) { throw new RuntimeException("Dummy"); } } @Override public void onException(ChannelHandlerContext ctx, Throwable cause) { if (!"Dummy".equals(cause.getMessage())) { otherCause.set(true); } } }); Runnable serverTask = new Runnable() { @Override public void run() { try { server.listen(); } catch (InterruptedException e) { } } }; Thread thread = new Thread(serverTask); thread.start(); sleep(1000); try { Long started = System.currentTimeMillis() / 1000L; for (int i = 0; i < concurrentConnections; i++) { connectClient(); } latch.await(10, TimeUnit.SECONDS); Long ended = System.currentTimeMillis() / 1000L; double diff = ended - started; assertThat(diff, is(closeTo(inactivityTime, 0.1))); assertThat(otherCause.get(), is(false)); } finally { server.stop(); } }</code><technical_language>a confused, connecting 10 clients, a 10% chance of throwing exception (which expecting), this pretty fire</technical_language>

Target:
public void testServerShouldTerminateConnectionIdleForTooLong() throws InterruptedException { int inactivityTime = 3; int concurrentConnections = 10; final Random random = new Random(); final CountDownLatch latch = new CountDownLatch(concurrentConnections); final AtomicBoolean exceptionClose = new AtomicBoolean(false); final Server server = new Server(host, randomPort, inactivityTime); server.setMessageListener(new MessageListener() { @Override public void onNewConnection(ChannelHandlerContext ctx) { } @Override public void onConnectionClose(ChannelHandlerContext ctx) { latch.countDown(); } @Override public void onNewMessage(ChannelHandlerContext ctx, Message message) { } @Override public void onException(ChannelHandlerContext ctx, Throwable cause) { exceptionClose.set(true); } }); Runnable serverTask = new Runnable() { @Override public void run() { try { server.listen(); } catch (InterruptedException e) { } } }; Thread thread = new Thread(serverTask); thread.start(); sleep(1000); try { Long started = System.currentTimeMillis() / 1000L; for (int i = 0; i < concurrentConnections; i++) { connectClient(); } assertThat(latch.await(10, TimeUnit.SECONDS), is(true)); Long ended = System.currentTimeMillis() / 1000L; double diff = ended - started; assertThat(diff, is(closeTo(inactivityTime, 0.1))); assertThat(exceptionClose.get(), is(false)); } finally { server.stop(); } }
Source:
<code>public LinkedHashMap<String, String> getKeyPropertyList(ObjectName mbeanName) { <START> if (keyPropertiesPerBean.containsKey(mbeanName)) { <END> return keyPropertiesPerBean.get(mbeanName); } LinkedHashMap<String, String> keyProperties = new LinkedHashMap<String, String>(); String properties = mbeanName.getKeyPropertyListString(); Matcher match = PROPERTY_PATTERN.matcher(properties); while (match.lookingAt()) { keyProperties.put(match.group(1), match.group(2)); properties = properties.substring(match.end()); if (properties.startsWith(",")) { properties = properties.substring(1); } match.reset(properties); } keyPropertiesPerBean.put(mbeanName, keyProperties); return keyProperties; }</code><technical_language>get return null if is empty, need for separate contains. a race due this</technical_language>

Target:
public LinkedHashMap<String, String> getKeyPropertyList(ObjectName mbeanName) { LinkedHashMap<String, String> keyProperties = keyPropertiesPerBean.get(mbeanName); if (keyProperties == null) { keyProperties = new LinkedHashMap<String, String>(); String properties = mbeanName.getKeyPropertyListString(); Matcher match = PROPERTY_PATTERN.matcher(properties); while (match.lookingAt()) { keyProperties.put(match.group(1), match.group(2)); properties = properties.substring(match.end()); if (properties.startsWith(",")) { properties = properties.substring(1); } match.reset(properties); } keyPropertiesPerBean.put(mbeanName, keyProperties); } return keyProperties; }
Source:
<code><START> private EventExecutorGroup createEventExecutorGroup(int size, long keepAliveSecs) { <END> if (size <= 0) { return ImmediateEventExecutor.INSTANCE; } ThreadFactory threadFactory = new ThreadFactory() { private final ThreadGroup threadGroup = new ThreadGroup(serviceName + "-executor-thread"); private final AtomicLong count = new AtomicLong(0); @Override public Thread newThread(Runnable r) { Thread t = new Thread(threadGroup, r, String.format("%s-executor-%d", serviceName, count.getAndIncrement())); t.setDaemon(true); return t; } }; Executor executor = new ThreadPoolExecutor(0, size, keepAliveSecs, TimeUnit.SECONDS, new SynchronousQueue<Runnable>(), threadFactory); return new MultithreadEventExecutorGroup(size, executor, DEFAULT_MAX_PENDING_EXECUTOR_TASKS, rejectedExecutionHandler) { @Override protected EventExecutor newChild(Executor executor, Object... args) throws Exception { return new DefaultEventExecutor(this, executor, (Integer) args[0], (RejectedExecutionHandler) args[1]); } }; }</code><technical_language>I @Nullable is wrong. return null</technical_language>

Target:
private EventExecutorGroup createEventExecutorGroup(int size, long keepAliveSecs) { if (size <= 0) { return null; } ThreadFactory threadFactory = new ThreadFactory() { private final ThreadGroup threadGroup = new ThreadGroup(serviceName + "-executor-thread"); private final AtomicLong count = new AtomicLong(0); @Override public Thread newThread(Runnable r) { Thread t = new Thread(threadGroup, r, String.format("%s-executor-%d", serviceName, count.getAndIncrement())); t.setDaemon(true); return t; } }; Executor executor = new ThreadPoolExecutor(0, size, keepAliveSecs, TimeUnit.SECONDS, new SynchronousQueue<Runnable>(), threadFactory); return new MultithreadEventExecutorGroup(size, executor, DEFAULT_MAX_PENDING_EXECUTOR_TASKS, rejectedExecutionHandler) { @Override protected EventExecutor newChild(Executor executor, Object... args) throws Exception { return new DefaultEventExecutor(this, executor, (Integer) args[0], (RejectedExecutionHandler) args[1]); } }; }
Source:
<code>public static Path getApexDFSRootDir(FileSystem fs, Configuration conf) { boolean useImpersonated = conf.getBoolean(StramUserLogin.DT_APP_PATH_IMPERSONATED, false); String userShortName = null; if (useImpersonated) { try { userShortName = UserGroupInformation.getCurrentUser().getShortUserName(); } catch (IOException ex) { <START> LOG.warn("Error getting current/login user name in getApexDFSRootDir", ex); <END> } } if (!useImpersonated || userShortName == null) { return getDTDFSRootDir(fs, conf); } return evalDFSRootDir(fs, conf, APEX_APP_DFS_ROOT_DIR, userShortName, true, false); }</code><technical_language>Remove method name log message (already provided logger)</technical_language>

Target:
public static Path getApexDFSRootDir(FileSystem fs, Configuration conf) { boolean useImpersonated = conf.getBoolean(StramUserLogin.DT_APP_PATH_IMPERSONATED, false); String userShortName = null; if (useImpersonated) { try { userShortName = UserGroupInformation.getCurrentUser().getShortUserName(); } catch (IOException ex) { LOG.warn("Error getting current/login user name", ex); } } if (!useImpersonated || userShortName == null) { return getDTDFSRootDir(fs, conf); } return evalDFSRootDir(fs, conf, APEX_APP_DFS_ROOT_DIR, userShortName, true, false); }
Source:
<code>public ConfigBuilder writeTo(View<?> view) { <START> if (view instanceof Dataset && view instanceof FileSystemDataset) { <END> FileSystemDataset dataset = (FileSystemDataset) view; conf.set(KITE_PARTITION_DIR, String.valueOf(dataset.getDescriptor().getLocation())); } withType(view.getType()); return writeTo(view.getUri()); }</code><technical_language>instanceof Dataset is redundant</technical_language>

Target:
public ConfigBuilder writeTo(View<?> view) { if (view instanceof FileSystemDataset) { FileSystemDataset dataset = (FileSystemDataset) view; conf.set(KITE_PARTITION_DIR, String.valueOf(dataset.getDescriptor().getLocation())); } withType(view.getType()); return writeTo(view.getUri()); }
Source:
<code>abstract JsonParser createParser(Object obj) throws IOException; private boolean findAttribute(JsonParser parser, String path) throws IOException { JsonToken token = parser.getCurrentToken(); if (token != JsonToken.START_OBJECT) { return false; } <START> parser.getCurrentToken(); <END> while (true) { token = parser.nextToken(); if (token == JsonToken.END_OBJECT) { return false; } if (path.equals(parser.getCurrentName())) { parser.nextToken(); return true; } else { parser.nextToken(); parser.skipChildren(); } } }</code><technical_language>Is necessary call this again</technical_language>

Target:
abstract JsonParser createParser(Object obj) throws IOException; private boolean findAttribute(JsonParser parser, String path) throws IOException { JsonToken token = parser.getCurrentToken(); if (token != JsonToken.START_OBJECT) { return false; } while (true) { token = parser.nextToken(); if (token == JsonToken.END_OBJECT) { return false; } if (path.equals(parser.getCurrentName())) { parser.nextToken(); return true; } else { parser.nextToken(); parser.skipChildren(); } } }
Source:
<code>public static org.ovirt.engine.core.common.job.Job map(Job job, org.ovirt.engine.core.common.job.Job entity) { org.ovirt.engine.core.common.job.Job target = entity != null ? entity : new org.ovirt.engine.core.common.job.Job(); <START> target.setId(new Guid(job.getId())); <END> if (job.isSetDescription()) { target.setDescription(job.getDescription()); } if (job.isSetStatus()) { target.setStatus(map(job.getStatus(), null)); } if (job.isSetOwner()) { target.setOwnerId(new Guid(job.getOwner().getId())); } target.setStartTime(job.isSetStartTime() ? job.getStartTime().toGregorianCalendar().getTime() : new Date((Calendar.getInstance().getTimeInMillis()))); target.setEndTime(job.isSetEndTime() ? job.getEndTime().toGregorianCalendar().getTime() : new Date((Calendar.getInstance().getTimeInMillis()))); target.setLastUpdateTime(job.isSetLastUpdated() ? job.getLastUpdated().toGregorianCalendar().getTime() : new Date((Calendar.getInstance().getTimeInMillis()))); target.setExternal(job.isSetExternal() ? job.isExternal() : true); target.setAutoCleared(job.isSetAutoCleared() ? job.isAutoCleared() : true); return target; }</code><technical_language>GuidUtils.asGuid() formats BAD_REQUEST format exception, while new Guid() throws runtime exception</technical_language>

Target:
public static org.ovirt.engine.core.common.job.Job map(Job job, org.ovirt.engine.core.common.job.Job entity) { org.ovirt.engine.core.common.job.Job target = entity != null ? entity : new org.ovirt.engine.core.common.job.Job(); target.setId(GuidUtils.asGuid(job.getId())); if (job.isSetDescription()) { target.setDescription(job.getDescription()); } if (job.isSetStatus()) { target.setStatus(map(job.getStatus(), null)); } if (job.isSetOwner()) { target.setOwnerId(GuidUtils.asGuid(job.getOwner().getId())); } target.setStartTime(job.isSetStartTime() ? job.getStartTime().toGregorianCalendar().getTime() : new Date((Calendar.getInstance().getTimeInMillis()))); target.setEndTime(job.isSetEndTime() ? job.getEndTime().toGregorianCalendar().getTime() : new Date((Calendar.getInstance().getTimeInMillis()))); target.setLastUpdateTime(job.isSetLastUpdated() ? job.getLastUpdated().toGregorianCalendar().getTime() : new Date((Calendar.getInstance().getTimeInMillis()))); target.setExternal(job.isSetExternal() ? job.isExternal() : true); target.setAutoCleared(job.isSetAutoCleared() ? job.isAutoCleared() : true); return target; }
Source:
<code>public Context start(String spanName, Context context) { Objects.requireNonNull(spanName, "'spanName' cannot be null."); Objects.requireNonNull(context, "'context' cannot be null."); Builder spanBuilder = getSpanBuilder(spanName, context); Span span = spanBuilder.startSpan(); if (span.isRecording()) { <START> span.setAttribute(AZ_NAMESPACE_KEY, AttributeValue.stringAttributeValue(HttpTraceUtil.parseNamespaceProvider(spanName))); <END> } return context.addData(PARENT_SPAN_KEY, span); }</code><technical_language>this add attribute if parsed name is ""? in policy doesn't</technical_language>

Target:
public Context start(String spanName, Context context) { Objects.requireNonNull(spanName, "'spanName' cannot be null."); Objects.requireNonNull(context, "'context' cannot be null."); Builder spanBuilder = getSpanBuilder(spanName, context); Span span = spanBuilder.startSpan(); if (span.isRecording()) { String tracingNamespace = getOrDefault(context, AZ_TRACING_NAMESPACE_KEY, null, String.class); if (tracingNamespace != null) { span.setAttribute(AZ_NAMESPACE_KEY, AttributeValue.stringAttributeValue(tracingNamespace)); } } return context.addData(PARENT_SPAN_KEY, span); }