auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>static DataInfo getDataInfo(String storedText) { if (TextUtils.isEmpty(storedText)) { throw new NullPointerException("Text should not be null or empty"); } <START> int index = storedText.indexOf(INFO_DELIMITER, 0); <END> if (index == -1) { return getOldDataInfo(storedText); } return getNewDataInfo(storedText, index); }</code><technical_language>default, starting index is 0, stay this</technical_language>

Target:
static DataInfo getDataInfo(String storedText) { HawkUtils.checkNullOrEmpty("Text", storedText); int start = storedText.indexOf(INFO_DELIMITER); if (start == -1) { throw new IllegalArgumentException("storedText is not valid"); } String keyClass = storedText.substring(0, start); int index = storedText.indexOf(INFO_DELIMITER, ++start); if (index == -1) { throw new IllegalArgumentException("Text should contain delimiter"); } String valueClass = storedText.substring(start, index); char dataType = storedText.charAt(++index); char newVersion = storedText.charAt(++index); if (newVersion != NEW_VERSION) { throw new IllegalStateException("storedText is not valid"); } index += 2; String cipherText = storedText.substring(index); HawkUtils.checkNullOrEmpty("Cipher text", cipherText); Class<?> keyClazz = null; Class<?> valueClazz = null; if (!TextUtils.isEmpty(keyClass)) { try { keyClazz = Class.forName(keyClass); } catch (ClassNotFoundException e) { Logger.d(e.getMessage()); } } if (!TextUtils.isEmpty(valueClass)) { try { valueClazz = Class.forName(valueClass); } catch (ClassNotFoundException e) { Logger.d(e.getMessage()); } } return new DataInfo(dataType, cipherText, keyClazz, valueClazz); }
Source:
<code>public void testOnlyPostScriptContainsAPIBinding() throws InvalidScriptException { Script s = scriptWithApiBindingClient(); Script s2 = scriptWithoutApiBinding(); FlowScript fs = flowScriptWithoutApiBinding(); Mockito.when(it.getPreScript()).thenReturn(s2); Mockito.when(it.getPostScript()).thenReturn(s); Mockito.when(sec.getScript()).thenReturn(s2); Mockito.when(fe.getEnvScript()).thenReturn(s2); Mockito.when(it.getFlowScript()).thenReturn(fs); Boolean result = new CheckEligibleTaskDescriptorScript().isTaskContainsAPIBinding(etd); <START> assertEquals(true, result); <END> }</code><technical_language>assertEquals is relevant</technical_language>

Target:
public void testOnlyPostScriptContainsAPIBinding() throws InvalidScriptException { Script s = scriptWithApiBindingClient(); Script s2 = scriptWithoutApiBinding(); FlowScript fs = flowScriptWithoutApiBinding(); Mockito.when(it.getPreScript()).thenReturn(s2); Mockito.when(it.getPostScript()).thenReturn(s); Mockito.when(sec.getScript()).thenReturn(s2); Mockito.when(fe.getEnvScript()).thenReturn(s2); Mockito.when(it.getFlowScript()).thenReturn(fs); assertTrue(new CheckEligibleTaskDescriptorScript().isTaskContainsAPIBinding(etd)); }
Source:
<code>public Map<String, Set<DatastreamTask>> assign(List<Datastream> datastreams, List<String> instances, Map<String, Set<DatastreamTask>> currentAssignment) { Map<String, Set<DatastreamTask>> assignment = new HashMap<>(); for (String instance : instances) { Set<DatastreamTask> newAssignmentForInstance = new HashSet<>(); assignment.put(instance, newAssignmentForInstance); if (currentAssignment != null && currentAssignment.containsKey(instance)) { Collection<DatastreamTask> currentAssignmentForInstance = currentAssignment.get(instance); for (Datastream datastream : datastreams) { Optional<DatastreamTask> foundDatastreamTask = currentAssignmentForInstance.stream().filter(x -> x.getDatastreams().contains(datastream.getName())) .findFirst(); if (!foundDatastreamTask.isPresent()) { newAssignmentForInstance.add(new DatastreamTaskImpl(datastream)); } else { newAssignmentForInstance.add(foundDatastreamTask.get()); } } } else { <START> for (Datastream datastream : datastreams) { <END> newAssignmentForInstance.add(new DatastreamTaskImpl(datastream)); } } } return assignment; }</code><technical_language>do handle datastream source situation</technical_language>

Target:
public Map<String, Set<DatastreamTask>> assign(List<Datastream> datastreams, List<String> instances, Map<String, Set<DatastreamTask>> currentAssignment) { Map<String, Set<DatastreamTask>> assignment = new HashMap<>(); for (String instance : instances) { Set<DatastreamTask> newAssignmentForInstance = new HashSet<>(); assignment.put(instance, newAssignmentForInstance); if (currentAssignment != null && currentAssignment.containsKey(instance)) { Map<String, DatastreamTask> datastreamToTaskMap = new HashMap<>(); Collection<DatastreamTask> currentAssignmentForInstance = currentAssignment.get(instance); for(DatastreamTask datastreamTask : currentAssignmentForInstance) { datastreamTask.getDatastreams().stream().forEach(d -> datastreamToTaskMap.put(d, datastreamTask)); } for (Datastream datastream : datastreams) { DatastreamTask foundDatastreamTask = datastreamToTaskMap.get(datastream.getName()); if (foundDatastreamTask == null) { newAssignmentForInstance.add(new DatastreamTaskImpl(datastream)); } else { newAssignmentForInstance.add(foundDatastreamTask); } } } else { for (Datastream datastream : datastreams) { newAssignmentForInstance.add(new DatastreamTaskImpl(datastream)); } } } return assignment; }
Source:
<code>switch (BuildConfig.FLAVOR) { case "prod": case "beta": { DNS_SEED = new String[]{"dnsseed.dash.org"}; BIP44_PATH = DeterministicKeyChain.BIP44_ACCOUNT_ZERO_PATH; NETWORK_PARAMETERS = MainNetParams.get(); IS_PROD_BUILD = true; break; } case "_testNet3": { DNS_SEED = new String[]{"95.183.51.146", "35.161.101.35", "54.91.130.170"}; BIP44_PATH = DeterministicKeyChain.BIP44_ACCOUNT_ZERO_PATH_TESTNET; NETWORK_PARAMETERS = TestNet3Params.get(); IS_PROD_BUILD = false; break; } case "devNet": { DNS_SEED = new String[]{ "devnet-maithai.thephez.com", "34.212.238.34", "34.222.226.15", "52.25.134.163", "18.237.18.236", "54.201.32.143", "18.237.223.92", "54.187.24.244", "34.216.182.200", "54.244.102.48", "34.222.227.120", "34.222.92.227", "54.185.85.42", "34.209.237.218"}; <START> BIP44_PATH = EvolutionWalletAppKit.EVOLUTION_ACCOUNT_PATH; <END> NETWORK_PARAMETERS = DevNetParams.get("maithai", "yMtULrhoxd8vRZrsnFobWgRTidtjg2Rnjm", 20001, DNS_SEED); IS_PROD_BUILD = false; break; } default: { throw new IllegalStateException("Unsupported flavor " + BuildConfig.FLAVOR); } }</code><technical_language>This is correct. Devnet's account path Testnet for receiving/spending wallet. evolution account path for keys sign SubTxRegister, SubTxResetKey, SubTxClose transactions</technical_language>

