auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected static void createEmbeddedNode() throws IOException { ElasticSearchEmbeddedServerConfig config = new ElasticSearchEmbeddedServerConfig(); config.setHttpEnabled(true); config.setClusterName("nuxeoESClientCluster"); config.setIndexStorageType("mmapfs"); config.setNodeName("nuxeoESClientTestNode"); config.setDataPath(folder.newFolder().getAbsolutePath()); config.setHomePath(folder.newFolder().getAbsolutePath()); System.out.println(config); embeddedNode = new ElasticSearchEmbeddedNode(config); embeddedNode.start(); }

Target:
protected static void createEmbeddedNode() throws IOException { ElasticSearchEmbeddedServerConfig config = new ElasticSearchEmbeddedServerConfig(); config.setHttpEnabled(true); config.setClusterName("nuxeoESClientCluster"); config.setIndexStorageType("mmapfs"); config.setNodeName("nuxeoESClientTestNode"); config.setDataPath(folder.newFolder().getAbsolutePath()); config.setHomePath(folder.newFolder().getAbsolutePath()); embeddedNode = new ElasticSearchEmbeddedNode(config); embeddedNode.start(); }
Source:
public TestCassandraDistributed() { super(CassandraQueryRunner::createCassandraQueryRunner, FeatureSelection.all().excludes(VIEW)); }

Target:
public TestCassandraDistributed() { super(allFeatures().excluding( ADD_COLUMN, DROP_COLUMN, RENAME_COLUMN, RENAME_TABLE, VIEW, DELETE_DATA, CREATE_TABLE, DATE_TYPE), CassandraQueryRunner::createCassandraQueryRunner); }
Source:
private void runFirehose(Firehose firehose) { final Period intermediatePersistPeriod = config.getIntermediatePersistPeriod(); long nextFlush = new DateTime().plus(intermediatePersistPeriod).getMillis(); while (firehose.hasMore()) { InputRow inputRow = null; try { try { inputRow = firehose.nextRow(); } catch (Exception e) { log.debug(e, "thrown away line due to exception, considering unparseable"); metrics.incrementUnparseable(); continue; } boolean lateEvent = false; boolean indexLimitExceeded = false; try { lateEvent = plumber.add(inputRow) == -1; } catch (IndexSizeExceededException e) { log.info("Index limit exceeded: %s", e.getMessage()); indexLimitExceeded = true; } if (indexLimitExceeded || lateEvent) { metrics.incrementThrownAway(); log.debug("Throwing away event[%s]", inputRow); if (indexLimitExceeded || System.currentTimeMillis() > nextFlush) { plumber.persist(firehose.commit()); nextFlush = new DateTime().plus(intermediatePersistPeriod).getMillis(); } continue; } final Sink sink = plumber.getSink(inputRow.getTimestampFromEpoch()); if ((sink != null && !sink.canAppendRow()) || System.currentTimeMillis() > nextFlush) { plumber.persist(firehose.commit()); nextFlush = new DateTime().plus(intermediatePersistPeriod).getMillis(); } metrics.incrementProcessed(); } catch (ParseException e) { if (inputRow != null) { log.error(e, "unparseable line: %s", inputRow); } metrics.incrementUnparseable(); } } }

Target:
private void runFirehose(Firehose firehose) { final Period intermediatePersistPeriod = config.getIntermediatePersistPeriod(); long nextFlush = new DateTime().plus(intermediatePersistPeriod).getMillis(); while (firehose.hasMore()) { InputRow inputRow = null; try { try { inputRow = firehose.nextRow(); if (inputRow == null) { log.debug("thrown away null input row, considering unparseable"); log.info("thrown away null input row, considering unparseable"); metrics.incrementUnparseable(); continue; } } catch (Exception e) { log.debug(e, "thrown away line due to exception, considering unparseable"); metrics.incrementUnparseable(); continue; } boolean lateEvent = false; boolean indexLimitExceeded = false; try { lateEvent = plumber.add(inputRow) == -1; } catch (IndexSizeExceededException e) { log.info("Index limit exceeded: %s", e.getMessage()); indexLimitExceeded = true; } if (indexLimitExceeded || lateEvent) { metrics.incrementThrownAway(); log.debug("Throwing away event[%s]", inputRow); if (indexLimitExceeded || System.currentTimeMillis() > nextFlush) { plumber.persist(firehose.commit()); nextFlush = new DateTime().plus(intermediatePersistPeriod).getMillis(); } continue; } final Sink sink = plumber.getSink(inputRow.getTimestampFromEpoch()); if ((sink != null && !sink.canAppendRow()) || System.currentTimeMillis() > nextFlush) { plumber.persist(firehose.commit()); nextFlush = new DateTime().plus(intermediatePersistPeriod).getMillis(); } metrics.incrementProcessed(); } catch (ParseException e) { if (inputRow != null) { log.error(e, "unparseable line: %s", inputRow); } metrics.incrementUnparseable(); } } }
Source:
public ExtensionJobList getExtensionJobs( @PathParam("extension-name") String extensionName, @DefaultValue(ASCENDING_SORT_ORDER) @QueryParam("sortOrder") String sortOrder, @DefaultValue("") @QueryParam("doAs") String doAsUser) { checkIfExtensionServiceIsEnabled(); if (extensionName != null) { getExtensionIfExists(extensionName); } try { return super.getExtensionJobs(extensionName, sortOrder, doAsUser); } catch (Throwable e) { LOG.error("Failed to get extension job list of " + extensionName + ": ", e); throw FalconWebException.newAPIException(e, Response.Status.INTERNAL_SERVER_ERROR); } }

Target:
public ExtensionJobList getExtensionJobs( @PathParam("extension-name") String extensionName, @DefaultValue(ASCENDING_SORT_ORDER) @QueryParam("sortOrder") String sortOrder, @DefaultValue("") @QueryParam("doAs") String doAsUser) { checkIfExtensionServiceIsEnabled(); if (StringUtils.isNotBlank(extensionName)) { getExtensionIfExists(extensionName); } try { return super.getExtensionJobs(extensionName, sortOrder, doAsUser); } catch (Throwable e) { LOG.error("Failed to get extension job list of " + extensionName + ": ", e); throw FalconWebException.newAPIException(e, Response.Status.INTERNAL_SERVER_ERROR); } }
Source:
protected Agent doGetRemoteAgent(URL url) throws AgentException { File agent = null; try { agent = downloadFile(new File(System.getProperty("java.io.tmpdir")), "agent", ".tmp", url); String json = readAndCloseQuietly(new FileInputStream(agent)); return DtoFactory.getInstance().createDtoFromJson(json, AgentDto.class); } catch (IOException | IllegalArgumentException e) { throw new AgentException("Can't fetch agent configuration", e); } finally { if (agent != null) { FileCleaner.addFile(agent); } } }

