auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private BinaryContent getBinaryContentFromZip(String filePath) throws CatalogTransformerException { BinaryContent binaryContent; InputStream fileInputStream; File zipFile = new File(filePath); try { fileInputStream = new ZipInputStream(new FileInputStream(zipFile)); binaryContent = new BinaryContentImpl(fileInputStream); } catch (FileNotFoundException e) { throw new CatalogTransformerException("Unable to get ZIP file from ZipInputStream.", e); } jarSigner.signJar( zipFile, System.getProperty(SystemBaseUrl.EXTERNAL_HOST), AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty("javax.net.ssl.keyStorePassword")), AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty("javax.net.ssl.keyStore")), AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty("javax.net.ssl.keyStorePassword"))); return binaryContent; }

Target:
private BinaryContent getBinaryContentFromZip(String filePath) throws CatalogTransformerException { BinaryContent binaryContent; InputStream fileInputStream; File zipFile = new File(filePath); try { fileInputStream = new ZipInputStream(new FileInputStream(zipFile)); binaryContent = new BinaryContentImpl(fileInputStream); } catch (FileNotFoundException e) { throw new CatalogTransformerException("Unable to get ZIP file from ZipInputStream.", e); } jarSigner.signJar( zipFile, AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty(SystemBaseUrl.EXTERNAL_HOST)), AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty("javax.net.ssl.keyStorePassword")), AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty("javax.net.ssl.keyStore")), AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty("javax.net.ssl.keyStorePassword"))); return binaryContent; }
Source:
private void generateNewPassword(U userAccount) { assertNotNew(userAccount); if (!userAccount.getUserAccountData().isPasswordGenerationPossible()) { throw Exceptions.createHandled() .withNLSKey("UserAccountConroller.cannotGeneratePasswordForOwnUser") .handle(); } userAccount.getUserAccountData().getLogin().forceGenerationOfPassword(null); userAccount.getMapper().update(userAccount); auditLog.neutral("AuditLog.passwordGenerated") .causedByCurrentUser() .forUser(userAccount.getUniqueName(), userAccount.getUserAccountData().getLogin().getUsername()) .forTenant(String.valueOf(userAccount.getTenant().getId()), userAccount.getTenant().getValue().getTenantData().getName()) .log(); }

Target:
private void generateNewPassword(U userAccount) { assertNotNew(userAccount); if (!userAccount.getUserAccountData().isPasswordGenerationPossible()) { throw Exceptions.createHandled() .withNLSKey("UserAccountConroller.cannotGeneratePasswordForOwnUser") .handle(); } userAccount.getUserAccountData().getLogin().forceGenerationOfPassword(); userAccount.getMapper().update(userAccount); auditLog.neutral("AuditLog.passwordGenerated") .causedByCurrentUser() .forUser(userAccount.getUniqueName(), userAccount.getUserAccountData().getLogin().getUsername()) .forTenant(String.valueOf(userAccount.getTenant().getId()), userAccount.getTenant().getValue().getTenantData().getName()) .log(); }
Source:
protected List<String> getTimeZoneOptionsAsHtml(ZoneId existingTimeZone) { List<ZoneId> options = TimeHelper.getTimeZoneValues(); ArrayList<String> result = new ArrayList<>(); for (ZoneId timeZoneOption : options) { result.add("<option value=\"" + timeZoneOption.toString() + "\"" + (existingTimeZone.equals(timeZoneOption) ? " selected" : "") + ">" + "(" + timeZoneOption.toString() + ") " + TimeHelper.getCitiesForTimeZone(timeZoneOption) + "</option>"); } return result; }

Target:
protected List<String> getTimeZoneOptionsAsHtml(ZoneId existingTimeZone) { List<ZoneId> options = TimeHelper.getTimeZoneValues(); ArrayList<String> result = new ArrayList<>(); for (ZoneId timeZoneOption : options) { result.add("<option value=\"" + timeZoneOption.getId() + "\"" + (existingTimeZone.equals(timeZoneOption) ? " selected" : "") + ">" + "(" + timeZoneOption.getId() + ") " + TimeHelper.getCitiesForTimeZone(timeZoneOption) + "</option>"); } return result; }
Source:
private static Exception classifyException(Exception e) { if (e instanceof TApplicationException) { return new PrestoException(THRIFT_GENERIC_REMOTE_SERVER_ERROR, "Exception raised by a remote thrift server", e); } return e; }

