auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public List<Transaction> getTransactionsByInstanceIds(final List<Integer> instanceIds, final TransactionStatus transactionStatus, final ExperimentTransactionType experimentTransactionType) { try { final Criteria criteria = this.getSession().createCriteria(Transaction.class, "transaction"); criteria.createAlias("transaction.experimentTransactions", "experimentTransaction", Criteria.INNER_JOIN); criteria.createAlias("experimentTransaction.experiment.geoLocation", "geolocation", Criteria.INNER_JOIN); criteria.add(Restrictions.eq("status", transactionStatus.getIntValue())); criteria.add(Restrictions.in("geolocation.locationId", instanceIds)); criteria.add(Restrictions.eq("experimentTransaction.type", experimentTransactionType.getId())); criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); return criteria.list(); } catch (final HibernateException e) { final String message = "Error at getTransactionsByInstanceId instanceIds = " + instanceIds + ", transactionType + " + transactionStatus .getValue() + ", experimentTransactionStatus=" + experimentTransactionType.getValue(); ExperimentTransactionDAO.LOG.error(message, e); throw new MiddlewareQueryException(message, e); } }

Target:
public List<Transaction> getTransactionsByInstanceIds(final List<Integer> instanceIds, final TransactionStatus transactionStatus, final ExperimentTransactionType experimentTransactionType) { try { final Criteria criteria = this.getSession().createCriteria(Transaction.class, "transaction"); criteria.createAlias("transaction.experimentTransactions", "experimentTransaction", Criteria.INNER_JOIN); criteria.createAlias("experimentTransaction.experiment.geoLocation", "geolocation", Criteria.INNER_JOIN); criteria.add(Restrictions.eq("status", transactionStatus.getIntValue())); criteria.add(Restrictions.in("geolocation.locationId", instanceIds)); criteria.add(Restrictions.eq("experimentTransaction.type", experimentTransactionType.getId())); criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); return criteria.list(); } catch (final HibernateException e) { final String message = "Error at getTransactionsByInstanceIds instanceIds = " + instanceIds + ", transactionType + " + transactionStatus .getValue() + ", experimentTransactionStatus=" + experimentTransactionType.getValue(); ExperimentTransactionDAO.LOG.error(message, e); throw new MiddlewareQueryException(message, e); } }
Source:
HostChanges(final Set<String> newHosts, final Set<String> currentHosts) { this.added = ImmutableList.copyOf(Sets.difference(newHosts, currentHosts).immutableCopy()); this.removed = ImmutableList.copyOf(Sets.difference(currentHosts, newHosts).immutableCopy()); }

Target:
HostChanges(final Set<String> newHosts, final Set<String> currentHosts) { this.added = ImmutableList.copyOf(Sets.difference(newHosts, currentHosts)); this.removed = ImmutableList.copyOf(Sets.difference(currentHosts, newHosts)); }
Source:
public static String sanitizeFileName(String fileName) { return fileName.replace(File.separator, "↗"); }

