auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected boolean connectLunDisks(Guid hostId) { if (getVm().getDiskMap().isEmpty()) { vmHandler.updateDisksFromDb(getVm()); } List<LunDisk> lunDisks = DisksFilter.filterLunDisks(getVm().getDiskMap().values()); Set<String> connections = new HashSet<>(); for (LunDisk lunDisk : lunDisks) { LUNs lun = lunDisk.getLun(); lun.setLunConnections(new ArrayList<>(storageServerConnectionDao.getAllForLun(lun.getLUNId()))); if (connections.containsAll( lun.getLunConnections() .stream() .map(c -> c.getId()) .collect(Collectors.toList()))) { continue; } if (lun.getLunConnections().isEmpty()) { return false; } if (!connect(hostId, lun)) { log.info("Failed to connect a lun disk to vdsm '{}' skipping it", hostId); return false; } connections.addAll(lun.getLunConnections() .stream() .map(c -> c.getId()) .collect(Collectors.toList())); } return true; }

Target:
protected boolean connectLunDisks(Guid hostId) { if (getVm().getDiskMap().isEmpty()) { vmHandler.updateDisksFromDb(getVm()); } List<LunDisk> lunDisks = DisksFilter.filterLunDisks(getVm().getDiskMap().values()); Set<String> connections = new HashSet<>(); for (LunDisk lunDisk : lunDisks) { LUNs lun = lunDisk.getLun(); lun.setLunConnections(new ArrayList<>(storageServerConnectionDao.getAllForLun(lun.getLUNId()))); if (connections.containsAll( lun.getLunConnections() .stream() .map(c -> c.getId()) .collect(Collectors.toList()))) { continue; } if (lun.getLunConnections().isEmpty()) { return false; } if (!connect(hostId, lun)) { log.error("Failed to connect a lun disk '{}' to vdsm '{}' skipping it", lun, hostId); return false; } connections.addAll(lun.getLunConnections() .stream() .map(c -> c.getId()) .collect(Collectors.toList())); } return true; }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Mapbox.getInstance(this, getString(R.string.access_token)); setContentView(R.layout.activity_extrusion_rotation); mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(@NonNull final MapboxMap map) { mapboxMap = map; setupBuildings(); setupLocationPlugin(); } }); sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); gyro = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); magnetic = sensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD); sensorManager.registerListener(this, gyro , 200); sensorManager.registerListener(this, magnetic , 200); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Mapbox.getInstance(this, getString(R.string.access_token)); setContentView(R.layout.activity_extrusion_rotation); mapView = (MapView) findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(@NonNull final MapboxMap map) { mapboxMap = map; setupBuildingExtrusionPlugin(); } }); }
Source:
public static InputStream openInputStream(final String uri, final Function<SeekableByteChannel, SeekableByteChannel> wrapper) throws IOException { final String scheme = Optional.ofNullable(IOUtil.getScheme(uri)).orElse(""); final InputStream inputStream; final Set<String> URL_SCHEMES = new HashSet<>(Arrays.asList("http","ftp","https")); if (URL_SCHEMES.contains(scheme)) { inputStream = getURLHelper(new URL(uri)).openInputStream(); } else if (scheme.isEmpty()) { File file = new File(uri); inputStream = new FileInputStream(file); } else { inputStream = new SeekablePathStream(IOUtil.getPath(uri), wrapper); } return inputStream; }

Target:
public static InputStream openInputStream(final String uri, final Function<SeekableByteChannel, SeekableByteChannel> wrapper) throws IOException { final InputStream inputStream; if (URL_SCHEMES.stream().anyMatch(uri::startsWith)) { inputStream = getURLHelper(new URL(uri)).openInputStream(); } else if (!IOUtil.hasScheme(uri)) { File file = new File(uri); inputStream = Files.newInputStream(file.toPath()); } else { inputStream = new SeekablePathStream(IOUtil.getPath(uri), wrapper); } return inputStream; }
Source:
public @ResponseBody List<AffiliationForm> getAffiliationsJson(HttpServletRequest request, @PathVariable("orcid") String orcid, @RequestParam(value = "affiliationIds") String workIdsStr) { List<AffiliationForm> affs = new ArrayList<AffiliationForm>(); Map<Long, Affiliation> affMap = affiliationMap(orcid, profileEntManager.getLastModified(orcid)); String[] affIds = workIdsStr.split(","); for (String id : affIds) { Affiliation aff = affMap.get(Long.valueOf(id)); validateVisibility(aff.getVisibility()); AffiliationForm form = AffiliationForm.valueOf(aff); form.setCountryForDisplay(getMessage(buildInternationalizationKey(CountryIsoEntity.class, aff.getOrganization().getAddress().getCountry().name()))); if(form.getDisambiguatedAffiliationSourceId() != null){ OrgDisambiguated orgDisambiguated = orgDisambiguatedManager.findInDB(Long.parseLong(form.getOrgDisambiguatedId().getValue())); form.setOrgDisambiguatedName(orgDisambiguated.getValue()); form.setOrgDisambiguatedUrl(orgDisambiguated.getUrl()); form.setOrgDisambiguatedCity(orgDisambiguated.getCity()); form.setOrgDisambiguatedRegion(orgDisambiguated.getRegion()); form.setOrgDisambiguatedCountry(orgDisambiguated.getCountry()); } affs.add(form); } return affs; }

