auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testCFStringRef() { String awesome = "ǝɯosǝʍɐ sı ∀Nſ"; CFStringRef cfAwesome = CFStringRef.createCFString(awesome); assertEquals(awesome.length(), CF.CFStringGetLength(cfAwesome).intValue()); assertEquals(awesome, cfAwesome.stringValue()); Memory mem = new Memory(awesome.getBytes().length + 1); mem.clear(); assertNotEquals(0, CF.CFStringGetCString(cfAwesome, mem, new CFIndex(mem.size()), CoreFoundation.kCFStringEncodingUTF8)); byte[] awesomeBytes = mem.getByteArray(0, (int) mem.size() - 1); byte[] awesomeArr = awesome.getBytes(); for (int i = 0; i < awesomeArr.length; i++) { assertEquals(awesomeArr[i], awesomeBytes[i]); } CFStringRef desc = CF.CFCopyDescription(cfAwesome); assertTrue(desc.stringValue().contains(awesome)); desc.release(); cfAwesome.release(); }

Target:
public void testCFStringRef() throws UnsupportedEncodingException { String awesome = "ǝɯosǝʍɐ sı ∀Nſ"; CFStringRef cfAwesome = CFStringRef.createCFString(awesome); assertEquals(awesome.length(), CF.CFStringGetLength(cfAwesome).intValue()); assertEquals(awesome, cfAwesome.stringValue()); assertEquals(CoreFoundation.STRING_TYPE_ID, cfAwesome.getTypeID()); byte[] awesomeArr = awesome.getBytes("UTF-8"); Memory mem = new Memory(awesomeArr.length + 1); mem.clear(); assertNotEquals(0, CF.CFStringGetCString(cfAwesome, mem, new CFIndex(mem.size()), CoreFoundation.kCFStringEncodingUTF8)); byte[] awesomeBytes = mem.getByteArray(0, (int) mem.size() - 1); assertArrayEquals(awesomeArr, awesomeBytes); CFStringRef desc = CF.CFCopyDescription(cfAwesome); assertTrue(desc.stringValue().contains(awesome)); desc.release(); cfAwesome.release(); }
Source:
private List<Pool> filterPoolsForActKey(ActivationKey key, List<Pool> pools, boolean includeWarnings) { List<Pool> filteredPools = new LinkedList<>(); for (Pool p : pools) { ValidationResult result = activationKeyRules.runPoolValidationForActivationKey(key, p, null); if (!result.hasErrorKeys() && (!result.hasWarnings() || includeWarnings)) { filteredPools.add(p); } else if (log.isDebugEnabled()) { log.debug("Omitting pool due to failed rules: {}", p.getId()); if (result.hasErrors()) { log.debug("\tErrors: {}", result.getErrors()); } if (result.hasWarnings()) { log.debug("\tWarnings: {}", result.getWarnings()); } } } return filteredPools; }

Target:
private List<Pool> filterPoolsForActKey(ActivationKey key, List<Pool> pools, boolean includeWarnings) { List<Pool> filteredPools = new LinkedList<>(); for (Pool p : pools) { ValidationResult result = activationKeyRules.runPoolValidationForActivationKey(key, p, null); if (result.isSuccessful() && (!result.hasWarnings() || includeWarnings)) { filteredPools.add(p); } else if (log.isDebugEnabled()) { log.debug("Omitting pool due to failed rules: {}", p.getId()); if (result.hasErrors()) { log.debug("\tErrors: {}", result.getErrors()); } if (result.hasWarnings()) { log.debug("\tWarnings: {}", result.getWarnings()); } } } return filteredPools; }
Source:
public SeatmapResponse getSeatGroupByName(String groupname) { List<Seat> seatGroup = seatRepository.findBySeatGroupIgnoreCase(groupname); Map<String, List<Seat>> seatMapResponse = new HashMap<>(); seatMapResponse.put(seatGroup.get(0).getSeatGroup(), seatGroup); return new SeatmapResponse(seatMapResponse); }

Target:
public SeatmapResponse getSeatGroupByName(String groupname) { List<Seat> seatGroup = seatRepository.findBySeatGroup(groupname); Map<String, List<Seat>> seatMapResponse = new HashMap<>(); seatMapResponse.put(groupname, seatGroup); return new SeatmapResponse(seatMapResponse); }
Source:
private Collection<Address> getCommitNodes(TxInvocationContext ctx) { LocalTransaction localTx = (LocalTransaction) ctx.getCacheTransaction(); LocalizedCacheTopology cacheTopology = dm.getCacheTopology(); Collection<Address> affectedNodes = isReplicated ? null : cacheTopology.getWriteOwners((Collection<Object>) ctx.getAffectedKeys()); return localTx.getCommitNodes(affectedNodes, cacheTopology); }

Target:
private Collection<Address> getCommitNodes(TxInvocationContext ctx) { LocalTransaction localTx = (LocalTransaction) ctx.getCacheTransaction(); LocalizedCacheTopology cacheTopology = dm.getCacheTopology(); Collection<Address> affectedNodes = isReplicated ? null : cacheTopology.getWriteOwners(ctx.getAffectedKeys()); return localTx.getCommitNodes(affectedNodes, cacheTopology); }
Source:
protected boolean checkUserPasswordValid(Object credential) throws UserStoreException { if (!isSecureCall.get()) { Class argTypes[] = new Class[]{Object.class}; Object object = callSecure("checkUserPasswordValid", new Object[]{credential}, argTypes); return (Boolean) object; } if (credential == null) { return false; } Secret credentialObj; try { credentialObj = Secret.getSecret(credential); } catch (UnsupportedSecretTypeException e) { throw new UserStoreException("Unsupported credential type", e); } try { if (credentialObj.getChars().length < 1) { return false; } String regularExpression = realmConfig.getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_JAVA_REG_EX); if (regularExpression != null) { if (isFormatCorrect(regularExpression, credentialObj.getChars())) { return true; } else { if (log.isDebugEnabled()) { log.debug("Submitted password does not match with the regex " + regularExpression); } return false; } } return regularExpression == null; } finally { credentialObj.clear(); } }

