auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected static boolean addTestData(String host, int port, String databaseName, String user, String pwd, String filePath) { Process proc = null; BufferedReader br = null; String errorMsg = null; String[] command = new String[] { "mysql", "--host=" + host, "--port=" + port, "--user=" + user, "--password=" + pwd, "--database=" + databaseName, "-e", "source " + filePath }; String runDirectory = System.getProperties().getProperty("user.dir"); File file = new File(runDirectory, "/database/bin/mysql"); if (file.exists()) { command[0] = file.getAbsolutePath(); } try { proc = Runtime.getRuntime().exec(command); try { br = new BufferedReader(new InputStreamReader(proc.getErrorStream())); String line; StringBuilder sb = new StringBuilder(); while ((line = br.readLine()) != null) { sb.append(System.getProperty("line.separator")); sb.append(line); } errorMsg = sb.toString(); } catch (IOException e) { log.error("Failed to add test data:", e); } finally { if (br != null) { try { br.close(); } catch (Exception e) { log.error("Failed to close the inputstream:", e); } } } if (StringUtils.isNotBlank(errorMsg)) { log.error(errorMsg); } if (proc.waitFor() == 0) { if (log.isDebugEnabled()) { log.debug("Added test data successfully"); } return true; } log .error("The process terminated abnormally while adding test data. Please look under the Configuration section at: <LINK_0>"); } catch (IOException e) { log.error("Failed to create the sql dump", e); } catch (InterruptedException e) { log.error("The back up was interrupted while adding test data", e); } return false; }

Target:
protected static boolean addTestData(String host, int port, String databaseName, String user, String pwd, String filePath) { Process proc = null; BufferedReader br = null; String errorMsg = null; String[] command = new String[] { "mysql", "--host=" + host, "--port=" + port, "--user=" + user, "--password=" + pwd, "--database=" + databaseName, "-e", "source " + filePath }; String runDirectory = System.getProperties().getProperty("user.dir"); File file = new File(Paths.get(runDirectory, "database", "bin", "mysql").toString()); if (file.exists()) { command[0] = file.getAbsolutePath(); } try { proc = Runtime.getRuntime().exec(command); try { br = new BufferedReader(new InputStreamReader(proc.getErrorStream())); String line; StringBuilder sb = new StringBuilder(); while ((line = br.readLine()) != null) { sb.append(System.getProperty("line.separator")); sb.append(line); } errorMsg = sb.toString(); } catch (IOException e) { log.error("Failed to add test data:", e); } finally { if (br != null) { try { br.close(); } catch (Exception e) { log.error("Failed to close the inputstream:", e); } } } if (StringUtils.isNotBlank(errorMsg)) { log.error(errorMsg); } if (proc.waitFor() == 0) { if (log.isDebugEnabled()) { log.debug("Added test data successfully"); } return true; } log .error("The process terminated abnormally while adding test data. Please look under the Configuration section at: <LINK_0>"); } catch (IOException e) { log.error("Failed to create the sql dump", e); } catch (InterruptedException e) { log.error("The back up was interrupted while adding test data", e); } return false; }
Source:
public void putIfAbsent(BufferNode bufferNode) { if (pendingBufferNode.putIfAbsent(bufferNode, bufferNode) == null) { bufferNode.setTimeout(EnvironmentEdgeManager.currentTime() + operationDelay); queue.add(bufferNode); } }

Target:
private void putIfAbsent(BufferNode bufferNode) { if (pendingBufferNode.putIfAbsent(bufferNode, bufferNode) == null) { bufferNode.setTimeout(EnvironmentEdgeManager.currentTime() + operationDelay); queue.add(bufferNode); } }
Source:
public void setUp() { try { RedisServer redisServer = new RedisServer(PORT); redisServer.start(); JedisPoolConfig jedisPoolConfig = new JedisPoolConfig(); jedisPoolConfig.setMaxTotal(10); pool = new JedisPool(jedisPoolConfig, HOST, PORT); makeData(); System.out.println("The redis server is start! host:" + HOST + " port:" + PORT); } catch (Exception e) { assertNotNull(e.getMessage()); } }

Target:
public void setUp() { try { RedisServer redisServer = new RedisServer(PORT); redisServer.start(); JedisPoolConfig jedisPoolConfig = new JedisPoolConfig(); jedisPoolConfig.setMaxTotal(10); pool = new JedisPool(jedisPoolConfig, HOST, PORT); makeData(); System.out.println("The redis server is started at host: " + HOST + " port: " + PORT); } catch (Exception e) { assertNotNull(e.getMessage()); } }
Source:
public void setParams(Object[] params) { if (params.length != 1) { throw new IllegalArgumentException("expecting one parameter"); } setParams((Map<Object, Number>) params[0]); }

Target:
public void setParams(Object[] params) { if (params.length != 1) { throw new IllegalArgumentException("expecting one parameter"); } setParams((Map<?, ?>) params[0]); }
Source:
private void updateWorkspaceSnapshots(String workspaceId, Workspace current, Workspace update) { final Map<String, Environment> updateEnvironments = update.getConfig() .getEnvironments() .entrySet() .stream() .collect(Collectors.toMap(Map.Entry::getKey, env -> new EnvironmentImpl(env.getValue()))); final Map <String, Environment> currentDiff = Sets.difference(current.getConfig().getEnvironments().entrySet(), updateEnvironments.entrySet()) .stream() .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); final Map <String, Environment> updateDiff = Sets.difference(updateEnvironments.entrySet(), current.getConfig().getEnvironments().entrySet()) .stream() .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); for (Map.Entry<String, Environment> env : currentDiff.entrySet()) { Environment envValue = env.getValue(); if (Collections.frequency(currentDiff.values(), envValue) == 1 && Collections.frequency(updateDiff.values(), envValue) == 1 && !updateDiff.containsKey(env.getKey())) { try { updateEnvironmentSnapshots(workspaceId, env.getKey(), updateDiff.entrySet() .stream() .filter(e -> e.getValue().equals(envValue)) .findAny() .orElse(null) .getKey()); } catch (ConflictException | SnapshotException | NotFoundException err) { LOG.error("Failed to update snapshots of '%s' environment in '%s' workspace.", env.getKey(), workspaceId, err); safeRemoveEnvironmentSnapshots(workspaceId, env.getKey()); } } else { safeRemoveEnvironmentSnapshots(workspaceId, env.getKey()); } } }