Target:
public @ResponseBody List<AffiliationForm> getAffiliationsJson(HttpServletRequest request, @PathVariable("orcid") String orcid, @RequestParam(value = "affiliationIds") String workIdsStr) { List<AffiliationForm> affs = new ArrayList<AffiliationForm>(); Map<Long, Affiliation> affMap = affiliationMap(orcid, profileEntManager.getLastModified(orcid)); String[] affIds = workIdsStr.split(","); for (String id : affIds) { Affiliation aff = affMap.get(Long.valueOf(id)); validateVisibility(aff.getVisibility()); AffiliationForm form = AffiliationForm.valueOf(aff); form.setCountryForDisplay(getMessage(buildInternationalizationKey(CountryIsoEntity.class, aff.getOrganization().getAddress().getCountry().name()))); if(form.getOrgDisambiguatedId() != null){ OrgDisambiguated orgDisambiguated = orgDisambiguatedManager.findInDB(Long.parseLong(form.getOrgDisambiguatedId().getValue())); form.setOrgDisambiguatedName(orgDisambiguated.getValue()); form.setOrgDisambiguatedUrl(orgDisambiguated.getUrl()); form.setOrgDisambiguatedCity(orgDisambiguated.getCity()); form.setOrgDisambiguatedRegion(orgDisambiguated.getRegion()); form.setOrgDisambiguatedCountry(orgDisambiguated.getCountry()); } affs.add(form); } return affs; }
Source:
public void receiveFile( String file1, String file2 ) throws Exception { log.debug(String.format("Receiving: '%1$s' '%2$s", file1, file2)); _remoteFileName(file1); MessageDigest localDigest = MessageDigest.getInstance("MD5"); PipedOutputStream pout = new PipedOutputStream(); final PipedInputStream pin = new PipedInputStream(pout); final OutputStream out = new DigestOutputStream( new FileOutputStream(file2), localDigest ); Thread t = new Thread( new Runnable() { public void run() { InputStream in = null; try { in = new GZIPInputStream(pin); byte b = new byte[8196]; int n; while ((n = in.read(b)) != -1) { out.write(b, 0, n); } } catch (IOException e) { log.debug(e); } finally { if (in != null) { try { in.close(); } catch(IOException e) { log.error(e); } } } } }, "SSHClient.decompress " + file2 ); try { t.start(); ByteArrayOutputStream remoteDigest = new ConstraintByteArrayOutputStream(1024); executeCommand( String.format(COMMAND_FILE_RECEIVE, "gzip -q", file1), new ByteArrayInputStream(new byte[0]), pout, remoteDigest ); t.join(1000); _validateDigest(localDigest, new String(remoteDigest.toByteArray(), "UTF-8").trim()); } catch(Exception e) { log.debug(e); throw e; } finally { t.interrupt(); try { out.close(); } catch(IOException e) { log.error(e); } } }

Target:
public void receiveFile( String file1, String file2 ) throws Exception { log.debug(String.format("Receiving: '%1$s' '%2$s", file1, file2)); _remoteFileName(file1); MessageDigest localDigest = MessageDigest.getInstance("MD5"); PipedOutputStream pout = new PipedOutputStream(); final InputStream pin = new PipedInputStream(pout, STREAM_BUFFER_SIZE); final OutputStream out = new DigestOutputStream( new FileOutputStream(file2), localDigest ); Thread t = new Thread( new Runnable() { public void run() { InputStream in = null; try { in = new GZIPInputStream(pin); byte b = new byte[STREAM_BUFFER_SIZE]; int n; while ((n = in.read(b)) != -1) { out.write(b, 0, n); } } catch (IOException e) { log.debug("Exceution during stream processing", e); } finally { if (in != null) { try { in.close(); } catch(IOException e) { log.error("Cannot close stream", e); } } } } }, "SSHClient.decompress " + file2 ); try { t.start(); ByteArrayOutputStream remoteDigest = new ConstraintByteArrayOutputStream(CONSTRAINT_BUFFER_SIZE); executeCommand( String.format(COMMAND_FILE_RECEIVE, "gzip -q", file1), new ByteArrayInputStream(new byte[0]), pout, remoteDigest ); t.join(THREAD_JOIN_WAIT_TIME); if (t.getState() != Thread.State.TERMINATED) { throw new IllegalStateException("Cannot stop SSH stream thead"); } _validateDigest(localDigest, new String(remoteDigest.toByteArray(), "UTF-8").trim()); } catch(Exception e) { log.debug("Receive failed", e); throw e; } finally { t.interrupt(); try { out.close(); } catch(IOException e) { log.error("Cannot close stream", e); } } log.debug(String.format("Received: '%1$s' '%2$s", file1, file2)); }
Source:
public boolean validate(byte[] key, byte[] auth) { try { String keyStr = new String(key, "UTF-8"); String authStr = new String(auth, "UTF-8"); int keyVal = Integer.parseInt(keyStr); int authVal = Integer.parseInt(authStr); if (keyVal!=0 && ((authVal % keyVal) != 0)) { return false; } } catch (NumberFormatException nfe) { return false; } catch (UnsupportedEncodingException e) { return false; } return true; }

Target:
private boolean validate(byte[] key, byte[] auth) { try { String keyStr = new String(key, "UTF-8"); String authStr = new String(auth, "UTF-8"); int keyVal = Integer.parseInt(keyStr); int authVal = Integer.parseInt(authStr); if (keyVal!=0 && ((authVal % keyVal) != 0)) { return false; } } catch (NumberFormatException | UnsupportedEncodingException nfe) { LOG.error("bad formatting", nfe); return false; } return true; }
Source:
public static Replicas singleton(Replica replica) { return of(Collections.singleton(replica)); }

Target:
public static ReplicaCollection singleton(Replica replica) { return of(replica); }
Source:
public UsageEventType(Plugin plugin, String categoryName, String actionName, String labelDescription, String valueDescription) { if(plugin == null) { throw new IllegalArgumentException("Plugin may not be null"); } if(actionName == null) { throw new IllegalArgumentException("Action name may not be null"); } actionName = actionName.replaceAll("\\s", "-"); String id = plugin.getBundle().getSymbolicName(); String[] segments = id.split("\\."); if(segments.length<4) { throw new IllegalArgumentException("Plugin ID (\"" + id + "\") must have at least 4 segments. For example: \"org.jboss.tools.common\""); } String componentName = segments[3]; Version version = plugin.getBundle().getVersion(); String componentVersion = "" + version.getMajor() + "." + version.getMinor() + "." + version.getMicro(); this.componentName = componentName; this.componentVersion = componentVersion; if(categoryName==null) { categoryName = componentName; } this.categoryName = categoryName; this.actionName = actionName; this.labelDescription = labelDescription; this.valueDescription = valueDescription; }

Target:
public UsageEventType(Plugin plugin, String categoryName, String actionName, String labelDescription, String valueDescription) { this(getComponentName(plugin), getVersion(plugin), categoryName, actionName, labelDescription, valueDescription); }
Source:
private void deleteAce(Sid sid, MutableAcl acl) { int nrEntries = acl.getEntries().size(); for (int i = nrEntries - 1; i >= 0; i--) { AccessControlEntry accessControlEntry = acl.getEntries().get(i); if (accessControlEntry.getSid().equals(sid)) { acl.deleteAce(i); mutableAclService.updateAcl(acl); } } }

Target:
private void deleteAce(Sid sid, MutableAcl acl) { int nrEntries = acl.getEntries().size(); boolean updated = false; for (int i = nrEntries - 1; i >= 0; i--) { AccessControlEntry accessControlEntry = acl.getEntries().get(i); if (accessControlEntry.getSid().equals(sid)) { acl.deleteAce(i); updated = true; } } if (updated) { mutableAclService.updateAcl(acl); } }
Source:
public CloseableIterable<RyaStatement> query(final RyaQuery ryaQuery) throws RyaDAOException { return query(new BatchRyaQuery(Collections.singleton(ryaQuery.getQuery()))); }