Target:
protected boolean checkUserPasswordValid(Object credential) throws UserStoreException { if (!isSecureCall.get()) { Class argTypes[] = new Class[]{Object.class}; Object object = callSecure("checkUserPasswordValid", new Object[]{credential}, argTypes); return (Boolean) object; } if (credential == null) { return false; } Secret credentialObj; try { credentialObj = Secret.getSecret(credential); } catch (UnsupportedSecretTypeException e) { throw new UserStoreException("Unsupported credential type", e); } try { if (credentialObj.getChars().length < 1) { return false; } String regularExpression = realmConfig.getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_JAVA_REG_EX); if (regularExpression != null) { if (isFormatCorrect(regularExpression, credentialObj.getChars())) { return true; } else { if (log.isDebugEnabled()) { log.debug("Submitted password does not match with the regex " + regularExpression); } return false; } } return true; } finally { credentialObj.clear(); } }
Source:
public void updateFile(final String bucket, final String key, final int startingLine) { final String etag = lockDao.acquire(key); if (etag == null) { logger.info("Failed to acquire lock for file " + key + ". Skipping it..."); return; } if (fileStatusDao.isCompleted(key)) { lockDao.release(key, etag); logger.info("File " + key + " already processed. Skipping it..."); return; } S3Object file = s3Client.getObject(bucket, key); try { repoUpdateService.update(file.getObjectContent(), key, startingLine, new UpdateFileCallback() { @Override public void call(UpdateResult result) { if (UpdateStatus.SUCCEEDED.equals(result.getStatus())) { fileStatusDao.setCompleted(key); } else { fileStatusDao.setFailed(key, result.getLineCount()); } } }, new UpdateRecordCallback() { @Override public void handle(WriteRecordResult result) { } }); } finally { try { file.close(); lockDao.release(key, etag); } catch (Exception e) { throw new RuntimeException(e); } } }

Target:
public void updateFile(final String bucket, final String key, final int startingLine) { final String etag = lockDao.acquire(key); if (etag == null) { logger.info("Failed to acquire lock for file " + key + ". Skipping it..."); return; } if (fileStatusDao.isCompleted(key)) { lockDao.release(key, etag); logger.info("File " + key + " already processed. Skipping it..."); return; } S3Object file = s3Client.getObject(bucket, key); try { repoUpdateService.update(file.getObjectContent(), key, startingLine, new UpdateFileCallback() { @Override public void call(UpdateResult result) { if (UpdateStatus.SUCCEEDED.equals(result.getStatus())) { fileStatusDao.setCompleted(key); } } }, new UpdateRecordCallback() { @Override public void handle(WriteRecordResult result) { failedRecordDao.put(result); } }); } finally { try { file.close(); lockDao.release(key, etag); } catch (Exception e) { throw new RuntimeException(e); } } }
Source:
protected Color createColor(IPreferenceStore store, String key, Display display) { RGB rgb= null; if (store.contains(key)) { if (store.isDefault(key)) rgb= PreferenceConverter.getDefaultColor(store, key); else rgb= PreferenceConverter.getColor(store, key); if (rgb != null) return new Color(display, rgb); } return null; }

Target:
private Color createColor(IPreferenceStore store, String key, Display display) { RGB rgb= null; if (store.contains(key)) { if (store.isDefault(key)) rgb= PreferenceConverter.getDefaultColor(store, key); else rgb= PreferenceConverter.getColor(store, key); if (rgb != null) return new Color(display, rgb); } return null; }
Source:
public static Double distance(Object from, Object to) { String unpackedFrom = (String)FunctionUtils.unpack(from); String unpackedTo = (String)FunctionUtils.unpack(to); if (unpackedFrom == null || "".equals(unpackedFrom) || unpackedTo == null || "".equals(unpackedTo)) { return new Double(-1.0); } try { GeoPointData castedFrom = new GeoPointData().cast(new UncastData(unpackedFrom)); GeoPointData castedTo = new GeoPointData().cast(new UncastData(unpackedTo)); return new Double(GeoPointUtils.computeDistanceBetween(castedFrom, castedTo)); } catch (NumberFormatException e) { throw new XPathTypeMismatchException("distance() function requires arguments containing numeric values only"); } }

Target:
public static Double distance(Object from, Object to) { String unpackedFrom = (String)FunctionUtils.unpack(from); String unpackedTo = (String)FunctionUtils.unpack(to); if (unpackedFrom == null || "".equals(unpackedFrom) || unpackedTo == null || "".equals(unpackedTo)) { return new Double(-1.0); } try { GeoPointData castedFrom = new GeoPointData().cast(new UncastData(unpackedFrom)); GeoPointData castedTo = new GeoPointData().cast(new UncastData(unpackedTo)); return new Double(GeoPointUtils.computeDistanceBetween(castedFrom, castedTo)); } catch (NumberFormatException e) { throw new XPathTypeMismatchException("distance() function requires arguments containing " + "numeric values only, but received arguments: " + unpackedFrom + " and " + unpackedTo); } }
Source:
private MsgType getNextMsgType(Map<String, MsgType> msgTypes) { try { return msgTypes.values().iterator().next(); } catch(NoSuchElementException ex) { throw new RuntimeException("Message type not found. Check the MsgType.xml file.", ex); } }

Target:
private MsgType getNextMsgType(Map<String, MsgType> msgTypes) { Iterator<MsgType> it = msgTypes.values().iterator(); if(it.hasNext()) { return it.next(); } else { throw new RuntimeException("Message type not found. Check the MsgType.xml file."); } }
Source:
private void showRelatedIssueOrPR() { TurboIssue issue = listView.getSelectedItem().get(); Optional<String> relatedIssueNumber = listView.getSelectedItem().get().isPullRequest() ? GithubURLPageElements.extractIssueNumber(listView.getSelectedItem().get().getDescription()) : ui.getBrowserComponent().getPRNumberFromIssue(); if (relatedIssueNumber.isPresent()){ ui.triggerEvent( new IssueSelectedEvent(issue.getRepoId(), Integer.parseInt(relatedIssueNumber.get()), panelIndex, issue.isPullRequest()) ); } }

Target:
private void showRelatedIssueOrPR() { if (!listView.getSelectedItem().isPresent()) return; TurboIssue issue = listView.getSelectedItem().get(); Optional<Integer> relatedIssueNumber = listView.getSelectedItem().get().isPullRequest() ? GithubURLPageElements.extractIssueNumber(listView.getSelectedItem().get().getDescription()) : ui.getBrowserComponent().getPRNumberFromIssue(); if (!relatedIssueNumber.isPresent()) return; ui.triggerEvent( new IssueSelectedEvent(issue.getRepoId(), relatedIssueNumber.get(), panelIndex, issue.isPullRequest()) ); }
Source:
private static void handleCounterAspect(ITmfEvent event, ITmfStateSystemBuilder ss, ITmfCounterAspect aspect, int rootQuark) { int quark = (aspect instanceof GroupedCounterAspect) ? ss.getQuarkRelativeAndAdd(rootQuark, ((GroupedCounterAspect) aspect).getGroupIds()) : rootQuark; quark = ss.getQuarkRelativeAndAdd(quark, aspect.getName()); Long resolve = aspect.resolve(event); ss.modifyAttribute(event.getTimestamp().toNanos(), resolve == null ? TmfStateValue.nullValue() : TmfStateValue.newValueLong(resolve), quark); }