Target:
protected Agent doGetRemoteAgent(URL url) throws AgentException { File agent = null; try { agent = downloadFile(new File(System.getProperty("java.io.tmpdir")), "agent", ".tmp", url); String json = readAndCloseQuietly(new FileInputStream(agent)); return DtoFactory.getInstance().createDtoFromJson(json, AgentDto.class); } catch (IOException | IllegalArgumentException e) { throw new AgentException("Can't fetch agent configuration", e); } finally { if (agent != null) { try { Files.delete(agent.toPath()); } catch (IOException e) { FileCleaner.addFile(agent); } } } }
Source:
public void deleteAllOldNonConformityStatistics() throws EntityRetrievalException { String hql = "UPDATE NonconformityTypeStatisticsEntity SET deleted = true WHERE deleted = false"; Query query = entityManager.createQuery(hql); query.executeUpdate(); }

Target:
public void deleteAllOldNonConformityStatistics() throws EntityRetrievalException { String hql = "UPDATE NonconformityTypeStatisticsEntity SET deleted = true, lastModifiedUser = " + getUserId(SYSTEM_USER_ID) + " WHERE deleted = false"; Query query = entityManager.createQuery(hql); query.executeUpdate(); }
Source:
public void testAssistForUnknownButConnectedType() throws CoreException, InvocationTargetException, IOException, InterruptedException { List<CompletionItem> items = new ArrayList<>(); items.add(createCompletionItem("FirstClass", CompletionItemKind.Class)); MockLanguageServer.INSTANCE.setCompletionList(new CompletionList(true, items)); IFile testFile = TestUtils.createUniqueTestFileOfUnknownType(project, ""); ITextViewer viewer = TestUtils.openTextViewer(testFile); LanguageServerDefinition serverDefinition = LanguageServersRegistry.getInstance().getDefinition("org.eclipse.lsp4e.test.server"); assertNotNull(serverDefinition); IPath fileLocation = testFile.getLocation(); LanguageServerWrapper lsWrapperForConnection = LanguageServiceAccessor .getLSWrapperForConnection(testFile.getProject(), serverDefinition, fileLocation); lsWrapperForConnection.connect(testFile, null); new DisplayHelper() { @Override protected boolean condition() { return lsWrapperForConnection.isConnectedTo(fileLocation); } }.waitForCondition(Display.getCurrent(), 3000); ICompletionProposal[] proposals = contentAssistProcessor.computeCompletionProposals(viewer, 0); assertEquals(items.size(), proposals.length); LSIncompleteCompletionProposal LSIncompleteCompletionProposal = (LSIncompleteCompletionProposal) proposals[0]; LSIncompleteCompletionProposal.apply(viewer.getDocument()); assertEquals(new Point("FirstClass".length(), 0), LSIncompleteCompletionProposal.getSelection(viewer.getDocument())); }

Target:
public void testAssistForUnknownButConnectedType() throws CoreException, InvocationTargetException, IOException, InterruptedException { List<CompletionItem> items = new ArrayList<>(); items.add(createCompletionItem("FirstClass", CompletionItemKind.Class)); MockLanguageServer.INSTANCE.setCompletionList(new CompletionList(true, items)); IFile testFile = TestUtils.createUniqueTestFileOfUnknownType(project, ""); ITextViewer viewer = TestUtils.openTextViewer(testFile); LanguageServerDefinition serverDefinition = LanguageServersRegistry.getInstance().getDefinition("org.eclipse.lsp4e.test.server"); assertNotNull(serverDefinition); IPath fileLocation = testFile.getLocation(); LanguageServerWrapper lsWrapperForConnection = LanguageServiceAccessor .getLSWrapperForConnection(testFile.getProject(), serverDefinition); lsWrapperForConnection.connect(testFile, null); new DisplayHelper() { @Override protected boolean condition() { return lsWrapperForConnection.isConnectedTo(fileLocation); } }.waitForCondition(Display.getCurrent(), 3000); ICompletionProposal[] proposals = contentAssistProcessor.computeCompletionProposals(viewer, 0); assertEquals(items.size(), proposals.length); LSIncompleteCompletionProposal LSIncompleteCompletionProposal = (LSIncompleteCompletionProposal) proposals[0]; LSIncompleteCompletionProposal.apply(viewer.getDocument()); assertEquals(new Point("FirstClass".length(), 0), LSIncompleteCompletionProposal.getSelection(viewer.getDocument())); }
Source:
private void trySleep(long millis) { try { Thread.sleep(millis); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } }

Target:
private void trySleep(long millis) { try { Thread.sleep(millis); } catch (InterruptedException e) { } }
Source:
public void patch( @NotNull(message = "json can't be NULL") final JsonObject json ) throws IOException { final Issue.Smart smart = new Issue.Smart(this); final boolean wasopen = smart.isOpen(); new JsonPatch(this.storage).patch(this.xpath(), json); final boolean nowopen = smart.isOpen(); if (nowopen != wasopen) { final String type; if (nowopen) { type = Event.REOPENED; } else { type = Event.CLOSED; } new MkIssueEvents(this.storage, this.self, this.coords) .create(type, this.num, this.self, Optional.<String>absent()); } }

Target:
public void patch( @NotNull(message = "json can't be NULL") final JsonObject json ) throws IOException { final Issue.Smart smart = new Issue.Smart(this); final boolean was = smart.isOpen(); new JsonPatch(this.storage).patch(this.xpath(), json); final boolean now = smart.isOpen(); if (now != was) { final String type; if (now) { type = Event.REOPENED; } else { type = Event.CLOSED; } new MkIssueEvents(this.storage, this.self, this.coords) .create(type, this.num, this.self, Optional.<String>absent()); } }
Source:
public static final boolean isValid(Phone phone) { try { PhoneNumber phoneNumber = PHONE_UTIL.parse(phone.getNumber(), phone.getRegionCode()); return PHONE_UTIL.isValidNumber(phoneNumber); } catch (Exception e) { } return false; }

