auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void createImportFileAudit(RchImportFacilitator rchImportFacilitator) throws RchFileManipulationException { Long state = rchImportFacilitator.getStateId(); LocalDate importDate = rchImportFacilitator.getImportDate(); RchUserType rchUserType = rchImportFacilitator.getUserType(); List<RchImportFacilitator> rchImportFacilitator1 = rchImportFacilitatorDataService.getByStateIdAndImportDateAndUserType(state, importDate, rchUserType); LOGGER.info("list size {}", rchImportFacilitator1.size()); if (rchImportFacilitator.getFileName() == null) { throw new RchFileManipulationException("Invalid file name"); } else if (rchImportFacilitator1.size() != 0) { <START> LOGGER.debug("A record already present for the same state: and today's date: {}.", state, importDate); <END> } else { rchImportFacilitatorDataService.create(rchImportFacilitator); } }</code><technical_language>need type !!</technical_language>

Target:
public void createImportFileAudit(RchImportFacilitator rchImportFacilitator) throws RchFileManipulationException { Long state = rchImportFacilitator.getStateId(); LocalDate importDate = rchImportFacilitator.getImportDate(); RchUserType rchUserType = rchImportFacilitator.getUserType(); List<RchImportFacilitator> rchImportFacilitator1 = rchImportFacilitatorDataService.getByStateIdAndImportDateAndUserType(state, importDate, rchUserType); LOGGER.info("list size {}", rchImportFacilitator1.size()); if (rchImportFacilitator.getFileName() == null) { throw new RchFileManipulationException("Invalid file name"); } else if (rchImportFacilitator1.size() != 0) { LOGGER.error("A record already present for the same state: , today's date: and userType: {}.", state, importDate, rchUserType.toString()); } else { rchImportFacilitatorDataService.create(rchImportFacilitator); } }
Source:
<code>public RetryHandler(Forklift forklift, File dir) { this.dir = dir; this.forklift = forklift; this.mapper = new ObjectMapper().registerModule(new JavaTimeModule()) .configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); this.executor = Executors.newScheduledThreadPool(1); <START> cleanup = new Consumer<RetryMessage>() { <END> @Override public void accept(RetryMessage msg) { log.info("Cleaning up persistent file {}", msg.getPersistedPath()); final File f = new File(msg.getPersistedPath()); if (f.exists()) f.delete(); } }; new FileScanner(dir).scan().stream() .filter(result -> result.getFilename().startsWith("retry") && result.getFilename().endsWith(".msg")) .forEach(result -> { try { final RetryMessage retryMessage = mapper.readValue(new File(dir, result.getFilename()), RetryMessage.class); executor.schedule(new RetryRunnable(retryMessage, forklift.getConnector(), cleanup), Long.parseLong(Integer.toString(Integer.parseInt(retryMessage.getProperties().get("forklift-retry-timeout")))), TimeUnit.SECONDS); } catch (Exception e) { log.error("Unable to read file {}", result.getFilename()); } }); }</code><technical_language>Nit: If java 8 functions, lambdas</technical_language>

Target:
public RetryHandler(Forklift forklift, File dir) { this.dir = dir; this.forklift = forklift; this.mapper = new ObjectMapper().registerModule(new JavaTimeModule()) .configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); this.executor = Executors.newScheduledThreadPool(1); cleanup = (msg) -> { log.info("Cleaning up persistent file {}", msg.getPersistedPath()); final File f = new File(msg.getPersistedPath()); if (f.exists()) f.delete(); }; new FileScanner(dir).scan().stream() .filter(result -> result.getFilename().startsWith("retry") && result.getFilename().endsWith(".msg")) .forEach(result -> { try { final RetryMessage retryMessage = mapper.readValue(new File(dir, result.getFilename()), RetryMessage.class); executor.schedule(new RetryRunnable(retryMessage, forklift.getConnector(), cleanup), Long.parseLong(Integer.toString(Integer.parseInt(retryMessage.getProperties().get("forklift-retry-timeout")))), TimeUnit.SECONDS); } catch (Exception e) { log.error("Unable to read file {}", result.getFilename()); } }); }
Source:
<code>public Optional<PassengerData> build(DataView container) throws InvalidDataException { <START> return Optional.absent(); <END> }</code><technical_language>This is exact deserializing, absent, rather, absent for manipulator work</technical_language>

Target:
public Optional<PassengerData> build(DataView container) throws InvalidDataException { PassengerData passengerData = create(); passengerData.set(Keys.BASE_VEHICLE, getData(container, Keys.BASE_VEHICLE)); passengerData.set(Keys.VEHICLE, getData(container, Keys.VEHICLE)); return Optional.of(passengerData); }
Source:
<code>public String executeCommand(String command) throws IOException { <START> command = command.endsWith("\r\n") ? command : command + "\r\n"; <END> byte b[] = command.getBytes(Sage.BYTE_CHARSET); return executeCommand(b, 0, b.length); }</code><technical_language>Put parenthesis (command + "\r\n") for clarity</technical_language>

Target:
public String executeCommand(String command) throws IOException { command = command.endsWith("\r\n") ? command : (command + "\r\n"); byte b[] = command.getBytes(Sage.BYTE_CHARSET); return executeCommand(b, 0, b.length); }
Source:
<code>public static <T extends UnspecificPlugin> Collection<T> getPlugins(Class<T> clazz) { <START> final String kInternalClassesPrefix = "net.xeoh.plugins."; <END> final short kInternalClassesCount = 4; ArrayList<T> result; PluginType type = UnspecificPlugin.typeOf(clazz); PluginManagerUtil pluginLoader = getPluginLoader(type); Collection<Plugin> plugins = pluginLoader.getPlugins(Plugin.class); result = new ArrayList<>(plugins.size() - kInternalClassesCount); for (Plugin implementation : plugins) { if (implementation.getClass().getName().startsWith(kInternalClassesPrefix)) { continue; } try { T plugin = (T) UnspecificPlugin.create(type, implementation); plugin.configure(getPluginConfiguration()); result.add(plugin); } catch (NoSuchMethodException | SecurityException e) { if (logger.isWarnEnabled()) { logger.warn( "Bad implementation of " + type.getName() + " plugin " + implementation.getClass().getName(), e); } } } return result; }</code><technical_language>mentioned above: do introduce unreadable variable names</technical_language>

