auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void removeUserFromKeycloak(String userId) throws ServerException { try { String token = requestToken(); int responseCode = requestFactory .fromUrl(keycloakRemoveUserUrl + userId) .setAuthorizationHeader("Bearer " + token) .useDeleteMethod() .request() .getResponseCode(); if (responseCode != 204) { throw new ServerException("Can't remove user from KeyClock. UserId:" + userId); } } catch (IOException | ApiException e) { LOG.warn("Exception during removing user from Keycloak", e); throw new ServerException("Exception during removing user from Keycloak", e); } }

Target:
public void removeUserFromKeycloak(String userId) throws ServerException { try { String token = requestToken(); int responseCode = requestFactory .fromUrl(keycloakRemoveUserUrl + userId) .setAuthorizationHeader("Bearer " + token) .useDeleteMethod() .request() .getResponseCode(); if (responseCode != 204) { throw new ServerException("Can't remove user from Keycloak. UserId:" + userId); } } catch (IOException | ApiException e) { LOG.warn("Exception during removing user from Keycloak", e); throw new ServerException("Exception during removing user from Keycloak", e); } }
Source:
private Sequence getSequence(String gappedSequenceString){ if (gappedSequenceString == null) return null; Sequence returnSeq = null; String sequenceString = gappedSequenceString.replace("-", ""); try { if (sequenceString.matches("^[ACTG]+$")) returnSeq = new DNASequence(sequenceString, DNACompoundSet.getDNACompoundSet()); else if (sequenceString.matches("^[ACUG]+$")) returnSeq = new RNASequence(sequenceString, DNACompoundSet.getDNACompoundSet()); else returnSeq = new ProteinSequence(sequenceString, AminoAcidCompoundSet.getAminoAcidCompoundSet()); } catch (CompoundNotFoundException ex) { Logger.getLogger(Hsp.class.getName()).log(Level.SEVERE, null, ex); } return returnSeq; }

Target:
private Sequence getSequence(String gappedSequenceString){ if (gappedSequenceString == null) return null; Sequence returnSeq = null; String sequenceString = gappedSequenceString.replace("-", ""); try { if (sequenceString.matches("^[ACTG]+$")) returnSeq = new DNASequence(sequenceString, DNACompoundSet.getDNACompoundSet()); else if (sequenceString.matches("^[ACUG]+$")) returnSeq = new RNASequence(sequenceString, DNACompoundSet.getDNACompoundSet()); else returnSeq = new ProteinSequence(sequenceString, AminoAcidCompoundSet.getAminoAcidCompoundSet()); } catch (CompoundNotFoundException ex) { logger.error("Unexpected error, could not find compound when creating Sequence object from Hsp", ex); } return returnSeq; }
Source:
public boolean isEmpty() { if(this.getTherapy().isEmpty() && this.getDisease().isEmpty() && this.getVersion().isEmpty() && this.getPages().isEmpty() && this.getCategory().isEmpty() && this.getDescription().isEmpty()) return true; else return false; }

Target:
public boolean isEmpty() { if (StringUtils.isNullOrEmpty(this.therapy) && StringUtils.isNullOrEmpty(this.disease) && StringUtils.isNullOrEmpty(this.version) && StringUtils.isNullOrEmpty(this.pages) && StringUtils.isNullOrEmpty(this.category) && StringUtils.isNullOrEmpty(this.description)) return true; else return false; }
Source:
public ColumnFamilyOptions getColumnOptions() { ColumnFamilyOptions opt = predefinedOptions.createColumnOptions(handlesToClose); handlesToClose.add(opt); if (optionsFactory != null) { opt = optionsFactory.createColumnOptions(opt, handlesToClose); } if (sharedResources != null) { final RocksDBSharedResources rocksResources = sharedResources.getResourceHandle(); final Cache blockCache = rocksResources.getCache(); TableFormatConfig tableFormatConfig = opt.tableFormatConfig(); BlockBasedTableConfig blockBasedTableConfig; if (tableFormatConfig == null) { blockBasedTableConfig = new BlockBasedTableConfig(); } else { Preconditions.checkArgument(tableFormatConfig instanceof BlockBasedTableConfig, "We currently only support BlockBasedTableConfig When bounding total memory."); blockBasedTableConfig = (BlockBasedTableConfig) tableFormatConfig; } if (rocksResources.isUsingPartitionedIndex()) { blockBasedTableConfig.setIndexType(IndexType.kTwoLevelIndexSearch); blockBasedTableConfig.setPartitionFilters(true); blockBasedTableConfig.setPinTopLevelIndexAndFilter(true); } blockBasedTableConfig.setBlockCache(blockCache); blockBasedTableConfig.setCacheIndexAndFilterBlocks(true); blockBasedTableConfig.setCacheIndexAndFilterBlocksWithHighPriority(true); blockBasedTableConfig.setPinL0FilterAndIndexBlocksInCache(true); opt.setTableFormatConfig(blockBasedTableConfig); } return opt; }

