auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void outbound(SmppOutboundMessageEntity request) throws SmppInvalidArgumentException, IOException { byte[] textBytes; int smppTonNpiValue = Integer.parseInt(SmppService.getSmppTonNpiValue()); SubmitSm submit0 = new SubmitSm(); submit0.setSourceAddress(new Address((byte) smppTonNpiValue, (byte) smppTonNpiValue, request.getSmppFrom())); submit0.setDestAddress(new Address((byte) smppTonNpiValue, (byte) smppTonNpiValue, request.getSmppTo())); if (CharsetUtil.CHARSET_UCS_2 == request.getSmppEncoding()) { submit0.setDataCoding(DataCoding.DATA_CODING_UCS2); textBytes = CharsetUtil.encode(request.getSmppContent(), CharsetUtil.CHARSET_UCS_2); } else { submit0.setDataCoding(DataCoding.DATA_CODING_GSM7); textBytes = CharsetUtil.encode(request.getSmppContent(), CharsetUtil.CHARSET_ISO_8859_1); } submit0.setShortMessage(textBytes); TlvSet tlvSet = request.getTlvSet(); if (tlvSet != null) { for (Tlv tlv : (Collection<Tlv>) tlvSet.getOptionalParameters()) { submit0.setOptionalParameter(tlv); } } else if (logger.isInfoEnabled()) { logger.info("TlvSet is null"); } try { if (logger.isInfoEnabled()) { logger.info("Sending SubmitSM for " + request); } SmppClientOpsThread.getSmppSession().submit(submit0, 10000); } catch (RecoverablePduException | UnrecoverablePduException | SmppTimeoutException | SmppChannelException | InterruptedException e) { logger.error("SMPP message cannot be sent : " + e); } }

Target:
public void outbound(SmppOutboundMessageEntity request) throws SmppInvalidArgumentException, IOException { byte[] textBytes; int smppTonNpiValue = Integer.parseInt(SmppService.getSmppTonNpiValue()); SubmitSm submit0 = new SubmitSm(); submit0.setSourceAddress(new Address((byte) smppTonNpiValue, (byte) smppTonNpiValue, request.getSmppFrom())); submit0.setDestAddress(new Address((byte) smppTonNpiValue, (byte) smppTonNpiValue, request.getSmppTo())); if (CharsetUtil.CHARSET_UCS_2 == request.getSmppEncoding()) { submit0.setDataCoding(SmppConstants.DATA_CODING_UCS2); textBytes = CharsetUtil.encode(request.getSmppContent(), CharsetUtil.CHARSET_UCS_2); } else { submit0.setDataCoding(SmppConstants.DATA_CODING_DEFAULT); textBytes = CharsetUtil.encode(request.getSmppContent(), SmppClientOpsThread.getOutboundDefaultEncoding()); } submit0.setShortMessage(textBytes); TlvSet tlvSet = request.getTlvSet(); if (tlvSet != null) { for (Tlv tlv : (Collection<Tlv>) tlvSet.getOptionalParameters()) { submit0.setOptionalParameter(tlv); } } else if (logger.isInfoEnabled()) { logger.info("TlvSet is null"); } try { if (logger.isInfoEnabled()) { logger.info("Sending SubmitSM for " + request); } SmppClientOpsThread.getSmppSession().submit(submit0, 10000); } catch (RecoverablePduException | UnrecoverablePduException | SmppTimeoutException | SmppChannelException | InterruptedException e) { logger.error("SMPP message cannot be sent : " + e); } }
Source:
public void initializeContextTypeResolvers() { addResolver(new GlobalTemplateVariables.Cursor()); addResolver(new GlobalTemplateVariables.WordSelection()); addResolver(new Selection(org.eclipse.jface.text.templates.GlobalTemplateVariables.LineSelection.NAME, JavaTemplateMessages.CompilationUnitContextType_variable_description_line_selection)); addResolver(new GlobalTemplateVariables.Dollar()); addResolver(new GlobalTemplateVariables.Date()); addResolver(new GlobalTemplateVariables.Year()); addResolver(new GlobalTemplateVariables.Time()); addResolver(new GlobalTemplateVariables.User()); addResolver(new File()); addResolver(new PrimaryTypeName()); addResolver(new ReturnType()); addResolver(new Method()); addResolver(new Type()); addResolver(new Package()); addResolver(new Project()); addResolver(new Arguments()); addResolver(new Array()); addResolver(new ArrayType()); addResolver(new ArrayElement()); addResolver(new Index()); addResolver(new Iterator()); addResolver(new Collection()); addResolver(new Iterable()); addResolver(new IterableType()); addResolver(new IterableElement()); addResolver(new Todo()); }

Target:
public void initializeContextTypeResolvers() { addResolver(new GlobalTemplateVariables.Cursor()); addResolver(new GlobalTemplateVariables.WordSelection()); addResolver(new GlobalTemplateVariables.Selection(GlobalTemplateVariables.LineSelection.NAME, JavaTemplateMessages.CompilationUnitContextType_variable_description_line_selection)); addResolver(new GlobalTemplateVariables.Dollar()); addResolver(new GlobalTemplateVariables.Date()); addResolver(new GlobalTemplateVariables.Year()); addResolver(new GlobalTemplateVariables.Time()); addResolver(new GlobalTemplateVariables.User()); addResolver(new File()); addResolver(new PrimaryTypeName()); addResolver(new ReturnType()); addResolver(new Method()); addResolver(new Type()); addResolver(new Package()); addResolver(new Project()); addResolver(new Arguments()); addResolver(new Array()); addResolver(new ArrayType()); addResolver(new ArrayElement()); addResolver(new Index()); addResolver(new Iterator()); addResolver(new Collection()); addResolver(new Iterable()); addResolver(new IterableType()); addResolver(new IterableElement()); addResolver(new Todo()); }
Source:
private Date getDateFromDiskDescription(Map<String, Object> map) { try { return new SimpleDateFormat(OvfParser.formatStrFromDiskDescription).parse(map.get(OvfInfoFileConstants.LastUpdated) .toString()); } catch (java.text.ParseException e) { log.errorFormat("LastUpdate Date could not be parsed from disk desscription"); e.printStackTrace(); return null; } }

Target:
private Date getDateFromDiskDescription(Map<String, Object> map) { try { return new SimpleDateFormat(OvfParser.formatStrFromDiskDescription).parse(map.get(OvfInfoFileConstants.LastUpdated) .toString()); } catch (java.text.ParseException e) { log.errorFormat("LastUpdate Date could not be parsed from disk desscription. Exception: {0}", e); return null; } }
Source:
public static void execute(Runnable command) { try { es.submit(new InternalWrapperRunnable(command, ThreadLocalParamsContainer.getVdcUser(), ThreadLocalParamsContainer.getHttpSessionId())); } catch (RejectedExecutionException e) { log.error("The thread pool is out of limit. A submitted task was rejected"); throw e; } }

