auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void onPreInit(FMLPreInitializationEvent event) { try { registerService(ChunkLoadService.class, new SpongeChunkLoadService()); SpongeBootstrap.initializeServices(); SpongeBootstrap.preInitializeRegistry(); SpongeSerializationRegistry.setupSerialization(Sponge.getGame()); SpongeForgeModuleRegistry.registerForgeData(); SpongeModMessageHandler.init(); <START> Class<?> clazz = Class.forName("org.spongepowered.api.entity.ai.task.AbstractAITask"); <END> MinecraftForge.EVENT_BUS.register(new SpongeEventHooks()); this.game.getServiceManager().potentiallyProvide(PermissionService.class).executeWhenPresent(input -> { input.registerContextCalculator(new SpongeContextCalculator()); return true; }); FMLCommonHandler.instance().bus().register(this); FMLCommonHandler.instance().bus().register(this.game.getChannelRegistrar()); if (event.getSide().isServer()) { SpongeHooks.enableThreadContentionMonitoring(); } } catch (Throwable t) { this.controller.errorOccurred(this, t); } }</code><technical_language>Is this needed</technical_language>

Target:
public void onPreInit(FMLPreInitializationEvent event) { try { registerService(ChunkLoadService.class, new SpongeChunkLoadService()); SpongeBootstrap.initializeServices(); SpongeBootstrap.preInitializeRegistry(); SpongeSerializationRegistry.setupSerialization(SpongeImpl.getGame()); SpongeForgeModuleRegistry.registerForgeData(); SpongeModMessageHandler.init(); Preconditions.checkArgument(Class.forName("org.spongepowered.api.entity.ai.task.AbstractAITask").getSuperclass().equals(SpongeEntityAICommonSuperclass.class)); MinecraftForge.EVENT_BUS.register(new SpongeEventHooks()); this.game.getServiceManager().potentiallyProvide(PermissionService.class) .executeWhenPresent(input -> input.registerContextCalculator(new SpongeContextCalculator())); FMLCommonHandler.instance().bus().register(this); FMLCommonHandler.instance().bus().register(this.game.getChannelRegistrar()); if (event.getSide().isServer()) { SpongeHooks.enableThreadContentionMonitoring(); } } catch (Throwable t) { this.controller.errorOccurred(this, t); } }
Source:
<code>public void testCalculateNewArraySize() { <START> int size = 1; <END> for (int i = 0; i < 100; i++) { int newSize; try { newSize = BlockUtil.calculateNewArraySize(size); } catch (IllegalArgumentException e) { assertEquals(e.getMessage(), "Can not grow array beyond '2147483639'"); break; } assertTrue(newSize > size, "New size " + newSize + " is not greater than current size " + size); size = newSize; } }</code><technical_language>I this is a simpler test cover cases in this loop: assertEquals(BlockUtil.calculateNewArraySize(200), 300); assertEquals(BlockUtil.calculateNewArraySize(Integer.MAX_VALUE), MAX_ARRAY_SIZE); try { BlockUtil.calculateNewArraySize(MAX_ARRAY_SIZE); } catch (IllegalArgumentException e) { assertEquals(e.getMessage(), format("Can grow array '%s'", MAX_ARRAY_SIZE)); }</technical_language>

Target:
public void testCalculateNewArraySize() { assertEquals(BlockUtil.calculateNewArraySize(200), 300); assertEquals(BlockUtil.calculateNewArraySize(Integer.MAX_VALUE), MAX_ARRAY_SIZE); try { BlockUtil.calculateNewArraySize(MAX_ARRAY_SIZE); } catch (IllegalArgumentException e) { assertEquals(e.getMessage(), format("Can not grow array beyond '%s'", MAX_ARRAY_SIZE)); } }
Source:
<code>public CompareConfiguration(IPreferenceStore prefStore) { setProperty("LEFT_IS_LOCAL", Boolean.valueOf(fLeftIsLocal)); fPreferenceStore= prefStore; if (fPreferenceStore != null) { boolean b= fPreferenceStore.getBoolean(ComparePreferencePage.INITIALLY_SHOW_ANCESTOR_PANE); setProperty(ICompareUIConstants.PROP_ANCESTOR_VISIBLE, Boolean.valueOf(b)); b= fPreferenceStore.getBoolean(ComparePreferencePage.IGNORE_WHITESPACE); setProperty(CompareConfiguration.IGNORE_WHITESPACE, Boolean.valueOf(b)); b= <START> fPreferenceStore.getBoolean(ComparePreferencePage.TOGGLE_LEFT_AND_RIGHT); <END> setProperty(ComparePreferencePage.TOGGLE_LEFT_AND_RIGHT, Boolean.valueOf(b)); } }</code><technical_language>Consider replacing word "toggle" "flip"</technical_language>

Target:
public CompareConfiguration(IPreferenceStore prefStore) { setProperty("LEFT_IS_LOCAL", Boolean.valueOf(fLeftIsLocal)); fPreferenceStore= prefStore; if (fPreferenceStore != null) { boolean b= fPreferenceStore.getBoolean(ComparePreferencePage.INITIALLY_SHOW_ANCESTOR_PANE); setProperty(ICompareUIConstants.PROP_ANCESTOR_VISIBLE, Boolean.valueOf(b)); b= fPreferenceStore.getBoolean(ComparePreferencePage.IGNORE_WHITESPACE); setProperty(CompareConfiguration.IGNORE_WHITESPACE, Boolean.valueOf(b)); setProperty(ComparePreferencePage.LAYOUT, fPreferenceStore.getString(ComparePreferencePage.LAYOUT)); } }
Source:
<code>public void visit(LwM2mResourceInstance instance) { LOG.trace("Encoding resource instance into text", instance); ResourceModel rSpec = model.getResourceModel(path.getObjectId(), instance.getId()); Type expectedType = rSpec != null ? rSpec.type : instance.getType(); Object val = converter.convertValue(instance.getValue(), instance.getType(), expectedType, path); if (expectedType == null) { throw new CodecException( "Unable to encode value for resource without type(probably a executable one)", path); } <START> String strValue; strValue = getStringValue(expectedType, val); <END> encoded = strValue.getBytes(StandardCharsets.UTF_8); }</code><technical_language>suggestion String strValue = getStringValue(expectedType, val); for resource :point_up:</technical_language>