Target:
switch (BuildConfig.FLAVOR) { case "prod": case "beta": { DNS_SEED = new String[]{"dnsseed.dash.org"}; BIP44_PATH = DeterministicKeyChain.BIP44_ACCOUNT_ZERO_PATH; NETWORK_PARAMETERS = MainNetParams.get(); IS_PROD_BUILD = true; FILENAME_NETWORK_SUFFIX = ""; WALLET_NAME_CURRENCY_CODE = "dash"; break; } case "_testNet3": { DNS_SEED = new String[]{"95.183.51.146", "35.161.101.35", "54.91.130.170"}; BIP44_PATH = DeterministicKeyChain.BIP44_ACCOUNT_ZERO_PATH_TESTNET; NETWORK_PARAMETERS = TestNet3Params.get(); IS_PROD_BUILD = false; FILENAME_NETWORK_SUFFIX = "-testnet"; WALLET_NAME_CURRENCY_CODE = "tdash"; break; } case "devNet": { DNS_SEED = new String[]{ "devnet-maithai.thephez.com", "54.187.113.35", "54.200.201.200", "34.216.233.163", "34.221.188.185", "54.189.63.67", "52.40.117.135", "54.187.111.107", "34.212.68.164", "18.237.142.23", "54.202.73.177" }; BIP44_PATH = DeterministicKeyChain.BIP44_ACCOUNT_ZERO_PATH_TESTNET; NETWORK_PARAMETERS = DevNetParams.get("maithai", "yMtULrhoxd8vRZrsnFobWgRTidtjg2Rnjm", 20001, DNS_SEED); IS_PROD_BUILD = false; FILENAME_NETWORK_SUFFIX = "-devnet"; WALLET_NAME_CURRENCY_CODE = "tdash"; break; } default: { throw new IllegalStateException("Unsupported flavor " + BuildConfig.FLAVOR); } }
Source:
<code>public GremlinServer(final Settings settings) { settings.optionalMetrics().ifPresent(GremlinServer::configureMetrics); this.settings = settings; provideDefaultForGremlinPoolSize(settings); this.isEpollEnabled = settings.useEpollEventLoop && SystemUtils.IS_OS_LINUX; if(settings.useEpollEventLoop && !SystemUtils.IS_OS_LINUX){ logger.warn("cannot use epoll in non-linux env, falling back to NIO"); } Runtime.getRuntime().addShutdownHook(new Thread(() -> this.stop().join(), SERVER_THREAD_PREFIX + "shutdown")); final ThreadFactory threadFactoryBoss = ThreadFactoryUtil.create("boss-%d"); if(isEpollEnabled){ bossGroup = new EpollEventLoopGroup(settings.threadPoolBoss, threadFactoryBoss); } else { bossGroup = new NioEventLoopGroup(settings.threadPoolBoss, threadFactoryBoss); } final ThreadFactory threadFactoryWorker = ThreadFactoryUtil.create("worker-%d"); if(isEpollEnabled) { workerGroup = new EpollEventLoopGroup(settings.threadPoolWorker, threadFactoryWorker); }else { workerGroup = new NioEventLoopGroup(settings.threadPoolWorker, threadFactoryWorker); } <START> serverGremlinExecutor = new ServerGremlinExecutor(settings, null, workerGroup, null); <END> gremlinExecutorService = serverGremlinExecutor.getGremlinExecutorService(); OpLoader.init(settings); }</code><technical_language>4th parameter is longer needed. PR targets master/, fine remove altogether, no</technical_language>

Target:
public GremlinServer(final Settings settings) { settings.optionalMetrics().ifPresent(GremlinServer::configureMetrics); this.settings = settings; provideDefaultForGremlinPoolSize(settings); this.isEpollEnabled = settings.useEpollEventLoop && SystemUtils.IS_OS_LINUX; if(settings.useEpollEventLoop && !SystemUtils.IS_OS_LINUX){ logger.warn("cannot use epoll in non-linux env, falling back to NIO"); } Runtime.getRuntime().addShutdownHook(new Thread(() -> this.stop().join(), SERVER_THREAD_PREFIX + "shutdown")); final ThreadFactory threadFactoryBoss = ThreadFactoryUtil.create("boss-%d"); if(isEpollEnabled){ bossGroup = new EpollEventLoopGroup(settings.threadPoolBoss, threadFactoryBoss); } else { bossGroup = new NioEventLoopGroup(settings.threadPoolBoss, threadFactoryBoss); } final ThreadFactory threadFactoryWorker = ThreadFactoryUtil.create("worker-%d"); if(isEpollEnabled) { workerGroup = new EpollEventLoopGroup(settings.threadPoolWorker, threadFactoryWorker); }else { workerGroup = new NioEventLoopGroup(settings.threadPoolWorker, threadFactoryWorker); } serverGremlinExecutor = new ServerGremlinExecutor(settings, null, workerGroup); gremlinExecutorService = serverGremlinExecutor.getGremlinExecutorService(); OpLoader.init(settings); }
Source:
<code><START> List<Long> query(String queryString, int maxResults) { <END> LOGGER.debug(queryString); SolrQuery query = new SolrQuery(queryString).setRows(maxResults); QueryResponse rsp; try { rsp = server.query(query); } catch (SolrServerException e) { throw new IndexException("Could not read Question from index", e); } SolrDocumentList docs = rsp.getResults(); List<Long> ids = new ArrayList<>(); for (SolrDocument doc : docs) { ids.add(Long.parseLong((String) doc.getFieldValue("id"))); } return ids; }</code><technical_language>this</technical_language>