Target:
public static void execute(Runnable command) { try { es.submit(new InternalWrapperRunnable(command, ThreadLocalParamsContainer.getVdcUser(), ThreadLocalParamsContainer.getHttpSessionId())); } catch (RejectedExecutionException e) { log.warn("The thread pool is out of limit. A submitted task was rejected"); throw e; } }
Source:
public int hashCode() { int result = bitSet; result = 31 * result + bitSet; return result; }

Target:
public int hashCode() { return bitSet; }
Source:
protected boolean validate() { DiskValidator diskValidator = new DiskValidator(getDiskImage()); if (!validate(diskValidator.isDiskExists()) && !validate(diskValidator.isDiskPluggedToVmsThatAreNotDown(false, vmsForDisk))) { return false; } if (getDiskImage().getVmEntityType().isTemplateType()) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_CANT_AMEND_TEMPLATE_DISK); } DiskImagesValidator diskImagesValidator = new DiskImagesValidator(Collections.singletonList(getDiskImage())); return validate(diskImagesValidator.diskImagesNotIllegal()) && validate(diskImagesValidator.diskImagesNotLocked()); }

Target:
protected boolean validate() { DiskValidator diskValidator = new DiskValidator(getDiskImage()); if (!validate(diskValidator.isDiskExists()) && !validate(diskValidator.isDiskPluggedToVmsThatAreNotDown(false, vmsForDisk))) { return false; } if (!FeatureSupported.qcowCompatSupported(getStoragePool().getCompatibilityVersion())) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_AMEND_NOT_SUPPORTED_BY_DC_VERSION, String.format("$dataCenterVersion %s", getStoragePool().getCompatibilityVersion().toString())); } if (getDiskImage().getVmEntityType().isTemplateType()) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_CANT_AMEND_TEMPLATE_DISK); } DiskImagesValidator diskImagesValidator = new DiskImagesValidator(Collections.singletonList(getDiskImage())); return validate(diskImagesValidator.diskImagesNotIllegal()) && validate(diskImagesValidator.diskImagesNotLocked()); }
Source:
public void tearDown() { System.out.println("In @After method"); cacheManager.close(); }

Target:
public void tearDown() { cacheManager.close(); }
Source:
public String getErrorLog() { StringBuilder errorBuilder = new StringBuilder(); int counter = 0; if (mErrorLines.size() > 0) { errorBuilder.append("In " + mFileName + "\n"); } for(String log: mErrorLines) { errorBuilder.append(log); counter++; if (counter > MAX_DISPLAY_ERROR_LOG_SIZE) { errorBuilder.append("Too long, skipping now ... \n"); break; } } return errorBuilder.toString(); }

Target:
public String getErrorLog() { StringBuilder errorBuilder = new StringBuilder(); int counter = 0; if (mErrorLines.size() > 0) { errorBuilder.append("In " + mFileName + ":\n"); } for (String log: mErrorLines) { errorBuilder.append(log); counter++; } return errorBuilder.toString(); }
Source:
public void cancel(Account account) { Log_OC.d(TAG, "Account= " + account.name); if (mCurrentDownload != null) { Log_OC.d(TAG, "Current Download Account= " + mCurrentDownload.getAccount().name); if (mCurrentDownload.getAccount().name.equals(account.name)) { mCurrentDownload.cancel(); } } ConcurrentMap downloadsAccount = mPendingDownloads.get(account); Iterator<String> it = downloadsAccount.keySet().iterator(); Log_OC.d(TAG, "Number of pending downloads= " + downloadsAccount.size()); while (it.hasNext()) { String key = it.next(); Log_OC.d(TAG, "download CANCELLED " + key); if (key.startsWith(account.name)) { DownloadFileOperation download; synchronized (mPendingDownloads) { download = mPendingDownloads.get(key); if (download != null) { String remotePath = download.getRemotePath(); if (mPendingDownloads.contains(account, remotePath)) { mPendingDownloads.remove(account, remotePath); } } } } } }

Target:
public void cancel(Account account) { Log_OC.d(TAG, "Account= " + account.name); if (mCurrentDownload != null) { Log_OC.d(TAG, "Current Download Account= " + mCurrentDownload.getAccount().name); if (mCurrentDownload.getAccount().name.equals(account.name)) { mCurrentDownload.cancel(); } } cancelDownloadsForAccount(account); }
Source:
public void registerBookie(String bookieId, boolean readOnly) throws BookieException { if (registerFailed) { throw BookieException.create(-100); } super.registerBookie(bookieId, readOnly); }

Target:
public void registerBookie(String bookieId, boolean readOnly) throws BookieException { if (registerFailed) { throw BookieException.create(MetadataStoreException); } super.registerBookie(bookieId, readOnly); }
Source:
public static void main(String[] args) throws Exception { if (args.length < 2) { System.err.println("Usage: StartClients <clients to start> <server file>"); System.exit(1); } int clientsToStart = Integer.parseInt(args[0]); String serversFileName = args[1]; Scanner sc = new Scanner(new File(serversFileName)); int nrOfServers = sc.nextInt(); sc.nextLine(); String[] serverURLs = new String[nrOfServers]; for (int i = 0; i < nrOfServers; i++) { serverURLs[i] = sc.nextLine(); } System.out.println("Starting " + clientsToStart + " client(s) on host: "+InetAddress.getLocalHost().getHostAddress()); try { for (int i = 0; i < clientsToStart; i++) { ClientProcess client = new ClientProcess(); client.selectServer(serverURLs, false); new Thread(client).start(); Thread.sleep(250); } } catch (Exception e) { e.printStackTrace(); } }

