auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private Result checkFileInSourceFolders(VirtualFile file, Module module) { ProjectFileIndex fileIndex = projectRootManager.getFileIndex(); if (fileIndex.isExcluded(file)) { return Result.excluded("file is excluded or ignored in IntelliJ's project structure"); } <START> if (SonarLintUtils.isGeneratedSoruce(module, fileIndex.getSourceRootForFile(file))) { <END> return Result.excluded("file is generated in IntelliJ's project structure"); } if (fileIndex.isInSourceContent(file)) { return Result.notExcluded(); } return Result.excluded("file does not belong to sources in IntelliJ's project structure"); }</code><technical_language>typo s/isGeneratedSoruce/isGeneratedSource</technical_language>

Target:
private Result checkFileInSourceFolders(VirtualFile file, Module module) { ProjectFileIndex fileIndex = projectRootManager.getFileIndex(); if (fileIndex.isExcluded(file)) { return Result.excluded("file is excluded or ignored in IntelliJ's project structure"); } SourceFolder sourceFolder = SonarLintUtils.getSourceFolder(fileIndex.getSourceRootForFile(file), module); if (sourceFolder != null) { if (SonarLintUtils.isGeneratedSource(sourceFolder)) { return Result.excluded("file is classified as generated in IntelliJ's project structure"); } if (SonarLintUtils.isJavaResource(sourceFolder)) { return Result.excluded("file is classified as resource in IntelliJ's project structure"); } } return Result.notExcluded(); }
Source:
<code>public void testRequestUsesElseForward() throws Exception { PipeForward forw = new PipeForward("custom_else", "random/path"); pipe.registerForward(forw); pipe.setElseForwardName("custom_else"); <START> assertEquals(pipe.doPipe(request, session).getPipeForward().getName().toString(), "custom_else"); <END> }</code><technical_language>This is a recipe for NullPointerExceptions</technical_language>

Target:
public void testRequestUsesElseForward() throws Exception { PipeForward forw = new PipeForward("custom_else", "random/path"); pipe.registerForward(forw); pipe.setElseForwardName("custom_else"); PipeRunResult res = doPipe(pipe, request, session); PipeForward forward = res.getPipeForward(); assertEquals(forward.getName(), "custom_else"); }
Source:
<code>private StoredObject generateNewFile(VersionedFile file, String uniqueIdentifier, String code) { String fullPath = uniqueIdentifier + file.getTimestamp(); if (storage.findByPath(file.getTenant().fetchValue(), VERSIONED_FILES, fullPath).isPresent()) { throw Exceptions.createHandled() .withNLSKey("VersionedFiles.versionExistsConflict") .set("date", NLS.toUserString(file.getTimestamp())) .set("path", uniqueIdentifier) .handle(); } <START> StoredObject object = storage.createTemporaryObject(file.getTenant().fetchValue(), <END> VERSIONED_FILES, file.getStoredFile().getReference(), fullPath); try (OutputStream out = storage.updateFile(object)) { out.write(code.getBytes()); } catch (IOException e) { throw Exceptions.handle(Storage.LOG, e); } return object; }</code><technical_language>cache</technical_language>

Target:
private StoredObject generateNewFile(VersionedFile file, String uniqueIdentifier, String code) { String fullPath = uniqueIdentifier + file.getTimestamp(); if (storage.findByPath(tenants.fetchCachedRequiredTenant(file.getTenant()), VERSIONED_FILES, fullPath) .isPresent()) { throw Exceptions.createHandled() .withNLSKey("VersionedFiles.versionExistsConflict") .set("date", NLS.toUserString(file.getTimestamp())) .set("path", uniqueIdentifier) .handle(); } StoredObject object = storage.createTemporaryObject(tenants.fetchCachedRequiredTenant(file.getTenant()), VERSIONED_FILES, file.getStoredFile().getReference(), fullPath); try (OutputStream out = storage.updateFile(object)) { out.write(code.getBytes()); } catch (IOException e) { throw Exceptions.handle(Storage.LOG, e); } return object; }
Source:
<code>private void createLayout() { setLayout(new GridLayout(1, false)); <START> searchControl = new SearchControl(this, model, model); <END> searchControl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); searchControl.setSearcher(model); lblTableTitle = new Label(this, SWT.NONE); lblTableTitle.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); tableViewer = new TableViewer(this, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER); tableViewer.setComparator(comparator); tableViewer.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); jmsStatusLabel = new Label(this, SWT.BORDER); jmsStatusLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); setConnectionStatus(model.getConnectionStatus()); createTableColumns(tableViewer); createContextMenu(tableViewer); addDoubleClickListener(tableViewer); final Table table = tableViewer.getTable(); table.setHeaderVisible(true); table.setLinesVisible(true); table.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (e.keyCode == SWT.DEL) { clearSelectedMessages(); } } }); table.addMenuDetectListener(new MenuDetectListener() { @Override public void menuDetected(MenuDetectEvent e) { updateContextMenu(); } }); tableViewer.setContentProvider(ArrayContentProvider.getInstance()); setData(new LogMessage[0]); }</code><technical_language>do need pass model twice</technical_language>