Target:
public ColumnFamilyOptions getColumnOptions() { ColumnFamilyOptions opt = predefinedOptions.createColumnOptions(handlesToClose); handlesToClose.add(opt); if (optionsFactory != null) { opt = optionsFactory.createColumnOptions(opt, handlesToClose); } if (sharedResources != null) { final RocksDBSharedResources rocksResources = sharedResources.getResourceHandle(); final Cache blockCache = rocksResources.getCache(); TableFormatConfig tableFormatConfig = opt.tableFormatConfig(); BlockBasedTableConfig blockBasedTableConfig; if (tableFormatConfig == null) { blockBasedTableConfig = new BlockBasedTableConfig(); } else { Preconditions.checkArgument(tableFormatConfig instanceof BlockBasedTableConfig, "We currently only support BlockBasedTableConfig When bounding total memory."); blockBasedTableConfig = (BlockBasedTableConfig) tableFormatConfig; } if (rocksResources.isUsingPartitionedIndex()) { blockBasedTableConfig.setIndexType(IndexType.kTwoLevelIndexSearch); blockBasedTableConfig.setPartitionFilters(true); blockBasedTableConfig.setPinTopLevelIndexAndFilter(true); this.overwriteFilterIfExist(blockBasedTableConfig); } blockBasedTableConfig.setBlockCache(blockCache); blockBasedTableConfig.setCacheIndexAndFilterBlocks(true); blockBasedTableConfig.setCacheIndexAndFilterBlocksWithHighPriority(true); blockBasedTableConfig.setPinL0FilterAndIndexBlocksInCache(true); opt.setTableFormatConfig(blockBasedTableConfig); } return opt; }
Source:
protected void configureWebView() { mWebView.getSettings().setJavaScriptEnabled(true); mWebView.getSettings().setDomStorageEnabled(true); WebViewClient webViewClient; Bundle extras = getIntent().getExtras(); ArrayList<String> allowedURL = null; if (extras != null && extras.getBoolean(DISABLE_LINKS_ON_PAGE, false)) { String addressToLoad = extras.getString(URL_TO_LOAD); String authURL = extras.getString(AUTHENTICATION_URL); allowedURL = new ArrayList<>(); if (!TextUtils.isEmpty(addressToLoad)) { allowedURL.add(addressToLoad); } if (!TextUtils.isEmpty(authURL)) { allowedURL.add(authURL); } if(extras.getStringArray(ALLOWED_URLS) != null) { String[] urls = extras.getStringArray(ALLOWED_URLS); for (String currentURL: urls) { allowedURL.add(currentURL); } } } if (getIntent().hasExtra(LOCAL_BLOG_ID)) { SiteModel site = mSiteStore.getSiteByLocalId(getIntent().getIntExtra(LOCAL_BLOG_ID, -1)); if (site == null) { AppLog.e(AppLog.T.UTILS, "No valid blog passed to WPWebViewActivity"); finish(); } webViewClient = new WPWebViewClient(site, mAccountStore.getAccessToken(), allowedURL); } else { if (allowedURL == null || allowedURL.size() == 0) { AppLog.e(AppLog.T.UTILS, "No valid urls passed to WPWebViewActivity"); finish(); } webViewClient = new URLFilteredWebViewClient(allowedURL); } mWebView.setWebViewClient(webViewClient); mWebView.setWebChromeClient(new WPWebChromeClient(this, (ProgressBar) findViewById(R.id.progress_bar))); }

Target:
protected void configureWebView() { mWebView.getSettings().setJavaScriptEnabled(true); mWebView.getSettings().setDomStorageEnabled(true); WebViewClient webViewClient; Bundle extras = getIntent().getExtras(); ArrayList<String> allowedURL = null; if (extras != null && extras.getBoolean(DISABLE_LINKS_ON_PAGE, false)) { String addressToLoad = extras.getString(URL_TO_LOAD); String authURL = extras.getString(AUTHENTICATION_URL); allowedURL = new ArrayList<>(); if (!TextUtils.isEmpty(addressToLoad)) { allowedURL.add(addressToLoad); } if (!TextUtils.isEmpty(authURL)) { allowedURL.add(authURL); } if(extras.getStringArray(ALLOWED_URLS) != null) { String[] urls = extras.getStringArray(ALLOWED_URLS); for (String currentURL: urls) { allowedURL.add(currentURL); } } } if (getIntent().hasExtra(LOCAL_BLOG_ID)) { SiteModel site = mSiteStore.getSiteByLocalId(getIntent().getIntExtra(LOCAL_BLOG_ID, -1)); if (site == null) { AppLog.e(AppLog.T.UTILS, "No valid blog passed to WPWebViewActivity"); finish(); } webViewClient = new WPWebViewClient(site, mAccountStore.getAccessToken(), allowedURL); } else { webViewClient = new URLFilteredWebViewClient(allowedURL); } mWebView.setWebViewClient(webViewClient); mWebView.setWebChromeClient(new WPWebChromeClient(this, (ProgressBar) findViewById(R.id.progress_bar))); }
Source:
private void createLockFileIfMissing() throws IOException { Path lockFile = getLockFilePath(); if (!lockFile.toFile().exists()) { FileChannel fc = FileChannel.open(lockFile, StandardOpenOption.CREATE, StandardOpenOption.WRITE); FileLock fl = fc.tryLock(); if (fl == null) { return; } try { Files.setPosixFilePermissions(lockFile, LOCK_FILE_PERMISSIONS); } finally { fl.release(); } } else { Files.setPosixFilePermissions(lockFile, LOCK_FILE_PERMISSIONS); } }

Target:
private void createLockFileIfMissing() throws IOException { Path lockFile = getLockFilePath(); if (!lockFile.toFile().exists()) { FileChannel fc = FileChannel.open(lockFile, StandardOpenOption.CREATE, StandardOpenOption.WRITE); try (FileLock fl = fc.tryLock()) { if (fl == null) { return; } Files.setPosixFilePermissions(lockFile, LOCK_FILE_PERMISSIONS); } } else { Files.setPosixFilePermissions(lockFile, LOCK_FILE_PERMISSIONS); } }
Source:
public ConfigAccessor(HelixZkClient zkClient) { this._zkClient = zkClient; this._usesExternalZkClient = true; }

Target:
public ConfigAccessor(HelixZkClient zkClient) { _zkClient = zkClient; _usesExternalZkClient = true; }
Source:
int fillFrom(ByteBuffer channelReadBuffer) { int toWrite = Math.min(channelReadBuffer.remaining(), buf.remaining()); if (channelReadBuffer.remaining() > buf.remaining()) { int savedLimit = channelReadBuffer.limit(); channelReadBuffer.limit(channelReadBuffer.position() + buf.remaining()); buf.put(channelReadBuffer); channelReadBuffer.limit(savedLimit); } else { buf.put(channelReadBuffer); } return toWrite; }

Target:
int fillFrom(ByteBuffer channelReadBuffer) { int toWrite = Math.min(channelReadBuffer.remaining(), buf.remaining()); if (channelReadBuffer.remaining() > buf.remaining()) { int savedLimit = channelReadBuffer.limit(); channelReadBuffer.limit(channelReadBuffer.position() + buf.remaining()); buf.put(channelReadBuffer); channelReadBuffer.limit(savedLimit); } else { buf.put(channelReadBuffer); } if (!buf.hasRemaining()) { onFillComplete(); } return toWrite; }
Source:
private static void createApiFile(File outFile, Map<String, ApiClass> classes) { PrintStream ps = null; try { ps = new PrintStream(outFile); ps.println("<?xml version=\"1.0\" encoding=\"utf-8\"?>"); ps.println("<api version=\"1\">"); TreeMap<String, ApiClass> map = new TreeMap<String, ApiClass>(classes); for (ApiClass theClass : map.values()) { (theClass).print(ps); } ps.println("</api>"); } catch (FileNotFoundException e) { e.printStackTrace(); } finally { if (ps != null) { ps.close(); } } }

