auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public SPageURL resolvePageURL(SPageMapping pageMapping, Map<String, Serializable> context) throws SExecutionException, SAuthorizationException { final List<String> pageAuthorizationRules = pageMapping.getPageAuthorizationRules(); <START> final List<AuthorizationRule> rules = getRules(pageAuthorizationRules); <END> for (AuthorizationRule rule : rules) { if (!rule.isAllowed(context)) { throw new SAuthorizationException("Access to Page or URL with key " + pageMapping.getKey() + " is not allowed"); } } String url = pageMapping.getUrl(); String urlAdapter = pageMapping.getUrlAdapter(); if (urlAdapter != null) { url = getUrlAdapter(urlAdapter).adapt(url, pageMapping.getKey(), context); } return new SPageURL(url, pageMapping.getPageId()); }</code><technical_language>avoid create a a list of rule iterate pageAuthorizationRules</technical_language>

Target:
public SPageURL resolvePageURL(SPageMapping pageMapping, Map<String, Serializable> context) throws SExecutionException, SAuthorizationException { final List<String> pageAuthorizationRules = pageMapping.getPageAuthorizationRules(); for (String rule : pageAuthorizationRules) { final AuthorizationRule authorizationRule = authorizationRuleMap.get(rule); if (authorizationRule == null) { throw new SExecutionException("Authorization rule " + rule + " is not known. Cannot check if authorized or not."); } if (!authorizationRule.isAllowed(context)) { throw new SAuthorizationException("Access to Page or URL with key " + pageMapping.getKey() + " is not allowed"); } } String url = pageMapping.getUrl(); String urlAdapter = pageMapping.getUrlAdapter(); if (urlAdapter != null) { url = getUrlAdapter(urlAdapter).adapt(url, pageMapping.getKey(), context); } return new SPageURL(url, pageMapping.getPageId()); }
Source:
<code>protected List<Resource<?>> doListResources() { if (isStale()) { listCache = null; } if (listCache == null) { listCache = new LinkedList<Resource<?>>(); ZipFile zip = null; try { zip = new ZipFile(file); Enumeration<? extends ZipEntry> entries = zip.entries(); while (entries.hasMoreElements()) { listCache.add(getChild(entries.nextElement().getName())); } } catch (IOException io) { throw new ResourceException("Error reading entries of zip file [" + getFullyQualifiedName() + "]", io); } finally { closeQuietily(zip); } } <START> return listCache.isEmpty() ? Collections.<Resource<?>> emptyList() : listCache; <END> }</code><technical_language>return listCache in</technical_language>

Target:
protected List<Resource<?>> doListResources() { return getRootEntry().doListResources(); }
Source:
<code>public RecordWriter getWriter() { <START> if (clazz == boolean.class) { <END> return new PrimitiveWriters.PrimitiveBooleanWriter(); } else if (clazz == Boolean.class) { return new PrimitiveWriters.BooleanWriter(); } else if (clazz == byte.class) { return new PrimitiveWriters.PrimitiveByteWriter(); } else if (clazz == Byte.class) { return new PrimitiveWriters.ByteWriter(); } else if (clazz == char.class) { return new PrimitiveWriters.PrimitiveCharWriter(); } else if (clazz == Character.class) { return new PrimitiveWriters.CharWriter(); } else if (clazz == short.class) { return new PrimitiveWriters.PrimitiveShortWriter(); } else if (clazz == Short.class) { return new PrimitiveWriters.ShortWriter(); } else if (clazz.isEnum()) { return new PrimitiveWriters.EnumWriter(); } else if (clazz == int.class) { return new PrimitiveWriters.PrimitiveIntWriter(); } else if (clazz == Integer.class) { return new PrimitiveWriters.IntWriter(); } else if (clazz == long.class) { return new PrimitiveWriters.PrimitiveLongWriter(); } else if (clazz == Long.class) { return new PrimitiveWriters.LongWriter(); } else if (clazz == float.class) { return new PrimitiveWriters.PrimitiveFloatWriter(); } else if (clazz == Float.class) { return new PrimitiveWriters.FloatWriter(); } else if (clazz == double.class) { return new PrimitiveWriters.PrimitiveDoubleWriter(); } else if (clazz == Double.class) { return new PrimitiveWriters.DoubleWriter(); } else if (clazz == byte[].class) { return new PrimitiveWriters.ByteArrayWriter(); } else if (clazz == String.class) { return new PrimitiveWriters.StringWriter(); } throw new IllegalStateException(String.format("Type %s could not be mapped to a writer.", clazz)); }</code><technical_language>ibid</technical_language>

Target:
public RecordWriter getWriter() { if(clazz.isEnum()) { return new PrimitiveWriters.EnumWriter(); } RecordWriter recordWriter = typeToWriter.get(clazz); if (recordWriter != null) { return recordWriter; } throw new IllegalStateException(String.format("Type %s could not be mapped to a writer.", clazz)); }
Source:
<code>public Map<String, AnalysisProvider<TokenFilterFactory>> getTokenFilters() { <START> return singletonMap("surrogate_merger", SurrogateMergerFilterFactory::new); <END> }</code><technical_language>remove factory class use: return singletonMap("surrogate_merger", (isettings, env, name, settings) -> new TokenFilterFactory() { @Override public String name() { return name; } @Override public TokenStream create(TokenStream tokenStream) { return new SurrogateMergerFilter(tokenStream); } });</technical_language>

Target:
public Map<String, AnalysisProvider<TokenFilterFactory>> getTokenFilters() { return singletonMap("surrogate_merger", (isettings, env, name, settings) -> new TokenFilterFactory() { @Override public String name() { return name; } @Override public TokenStream create(TokenStream tokenStream) { return new SurrogateMergerFilter(tokenStream); } }); }
Source:
<code>protected Object handleRead(Object target, String attributeName, Object value) { <START> if ( initialized ) { <END> throw new IllegalStateException( "EnhancementAsProxyLazinessInterceptor interception on an initialized instance" ); } if ( identifierAttributeNames.contains( attributeName ) ) { return extractIdValue( target, attributeName ); } try { return forceInitialize( target, attributeName ); } finally { initialized = true; } }</code><technical_language>entityKey non-null</technical_language>