Target:
private void updateWorkspaceSnapshots(String workspaceId, Workspace current, Workspace update) { final Map<String, Environment> updateEnvironments = update.getConfig() .getEnvironments() .entrySet() .stream() .collect(Collectors.toMap(Map.Entry::getKey, env -> new EnvironmentImpl(env.getValue()))); final Map <String, Environment> currentDiff = Sets.difference(current.getConfig().getEnvironments().entrySet(), updateEnvironments.entrySet()) .stream() .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); final Map <String, Environment> updateDiff = Sets.difference(updateEnvironments.entrySet(), current.getConfig().getEnvironments().entrySet()) .stream() .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); for (Map.Entry<String, Environment> env : currentDiff.entrySet()) { Environment envValue = env.getValue(); if (Collections.frequency(currentDiff.values(), envValue) == 1 && Collections.frequency(updateDiff.values(), envValue) == 1 && !updateDiff.containsKey(env.getKey())) { try { updateEnvironmentSnapshots(workspaceId, env.getKey(), updateDiff.entrySet() .stream() .filter(e -> e.getValue().equals(envValue)) .findAny() .orElse(null) .getKey()); } catch (ConflictException | SnapshotException | NotFoundException err) { LOG.error("Failed to update snapshots of '%s' environment in '%s' workspace.", env.getKey(), workspaceId, err); removeEnvironmentSnapshotsQuietly(workspaceId, env.getKey()); } } else { removeEnvironmentSnapshotsQuietly(workspaceId, env.getKey()); } } }
Source:
public void testRcAndTextFormats() throws IOException { try { getQueryRunner().execute("CREATE TABLE IF NOT EXISTS lineitem_partition WITH (format='ORC', partitioned_by=ARRAY['ds']) AS " + "SELECT linenumber, orderkey, partkey, suppkey, quantity, extendedprice, tax, shipinstruct, shipmode, ship_by_air, " + "is_returned, ship_day, ship_month, ship_timestamp, commit_timestamp, discount_real, discount, tax_real, ship_day_month, " + "discount_long_decimal, tax_short_decimal, long_decimals, keys, doubles, nested_keys, flags, reals, info, dates, timestamps, " + "comment, uppercase_comment, fixed_comment, char_array, varchar_array,'2019-11-01' AS ds FROM lineitem_ex"); for (HiveStorageFormat format : ImmutableList.of(RCBINARY, RCTEXT, TEXTFILE)) { assertFileFormat(format); } } finally { assertUpdate("DROP TABLE lineitem_partition"); } }

Target:
public void testRcAndTextFormats() throws IOException { getQueryRunner().execute("CREATE TABLE lineitem_ex_partitioned WITH (format = 'ORC', partitioned_by = ARRAY['ds']) AS\n" + "SELECT\n" + " linenumber,\n" + " orderkey,\n" + " partkey,\n" + " suppkey,\n" + " quantity,\n" + " extendedprice,\n" + " tax,\n" + " shipinstruct,\n" + " shipmode,\n" + " ship_by_air,\n" + " is_returned,\n" + " ship_day,\n" + " ship_month,\n" + " ship_timestamp,\n" + " commit_timestamp,\n" + " discount_real,\n" + " discount,\n" + " tax_real,\n" + " ship_day_month,\n" + " discount_long_decimal,\n" + " tax_short_decimal,\n" + " long_decimals,\n" + " keys,\n" + " doubles,\n" + " nested_keys,\n" + " flags,\n" + " reals,\n" + " info,\n" + " dates,\n" + " timestamps,\n" + " comment,\n" + " uppercase_comment,\n" + " fixed_comment,\n" + " char_array,\n" + " varchar_array,\n" + " '2019-11-01' AS ds\n" + "FROM lineitem_ex"); try { for (HiveStorageFormat format : ImmutableList.of(RCBINARY, RCTEXT, TEXTFILE)) { assertFileFormat(format); } } finally { assertUpdate("DROP TABLE lineitem_ex_partitioned"); } }
Source:
public Intent getIntentForBrokerActivity(final AuthenticationRequest request) { Intent intent = null; AccountManagerFuture<Bundle> result = null; try { Bundle addAccountOptions = getBrokerOptions(request); result = mAcctManager.addAccount(AuthenticationConstants.Broker.BROKER_ACCOUNT_TYPE, AuthenticationConstants.Broker.AUTHTOKEN_TYPE, null, addAccountOptions, null, null, mHandler); Bundle bundleResult = result.getResult(); intent = bundleResult.getParcelable(AccountManager.KEY_INTENT); if (intent != null) { intent.putExtra(AuthenticationConstants.Broker.BROKER_REQUEST, AuthenticationConstants.Broker.BROKER_REQUEST); } } catch (OperationCanceledException e) { Logger.e(TAG, "Authenticator cancels the request", "", ADALError.AUTH_FAILED_CANCELLED, e); } catch (AuthenticatorException e) { Logger.e(TAG, "Authenticator cancels the request", "", ADALError.BROKER_AUTHENTICATOR_NOT_RESPONDING); } catch (IOException e) { Logger.e(TAG, "Authenticator cancels the request", "", ADALError.BROKER_AUTHENTICATOR_IO_EXCEPTION); } return intent; }

Target:
public Intent getIntentForBrokerActivity(final AuthenticationRequest request) { Intent intent = null; AccountManagerFuture<Bundle> result = null; try { Bundle addAccountOptions = getBrokerOptions(request); result = mAcctManager.addAccount(AuthenticationConstants.Broker.BROKER_ACCOUNT_TYPE, AuthenticationConstants.Broker.AUTHTOKEN_TYPE, null, addAccountOptions, null, null, mHandler); Bundle bundleResult = result.getResult(); intent = bundleResult.getParcelable(AccountManager.KEY_INTENT); if (intent != null) { intent.putExtra(AuthenticationConstants.Broker.BROKER_REQUEST, AuthenticationConstants.Broker.BROKER_REQUEST); } } catch (OperationCanceledException e) { Logger.e(TAG, "Authenticator cancels the request", "", ADALError.AUTH_FAILED_CANCELLED, e); } catch (AuthenticatorException e) { Logger.e(TAG, "Authenticator cancels the request", "", ADALError.BROKER_AUTHENTICATOR_NOT_RESPONDING, e); } catch (IOException e) { Logger.e(TAG, "Authenticator cancels the request", "", ADALError.BROKER_AUTHENTICATOR_IO_EXCEPTION, e); } return intent; }
Source:
public void run() { if (isDisposing) { return; } if (validationIcon == null || validationIcon.isDisposed()) { return; } if (getVElement().getDiagnostic() == null) { return; } final VTableDomainModelReference tableDMR = (VTableDomainModelReference) getVElement() .getDomainModelReference(); Optional<Setting> setting; if (tableDMR.getDomainModelReference() != null) { setting = getSettingFromObservable(tableDMR.getDomainModelReference(), getViewModelContext().getDomainModel()); } else { setting = getSettingFromObservable(tableDMR, getViewModelContext().getDomainModel()); } validationIcon.setImage(getValidationIcon(getVElement().getDiagnostic().getHighestSeverity())); showValidationSummaryTooltip(showValidationSummaryTooltip); final Collection<?> collection = (Collection<?>) setting.get().get(true); if (!collection.isEmpty()) { for (final Object object : collection) { getTableViewer().update(object, null); } } }