Target:
private static Exception classifyException(Exception e) { if (e instanceof TApplicationException) { return new PrestoException(THRIFT_SERVICE_GENERIC_REMOTE_ERROR, "Exception raised by a remote thrift server", e); } return e; }
Source:
public void testNotLinkedToExternalNetworkNegative() { Network externalNetwork = new Network(); externalNetwork.setName(EXTERNAL_NETWORK_NAME); when(network.getId()).thenReturn(DEFAULT_GUID); when(networkDao.getAllExternalNetworksLinkedToPhysicalNetwork(eq(DEFAULT_GUID))).thenReturn(Collections.singletonList( externalNetwork)); assertThat(validator.notLinkedToExternalNetwork(), failsWith(EngineMessage.ACTION_TYPE_FAILED_CANNOT_REMOVE_PHYSICAL_NETWORK_LINKED_TO_EXTERNAL_NETWORK)); }

Target:
public void testNotLinkedToExternalNetworkNegative() { Network externalNetwork = new Network(); externalNetwork.setName(EXTERNAL_NETWORK_NAME); List<Network> externalNetworkList = Collections.singletonList(externalNetwork); String linkedExternalNetworkNames = externalNetworkList.stream() .map(Network::getName) .collect(joining(", ")); when(network.getId()).thenReturn(DEFAULT_GUID); when(networkDao.getAllExternalNetworksLinkedToPhysicalNetwork(eq(DEFAULT_GUID))).thenReturn(externalNetworkList); assertThat(validator.notLinkedToExternalNetwork(), failsWith(EngineMessage.ACTION_TYPE_FAILED_CANNOT_REMOVE_PHYSICAL_NETWORK_LINKED_TO_EXTERNAL_NETWORK, ReplacementUtils.createSetVariableString(NetworkValidator.NETWORK_LIST_REPLACEMENT, linkedExternalNetworkNames))); }
Source:
public static void setupProducts() { removeProducts(); final AttributeDefinition colorAttributeDefinition = AttributeDefinitionBuilder .of(COLOR, LocalizedStrings.ofEnglishLocale(COLOR), new TextType()).build(); final AttributeDefinition sizeAttributeDefinition = AttributeDefinitionBuilder .of(SIZE, LocalizedStrings.ofEnglishLocale(SIZE), new TextType()).build(); final ProductTypeDraft productTypeDraft = ProductTypeDraft.of(TEST_CLASS_NAME, "", asList(colorAttributeDefinition, sizeAttributeDefinition)); final ProductTypeCreateCommand productTypeCreateCommand = ProductTypeCreateCommand.of(productTypeDraft); productType = execute(productTypeCreateCommand); testProduct1 = createTestProduct(productType, "Schuh", "shoe", "red", "M"); testProduct2 = createTestProduct(productType, "Hemd", "shirt", "blue", "XL"); final SearchDsl<ProductProjection> search = ProductProjectionSearch.of(STAGED).withSort(SORT_CREATED_AT_DESC); execute(search, res -> { final List<String> ids = toIds(res.getResults()); return ids.contains(testProduct1.getId()) && ids.contains(testProduct2.getId()); }); try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } }

Target:
public static void setupProducts() { removeProducts(); final AttributeDefinition colorAttributeDefinition = AttributeDefinitionBuilder .of(COLOR, LocalizedStrings.ofEnglishLocale(COLOR), TextType.of()).build(); final AttributeDefinition sizeAttributeDefinition = AttributeDefinitionBuilder .of(SIZE, LocalizedStrings.ofEnglishLocale(SIZE), TextType.of()).build(); final ProductTypeDraft productTypeDraft = ProductTypeDraft.of(TEST_CLASS_NAME, "", asList(colorAttributeDefinition, sizeAttributeDefinition)); final ProductTypeCreateCommand productTypeCreateCommand = ProductTypeCreateCommand.of(productTypeDraft); productType = execute(productTypeCreateCommand); testProduct1 = createTestProduct(productType, "Schuh", "shoe", "red", "M"); testProduct2 = createTestProduct(productType, "Hemd", "shirt", "blue", "XL"); final SearchDsl<ProductProjection> search = ProductProjectionSearch.of(STAGED).withSort(SORT_CREATED_AT_DESC); execute(search, res -> { final List<String> ids = toIds(res.getResults()); return ids.contains(testProduct1.getId()) && ids.contains(testProduct2.getId()); }); try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } }
Source:
public void testFields() { assertTrue(postModel.toString().equals("<Post id: 0 title: Test Post posted_at_millis: 100 user_id: 1 updated_at: 0>")); assertTrue(userModel.toString().equals("<User id: 0 handle: handle created_at_millis: 0 num_posts: 0 some_date: 0 some_datetime: 0 bio: bio some_binary: null some_float: 0.0 some_decimal: 0.0 some_boolean: true>")); try { postModel.getField("fake_field"); fail("Non-existent field should have thrown exception on get"); } catch (IllegalStateException e) { } try { postModel.setField("fake_field", null); fail("Non-existent field should have thrown exception on set"); } catch (IllegalStateException e) { } assertFalse(postModel.hasField("fake_field")); assertTrue(postModel.hasField("title")); try { postModel.setField("title", "New Title"); assertEquals(postModel.getField("title"), "New Title"); } catch (IllegalStateException e) { e.printStackTrace(); fail("Field not found when it should have been"); } try { postModel.setField("title", 3); fail("Should have had class cast exception assigning int to string field"); } catch (ClassCastException e) { } }