Target:
public void visit(LwM2mResourceInstance instance) { LOG.trace("Encoding resource instance into text", instance); ResourceModel rSpec = model.getResourceModel(path.getObjectId(), instance.getId()); Type expectedType = rSpec != null ? rSpec.type : instance.getType(); Object val = converter.convertValue(instance.getValue(), instance.getType(), expectedType, path); if (expectedType == null) { throw new CodecException( "Unable to encode value for resource without type(probably a executable one)", path); } String strValue = getStringValue(expectedType, val); encoded = strValue.getBytes(StandardCharsets.UTF_8); }
Source:
<code>private void handleValueChangedCommand(final ValueChangedCommand serverCommand) { Attribute attribute = clientModelStore.findAttributeById(serverCommand.getAttributeId()); if (attribute == null) { <START> LOG.debug("C: attribute with id '{}' not found, cannot update old value '{}' to new value '{}'", serverCommand.getAttributeId() ,serverCommand.getOldValue(), serverCommand.getNewValue() ); <END> return; } if (attribute.getValue() == null && serverCommand.getNewValue() == null || (attribute.getValue() != null && serverCommand.getNewValue() != null && attribute.getValue().equals(serverCommand.getNewValue()))) { return; } if (strictMode && ((attribute.getValue() == null && serverCommand.getOldValue() != null) || (attribute.getValue() != null && serverCommand.getOldValue() == null) || (attribute.getValue() != null && !attribute.getValue().equals(serverCommand.getOldValue())))) { LOG.debug("C: attribute with id '{}' and value '{}' cannot be set to new value '{}' because the change was based on an outdated old value of '{}'.", serverCommand.getAttributeId(), attribute.getValue(), serverCommand.getNewValue(), serverCommand.getOldValue()); return; } LOG.trace("C: updating '{}' id '{}' from '{}' to '{}' ", attribute.getPropertyName(), serverCommand.getAttributeId(), attribute.getValue(), serverCommand.getNewValue()); attribute.setValue(serverCommand.getNewValue()); return; }</code><technical_language>This warn</technical_language>

Target:
private void handleValueChangedCommand(final ValueChangedCommand serverCommand) { Attribute attribute = clientModelStore.findAttributeById(serverCommand.getAttributeId()); if (attribute == null) { LOG.warn("C: attribute with id '{}' not found, cannot update old value '{}' to new value '{}'", serverCommand.getAttributeId() ,serverCommand.getOldValue(), serverCommand.getNewValue() ); return; } if (attribute.getValue() == null && serverCommand.getNewValue() == null || (attribute.getValue() != null && serverCommand.getNewValue() != null && attribute.getValue().equals(serverCommand.getNewValue()))) { return; } if (strictMode && ((attribute.getValue() == null && serverCommand.getOldValue() != null) || (attribute.getValue() != null && serverCommand.getOldValue() == null) || (attribute.getValue() != null && !attribute.getValue().equals(serverCommand.getOldValue())))) { LOG.warn("C: attribute with id '{}' and value '{}' cannot be set to new value '{}' because the change was based on an outdated old value of '{}'.", serverCommand.getAttributeId(), attribute.getValue(), serverCommand.getNewValue(), serverCommand.getOldValue()); return; } LOG.trace("C: updating '{}' id '{}' from '{}' to '{}' ", attribute.getPropertyName(), serverCommand.getAttributeId(), attribute.getValue(), serverCommand.getNewValue()); attribute.setValue(serverCommand.getNewValue()); return; }
Source:
<code>public static void post(String urlString, InputStream payload, String contentType) throws NetworkException { HttpURLConnection conn = null; try { URL url = new URL(urlString); conn = (HttpURLConnection) url.openConnection(); conn.setDoOutput(true); conn.setChunkedStreamingMode(0); if(contentType != null) { conn.addRequestProperty("Content-Type", contentType); } OutputStream out = conn.getOutputStream(); byte[] buffer = new byte[1024]; int bytesRead; <START> while ((bytesRead = payload.read(buffer)) != -1) <END> { out.write(buffer, 0, bytesRead); } int status = conn.getResponseCode(); if(status / 100 != 2) { throw new BadResponseException(urlString, status); } } catch (IOException e) { throw new NetworkException(String.format("Network error when posting to %s", urlString), e); } finally { if(conn != null) { conn.disconnect(); } } }</code><technical_language>strange buffer this manually, built-in stream util do this</technical_language>

Target:
public static void post(String urlString, InputStream payload, String contentType) throws NetworkException { HttpURLConnection conn = null; try { URL url = new URL(urlString); conn = (HttpURLConnection) url.openConnection(); conn.setDoOutput(true); conn.setChunkedStreamingMode(0); if(contentType != null) { conn.addRequestProperty("Content-Type", contentType); } OutputStream out = null; try { out = conn.getOutputStream(); byte[] buffer = new byte[1024]; int bytesRead; while ((bytesRead = payload.read(buffer)) != -1) { out.write(buffer, 0, bytesRead); } } finally { if(out != null) { out.close(); } } int status = conn.getResponseCode(); if(status / 100 != 2) { throw new BadResponseException(urlString, status); } } catch (IOException e) { throw new NetworkException(String.format("Network error when posting to %s", urlString), e); } finally { if(conn != null) { conn.disconnect(); } } }
Source:
<code>private static int getClassHierarchyDistance(final Class<?> subtype, final Class<?> supertype) { if (subtype == supertype) { return 0; } if (subtype == Object.class) { <START> throw new IllegalArgumentException("Finished traversing hierarchy and found Object.class"); <END> } final Class<?> subSuperclass = subtype.getSuperclass(); return 1 + getClassHierarchyDistance(subSuperclass, supertype); }</code><technical_language>I wrong, this a bad of exceptions me; judging code (wrapping in empty catch blocks), is exceptional this, a "not found"</technical_language>

Target:
private static int getClassHierarchyDistance(final Class<?> subtype, final Class<?> supertype) { if (subtype == supertype) { return 0; } if (subtype == Object.class) { return Integer.MAX_VALUE; } final Class<?> subSuperclass = subtype.getSuperclass(); final int distance = getClassHierarchyDistance(subSuperclass, supertype); if (distance != Integer.MAX_VALUE) { return 1 + distance; } return Integer.MAX_VALUE; }
Source:
<code>} catch (SecurityException e) { <START> System.out.println(Messages.XULRunnerInitializer_Cannot_check_mozilla_profile_availability); <END> e.printStackTrace(); }</code><technical_language>log Eclipse</technical_language>