Target:
public static <T extends UnspecificPlugin> Collection<T> getPlugins(Class<T> clazz) { final String internalClassesPrefix = "net.xeoh.plugins."; final short internalClassesCount = 4; ArrayList<T> result; PluginType type = UnspecificPlugin.typeOf(clazz); PluginManagerUtil pluginLoader = getPluginLoader(type); Collection<Plugin> plugins = pluginLoader.getPlugins(Plugin.class); result = new ArrayList<>(plugins.size() - internalClassesCount); for (Plugin implementation : plugins) { if (implementation.getClass().getName().startsWith(internalClassesPrefix)) { continue; } try { T plugin = (T) UnspecificPlugin.create(type, implementation); plugin.configure(getPluginConfiguration()); result.add(plugin); } catch (NoSuchMethodException | SecurityException e) { if (logger.isWarnEnabled()) { logger.warn( "Bad implementation of " + type.getName() + " plugin " + implementation.getClass().getName(), e); } } } return result; }
Source:
<code>public void onListItemClick(ListView l, View v, int position, long id) { if (!carrierConfig.getBoolean("config_fdn_direct_dial")) { editSelected(position); } else { SelectionPopUpMenu menu = new <START> SelectionPopUpMenu(getApplicationContext(), v, <END> position); menu.showPopUp(); } }</code><technical_language>"this" theme is different. If application context, pop menu is black while activity is white, inconsistent behavior. modify code perform verification</technical_language>

Target:
public void onListItemClick(ListView l, View v, int position, long id) { if (!mFdnDialDirectlySupported) { editSelected(position); } else { SelectionPopUpMenu menu = new SelectionPopUpMenu(this, v, position); menu.showPopUp(); } }
Source:
<code>void checkWhitespaceAroundColon(SwitchCaseContext ctx) { Token left = null; Token right = null; Token colon = null; if (ctx.caseLabel() != null) { left = ctx.caseLabel().caseItemList().getStop(); ParseTree rightChild = ctx.getChild(1); right = rightChild instanceof StatementsContext ? ((StatementsContext) rightChild).getStart() : ((TerminalNodeImpl) rightChild).getSymbol(); colon = ((TerminalNodeImpl) ctx.caseLabel().getChild(2)).getSymbol(); } else if (ctx.defaultLabel() != null) { left = ((TerminalNodeImpl) ctx.defaultLabel().getChild(0)).getSymbol(); ParseTree rightChild = ctx.getChild(1); right = rightChild instanceof StatementsContext ? ((StatementsContext) rightChild).getStart() : ((TerminalNodeImpl) rightChild).getSymbol(); colon = ((TerminalNodeImpl) ctx.defaultLabel().getChild(1)).getSymbol(); } else { return; } <START> verifyColonLeftAssociation(left, right, colon); <END> }</code><technical_language>verifyColonLeftAssociation get executed of return in else block</technical_language>

Target:
void checkWhitespaceAroundColon(SwitchCaseContext ctx) { Token left = null; Token right = null; Token colon = null; if (ctx.caseLabel() != null) { left = ctx.caseLabel().caseItemList().getStop(); ParseTree rightChild = ctx.getChild(1); right = rightChild instanceof StatementsContext ? ((StatementsContext) rightChild).getStart() : ((TerminalNodeImpl) rightChild).getSymbol(); colon = ((TerminalNodeImpl) ctx.caseLabel().getChild(2)).getSymbol(); } else { left = ((TerminalNodeImpl) ctx.defaultLabel().getChild(0)).getSymbol(); ParseTree rightChild = ctx.getChild(1); right = rightChild instanceof StatementsContext ? ((StatementsContext) rightChild).getStart() : ((TerminalNodeImpl) rightChild).getSymbol(); colon = ((TerminalNodeImpl) ctx.defaultLabel().getChild(1)).getSymbol(); } verifyColonLeftAssociation(left, right, colon); }
Source:
<code>public List<ISuite> runSuitesLocally() { if (m_suites.isEmpty()) { <START> this.m_hasTests = false; <END> error("No test suite found. Nothing to run"); usage(); return Collections.emptyList(); } SuiteRunnerMap suiteRunnerMap = new SuiteRunnerMap(); if (m_suites.get(0).getVerbose() >= 2) { Version.displayBanner(); } for (XmlSuite xmlSuite : m_suites) { createSuiteRunners(suiteRunnerMap, xmlSuite); } if (m_suiteThreadPoolSize == 1 && !m_randomizeSuites) { for (XmlSuite xmlSuite : m_suites) { runSuitesSequentially(xmlSuite, suiteRunnerMap, getVerbose(xmlSuite), getDefaultSuiteName()); } return Lists.newArrayList(suiteRunnerMap.values()); } DynamicGraph<ISuite> suiteGraph = new DynamicGraph<>(); for (XmlSuite xmlSuite : m_suites) { populateSuiteGraph(suiteGraph, suiteRunnerMap, xmlSuite); } IThreadWorkerFactory<ISuite> factory = new SuiteWorkerFactory(suiteRunnerMap, 0 , getDefaultSuiteName()); GraphThreadPoolExecutor<ISuite> pooledExecutor = new GraphThreadPoolExecutor<>("suites", suiteGraph, factory, m_suiteThreadPoolSize, m_suiteThreadPoolSize, Integer.MAX_VALUE, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>()); Utils.log("TestNG", 2, "Starting executor for all suites"); pooledExecutor.run(); try { pooledExecutor.awaitTermination(Long.MAX_VALUE, TimeUnit.MILLISECONDS); pooledExecutor.shutdownNow(); } catch (InterruptedException handled) { Thread.currentThread().interrupt(); error("Error waiting for concurrent executors to finish " + handled.getMessage()); } return Lists.newArrayList(suiteRunnerMap.values()); }</code><technical_language>need is false default</technical_language>