Target:
public void testFields() { try { postModel.getField("fake_field"); fail("Non-existent field should have thrown exception on get"); } catch (IllegalStateException e) { } try { postModel.setField("fake_field", null); fail("Non-existent field should have thrown exception on set"); } catch (IllegalStateException e) { } assertFalse(postModel.hasField("fake_field")); assertTrue(postModel.hasField("title")); try { postModel.setField("title", "New Title"); assertEquals(postModel.getField("title"), "New Title"); } catch (IllegalStateException e) { e.printStackTrace(); fail("Field not found when it should have been"); } try { postModel.setField("title", 3); fail("Should have had class cast exception assigning int to string field"); } catch (ClassCastException e) { } }
Source:
public void PyramidTest() { ITmfStateSystemBuilder fixture = createFixture(); int parentQuark = fixture.getQuarkAbsoluteAndAdd(PROCESS_PATH, THREAD_PATH, CALLSTACK_PATH); int quark = fixture.getQuarkRelativeAndAdd(parentQuark, QUARK_0); TmfStateValue statev = TmfStateValue.newValueLong(0); fixture.modifyAttribute(0, TmfStateValue.nullValue(), quark); fixture.modifyAttribute(10, statev, quark); fixture.modifyAttribute(20, TmfStateValue.nullValue(), quark); quark = fixture.getQuarkRelativeAndAdd(parentQuark, QUARK_1); statev = TmfStateValue.newValueLong(1); fixture.modifyAttribute(0, TmfStateValue.nullValue(), quark); fixture.modifyAttribute(5, statev, quark); fixture.modifyAttribute(25, TmfStateValue.nullValue(), quark); quark = fixture.getQuarkRelativeAndAdd(parentQuark, QUARK_2); statev = TmfStateValue.newValueLong(2); fixture.modifyAttribute(0, statev, quark); fixture.modifyAttribute(30, TmfStateValue.nullValue(), quark); fixture.closeHistory(1002); CGAnalysis cga = new CGAnalysis(); testPyramidStore(fixture, cga); }

Target:
public void PyramidTest() { ITmfStateSystemBuilder fixture = createFixture(); buildPyramidCallStack(fixture); CGAnalysis cga = new CGAnalysis(); assertTrue(cga.iterateOverStateSystem(fixture, tp, pp, csp, new NullProgressMonitor())); ISegmentStore<@NonNull ISegment> segmentStore = cga.getSegmentStore(); assertNotNull(segmentStore); Object[] segments = segmentStore.toArray(); CalledFunction f1 = (CalledFunction) segments[0]; assertEquals("Number of segments Found", 1, segments.length, ERROR); assertEquals("Callees number", 0, f1.getChildren().size(), ERROR); assertEquals("Function's self time", 10, f1.getSelfTime(), ERROR); assertEquals("Compare the function's self time and total time", f1.getLength(), f1.getSelfTime(), ERROR); assertEquals("Function's depth", 0, f1.getDepth(), ERROR); }
Source:
private static File getFileFromZip(File file) { File fileFromZip = null; String pathString = file.getPath(); String zipFile = pathString.substring(pathString.indexOf(":") + 1, pathString.indexOf("!")); String filePathInsideZip = pathString.split("!")[1].substring(1); byte[] buffer = new byte[1024]; try { File outputDir = Files.createTempDirectory("robolectric_assets").toFile(); ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFile)); ZipEntry ze = zis.getNextEntry(); while (ze != null) { String currentFilename = ze.getName(); if (!currentFilename.equals(filePathInsideZip)) { ze = zis.getNextEntry(); continue; } fileFromZip = new File(outputDir + File.separator + currentFilename); new File(fileFromZip.getParent()).mkdirs(); FileOutputStream fos = new FileOutputStream(fileFromZip); int len; while ((len = zis.read(buffer)) > 0) { fos.write(buffer, 0, len); } fos.close(); break; } zis.closeEntry(); zis.close(); } catch (IOException e) { e.printStackTrace(); } return fileFromZip; }