Target:
public static String sanitizeFileName(String fileName) { String encoding = System.getProperty("file.encoding", "UTF-8"); final String sha1 = DigestUtils.sha1Hex(fileName).substring(0, 6); String fnameBase = fileName.replace(File.separator, "_"); try { fnameBase = new URI(String.format("file:/%s", fnameBase)).toASCIIString().substring("file:/".length()); } catch (URISyntaxException e) { log.debug(e, "Unable to encode base name [%s]. Trying as hex of UTF-8.", fnameBase); fnameBase = javax.xml.bind.DatatypeConverter.printHexBinary(StringUtils.toUtf8(fnameBase)); } byte[] fnameBytes; do { try { fnameBytes = fnameBase.getBytes(encoding); } catch (UnsupportedEncodingException e) { log.debug(e, "Error coding [%s] in %s, defaulting to UTF-8", fnameBase, encoding); fnameBytes = StringUtils.toUtf8(fnameBase); } if (fnameBytes.length > 100) { if (fnameBase.length() > 1) { fnameBase = fnameBase.substring(0, fnameBase.length() / 2); } else { fnameBase = ""; } } } while (fnameBytes.length > 100 && !fnameBase.isEmpty()); return fnameBase + '.' + sha1; }
Source:
public static void writeDeploymentToZK(ZooKeeper zk, long genId, SegmentedCatalog catalogAndDeployment, ZKCatalogStatus catalogStatus, long txnId) throws KeeperException, InterruptedException { makeCatalogHeader(catalogAndDeployment, 0, genId); String path = VoltZK.catalogbytes + "/" + 0; ByteBuffer buffer = ByteBuffer.allocate(13); buffer.put((byte)ZKCatalogStatus.PENDING.ordinal()); buffer.putInt(catalogAndDeployment.m_data.size()); buffer.putLong(txnId); hostLog.info("***write deployment to " + path + " " + catalogStatus); zk.create(path, buffer.array(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); for (ByteBuffer chunk : catalogAndDeployment.m_data) { zk.create(ZKUtil.joinZKPath(path, "part_"), chunk.array(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT_SEQUENTIAL); } if (catalogStatus == ZKCatalogStatus.COMPLETE) { buffer.position(0); buffer.put((byte)catalogStatus.ordinal()); zk.setData(path, buffer.array(), -1); } }

Target:
public static void writeDeploymentToZK(ZooKeeper zk, long genId, SegmentedCatalog catalogAndDeployment, ZKCatalogStatus catalogStatus, long txnId) throws KeeperException, InterruptedException { makeCatalogHeader(catalogAndDeployment, 0, genId); String path = VoltZK.catalogbytes + "/" + 0; ByteBuffer buffer = ByteBuffer.allocate(13); buffer.put((byte)ZKCatalogStatus.PENDING.ordinal()); buffer.putInt(catalogAndDeployment.m_data.size()); buffer.putLong(txnId); zk.create(path, buffer.array(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); for (ByteBuffer chunk : catalogAndDeployment.m_data) { zk.create(ZKUtil.joinZKPath(path, "part_"), chunk.array(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT_SEQUENTIAL); } if (catalogStatus == ZKCatalogStatus.COMPLETE) { buffer.position(0); buffer.put((byte)catalogStatus.ordinal()); zk.setData(path, buffer.array(), -1); } }
Source:
public byte[] idBuffer() { if (contentIdFromPtr == ptr) return contentId; if (state.walk != null && (mode & FileMode.TYPE_MASK) != FileMode.TYPE_GITLINK) { DirCacheIterator i = state.walk.getTree(state.dirCacheTree, DirCacheIterator.class); if (i != null) { DirCacheEntry ent = i.getDirCacheEntry(); if (ent != null && compareMetadata(ent) == MetadataDiff.EQUAL) { contentIdOffset = i.idOffset(); contentIdFromPtr = ptr; return contentId = i.idBuffer(); } contentIdOffset = 0; } else { contentIdOffset = 0; } } switch (mode & FileMode.TYPE_MASK) { case FileMode.TYPE_SYMLINK: case FileMode.TYPE_FILE: contentIdFromPtr = ptr; return contentId = idBufferBlob(entries[ptr]); case FileMode.TYPE_GITLINK: contentIdFromPtr = ptr; return contentId = idSubmodule(entries[ptr]); } return zeroid; }

Target:
public byte[] idBuffer() { if (contentIdFromPtr == ptr) return contentId; if (state.walk != null) { DirCacheIterator i = state.walk.getTree(state.dirCacheTree, DirCacheIterator.class); if (i != null) { DirCacheEntry ent = i.getDirCacheEntry(); if (ent != null && compareMetadata(ent) == MetadataDiff.EQUAL && ((ent.getFileMode().getBits() & FileMode.TYPE_MASK) != FileMode.TYPE_GITLINK)) { contentIdOffset = i.idOffset(); contentIdFromPtr = ptr; return contentId = i.idBuffer(); } contentIdOffset = 0; } else { contentIdOffset = 0; } } switch (mode & FileMode.TYPE_MASK) { case FileMode.TYPE_SYMLINK: case FileMode.TYPE_FILE: contentIdFromPtr = ptr; return contentId = idBufferBlob(entries[ptr]); case FileMode.TYPE_GITLINK: contentIdFromPtr = ptr; return contentId = idSubmodule(entries[ptr]); } return zeroid; }
Source:
void injectAccountAndContainerForPostRequest(RestRequest restRequest) throws RestServiceException { accountAndContainerSanityCheck(restRequest); if (getHeader(restRequest.getArgs(), Headers.TARGET_ACCOUNT_NAME, false) != null || getHeader(restRequest.getArgs(), Headers.TARGET_CONTAINER_NAME, false) != null) { ensureRequiredHeadersOrThrow(restRequest, requiredAmbryHeadersForPutWithAccountAndContainerName); frontendMetrics.putWithAccountAndContainerHeaderRate.mark(); injectAccountAndContainerUsingAccountAndContainerHeaders(restRequest); } else if (frontendConfig.frontendAllowServiceIdBasedPostRequest) { ensureRequiredHeadersOrThrow(restRequest, requiredAmbryHeadersForPutWithServiceId); frontendMetrics.putWithServiceIdForAccountNameRate.mark(); String serviceId = getHeader(restRequest.getArgs(), Headers.SERVICE_ID, false); boolean isPrivate = isPrivate(restRequest.getArgs()); injectAccountAndContainerUsingServiceId(restRequest, serviceId, isPrivate); } else { throw new RestServiceException( "Missing either " + Headers.TARGET_ACCOUNT_NAME + " or " + Headers.TARGET_CONTAINER_NAME + " header", RestServiceErrorCode.BadRequest); } }

Target:
void injectAccountAndContainerForPostRequest(RestRequest restRequest) throws RestServiceException { accountAndContainerSanityCheck(restRequest); if (getHeader(restRequest.getArgs(), Headers.TARGET_ACCOUNT_NAME, false) != null || getHeader(restRequest.getArgs(), Headers.TARGET_CONTAINER_NAME, false) != null) { ensureRequiredHeadersOrThrow(restRequest, requiredAmbryHeadersForPutWithAccountAndContainerName); frontendMetrics.putWithAccountAndContainerHeaderRate.mark(); injectAccountAndContainerUsingAccountAndContainerHeaders(restRequest); } else if (frontendConfig.frontendAllowServiceIdBasedPostRequest) { ensureRequiredHeadersOrThrow(restRequest, requiredAmbryHeadersForPutWithServiceId); frontendMetrics.putWithServiceIdForAccountNameRate.mark(); String serviceId = getHeader(restRequest.getArgs(), Headers.SERVICE_ID, true); boolean isPrivate = isPrivate(restRequest.getArgs()); injectAccountAndContainerUsingServiceId(restRequest, serviceId, isPrivate); } else { throw new RestServiceException( "Missing either " + Headers.TARGET_ACCOUNT_NAME + " or " + Headers.TARGET_CONTAINER_NAME + " header", RestServiceErrorCode.BadRequest); } }
Source:
private DataStream updateDataStream(DataStream dataStream, Metadata.Builder metadata, RestoreSnapshotRequest request) { String dataStreamName = dataStream.getName(); if (request.renamePattern() != null && request.renameReplacement() != null) { dataStreamName = dataStreamName.replaceAll(request.renamePattern(), request.renameReplacement()); } List<Index> updatedIndices = dataStream.getIndices().stream() .map(i -> metadata.get(renameIndex(i.getName(), request, true)).getIndex()) .collect(Collectors.toList()); return new DataStream(dataStreamName, dataStream.getTimeStampField(), updatedIndices, dataStream.getGeneration()); }

Target:
static DataStream updateDataStream(DataStream dataStream, Metadata.Builder metadata, RestoreSnapshotRequest request) { String dataStreamName = dataStream.getName(); if (request.renamePattern() != null && request.renameReplacement() != null) { dataStreamName = dataStreamName.replaceAll(request.renamePattern(), request.renameReplacement()); } List<Index> updatedIndices = dataStream.getIndices().stream() .map(i -> metadata.get(renameIndex(i.getName(), request, true)).getIndex()) .collect(Collectors.toList()); return new DataStream(dataStreamName, dataStream.getTimeStampField(), updatedIndices, dataStream.getGeneration()); }
Source:
protected RemoteOperationResult doInBackground(Object... params) { RemoteOperationResult result; if (params!= null && params.length==2) { String url = (String)params[0]; OwnCloudCredentials credentials = (OwnCloudCredentials)params[1]; Uri uri = Uri.parse(url); OwnCloudClient client = OwnCloudClientFactory.createOwnCloudClient(uri, mContext, true); client.setCredentials(credentials); ExistenceCheckRemoteOperation operation = new ExistenceCheckRemoteOperation( REMOTE_PATH, mContext, SUCCESS_IF_ABSENT ); result = operation.execute(client); String permanentLocation = null; if (operation.wasRedirected()) { RedirectionPath redirectionPath = operation.getRedirectionPath(); permanentLocation = redirectionPath.getLastPermanentLocation(); } if (result.isSuccess()) { if (permanentLocation == null) { GetRemoteUserInfoOperation remoteUserNameOperation = new GetRemoteUserInfoOperation(); result = remoteUserNameOperation.execute(client); } else { GetRemoteUserInfoOperation remoteUserNameOperation = new GetRemoteUserInfoOperation(); OwnCloudClient redirectedClient = OwnCloudClientFactory.createOwnCloudClient( Uri.parse(AccountUtils.trimWebdavSuffix(permanentLocation)), mContext, true ); redirectedClient.setCredentials(credentials); result = remoteUserNameOperation.execute(redirectedClient); } } result.setLastPermanentLocation(permanentLocation); } else { result = new RemoteOperationResult(RemoteOperationResult.ResultCode.UNKNOWN_ERROR); } return result; }

Target:
protected RemoteOperationResult doInBackground(Object... params) { RemoteOperationResult result; if (params!= null && params.length==2) { String url = (String)params[0]; OwnCloudCredentials credentials = (OwnCloudCredentials)params[1]; Uri uri = Uri.parse(url); OwnCloudClient client = OwnCloudClientFactory.createOwnCloudClient(uri, mContext, true); client.setCredentials(credentials); ExistenceCheckRemoteOperation operation = new ExistenceCheckRemoteOperation( REMOTE_PATH, mContext, SUCCESS_IF_ABSENT ); result = operation.execute(client); String targetUrlAfterPermanentRedirection = null; if (operation.wasRedirected()) { RedirectionPath redirectionPath = operation.getRedirectionPath(); targetUrlAfterPermanentRedirection = redirectionPath.getLastPermanentLocation(); } if (result.isSuccess()) { GetRemoteUserInfoOperation remoteUserNameOperation = new GetRemoteUserInfoOperation(); if (targetUrlAfterPermanentRedirection != null) { client = OwnCloudClientFactory.createOwnCloudClient( Uri.parse(AccountUtils.trimWebdavSuffix( targetUrlAfterPermanentRedirection )), mContext, true ); client.setCredentials(credentials); } result = remoteUserNameOperation.execute(client); } result.setLastPermanentLocation(targetUrlAfterPermanentRedirection); } else { result = new RemoteOperationResult(RemoteOperationResult.ResultCode.UNKNOWN_ERROR); } return result; }
Source:
public InitializerCommand(ResourceSet set, final Collection<EObject> selection) { super(set); this.selection = selection; }

Target:
public InitializerCommand(ResourceSet set, final Collection<EObject> selection) { super(set); this.viewpoint = (Viewpoint) selection.iterator().next(); }
Source:
private void poisonTable(Connection connection) throws SQLException { try (Statement statement = connection.createStatement()) { if (ConnectionDbTypes.getDbType(connection).equals(DBType.ORACLE)) { statement.execute(String.format("ALTER TABLE %s RENAME COLUMN last_allocated TO LEGACY_last_allocated", prefixedTimestampTableName())); } else { statement.execute(String.format("ALTER TABLE %s RENAME last_allocated TO LEGACY_last_allocated", prefixedTimestampTableName())); } } }

Target:
private void poisonTable(Connection connection) throws SQLException { try (Statement statement = connection.createStatement()) { if (ConnectionDbTypes.getDbType(connection).equals(DBType.ORACLE)) { statement.execute(String.format("ALTER TABLE %s RENAME COLUMN %s TO %s", prefixedTimestampTableName(), LAST_ALLOCATED, LEGACY_LAST_ALLOCATED)); } else { statement.execute(String.format("ALTER TABLE %s RENAME %s TO %s", prefixedTimestampTableName(), LAST_ALLOCATED, LEGACY_LAST_ALLOCATED)); } } }
Source:
private ReadWriteLock getLock(long key) { return locks.get((int)key%LOCK_COUNT); }

Target:
private ReadWriteLock getLock(long key) { return locks.get((int)Math.abs(key)%LOCK_COUNT); }
Source:
public Api getAPIForSite(Site site) { HashMap<String, String> customHeaders = new HashMap<String, String>(); customHeaders.put("User-Agent", getUserAgent()); String acceptLanguage = getPrimaryLanguage(); Locale defaultLocale = Locale.getDefault(); String languageBase = Utils.langCodeToWikiLang(defaultLocale.getLanguage()); String country = defaultLocale.getCountry(); String langWithCountryCode = country.equals("") ? languageBase : languageBase.concat("-" + country.toLowerCase()); if (acceptLanguage.equals("zh") || languageBase.equals("zh")) { if (acceptLanguage.equals(langWithCountryCode)) { acceptLanguage = langWithCountryCode.equals(languageBase) ? acceptLanguage : acceptLanguage.concat("," + languageBase + ";q=0.9"); } else if (acceptLanguage.equals(languageBase)) { acceptLanguage = langWithCountryCode.concat("," + acceptLanguage + ";q=0.9"); } else { acceptLanguage = acceptLanguage.concat("," + langWithCountryCode + ";q=0.9"); if (!langWithCountryCode.equals(languageBase)) { acceptLanguage = acceptLanguage.concat("," + languageBase + ";q=0.8"); } } customHeaders.put("Accept-Language", acceptLanguage); } Api api = mccMncStateHandler.makeApiWithMccMncHeaderEnrichment(this, site, customHeaders); if (api != null) { return api; } String domainAndApiAndVariantKey = site.getDomain() + "-" + site.getApiDomain() + "-" + acceptLanguage; if (!apis.containsKey(domainAndApiAndVariantKey)) { apis.put(domainAndApiAndVariantKey, new Api(site.getApiDomain(), customHeaders)); } return apis.get(domainAndApiAndVariantKey); }

Target:
public Api getAPIForSite(Site site) { HashMap<String, String> customHeaders = new HashMap<String, String>(); customHeaders.put("User-Agent", getUserAgent()); String acceptLanguage = getAcceptLanguage(); if (!acceptLanguage.equals(getPrimaryLanguage())) { customHeaders.put("Accept-Language", acceptLanguage); } Api api = mccMncStateHandler.makeApiWithMccMncHeaderEnrichment(this, site, customHeaders); if (api != null) { return api; } String domainAndApiAndVariantKey = site.getDomain() + "-" + site.getApiDomain() + "-" + acceptLanguage; if (!apis.containsKey(domainAndApiAndVariantKey)) { apis.put(domainAndApiAndVariantKey, new Api(site.getApiDomain(), customHeaders)); } return apis.get(domainAndApiAndVariantKey); }
Source:
public static PlanMatchPattern semiJoin(String sourceSymbolAlias, String filteringSymbolAlias, String outputAlias, PlanMatchPattern source, PlanMatchPattern filtering) { return node(SemiJoinNode.class, source, filtering).with(new SemiJoinMatcher(sourceSymbolAlias, filteringSymbolAlias, outputAlias, Optional.empty())); }

Target:
public static PlanMatchPattern semiJoin(String sourceSymbolAlias, String filteringSymbolAlias, String outputAlias, PlanMatchPattern source, PlanMatchPattern filtering) { return semiJoin(sourceSymbolAlias, filteringSymbolAlias, outputAlias, Optional.empty(), source, filtering); }
Source:
String[] removeNegativeNumberOptions(String[] args) { for (int i = 0; i < args.length; i++) { if (isNegativeNumber.test(args[i])) { String param = args[i]; negativeNumberParams.put(i - 1, new BigDecimal(param).toString()); args[i] = "0"; } } return args; }

Target:
String[] removeNegativeNumberOptions(String[] args) { for (int i = 1; i < args.length; i++) { if (isNegativeNumber.test(args[i])) { String param = args[i]; negativeNumberParams.put(i - 1, new BigDecimal(param).toString()); args[i] = "0"; } } return args; }
Source:
public @Nonnull FormValidation doCheckNewName(@QueryParameter String newName) { if (!hasPermission(Item.CONFIGURE)) { checkPermission(Item.CREATE); checkPermission(Item.DELETE); } newName = newName == null ? null : newName.trim(); try { Jenkins.checkGoodName(newName); assert newName != null; checkIfNameIsUsed(newName); checkRename(newName); } catch (Failure e) { return FormValidation.error(e.getMessage()); } return FormValidation.ok(); }

Target:
public @Nonnull FormValidation doCheckNewName(@QueryParameter String newName) { if (!hasPermission(Item.CONFIGURE)) { if (parent instanceof AccessControlled) { ((AccessControlled)parent).checkPermission(Item.CREATE); } checkPermission(Item.DELETE); } newName = newName == null ? null : newName.trim(); try { Jenkins.checkGoodName(newName); assert newName != null; Jenkins.get().getProjectNamingStrategy().checkName(newName); checkIfNameIsUsed(newName); checkRename(newName); } catch (Failure e) { return FormValidation.error(e.getMessage()); } return FormValidation.ok(); }
Source:
public ByteBuffer encode(BaseOperation<K> operation) { BaseOperation.Code opCode = operation.getOpCode(); switch (opCode) { case PUT: return codecFactory.getPutOperationCodec().encode((PutOperation<K, V>)operation); default: throw new AssertionError("Invalid operation " + opCode); } }

Target:
public ByteBuffer encode(BaseOperation<K> operation) { OperationCode opCode = operation.getOpCode(); return codecProvider.getOperationCodec(opCode).encode(operation); }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); binding = ActivitySplashBinding.inflate(getLayoutInflater()); setContentView(binding.getRoot()); Typeface typeface = Typeface.createFromAsset(getAssets(), "fonts/OpenSans/Montserrat.ttf"); binding.organizationName.setTypeface(typeface); binding.organizationName.setText(R.string.organization_name); binding.clientName.setTypeface(typeface); binding.clientName.setText(R.string.client_name); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); Animation move = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.splash_screen_logo_anim); AnimationSet set = new AnimationSet(true); Animation fadeIn = new AlphaAnimation(0, 1); fadeIn.setInterpolator(new AccelerateInterpolator()); fadeIn.setDuration(1000); set.addAnimation(fadeIn); set.addAnimation(move); binding.logo.startAnimation(set); mRunnable = () -> { Intent intent = new Intent(SplashActivity.this, IntroActivity.class); startActivity(intent); finish(); }; mHandler.postDelayed(mRunnable, SPLASH_TIMER); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); binding = ActivitySplashBinding.inflate(getLayoutInflater()); setContentView(binding.getRoot()); Typeface typeface = Typeface.createFromAsset(getAssets(), "fonts/Roboto/Montserrat.ttf"); binding.organizationName.setTypeface(typeface); binding.organizationName.setText(R.string.organization_name); binding.clientName.setTypeface(typeface); binding.clientName.setText(R.string.client_name); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); Animation move = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.splash_screen_logo_anim); AnimationSet set = new AnimationSet(true); Animation fadeIn = new AlphaAnimation(0, 1); fadeIn.setInterpolator(new AccelerateInterpolator()); fadeIn.setDuration(1000); set.addAnimation(fadeIn); set.addAnimation(move); binding.logo.startAnimation(set); mRunnable = () -> { Intent intent = new Intent(SplashActivity.this, IntroActivity.class); startActivity(intent); finish(); }; mHandler.postDelayed(mRunnable, SPLASH_TIMER); }
Source:
private ContextForm() { Language currentLanguage = Language.getLanguage(); setWriteThrough(false); yearMonthField.setValue(new DateTime(year, month, 1, 0, 0, 0, 0).toDate()); yearMonthField.setResolution(InlineDateField.RESOLUTION_MONTH); addField("yearMonth", yearMonthField); accountabilityTypesField.addContainerProperty("name", String.class, null); accountabilityTypesField.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY); accountabilityTypesField.setItemCaptionPropertyId("name"); final Set<AccountabilityType> accountabilityTypes = MissionSystem.getInstance().getAccountabilityTypesRequireingAuthorization(); for (final AccountabilityType accountabilityType : accountabilityTypes) { final Item item = accountabilityTypesField.addItem(accountabilityType); final Property itemProperty = item.getItemProperty("name"); itemProperty.setValue(accountabilityType.getName().getContent(currentLanguage)); } accountabilityTypesField.setRows(accountabilityTypes.size()); accountabilityTypesField.setNullSelectionAllowed(false); accountabilityTypesField.setMultiSelect(true); accountabilityTypesField.setValue(Collections.unmodifiableSet(accountabilityTypes)); addField("accountabilityTypes", accountabilityTypesField); }