Target:
public static void main(String[] args) throws Exception { if (args.length < 2) { System.err.println("Usage: StartClients <nr of clients to start> <server file>"); System.exit(1); } int clientsToStart = Integer.parseInt(args[0]); String serversFileName = args[1]; Scanner sc = new Scanner(new File(serversFileName)); int nrOfServers = sc.nextInt(); sc.nextLine(); String[] serverURLs = new String[nrOfServers]; for (int i = 0; i < nrOfServers; i++) { serverURLs[i] = sc.nextLine(); } System.out.println("Starting " + clientsToStart + " client(s) on host: "+InetAddress.getLocalHost().getHostAddress()); try { for (int i = 0; i < clientsToStart; i++) { ClientProcess client = new ClientProcess(); client.selectServer(serverURLs, false); new Thread(client).start(); Thread.sleep(250); } } catch (Exception e) { e.printStackTrace(); } }
Source:
Set<MavenProject> applyVersioningChanges( final Collection<MavenProject> projects, final Map<ProjectVersionRef, String> _versionsByGAV ) throws ManipulationException { final VersioningState state = new VersioningState( session.getUserProperties() ); state.setVersionsByGAVMap( _versionsByGAV ); final Set<MavenProject> changed = new HashSet<>(); for ( final MavenProject project : projects ) { if ( applyVersioningChanges( new Project ( project.getOriginalModel()), state ) ) { final String v = _versionsByGAV.get( SimpleProjectVersionRef.parse( gav( project ) ) ); logger.info( "{} ({}): VERSION MODIFIED{} New version: {}", project.getName(), gav( project ), System.lineSeparator(), v ); applyVersioningChanges( new Project ( project.getModel()), state ); changed.add( project ); if ( v != null ) { project.setVersion( v ); } } } return changed; }

Target:
Set<MavenProject> applyVersioningChanges( final Collection<MavenProject> projects, final Map<ProjectVersionRef, String> _versionsByGAV ) throws ManipulationException { final VersioningState state = new VersioningState( session.getUserProperties() ); state.setVersionsByGAVMap( _versionsByGAV ); final Set<MavenProject> changed = new HashSet<>(); for ( final MavenProject project : projects ) { if ( applyVersioningChanges( new Project ( project.getOriginalModel()), state ) ) { final String v = _versionsByGAV.get( SimpleProjectVersionRef.parse( gav( project ) ) ); applyVersioningChanges( new Project ( project.getModel()), state ); changed.add( project ); if ( v != null ) { project.setVersion( v ); } } } return changed; }
Source:
public void checkData() { logger.info("checkData(): totalCount: {}; minWinId: {}; committedWinId: {}; curWinId: {}", totalCount, this.minWinId, committedWinId, this.windowId); for (long winId = Math.max(committedWinId + 1, minWinId); winId < this.windowId; ++winId) { Long count = this.windowToCount.get(winId); SpillableArrayListImpl<String> datas = (SpillableArrayListImpl<String>)multiMap.get("" + winId); if ((datas == null && count != null) || (datas != null && count == null)) { logger.error("datas: {}; count: {}", datas, count); } else if (datas == null && count == null) { logger.error("Both datas and count are null. probably something wrong."); } else { int dataSize = datas.size(); if ((long)count != (long)dataSize) { logger.error("data size not equal: window Id: {}; datas size: {}; count: {}", winId, dataSize, count); } } } }

Target:
public void checkData() { long startTime = System.currentTimeMillis(); logger.debug("check data: totalCount: {}; minWinId: {}; committedWinId: {}; curWinId: {}", totalCount, this.minWinId, committedWinId, this.windowId); for (long winId = Math.max(committedWinId + 1, minWinId); winId < this.windowId; ++winId) { Long count = this.windowToCount.get(winId); SpillableArrayListImpl<String> datas = (SpillableArrayListImpl<String>)multiMap.get("" + winId); String msg; if (((datas == null && count != null) || (datas != null && count == null)) || (datas == null && count == null)) { msg = "Invalid data/count. datas: " + datas + "; count: " + count; logger.error(msg); errorTrace = new RuntimeException(msg); throw new ShutdownException(); } else { int dataSize = datas.size(); if ((long)count != (long)dataSize) { msg = String.format("data size not equal: window Id: %d; datas size: %d; count: %d", winId, dataSize, count); logger.error(msg); errorTrace = new RuntimeException(msg); throw new ShutdownException(); } } } logger.info("check data took millis.", System.currentTimeMillis() - startTime); }
Source:
public static String topoNameToId(String topoName, ILocalCluster cluster) throws TException { TopologySummary topoSum = cluster.getTopologySummaryByName(topoName); if (topoSum.get_name().equals(topoName)) { return topoSum.get_id(); } return null; }

Target:
public static String topoNameToId(String topoName, ILocalCluster cluster) throws TException { try { TopologySummary topoSum = cluster.getTopologySummaryByName(topoName); return topoSum.get_id(); } catch (NotAliveException e) { LOG.error("Failed to getTopologySummaryByName from " + topoName, e); } return null; }
Source:
public List<Pair<String, String>> getRenamesBetweenCommits( String parentHash, String commitHash, String projectRoot) { ObjectId commitId = ObjectId.fromString(commitHash); ObjectId parentId = ObjectId.fromString(parentHash); RevCommit commit; RevCommit parent; List<Pair<String, String>> result = new ArrayList<>(); try (Git git = Git.open(new java.io.File(projectRoot))) { try (RevWalk revWalk = new RevWalk(git.getRepository())) { commit = revWalk.parseCommit(commitId); parent = revWalk.parseCommit(parentId); } RenameDetector renameDetector = new RenameDetector(git.getRepository()); try (TreeWalk treeWalk = new TreeWalk(git.getRepository())) { treeWalk.setFilter(TreeFilter.ANY_DIFF); treeWalk.setRecursive(true); treeWalk.reset(parent.getTree(), commit.getTree()); renameDetector.reset(); renameDetector.addAll(DiffEntry.scan(treeWalk)); for (DiffEntry ent : renameDetector.compute()) { if (ent.getChangeType() == DiffEntry.ChangeType.RENAME) result.add(new ImmutablePair<>(ent.getOldPath(), ent.getNewPath())); } } } catch (IOException e) { throw new UnableToGetCommitContentException(e.getMessage()); } return result; }