Target:
private static void handleCounterAspect(ITmfEvent event, ITmfStateSystemBuilder ss, ITmfCounterAspect aspect, int rootQuark) { int quark = (aspect instanceof GroupedCounterAspect) ? ss.getQuarkRelativeAndAdd(rootQuark, ((GroupedCounterAspect) aspect).getGroupIds()) : rootQuark; quark = ss.getQuarkRelativeAndAdd(quark, aspect.getName()); Long eventContent = aspect.resolve(event); ss.modifyAttribute(event.getTimestamp().toNanos(), eventContent == null ? TmfStateValue.nullValue() : TmfStateValue.newValueLong(eventContent), quark); }
Source:
private String stringifyMRElement(JsonElement element) { String s = element.toString(); if (element.isJsonObject()) { return s; } else { return s.substring(1, s.length() - 1); } }

Target:
private String stringifyMRElement(JsonElement element) { if (element != null) { String stringifiedElement = element.toString(); if (element.isJsonPrimitive() && element.getAsJsonPrimitive().isString()) { return stringifiedElement.substring(1, stringifiedElement.length() - 1); } else { return stringifiedElement; } } else { return null; } }
Source:
public XYAxis(org.eclipse.swtchart.IAxis axis) { fAxis = axis; }

Target:
private XYAxis(org.eclipse.swtchart.IAxis axis) { fAxis = axis; }
Source:
public boolean shouldProcessRequestedCashAdvancesFromSaeData() { return (getConcurParameterValue(ConcurParameterConstants.CONCUR_PROCESS_CASH_ADVANCES_FROM_SAE_DATA_IND).equalsIgnoreCase(KFSConstants.ParameterValues.YES)); }

Target:
public boolean shouldProcessRequestedCashAdvancesFromSaeData() { return (StringUtils.equalsIgnoreCase(getConcurParameterValue(ConcurParameterConstants.CONCUR_PROCESS_CASH_ADVANCES_FROM_SAE_DATA_IND), KFSConstants.ParameterValues.YES)); }
Source:
public ServiceBusReceiverClient buildClient() { return new ServiceBusReceiverClient(buildAsyncClient(), retryOptions.getTryTimeout(), ServiceBusConstants.SHORT_TIMEOUT_BETWEEN_MESSAGES); }

Target:
public ServiceBusReceiverClient buildClient() { return new ServiceBusReceiverClient(buildAsyncClient(), retryOptions.getTryTimeout()); }
Source:
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) req; String requestURI = request.getRequestURI(); if (requestURI.startsWith(openmrsPath + "/module/fhir/rest/swagger.json")) { String newURI = requestURI.replace("/openmrs/module/fhir/rest/swagger.json", "/ms/fhir/fhirDocServelet"); req.getRequestDispatcher(newURI).forward(req, res); } else { chain.doFilter(req, res); } }

Target:
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) req; String requestURI = request.getRequestURI(); if (requestURI.startsWith(openmrsPath + FHIROmodConstants.OPENMRS_FHIR_SWAGGER_SHORT_PATH)) { String newURI = requestURI.replace(FHIROmodConstants.OPENMRS_FHIR_SWAGGER_LONG_PATH, FHIROmodConstants.OPENMRS_FHIR_SWAGGER_ORG_PATH); req.getRequestDispatcher(newURI).forward(req, res); } else { chain.doFilter(req, res); } }
Source:
private MeasurementVariable addTermIdColumn(final TermId TermId, final VariableType VariableType, final String name, final boolean factor) { final MeasurementVariable MeasurementVariable = new MeasurementVariable(); MeasurementVariable.setName(StringUtils.isBlank(name) ? TermId.name() : name); MeasurementVariable.setAlias(TermId.name()); MeasurementVariable.setTermId(TermId.getId()); MeasurementVariable.setVariableType(VariableType); MeasurementVariable.setFactor(true); return MeasurementVariable; }

Target:
private MeasurementVariable addTermIdColumn(final TermId TermId, final VariableType VariableType, final String name, final boolean factor) { final MeasurementVariable MeasurementVariable = new MeasurementVariable(); MeasurementVariable.setName(StringUtils.isBlank(name) ? TermId.name() : name); MeasurementVariable.setAlias(TermId.name()); MeasurementVariable.setTermId(TermId.getId()); MeasurementVariable.setVariableType(VariableType); MeasurementVariable.setFactor(factor); return MeasurementVariable; }
Source:
public void finish(TimePeriod timeout) { log.info("Finish wizard"); new FinishButton(this).click(); new WaitUntil(new ShellHasChildrenOrIsNotAvailable(getShell())); if(!getShell().isDisposed()){ try { ShellIsAvailable serverShell = new ShellIsAvailable("Server"); new WaitUntil(serverShell); new OkButton(new DefaultShell(serverShell.getResult())).click(); new WaitWhile(serverShell); } catch (WaitTimeoutExpiredException exc) { } new WaitWhile(new WindowIsAvailable(this), timeout); } new WaitWhile(new JobIsRunning(), timeout); }

Target:
public void finish(TimePeriod timeout) { log.info("Finish wizard"); new FinishButton(this).click(); new WaitUntil(new ShellHasChildrenOrIsNotAvailable(getShell())); if(!getShell().isDisposed()){ ShellIsAvailable serverShell = new ShellIsAvailable("Server"); new WaitUntil(serverShell, TimePeriod.DEFAULT, false); if (serverShell.getResult() != null) { new OkButton(new DefaultShell(serverShell.getResult())).click(); new WaitWhile(serverShell); } new WaitWhile(new WindowIsAvailable(this), timeout); } new WaitWhile(new JobIsRunning(), timeout); }
Source:
public DecimalFormat decimalFormat() { return DecimalFormat.valueOf(getString(DECIMAL_FORMAT_CONFIG).toUpperCase(Locale.ROOT)); }