Target:
public void run() { if (isDisposing) { return; } if (validationIcon == null || validationIcon.isDisposed()) { return; } if (getVElement().getDiagnostic() == null) { return; } final VTableDomainModelReference tableDMR = (VTableDomainModelReference) getVElement() .getDomainModelReference(); Optional<Setting> setting; if (tableDMR.getDomainModelReference() != null) { setting = getSettingFromObservable(tableDMR.getDomainModelReference(), getViewModelContext().getDomainModel()); } else { setting = getSettingFromObservable(tableDMR, getViewModelContext().getDomainModel()); } if (setting.isPresent()) { return; } validationIcon.setImage(getValidationIcon(getVElement().getDiagnostic().getHighestSeverity())); showValidationSummaryTooltip(showValidationSummaryTooltip); final Collection<?> collection = (Collection<?>) setting.get().get(true); if (!collection.isEmpty()) { for (final Object object : collection) { getTableViewer().update(object, null); } } }
Source:
void updateTokenCacheUsingCommonCache(final AuthenticationRequest request, final AuthenticationResult result) throws MalformedURLException { AzureActiveDirectory ad = new AzureActiveDirectory(); AzureActiveDirectoryTokenResponse tokenResponse = CoreAdapter.asAadTokenResponse(result); AzureActiveDirectoryOAuth2Configuration config = new AzureActiveDirectoryOAuth2Configuration(); config.setAuthorityHostValidationEnabled(this.isValidateAuthorityHost()); AzureActiveDirectoryOAuth2Strategy strategy = ad.createOAuth2Strategy(config); AzureActiveDirectoryAuthorizationRequest aadAuthRequest = new AzureActiveDirectoryAuthorizationRequest.Builder( request.getClientId(), request.getRedirectUri(), new URL(mAuthority), request.getResource()) .build(); mCommonCache.save(strategy, aadAuthRequest, tokenResponse); }

Target:
void updateTokenCacheUsingCommonCache(final AuthenticationRequest request, final AuthenticationResult result) throws MalformedURLException { AzureActiveDirectory ad = new AzureActiveDirectory(); AzureActiveDirectoryTokenResponse tokenResponse = CoreAdapter.asAadTokenResponse(result); AzureActiveDirectoryOAuth2Configuration config = new AzureActiveDirectoryOAuth2Configuration(); config.setAuthorityHostValidationEnabled(this.isValidateAuthorityHost()); AzureActiveDirectoryOAuth2Strategy strategy = ad.createOAuth2Strategy(config); AzureActiveDirectoryAuthorizationRequest aadAuthRequest = new AzureActiveDirectoryAuthorizationRequest.Builder() .setClientId(request.getClientId()) .setResource(request.getResource()) .setScope(request.getResource()) .setAuthority(new URL(mAuthority)) .setRedirectUri(request.getRedirectUri()) .setLoginHint(request.getLoginHint()) .setCorrelationId(request.getCorrelationId()) .build(); mCommonCache.save(strategy, aadAuthRequest, tokenResponse); }
Source:
public Map<Integer,Error> commit() { Map<Integer,Error> results=new HashMap<>(); if(!batch.isEmpty()) { BulkWriteResult writeResult; LOGGER.debug("attemptToUpdate={}",batch.size()); try { if(writeConcern==null) { writeResult=bwo.execute(); } else { writeResult=bwo.execute(writeConcern); } LOGGER.debug("writeResult={}",writeResult); if(batch.size()==writeResult.getMatchedCount()) { LOGGER.debug("Successful update"); } else { LOGGER.debug("notUpdated={}",batch.size()-writeResult.getMatchedCount()); findConcurrentModifications(results); } } catch (BulkWriteException e) { List<BulkWriteError> writeErrors=e.getWriteErrors(); if(writeErrors!=null) { for(BulkWriteError we:writeErrors) { if (MongoCrudConstants.isDuplicate(we.getCode())) { results.put(we.getIndex(), Error.get("update", MongoCrudConstants.ERR_DUPLICATE, we.getMessage())); } else { results.put(we.getIndex(), Error.get("update", MongoCrudConstants.ERR_SAVE_ERROR, we.getMessage())); } } } findConcurrentModifications(results); } } retry(results); reset(); return results; }

Target:
public Map<Integer,Error> commit() { Map<Integer,Error> results=new HashMap<>(); if(!batch.isEmpty()) { BulkWriteResult writeResult; LOGGER.debug("attemptToUpdate={}",batch.size()); try { if(writeConcern==null) { writeResult=bwo.execute(); } else { writeResult=bwo.execute(writeConcern); } LOGGER.debug("writeResult={}",writeResult); if(batch.size()==writeResult.getMatchedCount()) { LOGGER.debug("Successful update"); } else { LOGGER.warn("notUpdated={}",batch.size()-writeResult.getMatchedCount()); findConcurrentModifications(results); } } catch (BulkWriteException e) { List<BulkWriteError> writeErrors=e.getWriteErrors(); if(writeErrors!=null) { for(BulkWriteError we:writeErrors) { if (MongoCrudConstants.isDuplicate(we.getCode())) { results.put(we.getIndex(), Error.get("update", MongoCrudConstants.ERR_DUPLICATE, we.getMessage())); } else { results.put(we.getIndex(), Error.get("update", MongoCrudConstants.ERR_SAVE_ERROR, we.getMessage())); } } } findConcurrentModifications(results); } } retryConcurrentUpdateErrorsIfNeeded(results); reset(); return results; }
Source:
public void testSubstrSetScanKey() throws Exception { String query = "SELECT inst FROM ptsdb WHERE substr(inst, 0, 3) = 'abc'"; List<Object> binds = Collections.emptyList(); Scan scan = new Scan(); compileQuery(query, binds, scan); assertTrue(Bytes.compareTo(Bytes.toBytes("abc"), scan.getStartRow()) == 0); assertTrue(Bytes.compareTo(Bytes.toBytes("abc\1"), scan.getStopRow()) == 0); assertTrue(scan.getFilter() != null); }