Target:
protected Object handleRead(Object target, String attributeName, Object value) { if ( initialized ) { throw new IllegalStateException( "EnhancementAsProxyLazinessInterceptor interception on an initialized instance" ); } if ( identifierAttributeNames.contains( attributeName ) ) { return extractIdValue( target, attributeName ); } return EnhancementHelper.performWork( this, (session, isTempSession) -> { final Object[] writtenValues; final EntityPersister entityPersister = session.getFactory() .getMetamodel() .entityPersister( getEntityName() ); final EntityTuplizer entityTuplizer = entityPersister.getEntityTuplizer(); if ( inLineDirtyChecking && writtenFieldNames != null && !writtenFieldNames.isEmpty() ) { if ( writtenFieldNames.contains( attributeName ) ) { return entityTuplizer.getPropertyValue( target, attributeName ); } writtenValues = new Object[writtenFieldNames.size()]; int index = 0; for ( String writtenFieldName : writtenFieldNames ) { writtenValues[index] = entityTuplizer.getPropertyValue( target, writtenFieldName ); index++; } } else { writtenValues = null; } final Object initializedValue = forceInitialize( target, attributeName, session, isTempSession ); initialized = true; if ( writtenValues != null ) { int index = 0; for ( String writtenFieldName : writtenFieldNames ) { entityTuplizer.setPropertyValue( target, writtenFieldName, writtenValues[index++] ); } writtenFieldNames.clear(); } return initializedValue; }, getEntityName(), attributeName ); }
Source:
<code>private void removeDiskImages() { List<DiskImage> images = DisksFilter.filterImageDisks(getVm().getDiskMap().values(), ONLY_NOT_SHAREABLE, ONLY_ACTIVE); for (DiskImage image : images) { image.setStorageIds(new ArrayList<>(Arrays.asList(getParameters().getStorageDomainId()))); image.setStoragePoolId(getParameters().getStoragePoolId()); } Set<String> allMemoryVolumes = MemoryUtils.getMemoryVolumesFromSnapshots(getVm().getSnapshots()); for (String memoryVolumes : allMemoryVolumes) { if (!StringUtils.isEmpty(memoryVolumes)) { List<Guid> <START> guids = <END> Guid.createGuidListFromString(memoryVolumes); DiskImage memoryDisk = createMemoryDisk(guids.get(2), guids.get(3)); images.add(memoryDisk); DiskImage metadataDisk = createMemoryDisk(guids.get(4), guids.get(5)); images.add(metadataDisk); } } removeVmImages(images); }</code><technical_language>Previously checked size logged a warning if expected. need anymore</technical_language>

Target:
private void removeDiskImages() { List<DiskImage> images = DisksFilter.filterImageDisks(getVm().getDiskMap().values(), ONLY_NOT_SHAREABLE, ONLY_ACTIVE); boolean shouldWipe = false; for (DiskImage image : images) { image.setStorageIds(new ArrayList<>(Arrays.asList(getParameters().getStorageDomainId()))); image.setStoragePoolId(getParameters().getStoragePoolId()); shouldWipe |= image.isWipeAfterDelete(); } Set<String> allMemoryVolumes = MemoryUtils.getMemoryVolumesFromSnapshots(getVm().getSnapshots()); for (String memoryVolumes : allMemoryVolumes) { if (!StringUtils.isEmpty(memoryVolumes)) { List<Guid> guids = Guid.createGuidListFromString(memoryVolumes); DiskImage memoryDisk = createMemoryDisk(guids.get(2), guids.get(3), shouldWipe); images.add(memoryDisk); DiskImage metadataDisk = createMemoryDisk(guids.get(4), guids.get(5), shouldWipe); images.add(metadataDisk); } } removeVmImages(images); }
Source:
<code>private void checkEntityTypeAndServiceUp(Entity entity, Class<? extends Entity> expectedClass) { Assert.assertNotNull(entity); Assert.assertTrue(expectedClass.isAssignableFrom(entity.getClass()), "expected: " + expectedClass + " on interfaces, found: " + entity.getClass().getInterfaces()); <START> EntityTestUtils.assertAttributeEquals(entity, Startable.SERVICE_UP, true); <END> }</code><technical_language>I if need assertAttributeEqualsEventually</technical_language>

Target:
private void checkEntityTypeAndServiceUp(Entity entity, Class<? extends Entity> expectedClass) { Assert.assertNotNull(entity); Assert.assertTrue(expectedClass.isAssignableFrom(entity.getClass()), "expected: " + expectedClass + " on interfaces, found: " + entity.getClass().getInterfaces()); EntityTestUtils.assertAttributeEqualsEventually(entity, Startable.SERVICE_UP, true); }
Source:
<code>public void open() throws InterpreterException { setProperty("zeppelin.python.useIPython", getProperty("zeppelin.pyspark.useIPython", "true")); DepInterpreter depInterpreter = getDepInterpreter(); URL urls = new URL[0]; List<URL> urlList = new LinkedList<>(); if (depInterpreter != null) { SparkDependencyContext depc = depInterpreter.getDependencyContext(); if (depc != null) { List<File> files = depc.getFiles(); if (files != null) { for (File f : files) { try { urlList.add(f.toURI().toURL()); } catch (MalformedURLException e) { LOGGER.error("Error", e); } } } } } String localRepo = getProperty("zeppelin.interpreter.localRepo"); if (localRepo != null) { File localRepoDir = new File(localRepo); if (localRepoDir.exists()) { File[] files = localRepoDir.listFiles(); if (files != null) { for (File f : files) { try { urlList.add(f.toURI().toURL()); } catch (MalformedURLException e) { LOGGER.error("Error", e); } } } } } urls = urlList.toArray(urls); ClassLoader oldCl = Thread.currentThread().getContextClassLoader(); try { URLClassLoader newCl = new URLClassLoader(urls, oldCl); Thread.currentThread().setContextClassLoader(newCl); super.open(); this.sparkInterpreter = getSparkInterpreter(); } finally { Thread.currentThread().setContextClassLoader(oldCl); } if (!useIPython()) { try { bootstrapInterpreter("python/zeppelin_pyspark.py"); } catch (IOException e) { <START> e.printStackTrace(); <END> } } }</code><technical_language>log</technical_language>