Target:
public DecimalFormat decimalFormat() { return decimalFormat; }
Source:
private Set<AccountGroup.Id> queryForGroups(final DirContext ctx, final String username, LdapQuery.Result account) throws NamingException, AccountException { final HashMap<String, String> params = new HashMap<String, String>(); params.put(USERNAME, username); if (groupNeedsAccount) { if (account == null) { account = findAccount(ctx, username); } for (final String name : groupMemberQueryList.get(0).getParameters()) { params.put(name, account.get(name)); } } final Set<AccountGroup.Id> actual = new HashSet<AccountGroup.Id>(); for (LdapQuery groupMemberQuery : groupMemberQueryList) { for (LdapQuery.Result r : groupMemberQuery.query(ctx, params)) { NamingEnumeration groups = r.getAll(memberField).getAll(); while (groups.hasMore()) { final String name = String.valueOf(groups.next()); final AccountGroup group = groupCache.lookup(name); if (group != null && isLdapGroup(group)) { actual.add(group.getId()); } } } } if (actual.isEmpty()) { return Collections.emptySet(); } else { return Collections.unmodifiableSet(actual); } }

Target:
private Set<AccountGroup.Id> queryForGroups(final DirContext ctx, final String username, LdapQuery.Result account) throws NamingException, AccountException { final HashMap<String, String> params = new HashMap<String, String>(); params.put(USERNAME, username); if (groupNeedsAccount) { if (account == null) { account = findAccount(ctx, username); } for (final String name : groupMemberQueryList.get(0).getParameters()) { params.put(name, account.get(name)); } } final Set<AccountGroup.Id> actual = new HashSet<AccountGroup.Id>(); for (LdapQuery groupMemberQuery : groupMemberQueryList) { for (LdapQuery.Result r : groupMemberQuery.query(ctx, params)) { NamingEnumeration groups = r.getAll(memberField).getAll(); while (groups.hasMore()) { final String dn = String.valueOf(groups.next()); try { String attrs[] = { "displayName" }; Attributes ldapGroup = ctx.getAttributes(dn, attrs); String name = String.valueOf(ldapGroup.get("displayName")); name = name.replace("displayName: ", ""); final AccountGroup group = groupCache.lookup(name); if (group != null && isLdapGroup(group)) { actual.add(group.getId()); } } catch (NamingException e) { } } } } if (actual.isEmpty()) { return Collections.emptySet(); } else { return Collections.unmodifiableSet(actual); } }
Source:
private PortSelection get(String springPropertyName, String namedPort) { PortSelection portSelection = get(springPropertyName, springPropertyName, PortSource.FROM_SPRING_PROPERTY); if (!portSelection.hasValue() || "-1".equals(portSelection.getPayload())) { if (isKubernetes(environment)) { portSelection = get(springPropertyName, namedPort, PortSource.FROM_PORT_NAMED); } else { portSelection = get(springPropertyName, "PORT" + portIndex, PortSource.FROM_PORT_ORDINAL); portIndex++; } } return portSelection; }

Target:
private PortSelection get(String springPropertyName, String namedPort) { PortSelection portSelection; if (isKubernetes(environment)) { portSelection = get(springPropertyName, namedPort, PortSource.FROM_PORT_NAMED); if (!portSelection.hasValue()) { portSelection = get(springPropertyName, springPropertyName, PortSource.FROM_SPRING_PROPERTY); } } else { portSelection = get(springPropertyName, springPropertyName, PortSource.FROM_SPRING_PROPERTY); if (!portSelection.hasValue() || "-1".equals(portSelection.getPayload())) { final String ordinalPortName = "PORT" + allocateNewPort(springPropertyName); portSelection = get(springPropertyName, ordinalPortName, PortSource.FROM_PORT_ORDINAL); } } return portSelection; }
Source:
public UseClauseTree GROUP_USE_CLAUSE() { return b.<UseClauseTree>nonterminal(PHPLexicalGrammar.GROUP_USE_CLAUSE).is( f.groupUseClause( b.optional( b.firstOf( b.token(PHPKeyword.CONST), b.token(PHPKeyword.FUNCTION))), NAMESPACE_NAME(), b.optional( f.newTuple55( b.token(PHPKeyword.AS), b.token(PHPLexicalGrammar.IDENTIFIER))))); }

Target:
public UseClauseTree GROUP_USE_CLAUSE() { return b.<UseClauseTree>nonterminal(PHPLexicalGrammar.GROUP_USE_CLAUSE).is( f.groupUseClause( b.optional(USE_TYPE()), NAMESPACE_NAME(), b.optional( f.newTuple55( b.token(PHPKeyword.AS), b.token(PHPLexicalGrammar.IDENTIFIER))))); }
Source:
private void checkSupportedVersion(IProgressMonitor monitor) throws GerritException { Version version = getVersion(monitor); if (GerritVersion.isVersion26OrLater(version)) { throw new GerritException(NLS.bind("Gerrit {0} or later is not supported yet.", GerritVersion.VERSION_2_6)); } }

Target:
private void checkSupportedVersion(IProgressMonitor monitor) throws GerritException { Version version = getVersion(monitor); if (GerritVersion.isVersion26OrLater(version)) { throw new GerritException( NLS.bind("Gerrit {0} or later is not supported yet.", GerritVersion.VERSION_2_6_0)); } }
Source:
private Image getTargetImage(Entity e){ if(bv == null){ return null; }else { if (e.isDestroyed()) { return bv.getTilesetManager().wreckMarkerFor(e, -1); } else { return bv.getTilesetManager().imageFor(e); } } }

Target:
private Image getTargetImage(Entity e){ if (bv == null) { return null; } else if (e.isDestroyed()) { return bv.getTilesetManager().wreckMarkerFor(e, -1); } else { return bv.getTilesetManager().imageFor(e); } }
Source:
private boolean hasPhone(SurveyDB survey) { Context context = PreferencesState.getInstance().getContext(); for (ValueDB value : survey.getValueDBs()) { if (value.getQuestionDB().getCode().equals( context.getString(R.string.phone_ownership_qc))) { return !(value.getOptionDB().getCode().equals( context.getString(R.string.no_phone_oc))); } } return false; }

Target:
private boolean hasPhone(SurveyDB survey) { Context context = PreferencesState.getInstance().getContext(); return !(survey.getOptionSelectedForQuestionCode( context.getString(R.string.phone_ownership_qc)).getName().equals( context.getString(R.string.no_phone_on))); }
Source:
public synchronized List<Transaction> addPendingTransactions(List<Transaction> transactions) { int unknownTx = 0; List<Transaction> newPending = new ArrayList<>(); for (Transaction tx : transactions) { if (addNewTxIfNotExist(tx)) { unknownTx++; if (addPendingTransactionImpl(tx)) { newPending.add(tx); } } } logger.debug("Wire transaction list added: total: {}, new: {}, valid (added to pending): (current #of known txs: {})", transactions.size(), unknownTx, newPending, receivedTxs.size()); if (!newPending.isEmpty()) { this.publisher .publish(new PendingTransactionsReceivedEvent(newPending)) .publish(new PendingStateChangedEvent(PendingStateImpl.this)); } return newPending; }