Target:
public List<ISuite> runSuitesLocally() { if (m_suites.isEmpty()) { error("No test suite found. Nothing to run"); usage(); return Collections.emptyList(); } SuiteRunnerMap suiteRunnerMap = new SuiteRunnerMap(); if (m_suites.get(0).getVerbose() >= 2) { Version.displayBanner(); } for (XmlSuite xmlSuite : m_suites) { createSuiteRunners(suiteRunnerMap, xmlSuite); } if (m_suiteThreadPoolSize == 1 && !m_randomizeSuites) { for (XmlSuite xmlSuite : m_suites) { runSuitesSequentially(xmlSuite, suiteRunnerMap, getVerbose(xmlSuite), getDefaultSuiteName()); } return Lists.newArrayList(suiteRunnerMap.values()); } DynamicGraph<ISuite> suiteGraph = new DynamicGraph<>(); for (XmlSuite xmlSuite : m_suites) { populateSuiteGraph(suiteGraph, suiteRunnerMap, xmlSuite); } IThreadWorkerFactory<ISuite> factory = new SuiteWorkerFactory(suiteRunnerMap, 0 , getDefaultSuiteName()); GraphThreadPoolExecutor<ISuite> pooledExecutor = new GraphThreadPoolExecutor<>("suites", suiteGraph, factory, m_suiteThreadPoolSize, m_suiteThreadPoolSize, Integer.MAX_VALUE, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>()); Utils.log("TestNG", 2, "Starting executor for all suites"); pooledExecutor.run(); try { pooledExecutor.awaitTermination(Long.MAX_VALUE, TimeUnit.MILLISECONDS); pooledExecutor.shutdownNow(); } catch (InterruptedException handled) { Thread.currentThread().interrupt(); error("Error waiting for concurrent executors to finish " + handled.getMessage()); } return Lists.newArrayList(suiteRunnerMap.values()); }
Source:
<code>private String getSignature(Method method) { StringBuilder sb = new StringBuilder(); Class<?> returnType = method.getReturnType(); if (returnType != null) { sb.append(returnType.getName()).append('#'); } sb.append(method.getName()); Class<?>[] parameters = method.getParameterTypes(); for (int i = 0; i < parameters.length; i++) { <START> sb.append(i == 0 ? ":" : ",").append(parameters[i].getName()); <END> } return sb.toString(); }</code><technical_language>change String instead of char</technical_language>