Target:
public List<Pair<String, String>> getRenamesBetweenCommits( String parentHash, String commitHash, String projectRoot) { ObjectId commitId = ObjectId.fromString(commitHash); ObjectId parentId = ObjectId.fromString(parentHash); RevCommit commit; RevCommit parent; List<Pair<String, String>> result = new ArrayList<>(); try (Git git = Git.open(new java.io.File(projectRoot))) { try (RevWalk revWalk = new RevWalk(git.getRepository())) { commit = revWalk.parseCommit(commitId); parent = revWalk.parseCommit(parentId); } RenameDetector renameDetector = new RenameDetector(git.getRepository()); try (TreeWalk treeWalk = new TreeWalk(git.getRepository())) { treeWalk.setFilter(TreeFilter.ANY_DIFF); treeWalk.setRecursive(true); treeWalk.reset(parent.getTree(), commit.getTree()); renameDetector.reset(); renameDetector.addAll(DiffEntry.scan(treeWalk)); for (DiffEntry ent : renameDetector.compute()) { if (ent.getChangeType() == DiffEntry.ChangeType.RENAME) result.add(Pair.of(ent.getOldPath(), ent.getNewPath())); } } } catch (IOException e) { throw new UnableToGetCommitContentException(e.getMessage()); } return result; }
Source:
public String getColumnText(Object element, int columnIndex) { Attribute<?> attribute = (Attribute<?>) element; if (columnIndex == 0) { return attribute.getAttributeType().getName(); } else if (columnIndex == 1) { try { return attribute.getDisplayableString(); } catch (OseeCoreException ex) { return Lib.exceptionToString(ex); } } else if (columnIndex == 2) { try { return String.valueOf(attribute.getId()); } catch (OseeCoreException ex) { return Lib.exceptionToString(ex); } } else if (columnIndex == 3) { try { return String.valueOf(attribute.getAttributeType().getIdString()); } catch (OseeCoreException ex) { return Lib.exceptionToString(ex); } } else { return String.valueOf(attribute.getGammaId()); } }

Target:
public String getColumnText(Object element, int columnIndex) { Attribute<?> attribute = (Attribute<?>) element; if (columnIndex == 0) { return attribute.getAttributeType().getName(); } else if (columnIndex == 1) { try { return attribute.getDisplayableString(); } catch (OseeCoreException ex) { return Lib.exceptionToString(ex); } } else if (columnIndex == 2) { try { return String.valueOf(attribute.getId()); } catch (OseeCoreException ex) { return Lib.exceptionToString(ex); } } else if (columnIndex == 3) { try { return attribute.getAttributeType().getIdString(); } catch (OseeCoreException ex) { return Lib.exceptionToString(ex); } } else { return String.valueOf(attribute.getGammaId()); } }
Source:
public Map<String, Object> asMap() { Map<String, Object> toReturn = new TreeMap<>(); Map<String, Object> capsMap = super.asMap(); capsMap.forEach((key, value) -> { if (key.equals("platformName")) { toReturn.put(key, value); } else { toReturn.put(APPIUM_PREFIX + key, value); } }); return unmodifiableMap(toReturn); }

Target:
public Map<String, Object> asMap() { AcceptedW3CCapabilityKeys acceptedW3CCapabilityKeys = new AcceptedW3CCapabilityKeys(); return unmodifiableMap(super.asMap().entrySet().stream().collect(Collectors.toMap( entry -> (acceptedW3CCapabilityKeys.test(entry.getKey()) || entry.getKey().startsWith(APPIUM_PREFIX)) ? entry.getKey() : APPIUM_PREFIX + entry.getKey(), Map.Entry::getValue))); }
Source:
public static void setEnvironmentVariables(String key, String value) throws IllegalAccessException, NoSuchFieldException, ClassNotFoundException { Map<String, String> newEnv = new HashMap<>(); newEnv.put(key, value); setEnvironmentVariables(newEnv); }

Target:
private void setEnvironmentVariables(String key, String value) throws IllegalAccessException, NoSuchFieldException, ClassNotFoundException { Map<String, String> newEnv = new HashMap<>(); newEnv.put(key, value); setEnvironmentVariables(newEnv); }
Source:
public void remove(E mob) { checkArgument(mob.getState() == EntityState.ACTIVE, "state != ACTIVE"); checkArgument(mob.getIndex() != -1, "index == -1"); indexes.offer(mob.getIndex()); mob.setState(EntityState.INACTIVE); mobs[mob.getIndex()] = null; mob.setIndex(-1); size--; }

Target:
public void remove(E mob) { checkArgument(mob.getState() == EntityState.ACTIVE, "state != ACTIVE"); checkArgument(mob.getIndex() != -1, "index == -1"); indexes.add(mob.getIndex()); mob.setState(EntityState.INACTIVE); mobs[mob.getIndex()] = null; mob.setIndex(-1); size--; }
Source:
public List<GrantedAuthority> getGrantedAuthorities(Context context, EPerson eperson) { List<GrantedAuthority> authorities = new LinkedList<>(); if (eperson != null) { boolean isAdmin = false; boolean isCommunityAdmin = false; boolean isColectionAdmin = false; try { isAdmin = authorizeService.isAdmin(context, eperson); isCommunityAdmin = authorizeService.isCommunityAdmin(context, eperson); isColectionAdmin = authorizeService.isCollectionAdmin(context, eperson); } catch (SQLException e) { log.error("SQL error while checking for admin rights", e); } if (isAdmin) { authorities.add(new SimpleGrantedAuthority(ADMIN_GRANT)); } else if ((isCommunityAdmin && AuthorizeUtil.canCommunityAdminManageAccounts()) || (isColectionAdmin && AuthorizeUtil.canCollectionAdminManageAccounts())) { authorities.add(new SimpleGrantedAuthority(ACCOUNT_ADMIN_GRANT)); } authorities.add(new SimpleGrantedAuthority(AUTHENTICATED_GRANT)); } return authorities; }

Target:
public List<GrantedAuthority> getGrantedAuthorities(Context context, EPerson eperson) { List<GrantedAuthority> authorities = new LinkedList<>(); if (eperson != null) { boolean isAdmin = false; boolean isCommunityAdmin = false; boolean isCollectionAdmin = false; try { isAdmin = authorizeService.isAdmin(context, eperson); isCommunityAdmin = authorizeService.isCommunityAdmin(context, eperson); isCollectionAdmin = authorizeService.isCollectionAdmin(context, eperson); } catch (SQLException e) { log.error("SQL error while checking for admin rights", e); } if (isAdmin) { authorities.add(new SimpleGrantedAuthority(ADMIN_GRANT)); } else if ((isCommunityAdmin && AuthorizeUtil.canCommunityAdminManageAccounts()) || (isCollectionAdmin && AuthorizeUtil.canCollectionAdminManageAccounts())) { authorities.add(new SimpleGrantedAuthority(ACCOUNT_ADMIN_GRANT)); } authorities.add(new SimpleGrantedAuthority(AUTHENTICATED_GRANT)); } return authorities; }
Source:
public void deployContrib(FeaturesRunner runner) throws Exception { String contribName = null; switch (directoryType) { case DIRECTORY_VCS: contribName = "OSGI-INF/test-directory-sql-contrib.xml"; break; case DIRECTORY_MONGODB: contribName = "OSGI-INF/test-directory-mongodb-contrib.xml"; break; case DIRECTORY_LDAP: contribName = "OSGI-INF/test-directory-ldap-contrib.xml"; break; default: break; } RuntimeHarness harness = runner.getFeature(RuntimeFeature.class).getHarness(); harness.deployContrib("org.nuxeo.ecm.directory.tests",contribName); }