Target:
private static File getFileFromZip(File file) { File fileFromZip = null; String pathString = file.getPath(); String zipFile = pathString.substring(pathString.indexOf(":") + 1, pathString.indexOf("!")); String filePathInsideZip = pathString.split("!")[1].substring(1); byte[] buffer = new byte[1024]; try { File outputDir = Files.createTempDirectory("robolectric_assets").toFile(); ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFile)); ZipEntry ze = zis.getNextEntry(); while (ze != null) { String currentFilename = ze.getName(); if (!currentFilename.equals(filePathInsideZip)) { ze = zis.getNextEntry(); continue; } fileFromZip = new File(outputDir + File.separator + currentFilename); new File(fileFromZip.getParent()).mkdirs(); FileOutputStream fos = new FileOutputStream(fileFromZip); int len; while ((len = zis.read(buffer)) > 0) { fos.write(buffer, 0, len); } fos.close(); break; } zis.closeEntry(); zis.close(); } catch (IOException e) { throw new RuntimeException(e); } return fileFromZip; }
Source:
private void finalizeShutdown() { this.selectionManager.shutdown(); this.clientPinger.shutdown(); PAFuture.waitFor(this.monitoring.shutdown()); PAActiveObject.terminateActiveObject(false); try { Thread.sleep(2000); synchronized (nodeRM) { nodeRM.notifyAll(); shutedDown = true; } if (!PAResourceManagerProperties.RM_SHUTDOWN_KILL_RUNTIME.isSet() || PAResourceManagerProperties.RM_SHUTDOWN_KILL_RUNTIME.getValueAsBoolean()) this.nodeRM.getProActiveRuntime().killRT(true); } catch (Exception e) { logger.debug("", e); } }

Target:
private void finalizeShutdown() { this.selectionManager.shutdown(); this.clientPinger.shutdown(); PAFuture.waitFor(this.monitoring.shutdown()); PAActiveObject.terminateActiveObject(false); try { Thread.sleep(2000); synchronized (nodeRM) { nodeRM.notifyAll(); shutedDown = true; } if (PAResourceManagerProperties.RM_SHUTDOWN_KILL_RUNTIME.getValueAsBoolean()) this.nodeRM.getProActiveRuntime().killRT(true); } catch (Exception e) { logger.debug("", e); } }
Source:
public ProcessStatus check() { boolean success = false; Transact inputTransact = inputDock.pullTransact(); if (inputTransact != null) { queue.offer(inputTransact); success = true; } Transact outputTransact = queue.peek(); if (outputTransact != null) { if (outputDock.pushTransact(outputTransact)) { queue.remove(); success = true; } } return success ? ProcessStatus.SUCCESS : ProcessStatus.NOTHING_TO_DO; }

Target:
public BlockStatus check() { Transact inputTransact = inputDock.pullTransact(); if (inputTransact != null) { queue.offer(inputTransact); System.out.println(Simulator.getTime() + " queue added " + inputTransact.getNumber()); return BlockStatus.SUCCESS; } Transact outputTransact = queue.peek(); if (outputTransact != null) { if (!outputDock.hasTransact()) { queue.remove(); System.out.println(Simulator.getTime() + " queue removed " + outputTransact.getNumber()); outputDock.pushTransact(outputTransact); return BlockStatus.SUCCESS; } } return BlockStatus.NOTHING_TO_DO; }
Source:
public Page<DiscussionComment> call() throws Exception { final List<String> requestedFields; { if (environment.getConfig().isDiscussionProfilePicturesEnabled()) { requestedFields = Collections.singletonList( DiscussionRequestFields.PROFILE_IMAGE.getQueryParamValue()); } else { requestedFields = Collections.EMPTY_LIST; } } return environment.getDiscussionAPI().getCommentsList(responseId, PAGE_SIZE, page, requestedFields); }