Target:
public static final boolean isValid(Phone phone) { checkNotNull(phone); try { PhoneNumber phoneNumber = PHONE_UTIL.parse(phone.getNumber(), phone.getRegionCode()); return PHONE_UTIL.isValidNumber(phoneNumber); } catch (NumberParseException e) { } return false; }
Source:
public void analyze() { Stack<Integer> ignoreBlockBeginStack = new Stack<>(); for (Token comment : singleLineComments) { int lineNumber = comment.getLine(); String trimmedComment = comment.getText().trim(); if (trimmedComment.equals(DISABLE_LINE_PATTERN)) { printer.ignoreRegion(lineNumber, lineNumber); } if (trimmedComment.equals(TAILOR_OFF)) { ignoreBlockBeginStack.push(lineNumber); } else if (trimmedComment.equals(TAILOR_ON)) { if (ignoreBlockBeginStack.empty()) { printer.warn(Messages.ON_OFF_MISMATCH, new Location(comment.getLine(), comment.getCharPositionInLine() + 1)); return; } printer.ignoreRegion(ignoreBlockBeginStack.pop(), lineNumber); } } }

Target:
public void analyze() { Stack<Integer> ignoreBlockBeginStack = new Stack<>(); Token lastSuppressViolationComment = null; for (Token comment : singleLineComments) { int lineNumber = comment.getLine(); String trimmedComment = comment.getText().trim(); if (trimmedComment.equals(DISABLE_LINE_PATTERN)) { printer.ignoreRegion(lineNumber, lineNumber); } if (trimmedComment.equals(TAILOR_OFF)) { ignoreBlockBeginStack.push(lineNumber); lastSuppressViolationComment = comment; } else if (trimmedComment.equals(TAILOR_ON)) { if (ignoreBlockBeginStack.empty()) { printOnOffMismatchWarning(comment); return; } printer.ignoreRegion(ignoreBlockBeginStack.pop(), lineNumber); lastSuppressViolationComment = comment; } } if (!ignoreBlockBeginStack.isEmpty() && lastSuppressViolationComment != null) { printOnOffMismatchWarning(lastSuppressViolationComment); } }
Source:
public QueryDetail(String modelName) { this.modelName = modelName; queryText = new ArrayList<String>(); queryText.add("Default Select Statement"); }

Target:
public QueryDetail(String modelName) { this.modelName = modelName; queryText = new ArrayList<String>(); queryText.add(""); }
Source:
public String getGitHttpUrl() throws UnknownHostException { String httpListenUrl = getHttpListenUrl(); if (httpListenUrl == null) { return ""; } if (downloadSchemes.length != 0){ if (!Arrays.asList(downloadSchemes).contains("http")) { return ""; } } String httpUrl = Objects.firstNonNull(canonicalWebUrlString, httpListenUrl); httpUrl = httpUrl.replace("://", "://" + GITBLIT_USER + "@"); httpUrl += (httpUrl.endsWith("/") ? "" : "/") + GITBLIT_REPO; return httpUrl; }

Target:
public String getGitHttpUrl() throws UnknownHostException { String httpListenUrl = getHttpListenUrl(); if (httpListenUrl == null) { return ""; } if (!downloadSchemes.isEmpty() && !downloadSchemes.contains("http")) { return ""; } String httpUrl = Objects.firstNonNull(canonicalWebUrlString, httpListenUrl); httpUrl = httpUrl.replace("://", "://" + GITBLIT_USER + "@"); httpUrl += (httpUrl.endsWith("/") ? "" : "/") + GITBLIT_REPO; return httpUrl; }
Source:
private void addArchetypesPerspective() { if (hasAccessToPerspective(PerspectiveIds.ARCHETYPE_MANAGEMENT)) { adminPage.addTool("root", constants.Archetypes(), new Sets.Builder().add("fa").add("fa-file-code-o").build(), "advanced", () -> { final Command accessArchetypeMgmt = () -> placeManager.goTo(PerspectiveIds.ARCHETYPE_MANAGEMENT); accessArchetypeMgmt.execute(); addAdminBreadcrumbs(PerspectiveIds.ARCHETYPE_MANAGEMENT, constants.Archetypes(), accessArchetypeMgmt); }); } }

Target:
private void addArchetypesPerspective() { if (hasAccessToPerspective(PerspectiveIds.ARCHETYPE_MANAGEMENT)) { adminPage.addTool("root", constants.Archetypes(), new Sets.Builder().add("fa").add("fa-file-code-o").build(), ADVANCED_CATEGORY, () -> { final Command accessArchetypeMgmt = () -> placeManager.goTo(PerspectiveIds.ARCHETYPE_MANAGEMENT); accessArchetypeMgmt.execute(); addAdminBreadcrumbs(PerspectiveIds.ARCHETYPE_MANAGEMENT, constants.Archetypes(), accessArchetypeMgmt); }); } }
Source:
public CanonicalizeExpressions() { super((expression, context) -> ExpressionTreeRewriter.rewriteWith(new CanonicalizeExpressionRewriter(), expression)); }

Target:
public CanonicalizeExpressions() { super((expression, context) -> CanonicalizeExpressionRewriter.rewrite(expression)); }
Source:
public synchronized void mark(int readlimit) { if (mark >= 0) { discardMark(); } this.mark = position; this.markLimit = mark + readlimit + 1; if (current != null) { markBuffers.add(current.duplicate()); } }

Target:
public void mark(int readlimit) { if (mark >= 0) { discardMark(); } this.mark = position; this.markLimit = mark + readlimit + 1; if (current != null) { markBuffers.add(current.duplicate()); } }
Source:
public void onRecipientChange(Recipient recipientToReplace, Recipient alternateAddress) { alternatesPopup.dismiss(); List<Recipient> currentRecipients = getObjects(); int indexOfRecipient = currentRecipients.indexOf(alternateAddress); if (indexOfRecipient == -1) { Log.e(K9.LOG_TAG, "Tried to refresh invalid view token!"); return; } Recipient currentRecipient = currentRecipients.get(indexOfRecipient); currentRecipient.address = alternateAddress.address; currentRecipient.addressLabel = alternateAddress.addressLabel; currentRecipient.cryptoStatus = alternateAddress.cryptoStatus; View recipientTokenView = getTokenViewForRecipient(currentRecipient); if (recipientTokenView == null) { Log.e(K9.LOG_TAG, "Tried to refresh invalid view token!"); return; } bindObjectView(currentRecipient, recipientTokenView); if (listener != null) { listener.onTokenChanged(currentRecipient); } invalidate(); }