Target:
public void deployContrib(FeaturesRunner runner) throws Exception { String contribName; switch (directoryType) { case DIRECTORY_SQL: contribName = "OSGI-INF/test-directory-sql-contrib.xml"; break; case DIRECTORY_MONGODB: contribName = "OSGI-INF/test-directory-mongodb-contrib.xml"; break; default: throw new NuxeoException("Contribution for testing directories cannot be null"); } RuntimeHarness harness = runner.getFeature(RuntimeFeature.class).getHarness(); harness.deployContrib("org.nuxeo.ecm.directory.tests", contribName); }
Source:
protected void validateTieredReplicants(Map<String, Integer> tieredReplicants){ for(Map.Entry<String, Integer> entry: tieredReplicants.entrySet()){ if(entry.getValue() < 0) throw new IllegalArgumentException("Replicant value cannot be less than 0"); } }

Target:
protected void validateTieredReplicants(Map<String, Integer> tieredReplicants){ for (Map.Entry<String, Integer> entry: tieredReplicants.entrySet()) { if (entry.getValue() < 0) throw new IAE("Replicant value [%d] is less than 0, which is not allowed", entry.getValue()); } }
Source:
public static void main(String[] args) throws Exception { String accountName = getAccountName(); String accountKey = getAccountKey(); SharedKeyCredential credential = new SharedKeyCredential(accountName, accountKey); String endPoint = String.format(Locale.ROOT, "<LINK_0>", accountName); StorageClient storageClient = StorageClient.storageClientBuilder().endpoint(endPoint).credential(credential).buildClient(); ContainerClient containerClient = storageClient.getContainerClient("myjavacontainerparallelupload" + System.currentTimeMillis()); containerClient.create(); String filename = "BigFile.bin"; BlockBlobClient blobClient = containerClient.getBlockBlobClient(filename); File largeFile = createTempEmptyFile(filename); File downloadFile = createTempEmptyFile("downloadFile.bin"); Long fileSize = 100 * 1024 * 1024L; createTempFileWithFileSize(largeFile, fileSize); blobClient.uploadFromFile(largeFile.getPath()); blobClient.downloadToFile(downloadFile.getPath()); if (Files.exists(downloadFile.toPath()) && Files.exists(largeFile.toPath())) { checkTwoFilesAreTheSame(largeFile, downloadFile); System.out.println("The file we upload is the same as the one we download."); } else { throw new RuntimeException("Did not find the upload or download file."); } containerClient.delete(); Files.deleteIfExists(largeFile.toPath()); Files.deleteIfExists(downloadFile.toPath()); }

Target:
public static void main(String[] args) throws Exception { String accountName = getAccountName(); String accountKey = getAccountKey(); SharedKeyCredential credential = new SharedKeyCredential(accountName, accountKey); String endPoint = String.format(Locale.ROOT, "<LINK_0>", accountName); StorageClient storageClient = StorageClient.storageClientBuilder().endpoint(endPoint).credential(credential).buildClient(); ContainerClient containerClient = storageClient.getContainerClient("myjavacontainerparallelupload" + System.currentTimeMillis()); containerClient.create(); String filename = "BigFile.bin"; BlockBlobClient blobClient = containerClient.getBlockBlobClient(filename); File largeFile = createTempEmptyFile(filename); File downloadFile = createTempEmptyFile("downloadFile.bin"); long fileSize = 100 * 1024 * 1024L; createTempFileWithFileSize(largeFile, fileSize); blobClient.uploadFromFile(largeFile.getPath()); blobClient.downloadToFile(downloadFile.getPath()); if (Files.exists(downloadFile.toPath()) && Files.exists(largeFile.toPath())) { checkTwoFilesAreTheSame(largeFile, downloadFile); System.out.println("The file we upload is the same as the one we download."); } else { throw new RuntimeException("Did not find the upload or download file."); } containerClient.delete(); Files.deleteIfExists(largeFile.toPath()); Files.deleteIfExists(downloadFile.toPath()); }
Source:
public String getGID(URL url) throws MalformedURLException { Pattern p = Pattern.compile("^https?://myhentaicomics.com/index.php/([a-zA-Z0-9-]*)$"); Matcher m = p.matcher(url.toExternalForm()); if (m.matches()) { return m.group(1); } throw new MalformedURLException("Expected imgur.com URL format: " + "myhentaicomics.com/index.php/albumName - got " + url + " instead"); }

Target:
public String getGID(URL url) throws MalformedURLException { Pattern p = Pattern.compile("^https?://myhentaicomics.com/index.php/([a-zA-Z0-9-]*)/?$"); Matcher m = p.matcher(url.toExternalForm()); if (m.matches()) { return m.group(1); } Pattern pa = Pattern.compile("^https?://myhentaicomics.com/index.php/search\\?q=([a-zA-Z0-9-]*)([a-zA-Z0-9=&]*)?$"); Matcher ma = pa.matcher(url.toExternalForm()); if (ma.matches()) { return ma.group(1); } Pattern pat = Pattern.compile("^<LINK_0>[0-9]*)/?([a-zA-Z%0-9+\\?=:]*)?$"); Matcher mat = pat.matcher(url.toExternalForm()); if (mat.matches()) { return mat.group(1); } throw new MalformedURLException("Expected myhentaicomics.com URL format: " + "myhentaicomics.com/index.php/albumName - got " + url + " instead"); }
Source:
private void doWork() { ArrayList<TimeRequest> request = new ArrayList<>(); while (true) { try { request.clear(); TimeRequest trh = null; while(trh == null){ if(closed.get()){ return; } trh = queue.poll(1, TimeUnit.SECONDS); } request.add(trh); queue.drainTo(request); long start; while (true) { try { String currentLeaderId; OracleService.Client localClient; synchronized (this) { currentLeaderId = getOracle(); localClient = client; } Context timerContext = responseTimer.time(); start = localClient.getTimestamps(env.getFluoApplicationID(), request.size()); String leaderId = getOracle(); if(leaderId != null && !leaderId.equals(currentLeaderId)) { reconnect(); continue; } stampsHistogram.update(request.size()); timerContext.close(); break; } catch (TTransportException tte) { log.info("Oracle connection lost. Retrying..."); reconnect(); } catch (TException e) { log.error("TException occurred in doWork() method", e); } } for (int i = 0; i < request.size(); i++) { TimeRequest tr = request.get(i); tr.timestamp.set(start + i); tr.cdl.countDown(); } } catch (InterruptedException e) { if(!closed.get()){ log.error("InterruptedException occurred in doWork() method", e); } } catch (Exception e) { log.error("Exception occurred in doWork() method", e); } } }