Target:
public void open() throws InterpreterException { setProperty("zeppelin.python.useIPython", getProperty("zeppelin.pyspark.useIPython", "true")); DepInterpreter depInterpreter = getDepInterpreter(); URL urls = new URL[0]; List<URL> urlList = new LinkedList<>(); if (depInterpreter != null) { SparkDependencyContext depc = depInterpreter.getDependencyContext(); if (depc != null) { List<File> files = depc.getFiles(); if (files != null) { for (File f : files) { try { urlList.add(f.toURI().toURL()); } catch (MalformedURLException e) { LOGGER.error("Error", e); } } } } } String localRepo = getProperty("zeppelin.interpreter.localRepo"); if (localRepo != null) { File localRepoDir = new File(localRepo); if (localRepoDir.exists()) { File[] files = localRepoDir.listFiles(); if (files != null) { for (File f : files) { try { urlList.add(f.toURI().toURL()); } catch (MalformedURLException e) { LOGGER.error("Error", e); } } } } } urls = urlList.toArray(urls); ClassLoader oldCl = Thread.currentThread().getContextClassLoader(); try { URLClassLoader newCl = new URLClassLoader(urls, oldCl); Thread.currentThread().setContextClassLoader(newCl); super.open(); this.sparkInterpreter = getSparkInterpreter(); } finally { Thread.currentThread().setContextClassLoader(oldCl); } if (!useIPython()) { try { bootstrapInterpreter("python/zeppelin_pyspark.py"); } catch (IOException e) { throw new InterpreterException("Fail to bootstrap pyspark", e); } } }
Source:
<code>public void excludeColumns(String name) throws MaxwellInvalidFilterException { <START> excludeColumns.add(name); <END> }</code><technical_language>in other patterns do compile(name) lets do regexp-based exclusion. support pattern here</technical_language>

Target:
public void excludeColumns(String name) throws MaxwellInvalidFilterException { excludeColumns.add(compile(name)); }
Source:
<code>public String getTaskHsitoryList(String taskID) throws JSONException, SQLException { ConvertSprintBacklog csb = new ConvertSprintBacklog(); TaskObject task = TaskObject.get(Long.parseLong(taskID)); List<HistoryObject> taskHistoryList = task.getHistories(); <START> List<String> remainsList = new ArrayList<String>(); <END> String lastRemainsHour = "0"; for (HistoryObject history : taskHistoryList) { String date = parseDate(history.getCreateTime()); lastRemainsHour = task.getRemains(new Date(date)) + ""; remainsList.add(lastRemainsHour); } String taskHistoryJsonString = csb.convertTaskHistory(taskHistoryList, remainsList); return taskHistoryJsonString; }</code><technical_language>remainses</technical_language>

Target:
public String getTaskHsitoryList(String taskID) throws JSONException, SQLException { ConvertSprintBacklog csb = new ConvertSprintBacklog(); TaskObject task = TaskObject.get(Long.parseLong(taskID)); List<HistoryObject> taskHistories = task.getHistories(); List<String> remainsList = new ArrayList<String>(); String lastRemainsHour = "0"; for (HistoryObject history : taskHistories) { String date = parseDate(history.getCreateTime()); lastRemainsHour = task.getRemains(new Date(date)) + ""; remainsList.add(lastRemainsHour); } String taskHistoryJsonString = csb.convertTaskHistory(taskHistories, remainsList); return taskHistoryJsonString; }
Source:
<code>public Records fetch() throws IOException { int retryCount = 0; final QueryStatistics.Measurer statTracker = new QueryStatistics.Measurer(); statTracker.recordQueryPrepStart(); PreparedStatement preparedStatement = getPreparedStatement(); statTracker.recordQueryPrepEnd(); while (true) { try { statTracker.recordAttempt(); statTracker.recordQueryExecStart(); final Records queryResults = getQueryResults(preparedStatement); statTracker.recordQueryExecEnd(); final QueryStatistics statistics = statTracker.calculate(); queryResults.addStatistics(statistics); try { postQueryAction.perform(statistics); } catch (Exception ignoredException) { <START> LOG.info(String.format("Error occurred running post-query action %s", postQueryAction), ignoredException); <END> } return queryResults; } catch (SQLRecoverableException e) { LOG.error(e.toString()); if (++retryCount > MAX_CONNECTION_RETRIES) { throw new IOException(e); } } catch (SQLException e) { throw new IOException(e); } } }</code><technical_language>I LOG.error is justified</technical_language>

Target:
public Records fetch() throws IOException { int retryCount = 0; final QueryStatistics.Measurer statTracker = new QueryStatistics.Measurer(); statTracker.recordQueryPrepStart(); PreparedStatement preparedStatement = getPreparedStatement(); statTracker.recordQueryPrepEnd(); while (true) { try { statTracker.recordAttempt(); statTracker.recordQueryExecStart(); final Records queryResults = getQueryResults(preparedStatement); statTracker.recordQueryExecEnd(); final QueryStatistics statistics = statTracker.calculate(); queryResults.addStatistics(statistics); try { postQueryAction.perform(statistics); } catch (Exception ignoredException) { LOG.error(String.format("Error occurred running post-query action %s", postQueryAction), ignoredException); } return queryResults; } catch (SQLRecoverableException e) { LOG.error(e.toString()); if (++retryCount > MAX_CONNECTION_RETRIES) { throw new IOException(e); } } catch (SQLException e) { throw new IOException(e); } } }
Source:
<code>private void writeCheckpointIfNeed() { if (commitNeeded) { <START> throw new IllegalStateException("A checkpoint should only be written if now commit is needed."); <END> } if (checkpoint != null) { stateMgr.checkpoint(checkpoint); checkpoint = null; } }</code><technical_language>if commit is needed</technical_language>

Target:
private void writeCheckpointIfNeed() { if (commitNeeded) { throw new IllegalStateException("A checkpoint should only be written if no commit is needed."); } if (checkpoint != null) { stateMgr.checkpoint(checkpoint); checkpoint = null; } }
Source:
<code>private Throwable mapError(Throwable throwable, ServiceBusErrorSource errorSource) { <START> if ((throwable instanceof ServiceBusReceiverException) || !(throwable instanceof AmqpException)) { return throwable; } else { return new ServiceBusReceiverException((AmqpException) throwable, errorSource); } <END> }</code><technical_language>This simplified java if (throwable instanceof AmqpException) { return new ServiceBusReceiverException((AmqpException) throwable, errorSource); } return throwable;</technical_language>