Target:
private static boolean createApiFile(File outFile, Map<String, ApiClass> classes) { PrintStream ps = null; try { ps = new PrintStream(outFile, "UTF-8"); ps.println("<?xml version=\"1.0\" encoding=\"utf-8\"?>"); ps.println("<api version=\"1\">"); TreeMap<String, ApiClass> map = new TreeMap<String, ApiClass>(classes); for (ApiClass theClass : map.values()) { (theClass).print(ps); } ps.println("</api>"); } catch (Exception e) { e.printStackTrace(); return false; } finally { if (ps != null) { ps.close(); } } return true; }
Source:
public void setup() throws ConfigurationException { initMocks(this); mTest = new TestDescription("HelloTest", "testDrive"); ITestDevice mockDevice = mock(ITestDevice.class); when(mockDevice.getSerialNumber()).thenReturn("serial1"); mDevices = new ArrayList<>(); mDevices.add(mockDevice); when(mContext.getDevices()).thenReturn(mDevices); when(mContext.getDeviceName(same(mockDevice))).thenReturn("device1"); when(mMockReceiver.getLogcatData()).thenReturn(createInputStreamSource()); mCollector.addLogcatReceiver(mockDevice, mMockReceiver); doReturn(createFakeTimingMetrics()).when(mCollector).parse(any(InputStreamSource.class)); mCollector.init(mContext, mListener); setPatterns(mCollector); }

Target:
public void setup() throws ConfigurationException { initMocks(this); mTest = new TestDescription("HelloTest", "testDrive"); ITestDevice mockDevice = mock(ITestDevice.class); when(mockDevice.getSerialNumber()).thenReturn("serial1"); mDevices = new ArrayList<>(); mDevices.add(mockDevice); when(mContext.getDevices()).thenReturn(mDevices); when(mContext.getDeviceName(same(mockDevice))).thenReturn("device1"); when(mMockReceiver.getLogcatData()).thenReturn(createInputStreamSource()); doReturn(mMockReceiver).when(mCollector).createLogcatReceiver(same(mockDevice), anyString()); doReturn(createFakeTimingMetrics()).when(mCollector).parse(any(InputStreamSource.class)); mCollector.init(mContext, mListener); setPatterns(mCollector); }
Source:
public PageCacheByteArray( PagedFile pagedFile, long length, byte[] defaultValue, long base ) throws IOException { super( pagedFile, defaultValue.length, length, 0, base ); this.defaultValue = defaultValue; setDefaultValue( -1 ); }

Target:
PageCacheByteArray( PagedFile pagedFile, long length, byte[] defaultValue, long base ) throws IOException { super( pagedFile, defaultValue.length, length, base ); this.defaultValue = defaultValue; setDefaultValue( -1 ); }
Source:
public final SQLSerializer handleSelect(final String sep, final List<? extends Expression<?>> expressions) { if (inSubquery) { Set<String> names = Sets.newHashSet(); List<Expression<?>> replacements = Lists.newArrayList(); for (Expression<?> expr : expressions) { if (expr instanceof Path) { String name = ColumnMetadata.getName((Path<?>) expr); if (!names.add(name.toLowerCase())) { expr = ExpressionUtils.as(expr, "col__" + name + replacements.size()); } } replacements.add(expr); } return handle(sep, replacements); } else { return handle(sep, expressions); } }

Target:
public final SQLSerializer handleSelect(final String sep, final List<? extends Expression<?>> expressions) { if (inSubquery) { Set<String> names = Sets.newHashSet(); List<Expression<?>> replacements = Lists.newArrayList(); for (Expression<?> expr : expressions) { if (expr instanceof Path) { String name = ColumnMetadata.getName((Path<?>) expr); if (!names.add(name.toLowerCase(Locale.ENGLISH))) { expr = ExpressionUtils.as(expr, "col__" + name + replacements.size()); } } replacements.add(expr); } return handle(sep, replacements); } else { return handle(sep, expressions); } }
Source:
public static boolean debug() { if (debug == null) { debug = "TRUE".equalsIgnoreCase(System.getProperty("run.flaky.tests.debug", "FALSE")); } return debug; }

Target:
public static boolean debug() { return DEBUG; }
Source:
public void notifyServerHasUpdates(String serverId, List<String> changelog, ConnectedSonarLintEngine engine, SonarQubeServer server, boolean onlyProjects) { Notification notification = new Notification(GROUP_UPDATE_NOTIFICATION, "<b>SonarLint - Configuration updates available.</b> <a href=\"#ignore\">Ignore...</a>", "\n<br>Some configuration updates are available from the SonarQube server '" + serverId + "': <ul><li>" + StringUtil.join(changelog, "<li>") + "</ul>If you want to apply them, click here to <a href=\"#update\">update binding</a>", NotificationType.INFORMATION, new NotificationListener.Adapter() { @Override public void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent event) { switch (event.getDescription()) { case "#ignore": notification.hideBalloon(); break; case "#update": SonarQubeServerMgmtPanel.updateServerBinding(server, engine, true, onlyProjects); break; default: throw new IllegalArgumentException("Unknow event: " + event.getDescription()); } } }); notification.setImportant(false); notification.notify(myProject); }

Target:
public void notifyServerHasUpdates(String serverId, List<String> changelog, ConnectedSonarLintEngine engine, SonarQubeServer server, boolean onlyProjects) { Notification notification = new Notification(GROUP_UPDATE_NOTIFICATION, "<b>SonarLint - Configuration updates available.</b> <a href=\"#ignore\">Ignore...</a>", "\n<br>Some configuration updates are available from the SonarQube server '" + serverId + "': <ul><li>" + StringUtil.join(changelog, "<li>") + "</ul>If you want to apply them, <a href=\"#update\">click here to update binding</a>", NotificationType.INFORMATION, new NotificationListener.Adapter() { @Override public void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent event) { switch (event.getDescription()) { case "#ignore": notification.hideBalloon(); break; case "#update": SonarQubeServerMgmtPanel.updateServerBinding(server, engine, true, onlyProjects); break; default: throw new IllegalArgumentException("Unknow event: " + event.getDescription()); } } }); notification.setImportant(false); notification.notify(myProject); }
Source:
public ConfigDef config() { return new ConfigDef(); }

Target:
public ConfigDef config() { return CONFIG_DEF; }
Source:
public void testConsumingEndOfMonitorNotTreatedAsTrivial() { NullProgressMonitor npm = new NullProgressMonitor(); boolean threwException = false; SubMonitor subMonitor = SubMonitor.convert(npm, 1000); subMonitor.newChild(500); try { npm.setCanceled(true); subMonitor.split(500); } catch (OperationCanceledException exception) { threwException = true; } assertTrue("split should have thrown an exception", threwException); }