Target:
public synchronized List<Transaction> addPendingTransactions(List<Transaction> transactions) { int unknownTx = 0; List<Transaction> newPending = new ArrayList<>(); for (Transaction tx : transactions) { if (addNewTxIfNotExist(tx)) { unknownTx++; if (addPendingTransactionImpl(tx)) { newPending.add(tx); } } } logger.debug("Wire transaction list added: total: {}, new: {}, valid (added to pending): (current #of known txs: {})", transactions.size(), unknownTx, newPending, receivedTxs.size()); if (!newPending.isEmpty()) { listener.onPendingTransactionsReceived(newPending); listener.onPendingStateChanged(this); } return newPending; }
Source:
public void update(Session session, Row oldRow, Row newRow) { if (compareRows(oldRow, newRow ) != 0) { super.update(session, oldRow, newRow); } }

Target:
public void update(Session session, Row oldRow, Row newRow) { if (!rowsAreEqual(oldRow, newRow)) { super.update(session, oldRow, newRow); } }
Source:
private SubPlan buildFragment(PlanNode root, FragmentProperties properties, PlanFragmentId fragmentId) { Set<Symbol> dependencies = SymbolsExtractor.extractUnique(root); List<PlanNodeId> schedulingOrder = new SchedulingOrderVisitor().getSchedulingOrder(root); boolean equals = properties.getPartitionedSources().equals(ImmutableSet.copyOf(schedulingOrder)); checkArgument(equals, "Expected scheduling order (%s) to contain an entry for all partitioned sources (%s)", schedulingOrder, properties.getPartitionedSources()); PlanFragment fragment = new PlanFragment( fragmentId, root, Maps.filterKeys(types, in(dependencies)), properties.getPartitioningHandle(), schedulingOrder, properties.getPartitioningScheme()); return new SubPlan(fragment, properties.getChildren()); }

Target:
private SubPlan buildFragment(PlanNode root, FragmentProperties properties, PlanFragmentId fragmentId) { Set<Symbol> dependencies = SymbolsExtractor.extractAll(root); List<PlanNodeId> schedulingOrder = new SchedulingOrderVisitor().getSchedulingOrder(root); boolean equals = properties.getPartitionedSources().equals(ImmutableSet.copyOf(schedulingOrder)); checkArgument(equals, "Expected scheduling order (%s) to contain an entry for all partitioned sources (%s)", schedulingOrder, properties.getPartitionedSources()); PlanFragment fragment = new PlanFragment( fragmentId, root, Maps.filterKeys(types, in(dependencies)), properties.getPartitioningHandle(), schedulingOrder, properties.getPartitioningScheme()); return new SubPlan(fragment, properties.getChildren()); }
Source:
public void writeCopy(File file, byte[] key) { if (file.isFile() && file.exists()) { throw new IllegalArgumentException("The destination file must not exist"); } if (key != null && key.length != 64) { throw new IllegalArgumentException("Realm AES keys must be 64 bytes long"); } nativeWriteCopy(nativePtr, file.getAbsolutePath(), key); }

Target:
public void writeCopy(File file, byte[] key) { if (file.isFile() && file.exists()) { throw new IllegalArgumentException("The destination file must not exist"); } nativeWriteCopy(nativePtr, file.getAbsolutePath(), key); }
Source:
public void badValueThrowsException() throws Exception { final Throwable exn = catchThrowable(() -> new SizeParam("10 kelvins", "degrees")); assertThat(exn).isInstanceOf(WebApplicationException.class); final Response response = ((WebApplicationException) exn).getResponse(); assertThat(response.getStatus()).isEqualTo(400); assertThat((ErrorMessage) response.getEntity()) .isEqualTo(new ErrorMessage(400, "degrees is not a valid duration.")); }

Target:
public void badValueThrowsException() throws Exception { final Throwable exn = catchThrowable(() -> new SizeParam("10 kelvins", "degrees")); assertThat(exn).isInstanceOf(WebApplicationException.class); final Response response = ((WebApplicationException) exn).getResponse(); assertThat(response.getStatus()).isEqualTo(400); assertThat((ErrorMessage) response.getEntity()) .isEqualTo(new ErrorMessage(400, "degrees is not a valid size.")); }
Source:
public void onResume() { EventBusExt.getDefault().register(this); titleListener.setTitle("Hub"); super.onResume(); String publicId = getArguments().getString(EXTRA_ID, null); if(publicId != null) { TaskQueue.loadQueueDefault(getActivity()).execute(new GetUserTask(publicId)); } else { TaskQueue.loadQueueDefault(getActivity()).execute( new DbGetUserTask(AppPrefs.getInstance(getActivity()).getCurrentUserId())); } }

Target:
public void onResume() { if(! EventBusExt.getDefault().isRegistered(this)) { EventBusExt.getDefault().register(this); } titleListener.setTitle("Hub"); super.onResume(); String publicId = getArguments().getString(EXTRA_ID, null); if(publicId != null) { TaskQueue.loadQueueDefault(getActivity()).execute(new GetUserTask(publicId, true)); } else { DatabaseHelper.defaultDatabaseQueue(getActivity()).execute( new DbGetUserTask(AppPrefs.getInstance(getActivity()).getCurrentUserId())); } }
Source:
public Long getUuid() { return new Long(user.getArtId()); }

Target:
public Long getUuid() { return Long.valueOf(user.getArtId()); }
Source:
public void testIsWithinHammingDistanceExceptions(final String s1, final String s2, final int maxHammingDistance) { Assert.assertEquals(StringUtil.hammingDistance(s1, s2), 0); Assert.assertEquals(StringUtil.isWithinHammingDistance(s1, s2, maxHammingDistance), true); }

Target:
public void testIsWithinHammingDistanceExceptions(final String s1, final String s2, final int maxHammingDistance) { StringUtil.isWithinHammingDistance(s1, s2, maxHammingDistance); }
Source:
public void testOtherFieldsNotValidatedInImport() { ImportVmParameters parameters = createParameters(); String stringOf5000Chars = RandomUtils.instance().nextNameString(BusinessEntitiesDefinitions.GENERAL_MAX_SIZE + 1); parameters.getVm().setUserDefinedProperties(stringOf5000Chars); parameters.setImportAsNewEntity(true); ImportVmCommand command = new ImportVmCommand(parameters); Set<ConstraintViolation<ImportVmParameters>> validate = ValidationUtils.getValidator().validate(parameters, command.getValidationGroups().toArray(new Class<?>[0])); assertTrue(validate.isEmpty()); parameters.getVm().setUserDefinedProperties(stringOf5000Chars); parameters.setImportAsNewEntity(false); command = new ImportVmCommand(parameters); validate = ValidationUtils.getValidator().validate(parameters, command.getValidationGroups().toArray(new Class<?>[0])); assertTrue(validate.isEmpty()); }