Target:
public void onRecipientChange(Recipient recipientToReplace, Recipient alternateAddress) { alternatesPopup.dismiss(); List<Recipient> currentRecipients = getObjects(); int indexOfRecipient = currentRecipients.indexOf(recipientToReplace); if (indexOfRecipient == -1) { Log.e(K9.LOG_TAG, "Tried to refresh invalid view token!"); return; } Recipient currentRecipient = currentRecipients.get(indexOfRecipient); currentRecipient.address = alternateAddress.address; currentRecipient.addressLabel = alternateAddress.addressLabel; currentRecipient.cryptoStatus = alternateAddress.cryptoStatus; View recipientTokenView = getTokenViewForRecipient(currentRecipient); if (recipientTokenView == null) { Log.e(K9.LOG_TAG, "Tried to refresh invalid view token!"); return; } bindObjectView(currentRecipient, recipientTokenView); if (listener != null) { listener.onTokenChanged(currentRecipient); } invalidate(); }
Source:
public void adjustAttributes(String tag, Map attributes) { if (tag.equals("body") && attributes.get(XMLLump.ID_ATTRIBUTE) == null) { attributes.put(XMLLump.ID_ATTRIBUTE, XMLLump.SCR_PREFIX + SAKAI_BODY); } else if (tag.equals(SCRIPT) && attributes.get(SRC)!=null && !((String)attributes.get(SRC)).contains(VERSION)) { attributes.put(SRC, attributes.get(SRC) + PortalUtils.getCDNQuery()); } else if (tag.equals(LINK) && attributes.get(HREF)!=null && !((String)attributes.get(HREF)).contains(VERSION)) { attributes.put(HREF, attributes.get(HREF) + PortalUtils.getCDNQuery()); } }

Target:
public void adjustAttributes(String tag, Map attributes) { if (tag.equals("body") && attributes.get(XMLLump.ID_ATTRIBUTE) == null) { attributes.put(XMLLump.ID_ATTRIBUTE, XMLLump.SCR_PREFIX + SAKAI_BODY); } else if (tag.equals(SCRIPT) && attributes.get(SRC)!=null && !((String)attributes.get(SRC)).contains(QUESTION_MARK)) { attributes.put(SRC, attributes.get(SRC) + PortalUtils.getCDNQuery()); } else if (tag.equals(LINK) && attributes.get(HREF)!=null && !((String)attributes.get(HREF)).contains(QUESTION_MARK)) { attributes.put(HREF, attributes.get(HREF) + PortalUtils.getCDNQuery()); } }
Source:
public HttpRequestBuilder withHeader(String header, String value) { if (headers == null) { headers = new Properties(); } headers.put(header, value); return this; }

Target:
public HttpRequestBuilder withHeader(String header, String value) { Properties localHeaders = headers; if (localHeaders == null) { headers = new Properties(); localHeaders = headers; } localHeaders.put(header, value); return this; }
Source:
protected CompiledPlan compileAdHocCalcitePlan(String sql, boolean inferPartitioning, boolean forcedSP, DeterminismMode detMode) { CompiledPlan cp = null; try { cp = m_aide.compileAdHocPlan(PlannerType.CALCITE, sql, inferPartitioning, forcedSP, detMode); assertTrue(cp != null); } catch (Exception ex) { ex.printStackTrace(); fail(); } return cp; }

Target:
protected CompiledPlan compileAdHocCalcitePlan(String sql, boolean inferPartitioning, boolean forcedSP, DeterminismMode detMode) { CompiledPlan cp = null; try { cp = m_aide.compileAdHocPlan(PlannerType.CALCITE, sql, inferPartitioning, forcedSP, detMode); assertNotNull(cp); } catch (Exception ex) { fail(ex.getMessage()); } return cp; }
Source:
private int run0() throws InterruptedException, DockerException { Thread.sleep(delayMillis); final String containerId = createAndStartContainer(); listener.running(); serviceRegistrationHandle = Optional.fromNullable(registrar.register(config.registration())); final ContainerExit exit; try { exit = docker.waitContainer(containerId); } finally { if (serviceRegistrationHandle.isPresent()) { unregister(); } } log.info("container exited: {}: {}: {}", config, containerId, exit.statusCode()); listener.exited(exit.statusCode()); return exit.statusCode(); }

Target:
private int run0() throws InterruptedException, DockerException { Thread.sleep(delayMillis); final String containerId = createAndStartContainer(); listener.running(); serviceRegistrationHandle = Optional.fromNullable(registrar.register(config.registration())); final ContainerExit exit; try { exit = docker.waitContainer(containerId); } finally { unregister(); } log.info("container exited: {}: {}: {}", config, containerId, exit.statusCode()); listener.exited(exit.statusCode()); return exit.statusCode(); }
Source:
public void createKeyRotationSchedule( String projectId, String locationId, String keyRingId, String id) throws IOException { try (KeyManagementServiceClient client = KeyManagementServiceClient.create()) { KeyRingName keyRingName = KeyRingName.of(projectId, locationId, keyRingId); long tomorrow = java.time.Instant.now().plus(24, ChronoUnit.HOURS).getEpochSecond(); CryptoKey key = CryptoKey.newBuilder() .setPurpose(CryptoKeyPurpose.ENCRYPT_DECRYPT) .setVersionTemplate( CryptoKeyVersionTemplate.newBuilder() .setAlgorithm(CryptoKeyVersionAlgorithm.GOOGLE_SYMMETRIC_ENCRYPTION)) .setRotationPeriod( Duration.newBuilder().setSeconds(java.time.Duration.ofHours(24).getSeconds())) .setNextRotationTime(Timestamp.newBuilder().setSeconds(tomorrow)) .build(); CryptoKey createdKey = client.createCryptoKey(keyRingName, id, key); System.out.printf("Created key with rotation schedule %s%n", createdKey.getName()); } }

Target:
public void createKeyRotationSchedule( String projectId, String locationId, String keyRingId, String id) throws IOException { try (KeyManagementServiceClient client = KeyManagementServiceClient.create()) { KeyRingName keyRingName = KeyRingName.of(projectId, locationId, keyRingId); long tomorrow = java.time.Instant.now().plus(24, ChronoUnit.HOURS).getEpochSecond(); CryptoKey key = CryptoKey.newBuilder() .setPurpose(CryptoKeyPurpose.ENCRYPT_DECRYPT) .setVersionTemplate( CryptoKeyVersionTemplate.newBuilder() .setAlgorithm(CryptoKeyVersionAlgorithm.GOOGLE_SYMMETRIC_ENCRYPTION)) .setRotationPeriod( Duration.newBuilder().setSeconds(java.time.Duration.ofDays(30).getSeconds())) .setNextRotationTime(Timestamp.newBuilder().setSeconds(tomorrow)) .build(); CryptoKey createdKey = client.createCryptoKey(keyRingName, id, key); System.out.printf("Created key with rotation schedule %s%n", createdKey.getName()); } }
Source:
public void init() { if (dubboConfigBinder == null) { try { dubboConfigBinder = applicationContext.getBean(DubboConfigBinder.class); } catch (BeansException ignored) { if (log.isDebugEnabled()) { log.debug("DubboConfigBinder Bean can't be found in ApplicationContext."); } dubboConfigBinder = createDubboConfigBinder(applicationContext.getEnvironment()); } } dubboConfigBinder.setIgnoreUnknownFields(ignoreUnknownFields); dubboConfigBinder.setIgnoreInvalidFields(ignoreInvalidFields); }