Target:
private List<Long> query(String queryString, int maxResults) { LOGGER.debug(queryString); SolrQuery query = new SolrQuery(queryString).setRows(maxResults); QueryResponse rsp; try { rsp = server.query(query); } catch (SolrServerException e) { throw new IndexException("Could not read Question from index", e); } SolrDocumentList docs = rsp.getResults(); List<Long> ids = new ArrayList<>(); for (SolrDocument doc : docs) { ids.add(Long.parseLong((String) doc.getFieldValue("id"))); } return ids; }
Source:
<code>public List<IMethodInstance> intercept(List<IMethodInstance> methods, ITestContext context) { Comparator<IMethodInstance> compareByPackage = (IMethodInstance m1, IMethodInstance m2) -> { int val = 0; String p1 = getPackageName(m1); String p2 = getPackageName(m2); val = p1.compareTo(p2); val -= packagePriorityOffset(p1); <START> val += packagePriorityOffset(p2); <END> return val; }; Comparator<IMethodInstance> compareByClassPriority = Comparator.comparing((IMethodInstance m) -> getClassPriority(m)); Comparator<IMethodInstance> compareByClassName = Comparator.comparing((IMethodInstance m) -> getClassName(m)); Comparator<IMethodInstance> compareByMethodPriority = Comparator.comparing((IMethodInstance m) -> getMethodPriority(m)); Comparator<IMethodInstance> comparator = compareByPackage.thenComparing(compareByClassPriority) .thenComparing(compareByClassName) .thenComparing(compareByMethodPriority); IMethodInstance[] array = methods.toArray(new IMethodInstance[methods .size()]); Arrays.sort(array, comparator); return Arrays.asList(array); }</code><technical_language>combined; in fact remove usage of explicit variable val way</technical_language>

Target:
public List<IMethodInstance> intercept(List<IMethodInstance> methods, ITestContext context) { Comparator<IMethodInstance> compareByPackage = (m1, m2) -> { String p1 = getPackageName(m1); String p2 = getPackageName(m2); return p1.compareTo(p2) - getPackagePriority(p1) + getPackagePriority(p2); }; Comparator<IMethodInstance> comparator = compareByPackage .thenComparing(m -> getClassPriority(m)) .thenComparing(m -> getClassName(m)) .thenComparing(m -> getMethodPriority(m)); methods.sort(comparator); return methods; }
Source:
<code>public HDFSTransactionLogReaderV2(SequenceFile.Reader reader) { super(reader); this.transactionEdits = new ArrayDeque<>(); this.key = new LongWritable(); this.rawKey = new DataOutputBuffer(); this.value = new ByteArrayOutputStream(Integer.SIZE); <START> this.outputStream = new DataOutputStream(value); <END> }</code><technical_language>Naming outputStream valueDataStream readability, right</technical_language>

Target:
public HDFSTransactionLogReaderV2(SequenceFile.Reader reader) { this.reader = reader; this.transactionEdits = new ArrayDeque<>(); this.key = new LongWritable(); this.commitMarkerCodec = new CommitMarkerCodec(); }
Source:
<code><T extends ParseObject> List<T> convertFindResponse(ParseQuery.State<T> state, JSONObject response) throws JSONException { ArrayList<T> answer = new ArrayList<>(); JSONArray results = response.getJSONArray("results"); if (results == null) { PLog.d(TAG, "null results in find response"); } else { String resultClassName = response.optString("className", null); if (resultClassName == null) { resultClassName = state.className(); } boolean isSubset = state.selectedKeys() != null; JSONArray selectedKeys = isSubset ? new JSONArray(state.selectedKeys()) : null; for (int i = 0; i < results.length(); ++i) { JSONObject data = results.getJSONObject(i); <START> if (isSubset) data.put(ParseObject.KEY_SELECTED_KEYS, selectedKeys); <END> T object = ParseObject.fromJSON(data, resultClassName, !isSubset); answer.add(object); ParseQuery.RelationConstraint relation = (ParseQuery.RelationConstraint) state.constraints().get("$relatedTo"); if (relation != null) { relation.getRelation().addKnownObject(object); } } } return answer; }</code><technical_language>Yep :)</technical_language>

Target:
<T extends ParseObject> List<T> convertFindResponse(ParseQuery.State<T> state, JSONObject response) throws JSONException { ArrayList<T> answer = new ArrayList<>(); JSONArray results = response.getJSONArray("results"); if (results == null) { PLog.d(TAG, "null results in find response"); } else { String resultClassName = response.optString("className", null); if (resultClassName == null) { resultClassName = state.className(); } for (int i = 0; i < results.length(); ++i) { JSONObject data = results.getJSONObject(i); T object = ParseObject.fromJSON(data, resultClassName, ParseDecoder.get(), state.selectedKeys()); answer.add(object); ParseQuery.RelationConstraint relation = (ParseQuery.RelationConstraint) state.constraints().get("$relatedTo"); if (relation != null) { relation.getRelation().addKnownObject(object); } } } return answer; }
Source:
<code>private void validateReplacements(String config) { Pattern pattern = Pattern.compile("\\$\\{(\\d+)}"); Matcher partsMatcher = pattern.matcher(getString(config)); String dir = partsMatcher.replaceAll("").replace("${topic}", ""); <START> Pattern invalid = Pattern.compile("\\$\\{.*}"); <END> Matcher invalidMatcher = invalid.matcher(dir); if (invalidMatcher.find()) { throw new ConfigException( String.format( "%s: %s contains an invalid ${} substitution %s", config, getString(config), invalidMatcher.group() ) ); } }</code><technical_language>nit: patterns private static final reused</technical_language>

Target:
private void validateReplacements(String config) { Matcher partsMatcher = SUBSTITUTION_PATTERN.matcher(getString(config)); String dir = partsMatcher.replaceAll("").replace("${topic}", ""); Matcher invalidMatcher = INVALID_SUB_PATTERN.matcher(dir); if (invalidMatcher.find()) { throw new ConfigException( String.format( "%s: %s contains an invalid ${} substitution %s. Valid substitutions are ${topic} " + "and ${n} where n >= 0.", config, getString(config), invalidMatcher.group() ) ); } }
Source:
<code>protected Object doExecute() throws Exception { printInitCommand("Removing all actions of the queue"); try { IResourceManager resourceManager = getResourceManager(); String[] argsRouterName = new String[2]; argsRouterName = splitResourceName(resourceId); IResourceIdentifier resourceIdentifier = null; resourceIdentifier = resourceManager.getIdentifierFromResourceName(argsRouterName[0], argsRouterName[1]); if (resourceIdentifier == null) { printError("Could not get resource with name: " + argsRouterName[0] + ":" + argsRouterName[1]); printEndCommand(); return -1; } <START> IResource resource = resourceManager.getResource(resourceIdentifier); <END> validateResource(resource); ICapability queue = getCapability(resource.getCapabilities(), QueueManager.QUEUE); if (queue == null) { printError("Could not found capability " + QueueManager.QUEUE + " in resource " + resourceId); return -1; } List<IAction> listActions = (List<IAction>) queue.sendMessage(QueueConstants.GETQUEUE, null); int numActions = listActions.size(); for (int i = 0; i < numActions; i++) { ModifyParams params = ModifyParams.newRemoveOperation(0); Response resp = (Response) queue.sendMessage(QueueConstants.MODIFY, params); } printInfo("Removed " + numActions + " actions from the queue"); } catch (Exception e) { printError(e.getMessage()); printEndCommand(); return -1; } printEndCommand(); return null; }</code><technical_language>get resource, a method in GenericKarafCommand useful: getResourceFromFriendlyId similar. ;)</technical_language>