Target:
private void doWork() { ArrayList<TimeRequest> request = new ArrayList<>(); while (true) { try { request.clear(); TimeRequest trh = null; while(trh == null){ if(closed.get()){ return; } trh = queue.poll(1, TimeUnit.SECONDS); } request.add(trh); queue.drainTo(request); long start; while (true) { try { String currentLeaderId; OracleService.Client localClient; synchronized (this) { currentLeaderId = getOracle(); localClient = client; } Context timerContext = responseTimer.time(); start = localClient.getTimestamps(env.getFluoApplicationID(), request.size()); String leaderId = getOracle(); if(leaderId != null && !leaderId.equals(currentLeaderId)) { reconnect(); continue; } stampsHistogram.update(request.size()); timerContext.close(); break; } catch (TTransportException tte) { log.info("Oracle connection lost. Retrying..."); reconnect(); } catch (TException e) { log.error("TException occurred in doWork() method", e); } } for (int i = 0; i < request.size(); i++) { TimeRequest tr = request.get(i); tr.timestamp.set(start + i); tr.cdl.countDown(); } } catch (InterruptedException e) { if(!closed.get()){ log.error("InterruptedException occurred in doWork() method", e); } else { log.debug("InterruptedException occurred in doWork() method", e); } } catch (Exception e) { log.error("Exception occurred in doWork() method", e); } } }
Source:
public Macro<?> getMacro(MacroId macroId) throws MacroLookupException { String macroHint = macroId.toString(); ComponentManager cm = this.componentManager.get(); try { if (cm.hasComponent(Macro.class, macroHint)) { return cm.getInstance(Macro.class, macroHint); } else { if (cm.hasComponent(Macro.class, macroId.getId())) { return cm.getInstance(Macro.class, macroId.getId()); } throw new MacroNotFoundException(String.format("No macro [%s] could be found.", macroId.toString())); } } catch (ComponentLookupException e) { throw new MacroLookupException(String.format("Macro [%s] failed to be instantiated" + ".", macroId.toString()), e); } }

Target:
public Macro<?> getMacro(MacroId macroId) throws MacroLookupException { String macroHint = macroId.toString(); ComponentManager cm = this.componentManager.get(); try { if (cm.hasComponent(Macro.class, macroHint)) { return cm.getInstance(Macro.class, macroHint); } else { if (cm.hasComponent(Macro.class, macroId.getId())) { return cm.getInstance(Macro.class, macroId.getId()); } throw new MacroNotFoundException(String.format("No macro [%s] could be found.", macroId.toString())); } } catch (ComponentLookupException e) { throw new MacroLookupException(String.format("Macro [%s] failed to be instantiated." + , macroId.toString()), e); } }
Source:
public String getPackage() { if (!actualName.contains(File.separator)){ return null; } return getActualName().substring(0, getActualName().lastIndexOf(File.separator) + 1) .replaceAll(File.separator, "\\."); }

Target:
public String getPackage() { if (!actualName.contains(File.separator)){ return null; } return getActualName().substring(0, getActualName().lastIndexOf("/") + 1) .replace("/", "\\."); }
Source:
private void handleDestDisk() { if (getParameters().getLiveDiskMigrateStage() != LiveDiskMigrateStage.IMAGE_PLACEHOLDER_CREATION && getParameters().getLiveDiskMigrateStage() != LiveDiskMigrateStage.SOURCE_IMAGE_DELETION) { if (Guid.Empty.equals(getParameters().getVdsId()) && getParameters().getLiveDiskMigrateStage() != LiveDiskMigrateStage.VM_REPLICATE_DISK_FINISH) { log.error("Failed during live storage migration of disk '{}' of vm '{}', as the vm is not running" + " on any host not attempting to end the replication before the target disk deletion", getParameters().getImageGroupID(), getParameters().getVmId()); } else { log.error("Failed during live storage migration of disk '{}' of vm '{}', attempting to end " + "replication" + " before deleting the target disk", getParameters().getImageGroupID(), getParameters().getVmId()); try { replicateDiskFinish(getParameters().getSourceStorageDomainId(), getParameters().getSourceStorageDomainId()); } catch (Exception e) { log.error("Replication end of disk '{}' in vm '{}' back to the source failed, skipping deletion of " + "the target disk", getParameters().getImageGroupID(), getParameters().getVmId()); return; } } log.error("The target of disk '{}' of vm '{}' isn't used, attempting to delete it", getParameters().getImageGroupID(), getParameters().getVmId()); LiveStorageMigrationHelper.removeImage(this, getParameters().getTargetStorageDomainId(), getParameters() .getImageGroupID(), getParameters().getDestinationImageId(), AuditLogType .USER_MOVE_IMAGE_GROUP_FAILED_TO_DELETE_DST_IMAGE); } }

Target:
private void handleDestDisk() { if (getParameters().getLiveDiskMigrateStage() != LiveDiskMigrateStage.IMAGE_PLACEHOLDER_CREATION && getParameters().getLiveDiskMigrateStage() != LiveDiskMigrateStage.SOURCE_IMAGE_DELETION) { if (Guid.Empty.equals(getParameters().getVdsId())) { log.error("Failed during live storage migration of disk '{}' of vm '{}', as the vm is not running" + " on any host not attempting to end the replication before the target disk deletion", getParameters().getImageGroupID(), getParameters().getVmId()); } else { log.error("Failed during live storage migration of disk '{}' of vm '{}', attempting to end " + "replication before deleting the target disk", getParameters().getImageGroupID(), getParameters().getVmId()); try { replicateDiskFinish(getParameters().getSourceStorageDomainId(), getParameters().getSourceStorageDomainId()); } catch (Exception e) { log.error("Replication end of disk '{}' in vm '{}' back to the source failed, skipping deletion of " + "the target disk", getParameters().getImageGroupID(), getParameters().getVmId()); return; } } log.error("The target of disk '{}' of vm '{}' isn't used, attempting to delete it", getParameters().getImageGroupID(), getParameters().getVmId()); LiveStorageMigrationHelper.removeImage(this, getParameters().getTargetStorageDomainId(), getParameters() .getImageGroupID(), getParameters().getDestinationImageId(), AuditLogType .USER_MOVE_IMAGE_GROUP_FAILED_TO_DELETE_DST_IMAGE); } }
Source:
private static Duration getStateTransferTimeoutEstimate(CorfuRuntime runtime) { Token trimMark = runtime.getAddressSpaceView().getTrimMark(); long tail = runtime.getAddressSpaceView().getAllTails().getLogTail(); long rangeToReplicate = tail - trimMark.getSequence(); long numSections = rangeToReplicate / runtime.getParameters().getBulkReadSize(); long rpcTimeout = (long) (runtime.getParameters().getRequestTimeout().toMillis() * 1.5); long timeoutInMs = Math.max(DEFAULT_HEAL_TIMEOUT.toMillis(), numSections * rpcTimeout); return Duration.ofMillis(timeoutInMs); }