Target:
private String getSignature(Method method) { StringBuilder sb = new StringBuilder(); Class<?> returnType = method.getReturnType(); if (returnType != null) { sb.append(returnType.getName()).append('#'); } sb.append(method.getName()); Class<?>[] parameters = method.getParameterTypes(); for (int i = 0; i < parameters.length; i++) { sb.append(i == 0 ? ':' : ',').append(parameters[i].getName()); } return sb.toString(); }
Source:
<code>public CopyRatioState.SegmentMeans estimateSegmentMeans() { <START> final List<Double> means = new ArrayList<>(numSegments); <END> for (int segment = 0; segment < numSegments; segment++) { means.add(new Mean().evaluate(Doubles.toArray(getCoveragesInSegment(segment)))); } return new CopyRatioState.SegmentMeans(means); }</code><technical_language>java final List<Double> means = IntStream.range(0, numSegments) .mapToDouble(s -> new Mean().evaluate(Doubles.toArray(getCoveragesInSegment(s))) .collect(Collectors.toList());</technical_language>

Target:
public CopyRatioState.SegmentMeans estimateSegmentMeans() { final List<Double> means = IntStream.range(0, numSegments).boxed() .map(s -> new Mean().evaluate(Doubles.toArray(getIndexedCoveragesInSegment(s).stream().map(IndexedCoverage::getCoverage).collect(Collectors.toList())))) .collect(Collectors.toList()); return new CopyRatioState.SegmentMeans(means); }
Source:
<code>public IComplexNumber dotu(IComplexNDArray x, IComplexNDArray y) { <START> return null; <END> }</code><technical_language>worry implementing complex right now. do: throw new UnsupportedOperationException() operations</technical_language>

Target:
public IComplexNumber dotu(IComplexNDArray x, IComplexNDArray y) { throw new UnsupportedOperationException(); }
Source:
<code>public List<InputSplit> getSplits(JobContext context) throws IOException { final Configuration configuration = context.getConfiguration(); BigQueryStorageClient client = getClient(configuration); BigQueryHelper bigQueryHelper; try { bigQueryHelper = getBigQueryHelper(configuration); } catch (GeneralSecurityException gse) { <START> LOG.error("Failed to create BigQuery client", gse); <END> throw new IOException("Failed to create BigQuery client", gse); } double skewLimit = configuration.getDouble(BigQueryConfiguration.SKEW_LIMIT_KEY, BigQueryConfiguration.SKEW_LIMIT_DEFAULT); Preconditions.checkArgument( skewLimit >= 1.0, BigQueryConfiguration.SKEW_LIMIT_KEY + " is less than 1, than not all records would be read. Exiting"); Table table = getTable(configuration, bigQueryHelper); ReadSession session = startSession(configuration, table, client); long numRows = table.getNumRows().longValue(); long limit = Math.round(skewLimit * numRows / session.getStreamsCount()); return session.getStreamsList().stream() .map( stream -> new DirectBigQueryInputSplit( stream.getName(), session.getAvroSchema().getSchema(), limit)) .collect(Collectors.toList()); }</code><technical_language>Flogger, do log re-throw exception - this is anti-pattern</technical_language>

Target:
public List<InputSplit> getSplits(JobContext context) throws IOException { final Configuration configuration = context.getConfiguration(); BigQueryStorageClient client = getClient(configuration); BigQueryHelper bigQueryHelper; try { bigQueryHelper = getBigQueryHelper(configuration); } catch (GeneralSecurityException gse) { throw new IOException("Failed to create BigQuery client", gse); } double skewLimit = configuration.getDouble( BigQueryConfiguration.SKEW_LIMIT_KEY, BigQueryConfiguration.SKEW_LIMIT_DEFAULT); Preconditions.checkArgument( skewLimit >= 1.0, "%s is less than 1; not all records would be read. Exiting", BigQueryConfiguration.SKEW_LIMIT_KEY); Table table = getTable(configuration, bigQueryHelper); ReadSession session = startSession(configuration, table, client); long numRows = table.getNumRows().longValue(); long limit = Math.round(skewLimit * numRows / session.getStreamsCount()); return session.getStreamsList().stream() .map( stream -> new DirectBigQueryInputSplit( stream.getName(), session.getAvroSchema().getSchema(), limit)) .collect(Collectors.toList()); }
Source:
<code>private void saveEditingTargetsWithPrompt( String title, ArrayList<EditingTarget> editingTargets, final Command onCompleted, final Command onCancelled) { if (editingTargets.size() == 0) { onCompleted.execute(); } else if (editingTargets.size() == 1) { editingTargets.get(0).saveWithPrompt(onCompleted, onCancelled); } else { ArrayList<UnsavedChangesTarget> unsavedTargets = new ArrayList<UnsavedChangesTarget>(); <START> unsavedTargets.addAll(editingTargets); <END> showUnsavedChangesDialog( title, unsavedTargets, new OperationWithInput<UnsavedChangesDialog.Result>() { @Override public void execute(UnsavedChangesDialog.Result result) { saveChanges(result.getSaveTargets(), onCompleted); } }, onCancelled); } }</code><technical_language>replace with: ArrayList<UnsavedChangesTarget> unsavedTargets = new ArrayList<>(editingTargets);</technical_language>

Target:
private void saveEditingTargetsWithPrompt( String title, ArrayList<EditingTarget> editingTargets, final Command onCompleted, final Command onCancelled) { if (editingTargets.size() == 0) { onCompleted.execute(); } else if (editingTargets.size() == 1) { editingTargets.get(0).saveWithPrompt(onCompleted, onCancelled); } else { ArrayList<UnsavedChangesTarget> unsavedTargets = new ArrayList<>(editingTargets); showUnsavedChangesDialog( title, unsavedTargets, new OperationWithInput<UnsavedChangesDialog.Result>() { @Override public void execute(UnsavedChangesDialog.Result result) { saveChanges(result.getSaveTargets(), onCompleted); } }, onCancelled); } }
Source:
<code>public int compare(JudgmentCorrection correctionOne, JudgmentCorrection correctionTwo) { if (correctionOne.getCorrectedObjectClass() == correctionTwo.getCorrectedObjectClass()) { return compareChangeOperation(correctionOne.getChangeOperation(), correctionTwo.getChangeOperation()); <START> } else if (correctionOne.getCorrectedObjectClass() == CommonCourtJudgment.class || <END> correctionOne.getCorrectedObjectClass() == SupremeCourtJudgment.class) { return -1; } else if (correctionOne.getCorrectedObjectClass() == SupremeCourtChamber.class) { if (correctionTwo.getCorrectedObjectClass() == CommonCourtJudgment.class || correctionTwo.getCorrectedObjectClass() == SupremeCourtJudgment.class) { return 1; } else { return -1; } } else if (correctionOne.getCorrectedObjectClass() == SupremeCourtJudgmentForm.class) { if (correctionTwo.getCorrectedObjectClass() == Judge.class) { return -1; } else { return 1; } } else { return 1; } }</code><technical_language>This else if is unneceassary (because of return in if). other judgments (for example CtJudgment)</technical_language>

Target:
public int compare(JudgmentCorrection correctionOne, JudgmentCorrection correctionTwo) { if (correctionOne.getCorrectedObjectClass() == correctionTwo.getCorrectedObjectClass()) { return compareChangeOperation(correctionOne.getChangeOperation(), correctionTwo.getChangeOperation()); } if (Judgment.class.isAssignableFrom(correctionOne.getCorrectedObjectClass())) { return -1; } if (correctionOne.getCorrectedObjectClass() == SupremeCourtChamber.class) { if (correctionTwo.getCorrectedObjectClass() == CommonCourtJudgment.class || correctionTwo.getCorrectedObjectClass() == SupremeCourtJudgment.class) { return 1; } else { return -1; } } if (correctionOne.getCorrectedObjectClass() == SupremeCourtJudgmentForm.class) { if (correctionTwo.getCorrectedObjectClass() == Judge.class) { return -1; } else { return 1; } } return 1; }
Source:
<code>public void insertTaskContainerEvent(ITmfStateSystemBuilder ssb, TaskContainerEvent t) { <START> checkNotNull(t); <END> if (!hmTasks.containsKey(t.getTid())) { hmTasks.put(t.getTid(), t); if (rootContainerInfoAdded) { int rootContainerQuark = ContainerHelper.getRootContainerQuark(ssb); ContainerInfo rootContainerInfo = ContainerHelper.getContainerInfo(ssb, rootContainerQuark); if (rootContainerInfo == null) { throw new IllegalStateException("Error, root container seems added but container info is unavailable!"); } if (t.getNsInode() == rootContainerInfo.getContainerInode()) { setTaskCPUStatus(ssb, t); } else if (isParentContainerAdded(ssb, t)) { addTaskAndResolveOrphans(ssb, t); } else { unresolvedTasks.add(t); } } } }</code><technical_language>package is marked @NonNullByDefault (from package-info file), parameter 't' is marked @NonNull, null here. If do a check if (t == null) you. of reasons, checkNotNull() is @Nullable, @NonNull is a subset of @Nullable, compiler wrong it</technical_language>

Target:
public void insertTaskContainerEvent(ITmfStateSystemBuilder ssb, TaskContainerEvent t) { if (!fTasks.containsKey(t.getTid())) { fTasks.put(t.getTid(), t); int rootContainerQuark = ContainerHelper.getRootContainerQuark(ssb); ContainerInfo rootContainerInfo = ContainerHelper.getContainerInfo(ssb, rootContainerQuark); if (rootContainerInfo != null) { if (t.getNsInode() == rootContainerInfo.getContainerInode()) { setTaskCPUStatus(ssb, t); } else if (isParentContainerAdded(ssb, t)) { addTaskAndResolveOrphans(ssb, t); } else { unresolvedTasks.add(t); } } } }
Source:
<code>public void send_shouldFillInLastIntentData() throws Exception { Intent[] intents = {new Intent("first"), new Intent("second")}; <START> Context context = new Activity(); <END> PendingIntent pendingIntent = PendingIntent.getActivities(context, 99, intents, 100); Activity otherContext = new Activity(); Intent fillIntent = new Intent(); fillIntent.putExtra("TEST", 23); pendingIntent.send(otherContext, 0, fillIntent); ShadowActivity shadowActivity = shadowOf(otherContext); Intent first = shadowActivity.getNextStartedActivity(); assertThat(first).isNotNull(); assertThat(first).isSameAs(intents[0]); assertThat(first.hasExtra("TEST")).isFalse(); Intent second = shadowActivity.getNextStartedActivity(); assertThat(second).isNotNull(); assertThat(second).isSameAs(intents[1]); assertThat(second.getIntExtra("TEST", -1)).isEqualTo(23); }</code><technical_language>Robolectric.setupActivity() - want a field initialized in setup()</technical_language>

Target:
public void send_shouldFillInLastIntentData() throws Exception { Intent[] intents = {new Intent("first"), new Intent("second")}; Context context = Robolectric.setupActivity(Activity.class); PendingIntent pendingIntent = PendingIntent.getActivities(context, 99, intents, 100); Activity otherContext = Robolectric.setupActivity(Activity.class); Intent fillIntent = new Intent(); fillIntent.putExtra("TEST", 23); pendingIntent.send(otherContext, 0, fillIntent); ShadowActivity shadowActivity = shadowOf(otherContext); Intent first = shadowActivity.getNextStartedActivity(); assertThat(first).isNotNull(); assertThat(first).isSameAs(intents[0]); assertThat(first.hasExtra("TEST")).isFalse(); Intent second = shadowActivity.getNextStartedActivity(); assertThat(second).isNotNull(); assertThat(second).isSameAs(intents[1]); assertThat(second.getIntExtra("TEST", -1)).isEqualTo(23); }
Source:
<code>public void tearDown() throws Exception { mJobScheduler.cancel(CONNECTIVITY_JOB_ID); if (mInitialRestrictBackground) { SystemUtil.runShellCommand(getInstrumentation(), RESTRICT_BACKGROUND_ON_CMD); } if (mHasWifi) { if (mWifiManager.isWifiEnabled() == mInitialWiFiState) { <START> return; <END> } NetworkInfo.State expectedState = mInitialWiFiState ? NetworkInfo.State.CONNECTED : NetworkInfo.State.DISCONNECTED; ConnectivityActionReceiver receiver = new ConnectivityActionReceiver(ConnectivityManager.TYPE_WIFI, expectedState); IntentFilter filter = new IntentFilter(); filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); mContext.registerReceiver(receiver, filter); assertTrue(mWifiManager.setWifiEnabled(mInitialWiFiState)); receiver.waitForStateChange(); assertTrue("Failure to restore previous WiFi state", mWifiManager.isWifiEnabled() == mInitialWiFiState); mContext.unregisterReceiver(receiver); } super.tearDown(); }</code><technical_language>I this is a refactor, please remove return...super.tearDown() needs called end</technical_language>