Target:
public void testSubstrSetScanKey() throws Exception { String query = "SELECT inst FROM ptsdb WHERE substr(inst, 0, 3) = 'abc'"; List<Object> binds = Collections.emptyList(); Scan scan = new Scan(); compileQuery(query, binds, scan); assertTrue(Bytes.compareTo(Bytes.toBytes("abc"), scan.getStartRow()) == 0); assertTrue(Bytes.compareTo(Bytes.toBytes("abd"), scan.getStopRow()) == 0); assertTrue(scan.getFilter() == null); }
Source:
public StorageQosMetricParametersModel(ConfigurationValues maxTotal, ConfigurationValues maxRead, ConfigurationValues maxWrite) { this.maxTotal = maxTotal; this.maxRead = maxRead; this.maxWrite = maxWrite; setTotal(new EntityModel<Integer>()); setRead(new EntityModel<Integer>()); setWrite(new EntityModel<Integer>()); setChoiceGroupNone(new EntityModel<Boolean>()); setChoiceGroupTotal(new EntityModel<Boolean>()); setChoiceGroupReadWrite(new EntityModel<Boolean>()); getChoiceGroupNone().getEntityChangedEvent().addListener(this); getChoiceGroupTotal().getEntityChangedEvent().addListener(this); getChoiceGroupReadWrite().getEntityChangedEvent().addListener(this); getPropertyChangedEvent().addListener(this); }

Target:
public StorageQosMetricParametersModel(ConfigurationValues maxTotal, ConfigurationValues maxRead, ConfigurationValues maxWrite) { this.maxTotal = maxTotal; this.maxRead = maxRead; this.maxWrite = maxWrite; setTotal(new EntityModel<Integer>()); setRead(new EntityModel<Integer>()); setWrite(new EntityModel<Integer>()); setChoiceGroupNone(new EntityModel<Boolean>()); setChoiceGroupTotal(new EntityModel<Boolean>()); setChoiceGroupReadWrite(new EntityModel<Boolean>()); getChoiceGroupNone().getEntityChangedEvent().addListener(this); getChoiceGroupTotal().getEntityChangedEvent().addListener(this); getChoiceGroupReadWrite().getEntityChangedEvent().addListener(this); }
Source:
private void addHintText() { String s = null; try { s = mPrompt.getHintText(); } catch (XPathException e) { UserfacingErrorHandling.createErrorDialog((CommCareActivity)getContext(), e.getLocalizedMessage(), true); } catch (Exception e) { Logger.exception(TAG + ".addHintText", e); e.printStackTrace(); } if (s != null && !s.equals("")) { mHintText = new ShrinkingTextView(getContext(), this.getMaxHintHeight()); mHintText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mQuestionFontSize - 3); mHintText.setPadding(0, -5, 0, 7); mHintText.setHorizontallyScrolling(false); mHintText.setText(s); mHintText.setTypeface(null, Typeface.ITALIC); addView(mHintText, mLayout); } }

Target:
private void addHintText() { String s = null; try { s = mPrompt.getHintText(); } catch (XPathException e) { UserfacingErrorHandling.createErrorDialog((CommCareActivity)getContext(), e.getLocalizedMessage(), true); } if (s != null && !s.equals("")) { mHintText = new ShrinkingTextView(getContext(), this.getMaxHintHeight()); mHintText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mQuestionFontSize - 3); mHintText.setPadding(0, -5, 0, 7); mHintText.setHorizontallyScrolling(false); mHintText.setText(s); mHintText.setTypeface(null, Typeface.ITALIC); addView(mHintText, mLayout); } }
Source:
public void migrate( File storeDir, File migrationDir, MigrationProgressMonitor.Section progressMonitor, String versionToMigrateFrom, String versionToMigrateTo ) throws IOException { if ( countStoreRebuildRequired( versionToMigrateFrom ) ) { StoreFile.fileOperation( DELETE, fileSystem, migrationDir, migrationDir, COUNTS_STORE_FILES, true, null, StoreFileType.STORE ); File neoStore = new File( storeDir, DEFAULT_NAME ); long lastTxId = MetaDataStore.getRecord( pageCache, neoStore, Position.LAST_TRANSACTION_ID ); try { rebuildCountsFromScratch( migrationDir, migrationDir, lastTxId, progressMonitor, versionToMigrateTo, pageCache, NullLogProvider.getInstance() ); } catch ( StoreFailureException e ) { rebuildCountsFromScratch( storeDir, migrationDir, lastTxId, progressMonitor, versionToMigrateFrom, pageCache, logService.getInternalLogProvider() ); } } }

Target:
public void migrate( File storeDir, File migrationDir, MigrationProgressMonitor.Section progressMonitor, String versionToMigrateFrom, String versionToMigrateTo ) throws IOException { if ( countStoreRebuildRequired( versionToMigrateFrom ) ) { StoreFile.fileOperation( DELETE, fileSystem, migrationDir, migrationDir, COUNTS_STORE_FILES, true, null, StoreFileType.STORE ); File neoStore = new File( storeDir, DEFAULT_NAME ); long lastTxId = MetaDataStore.getRecord( pageCache, neoStore, Position.LAST_TRANSACTION_ID ); try { rebuildCountsFromScratch( migrationDir, migrationDir, lastTxId, progressMonitor, versionToMigrateTo, pageCache, NullLogProvider.getInstance() ); } catch ( StoreFailureException e ) { rebuildCountsFromScratch( storeDir, migrationDir, lastTxId, progressMonitor, versionToMigrateFrom, pageCache, NullLogProvider.getInstance() ); } } }
Source:
public GCSAvroOutputFormatProvider(GCSAvroSinkConfig config, BatchSinkContext context) { conf = Maps.newHashMap(); conf.put(JobContext.OUTPUT_KEY_CLASS, AvroKey.class.getName()); conf.put("avro.schema.output.key", config.schema); conf.put(FileOutputFormat.OUTDIR, String.format("gs://%s/%s", config.bucketKey, config.path)); }