Target:
} catch (SecurityException e) { System.out.println(NLS.bind(Messages.XULRunnerInitializer_Cannot_check_mozilla_profile_availability, getMozillaEclipseProfilePath())); e.printStackTrace(); }
Source:
<code>public static void main(String[] args) throws IOException, InterruptedException, IllegalArgumentException { KeyAsyncClient keyAsyncClient = new KeyClientBuilder() .endpoint("https://{YOUR_VAULT_NAME}.vault.azure.net") .credential(new DefaultAzureCredentialBuilder().build()) .buildAsyncClient(); keyAsyncClient.createRsaKey(new RsaKeyCreateOptions("CloudRsaKey") .setExpires(OffsetDateTime.now().plusYears(1)) .setKeySize(2048)) .subscribe(keyResponse -> System.out.printf("Key is created with name %s and type %s \n", keyResponse.name(), keyResponse.getKeyMaterial().getKty())); Thread.sleep(2000); String backupFilePath = "YOUR_BACKUP_FILE_PATH"; keyAsyncClient.backupKey("CloudRsaKey").subscribe(backupResponse -> { byte[] backupBytes = backupResponse; writeBackupToFile(backupBytes, backupFilePath); }); Thread.sleep(7000); keyAsyncClient.deleteKey("CloudRsaKey").subscribe(deletedKeyResponse -> System.out.printf("Deleted Key's Recovery Id %s \n", deletedKeyResponse.getRecoveryId())); Thread.sleep(30000); keyAsyncClient.purgeDeletedKeyWithResponse("CloudRsaKey").subscribe(purgeResponse -> <START> System.out.printf("Purge Status response %d \n", purgeResponse.getStatusCode())); <END> Thread.sleep(15000); byte[] backupFromFile = Files.readAllBytes(new File(backupFilePath).toPath()); keyAsyncClient.restoreKey(backupFromFile).subscribe(keyResponse -> System.out.printf("Restored Key with name %s \n", keyResponse.name())); Thread.sleep(15000); }</code><technical_language>%n</technical_language>

Target:
public static void main(String[] args) throws IOException, InterruptedException, IllegalArgumentException { KeyAsyncClient keyAsyncClient = new KeyClientBuilder() .endpoint("https://{YOUR_VAULT_NAME}.vault.azure.net") .credential(new DefaultAzureCredentialBuilder().build()) .buildAsyncClient(); keyAsyncClient.createRsaKey(new RsaKeyCreateOptions("CloudRsaKey") .setExpires(OffsetDateTime.now().plusYears(1)) .setKeySize(2048)) .subscribe(keyResponse -> System.out.printf("Key is created with name %s and type %s %n", keyResponse.name(), keyResponse.getKeyMaterial().getKty())); Thread.sleep(2000); String backupFilePath = "YOUR_BACKUP_FILE_PATH"; keyAsyncClient.backupKey("CloudRsaKey").subscribe(backupResponse -> { byte[] backupBytes = backupResponse; writeBackupToFile(backupBytes, backupFilePath); }); Thread.sleep(7000); keyAsyncClient.deleteKey("CloudRsaKey").subscribe(deletedKeyResponse -> System.out.printf("Deleted Key's Recovery Id %s %n", deletedKeyResponse.getRecoveryId())); Thread.sleep(30000); keyAsyncClient.purgeDeletedKeyWithResponse("CloudRsaKey").subscribe(purgeResponse -> System.out.printf("Purge Status response %d %n", purgeResponse.getStatusCode())); Thread.sleep(15000); byte[] backupFromFile = Files.readAllBytes(new File(backupFilePath).toPath()); keyAsyncClient.restoreKey(backupFromFile).subscribe(keyResponse -> System.out.printf("Restored Key with name %s %n", keyResponse.name())); Thread.sleep(15000); }
Source:
<code>protected void encode( ChannelHandlerContext ctx, Message msg, List<Object> out ) { log.debug( "C: %s", msg ); ByteBuf messageBuf = ctx.alloc().ioBuffer(); output.start( messageBuf ); try { writer.write( msg ); output.stop(); } catch ( Throwable error ) { output.stop(); messageBuf.release(); throw new EncoderException( "Failed to write outbound message: " + msg, error ); } if ( log.isTraceEnabled() ) { <START> log.trace( "C: %s encoded as\n%s", msg, prettyHexDump( messageBuf ) ); <END> } out.add( messageBuf ); out.add( messageBoundary() ); }</code><technical_language>change this "C:\n%s" * is log.trace( "S:\n%s", prettyHexDump( msg ) ); * avoid printing message printed out in debug</technical_language>

Target:
protected void encode( ChannelHandlerContext ctx, Message msg, List<Object> out ) { log.debug( "C: %s", msg ); ByteBuf messageBuf = ctx.alloc().ioBuffer(); output.start( messageBuf ); try { writer.write( msg ); output.stop(); } catch ( Throwable error ) { output.stop(); messageBuf.release(); throw new EncoderException( "Failed to write outbound message: " + msg, error ); } if ( log.isTraceEnabled() ) { log.trace( "C:\n%s", prettyHexDump( messageBuf ) ); } out.add( messageBuf ); out.add( messageBoundary() ); }
Source:
<code>public static void setScenarioModifiers(AtBDynamicScenario scenario) { int numMods = Compute.randomInt(2); for(int x = 0; x < numMods; x++) { int scenarioIndex = Compute.randomInt(AtBScenarioModifier.getScenarioModifiers().size()); <START> AtBScenarioModifier scenarioMod = (AtBScenarioModifier) AtBScenarioModifier.getScenarioModifiers().values().toArray()[scenarioIndex]; <END> if((scenarioMod.getAllowedMapLocations() == null) || scenarioMod.getAllowedMapLocations().contains(scenario.getTemplate().mapParameters.getMapLocation())) { scenario.getScenarioModifiers().add(scenarioMod); if(scenarioMod.getBlockFurtherEvents() == true) { break; } } } }</code><technical_language>"fun", I realize numMods large, this feels off. hoist array of loop</technical_language>

