auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private RestRequest rewriteRequest(RestRequest originalRequest, String darkServiceName) { <START> _uriRewriterMap.computeIfAbsent(darkServiceName, k -> { <END> URI configuredURI = URI.create("d2://" + darkServiceName); URIRewriter rewriter = new D2URIRewriter(configuredURI); return new AtomicReference<>(rewriter); }); URIRewriter rewriter = _uriRewriterMap.get(darkServiceName).get(); return originalRequest.builder().setURI(rewriter.rewriteURI(originalRequest.getURI())).build(); }</code><technical_language>computeIfAbsent is apparently performant in java 7. worth manually checking if present potentially do this request</technical_language>

Target:
private RestRequest rewriteRequest(RestRequest originalRequest, String darkServiceName) { if (!_uriRewriterMap.containsKey(darkServiceName)) { _uriRewriterMap.computeIfAbsent(darkServiceName, k -> { URI configuredURI = URI.create("d2://" + darkServiceName); URIRewriter rewriter = new D2URIRewriter(configuredURI); return new AtomicReference<>(rewriter); }); } URIRewriter rewriter = _uriRewriterMap.get(darkServiceName).get(); return originalRequest.builder().setURI(rewriter.rewriteURI(originalRequest.getURI())).build(); }
Source:
<code>public void initGui() { super.initGui(); for( int i = 0; i < DualityFluidInterface.NUMBER_OF_TANKS; ++i ) <START> { <END> this.buttonList.add( new GuiFluidTank( ID_BUTTON_TANK + i, this.host.getDualityFluidInterface() .getTank( i ), this.getGuiLeft() + 7 + 18 * i, this.getGuiTop() + 16 + 8, 16, 80 ) ); } }</code><technical_language>![MINOR](<LINK_2> 'Severity: MINOR') Reorder modifiers comply Java Language Specification. [![rule](<LINK_1>](<LINK_0></technical_language>

Target:
public void initGui() { super.initGui(); for( int i = 0; i < DualityFluidInterface.NUMBER_OF_TANKS; ++i ) { this.buttonList.add( new GuiFluidTank( ID_BUTTON_TANK + i, this.host.getDualityFluidInterface() .getTank( i ), this.getGuiLeft() + 7 + 18 * i, this.getGuiTop() + 16 + 8, 16, 80 ) ); } this.priority = new GuiTabButton( this.getGuiLeft() + 154, this.getGuiTop(), 2 + 4 * 16, GuiText.Priority.getLocal(), this.itemRender ); this.buttonList.add( this.priority ); }
Source:
<code>public void setup() throws Exception { this.stream = new ByteArrayOutputStream(); response = mock(HttpServletResponse.class); when(response.getWriter()).thenReturn(new PrintWriter(stream)); extractor = new DefaultTypeNameExtractor(); initializer = new HibernateProxyInitializer(); serializee = new Serializee(); VRaptorGsonBuilderCreator gsonBuilderCreator = new VRaptorGsonBuilderCreator(new DefaultJsonSerializers(Collections.<JsonSerializer> emptyList()), serializee); <START> this.serialization = new GsonJSONSerialization(response, extractor, initializer, gsonBuilderCreator.getInstance(), serializee); <END> }</code><technical_language>extract lines a method, duplicated tests: createJSONSerialization(JSonSerializer...adapters)</technical_language>

Target:
public void setup() throws Exception { this.stream = new ByteArrayOutputStream(); response = mock(HttpServletResponse.class); when(response.getWriter()).thenReturn(new PrintWriter(stream)); extractor = new DefaultTypeNameExtractor(); initializer = new HibernateProxyInitializer(); serializee = new Serializee(); this.serialization = new GsonJSONSerialization(response, extractor, initializer, createBuilder(), serializee); }
Source:
<code>public synchronized void cleanCallBack(Future<ScriptResult<?>> future) { Iterator<Entry<Node, ScriptResult<?>>> iterator = nodes.entrySet().iterator(); NodeSet ns = new NodeSet(); while (iterator.hasNext()) { Entry<Node, ScriptResult<?>> entry = iterator.next(); if (!PAFuture.isAwaited(entry.getValue())) { if (logger.isInfoEnabled()) { String nodeUrl = entry.getKey().getNodeInformation().getURL(); logger.info("Cleaning script successfull, node freed : " + nodeUrl ); try { logger.info("Cleaning script output on node " + nodeUrl + ":"+future.get().getOutput()); <START> } catch (Exception e) { <END> logger.warn("Exception occurred while executing cleaning script on node "+ nodeUrl +":", e); } } ns.add(entry.getKey()); iterator.remove(); } } if (ns.size() > 0) { releaseNodes(ns); } }</code><technical_language>in order this cleaner more robust, I suggest put try/catch statement if(logger.isInfoEnabled()). do this way: ScriptResult res; try { res = future.get() } catch (Exception e) { logger.warn("blabla") }</technical_language>

Target:
public synchronized void cleanCallBack(Future<ScriptResult<?>> future) { Iterator<Entry<Node, ScriptResult<?>>> iterator = nodes.entrySet().iterator(); NodeSet ns = new NodeSet(); while (iterator.hasNext()) { Entry<Node, ScriptResult<?>> entry = iterator.next(); if (!PAFuture.isAwaited(entry.getValue())) { String nodeUrl = entry.getKey().getNodeInformation().getURL(); ScriptResult<?> sResult = null; try { sResult = future.get(); } catch (Exception e) { logger.warn("Exception occurred while executing cleaning script on node " + nodeUrl + ":", e); } printCleaningScriptInformations(nodeUrl, sResult); ns.add(entry.getKey()); iterator.remove(); } } if (ns.size() > 0) { releaseNodes(ns); } }
Source:
<code>public void verifyDefaultStructure() { <START> init(); <END> builder.open("verifyDefaultStructure") .switchToIFrame() .verifyDefaultTemplateStructure(); }</code><technical_language>please get rid of this init() method? Add 'open()' method SpecialThemeDesignerPageObject rename SpecialThemeDesignerPage. Lombok getters for infobox builder</technical_language>

Target:
public void verifyDefaultStructure() { new InfoboxBuilderPage() .open("verifyDefaultStructure") .switchToIFrame() .verifyDefaultTemplateStructure(); }
Source:
<code>public void onKPlayerPlayheadUpdate(PlayerViewController playerViewController, long currentTime) { long currentSeconds = (int) (currentTime / 1000); long totalSeconds = (int) (playerViewController.getDurationSec()); <START> Double percentage = (double) 0; <END> if (totalSeconds > 0) { percentage = (((double) currentSeconds) / totalSeconds) * 100; } Log.d(TAG, "onKPlayerPlayheadUpdate " + currentSeconds + "/" + totalSeconds + " => " + percentage.intValue() + "%"); mSeekBar.setProgress(percentage.intValue()); }</code><technical_language>Please double, Double. adds overhead (boxing/unboxing). Also, cast needed</technical_language>

Target:
public void onKPlayerPlayheadUpdate(PlayerViewController playerViewController, long currentTime) { long currentSeconds = (int) (currentTime / 1000); long totalSeconds = (int) (playerViewController.getDurationSec()); double percentage = 0; if (totalSeconds > 0) { percentage = (((double) currentSeconds) / totalSeconds) * 100; } Log.d(TAG, "onKPlayerPlayheadUpdate " + currentSeconds + "/" + totalSeconds + " => " + (int)percentage + "%"); mSeekBar.setProgress((int)percentage); }
Source:
<code>public void splitCompleteUserIdShouldReturnAll3Components() throws Exception { OpenPgpUtils.UserInfo info = OpenPgpUtils.splitUserId("Max Mustermann (this is a comment) <max@example.com>"); <START> assertEquals(info.name, "Max Mustermann"); <END> assertEquals(info.comment, "this is a comment"); assertEquals(info.email, "max@example.com"); }</code><technical_language>assertEquals param order is expected, actual, this (and other assertions) written java assertEquals("Max Mustermann", info.name);</technical_language>

Target:
public void splitCompleteUserIdShouldReturnAll3Components() throws Exception { OpenPgpUtils.UserInfo info = OpenPgpUtils.splitUserId("Max Mustermann (this is a comment) <max@example.com>"); assertEquals("Max Mustermann", info.name); assertEquals("this is a comment", info.comment); assertEquals("max@example.com", info.email); }
Source:
<code>public AddManualEvent(TimeLineController controller, Long epochMillis) { super(Bundle.AddManualEvent_text()); this.controller = controller; setGraphic(new ImageView(ADD_EVENT_IMAGE)); setLongText(Bundle.AddManualEvent_longText()); setEventHandler(actionEvent -> { <START> new EventCreationDialog(controller, epochMillis).showAndWait().ifPresent(this::addEvent); <END> }); }</code><technical_language>This issue in EventCreationDialog, dialog pops confined bounds of main window. In case of setup dialog pops other screen, main window. This means I put main window top of popup dialog hiding popup causing main window "stuck"</technical_language>

Target:
public AddManualEvent(TimeLineController controller, Long epochMillis) { super(Bundle.AddManualEvent_text()); setGraphic(new ImageView(ADD_EVENT_IMAGE)); setLongText(Bundle.AddManualEvent_longText()); setEventHandler(actionEvent -> SwingUtilities.invokeLater(() -> { JEventCreationDialog dialog = new JEventCreationDialog(controller, epochMillis, SwingUtilities.windowForComponent(controller.getTopComponent())); dialog.setVisible(true); })); }
Source:
<code>public void changeDiscoveryMode() { <START> validationProvider = new BeanValidationProviderCDI11(); <END> prepareBeanXml("all", true); }</code><technical_language>Update BeanValidationProvider CDI20 requirments, please</technical_language>

Target:
public void changeDiscoveryMode() { validationProvider = new BeanValidationProvider("JSR-365"); prepareBeanXml("all", true); }
Source:
<code>public Resource getOrCreateRepresentationResource(DRepresentation representation, Resource airdResource) { Resource resource = null; ResourceSet resourceSet = airdResource != null ? airdResource.getResourceSet() : null; if (resourceSet != null) { resource = getURIFromExtensionPoint(representation, airdResource).map(repResourceURI -> { <START> Resource res = resourceSet.getResource(repResourceURI, false); <END> if (res == null) { res = resourceSet.createResource(repResourceURI); } return res; }).orElse(null); } return resource; }</code><technical_language>some cases resource exist is loaded</technical_language>

Target:
public Resource getOrCreateRepresentationResource(DRepresentation representation, Resource airdResource) { Resource resource = null; ResourceSet resourceSet = airdResource != null ? airdResource.getResourceSet() : null; if (resourceSet != null) { resource = getURIFromExtensionPoint(representation, airdResource).map(repResourceURI -> { Resource res = resourceSet.getResource(repResourceURI, false); if (res == null) { if (resourceSet.getURIConverter().exists(repResourceURI, null)) { res = resourceSet.getResource(repResourceURI, true); } else { res = resourceSet.createResource(repResourceURI); } } return res; }).orElse(null); } return resource; }
Source:
<code>private HashComputation(Iterable<VariableReferenceExpression> fields, FunctionManager functionManager) { requireNonNull(fields, "fields is null"); requireNonNull(functionManager, "functionManager is null"); this.fields = ImmutableList.copyOf(fields); <START> this.functionManager = functionManager; <END> checkArgument(!this.fields.isEmpty(), "fields can not be empty"); }</code><technical_language>inline requireNonNull this</technical_language>

Target:
private HashComputation(Iterable<VariableReferenceExpression> fields, FunctionManager functionManager) { requireNonNull(fields, "fields is null"); this.fields = ImmutableList.copyOf(fields); this.functionManager = requireNonNull(functionManager, "functionManager is null"); checkArgument(!this.fields.isEmpty(), "fields can not be empty"); }
Source:
<code>public static boolean checkIfNumerical(IDataChartDescriptor<?, ?> desc) { DescriptorTypeVisitor visitor = new DescriptorTypeVisitor(); desc.accept(visitor); <START> if (visitor.checkIfType(DescriptorType.NUMERICAL)) { <END> return true; } return false; }</code><technical_language>return visitor.checkIfType(DescriptorType.NUMERICAL);</technical_language>

Target:
static boolean checkIfNumerical(IDataChartDescriptor<?, ?> desc) { DescriptorTypeVisitor visitor = new DescriptorTypeVisitor(); desc.accept(visitor); return visitor.isIndividualType(DescriptorType.NUMERICAL); }
Source:
<code>public ArrayList<CertifyActionsParcel.CertifyAction> getSelectedCertifyActions() { <START> return mUserIdsAdapter.getSelectedCertifyActions(); <END> }</code><technical_language>throw AssertionError if checkboxVisibility is false</technical_language>

Target:
public ArrayList<CertifyActionsParcel.CertifyAction> getSelectedCertifyActions() { if (!checkboxVisibility) { throw new AssertionError("Item selection not allowed"); } return mUserIdsAdapter.getSelectedCertifyActions(); }
Source:
<code>private OffsetAndMetadata greaterOffset(OffsetAndMetadata a, OffsetAndMetadata b) { <START> if (a == null) { <END> return b; } else if (b == null) { return a; } return a.offset() > b.offset() ? a : b; }</code><technical_language>_need_ check for null here, merge function called if is existing (which non-null)</technical_language>

Target:
private OffsetAndMetadata greaterOffset(OffsetAndMetadata a, OffsetAndMetadata b) { return a.offset() > b.offset() ? a : b; }
Source:
<code>private static void zip(StaplerResponse rsp, VirtualFile root, VirtualFile dir, String glob) throws IOException, InterruptedException { OutputStream outputStream = rsp.getOutputStream(); try (ZipOutputStream zos = new ZipOutputStream(outputStream)) { zos.setEncoding(System.getProperty("file.encoding")); for (String n : dir.list(glob.isEmpty() ? "**" : glob, null, true)) { String relativePath; if (glob.length() == 0) { relativePath = dir.getName() + '/' + n; } else { relativePath = n; } String targetFile = dir.toString().substring(root.toString().length()) + n; if (!ALLOW_SYMLINK_ESCAPE && root.supportIsDescendant() && !root.isDescendant(targetFile)) { <START> LOGGER.log(Level.FINE, "Trying to access a file outside of the directory: " + root + ", illicit target: " + targetFile); <END> } else { ZipEntry e = new ZipEntry(relativePath.replace('\\', '/')); VirtualFile f = dir.child(n); e.setTime(f.lastModified()); zos.putNextEntry(e); try (InputStream in = f.open()) { IOUtils.copy(in, zos); } zos.closeEntry(); } } } }</code><technical_language>If fight for performance, want replace this call String formatting</technical_language>

Target:
private static void zip(StaplerResponse rsp, VirtualFile root, VirtualFile dir, String glob) throws IOException, InterruptedException { boolean messageAlreadyPutInLog = false; OutputStream outputStream = rsp.getOutputStream(); try (ZipOutputStream zos = new ZipOutputStream(outputStream)) { zos.setEncoding(System.getProperty("file.encoding")); for (String n : dir.list(glob.isEmpty() ? "**" : glob, null, true)) { String relativePath; if (glob.length() == 0) { relativePath = dir.getName() + '/' + n; } else { relativePath = n; } String targetFile = dir.toString().substring(root.toString().length()) + n; if (!ALLOW_SYMLINK_ESCAPE && root.supportIsDescendant() && !root.isDescendant(targetFile)) { if (!messageAlreadyPutInLog) { messageAlreadyPutInLog = true; LOGGER.log(Level.FINE, "Trying to access a file outside of the directory: {0}, forbidden target: {1}. This message is only sent once per request.", new Object[] {root, targetFile}); } } else { ZipEntry e = new ZipEntry(relativePath.replace('\\', '/')); VirtualFile f = dir.child(n); e.setTime(f.lastModified()); zos.putNextEntry(e); try (InputStream in = f.open()) { IOUtils.copy(in, zos); } zos.closeEntry(); } } } }
Source:
<code>public void testReadProbabilitySimulationProperties() { SimulationDataProvider provider = new BPMN2SimulationDataProvider(this.getClass().getResourceAsStream("/BPMN2-ExclusiveSplitWithSimulationProps.bpmn2")); Map<String, Object> data = provider.getSimulationDataForNode(new Node() { public List<Connection> getOutgoingConnections(String type) { return null; } public Map<String, List<Connection>> getOutgoingConnections() { return null; } public NodeContainer getNodeContainer() { return null; } public String getName() { return "Hello"; } public Object getMetaData(String name) { return null; } public Map<String, Object> getMetaData() { Map<String, Object> metaData = new HashMap<String, Object>(); metaData.put("UniqueId", "_575A78C8-C34A-445E-8B2F-BB990B513A03"); return metaData; } public List<Connection> getIncomingConnections(String type) { return null; } public Map<String, List<Connection>> getIncomingConnections() { return null; } public long getId() { return 2; } <START> @Override public String getUniqueId() { return null; } <END> @Override public String getNodeUniqueId() { return null; } }); assertNotNull(data); assertEquals(1, data.size()); assertTrue(data.containsKey(SimulationConstants.PROBABILITY)); }</code><technical_language>here. method defined in interface Node</technical_language>

Target:
public void testReadProbabilitySimulationProperties() { SimulationDataProvider provider = new BPMN2SimulationDataProvider(this.getClass().getResourceAsStream("/BPMN2-ExclusiveSplitWithSimulationProps.bpmn2")); Map<String, Object> data = provider.getSimulationDataForNode(new Node() { public List<Connection> getOutgoingConnections(String type) { return null; } public Map<String, List<Connection>> getOutgoingConnections() { return null; } public NodeContainer getNodeContainer() { return null; } public String getName() { return "Hello"; } public Object getMetaData(String name) { return null; } public Map<String, Object> getMetaData() { Map<String, Object> metaData = new HashMap<String, Object>(); metaData.put("UniqueId", "_575A78C8-C34A-445E-8B2F-BB990B513A03"); return metaData; } public List<Connection> getIncomingConnections(String type) { return null; } public Map<String, List<Connection>> getIncomingConnections() { return null; } public long getId() { return 2; } @Override public String getNodeUniqueId() { return null; } }); assertNotNull(data); assertEquals(1, data.size()); assertTrue(data.containsKey(SimulationConstants.PROBABILITY)); }
Source:
<code>public FieldReference getReference(String name) { ExposedField field = exposedFields.getField(name); if (field != null) { return new FieldReference(field); } <START> if (name != null && name.contains(".")) { <END> ExposedField rootField = exposedFields.getField(name.split("\\.")[0]); if (rootField != null) { return new FieldReference(new ExposedField(name, true)); } } throw new IllegalArgumentException(String.format("Invalid reference '%s'!", name)); }</code><technical_language>I strictly reject null-names right a cryptic exception message (I String expansion work properly)</technical_language>

Target:
public FieldReference getReference(String name) { Assert.notNull(name, "Name must not be null!"); ExposedField field = exposedFields.getField(name); if (field != null) { return new FieldReference(field); } if (name.contains(".")) { ExposedField rootField = exposedFields.getField(name.split("\\.")[0]); if (rootField != null) { return new FieldReference(new ExposedField(name, true)); } } throw new IllegalArgumentException(String.format("Invalid reference '%s'!", name)); }
Source:
<code>private void checkServer() { <START> checkState(isMainThread()); <END> }</code><technical_language>Formatting change? this</technical_language>

Target:
private void checkServer() { checkState(this.isMainThread()); }
Source:
<code>public Response checkRoles(final @Context HttpServletRequest request, final @PathParam("userId") String userId, final @PathParam("roleIds") String roleIds) { webResource.init(true, request, true); boolean hasUserRole = false; try { String[] roles = roleIds.split(ROLE_ID_SEPARATOR); <START> hasUserRole = this.helper.userHasRoles(userId, CollectionsUtils.list(roles)); <END> } catch (Exception e) { Logger.error(this, "An error occurred when processing the request.", e); return ExceptionMapperUtil.createResponse(e, Response.Status.INTERNAL_SERVER_ERROR); } return Response.ok(new ResponseEntityView(map("checkRoles", hasUserRole))).build(); }</code><technical_language>I love static imports, is u</technical_language>

Target:
public Response checkRoles(final @Context HttpServletRequest request, final @PathParam("userId") String userId, final @PathParam("roleIds") String roleIds) { webResource.init(true, request, true); boolean hasUserRole = false; try { String[] roles = roleIds.split(ROLE_ID_SEPARATOR); hasUserRole = this.helper.userHasRoles(userId, list(roles)); } catch (Exception e) { Logger.error(this, "An error occurred when processing the request.", e); return ExceptionMapperUtil.createResponse(e, Response.Status.INTERNAL_SERVER_ERROR); } return Response.ok(new ResponseEntityView(map("checkRoles", hasUserRole))).build(); }
Source:
<code>@Override public boolean process(Set<? extends TypeElement> types, RoundEnvironment env) { List<Element> allElements = new ArrayList<Element>(); <START> Map<Element, Element> parametersToTheirMethods = new HashMap<Element, Element>(); <END> getAllElements(env, allElements, parametersToTheirMethods); for (Element element : allElements) { validateScoping(element); validateQualifiers(element, parametersToTheirMethods); } return false; }</code><technical_language>HashMap --> LinkedHashMap. Always</technical_language>

Target:
@Override public boolean process(Set<? extends TypeElement> types, RoundEnvironment env) { List<Element> allElements = new ArrayList<Element>(); Map<Element, Element> parametersToTheirMethods = new LinkedHashMap<Element, Element>(); getAllElements(env, allElements, parametersToTheirMethods); for (Element element : allElements) { validateProvides(element); validateScoping(element); validateQualifiers(element, parametersToTheirMethods); } return false; }
Source:
<code>private Class<?> toClass(String classId) { if (this.idClassMapping.containsKey(classId)) { return this.idClassMapping.get(classId); } if (classId.equals(DEFAULT_HASHTABLE_TYPE_ID)) { return this.defaultMapClass; } try { <START> Class<?> aClass = ClassUtils.forName(classId, getClass().getClassLoader()); <END> Package packageToCheck = aClass.getPackage(); if (packageToCheck == null || isTrustedPackage(packageToCheck.getName())) { return aClass; } else { throw new IllegalArgumentException("The class with id '" + classId + "' and name '" + aClass.getName() + "' is not in the trusted packages: " + this.trustedPackages + ". " + "If you believe this class is safe to deserialize, please provide its name. " + "If the serialization is only done by a trusted source, you can also enable trust all (*)."); } } catch (ClassNotFoundException e) { throw new MessageConversionException( "failed to resolve class name [" + classId + "]", e); } catch (LinkageError e) { throw new MessageConversionException( "failed to resolve class name [" + classId + "]", e); } }</code><technical_language>Do safe instantiate class? In Kafka I compared packages String</technical_language>

Target:
private Class<?> toClass(String classId) { if (this.idClassMapping.containsKey(classId)) { return this.idClassMapping.get(classId); } if (classId.equals(DEFAULT_HASHTABLE_TYPE_ID)) { return this.defaultMapClass; } try { if (!isTrustedPackage(classId)) { throw new IllegalArgumentException("The class '" + classId + "' is not in the trusted packages: " + this.trustedPackages + ". " + "If you believe this class is safe to deserialize, please provide its name. " + "If the serialization is only done by a trusted source, you can also enable trust all (*)."); } else { return ClassUtils.forName(classId, getClass().getClassLoader()); } } catch (ClassNotFoundException e) { throw new MessageConversionException( "failed to resolve class name [" + classId + "]", e); } catch (LinkageError e) { throw new MessageConversionException( "failed to resolve class name [" + classId + "]", e); } }
Source:
<code>public void readElement(final XMLExtendedStreamReader reader, final List<ModelNode> operationList) throws XMLStreamException { Namespace readerNS = Namespace.forUri(reader.getNamespaceURI()); switch (readerNS.getMajorVersion()) { case 1: case 2: case 3: new StandaloneXml_Legacy( new ExtensionXml(loader, executorService, extensionRegistry), extensionRegistry, <START> readerNS) <END> .readElement(reader, operationList); break; default: new StandaloneXml_4(extensionHandler, readerNS, parsingOptions).readElement(reader, operationList); break; } }</code><technical_language>Parsing previous files < WF 10 allowed? referring fact ParsingOptions passed through</technical_language>

Target:
public void readElement(final XMLExtendedStreamReader reader, final List<ModelNode> operationList) throws XMLStreamException { Namespace readerNS = Namespace.forUri(reader.getNamespaceURI()); switch (readerNS.getMajorVersion()) { case 1: case 2: case 3: new StandaloneXml_Legacy(extensionHandler, readerNS, parsingOptions) .readElement(reader, operationList); break; default: new StandaloneXml_4(extensionHandler, readerNS, parsingOptions).readElement(reader, operationList); break; } }
Source:
<code>public View getBannerView() { if(mBannerView == null) { <START> Log.v(TAG, "Unity Ads Adaptor null banner view"); <END> } else { Log.v(TAG, "Unity Ads Adaptor provided a banner view for placement: " + mBannerView.getPlacementId()); } return mBannerView; }</code><technical_language>Adapter</technical_language>

Target:
public View getBannerView() { return mBannerView; }
Source:
<code>private void buildHeader(MimeMessage message) throws MessagingException { message.addSentDate(sentDate, hideTimeZone); Address from = new Address(identity.getEmail(), identity.getName()); message.setFrom(from); message.setRecipients(RecipientType.TO, to); message.setRecipients(RecipientType.CC, cc); message.setRecipients(RecipientType.BCC, bcc); message.setSubject(subject); if (requestReadReceipt) { message.setHeader("Disposition-Notification-To", from.toEncodedString()); message.setHeader("X-Confirm-Reading-To", from.toEncodedString()); message.setHeader("Return-Receipt-To", from.toEncodedString()); } if (!K9.hideUserAgent()) { message.setHeader("User-Agent", context.getString(R.string.message_header_mua)); } if (isHighPriority) { <START> message.setHeader("X-Priority", context.getString(R.string.x_priority)); <END> } final String replyTo = identity.getReplyTo(); if (replyTo != null) { message.setReplyTo(new Address[] { new Address(replyTo) }); } if (inReplyTo != null) { message.setInReplyTo(inReplyTo); } if (references != null) { message.setReferences(references); } String messageId = messageIdGenerator.generateMessageId(message); message.setMessageId(messageId); if (isDraft && isPgpInlineEnabled) { message.setFlag(Flag.X_DRAFT_OPENPGP_INLINE, true); } }</code><technical_language>this is a protocol mandated string, a string constant in code</technical_language>

Target:
private void buildHeader(MimeMessage message) throws MessagingException { message.addSentDate(sentDate, hideTimeZone); Address from = new Address(identity.getEmail(), identity.getName()); message.setFrom(from); message.setRecipients(RecipientType.TO, to); message.setRecipients(RecipientType.CC, cc); message.setRecipients(RecipientType.BCC, bcc); message.setSubject(subject); if (requestReadReceipt) { message.setHeader("Disposition-Notification-To", from.toEncodedString()); message.setHeader("X-Confirm-Reading-To", from.toEncodedString()); message.setHeader("Return-Receipt-To", from.toEncodedString()); } if (!K9.hideUserAgent()) { message.setHeader("User-Agent", context.getString(R.string.message_header_mua)); } if (isHighPriority) { message.setHeader(MimeHeader.HEADER_HIGH_PRIORITY, X_PRIORITY_CONTENT); } final String replyTo = identity.getReplyTo(); if (replyTo != null) { message.setReplyTo(new Address[] { new Address(replyTo) }); } if (inReplyTo != null) { message.setInReplyTo(inReplyTo); } if (references != null) { message.setReferences(references); } String messageId = messageIdGenerator.generateMessageId(message); message.setMessageId(messageId); if (isDraft && isPgpInlineEnabled) { message.setFlag(Flag.X_DRAFT_OPENPGP_INLINE, true); } }
Source:
<code>private static PersonIdent tmpAuthor(List<RevCommit> commits) { int t = 0; for (int i = 0; i < commits.size();) { t = Math.max(t, commits.get(i).getCommitTime()); } String name = <START> "tmp"; <END> String email = "tmp@tmp"; return new PersonIdent(name, email, t * 1000L, 0); }</code><technical_language>"Ketch Stage"</technical_language>

Target:
private static PersonIdent tmpAuthor(List<RevCommit> commits) { int t = 0; for (int i = 0; i < commits.size();) { t = Math.max(t, commits.get(i).getCommitTime()); } String name = "Ketch Stage"; String email = "tmp@tmp"; return new PersonIdent(name, email, t * 1000L, 0); }
Source:
<code>public void handleData(final @Nullable ITmfEvent event) { super.handleData(event); if (event != null && event.getTrace() != trace) { <START> System.out.println("alld"); END> } if (event != null && event.getTrace() == trace) { sci.processEvent(event); } }</code><technical_language>I guess this is WIP part..</technical_language>

Target:
public void handleData(final @Nullable ITmfEvent event) { super.handleData(event); if (event != null && event.getTrace() == trace) { sci.processEvent(event); } }
Source:
<code>public boolean isClientAwake(Registration registration) { if (!clientStatusList.containsKey(registration.getEndpoint())) { return false; } <START> PresenceStatus presenceStatus = clientStatusList.get(registration.getEndpoint()); <END> return presenceStatus.isClientAwake(); }</code><technical_language>Variable allocation needed</technical_language>

Target:
public boolean isClientAwake(Registration registration) { PresenceStatus presenceStatus = clientStatusList.get(registration.getEndpoint()); if (presenceStatus == null) { return false; } return presenceStatus.isClientAwake(); }
Source:
<code>public Result next() throws IOException { values.clear(); scanner.nextRaw(values); <START> statisticsCollector.collectStatistics(values, ! values.isEmpty()); <END> if (values.isEmpty()) { return null; } return Result.create(values); }</code><technical_language>Suggestion: another of handling GPW is scanner close method commit GPW. approach, need explicitly add this boolean here</technical_language>

Target:
public Result next() throws IOException { values.clear(); scanner.nextRaw(values); statisticsCollector.collectStatistics(values); if (values.isEmpty()) { return null; } return Result.create(values); }
Source:
<code>public void testInputValidation() { ______TS("CONST SUM:input validation"); feedbackEditPage.fillQuestionTextBoxForNewQuestion("ConstSum-recipient qn"); feedbackEditPage.fillQuestionDescriptionForNewQuestion("more details"); feedbackEditPage.fillConstSumPointsBoxForNewQuestion(""); assertEquals("1", feedbackEditPage.getConstSumPointsBoxForNewQuestion()); feedbackEditPage.fillConstSumPointsForEachRecipientBoxForNewQuestion(""); assertEquals("1", feedbackEditPage.getConstSumPointsForEachRecipientBoxForNewQuestion()); assertFalse(feedbackEditPage.isElementVisible("constSumOptionTable--1")); feedbackEditPage.clickDiscardChangesLinkForNewQuestion(); feedbackEditPage.waitForConfirmationModalAndClickOk(); <START> assertTrue(feedbackEditPage.getTextsForAllStatusMessagesToUser().isEmpty()); <END> assertNull(BackDoor.getFeedbackQuestion(courseId, feedbackSessionName, 1)); }</code><technical_language>assertEquals(Collections.emptyList(), feedbackEditPage.getTextsForAllStatusMessagesToUser());</technical_language>

Target:
public void testInputValidation() { ______TS("CONST SUM:input validation"); feedbackEditPage.fillQuestionTextBoxForNewQuestion("ConstSum-recipient qn"); feedbackEditPage.fillQuestionDescriptionForNewQuestion("more details"); feedbackEditPage.fillConstSumPointsBoxForNewQuestion(""); assertEquals("1", feedbackEditPage.getConstSumPointsBoxForNewQuestion()); feedbackEditPage.fillConstSumPointsForEachRecipientBoxForNewQuestion(""); assertEquals("1", feedbackEditPage.getConstSumPointsForEachRecipientBoxForNewQuestion()); assertFalse(feedbackEditPage.isElementVisible("constSumOptionTable--1")); feedbackEditPage.clickDiscardChangesLinkForNewQuestion(); feedbackEditPage.waitForConfirmationModalAndClickOk(); assertEquals(Collections.emptyList(), feedbackEditPage.getTextsForAllStatusMessagesToUser()); assertNull(BackDoor.getFeedbackQuestion(courseId, feedbackSessionName, 1)); }
Source:
<code>private void unlockVmsManager() { Date updateTime = Calendar.getInstance().getTime(); for (VmManager vmManager : vmManagers.values()) { <START> vmManager.setLastUpdateDate(updateTime); <END> vmManager.unlock(); } }</code><technical_language>is this part needed? additional cycle of VmsMonitoring 'perform' method of previous cycle ends, no</technical_language>

Target:
private void unlockVmsManager() { for (VmManager vmManager : vmManagers.values()) { vmManager.updateVmDataChangedTime(); vmManager.unlock(); } }
Source:
<code>public void loadPlugins() { File[] pluginFiles = pluginDirectory.listFiles(new FileFilter() { @Override public boolean accept(File pathname) { return pathname.isFile() && (pathname.getName().toLowerCase().endsWith(".jar") || pathname.getName().toLowerCase().endsWith(".zip")); } }); if (pluginFiles != null) { List<File> pluginFileList = new ArrayList<>(); ProductBodyguard productBodyguard = new ProductBodyguard(); for (File f:pluginFiles) { if (!productBodyguard.isKnown(f)) { <START> SoapUI.log.warn("Plugin '" + f.getName() + "' is not loaded since it's not approved by SmartBear Software."); <END> } else { pluginFileList.add(f); } } resolver = null; try { resolver = new PluginDependencyResolver(pluginLoader, pluginFileList); pluginFileList = resolver.determineLoadOrder(); } catch (Exception e) { log.error("Couldn't resolve plugin dependency order. This may impair plugin functionality.", e); } long startTime = System.currentTimeMillis(); getForkJoinPool().invoke(new LoadPluginsTask(pluginFileList)); long timeTaken = System.currentTimeMillis() - startTime; log.info(pluginFileList.size() + " plugins loaded in " + timeTaken + " ms"); } }</code><technical_language>I log message "because signed by" "since approved by". @mattihjelm, thoughts</technical_language>

Target:
public void loadPlugins() { File[] pluginFiles = pluginDirectory.listFiles(new FileFilter() { @Override public boolean accept(File pathname) { return pathname.isFile() && (pathname.getName().toLowerCase().endsWith(".jar") || pathname.getName().toLowerCase().endsWith(".zip")); } }); if (pluginFiles != null) { List<File> pluginFileList = new ArrayList<>(); ProductBodyguard productBodyguard = new ProductBodyguard(); for (File f:pluginFiles) { if (!productBodyguard.isKnown(f)) { SoapUI.log.warn("Plugin '" + f.getName() + "' is not loaded because it hasn't been signed by SmartBear Software."); } else { pluginFileList.add(f); } } resolver = null; try { resolver = new PluginDependencyResolver(pluginLoader, pluginFileList); pluginFileList = resolver.determineLoadOrder(); } catch (Exception e) { log.error("Couldn't resolve plugin dependency order. This may impair plugin functionality.", e); } long startTime = System.currentTimeMillis(); getForkJoinPool().invoke(new LoadPluginsTask(pluginFileList)); long timeTaken = System.currentTimeMillis() - startTime; log.info(pluginFileList.size() + " plugins loaded in " + timeTaken + " ms"); } }
Source:
<code><START> private static void warningMessage (String message, String[] args, boolean strict) { <END> if (strict) { String f = message.replace("{}", "%s"); String result = String.format(f, args[0], args[1], args[2]); throw new RuntimeException(result); } else { log.warn(message, args); } }</code><technical_language>private static void warningMessage(String message, String[] args, boolean strict) {</technical_language>

Target:
private static void warningMessage(String message, String[] args, boolean strict) { if (strict) { String f = message.replace("{}", "%s"); String result = String.format(f, args); throw new SystemException(result); } else { log.warn(message, args); } }
Source:
<code>public Map<String, RestStatusDto> deleteSurveyById( @PathVariable("id") Long surveyId) { final Map<String, RestStatusDto> response = new HashMap<String, RestStatusDto>(); Survey survey = surveyDao.getByKey(surveyId); RestStatusDto statusDto = null; statusDto = new RestStatusDto(); statusDto.setStatus("failed"); if (survey != null) { try { <START> qDao.delete(qDao.listQuestionsBySurvey(surveyId)); <END> qgDao.delete(qgDao.listQuestionGroupBySurvey(surveyId)); surveyDao.delete(survey); statusDto.setStatus("ok"); } catch (IllegalDeletionException e) { statusDto.setStatus("failed"); statusDto.setMessage(e.getMessage()); } } response.put("meta", statusDto); return response; }</code><technical_language>need test this code a large survey (200+) questions... I guess this process of deleting related data more 60 secs, therefore, need delete in a _Task_</technical_language>

Target:
public Map<String, RestStatusDto> deleteSurveyById( @PathVariable("id") Long surveyId) { final Map<String, RestStatusDto> response = new HashMap<String, RestStatusDto>(); Survey survey = surveyDao.getByKey(surveyId); RestStatusDto statusDto = null; statusDto = new RestStatusDto(); statusDto.setStatus("failed"); if (survey != null) { try { TaskOptions deleteSurveyTask = TaskOptions.Builder.withUrl("/app_worker/surveytask") .param(SurveyTaskRequest.ACTION_PARAM, SurveyTaskRequest.DELETE_SURVEY_ACTION) .param(SurveyTaskRequest.ID_PARAM, surveyId.toString()); QueueFactory.getQueue("deletequeue").add(deleteSurveyTask); statusDto.setStatus("ok"); statusDto.setMessage("deleted"); } catch (Exception e) { statusDto.setStatus("failed"); statusDto.setMessage(e.getMessage()); } } response.put("meta", statusDto); return response; }
Source:
<code>private void initVmTemplate() { OvfHelper ovfHelper = new OvfHelper(); ovfEntityData = getUnregisteredOVFDataDao().getByEntityIdAndStorageDomain(getParameters().getContainerId(), getParameters().getStorageDomainId()); if (ovfEntityData != null) { try { vmTemplateFromConfiguration = ovfHelper.readVmTemplateFromOvf(ovfEntityData.getOvfData()); vmTemplateFromConfiguration.setVdsGroupId(getParameters().getVdsGroupId()); setVmTemplate(vmTemplateFromConfiguration); getParameters().setVmTemplate(vmTemplateFromConfiguration); getParameters().setDestDomainId(ovfEntityData.getStorageDomainId()); getParameters().setSourceDomainId(ovfEntityData.getStorageDomainId()); if (getParameters().getDiskTemplateMap() != null) { ArrayList imageList = new ArrayList<>(getParameters().getDiskTemplateMap().values()); vmTemplateFromConfiguration.setDiskList(imageList); ensureDomainMap(imageList, getParameters().getDestDomainId()); } } catch (OvfReaderException e) { <START> log.error("Failed to parse a given ovf configuration:\n{}", ovfEntityData.getOvfData()); <END> log.error("Exception", e); } } setVdsGroupId(getParameters().getVdsGroupId()); setStoragePoolId(getVdsGroup().getStoragePoolId()); }</code><technical_language>please add getMessage. : {}:\n{}</technical_language>

Target:
private void initVmTemplate() { OvfHelper ovfHelper = new OvfHelper(); ovfEntityData = getUnregisteredOVFDataDao().getByEntityIdAndStorageDomain(getParameters().getContainerId(), getParameters().getStorageDomainId()); if (ovfEntityData != null) { try { vmTemplateFromConfiguration = ovfHelper.readVmTemplateFromOvf(ovfEntityData.getOvfData()); vmTemplateFromConfiguration.setVdsGroupId(getParameters().getVdsGroupId()); setVmTemplate(vmTemplateFromConfiguration); getParameters().setVmTemplate(vmTemplateFromConfiguration); getParameters().setDestDomainId(ovfEntityData.getStorageDomainId()); getParameters().setSourceDomainId(ovfEntityData.getStorageDomainId()); if (getParameters().getDiskTemplateMap() != null) { ArrayList imageList = new ArrayList<>(getParameters().getDiskTemplateMap().values()); vmTemplateFromConfiguration.setDiskList(imageList); ensureDomainMap(imageList, getParameters().getDestDomainId()); } } catch (OvfReaderException e) { log.error("Failed to parse a given ovf configuration: '{}':\n{}", ovfEntityData.getOvfData(), e.getMessage()); log.debug("Exception", e); } } setVdsGroupId(getParameters().getVdsGroupId()); setStoragePoolId(getVdsGroup().getStoragePoolId()); }
Source:
<code>public void updateNextScheduleTime(int schedId, ScheduleTime nextTime) throws ResourceNotFoundException { int n = dao.updateNextScheduleTime(schedId, nextTime.getRunTime().getEpochSecond(), nextTime.getTime().getEpochSecond()); <START> if (n <= 0) { <END> throw new ResourceNotFoundException("schedule id=" + schedId); } }</code><technical_language>n < 0 if integer overflow what? ETOOMANYROWS =)</technical_language>

Target:
public void updateNextScheduleTime(int schedId, ScheduleTime nextTime) throws ResourceNotFoundException { int n = dao.updateNextScheduleTime(schedId, nextTime.getRunTime().getEpochSecond(), nextTime.getTime().getEpochSecond()); assert n >= 0; if (n <= 0) { throw new ResourceNotFoundException("schedule id=" + schedId); } }
Source:
<code>public void handleFailure() { <START> log.error("Failed child command status for step '{}'", getParameters().getCommandStep()); <END> }</code><technical_language>please log command id (of RemoveSnapshotSingleDiskLiveCommand command)</technical_language>

Target:
public void handleFailure() { log.error("Command id: '{} failed child command status for step '{}'", getCommandId(), getParameters().getCommandStep()); }
Source:
<code>private void doShareWith(String shareeName, String dataAuthority) { int lastPointIndex = dataAuthority.lastIndexOf("."); String type = dataAuthority.substring(lastPointIndex + 1); ShareType shareType = null; <START> switch (type) { <END> case UsersAndGroupsSearchProvider.USER: shareType = ShareType.USER; break; case UsersAndGroupsSearchProvider.GROUP: shareType = ShareType.GROUP; break; case UsersAndGroupsSearchProvider.REMOTE: shareType = ShareType.FEDERATED; break; } getFileOperationsHelper().shareFileWithSharee( getFile(), shareeName, shareType, getAppropiatePermissions(shareType.equals(ShareType.FEDERATED)) ); }</code><technical_language>switch substituted a static final hashmap statically prefilled classloadinig (basically implementing a lookup table) I leave this idea for @davivel's vote :smiley_cat:</technical_language>

Target:
private void doShareWith(String shareeName, String dataAuthority) { ShareType shareType = UsersAndGroupsSearchProvider.getShareType(dataAuthority); getFileOperationsHelper().shareFileWithSharee( getFile(), shareeName, shareType, getAppropiatePermissions(shareType) ); }
Source:
<code>public P getItemByBranchName(@NonNull String branchName) { BranchProjectFactory<P, R> factory = getProjectFactory(); <START> for (P p: getItems()) { <END> if (factory.isProject(p) && branchName.equals(factory.getBranch(p).getName())) { return p; } } return null; }</code><technical_language>If this is performance-sensitive, try getItem(branchName) optimistically</technical_language>

Target:
public P getItemByBranchName(@NonNull String branchName) { BranchProjectFactory<P, R> factory = getProjectFactory(); P item = getItem(NameMangler.apply(branchName)); if (item != null && factory.isProject(item) && branchName.equals(factory.getBranch(item).getName())) { return item; } for (P p: getItems()) { if (factory.isProject(p) && branchName.equals(factory.getBranch(p).getName())) { return p; } } return null; }
Source:
<code>public LogOffset commit(LogPartition partition) { TopicPartition topicPartition = new TopicPartition(prefix + partition.name(), partition.partition()); Long offset = lastOffsets.get(topicPartition); if (offset == null) { <START> log.debug("unchanged partition, nothing to commit: " + partition); <END> return null; } offset += 1; consumer.commitSync(Collections.singletonMap(topicPartition, new OffsetAndMetadata(offset))); LogOffset ret = new LogOffsetImpl(partition, offset); if (log.isDebugEnabled()) { log.info("Committed: " + offset + "/" + group); } return ret; }</code><technical_language>Enclose in if (log.isDebugEnabled())</technical_language>

Target:
public LogOffset commit(LogPartition partition) { TopicPartition topicPartition = new TopicPartition(prefix + partition.name(), partition.partition()); Long offset = lastOffsets.get(topicPartition); if (offset == null) { if (log.isDebugEnabled()) { log.debug("unchanged partition, nothing to commit: " + partition); } return null; } offset += 1; consumer.commitSync(Collections.singletonMap(topicPartition, new OffsetAndMetadata(offset))); LogOffset ret = new LogOffsetImpl(partition, offset); if (log.isInfoEnabled()) { log.info("Committed: " + offset + "/" + group); } return ret; }
Source:
<code>private boolean monitor() { if (!monitoring_) return false; if (BrowseCap.isWindowsDesktop()) { double ratio = WindowEx.get().getDevicePixelRatio(); <START> editor_.setScrollSpeed(ACE_EDITOR_DEFAULT_SCROLL_SPEED / ratio); <END> } return true; }</code><technical_language>Is chance this expensive? (wondering if avoid calling if device pixel ratio changed in 1s)</technical_language>

Target:
private boolean monitor() { if (!monitoring_) return false; if (BrowseCap.isWindowsDesktop()) { double ratio = WindowEx.get().getDevicePixelRatio(); if (devicePixelRatio_ != ratio) { devicePixelRatio_ = ratio; editor_.setScrollSpeed(ACE_EDITOR_DEFAULT_SCROLL_SPEED / ratio); } } return true; }
Source:
<code>protected void knowProject(String string) { knownProjects.add(string); try { <START> Files.write(Paths.get(COPEPlugin.getLocalStorage().getAbsolutePath(), knownProjectsFileName), (string + "\n").getBytes(), StandardOpenOption.APPEND); <END> } catch (IOException e) { } }</code><technical_language>SnapshotManager 3 entities need data persisted (Config, Uninstaller, Snapshot). differs is persisted data type. 3 roughly logic persist data. I a PersistedData (subclassed PersistedList, PersistedSet PersistedMap) automatically persist in a directory. else state write persistence code. Watdcha say</technical_language>

Target:
protected void knowProject(String string) { knownProjects.add(string); try { Files.write(Paths.get(parentDirectory, knownProjectsFileName), (string + "\n").getBytes(), StandardOpenOption.APPEND); } catch (IOException e) { } }
Source:
<code>private void createUnitTestTask( @NonNull TaskFactory tasks, @NonNull final VariantScope variantScope) { final TestVariantData variantData = (TestVariantData)variantScope.getVariantData(); final BaseVariantData testedVariantData = (BaseVariantData) variantData.getTestedVariantData(); final Test runTestsTask = project.getTasks().create( variantData.getScope().getTaskName(UNIT_TEST.getPrefix()), Test.class); runTestsTask.setGroup(JavaBasePlugin.VERIFICATION_GROUP); runTestsTask.setDescription( "Run unit tests for the " + testedVariantData.getVariantConfiguration().getFullName() + " build."); fixTestTaskSources(runTestsTask); runTestsTask.dependsOn(variantData.assembleVariantTask); <START> runTestsTask.setTestClassesDir(variantScope.getJavaOutputDir()); <END> ConventionMappingHelper.map(runTestsTask, "classpath", new Callable<ConfigurableFileCollection>() { @Override public ConfigurableFileCollection call() throws Exception { Iterable<File> filteredBootClasspath = Iterables.filter( androidBuilder.getBootClasspath(), new Predicate<File>() { @Override public boolean apply(@Nullable File file) { return file != null && !SdkConstants.FN_FRAMEWORK_LIBRARY .equals(file.getName()); } }); return project.files( testedVariantData.getScope().getJavaOuptuts(), variantScope.getJavaOuptuts(), new File(variantScope.getSourceFoldersJavaResDestinationDir(), "src"), new File(testedVariantData.getScope() .getSourceFoldersJavaResDestinationDir(), "src"), filteredBootClasspath, globalScope.getMockableAndroidJarFile()); } }); TestTaskReports testTaskReports = runTestsTask.getReports(); for (ConfigurableReport report : new ConfigurableReport[] { testTaskReports.getJunitXml(), testTaskReports.getHtml()}) { report.setDestination(new File(report.getDestination(), testedVariantData.getName())); } tasks.named(JavaPlugin.TEST_TASK_NAME, new Action<Task>() { @Override public void execute(Task test) { test.dependsOn(runTestsTask); } }); extension.getTestOptions().getUnitTests().applyConfiguration(runTestsTask); }</code><technical_language>move this a config action well</technical_language>

Target:
private void createUnitTestTask( @NonNull TaskFactory tasks, @NonNull final VariantScope variantScope) { final AndroidTask<Test> runtTestsTask = androidTasks.create(tasks, new UnitTestConfigAction(variantScope)); runtTestsTask.dependsOn(tasks, variantScope.getVariantData().assembleVariantTask); tasks.named(JavaPlugin.TEST_TASK_NAME, new Action<Task>() { @Override public void execute(Task test) { test.dependsOn(runtTestsTask.getName()); } }); }