Target:
private ContextForm() { setWriteThrough(false); yearMonthField.setValue(new DateTime(year, month, 1, 0, 0, 0, 0).toDate()); yearMonthField.setResolution(InlineDateField.RESOLUTION_MONTH); addField("yearMonth", yearMonthField); accountabilityTypesField.addContainerProperty("name", String.class, null); accountabilityTypesField.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY); accountabilityTypesField.setItemCaptionPropertyId("name"); final Set<AccountabilityType> accountabilityTypes = MissionSystem.getInstance().getAccountabilityTypesRequireingAuthorization(); for (final AccountabilityType accountabilityType : accountabilityTypes) { final Item item = accountabilityTypesField.addItem(accountabilityType); final Property itemProperty = item.getItemProperty("name"); itemProperty.setValue(accountabilityType.getName().getContent(Language.getLanguage())); } accountabilityTypesField.setRows(accountabilityTypes.size()); accountabilityTypesField.setNullSelectionAllowed(false); accountabilityTypesField.setMultiSelect(true); accountabilityTypesField.setValue(Collections.unmodifiableSet(accountabilityTypes)); addField("accountabilityTypes", accountabilityTypesField); }
Source:
public void testAllScriptsContainAPIBinding() throws InvalidScriptException { Script s = scriptWithApiBindingClient(); Script s1 = scriptWithApiBindingUser(); Script s2 = scriptWithApiBindingGlobal(); FlowScript fs = flowScriptWithApiBindingClient(); Mockito.when(it.getPreScript()).thenReturn(s1); Mockito.when(it.getPostScript()).thenReturn(s2); Mockito.when(sec.getScript()).thenReturn(s); Mockito.when(fe.getEnvScript()).thenReturn(s); Mockito.when(it.getFlowScript()).thenReturn(fs); Boolean result = new CheckEligibleTaskDescriptorScript().isTaskContainsAPIBinding(etd); assertEquals(true, result); }