Target:
public CloseableIterable<RyaStatement> query(final RyaQuery ryaQuery) throws RyaDAOException { Preconditions.checkNotNull(ryaQuery); return query(new BatchRyaQuery(Collections.singleton(ryaQuery.getQuery()))); }
Source:
public void testCompressionSkip() { EmbeddedChannel encoderChannel = new EmbeddedChannel(new PerFrameDeflateEncoder(9, 15, false, ALWAYS_SKIP)); EmbeddedChannel decoderChannel = new EmbeddedChannel( ZlibCodecFactory.newZlibDecoder(ZlibWrapper.NONE)); byte[] payload = new byte[300]; random.nextBytes(payload); BinaryWebSocketFrame binaryFrame = new BinaryWebSocketFrame(true, WebSocketExtension.RSV3, Unpooled.wrappedBuffer(payload)); encoderChannel.writeOutbound(binaryFrame.copy()); BinaryWebSocketFrame outboundFrame = encoderChannel.readOutbound(); assertNotNull(outboundFrame); assertNotNull(outboundFrame.content()); assertArrayEquals(payload, ByteBufUtil.getBytes(outboundFrame.content())); assertEquals(WebSocketExtension.RSV3, outboundFrame.rsv()); assertTrue(outboundFrame.release()); decoderChannel.writeInbound(binaryFrame); BinaryWebSocketFrame inboundBinaryFrame = decoderChannel.readInbound(); assertNotNull(inboundBinaryFrame); assertNotNull(inboundBinaryFrame.content()); assertArrayEquals(payload, ByteBufUtil.getBytes(inboundBinaryFrame.content())); assertEquals(WebSocketExtension.RSV3, inboundBinaryFrame.rsv()); assertTrue(inboundBinaryFrame.release()); assertEquals(0, binaryFrame.refCnt()); }

Target:
public void testCompressionSkip() { EmbeddedChannel encoderChannel = new EmbeddedChannel( new PerFrameDeflateEncoder(9, 15, false, ALWAYS_SKIP)); byte[] payload = new byte[300]; random.nextBytes(payload); BinaryWebSocketFrame binaryFrame = new BinaryWebSocketFrame(true, 0, Unpooled.wrappedBuffer(payload)); assertTrue(encoderChannel.writeOutbound(binaryFrame.copy())); BinaryWebSocketFrame outboundFrame = encoderChannel.readOutbound(); assertNotNull(outboundFrame); assertNotNull(outboundFrame.content()); assertArrayEquals(payload, ByteBufUtil.getBytes(outboundFrame.content())); assertEquals(0, outboundFrame.rsv()); assertTrue(outboundFrame.release()); assertFalse(encoderChannel.finish()); }
Source:
public static Long getLogTail(Layout layout, CorfuRuntime runtime) { Set<Long> luResponses = new HashSet<>(); Layout.LayoutSegment segment = layout.getLatestSegment(); if (segment.getReplicationMode().equals(Layout.ReplicationMode.CHAIN_REPLICATION)) { for (Layout.LayoutStripe stripe : segment.getStripes()) { Long tail = CFUtils.getUninterruptibly( runtime.getLayoutView().getRuntimeLayout(layout) .getLogUnitClient(stripe.getLogServers().get(0)) .getLogTail()); luResponses.add(tail); } } else if (segment.getReplicationMode() .equals(Layout.ReplicationMode.QUORUM_REPLICATION)) { throw new UnsupportedOperationException(); } return Collections.max(luResponses); }

Target:
public static long getLogTail(Layout layout, CorfuRuntime runtime) { long globalLogTail = Address.NON_EXIST; Layout.LayoutSegment segment = layout.getLatestSegment(); if (segment.getReplicationMode() == Layout.ReplicationMode.CHAIN_REPLICATION) { for (Layout.LayoutStripe stripe : segment.getStripes()) { TailsResponse response = CFUtils.getUninterruptibly( runtime.getLayoutView().getRuntimeLayout(layout) .getLogUnitClient(stripe.getLogServers().get(DEFAULT_LOGUNIT)) .getLogTail()); globalLogTail = Long.max(globalLogTail, response.getLogTail()); } } else if (segment.getReplicationMode() == Layout.ReplicationMode.QUORUM_REPLICATION) { throw new UnsupportedOperationException(); } return globalLogTail; }
Source:
private static void logAuthSuccess(String user, String fromAddress) { if (fromAddress == null) fromAddress = ""; else fromAddress = " from " + fromAddress; String format = "Authenticated user " + user + "%s. This message is rate limited to once every 60 seconds."; RateLimitedLogger.tryLogForMessage(System.currentTimeMillis(), 60, TimeUnit.SECONDS, authLogger, Level.INFO, format, fromAddress); }

Target:
private static void logAuthSuccess(String user, String fromAddress) { if (fromAddress == null) { fromAddress = "NULL"; } String authenticationLogMessage = String.format( "Authenticated user %s from %s. This message is rate limited to once every 60 seconds.", user, fromAddress); RateLimitedLogger.tryLogForMessage(System.currentTimeMillis(), 60, TimeUnit.SECONDS, authLogger, Level.INFO, authenticationLogMessage); }
Source:
public static void setApplicationIconBadgeNumber(Context context, int badgeCount) { if (badgeCount > 0) { ShortcutBadger.applyCount(context, badgeCount); SharedPreferences.Editor editor = context.getSharedPreferences("badge", Context.MODE_PRIVATE).edit(); editor.putInt("badge", badgeCount); editor.apply(); } else { ShortcutBadger.removeCount(context); SharedPreferences.Editor editor = context.getSharedPreferences("badge", Context.MODE_PRIVATE).edit(); editor.putInt("badge", 0); editor.apply(); } }

Target:
public static void setApplicationIconBadgeNumber(Context context, int badgeCount) { if (badgeCount > 0) { ShortcutBadger.applyCount(context, badgeCount); }else{ ShortcutBadger.removeCount(context); } SharedPreferences.Editor editor = context.getSharedPreferences(BADGE, Context.MODE_PRIVATE).edit(); editor.putInt(BADGE, Math.max(badgeCount, 0)); editor.apply(); }
Source:
public static void tearDown() throws IOException, OperationException, TimeoutException, InterruptedException { try { operations.removeIfExists(endpointConfigurationAddress); administration.reloadIfRequired(); administration.restartIfRequired(); } finally { client.close(); } }