Target:
private void init() { if (dubboConfigBinder == null) { try { dubboConfigBinder = applicationContext.getBean(DubboConfigBinder.class); } catch (BeansException ignored) { if (log.isDebugEnabled()) { log.debug("DubboConfigBinder Bean can't be found in ApplicationContext."); } dubboConfigBinder = createDubboConfigBinder(applicationContext.getEnvironment()); } } dubboConfigBinder.setIgnoreUnknownFields(ignoreUnknownFields); dubboConfigBinder.setIgnoreInvalidFields(ignoreInvalidFields); }
Source:
private boolean connectStorageServer(StorageType storageType, List<StorageServerConnections> connections, boolean sendNetworkEventOnFailure) { if (connections == null) { return true; } StorageServerConnectionManagementVDSParameters parameters = new StorageServerConnectionManagementVDSParameters(getVds().getId(), getStoragePool().getId(), storageType, connections); parameters.setSendNetworkEventOnFailure(sendNetworkEventOnFailure); Map<String, String> retValues = (Map<String, String>) runVdsCommand( VDSCommandType.ConnectStorageServer, parameters).getReturnValue(); return storageHelperDirector.getItem(storageType).isConnectSucceeded(retValues, connections); }

Target:
private boolean connectStorageServer(StorageType storageType, List<StorageServerConnections> connections, boolean sendNetworkEventOnFailure) { if (connections == null || connections.isEmpty()) { return true; } StorageServerConnectionManagementVDSParameters parameters = new StorageServerConnectionManagementVDSParameters(getVds().getId(), getStoragePool().getId(), storageType, connections); parameters.setSendNetworkEventOnFailure(sendNetworkEventOnFailure); Map<String, String> retValues = (Map<String, String>) runVdsCommand( VDSCommandType.ConnectStorageServer, parameters).getReturnValue(); return storageHelperDirector.getItem(storageType).isConnectSucceeded(retValues, connections); }
Source:
public static LimitOrder createLimitOrder(MarketOrder marketOrder, DSXExchangeInfo dsxExchangeInfo) { DSXPairInfo dsxPairInfo = dsxExchangeInfo.getPairs().get(getPair(marketOrder.getCurrencyPair())); BigDecimal limitPrice = marketOrder.getType() == OrderType.BID ? dsxPairInfo.getMaxPrice() : dsxPairInfo.getMinPrice(); return LimitOrder.Builder.from(marketOrder).limitPrice(limitPrice).timestamp(new Date()).build(); }

Target:
public static LimitOrder createLimitOrder(MarketOrder marketOrder, DSXExchangeInfo dsxExchangeInfo) { DSXPairInfo dsxPairInfo = dsxExchangeInfo.getPairs().get(getPair(marketOrder.getCurrencyPair())); BigDecimal limitPrice = marketOrder.getType() == OrderType.BID ? dsxPairInfo.getMaxPrice() : dsxPairInfo.getMinPrice(); return LimitOrder.Builder.from(marketOrder).limitPrice(limitPrice).build(); }
Source:
public void verifyTheLocksAreClearedWhenMemberDepartsAfterTakingClearLockOnRemoteMembers() throws Exception { client1.invoke(this::initClientCache); client2.invoke(this::initClientCache); accessor.invoke(() -> feed(false)); verifyServerRegionSize(NUM_ENTRIES); dataStore2.invoke(() -> DistributionMessageObserver.setInstance( testHookToKillMemberCallingClearBeforeMessageProcessed())); AsyncInvocation ds1ClearAsync = dataStore1.invokeAsync(() -> getRegion(false).clear()); getBlackboard().waitForGate("CacheClose", 30, SECONDS); dataStore1.invoke(() -> getCache().close()); getBlackboard().signalGate("CacheClosed"); dataStore2.invoke(() -> feed(false)); dataStore3.invoke(() -> feed(false)); dataStore2.invoke(() -> verifyRegionSize(false, NUM_ENTRIES)); dataStore3.invoke(() -> verifyRegionSize(false, NUM_ENTRIES)); ds1ClearAsync.await(); }

Target:
public void verifyTheLocksAreClearedWhenMemberDepartsAfterTakingClearLockOnRemoteMembers() throws Exception { client1.invoke(this::initClientCache); client2.invoke(this::initClientCache); accessor.invoke(() -> feed(false)); verifyServerRegionSize(NUM_ENTRIES); dataStore2.invoke(() -> DistributionMessageObserver.setInstance( testHookToKillMemberCallingClearBeforeMessageProcessed())); AsyncInvocation ds1ClearAsync = dataStore1.invokeAsync(() -> getRegion(false).clear()); getBlackboard().waitForGate("CLOSE_CACHE", 30, SECONDS); dataStore1.invoke(() -> getCache().close()); getBlackboard().signalGate("CACHE_CLOSED"); dataStore2.invoke(() -> feed(false)); dataStore3.invoke(() -> feed(false)); dataStore2.invoke(() -> verifyRegionSize(false, NUM_ENTRIES)); dataStore3.invoke(() -> verifyRegionSize(false, NUM_ENTRIES)); ds1ClearAsync.await(); }
Source:
public void invalidWhenOnly11Digits() { final String actualNumber = new PhoneNumber("21234567890").getNumber(); }

Target:
public void invalidWhenOnly11Digits() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("Can only have 11 digits if number starts with '1'"); new PhoneNumber("21234567890").getNumber(); }
Source:
public void onCreate(Bundle savedInstanceState) { if (DEVELOPER_MODE) { StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectDiskReads() .detectDiskWrites().detectNetwork().penaltyLog().build()); StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectLeakedSqlLiteObjects() .detectAll().penaltyLog().penaltyDeath().build()); } super.onCreate(savedInstanceState); initData(); initUi(); }

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); initData(); initUi(); }
Source:
public static RyaStatement deserializeTriple(final Bytes row) { final byte[] rowArray = removeTriplePrefixAndConvertToByteArray(row); RyaStatement rs = null; try { rs = tr.deserialize(TABLE_LAYOUT.SPO, new TripleRow(rowArray, new byte[0], new byte[0])); } catch (final TripleRowResolverException e) { e.printStackTrace(); } return rs; }