Target:
private void createLayout() { setLayout(new GridLayout(1, false)); searchControl = new SearchControl(this, model); searchControl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); searchControl.setSearcher(model); lblTableTitle = new Label(this, SWT.NONE); lblTableTitle.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); tableViewer = new TableViewer(this, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER); tableViewer.setComparator(comparator); tableViewer.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); jmsStatusLabel = new Label(this, SWT.BORDER); jmsStatusLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); setConnectionStatus(model.getConnectionStatus()); createTableColumns(tableViewer); createContextMenu(tableViewer); addDoubleClickListener(tableViewer); final Table table = tableViewer.getTable(); table.setHeaderVisible(true); table.setLinesVisible(true); table.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (e.keyCode == SWT.DEL) { clearSelectedMessages(); } } }); table.addMenuDetectListener(new MenuDetectListener() { @Override public void menuDetected(MenuDetectEvent e) { updateContextMenu(); } }); tableViewer.setContentProvider(ArrayContentProvider.getInstance()); setData(new LogMessage[0]); }
Source:
<code>public void testEncodePrettily() throws Exception { jsonObject.put("mystr", "foo"); jsonObject.put("myint", 123); jsonObject.put("mylong", 1234l); jsonObject.put("myfloat", 1.23f); jsonObject.put("mydouble", 2.34d); jsonObject.put("myboolean", true); byte[] bytes = TestUtils.randomByteArray(10); jsonObject.put("mybinary", bytes); jsonObject.put("myobj", new JsonObject().put("foo", "bar")); jsonObject.put("myarr", new JsonArray().add("foo").add(123)); String strBytes = Base64.getEncoder().encodeToString(bytes); <START> String expected = "{" + System.getProperty("line.separator") + <END> " \"mystr\" : \"foo\"," + System.getProperty("line.separator") + " \"myint\" : 123," + System.getProperty("line.separator") + " \"mylong\" : 1234," + System.getProperty("line.separator") + " \"myfloat\" : 1.23," + System.getProperty("line.separator") + " \"mydouble\" : 2.34," + System.getProperty("line.separator") + " \"myboolean\" : true," + System.getProperty("line.separator") + " \"mybinary\" : \"" + strBytes + "\"," + System.getProperty("line.separator") + " \"myobj\" : {" + System.getProperty("line.separator") + " \"foo\" : \"bar\"" + System.getProperty("line.separator") + " }," + System.getProperty("line.separator") + " \"myarr\" : [ \"foo\", 123 ]" + System.getProperty("line.separator") + "}"; String json = jsonObject.encodePrettily(); assertEquals(expected, json); }</code><technical_language>preferable put in constant avoid writing out code multiple times</technical_language>

Target:
public void testEncodePrettily() throws Exception { jsonObject.put("mystr", "foo"); jsonObject.put("myint", 123); jsonObject.put("mylong", 1234l); jsonObject.put("myfloat", 1.23f); jsonObject.put("mydouble", 2.34d); jsonObject.put("myboolean", true); byte[] bytes = TestUtils.randomByteArray(10); jsonObject.put("mybinary", bytes); jsonObject.put("myobj", new JsonObject().put("foo", "bar")); jsonObject.put("myarr", new JsonArray().add("foo").add(123)); String strBytes = Base64.getEncoder().encodeToString(bytes); String expected = "{" + Utils.LINE_SEPARATOR + " \"mystr\" : \"foo\"," + Utils.LINE_SEPARATOR + " \"myint\" : 123," + Utils.LINE_SEPARATOR + " \"mylong\" : 1234," + Utils.LINE_SEPARATOR + " \"myfloat\" : 1.23," + Utils.LINE_SEPARATOR + " \"mydouble\" : 2.34," + Utils.LINE_SEPARATOR + " \"myboolean\" : true," + Utils.LINE_SEPARATOR + " \"mybinary\" : \"" + strBytes + "\"," + Utils.LINE_SEPARATOR + " \"myobj\" : {" + Utils.LINE_SEPARATOR + " \"foo\" : \"bar\"" + Utils.LINE_SEPARATOR + " }," + Utils.LINE_SEPARATOR + " \"myarr\" : [ \"foo\", 123 ]" + Utils.LINE_SEPARATOR + "}"; String json = jsonObject.encodePrettily(); assertEquals(expected, json); }
Source:
<code>public AssetUri getPrefabURI() { if (exists()) { EntityInfoComponent info = getComponent(EntityInfoComponent.class); <START> if (info != null && !info.parentPrefab.exists()) { <END> return new AssetUri(AssetType.PREFAB, info.parentPrefab.getName()); } } return null; }</code><technical_language>This right, ! there</technical_language>

Target:
public AssetUri getPrefabURI() { if (exists()) { EntityInfoComponent info = getComponent(EntityInfoComponent.class); if (info != null && info.parentPrefab.exists()) { return new AssetUri(AssetType.PREFAB, info.parentPrefab.getName()); } } return null; }
Source:
<code><START> public void close() throws Exception { <END> this.isFinished = true; }</code><technical_language>I find call close method</technical_language>

Target:
public void close() { this.isFinished = true; }
Source:
<code>public DefaultInternalRunner(Class<?> testClass, final Supplier<MockitoTestListener> listenerSupplier) throws InitializationError { runner = new BlockJUnit4ClassRunner(testClass) { private Object target; private MockitoTestListener mockitoTestListener; protected Statement withBefores(FrameworkMethod method, Object target, Statement statement) { this.target = target; mockitoTestListener = listenerSupplier.get(); Mockito.framework().addListener(mockitoTestListener); MockitoAnnotations.initMocks(target); return super.withBefores(method, target, statement); } public void run(final RunNotifier notifier) { <START> final RunListener listener = new RunListener() { <END> Throwable failure; boolean started; public void testStarted(Description description) throws Exception { started = true; } public void testFailure(Failure failure) throws Exception { this.failure = failure.getException(); if (!started && mockitoTestListener != null) { Mockito.framework().removeListener(mockitoTestListener); } } public void testFinished(Description description) throws Exception { try { if (mockitoTestListener != null) { Mockito.framework().removeListener(mockitoTestListener); mockitoTestListener.testFinished(new DefaultTestFinishedEvent(target, description.getMethodName(), failure)); } Mockito.validateMockitoUsage(); } catch (Throwable t) { notifier.fireTestFailure(new Failure(description, t)); } } }; notifier.addListener(listener); super.run(notifier); } }; }</code><technical_language>Nit: needed</technical_language>