Target:
public void testOtherFieldsNotValidatedInImport() { ImportVmParameters parameters = createParameters(); String tooLongString = RandomUtils.instance().nextPropertyString(BusinessEntitiesDefinitions.GENERAL_MAX_SIZE + 1); parameters.getVm().setUserDefinedProperties(tooLongString); parameters.setImportAsNewEntity(true); ImportVmCommand command = new ImportVmCommand(parameters); Set<ConstraintViolation<ImportVmParameters>> validate = ValidationUtils.getValidator().validate(parameters, command.getValidationGroups().toArray(new Class<?>[0])); assertTrue(validate.isEmpty()); parameters.getVm().setUserDefinedProperties(tooLongString); parameters.setImportAsNewEntity(false); command = new ImportVmCommand(parameters); validate = ValidationUtils.getValidator().validate(parameters, command.getValidationGroups().toArray(new Class<?>[0])); assertTrue(validate.isEmpty()); }
Source:
EtcdMembersResponse( @JsonProperty("members") List<MemberInfo> members) { this.members = members; }

Target:
EtcdMembersResponse( @JsonProperty("members") List<MemberInfo> members) { this.members = Collections.unmodifiableList(members); }
Source:
private void teardown() { if (torndown) { return; } torndown = true; serverHelperExecutor.submit(new Runnable() { @Override public void run() { if (publisherChannels.containsValue(this)) { final Iterator<Entry<String, AbstractLengthPrependerClient>> i = publisherChannels.entrySet().iterator(); while (i.hasNext()) { if (i.next().getValue() == Publisher.this) { i.remove(); break; } } } ArrayList<LogicalNode> list = new ArrayList<>(); String publisherIdentifier = datalist.getIdentifier(); Iterator<LogicalNode> iterator = subscriberGroups.values().iterator(); while (iterator.hasNext()) { LogicalNode ln = iterator.next(); if (publisherIdentifier.equals(ln.getUpstream())) { list.add(ln); } } for (LogicalNode ln : list) { logger.debug("Booting logical node from publisher", ln); ln.boot(); } } }); }

Target:
private void teardown() { if (torndown) { return; } torndown = true; serverHelperExecutor.submit(() -> { String publisherIdentifier = datalist.getIdentifier(); if (!publisherChannels.remove(publisherIdentifier, Publisher.this)) { logger.warn("{} could not be removed from channels", Publisher.this); } subscriberGroups.forEach((type, ln) -> { if (publisherIdentifier.equals(ln.getUpstream())) { logger.debug("Booting logical node from publisher", ln); ln.boot(); } }); }); }
Source:
public boolean isConnected() { boolean isConnected = false; if (initialized) { try { isConnected = restApi().isConnected(sid); } catch (NotConnectedRestException e) { } } return isConnected; }

Target:
public boolean isConnected() { boolean isConnected = false; if (initialized) { try { isConnected = restApi().isConnected(sid); } catch (Throwable e) { } } return isConnected; }
Source:
private synchronized void initializeSpelFunctionRegistrarIfNecessary(ParserContext parserContext) { if (!this.initialized) { BeanDefinitionBuilder registrarBuilder = BeanDefinitionBuilder .genericBeanDefinition(IntegrationNamespaceUtils.BASE_PACKAGE + ".config.SpelFunctionRegistrar"); registrarBuilder.addConstructorArgValue(this.functions); BeanDefinitionReaderUtils.registerWithGeneratedName(registrarBuilder.getBeanDefinition(), parserContext.getRegistry()); this.initialized = true; } }

Target:
private synchronized void initializeSpelFunctionRegistrarIfNecessary(ParserContext parserContext) { if (!this.initialized) { BeanDefinitionBuilder registrarBuilder = BeanDefinitionBuilder .genericBeanDefinition(IntegrationNamespaceUtils.BASE_PACKAGE + ".config.SpelFunctionRegistrar") .setRole(BeanDefinition.ROLE_INFRASTRUCTURE) .addConstructorArgValue(this.functions); BeanDefinitionReaderUtils.registerWithGeneratedName(registrarBuilder.getBeanDefinition(), parserContext.getRegistry()); this.initialized = true; } }
Source:
protected FixedDoubleHistogram(FixedDoubleHistogram other) { bucketCount = other.bucketCount; min = other.min; max = other.max; weights = new double[bucketCount]; for (int i = 0; i < bucketCount; ++i) { weights[i] = other.weights[i]; } }

Target:
protected FixedDoubleHistogram(FixedDoubleHistogram other) { bucketCount = other.bucketCount; min = other.min; max = other.max; weights = new double[bucketCount]; System.arraycopy(other.weights, 0, weights, 0, bucketCount); }
Source:
public HostCriteria(boolean paused, UUID configHash, UUID meshHash, boolean enterprise, StartAction startAction, boolean bare, int hostCount, NodeState nodeState, boolean addAllowed, boolean safeMode, String terminusNonce) { checkArgument(configHash != null, "config hash is null"); checkArgument(meshHash != null, "mesh hash is null"); checkArgument(startAction != null, "start action is null"); checkArgument(hostCount > 0, "host count %s is less then one", hostCount); checkArgument(terminusNonce == null || !terminusNonce.trim().isEmpty(), "terminus is blank"); m_paused = paused; m_configHash = configHash; m_meshHash = meshHash; m_enterprise = enterprise; m_startAction = startAction; m_bare = bare; m_hostCount = hostCount; m_nodeState = nodeState; m_addAllowed = addAllowed; m_safeMode = safeMode; m_terminusNonce = terminusNonce; }