Target:
public Page<DiscussionComment> call() throws Exception { return environment.getDiscussionAPI().getCommentsList(responseId, PAGE_SIZE, page, DiscussionRequestFields.getRequestedFieldsList(environment.getConfig())); }
Source:
public void onSupportActionModeStarted(ActionMode mode) { if (mSelectionModeActive == true && selectedTextView != null) { mSelectionModeActive = false; mActionMode = mode; Menu menu = mode.getMenu(); mode.getMenuInflater().inflate(R.menu.details_context, menu); menu.findItem(R.id.menu_copy).setVisible(false); menu.findItem(R.id.menu_cache_share_field).setOnMenuItemClickListener(new TextMenuItemClickListener()); menu.findItem(R.id.menu_translate_to_sys_lang).setOnMenuItemClickListener(new TextMenuItemClickListener()); menu.findItem(R.id.menu_translate_to_english).setOnMenuItemClickListener(new TextMenuItemClickListener()); buildDetailsContextMenu(mode, menu, res.getString(R.string.cache_description), false); selectedTextView.setWindowFocusWait(true); } super.onSupportActionModeStarted(mode); }

Target:
public void onSupportActionModeStarted(ActionMode mode) { if (selectionModeActive && selectedTextView != null) { selectionModeActive = false; mActionMode = mode; Menu menu = mode.getMenu(); mode.getMenuInflater().inflate(R.menu.details_context, menu); menu.findItem(R.id.menu_copy).setVisible(false); menu.findItem(R.id.menu_cache_share_field).setOnMenuItemClickListener(new TextMenuItemClickListener()); menu.findItem(R.id.menu_translate_to_sys_lang).setOnMenuItemClickListener(new TextMenuItemClickListener()); menu.findItem(R.id.menu_translate_to_english).setOnMenuItemClickListener(new TextMenuItemClickListener()); buildDetailsContextMenu(mode, menu, res.getString(R.string.cache_description), false); selectedTextView.setWindowFocusWait(true); } super.onSupportActionModeStarted(mode); }
Source:
public void reapEntries(final Date reapingDate) { sqlDao.inTransaction(new Transaction<Void, QueueSqlDao<T>>() { @Override public Void inTransaction(final QueueSqlDao<T> transactional, final TransactionStatus status) throws Exception { final Date now = clock.getUTCNow().toDate(); final List<T> entriesLeftBehind = sqlDao.getEntriesLeftBehind(config.getMaxReDispatchCount(), now, reapingDate, config.getTableName()); if (entriesLeftBehind.size() > 0) { final Iterable<T> entriesToMove = Iterables.transform(entriesLeftBehind, new Function<T, T>() { @Nullable @Override public T apply(@Nullable final T entry) { set(entry, "processingState", PersistentQueueEntryLifecycleState.REAPED); return entry; } }); moveEntriesToHistoryFromTransaction(transactional, entriesToMove); for (T entry : entriesLeftBehind) { set(entry, "creatingOwner", CreatorName.get()); set(entry, "createdDate", clock.getUTCNow()); set(entry, "processingState", PersistentQueueEntryLifecycleState.AVAILABLE); insertEntryFromTransaction(transactional, entry); } log.warn(String.format( "%s %s entries were reaped by %s",DB_QUEUE_LOG_ID ,entriesLeftBehind.size(), CreatorName.get())); } return null; } private void set(T entry, String fieldName, Object value) { Class clazz = entry.getClass(); Field field = null; try { field = clazz.getDeclaredField(fieldName); field.setAccessible(true); field.set(entry, value); } catch (NoSuchFieldException e) { } catch (IllegalAccessException e) { } } }); }

Target:
public void reapEntries(final Date reapingDate) { sqlDao.inTransaction(new Transaction<Void, QueueSqlDao<T>>() { @Override public Void inTransaction(final QueueSqlDao<T> transactional, final TransactionStatus status) throws Exception { final DateTime now = clock.getUTCNow(); final List<T> entriesLeftBehind = sqlDao.getEntriesLeftBehind(config.getMaxReDispatchCount(), now.toDate(), reapingDate, config.getTableName()); if (entriesLeftBehind.size() > 0) { final Iterable<T> entriesToMove = Iterables.transform(entriesLeftBehind, new Function<T, T>() { @Nullable @Override public T apply(@Nullable final T entry) { entry.setProcessingState(PersistentQueueEntryLifecycleState.REAPED); return entry; } }); moveEntriesToHistoryFromTransaction(transactional, entriesToMove); for (T entry : entriesLeftBehind) { entry.setCreatedDate(now); entry.setProcessingState(PersistentQueueEntryLifecycleState.AVAILABLE); entry.setCreatingOwner(CreatorName.get()); insertEntryFromTransaction(transactional, entry); } log.warn(String.format( "{} entries were reaped by {}",DB_QUEUE_LOG_ID ,entriesLeftBehind.size(), CreatorName.get())); } return null; } }); }
Source:
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); cfg.setSslContextFactory(createSslFactory()); ConnectorConfiguration conCfg = new ConnectorConfiguration(); conCfg.setSslEnabled(true); conCfg.setSslClientAuth(true); cfg.setConnectorConfiguration(conCfg); CacheConfiguration ccfg = new CacheConfiguration(TEST_CACHE_NAME); cfg.setCacheConfiguration(ccfg); return cfg; }