Target:
public void testAllScriptsContainAPIBinding() throws InvalidScriptException { Script s = scriptWithApiBindingClient(); Script s1 = scriptWithApiBindingUser(); Script s2 = scriptWithApiBindingGlobal(); FlowScript fs = flowScriptWithApiBindingClient(); Mockito.when(it.getPreScript()).thenReturn(s1); Mockito.when(it.getPostScript()).thenReturn(s2); Mockito.when(sec.getScript()).thenReturn(s); Mockito.when(fe.getEnvScript()).thenReturn(s); Mockito.when(it.getFlowScript()).thenReturn(fs); assertTrue(new CheckEligibleTaskDescriptorScript().isTaskContainsAPIBinding(etd)); }
Source:
public static ConfigurationLoader from(final Properties props) throws IOException { return new ConfigurationLoader(new Function<String, String>() { @SuppressFBWarnings(value = "NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE", justification = "False positive. I don't know what spotbugs is doing here.") public String apply(String from) { return props.getProperty(from); } }); }

Target:
public static ConfigurationLoader from(final Properties props) throws IOException { return new ConfigurationLoader(from -> props.getProperty(from)); }
Source:
private static String[] removeNullsFromArgArray(String[] argArray) { List<String> argList = new ArrayList(Arrays.asList(argArray)); argList.removeAll(Collections.singleton(null)); return argList.toArray(new String[0]); }