Target:
protected Object doExecute() throws Exception { printInitCommand("Removing all actions of the queue"); try { IResource resource = getResourceFromFriendlyName(resourceId); validateResource(resource); QueueManager queue = (QueueManager) getCapability(resource.getCapabilities(), QueueManager.QUEUE); queue.empty(); printInfo("Removed all actions from the queue"); } catch (Exception e) { printError(e.getMessage()); printEndCommand(); return -1; } printEndCommand(); return null; }
Source:
<code>public int run() throws Exception { SitePaths sitePaths = new SitePaths(getSitePath()); File newSecureStoreFile = new File(newSecureStoreLib); if (!newSecureStoreFile.exists()) { throw new RuntimeException(String.format("File %s doesn't exists", newSecureStoreFile.getAbsolutePath())); } String newSecureStore = getNewSecureStoreClassName(newSecureStoreFile); String currentSecureStoreName = getCurrentSecureStoreClassName(sitePaths); if (currentSecureStoreName.equals(newSecureStore)) { <START> log.error( "Old and new SecureStore implementation names are the same. Migration will not work"); <END> return -1; } IoUtil.loadJARs(newSecureStoreFile); SiteLibraryLoaderUtil.loadSiteLib(sitePaths.lib_dir); log.info("Current secureStoreClass property ({}) will be replaced with {}", currentSecureStoreName, newSecureStore); Injector dbInjector = createDbInjector(SINGLE_USER); SecureStore currentStore = getSecureStore(currentSecureStoreName, dbInjector); SecureStore newStore = getSecureStore(newSecureStore, dbInjector); migrateProperties(currentStore, newStore); removeOldLib(sitePaths, currentSecureStoreName); copyNewLib(sitePaths, newSecureStoreFile); updateGerritConfig(sitePaths, newSecureStore); return 0; }</code><technical_language>Wrapping this line shorter. split string. log.error("Old new SecureStore implementation names " + "are same. Migration work");</technical_language>

Target:
public int run() throws Exception { SitePaths sitePaths = new SitePaths(getSitePath()); File newSecureStoreFile = new File(newSecureStoreLib); if (!newSecureStoreFile.exists()) { throw new RuntimeException(String.format("File %s doesn't exists", newSecureStoreFile.getAbsolutePath())); } String newSecureStore = getNewSecureStoreClassName(newSecureStoreFile); String currentSecureStoreName = getCurrentSecureStoreClassName(sitePaths); if (currentSecureStoreName.equals(newSecureStore)) { log.error("Old and new SecureStore implementation names " + "are the same. Migration will not work"); return -1; } IoUtil.loadJARs(newSecureStoreFile); SiteLibraryLoaderUtil.loadSiteLib(sitePaths.lib_dir); log.info("Current secureStoreClass property ({}) will be replaced with {}", currentSecureStoreName, newSecureStore); Injector dbInjector = createDbInjector(SINGLE_USER); SecureStore currentStore = getSecureStore(currentSecureStoreName, dbInjector); SecureStore newStore = getSecureStore(newSecureStore, dbInjector); migrateProperties(currentStore, newStore); removeOldLib(sitePaths, currentSecureStoreName); copyNewLib(sitePaths, newSecureStoreFile); updateGerritConfig(sitePaths, newSecureStore); return 0; }
Source:
<code>public void testParseEncoding_ISO8859_1_encoding() { Charset result = RawParseUtils.parseEncoding("encoding ISO-8859-1\n" <START> .getBytes()); <END> assertNotNull(result); }</code><technical_language>rely JRE platform encoding here. a specific encoding, Constants.encodeASCII(). This applies other getBytes calls below</technical_language>

Target:
public void testParseEncoding_ISO8859_1_encoding() { Charset result = RawParseUtils.parseEncoding(Constants .encodeASCII("encoding ISO-8859-1\n")); assertNotNull(result); }
Source:
<code>public void testAddMavenDescriptorNotAddedPerDefault() throws Exception { File basedir = getBasedir("projects/addMavenDescriptorDefault"); File platform = new File("src/test/resources/eclipse"); List<MavenProject> projects = getSortedProjects(basedir, platform); MavenProject project = getProject(projects, "addMavenDescriptorDefault"); PackageFeatureMojo mojo = (PackageFeatureMojo) lookupMojo("package-feature", project.getFile()); setVariableValueToObject(mojo, "project", project); setVariableValueToObject(mojo, "session", newMavenSession(project, projects)); setVariableValueToObject(mojo, "finalName", "feature"); mojo.execute(); ZipFile zip = new ZipFile(new File(basedir, "target/feature.jar")); ZipEntry entry = zip.getEntry("META-INF/maven"); assertNull("No 'META-INF/maven/' entry must be in the feature.jar!", entry); <START> zip.close(); <END> }</code><technical_language>close() in finally block</technical_language>

Target:
public void testAddMavenDescriptorNotAddedPerDefault() throws Exception { File basedir = getBasedir("projects/addMavenDescriptor/featureDefault/"); File platform = new File("src/test/resources/eclipse"); List<MavenProject> projects = getSortedProjects(basedir, platform); MavenProject project = getProject(projects, "featureDefault"); PackageFeatureMojo mojo = (PackageFeatureMojo) lookupMojo("package-feature", project.getFile()); setVariableValueToObject(mojo, "project", project); setVariableValueToObject(mojo, "session", newMavenSession(project, projects)); mojo.execute(); ZipFile zip = new ZipFile(new File(basedir, "target/featureDefault.jar")); try { ZipEntry entry = zip.getEntry("META-INF/maven"); assertNull("No 'META-INF/maven/' entry must be in the feature.jar!", entry); } finally { zip.close(); } }
Source:
<code>public void initialize() throws SchedulerConfigException { executorService = new ThreadPoolExecutor(10, count, 60L, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(queueSize), new SchedulerThreadFactory(this), new <START> BlockedRejectedExecutionHandler(log)); <END> }</code><technical_language>suggest this configurable well, blocking default anyhow</technical_language>