Target:
public static void tearDown() throws IOException, OperationException, TimeoutException, InterruptedException { try { operations.removeIfExists(endpointConfigurationAddress); administration.reloadIfRequired(); } finally { client.close(); } }
Source:
public String getMetricTypeId() { return idIfTypeCorrect(CanonicalPath.this, Resource.class); }

Target:
public String getMetricTypeId() { return idIfTypeCorrect(CanonicalPath.this, MetricType.class); }
Source:
public static RuntimeException propagate(Throwable throwable) { if (throwable instanceof InterruptedException) throw new RuntimeInterruptedException((InterruptedException) throwable); if (throwable instanceof ExecutionException) return Throwables.propagate(throwable.getCause()); return Throwables.propagate(throwable); }

Target:
public static RuntimeException propagate(Throwable throwable) { if (throwable instanceof InterruptedException) throw new RuntimeInterruptedException((InterruptedException) throwable); return Throwables.propagate(throwable); }
Source:
private UserAndRoleMap loadUserAndRoleMapFromDisk(String prefix) throws Exception { File userAndRoleMapFile = new File(commonCacheConfig.getCacheDirectory(), getUserRoleMapFilename(prefix)); if (!userAndRoleMapFile.exists()) { return null; } return objectMapper.readValue( userAndRoleMapFile, BasicAuthUtils.AUTHORIZER_USER_AND_ROLE_MAP_TYPE_REFERENCE ); }

Target:
private UserAndRoleMap loadUserAndRoleMapFromDisk(String prefix) throws IOException { File userAndRoleMapFile = new File(commonCacheConfig.getCacheDirectory(), getUserRoleMapFilename(prefix)); if (!userAndRoleMapFile.exists()) { return null; } return objectMapper.readValue( userAndRoleMapFile, BasicAuthUtils.AUTHORIZER_USER_AND_ROLE_MAP_TYPE_REFERENCE ); }
Source:
public void save() throws SQLException, IOException { createStoreDatabase(); if (this.schema == null) throw new RuntimeException("Uninitialized schema!"); Integer schemaId = executeInsert(schemaInsert, position.getFile(), position.getOffset(), 1); for (Database d : schema.getDatabases()) { Integer dbId = executeInsert(databaseInsert, schemaId, d.getName(), d.getEncoding()); for (Table t : d.getTableList()) { Integer tableId = executeInsert(tableInsert, schemaId, dbId, t.getName(), t.getEncoding()); for (ColumnDef c : t.getColumnList()) { executeInsert(columnInsert, schemaId, tableId, c.getName(), c.getEncoding(), c.getType(), c.getSigned() ? 1 : 0); } } } }

Target:
public void save() throws SQLException, IOException { createStoreDatabase(); if (this.schema == null) throw new RuntimeException("Uninitialized schema!"); try { connection.setAutoCommit(false); saveSchema(); connection.commit(); } finally { connection.setAutoCommit(true); } }
Source:
public void fetchThemes() { if (mFetchingThemes) { return; } mFetchingThemes = true; int page = 1; if (mThemeBrowserFragment != null) { page = mThemeBrowserFragment.getPage(); } WordPress.getRestClientUtilsV1_2().getFreeThemes(mSite.getSiteId(), THEME_FETCH_MAX, page, new Listener() { @Override public void onResponse(JSONObject response) { new FetchThemesTask().execute(response); } }, new ErrorListener() { @Override public void onErrorResponse(VolleyError response) { if (response.toString().equals(AuthFailureError.class.getName())) { String errorTitle = getString(R.string.theme_auth_error_title); String errorMsg = getString(R.string.theme_auth_error_message); if (mIsRunning) { FragmentTransaction ft = getFragmentManager().beginTransaction(); WPAlertDialogFragment fragment = WPAlertDialogFragment.newAlertDialog(errorMsg, errorTitle); ft.add(fragment, ALERT_TAB); ft.commitAllowingStateLoss(); } AppLog.d(T.THEMES, getString(R.string.theme_auth_error_authenticate)); } else { ToastUtils.showToast(ThemeBrowserActivity.this, R.string.theme_fetch_failed, ToastUtils.Duration.LONG) .show(); AppLog.d(T.THEMES, getString(R.string.theme_fetch_failed) + ": " + response.toString()); } mFetchingThemes = false; } } ); }

Target:
public void fetchThemes() { if (mFetchingThemes) { return; } mFetchingThemes = true; int page = 1; if (mThemeBrowserFragment != null) { page = mThemeBrowserFragment.getPage(); } WordPress.getRestClientUtilsV1_2().getFreeThemes(mSite.getSiteId(), THEME_FETCH_MAX, page, new Listener() { @Override public void onResponse(JSONObject response) { new FetchThemesTask().execute(response); } }, new ErrorListener() { @Override public void onErrorResponse(VolleyError response) { if (response.toString().equals(AuthFailureError.class.getName())) { String errorTitle = getString(R.string.theme_auth_error_title); String errorMsg = getString(R.string.theme_auth_error_message); if (mIsRunning) { FragmentTransaction ft = getFragmentManager().beginTransaction(); WPAlertDialogFragment fragment = WPAlertDialogFragment.newAlertDialog(errorMsg, errorTitle); ft.add(fragment, ALERT_TAB); ft.commitAllowingStateLoss(); } AppLog.d(T.THEMES, getString(R.string.theme_auth_error_authenticate)); } else { ToastUtils.showToast(ThemeBrowserActivity.this, R.string.theme_fetch_failed, ToastUtils.Duration.LONG); AppLog.d(T.THEMES, getString(R.string.theme_fetch_failed) + ": " + response.toString()); } mFetchingThemes = false; } } ); }
Source:
public int size() { int s = size; if (s == -1) { s = (int) validIndices().count(); size = s; } return s; }

Target:
public int size() { int s = size; if (s == 0) { s = (int) validIndices().count() + 1; size = s; } return s - 1; }
Source:
public static DataFetchingFieldSelectionSet newCollector(ExecutionContext executionContext, GraphQLType fieldType, List<Field> fields) { GraphQLType unwrappedType = ExecutionTypeInfo.unwrapBaseType(fieldType); if (unwrappedType instanceof GraphQLFieldsContainer) { return new DataFetchingFieldSelectionSetImpl(executionContext, (GraphQLFieldsContainer) unwrappedType, fields); } else { return NOOP; } }