Target:
public void testConsumingEndOfMonitorNotTreatedAsTrivial() { NullProgressMonitor npm = new NullProgressMonitor(); SubMonitor subMonitor = SubMonitor.convert(npm, 1000); subMonitor.newChild(500); try { npm.setCanceled(true); subMonitor.split(500); fail("split should have thrown an exception"); } catch (OperationCanceledException exception) { } }
Source:
protected StorageService getOrCreateStorageService(String storageServiceName) { StorageAccountApi storageApi = api.getStorageAccountApi(getResourceGroupName()); StorageService ss = storageApi.get(storageServiceName); if (ss != null) { return ss; } URI uri = storageApi.create(storageServiceName, LOCATION, ImmutableMap.of("property_name", "property_value"), ImmutableMap.of("accountType", StorageService.AccountType.Standard_ZRS.toString())); if (uri != null){ assertTrue(uri.toString().contains("api-version")); boolean jobDone = Predicates2.retry(new Predicate<URI>() { @Override public boolean apply(URI uri) { return ParseJobStatus.JobStatus.DONE == api.getJobApi().jobStatus(uri); } }, 60 * 1 * 1000 ).apply(uri); assertTrue(jobDone, "delete operation did not complete in the configured timeout"); } ss = storageApi.get(storageServiceName); Assert.assertEquals(ss.location(), LOCATION); Logger.getAnonymousLogger().log(Level.INFO, "created storageService: {0}", ss); return ss; }

Target:
protected StorageService getOrCreateStorageService(String storageServiceName) { StorageAccountApi storageApi = api.getStorageAccountApi(getResourceGroupName()); StorageService ss = storageApi.get(storageServiceName); if (ss != null) { return ss; } URI uri = storageApi.create(storageServiceName, LOCATION, ImmutableMap.of("property_name", "property_value"), ImmutableMap.of("accountType", StorageService.AccountType.Standard_LRS.toString())); if (uri != null){ assertTrue(uri.toString().contains("api-version")); boolean jobDone = Predicates2.retry(new Predicate<URI>() { @Override public boolean apply(URI uri) { return ParseJobStatus.JobStatus.DONE == api.getJobApi().jobStatus(uri); } }, 60 * 1 * 1000 ).apply(uri); assertTrue(jobDone, "create operation did not complete in the configured timeout"); } ss = storageApi.get(storageServiceName); Assert.assertEquals(ss.location(), LOCATION); Logger.getAnonymousLogger().log(Level.INFO, "created storageService: {0}", ss); return ss; }
Source:
public void testEmptyDelegationToken() throws IOException { Configuration conf = getTestConfiguration(); MiniDFSCluster cluster = null; try { cluster = new MiniDFSCluster.Builder(conf).numDataNodes(1).build(); URI defaultUri = URI.create(conf.get(CommonConfigurationKeys.FS_DEFAULT_NAME_KEY)); ConfigUtil.addLinkFallback(conf, defaultUri.getHost(), defaultUri); try (FileSystem fileSys = FileSystem.get(conf)) { fileSys.getDelegationToken(""); } } finally { if (cluster != null) { cluster.shutdown(); } } }

Target:
public void testEmptyDelegationToken() throws IOException { Configuration conf = getTestConfiguration(); MiniDFSCluster cluster = null; try { cluster = new MiniDFSCluster.Builder(conf).numDataNodes(0).build(); URI defaultUri = URI.create(conf.get(CommonConfigurationKeys.FS_DEFAULT_NAME_KEY)); ConfigUtil.addLinkFallback(conf, defaultUri.getHost(), defaultUri); try (FileSystem fileSys = FileSystem.get(conf)) { fileSys.getDelegationToken(""); } } finally { if (cluster != null) { cluster.shutdown(); } } }
Source:
public void log(final CommitSession commitSession, final long tabletSeq, final Mutation m, final Durability durability) throws IOException { if (durability == Durability.NONE) { return; } if (durability == Durability.DEFAULT) { throw new IllegalArgumentException("Unexpected durability " + durability); } write(Collections.singletonList(commitSession), false, logger -> logger.log(tabletSeq, commitSession.getLogId(), m, durability), writeRetryFactory.createRetry()); logSizeEstimate.addAndGet(m.numBytes()); }

Target:
public void log(final CommitSession commitSession, final long tabletSeq, final Mutation m, final Durability durability) throws IOException { if (durability == Durability.DEFAULT || durability == Durability.NONE) { throw new IllegalArgumentException("Unexpected durability " + durability); } write(singletonList(commitSession), false, logger -> logger.log(tabletSeq, commitSession.getLogId(), m, durability), writeRetryFactory.createRetry()); logSizeEstimate.addAndGet(m.numBytes()); }
Source:
public String getResponseFromQuery(String query) { try { final URL url = new URL( WEBSERVICE_URL + "&q=" + URLEncoder.encode(query, StandardCharsets.UTF_8.toString())); final URLConnection connection = url.openConnection(); return IOUtils.toString(connection.getInputStream()); } catch (MalformedURLException e) { logger.debug("Constructed query url '{}' is not valid: {}", query, e.getMessage()); } catch (IOException e) { logger.warn("Communication error occurred while getting Yahoo weather information: {}", e.getMessage()); } return null; }

Target:
public String getResponseFromQuery(String query) { try { return HttpUtil.executeUrl("GET", WEBSERVICE_URL + "&q=" + URLEncoder.encode(query, StandardCharsets.UTF_8.toString()), WEBSERVICE_TIMEOUT); } catch (IOException e) { logger.warn("Communication error occurred while getting Yahoo weather information: {}", e.getMessage()); } return null; }
Source:
@Override public final String toString() { return MoreObjects.toStringHelper(this) .add("name", name()) .add("version", version()) .add("description", description()) .add("content", "[REDACTED]") .add("size", size()) .add("createdAtSeconds", createdAtSeconds()) .add("createdBy", createdBy()) .add("type", type()) .add("metadata", metadata()) .add("expiry", expiry()) .omitNullValues() .toString(); }

Target:
@Override public final String toString() { return MoreObjects.toStringHelper(this) .add("name", name()) .add("description", description()) .add("content", "[REDACTED]") .add("size", size()) .add("createdAtSeconds", createdAtSeconds()) .add("createdBy", createdBy()) .add("type", type()) .add("metadata", metadata()) .add("expiry", expiry()) .omitNullValues() .toString(); }
Source:
public static HtsgetResponse parse(final String s) { final HtsgetResponse resp = new HtsgetResponse(); final mjson.Json j = mjson.Json.read(s); final mjson.Json htsget = j.at("htsget"); final mjson.Json md5 = htsget.at("md5"); if (md5 != null) { resp.md5 = md5.asString(); } final mjson.Json htsgetClass = htsget.at("format"); if (htsgetClass != null) { resp.format = HtsgetFormat.valueOf(htsgetClass.asString().toUpperCase()); } final mjson.Json blocksJson = htsget.at("urls"); if (blocksJson == null) { throw new IllegalArgumentException("No urls field found in Htsget Response"); } resp.blocks = blocksJson.asJsonList().stream() .map(Block::parse) .collect(Collectors.toList()); return resp; }