Target:
private static String[] removeNullsFromArgArray(String[] argArray) { List<String> argList = new ArrayList(Arrays.asList(argArray)); argList.removeAll(Collections.singleton(null)); return argList.toArray(new String[argList.size()]); }
Source:
@NotNull public static XmlBlock create(FsFile fsFile, String packageName) throws RoboNotFoundException { Document document = parse(fsFile); if (document == null) { throw new RoboNotFoundException("couldn't find resource " + fsFile.getPath()); } return new XmlBlock(document, fsFile.getPath(), packageName); }

Target:
public static XmlBlock create(FsFile fsFile, String packageName) { Document document = parse(fsFile); return document == null ? null : new XmlBlock(document, fsFile.getPath(), packageName); }
Source:
private void open(final IDockerConnection connection) { final Job pingJob = new LoadingJob(DVMessages.getString("PingJob.msg"), connection) { @Override protected IStatus run(final IProgressMonitor monitor) { try { connection.open(true); connection.ping(); return Status.OK_STATUS; } catch (DockerException e) { Display.getDefault().asyncExec(() -> { MessageDialog.openError( Display.getDefault().getActiveShell(), DVMessages.getString("Error"), DVMessages.getFormattedString( "PingJobError.msg.withExplanation", connection.getName(), e.getMessage())); }); return Status.CANCEL_STATUS; } } }; pingJob.schedule(); }

Target:
private void open(final IDockerConnection connection) { final Job pingJob = new LoadingJob(DVMessages.getString("PingJob.msg"), connection) { @Override protected IStatus run(final IProgressMonitor monitor) { try { connection.open(true); connection.ping(); return Status.OK_STATUS; } catch (DockerException e) { Activator.logWarningMessage(DVMessages.getFormattedString( "PingJobError.msg.withExplanation", connection.getName(), e.getMessage())); return Status.CANCEL_STATUS; } } }; pingJob.schedule(); }
Source:
public static void annotateMutationWithMetadata(PTable table, Mutation mutation) { if (mutation.getDurability() == Durability.SKIP_WAL) { return; } if (table.getTenantId() != null) { mutation.setAttribute(MutationMetadataType.TENANT_ID.toString(), table.getTenantId().getBytes()); } if (table.getSchemaName() != null) { mutation.setAttribute(MutationMetadataType.SCHEMA_NAME.toString(), table.getSchemaName().getBytes()); } if (table.getTableName() != null) { mutation.setAttribute(MutationMetadataType.LOGICAL_TABLE_NAME.toString(), table.getTableName().getBytes()); } if (table.getLastDDLTimestamp() != null) { mutation.setAttribute(MutationMetadataType.TIMESTAMP.toString(), Bytes.toBytes(table.getLastDDLTimestamp())); } mutation.setAttribute(MutationMetadataType.TABLE_TYPE.toString(), table.getType().getValue().getBytes()); }

Target:
private void annotateMutationWithMetadata(PTable table, Mutation mutation) { byte[] tenantId = table.getTenantId() != null ? table.getTenantId().getBytes() : null; byte[] schemaName = table.getSchemaName() != null ? table.getSchemaName().getBytes() : null; byte[] tableName = table.getTableName() != null ? table.getTableName().getBytes() : null; byte[] tableType = table.getType().getValue().getBytes(); byte[] lastDDLTimestamp = table.getLastDDLTimestamp() != null ? Bytes.toBytes(table.getLastDDLTimestamp()) : null; WALAnnotationUtil.annotateMutation(mutation, tenantId, schemaName, tableName, tableType, lastDDLTimestamp); }
Source:
public InetSocketAddress getAddressForHost(String host) throws UnknownHostException { if (config.addressTranslation().containsKey(host)) { log.info("Found address translation mapping for host {}. The InetSocketAddress this host maps to is {}.", SafeArg.of("host", host), SafeArg.of("address", config.addressTranslation().get(host))); return config.addressTranslation().get(host); } InetAddress resolvedHost = InetAddress.getByName(host); Set<InetSocketAddress> allKnownHosts = Sets.union(currentPools.keySet(), config.servers()); for (InetSocketAddress address : allKnownHosts) { if (Objects.equals(address.getAddress(), resolvedHost)) { return address; } } Set<Integer> allKnownPorts = allKnownHosts.stream() .map(InetSocketAddress::getPort) .collect(Collectors.toSet()); if (allKnownPorts.size() == 1) { return new InetSocketAddress(resolvedHost, Iterables.getOnlyElement(allKnownPorts)); } else { throw new UnknownHostException("Couldn't find the provided host in server list or current servers"); } }