Target:
private Throwable mapError(Throwable throwable, ServiceBusErrorSource errorSource) { if (!(throwable instanceof ServiceBusReceiverException)) { return new ServiceBusReceiverException(throwable, errorSource); } return throwable; }
Source:
<code>public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException { for (Argument arg : scriptEntry.getProcessedArgs()) { if (!scriptEntry.hasObject("players") && arg.matchesPrefix("to", "players")) { scriptEntry.addObject("players", arg.asType(ListTag.class).filter(PlayerTag.class, scriptEntry)); } else if (arg.matchesPrefix("d", "duration") && arg.matchesArgumentType(DurationTag.class)) { scriptEntry.addObject("duration", arg.asType(DurationTag.class)); } else if (!scriptEntry.hasObject("entity") && arg.matchesArgumentType(EntityTag.class)) { scriptEntry.addObject("entity", arg.asType(EntityTag.class)); } else if (!scriptEntry.hasObject("location") && arg.matchesArgumentType(LocationTag.class)) { scriptEntry.addObject("location", arg.asType(LocationTag.class)); } else { arg.reportUnhandled(); } } if (!scriptEntry.hasObject("players") && Utilities.entryHasPlayer(scriptEntry)) { List<PlayerTag> players = new ArrayList<>(); players.add(Utilities.getEntryPlayer(scriptEntry)); <START> scriptEntry.defaultObject("players", players); <END> } if (!scriptEntry.hasObject("location")) { throw new InvalidArgumentsException("Must specify a valid location!"); } if (!scriptEntry.hasObject("players")) { throw new InvalidArgumentsException("Must have a valid, online player attached!"); } if (!scriptEntry.hasObject("entity")) { throw new InvalidArgumentsException("Must specify a valid entity!"); } scriptEntry.defaultObject("duration", new DurationTag(10)); }</code><technical_language>scriptEntry.defaultObject("players", Arrays.asList(Utilities.getEntryPlayer(scriptEntry))); * I this overly long code is copied ShowFake fix instance of</technical_language>

Target:
public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException { for (Argument arg : scriptEntry.getProcessedArgs()) { if (!scriptEntry.hasObject("players") && arg.matchesPrefix("to", "players")) { scriptEntry.addObject("players", arg.asType(ListTag.class).filter(PlayerTag.class, scriptEntry)); } else if (arg.matchesPrefix("d", "duration") && arg.matchesArgumentType(DurationTag.class)) { scriptEntry.addObject("duration", arg.asType(DurationTag.class)); } else if (!scriptEntry.hasObject("entity") && arg.matchesArgumentType(EntityTag.class)) { scriptEntry.addObject("entity", arg.asType(EntityTag.class)); } else if (!scriptEntry.hasObject("location") && arg.matchesArgumentType(LocationTag.class)) { scriptEntry.addObject("location", arg.asType(LocationTag.class)); } else { arg.reportUnhandled(); } } if (!scriptEntry.hasObject("players") && Utilities.entryHasPlayer(scriptEntry)) { scriptEntry.defaultObject("players", Arrays.asList(Utilities.getEntryPlayer(scriptEntry))); } if (!scriptEntry.hasObject("location")) { throw new InvalidArgumentsException("Must specify a valid location!"); } if (!scriptEntry.hasObject("players")) { throw new InvalidArgumentsException("Must have a valid, online player attached!"); } if (!scriptEntry.hasObject("entity")) { throw new InvalidArgumentsException("Must specify a valid entity!"); } scriptEntry.defaultObject("duration", new DurationTag(10)); }
Source:
<code>protected <P extends Archive<?> & ClassContainer<?>> void processClasses(P archive) { if (classes == null || classes.isEmpty()) { return; } if (isSinglePackage(classes)) { Package classesPackage = null; final List<String> simpleNames = new ArrayList<String>(classes.size()); for (Class<?> clazz : classes) { if (skipClassName(clazz.getName())) { continue; } simpleNames.add(clazz.getSimpleName()); if (classesPackage == null) { classesPackage = clazz.getPackage(); } Asset resource = new ClassAsset(clazz); ArchivePath location = ArchivePaths.create(resolveClassesPath(archive), AssetUtil.getFullPathForClassResource(clazz)); archive.add(resource, location); } archive.addPackages(false, new Filter<ArchivePath>() { @Override public boolean include(ArchivePath path) { String pathStr = path.get(); for (String simpleName : simpleNames) { if (isInnerClassCandidate(simpleName, pathStr)) { <START> return pathStr.matches(String.format(".*%s%s%s.+\\.class", AssetUtil.DELIMITER_RESOURCE_PATH, simpleName, INNER_CLASS_MARKER)); <END> } } return false; } }, classesPackage); } else { for (Class<?> clazz : classes) { if (skipClassName(clazz.getName())) { continue; } archive.addClass(clazz); } } }</code><technical_language>for uniformity: a constant AssetUtil is instead of "/", AssetUtil.DELIMITER_CLASS_NAME_PATH instead of "\."</technical_language>

Target:
protected <P extends Archive<?> & ClassContainer<?>> void processClasses(P archive) { if (classes == null || classes.isEmpty()) { return; } if (isSinglePackage(classes)) { Package classesPackage = null; final List<String> simpleNames = new ArrayList<String>(classes.size()); for (Class<?> clazz : classes) { if (skipClassName(clazz.getName())) { continue; } simpleNames.add(clazz.getSimpleName()); if (classesPackage == null) { classesPackage = clazz.getPackage(); } Asset resource = new ClassAsset(clazz); ArchivePath location = ArchivePaths.create(resolveClassesPath(archive), AssetUtil.getFullPathForClassResource(clazz)); archive.add(resource, location); } archive.addPackages(false, new Filter<ArchivePath>() { @Override public boolean include(ArchivePath path) { String pathStr = path.get(); for (String simpleName : simpleNames) { if (isInnerClassCandidate(simpleName, pathStr)) { return pathStr.matches(String.format(INNER_CLASS_MATCH_PATTERN_BASE, simpleName)); } } return false; } }, classesPackage); } else { for (Class<?> clazz : classes) { if (skipClassName(clazz.getName())) { continue; } archive.addClass(clazz); } } }
Source:
<code>public void test() throws Exception { final String className = "Example"; final ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES) { @Override protected String getCommonSuperClass(final String type1, final String type2) { computedCommonSuperClass = true; return "java/lang/Object"; } }; cw.visit(Opcodes.V1_5, Opcodes.ACC_PUBLIC, className, null, "java/lang/Object", null); final MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "m", "()V", null, null); mv.visitCode(); addCauseOfResizeInstructions(mv); addCauseOfGetCommonSuperClass(mv); mv.visitMaxs(1, 1); mv.visitEnd(); cw.visitEnd(); final byte[] original = cw.toByteArray(); <START> assertEquals(true, computedCommonSuperClass); <END> load(className, original); instrumenter.instrument(original, className); }</code><technical_language>I prefer assertTrue(computedCommonSuperClass) I consistently in other tests</technical_language>