Target:
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); cfg.setSslContextFactory(createSslFactory()); cfg.setConnectorConfiguration(new ConnectorConfiguration() .setSslEnabled(true) .setSslClientAuth(true)); cfg.setCacheConfiguration(new CacheConfiguration(TEST_CACHE_NAME)); return cfg; }
Source:
public void setShippingMethodTaxAmount() throws Exception { withShippingMethodForGermany(client(), shippingMethod -> { withCustomLineItemFilledCartWithTaxMode(client(), TaxMode.EXTERNAL_AMOUNT, cart -> { final Cart cartWithShippingMethod = client().executeBlocking(CartUpdateCommand.of(cart, SetShippingMethod.of(shippingMethod))); final ExternalTaxRateDraft taxRate = ExternalTaxRateDraftBuilder .ofAmount(1.0, "Test Tax", CountryCode.DE) .build(); final MonetaryAmount totalGross = MoneyImpl.ofCents(1000, EUR); final ExternalTaxAmountDraftDsl taxAmountDraft = ExternalTaxAmountDraftBuilder .of(totalGross, taxRate) .build(); final SetShippingMethodTaxAmount setShippingMethodTaxAmount = SetShippingMethodTaxAmount.of(taxAmountDraft); final Cart updatedCart = client().executeBlocking(CartUpdateCommand.of(cartWithShippingMethod, setShippingMethodTaxAmount)); return updatedCart; }); }); }

Target:
public void setShippingMethodTaxAmount() throws Exception { withShippingMethodForGermany(client(), shippingMethod -> { withCustomLineItemFilledCartWithTaxMode(client(), TaxMode.EXTERNAL_AMOUNT, cart -> { final Cart cartWithShippingMethod = client().executeBlocking(CartUpdateCommand.of(cart, SetShippingMethod.of(shippingMethod))); assertThat(cartWithShippingMethod.getShippingInfo()).isNotNull(); assertThat(cartWithShippingMethod.getShippingInfo().getTaxedPrice()).isNull(); final ExternalTaxRateDraft taxRate = ExternalTaxRateDraftBuilder .ofAmount(1.0, "Test Tax", CountryCode.DE) .build(); final MonetaryAmount totalGross = MoneyImpl.ofCents(100000, EUR); final ExternalTaxAmountDraftDsl taxAmountDraft = ExternalTaxAmountDraftBuilder .of(totalGross, taxRate) .build(); final SetShippingMethodTaxAmount setShippingMethodTaxAmount = SetShippingMethodTaxAmount.of(taxAmountDraft); final Cart updatedCart = client().executeBlocking(CartUpdateCommand.of(cartWithShippingMethod, setShippingMethodTaxAmount)); final TaxedItemPrice taxedPrice = updatedCart.getShippingInfo().getTaxedPrice(); assertThat(taxedPrice.getTotalGross()).isEqualTo(totalGross); return updatedCart; }); }); }
Source:
public BooleanWrapper removeNodeSource(String sourceName, boolean preempt) { NodeSource removedNodeSource; if (deployedNodeSources.containsKey(sourceName)) { removedNodeSource = deployedNodeSources.get(sourceName); caller.checkPermission(removedNodeSource.getAdminPermission(), caller + " is not authorized to remove " + sourceName); logger.info(caller + " requested removal of node source " + sourceName); removeAllNodes(sourceName, preempt); removedNodeSource.shutdown(caller); dbManager.removeNodeSource(sourceName); return new BooleanWrapper(true); } else if (undeployedNodeSources.containsKey(sourceName)) { removedNodeSource = undeployedNodeSources.remove(sourceName); caller.checkPermission(removedNodeSource.getAdminPermission(), caller + " is not authorized to remove " + sourceName); logger.info(caller + " requested removal of undeployed node source " + sourceName); dbManager.removeNodeSource(sourceName); this.monitoring.nodeSourceEvent(new RMNodeSourceEvent(RMEventType.NODESOURCE_REMOVED, caller.getName(), removedNodeSource.getName(), removedNodeSource.getDescription(), removedNodeSource.getAdministrator().getName(), removedNodeSource.getDescriptor() .getStatus() .toString())); return new BooleanWrapper(true); } else { throw new IllegalArgumentException("Unknown node source " + sourceName); } }