Target:
public DefaultInternalRunner(Class<?> testClass, final Supplier<MockitoTestListener> listenerSupplier) throws InitializationError { runner = new BlockJUnit4ClassRunner(testClass) { public Object target; private MockitoTestListener mockitoTestListener; protected Statement withBefores(FrameworkMethod method, Object target, Statement statement) { this.target = target; mockitoTestListener = listenerSupplier.get(); Mockito.framework().addListener(mockitoTestListener); MockitoAnnotations.initMocks(target); return super.withBefores(method, target, statement); } public void run(final RunNotifier notifier) { RunListener listener = new RunListener() { private boolean started; Throwable failure; @Override public void testStarted(Description description) throws Exception { started = true; } @Override public void testFailure(Failure failure) throws Exception { this.failure = failure.getException(); if (!started && mockitoTestListener != null) { Mockito.framework().removeListener(mockitoTestListener); } } @Override public void testFinished(Description description) throws Exception { try { if (mockitoTestListener != null) { Mockito.framework().removeListener(mockitoTestListener); mockitoTestListener.testFinished(new DefaultTestFinishedEvent(target, description.getMethodName(), failure)); } Mockito.validateMockitoUsage(); } catch (Throwable t) { notifier.fireTestFailure(new Failure(description, t)); } } }; notifier.addListener(listener); super.run(notifier); } }; }
Source:
<code>private InetSocketAddress getNativeAddressFromPeers(AdminRow row) { InetAddress nativeAddress = row.getInetAddress("native_address"); if (nativeAddress == null) { nativeAddress = row.getInetAddress("rpc_address"); } if (nativeAddress == null) { return null; } <START> Integer row_port = row.getInteger("native_port"); <END> if (row_port == null) { row_port = port; } return addressTranslator.translate(new InetSocketAddress(nativeAddress, row_port)); }</code><technical_language>Please Java conventions for variable names: rowPort</technical_language>

Target:
private InetSocketAddress getNativeAddressFromPeers(AdminRow row) { InetAddress nativeAddress = row.getInetAddress("native_address"); if (nativeAddress == null) { nativeAddress = row.getInetAddress("rpc_address"); } if (nativeAddress == null) { return null; } Integer rowPort = row.getInteger("native_port"); if (rowPort == null || rowPort == 0) { rowPort = port; } return addressTranslator.translate(new InetSocketAddress(nativeAddress, rowPort)); }
Source:
<code>public IdentityClientOptions setTokenRefreshOffset(Duration tokenRefreshOffset) { <START> this.tokenRefreshOffset = tokenRefreshOffset; <END> return this; }</code><technical_language>nit; null check</technical_language>

Target:
public IdentityClientOptions setTokenRefreshOffset(Duration tokenRefreshOffset) { if (tokenRefreshOffset != null) { this.tokenRefreshOffset = tokenRefreshOffset; } return this; }
Source:
<code>protected void handleError(final Exception e, final DeviceMessageMetadata deviceMessageMetadata) { LOGGER.info("handeling error: for message type: {}", e.getMessage(), deviceMessageMetadata.getMessageType()); final OsgpException osgpException = this.ensureOsgpException(e); <START> this.webServiceResponseMessageSender.send( <END> ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(deviceMessageMetadata.getCorrelationUid()) .withOrganisationIdentification(deviceMessageMetadata.getOrganisationIdentification()) .withDeviceIdentification(deviceMessageMetadata.getDeviceIdentification()) .withResult(ResponseMessageResultType.NOT_OK).withOsgpException(osgpException) .withMessagePriority(deviceMessageMetadata.getMessagePriority()).build(), deviceMessageMetadata.getMessageType()); }</code><technical_language>Extract building of ResponseMessage variable (in eclipse, select text, right-click > refactor > extract local variable / select code + shift+alt+L). This code a bit more readable, especially passing in other besides ResponseMessage</technical_language>

Target:
protected void handleError(final Exception e, final DeviceMessageMetadata deviceMessageMetadata) { LOGGER.info("handeling error: for message type: {}", e.getMessage(), deviceMessageMetadata.getMessageType()); final OsgpException osgpException = this.ensureOsgpException(e); final ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(deviceMessageMetadata.getCorrelationUid()) .withOrganisationIdentification(deviceMessageMetadata.getOrganisationIdentification()) .withDeviceIdentification(deviceMessageMetadata.getDeviceIdentification()) .withResult(ResponseMessageResultType.NOT_OK).withOsgpException(osgpException) .withMessagePriority(deviceMessageMetadata.getMessagePriority()).build(); this.webServiceResponseMessageSender.send(responseMessage, deviceMessageMetadata.getMessageType()); }
Source:
<code>private String getDefaultFilePath() { String defaultFilePath = null; FormController formController = Collect.getInstance().getFormController(); if (formController != null) { if (binaryName.startsWith("jr://images/")) { try { defaultFilePath = referenceManager.deriveReference(binaryName).getLocalURI(); } catch (InvalidReferenceException e) { Timber.w(e); } } else { <START> defaultFilePath = formController.getMediaFolder() + File.separator + binaryName; <END> } } return defaultFilePath; }</code><technical_language>This means manually get media folder if a file prefix? Why? consider if a jr://file/ URI is set, for example, end a path /path/to/media/folder/jr://file/name</technical_language>

Target:
String getDefaultFilePath() { try { return referenceManager.deriveReference(binaryName).getLocalURI(); } catch (InvalidReferenceException e) { Timber.w(e); } return ""; }
Source:
<code>private FedoraResource getResourceOrParentFromPath(final FedoraId fedoraId) { FedoraResource resource = null; log.debug("Attempting to get FedoraResource for {}", fedoraId.getFullIdPath()); try { resource = resource(fedoraId); log.debug("Got FedoraResource for {}", fedoraId.getFullIdPath()); } catch (final PathNotFoundException e) { log.debug("Path does not exist", fedoraId.getFullIdPath()); <START> if (fedoraId.getFullId().length() > 1) { <END> final int lastSlash = fedoraId.getFullId().lastIndexOf("/"); final int end = lastSlash > 0 ? lastSlash : lastSlash + 1; resource = getResourceOrParentFromPath(FedoraId.create(fedoraId.getFullId().substring(0, end))); } } return resource; }</code><technical_language>code else walks id containment this? related for AGs? a useful extracted somewhere. if FedoraId a method for creating a new FedoraId of parent</technical_language>

Target:
private FedoraResource getResourceOrParentFromPath(final FedoraId fedoraId) { try { log.debug("Testing FedoraResource for {}", fedoraId.getFullIdPath()); return this.resourceFactory.getResource(transaction(), fedoraId); } catch (final PathNotFoundException exc) { log.debug("Resource not found getting container", fedoraId.getFullIdPath()); final String txID = transaction() == null ? null : transaction().getId(); final FedoraId containerId = containmentIndex.getContainerIdByPath(txID, fedoraId); log.debug("Attempting to get FedoraResource for {}", fedoraId.getFullIdPath()); try { log.debug("Got FedoraResource for {}", containerId.getFullIdPath()); return this.resourceFactory.getResource(transaction(), containerId); } catch (final PathNotFoundException exc2) { log.debug("Path does not exist, but we should never end up here.", containerId.getFullIdPath()); return null; } } }
Source:
<code>public String getEndpointHost() { if(endpointHost.startsWith("https://")){ <START> return endpointHost.substring(8); <END> } return endpointHost; }</code><technical_language>suggestion return endpointHost.substring("https://".length()); a more clear magic numbe 8</technical_language>