Target:
public GCSAvroOutputFormatProvider(GCSAvroSinkConfig config, BatchSinkContext context) { conf = new HashMap<>(); conf.put(JobContext.OUTPUT_KEY_CLASS, AvroKey.class.getName()); conf.put("avro.schema.output.key", config.schema); conf.put(FileOutputFormat.OUTDIR, String.format("gs://%s/%s", config.bucketKey, config.path)); }
Source:
private void replaceAntiCsrfTokenValueIfRequired(HttpMessage requestMessage, User user) throws IOException { if(extAntiCsrf == null) { extAntiCsrf = Control.getSingleton().getExtensionLoader().getExtension(ExtensionAntiCSRF.class); } List<AntiCsrfToken> antiCsrfTokensOfFirstLoginMsg = null; if(extAntiCsrf != null) { antiCsrfTokensOfFirstLoginMsg = extAntiCsrf.getTokens(requestMessage); } AntiCsrfToken antiCsrfTokenOfFirstLoginMsg = null; if(antiCsrfTokensOfFirstLoginMsg != null && antiCsrfTokensOfFirstLoginMsg.size() > 0) { antiCsrfTokenOfFirstLoginMsg = antiCsrfTokensOfFirstLoginMsg.get(0); } if (antiCsrfTokenOfFirstLoginMsg != null) { HttpMessage loginMsgToRegenerateAntiCsrfToken = antiCsrfTokenOfFirstLoginMsg.getMsg().cloneAll(); loginMsgToRegenerateAntiCsrfToken.setRequestingUser(user); getHttpSender().sendAndReceive(loginMsgToRegenerateAntiCsrfToken); AuthenticationHelper.addAuthMessageToHistory(loginMsgToRegenerateAntiCsrfToken); String regeneratedAntiCsrfTokenValue = extAntiCsrf.getTokenValue(loginMsgToRegenerateAntiCsrfToken, antiCsrfTokenOfFirstLoginMsg.getName()); String requestBody = requestMessage.getRequestBody().toString(); if (regeneratedAntiCsrfTokenValue != null) { requestBody = requestBody.replace( antiCsrfTokenOfFirstLoginMsg.getValue(), paramEncoder.apply(regeneratedAntiCsrfTokenValue)); requestMessage.getRequestBody().setBody(requestBody); } } }

Target:
private void replaceAntiCsrfTokenValueIfRequired(HttpMessage requestMessage, User user) throws IOException { if(extAntiCsrf == null) { extAntiCsrf = Control.getSingleton().getExtensionLoader().getExtension(ExtensionAntiCSRF.class); } List<AntiCsrfToken> antiCsrfTokensOfFirstLoginMsg = null; if(extAntiCsrf != null) { antiCsrfTokensOfFirstLoginMsg = extAntiCsrf.getTokens(requestMessage); } AntiCsrfToken antiCsrfTokenOfFirstLoginMsg = null; if(antiCsrfTokensOfFirstLoginMsg != null && antiCsrfTokensOfFirstLoginMsg.size() > 0) { antiCsrfTokenOfFirstLoginMsg = antiCsrfTokensOfFirstLoginMsg.get(0); } if (antiCsrfTokenOfFirstLoginMsg != null) { HttpMessage loginMsgToRegenerateAntiCsrfToken = antiCsrfTokenOfFirstLoginMsg.getMsg().cloneAll(); loginMsgToRegenerateAntiCsrfToken.setRequestingUser(user); loginMsgToRegenerateAntiCsrfToken.getRequestHeader().setHeader(HttpRequestHeader.COOKIE, null); getHttpSender().sendAndReceive(loginMsgToRegenerateAntiCsrfToken); AuthenticationHelper.addAuthMessageToHistory(loginMsgToRegenerateAntiCsrfToken); String regeneratedAntiCsrfTokenValue = extAntiCsrf.getTokenValue(loginMsgToRegenerateAntiCsrfToken, antiCsrfTokenOfFirstLoginMsg.getName()); String requestBody = requestMessage.getRequestBody().toString(); if (regeneratedAntiCsrfTokenValue != null) { requestBody = requestBody.replace( antiCsrfTokenOfFirstLoginMsg.getValue(), paramEncoder.apply(regeneratedAntiCsrfTokenValue)); requestMessage.getRequestBody().setBody(requestBody); } } }
Source:
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { out = new PrintStream((OutputStream)in.readObject(), AUTO_FLUSH); String name = (String)in.readObject(); charset = name==null ? null : Charset.forName(name); LOGGER.log(Level.FINE, null, new Throwable("deserializing here with AUTO_FLUSH=" + AUTO_FLUSH)); }

Target:
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { out = new PrintStream((OutputStream)in.readObject(), AUTO_FLUSH); String name = (String)in.readObject(); charset = name==null ? null : Charset.forName(name); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, null, new Throwable("deserializing here with AUTO_FLUSH=" + AUTO_FLUSH)); } }
Source:
public void onPerformSync(Account account, Bundle extras, String authority, ContentProviderClient provider, SyncResult syncResult) { Preferences prefs = Preferences.getPreferences(getContext()); if(prefs.getWifiOnlySync()){ ConnectivityManager connMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); @SuppressWarnings("deprecation") NetworkInfo networkInfo = connMgr.getNetworkInfo(ConnectivityManager.TYPE_WIFI); boolean isWifiConn = networkInfo.isConnected(); if(!isWifiConn){ new NetworkReceiver().setWifiReceiverComponent(true, getContext()); return; } } Log.d(Constants.TAG, "Performing a keyserver sync!"); PowerManager pm = (PowerManager) KeyserverSyncAdapterService.this .getSystemService(Context.POWER_SERVICE); @SuppressWarnings("deprecation") boolean isScreenOn = pm.isScreenOn(); if (!isScreenOn) { startServiceWithUpdateAll(); } else { postponeSync(); } }

Target:
public void onPerformSync(Account account, Bundle extras, String authority, ContentProviderClient provider, SyncResult syncResult) { Preferences prefs = Preferences.getPreferences(getContext()); if (prefs.getWifiOnlySync()) { ConnectivityManager connMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connMgr.getNetworkInfo(ConnectivityManager.TYPE_WIFI); boolean isNotOnWifi = !(networkInfo.getType() == ConnectivityManager.TYPE_WIFI); boolean isNotConnected = !(networkInfo.isConnected()); if (isNotOnWifi && isNotConnected) { new NetworkReceiver().setWifiReceiverComponent(true, getContext()); return; } } Log.d(Constants.TAG, "Performing a keyserver sync!"); PowerManager pm = (PowerManager) KeyserverSyncAdapterService.this .getSystemService(Context.POWER_SERVICE); @SuppressWarnings("deprecation") boolean isScreenOn = pm.isScreenOn(); if (!isScreenOn) { startServiceWithUpdateAll(); } else { postponeSync(); } }
Source:
public RangeSet<String> getDimensionRangeSet(String dimension) { return null; }

Target:
public RangeSet<String> getDimensionRangeSet(String dimension) { return convertedFilter.getDimensionRangeSet(dimension); }
Source:
private Matrix backPropagateMaxPooling(final Matrix input, final Matrix nextError) { if (layerError == null || !layerError.hasSameSize(input)) { layerError = matrixFactory.create(input.getRows(), input.getColumns()); } layerError.fill(0); final int outputSize = outputHeight * outputWidth; for (int n = 0; n < input.getColumns(); ++n) { for (int c = 0; c < inputChannel; ++c) { for (int oh = 0; oh < outputHeight; ++oh) { for (int ow = 0; ow < outputWidth; ++ow) { final int outputIndex = c * outputSize + oh * outputWidth + ow; final int maxIndex = (int) indexMatrix.get(outputIndex, n); final float newError = nextError.get(outputIndex, n) + layerError.get(maxIndex, n); layerError.put(maxIndex, n, newError); } } } } return layerError; }