Target:
public BooleanWrapper removeNodeSource(String sourceName, boolean preempt) { NodeSource nodeSourceToRemove; if (this.deployedNodeSources.containsKey(sourceName)) { nodeSourceToRemove = this.deployedNodeSources.get(sourceName); caller.checkPermission(nodeSourceToRemove.getAdminPermission(), caller + " is not authorized to remove " + sourceName); logger.info(caller + " requested removal of node source " + sourceName); removeAllNodes(sourceName, preempt); nodeSourceToRemove.shutdown(caller); dbManager.removeNodeSource(sourceName); return new BooleanWrapper(true); } else if (this.undeployedNodeSources.containsKey(sourceName)) { nodeSourceToRemove = this.undeployedNodeSources.get(sourceName); caller.checkPermission(nodeSourceToRemove.getAdminPermission(), caller + " is not authorized to remove " + sourceName); logger.info(caller + " requested removal of undeployed node source " + sourceName); this.undeployedNodeSources.remove(sourceName); dbManager.removeNodeSource(sourceName); this.monitoring.nodeSourceEvent(new RMNodeSourceEvent(RMEventType.NODESOURCE_REMOVED, caller.getName(), nodeSourceToRemove.getName(), nodeSourceToRemove.getDescription(), nodeSourceToRemove.getAdministrator().getName(), nodeSourceToRemove.getDescriptor() .getStatus() .toString())); return new BooleanWrapper(true); } else { throw new IllegalArgumentException("Unknown node source " + sourceName); } }
Source:
public void onPreInit(FMLPreInitializationEvent event) { try { registerService(ChunkLoadService.class, new SpongeChunkLoadService()); SpongeBootstrap.initializeServices(); SpongeBootstrap.preInitializeRegistry(); SpongeSerializationRegistry.setupSerialization(Sponge.getGame()); SpongeForgeModuleRegistry.registerForgeData(); SpongeModMessageHandler.init(); Class<?> clazz = Class.forName("org.spongepowered.api.entity.ai.task.AbstractAITask"); 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); } }

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:
public void testCalculateNewArraySize() { int size = 1; 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; } }

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:
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= fPreferenceStore.getBoolean(ComparePreferencePage.TOGGLE_LEFT_AND_RIGHT); setProperty(ComparePreferencePage.TOGGLE_LEFT_AND_RIGHT, Boolean.valueOf(b)); } }

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:
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; strValue = getStringValue(expectedType, val); encoded = strValue.getBytes(StandardCharsets.UTF_8); }

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:
private void handleValueChangedCommand(final ValueChangedCommand serverCommand) { Attribute attribute = clientModelStore.findAttributeById(serverCommand.getAttributeId()); if (attribute == null) { LOG.debug("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.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; }

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:
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; while ((bytesRead = payload.read(buffer)) != -1) { 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(); } } }

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:
private static int getClassHierarchyDistance(final Class<?> subtype, final Class<?> supertype) { if (subtype == supertype) { return 0; } if (subtype == Object.class) { throw new IllegalArgumentException("Finished traversing hierarchy and found Object.class"); } final Class<?> subSuperclass = subtype.getSuperclass(); return 1 + getClassHierarchyDistance(subSuperclass, supertype); }

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:
} catch (SecurityException e) { System.out.println(Messages.XULRunnerInitializer_Cannot_check_mozilla_profile_availability); e.printStackTrace(); }

