auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static ArrayList<Integer> targetWidths() { ArrayList<Integer> resolutions = new ArrayList<Integer>(); int MAX_SIZE = 8192; double SRCSET_INCREMENT_PERCENTAGE = 8; double prev = 100; while (prev <= MAX_SIZE) { resolutions.add((int)(2 * Math.round(prev/2))); prev *= 1 + (SRCSET_INCREMENT_PERCENTAGE / 100) * 2; } resolutions.add(MAX_SIZE); return resolutions; }

Target:
private static ArrayList<Integer> targetWidths() { ArrayList<Integer> resolutions = new ArrayList<Integer>(); int MAX_SIZE = 8192, roundedPrev; double SRCSET_INCREMENT_PERCENTAGE = 8; double prev = 100; while (prev < MAX_SIZE) { roundedPrev = (int)(2 * Math.round(prev / 2)); resolutions.add(roundedPrev); prev *= 1 + (SRCSET_INCREMENT_PERCENTAGE / 100) * 2; } resolutions.add(MAX_SIZE); return resolutions; }
Source:
public void update() throws Exception { context.turnOffAuthorisationSystem(); MetadataSchema metadataSchema = MetadataSchemaBuilder.createMetadataSchema(context, TEST_NAME, TEST_NAMESPACE) .build(); MetadataSchemaRest metadataSchemaRest = new MetadataSchemaRest(); metadataSchemaRest.setId(metadataSchema.getID()); metadataSchemaRest.setPrefix(TEST_NAME_UPDATED); metadataSchemaRest.setNamespace(TEST_NAMESPACE_UPDATED); getClient(getAuthToken(admin.getEmail(), password)) .perform(put("/api/core/metadataschemas/" + metadataSchema.getID()) .content(new ObjectMapper().writeValueAsBytes(metadataSchemaRest)) .contentType(contentType)) .andExpect(status().isOk()); getClient().perform(get("/api/core/metadataschemas/" + metadataSchema.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$", MetadataschemaMatcher .matchEntry(TEST_NAME_UPDATED, TEST_NAMESPACE_UPDATED))); }

Target:
public void update() throws Exception { context.turnOffAuthorisationSystem(); MetadataSchema metadataSchema = MetadataSchemaBuilder.createMetadataSchema(context, TEST_NAME, TEST_NAMESPACE) .build(); context.restoreAuthSystemState(); MetadataSchemaRest metadataSchemaRest = new MetadataSchemaRest(); metadataSchemaRest.setId(metadataSchema.getID()); metadataSchemaRest.setPrefix(TEST_NAME_UPDATED); metadataSchemaRest.setNamespace(TEST_NAMESPACE_UPDATED); getClient(getAuthToken(admin.getEmail(), password)) .perform(put("/api/core/metadataschemas/" + metadataSchema.getID()) .content(new ObjectMapper().writeValueAsBytes(metadataSchemaRest)) .contentType(contentType)) .andExpect(status().isOk()); getClient().perform(get("/api/core/metadataschemas/" + metadataSchema.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$", MetadataschemaMatcher .matchEntry(TEST_NAME_UPDATED, TEST_NAMESPACE_UPDATED))); }
Source:
public synchronized void stop() { if (acceptor != null) { try { close(true).await(); } catch (InterruptedException e) { log.warn("Exception caught while closing", e); } finally { acceptor = null; } } }

Target:
public synchronized void stop() { if (acceptor != null) { try { close(true).await(); log.info("Stopped Gerrit SSHD"); } catch (InterruptedException e) { log.warn("Exception caught while closing", e); } finally { acceptor = null; } } }
Source:
private ArrayList<String> getTrackedEventsFromFolder(String harDirPath) { ArrayList<String> finalTrackedEvents = new ArrayList<String>(); ArrayList<String> listOfHarFiles = new ArrayList<String>(); listOfHarFiles = getAllHarFiles(harDirPath); for (int i = 0; i < listOfHarFiles.size(); i++) { ArrayList<String> trackedEvents = new ArrayList<String>(); trackedEvents = getTrackedEventsFromFile(harDirPath+listOfHarFiles.get(i)); finalTrackedEvents.addAll(trackedEvents); } return finalTrackedEvents; }

Target:
private ArrayList<String> getTrackedEventsFromFolder(String harDirPath) { ArrayList<String> finalTrackedEvents = new ArrayList<String>(); ArrayList<String> listOfHarFiles = new ArrayList<String>(); listOfHarFiles = getAllHarFiles(harDirPath); for (int i = 0; i < listOfHarFiles.size(); i++) { finalTrackedEvents.addAll(getTrackedEventsFromFile(harDirPath+listOfHarFiles.get(i))); } return finalTrackedEvents; }
Source:
private static void validateStreamEmitterMethod(Method method, int outputAnnotationCount, String methodAnnotatedOutboundName) { if (StringUtils.hasText(methodAnnotatedOutboundName)) { Assert.isTrue(outputAnnotationCount == 0, StreamEmitterErrorMessages.INVALID_OUTPUT_METHOD_PARAMETERS); } else { Assert.isTrue(outputAnnotationCount > 0, StreamEmitterErrorMessages.NO_OUTPUT_SPECIFIED); } if (!method.getReturnType().equals(Void.TYPE)) { Assert.isTrue(StringUtils.hasText(methodAnnotatedOutboundName), StreamEmitterErrorMessages.RETURN_TYPE_NO_OUTBOUND_SPECIFIED); Assert.isTrue(method.getParameterCount() == 0, StreamEmitterErrorMessages.RETURN_TYPE_METHOD_ARGUMENTS); } else { if (!StringUtils.hasText(methodAnnotatedOutboundName)) { int methodArgumentsLength = method.getParameterTypes().length; for (int parameterIndex = 0; parameterIndex < methodArgumentsLength; parameterIndex++) { MethodParameter methodParameter = MethodParameter.forMethodOrConstructor(method, parameterIndex); if (methodParameter.hasParameterAnnotation(Output.class)) { String outboundName = (String) AnnotationUtils .getValue(methodParameter.getParameterAnnotation(Output.class)); Assert.isTrue(StringUtils.hasText(outboundName), StreamEmitterErrorMessages.INVALID_OUTBOUND_NAME); } else { throw new IllegalArgumentException( StreamEmitterErrorMessages.OUTPUT_ANNOTATION_MISSING_ON_METHOD_PARAMETERS_VOID_RETURN_TYPE); } } } } }

Target:
private static void validateStreamEmitterMethod(Method method, int outputAnnotationCount, String methodAnnotatedOutboundName) { if (StringUtils.hasText(methodAnnotatedOutboundName)) { Assert.isTrue(outputAnnotationCount == 0, StreamEmitterErrorMessages.INVALID_OUTPUT_METHOD_PARAMETERS); } else { Assert.isTrue(outputAnnotationCount > 0, StreamEmitterErrorMessages.NO_OUTPUT_SPECIFIED); } if (!method.getReturnType().equals(Void.TYPE)) { Assert.isTrue(StringUtils.hasText(methodAnnotatedOutboundName), StreamEmitterErrorMessages.RETURN_TYPE_NO_OUTBOUND_SPECIFIED); Assert.isTrue(method.getParameterCount() == 0, StreamEmitterErrorMessages.RETURN_TYPE_METHOD_ARGUMENTS); } else { if (!StringUtils.hasText(methodAnnotatedOutboundName)) { int methodArgumentsLength = method.getParameterTypes().length; for (int parameterIndex = 0; parameterIndex < methodArgumentsLength; parameterIndex++) { MethodParameter methodParameter = new MethodParameter(method, parameterIndex); if (methodParameter.hasParameterAnnotation(Output.class)) { String outboundName = (String) AnnotationUtils .getValue(methodParameter.getParameterAnnotation(Output.class)); Assert.isTrue(StringUtils.hasText(outboundName), StreamEmitterErrorMessages.INVALID_OUTBOUND_NAME); } else { throw new IllegalArgumentException( StreamEmitterErrorMessages.OUTPUT_ANNOTATION_MISSING_ON_METHOD_PARAMETERS_VOID_RETURN_TYPE); } } } } }
Source:
private List<ProxyData> getProxyData(String provider) { List<ProxyData> proxyDatas = new ArrayList<>(); ProxyData[] entries = ProxySelector.getProxyData(provider); for (ProxyData entrie : entries) { entrie.setSource(provider); proxyDatas.add(entrie); } return proxyDatas; }

Target:
private List<ProxyData> getProxyData(String provider) { List<ProxyData> proxyDatas = new ArrayList<>(); ProxyData[] entries = ProxySelector.getProxyData(provider); for (ProxyData entry : entries) { entry.setSource(provider); proxyDatas.add(entry); } return proxyDatas; }
Source:
public synchronized void initRoutingTable(final EMRoutingTable routingTable) { final Map<Integer, Set<Integer>> storeIdToBlockIds = routingTable.getStoreIdToBlockIds(); numTotalBlocks = routingTable.getNumTotalBlocks(); storeIdToEndpointId.putAll(routingTable.getStoreIdToEndpointId()); for (final Map.Entry<Integer, Set<Integer>> entry : storeIdToBlockIds.entrySet()) { final int storeId = entry.getKey(); for (final int blockId : entry.getValue()) { blockIdToStoreId.put(blockId, storeId); } } initialized = true; LOG.log(Level.FINE, "Server resolver is initialized"); synchronized (this) { this.notifyAll(); } }

Target:
public synchronized void initRoutingTable(final EMRoutingTable routingTable) { if (initialized) { return; } final Map<Integer, Set<Integer>> storeIdToBlockIds = routingTable.getStoreIdToBlockIds(); numTotalBlocks = routingTable.getNumTotalBlocks(); storeIdToEndpointId.putAll(routingTable.getStoreIdToEndpointId()); for (final Map.Entry<Integer, Set<Integer>> entry : storeIdToBlockIds.entrySet()) { final int storeId = entry.getKey(); for (final int blockId : entry.getValue()) { blockIdToStoreId.put(blockId, storeId); } } initialized = true; LOG.log(Level.FINE, "Server resolver is initialized"); synchronized (this) { this.notifyAll(); } }
Source:
private static AuthenticationException needAuthentication(String message) { return new AuthenticationException(message, "Bearer realm=\"Presto\", token_type=\"JWT\"'"); }

Target:
private static AuthenticationException needAuthentication(String message) { return new AuthenticationException(message, "Bearer realm=\"Presto\", token_type=\"JWT\""); }
Source:
private boolean bufferCurrentEventAndScheduleIfRequired(RecordsRetrieved recordsRetrieved, RecordFlow triggeringFlow) { boolean isCurrentEventScheduled = false; final RecordsRetrievedContext recordsRetrievedContext = new RecordsRetrievedContext(recordsRetrieved, triggeringFlow); try { recordsDeliveryQueue.add(recordsRetrievedContext); if (recordsDeliveryQueue.size() == 1) { subscriber.onNext(recordsRetrieved); isCurrentEventScheduled = true; } } catch (IllegalStateException e) { log.warn("{}: Unable to enqueue the payload due to capacity restrictions in delivery queue with remaining capacity ", shardId, recordsDeliveryQueue.remainingCapacity()); throw e; } catch (Throwable t) { recordsDeliveryQueue.remove(recordsRetrievedContext); throw t; } return isCurrentEventScheduled; }

Target:
void bufferCurrentEventAndScheduleIfRequired(RecordsRetrieved recordsRetrieved, RecordFlow triggeringFlow) { final RecordsRetrievedContext recordsRetrievedContext = new RecordsRetrievedContext(recordsRetrieved, triggeringFlow, Instant.now()); try { recordsDeliveryQueue.add(recordsRetrievedContext); if (recordsDeliveryQueue.size() == 1) { subscriber.onNext(recordsRetrieved); } } catch (IllegalStateException e) { log.warn("{}: Unable to enqueue the payload due to capacity restrictions in delivery queue with remaining capacity ", shardId, recordsDeliveryQueue.remainingCapacity()); throw e; } catch (Throwable t) { log.error("{}: Unable to deliver event to the shard consumer.", shardId, t); throw t; } }
Source:
public GenerateVepAnnotationStepParametersValidator(boolean isStudyIdRequired) { super(new String[]{JobParametersNames.DB_COLLECTIONS_VARIANTS_NAME, JobParametersNames.DB_NAME, JobParametersNames.APP_VEP_CACHE_PATH, JobParametersNames.APP_VEP_CACHE_SPECIES, JobParametersNames.APP_VEP_CACHE_VERSION, JobParametersNames.APP_VEP_NUMFORKS, JobParametersNames.APP_VEP_PATH, JobParametersNames.APP_VEP_TIMEOUT, JobParametersNames.INPUT_FASTA, JobParametersNames.ANNOTATION_OVERWRITE, JobParametersNames.OUTPUT_DIR_ANNOTATION}, new String[]{}); this.isStudyIdRequired = isStudyIdRequired; }

Target:
public GenerateVepAnnotationStepParametersValidator(boolean isStudyIdRequired) { super(new String[]{JobParametersNames.ANNOTATION_OVERWRITE, JobParametersNames.APP_VEP_CACHE_PATH, JobParametersNames.APP_VEP_CACHE_SPECIES, JobParametersNames.APP_VEP_CACHE_VERSION, JobParametersNames.APP_VEP_NUMFORKS, JobParametersNames.APP_VEP_PATH, JobParametersNames.APP_VEP_TIMEOUT, JobParametersNames.DB_COLLECTIONS_VARIANTS_NAME, JobParametersNames.DB_NAME, JobParametersNames.INPUT_FASTA, JobParametersNames.OUTPUT_DIR_ANNOTATION}, new String[]{}); this.isStudyIdRequired = isStudyIdRequired; }
Source:
public void tearDown() throws IOException { try { DeleteJob.deleteJob(PROJECT_ID, LOCATION, JOB_ID); } catch (GoogleJsonResponseException gjre) { } deleteBucket(BUCKET_NAME); System.setOut(originalOut); bout.reset(); }

Target:
public void tearDown() throws IOException { DeleteJob.deleteJob(PROJECT_ID, LOCATION, JOB_ID); deleteBucket(BUCKET_NAME); System.setOut(originalOut); bout.reset(); }
Source:
private void handleOnFragmentChange() { getSupportFragmentManager().addOnBackStackChangedListener(new FragmentManager.OnBackStackChangedListener() { @Override public void onBackStackChanged() { FragmentManager fragmentManager = getSupportFragmentManager(); Fragment fragment = fragmentManager.findFragmentById(R.id.list_fragment_container); if (fragment instanceof MessageListFragment) { String tag = fragment.getTag(); if (menu==null) return; if (tag.equals(getString(R.string.home_frament_tag))) { calendar = Calendar.getInstance(); menu.getItem(2).getSubMenu().getItem(0).setTitle(R.string.menu_today); }else if (tag.equals(getString(R.string.today_fragment_tag))) { menu.getItem(2).getSubMenu().getItem(0).setTitle(R.string.menu_one_day_before); } } } }); }

Target:
private void handleOnFragmentChange() { getSupportFragmentManager().addOnBackStackChangedListener(new FragmentManager.OnBackStackChangedListener() { @Override public void onBackStackChanged() { if (menu == null) return; if (narrowedList==null) { calendar = Calendar.getInstance(); menu.getItem(2).getSubMenu().getItem(0).setTitle(R.string.menu_today); } else if (narrowedList.filter instanceof NarrowFilterByDate) { menu.getItem(2).getSubMenu().getItem(0).setTitle(R.string.menu_one_day_before); } } }); }
Source:
public GDPRSymmetricKey() throws Exception { algorithm = OzoneConsts.GDPR_ALGORITHM_NAME; secret = RandomStringUtils .randomAlphabetic(OzoneConsts.GDPR_RANDOM_SECRET_LENGTH); this.secretKey = new SecretKeySpec( secret.substring(0, OzoneConsts.GDPR_RANDOM_SECRET_LENGTH) .getBytes(OzoneConsts.GDPR_CHARSET), algorithm); this.cipher = Cipher.getInstance(algorithm); }

Target:
public GDPRSymmetricKey() throws Exception { algorithm = OzoneConsts.GDPR_ALGORITHM_NAME; secret = RandomStringUtils .randomAlphabetic(OzoneConsts.GDPR_RANDOM_SECRET_LENGTH); this.secretKey = new SecretKeySpec( secret.getBytes(OzoneConsts.GDPR_CHARSET), algorithm); this.cipher = Cipher.getInstance(algorithm); }
Source:
public VdsIdVDSCommandBase(P parameters, boolean newHost) { super(parameters); if (!newHost) { _vdsManager = Injector.get(ResourceManager.class).getVdsManager(parameters.getVdsId()); } }

Target:
public VdsIdVDSCommandBase(P parameters, boolean newHost) { super(parameters); this.newHost = newHost; }
Source:
public void onInitialize(MatchingFrame frame, ISearchContext context) throws LocalSearchException { call = helper.createCall(context); Set<Object> seedsToEvaluate = Sets.newLinkedHashSet(); seedsToEvaluate.add(frame.get(seedPosition)); Set<Object> seedsEvaluated = Sets.newHashSet(); do { Object currentValue = seedsToEvaluate.iterator().next(); seedsToEvaluate.remove(currentValue); seedsEvaluated.add(currentValue); final Object[] mappedFrame = calculateCallFrame(currentValue); for (Tuple match : call.getAllMatches(mappedFrame)) { Object foundTarget = getTargets(match); if (!seedsEvaluated.contains(foundTarget)) { seedsToEvaluate.add(foundTarget); } } } while (!seedsToEvaluate.isEmpty()); it = seedsEvaluated.iterator(); }

Target:
public void onInitialize(MatchingFrame frame, ISearchContext context) throws LocalSearchException { call = helper.createCall(context); Queue<Object> seedsToEvaluate = new LinkedList<>(); seedsToEvaluate.add(frame.get(seedPosition)); Set<Object> seedsEvaluated = new HashSet<>(); while(!seedsToEvaluate.isEmpty()) { Object currentValue = seedsToEvaluate.poll(); seedsEvaluated.add(currentValue); final Object[] mappedFrame = calculateCallFrame(currentValue); for (Tuple match : call.getAllMatches(mappedFrame)) { Object foundTarget = getTarget(match); if (!seedsEvaluated.contains(foundTarget)) { seedsToEvaluate.add(foundTarget); } } } it = seedsEvaluated.iterator(); }
Source:
public void checkNameProjectTest() throws Exception { driver.navigate().to(swaggerUrl); try { assertTrue(swagger.getWsNamesFromWorkspacePage().contains(workspace.getName())); } catch (IllegalStateException ex) { Assert.fail("Known issue <LINK_0>"); } catch (StaleElementReferenceException ex) { Assert.fail("Known issue <LINK_0>"); } }

Target:
public void checkNameProjectTest() throws Exception { driver.navigate().to(swaggerUrl); try { assertTrue(swagger.getWsNamesFromWorkspacePage().contains(workspace.getName())); } catch (IllegalStateException | StaleElementReferenceException ex) { fail("Known issue <LINK_0>"); } }
Source:
public void inject() { final Type[] types = Type.getArgumentTypes(this.method.desc); InsnList inject = new InsnList(); Label l0 = new Label(); inject.add(new LabelNode(l0)); int offset = 0; if (args != null && args.length > 0) { for (int arg : args) { if (Modifier.isStatic(method.access)) { int loadOpcode = ASMUtils.getLoadOpcode(types[arg] .getDescriptor()); inject.add(new VarInsnNode(loadOpcode, arg + offset)); if (loadOpcode == Opcodes.LLOAD) { offset++; } } else { inject.add(new VarInsnNode(ASMUtils.getLoadOpcode(types[arg] .getDescriptor()), arg + 1)); } } } inject.add(new MethodInsnNode(INVOKESTATIC, this.invokeClass, this.invokeMethod, this.desc)); if (this.conditional) { LabelNode ln = new LabelNode(new Label()); inject.add(new JumpInsnNode(IFEQ, ln)); if (Type.getReturnType(method.desc).equals(Type.BOOLEAN_TYPE)) { inject.add(new InsnNode(ICONST_1)); inject.add(new InsnNode(IRETURN)); } else { inject.add(new InsnNode(RETURN)); } inject.add(ln); } if (method.name.startsWith("<") && !Modifier.isStatic(method.access)) { AbstractInsnNode target = null; for (AbstractInsnNode node : this.method.instructions.toArray()) { if (node.getOpcode() == Opcodes.INVOKESPECIAL) { target = node; break; } } if (target != null) { this.method.instructions.insert(target, inject); } } else { this.method.instructions.insert(inject); } }

Target:
public void inject() { final Type[] types = Type.getArgumentTypes(this.method.desc); InsnList inject = new InsnList(); Label l0 = new Label(); inject.add(new LabelNode(l0)); int offset = 0; if (args != null) { for (int arg : args) { if (Modifier.isStatic(method.access)) { int loadOpcode = ASMUtils.getLoadOpcode(types[arg] .getDescriptor()); inject.add(new VarInsnNode(loadOpcode, arg + offset)); if (loadOpcode == Opcodes.LLOAD) { offset++; } } else { inject.add(new VarInsnNode(ASMUtils.getLoadOpcode(types[arg] .getDescriptor()), arg + 1)); } } } inject.add(new MethodInsnNode(INVOKESTATIC, this.invokeClass, this.invokeMethod, this.desc)); if (this.conditional) { LabelNode ln = new LabelNode(new Label()); inject.add(new JumpInsnNode(IFEQ, ln)); if (Type.getReturnType(method.desc).equals(Type.BOOLEAN_TYPE)) { inject.add(new InsnNode(ICONST_1)); inject.add(new InsnNode(IRETURN)); } else { inject.add(new InsnNode(RETURN)); } inject.add(ln); } if (method.name.startsWith("<") && !Modifier.isStatic(method.access)) { AbstractInsnNode target = null; for (AbstractInsnNode node : this.method.instructions.toArray()) { if (node.getOpcode() == Opcodes.INVOKESPECIAL) { target = node; break; } } if (target != null) { this.method.instructions.insert(target, inject); } } else { this.method.instructions.insert(inject); } }
Source:
public static VectorGenerator gauss(Vector means, Vector variances, Long seed) { A.notEmpty(means.asArray(), "mean.size() != 0"); A.ensure(means.size() == variances.size(), "mean.size() == variances.size()"); RandomProducer[] producers = new RandomProducer[means.size()]; for (int i = 0; i < producers.length; i++) producers[i] = new GaussRandomProducer(means.get(i), variances.get(i), seed >>= 2); return RandomProducer.vectorize(producers); }

Target:
public static VectorGenerator gauss(Vector means, Vector variances, Long seed) { A.notEmpty(means.asArray(), "mean.size() != 0"); A.ensure(means.size() == variances.size(), "mean.size() == variances.size()"); RandomProducer[] producers = new RandomProducer[means.size()]; for (int i = 0; i < producers.length; i++) producers[i] = new GaussRandomProducer(means.get(i), variances.get(i), seed *= 2); return RandomProducer.vectorize(producers); }
Source:
private void uploadModel(String modelInputPath) throws IOException { FileReader fr = new FileReader(modelInputPath); NaiveBayesModelReader reader = new PlainTextNaiveBayesModelReader(new BufferedReader(fr)); reader.checkModelType(); NaiveBayesModel initialModel = (NaiveBayesModel) reader.constructModel(); fr.close(); Object[] data = initialModel.getDataStructures(); Context[] params = (Context[]) data[0]; Map<String, Context> pmap = (Map<String, Context>) data[1]; String[] outcomeNames = (String[]) data[2]; this.setMasterOutcomeLabels(Arrays.asList(outcomeNames)); this.setMasterPredLabels(new ArrayList<>(pmap.keySet())); List<MutableContext> paramsList = new ArrayList<>(); for (String pred : masterPredLabels) { Context context = pmap.get(pred); MutableContext mutableContext = new MutableContext(context.getOutcomes(), context.getParameters()); paramsList.add(mutableContext); } this.setParameters(paramsList); }

Target:
private void uploadModel(String modelInputPath) throws IOException { NaiveBayesModel initialModel; try (FileReader fr = new FileReader(modelInputPath)) { NaiveBayesModelReader reader = new PlainTextNaiveBayesModelReader(new BufferedReader(fr)); reader.checkModelType(); initialModel = (NaiveBayesModel) reader.constructModel(); } Object[] data = initialModel.getDataStructures(); Map<String, Context> pmap = (Map<String, Context>) data[1]; String[] outcomeNames = (String[]) data[2]; this.setMasterOutcomeLabels(Arrays.asList(outcomeNames)); this.setMasterPredLabels(new ArrayList<>(pmap.keySet())); List<MutableContext> paramsList = new ArrayList<>(); for (String pred : masterPredLabels) { Context context = pmap.get(pred); MutableContext mutableContext = new MutableContext(context.getOutcomes(), context.getParameters()); paramsList.add(mutableContext); } this.setParameters(paramsList); }
Source:
public void testModuleGroups() throws Exception { Map<String, String> results = new HashMap<>(); results.put(CDH580Spark2Constant.SPARK_MODULE_GROUP.getModuleName(), "(SPARK_LOCAL_MODE=='false')"); results.put(CDH580Spark2Constant.HDFS_MODULE_GROUP.getModuleName(), "(SPARK_LOCAL_MODE=='false')"); results.put(CDH580Spark2Constant.MAPREDUCE_MODULE_GROUP.getModuleName(), "(SPARK_LOCAL_MODE=='false')"); results.put(CDH580Spark2Constant.SPARK_MRREQUIRED_MODULE_GROUP.getModuleName(), "(SPARK_LOCAL_MODE=='false')"); results.put(CDH580Spark2Constant.TALEND_CLOUDERA_CDH_5_5_NAVIGATOR.getModuleName(), "(USE_CLOUDERA_NAVIGATOR=='true')"); Set<DistributionModuleGroup> moduleGroups = CDH580Spark2SparkStreamingModuleGroup.getModuleGroups(); assertEquals(3, moduleGroups.size()); moduleGroups.iterator(); for (DistributionModuleGroup module : moduleGroups) { assertTrue("Should contain module " + module.getModuleName(), results.containsKey(module.getModuleName())); if (results.get(module.getModuleName()) == null) { assertTrue("The condition of the module " + module.getModuleName() + " is not null.", results.get(module.getModuleName()) == null); } else { assertTrue("The condition of the module " + module.getModuleName() + " is null, but it should be " + results.get(module.getModuleName()) + ".", results.get(module.getModuleName()) != null); assertEquals(results.get(module.getModuleName()), module.getRequiredIf().getConditionString()); } } }

Target:
public void testModuleGroups() throws Exception { Map<String, String> results = new HashMap<>(); results.put(CDH580Spark2Constant.SPARK_MODULE_GROUP.getModuleName(), "(SPARK_LOCAL_MODE=='false')"); results.put(CDH580Spark2Constant.HDFS_MODULE_GROUP.getModuleName(), "(SPARK_LOCAL_MODE=='false')"); results.put(CDH580Spark2Constant.MAPREDUCE_MODULE_GROUP.getModuleName(), "(SPARK_LOCAL_MODE=='false')"); Set<DistributionModuleGroup> moduleGroups = CDH580Spark2SparkStreamingModuleGroup.getModuleGroups(); assertEquals(results.size(), moduleGroups.size()); moduleGroups.iterator(); for (DistributionModuleGroup module : moduleGroups) { assertTrue("Should contain module " + module.getModuleName(), results.containsKey(module.getModuleName())); if (results.get(module.getModuleName()) == null) { assertTrue("The condition of the module " + module.getModuleName() + " is not null.", results.get(module.getModuleName()) == null); } else { assertTrue("The condition of the module " + module.getModuleName() + " is null, but it should be " + results.get(module.getModuleName()) + ".", results.get(module.getModuleName()) != null); assertEquals(results.get(module.getModuleName()), module.getRequiredIf().getConditionString()); } } }
Source:
private void addWrapper(ProxyWhitelist pwl){ lock.writeLock().lock(); wrappers.put(pwl, null); lock.writeLock().unlock(); }

Target:
private void addWrapper(ProxyWhitelist pwl){ lock.writeLock().lock(); try { wrappers.put(pwl, null); } finally { lock.writeLock().unlock(); } }
Source:
public JiraSite(String url){ URL mainURL = toURL(url); if (mainURL == null) throw new AssertionError("URL cannot be null"); this.url = mainURL; }

Target:
public JiraSite(String url){ URL mainURL = toURL(url); if (mainURL == null) throw new AssertionError("URL cannot be empty"); this.url = mainURL; }
Source:
public long getVirtualOffsetForSeek(final long uncompressedOffset) { if (uncompressedOffset == 0) { return BlockCompressedFilePointerUtil.makeFilePointer(0, 0); } final IndexEntry indexEntry = entries.stream() .filter(entry -> entry.getUncompressedOffset() >= uncompressedOffset) .findFirst().orElse(FIRST_MAPPING); final int blockOffset = Math.toIntExact(indexEntry.getUncompressedOffset() - uncompressedOffset); return BlockCompressedFilePointerUtil.makeFilePointer(indexEntry.getCompressedOffset(), blockOffset); }

Target:
public long getVirtualOffsetForSeek(final long uncompressedOffset) { try { if (uncompressedOffset == 0) { return BlockCompressedFilePointerUtil.makeFilePointer(0, 0); } final int pos = Collections.binarySearch(entries, new IndexEntry(0, uncompressedOffset), Comparator.comparingLong(IndexEntry::getUncompressedOffset)); if (pos >= 0) { return BlockCompressedFilePointerUtil.makeFilePointer( entries.get(pos).getCompressedOffset(), 0); } final int entryPos = -pos - 2; if (entryPos == -1) { return BlockCompressedFilePointerUtil.makeFilePointer(0, Math.toIntExact(uncompressedOffset)); } final IndexEntry indexEntry = entries.get(entryPos); final int blockOffset = Math.toIntExact(uncompressedOffset - indexEntry.getUncompressedOffset()); return BlockCompressedFilePointerUtil.makeFilePointer(indexEntry.getCompressedOffset(), blockOffset); } catch (ArithmeticException e) { throw new IllegalArgumentException("Cannot handle offsets within blocks larger than " + Integer.MAX_VALUE, e); } }
Source:
private AmazonEC2 getEC2Service() { eurekaConfig = EurekaServerConfigurationManager.getInstance() .getConfiguration(); AmazonEC2 ec2Service = new AmazonEC2Client( AWSCredentialsManager.getInstance().getCredentials()); String region = DiscoveryManager.getInstance().getEurekaClientConfig() .getRegion(); region = region.trim().toLowerCase(); ec2Service.setEndpoint("ec2." + region + ".amazonaws.com"); return ec2Service; }

Target:
private AmazonEC2 getEC2Service() { eurekaConfig = EurekaServerConfigurationManager.getInstance() .getConfiguration(); String aWSAccessId = eurekaConfig.getAWSAccessId(); String aWSSecretKey = eurekaConfig.getAWSSecretKey(); AmazonEC2 ec2Service; if (null != aWSAccessId && !"".equals(aWSAccessId) && null != aWSSecretKey && !"".equals(aWSSecretKey)) { ec2Service = new AmazonEC2Client(new BasicAWSCredentials( aWSAccessId, aWSSecretKey)); } else { ec2Service = new AmazonEC2Client( new InstanceProfileCredentialsProvider()); } String region = DiscoveryManager.getInstance().getEurekaClientConfig() .getRegion(); region = region.trim().toLowerCase(); ec2Service.setEndpoint("ec2." + region + ".amazonaws.com"); return ec2Service; }
Source:
public Method getOnErrorMethod(Object webSocketEndpoint) { Method[] methods = webSocketEndpoint.getClass().getMethods(); for (Method method : methods) { if (method.isAnnotationPresent(OnError.class)) { return method; } } return null; }

Target:
public Method getOnErrorMethod(Object webSocketEndpoint) { Method[] methods = webSocketEndpoint.getClass().getMethods(); if (methods == null) { return null; } for (Method method : methods) { if (method.isAnnotationPresent(OnError.class)) { return method; } } return null; }
Source:
public static MessageTransformers createMessageTransformer(String className, SecorConfig config) throws Exception { Class<?> clazz = Class.forName(className); if(!MessageTransformers.class.isAssignableFrom(clazz)) { throw new IllegalArgumentException(String.format("The class '%s' is not assignable to '%s'.", className, MessageTransformers.class.getName())); } return (MessageTransformers) clazz.getConstructor(SecorConfig.class).newInstance(config); }

Target:
public static MessageTransformer createMessageTransformer( String className, SecorConfig config) throws Exception { Class<?> clazz = Class.forName(className); if (!MessageTransformer.class.isAssignableFrom(clazz)) { throw new IllegalArgumentException(String.format( "The class '%s' is not assignable to '%s'.", className, MessageTransformer.class.getName())); } return (MessageTransformer) clazz.getConstructor(SecorConfig.class) .newInstance(config); }
Source:
public TextFieldTableCell<S, T> call(TableColumn<S, T> param) { return new TextFieldTableCell<>(stringConverter) { List<Subscription> subscriptions = new ArrayList<>(); @Override public void startEdit() { super.startEdit(); lookupTextField().ifPresent(textField -> Platform.runLater(() -> { textField.requestFocus(); textField.selectAll(); })); } private Optional<TextField> lookupTextField() { if (getGraphic() instanceof TextField) { return Optional.of((TextField) getGraphic()); } else { if (getGraphic() instanceof HBox) { HBox hbox = (HBox) getGraphic(); if ((hbox.getChildren().size() > 1) && hbox.getChildren().get(1) instanceof TextField) { return Optional.of((TextField) hbox.getChildren().get(1)); } } return Optional.empty(); } } @Override public void updateItem(T item, boolean empty) { super.updateItem(item, empty); subscriptions.forEach(Subscription::unsubscribe); subscriptions.clear(); S viewModel = getTableRow().getItem(); if (empty || (viewModel == null)) { setText(null); setGraphic(null); setOnMouseClicked(null); setTooltip(null); setStyle(""); } else { if (validationStatusProperty != null) { validationStatusProperty.apply(viewModel).getHighestMessage().ifPresent(message -> { setTooltip(new Tooltip(message.getMessage())); subscriptions.add(BindingsHelper.includePseudoClassWhen(this, INVALID_PSEUDO_CLASS, validationStatusProperty.apply(viewModel).validProperty().not())); }); } } } }; }

Target:
public TextFieldTableCell<S, T> call(TableColumn<S, T> param) { return new TextFieldTableCell<>(stringConverter) { final List<Subscription> subscriptions = new ArrayList<>(); @Override public void startEdit() { super.startEdit(); lookupTextField().ifPresent(textField -> Platform.runLater(() -> { textField.requestFocus(); textField.selectAll(); })); } private Optional<TextField> lookupTextField() { if (getGraphic() instanceof TextField) { return Optional.of((TextField) getGraphic()); } else { if (getGraphic() instanceof HBox) { HBox hbox = (HBox) getGraphic(); if ((hbox.getChildren().size() > 1) && hbox.getChildren().get(1) instanceof TextField) { return Optional.of((TextField) hbox.getChildren().get(1)); } } return Optional.empty(); } } @Override public void updateItem(T item, boolean empty) { super.updateItem(item, empty); subscriptions.forEach(Subscription::unsubscribe); subscriptions.clear(); if (empty || getTableRow() == null || getTableRow().getItem() == null) { setText(null); setGraphic(null); setOnMouseClicked(null); setTooltip(null); pseudoClassStateChanged(INVALID_PSEUDO_CLASS, false); } else { S viewModel = getTableRow().getItem(); if (validationStatusProperty != null) { validationStatusProperty.apply(viewModel) .getHighestMessage() .ifPresent(message -> setTooltip(new Tooltip(message.getMessage()))); subscriptions.add(BindingsHelper.includePseudoClassWhen( this, INVALID_PSEUDO_CLASS, validationStatusProperty.apply(viewModel).validProperty().not())); } } } }; }
Source:
private boolean canConnectToConsole() { final VM vm = getVm(); machineHasReconnectFlag = vm.getAllowConsoleReconnect(); if (machineHasReconnectFlag) { return true; } userHasReconnectPermission = checkUserAuthorization(ActionGroup.RECONNECT_TO_VM, MultiLevelAdministrationHandler.SYSTEM_OBJECT_ID, VdcObjectType.System); if (userHasReconnectPermission) { return true; } final String currentName = getCurrentUser().getUserName(); final NGuid currentId = getCurrentUser().getUserId(); final String previousName = vm.getConsoleUserName(); final NGuid previousId = vm.getConsoleUserId(); if (previousId != null && !previousId.equals(currentId)) { log.warnFormat("User \"{0}\" is trying to set a ticket for virtual machine \"{1}\" but the machine is already in use by \"{2}\".", currentName, vm.getvm_name(), previousName); log.warnFormat("The id of user \"{0}\" is \"{1}\".", currentName, currentId); log.warnFormat("The id of user \"{0}\" is \"{1}\".", previousName, previousId); log.warnFormat("The id of virtual machine \"{0}\" is \"{1}\".", vm.getvm_name(), vm.getvm_guid()); log.warnFormat("The ticket will not be set."); addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_IN_USE_BY_OTHER_USER); addCanDoActionMessage(VdcBllMessages.VAR__ACTION__SET); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__VM_TICKET); return false; } return true; }

Target:
private boolean canConnectToConsole() { final VM vm = getVm(); if (vm.getAllowConsoleReconnect()) { return true; } final String currentName = getCurrentUser().getUserName(); final NGuid currentId = getCurrentUser().getUserId(); final String previousName = vm.getConsoleUserName(); final NGuid previousId = vm.getConsoleUserId(); if (previousId != null && !previousId.equals(currentId)) { log.warnFormat("User \"{0}\" is trying to set a ticket for virtual machine \"{1}\" but the machine is already in use by \"{2}\".", currentName, vm.getvm_name(), previousName); log.warnFormat("The id of user \"{0}\" is \"{1}\".", currentName, currentId); log.warnFormat("The id of user \"{0}\" is \"{1}\".", previousName, previousId); log.warnFormat("The id of virtual machine \"{0}\" is \"{1}\".", vm.getvm_name(), vm.getvm_guid()); log.warnFormat("The ticket will not be set."); addCanDoActionMessage(VdcBllMessages.USER_NOT_AUTHORIZED_TO_PERFORM_ACTION); return false; } return true; }
Source:
private static void setWallpaper(Context context, Bitmap bitmap) { WallpaperManager wallpaperManager = WallpaperManager.getInstance(context); try { wallpaperManager.setBitmap(bitmap); ViewUtil.showLongToast(context, context.getString(R.string.wallpaper_set_successfully)); if (progressDialog.isShowing() && progressDialog != null) { progressDialog.dismiss(); } } catch (IOException e) { Timber.e(e, "Error setting wallpaper"); ViewUtil.showLongToast(context, context.getString(R.string.wallpaper_set_unsuccessfully)); if (progressDialog != null) { progressDialog.cancel(); } } }

Target:
private static void setWallpaper(Context context, Bitmap bitmap) { WallpaperManager wallpaperManager = WallpaperManager.getInstance(context); try { wallpaperManager.setBitmap(bitmap); ViewUtil.showLongToast(context, context.getString(R.string.wallpaper_set_successfully)); if (progressDialog != null && progressDialog.isShowing()) { progressDialog.dismiss(); } } catch (IOException e) { Timber.e(e, "Error setting wallpaper"); ViewUtil.showLongToast(context, context.getString(R.string.wallpaper_set_unsuccessfully)); if (progressDialog != null) { progressDialog.cancel(); } } }
Source:
protected void enableDiscoveryProtocol(JChannel c) { for (Protocol p : c.getProtocolStack().getProtocols()) { if (p instanceof Discovery) { try { log.tracef("About to start discovery: %s", p); p.start(); } catch (Exception e) { throw new RuntimeException(e); } } } }

Target:
protected void enableDiscoveryProtocol(JChannel c) { try { c.getProtocolStack().findProtocol(TEST_PING.class).start(); } catch (Exception e) { throw new RuntimeException(e); } }
Source:
public void parseWithContinuation() throws Exception { String code = load("cpp_with_continuation.cpp"); Tokens tokens = parse(code); if (tokens.size() < 52) { printTokens(tokens); fail("Not enough tokens - probably parsing error. Tokens: " + tokens.size()); } assertEquals("static", findByLine(8, tokens).get(0).toString()); assertEquals("int", findByLine(8, tokens).get(1).toString()); assertEquals("ab", findByLine(8, tokens).get(2).toString()); assertEquals("int", findByLine(12, tokens).get(0).toString()); assertEquals("main", findByLine(12, tokens).get(1).toString()); assertEquals("(", findByLine(12, tokens).get(2).toString()); assertEquals(")", findByLine(12, tokens).get(3).toString()); assertEquals("{", findByLine(13, tokens).get(0).toString()); assertEquals("\"world!\\n\"", findByLine(16, tokens).get(0).toString()); assertEquals("}", findByLine(29, tokens).get(0).toString()); }

Target:
public void parseWithContinuation() throws Exception { String code = load("cpp_with_continuation.cpp"); Tokens tokens = parse(code); if (tokens.size() < 52) { printTokens(tokens); fail("Not enough tokens - probably parsing error. Tokens: " + tokens.size()); } assertEquals("static", findByLine(8, tokens).get(0).toString()); assertEquals("int", findByLine(8, tokens).get(1).toString()); TokenEntry tokenEntry = findByLine(8, tokens).get(2); assertEquals("ab", tokenEntry.toString()); assertEquals("int", findByLine(12, tokens).get(0).toString()); assertEquals("main", findByLine(12, tokens).get(1).toString()); assertEquals("(", findByLine(12, tokens).get(2).toString()); assertEquals(")", findByLine(12, tokens).get(3).toString()); assertEquals("{", findByLine(13, tokens).get(0).toString()); assertEquals("\"world!\\n\"", findByLine(16, tokens).get(0).toString()); assertEquals("\"3 Hello, \\world!\\n\"", findByLine(22, tokens).get(4).toString()); assertEquals("}", findByLine(29, tokens).get(0).toString()); }
Source:
public void testNonExistentProtocol() throws Exception { fail("IGNITE-10245"); protocols = new String[] { "SSLv3" }; startGrid(); checkClientStartFailure( null, new String[][] { new String[] { "SSLv3", "SSLvDoesNotExist" } }, GridClientException.class, "SSLvDoesNotExist" ); }

Target:
public void testNonExistentProtocol() throws Exception { protocols = new String[] { "SSLv3" }; startGrid(); checkClientStartFailure( null, new String[] { "SSLv3", "SSLvDoesNotExist" }, "SSLvDoesNotExist" ); }
Source:
public void testEndToEnd() throws IOException { final File tempFile = File.createTempFile("IntervalCodecTest.", ".interval_list"); tempFile.deleteOnExit(); final IntervalList expectedList = new IntervalList(this.dict); final IntervalList actualList = new IntervalList(this.dict); expectedList.add(new Interval("chr1", 50, 150)); expectedList.add(new Interval("chr1", 150, 250)); expectedList.add(new Interval("chr2", 50, 150)); expectedList.add(new Interval("chr3", 50, 150)); expectedList.add(new Interval("chr1", 50, 150, true, "number-5")); expectedList.add(new Interval("chr1", 150, 250, false, "number-6")); try(final OutputStream outputStream = new FileOutputStream(tempFile)) { final IntervalCodec writeCodec = new IntervalCodec(this.dict); writeCodec.setOutputStream(outputStream); for (final Interval interval : expectedList.getIntervals()) { writeCodec.encode(interval); } } final IntervalCodec readCodec = new IntervalCodec(this.dict); try(final InputStream inputStream = new FileInputStream(tempFile)) { readCodec.setInputStream(inputStream); while (true) { final Interval interval = readCodec.decode(); if (interval == null) { break; } else { actualList.add(interval); } } } Assert.assertEquals( actualList.getIntervals(), expectedList.getIntervals() ); }

Target:
public void testEndToEnd() throws IOException { final File tempFile = File.createTempFile("IntervalCodecTest.", ".interval_list"); tempFile.deleteOnExit(); final IntervalList expectedList = new IntervalList(this.dict); final IntervalList actualList = new IntervalList(this.dict); expectedList.add(new Interval("chr1", 50, 150)); expectedList.add(new Interval("chr1", 150, 250)); expectedList.add(new Interval("chr2", 50, 150)); expectedList.add(new Interval("chr3", 50, 150)); expectedList.add(new Interval("chr1", 50, 150, true, "number-5")); expectedList.add(new Interval("chr1", 150, 250, false, "number-6")); try (final OutputStream outputStream = new FileOutputStream(tempFile)) { final IntervalCodec writeCodec = new IntervalCodec(this.dict); writeCodec.setOutputStream(outputStream); for (final Interval interval : expectedList.getIntervals()) { writeCodec.encode(interval); } } final IntervalCodec readCodec = new IntervalCodec(this.dict); try (final InputStream inputStream = new FileInputStream(tempFile)) { readCodec.setInputStream(inputStream); while (true) { final Interval interval = readCodec.decode(); if (interval == null) { break; } actualList.add(interval); } } Assert.assertEquals( actualList.getIntervals(), expectedList.getIntervals() ); }
Source:
private static URI fixFileURL(URL u) { if (!"file".equals(u.getProtocol())) throw new IllegalArgumentException(); return new File(u.getFile()).toURI(); }

Target:
private static URI fixFileURL(URL u) { if (!"file".equals(u.getProtocol())) { throw new IllegalArgumentException(); } return new File(u.getFile()).toURI(); }
Source:
public Intent getIntentForBrokerActivity(final AuthenticationRequest request, final BrokerEvent brokerEvent) throws AuthenticationException { final String methodName = ":getIntentForBrokerActivity"; final Bundle requestBundle = getBrokerOptions(request); final Intent intent; if (isBrokerAccountServiceSupported()) { intent = BrokerAccountServiceHandler.getInstance().getIntentForInteractiveRequest(mContext, brokerEvent); if (intent == null) { Logger.e(TAG, "Received null intent from broker interactive request.", null, ADALError.BROKER_AUTHENTICATOR_NOT_RESPONDING); final AuthenticationException authenticationException = new AuthenticationException(ADALError.BROKER_AUTHENTICATOR_NOT_RESPONDING, "Received null intent from broker interactive request."); brokerEvent.setBrokerAccountServiceConnectionErrorInfo(authenticationException); throw authenticationException; } else { intent.putExtras(requestBundle); } } else { intent = getIntentForBrokerActivityFromAccountManager(requestBundle); } if (intent != null) { intent.putExtra(AuthenticationConstants.Broker.BROKER_REQUEST, AuthenticationConstants.Broker.BROKER_REQUEST); if (!isBrokerWithPRTSupport(intent) && PromptBehavior.FORCE_PROMPT == request.getPrompt()) { Logger.v(TAG + methodName, "FORCE_PROMPT is set for broker auth via old version of broker app, reset to ALWAYS."); intent.putExtra(AuthenticationConstants.Broker.ACCOUNT_PROMPT, PromptBehavior.Always.name()); } } return intent; }

Target:
public Intent getIntentForBrokerActivity(final AuthenticationRequest request, final BrokerEvent brokerEvent) throws AuthenticationException { setBrokerInstallationStatuses(brokerEvent); final String methodName = ":getIntentForBrokerActivity"; final Bundle requestBundle = getBrokerOptions(request); final Intent intent; if (isBrokerAccountServiceSupported()) { intent = BrokerAccountServiceHandler.getInstance().getIntentForInteractiveRequest(mContext, brokerEvent); if (intent == null) { Logger.e(TAG, "Received null intent from broker interactive request.", null, ADALError.BROKER_AUTHENTICATOR_NOT_RESPONDING); final AuthenticationException authenticationException = new AuthenticationException(ADALError.BROKER_AUTHENTICATOR_NOT_RESPONDING, "Received null intent from broker interactive request."); brokerEvent.setBrokerAccountServiceConnectionErrorInfo(authenticationException); brokerEvent.setBrokerError(BrokerEvent.BrokerError.BROKER_INTENT_MALFORMED_OR_NULL); throw authenticationException; } else { intent.putExtras(requestBundle); } } else { intent = getIntentForBrokerActivityFromAccountManager(requestBundle); } if (intent != null) { intent.putExtra(AuthenticationConstants.Broker.BROKER_REQUEST, AuthenticationConstants.Broker.BROKER_REQUEST); if (!isBrokerWithPRTSupport(intent) && PromptBehavior.FORCE_PROMPT == request.getPrompt()) { Logger.v(TAG + methodName, "FORCE_PROMPT is set for broker auth via old version of broker app, reset to ALWAYS."); intent.putExtra(AuthenticationConstants.Broker.ACCOUNT_PROMPT, PromptBehavior.Always.name()); } } return intent; }
Source:
private static @Nullable State getEventState(TimeEvent event) { if (event.hasValue()) { VirtualMachineViewEntry entry = (VirtualMachineViewEntry) event.getEntry(); int value = event.getValue(); if (entry.getType() == Type.VCPU) { if ((value & VcpuStateValues.VCPU_PREEMPT) > 0) { return State.VCPU_PREEMPTED; } else if ((value & VcpuStateValues.VCPU_VMM) > 0) { return State.WAIT_VMM; } else if (value == 2) { return State.USERMODE; } else if (value == 1) { return State.IDLE; } else { return State.UNKNOWN; } } else if (entry.getType() == Type.THREAD) { if (value == VcpuStateValues.VCPU_PREEMPT) { return null; } switch (value) { case StateValues.PROCESS_STATUS_RUN_USERMODE: return State.THREAD_USERMODE; case StateValues.PROCESS_STATUS_RUN_SYSCALL: return State.THREAD_SYSCALL; case StateValues.PROCESS_STATUS_WAIT_FOR_CPU: return State.THREAD_WAIT_FOR_CPU; case StateValues.PROCESS_STATUS_WAIT_BLOCKED: return State.THREAD_WAIT_BLOCKED; case StateValues.PROCESS_STATUS_INTERRUPTED: return State.THREAD_INTERRUPTED; case StateValues.PROCESS_STATUS_UNKNOWN: case StateValues.PROCESS_STATUS_WAIT_UNKNOWN: return State.THREAD_UNKNOWN; default: return null; } } } return null; }

Target:
private static @Nullable State getEventState(TimeEvent event) { if (event.hasValue()) { VirtualMachineViewEntry entry = (VirtualMachineViewEntry) event.getEntry(); int value = event.getValue(); if (entry.getType() == Type.VCPU) { return getStateForVcpu(value); } else if (entry.getType() == Type.THREAD) { return getStateForThread(value); } } return null; }
Source:
private <T, U> Map<T, U> getGuestOsInto(){ Map resultMap = map(); resultMap.put("kernel","2.6.32-642.el6.x86_64"); resultMap.put("type", "linux"); resultMap.put("version", "6.7"); resultMap.put("arch", "x86_64"); resultMap.put("codename", "Santiago"); resultMap.put("distribution", "Red Hat Enterprise Linux Server"); return resultMap; }

Target:
private Map<String, String> getGuestOsInto(){ Map<String, String> resultMap = map(); resultMap.put("kernel","2.6.32-642.el6.x86_64"); resultMap.put("type", "linux"); resultMap.put("version", "6.7"); resultMap.put("arch", "x86_64"); resultMap.put("codename", "Santiago"); resultMap.put("distribution", "Red Hat Enterprise Linux Server"); return resultMap; }
Source:
public EnhancerFactoryData(Class generatedClass, Class[] primaryConstructorArgTypes, boolean classOnly) { this.generatedClass = generatedClass; try { setThreadCallbacks = getCallbacksSetter(generatedClass, SET_THREAD_CALLBACKS_NAME); setThreadCallbacks.setAccessible(true); if (classOnly) { this.primaryConstructorArgTypes = null; this.primaryConstructor = null; } else { this.primaryConstructorArgTypes = primaryConstructorArgTypes; this.primaryConstructor = generatedClass.getDeclaredConstructor(primaryConstructorArgTypes); primaryConstructor.setAccessible(true); } } catch (NoSuchMethodException e) { throw new CodeGenerationException(e); } }

Target:
public EnhancerFactoryData(Class generatedClass, Class[] primaryConstructorArgTypes, boolean classOnly) { this.generatedClass = generatedClass; try { setThreadCallbacks = getCallbacksSetter(generatedClass, SET_THREAD_CALLBACKS_NAME); if (classOnly) { this.primaryConstructorArgTypes = null; this.primaryConstructor = null; } else { this.primaryConstructorArgTypes = primaryConstructorArgTypes; this.primaryConstructor = ReflectUtils.getConstructor(generatedClass, primaryConstructorArgTypes); } } catch (NoSuchMethodException e) { throw new CodeGenerationException(e); } }