Target:
public void initialize() throws SchedulerConfigException { executorService = new ThreadPoolExecutor(10, count, 60L, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(queueSize), new SchedulerThreadFactory(this), isBlockIfFull() ? new BlockedRejectedExecutionHandler(log) : new ThreadPoolExecutor.AbortPolicy()); }
Source:
<code>public void setupMqtt() throws MqttException { if (preferences.isMqttEnabled()) { if (!preferences.getMqttUser().equals("") && !preferences.getMqttPass().equals("") && !preferences.getMqttEndpoint().equals("")) { MqttConnectOptions mqttOptions = new MqttConnectOptions(); <START> mqttOptions.setCleanSession(true); <END> mqttOptions.setKeepAliveInterval(150000); mqttOptions.setUserName(preferences.getMqttUser()); mqttOptions.setPassword(preferences.getMqttPass().toCharArray()); String androidId = Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID); MemoryPersistence dataStore = new MemoryPersistence(); MqttClient client = new MqttClient(preferences.getMqttEndpoint(), androidId, dataStore); MqttPinger pinger = new AndroidMqttPinger(getApplicationContext(), 0, client, 150000); MqttTimer timer = new AndroidMqttTimer(getApplicationContext(), 0); mqttManager = new MqttEventMgr(client, mqttOptions, pinger, timer, reporter); mqttManager.connect(); mSyncButton.setBackgroundResource(R.drawable.ic_cloud); } } }</code><technical_language>this change</technical_language>

Target:
public void setupMqtt() throws MqttException { if (preferences.isMqttEnabled()) { if (!preferences.getMqttUser().equals("") && !preferences.getMqttPass().equals("") && !preferences.getMqttEndpoint().equals("")) { MqttConnectOptions mqttOptions = new MqttConnectOptions(); mqttOptions.setCleanSession(false); mqttOptions.setKeepAliveInterval(150000); mqttOptions.setUserName(preferences.getMqttUser()); mqttOptions.setPassword(preferences.getMqttPass().toCharArray()); String androidId = Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID); MemoryPersistence dataStore = new MemoryPersistence(); MqttClient client = new MqttClient(preferences.getMqttEndpoint(), androidId, dataStore); MqttPinger pinger = new AndroidMqttPinger(getApplicationContext(), 0, client, 150000); MqttTimer timer = new AndroidMqttTimer(getApplicationContext(), 0); mqttManager = new MqttEventMgr(client, mqttOptions, pinger, timer, reporter); mqttManager.connect(); mSyncButton.setBackgroundResource(R.drawable.ic_cloud); } } }
Source:
<code>public EclipseReferencePointManager() { referencePointToProjectMapper = <START> new ConcurrentHashMap<IReferencePoint, org.eclipse.core.resources.IProject>(); <END> }</code><technical_language>please Diamond Operator for initialization</technical_language>

Target:
public EclipseReferencePointManager() { referencePointToProjectMapper = new ConcurrentHashMap<>(); }
Source:
<code>public void edit(final HostBondInterfaceModel object) { super.edit(object); info.setVisible(false); message.setVisible(false); <START> checkConnectivity.setVisible(false); <END> commitChanges.setVisible(false); layoutPanel.remove(infoPanel); layoutPanel.setWidgetSize(mainPanel, 300); asPopupPanel().setPixelSize(400, 400); }</code><technical_language>Redundant, getCheckConnectivity().setIsAvailable(false) in SetupNetworksBondPopupView</technical_language>

Target:
public void edit(final HostBondInterfaceModel object) { super.edit(object); info.setVisible(false); message.setVisible(false); layoutPanel.remove(infoPanel); layoutPanel.setWidgetSize(mainPanel, 300); asPopupPanel().setPixelSize(400, 400); }
Source:
<code>String buildBulkImportSessionName(PluginTask task, ExecSession exec) { if (task.getSession().isPresent()) { return task.getSession().get(); } else { Timestamp time = exec.getTransactionTime(); return String.format("embulk_%s_%09d_%s", <START> DateTimeFormatter.ofPattern("yyyyMMdd_HHmmss").withZone(ZoneId.of("UTC")).format(time.getInstant()), <END> time.getNano(), UUID.randomUUID().toString().replace('-', '_')); } }</code><technical_language>ZoneId.of("UTC") ZoneOffset.UTC</technical_language>