Target:
private static Duration getStateTransferTimeoutEstimate(CorfuRuntime runtime) { Token trimMark = runtime.getAddressSpaceView().getTrimMark(); long tail = runtime.getAddressSpaceView().getAllTails().getLogTail(); long rangeToReplicate = tail - trimMark.getSequence(); long numSections = rangeToReplicate / runtime.getParameters().getBulkReadSize(); long rpcTimeout = (long) (runtime.getParameters().getRequestTimeout().toMillis() * TIMEOUT_MULTIPLICATIVE_FACTOR); long timeoutInMs = Math.max(DEFAULT_HEAL_TIMEOUT.toMillis(), numSections * rpcTimeout); return Duration.ofMillis(timeoutInMs); }
Source:
private static void checkExceptions(DataTable dataTable, PinotSplit split) { Map<String, String> metadata = dataTable.getMetadata(); List<String> exceptions = new ArrayList<>(); metadata.forEach((k, v) -> { if (k.startsWith(DataTable.EXCEPTION_METADATA_KEY)) { exceptions.add(v); } }); if (!exceptions.isEmpty()) { throw new PinotException(PinotErrorCode.PINOT_EXCEPTION, split.getSegmentPql(), String.format("Encountered %d pinot exceptions for split %s: %s", exceptions.size(), split, exceptions)); } int columnsExpected = split.getExpectedColumnHandles().size(); int columnsActual = dataTable.getDataSchema().size(); if (columnsActual != columnsExpected) { throw new PinotException(PinotErrorCode.PINOT_EXCEPTION, split.getSegmentPql(), String.format( "Expected pinot to contain %d columns but got %d: %s", columnsExpected, columnsActual, dataTable.getDataSchema())); } }

Target:
private static void checkExceptions(DataTable dataTable, PinotSplit split) { Map<String, String> metadata = dataTable.getMetadata(); List<String> exceptions = new ArrayList<>(); metadata.forEach((k, v) -> { if (k.startsWith(DataTable.EXCEPTION_METADATA_KEY)) { exceptions.add(v); } }); if (!exceptions.isEmpty()) { throw new PinotException( PINOT_EXCEPTION, split.getSegmentPql(), String.format("Encountered %d pinot exceptions for split %s: %s", exceptions.size(), split, exceptions)); } int numColumnsExpected = split.getExpectedColumnHandles().size(); int numColumnsActual = dataTable.getDataSchema().size(); if (numColumnsActual != numColumnsExpected) { throw new PinotException( PINOT_EXCEPTION, split.getSegmentPql(), String.format("Expected pinot to contain %d columns but got %d: %s", numColumnsExpected, numColumnsActual, dataTable.getDataSchema())); } }
Source:
public ChatPrefs() { ukTime = new SimpleStringProperty(TimeInfo.AUTO.getDisplayName()); maxMessages = new SimpleIntegerProperty(500); zoom = new SimpleDoubleProperty(1); learnedAutoComplete = new SimpleBooleanProperty(false); previewImageUrls = new SimpleBooleanProperty(true); hideFoeMessages = new SimpleBooleanProperty(true); channelTabScrollPaneWidth = new SimpleIntegerProperty(250); userToColor = new SimpleMapProperty<>(FXCollections.observableHashMap()); chatColorMode = new SimpleObjectProperty<>(CUSTOM); idleThreshold = new SimpleIntegerProperty(10); }

Target:
public ChatPrefs() { timeFormat = new SimpleObjectProperty<>(TimeInfo.AUTO); maxMessages = new SimpleIntegerProperty(500); zoom = new SimpleDoubleProperty(1); learnedAutoComplete = new SimpleBooleanProperty(false); previewImageUrls = new SimpleBooleanProperty(true); hideFoeMessages = new SimpleBooleanProperty(true); channelTabScrollPaneWidth = new SimpleIntegerProperty(250); userToColor = new SimpleMapProperty<>(FXCollections.observableHashMap()); chatColorMode = new SimpleObjectProperty<>(CUSTOM); idleThreshold = new SimpleIntegerProperty(10); }
Source:
public static org.ovirt.engine.core.common.job.Step map(Step step, org.ovirt.engine.core.common.job.Step entity) { org.ovirt.engine.core.common.job.Step target = entity != null ? entity : new org.ovirt.engine.core.common.job.Step(); target.setId(new Guid(step.getId())); if (step.isSetParentStep()) { target.setParentStepId(Guid.createGuidFromString(step.getParentStep().getId())); } target.setJobId(GuidUtils.asGuid(step.getJob().getId())); if (step.isSetType()) { StepEnum type = StepEnum.fromValue(step.getType()); if (type != null) { target.setStepType(map(type)); } } if (step.isSetDescription()) { target.setDescription(step.getDescription()); } if (step.isSetNumber()) { target.setStepNumber(step.getNumber()); } if (step.isSetStatus()) { target.setStatus(JobMapper.map(step.getStatus(), null)); } target.setStartTime(step.isSetStartTime() ? step.getStartTime().toGregorianCalendar().getTime() : new Date((Calendar.getInstance().getTimeInMillis()))); target.setEndTime(step.isSetEndTime() ? step.getEndTime().toGregorianCalendar().getTime() : new Date((Calendar.getInstance().getTimeInMillis()))); target.setExternal(step.isSetExternal() ? step.isExternal() : true); return target; }