Target:
public static HtsgetResponse parse(final String s) { final mjson.Json j = mjson.Json.read(s); final mjson.Json htsget = j.at("htsget"); if (htsget == null) { throw new HtsgetMalformedResponseException("No htsget key found in response"); } final mjson.Json md5Json = htsget.at("md5"); final mjson.Json formatJson = htsget.at("format"); final mjson.Json blocksJson = htsget.at("urls"); if (blocksJson == null) { throw new HtsgetMalformedResponseException("No urls field found in Htsget Response"); } final List<Block> blocks = blocksJson.asJsonList().stream() .map(Block::parse) .collect(Collectors.toList()); return new HtsgetResponse( formatJson == null ? null : HtsgetFormat.valueOf(formatJson.asString().toUpperCase()), blocks, md5Json == null ? null : md5Json.asString() ); }
Source:
private boolean onlyBranchesAreSelected(TreeSelection selection) { Iterator selIterator = selection.iterator(); for (Object sel = selIterator.next(); selIterator.hasNext(); sel = selIterator .next()) { if (sel instanceof RefNode) { RefNode node = (RefNode) sel; String refName = node.getObject().getName(); if (!refName.startsWith(Constants.R_HEADS)) return false; } else return false; } return true; }

Target:
private boolean onlyBranchesAreSelected(TreeSelection selection) { Iterator selIterator = selection.iterator(); while (selIterator.hasNext()) { Object sel = selIterator.next(); if (sel instanceof RefNode) { RefNode node = (RefNode) sel; String refName = node.getObject().getName(); if (!refName.startsWith(Constants.R_HEADS)) return false; } else return false; } return true; }
Source:
public JRDataSource getDataSource() { String sessionId = getSessionIdProvider().getSessionId(); @SuppressWarnings("unchecked") List<SessionData> all = getHibernateTemplate().find("from SessionData sd where sd.sessionId=?", sessionId); if (all.size() > 1) { throw new IllegalStateException("To much session data was stored for the session."); } if (all.isEmpty()) { throw new IllegalStateException("Session data for session "+sessionId+" was not stored"); } all.get(0).setSessionName(sessionId); return new JRBeanCollectionDataSource(all); }

Target:
public JRDataSource getDataSource() { String sessionId = getSessionIdProvider().getSessionId(); @SuppressWarnings("unchecked") List<SessionData> all = getHibernateTemplate().find("from SessionData sd where sd.sessionId=?", sessionId); if (all.size() > 1) { throw new IllegalStateException("To much session data was stored for the session " + sessionId); } if (all.isEmpty()) { throw new IllegalStateException("Session data for session " + sessionId + " was not stored"); } all.get(0).setSessionName(sessionId); return new JRBeanCollectionDataSource(all); }
Source:
public List<BibEntry> performSearch(String query) { List<String> plainReferences = Arrays .stream(query.split("\\r\\r+|\\n\\n+|\\r\\n(\\r\\n)+")) .map(String::trim) .filter(str -> !str.isBlank()) .collect(Collectors.toCollection(ArrayList::new)); if (plainReferences.isEmpty()) { return Collections.emptyList(); } else { return plainReferences .stream() .map(reference -> parseUsingGrobid(reference)) .flatMap(Optional::stream) .map(reference -> parseBibToBibEntry(reference)) .flatMap(Optional::stream) .collect(Collectors.toList()); } }

Target:
public List<BibEntry> performSearch(String query) { return Arrays .stream(query.split("\\r\\r+|\\n\\n+|\\r\\n(\\r\\n)+")) .map(String::trim) .filter(str -> !str.isBlank()) .map(reference -> parseUsingGrobid(reference)) .flatMap(Optional::stream) .map(reference -> parseBibToBibEntry(reference)) .flatMap(Optional::stream) .collect(Collectors.toList()); }
Source:
private DatabaseRow getNextRow() throws SQLException { numRowsInResult++; try { ResultSetMetaData rsmd = _queryResultSet.getMetaData(); int colCount = rsmd.getColumnCount(); DatabaseRow row = new DatabaseRow(); for (int i = 1; i <= colCount; i++) { String colName = rsmd.getColumnName(i); int colType = rsmd.getColumnType(i); String formattedColName = _interpreter.formatColumnName(colName); Object result = _interpreter.sqlObjectToAvro(_queryResultSet.getObject(i), formattedColName, _tableSchema); row.addField(formattedColName, result, colType); if (_chunkingKeys.containsKey(colName)) { _chunkingKeys.put(colName, result); } } return row; } catch (SQLException e) { _metrics.updateErrorRate(); if (_skipBadMessagesEnabled) { LOG.warn("Skipping row due to SQL exception", e); _metrics.updateSkipBadMessagesRate(); return null; } else { LOG.error("Failed to interpret row and skipBadMessage not enabled", e); throw e; } } }

Target:
private DatabaseRow getNextRow() throws SQLException { _numRowsInResult++; try { ResultSetMetaData rsmd = _queryResultSet.getMetaData(); int colCount = rsmd.getColumnCount(); DatabaseRow row = new DatabaseRow(); for (int i = 1; i <= colCount; i++) { String colName = rsmd.getColumnName(i); int colType = rsmd.getColumnType(i); String formattedColName = _interpreter.formatColumnName(colName); Object result = _interpreter.sqlObjectToAvro(_queryResultSet.getObject(i), formattedColName, _tableSchema); row.addField(formattedColName, result, colType); if (_chunkingKeys.containsKey(colName)) { _chunkingKeys.put(colName, result); } } return row; } catch (SQLException e) { _metrics.updateErrorRate(); if (_skipBadMessagesEnabled) { LOG.warn("Skipping row due to SQL exception", e); _metrics.updateSkipBadMessagesRate(); return null; } else { LOG.error("Failed to interpret row and skipBadMessage not enabled", e); throw e; } } }
Source:
protected void openIptablesImpl(Iterable<Integer> inboundPorts, SshMachineLocation machine) { if (inboundPorts == null || Iterables.isEmpty(inboundPorts)) { log.info("No ports to open in iptables (no inbound ports) for at {}", machine, this); } else { log.info("Opening ports in iptables for at {}", entity(), machine); List<String> iptablesRules = Lists.newArrayList(); String iptablesInstallCommands = ""; if (isLocationFirewalldEnabled(machine)) { for (Integer port : inboundPorts) { iptablesRules.add(IptablesCommands.addFirewalldRule(Chain.INPUT, Protocol.TCP, port, Policy.ACCEPT)); } } else { iptablesRules = createIptablesRulesForNetworkInterface(inboundPorts); iptablesInstallCommands = IptablesCommands.saveIptablesRules(); } insertIptablesRules(iptablesRules, iptablesInstallCommands, machine); listIptablesRules(machine); } }