Target:
public String getEndpointHost() { if(endpointHost.startsWith("https://")){ return endpointHost.substring("https://".length()); } return endpointHost; }
Source:
<code>public MetastoreHiveStatisticsProvider(TypeManager typeManager, SemiTransactionalHiveMetastore metastore, DateTimeZone timeZone) { this.typeManager = requireNonNull(typeManager, "typeManager is null"); <START> this.metastore = requireNonNull(metastore, "metastore is null"); <END> this.timeZone = timeZone; }</code><technical_language>I do find selectedPartitions a name hivePartitions. I refrain this rename. allTablePartitions</technical_language>

Target:
public MetastoreHiveStatisticsProvider(TypeManager typeManager, SemiTransactionalHiveMetastore metastore, DateTimeZone timeZone) { this.typeManager = requireNonNull(typeManager, "typeManager is null"); this.metastore = requireNonNull(metastore, "metastore is null"); this.timeZone = requireNonNull(timeZone, "timeZone is null"); }
Source:
<code>public static ByteBuf writeArgs(ByteBufAllocator allocator, ByteBuf header, List<ByteBuf> args) { int writableBytes = TFrame.MAX_FRAME_PAYLOAD_LENGTH - header.readableBytes(); List<ByteBuf> bufs = new ArrayList<>(7); bufs.add(header); while (!args.isEmpty()) { ByteBuf arg = args.get(0); int len = writeArg(allocator, arg, writableBytes, bufs); writableBytes -= len; <START> if (writableBytes <= 2) { <END> break; } if (arg.readableBytes() == 0) { args.remove(0); } } CompositeByteBuf comp = allocator.compositeBuffer(); comp.addComponents(bufs); comp.writerIndex(TFrame.MAX_FRAME_PAYLOAD_LENGTH - writableBytes); return comp; }</code><technical_language>give 2 a name</technical_language>

Target:
public static ByteBuf writeArgs(ByteBufAllocator allocator, ByteBuf header, List<ByteBuf> args) { int writableBytes = TFrame.MAX_FRAME_PAYLOAD_LENGTH - header.readableBytes(); List<ByteBuf> bufs = new ArrayList<>(7); bufs.add(header); while (!args.isEmpty()) { ByteBuf arg = args.get(0); int len = writeArg(allocator, arg, writableBytes, bufs); writableBytes -= len; if (writableBytes <= TFrame.FRAME_SIZE_LENGTH) { break; } if (arg.readableBytes() == 0) { args.remove(0); } } CompositeByteBuf comp = allocator.compositeBuffer(); comp.addComponents(bufs); comp.writerIndex(TFrame.MAX_FRAME_PAYLOAD_LENGTH - writableBytes); return comp; }
Source:
<code>public Collection<FederatedSource> getFederatedSources() { List<FederatedSource> sources = new ArrayList<>(federatedSources); sources.addAll(oauthFederatedSources); <START> return sources; <END> }</code><technical_language>question FederatedSources OAuthSources living in separate variables</technical_language>

Target:
public Collection<FederatedSource> getFederatedSources() { return federatedSources; }
Source:
<code>public void basicSimpleTest() { final Message message = new SimpleMessage("Test Message"); final StringMap contextData = ContextDataFactory.createContextData(); contextData.putValue("service", "log4j2"); final LogEvent event = Log4jLogEvent.newBuilder().setLoggerName(LOGGER.getName()).setLevel(Level.DEBUG) .setContextData(contextData).setIncludeLocation(true) .setLoggerFqcn("org.talend.logging.event.Log4j2JSONLayoutTest").setMessage(message).build(); AbstractStringLayout layout = Log4j2JSONLayout.createLayout(true, true, true, true, false, Charset.defaultCharset(), null); LOGGER.debug("I shouldn't have MDC data in my log"); String actualJSON = layout.toSerializable(event); <START> System.out.println(actualJSON); <END> assertThat(actualJSON, sameJSONAs(EXPECTED_BASIC_SIMPLE_JSON_TEST).allowingExtraUnexpectedFields().allowingAnyArrayOrdering()); }</code><technical_language>Do System.out.println(actualJSON) in tests LOGGER instead</technical_language>

Target:
public void basicSimpleTest() { final Message message = new SimpleMessage("Test Message"); final StringMap contextData = ContextDataFactory.createContextData(); contextData.putValue("service", "log4j2"); final LogEvent event = Log4jLogEvent.newBuilder().setLoggerName(LOGGER.getName()).setLevel(Level.DEBUG) .setContextData(contextData).setIncludeLocation(true) .setLoggerFqcn("org.talend.logging.event.Log4j2JSONLayoutTest").setMessage(message).build(); AbstractStringLayout layout = Log4j2JSONLayout.createLayout(true, true, true, true, false, Charset.defaultCharset(), null); LOGGER.debug("I shouldn't have MDC data in my log"); String actualJSON = layout.toSerializable(event); assertThat(actualJSON, sameJSONAs(EXPECTED_BASIC_SIMPLE_JSON_TEST).allowingExtraUnexpectedFields().allowingAnyArrayOrdering()); }
Source:
<code>public void getExpandedItems_tryToAddItemsToCollection_shouldThrowException() { exceptionRule.expect(UnsupportedOperationException.class); TreeNode root = new TreeNode("root", null); TreeNode first1 = new TreeNode("first-1", root); TreeNode second1 = new TreeNode("second-2", root); TreeNode first11 = new TreeNode("first-1-1", first1); TreeNode second11 = new TreeNode("second-1-1", second1); <START> HierarchicalDataProvider<TreeNode, Void> dataProvider = <END> new AbstractBackEndHierarchicalDataProvider<TreeNode, Void>() { @Override public int getChildCount(HierarchicalQuery<TreeNode, Void> query) { if (query.getParent() == null) { return 2; } if (query.getParent().getName().equals("first-1") || query.getParent().getName().equals("second-1")) { return 1; } return 0; } @Override public boolean hasChildren(TreeNode item) { return item.getParent() == null || item.getParent().getName().equals("first-1") || item.getParent().getName().equals("second-1"); } @Override protected Stream<TreeNode> fetchChildrenFromBackEnd( HierarchicalQuery<TreeNode, Void> query) { if (query.getParent() == null) { return Arrays.stream(new TreeNode[]{ first1, second1 }); } if (query.getParent().getName().equals("first-1")) { return Arrays.stream(new TreeNode[]{first11}); } return Arrays.stream(new TreeNode[]{second11}); } }; HierarchyMapper<TreeNode, Void> hierarchyMapper = new HierarchyMapper<>( dataProvider ); hierarchyMapper.expand(root); hierarchyMapper.expand(second1); Map<Object, TreeNode> expandedItems = hierarchyMapper.getExpandedItems(); expandedItems.put(new Object(), new TreeNode("third-1")); }</code><technical_language>this data provider is more once, is extract class reuse</technical_language>