Target:
public static RyaStatement deserializeTriple(final Bytes row) { checkNotNull(row); final byte[] rowArray = removeTriplePrefixAndConvertToByteArray(row); RyaStatement rs = null; try { rs = tr.deserialize(TABLE_LAYOUT.SPO, new TripleRow(rowArray, new byte[0], new byte[0])); } catch (final TripleRowResolverException e) { e.printStackTrace(); } return rs; }
Source:
static <T> T tryFor(long timeout, TimeUnit timeoutUnit, long interval, TimeUnit intervalUnit, Supplier<T> supplier, Predicate<T> predicate, Timer timer) throws TimeoutException, InterruptedException { long until = timer.nanoTime() + NANOSECONDS.convert(timeout, timeoutUnit); T value; do { value = supplier.get(); if (predicate.test(value)) { return value; } else { timer.sleep(interval, intervalUnit); } } while (timer.nanoTime() < until); throw new TimeoutException(); }

Target:
static <T> T tryFor(long timeout, TimeUnit timeoutUnit, long interval, TimeUnit intervalUnit, Supplier<T> supplier, Predicate<T> predicate, Timer timer) throws TimeoutException, InterruptedException { long until = timer.nanoTime() + NANOSECONDS.convert(timeout, timeoutUnit); long intervalNano = NANOSECONDS.convert(interval, intervalUnit); T value; for (;;) { value = supplier.get(); if (predicate.test(value)) { return value; } else { if ((timer.nanoTime() + intervalNano) < until) { timer.sleep(intervalNano); } else { break; } } } throw new TimeoutException(); }
Source:
public void parseXML(List<Workspace> workspaces,XMLStreamReader parser) throws XMLStreamException { List<String> hierarchy = new ArrayList<String>(); for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) { switch(event) { case XMLStreamConstants.START_ELEMENT: hierarchy.add(parser.getLocalName()); break; case XMLStreamConstants.END_ELEMENT: hierarchy.remove(hierarchy.size()-1); break; case XMLStreamConstants.CHARACTERS: if(RemoteCommons.endsWith(hierarchy,"workspaces","workspace")) { workspaces.add(new Workspace(cParams, parser.getText().trim())); } break; } } }

Target:
public void parseXML(List<Workspace> workspaces,XMLStreamReader parser) throws XMLStreamException { List<String> hierarchy = new ArrayList<String>(); StringBuilder characters = new StringBuilder(); for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) { switch(event) { case XMLStreamConstants.START_ELEMENT: hierarchy.add(parser.getLocalName()); break; case XMLStreamConstants.END_ELEMENT: if(RemoteCommons.endsWith(hierarchy,"workspaces","workspace")) { workspaces.add(new Workspace(cParams,characters.toString().trim())); } hierarchy.remove(hierarchy.size()-1); characters = new StringBuilder(); break; case XMLStreamConstants.CHARACTERS: characters.append(StringEscapeUtils.unescapeHtml(parser.getText())); break; } } }
Source:
private LocationAvailability createLocationAvailability() { LocationManager locationManager = (LocationManager) context.getSystemService( Context.LOCATION_SERVICE); boolean gpsEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER); boolean networkEnabled = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER); return new LocationAvailability(gpsEnabled || networkEnabled); }

Target:
private LocationAvailability createLocationAvailability() { LocationManager locationManager = (LocationManager) context.getSystemService( Context.LOCATION_SERVICE); boolean gpsEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER); boolean networkEnabled = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER); boolean gpsLocationExists = locationManager.getLastKnownLocation( LocationManager.GPS_PROVIDER) != null; boolean networkLocationExists = locationManager.getLastKnownLocation( LocationManager.NETWORK_PROVIDER) != null; return new LocationAvailability((gpsEnabled && gpsLocationExists) || (networkEnabled && networkLocationExists)); }
Source:
public PremisEventBuilder(String eventId, Resource eventType, Date date, PremisLogger premisLogger) { this.eventId = eventId; this.eventType = eventType; this.date = date; this.premisLogger = premisLogger; addEvent(); }

Target:
public PremisEventBuilder(String eventId, Resource eventType, Date date, PremisLogger premisLogger) { this.eventId = eventId; this.premisLogger = premisLogger; addEvent(eventType, date); }
Source:
protected @NonNull List<@NonNull TmfTreeDataModel> getTree(@NonNull ITmfStateSystem ss, @NonNull TimeQueryFilter filter, @Nullable IProgressMonitor monitor) throws StateSystemDisposedException { List<@NonNull Integer> attribs = ss.getSubAttributes(ITmfStateSystem.ROOT_ATTRIBUTE, false); List<@NonNull TmfTreeDataModel> retVal = new ArrayList<>(); for (Integer attrib : attribs) { String[] strings = fCache.get(attrib); if (strings == null) { strings = ss.getFullAttributePathArray(attrib); fCache.put(attrib, strings); } retVal.add(new TmfTreeDataModel(getId(attrib), getId(ITmfStateSystem.ROOT_ATTRIBUTE), strings[0])); } return retVal; }

Target:
protected @NonNull List<@NonNull TmfTreeDataModel> getTree(@NonNull ITmfStateSystem ss, @NonNull TimeQueryFilter filter, @Nullable IProgressMonitor monitor) throws StateSystemDisposedException { List<@NonNull Integer> attribs = ss.getSubAttributes(ITmfStateSystem.ROOT_ATTRIBUTE, false); List<@NonNull TmfTreeDataModel> retVal = new ArrayList<>(); for (Integer attrib : attribs) { String[] strings = fCache.computeIfAbsent(attrib, t -> ss.getFullAttributePathArray(t)); retVal.add(new TmfTreeDataModel(getId(attrib), getId(ITmfStateSystem.ROOT_ATTRIBUTE), strings[0])); } return retVal; }
Source:
public List<Map<String, Object>> getActionLinks(BusinessObjectBase businessObject, Person user) { BatchFile batchFile = (BatchFile) businessObject; List<Map<String, Object>> actionLinks = new LinkedList<>(); if (canCreateDoneFile(batchFile, user)) { Map<String, Object> createDoneLink = new LinkedHashMap<>(); createDoneLink.put("label", "Create Done"); createDoneLink.put("url", KRAD_URL_PREFIX + getCreateDoneUrl(batchFile)); createDoneLink.put("method", "GET"); actionLinks.add(createDoneLink); } return actionLinks; }