Target:
protected void openIptablesImpl(Iterable<Integer> inboundPorts, SshMachineLocation machine) { if (inboundPorts == null || Iterables.isEmpty(inboundPorts)) { log.info("No ports to open in iptables (no inbound ports) for at {}", machine, this); } else { log.info("Opening ports in iptables for at {}", entity(), machine); List<String> iptablesRules = Lists.newArrayList(); String iptablesInstallCommands = null; Task<Integer> checkFirewall = checkLocationFirewall(machine); if (checkFirewall.getUnchecked() == 0) { for (Integer port : inboundPorts) { iptablesRules.add(IptablesCommands.addFirewalldRule(Chain.INPUT, Protocol.TCP, port, Policy.ACCEPT)); } } else { iptablesRules = createIptablesRulesForNetworkInterface(inboundPorts); iptablesInstallCommands = IptablesCommands.saveIptablesRules(); } insertIptablesRules(iptablesRules, iptablesInstallCommands, machine); listIptablesRules(machine); } }
Source:
AnonymousClassWriter(ClassName className) { super(className); this.arguments = Optional.absent(); this.types = Lists.newArrayList(); }

Target:
AnonymousClassWriter(ClassName className) { super(className); arguments = Optional.absent(); typeVariables = Lists.newArrayList(); }
Source:
protected void executeCommand() { DbUserDAO dao = getDbUserDAO(); DbUser dbUser = dao.getByExternalId(getParameters().getDirectory(), principal.<String> get(PrincipalRecord.ID)); DbUser mappedDbUser = DirectoryUtils.mapPrincipalRecordToDbUser(getParameters().getDirectory(), principal); mappedDbUser.setId(dbUser != null ? dbUser.getId() : Guid.newGuid()); mappedDbUser.setActive(dbUser != null ? dbUser.isActive() : true); DirectoryUtils.syncAndReactivatePrincipal(principal, mappedDbUser, "the user is rectivated as it was added again to the system"); setActionReturnValue(mappedDbUser.getId()); setSucceeded(true); }

Target:
protected void executeCommand() { DbUser userToAdd = getParameters().getUserToAdd(); SyncUsers.sync(Arrays.asList(userToAdd), "The user was found in authz provider while it was added to the oVirt engine"); setActionReturnValue(DbFacade.getInstance().getDbUserDao().getByExternalId(userToAdd.getDomain(), userToAdd.getExternalId()).getId()); setSucceeded(true); }
Source:
public String toString() { return MoreObjects.toStringHelper(this.getClass()) .add("Required formals", requiredFormals) .add("Optional formals", optionalFormals) .add("Varargs formals", restFormals) .add("Return", returnType) .add("Nominal type", nominalType).toString(); }

Target:
public String toString() { return MoreObjects.toStringHelper(this) .add("Required formals", requiredFormals) .add("Optional formals", optionalFormals) .add("Varargs formals", restFormals) .add("Return", returnType) .add("Nominal type", nominalType).toString(); }
Source:
public DownloadRequestStrategy into(ImageView imageView) { ImageRequest imageRequest = imageRequestBuilder.build(); GenericDraweeHierarchy genericDraweeHierarchy = genericDraweeHierarchyBuilder.build(); DraweeView draweeView = (DraweeView) imageView; DraweeController draweeController = Fresco.newDraweeControllerBuilder() .setImageRequest(imageRequest) .build(); draweeController.setHierarchy(genericDraweeHierarchy); draweeView.setController(draweeController); return new FrescoDownloadRequestStrategy(); }

Target:
public DownloadRequestStrategy into(ImageView imageView) { if (!(imageView instanceof DraweeView)) { throw new IllegalArgumentException("ImageView must be an instance of DraweeView."); } ImageRequest imageRequest = imageRequestBuilder.build(); GenericDraweeHierarchy genericDraweeHierarchy = genericDraweeHierarchyBuilder.build(); DraweeView draweeView = (DraweeView) imageView; DraweeController draweeController = Fresco.newDraweeControllerBuilder() .setImageRequest(imageRequest) .build(); draweeController.setHierarchy(genericDraweeHierarchy); draweeView.setController(draweeController); return new FrescoDownloadRequestStrategy(); }
Source:
public boolean equals( Object o ) { if ( this == o ) return true; if ( o == null || getClass() != o.getClass() ) return false; MetadataCacheKey that = (MetadataCacheKey) o; return storeKey.equals( that.storeKey ) && path.equals( that.path ); }

Target:
public boolean equals( Object o ) { if ( this == o ) return true; if ( o == null || getClass() != o.getClass() ) return false; MetadataCacheKey that = (MetadataCacheKey) o; return Objects.equals( storeKey, that.storeKey ) && Objects.equals( path, that.path ); }
Source:
public void lockCanBeUpdated() { UUID leaderId = UUID.randomUUID(); LockWatchStateUpdate update = LockWatchStateUpdate.update(leaderId, 1, ImmutableList.of( LockEvent.builder(ImmutableSet.of(DESCRIPTOR)).build(0), UnlockEvent.builder(ImmutableSet.of(DESCRIPTOR)).build(1))); tracker.updateState(update); VersionedLockWatchState state = tracker.currentState(); assertThat(state.version()).isEqualTo(OptionalLong.of(1)); assertThat(state.leaderId()).isEqualTo(leaderId); assertThat(state.lockWatchState(DESCRIPTOR)).isEqualTo(LockWatchInfo.of(UNLOCKED, OptionalLong.of(0))); LockWatchStateUpdate secondUpdate = LockWatchStateUpdate.update(leaderId, 2, ImmutableList.of( LockEvent.builder(ImmutableSet.of(DESCRIPTOR)).build(2))); tracker.updateState(secondUpdate); state = tracker.currentState(); assertThat(state.version()).isEqualTo(OptionalLong.of(2)); assertThat(state.leaderId()).isEqualTo(leaderId); assertThat(state.lockWatchState(DESCRIPTOR)).isEqualTo(LockWatchInfo.of(LOCKED, OptionalLong.of(2))); }