Target:
private Matrix backPropagateMaxPooling(final Matrix input, final Matrix nextError) { final Matrix error = matrixFactory.zeros(input.getRows(), input.getColumns()); final int outputSize = outputHeight * outputWidth; for (int n = 0; n < input.getColumns(); ++n) { for (int c = 0; c < inputChannel; ++c) { for (int oh = 0; oh < outputHeight; ++oh) { for (int ow = 0; ow < outputWidth; ++ow) { final int outputIndex = c * outputSize + oh * outputWidth + ow; final int maxIndex = (int) indexMatrix.get(outputIndex, n); final float newError = nextError.get(outputIndex, n) + error.get(maxIndex, n); error.put(maxIndex, n, newError); } } } } return error; }
Source:
public void visit(NodeTraversal t, Node n, Node parent) { if (n.isName()) { String name = n.getString(); if ("".equals(name)) { return; } Scope s = t.getScope(); Var v = s.getVar(name); if (v == null || !v.isGlobal()) { return; } CompilerInput input = v.getInput(); if (input == null) { return; } JSModule definingChunk = input.getModule(); JSModule referencingChunk = t.getModule(); if (definingChunk != referencingChunk) { if (NodeUtil.isLhsOfAssign(n)) { t.report( n, ASSIGNMENT_TO_IMPORT, n.getString(), GetChunkName(referencingChunk)); } Set<String> namesToExport = crossChunkExports.get(definingChunk); if (namesToExport == null) { namesToExport = new HashSet<>(); crossChunkExports.put(definingChunk, namesToExport); } namesToExport.add(name); Map<JSModule, Set<String>> namesToImportByModule = crossChunkImports.get(referencingChunk); if (namesToImportByModule == null) { namesToImportByModule = new HashMap<>(); crossChunkImports.put(referencingChunk, namesToImportByModule); } Set<String> importsForModule = namesToImportByModule.get(definingChunk); if (importsForModule == null) { importsForModule = new HashSet<>(); namesToImportByModule.put(definingChunk, importsForModule); } importsForModule.add(name); } } }

Target:
public void visit(NodeTraversal t, Node n, Node parent) { if (n.isName()) { String name = n.getString(); if ("".equals(name)) { return; } Scope s = t.getScope(); Var v = s.getVar(name); if (v == null || !v.isGlobal()) { return; } CompilerInput input = v.getInput(); JSModule definingChunk = input.getModule(); JSModule referencingChunk = t.getModule(); if (definingChunk != referencingChunk) { if (NodeUtil.isLValue(n)) { t.report( n, ASSIGNMENT_TO_IMPORT, n.getString(), getChunkFileName(referencingChunk)); } Set<String> namesToExport = crossChunkExports.get(definingChunk); if (namesToExport == null) { namesToExport = new HashSet<>(); crossChunkExports.put(definingChunk, namesToExport); } namesToExport.add(name); Map<JSModule, Set<String>> namesToImportByModule = crossChunkImports.get(referencingChunk); if (namesToImportByModule == null) { namesToImportByModule = new HashMap<>(); crossChunkImports.put(referencingChunk, namesToImportByModule); } Set<String> importsForModule = namesToImportByModule.get(definingChunk); if (importsForModule == null) { importsForModule = new HashSet<>(); namesToImportByModule.put(definingChunk, importsForModule); } importsForModule.add(name); } } }
Source:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpSession httpSession = ((HttpServletRequest) request).getSession(false); if (httpSession != null) { String engineSession = (String) httpSession.getAttribute(FiltersHelper.Constants.ENGINE_SESSION_ID_KEY); if (engineSession != null) { try { VdcQueryParametersBase parameters = new VdcQueryParametersBase(); parameters.setSessionId(engineSession); InitialContext ctx = new InitialContext(); httpSession.setAttribute( FiltersHelper.Constants.AUTHENTICATED_KEY, FiltersHelper.getBackend(ctx).runPublicQuery(VdcQueryType.ValidateSession, parameters).getSucceeded() ); FiltersHelper.closeContext(ctx); } catch (Exception ex) { log.error(String.format("An error has occurred while session validation. Message is %1$s", ex.getMessage())); if (log.isDebugEnabled()) { log.debug("", ex); } } } } chain.doFilter(request, response); }

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { try { HttpSession httpSession = ((HttpServletRequest) request).getSession(false); if (httpSession != null) { String engineSession = (String) httpSession.getAttribute(FiltersHelper.Constants.ENGINE_SESSION_ID_KEY); InitialContext ctx = null; if (engineSession != null) { ctx = new InitialContext(); try { VdcQueryParametersBase parameters = new VdcQueryParametersBase(); parameters.setSessionId(engineSession); httpSession.setAttribute( FiltersHelper.Constants.AUTHENTICATED_KEY, FiltersHelper.getBackend(ctx) .runPublicQuery(VdcQueryType.ValidateSession, parameters) .getSucceeded() ); } finally { FiltersHelper.closeContext(ctx); } } } chain.doFilter(request, response); } catch (Exception ex) { String msg = String.format("An error has occurred while session validation. Message is %1$s", ex.getMessage()); log.error(msg); if (log.isDebugEnabled()) { log.debug("", ex); } ((HttpServletResponse) response).sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } }
Source:
private void post(Work work) { try { logger.trace("putting work on queue."); workQueue.put(work); queueWork(work); checkQueueSize(); } catch (InterruptedException ex) { logger.warn("Interrupted while putting work on queue!", ex); } }