Target:
public void tearDown() throws Exception { mJobScheduler.cancel(CONNECTIVITY_JOB_ID); if (mInitialRestrictBackground) { SystemUtil.runShellCommand(getInstrumentation(), RESTRICT_BACKGROUND_ON_CMD); } if (mHasWifi) { if (mWifiManager.isWifiEnabled() != mInitialWiFiState) { NetworkInfo.State expectedState = mInitialWiFiState ? NetworkInfo.State.CONNECTED : NetworkInfo.State.DISCONNECTED; ConnectivityActionReceiver receiver = new ConnectivityActionReceiver(ConnectivityManager.TYPE_WIFI, expectedState); IntentFilter filter = new IntentFilter(); filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); mContext.registerReceiver(receiver, filter); assertTrue(mWifiManager.setWifiEnabled(mInitialWiFiState)); receiver.waitForStateChange(); assertTrue("Failure to restore previous WiFi state", mWifiManager.isWifiEnabled() == mInitialWiFiState); mContext.unregisterReceiver(receiver); } } super.tearDown(); }
Source:
<code>public String requestUserCode(@RequestParam(value = "user_code", required = false) String userCode, ModelMap model, HttpSession session) { if (userCode == null) { return "requestUserCode"; } else { <START> return readUserCode(userCode, model, session); <END> } }</code><technical_language>sense a flag enabling this behavior? per-client? standard for flag adding this work for now</technical_language>

Target:
public String requestUserCode(@RequestParam(value = "user_code", required = false) String userCode, ModelMap model, HttpSession session) { if (userCode == null) { return "requestUserCode"; } else { model.addAttribute("completeVerificationUriUsed", true); return readUserCode(userCode, model, session); } }
Source:
<code>private boolean readFrame(ByteBuffer src, boolean trusted) { int remaining = src.remaining(); if (remaining < SIZE_OF_FRAME_LENGTH_AND_FLAGS) { return false; } if (readOffset == -1) { int frameLength = Bits.readIntL(src, src.position()); if (!trusted) { if (frameLength > maxFrameLength) { <START> throw new IllegalArgumentException( <END> format("The client message frame size (%d) exceededs the maximum allowed frame length (%d)", frameLength, maxFrameLength)); } if (frames.size() + 1 > maxFrameCount) { throw new IllegalArgumentException( format("The client message frames count exceededs the maximum allowed count (%d)", maxFrameCount)); } } if (frameLength < SIZE_OF_FRAME_LENGTH_AND_FLAGS) { throw new IllegalArgumentException(format( "The client message frame reported illegal length (%d bytes)." + " Minimal length is the size of frame header (%d bytes).", frameLength, SIZE_OF_FRAME_LENGTH_AND_FLAGS)); } src.position(src.position() + Bits.INT_SIZE_IN_BYTES); int flags = Bits.readShortL(src, src.position()) & INT_MASK; src.position(src.position() + Bits.SHORT_SIZE_IN_BYTES); int size = frameLength - SIZE_OF_FRAME_LENGTH_AND_FLAGS; byte[] bytes = new byte[size]; frames.add(new ClientMessage.Frame(bytes, flags)); readOffset = 0; if (size == 0) { return true; } } ClientMessage.Frame frame = frames.get(readIndex); return accumulate(src, frame.content, frame.content.length - readOffset); }</code><technical_language>MaxMessageSizeExceeded</technical_language>