Target:
public void lockCanBeUpdated() { UUID leaderId = UUID.randomUUID(); LockWatchStateUpdate update = LockWatchStateUpdate.update(leaderId, 1, ImmutableList.of( LockEvent.builder(ImmutableSet.of(DESCRIPTOR)).build(0), UnlockEvent.builder(ImmutableSet.of(DESCRIPTOR)).build(1))); tracker.updateState(update); VersionedLockWatchState state = tracker.currentState(); assertThat(state.version()).hasValue(1); assertThat(state.leaderId()).isEqualTo(leaderId); assertThat(state.lockWatchState(DESCRIPTOR)).isEqualTo(LockWatchInfo.of(UNLOCKED, OptionalLong.of(0))); LockWatchStateUpdate secondUpdate = LockWatchStateUpdate.update(leaderId, 2, ImmutableList.of( LockEvent.builder(ImmutableSet.of(DESCRIPTOR)).build(2))); tracker.updateState(secondUpdate); state = tracker.currentState(); assertThat(state.version()).hasValue(2); assertThat(state.leaderId()).isEqualTo(leaderId); assertThat(state.lockWatchState(DESCRIPTOR)).isEqualTo(LockWatchInfo.of(LOCKED, OptionalLong.of(2))); }
Source:
public final MesosClient<Send, Receive> build() { return new MesosClient<>( checkNotNull(mesosUri), checkNotNull(applicationUserAgentEntry), checkNotNull(sendCodec), checkNotNull(receiveCodec), checkNotNull(subscribe), checkNotNull(streamProcessor), checkNotNull(byteStreamTransformer)); }

Target:
public final MesosClient<Send, Receive> build() { return new MesosClient<>( checkNotNull(mesosUri), checkNotNull(applicationUserAgentEntry), checkNotNull(sendCodec), checkNotNull(receiveCodec), checkNotNull(subscribe), checkNotNull(streamProcessor), checkNotNull(backpressureTransformer) ); }
Source:
private CreateConnectionViewRequest createConnectionViewRequest(final IElementType type, final EditPart source, final EditPart target, final Point sourcePoint, final Point targetPoint) { CreateConnectionViewRequest connectionRequest = CreateViewRequestFactory.getCreateConnectionRequest(type, ((IGraphicalEditPart) getDiagramEditPart()).getDiagramPreferencesHint()); connectionRequest.setLocation(sourcePoint); connectionRequest.setSourceEditPart(null); connectionRequest.setTargetEditPart(source); connectionRequest.setType(RequestConstants.REQ_CONNECTION_START); Command cmd = source.getCommand(connectionRequest); connectionRequest.setSourceEditPart(source); connectionRequest.setTargetEditPart(target); connectionRequest.setType(RequestConstants.REQ_CONNECTION_END); connectionRequest.setLocation(targetPoint); EObject container = getRootEditPart().resolveSemanticElement(); connectionRequest.getExtendedData().put(SOURCE_MODEL_CONTAINER, container); connectionRequest.getExtendedData().put(TARGET_MODEL_CONTAINER, container); return connectionRequest; }

Target:
private CreateConnectionViewRequest createConnectionViewRequest(final IElementType type, final EditPart source, final EditPart target, final Point sourcePoint, final Point targetPoint) { CreateConnectionViewRequest connectionRequest = CreateViewRequestFactory.getCreateConnectionRequest(type, ((IGraphicalEditPart) getDiagramEditPart()).getDiagramPreferencesHint()); connectionRequest.setLocation(sourcePoint); connectionRequest.setSourceEditPart(null); connectionRequest.setTargetEditPart(source); connectionRequest.setType(RequestConstants.REQ_CONNECTION_START); source.getCommand(connectionRequest); connectionRequest.setSourceEditPart(source); connectionRequest.setTargetEditPart(target); connectionRequest.setType(RequestConstants.REQ_CONNECTION_END); connectionRequest.setLocation(targetPoint); EObject container = getRootEditPart().resolveSemanticElement(); connectionRequest.getExtendedData().put(SOURCE_MODEL_CONTAINER, container); connectionRequest.getExtendedData().put(TARGET_MODEL_CONTAINER, container); return connectionRequest; }
Source:
protected LinkedHashMap<String, ZuulRoute> locateRoutes() { LinkedHashMap<String, ZuulRoute> routesMap = new LinkedHashMap<>(); addConfiguredRoutes(routesMap); routesMap.putAll(staticRoutes); List<String> services = discovery.getServices(); for (String serviceId : services) { String key = "/" + serviceId + "/**"; if (!properties.getIgnoredServices().contains(serviceId) && !routesMap.containsKey(key)) { routesMap.put(key, new ZuulRoute(key, serviceId)); } } if (routesMap.get(DEFAULT_ROUTE) != null) { ZuulRoute defaultRoute = routesMap.get(DEFAULT_ROUTE); routesMap.remove(DEFAULT_ROUTE); routesMap.put(DEFAULT_ROUTE, new ZuulRoute(defaultRoute.getPath(), defaultRoute.getLocation())); } LinkedHashMap<String, ZuulRoute> values = new LinkedHashMap<>(); for (Entry<String, ZuulRoute> entry : routesMap.entrySet()) { String path = entry.getKey(); if (!path.startsWith("/")) { path = "/" + path; } if (StringUtils.hasText(properties.getPrefix())) { path = properties.getPrefix() + path; if (!path.startsWith("/")) { path = "/" + path; } } values.put(path, entry.getValue()); } return values; }

Target:
protected LinkedHashMap<String, ZuulRoute> locateRoutes() { LinkedHashMap<String, ZuulRoute> routesMap = new LinkedHashMap<>(); addConfiguredRoutes(routesMap); routesMap.putAll(staticRoutes); List<String> services = discovery.getServices(); for (String serviceId : services) { String key = "/" + serviceId + "/**"; if (!properties.getIgnoredServices().contains(serviceId) && !routesMap.containsKey(key)) { routesMap.put(key, new ZuulRoute(key, serviceId)); } } if (routesMap.get(DEFAULT_ROUTE) != null) { ZuulRoute defaultRoute = routesMap.get(DEFAULT_ROUTE); routesMap.remove(DEFAULT_ROUTE); routesMap.put(DEFAULT_ROUTE, defaultRoute); } LinkedHashMap<String, ZuulRoute> values = new LinkedHashMap<>(); for (Entry<String, ZuulRoute> entry : routesMap.entrySet()) { String path = entry.getKey(); if (!path.startsWith("/")) { path = "/" + path; } if (StringUtils.hasText(properties.getPrefix())) { path = properties.getPrefix() + path; if (!path.startsWith("/")) { path = "/" + path; } } values.put(path, entry.getValue()); } return values; }
Source:
private void toHtmlForPeriodical(StringBuilder result) { appendNames(creators, result); appendYear(result); appendArticle(result); appendContainedIn(result); appendNames(contributors, result); appendTitle(result); appendVolumeInformation(result); appendEdition(result, true); appendPlaceAndPublisher(result); appendOverallTitleAndNumber(result); appendPagerange(result); }