Target:
public List<Map<String, Object>> getActionLinks(BusinessObjectBase businessObject, Person user) { BatchFile batchFile = (BatchFile) businessObject; List<Map<String, Object>> actionLinks = new LinkedList<>(); if (canCreateDoneFile(batchFile, user)) { Map<String, Object> createDoneLink = new LinkedHashMap<>(); createDoneLink.put(CUKFSPropertyConstants.LOOKUP_RESULT_ACTION_LABEL, "Create Done"); createDoneLink.put(CUKFSPropertyConstants.LOOKUP_RESULT_ACTION_URL, KRAD_URL_PREFIX + getCreateDoneUrl(batchFile)); createDoneLink.put(CUKFSPropertyConstants.LOOKUP_RESULT_ACTION_METHOD, "GET"); actionLinks.add(createDoneLink); } return actionLinks; }
Source:
public boolean matches(MethodParams params) { return params.are(EventMessage.class, EventContext.class) && params.declaredAsClasses(); }

Target:
public boolean matches(MethodParams params) { return params.match(criteria); }
Source:
public void displayNewPage(final PageTitle title, final HistoryEntry entry, boolean allowStateLoss) { ACRA.getErrorReporter().putCustomData("api", title.getSite().getApiDomain()); ACRA.getErrorReporter().putCustomData("title", title.toString()); if (drawerLayout.isDrawerOpen(Gravity.START)) { drawerLayout.closeDrawer(Gravity.START); } if (title.isSpecial()) { Utils.visitInExternalBrowser(this, Uri.parse(title.getMobileUri())); return; } resetFragments(allowStateLoss); fragmentContainerView.post(new Runnable() { @Override public void run() { PageViewFragmentInternal frag = getCurPageFragment(); if (frag == null) { return; } if (frag.getCurrentTab().getBackStack().size() > 0 && frag.getCurrentTab().getBackStack().get(frag.getCurrentTab().getBackStack().size() - 1).getTitle().equals(title)) { if (!TextUtils.isEmpty(title.getFragment())) { frag.scrollToSection(title.getFragment()); } return; } frag.closeFindInPage(); frag.displayNewPage(title, entry, false, true); app.getSessionFunnel().pageViewed(entry); } }); }

Target:
public void displayNewPage(final PageTitle title, final HistoryEntry entry, boolean allowStateLoss) { ACRA.getErrorReporter().putCustomData("api", title.getSite().getApiDomain()); ACRA.getErrorReporter().putCustomData("title", title.toString()); if (drawerLayout.isDrawerOpen(Gravity.START)) { drawerLayout.closeDrawer(Gravity.START); } if (title.isSpecial()) { Utils.visitInExternalBrowser(this, Uri.parse(title.getMobileUri())); return; } resetFragments(allowStateLoss); fragmentContainerView.post(new Runnable() { @Override public void run() { PageViewFragmentInternal frag = getCurPageFragment(); if (frag == null) { return; } if (!frag.getCurrentTab().getBackStack().isEmpty() && frag.getCurrentTab().getBackStack().get(frag.getCurrentTab().getBackStack().size() - 1).getTitle().equals(title)) { if (!TextUtils.isEmpty(title.getFragment())) { frag.scrollToSection(title.getFragment()); } return; } frag.closeFindInPage(); frag.displayNewPage(title, entry, false, true); app.getSessionFunnel().pageViewed(entry); } }); }
Source:
public void dumpTrailer(PrintStream p, String indent, boolean noArmor) { if (!noArmor) { p.print ("\n}\n"); } }

Target:
public void dumpTrailer(PrintStream p, String indent, boolean noArmor) { if (!noArmor) { p.print (indent+"\n}\n"); } }
Source:
private void doResetStatistics() { progressBar.setVisibility(View.VISIBLE); feedStatisticsList.setVisibility(View.GONE); if (disposable != null) { disposable.dispose(); } UserPreferences.resetUsageCounting(); disposable = Completable.fromFuture(DBWriter.resetStatistics()) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(this::refreshStatistics, error -> Log.e(TAG, Log.getStackTraceString(error))); }

Target:
private void doResetStatistics() { progressBar.setVisibility(View.VISIBLE); feedStatisticsList.setVisibility(View.GONE); if (disposable != null) { disposable.dispose(); } disposable = Completable.fromFuture(DBWriter.resetStatistics()) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(() -> { refreshStatistics(); UserPreferences.resetUsageCountingDate(); }, error -> Log.e(TAG, Log.getStackTraceString(error))); }
Source:
public void run() { long iteration = 0; Metronome metronome = SimpleMetronome.withFixedIntervalMs(intervalMs); SqlPredicate sqlPredicate = new SqlPredicate(sqlQuery); Predicate predicate = new AgePredicate(56); while (!testContext.isStopped()) { metronome.waitForNext(); if (customPredicate == true) { search.started(); map.values(predicate); search.done(); } else { search.started(); map.values(sqlPredicate); search.done(); } if (iteration % logFrequency == 0) { log.info(Thread.currentThread().getName() + " At iteration: " + iteration); } if (iteration % performanceUpdateFrequency == 0) { operations.addAndGet(performanceUpdateFrequency); } iteration++; } }

Target:
public void run() { long iteration = 0; Metronome metronome = SimpleMetronome.withFixedIntervalMs(intervalMs); SqlPredicate sqlPredicate = new SqlPredicate(sqlQuery); PredicateType type = selector.select(); AgePredicate agePredicate = new AgePredicate(30); NamePredicate namePredicate = new NamePredicate("aaa"); ActivePredicate activePredicate = new ActivePredicate(true); SalaryPredicate salaryPredicate = new SalaryPredicate(700.0); while (!testContext.isStopped()) { metronome.waitForNext(); search.started(); if (customPredicate) { switch (type){ case AGE: map.values(agePredicate); break; case NAME: map.values(namePredicate); break; case ACTIVE: map.values(activePredicate); break; case SALARY: map.values(salaryPredicate); break; default: log.severe("There is no predicate type like this"); } } else { map.values(sqlPredicate); } search.done(); iteration++; if (iteration % logFrequency == 0) { log.info(Thread.currentThread().getName() + " At iteration: " + iteration); } if (iteration % performanceUpdateFrequency == 0) { operations.addAndGet(performanceUpdateFrequency); } } operations.addAndGet(iteration % performanceUpdateFrequency); }
Source:
public long objectSize() throws InternalException { if (this.objectSize == null) { throw new InternalException( "buildHeaders(long objectSize, String etag) must be called prior this method invocation"); } return this.objectSize; }