Target:
public static void setScenarioModifiers(AtBDynamicScenario scenario) { int numMods = Compute.randomInt(2); for(int x = 0; x < numMods; x++) { AtBScenarioModifier scenarioMod = AtBScenarioModifier.getRandomScenarioModifier(); if((scenarioMod.getAllowedMapLocations() == null) || scenarioMod.getAllowedMapLocations().contains(scenario.getTemplate().mapParameters.getMapLocation())) { scenario.getScenarioModifiers().add(scenarioMod); if(scenarioMod.getBlockFurtherEvents() == true) { break; } } } }
Source:
<code>public synchronized String getDefaultLogFileFolder() { if (defaultLogFileDir == null) { if (checkCreateLogFileFolder(getString(KEY_LOGGING_LOGFILE_PATH, null))) return defaultLogFileDir; if (checkCreateLogFileFolder(System.getenv(ENV_LOG_PATH))) return defaultLogFileDir; if (Platform.isLinux()) <START> if (checkCreateLogFileFolder(DEFAILT_LOG_FOLDER_LINUX)) <END> return defaultLogFileDir; if (checkCreateLogFileFolder(PROFILE_DIRECTORY)) return defaultLogFileDir; try { final File tmpFolder=tempFolder.getTempFolder(); if (tmpFolder!=null) if (checkCreateLogFileFolder(tmpFolder.getAbsolutePath())) return defaultLogFileDir; } catch (IOException e) { LOGGER.trace("getDefaultLogFileFolder: could not get temp folder : {}", e.getMessage()); } defaultLogFileDir = ""; } return defaultLogFileDir; }</code><technical_language>set DEFAILT ? typo</technical_language>

Target:
public synchronized String getDefaultLogFileFolder() { if (defaultLogFileDir == null) { if (checkCreateLogFileFolder(getString(KEY_LOGGING_LOGFILE_PATH, null))) return defaultLogFileDir; if (checkCreateLogFileFolder(System.getenv(ENV_LOG_PATH))) return defaultLogFileDir; if (Platform.isLinux()) if (checkCreateLogFileFolder(DEFAULT_LOG_FOLDER_LINUX)) return defaultLogFileDir; if (checkCreateLogFileFolder(PROFILE_DIRECTORY)) return defaultLogFileDir; try { final File tmpFolder=tempFolder.getTempFolder(); if (tmpFolder!=null) if (checkCreateLogFileFolder(tmpFolder.getAbsolutePath())) return defaultLogFileDir; } catch (IOException e) { LOGGER.trace("getDefaultLogFileFolder: could not get temp folder : {}", e.getMessage()); } defaultLogFileDir = ""; } return defaultLogFileDir; }
Source:
<code>public FlowTypeTree FLOW_TYPE() { return b.<FlowTypeTree>nonterminal(EcmaScriptLexer.FLOW_TYPE) <START> .is(b.firstOf( <END> FLOW_FUNCTION_TYPE_OR_HIGHER() )); }</code><technical_language>@inverno remove "firstof"</technical_language>

Target:
public FlowTypeTree FLOW_TYPE() { return b.<FlowTypeTree>nonterminal(EcmaScriptLexer.FLOW_TYPE) .is(FLOW_FUNCTION_TYPE_OR_HIGHER()); }
Source:
<code>public SyndFeedInfo getFeedInfo(URL feedUrl) { try { String url = urlToString(feedUrl); FeedRecord record = feedRecordDataService.findByURL(url); if (record != null) { return feedRecordToFeedInfo(record); } } catch (IOException | ClassNotFoundException | FeedException ex) { <START> LOGGER.error(ex.getMessage(), ex); <END> } return null; }</code><technical_language>additionally add message, signal problem occured? Eg. "Error while retrieving object cache"</technical_language>

Target:
public SyndFeedInfo getFeedInfo(URL feedUrl) { try { String url = FeedCacheUtils.urlToString(feedUrl); FeedRecord record = feedRecordDataService.findByURL(url); if (record != null) { return FeedCacheUtils.feedRecordToFeedInfo(record); } } catch (IOException | ClassNotFoundException | FeedException ex) { LOGGER.error("Error reading FeedRecord from the database {}", ex.getMessage()); } return null; }
Source:
<code>public static DeclarationList fromString(String encoded) { return new DeclarationList( <START> Arrays.asList(encoded.split(",")).stream() <END> .map(VariableDeclaration::fromString) .collect(Collectors.toList())); }</code><technical_language>Arrays.asList().stream() replaced Arrays.stream()</technical_language>

Target:
public static DeclarationList fromString(String encoded) { return new DeclarationList( Arrays.stream(encoded.split(",")) .map(VariableDeclaration::fromString) .collect(Collectors.toList())); }
Source:
<code>void createTestDepartment(String name, String description, List<Person> members, List<Person> departmentHeads, List<Person> secondStageAuthorities) { Department department = new Department(); department.setName(name); department.setDescription(description); <START> department.setLastModification(ZonedDateTime.now(UTC).toLocalDate()); <END> department.setMembers(members); department.setDepartmentHeads(departmentHeads); department.setSecondStageAuthorities(secondStageAuthorities); if (!secondStageAuthorities.isEmpty()) { department.setTwoStageApproval(true); } departmentService.create(department); }</code><technical_language>LocalDate.now(UTC);</technical_language>

Target:
void createTestDepartment(String name, String description, List<Person> members, List<Person> departmentHeads, List<Person> secondStageAuthorities) { Department department = new Department(); department.setName(name); department.setDescription(description); department.setLastModification(LocalDate.now(UTC)); department.setMembers(members); department.setDepartmentHeads(departmentHeads); department.setSecondStageAuthorities(secondStageAuthorities); if (!secondStageAuthorities.isEmpty()) { department.setTwoStageApproval(true); } departmentService.create(department); }
Source:
<code>private String createText(String message, boolean success) { String textToSend = uuid + ": " + message; if (!success) { <START> textToSend = uuid + ": failed-" + message; <END> } return textToSend; }</code><technical_language>This rely user splitting :. a object instance variable encoded JSON</technical_language>

Target:
private String createText(String message, boolean success) { String textToSend = message; if (!success) { textToSend = "failed-" + message; } return textToSend; }
Source:
<code>public Object[] value(SearchHit hit) { Object[] value = super.value(hit); if (value.length == 0) { <START> return new Object[0]; <END> } if (value.length > 1) { throw new IllegalStateException("Unexpected values for a geo_point field: " + Arrays.toString(value)); } if (value[0] instanceof String) { value[0] = handleString((String) value[0]); } else { throw new IllegalStateException("Unexpected value type for a geo_point field: " + value[0].getClass()); } return value; }</code><technical_language>Theoretically save a memory allocation garbage collection return value;. Hotspot optimise this in practice. in other file</technical_language>