Target:
private void toHtmlForPeriodical(StringBuilder result) { appendNames(creators, result); appendYear(result); appendArticle(result); if (Objects.nonNull(part)) { result.append(' '); result.append(part); } appendContainedIn(result); appendTitle(result); if (Objects.nonNull(subseries)) { result.append(' '); result.append(subseries); } if (Objects.nonNull(volume)) { result.append(' '); result.append(volume); } if (Objects.nonNull(published)) { result.append(" ("); result.append(published.toString(PUBLICATION_DATE_FORMAT)); result.append(')'); } if (Objects.nonNull(number)) { result.append(' '); result.append(number); } appendPagerange(result); if (Objects.nonNull(accessed)) { result.append(" ("); appendAccessed(result); result.append(')'); } appendURL(result); }
Source:
public static Map<String, Integer> calculateAveragePartitionWeight( Map<String, Map<String, Integer>> partitionCapacityMap) { Map<String, PartitionWeightCounterEntry> countPartitionWeightMap = aggregatePartitionWeight(partitionCapacityMap); Map<String, Integer> averagePartitionWeightMap = new HashMap<>(); for (Map.Entry<String, PartitionWeightCounterEntry> entry : countPartitionWeightMap.entrySet()) { String capacityKey = entry.getKey(); PartitionWeightCounterEntry weightEntry = entry.getValue(); int averageWeight = weightEntry.getWeight() / weightEntry.getPartitions(); averagePartitionWeightMap.put(capacityKey, averageWeight); } return averagePartitionWeightMap; }

Target:
public static Map<String, Integer> calculateAveragePartitionWeight( Map<String, Map<String, Integer>> partitionCapacityMap) { Map<String, PartitionWeightCounterEntry> countPartitionWeightMap = new HashMap<>(); partitionCapacityMap.values().forEach(partitionCapacityEntry -> partitionCapacityEntry.forEach((capacityKey, weight) -> countPartitionWeightMap .computeIfAbsent(capacityKey, counterEntry -> new PartitionWeightCounterEntry()) .increase(1, weight))); Map<String, Integer> averagePartitionWeightMap = new HashMap<>(); for (Map.Entry<String, PartitionWeightCounterEntry> entry : countPartitionWeightMap.entrySet()) { String capacityKey = entry.getKey(); PartitionWeightCounterEntry weightEntry = entry.getValue(); int averageWeight = (int) (weightEntry.getWeight() / weightEntry.getPartitions()); averagePartitionWeightMap.put(capacityKey, averageWeight); } return averagePartitionWeightMap; }
Source:
private static <E extends Expression> HasTypeRef getTypeRefOfExpression(final Optional<E> expression, final HasExpression hasExpression) { HasTypeRef hasTypeRef = expression.get(); final DMNModelInstrumentedBase base = hasExpression.asDMNModelInstrumentedBase(); if (base instanceof HasVariable) { final HasVariable hasVariable = (HasVariable) base; hasTypeRef = hasVariable.getVariable(); } return hasTypeRef; }

Target:
private static <E extends Expression> HasTypeRef getTypeRefOfExpression(final Optional<E> expression, final HasExpression hasExpression) { HasTypeRef hasTypeRef = expression.orElseThrow(() -> new UnsupportedOperationException("'expression' should never be null for grids supporting NameAndDataTypeHeaderMetaData.")); final DMNModelInstrumentedBase base = hasExpression.asDMNModelInstrumentedBase(); if (base instanceof HasVariable) { final HasVariable hasVariable = (HasVariable) base; hasTypeRef = hasVariable.getVariable(); } return hasTypeRef; }
Source:
public Optional<String> checkTypeForDoNotMockViolation(Class<?> type) { return Arrays.stream(type.getAnnotations()).filter( annotation -> annotation.annotationType().getName().endsWith("org.mockito.DoNotMock")) .findFirst() .map(annotation -> { String exceptionMessage = type + " is annotated with @DoNoMock and can't be mocked."; if (DoNotMock.class.equals(annotation.annotationType())) { exceptionMessage += " " + type.getAnnotation(DoNotMock.class).value(); } return exceptionMessage; }); }

Target:
public String checkTypeForDoNotMockViolation(Class<?> type) { for (Annotation annotation : type.getAnnotations()) { if (annotation.annotationType().getName().endsWith("org.mockito.DoNotMock")) { String exceptionMessage = type + " is annotated with org.mockito.@DoNoMock and can't be mocked."; if (DoNotMock.class.equals(annotation.annotationType())) { exceptionMessage += " " + type.getAnnotation(DoNotMock.class).value(); } return exceptionMessage; } } return null; }
Source:
private void createPresenterModule() { RenderedTemplate renderedTemplate = null; if (presenterConfigModel.getNestedPresenter()) { renderedTemplate = createdNestedPresenterTemplates.getModule(); } else if (presenterConfigModel.getPresenterWidget()) { renderedTemplate = createdPresenterWidgetTemplates.getModule(); } else if (presenterConfigModel.getPopupPresenter()) { renderedTemplate = createdPopupPresenterTemplates.getModule(); } PsiClass createdPsiClass = createPsiClass(createdPresenterPackage, renderedTemplate); createdPsiClass.navigate(true); }

Target:
private void createPresenterModule() { RenderedTemplate renderedTemplate = null; if (presenterConfigModel.getNestedPresenter()) { renderedTemplate = createdNestedPresenterTemplates.getModule(); } else if (presenterConfigModel.getPresenterWidget()) { renderedTemplate = createdPresenterWidgetTemplates.getModule(); } else if (presenterConfigModel.getPopupPresenter()) { renderedTemplate = createdPopupPresenterTemplates.getModule(); } createdModulePsiClass = createPsiClass(createdPresenterPackage, renderedTemplate); navigateToClass(createdModulePsiClass); }
Source:
public static String printMoneyArray(Money[] array) { String values = ""; for(int i = 0; i < array.length; i++) { values += array[i].toXmlString(); if(i < (array.length-1)) { values += ","; } } return values; }

Target:
public static String printMoneyArray(Money[] array) { StringBuilder values = new StringBuilder(); for(int i = 0; i < array.length; i++) { values.append(array[i].toXmlString()); if(i < (array.length-1)) { values.append(","); } } return values.toString(); }