Target:
public HostCriteria(boolean paused, UUID configHash, UUID meshHash, boolean enterprise, StartAction startAction, boolean bare, int hostCount, NodeState nodeState, boolean addAllowed, boolean safeMode, String terminusNonce) { checkArgument(configHash != null, "config hash is null"); checkArgument(meshHash != null, "mesh hash is null"); checkArgument(startAction != null, "start action is null"); checkArgument(hostCount > 0, "host count %s is less then one", hostCount); checkArgument(terminusNonce == null || !terminusNonce.trim().isEmpty(), "terminus should not be blank"); m_paused = paused; m_configHash = configHash; m_meshHash = meshHash; m_enterprise = enterprise; m_startAction = startAction; m_bare = bare; m_hostCount = hostCount; m_nodeState = nodeState; m_addAllowed = addAllowed; m_safeMode = safeMode; m_terminusNonce = terminusNonce; }
Source:
public void testExecute() { InstructorAttributes instructor = typicalBundle.instructors.get("instructor1OfCourse1"); String instructorId = instructor.googleId; loginAsInstructor(instructorId); ______TS("Invalid parameters"); verifyHttpParameterFailure(); String[] invalidParams = new String[] {}; verifyHttpParameterFailure(invalidParams); ______TS("Typical successful case"); String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, instructor.courseId, }; GetCourseEnrollStudentsAction action = getAction(submissionParams); JsonResult jsonResult = getJsonResult(action); assertEquals(HttpStatus.SC_OK, jsonResult.getStatusCode()); String expectedString = "Section 1|Team 1.1</td></div>'\"|student1 In Course1</td></div>'\"" + "|student1InCourse1@gmail.tmt|comment for student1InCourse1</td></div>'\"" + "Section 1|Team 1.1</td></div>'\"|student2 In Course1|student2InCourse1@gmail.tmt|" + "Section 1|Team 1.1</td></div>'\"|student3 In Course1|student3InCourse1@gmail.tmt|" + "Section 1|Team 1.1</td></div>'\"|student4 In Course1|student4InCourse1@gmail.tmt|" + "Section 2|Team 1.2|student5 In Course1|student5InCourse1@gmail.tmt|"; StudentList output = (StudentList) jsonResult.getOutput(); StringBuilder resultString = new StringBuilder(); for (StudentAttributes student : output.getEnrolledStudents()) { resultString.append(student.toEnrollmentString()); } assertEquals(expectedString, resultString.toString()); }

Target:
public void testExecute() { InstructorAttributes instructor = typicalBundle.instructors.get("instructor1OfCourse1"); String instructorId = instructor.googleId; loginAsInstructor(instructorId); ______TS("Invalid parameters"); verifyHttpParameterFailure(); ______TS("Typical successful case"); String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, instructor.courseId, }; GetCourseEnrollStudentsAction action = getAction(submissionParams); JsonResult jsonResult = getJsonResult(action); assertEquals(HttpStatus.SC_OK, jsonResult.getStatusCode()); String expectedString = "Section 1|Team 1.1</td></div>'\"|student1 In Course1</td></div>'\"" + "|student1InCourse1@gmail.tmt|comment for student1InCourse1</td></div>'\"" + "Section 1|Team 1.1</td></div>'\"|student2 In Course1|student2InCourse1@gmail.tmt|" + "Section 1|Team 1.1</td></div>'\"|student3 In Course1|student3InCourse1@gmail.tmt|" + "Section 1|Team 1.1</td></div>'\"|student4 In Course1|student4InCourse1@gmail.tmt|" + "Section 2|Team 1.2|student5 In Course1|student5InCourse1@gmail.tmt|"; StudentList output = (StudentList) jsonResult.getOutput(); StringBuilder resultString = new StringBuilder(); for (StudentAttributes student : output.getEnrolledStudents()) { resultString.append(student.toEnrollmentString()); } assertEquals(expectedString, resultString.toString()); }
Source:
protected void assertMegabyteAndETagMatches(String regionId, String containerName, String name, String etag1s) { SwiftObject object1s = getApi().getObjectApi(regionId, containerName).get(name); assertThat(object1s.getETag().equals(etag1s)); assertThat(object1s.getPayload().getContentMetadata().getContentLength().equals(Long.valueOf(1024 * 1024))); }

Target:
protected void assertMegabyteAndETagMatches(String regionId, String containerName, String name, String etag1s) { SwiftObject object1s = getApi().getObjectApi(regionId, containerName).get(name); assertThat(object1s.getETag()).isEqualTo(etag1s); assertThat(object1s.getPayload().getContentMetadata().getContentLength()).isEqualTo(Long.valueOf(1024L * 1024L)); }
Source:
public void visitNode(Tree tree) { if(!hasSemantic()) { return; } if (tree.is(Tree.Kind.METHOD, Tree.Kind.CONSTRUCTOR)) { checkIfUnused((MethodTree) tree); } else { checkIfUnknown(tree); } }

Target:
public void visitNode(Tree tree) { if(!hasSemantic()) { return; } switch (tree.kind()) { case METHOD: case CONSTRUCTOR: checkIfUnused((MethodTree) tree); break; case NEW_CLASS: checkIfUnknown((NewClassTree) tree); break; case METHOD_INVOCATION: checkIfUnknown((MethodInvocationTree) tree); break; case METHOD_REFERENCE: checkIfUnknown((MethodReferenceTree) tree); break; default: throw new IllegalStateException("Unexpected subscribed tree."); } }
Source:
private String formatAccountAttribute(AccountAttribute who) { if (who != null && who.name != null) { return who.name; } return anonymousCowardName; }

Target:
private String formatAccountAttribute(AccountAttribute who) { if (who != null && !Strings.isNullOrEmpty(who.name)) { return who.name; } return anonymousCowardName; }
Source:
public <JavaTypeT> TypeCodec<JavaTypeT> codecFor(@NonNull JavaTypeT value) { Preconditions.checkNotNull(value); LOG.trace("[{}] Looking up codec for object {}", logPrefix, value); for (TypeCodec<?> primitiveCodec : primitiveCodecs) { if (primitiveCodec.accepts(value)) { LOG.trace("[{}] Found matching primitive codec {}", logPrefix, primitiveCodec); return uncheckedCast(primitiveCodec); } } for (TypeCodec<?> userCodec : userCodecs) { if (userCodec.accepts(value)) { LOG.trace("[{}] Found matching user codec {}", logPrefix, userCodec); return uncheckedCast(userCodec); } } DataType cqlType = inferCqlTypeFromValue(value); GenericType<?> javaType = inspectType(value, cqlType); LOG.trace("[{}] Continuing based on inferred type {}", logPrefix, javaType); return uncheckedCast(getCachedCodec(cqlType, javaType, true)); }