Target:
public Object[] value(SearchHit hit) { Object[] value = super.value(hit); if (value.length == 0) { return value; } if (value.length > 1) { throw new IllegalStateException("Unexpected values for a geo_point field: " + Arrays.toString(value)); } if (value[0] instanceof String) { value[0] = handleString((String) value[0]); } else { throw new IllegalStateException("Unexpected value type for a geo_point field: " + value[0].getClass()); } return value; }
Source:
<code>protected List<String> getProcessOutput(Process p) { List<String> lines = new ArrayList<String>(); if (p == null) { return lines; } InputStream in = p.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(in)); String line; try { while ((line = reader.readLine()) != null) { lines.add(line); } } catch (IOException ignore) { } return lines; <START> } <END></code><technical_language>Do concern loading full logs memory</technical_language>

Target:
protected List<String> getProcessOutput(Process p) { List<String> lines = new ArrayList<String>(); if (p == null) { return lines; } InputStream in = p.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(in)); String line; try { while ((line = reader.readLine()) != null) { if (lines.size() < 10000) { lines.add(line); } else { lines.add("(log output truncated)"); break; } } } catch (IOException e) { lines.add("Failed to read log output due to " + e.getClass().getName()); lines.add(e.getMessage()); } finally { try { reader.close(); } catch (IOException ignore) } return lines; }
Source:
<code><START> public boolean contains(Object o) { <END> return fInnerElements.containsValue(o); }</code><technical_language>special code for null (maybe comparing size of this vs. size of hash map)</technical_language>

Target:
public boolean contains(Object o) { return (o == null && size() > fInnerElements.size()) || fInnerElements.containsValue(o); }
Source:
<code>public boolean hasSpaceForSnapthosts(VM vm) { Map<storage_domains, Integer> map = mapStorageDomainsToNumOfDisks(vm); Integer minSnapshotSize = Config.<Integer> GetValue(ConfigValues.InitStorageSparseSizeInGB); for (storage_domains domain : map.keySet()) { if (!StorageDomainSpaceChecker.hasSpaceForRequest(domain, minSnapshotSize * map.get(domain))) { <START> log.error("not enough space to create snapshot on domain {0}" + domain.getId()); <END> return false; } } return true; }</code><technical_language>errorFormat instead error "...{0}",domain.getId" instead "{0}" + domain.getId()"</technical_language>

Target:
public boolean hasSpaceForSnapthosts(VM vm) { Map<storage_domains, Integer> map = mapStorageDomainsToNumOfDisks(vm); Integer minSnapshotSize = Config.<Integer> GetValue(ConfigValues.InitStorageSparseSizeInGB); for (storage_domains domain : map.keySet()) { if (!StorageDomainSpaceChecker.hasSpaceForRequest(domain, minSnapshotSize * map.get(domain))) { log.error("not enough space to create snapshot on domain " + domain.getId()); return false; } } return true; }
Source:
<code>CryptoJobHandler(int threadCount, long cryptoJobTimeoutMs, Time time) { this.cryptoJobTimeoutMs = cryptoJobTimeoutMs; enabled.set(true); <START> scheduler = Executors.newFixedThreadPool(threadCount); <END> this.time = time; }</code><technical_language>minor: change this variable name executor, a plain ExecutorService instead of a ScheduledExecutorService</technical_language>

Target:
CryptoJobHandler(int threadCount, long cryptoJobTimeoutMs, Time time) { this.cryptoJobTimeoutMs = cryptoJobTimeoutMs; enabled.set(true); executor = Executors.newFixedThreadPool(threadCount); this.time = time; }
Source:
<code>public int compareTo(@Nullable ISegment o) { if (o == null) { throw new IllegalArgumentException(); } <START> Comparator<ISegment> comparator = Ordering <END> .from(SegmentComparators.INTERVAL_START_COMPARATOR) .compound(SegmentComparators.INTERVAL_END_COMPARATOR) .compound(Ordering.usingToString()); return comparator.compare(this, o); }</code><technical_language>final static</technical_language>

Target:
public int compareTo(@Nullable ISegment o) { if (o == null) { throw new IllegalArgumentException(); } return COMPARATOR.compare(this, o); }
Source:
<code>protected boolean sendDataOut(SimpleBinaryItemData data) { if (LINE_STABILIZATION_TIME > 0) { while (Math.abs(System.currentTimeMillis() - receiveTime) <= LINE_STABILIZATION_TIME) { try { Thread.sleep(10); } catch (InterruptedException e) { <START> e.printStackTrace(); <END> } } } if (logger.isDebugEnabled()) { logger.debug("Port - Sending data to device with length bytes", this.deviceID, data.getDeviceId(), data.getData().length); logger.debug("Port - data: {}", this.deviceID, SimpleBinaryProtocol.arrayToString(data.getData(), data.getData().length)); } if (compareAndSetWaitingForAnswer()) { try { if (this.forceRTS) { if (logger.isDebugEnabled()) { logger.debug("Port - RTS set", this.deviceID); } sentTimeTicks = System.currentTimeMillis() + (((data.getData().length * 8) + 4) * 1000 / this.baud); serialPort.setRTS(invertedRTS ? false : true); } outputStream.write(data.getData()); outputStream.flush(); setLastSentData(data); } catch (IOException e) { logger.error("Port - Error while writing", this.deviceID); reconnect(); return false; } return true; } else { if (logger.isDebugEnabled()) { logger.debug("Port - Sending data to device discarted. Another send/wait is processed.", this.deviceID, data.getDeviceId()); } return false; } }</code><technical_language>a logger statement</technical_language>