Target:
private boolean readFrame(ByteBuffer src, boolean trusted) { int remaining = src.remaining(); if (remaining < SIZE_OF_FRAME_LENGTH_AND_FLAGS) { return false; } if (readOffset == -1) { int frameLength = Bits.readIntL(src, src.position()); if (frameLength < SIZE_OF_FRAME_LENGTH_AND_FLAGS) { throw new IllegalArgumentException(format( "The client message frame reported illegal length (%d bytes)." + " Minimal length is the size of frame header (%d bytes).", frameLength, SIZE_OF_FRAME_LENGTH_AND_FLAGS)); } if (!trusted) { if (Integer.MAX_VALUE - frameLength < sumUntrustedMessageLength || sumUntrustedMessageLength + frameLength > maxMessageLength) { throw new MaxMessageSizeExceeded( format("The client message size (%d + %d) exceededs the maximum allowed length (%d)", sumUntrustedMessageLength, frameLength, maxMessageLength)); } sumUntrustedMessageLength += frameLength; } src.position(src.position() + Bits.INT_SIZE_IN_BYTES); int flags = Bits.readShortL(src, src.position()) & INT_MASK; src.position(src.position() + Bits.SHORT_SIZE_IN_BYTES); int size = frameLength - SIZE_OF_FRAME_LENGTH_AND_FLAGS; byte[] bytes = new byte[size]; frames.add(new ClientMessage.Frame(bytes, flags)); readOffset = 0; if (size == 0) { return true; } } ClientMessage.Frame frame = frames.get(readIndex); return accumulate(src, frame.content, frame.content.length - readOffset); }
Source:
<code>public PlanNode replaceChildren(List<PlanNode> newChildren) { checkArgument(newChildren.size() == 2, "expected newChildren to contain 2 nodes"); PlanNode newLeft = newChildren.get(0); <START> PlanNode newRight = newChildren.get(1); <END> return new SpatialJoinNode(getId(), type, newLeft, newRight, outputSymbols, filter); }</code><technical_language>I inline</technical_language>

Target:
public PlanNode replaceChildren(List<PlanNode> newChildren) { checkArgument(newChildren.size() == 2, "expected newChildren to contain 2 nodes"); return new SpatialJoinNode(getId(), type, newChildren.get(0), newChildren.get(1), outputSymbols, filter); }
Source:
<code>private CTabFolder createTabFolder(Composite parent) { final CTabFolder folder = new CTabFolder(parent, SWT.NO_REDRAW_RESIZE | SWT.NO_TRIM | SWT.FLAT); ColorRegistry reg = JFaceResources.getColorRegistry(); Color c1 = reg.get("org.eclipse.ui.workbench.ACTIVE_TAB_BG_START"), c2 = reg.get("org.eclipse.ui.workbench.ACTIVE_TAB_BG_END"); folder.setSelectionBackground(new Color[] {c1, c2}, new int[] {100}, true); folder.setSelectionForeground(reg.get("org.eclipse.ui.workbench.ACTIVE_TAB_TEXT_COLOR")); folder.setSimple(PlatformUI.getPreferenceStore().getBoolean(IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS)); folder.setBorderVisible(true); folder.addCTabFolder2Listener(new CTabFolder2Adapter() { @Override public void close(CTabFolderEvent event) { event.doit = true; CTabItem item = (CTabItem) event.item; disposeTab(item); try { saveMemento(folder); } catch (CoreException e) { MemoryBrowserPlugin.getDefault().getLog().log(new Status(Status.ERROR, MemoryBrowserPlugin.PLUGIN_ID, "Could not <START> get memory <END> tabs memento", e)); } } }); folder.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { for(CTabItem tab : folder.getItems()) { disposeTab(tab); } folder.removeDisposeListener(this); fMemento = null; } }); return folder; }</code><technical_language>set? save</technical_language>

Target:
private CTabFolder createTabFolder(Composite parent) { final CTabFolder folder = new CTabFolder(parent, SWT.NO_REDRAW_RESIZE | SWT.NO_TRIM | SWT.FLAT); ColorRegistry reg = JFaceResources.getColorRegistry(); Color c1 = reg.get("org.eclipse.ui.workbench.ACTIVE_TAB_BG_START"), c2 = reg.get("org.eclipse.ui.workbench.ACTIVE_TAB_BG_END"); folder.setSelectionBackground(new Color[] {c1, c2}, new int[] {100}, true); folder.setSelectionForeground(reg.get("org.eclipse.ui.workbench.ACTIVE_TAB_TEXT_COLOR")); folder.setSimple(PlatformUI.getPreferenceStore().getBoolean(IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS)); folder.setBorderVisible(true); folder.addCTabFolder2Listener(new CTabFolder2Adapter() { @Override public void close(CTabFolderEvent event) { event.doit = true; CTabItem item = (CTabItem) event.item; disposeTab(item); try { saveMemento(folder); } catch (CoreException e) { MemoryBrowserPlugin.getDefault().getLog().log(new Status(Status.ERROR, MemoryBrowserPlugin.PLUGIN_ID, "Could not save memory tabs memento", e)); } } }); folder.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { for(CTabItem tab : folder.getItems()) { disposeTab(tab); } folder.removeDisposeListener(this); } }); return folder; }
Source:
<code>public void testPeek() throws Exception { SingleItemPeekableItemReader<String> reader = new SingleItemPeekableItemReaderBuilder<String>() .setDelegate( <START> new SingleItemPeekableItemReaderTests.CountingListItemReader<String>(Arrays.asList("a", "b"))) <END> .build(); reader.setDelegate( new SingleItemPeekableItemReaderTests.CountingListItemReader<String>(Arrays.asList("a", "b"))); assertEquals("a", reader.peek()); assertEquals("a", reader.read()); assertEquals("b", reader.read()); assertEquals(null, reader.peek()); assertEquals(null, reader.read()); }</code><technical_language>a ListItemReader instead of odd</technical_language>

Target:
public void testPeek() throws Exception { SingleItemPeekableItemReader<String> reader = new SingleItemPeekableItemReaderBuilder<String>() .delegate( new ListItemReader<String>(Arrays.asList("a", "b"))) .build(); assertEquals("a", reader.peek()); assertEquals("a", reader.read()); assertEquals("b", reader.read()); assertEquals(null, reader.peek()); assertEquals(null, reader.read()); }
Source:
<code>public void onPluginDirectorySearched(OnPluginDirectorySearched event) throws InterruptedException { if (isFinishing()) return; showProgress(false); PluginListFragment fragment = getListFragment(); if (fragment == null || fragment.getListType() != PluginListType.SEARCH || !StringUtils.equals(mSearchQuery, event.searchTerm)) { <START> return; <END> } if (event.isError()) { AppLog.e(AppLog.T.PLUGINS, "An error occurred while searching the plugin directory"); ToastUtils.showToast(this, R.string.plugin_search_error); } else { mSearchResults.clear(); mSearchResults.addAll(event.plugins); fragment.showEmptyView(mSearchResults.isEmpty() && !TextUtils.isEmpty(mSearchQuery)); refreshListFragment(); } }</code><technical_language>Nice! I explicit checks</technical_language>