Target:
public static DataFetchingFieldSelectionSet newCollector(ExecutionContext executionContext, GraphQLType fieldType, List<Field> fields) { GraphQLType unwrappedType = ExecutionTypeInfo.unwrapBaseType(fieldType); if (unwrappedType instanceof GraphQLFieldsContainer) { return new DataFetchingFieldSelectionSetImpl(executionContext, asObjectTypeOrNull(unwrappedType), fields); } else { return NOOP; } }
Source:
private void selectColorsAndFontsTheme(String colorAndFontThemeId) { if (colorAndFontThemeId == null) { colorAndFontThemeId = currentColorsAndFontsTheme.getId(); } for (ColorsAndFontsTheme colorsAndFontsTheme : (List<ColorsAndFontsTheme>) colorsAndFontsThemeCombo .getInput()) { if (colorsAndFontsTheme.getId().equals(colorAndFontThemeId)) { ISelection selection = new StructuredSelection(colorsAndFontsTheme); colorsAndFontsThemeCombo.setSelection(selection); break; } } }

Target:
private void selectColorsAndFontsTheme(String colorAndFontThemeId) { if (colorAndFontThemeId == null) { colorAndFontThemeId = currentColorsAndFontsTheme.getId(); } for (ColorsAndFontsTheme theme : (List<ColorsAndFontsTheme>) colorsAndFontsThemeCombo .getInput()) { if (theme.getId().equals(colorAndFontThemeId)) { ISelection selection = new StructuredSelection(theme); colorsAndFontsThemeCombo.setSelection(selection); break; } } }
Source:
void close(String user, Map<URI, AbstractLock> locks) { synchronized (this) { canClose(locks.keySet()); locks.entrySet().parallelStream().map(entry -> entry.getKey()) .peek(uri -> removePermission(user, locks.get(uri), uri)) .forEach(uri -> immutableReadFileManagement.maybeRemoveReadFile(uri, user)); } }

Target:
void close(String user, Map<URI, AbstractLock> locks) { synchronized (this) { canClose(locks.keySet()); locks.entrySet().parallelStream().map(Entry::getKey) .peek(uri -> removePermission(user, locks.get(uri), uri)) .forEach(uri -> immutableReadFileManagement.maybeRemoveReadFile(uri, user)); } }
Source:
public void afterPropertiesSet() { fafService.addOnMessageListener(UpdatedAchievementsMessage.class, updatedAchievementsMessage -> reloadAchievements()); playerAchievements = FXCollections.observableArrayList(); readOnlyPlayerAchievements = FXCollections.unmodifiableObservableList(playerAchievements); }

Target:
public void afterPropertiesSet() { fafService.addOnMessageListener(UpdatedAchievementsMessage.class, updatedAchievementsMessage -> reloadAchievements()); }
Source:
public void accept(final Socket socket) throws IOException { this.origin.accept(socket); final Thread callerThread = Thread.currentThread(); final Thread monitor = new Thread( new Runnable() { @Override public void run() { try { Thread.sleep(BkTimeable.this.latency); callerThread.interrupt(); } catch (final InterruptedException ex) { Thread.currentThread().interrupt(); throw new IllegalStateException(ex); } } } ); monitor.start(); }

Target:
public void accept(final Socket socket) throws IOException { this.threads.put(Thread.currentThread(), System.currentTimeMillis()); this.origin.accept(socket); }
Source:
private void updateSmtDisabledOnHosts() { for (VDS vds : allForCluster) { vds.setKernelCmdlineSmtDisabled(getCluster().getSmtDisabled()); if (getCluster().getSmtDisabled()) { vds.setCurrentKernelCmdline(vds.getCurrentKernelCmdline() + "nosmt "); } else if (vds.getCurrentKernelCmdline().contains("nosmt")) { String cmdLine = vds.getCurrentKernelCmdline(); cmdLine = cmdLine.replace("nosmt", ""); vds.setCurrentKernelCmdline(cmdLine); } vdsStaticDao.update(vds.getStaticData()); } }

Target:
private void updateSmtDisabledOnHosts() { for (VDS vds : allForCluster) { if (vds.isKernelCmdlineSmtDisabled() != getCluster().getSmtDisabled()) { vdsStaticDao.updateReinstallRequired(vds.getId(), true); } vds.setKernelCmdlineSmtDisabled(getCluster().getSmtDisabled()); if (getCluster().getSmtDisabled()) { vds.setCurrentKernelCmdline(vds.getCurrentKernelCmdline() + "nosmt "); } else if (vds.getCurrentKernelCmdline().contains("nosmt")) { String cmdLine = vds.getCurrentKernelCmdline(); cmdLine = cmdLine.replace("nosmt", "").trim(); vds.setCurrentKernelCmdline(cmdLine); } vdsStaticDao.update(vds.getStaticData()); } }
Source:
public Iterable<ServerInfo> listNodesByIds(final Iterable<String> ids) { return Iterables.filter(listNodes(), new Predicate<ServerInfo>() { @Override public boolean apply(ServerInfo server) { return Iterables.contains(ids, server.getUuid()); } }); }

Target:
public Iterable<ServerInfo> listNodesByIds(final Iterable<String> ids) { return filter(listNodes(), new Predicate<ServerInfo>() { @Override public boolean apply(ServerInfo server) { return contains(ids, server.getUuid()); } }); }
Source:
public TaskExecution mapRow(ResultSet rs, int rowNum) throws SQLException { long id = rs.getLong("TASK_EXECUTION_ID"); int exitCode = rs.getInt("EXIT_CODE"); return new TaskExecution(id, !rs.wasNull() ? exitCode : null, rs.getString("TASK_NAME"), rs.getTimestamp("START_TIME"), rs.getTimestamp("END_TIME"), rs.getString("EXIT_MESSAGE"), getTaskParameters(id)); }

Target:
public TaskExecution mapRow(ResultSet rs, int rowNum) throws SQLException { long id = rs.getLong("TASK_EXECUTION_ID"); return new TaskExecution(id, getNullableExitCode(rs), rs.getString("TASK_NAME"), rs.getTimestamp("START_TIME"), rs.getTimestamp("END_TIME"), rs.getString("EXIT_MESSAGE"), getTaskParameters(id)); }
Source:
public boolean subscribe(PropertyChangeListener listener) { if (listener == null) { logWarning("A null subscriber cannot be added."); return false; } if (subscribers.contains(listener)) { logWarning("The listener has already been subscribed."); return false; } subscribers.add(listener); return true; }