Target:
protected boolean sendDataOut(SimpleBinaryItemData data) { if (!this.connected) { logger.debug("{} - Port is closed. Try to reopen."); if (!this.open()) { logger.warn("{} - Port is closed. Unable to send data to device {}.", this.toString(), data.getDeviceId()); return false; } } if (LINE_STABILIZATION_TIME > 0) { while (Math.abs(System.currentTimeMillis() - receiveTime) <= LINE_STABILIZATION_TIME) { try { Thread.sleep(10); } catch (InterruptedException e) { } } } if (logger.isDebugEnabled()) { logger.debug("{} - Sending data to device with length bytes", this.toString(), data.getDeviceId(), data.getData().length); logger.debug("{} - data: {}", this.toString(), SimpleBinaryProtocol.arrayToString(data.getData(), data.getData().length)); } if (compareAndSetWaitingForAnswer()) { try { if (this.forceRTS) { if (logger.isDebugEnabled()) { logger.debug("{} - RTS set", this.toString()); } sentTimeTicks = System.currentTimeMillis() + (((data.getData().length * 8) + 4) * 1000 / this.baud); serialPort.setRTS(invertedRTS ? false : true); } outputStream.write(data.getData()); outputStream.flush(); setLastSentData(data); } catch (Exception e) { logger.error("{} - Error while writing", this.toString()); reconnect(); return false; } return true; } else { if (logger.isDebugEnabled()) { logger.debug("{} - Sending data to device discarted. Another send/wait is processed.", this.toString(), data.getDeviceId()); } return false; } }
Source:
<code>public void testToDate() throws Exception { DateFormat dateFormat = DateUtils .createDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); assertEquals("2008-11-04 00:00:00.000", dateFormat.format(TimeComparator.toDate("08-11-04"))); assertEquals("2010-09-21 14:06:00.000", dateFormat.format(TimeComparator.toDate("2010-09-21 14:06"))); assertEquals("2010-09-21 14:06:13.000", dateFormat.format(TimeComparator.toDate("2010-09-21 14:06:13"))); assertEquals("2010-09-21 14:06:13.009", dateFormat.format(TimeComparator .toDate("2010-09-21 14:06:13.009"))); assertEquals("2000-12-31 02:30:05.100", dateFormat.format(TimeComparator .toDate("2000-12-31 02:30:05.100"))); assertEquals("Fri Jan 04 15:55:51 CET 2013", <START> TimeComparator.toDate("2013-01-04T15:55:51.217+01:00").toString()); <END> }</code><technical_language>This fail in Travis</technical_language>

Target:
public void testToDate() throws Exception { DateFormat dateFormat = DateUtils .createDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); assertEquals("2008-11-04 00:00:00.000", dateFormat.format(TimeComparator.toDate("08-11-04"))); assertEquals("2010-09-21 14:06:00.000", dateFormat.format(TimeComparator.toDate("2010-09-21 14:06"))); assertEquals("2010-09-21 14:06:13.000", dateFormat.format(TimeComparator.toDate("2010-09-21 14:06:13"))); assertEquals("2010-09-21 14:06:13.009", dateFormat.format(TimeComparator .toDate("2010-09-21 14:06:13.009"))); assertEquals("2000-12-31 02:30:05.100", dateFormat.format(TimeComparator .toDate("2000-12-31 02:30:05.100"))); }
Source:
<code>public Pair<String, String> get(RuntimeIdentity runtimeIdentity) throws InfrastructureException { <START> if (wsAgentCorsAllowCredentials == null) { <END> return null; } else { return Pair.of("CHE_WSAGENT_CORS_ALLOW__CREDENTIALS", wsAgentCorsAllowCredentials); } }</code><technical_language>return wsAgentCorsAllowCredentials != null?Pair.of("CHE_WSAGENT_CORS_ALLOW__CREDENTIALS", wsAgentCorsAllowCredentials):null</technical_language>

Target:
public Pair<String, String> get(RuntimeIdentity runtimeIdentity) throws InfrastructureException { return wsAgentCorsAllowCredentials == null ? null : Pair.of("CHE_WSAGENT_CORS_ALLOW__CREDENTIALS", wsAgentCorsAllowCredentials); }
Source:
<code>static CompletionStage<ImmutableMap<ReportFormat, RenderedReport>> renderAll( final Injector injector, final ImmutableSet<ReportFormat> formats, final ReportSource source, final Instant scheduled ) { <START> final Map<ReportFormat, RenderedReport> result = Maps.newHashMap(); END> final CompletableFuture<?>[] resultSettingFutures = formats .stream() .map(format -> render(injector, source, format, scheduled) .thenApply(rendered -> result.put(format, rendered)) .toCompletableFuture()) .toArray(CompletableFuture[]::new); return CompletableFuture.allOf(resultSettingFutures).thenApply(nothing -> ImmutableMap.copyOf(result)); }</code><technical_language>Yes. populating map concurrently result of render future is executed. guarantees synchronous access map</technical_language>

Target:
static CompletionStage<ImmutableMap<ReportFormat, RenderedReport>> renderAll( final Injector injector, final ImmutableSet<ReportFormat> formats, final ReportSource source, final Instant scheduled ) { final Map<ReportFormat, RenderedReport> result = Maps.newConcurrentMap(); final CompletableFuture<?>[] resultSettingFutures = formats .stream() .map(format -> getRenderer(injector, source, format) .render(source, format, scheduled) .thenApply(rendered -> result.put(format, rendered)) .toCompletableFuture()) .toArray(CompletableFuture[]::new); return CompletableFuture.allOf(resultSettingFutures).thenApply(nothing -> ImmutableMap.copyOf(result)); }
Source:
<code>public Rule Reserved() { <START> return FirstOf( Aggregate(), Find(), FindOne(), FindAndModify(), Insert(), Remove(), Update(), Count() ); <END> }</code><technical_language>add end instead of beginning. common other operations</technical_language>

Target:
public Rule Reserved() { return FirstOf( Find(), FindOne(), FindAndModify(), Insert(), Remove(), Update(), Count(), Aggregate() ); }
Source:
<code>public void removeFromInstanceSet(final Object keyClass, final EObject value) { final Set<EObject> set = instanceMap.get(keyClass); if (set != null) { if(!set.remove(value)) { <START> String msg = String.format("Notification received to remove %s as a %s, but feature was not indexed. This indicates some errors in underlying model representation.", value, keyClass); <END> logNotificationHandlingError(msg); } if (set.isEmpty()) { instanceMap.remove(keyClass); } } isDirty = true; navigationHelper.notifyInstanceListeners(keyClass, value, false); }</code><technical_language>"feature indexed" is a copy-paste bug here</technical_language>