Target:
public InetSocketAddress getAddressForHost(String host) throws UnknownHostException { if (config.addressTranslation().containsKey(host)) { return config.addressTranslation().get(host); } InetAddress resolvedHost = InetAddress.getByName(host); Set<InetSocketAddress> allKnownHosts = Sets.union(currentPools.keySet(), config.servers()); for (InetSocketAddress address : allKnownHosts) { if (Objects.equals(address.getAddress(), resolvedHost)) { return address; } } Set<Integer> allKnownPorts = allKnownHosts.stream() .map(InetSocketAddress::getPort) .collect(Collectors.toSet()); if (allKnownPorts.size() == 1) { return new InetSocketAddress(resolvedHost, Iterables.getOnlyElement(allKnownPorts)); } else { throw new UnknownHostException("Couldn't find the provided host in server list or current servers"); } }
Source:
public static List<Overlay> convert(MapView map, File file, ValidationPreferences pref) throws Exception { return convert(map, file, pref, Color.TRANSPARENT, Color.BLACK, 5, defaultBubbleText); }

Target:
public static List<Overlay> convert(MapView map, File file, ValidationPreferences pref) throws Exception { return convert(map, file, pref, new DefaultShapeMetaSetter()); }
Source:
private void updateModuleInformation() { Set<Name> filtered = ImmutableSet.of(ENGINE_MODULE_NAME, new Name("engine-test")); for (RemoteModule remote : metaDownloader.getModules()) { ModuleSelectionInfo info = modulesLookup.get(remote.getId()); if (!filtered.contains(remote.getId())) { if (info == null) { info = ModuleSelectionInfo.remote(remote); modulesLookup.put(remote.getId(), info); int pos = Collections.binarySearch(sortedModules, info, moduleInfoComparator); if (pos < 0) { sortedModules.add(-pos - 1, info); allSortedModules = new ArrayList<>(sortedModules); } } info.setOnlineVersion(remote); } } }

Target:
private void updateModuleInformation() { Set<Name> filtered = ImmutableSet.of(ENGINE_MODULE_NAME, new Name("engine-test")); for (RemoteModule remote : metaDownloader.getModules()) { ModuleSelectionInfo info = modulesLookup.get(remote.getId()); if (!filtered.contains(remote.getId())) { if (info == null) { info = ModuleSelectionInfo.remote(remote); modulesLookup.put(remote.getId(), info); int pos = Collections.binarySearch(sortedModules, info, moduleInfoComparator); if (pos < 0) { sortedModules.add(-pos - 1, info); allSortedModules.clear(); allSortedModules.addAll(sortedModules); } } info.setOnlineVersion(remote); } } }
Source:
public void addPullRequestReviewer(String project, String repository, String pullRequestId, String user, StashClient stashClient){ try { StashPullRequest pullRequest = stashClient.getPullRequest(project, repository, pullRequestId); StashUser reviewer = pullRequest.getReviewer(user); if (reviewer == null) { reviewer = stashClient.getUser(project, repository, pullRequestId, user); stashClient.addPullRequestReviewer(project, repository, pullRequestId, pullRequest.getVersion(), reviewer); LOGGER.debug("User \"{}\" is now a reviewer of the pull-request #{}", user, pullRequestId, project, repository); } } catch(StashClientException e){ LOGGER.error("Unable to add a new reviewer to the pull-request: {}", e.getMessage()); LOGGER.debug("Exception stack trace", e); } }

Target:
public void addPullRequestReviewer(String project, String repository, String pullRequestId, String user, StashClient stashClient){ try { StashPullRequest pullRequest = stashClient.getPullRequest(project, repository, pullRequestId); StashUser reviewer = pullRequest.getReviewer(user); if (reviewer == null) { ArrayList<StashUser> reviewers = new ArrayList<>(pullRequest.getReviewers()); reviewers.add(stashClient.getUser(project, repository, pullRequestId, user)); stashClient.addPullRequestReviewer(project, repository, pullRequestId, pullRequest.getVersion(), reviewers); LOGGER.info("User \"{}\" is now a reviewer of the pull-request #{}", user, pullRequestId, project, repository); } } catch(StashClientException e){ LOGGER.error("Unable to add a new reviewer to the pull-request: {}", e.getMessage()); LOGGER.debug("Exception stack trace", e); } }
Source:
private Scenario giveResourcesToPlayerForSettlementBuilding(int moveOrder) { return scenario .nextRandomDiceValues(asList(moveOrder, moveOrder, moveOrder, moveOrder == 3 ? moveOrder + 2 : moveOrder + 1, 6, 6)) .THROW_DICE(moveOrder) .END_TURN(moveOrder) .THROW_DICE(moveOrder == 1 ? 2 : moveOrder == 2 ? 3 : 1) .END_TURN(moveOrder == 1 ? 2 : moveOrder == 2 ? 3 : 1) .THROW_DICE(moveOrder == 1 ? 3 : moveOrder == 2 ? 1 : 2) .END_TURN(moveOrder == 1 ? 3 : moveOrder == 2 ? 1 : 2); }

Target:
private Scenario giveResourcesToPlayerForSettlementBuilding(int moveOrder) { return scenario .nextRandomDiceValues(asList(moveOrder, moveOrder)) .THROW_DICE(moveOrder) .END_TURN(moveOrder) .nextRandomDiceValues(asList(moveOrder, moveOrder == 3 ? moveOrder + 2 : moveOrder + 1)) .THROW_DICE(moveOrder == 1 ? 2 : moveOrder == 2 ? 3 : 1) .END_TURN(moveOrder == 1 ? 2 : moveOrder == 2 ? 3 : 1) .nextRandomDiceValues(asList(6, 6)) .THROW_DICE(moveOrder == 1 ? 3 : moveOrder == 2 ? 1 : 2) .END_TURN(moveOrder == 1 ? 3 : moveOrder == 2 ? 1 : 2); }
Source:
private void onInsertedData(Metric<?> metric) { log.tracef("Inserted metric: %s", metric); if (publish.isPublished(metric.getMetricId())) { pendingMetrics.add(metric); } }