Target:
public void test() throws Exception { final String className = "Example"; final ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES) { @Override protected String getCommonSuperClass(final String type1, final String type2) { computedCommonSuperClass |= className.equals(type1) || className.equals(type2); return "java/lang/Object"; } }; cw.visit(Opcodes.V1_5, Opcodes.ACC_PUBLIC, className, null, "java/lang/Object", null); final MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "m", "()V", null, null); mv.visitCode(); addCauseOfResizeInstructions(mv); addCauseOfGetCommonSuperClass(mv); mv.visitMaxs(1, 1); mv.visitEnd(); cw.visitEnd(); final byte[] original = cw.toByteArray(); assertTrue(computedCommonSuperClass); new TargetLoader().add(className, original); final byte[] instrumented = instrumenter.instrument(original, className); new TargetLoader().add(className, instrumented); }
Source:
<code><START> public static void getStringAnnotation(QuotedEntityChecker checker, String template, String value) <END> throws Exception { }</code><technical_language>sense signatures changed void, if deprecated</technical_language>

Target:
public static OWLAnnotation getStringAnnotation( QuotedEntityChecker checker, String template, String value) throws Exception { return TemplateHelper.getStringAnnotation(checker, template, value); }
Source:
<code>public void addPrivatePackage(String packageName) { <START> String key = hasPrivatePackageHeader() ? Constants.PRIVATE_PACKAGE : Constants.PRIVATEPACKAGE; <END> List<String> packages = getEntries(key, listConverter); packages.add(packageName); setEntries(packages, key); }</code><technical_language>In setPrivatePackages, prefer instruction. prefer header. I prefer newer instruction. If instruction, add new it</technical_language>

Target:
public void addPrivatePackage(String packageName) { String key = hasPrivatePackageInstruction() ? Constants.PRIVATEPACKAGE : Constants.PRIVATE_PACKAGE; List<String> packages = getEntries(key, listConverter); packages.add(packageName); setEntries(packages, key); }
Source:
<code>public List<? extends BoundedSource<KV<K, V>>> splitIntoBundles(long desiredBundleSizeBytes, PipelineOptions options) throws Exception { if (serializableSplit == null) { <START> desiredBundleSizeBytes = Math.max(desiredBundleSizeBytes, ONE_HUNDRED_MB); <END> List<InputSplit> splits = computeSplits(desiredBundleSizeBytes); SOURCE_LOG.info("Got " + splits.size() + " splits."); Collections.shuffle(splits); return Lists.transform(splits, new Function<InputSplit, BoundedSource<KV<K, V>>>() { @Nullable @Override public BoundedSource<KV<K, V>> apply(@Nullable InputSplit inputSplit) { return new HadoopFileSource<K, V>(filepattern, formatClass, keyClass, valueClass, new SerializableSplit(inputSplit), overrideOutputCoder, serializationProperties); } }); } else { return ImmutableList.of(this); } }</code><technical_language>nit: try mutate input parameter. though</technical_language>

Target:
public List<? extends BoundedSource<KV<K, V>>> splitIntoBundles(long desiredBundleSizeBytes, PipelineOptions options) throws Exception { if (serializableSplit == null) { long bundleSizeBytes = Math.max(desiredBundleSizeBytes, MIN_BUNDLE_SIZE_BYTES); List<InputSplit> splits = computeSplits(bundleSizeBytes); SOURCE_LOG.info("Got " + splits.size() + " splits."); Collections.shuffle(splits); return Lists.transform(splits, new Function<InputSplit, BoundedSource<KV<K, V>>>() { @Nullable @Override public BoundedSource<KV<K, V>> apply(@Nullable InputSplit inputSplit) { return new HadoopFileSource<K, V>(filepattern, formatClass, keyClass, valueClass, new SerializableSplit(inputSplit), overrideOutputCoder, serializationProperties); } }); } else { return ImmutableList.of(this); } }
Source:
<code>for (int i = 0; i < extraColumns.size(); i++) { <START> EXTRA_COLUMNS[i] = new GridColumns(extraColumns.get(i).getName(), <END> extraColumns.get(i).getTitle(), extraColumns.get(i).isHidden()); }</code><technical_language>Factorize extraColumns.get(i) extracting a variable</technical_language>

Target:
for (int i = 0; i < extraColumns.size(); i++) { JSONColumn columnConfiguration = extraColumns.get(i); EXTRA_COLUMNS[i] = new GridColumns(columnConfiguration.getName(), columnConfiguration.getTitle(), columnConfiguration.isHidden()); }
Source:
<code>public void edit(final GlusterVolumeGeoRepCreateModel object) { driver.edit(object); setSuggestedConfigViolations(object.getRecommendationViolations()); setUserGroupVisibility(false); <START> object.getShowEligibleVolumes().getEntityChangedEvent().addListener(new <END> IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { boolean overrideSuggestedConfig = object.getShowEligibleVolumes().getEntity(); if(!overrideSuggestedConfig) { object.getVolumesForForceSessionCreate(); } else { object.getEligibleVolumes(); } } }); IEventListener<EventArgs> clusterEventListener = new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { String selectedCluster = object.getSlaveClusters().getSelectedItem(); List<GlusterVolumeEntity> volumesInCurrentCluster = new ArrayList<GlusterVolumeEntity>(); if(selectedCluster != null) { volumesInCurrentCluster = object.getVolumesInCluster(selectedCluster, object.getVolumeList()); } if(volumesInCurrentCluster.size() > 0) { object.getSlaveVolumes().setItems(volumesInCurrentCluster, volumesInCurrentCluster.get(0)); } else { object.getSlaveVolumes().setItems(volumesInCurrentCluster); } } }; object.getSlaveClusters().getSelectedItemChangedEvent().addListener(clusterEventListener); IEventListener<EventArgs> slaveVolumeEventListener = new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { GlusterVolumeEntity selectedSlaveVolume = object.getSlaveVolumes().getSelectedItem(); Set<String> hostsInCurrentVolume = new HashSet<String>(); if(!object.getShowEligibleVolumes().getEntity() && selectedSlaveVolume != null) { object.updateRecommendatonViolations(); } if(selectedSlaveVolume != null) { hostsInCurrentVolume = object.getHostNamesForVolume(selectedSlaveVolume); } object.getSlaveHosts().setItems(hostsInCurrentVolume); } }; object.getSlaveVolumes().getSelectedItemChangedEvent().addListener(slaveVolumeEventListener); }</code><technical_language>This done in model</technical_language>