Target:
private void post(Work work) { logger.trace("putting work on queue."); queueWork(work); checkQueueSize(); }
Source:
public void evaluateUnaryExpression() { assertTrue(evaluator.evaluateUnaryExpression("# java.util.Objects.equals(" + ACTUAL_VALUE_IDENTIFIER + ", \"Test\"" + ")", "Test", String.class)); assertFalse(evaluator.evaluateUnaryExpression("# java.util.Objects.equals(" + ACTUAL_VALUE_IDENTIFIER + ", \"Test\"" + ")", "Test1", String.class)); assertTrue(evaluator.evaluateUnaryExpression("# 1", 1, Integer.class)); assertFalse(evaluator.evaluateUnaryExpression("# 2", 1, Integer.class)); assertTrue(evaluator.evaluateUnaryExpression("# " + ACTUAL_VALUE_IDENTIFIER + " == 123", 123, Integer.class)); assertTrue(evaluator.evaluateUnaryExpression("# " + ACTUAL_VALUE_IDENTIFIER + " != 123", 321, Integer.class)); assertFalse(evaluator.evaluateUnaryExpression("# " + ACTUAL_VALUE_IDENTIFIER + " == 123", 321, Integer.class)); assertFalse(evaluator.evaluateUnaryExpression("# " + ACTUAL_VALUE_IDENTIFIER + " != 123", 123, Integer.class)); assertThatThrownBy(() -> evaluator.evaluateUnaryExpression(new Object(), "", String.class)) .isInstanceOf(IllegalArgumentException.class) .hasMessageStartingWith("Raw value should be a String"); assertThatThrownBy(() -> evaluator.evaluateUnaryExpression(null, "", String.class)) .isInstanceOf(IllegalArgumentException.class) .hasMessageStartingWith("Raw value should be a String"); }

Target:
public void evaluateUnaryExpression() { assertTrue(evaluator.evaluateUnaryExpression(mvelExpression("java.util.Objects.equals(" + ACTUAL_VALUE_IDENTIFIER + ", \"Test\")"), "Test", String.class)); assertFalse(evaluator.evaluateUnaryExpression(mvelExpression("java.util.Objects.equals(" + ACTUAL_VALUE_IDENTIFIER + ", " + "\"Test\")"), "Test1", String.class)); assertTrue(evaluator.evaluateUnaryExpression(mvelExpression("1"), 1, Integer.class)); assertFalse(evaluator.evaluateUnaryExpression(mvelExpression("2"), 1, Integer.class)); assertTrue(evaluator.evaluateUnaryExpression(mvelExpression(ACTUAL_VALUE_IDENTIFIER + " == 123"), 123, Integer.class)); assertTrue(evaluator.evaluateUnaryExpression(mvelExpression(ACTUAL_VALUE_IDENTIFIER + " != 123"), 321, Integer.class)); assertFalse(evaluator.evaluateUnaryExpression(mvelExpression(ACTUAL_VALUE_IDENTIFIER + " == 123"), 321, Integer.class)); assertFalse(evaluator.evaluateUnaryExpression(mvelExpression(ACTUAL_VALUE_IDENTIFIER + " != 123"), 123, Integer.class)); assertThatThrownBy(() -> evaluator.evaluateUnaryExpression(new Object(), "", String.class)) .isInstanceOf(IllegalArgumentException.class) .hasMessageStartingWith("Raw expression should be a String"); assertThatThrownBy(() -> evaluator.evaluateUnaryExpression(null, "", String.class)) .isInstanceOf(IllegalArgumentException.class) .hasMessageStartingWith("Raw expression should be a String"); }
Source:
public Integer executeQuery(Map<String, Object> queryParameters) { Cache cache = cacheManager.getCache(getCacheName()); SearchManager searchManager = Search.getSearchManager(cache); QueryBuilder queryBuilder = searchManager.buildQueryBuilderForClass(QueryableData.class).get(); TermTermination termTermination; Boolean isWildcardQuery = (Boolean) queryParameters.get(IS_WILDCARD); String onField = (String) queryParameters.get(QUERYABLE_FIELD); String matching = (String) queryParameters.get(MATCH_STRING); if (isWildcardQuery) { termTermination = queryBuilder.keyword().wildcard().onField(onField).matching(matching); } else { termTermination = queryBuilder.keyword().onField(onField).matching(matching); } CacheQuery cacheQuery = searchManager.getQuery(termTermination.createQuery()); return cacheQuery.getResultSize(); }

Target:
public QueryResultImpl executeQuery(Map<String, Object> queryParameters) { Cache cache = cacheManager.getCache(getCacheName()); SearchManager searchManager = Search.getSearchManager(cache); QueryBuilder queryBuilder = searchManager.buildQueryBuilderForClass(QueryableData.class).get(); TermTermination termTermination; Boolean isWildcardQuery = (Boolean) queryParameters.get(IS_WILDCARD); String onField = (String) queryParameters.get(QUERYABLE_FIELD); String matching = (String) queryParameters.get(MATCH_STRING); if (isWildcardQuery) { termTermination = queryBuilder.keyword().wildcard().onField(onField).matching(matching); } else { termTermination = queryBuilder.keyword().onField(onField).matching(matching); } CacheQuery cacheQuery = searchManager.getQuery(termTermination.createQuery()); return new QueryResultImpl(cacheQuery); }
Source:
public NetworkStats readNetworkStatsDetail() throws IOException { return readNetworkStatsDetail(UID_ALL, null, TAG_ALL); }

Target:
public NetworkStats readNetworkStatsDetail() throws IOException { return readNetworkStatsDetail(UID_ALL, INTERFACES_ALL, TAG_ALL); }
Source:
private void list() throws IOException, ConfigInvalidException { final FS fs = getRepository().getFS(); if (configFile != null) { list(new FileBasedConfig(configFile, fs)); return; } if (system || (isListAll() && StringUtils.isEmptyOrNull(SystemReader .getInstance() .getenv(Constants.GIT_CONFIG_NOSYSTEM_KEY)))) { list(SystemReader.getInstance().getSystemConfig()); } if (global || isListAll()) { list(SystemReader.getInstance().getUserConfig()); } if (local || isListAll()) { list(new FileBasedConfig(fs.resolve(getRepository().getDirectory(), Constants.CONFIG), fs)); } }

Target:
private void list() throws IOException, ConfigInvalidException { final FS fs = getRepository().getFS(); if (configFile != null) { list(new FileBasedConfig(configFile, fs)); return; } if (system || (isListAll() && StringUtils.isEmptyOrNull(SystemReader .getInstance() .getenv(Constants.GIT_CONFIG_NOSYSTEM_KEY)))) list(SystemReader.getInstance().openSystemConfig(null, fs)); if (global || isListAll()) list(SystemReader.getInstance().openUserConfig(null, fs)); if (local || isListAll()) list(new FileBasedConfig(fs.resolve(getRepository().getDirectory(), Constants.CONFIG), fs)); }
Source:
CachedFileInfo getFileInfo(final Long ledger, final byte masterKey[]) throws IOException { try { CachedFileInfo fi; pendingGetFileInfoCounter.inc(); Callable<CachedFileInfo> loader = () -> { CachedFileInfo fileInfo = fileInfoBackingCache.loadFileInfo(ledger, masterKey); activeLedgers.put(ledger, true); return fileInfo; }; do { if (null != masterKey) { fi = writeFileInfoCache.get(ledger, loader); } else { fi = readFileInfoCache.get(ledger, loader); } if (!fi.tryRetain()) { if (writeFileInfoCache.asMap().remove(ledger, fi) || readFileInfoCache.asMap().remove(ledger, fi)) { LOG.error("Dead fileinfo({}) forced out of cache. Must have been double-released somewhere.", fi); } fi = null; } } while (fi == null); return fi; } catch (ExecutionException | UncheckedExecutionException ee) { if (ee.getCause() instanceof IOException) { throw (IOException) ee.getCause(); } else { throw new IOException("Failed to load file info for ledger " + ledger, ee); } } finally { pendingGetFileInfoCounter.dec(); } }