Target:
public void getExpandedItems_tryToAddItemsToCollection_shouldThrowException() { exceptionRule.expect(UnsupportedOperationException.class); TreeNode root = new TreeNode("root", null); TreeNode second1 = new TreeNode("second-1", root); TreeNode second2 = new TreeNode("second-2", root); TreeNode third11 = new TreeNode("third-1-1", second1); TreeNode third21 = new TreeNode("third-2-1", second2); HierarchicalDataProvider<TreeNode, Void> dataProvider = new ThreeLevelStaticHierarchicalDataProvider(root, new TreeNode[]{second1, second2}, new TreeNode[]{third11, third21}); HierarchyMapper<TreeNode, Void> hierarchyMapper = new HierarchyMapper<>( dataProvider ); hierarchyMapper.expand(root); hierarchyMapper.expand(second1); Collection<TreeNode> expandedItems = hierarchyMapper.getExpandedItems(); expandedItems.add(new TreeNode("third-1")); }
Source:
<code>public GetObjectRequest(final String bucketName, final String objectName, final long offset, final UUID jobId) { this.bucketName = bucketName; this.objectName = objectName; this.jobId = jobId; this.offset = offset; if(jobId != null) { this.getQueryParams().put("job", jobId.toString()); } <START> this.getQueryParams().put("offset", Long.toString(offset)); <END> }</code><technical_language>I cross-referenced this server code I this break regular S3 GETs. If job id send offset</technical_language>

Target:
public GetObjectRequest(final String bucketName, final String objectName, final long offset, final UUID jobId) { this.bucketName = bucketName; this.objectName = objectName; this.jobId = jobId; this.offset = offset; this.getQueryParams().put("job", jobId.toString()); this.getQueryParams().put("offset", Long.toString(offset)); }
Source:
<code>private void doWhoIsRequest(VoiceInput voiceInput, SsmlDocumentBuilder builder) { String bot = (String) voiceInput.getMetadata().get("bot"); String botInQuestion = voiceInput.getMessageAsMap().get("botName"); if(bot == null || bot.isEmpty() || botInQuestion == null || botInQuestion.isEmpty()){ builder.text("I don't have any info for this situation."); return; } switch(bot){ case "complibot": if(botInQuestion.equals(bot)){ builder.text("That's me! ").endSentence(); doWhatDoYouDoRequest(voiceInput, builder); }else if(botInQuestion.equals("insultibot")){ builder.text("That's my bestie. ").endSentence().text("It can act grumpy sometimes, but it has a heart of gold.").endSentence(); }else{ builder.text("I don't know that bot, but I bet it's awesome.").endSentence(); } break; case "insultibot": if(botInQuestion.equals(bot)){ builder.text("Are you trolling me? ").endSentence().text("That's me. ").endSentence(); doWhatDoYouDoRequest(voiceInput, builder); }else if(botInQuestion.equals("complibot")){ builder.text("That's the annoyingly cheerful bot that won't shut up.").endSentence(); }else{ builder.text("I don't know that bot, and I'm perfectly fine with that.").endSentence(); } break; default: <START> builder.text("I don't have that info for the bot named '" + bot + "'.").endSentence(); <END> return; } }</code><technical_language>info</technical_language>

Target:
private void doWhoIsRequest(VoiceInput voiceInput, SsmlDocumentBuilder builder) { String bot = (String) voiceInput.getMetadata().get("bot"); String botInQuestion = voiceInput.getMessageAsMap().get("botName"); if(StringUtils.isEmpty(bot) || StringUtils.isEmpty(botInQuestion)){ builder.text("I don't have any info for this situation."); return; } switch(bot){ case "complibot": if(botInQuestion.equals(bot)){ builder.text("That's me! ").endSentence(); doWhatDoYouDoRequest(voiceInput, builder); }else if(botInQuestion.equals("insultibot")){ builder.text("That's my bestie. ").endSentence().text("It can act grumpy sometimes, but it has a heart of gold.").endSentence(); }else{ builder.text("I don't know that bot, but I bet it's awesome.").endSentence(); } break; case "insultibot": if(botInQuestion.equals(bot)){ builder.text("Are you trolling me? ").endSentence().text("That's me. ").endSentence(); doWhatDoYouDoRequest(voiceInput, builder); }else if(botInQuestion.equals("complibot")){ builder.text("That's the annoyingly cheerful bot that won't shut up.").endSentence(); }else{ builder.text("I don't know that bot, and I'm perfectly fine with that.").endSentence(); } break; default: builder.text("I don't have any info for the bot named '" + bot + "'.").endSentence(); return; } }
Source:
<code>public boolean updateCertificateTS(String oldAlias, Certificate cert) throws CertificateManagerException { final Map<String, String> trustStoreProperties = cmHelper.getTrustStoreSystemProperties(); String storeType = trustStoreProperties.get(TRUST_STORE_TYPE_KEY); final String storeLoc = trustStoreProperties.get(TRUST_STORE_KEY); final String passkey = trustStoreProperties.get(TRUST_STORE_PASSWORD_KEY); FileInputStream is = null; FileOutputStream os = null; boolean isUpdateSuccessful = false; try { KeyStore tstore = KeyStore.getInstance(storeType); if (!PKCS11_TYPE.equalsIgnoreCase(storeType)) { is = new FileInputStream(storeLoc); <START> } <END> tstore.load(is, passkey.toCharArray()); if (tstore.containsAlias(oldAlias)) { certToRestore = cert; os = updateCert(oldAlias, cert, storeLoc, passkey, tstore); isUpdateSuccessful = true; } } catch (final IOException | NoSuchAlgorithmException | CertificateException | KeyStoreException ex) { isUpdateSuccessful = false; LOG.error("Unable to update the Certifiate: ", ex.getLocalizedMessage(), ex); throw new CertificateManagerException(ex.getMessage(), ex); } finally { closeFiles(is, os); } return isUpdateSuccessful; }</code><technical_language>Factor out common logic in a private method for updateCertificateTS updateCertificateKS</technical_language>