Target:
String buildBulkImportSessionName(PluginTask task, ExecSession exec) { if (task.getSession().isPresent()) { return task.getSession().get(); } else { Timestamp time = exec.getTransactionTime(); final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyyMMdd_HHmmss") .withZone(ZoneOffset.UTC); return String.format("embulk_%s_%09d_%s", dateTimeFormatter.format(time.getInstant()), time.getNano(), UUID.randomUUID().toString().replace('-', '_')); } }
Source:
<code>public boolean showMuteOverlayOnVideoCall() { if (carrierConfig == null) { return true; } return <START> carrierConfig.getBoolean(CarrierConfigManager.KEY_VIDEO_CALL_MUTE_OVERLAY_VISIBLE_BOOL); <END> }</code><technical_language>This defaults false. key is new missing older platforms. getBoolean(String, boolean) instead</technical_language>

Target:
public boolean showMuteOverlayOnVideoCall() { if (carrierConfig == null) { return true; } return carrierConfig.getBoolean( CarrierConfigManager.KEY_VIDEO_CALL_MUTE_OVERLAY_VISIBLE_BOOL, true); }
Source:
<code>public final void setBool(boolean reverse, IntsRef ref, boolean value) { if (store2DirectedValues && reverse) { int flags = ref.ints[bwdDataIndex + ref.offset]; flags &= ~bwdMask; if (value) flags = flags | (1 << bwdShift); ref.ints[bwdDataIndex + ref.offset] = flags; } else { int flags = ref.ints[fwdDataIndex + ref.offset]; flags &= ~fwdMask; if (value) flags = flags | (1 << fwdShift); ref.ints[fwdDataIndex + ref.offset] = flags; <START> } <END> }</code><technical_language>if else branch pretty similar, combine in function</technical_language>

Target:
public final void setBool(boolean reverse, IntsRef ref, boolean value) { if (storeBothDirections && reverse) { int flags = ref.ints[bwdDataIndex + ref.offset]; flags &= ~bwdMask; if (value) flags = flags | (1 << bwdShift); ref.ints[bwdDataIndex + ref.offset] = flags; } else { int flags = ref.ints[fwdDataIndex + ref.offset]; flags &= ~fwdMask; if (value) flags = flags | (1 << fwdShift); ref.ints[fwdDataIndex + ref.offset] = flags; } }
Source:
<code>public EventHubConsumer createConsumer(String consumerGroup, String partitionId, EventPosition eventPosition, EventHubConsumerOptions options) { Objects.requireNonNull(eventPosition); Objects.requireNonNull(options); if (ImplUtils.isNullOrEmpty(consumerGroup)) { throw new IllegalArgumentException("'partitionId' cannot be null or empty."); } if (ImplUtils.isNullOrEmpty(consumerGroup)) { throw new IllegalArgumentException("'partitionId' cannot be null or empty."); <START> } <END> final EventHubConsumerOptions clonedOptions = options.clone(); if (clonedOptions.scheduler() == null) { clonedOptions.scheduler(connectionOptions.scheduler()); } if (clonedOptions.retry() == null) { clonedOptions.retry(connectionOptions.retryPolicy()); } final String linkName = StringUtil.getRandomString("PR"); final String entityPath = String.format(Locale.US, RECEIVER_ENTITY_PATH_FORMAT, eventHubPath, consumerGroup, partitionId); final Mono<AmqpReceiveLink> receiveLinkMono = connectionMono.flatMap(connection -> connection.createSession(entityPath)) .cast(EventHubSession.class) .flatMap(session -> { final Long priority = options.ownerLevel().isPresent() ? options.ownerLevel().get() : null; return session.createConsumer(linkName, entityPath, eventPosition.getExpression(), connectionOptions.timeout(), clonedOptions.retry(), priority, options.identifier()); }) .cast(AmqpReceiveLink.class); return new EventHubConsumer(receiveLinkMono, clonedOptions, connectionOptions.timeout()); }</code><technical_language>Copy/paste issues here? checking for ConsumerGroup in if blocks throwing error for partitionId</technical_language>

Target:
public EventHubConsumer createConsumer(String consumerGroup, String partitionId, EventPosition eventPosition, EventHubConsumerOptions options) { Objects.requireNonNull(eventPosition); Objects.requireNonNull(options); if (ImplUtils.isNullOrEmpty(consumerGroup)) { throw new IllegalArgumentException("'consumerGroup' cannot be null or empty."); } if (ImplUtils.isNullOrEmpty(partitionId)) { throw new IllegalArgumentException("'partitionId' cannot be null or empty."); } final EventHubConsumerOptions clonedOptions = options.clone(); if (clonedOptions.scheduler() == null) { clonedOptions.scheduler(connectionOptions.scheduler()); } if (clonedOptions.retry() == null) { clonedOptions.retry(connectionOptions.retryPolicy()); } final String linkName = StringUtil.getRandomString("PR"); final String entityPath = String.format(Locale.US, RECEIVER_ENTITY_PATH_FORMAT, eventHubPath, consumerGroup, partitionId); final Mono<AmqpReceiveLink> receiveLinkMono = connectionMono.flatMap(connection -> connection.createSession(entityPath)) .cast(EventHubSession.class) .flatMap(session -> { return session.createConsumer(linkName, entityPath, eventPosition.getExpression(), connectionOptions.timeout(), clonedOptions.retry(), options.ownerLevel(), options.identifier()); }) .cast(AmqpReceiveLink.class); return new EventHubConsumer(receiveLinkMono, clonedOptions, connectionOptions.timeout()); }
Source:
<code>public JsonElement serialize(JsonSerializationContext context) { JsonObject serialized = context.serialize(flag).getAsJsonObject(); serialized.add("body", serialized.remove("comment")); if (flag.getUserProfileId() != null) { <START> serialized.remove("userProfileID"); <END> serialized.add("creator", context.serialize(new UserIdView(flag.getUserProfileId()))); } serialized.add("flaggedComment", context.serialize(flaggedComment)); return serialized; }</code><technical_language>I this line serialized.remove("userProfileID") if() block</technical_language>

Target:
public JsonElement serialize(JsonSerializationContext context) { JsonObject serialized = context.serialize(flag).getAsJsonObject(); serialized.add("body", serialized.remove("comment")); serialized.remove("userProfileID"); if (flag.getUserProfileId() != null) { serialized.add("creator", context.serialize(new UserIdView(flag.getUserProfileId()))); } serialized.add("flaggedComment", context.serialize(flaggedComment)); return serialized; }
Source:
<code>public void testOptimizedCreateStandardSyncTasks() { List<TreeResponse> treeResponses = Arrays.asList(treeResponse(addr1, range1, "one", range2, "one"), treeResponse(addr2, range1, "one", range2, "two"), treeResponse(addr3, range1, "three", range2, "two")); Map<SyncNodePair, SyncTask> tasks = toMap(RepairJob.createOptimisedSyncingSyncTasks(desc, treeResponses, addr4, noTransient(), addr -> "DC1", false, PreviewKind.ALL)); assertEquals(Arrays.asList(range1), tasks.get(pair(addr1, addr3)).rangesToSync); <START> assertEquals(Arrays.asList(range2), tasks.get(pair(addr1, addr2)).rangesToSync); <END> assertEquals(Arrays.asList(range1), tasks.get(pair(addr2, addr3)).rangesToSync); assertEquals(Arrays.asList(range2), tasks.get(pair(addr2, addr1)).rangesToSync); assertEquals(Arrays.asList(range1), tasks.get(pair(addr3, addr2)).rangesToSync); assertEquals(Arrays.asList(range2), tasks.get(pair(addr3, addr1)).rangesToSync); }</code><technical_language>this assert depends iteration order in <LINK_0> - option stream hosts, pick fewest outgoing streams, if chance added a outgoing streams addr2 this, sync range2 addr3 instead assert addr1 range2 addr2 addr3 (but both) instead</technical_language>

Target:
public void testOptimizedCreateStandardSyncTasks() { List<TreeResponse> treeResponses = Arrays.asList(treeResponse(addr1, range1, "one", range2, "one"), treeResponse(addr2, range1, "one", range2, "two"), treeResponse(addr3, range1, "three", range2, "two")); Map<SyncNodePair, SyncTask> tasks = toMap(RepairJob.createOptimisedSyncingSyncTasks(desc, treeResponses, addr4, noTransient(), addr -> "DC1", false, PreviewKind.ALL)); for (SyncTask task : tasks.values()) assertTrue(task instanceof AsymmetricRemoteSyncTask); assertEquals(Arrays.asList(range1), tasks.get(pair(addr1, addr3)).rangesToSync); assertStreamRangeFromEither(tasks, Arrays.asList(range2), addr1, addr2, addr3); assertEquals(Arrays.asList(range1), tasks.get(pair(addr2, addr3)).rangesToSync); assertEquals(Arrays.asList(range2), tasks.get(pair(addr2, addr1)).rangesToSync); assertStreamRangeFromEither(tasks, Arrays.asList(range1), addr3, addr2, addr1); assertEquals(Arrays.asList(range2), tasks.get(pair(addr3, addr1)).rangesToSync); }
Source:
<code><START> public boolean tableExists(String tableName) throws IOException { <END> boolean retval = false; final Scan scan = new Scan() .addColumn(mFamilyBytes, QUALIFIER_LAYOUT_BYTES) .setMaxVersions(1); final ResultScanner resultScanner = mTable.getScanner(scan); for (Result result : resultScanner) { if (tableName.equals(Bytes.toString(result.getRow()))) { retval = true; break; } } resultScanner.close(); return retval; }</code><technical_language>Ditto this (obviously)</technical_language>

Target:
public boolean tableExists(String tableName) throws IOException { boolean retval = false; final Scan scan = new Scan() .addColumn(mFamilyBytes, QUALIFIER_LAYOUT_BYTES) .setMaxVersions(1); ResultScanner resultScanner = null; try { resultScanner = mTable.getScanner(scan); for (Result result : resultScanner) { if (tableName.equals(Bytes.toString(result.getRow()))) { retval = true; break; } } } finally { if (null != resultScanner) { resultScanner.close(); } } return retval; }
Source:
<code>public static String getAppConfigFolder(String appName) { Path configRoot = null; String osName = System.getProperty("os.name"); if ("Mac OS X".equals(osName)) { configRoot = Paths.get(System.getProperty("user.home"), "Library", "Java"); } else if (osName.startsWith("Windows")) { try { configRoot = Paths.get(System.getenv("APPDATA")); <START> if (configRoot != null) { <END> configRoot = configRoot.resolve("Sun").resolve("Java"); } } catch (SecurityException e) { } } if (configRoot == null) { configRoot = Paths.get(System.getProperty("user.home"), ".config"); } return configRoot.resolve(appName).toString(); }</code><technical_language>configRoot is null. get a NullPointerException if System.getenv("APPDATA") returns null</technical_language>

Target:
public static String getAppConfigFolder(String appName) { Path configRoot = null; String osName = System.getProperty("os.name"); if ("Mac OS X".equals(osName)) { configRoot = Paths.get(System.getProperty("user.home"), "Library", "Java"); } else if (osName.startsWith("Windows")) { try { String appData = System.getenv("APPDATA"); if (appData != null) { configRoot = Paths.get(appData).resolve("Sun").resolve("Java"); } } catch (SecurityException e) { } } if (configRoot == null) { configRoot = Paths.get(System.getProperty("user.home"), ".config"); } return configRoot.resolve(appName).toString(); }
Source:
<code>private UserAndRoleMap fetchUserAndRoleMapFromCoordinator(String prefix, boolean isInit) { try { return RetryUtils.retry( () -> { return tryFetchMapsFromCoordinator(prefix); }, e -> true, commonCacheConfig.getMaxSyncRetries() ); } catch (Exception e) { LOG.makeAlert(e, "Encountered exception while fetching user and role map for authorizer [%s]", prefix); if (isInit) { if (commonCacheConfig.getCacheDirectory() != null) { try { LOG.info("Attempting to load user map snapshot from disk."); return loadUserAndRoleMapFromDisk(prefix); } catch (Exception e2) { <START> LOG.makeAlert(e2, "Encountered exception while loading user-role map snapshot for authorizer [%s]", prefix); <END> } } } return null; } }</code><technical_language>Please add e e2</technical_language>

Target:
private UserAndRoleMap fetchUserAndRoleMapFromCoordinator(String prefix, boolean isInit) { try { return RetryUtils.retry( () -> { return tryFetchMapsFromCoordinator(prefix); }, e -> true, commonCacheConfig.getMaxSyncRetries() ); } catch (Exception e) { LOG.makeAlert(e, "Encountered exception while fetching user and role map for authorizer [%s]", prefix); if (isInit) { if (commonCacheConfig.getCacheDirectory() != null) { try { LOG.info("Attempting to load user map snapshot from disk."); return loadUserAndRoleMapFromDisk(prefix); } catch (Exception e2) { e2.addSuppressed(e); LOG.makeAlert(e2, "Encountered exception while loading user-role map snapshot for authorizer [%s]", prefix); } } } return null; } }
Source:
<code>public void onValueChanged(final Consumer<Event> onValueChanged) { input.onkeyup = null; <START> input.onkeyup = event -> { <END> onValueChanged.accept(event); return this; }; }</code><technical_language>Is this step handler change needed avoid some memory leak? enough assign new value</technical_language>

Target:
public void onValueChanged(final Consumer<Event> onValueChanged) { input.onkeyup = event -> { onValueChanged.accept(event); return this; }; }
Source:
<code>public void verifyViewAndViewIndexes() throws SQLException { ResultSet rs = conn.createStatement().executeQuery(VIEWS_QUERY); int countViews = -1, indexCount = -1; <START> while(rs.next()) { <END> countViews = rs.getInt(1); } Assert.assertEquals("view count in system table doesn't match", 2, countViews); rs = conn.createStatement().executeQuery(String.format(VIEW_INDEX_QUERY, "MOCK1_VIEW")); while (rs.next()) { indexCount = rs.getInt(1); } Assert.assertEquals("view-index count in system table doesn't match",1, indexCount); rs = conn.createStatement().executeQuery(String.format(VIEW_INDEX_QUERY, "MOCK1_VIEW1")); while (rs.next()) { indexCount = rs.getInt(1); } Assert.assertEquals("view-index count in system table doesn't match", 2, indexCount); }</code><technical_language>nit: if (rs.next()) is better? technically more 1 once, SELECT COUNT</technical_language>

Target:
public void verifyViewAndViewIndexes() throws SQLException { String tableName = "MOCK1"; String schemaName = "TEST"; String viewQuery = iut.getViewSql(tableName, schemaName); ResultSet rs = conn.createStatement().executeQuery(viewQuery); int countViews = 0; List<String> views = new ArrayList<>(); List<Integer> indexCount = new ArrayList<>(); while (rs.next()) { views.add(rs.getString(1)); countViews++; } Assert.assertEquals("view count in system table doesn't match", 2, countViews); for (int i=0; i < views.size(); i++) { String viewName = SchemaUtil.getTableNameFromFullName(views.get(i)); String viewIndexQuery = iut.getViewIndexesSql(viewName, schemaName, null); rs = conn.createStatement().executeQuery(viewIndexQuery); int indexes = 0; while (rs.next()) { indexes++; } indexCount.add(indexes); } Assert.assertEquals(VERIFY_COUNT_ASSERT_MESSAGE, 1, (int) indexCount.get(0)); Assert.assertEquals(VERIFY_COUNT_ASSERT_MESSAGE, 2, (int) indexCount.get(1)); }
Source:
<code>public static void main(String[] args) { final long seed = 0; final boolean showTables = false; final CloudSim simulation0 = new CloudSim(); <START> UniformDistr random0 = new UniformDistr(0, 1, seed); <END> final DatacenterBrokerHeuristic broker0 = createHeuristicBroker(simulation0, random0); new DatacenterBrokersMappingComparison(broker0, random0, showTables); final CloudSim simulation1 = new CloudSim(); UniformDistr random1 = new UniformDistr(0, 1, seed); final DatacenterBroker broker1 = new DatacenterBrokerBestFit(simulation1); new DatacenterBrokersMappingComparison(broker1, random1, showTables); final CloudSim simulation2 = new CloudSim(); UniformDistr random2 = new UniformDistr(0, 1, seed); final DatacenterBroker broker2 = new DatacenterBrokerSimple(simulation2); new DatacenterBrokersMappingComparison(broker2, random2, showTables); }</code><technical_language>suggestion final UniformDistr random0 = new UniformDistr(0, 1, seed);</technical_language>

Target:
public static void main(String[] args) { System.out.println("Starting comparison..."); final long seed = System.currentTimeMillis(); final boolean verbose = false; final CloudSim simulation0 = new CloudSim(); final UniformDistr random0 = new UniformDistr(0, 1, seed); final DatacenterBrokerHeuristic broker0 = createHeuristicBroker(simulation0, random0); new DatacenterBrokersMappingComparison(broker0, random0, verbose); final CloudSim simulation1 = new CloudSim(); final UniformDistr random1 = new UniformDistr(0, 1, seed); final DatacenterBroker broker1 = new DatacenterBrokerBestFit(simulation1); new DatacenterBrokersMappingComparison(broker1, random1, verbose); final CloudSim simulation2 = new CloudSim(); final UniformDistr random2 = new UniformDistr(0, 1, seed); final DatacenterBroker broker2 = new DatacenterBrokerSimple(simulation2); new DatacenterBrokersMappingComparison(broker2, random2, verbose); System.out.println("Comparison finished!"); }
Source:
<code>private void setupAria() { if (!isAriaScanEnabled(operatorContext.getSession()) || columns.isEmpty()) { return; } int[] channels = new int[columns.size()]; for (int i = 0; i < channels.length; i++) { channels[i] = i; } PageSourceOptions options = new PageSourceOptions( channels, channels, reusePages, <START> new PageSourceOptions.FilterFunction[0], <END> false, 512 * 1024, ariaFlags(operatorContext.getSession())); source.pushdownFilterAndProjection(options); }</code><technical_language>nit: import PageSourceOptions.FilterFunction this new FilterFunction[0]</technical_language>

Target:
private void setupAria() { if (!isAriaScanEnabled(operatorContext.getSession()) || columns.isEmpty()) { return; } int[] channels = new int[columns.size()]; for (int i = 0; i < channels.length; i++) { channels[i] = i; } PageSourceOptions options = new PageSourceOptions( channels, channels, reusePages, new FilterFunction[0], false, 512 * 1024, ariaFlags(operatorContext.getSession())); source.pushdownFilterAndProjection(options); }
Source:
<code>public String initialString() { String threads = ""; if (configuration.isFfmpegAviSynthMultithreading()) { threads = " -threads " + configuration.getNumberOfCpuCores(); } <START> return configuration.getMPEG2MainSettingsFFmpeg() + " -ab " + configuration.getAudioBitrateAC3() + "k" + threads; <END> }</code><technical_language>@SubJunk this is correct? if audio_bitrate_ac3 set Automatic result e.g. -ab Automatick -threads 2</technical_language>

Target:
public String initialString() { String threads = ""; if (configuration.isFfmpegAviSynthMultithreading()) { threads = " -threads " + configuration.getNumberOfCpuCores(); } return configuration.getMPEG2MainSettingsFFmpeg() + " -ab " + configuration.getAudioBitrate() + "k" + threads; }
Source:
<code>public void testWithTemplateClassl() throws Exception { selectedMethods = new String[] { "virtual void baseFunc() const=0;" }; assertRefactoringSuccess(); <START> } <END></code><technical_language>a test for override in a nested class</technical_language>

Target:
public void testWithTemplateClassl() throws Exception { selectedMethods = new String[] { "baseFunc()const" }; assertRefactoringSuccess(); }
Source:
<code>public Partition getPartition(String dbName, String tableName, List<String> part_vals) throws NoSuchObjectException, MetaException { boolean committed = false; <START> Partition part = null; <END> try { openTransaction(); part = convertToPart(getMPartition(dbName, tableName, part_vals)); committed = commitTransaction(); if(part == null) { throw new NoSuchObjectException("partition values=" + part_vals.toString()); } } catch (NucleusObjectNotFoundException ex) { throw new NoSuchObjectException("Failed to find the partition, partition values = " + part_vals.toString()); } finally { if (!committed) { rollbackTransaction(); } } part.setValues(part_vals); return part; }</code><technical_language>Do need a openTransaction here? getMPartition() opens closes transaction in a try-finally block, I need do is remove openTransaction() commitTransaction() this method. NucleusObjectNotFoundException is a runtime exception datanucleus catch (as in other methods), I suggest catch here. Basically, this patch require is remove openTransaction/commitTransaction() pair work</technical_language>

Target:
public Partition getPartition(String dbName, String tableName, List<String> part_vals) throws NoSuchObjectException, MetaException { Partition part = convertToPart(getMPartition(dbName, tableName, part_vals)); if(part == null) { throw new NoSuchObjectException("partition values=" + part_vals.toString()); } part.setValues(part_vals); return part; }