Target:
public void removeFromInstanceSet(final Object keyClass, final EObject value) { final Set<EObject> set = instanceMap.get(keyClass); if (set != null) { if(!set.remove(value)) { String msg = String.format("Notification received to remove %s as a %s, but it is missing from the index. This indicates some errors in underlying model representation.", value, keyClass); logNotificationHandlingError(msg); } if (set.isEmpty()) { instanceMap.remove(keyClass); } } isDirty = true; navigationHelper.notifyInstanceListeners(keyClass, value, false); }
Source:
<code>public void activateProcessInstanceCmdExecutorTest() { ActivateProcessInstanceCmd activateProcessInstanceCmd = new ActivateProcessInstanceCmd("x"); <START> assertThat(activateProcessInstanceCmdExecutor).isNotNull(); <END> assertThat(activateProcessInstanceCmdExecutor.getHandledType()).isEqualTo(ActivateProcessInstanceCmd.class); activateProcessInstanceCmdExecutor.execute(activateProcessInstanceCmd); verify(processEngine).activate(activateProcessInstanceCmd); verify(commandResults).send(ArgumentMatchers.<Message<ActivateProcessInstanceResults>>any()); }</code><technical_language>This assert is necessary activateProcessInstanceCmdExecutor null instantiated Mockito</technical_language>

Target:
public void activateProcessInstanceCmdExecutorTest() { ActivateProcessInstanceCmd activateProcessInstanceCmd = new ActivateProcessInstanceCmd("x"); assertThat(activateProcessInstanceCmdExecutor.getHandledType()).isEqualTo(ActivateProcessInstanceCmd.class); activateProcessInstanceCmdExecutor.execute(activateProcessInstanceCmd); verify(processEngine).activate(activateProcessInstanceCmd); verify(commandResults).send(ArgumentMatchers.<Message<ActivateProcessInstanceResults>>any()); }
Source:
<code>private String composeSwitchLocation() { if (switchView.isSwitchToTrunk()) { return projectUri + "/trunk"; } else if (switchView.isSwitchToBranch()) { <START> return projectUri + "/branches/" + (isNullOrEmpty(switchView.getSwitchToLocation()) ? "" : switchView.getSwitchToLocation()); <END> } else if (switchView.isSwitchToTag()) { return projectUri + "/tags/" + (isNullOrEmpty(switchView.getSwitchToLocation()) ? "" : switchView.getSwitchToLocation()); } else { return switchView.getLocation(); } }</code><technical_language>move switchView.getSwitchToLocation() var in case 4 times</technical_language>

Target:
private String composeSwitchLocation() { if (switchView.isSwitchToTrunk()) { return projectUri + "/trunk"; } else { String switchToLocation = switchView.getSwitchToLocation(); if (switchView.isSwitchToBranch()) { return projectUri + "/branches/" + (isNullOrEmpty(switchToLocation) ? "" : switchToLocation); } else if (switchView.isSwitchToTag()) { return projectUri + "/tags/" + (isNullOrEmpty(switchToLocation) ? "" : switchToLocation); } else { return switchView.getLocation(); } } }
Source:
<code>private ResponseErrors parseResponseErrors(HttpResponse response) { ResponseErrors responseErrors = null; if (response.getEntity() != null) { try { String responseEntity = EntityUtils.toString(response.getEntity()); LOGGER.debug(responseEntity); responseErrors = JsonParser.DEFAULT.parse(responseEntity, ResponseErrors.class); } catch (IOException e) { <START> e.printStackTrace(); <END> } catch (ParseException e) { e.printStackTrace(); } } return responseErrors; }</code><technical_language>LOGGER here</technical_language>

Target:
private ResponseErrors parseResponseErrors(HttpResponse response) { ResponseErrors responseErrors = null; if (response.getEntity() != null) { try { String responseEntity = EntityUtils.toString(response.getEntity()); LOGGER.debug(responseEntity); responseErrors = JsonParser.DEFAULT.parse(responseEntity, ResponseErrors.class); } catch (IOException ex) { LOGGER.error("IOException", ex); } catch (ParseException ex) { LOGGER.error("ParseException", ex); } } return responseErrors; }
Source:
<code>public View onCreateView(@NonNull final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { View v = inflater.inflate(R.layout.select_playlist_fragment, container, false); recyclerView = v.findViewById(R.id.items_list); recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); SelectPlaylistAdapter playlistAdapter = new SelectPlaylistAdapter(); recyclerView.setAdapter(playlistAdapter); progressBar = v.findViewById(R.id.progressBar); emptyView = v.findViewById(R.id.empty_state_view); progressBar.setVisibility(View.VISIBLE); recyclerView.setVisibility(View.GONE); emptyView.setVisibility(View.GONE); final AppDatabase database = NewPipeDatabase.getInstance(this.getContext()); LocalPlaylistManager localPlaylistManager = new LocalPlaylistManager(database); RemotePlaylistManager remotePlaylistManager = new RemotePlaylistManager(database); Flowable.combineLatest(localPlaylistManager.getPlaylists(), remotePlaylistManager.getPlaylists(), PlaylistItemsUtils::merge) .toObservable() .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) <START> .subscribe(getPlaylistsObserver()); <END> return v; }</code><technical_language>do .subscribe(this::displayPlaylists, this::onError) (I test that). store Disposable returns dispose in onDestroy()</technical_language>

Target:
public View onCreateView(@NonNull final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { final View v = inflater.inflate(R.layout.select_playlist_fragment, container, false); recyclerView = v.findViewById(R.id.items_list); recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); SelectPlaylistAdapter playlistAdapter = new SelectPlaylistAdapter(); recyclerView.setAdapter(playlistAdapter); progressBar = v.findViewById(R.id.progressBar); emptyView = v.findViewById(R.id.empty_state_view); progressBar.setVisibility(View.VISIBLE); recyclerView.setVisibility(View.GONE); emptyView.setVisibility(View.GONE); final AppDatabase database = NewPipeDatabase.getInstance(requireContext()); final LocalPlaylistManager localPlaylistManager = new LocalPlaylistManager(database); final RemotePlaylistManager remotePlaylistManager = new RemotePlaylistManager(database); playlistsSubscriber = Flowable.combineLatest(localPlaylistManager.getPlaylists(), remotePlaylistManager.getPlaylists(), PlaylistLocalItem::merge) .subscribe(this::displayPlaylists, this::onError); return v; }
Source:
<code>public void onPartitionsAssigned(final Collection<TopicPartition> assignedPartitions) { switch (taskManager.rebalanceProtocol()) { case EAGER: <START> eagerOnPartitionsAssigned(assignedPartitions); <END> break; case COOPERATIVE: cooperativeOnPartitionsAssigned(assignedPartitions); break; } }</code><technical_language>rely rebalance protocol setRebalanceProtocol in task manager determine logic, a rebalance, send supported protocol EAGER protocol is --- leader protocol is assignment. moment is impossible listener protocol (not protocol supported); other hand I feel is necessary well: If COOPERATIVE protocol is used, effectively suspend tasks in onPartitionRevoked, immediately close suspended tasks in onPartitionsAssigned called consecutively in onJoinComplete, resumed (i.e. resumeSuspended call no-op passed in task parameters). suggest listener agnostic rebalance protocol, follow current logic of suspending resuming, if in releases remove suspending/resuming of protocols</technical_language>