Target:
public void edit(final GlusterVolumeGeoRepCreateModel object) { driver.edit(object); setSuggestedConfigViolations(object.getRecommendationViolations()); setUserGroupVisibility(false); }
Source:
<code>public boolean hasTimeEvents() { return fModel instanceof ITimeGraphEntryModel ? ((TimeGraphEntryModel) fModel).hasRowModel() : <START> true; <END> }</code><technical_language>I thought if a ITimeGraphEntryModel a row model? If does, is a ITimeGraphEntryModel? Cast ITimeGraphEntryModel</technical_language>

Target:
public boolean hasTimeEvents() { return fModel instanceof ITimeGraphEntryModel ? ((ITimeGraphEntryModel) fModel).hasRowModel() : true; }
Source:
<code>public static Collection<CentralProject> data() { closeWelcomeScreen(); List<CentralProject> resultList = new ArrayList<CentralProject>(); new DefaultToolItem(new WorkbenchShell(), CENTRAL_LABEL).click(); centralEditor = new DefaultEditor(CENTRAL_LABEL); centralEditor.activate(); browser = new InternalBrowser(); jsHelper.setBrowser(browser); new WaitWhile(new CentralBrowserIsLoading(), TimePeriod.LONG); <START> AbstractWait.sleep(TimePeriod.DEFAULT); <END> jsHelper.searchFor(SEARCH_STRING); do { String[] examples = jsHelper.getExamples(); for (String exampleName : examples) { if (System.getProperty("specificQuickstarts") == null || System.getProperty("specificQuickstarts").isEmpty() || System.getProperty("specificQuickstarts").contains(exampleName)) { resultList.add(new CentralProject(exampleName, jsHelper.getDescriptionForExample(exampleName))); } } jsHelper.nextPage(); } while (jsHelper.hasNext()); return resultList; }</code><technical_language>Please avoid hard waits</technical_language>

Target:
public static Collection<CentralProject> data() { closeWelcomeScreen(); List<CentralProject> resultList = new ArrayList<CentralProject>(); new DefaultToolItem(new WorkbenchShell(), CENTRAL_LABEL).click(); centralEditor = new DefaultEditor(CENTRAL_LABEL); centralEditor.activate(); browser = new InternalBrowser(); jsHelper.setBrowser(browser); new WaitWhile(new CentralBrowserIsLoading(), TimePeriod.LONG); jsHelper.searchFor(SEARCH_STRING); do { String[] examples = jsHelper.getExamples(); for (String exampleName : examples) { if (System.getProperty("specificQuickstarts") == null || System.getProperty("specificQuickstarts").isEmpty() || System.getProperty("specificQuickstarts").contains(exampleName)) { resultList.add(new CentralProject(exampleName, jsHelper.getDescriptionForExample(exampleName))); } } jsHelper.nextPage(); } while (jsHelper.hasNext()); return resultList; }
Source:
<code>public static String setUserSessionUserId(final HttpSession session) { String resultUserId; <START> final String hashedUserId = (String) session.getAttribute("USER_ID"); <END> if (hashedUserId == null) { resultUserId = JiraTimetrackerAnalytics.getUserId(); session.setAttribute("USER_ID", resultUserId); } else { resultUserId = hashedUserId; } return resultUserId; }</code><technical_language>Extract "USER_ID" a constant more unique. HttpSession accessed "everywhere" in a servlet container. For example: "org.everit.jira.timetracker.plugin.user.id.hash"</technical_language>

Target:
public static String setUserSessionUserId(final HttpSession session) { String resultUserId; String hashedUserId = (String) session.getAttribute(USER_ID); if (hashedUserId == null) { resultUserId = JiraTimetrackerAnalytics.getUserId(); session.setAttribute(USER_ID, resultUserId); } else { resultUserId = hashedUserId; } return resultUserId; }
Source:
<code>public Encoding copy() { Encoding copy = new Encoding(); Identified.copyTo(this, copy); copy.advertisingDuration = advertisingDuration; copy.audioBitRate = audioBitRate; copy.audioChannels = audioChannels; copy.audioCoding = audioCoding; copy.availableAt = Sets.newHashSet(Iterables.transform(availableAt, Location.COPY)); copy.bitRate = bitRate; copy.containsAdvertising = containsAdvertising; copy.dataContainerFormat = dataContainerFormat; copy.dataSize = dataSize; copy.distributor = distributor; copy.hasDOG = hasDOG; copy.source = source; copy.videoAspectRatio = videoAspectRatio; copy.videoBitRate = videoBitRate; copy.videoCoding = videoCoding; copy.videoFrameRate = videoFrameRate; copy.videoHorizontalSize = videoHorizontalSize; copy.videoProgressiveScan = videoProgressiveScan; copy.videoVerticalSize = videoVerticalSize; <START> copy.audioDescribed = audioDescribed; <END> return copy; }</code><technical_language>I this file tabs in before, do a formatting commit fix inconsistent</technical_language>