Target:
public boolean subscribe(PropertyChangeListener listener) { if (subscribers == null) { subscribers = Sets.newHashSet(); } if (listener == null) { LOGGER.warn(formatWarning("A null subscriber cannot be added.")); return false; } if (subscribers.contains(listener)) { LOGGER.warn(formatWarning("The listener has already been subscribed.")); return false; } subscribers.add(listener); return true; }
Source:
public Map<Partition.PartitionKey, NakadiCursor> getSubscriptionOffsets() { try { final List<NakadiCursor> existingPositions = new ArrayList<>(); switch (subscription.getReadFrom()) { case BEGIN: for (String eventType : subscription.getEventTypes()) { final Timeline timeline = timelineService.getActiveTimelinesOrdered(eventType).get(0); timelineService.getTopicRepository(timeline) .loadTopicStatistics(Collections.singletonList(timeline)) .forEach(stat -> existingPositions.add(stat.getBeforeFirst())); } break; case END: for (String eventType : subscription.getEventTypes()) { final Timeline timeline = timelineService.getActiveTimelinesOrdered(eventType).get(0); timelineService.getTopicRepository(timeline) .loadTopicStatistics(Collections.singletonList(timeline)) .forEach(stat -> existingPositions.add(stat.getLast())); } break; case CURSORS: subscription.getInitialCursors().forEach(cursor -> { try { existingPositions.add(cursorConverter.convert(cursor.getEventType(), cursor)); } catch (final Exception e) { throw new NakadiRuntimeException(e); } }); break; default: throw new IllegalStateException("unsupported start position " + subscription.getReadFrom() + " for subscription " + subscription.getId()); } return existingPositions.stream().collect( Collectors.toMap( cursor -> new Partition.PartitionKey(cursor.getTopic(), cursor.getPartition()), cursor -> cursor )); } catch (final NakadiException e) { throw new NakadiRuntimeException(e); } }

Target:
public Map<Partition.PartitionKey, NakadiCursor> getSubscriptionOffsets() { try { final List<NakadiCursor> existingPositions = new ArrayList<>(); switch (subscription.getReadFrom()) { case BEGIN: for (final String eventType : subscription.getEventTypes()) { final List<Timeline> activeTimelines = timelineService.getActiveTimelinesOrdered(eventType); final Timeline timeline = activeTimelines.get(0); timelineService.getTopicRepository(timeline) .loadTopicStatistics(Collections.singletonList(timeline)) .forEach(stat -> existingPositions.add(stat.getBeforeFirst())); } break; case END: for (final String eventType : subscription.getEventTypes()) { final List<Timeline> activeTimelines = timelineService.getActiveTimelinesOrdered(eventType); final Timeline timeline = activeTimelines.get(activeTimelines.size() - 1); timelineService.getTopicRepository(timeline) .loadTopicStatistics(Collections.singletonList(timeline)) .forEach(stat -> existingPositions.add(stat.getLast())); } break; case CURSORS: subscription.getInitialCursors().forEach(cursor -> { try { existingPositions.add(cursorConverter.convert(cursor)); } catch (final Exception e) { throw new NakadiRuntimeException(e); } }); break; default: throw new IllegalStateException("unsupported start position " + subscription.getReadFrom() + " for subscription " + subscription.getId()); } return existingPositions.stream().collect( Collectors.toMap( cursor -> new Partition.PartitionKey(cursor.getTopic(), cursor.getPartition()), cursor -> cursor )); } catch (final NakadiException e) { throw new NakadiRuntimeException(e); } }
Source:
public void OnConnected(DelegationIOConnection connection) { boolean offsetNeedRecoveryBeforeWork = false; for (PartitionTopicInfo info : partitionTopicInfos) { if (info.getFetchedOffset() < 0) { offsetNeedRecoveryBeforeWork = true; partitionBlockMap.put(info, true); senOffsetRequest(connection, info); } } if (!offsetNeedRecoveryBeforeWork) { if (betterOrdered) { sendMultiFetchRequest(connection); } else { for (PartitionTopicInfo info : partitionTopicInfos) { sendFetchRequest(connection, info); } } } }

Target:
public void OnConnected(DelegationIOConnection connection) { boolean offsetNeedRecoveryBeforeWork = false; for (PartitionTopicInfo info : partitionBlockMap.keySet()) { if (info.getFetchedOffset() < 0) { offsetNeedRecoveryBeforeWork = true; partitionBlockMap.put(info, true); sendOffsetRequest(connection, info); } } if (!offsetNeedRecoveryBeforeWork) { if (betterOrdered) { sendMultiFetchRequest(connection); } else { for (PartitionTopicInfo info : partitionBlockMap.keySet()) { sendFetchRequest(connection, info); } } } }
Source:
public void chooseAdvancedOption(int i) { waitForElementByElement(advancedField); advancedOptionInputs.get(i).click(); intraSearchButton.click(); }

Target:
public void chooseAdvancedOption(int i) { waitForElementByElement(advancedField); advancedOptionInputs.get(i).click(); intraSearchButton.click(); PageObjectLogging.log("chooseAdvancedOption", "chosen advance option is selected", true, driver); }
Source:
public static boolean needFigureChange(final WorkspaceImage bundledImage, IWorkspaceImageFigure figure) { boolean result = false; String workspacePath = bundledImage.getWorkspacePath(); if (StringUtil.isEmpty(workspacePath)) { if (!(figure instanceof WorkspaceImageFigure)) { result = true; } } else if (WorkspaceImageFigure.isSvgImage(workspacePath)) { if (!(figure instanceof SVGWorkspaceImageFigure)) { result = true; } } else if (!(figure instanceof WorkspaceImageFigure)) { result = true; } return result; }

Target:
public static boolean needFigureChange(final WorkspaceImage bundledImage, IWorkspaceImageFigure figure) { boolean result = false; String workspacePath = bundledImage.getWorkspacePath(); if (!StringUtil.isEmpty(workspacePath) && WorkspaceImageFigure.isSvgImage(workspacePath)) { result = !(figure instanceof SVGWorkspaceImageFigure); } else { result = !(figure instanceof WorkspaceImageFigure); } return result; }
Source:
public Void visitIndexSource(IndexSourceNode node, Context context) { TableHandle tableHandle = node.getTableHandle(); Set<Column> columns = new HashSet<>(); for (ColumnHandle columnHandle : node.getAssignments().values()) { columns.add(createColumn(metadata.getColumnMetadata(session, tableHandle, columnHandle))); } Set<ColumnHandle> desiredColumns = node.getAssignments().values().stream().collect(toImmutableSet()); Optional<TableStatistics> statistics = Optional.empty(); if (context.extractStatistics) { Constraint<ColumnHandle> constraint = new Constraint<>(node.getCurrentConstraint()); TableStatistics tableStatistics = metadata.getTableStatistics(session, tableHandle, constraint); statistics = Optional.of(pruneStatistics(tableStatistics, desiredColumns)); } inputs.add(createInput(metadata.getTableMetadata(session, tableHandle), tableHandle, columns, statistics)); return null; }