Target:
private void onInsertedData(Metric<?> metric) { log.tracef("Inserted metric: %s", metric); if (metric.getMetricId().getType() == AVAILABILITY) { @SuppressWarnings("unchecked") Metric<AvailabilityType> avail = (Metric<AvailabilityType>) metric; publishAvailablility(avail); } else { @SuppressWarnings("unchecked") Metric<? extends Number> numeric = (Metric<? extends Number>) metric; publishNumeric(numeric); } }
Source:
public Map<String, byte[]> get(Set<String> keys) { Objects.requireNonNull(keys); Map<String, byte[]> kvMap = new HashMap<>(keys.size()); List<byte[]> values = getValuesForKeys(keys); int i = 0; for (String key : keys) { byte[] value = values.get(i++); if (value != null) { kvMap.put(key, value); } } return kvMap; }

Target:
public Map<String, byte[]> get(Set<String> keys) { Objects.requireNonNull(keys); Map<String, byte[]> map = new HashMap<>(keys.size()); List<byte[]> values = getValuesForKeys(keys); int i = 0; for (String key : keys) { byte[] value = values.get(i++); if (value != null) { map.put(key, value); } } return map; }
Source:
synchronized void add(PcapPacket packet) { Packet newPacket = packet.getPacket(fProtocol); if (newPacket == null) { return; } if (fEndpointPair.getFirstEndpoint().equals(newPacket.getSourceEndpoint()) && fEndpointPair.getSecondEndpoint().equals(newPacket.getDestinationEndpoint())) { fNbPacketsAtoB++; fNbBytesAtoB += packet.getOriginalLength(); } else if (fEndpointPair.getFirstEndpoint().equals(newPacket.getDestinationEndpoint()) && fEndpointPair.getSecondEndpoint().equals(newPacket.getSourceEndpoint())) { fNbPacketsBtoA++; fNbBytesBtoA += packet.getOriginalLength(); } else { return; } long timestamp; switch (packet.getTimestampScale()) { case MICROSECOND: timestamp = packet.getTimestamp() * 1000; break; case NANOSECOND: timestamp = packet.getTimestamp(); break; default: throw new IllegalArgumentException("The timestamp precision is not valid!"); } if ((fStartTime == -1) || (fStartTime > timestamp)) { fStartTime = timestamp; } if ((fStopTime == -1) || (fStopTime < timestamp)) { fStopTime = timestamp; } }

Target:
synchronized void add(PcapPacket packet) { Packet newPacket = packet.getPacket(fProtocol); if (newPacket == null) { return; } if (fEndpointPair.getFirstEndpoint().equals(newPacket.getSourceEndpoint()) && fEndpointPair.getSecondEndpoint().equals(newPacket.getDestinationEndpoint())) { fNbPacketsAtoB++; fNbBytesAtoB += packet.getOriginalLength(); } else if (fEndpointPair.getFirstEndpoint().equals(newPacket.getDestinationEndpoint()) && fEndpointPair.getSecondEndpoint().equals(newPacket.getSourceEndpoint())) { fNbPacketsBtoA++; fNbBytesBtoA += packet.getOriginalLength(); } else { throw new IllegalStateException(); } long timestamp; switch (packet.getTimestampScale()) { case MICROSECOND: timestamp = packet.getTimestamp() * 1000; break; case NANOSECOND: timestamp = packet.getTimestamp(); break; default: throw new IllegalArgumentException("The timestamp precision is not valid!"); } fStartTime = Math.min(fStartTime, timestamp); fEndTime = Math.max(fEndTime, timestamp); }
Source:
public void destroyCache(final String alias) throws CachePersistenceException { if (alias == null) { throw new NullPointerException("Alias cannot be null"); } LOGGER.debug("Destroying Cache '{}' in {}.", alias, simpleName); StatusTransitioner.Transition maintenance = null; try { maintenance = statusTransitioner.maintenance(); } catch(IllegalStateException e) { statusTransitioner.checkAvailable(); } if(maintenance != null) { try { startMaintainableServices(MaintainableService.MaintenanceScope.CACHE); maintenance.succeeded(); } catch (Throwable t) { throw maintenance.failed(t); } } try { removeCache(alias); destroyPersistenceSpace(alias); } finally { if(maintenance != null) { StatusTransitioner.Transition st = statusTransitioner.exitMaintenance(); try { stopMaintainableServices(); st.succeeded(); } catch (Throwable t) { throw st.failed(t); } } } LOGGER.info("Cache '{}' successfully destroyed in {}.", alias, simpleName); }

Target:
public void destroyCache(final String alias) throws CachePersistenceException { if (alias == null) { throw new NullPointerException("Alias cannot be null"); } LOGGER.debug("Destroying Cache '{}' in {}.", alias, simpleName); StatusTransitioner.Transition maintenance = null; try { maintenance = statusTransitioner.maintenance(); } catch(IllegalStateException e) { statusTransitioner.checkAvailable(); } if(maintenance != null) { try { startMaintainableServices(MaintainableService.MaintenanceScope.CACHE); maintenance.succeeded(); } catch (Throwable t) { throw maintenance.failed(t); } } try { removeCache(alias, true); destroyPersistenceSpace(alias); } finally { if(maintenance != null) { StatusTransitioner.Transition st = statusTransitioner.exitMaintenance(); try { stopMaintainableServices(); st.succeeded(); } catch (Throwable t) { throw st.failed(t); } } } LOGGER.info("Cache '{}' successfully destroyed in {}.", alias, simpleName); }
Source:
private long determineDelayForMessage(Message<?> message) { long delay = this.defaultDelay; if (this.delayExpression != null) { String delayValueExceptionMessage = null; Object delayValue = null; try { delayValue = this.delayExpression.getValue(this.evaluationContext, message); } catch (EvaluationException e) { delayValueExceptionMessage = e.getMessage(); } if (delayValue instanceof Date) { delay = ((Date) delayValue).getTime() - new Date().getTime(); } else if (delayValue != null) { try { delay = Long.valueOf(delayValue.toString()); } catch (NumberFormatException e) { delayValueExceptionMessage = e.getMessage(); } } if (delayValueExceptionMessage != null && logger.isWarnEnabled()) { logger.warn("Failed to get delay value from 'delayExpression': " + delayValueExceptionMessage + ". Will fall back to default delay: " + this.defaultDelay); } } return delay; }