Target:
public Encoding copy() { Encoding copy = new Encoding(); Identified.copyTo(this, copy); copy.advertisingDuration = advertisingDuration; copy.audioBitRate = audioBitRate; copy.audioChannels = audioChannels; copy.audioCoding = audioCoding; copy.availableAt = Sets.newHashSet(Iterables.transform(availableAt, Location.COPY)); copy.bitRate = bitRate; copy.containsAdvertising = containsAdvertising; copy.dataContainerFormat = dataContainerFormat; copy.dataSize = dataSize; copy.distributor = distributor; copy.hasDOG = hasDOG; copy.source = source; copy.videoAspectRatio = videoAspectRatio; copy.videoBitRate = videoBitRate; copy.videoCoding = videoCoding; copy.videoFrameRate = videoFrameRate; copy.videoHorizontalSize = videoHorizontalSize; copy.videoProgressiveScan = videoProgressiveScan; copy.videoVerticalSize = videoVerticalSize; copy.audioDescribed = audioDescribed; copy.signed = signed; return copy; }
Source:
<code>private void logManualSync() { String url = preferencesProvider.getGeneralSharedPreferences().getString(GeneralKeys.KEY_SERVER_URL, ""); String urlHash = FileUtils.getMd5Hash(new ByteArrayInputStream(url.getBytes())); <START> analytics.logEvent(AnalyticsEvents.MATCH_EXACTLY_SYNC, "Manual", urlHash); <END> }</code><technical_language>do of hostname instead of raw setting value? raw server setting differentiate Central App Users. Hostname give a sense of organizations match specifically manual sync button</technical_language>

Target:
private void logManualSync() { Uri uri = Uri.parse(preferencesProvider.getGeneralSharedPreferences().getString(GeneralKeys.KEY_SERVER_URL, "")); String host = uri.getHost() != null ? uri.getHost() : ""; String urlHash = FileUtils.getMd5Hash(new ByteArrayInputStream(host.getBytes())); analytics.logEvent(AnalyticsEvents.MATCH_EXACTLY_SYNC, "Manual", urlHash); }
Source:
<code>public ProcessExternalPayment deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { JsonObject jsonObject = json.getAsJsonObject(); ProcessExternalPayment.Builder builder = new ProcessExternalPayment.Builder(); <START> builder.setExternalCard(jsonObject.has(MEMBER_MONEY_SOURCE) ? <END> ExternalCardTypeAdapter.getInstance().fromJson(jsonObject.get( MEMBER_MONEY_SOURCE)) : null); Delegate.deserialize(jsonObject, builder); return builder.create(); }</code><technical_language>I is for performance get member first, check if is null perform deserialization. safer</technical_language>

Target:
public ProcessExternalPayment deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { JsonObject jsonObject = json.getAsJsonObject(); ProcessExternalPayment.Builder builder = new ProcessExternalPayment.Builder(); JsonElement moneySource = jsonObject.get(MEMBER_MONEY_SOURCE); if (moneySource != null) { builder.setExternalCard(ExternalCardTypeAdapter.getInstance().fromJson(moneySource)); } BaseProcessPaymentTypeAdapter.Delegate.deserialize(jsonObject, builder); return builder.create(); }
Source:
<code>public ObjectFilter withParameters(Map<String, Object> namedParameters) { if (namedParameters == null) { throw new IllegalArgumentException("namedParameters argument cannot be null"); } for (String paramName : getParameterNames()) { if (namedParameters.get(paramName) == null) { <START> throw new IllegalArgumentException("Query parameter '" + paramName + "' was not set"); <END> } } return new AcceptObjectFilter<>(namedParameters, matcher, metadataAdapter, parsingResult); }</code><technical_language>need some internationalization here</technical_language>

Target:
public ObjectFilter withParameters(Map<String, Object> namedParameters) { validateParameters(namedParameters); return new AcceptObjectFilter<>(namedParameters, matcher, metadataAdapter, parsingResult); }
Source:
<code>@Test public void testShouldShowByPlatform() throws Throwable { <START> assertFalse(AnnouncementClient.shouldShow(announcementIOS, <END> "US", dateDuring)); }</code><technical_language>reason this method static</technical_language>

Target:
@Test public void testShouldShowByPlatform() throws Throwable { Announcement announcementIOS = announcementList.items().get(ANNOUNCEMENT_IOS); Date dateDuring = dateFormat.parse("2016-11-20"); assertThat(AnnouncementClient.shouldShow(announcementIOS, "US", dateDuring), is(false)); }
Source:
<code>public final void commit (boolean report_heuristics) throws Unavailable, HeuristicMixed, HeuristicHazard, SystemException { try { if (_controlImpl != null) _controlImpl.getImplHandle().commit(report_heuristics); else { Terminator t = null; try { t = _control.get_terminator(); } catch (SystemException e) { throw new Unavailable(); } catch (final NullPointerException ex) { throw new Unavailable(); } if (t != null) t.commit(report_heuristics); else throw new Unavailable(); } } catch (NullPointerException ex) { if (_controlImpl.getFinalStatus() != org.omg.CosTransactions.Status.StatusCommitted) <START> return; <END> } }</code><technical_language>this one? If commit ended rolling need TRANSACTION_ROLLEDBACK exception</technical_language>

Target:
public final void commit (boolean report_heuristics) throws Unavailable, HeuristicMixed, HeuristicHazard, SystemException { try { if (_controlImpl != null) _controlImpl.getImplHandle().commit(report_heuristics); else { Terminator t = null; try { t = _control.get_terminator(); } catch (SystemException e) { throw new Unavailable(); } catch (final NullPointerException ex) { throw new Unavailable(); } if (t != null) t.commit(report_heuristics); else throw new Unavailable(); } } catch (NullPointerException ex) { if (_controlImpl.getFinalStatus() != org.omg.CosTransactions.Status.StatusCommitted) throw new TRANSACTION_ROLLEDBACK(); } }
Source:
<code>public RowIndexEntry append(UnfilteredRowIterator partition) { DecoratedKey key = partition.partitionKey(); <START> if (preemptiveOpenInterval != Long.MAX_VALUE) <END> maybeReopenEarly(key); RowIndexEntry index = writer.append(partition); if (DatabaseDescriptor.getInvalidateKeyCacheOnCompaction()) { if (!transaction.isOffline() && index != null) { for (SSTableReader reader : transaction.originals()) { if (reader.getCachedPosition(key, false) != null) { cachedKeys.put(key, index); break; } } } } return index; }</code><technical_language>this is checked in maybeReopenEarly - need check</technical_language>