Target:
public <JavaTypeT> TypeCodec<JavaTypeT> codecFor(@NonNull JavaTypeT value) { Preconditions.checkNotNull(value); LOG.trace("[{}] Looking up codec for object {}", logPrefix, value); for (TypeCodec<?> primitiveCodec : primitiveCodecs) { if (primitiveCodec.accepts(value)) { LOG.trace("[{}] Found matching primitive codec {}", logPrefix, primitiveCodec); return uncheckedCast(primitiveCodec); } } for (TypeCodec<?> userCodec : userCodecs) { if (userCodec.accepts(value)) { LOG.trace("[{}] Found matching user codec {}", logPrefix, userCodec); return uncheckedCast(userCodec); } } DataType cqlType = inferCqlTypeFromValue(value); GenericType<?> javaType = inspectType(value, cqlType); LOG.trace( "[{}] Continuing based on inferred CQL type and Java type {}", logPrefix, cqlType, javaType); return uncheckedCast(getCachedCodec(cqlType, javaType, true)); }
Source:
private void initXPathRuleQuery() { if (xPathRuleQueryNeedsInitialization()) { final String xpath = getProperty(XPATH_DESCRIPTOR); final String version = getProperty(VERSION_DESCRIPTOR); initRuleQueryBasedOnVersion(version); xpathRuleQuery.setXPath(xpath); xpathRuleQuery.setVersion(version); xpathRuleQuery.setProperties(getPropertiesByPropertyDescriptor()); } }

Target:
private void initXPathRuleQuery() { String xpath = getProperty(XPATH_DESCRIPTOR); String version = getProperty(VERSION_DESCRIPTOR); initRuleQueryBasedOnVersion(version); xpathRuleQuery.setXPath(xpath); xpathRuleQuery.setVersion(version); xpathRuleQuery.setProperties(getPropertiesByPropertyDescriptor()); }
Source:
public void newFolderWithGivenFolderThrowsIOExceptionIfFolderNameConsistsOfMultiplePathComponents() throws IOException { thrown.expect(IOException.class); String errorMsg = "Folder name cannot consist of multiple path components separated by a file separator." + " Please use newFolder('MyParentFolder','MyFolder') to create hierarchies of folders"; thrown.expectMessage(errorMsg); tempFolder.create(); tempFolder.newFolder("temp1/temp2"); }

Target:
public void newFolderWithGivenFolderThrowsIOExceptionIfFolderNameConsistsOfMultiplePathComponents() throws IOException { tempFolder.create(); thrown.expect(IOException.class); thrown.expectMessage("name cannot consist of multiple path components"); tempFolder.newFolder("temp1/temp2"); }
Source:
public static <O extends JavaSource<O>> int getArrayDimension(String name) { int count = 0; if (name != null) { if (isGeneric(name)) { name = stripGenerics(name); } for (char c : name.toCharArray()) { if (c == '[') { count++; } } } return count; }

Target:
public static int getArrayDimension(String name) { int count = 0; if (name != null) { if (isGeneric(name)) { name = stripGenerics(name); } for (char c : name.toCharArray()) { if (c == '[') { count++; } } } return count; }
Source:
public Type getType() { return null; }

Target:
public Type getType() { return Type.SHARED; }
Source:
public void open() throws InterpreterException { sparkInterpreter = getInterpreterInTheSameSessionByClassName(SparkInterpreter.class); jsc = sparkInterpreter.getJavaSparkContext(); sparkVersion = SparkVersion.fromVersionString(jsc.version()); assertVersion(); z = sparkInterpreter.getZeppelinContext(); SparkKotlinReceiver ctx = new SparkKotlinReceiver( sparkInterpreter.getSparkSession(), jsc, sparkInterpreter.getSQLContext(), z); List<String> classpath = sparkClasspath(); String outputDir = null; SparkConf conf = jsc.getConf(); if (conf != null) { outputDir = conf.getOption("spark.repl.class.outputDir").getOrElse(null); } interpreter.properties() .receiver(ctx) .classPath(classpath) .outputDir(outputDir) .codeOnLoad(KotlinZeppelinBindings.Z_SELECT_KOTLIN_SYNTAX) .codeOnLoad(KotlinZeppelinBindings.SPARK_UDF_IMPORTS) .codeOnLoad(KotlinZeppelinBindings.CAST_SPARK_SESSION); interpreter.open(); }

Target:
public void open() throws InterpreterException { sparkInterpreter = getInterpreterInTheSameSessionByClassName(SparkInterpreter.class); jsc = sparkInterpreter.getJavaSparkContext(); SparkVersion sparkVersion = SparkVersion.fromVersionString(jsc.version()); if (sparkVersion.olderThan(KOTLIN_SPARK_SUPPORTED_VERSION)) { unsupportedMessage = new InterpreterResult( InterpreterResult.Code.ERROR, "Spark version is " + sparkVersion + ", only " + KOTLIN_SPARK_SUPPORTED_VERSION + " and newer are supported"); } z = sparkInterpreter.getZeppelinContext(); SparkKotlinReceiver ctx = new SparkKotlinReceiver( sparkInterpreter.getSparkSession(), jsc, sparkInterpreter.getSQLContext(), z); List<String> classpath = sparkClasspath(); String outputDir = null; SparkConf conf = jsc.getConf(); if (conf != null) { outputDir = conf.getOption("spark.repl.class.outputDir").getOrElse(null); } interpreter.getKotlinReplProperties() .receiver(ctx) .classPath(classpath) .outputDir(outputDir) .codeOnLoad(KotlinZeppelinBindings.Z_SELECT_KOTLIN_SYNTAX) .codeOnLoad(KotlinZeppelinBindings.SPARK_UDF_IMPORTS) .codeOnLoad(KotlinZeppelinBindings.CAST_SPARK_SESSION); interpreter.open(); }
Source:
protected Builder() { id("packet") .name("Packet Compute Services") .apiMetadata(new PacketApiMetadata()) .homepage(URI.create("<LINK_1>")) .console(URI.create("<LINK_2>")) .endpoint("<LINK_0>") .defaultProperties(PacketProviderMetadata.defaultProperties()); }

Target:
protected Builder() { id("packet") .name("Packet Compute Services") .apiMetadata(new PacketApiMetadata()) .homepage(URI.create("<LINK_1>")) .console(URI.create("<LINK_2>")) .endpoint("<LINK_0>") .iso3166Codes("US-CA", "US-NJ", "NL", "JP") .defaultProperties(PacketProviderMetadata.defaultProperties()); }
Source:
public Optional<Object> value() { return Optional.of(_value); }

Target:
public Optional<Object> value() { return Optional.ofNullable(_value); }
Source:
public static void listJobs() throws IOException { String projectId = "your-project-id"; String filter = "state=DONE"; String jobType = "INSPECT_JOB"; listJobs(projectId, filter, jobType); }

Target:
public static void listJobs() throws IOException { String projectId = "your-project-id"; listJobs(projectId); }