Target:
public long objectSize() throws InternalException { if (this.objectSize == null) { throw new InternalException( "buildHeaders(long objectSize, String etag) must be called prior to this method invocation"); } return this.objectSize; }
Source:
private Response convertToResponse(Object retVal, Throwable throwable) { if (throwable != null) { throwable = CompletableFutures.extractException(throwable); if (throwable instanceof InterruptedException || throwable instanceof IllegalLifecycleStateException) { log.debugf("Shutdown while handling command %s", command); return shuttingDownResponse(); } else { CLUSTER.exceptionHandlingCommand(command, throwable); return exceptionHandlingCommand(throwable); } } else { if (retVal == null || retVal instanceof Response) { return (Response) retVal; } else { return SuccessfulResponse.create(retVal); } } }

Target:
private Response convertToResponse(Object retVal, Throwable throwable) { if (throwable != null) { throwable = CompletableFutures.extractException(throwable); if (throwable instanceof InterruptedException || throwable instanceof IllegalLifecycleStateException) { CLUSTER.debugf("Shutdown while handling command %s", command); return shuttingDownResponse(); } else { CLUSTER.exceptionHandlingCommand(command, throwable); return exceptionHandlingCommand(throwable); } } else { if (retVal == null || retVal instanceof Response) { return (Response) retVal; } else { return SuccessfulResponse.create(retVal); } } }
Source:
public void isExecutable_HeaderCellSelected() { when(scenarioGridModelMock.getSelectedCells()).thenReturn(Collections.emptyList()); when(scenarioGridModelMock.getSelectedHeaderCells()).thenReturn(Lists.create(selectedCell, selectedCell2)); assertTrue(handler.isExecutable(scenarioGridMock)); }

Target:
public void isExecutable_HeaderCellSelected() { when(scenarioGridModelMock.getSelectedCells()).thenReturn(Collections.emptyList()); when(scenarioGridModelMock.getSelectedHeaderCells()).thenReturn(Arrays.asList(selectedCell, selectedCell2)); assertTrue(handler.isExecutable(scenarioGridMock)); }
Source:
public void show(List<NavItem> itemList) { this.navItemList = itemList; this.navSubgroupList.clear(); if (secure) { navItemList = new ArrayList<>(itemList); navigationManager.secure(navItemList, hideEmptyGroups); } view.clearItems(); if (navItemList.isEmpty()) { view.errorNavItemsEmpty(); } for (NavItem navChild : navItemList) { if (navChild instanceof NavGroup) { if (areSubGroupsSupported()) { showGroup((NavGroup) navChild); } else { showItem(navChild); } } else if (navChild instanceof NavDivider) { view.addDivider(); } else { showItem(navChild); } } }

Target:
public void show(List<NavItem> itemList) { this.hide(); this.navItemList = itemList; this.navSubgroupList.clear(); if (secure) { navItemList = new ArrayList<>(itemList); navigationManager.secure(navItemList, hideEmptyGroups); } if (navItemList.isEmpty()) { view.errorNavItemsEmpty(); } for (NavItem navChild : navItemList) { if (navChild instanceof NavGroup) { if (areSubGroupsSupported()) { showGroup((NavGroup) navChild); } else { showItem(navChild); } } else if (navChild instanceof NavDivider) { view.addDivider(); } else { showItem(navChild); } } }
Source:
private IdToken(String idtoken) throws UnsupportedEncodingException, JSONException{ int firstDot = idtoken.indexOf("."); int secondDot = idtoken.indexOf(".", firstDot + 1); int invalidDot = idtoken.indexOf(".", secondDot + 1); if (invalidDot == -1 && firstDot > 0 && secondDot > 0) { String idbody = idtoken.substring(firstDot + 1, secondDot); byte[] data = Base64.decode(idbody, Base64.URL_SAFE); String decodedBody = new String(data, "UTF-8"); HashMap<String, String> responseItems = new HashMap<String, String>(); extractJsonObjects(responseItems, decodedBody); if (responseItems != null && !responseItems.isEmpty()) { this.mSubject = responseItems .get(AuthenticationConstants.OAuth2.ID_TOKEN_SUBJECT); this.mTenantId = responseItems .get(AuthenticationConstants.OAuth2.ID_TOKEN_TENANTID); this.mUpn = responseItems .get(AuthenticationConstants.OAuth2.ID_TOKEN_UPN); this.mEmail = responseItems .get(AuthenticationConstants.OAuth2.ID_TOKEN_EMAIL); this.mGivenName = responseItems .get(AuthenticationConstants.OAuth2.ID_TOKEN_GIVEN_NAME); this.mFamilyName = responseItems .get(AuthenticationConstants.OAuth2.ID_TOKEN_FAMILY_NAME); this.mIdentityProvider = responseItems .get(AuthenticationConstants.OAuth2.ID_TOKEN_IDENTITY_PROVIDER); this.mObjectId = responseItems .get(AuthenticationConstants.OAuth2.ID_TOKEN_OBJECT_ID); String expiration = responseItems .get(AuthenticationConstants.OAuth2.ID_TOKEN_PASSWORD_EXPIRATION); if (!StringExtensions.IsNullOrBlank(expiration)) { this.mPasswordExpiration = Long.parseLong(expiration); } this.mPasswordChangeUrl = responseItems .get(AuthenticationConstants.OAuth2.ID_TOKEN_PASSWORD_CHANGE_URL); } } }

Target:
public IdToken(String idtoken) throws AuthenticationException { final HashMap<String, String> responseItems = this.parseJWT(idtoken); if (responseItems != null && !responseItems.isEmpty()) { this.mSubject = responseItems.get(AuthenticationConstants.OAuth2.ID_TOKEN_SUBJECT); this.mTenantId = responseItems.get(AuthenticationConstants.OAuth2.ID_TOKEN_TENANTID); this.mUpn = responseItems.get(AuthenticationConstants.OAuth2.ID_TOKEN_UPN); this.mEmail = responseItems.get(AuthenticationConstants.OAuth2.ID_TOKEN_EMAIL); this.mGivenName = responseItems.get(AuthenticationConstants.OAuth2.ID_TOKEN_GIVEN_NAME); this.mFamilyName = responseItems.get(AuthenticationConstants.OAuth2.ID_TOKEN_FAMILY_NAME); this.mIdentityProvider = responseItems.get(AuthenticationConstants.OAuth2.ID_TOKEN_IDENTITY_PROVIDER); this.mObjectId = responseItems.get(AuthenticationConstants.OAuth2.ID_TOKEN_OBJECT_ID); final String expiration = responseItems.get(AuthenticationConstants.OAuth2.ID_TOKEN_PASSWORD_EXPIRATION); if (!StringExtensions.IsNullOrBlank(expiration)) { this.mPasswordExpiration = Long.parseLong(expiration); } this.mPasswordChangeUrl = responseItems.get(AuthenticationConstants.OAuth2.ID_TOKEN_PASSWORD_CHANGE_URL); } }