Target:
public static org.ovirt.engine.core.common.job.Step map(Step step, org.ovirt.engine.core.common.job.Step entity) { org.ovirt.engine.core.common.job.Step target = entity != null ? entity : new org.ovirt.engine.core.common.job.Step(); target.setId(new Guid(step.getId())); if (step.isSetParentStep()) { target.setParentStepId(GuidUtils.asGuid(step.getParentStep().getId())); } target.setJobId(GuidUtils.asGuid(step.getJob().getId())); if (step.isSetType()) { StepEnum type = StepEnum.fromValue(step.getType()); if (type != null) { target.setStepType(map(type)); } } if (step.isSetDescription()) { target.setDescription(step.getDescription()); } if (step.isSetNumber()) { target.setStepNumber(step.getNumber()); } if (step.isSetStatus()) { target.setStatus(JobMapper.map(step.getStatus(), null)); } target.setStartTime(step.isSetStartTime() ? step.getStartTime().toGregorianCalendar().getTime() : new Date((Calendar.getInstance().getTimeInMillis()))); target.setEndTime(step.isSetEndTime() ? step.getEndTime().toGregorianCalendar().getTime() : new Date((Calendar.getInstance().getTimeInMillis()))); target.setExternal(step.isSetExternal() ? step.isExternal() : true); return target; }
Source:
public void refreshAccessToken() { AccessTokenDTO refreshedToken = callConcurEndpoint( this::callRefreshAccessTokenEndpoint, AccessTokenDTO.class); webServiceCredentialService.updateWebServiceCredentialValue(ConcurConstants.CONCUR_ACCESS_TOKEN_EXPIRATION_DATE, refreshedToken.getExpirationDate()); }

Target:
public void refreshAccessToken() { AccessTokenDTO refreshedToken = callConcurEndpoint( this::buildRefreshAccessTokenClientRequest, AccessTokenDTO.class); webServiceCredentialService.updateWebServiceCredentialValue(ConcurConstants.CONCUR_ACCESS_TOKEN_EXPIRATION_DATE, refreshedToken.getExpirationDate()); }
Source:
public OperationStepHandler apply(OperationStepHandler handler) { return (context, operation) -> { PathAddress address = context.getCurrentAddress(); JGroupsLogger.ROOT_LOGGER.legacyProtocol(address.getLastElement().getValue(), this.targetName); PathAddress targetAddress = address.getParent().append(pathElement(this.targetName)); Operations.setPathAddress(operation, targetAddress); PathAddress targetRegistrationAddress = address.getParent().append(ProtocolResourceDefinition.WILDCARD_PATH); String operationName = Operations.getName(operation); context.addStep(operation, context.getRootResourceRegistration().getOperationHandler(targetRegistrationAddress, operationName), OperationContext.Stage.MODEL); }; }

Target:
public OperationStepHandler apply(OperationStepHandler handler) { return this; }
Source:
private T determineNextSelectedItem() { T currentItem = getSelectedItem() != null ? getSelectedItem() : getSelectedItems() != null ? getSelectedItems().get(0) : null; T nextItem = null; Collection<T> items = getItems(); if (items != null && currentItem != null) { List<T> itemsList = (List<T>) items; int currentIndex = itemsList.indexOf(currentItem); if (currentIndex > -1 && currentIndex < itemsList.size()) { if (currentIndex + 1 < itemsList.size()) { nextItem = itemsList.get(currentIndex + 1); } else if (currentIndex - 1 > -1) { nextItem = itemsList.get(currentIndex - 1); } } } return nextItem; }

Target:
private T determineNextSelectedItem() { T currentItem = getSelectedItem() != null ? getSelectedItem() : getSelectedItems() != null ? getSelectedItems().get(0) : null; T nextItem = null; Collection<T> items = getItems(); if (items != null && currentItem != null && items instanceof List) { List<T> itemsList = (List<T>) items; int currentIndex = itemsList.indexOf(currentItem); if (currentIndex > -1 && currentIndex < itemsList.size()) { if (currentIndex + 1 < itemsList.size()) { nextItem = itemsList.get(currentIndex + 1); } else if (currentIndex - 1 > -1) { nextItem = itemsList.get(currentIndex - 1); } } } return nextItem; }
Source:
public void applyFix(@NotNull final Project project, @NotNull ProblemDescriptor descriptor) { final PsiElement element = descriptor.getPsiElement(); final PsiFile file = element != null ? element.getContainingFile() : null; if (!(element instanceof GoImportSpec && file instanceof GoFile)) return; final Map<GoReferenceExpressionBase, String> usages = ContainerUtil.newHashMap(); file.acceptChildren(new PsiRecursiveElementVisitor() { public void visitElement(@NotNull PsiElement element) { if (element instanceof GoReferenceExpression || element instanceof GoTypeReferenceExpression) { PsiReference reference = element.getReference(); PsiElement definition = reference != null ? reference.resolve() : null; PsiFile definitionFile = definition instanceof GoNamedElement ? definition.getContainingFile() : null; if (definitionFile != null && definitionFile.getParent() == file.getParent()) { usages.put((GoReferenceExpressionBase)element, ((GoNamedElement)definition).getName()); return; } } super.visitElement(element); } }); WriteCommandAction.runWriteCommandAction(project, new Runnable() { @Override public void run() { for (Map.Entry<GoReferenceExpressionBase, String> usage : usages.entrySet()) { GoReferenceExpressionBase expression = usage.getKey(); expression.replace(expression instanceof GoReferenceExpression ? GoElementFactory.createReferenceExpression(project, usage.getValue()) : GoElementFactory.createTypeReferenceExpression(project, usage.getValue())); } GoImportDeclaration importDeclaration = PsiTreeUtil.getParentOfType(element, GoImportDeclaration.class); assert importDeclaration != null; PsiElement elementToDelete = importDeclaration.getImportSpecList().size() == 1 ? importDeclaration : element; elementToDelete.delete(); } }); }

Target:
public void applyFix(@NotNull final Project project, @NotNull ProblemDescriptor descriptor) { final PsiElement element = descriptor.getPsiElement(); final PsiFile file = element != null ? element.getContainingFile() : null; if (!(element instanceof GoImportSpec && file instanceof GoFile)) return; WriteCommandAction.runWriteCommandAction(project, new Runnable() { @Override public void run() { ((GoFile)file).deleteImport((GoImportSpec)element); } }); }
Source:
public List<Pair<Term, BitSet>> disjunctions() { Set<Pair<Term, BitSet>> disjunctions = new HashSet<>(); disjunctions.addAll((java.util.Collection<Pair<Term, BitSet>>) (Object) Arrays.asList(kItemDisjunctionsArray)); ((List<List<Pair<Term, BitSet>>>) (Object) Arrays.asList(variableDisjunctionsArray)).stream().filter(l -> l != null).forEach(disjunctions::addAll); disjunctions.addAll((java.util.Collection<Pair<Term, BitSet>>) (Object) tokenDisjunctions.values()); disjunctions.removeIf(e -> e == null); return new ArrayList<>(disjunctions); }

Target:
public List<Pair<Term, BitSet>> disjunctions() { return disjunctions; }