Target:
public void onPluginDirectorySearched(OnPluginDirectorySearched event) throws InterruptedException { if (isFinishing()) return; showProgress(false); PluginListFragment fragment = getListFragment(); if (fragment == null || fragment.getListType() != PluginListType.SEARCH || !StringUtils.equals(mSearchQuery, event.searchTerm)) { return; } if (event.isError()) { AppLog.e(AppLog.T.PLUGINS, "An error occurred while searching the plugin directory"); ToastUtils.showToast(this, R.string.plugin_search_error); } else { mSearchResults.clear(); mSearchResults.addAll(event.plugins); fragment.showEmptyView(mSearchResults.isEmpty() && !TextUtils.isEmpty(mSearchQuery)); reloadListFragment(); } }
Source:
<code>public SchedulerDriver createMesosSchedulerDriver( MesosConfiguration mesosConfig, Scheduler scheduler, boolean implicitAcknowledgements) { MesosSchedulerDriver schedulerDriver; if (mesosConfig.credential().isDefined()) { <START> schedulerDriver = new MesosSchedulerDriver(scheduler, mesosConfig.frameworkInfo().build(), mesosConfig.masterUrl(), implicitAcknowledgements, mesosConfig.credential().get().build()); <END> } else { schedulerDriver = new MesosSchedulerDriver(scheduler, mesosConfig.frameworkInfo().build(), mesosConfig.masterUrl(), implicitAcknowledgements); } return schedulerDriver; }</code><technical_language>suggestion schedulerDriver = new MesosSchedulerDriver( scheduler, mesosConfig.frameworkInfo().build(), mesosConfig.masterUrl(), implicitAcknowledgements, mesosConfig.credential().get().build()); suggest reformatting lines for readability purposes</technical_language>

Target:
public SchedulerDriver createMesosSchedulerDriver( MesosConfiguration mesosConfig, Scheduler scheduler, boolean implicitAcknowledgements) { if (mesosConfig.credential().isDefined()) { return new MesosSchedulerDriver( scheduler, mesosConfig.frameworkInfo().build(), mesosConfig.masterUrl(), implicitAcknowledgements, mesosConfig.credential().get().build()); } else { return new MesosSchedulerDriver( scheduler, mesosConfig.frameworkInfo().build(), mesosConfig.masterUrl(), implicitAcknowledgements); } }
Source:
<code>public static DiffEntry getChangeDiffEntry(Repository repository, String newPath, RevCommit newCommit, RevCommit oldCommit, ObjectReader objectReader) throws IOException { TreeWalk walk = new TreeWalk(objectReader); walk.setRecursive(true); walk.addTree(oldCommit.getTree()); walk.addTree(newCommit.getTree()); List<DiffEntry> entries = DiffEntry.scan(walk); <START> for (DiffEntry diff : entries) <END> if (diff.getChangeType() == ChangeType.MODIFY && newPath.equals(diff.getNewPath())) return diff; if (entries.size() < 2) return null; RenameDetector detector = new RenameDetector(repository); detector.addAll(entries); List<DiffEntry> renames = detector.compute(walk.getObjectReader(), NullProgressMonitor.INSTANCE); for (DiffEntry diff : renames) if (diff.getChangeType() == ChangeType.RENAME && newPath.equals(diff.getNewPath())) return diff; return null; }</code><technical_language>I braces for for loop's block</technical_language>

Target:
public static DiffEntry getChangeDiffEntry(Repository repository, String newPath, RevCommit newCommit, RevCommit oldCommit, ObjectReader objectReader) throws IOException { TreeWalk walk = new TreeWalk(objectReader); walk.setRecursive(true); walk.addTree(oldCommit.getTree()); walk.addTree(newCommit.getTree()); List<DiffEntry> entries = DiffEntry.scan(walk); for (DiffEntry diff : entries) { if (diff.getChangeType() == ChangeType.MODIFY && newPath.equals(diff.getNewPath())) return diff; } if (entries.size() < 2) return null; RenameDetector detector = new RenameDetector(repository); detector.addAll(entries); List<DiffEntry> renames = detector.compute(walk.getObjectReader(), NullProgressMonitor.INSTANCE); for (DiffEntry diff : renames) { if (diff.getChangeType() == ChangeType.RENAME && newPath.equals(diff.getNewPath())) return diff; } return null; }
Source:
<code><START> private String[] resolveQueues(String... queues) { <END> String[] result = new String[queues.length]; for (int i = 0; i < queues.length; i++) { Object resolvedValue = resolveExpression(queues[i]); if (resolvedValue instanceof Queue) { result[i] = ((Queue) resolvedValue).getName(); } else { result[i] = (String) resolvedValue; } } return result; }</code><technical_language>I fix indents tabs, changes :smile:</technical_language>