Target:
} catch (SecurityException e) { System.out.println(NLS.bind(Messages.XULRunnerInitializer_Cannot_check_mozilla_profile_availability, getMozillaEclipseProfilePath())); e.printStackTrace(); }
Source:
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); }

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:
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: %s encoded as\n%s", msg, prettyHexDump( messageBuf ) ); } out.add( messageBuf ); out.add( messageBoundary() ); }

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:
public void run() { double quantile = routerConfig.routerLatencyToleranceQuantile; for (Map.Entry<Resource, CachedHistogram> resourceToHistogram : getBlobLocalDcResourceToLatency.entrySet()) { Resource resource = resourceToHistogram.getKey(); Histogram histogram = resourceToHistogram.getValue(); logger.debug("{} GetBlob local DC latency histogram {}th percentile in ms: {}", resource.toString(), quantile * 100, histogram.getSnapshot().getValue(quantile)); } for (Map.Entry<Resource, CachedHistogram> resourceToHistogram : getBlobCrossDcResourceToLatency.entrySet()) { Resource resource = resourceToHistogram.getKey(); Histogram histogram = resourceToHistogram.getValue(); logger.trace("{} GetBlob cross DC latency histogram {}th percentile in ms: {}", resource.toString(), quantile * 100, histogram.getSnapshot().getValue(quantile)); } for (Map.Entry<Resource, CachedHistogram> resourceToHistogram : getBlobInfoLocalDcResourceToLatency.entrySet()) { Resource resource = resourceToHistogram.getKey(); Histogram histogram = resourceToHistogram.getValue(); logger.debug("{} GetBlobInfo local DC latency histogram {}th percentile in ms: {}", resource.toString(), quantile * 100, histogram.getSnapshot().getValue(quantile)); } for (Map.Entry<Resource, CachedHistogram> resourceToHistogram : getBlobInfoCrossDcResourceToLatency.entrySet()) { Resource resource = resourceToHistogram.getKey(); Histogram histogram = resourceToHistogram.getValue(); logger.trace("{} GetBlobInfo cross DC latency histogram {}th percentile in ms: {}", resource.toString(), quantile * 100, histogram.getSnapshot().getValue(quantile)); } }

Target:
public void run() { double percentile = routerConfig.routerLatencyToleranceQuantile * 100; for (Map.Entry<Resource, CachedHistogram> resourceToHistogram : getBlobLocalDcResourceToLatency.entrySet()) { Resource resource = resourceToHistogram.getKey(); CachedHistogram histogram = resourceToHistogram.getValue(); logger.debug("{} GetBlob local DC latency histogram {}th percentile in ms: {}", resource.toString(), percentile, histogram.getCachedValue()); } for (Map.Entry<Resource, CachedHistogram> resourceToHistogram : getBlobCrossDcResourceToLatency.entrySet()) { Resource resource = resourceToHistogram.getKey(); CachedHistogram histogram = resourceToHistogram.getValue(); logger.trace("{} GetBlob cross DC latency histogram {}th percentile in ms: {}", resource.toString(), percentile, histogram.getCachedValue()); } for (Map.Entry<Resource, CachedHistogram> resourceToHistogram : getBlobInfoLocalDcResourceToLatency.entrySet()) { Resource resource = resourceToHistogram.getKey(); CachedHistogram histogram = resourceToHistogram.getValue(); logger.debug("{} GetBlobInfo local DC latency histogram {}th percentile in ms: {}", resource.toString(), percentile, histogram.getCachedValue()); } for (Map.Entry<Resource, CachedHistogram> resourceToHistogram : getBlobInfoCrossDcResourceToLatency.entrySet()) { Resource resource = resourceToHistogram.getKey(); CachedHistogram histogram = resourceToHistogram.getValue(); logger.trace("{} GetBlobInfo cross DC latency histogram {}th percentile in ms: {}", resource.toString(), percentile, histogram.getCachedValue()); } }
Source:
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()); AtBScenarioModifier scenarioMod = (AtBScenarioModifier) AtBScenarioModifier.getScenarioModifiers().values().toArray()[scenarioIndex]; if((scenarioMod.getAllowedMapLocations() == null) || scenarioMod.getAllowedMapLocations().contains(scenario.getTemplate().mapParameters.getMapLocation())) { scenario.getScenarioModifiers().add(scenarioMod); if(scenarioMod.getBlockFurtherEvents() == true) { break; } } } }

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:
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(DEFAILT_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; }

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:
public FlowTypeTree FLOW_TYPE() { return b.<FlowTypeTree>nonterminal(EcmaScriptLexer.FLOW_TYPE) .is(b.firstOf( FLOW_FUNCTION_TYPE_OR_HIGHER() )); }

Target:
public FlowTypeTree FLOW_TYPE() { return b.<FlowTypeTree>nonterminal(EcmaScriptLexer.FLOW_TYPE) .is(FLOW_FUNCTION_TYPE_OR_HIGHER()); }
Source:
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) { LOGGER.error(ex.getMessage(), ex); } return null; }

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:
public static DeclarationList fromString(String encoded) { return new DeclarationList( Arrays.asList(encoded.split(",")).stream() .map(VariableDeclaration::fromString) .collect(Collectors.toList())); }

Target:
public static DeclarationList fromString(String encoded) { return new DeclarationList( Arrays.stream(encoded.split(",")) .map(VariableDeclaration::fromString) .collect(Collectors.toList())); }