Target:
CachedFileInfo getFileInfo(final Long ledger, final byte masterKey[]) throws IOException { try { CachedFileInfo fi; pendingGetFileInfoCounter.inc(); Callable<CachedFileInfo> loader = () -> { CachedFileInfo fileInfo = fileInfoBackingCache.loadFileInfo(ledger, masterKey); activeLedgers.put(ledger, true); return fileInfo; }; do { if (null != masterKey) { fi = writeFileInfoCache.get(ledger, loader); } else { fi = readFileInfoCache.get(ledger, loader); } if (!fi.tryRetain()) { boolean inWriteMap = writeFileInfoCache.asMap().remove(ledger, fi); boolean inReadMap = readFileInfoCache.asMap().remove(ledger, fi); if (inWriteMap || inReadMap) { LOG.error("Dead fileinfo({}) forced out of cache (write:{}, read:{}). " + "It must have been double-released somewhere.", fi, inWriteMap, inReadMap); } fi = null; } } while (fi == null); return fi; } catch (ExecutionException | UncheckedExecutionException ee) { if (ee.getCause() instanceof IOException) { throw (IOException) ee.getCause(); } else { throw new IOException("Failed to load file info for ledger " + ledger, ee); } } finally { pendingGetFileInfoCounter.dec(); } }
Source:
public void alterTable(ObjectPath tablePath, CatalogBaseTable newCatalogTable, boolean ignoreIfNotExists) throws TableNotExistException, CatalogException { checkNotNull(tablePath, "tablePath cannot be null"); checkNotNull(newCatalogTable, "newCatalogTable cannot be null"); Table hiveTable; try { hiveTable = getHiveTable(tablePath); } catch (TableNotExistException e) { if (!ignoreIfNotExists) { throw e; } return; } CatalogBaseTable existingTable = instantiateCatalogTable(hiveTable, hiveConf); if (existingTable.getClass() != newCatalogTable.getClass()) { throw new CatalogException( String.format("Table types don't match. Existing table is '%s' and new table is '%s'.", existingTable.getClass().getName(), newCatalogTable.getClass().getName())); } boolean isGeneric = isGenericForGet(hiveTable.getParameters()); if (isGeneric) { hiveTable = alterTableViaCatalogBaseTable(tablePath, newCatalogTable, hiveTable); } else { AlterTableOp op = extractAlterTableOp(newCatalogTable.getOptions()); if (op == null) { hiveTable = alterTableViaCatalogBaseTable(tablePath, newCatalogTable, hiveTable); } else { alterTableViaProperties(op, hiveTable, hiveTable.getParameters(), newCatalogTable.getProperties(), hiveTable.getSd()); } } disallowChangeIsGeneric(isGeneric, isGenericForGet(hiveTable.getParameters())); try { client.alter_table(tablePath.getDatabaseName(), tablePath.getObjectName(), hiveTable); } catch (TException e) { throw new CatalogException(String.format("Failed to alter table %s", tablePath.getFullName()), e); } }

Target:
public void alterTable(ObjectPath tablePath, CatalogBaseTable newCatalogTable, boolean ignoreIfNotExists) throws TableNotExistException, CatalogException { checkNotNull(tablePath, "tablePath cannot be null"); checkNotNull(newCatalogTable, "newCatalogTable cannot be null"); Table hiveTable; try { hiveTable = getHiveTable(tablePath); } catch (TableNotExistException e) { if (!ignoreIfNotExists) { throw e; } return; } CatalogBaseTable existingTable = instantiateCatalogTable(hiveTable, hiveConf); if (existingTable.getClass() != newCatalogTable.getClass()) { throw new CatalogException( String.format("Table types don't match. Existing table is '%s' and new table is '%s'.", existingTable.getClass().getName(), newCatalogTable.getClass().getName())); } boolean isGeneric = isGenericForGet(hiveTable.getParameters()); if (isGeneric) { hiveTable = HiveTableUtil.alterTableViaCatalogBaseTable(tablePath, newCatalogTable, hiveTable, hiveConf); } else { AlterTableOp op = HiveTableUtil.extractAlterTableOp(newCatalogTable.getOptions()); if (op == null) { hiveTable = HiveTableUtil.alterTableViaCatalogBaseTable(tablePath, newCatalogTable, hiveTable, hiveConf); } else { alterTableViaProperties( op, hiveTable, (CatalogTable) newCatalogTable, hiveTable.getParameters(), newCatalogTable.getProperties(), hiveTable.getSd()); } } disallowChangeIsGeneric(isGeneric, isGenericForGet(hiveTable.getParameters())); try { client.alter_table(tablePath.getDatabaseName(), tablePath.getObjectName(), hiveTable); } catch (TException e) { throw new CatalogException(String.format("Failed to alter table %s", tablePath.getFullName()), e); } }
Source:
public void setConf(Configuration conf) { config = conf; String host = conf.get(ElasticRestConstants.HOST); if (StringUtils.isBlank(host)) { String message = "Missing elastic.host. It should be set in nutch-site.xml "; message += "\n" + describe(); LOG.error(message); throw new RuntimeException(message); } }

Target:
public void setConf(Configuration conf) { config = conf; String host = conf.get(ElasticRestConstants.HOST); String port = conf.get(ElasticRestConstants.PORT); if (StringUtils.isBlank(host) && StringUtils.isBlank(port)) { String message = "Missing elastic.rest.host and elastic.rest.port. At least one of them should be set in nutch-site.xml "; message += "\n" + describe(); LOG.error(message); throw new RuntimeException(message); } }
Source:
public TestToolUtils() throws IOException { super(); }

Target:
public TestToolUtils() throws IOException
Source:
public UniqueConstraintDetails(Label label, String property) { super(); this.label = label; this.property = property; }

Target:
public UniqueConstraintDetails(Label label, String property) { this.label = label; this.property = property; }
Source:
protected void disconnect() { connectionAttemptState.websocket.disconnect(1000, "Websocket closed normally"); }

Target:
protected void disconnect() { websocket.disconnect(1000, "Websocket closed normally"); }