Target:
private String[] resolveQueues(String... queues) { String[] result = new String[queues.length]; for (int i = 0; i < queues.length; i++) { Object resolvedValue = resolveExpression(queues[i]); if (resolvedValue instanceof Queue) { result[i] = ((Queue) resolvedValue).getName(); } else if (resolvedValue instanceof String) { result[i] = (String) resolvedValue; } else { throw new IllegalArgumentException(String.format( "@RabbitListener can't resolve '%s' as either a String or a Queue", resolvedValue)); } } return result; }
Source:
<code>static String maskCredentialsInUrl(String originalUrl) throws IOException { <START> Pattern pattern = Pattern.compile(CREDENTIALS_IN_URL_REGEXP); <END> Matcher matcher = pattern.matcher(originalUrl); if (!matcher.find()) { return originalUrl; } String credentialsPart = matcher.group(); String[] split = credentialsPart.split(" if (split.length < 2) { throw new IOException("Failed to parse .git config"); } return StringUtils.replace(originalUrl, credentialsPart, split[0] + " }</code><technical_language>Compiling a reg exp is a pretty expensive operation. I suggest do once, save compiled pattern</technical_language>

Target:
static String maskCredentialsInUrl(String originalUrl) throws IOException { Matcher matcher = CredentialsInUrlRegexpPattern.matcher(originalUrl); if (!matcher.find()) { return originalUrl; } String credentialsPart = matcher.group(); String[] split = credentialsPart.split(" if (split.length < 2) { throw new IOException("Failed to parse .git config"); } return StringUtils.replace(originalUrl, credentialsPart, split[0] + " }
Source:
<code>public boolean accept(final Neo4jPersistentProperty property) { <START> return property.isSerializablePropertyField(genericConversionService); <END> }</code><technical_language>handle non-transient values, or</technical_language>

Target:
public boolean accept(final Neo4jPersistentProperty property) { return property.getType() == Object.class && !property.isTransient(); }
Source:
<code>public boolean deleteIdentifier() { boolean result = false; if (selectedIdentifier != null) { if (CollectionUtils.isNotEmpty(getIdentifiers()) && getIdentifiers().size() > 1) { result = wsService.deleteIdentifier(selectedIdentifier); if (result) { withPatient.getIdentifierList().remove(selectedIdentifier); } selectedIdentifier = null; } else { <START> addPatientErrorMessages("Patient-identifier cannot be empty: fail to delete the last record"); <END> } } else { addPatientErrorMessages(msgForSelectDelete(IDENTIFIER)); } return result; }</code><technical_language>Update message identifier deleted</technical_language>

Target:
public boolean deleteIdentifier() { boolean result = false; if (selectedIdentifier != null) { if (CollectionUtils.isNotEmpty(getIdentifiers()) && getIdentifiers().size() > 1) { result = wsService.deleteIdentifier(selectedIdentifier); if (result) { refreshPatient(); } selectedIdentifier = null; } else { addPatientErrorMessages("Last identifier cannot be deleted."); } } else { addPatientErrorMessages(msgForSelectDelete(IDENTIFIER)); } return result; }
Source:
<code>public static LfsPointer parseLfsPointer(InputStream in) throws IOException { boolean versionLine = false; LongObjectId id = null; long si = -1; try (BufferedReader br = new BufferedReader( new InputStreamReader(in))) { for (String s = br.readLine(); s != null; s = br.readLine()) { if (s.startsWith("#") || s.length() == 0) { continue; } else if (s.startsWith("version") && s.length() > 8 && s.substring(8).trim().equals(VERSION)) { versionLine = true; } else if (s.startsWith("oid sha256:")) { id = LongObjectId.fromString(s.substring(11).trim()); } else if (s.startsWith("size") && s.length() > 5) { <START> si = <END> Long.parseLong(s.substring(5).trim()); } else { return null; } } if (versionLine && id != null && si > -1) { return new LfsPointer(id, si); } } return null; }</code><technical_language>strange variable name, n sz</technical_language>

Target:
public static LfsPointer parseLfsPointer(InputStream in) throws IOException { boolean versionLine = false; LongObjectId id = null; long sz = -1; try (BufferedReader br = new BufferedReader( new InputStreamReader(in))) { for (String s = br.readLine(); s != null; s = br.readLine()) { if (s.startsWith("#") || s.length() == 0) { continue; } else if (s.startsWith("version") && s.length() > 8 && s.substring(8).trim().equals(VERSION)) { versionLine = true; } else if (s.startsWith("oid sha256:")) { id = LongObjectId.fromString(s.substring(11).trim()); } else if (s.startsWith("size") && s.length() > 5) { sz = Long.parseLong(s.substring(5).trim()); } else { return null; } } if (versionLine && id != null && sz > -1) { return new LfsPointer(id, sz); } } return null; }
Source:
<code>private static JavaArchive createJar(final String archiveName, final String securityDomainName) { final JavaArchive jar = ShrinkWrap .create(JavaArchive.class, archiveName) .addClasses(HelloBean.class, Hello.class, CustomXACMLAuthorizationModule.class, Util.class) .addAsResource(new StringAsset("jduke=theduke\nJohnDoe=jdoe"), "users.properties") .addAsResource(new StringAsset("jduke=TestRole,TestRole2\nJohnDoe=TestRole"), "roles.properties") .addAsResource(EjbXACMLAuthorizationModuleTestCase.class.getPackage(), XACMLTestUtils.TESTOBJECTS_CONFIG + "/jbossxacml-config.xml", "jbossxacml-config.xml") .addAsResource(EjbXACMLAuthorizationModuleTestCase.class.getPackage(), XACMLTestUtils.TESTOBJECTS_POLICIES + "/ejb-xacml-policy.xml", "xacml-policy.xml") .addAsManifestResource(EjbXACMLAuthorizationModuleTestCase.class.getPackage(), XACMLTestUtils.TESTOBJECTS_CONFIG + "/jboss-ejb3.xml", "jboss-ejb3.xml") .addAsResource(createPermissionsXmlAsset( new RuntimePermission("accessDeclaredMembers"), new RuntimePermission("getClassLoader"), new ElytronPermission("getSecurityDomain"), <START> new ReflectPermission("suppressAccessChecks") <END> ), "META-INF/permissions.xml"); XACMLTestUtils.addJBossDeploymentStructureToArchive(jar); jar.addClasses(AbstractSecurityDomainsServerSetupTask.class); return jar; }</code><technical_language>Please remove RuntimePermissions - ElytronPermission added - added privileged block instead: <LINK_0> (discussion in <LINK_1> )</technical_language>

Target:
private static JavaArchive createJar(final String archiveName, final String securityDomainName) { final JavaArchive jar = ShrinkWrap .create(JavaArchive.class, archiveName) .addClasses(HelloBean.class, Hello.class, CustomXACMLAuthorizationModule.class, Util.class) .addAsResource(new StringAsset("jduke=theduke\nJohnDoe=jdoe"), "users.properties") .addAsResource(new StringAsset("jduke=TestRole,TestRole2\nJohnDoe=TestRole"), "roles.properties") .addAsResource(EjbXACMLAuthorizationModuleTestCase.class.getPackage(), XACMLTestUtils.TESTOBJECTS_CONFIG + "/jbossxacml-config.xml", "jbossxacml-config.xml") .addAsResource(EjbXACMLAuthorizationModuleTestCase.class.getPackage(), XACMLTestUtils.TESTOBJECTS_POLICIES + "/ejb-xacml-policy.xml", "xacml-policy.xml") .addAsManifestResource(EjbXACMLAuthorizationModuleTestCase.class.getPackage(), XACMLTestUtils.TESTOBJECTS_CONFIG + "/jboss-ejb3.xml", "jboss-ejb3.xml") .addAsResource(createPermissionsXmlAsset( new ElytronPermission("getSecurityDomain") ), "META-INF/permissions.xml"); XACMLTestUtils.addJBossDeploymentStructureToArchive(jar); jar.addClasses(AbstractSecurityDomainsServerSetupTask.class); return jar; }