Target:
public RowIndexEntry append(UnfilteredRowIterator partition) { DecoratedKey key = partition.partitionKey(); maybeReopenEarly(key); RowIndexEntry index = writer.append(partition); if (DatabaseDescriptor.shouldMigrateKeycacheOnCompaction()) { if (!transaction.isOffline() && index != null) { for (SSTableReader reader : transaction.originals()) { if (reader.getCachedPosition(key, false) != null) { cachedKeys.put(key, index); break; } } } } return index; }
Source:
<code>public void testRemoveScopedRole() { RoleRepresentation roleRep = createRealmRole("foo-role"); ClientScopeRepresentation templateRep = new ClientScopeRepresentation(); <START> templateRep.setName("bar-template"); <END> String templateId = createClientScope(templateRep); clientScopes().get(templateId).getScopeMappings().realmLevel().add(Collections.singletonList(roleRep)); assertAdminEvents.assertEvent(getRealmId(), OperationType.CREATE, AdminEventPaths.clientScopeRoleMappingsRealmLevelPath(templateId), Collections.singletonList(roleRep), ResourceType.REALM_SCOPE_MAPPING); List<RoleRepresentation> roleReps = clientScopes().get(templateId).getScopeMappings().realmLevel().listAll(); Assert.assertEquals(1, roleReps.size()); Assert.assertEquals("foo-role", roleReps.get(0).getName()); testRealmResource().roles().deleteRole("foo-role"); assertAdminEvents.assertEvent(getRealmId(), OperationType.DELETE, AdminEventPaths.roleResourcePath("foo-role"), ResourceType.REALM_ROLE); roleReps = clientScopes().get(templateId).getScopeMappings().realmLevel().listAll(); Assert.assertEquals(0, roleReps.size()); removeClientScope(templateId); }</code><technical_language>bar-template > scope-template</technical_language>

Target:
public void testRemoveScopedRole() { RoleRepresentation roleRep = createRealmRole("foo-role"); ClientScopeRepresentation scopeRep = new ClientScopeRepresentation(); scopeRep.setName("bar-scope"); String scopeId = createClientScope(scopeRep); clientScopes().get(scopeId).getScopeMappings().realmLevel().add(Collections.singletonList(roleRep)); assertAdminEvents.assertEvent(getRealmId(), OperationType.CREATE, AdminEventPaths.clientScopeRoleMappingsRealmLevelPath(scopeId), Collections.singletonList(roleRep), ResourceType.REALM_SCOPE_MAPPING); List<RoleRepresentation> roleReps = clientScopes().get(scopeId).getScopeMappings().realmLevel().listAll(); Assert.assertEquals(1, roleReps.size()); Assert.assertEquals("foo-role", roleReps.get(0).getName()); testRealmResource().roles().deleteRole("foo-role"); assertAdminEvents.assertEvent(getRealmId(), OperationType.DELETE, AdminEventPaths.roleResourcePath("foo-role"), ResourceType.REALM_ROLE); roleReps = clientScopes().get(scopeId).getScopeMappings().realmLevel().listAll(); Assert.assertEquals(0, roleReps.size()); removeClientScope(scopeId); }
Source:
<code>public boolean install(Resource r, ResourceLocation location, Reference ref, ResourceTable table, AndroidCommCarePlatform instance, boolean upgrade) throws UnresolvedResourceException, UnfullfilledRequirementsException { super.install(r, location, ref, table, instance, upgrade); try { Reference local = ReferenceManager._().DeriveReference(localLocation); ProfileParser parser = new ProfileParser(local.getStream(), instance, table, r.getRecordGuid(), upgrade ? Resource.RESOURCE_STATUS_UNINITIALIZED : Resource.RESOURCE_STATUS_UNINITIALIZED, false); Profile p = parser.parse(); instance.setProfile(p); if(!upgrade) { initProperties(p); String newAppId = p.getUniqueId(); <START> ArrayList<ApplicationRecord> installedApps = CommCareApplication._(). <END> getInstalledAppRecords(); for (ApplicationRecord record : installedApps) { if (record.getUniqueId().equals(newAppId)) { throw new UnfullfilledRequirementsException( "The app you are trying to install already exists on this device", CommCareElementParser.SEVERITY_PROMPT, true); } } } table.commit(r, upgrade ? Resource.RESOURCE_STATUS_UPGRADE : Resource.RESOURCE_STATUS_INSTALLED, p.getVersion()); return true; } catch (InvalidReferenceException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (InvalidStructureException e) { throw new UnresolvedResourceException(r, "Invalid content in the Profile Definition: " + e.getMessage(), true); } catch (XmlPullParserException e) { e.printStackTrace(); } return false; }</code><technical_language>minor feedback: split portion of this runs application records compares ID method, portion is introduces CommCareApplication static state dependence</technical_language>

Target:
public boolean install(Resource r, ResourceLocation location, Reference ref, ResourceTable table, AndroidCommCarePlatform instance, boolean upgrade) throws UnresolvedResourceException, UnfullfilledRequirementsException { super.install(r, location, ref, table, instance, upgrade); try { Reference local = ReferenceManager._().DeriveReference(localLocation); ProfileParser parser = new ProfileParser(local.getStream(), instance, table, r.getRecordGuid(), upgrade ? Resource.RESOURCE_STATUS_UNINITIALIZED : Resource.RESOURCE_STATUS_UNINITIALIZED, false); Profile p = parser.parse(); if(!upgrade) { initProperties(p); checkDuplicate(p); } table.commit(r, upgrade ? Resource.RESOURCE_STATUS_UPGRADE : Resource.RESOURCE_STATUS_INSTALLED, p.getVersion()); return true; } catch (InvalidReferenceException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (InvalidStructureException e) { throw new UnresolvedResourceException(r, "Invalid content in the Profile Definition: " + e.getMessage(), true); } catch (XmlPullParserException e) { e.printStackTrace(); } return false; }
Source:
<code>public void getTransferRefunds() throws Exception { Transfer transfer = this.getNewTransfer(); Refund firstRefund = this.getNewRefundForTransfer(transfer); Refund secondRefund = this.getNewRefundForTransfer(transfer); List<Refund> refunds = this.getApi().getTransferApi().getRefunds(transfer.getId()); assertNotNull("Refunds came back null", refunds); <START> assertTrue("Refunds size is not correct", refunds.size() == 2); <END> }</code><technical_language>Please pagination, too</technical_language>

Target:
public void getTransferRefunds() throws Exception { Transfer transfer = this.getNewTransfer(); Refund firstRefund = this.getNewRefundForTransfer(transfer); Refund secondRefund = this.getNewRefundForTransfer(transfer); Pagination pagination = new Pagination(1, 2); List<Refund> refunds = this.getApi().getTransferApi().getRefunds(transfer.getId(), pagination, null); assertNotNull("Refunds came back null", refunds); assertTrue("Refunds size is not correct", refunds.size() == 2); }