Target:
public Void visitIndexSource(IndexSourceNode node, Context context) { TableHandle tableHandle = node.getTableHandle(); Set<Column> columns = new HashSet<>(); for (ColumnHandle columnHandle : node.getAssignments().values()) { columns.add(createColumn(metadata.getColumnMetadata(session, tableHandle, columnHandle))); } Set<ColumnHandle> desiredColumns = node.getAssignments().values().stream().collect(toImmutableSet()); Optional<TableStatistics> statistics = Optional.empty(); if (context.isExtractStatistics()) { Constraint<ColumnHandle> constraint = new Constraint<>(node.getCurrentConstraint()); TableStatistics tableStatistics = metadata.getTableStatistics(session, tableHandle, constraint); statistics = Optional.of(pruneStatistics(tableStatistics, desiredColumns)); } inputs.add(createInput(metadata.getTableMetadata(session, tableHandle), tableHandle, columns, statistics)); return null; }
Source:
private void applyPrefixForLegacyConsumer(Message message) { if (session.getRemotingConnection() instanceof CoreRemotingConnection) { CoreRemotingConnection coreRemotingConnection = (CoreRemotingConnection) session.getRemotingConnection(); if (session.getMetaData(ClientSession.JMS_SESSION_IDENTIFIER_PROPERTY) != null && coreRemotingConnection.getClientVersion() < PacketImpl.ADDRESSING_CHANGE_VERSION) { if (getQueue().getRoutingType().equals(RoutingType.ANYCAST)) { if (!message.getAddress().startsWith(PacketImpl.OLD_QUEUE_PREFIX.toString())) { message.setAddress(PacketImpl.OLD_QUEUE_PREFIX + message.getAddress()); } } else if (getQueue().getRoutingType().equals(RoutingType.MULTICAST)) { if (!message.getAddress().startsWith(PacketImpl.OLD_TOPIC_PREFIX.toString())) { message.setAddress(PacketImpl.OLD_TOPIC_PREFIX + message.getAddress()); } } } } }

Target:
private void applyPrefixForLegacyConsumer(Message message) { if (requiresLegacyPrefix) { if (anycast) { if (!message.getAddress().startsWith(PacketImpl.OLD_QUEUE_PREFIX.toString())) { message.setAddress(PacketImpl.OLD_QUEUE_PREFIX + message.getAddress()); } } else { if (!message.getAddress().startsWith(PacketImpl.OLD_TOPIC_PREFIX.toString())) { message.setAddress(PacketImpl.OLD_TOPIC_PREFIX + message.getAddress()); } } } }
Source:
private void deleteResources(final IResourceUIModel[] uiResources, boolean willDeleteSubResources) { final JobGroup group = new JobGroup("Delete Openshift resources", 1, uiResources.length) { @Override protected boolean shouldCancel(IStatus lastCompletedJobResult, int numberOfFailedJobs, int numberOfCanceledJobs) { return false; } }; try (Stream<IResourceUIModel> stream = Arrays.stream(uiResources)) { stream.forEach(uiResource -> { DeleteResourceJob job = OpenShiftJobs.createDeleteResourceJob(uiResource.getResource(), willDeleteSubResources); job.setJobGroup(group); job.addJobChangeListener(new JobChangeAdapter() { @Override public void done(IJobChangeEvent event) { if(!event.getResult().isOK()) { uiResource.setDeleting(false); } } }); uiResource.setDeleting(true); job.schedule(); }); } }

Target:
private void deleteResources(final IResourceUIModel[] uiResources, boolean willDeleteSubResources) { final JobGroup group = new JobGroup("Delete Openshift resources", 1, uiResources.length) { @Override protected boolean shouldCancel(IStatus lastCompletedJobResult, int numberOfFailedJobs, int numberOfCanceledJobs) { return false; } }; DeleteResourceJob<IResourceUIModel> job = new DeleteResourceJob<>(Arrays.asList(uiResources), willDeleteSubResources, new DeleteResourceJob.Callback<IResourceUIModel>() { @Override public IResource getResource(IResourceUIModel wrapper) { return wrapper.getResource(); } @Override public void preProcess(IResourceUIModel wrapper) { wrapper.setDeleting(true); } @Override public void postProcess(IResourceUIModel wrapper) { wrapper.setDeleting(false); } }); job.schedule(); }
Source:
public void testSaveBulkNullListItem() throws Exception { List<Document> documents = new Vector<Document>(); documents.add(null); documents.add(new Document(UUID.randomUUID().toString(), System.currentTimeMillis(), mapper.valueToTree(Collections.singletonMap("TEST_NAME", "SINGLE_SAVE_TEST")))); queryStore.save(TestUtils.TEST_TABLE_NAME, documents); }

Target:
public void testSaveBulkNullListItem() throws Exception { List<Document> documents = new Vector<Document>(); documents.add(null); documents.add(new Document(UUID.randomUUID().toString(), System.currentTimeMillis(), mapper.valueToTree(Collections.singletonMap("TEST_NAME", "SINGLE_SAVE_TEST")))); try { queryStore.save(TestUtils.TEST_TABLE_NAME, documents); } catch (QueryStoreException e) { assertEquals(QueryStoreException.ErrorCode.INVALID_REQUEST, e.getErrorCode()); throw e; } }
Source:
protected final MessageValues deserializePayloadIfNecessary(Message<?> message) { return MessageSerializationUtils.deserializePayload(new MessageValues(message), this.contentTypeResolver, this.payloadTypeCache, this.codec); }

Target:
protected final MessageValues deserializePayloadIfNecessary(Message<?> message) { return MessageSerializationUtils.deserializePayload(new MessageValues(message), this.contentTypeResolver, this.codec); }
Source:
public RestOperations restOperations() { RestTemplate restOperations = (RestTemplate) super.restOperations(); if (vaultProperties.getNamespace() != null) { restOperations.getInterceptors().add(VaultClients .createNamespaceInterceptor(vaultProperties.getNamespace())); } return restOperations; }