Target:
public void onPartitionsAssigned(final Collection<TopicPartition> assignedPartitions) { log.debug("Current state {}: assigned partitions at the end of consumer rebalance.\n" + "\tpreviously assigned active tasks: {}\n" + "\tpreviously assigned standby tasks: {}\n", streamThread.state(), assignedPartitions, taskManager.previousActiveTaskIds(), taskManager.previousStandbyTaskIds()); if (streamThread.getAssignmentErrorCode() == AssignorError.INCOMPLETE_SOURCE_TOPIC_METADATA.code()) { log.error("Received error code - shutdown", streamThread.getAssignmentErrorCode()); streamThread.shutdown(); return; } final long start = time.milliseconds(); List<TopicPartition> revokedStandbyPartitions = null; try { if (streamThread.setState(State.PARTITIONS_ASSIGNED) == null) { log.debug( "Skipping task creation in rebalance because we are already in state.", streamThread.state() ); } else if (streamThread.getAssignmentErrorCode() != AssignorError.NONE.code()) { log.debug( "Encountered assignment error during partition assignment: {}. Skipping task initialization", streamThread.getAssignmentErrorCode() ); } else { revokedStandbyPartitions = taskManager.closeRevokedStandbyTasks(); taskManager.closeRevokedSuspendedTasks(); taskManager.createTasks(assignedPartitions); } } catch (final Throwable t) { log.error( "Error caught during partition assignment, " + "will abort the current process and re-throw at the end of rebalance", t); streamThread.setRebalanceException(t); } finally { if (revokedStandbyPartitions != null) { streamThread.clearStandbyRecords(revokedStandbyPartitions); } log.info("partition assignment took ms.\n" + "\tcurrently assigned active tasks: {}\n" + "\tcurrently assigned standby tasks: {}\n" + "\trevoked active tasks: {}\n" + "\trevoked standby tasks: {}\n", time.milliseconds() - start, taskManager.activeTaskIds(), taskManager.standbyTaskIds(), taskManager.revokedActiveTaskIds(), taskManager.revokedStandbyTaskIds()); } }
Source:
<code><START> public Tuple destruct() { <END> LinkedList<T> vals = new LinkedList<>(); for (T v : this) { vals.add(v); } return Tuple.fromArray(vals.toArray()); }</code><technical_language>making array right start, avoid a LinkedList</technical_language>

Target:
public Tuple destruct() { Object[] data = new Object[this.size()]; int i = 0; for (T v : this) { data[i] = v; i++; } return Tuple.fromArray(data); }
Source:
<code>private Set<String> getStringSet(String key) { String prefSetting = getIndexer().getProperty(key); <START> if (prefSetting != null && prefSetting.length() > 0) { <END> return new HashSet<String>(Arrays.asList(prefSetting.split(","))); } return Collections.emptySet(); }</code><technical_language>Better: prefSetting != null && !prefSetting.isEmpty()</technical_language>

Target:
private Set<String> getStringSet(String key) { String prefSetting = getIndexer().getProperty(key); if (prefSetting != null && !prefSetting.isEmpty()) { return new HashSet<String>(Arrays.asList(prefSetting.split(","))); } return Collections.emptySet(); }
Source:
<code>public static AmazonEC2Client createAmazonEC2Mock(@Nullable Answer defaultAnswer) { AmazonEC2Client mock; if (defaultAnswer != null) { mock = Mockito.mock(AmazonEC2Client.class, defaultAnswer); } else { <START> mock = Mockito.mock(AmazonEC2Client.class); <END> mockDescribeRegions(mock); mockDescribeInstances(mock); mockDescribeImages(mock); mockDescribeKeyPairs(mock); mockDescribeSecurityGroups(mock); mockDescribeSubnets(mock); mockRunInstances(mock); mockTerminateInstances(mock); } return mock; }</code><technical_language>Nit: static imports for Mockito methods</technical_language>

Target:
public static AmazonEC2Client createAmazonEC2Mock(@Nullable Answer defaultAnswer) { AmazonEC2Client mock; if (defaultAnswer != null) { mock = mock(AmazonEC2Client.class, defaultAnswer); } else { mock = mock(AmazonEC2Client.class); mockDescribeRegions(mock); mockDescribeInstances(mock); mockDescribeImages(mock); mockDescribeKeyPairs(mock); mockDescribeSecurityGroups(mock); mockDescribeSubnets(mock); mockRunInstances(mock); mockTerminateInstances(mock); } return mock; }
Source:
<code>public void recognizeMultipageBusinessCardUrl(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerClient(httpClient, serviceVersion); urlRunner(sourceUrl -> { SyncPoller<FormRecognizerOperationResult, List<RecognizedForm>> syncPoller = client.beginRecognizeBusinessCardsFromUrl(sourceUrl, new RecognizeBusinessCardsOptions() <START> .setContentType(FormContentType.APPLICATION_PDF) <END> .setFieldElementsIncluded(true) .setPollInterval(durationTestMode), Context.NONE); syncPoller.waitForCompletion(); validateMultipageBusinessData(syncPoller.getFinalResult()); }, MULTIPAGE_BUSINESS_CARD_PDF); }</code><technical_language>if recognize url, content-type application/json</technical_language>

Target:
public void recognizeMultipageBusinessCardUrl(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerClient(httpClient, serviceVersion); urlRunner(sourceUrl -> { SyncPoller<FormRecognizerOperationResult, List<RecognizedForm>> syncPoller = client.beginRecognizeBusinessCardsFromUrl(sourceUrl, new RecognizeBusinessCardsOptions() .setFieldElementsIncluded(true) .setPollInterval(durationTestMode), Context.NONE); syncPoller.waitForCompletion(); validateMultipageBusinessData(syncPoller.getFinalResult()); }, MULTIPAGE_BUSINESS_CARD_PDF); }