Target:
private long determineDelayForMessage(Message<?> message) { long delay = this.defaultDelay; if (this.delayExpression != null) { Exception delayValueException = null; Object delayValue = null; try { delayValue = this.delayExpression.getValue(this.evaluationContext, message); } catch (EvaluationException e) { delayValueException = e; } if (delayValue instanceof Date) { delay = ((Date) delayValue).getTime() - new Date().getTime(); } else if (delayValue != null) { try { delay = Long.valueOf(delayValue.toString()); } catch (NumberFormatException e) { delayValueException = e; } } if (delayValueException != null) { if (this.ignoreExpressionFailures) { if (logger.isDebugEnabled()) { logger.debug("Failed to get delay value from 'delayExpression': " + delayValueException.getMessage() + ". Will fall back to default delay: " + this.defaultDelay); } } else { throw new MessageHandlingException(message, "Error occurred during 'delay' value determination", delayValueException); } } } return delay; }
Source:
public void removeVmDevices(List<VmDevice> devices, int numberOfDevicesToRemove) { int size = devices.size(); int maxIndex = Math.min(numberOfDevicesToRemove, size); for (int index = 1; index <= maxIndex; index++) { vmDeviceDao.remove(devices.get(size - index).getId()); } }

Target:
public void removeVmDevices(List<VmDevice> devices, int numberOfDevicesToRemove) { int size = devices.size(); removeVmDevices(devices.subList(Math.max(size - numberOfDevicesToRemove, 0), size)); }
Source:
public void dispose() { synchronized(PhoneProxy.lockForRadioTechnologyChange) { mCM.unregisterForAvailable(h); mSIMRecords.unregisterForRecordsLoaded(h); mCM.unregisterForOffOrNotAvailable(h); mCM.unregisterForOn(h); mSST.unregisterForNetworkAttach(h); mCM.unSetOnUSSD(h); mCM.unSetOnSuppServiceNotification(h); mCM.unSetOnCallRing(h); mPendingMMIs.removeAll(mPendingMMIs); h.removeCallbacksAndMessages(null); mStkService.dispose(); mCT.dispose(); mDataConnection.dispose(); mSST.dispose(); ((SIMFileHandler)mIccFileHandler).dispose(); mSIMRecords.dispose(); mSimCard.dispose(); mSimPhoneBookIntManager.dispose(); mSimSmsIntManager.dispose(); mSubInfo.dispose(); this.mIccFileHandler = null; this.mSimCard = null; this.debugSocket = null; this.debugPortThread = null; this.mSimulatedRadioControl = null; this.mPendingMMIs = null; this.mStkService = null; this.mCM = null; this.mDataConnection = null; this.mSsnRegistrants = null; this.mCT = null; this.mPostDialHandler = null; this.mSimPhoneBookIntManager = null; this.mSIMRecords = null; this.mSimSmsIntManager = null; this.mSMS = null; this.mSST = null; this.mSubInfo = null; this.h = null; } }

Target:
public void dispose() { synchronized(PhoneProxy.lockForRadioTechnologyChange) { mCM.unregisterForAvailable(h); mSIMRecords.unregisterForRecordsLoaded(h); mCM.unregisterForOffOrNotAvailable(h); mCM.unregisterForOn(h); mSST.unregisterForNetworkAttach(h); mCM.unSetOnUSSD(h); mCM.unSetOnSuppServiceNotification(h); mCM.unSetOnCallRing(h); mPendingMMIs.clear(); mStkService.dispose(); mCT.dispose(); mDataConnection.dispose(); mSST.dispose(); mIccFileHandler.dispose(); mSIMRecords.dispose(); mSimCard.dispose(); mSimPhoneBookIntManager.dispose(); mSimSmsIntManager.dispose(); mSubInfo.dispose(); } }
Source:
public void dropTable(String tableName) { queryExecutor.executeQuery("DROP TABLE " + tableName); }

Target:
public void dropTable(String tableName) { executeQueryIgnoreTypeError("DROP TABLE " + tableName); }
Source:
private static String format(final String format, final Object... parameters) { List<String> parts = Arrays.asList(format.split("[%][s]", -1)); if (parts.size() - 1 != parameters.length) { throw new IllegalArgumentException("Format string \"" + format + "\" does not have " + parameters.length + " substitution variables."); } StringBuffer buffer = new StringBuffer(parts.get(0)); for (int i = 0; i < parameters.length ; ) { buffer.append(parameters[i]).append(parts.get(++i)); } return buffer.toString(); }

Target:
private static String format(final String format, final Object... parameters) { List<String> parts = Arrays.asList(format.split("[%][s]", -1)); if (parts.size() - 1 != parameters.length) { throw new IllegalArgumentException("Format string \"" + format + "\" does not have " + parameters.length + " substitution variables."); } StringBuffer buffer = new StringBuffer(parts.get(0)); for (int i = 0; i < parameters.length ; i++) { buffer.append(parameters[i]).append(parts.get(i+1)); } return buffer.toString(); }
Source:
public Void call() throws Exception { s_logger.info("Updating configurations"); Thread.currentThread().setName(getClass().getSimpleName()); try { List<ComponentConfiguration> configImpls = this.m_xmlConfigurations != null ? this.m_xmlConfigurations.getConfigurations() : null; if (configImpls == null) { return null; } List<ComponentConfiguration> configs = new ArrayList<>(); configs.addAll(configImpls); if (this.m_pid == null) { this.m_configurationService.updateConfigurations(configs); } else { for (ComponentConfiguration config : configs) { if (this.m_pid.equals(config.getPid())) { this.m_configurationService.updateConfiguration(this.m_pid, config.getConfigurationProperties()); } } } } catch (KuraException e) { s_logger.error("Error updating configurations: {}", e); throw new KuraException(KuraErrorCode.CONFIGURATION_UPDATE, e); } return null; }

Target:
public Void call() throws Exception { logger.info("Updating configurations"); Thread.currentThread().setName(getClass().getSimpleName()); try { List<ComponentConfiguration> configImpls = this.xmlConfigurations != null ? this.xmlConfigurations.getConfigurations() : null; if (configImpls == null) { return null; } List<ComponentConfiguration> configs = new ArrayList<>(); configs.addAll(configImpls); if (this.pid == null) { this.configurationService.updateConfigurations(configs); } else { for (ComponentConfiguration config : configs) { if (this.pid.equals(config.getPid())) { this.configurationService.updateConfiguration(this.pid, config.getConfigurationProperties()); } } } } catch (KuraException e) { logger.error("Error updating configurations: {}", e); throw new KuraException(KuraErrorCode.CONFIGURATION_UPDATE, e); } return null; }