Target:
public RestOperations restOperations() { RestTemplate restOperations = (RestTemplate) super.restOperations(); applyNamespaceInterceptor(restOperations); return restOperations; }
Source:
private ProgramState closeResource(ProgramState programState, final SymbolicValue target) { if (target != null && isOpened(programState, target)) { return programState.addConstraint(target.wrappedValue(), NullConstraint.CLOSED); } return programState; }

Target:
private static ProgramState closeResource(ProgramState programState, final SymbolicValue target) { if (target != null && isOpened(programState, target)) { return programState.addConstraint(target.wrappedValue(), NullConstraint.CLOSED); } return programState; }
Source:
protected Reader reader(String path) throws IOException { return new StringReader("key=testKey\npassword=ServerPassword\na=b\nlog=2"); }

Target:
protected Reader reader(String path) throws IOException { return new StringReader("key=testKey\npassword=randomPassword"); }
Source:
private ICommandControlDMContext getCommandControlContext(Object obj) { IDMContext context = null; if (obj instanceof IDMVMContext) context = ((IDMVMContext)obj).getDMContext(); else if (obj instanceof GdbLaunch) { GdbLaunch l = (GdbLaunch)obj; final DsfServicesTracker tracker = new DsfServicesTracker(GdbPlugin.getBundleContext(), l.getSession().getId()); Query<IDMContext> contextQuery = new Query<IDMContext>() { @Override protected void execute(DataRequestMonitor<IDMContext> rm) { ICommandControlService commandControl = tracker.getService(ICommandControlService.class); if (commandControl != null) { rm.setData(commandControl.getContext()); } rm.done(); } }; l.getSession().getExecutor().submit(contextQuery); try { context = contextQuery.get(); } catch (Exception e) { } } return DMContexts.getAncestorOfType(context, ICommandControlDMContext.class); }

Target:
private ICommandControlDMContext getCommandControlContext(Object obj) { IDMContext context = null; if (obj instanceof IDMVMContext) context = ((IDMVMContext)obj).getDMContext(); else if (obj instanceof GdbLaunch) { GdbLaunch l = (GdbLaunch)obj; final DsfServicesTracker tracker = new DsfServicesTracker(GdbPlugin.getBundleContext(), l.getSession().getId()); Query<IDMContext> contextQuery = new Query<IDMContext>() { @Override protected void execute(DataRequestMonitor<IDMContext> rm) { ICommandControlService commandControl = tracker.getService(ICommandControlService.class); tracker.dispose(); if (commandControl != null) { rm.setData(commandControl.getContext()); } rm.done(); } }; l.getSession().getExecutor().submit(contextQuery); try { context = contextQuery.get(); } catch (Exception e) { } } return DMContexts.getAncestorOfType(context, ICommandControlDMContext.class); }
Source:
public SparkConf sparkConf() { Optional<SparkConfiguration> maybeSparkConfiguration = rhizomeConfiguration.getSparkConfiguration(); Optional<CassandraConfiguration> maybeCassandraConfiguration = rhizomeConfiguration.getCassandraConfiguration(); if ( maybeSparkConfiguration.isPresent() && maybeCassandraConfiguration.isPresent() ) { SparkConfiguration sparkConfiguration = maybeSparkConfiguration.get(); CassandraConfiguration cassandraConfiguration = maybeCassandraConfiguration.get(); StringBuilder sparkMasterUrlBuilder; if ( sparkConfiguration.isLocal() ) { sparkMasterUrlBuilder = new StringBuilder( sparkConfiguration.getSparkMasters().iterator().next() ); } else { sparkMasterUrlBuilder = new StringBuilder( "spark://" ); String sparkMastersAsString = sparkConfiguration.getSparkMasters().stream() .collect( Collectors.joining( "," ) ); sparkMasterUrlBuilder.append( sparkMastersAsString ); } return new SparkConf() .setMaster( sparkMasterUrlBuilder.toString() ) .setAppName( sparkConfiguration.getAppName() ) .set( "spark.cassandra.connection.host", cassandraConfiguration.getCassandraSeedNodes().stream() .map( host -> host.getHostAddress() ).collect( Collectors.joining( "," ) ) ) .set( "spark.cassandra.connection.port", Integer.toString( 9042 ) ) .setJars( sparkConfiguration.getJarLocations() ); } return null; }

Target:
public SparkConf sparkConf() { Optional<SparkConfiguration> maybeSparkConfiguration = rhizomeConfiguration.getSparkConfiguration(); Optional<CassandraConfiguration> maybeCassandraConfiguration = rhizomeConfiguration.getCassandraConfiguration(); if ( maybeSparkConfiguration.isPresent() && maybeCassandraConfiguration.isPresent() ) { SparkConfiguration sparkConfiguration = maybeSparkConfiguration.get(); CassandraConfiguration cassandraConfiguration = maybeCassandraConfiguration.get(); StringBuilder sparkMasterUrlBuilder; if ( sparkConfiguration.isLocal() ) { sparkMasterUrlBuilder = new StringBuilder( sparkConfiguration.getSparkMasters().iterator().next() ); } else { sparkMasterUrlBuilder = new StringBuilder( "spark://" ); String sparkMastersAsString = sparkConfiguration.getSparkMasters().stream() .map( master -> master + ":" + Integer.toString( sparkConfiguration.getSparkPort() ) ) .collect( Collectors.joining( "," ) ); sparkMasterUrlBuilder.append( sparkMastersAsString ); } return new SparkConf() .setMaster( sparkMasterUrlBuilder.toString() ) .setAppName( sparkConfiguration.getAppName() ) .set( "spark.cassandra.connection.host", cassandraConfiguration.getCassandraSeedNodes().stream() .map( host -> host.getHostAddress() ).collect( Collectors.joining( "," ) ) ) .set( "spark.cassandra.connection.port", Integer.toString( 9042 ) ) .setJars( sparkConfiguration.getJarLocations() ); } return null; }
Source:
public static void checkPermission(Subject subject, int subjectMask, AuthorizationPermission perm) { if ((subjectMask & perm.getMask()) != perm.getMask()) { if (System.getSecurityManager() == null) { throw log.unauthorizedAccess(subject == null ? "null" : subject.toString(), perm.toString()); } else { System.getSecurityManager().checkPermission(perm.getSecurityPermission()); } } }

Target:
public static void checkPermission(Subject subject, int subjectMask, AuthorizationPermission perm) { if ((subjectMask & perm.getMask()) != perm.getMask()) { if (System.getSecurityManager() == null) { throw log.unauthorizedAccess(String.valueOf(subject), perm.toString()); } else { System.getSecurityManager().checkPermission(perm.getSecurityPermission()); } } }