Target:
public boolean updateCertificateTS(String oldAlias, Certificate cert) throws CertificateManagerException { final Map<String, String> trustStoreProperties = cmHelper.getTrustStoreSystemProperties(); String storeType = trustStoreProperties.get(TRUST_STORE_TYPE_KEY); final String storeLoc = trustStoreProperties.get(TRUST_STORE_KEY); final String passkey = trustStoreProperties.get(TRUST_STORE_PASSWORD_KEY); KeyStore storeCert; try { storeCert = KeyStore.getInstance(storeType); return updateCertificate(oldAlias, cert, storeType, storeLoc, passkey, storeCert); } catch (final KeyStoreException ex) { LOG.error("Unable to update the Certifiate: ", ex.getLocalizedMessage(), ex); throw new CertificateManagerException(ex.getMessage(), ex); } }
Source:
<code><START> private String getUgiUserName() throws IOException { <END> UserGroupInformation ugi = UserGroupInformation.getCurrentUser(); return ugi.getShortUserName(); }</code><technical_language>this method static - access object state</technical_language>

Target:
private static String getUgiUserName() throws IOException { UserGroupInformation ugi = UserGroupInformation.getCurrentUser(); return ugi.getShortUserName(); }
Source:
<code><START> public Node buildNode() throws Exception { <END> config.saveSessionToFile(); if (daemon) { } Node node = new Node(port); node.configureAddressing(port, local); node.storageController = new StorageController(new File( this.storageDir).toPath(), node.addressTable); if (!adam && bootstrapNode != null) { node.addressTable.add(bootstrapNode); } Node.singleton = node; return Node.getInstance(); }</code><technical_language>this throwing Exception, gotta specific</technical_language>

Target:
public Node buildNode() throws NodeException { config.saveSessionToFile(); if (daemon) { } Node node = new Node(); node.configureAddressing(port); node.storageController = new StorageController(new File( this.storageDir).toPath(), node.addressTable); if (!adam && bootstrapNode != null) { node.addressTable.add(bootstrapNode); } Node.singleton = node; node.startServer(port); return Node.getInstance(); }
Source:
<code>protected void map(NullWritable key, ViewInfoTracker value, Context context) { final Configuration config = context.getConfiguration(); if (this.multiViewJobStatusTracker == null) { <START> initMultiViewJobStatusTracker(config); <END> } LOGGER.debug(String.format("Deleting from view %s, TenantID %s, and TTL value: %d", value.getViewName(), value.getTenantId(), value.getViewTtl())); try (PhoenixConnection connection =(PhoenixConnection) ConnectionUtil.getInputConnection(config) ){ if (value.getTenantId() != null && !value.getTenantId().equals("NULL")) { try (PhoenixConnection tenantConnection = (PhoenixConnection)PhoenixViewTtlUtil. buildTenantConnection(connection.getURL(), value.getTenantId())) { deletingExpiredRows(tenantConnection, value, config); } } else { deletingExpiredRows(connection, value, config); } } catch (SQLException e) { LOGGER.error(e.getErrorCode() + e.getSQLState(), e.getStackTrace()); } }</code><technical_language>do putting this map function more readable</technical_language>

Target:
protected void map(NullWritable key, ViewInfoTracker value, Context context) { final Configuration config = context.getConfiguration(); if (this.multiViewJobStatusTracker == null) { initMultiViewJobStatusTracker(config); } LOGGER.debug(String.format("Deleting from view %s, TenantID %s, and TTL value: %d", value.getViewName(), value.getTenantId(), value.getViewTtl())); try (PhoenixConnection connection =(PhoenixConnection) ConnectionUtil.getInputConnection(config) ){ if (value.getTenantId() != null && !value.getTenantId().equals("NULL")) { try (PhoenixConnection tenantConnection = (PhoenixConnection)PhoenixViewTtlUtil. buildTenantConnection(connection.getURL(), value.getTenantId())) { deletingExpiredRows(tenantConnection, value, config); } } else { deletingExpiredRows(connection, value, config); } } catch (SQLException e) { LOGGER.error("Mapper got an exception while deleting expired rows : " + e.getErrorCode() + e.getSQLState(), e.getStackTrace()); } }
Source:
<code>protected void assertSelectionEquals(String message, TestElement expected) { <START> ISelection selection = fViewer.getStructuredSelection(); assertTrue(selection instanceof IStructuredSelection); <END> List expectedList = new ArrayList(); expectedList.add(expected); IStructuredSelection structuredSelection = (IStructuredSelection)selection; assertEquals("selectionEquals - " + message, expectedList, (structuredSelection).toList()); }</code><technical_language>remove assertion change ISelection IStructuredSelection</technical_language>

Target:
protected void assertSelectionEquals(String message, TestElement expected) { IStructuredSelection selection = fViewer.getStructuredSelection(); List expectedList = new ArrayList(); expectedList.add(expected); assertEquals("selectionEquals - " + message, expectedList, selection.toList()); }
Source:
<code>public boolean execute(CommandSender sender, String label, String[] args) { if (!testPermission(sender)) return false; if (args.length == 0) { <START> sender.sendMessage(ChatColor.RED + "Missing arguments. Usage: " + usageMessage); <END> return false; } GameMode gamemode; final String inputMode = args[0]; switch (inputMode.toLowerCase()) { case "s": case "0": case "survival": gamemode = GameMode.SURVIVAL; break; case "c": case "1": case "creative": gamemode = GameMode.CREATIVE; break; case "a": case "2": case "adventure": gamemode = GameMode.ADVENTURE; break; case "sp": case "3": case "spectator": gamemode = GameMode.SPECTATOR; break; default: sender.sendMessage(ChatColor.RED + "Unknown mode '" + inputMode + "'."); return false; } Bukkit.getServer().setDefaultGameMode(gamemode); sender.sendMessage("Default game mode set to " + ChatColor.GRAY + "" + ChatColor.ITALIC + gamemode.toString().toLowerCase()); return true; }</code><technical_language>Remove "Missing arguments." part</technical_language>

Target:
public boolean execute(CommandSender sender, String label, String[] args) { if (!testPermission(sender)) return false; if (args.length == 0) { sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage); return false; } final String inputMode = args[0]; final GameMode gamemode = GameModeUtils.build(inputMode); if (gamemode == null) { sender.sendMessage(ChatColor.RED + "Unknown mode '" + inputMode + "'."); return false; } Bukkit.getServer().setDefaultGameMode(gamemode); sender.sendMessage("The world's default game mode is now " + ChatColor.GRAY + "" + ChatColor.ITALIC + GameModeUtils.prettyPrint(gamemode) + " Mode"); return true; }
Source:
<code>private static ExternalMetadata validateAndGetMetadata(JsonNode paymentRequest) { Map<String, Object> metadataMap = null; try { metadataMap = objectMapper.convertValue(paymentRequest.get("metadata"), Map.class); } catch (IllegalArgumentException e) { PaymentError paymentError = aPaymentError(METADATA, CREATE_PAYMENT_VALIDATION_ERROR, "Must be an object of JSON key-value pairs."); throw new WebApplicationException(Response.status(SC_UNPROCESSABLE_ENTITY).entity(paymentError).build()); } ExternalMetadata metadata = new ExternalMetadata(metadataMap); Set<ConstraintViolation<ExternalMetadata>> violations = validator.validate(metadata); if (violations.size() > 0) { String message = violations.stream() <START> .map(v -> capitalize(v.getMessage().replace("Field [metadata] ", "") + ".")) <END> .collect(Collectors.joining(" ")); PaymentError paymentError = aPaymentError(METADATA, CREATE_PAYMENT_VALIDATION_ERROR, message); throw new WebApplicationException(Response.status(SC_UNPROCESSABLE_ENTITY).entity(paymentError).build()); } return metadata; }</code><technical_language>I capitalize( ) method. Neat</technical_language>

Target:
private static ExternalMetadata validateAndGetMetadata(JsonNode paymentRequest) { Map<String, Object> metadataMap = null; try { metadataMap = objectMapper.convertValue(paymentRequest.get("metadata"), Map.class); } catch (IllegalArgumentException e) { PaymentError paymentError = aPaymentError(METADATA, CREATE_PAYMENT_VALIDATION_ERROR, "Must be an object of JSON key-value pairs"); throw new WebApplicationException(Response.status(SC_UNPROCESSABLE_ENTITY).entity(paymentError).build()); } ExternalMetadata metadata = new ExternalMetadata(metadataMap); Set<ConstraintViolation<ExternalMetadata>> violations = validator.validate(metadata); if (violations.size() > 0) { String message = violations.stream() .map(ConstraintViolation::getMessage) .map(msg -> msg.replace("Field [metadata] ", "")) .map(StringUtils::capitalize) .collect(Collectors.joining(". ")); PaymentError paymentError = aPaymentError(METADATA, CREATE_PAYMENT_VALIDATION_ERROR, message); throw new WebApplicationException(Response.status(SC_UNPROCESSABLE_ENTITY).entity(paymentError).build()); } return metadata; }
Source:
<code>public String toString() { StringBuilder builder = new StringBuilder(); builder.append("ExpressionEvaluatingSelector [expressionParser=") .append(expressionParser.toString()) .append(", expressionString=") .append(this.expressionString) .append("]"); <START> return builder.toString(); <END> }</code><technical_language>I it. For simple: return "ExpressionEvaluatingSelector for: [" + this.expressionString + "]"; compiler optimizes StringBuilder</technical_language>

Target:
public String toString() { return "ExpressionEvaluatingSelector for: [" + this.expressionString + "]"; }
Source:
<code>public static synchronized Log getLog(String logTag) { <START> if (logTag.length() > 23) { <END> android.util.Log.w(TAG, "Truncating log tag length as it exceed 23, the limit imposed by android on certain API Levels"); logTag = logTag.substring(0, 23); } Log log = logMap.get(logTag); if (log == null) { if (checkApacheCommonsLoggingExists()) { try { log = new ApacheCommonsLogging(logTag); logMap.put(logTag, log); } catch (Exception e) { android.util.Log.w(TAG, "Could not create log from " + APACHE_COMMONS_LOGGING_LOGFACTORY, e); } } if (log == null) { log = new AndroidLog(logTag); logMap.put(logTag, log); } } return log; }</code><technical_language>Consider replacing of a private utility function getSafeLogTag truncate (and warn) potentially extended in future do other sanitizations. code reads more clearly: java String safeTag = getSafeLogTag(logTag); // sanitizeTag normalizeTag, ..</technical_language>

Target:
public static synchronized Log getLog(String logTag) { logTag = getTruncatedLogTag(logTag); Log log = logMap.get(logTag); if (log == null) { if (checkApacheCommonsLoggingExists()) { try { log = new ApacheCommonsLogging(logTag); logMap.put(logTag, log); } catch (Exception e) { android.util.Log.w(TAG, "Could not create log from " + APACHE_COMMONS_LOGGING_LOGFACTORY, e); } } if (log == null) { log = new AndroidLog(logTag); logMap.put(logTag, log); } } return log; }
Source:
<code>private void deserializeBlobIdAndAssert(short version, String srcBlobIdStr) throws Exception { List<BlobId> blobIds = new ArrayList<>(); blobIds.add(BlobId.fromStringId(srcBlobIdStr, referenceClusterMap)); blobIds.add(BlobId.fromDataInputStream(getStreamFromBase64(srcBlobIdStr), referenceClusterMap)); blobIds.add(BlobId.fromDataInputStream(getStreamFromBase64(srcBlobIdStr + "EXTRA"), referenceClusterMap)); for (BlobId blobId : blobIds) { assertEquals("Wrong partition ID in blobId: " + blobId, referencePartitionId, blobId.getPartition()); assertEquals("Wrong base-64 ID in blobId: " + blobId, srcBlobIdStr, blobId.getID()); assertEquals("Wrong blobId version", version, getVersionFromBlobString(blobId.getID())); switch (version) { <START> case BLOB_ID_V1: <END> assertEquals("Wrong flag in blobId: " + blobId, BlobId.DEFAULT_FLAG, blobId.getFlag()); assertEquals("Wrong datacenter ID in blobId: " + blobId, LEGACY_DATACENTER_ID, blobId.getDatacenterId()); assertEquals("Wrong account ID in blobId: " + blobId, Account.LEGACY_ACCOUNT_ID, blobId.getAccountId()); assertEquals("Wrong container ID in blobId: " + blobId, Container.LEGACY_CONTAINER_ID, blobId.getContainerId()); break; case BLOB_ID_V2: assertEquals("Wrong flag in blobId: " + blobId, referenceFlag, blobId.getFlag()); assertEquals("Wrong datacenter ID in blobId: " + blobId, referenceDatacenterId, blobId.getDatacenterId()); assertEquals("Wrong account ID in blobId: " + blobId, referenceAccountId, blobId.getAccountId()); assertEquals("Wrong container ID in blobId: " + blobId, referenceContainerId, blobId.getContainerId()); break; default: throw new IllegalArgumentException("invalid version number blob" + version); } } }</code><technical_language>is re-use assertBlobIdFieldValues()</technical_language>

Target:
private void deserializeBlobIdAndAssert(short version, String srcBlobIdStr) throws Exception { List<BlobId> blobIds = new ArrayList<>(); blobIds.add(new BlobId(srcBlobIdStr, referenceClusterMap)); blobIds.add(new BlobId(getStreamFromBase64(srcBlobIdStr), referenceClusterMap)); blobIds.add(new BlobId(getStreamFromBase64(srcBlobIdStr + "EXTRA"), referenceClusterMap)); for (BlobId blobId : blobIds) { assertEquals("Wrong base-64 ID in blobId: " + blobId, srcBlobIdStr, blobId.getID()); assertEquals("Wrong blobId version", version, getVersionFromBlobString(blobId.getID())); assertBlobIdFieldValues(version, blobId, referenceFlag, referenceDatacenterId, referenceAccountId, referenceContainerId, referencePartitionId); } }
Source:
<code>public void validate(Object o, Errors errors) { Diagnosis diagnosis = (Diagnosis)o; if(diagnosis == null){ throw new APIException("Diagnosis can't be null"); } else if (diagnosis.getVoided()) { return; } <START> ValidationUtils.rejectIfEmptyOrWhitespace(errors, "rank", "field.required"); <END> ValidationUtils.rejectIfEmptyOrWhitespace(errors, "certainty", "field.required"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "diagnosis", "field.required"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "encounter", "field.required"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "diagnosisId", "field.required"); }</code><technical_language>in position create some tests for this class? a examples: <LINK_0></technical_language>

Target:
public void validate(Object o, Errors errors) { Diagnosis diagnosis = (Diagnosis)o; if(diagnosis == null){ throw new APIException("Diagnosis can't be null"); } else if (diagnosis.getVoided()) { return; } if (diagnosis.getEncounter() == null){ errors.rejectValue("encounter", "error.null"); } if (diagnosis.getDiagnosis() == null){ errors.rejectValue("diagnosis", "error.null"); } if (diagnosis.getCertainty() == null){ errors.rejectValue("certainty", "error.null"); } Integer rank = diagnosis.getRank(); if (rank == null){ errors.rejectValue("rank", "error.null"); }else if(rank < 0){ errors.rejectValue("rank", "error.rank.notPositiveInteger"); } }
Source:
<code>public void setElements(String elements) { String[] entries = elements.split(","); clearEntries(); int tupleSize = getTupleSize(); for (int i = 0; i < entries.length; i += tupleSize) { if (i + tupleSize - 1 >= entries.length) { break; } String[] tuple = new String[tupleSize]; <START> for (int j = 0; j < tupleSize; ++j) { <END> tuple[j] = entries[i + j]; } addEntryFromTuple(tuple); } postDataImportAction(); }</code><technical_language>if System.arraycopy is supported in GWT emulation library. Copying get optimized more efficient in browser iterating list one-by-one</technical_language>

Target:
public void setElements(String elements) { String[] entries = elements.split(","); clearEntries(); int tupleSize = getTupleSize(); for (int i = 0; i < entries.length; i += tupleSize) { if (i + tupleSize - 1 >= entries.length) { break; } String[] tuple = new String[tupleSize]; System.arraycopy(entries, i, tuple, 0, tupleSize); addEntryFromTuple(tuple); } postDataImportAction(); }
Source:
<code>public void noMdevs() { vm.setCustomProperties("key=value"); List<VDS> result = filter(); assertThat(result <START> == vdsList).isTrue(); <END> }</code><technical_language>this .equals()</technical_language>

Target:
public void noMdevs() { vm.setCustomProperties("key=value"); List<VDS> result = filter(); assertSame(vdsList, result); }
Source:
<code>public RunAmok(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{R}"); this.getSpellAbility().addEffect(new BoostTargetEffect(3, 3, Duration.EndOfTurn)); <START> this.getSpellAbility().addEffect(new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn)); <END> this.getSpellAbility().addTarget(new TargetAttackingCreature()); }</code><technical_language>setText("and gains trample end of turn"), text is gonna wrong</technical_language>

Target:
public RunAmok(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{R}"); this.getSpellAbility().addEffect(new BoostTargetEffect(3, 3, Duration.EndOfTurn).setText("Target attacking creature gets +3/+3")); this.getSpellAbility().addEffect(new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn).setText("and gains trample until end of turn")); this.getSpellAbility().addTarget(new TargetAttackingCreature()); }