auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public CouchConfig getCouchConfig(String db) { if(TEST_WITH_CLOUDANT) { CouchConfig config = CloudantConfig.defaultConfig(db); if(Strings.isNullOrEmpty(config.getRootUri().getUserInfo())) { throw new IllegalStateException("Cloudant account info" + " is required to run tests with Cloudant."); } return config; } else if (SPECIFIED_COUCH) { <START> return SpecifiedCouch.defaultConfig(db); <END> } else { String host; if(Misc.isRunningOnAndroid()){ host = "10.0.2.2"; } else { host = "127.0.0.1"; } return this.defaultConfig(host, db); } }</code><technical_language>I of this SpecifiedCouch class. user pass in a url string done it</technical_language>

Target:
public CouchConfig getCouchConfig(String db) { if (SPECIFIED_COUCH) { return SpecifiedCouch.defaultConfig(db); } else { String host; if(Misc.isRunningOnAndroid()){ host = "10.0.2.2"; } else { host = "127.0.0.1"; } return this.defaultConfig(host, db); } }
Source:
<code>public boolean verifyServerKey(ClientSession clientSession, SocketAddress remoteAddress, PublicKey serverKey) { try { if (checkReloadRequired()) { Path file = getPath(); if (exists()) { updateReloadAttributes(); keysSupplier = GenericUtils.memoizeLock(getKnownHostSupplier(clientSession, file)); } else { if (log.isDebugEnabled()) { log.debug("verifyServerKey({})[{}] missing known hosts file {}", clientSession, remoteAddress, file); } <START> keysSupplier = GenericUtils.memoizeLock(Collections::emptyList); <END> } } } catch (Throwable t) { return acceptIncompleteHostKeys(clientSession, remoteAddress, serverKey, t); } Collection<HostEntryPair> knownHosts = keysSupplier.get(); return acceptKnownHostEntries(clientSession, remoteAddress, serverKey, knownHosts); }</code><technical_language>Update of keysSupplier field is mutually exclusive..</technical_language>

Target:
public boolean verifyServerKey(ClientSession clientSession, SocketAddress remoteAddress, PublicKey serverKey) { try { if (checkReloadRequired()) { Path file = getPath(); if (exists()) { updateReloadAttributes(); keysSupplier.set(GenericUtils.memoizeLock(getKnownHostSupplier(clientSession, file))); } else { if (log.isDebugEnabled()) { log.debug("verifyServerKey({})[{}] missing known hosts file {}", clientSession, remoteAddress, file); } keysSupplier.set(GenericUtils.memoizeLock(Collections::emptyList)); } } } catch (Throwable t) { return acceptIncompleteHostKeys(clientSession, remoteAddress, serverKey, t); } Collection<HostEntryPair> knownHosts = keysSupplier.get().get(); return acceptKnownHostEntries(clientSession, remoteAddress, serverKey, knownHosts); }
Source:
<code>public void visitNode(Tree tree) { if (!hasSemantic()) { return; } SwitchStatementTree switchStatementTree = (SwitchStatementTree) tree; Optional<CaseLabelTree> defaultLabel = getDefaultLabel(switchStatementTree); <START> if (!defaultLabel.isPresent()) { <END> if (!isSwitchOnEnum(switchStatementTree)) { reportIssue(switchStatementTree.switchKeyword(), "Add a default case to this switch."); } else if (missingCasesOfEnum(switchStatementTree)) { reportIssue(switchStatementTree.switchKeyword(), "Complete cases by adding the missing enum constants or add a default case to this switch."); } } else if (!defaultLabel.get().equals(getLastLabel(switchStatementTree))) { reportIssue(defaultLabel.get(), "Move this default to the end of the switch."); } }</code><technical_language>This reworked avoid ! in condition cases cleaner read</technical_language>

Target:
public void visitNode(Tree tree) { if (!hasSemantic()) { return; } SwitchStatementTree switchStatementTree = (SwitchStatementTree) tree; Optional<CaseLabelTree> defaultLabel = getDefaultLabel(switchStatementTree); if (defaultLabel.isPresent()) { CaseLabelTree defaultLabelTree = defaultLabel.get(); if (!defaultLabelTree.equals(getLastLabel(switchStatementTree))) { reportIssue(defaultLabelTree, "Move this default to the end of the switch."); } } else { if (!isSwitchOnEnum(switchStatementTree)) { reportIssue(switchStatementTree.switchKeyword(), "Add a default case to this switch."); } else if (missingCasesOfEnum(switchStatementTree)) { reportIssue(switchStatementTree.switchKeyword(), "Complete cases by adding the missing enum constants or add a default case to this switch."); } } }
Source:
<code>KeyspaceMetadata(String name, boolean durableWrites, Map<String, String> replication) { this.name = name; this.durableWrites = durableWrites; this.replication = replication; this.strategy = ReplicationStrategy.create(replication); <START> this.isVirtual=false; <END> }</code><technical_language>preferable for this constructor reuse new (i.e. this(name, durableWrites, replication, false)). mark this constructor deprecated existing of updated new one</technical_language>

Target:
KeyspaceMetadata(String name, boolean durableWrites, Map<String, String> replication) { this(name, durableWrites, replication, false); }
Source:
<code>protected void eventHandle(ITmfEvent event) { final String eventName = event.getType().getName(); if (eventName.equals(fLayout.eventSchedSwitch())) { TmfCpuAspect cpuAspect = null; for (TmfCpuAspect aspect : TmfTraceUtils.getEventAspectsOfClass(event.getTrace(), TmfCpuAspect.class)) { <START> cpuAspect = aspect; <END> } if (cpuAspect == null) { return; } Integer cpu = cpuAspect.resolve(event); ITmfEventField content = event.getContent(); long ts = event.getTimestamp().getValue(); Long prevTid = (Long) content.getField(fLayout.fieldPrevTid()).getValue(); try { Integer currentCPUNode = ss.getQuarkRelativeAndAdd(getNodeCPUs(), cpu.toString()); Integer cumulativeTimeQuark = ss.getQuarkRelativeAndAdd(currentCPUNode, prevTid.toString()); Long startTime = fLastStartTimes.get(cpu); if (startTime == null) { startTime = fTraceStart; } if (startTime != null) { ITmfStateValue value = ss.queryOngoingState(cumulativeTimeQuark); long prevCumulativeTime = value.unboxLong(); long newCumulativeTime = prevCumulativeTime + (ts - startTime); value = TmfStateValue.newValueLong(newCumulativeTime); ss.modifyAttribute(ts, value, cumulativeTimeQuark); fLastStartTimes.put(cpu, ts); } } catch (AttributeNotFoundException e) { Activator.getDefault().logError("Attribute not found in LttngKernelCpuStateProvider", e); } } }</code><technical_language>break mebbe</technical_language>

Target:
protected void eventHandle(ITmfEvent event) { final String eventName = event.getType().getName(); if (eventName.equals(fLayout.eventSchedSwitch())) { Integer cpu = null; Iterable<TmfCpuAspect> aspects = TmfTraceUtils.getEventAspectsOfClass(event.getTrace(), TmfCpuAspect.class); for (TmfCpuAspect aspect : aspects) { if (!aspect.resolve(event).equals(TmfCpuAspect.CPU_UNAVAILABLE)) { cpu = aspect.resolve(event); break; } } if (cpu == null) { return; } ITmfEventField content = event.getContent(); long ts = event.getTimestamp().getValue(); Long prevTid = (Long) content.getField(fLayout.fieldPrevTid()).getValue(); try { Integer currentCPUNode = ss.getQuarkRelativeAndAdd(getNodeCPUs(), cpu.toString()); Integer cumulativeTimeQuark = ss.getQuarkRelativeAndAdd(currentCPUNode, prevTid.toString()); Long startTime = fLastStartTimes.get(cpu); if (startTime == null) { startTime = fTraceStart; } if (startTime != null) { ITmfStateValue value = ss.queryOngoingState(cumulativeTimeQuark); long prevCumulativeTime = value.unboxLong(); long newCumulativeTime = prevCumulativeTime + (ts - startTime); value = TmfStateValue.newValueLong(newCumulativeTime); ss.modifyAttribute(ts, value, cumulativeTimeQuark); fLastStartTimes.put(cpu, ts); } } catch (AttributeNotFoundException e) { Activator.getDefault().logError("Attribute not found in LttngKernelCpuStateProvider", e); } } }
Source:
<code>public boolean setMinPasscodeLength(Context ctx, int minPasscodeLength) { if (minPasscodeLength > this.minPasscodeLength) { this.minPasscodeLength = minPasscodeLength; if (hasStoredPasscode(SalesforceSDKManager.getInstance().getAppContext())) { setEnabled(true); showLockActivity(ctx, true); <START> return true; <END> } } this.minPasscodeLength = minPasscodeLength; storeMobilePolicy(SalesforceSDKManager.getInstance().getAppContext()); return false; }</code><technical_language>@skyler-b this lead minPasscodeLength updated? Previously, lock activity is shown, control return execute storeMobilePolicy below. Now, code returns here, min length updated, right</technical_language>

Target:
public boolean setMinPasscodeLength(Context ctx, int minPasscodeLength) { boolean passcodeChangeRequired = false; if (minPasscodeLength > this.minPasscodeLength) { this.minPasscodeLength = minPasscodeLength; if (hasStoredPasscode(ctx)) { showLockActivity(ctx, true); passcodeChangeRequired = true; } } this.minPasscodeLength = minPasscodeLength; storeMobilePolicy(ctx); return passcodeChangeRequired; }
Source:
<code>private void addScript() throws IOException { ExtensionScript extScript = Control.getSingleton().getExtensionLoader().getExtension(ExtensionScript.class); if (extScript != null) { ScriptType variantType = extScript.getScriptType(ExtensionActiveScan.SCRIPT_TYPE_VARIANT); ScriptEngineWrapper engine = extScript.getEngineWrapper( Constant.messages.getString("graphql.script.engine")); if (variantType != null && engine != null) { String scriptName = Constant.messages.getString("graphql.script.name"); <START> File scriptPath = new File(Constant.getZapHome(), "scripts/scripts/variant/" + scriptName); <END> ScriptWrapper script = new ScriptWrapper( scriptName, Constant.messages.getString("graphql.script.description"), engine, variantType, true, scriptPath); script.reloadScript(); extScript.addScript(script); } } }</code><technical_language>@psiinon / @thc202 is a core constant handier for add-ons (vs. hard coding path)</technical_language>

Target:
private void addScript() throws IOException { ExtensionScript extScript = Control.getSingleton().getExtensionLoader().getExtension(ExtensionScript.class); String scriptName = "GraphQL Support.js"; if (extScript != null && extScript.getScript(scriptName) == null) { ScriptType variantType = extScript.getScriptType(ExtensionActiveScan.SCRIPT_TYPE_VARIANT); ScriptEngineWrapper engine = extScript.getEngineWrapper("Oracle Nashorn"); if (variantType != null && engine != null) { File scriptPath = Paths.get( Constant.getZapHome(), ExtensionScript.SCRIPTS_DIR, ExtensionScript.SCRIPTS_DIR, ExtensionActiveScan.SCRIPT_TYPE_VARIANT, scriptName) .toFile(); ScriptWrapper script = new ScriptWrapper( scriptName, Constant.messages.getString("graphql.script.description"), engine, variantType, true, scriptPath); script.reloadScript(); extScript.addScript(script); } } }
Source:
<code>protected Response createPaymentResponse(final UriInfo uriInfo, final Payment payment, final TransactionType transactionType, @Nullable final String transactionExternalKey) { final PaymentTransaction createdTransaction = findCreatedTransaction(payment, transactionType, transactionExternalKey); Preconditions.checkNotNull(createdTransaction, "No transaction of type '%s' found", transactionType); switch (createdTransaction.getTransactionStatus()) { case PENDING: case SUCCESS: return uriBuilder.buildResponse(uriInfo, PaymentResource.class, "getPayment", payment.getId()); case PAYMENT_FAILURE: <START> return Response.status(402).build(); <END> case PAYMENT_SYSTEM_OFF: case UNKNOWN: return Response.status(Status.SERVICE_UNAVAILABLE).build(); case PLUGIN_FAILURE: return Response.status(502).build(); } return Response.serverError().build(); }</code><technical_language>location header in failure scenarios too? for client get payment id (if external key specified)</technical_language>

Target:
protected Response createPaymentResponse(final UriInfo uriInfo, final Payment payment, final TransactionType transactionType, @Nullable final String transactionExternalKey) { final PaymentTransaction createdTransaction = findCreatedTransaction(payment, transactionType, transactionExternalKey); Preconditions.checkNotNull(createdTransaction, "No transaction of type '%s' found", transactionType); final ResponseBuilder responseBuilder; final BillingExceptionJson exception; switch (createdTransaction.getTransactionStatus()) { case PENDING: case SUCCESS: return uriBuilder.buildResponse(uriInfo, PaymentResource.class, "getPayment", payment.getId()); case PAYMENT_FAILURE: responseBuilder = Response.status(402); exception = createBillingException(String.format("Payment decline by gateway. Error message: %s", createdTransaction.getGatewayErrorMsg())); break; case PAYMENT_SYSTEM_OFF: responseBuilder = Response.status(Status.SERVICE_UNAVAILABLE); exception = createBillingException("Payment system is off."); break; case UNKNOWN: responseBuilder = Response.status(Status.SERVICE_UNAVAILABLE); exception = createBillingException("Payment in unknown status, failed to receive gateway response."); break; case PLUGIN_FAILURE: responseBuilder = Response.status(502); exception = createBillingException("Failed to submit payment transaction"); break; default: responseBuilder = Response.serverError(); exception = createBillingException("This should never have happened!!!"); } addExceptionToResponse(responseBuilder, exception); return responseBuilder.location(getPaymentLocation(uriInfo, payment)).build(); }
Source:
<code>protected <T> T execute(HttpRequestBase request, ResponseHandler<T> responseHandler) throws IOException { try { return super.execute(request, responseHandler); } finally { <START> request.releaseConnection(); <END> } }</code><technical_language>is request checked for null somewhere? eg. in super.execute()</technical_language>

Target:
protected <T> T execute(HttpRequestBase request, ResponseHandler<T> responseHandler) throws IOException { try { notNull(request,"request must not be null!"); return super.execute(request, responseHandler); } finally { request.releaseConnection(); } }
Source:
<code>private boolean hasTrivialCoordinator(AbstractPlanNode planNode) { PlanNodeType planNodeType = planNode.getPlanNodeType(); if (PlanNodeType.RECEIVE == planNodeType || PlanNodeType.MERGERECEIVE == planNodeType) { return true; <START> } else if (PlanNodeType.PROJECTION == planNodeType) { <END> assert(planNode.getChildCount() == 1); return hasTrivialCoordinator(planNode.getChild(0)); } return false; }</code><technical_language>"else" required return</technical_language>

Target:
private boolean hasTrivialCoordinator(AbstractPlanNode planNode) { PlanNodeType planNodeType = planNode.getPlanNodeType(); if (PlanNodeType.RECEIVE == planNodeType || PlanNodeType.MERGERECEIVE == planNodeType) { return true; } if (PlanNodeType.PROJECTION == planNodeType) { assert(planNode.getChildCount() == 1); return hasTrivialCoordinator(planNode.getChild(0)); } return false; }
Source:
<code>public static List<Event> dispatch(ProcessManager<?, ?, ?> pm, EventEnvelope event) { checkNotNull(pm); checkNotNull(event); final PmTransaction<?, ?, ?> tx = PmTransaction.start(pm); <START> List<Event> eventMessages = pm.dispatchEvent(event); <END> tx.commit(); return eventMessages; }</code><technical_language>This variable final</technical_language>

Target:
public static List<Event> dispatch(ProcessManager<?, ?, ?> pm, EventEnvelope event) { checkNotNull(pm); checkNotNull(event); final PmTransaction<?, ?, ?> tx = PmTransaction.start(pm); final List<Event> eventMessages = pm.dispatchEvent(event); tx.commit(); return eventMessages; }
Source:
<code>public BoardPanel(BoardSize boardSize, int boardIndex, GlassPane globalGlassPane, DropManager dropManager, Function<Pair<Integer, BoardCoordinate>, Set<BoardCoordinate>> getMovesCallback) { mSquareLabels = new SquareJLabel[boardSize.width][boardSize.height]; mGlassPane = globalGlassPane; mDropManager = dropManager; mBoardIndex = boardIndex; mGetMovesCallback = getMovesCallback; mBoardSize = boardSize; mHighlightCallback = coordinate -> { Set<BoardCoordinate> coordinates = mGetMovesCallback.apply(Pair.create(mBoardIndex, coordinate)); if (!coordinates.isEmpty()) { List<SquareJLabel> labels = highlightSquares(coordinates); repaint(); return labels; } else { return Collections.emptyList(); } }; setOpaque(false); <START> setLayout(new GridLayout(mBoardSize.width + 1, mBoardSize.height)); <END> setPreferredSize(new Dimension((mBoardSize.width + 1) * 48, (mBoardSize.height + 1) * 48)); createGrid(); }</code><technical_language>This mBoardSize.height + 1...bug</technical_language>

Target:
public BoardPanel(BoardSize boardSize, int boardIndex, GlassPane globalGlassPane, DropManager dropManager, Function<Pair<Integer, BoardCoordinate>, Set<BoardCoordinate>> getMovesCallback) { mSquareLabels = new SquareJLabel[boardSize.width][boardSize.height]; mGlassPane = globalGlassPane; mDropManager = dropManager; mBoardIndex = boardIndex; mGetMovesCallback = getMovesCallback; mBoardSize = boardSize; mHighlightCallback = coordinate -> { Set<BoardCoordinate> coordinates = mGetMovesCallback.apply(Pair.create(mBoardIndex, coordinate)); if (!coordinates.isEmpty()) { List<SquareJLabel> labels = highlightSquares(coordinates); repaint(); return labels; } else { return Collections.emptyList(); } }; setOpaque(false); setLayout(new GridLayout(mBoardSize.width + 1, mBoardSize.height + 1)); setPreferredSize(new Dimension((mBoardSize.width + 1) * 48, (mBoardSize.height + 1) * 48)); createGrid(); }
Source:
<code>public void save() { <START> Preconditions.checkState(isInitialized(), "SpongeUser is not initialized", this.profile.getId()); <END> SaveHandler saveHandler = (SaveHandler) WorldManager.getWorldByDimensionId(0).get().getSaveHandler(); File dataFile = new File(saveHandler.playersDirectory, getUniqueId() + ".dat"); NBTTagCompound tag; try { tag = CompressedStreamTools.readCompressed(new FileInputStream(dataFile)); } catch (IOException ignored) { tag = new NBTTagCompound(); } writeToNbt(tag); try (FileOutputStream out = new FileOutputStream(dataFile)) { CompressedStreamTools.writeCompressed(tag, out); dirtyUsers.remove(this); invalidate(); } catch (IOException e) { SpongeImpl.getLogger().warn("Failed to save user file [{}]!", dataFile, e); } }</code><technical_language>User</technical_language>

Target:
public void save() { Preconditions.checkState(isInitialized(), "User is not initialized", this.profile.getId()); final SaveHandlerAccessor saveHandler = (SaveHandlerAccessor) WorldManager.getWorldByDimensionId(0).get().getSaveHandler(); final File dataFile = new File(saveHandler.accessor$getPlayersDirectory(), getUniqueId() + ".dat"); NBTTagCompound tag; try { tag = CompressedStreamTools.readCompressed(new FileInputStream(dataFile)); } catch (IOException ignored) { tag = new NBTTagCompound(); } writeToNbt(tag); try (final FileOutputStream out = new FileOutputStream(dataFile)) { CompressedStreamTools.writeCompressed(tag, out); dirtyUsers.remove(this); invalidate(); } catch (IOException e) { SpongeImpl.getLogger().warn("Failed to save user file [{}]!", dataFile, e); } }
Source:
<code>public void prepareRun(StageSubmitterContext context) throws Exception { super.prepareRun(context); <START> Schema schema = context.getInputSchema(); <END> if (schema == null || schema.getFields() == null) { return; } List<String> input = schema.getFields().stream() .map(Schema.Field::getName).collect(Collectors.toList()); context.record(Collections.singletonList( new FieldTransformOperation("csvFormat", "CSV formatter", input, fields.stream().map(Schema.Field::getName) .collect(Collectors.toList())))); config.validate(context.getFailureCollector()); }</code><technical_language>This is wrong. transform method, <LINK_0>, this basically converts input fields field of output schema, field lineage reflect this</technical_language>

Target:
public void prepareRun(StageSubmitterContext context) throws Exception { super.prepareRun(context); List<String> outputFields = TransformLineageRecorderUtils.getFields(context.getOutputSchema()); if (!outputFields.isEmpty()) { context.record( TransformLineageRecorderUtils .generateManyToOne(TransformLineageRecorderUtils.getFields(context.getInputSchema()), outputFields.get(0), "csvFormat", "Formatted the input data as CSV.")); } config.validate(context.getFailureCollector()); }
Source:
<code>public void stop() { <START> log.info( "Redis stopping ..." ); <END> entityKeys.clear(); associationKeys.clear(); pool.destroy(); }</code><technical_language>wrong, nice if logger messages embedded in _Log_ interface? have: log.redisStopping(); allows internationalization team translate redefine logging level</technical_language>

Target:
public void stop() { log.redisStopping(); entityKeys.clear(); associationKeys.clear(); if ( pool != null ) { pool.destroy(); } }
Source:
<code>public void uploadFile(WebContext ctx, JSONStructuredOutput out, String bucket, InputStreamHandler input) { try { String name = ctx.get("filename").asString(ctx.get("qqfile").asString()); Bucket storageBucket = storage.getBucket(bucket); StoredObject object = storageBucket.getObject(name); try (FileOutputStream fos = new FileOutputStream(object.getFile())) { ByteStreams.copy(input, fos); } Map<String, String> properties = Maps.newTreeMap(); properties.put(HttpHeaderNames.CONTENT_TYPE.toString(), ctx.getHeaderValue(HttpHeaderNames.CONTENT_TYPE).asString(MimeHelper.guessMimeType(name))); <START> HashCode hash = Files.asByteSource(object.getFile()).hash(Hashing.md5()); <END> String md5 = BaseEncoding.base64().encode(hash.asBytes()); properties.put("Content-MD5", md5); object.storeProperties(properties); out.property("message", "File successfully uploaded."); out.property("action", "/ui/" + bucket); out.property("actionLabel", NLS.get("NLS.refresh")); out.property("refresh", "true"); } catch (IOException e) { UserContext.handle(e); ctx.respondWith().direct(HttpResponseStatus.OK, "{ success: false }"); } }</code><technical_language>s.a</technical_language>

Target:
public void uploadFile(WebContext ctx, JSONStructuredOutput out, String bucket, InputStreamHandler input) { try { String name = ctx.get("filename").asString(ctx.get("qqfile").asString()); Bucket storageBucket = storage.getBucket(bucket); StoredObject object = storageBucket.getObject(name); try (FileOutputStream fos = new FileOutputStream(object.getFile())) { ByteStreams.copy(input, fos); } Map<String, String> properties = Maps.newTreeMap(); properties.put(HttpHeaderNames.CONTENT_TYPE.toString(), ctx.getHeaderValue(HttpHeaderNames.CONTENT_TYPE).asString(MimeHelper.guessMimeType(name))); String md5 = Hasher.md5().hashFile(object.getFile()).toBase64String(); properties.put("Content-MD5", md5); object.storeProperties(properties); out.property("message", "File successfully uploaded."); out.property("action", "/ui/" + bucket); out.property("actionLabel", NLS.get("NLS.refresh")); out.property("refresh", "true"); } catch (IOException e) { UserContext.handle(e); ctx.respondWith().direct(HttpResponseStatus.OK, "{ success: false }"); } }
Source:
<code>public static void editArtifacts(final String name, final Collection<? extends Artifact> artifacts, TableLoadOption... tableLoadOptions) { <START> for (Artifact art : artifacts) { <END> if (ChangeUiUtil.permissionsDeniedWithDialog(art.getBranch())) { return; } } Set<TableLoadOption> options = new HashSet<>(); options.addAll(Arrays.asList(tableLoadOptions)); Displays.ensureInDisplayThread(new Runnable() { @Override public void run() { boolean accessControlFilteredResults = false; try { Set<Artifact> accessibleArts = new HashSet<>(); for (Artifact artifact : artifacts) { if (!AccessControlManager.hasPermission(artifact, PermissionEnum.READ)) { OseeLog.log(Activator.class, Level.INFO, "The user " + UserManager.getUser() + " does not have read access to " + artifact); accessControlFilteredResults = true; } else { accessibleArts.add(artifact); } } if (accessibleArts.isEmpty()) { AWorkbench.popup("ERROR", "No Artifacts to edit"); } else { AWorkbench.getActivePage().openEditor( new MassArtifactEditorInput(name, accessibleArts, new MassXViewerFactory(accessibleArts)), EDITOR_ID); } if (accessControlFilteredResults) { AWorkbench.popup("ERROR", "Some Artifacts not loaded due to access control limitations."); } } catch (Exception ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } } }, options.contains(TableLoadOption.ForcePend)); }</code><technical_language>Remove this section - covered</technical_language>

Target:
public static void editArtifacts(final String name, final Collection<? extends Artifact> artifacts, TableLoadOption... tableLoadOptions) { Set<TableLoadOption> options = new HashSet<>(); options.addAll(Arrays.asList(tableLoadOptions)); Displays.ensureInDisplayThread(new Runnable() { @Override public void run() { boolean accessControlFilteredResults = false; try { Set<Artifact> accessibleArts = new HashSet<>(); for (Artifact artifact : artifacts) { if (!AccessControlManager.hasPermission(artifact, PermissionEnum.READ)) { OseeLog.log(Activator.class, Level.INFO, "The user " + UserManager.getUser() + " does not have read access to " + artifact); accessControlFilteredResults = true; } else { accessibleArts.add(artifact); } } if (accessibleArts.isEmpty()) { AWorkbench.popup("ERROR", "No Artifacts to edit"); } else { AWorkbench.getActivePage().openEditor( new MassArtifactEditorInput(name, accessibleArts, new MassXViewerFactory(accessibleArts)), EDITOR_ID); } if (accessControlFilteredResults) { AWorkbench.popup("ERROR", "Some Artifacts not loaded due to access control limitations."); } } catch (Exception ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } } }, options.contains(TableLoadOption.ForcePend)); }
Source:
<code>public FlashScope getFlashCookie() { <START> return wrapped.getFlashScope(); <END> }</code><technical_language>please leave - intentionally referencing deprecated version</technical_language>

Target:
public FlashScope getFlashCookie() { return wrapped.getFlashCookie(); }
Source:
<code>void shouldUpdateChargeToSystemCancel_IfEpdqStatusIs6WithRelevantChargeStatus(String status) { final String payload = notificationPayloadForTransaction(payId, EPDQ_AUTHORISED_CANCELLED); charge = Charge.from(ChargeEntityFixture.aValidChargeEntity() .withStatus(ChargeStatus.fromString(status)) .withGatewayTransactionId(payId) .build()); setUpGatewayAccountToReturnGatewayAccountEntity(Optional.of(gatewayAccountEntity)); setUpChargeServiceToReturnCharge(Optional.of(charge)); <START> final boolean result = notificationService.handleNotificationFor(payload, FORWARDED_IP_ADDRESSES); assertTrue(result); <END> verify(mockChargeNotificationProcessor).invoke(payId, charge, SYSTEM_CANCELLATION_FLOW.getSuccessTerminalState(), null); }</code><technical_language>inlined</technical_language>

Target:
void shouldUpdateChargeToSystemCancel_IfEpdqStatusIs6WithRelevantChargeStatus(String status) { final String payload = notificationPayloadForTransaction(payId, EPDQ_AUTHORISED_CANCELLED); charge = Charge.from(ChargeEntityFixture.aValidChargeEntity() .withStatus(ChargeStatus.fromString(status)) .withGatewayTransactionId(payId) .build()); setUpGatewayAccountToReturnGatewayAccountEntity(Optional.of(gatewayAccountEntity)); setUpChargeServiceToReturnCharge(Optional.of(charge)); assertTrue(notificationService.handleNotificationFor(payload, FORWARDED_IP_ADDRESSES)); verify(mockChargeNotificationProcessor).invoke(payId, charge, SYSTEM_CANCELLATION_FLOW.getSuccessTerminalState(), null); }
Source:
<code>private void checkResources() { File validatorDir = new File(validatorDirPath); List<URL> resources = new ArrayList<URL>(); boolean reloadResources = false; try { if (validatorDir.canRead() && validatorDir.isDirectory()) { for (File f : validatorDir.listFiles()) { if (f.getName().endsWith(".jar")) { resources.add(f.toURI().toURL()); if (resourceTimestamps.get(f.getName()) == null || resourceTimestamps.get(f.getName()) != f.lastModified()) { reloadResources = true; logger.info("Resource " + f.getName() + " is updated. Reload the classloader."); resourceTimestamps.put(f.getName(), f.lastModified()); } } } } } catch (MalformedURLException e) { throw new ValidatorManagerException(e); } if (reloadResources) { if (validatorLoader != null) { <START> validatorLoader.close(); <END> } validatorLoader = new ValidatorClassLoader(resources.toArray(new URL[resources.size()])); } }</code><technical_language>sense add try/catch miss in future</technical_language>

Target:
private void checkResources() { File validatorDir = new File(validatorDirPath); List<URL> resources = new ArrayList<URL>(); boolean reloadResources = false; try { if (validatorDir.canRead() && validatorDir.isDirectory()) { for (File f : validatorDir.listFiles()) { if (f.getName().endsWith(".jar")) { resources.add(f.toURI().toURL()); if (resourceTimestamps.get(f.getName()) == null || resourceTimestamps.get(f.getName()) != f.lastModified()) { reloadResources = true; logger.info("Resource " + f.getName() + " is updated. Reload the classloader."); resourceTimestamps.put(f.getName(), f.lastModified()); } } } } } catch (MalformedURLException e) { throw new ValidatorManagerException(e); } if (reloadResources) { if (validatorLoader != null) { try { validatorLoader.close(); } catch (ValidatorManagerException e) { logger.error("Cannot reload validator classloader because failure " + "to close the validator classloader.", e); } } validatorLoader = new ValidatorClassLoader(resources.toArray(new URL[resources.size()])); } }
Source:
<code>public void visitConditionalExpression(ConditionalExpressionTree tree) { TernaryVisitor visitor = new TernaryVisitor(); tree.condition().accept(visitor); <START> ExpressionTree trueExpression = tree.trueExpression(); <END> if (trueExpression != null) { trueExpression.accept(visitor); } tree.falseExpression().accept(visitor); if (visitor.childTernary != null) { context() .newIssue(this, visitor.childTernary, "Extract this nested ternary operation into an independent statement.") .secondary(tree.queryToken(), "Parent ternary operator"); } }</code><technical_language>is need visit true false expressions if issue detected in condition. some unecessary visit done issue is found. I subvisitor visit false expression if issue found, visit true expression if null if issue found, condition expression. I of choice reporting nested false expression only. provide nested children secondaries ? This avoid reporting true expression fixing issue</technical_language>

Target:
public void visitConditionalExpression(ConditionalExpressionTree tree) { TernaryVisitor visitor = new TernaryVisitor(); tree.falseExpression().accept(visitor); ExpressionTree trueExpression = tree.trueExpression(); if (trueExpression != null) { trueExpression.accept(visitor); } tree.condition().accept(visitor); if (!visitor.descendantTernaries.isEmpty()) { ConditionalExpressionTree first = visitor.descendantTernaries.get(0); PreciseIssue issue = context().newIssue(this, first, "Extract this nested ternary operation into an independent statement."); visitor.descendantTernaries.stream().skip(1).forEach(ternary -> issue.secondary(ternary, "Other nested ternary")); issue.secondary(tree.queryToken(), "Parent ternary operator"); } }
Source:
<code>public Meta create(List<String> args) { Configuration conf = Preconditions.checkNotNull(getConf(), "Configuration must not be null."); Properties info = new Properties(); info.putAll(conf.getValByRegex("avatica.*")); try { final String url; if (args.size() == 0) { url = QueryUtil.getConnectionUrl(info, conf); } else if (args.size() == 1) { url = args.get(0); } else { throw new RuntimeException( "0 or 1 argument expected. Received " + Arrays.toString(args.toArray())); } <START> if (PqsConfiguration.isMetricsTurnedOn()) { <END> info.put(QueryServices.COLLECT_REQUEST_LEVEL_METRICS, "true"); } return new PQSMetricsMeta(url, info); } catch (SQLException | ClassNotFoundException e) { throw new RuntimeException(e); } }</code><technical_language>return a PQSMetricsMeta if metrics collection is enabled</technical_language>

Target:
public Meta create(List<String> args) { Configuration conf = Preconditions.checkNotNull(getConf(), "Configuration must not be null."); Properties info = new Properties(); info.putAll(conf.getValByRegex("avatica.*")); try { final String url; if (args.size() == 0) { url = QueryUtil.getConnectionUrl(info, conf); } else if (args.size() == 1) { url = args.get(0); } else { throw new RuntimeException( "0 or 1 argument expected. Received " + Arrays.toString(args.toArray())); } boolean isMetricOn = conf.getBoolean(PHOENIX_QUERY_SERVER_METRICS, DEFAULT_PHOENIX_QUERY_SERVER_METRICS); if (isMetricOn) { info.put("pqs_reporting_interval", PqsMetricsSystem.getReportingInterval(conf)); info.put("pqs_filename",PqsMetricsSystem.getSinkFileName(conf)); info.put("pqs_sinktype",PqsMetricsSystem.getTypeOfSink(conf)); info.put(QueryServices.COLLECT_REQUEST_LEVEL_METRICS, "true"); return new PQSMetricsMeta(url, info); } else { return new JdbcMeta(url, info); } } catch (SQLException | ClassNotFoundException e) { throw new RuntimeException(e); } }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mMapView = findViewById(R.id.mapView); ArcGISMap map = new ArcGISMap(Basemap.createStreets()); mMapView.setMap(map); AuthenticationManager.setAuthenticationChallengeHandler(this); mRecyclerView = findViewById(R.id.recyclerView); mRecyclerView.setLayoutManager(new LinearLayoutManager(this)); Button searchPublicButton = findViewById(R.id.searchPublicButton); searchPublicButton.setOnClickListener(v -> { <START> searchPortal(new Portal(getString(R.string.arcgis_url))); <END> }); mPortalLoadStateView = findViewById(R.id.portalLoadState); mPortalLoadStateView.setVisibility(View.GONE); mLoadStateTextView = findViewById(R.id.loadStateTextView); Button searchSecureButton = findViewById(R.id.searchSecureButton); EditText portalUrlEditText = findViewById(R.id.portalUrlEditText); searchSecureButton.setOnClickListener(v -> { String securedPortalUrl = portalUrlEditText.getText().toString(); if (!securedPortalUrl.isEmpty()) { searchPortal(new Portal(securedPortalUrl, true)); } else { String error = "Portal URL is empty. Please enter a portal URL."; Toast.makeText(this, error, Toast.LENGTH_LONG).show(); Log.e(TAG, error); } }); mLoadWebMapTextView = findViewById(R.id.loadedWebMapTextView); }</code><technical_language>I a bit confused behavior of "Search public" code. Do intend search ArcGIS Online? If so, I text of this button "Search Online" explain this button search ArcGIS online anonymous user in Readme page. If intention of this button is search a portal is in portal url text box anonymous user, impression, url passed Portal constructor portal url text box instead of this string resource. I missing something</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mMapView = findViewById(R.id.mapView); ArcGISMap map = new ArcGISMap(Basemap.createStreets()); mMapView.setMap(map); AuthenticationManager.setAuthenticationChallengeHandler(this); mRecyclerView = findViewById(R.id.recyclerView); mRecyclerView.setLayoutManager(new LinearLayoutManager(this)); Button searchPublicButton = findViewById(R.id.searchPublicButton); searchPublicButton.setOnClickListener(v -> { searchPortal(new Portal(getString(R.string.arcgis_url))); }); mPortalLoadStateView = findViewById(R.id.portalLoadState); mPortalLoadStateView.setVisibility(View.GONE); mLoadStateTextView = findViewById(R.id.loadStateTextView); mLoadWebMapTextView = findViewById(R.id.loadedWebMapTextView); Button searchSecureButton = findViewById(R.id.searchSecureButton); EditText portalUrlEditText = findViewById(R.id.portalUrlEditText); searchSecureButton.setOnClickListener(v -> { String securedPortalUrl = portalUrlEditText.getText().toString(); if (!securedPortalUrl.isEmpty()) { searchPortal(new Portal(securedPortalUrl, true)); } else { String error = "Portal URL is empty. Please enter a portal URL."; Toast.makeText(this, error, Toast.LENGTH_LONG).show(); Log.e(TAG, error); } }); }
Source:
<code>public void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case CAMERA_REQUEST: case REQUEST_CHOOSER: if (resultCode == Activity.RESULT_OK && requestCode == CAMERA_REQUEST) { <START> if(mTempImageFile == null || !mTempImageFile.exists()) <END> return; IndexedFolder dir = mContentManager.getCurrentFolder(); mContentManager.addFile(dir, mTempImageFile, new IOnResult<IndexedFile>() { @Override public void onResult(IndexedFile result) { if (result != null) { ArrayList<IndexedItem> itemList = new ArrayList<IndexedItem>(); itemList.add(result); actionLock(itemList); Utils.toast(R.string.content_success_add); } else { Utils.toast(R.string.content_fail_add); } } }); } break; } }</code><technical_language>Code style #71</technical_language>

Target:
public void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case CAMERA_REQUEST: case REQUEST_CHOOSER: if (resultCode == Activity.RESULT_OK) { File dataFile = null; if (data == null) { Utils.d("Oops... Result was OK, but intent was null. That's just great."); dataFile = mTempImageFile; } else { dataFile = FileUtils.getFile(getActivity(), data.getData()); } if (dataFile == null || !dataFile.exists()) { Utils.d("Empty result was found!"); return; } IndexedFolder dir = mContentManager.getCurrentFolder(); mContentManager.addFile(dir, dataFile, new IOnResult<IndexedFile>() { @Override public void onResult(IndexedFile result) { if (result != null) { ArrayList<IndexedItem> itemList = new ArrayList<IndexedItem>(); itemList.add(result); actionLock(itemList, mMode); Utils.toast(R.string.content_success_add); } else { Utils.toast(R.string.content_fail_add); } } }); } break; } }
Source:
<code>public void logsSlowestOperationIfMultipleOperationsExceedTheSlowThresholdIfFirst() { accumulateLogsWithCall(TWO_CENTURIES, profilingTimelockService::getFreshTimestamp); flushLogsWithCall(TWO_CENTURIES, profilingTimelockService::startIdentifiedAtlasDbTransaction); <START> verifyLoggerInvokedOnceWithSpecificProfile("getFreshTimestamp", TWO_CENTURIES); <END> }</code><technical_language>confused select getFreshTimestamp? is one</technical_language>

Target:
public void logsSlowestOperationIfMultipleOperationsExceedTheSlowThresholdIfFirst() { accumulateLogsWithCall(TWO_CENTURIES, profilingTimelockService::getFreshTimestamp); flushLogsWithCall(LONG_DURATION, profilingTimelockService::startIdentifiedAtlasDbTransaction); verifyLoggerInvokedOnceWithSpecificProfile("getFreshTimestamp", TWO_CENTURIES); }
Source:
<code>public boolean isHttpsAllowAnyCertificate() { <START> return WebProperties.WEB_HTTPS_ALLOW_ANY_CERTIFICATE.getValueAsBoolean(); <END> }</code><technical_language>return false default</technical_language>

Target:
public boolean isHttpsAllowAnyCertificate() { return getBooleanValue(HTTPS_ALLOW_ANY_CERTIFICATE, false); }
Source:
<code>public Page<TaskId> getTaskIds(String taskTag, long from, long to, boolean mytasks, boolean running, boolean pending, boolean finished, int offset, int limit) throws NotConnectedException, PermissionException { RestPageParameters params = new RestPageParameters(frontendState, "getTaskIds", from, to, mytasks, <START> running, pending, finished, offset, limit, taskTag, null); <END> Page<TaskInfo> pTaskInfo; pTaskInfo = dbManager.getTasks(params.getFrom(), params.getTo(), params.getTag(), params.getOffset(), params.getLimit(), params.getUserName(), params.isPending(), params.isRunning(), params.isFinished()); List<TaskId> lTaskId = new ArrayList<TaskId>(pTaskInfo.getList().size()); for (TaskInfo taskInfo : pTaskInfo.getList()) { lTaskId.add(taskInfo.getTaskId()); } return new Page<TaskId>(lTaskId, pTaskInfo.getSize()); }</code><technical_language>cleaner OO point of view pass instance of SortSpecifierContainer contains sort item. This ways, _null_ checks avoided. This special instance of SortSpecifierContainer cached in a static field is publicly available</technical_language>

Target:
public Page<TaskId> getTaskIds(String taskTag, long from, long to, boolean mytasks, boolean running, boolean pending, boolean finished, int offset, int limit) throws NotConnectedException, PermissionException { RestPageParameters params = new RestPageParameters(frontendState, "getTaskIds", from, to, mytasks, running, pending, finished, offset, limit, taskTag, SortSpecifierContainer.EMPTY_CONTAINER); Page<TaskInfo> pTaskInfo; pTaskInfo = dbManager.getTasks(params.getFrom(), params.getTo(), params.getTag(), params.getOffset(), params.getLimit(), params.getUserName(), params.isPending(), params.isRunning(), params.isFinished()); List<TaskId> lTaskId = new ArrayList<TaskId>(pTaskInfo.getList().size()); for (TaskInfo taskInfo : pTaskInfo.getList()) { lTaskId.add(taskInfo.getTaskId()); } return new Page<TaskId>(lTaskId, pTaskInfo.getSize()); }
Source:
<code>public void start() throws Exception { Preconditions.checkState(state.compareAndSet(State.LATENT, State.STARTED), "Cannot be started more than once"); <START> final ExecutorService executor = ThreadUtils.newSingleThreadExecutor(""); <END> executor.submit(new Runnable() { @Override public void run() { try { client.blockUntilConnected(); client.getConnectionStateListenable().addListener(listener); reset(); } catch(Exception ex) { log.error("An error occurred checking resetting leadership.", ex); } finally { executor.shutdown(); } } }); }</code><technical_language>Pass in name of class instead of ""</technical_language>

Target:
public void start() throws Exception { Preconditions.checkState(state.compareAndSet(State.LATENT, State.STARTED), "Cannot be started more than once"); ExecuteAfterConnectionEstablished.executeAfterConnectionEstablishedInBackground(LeaderLatch.class.getName(), client, new Runnable() { @Override public void run() { try { client.getConnectionStateListenable().addListener(listener); reset(); } catch(Exception ex) { log.error("An error occurred checking resetting leadership.", ex); } } }); }
Source:
<code>private void processResources(File destDir) throws IOException { for (Resource res : config.getResources()) { res.walk(new Walker() { @Override public boolean processDir(Resource resource, File dir, File destDir) throws IOException { return true; } @Override public void processFile(Resource resource, File file, File destDir) throws IOException { String filename = file.getName().toLowerCase(); if (filename.endsWith(".storyboard") || filename.endsWith(".xib")) { try { List<String> customClasses = findCustomClassesInIBFile(file); config.addCustomIBClasses(customClasses); } catch (XMLStreamException | IOException e) { <START> e.printStackTrace(); <END> } } } }, destDir); } }</code><technical_language>want config.getLogger().xxx here</technical_language>

Target:
private void processResources(File destDir) throws IOException { for (Resource res : config.getResources()) { res.walk(new Walker() { @Override public boolean processDir(Resource resource, File dir, File destDir) throws IOException { return true; } @Override public void processFile(Resource resource, File file, File destDir) throws IOException { String filename = file.getName().toLowerCase(); if (filename.endsWith(".storyboard") || filename.endsWith(".xib")) { try { List<String> customClasses = findCustomClassesInIBFile(file); config.addCustomIBClasses(customClasses); } catch (XMLStreamException | IOException e) { if (config.getHome().isDev()) { e.printStackTrace(); } } } } }, destDir); } }
Source:
<code>public ComplexMetricExtractor getExtractor() { return new ComplexMetricExtractor() { @Override public Class<?> extractedClass() { return MomentSketchWrapper.class; } @Override public Object extractValue(final InputRow inputRow, final String metricName) { Object rawValue = inputRow.getRaw(metricName); <START> if (rawValue instanceof MomentSketchWrapper) { <END> return (MomentSketchWrapper) rawValue; } else { throw new IAE("Not a momentSketch"); } } }; }</code><technical_language>This explicitness add a lot of value, cast throw ClassCastException. log wrong class, current code</technical_language>

Target:
public ComplexMetricExtractor getExtractor() { return new ComplexMetricExtractor() { @Override public Class<?> extractedClass() { return MomentSketchWrapper.class; } @Override public Object extractValue(final InputRow inputRow, final String metricName) { return (MomentSketchWrapper) inputRow.getRaw(metricName); } }; }
Source:
<code>public void testCreateFromConfigLoader() throws Exception { PowerMockito.spy(ClusterBasedJobCoordinator.class); Map<String, String> config = new HashMap<>(); config.put(ApplicationConfig.APP_CLASS, MockStreamApplication.class.getCanonicalName()); config.put(JobConfig.CONFIG_LOADER_FACTORY, PropertiesConfigLoaderFactory.class.getCanonicalName()); config.put(PropertiesConfigLoaderFactory.CONFIG_LOADER_PROPERTIES_PREFIX + "path", getClass().getResource("/test.properties").getPath()); PowerMockito.doAnswer(invocation -> invocation.getArgumentAt(0, Config.class)) .when(ClusterBasedJobCoordinator.class, "prepareJob", any()); PowerMockito.whenNew(ClusterBasedJobCoordinator.class).withAnyArguments().thenReturn(mock(ClusterBasedJobCoordinator.class)); PowerMockito.whenNew(CoordinatorStreamStore.class).withAnyArguments().thenReturn(mock(CoordinatorStreamStore.class)); ClusterBasedJobCoordinator.createFromConfigLoader(new MapConfig(config)); <START> verifyPrivate(ClusterBasedJobCoordinator.class).invoke("prepareJob", any()); verifyNew(ClusterBasedJobCoordinator.class).withArguments(any(), any(), any()); <END> }</code><technical_language>Is practical do more-specific validation arguments here</technical_language>

Target:
public void testCreateFromConfigLoader() throws Exception { Map<String, String> config = new HashMap<>(); config.put(ApplicationConfig.APP_CLASS, MockStreamApplication.class.getCanonicalName()); config.put(JobConfig.CONFIG_LOADER_FACTORY, PropertiesConfigLoaderFactory.class.getCanonicalName()); config.put(PropertiesConfigLoaderFactory.CONFIG_LOADER_PROPERTIES_PREFIX + "path", getClass().getResource("/test.properties").getPath()); Config submissionConfig = new MapConfig(config); JobConfig fullJobConfig = new JobConfig(ConfigUtil.loadConfig(submissionConfig)); RemoteJobPlanner mockJobPlanner = mock(RemoteJobPlanner.class); CoordinatorStreamStore mockCoordinatorStreamStore = mock(CoordinatorStreamStore.class); PowerMockito.whenNew(ClusterBasedJobCoordinator.class).withAnyArguments().thenReturn(mock(ClusterBasedJobCoordinator.class)); PowerMockito.doReturn(new MapConfig()).when(CoordinatorStreamUtil.class, "buildCoordinatorStreamConfig", any()); PowerMockito.whenNew(CoordinatorStreamStore.class).withAnyArguments().thenReturn(mockCoordinatorStreamStore); PowerMockito.whenNew(RemoteJobPlanner.class).withAnyArguments().thenReturn(mockJobPlanner); when(mockJobPlanner.prepareJobs()).thenReturn(Collections.singletonList(fullJobConfig)); ClusterBasedJobCoordinator.createFromConfigLoader(submissionConfig); verifyNew(ClusterBasedJobCoordinator.class).withArguments(any(MetricsRegistryMap.class), eq(mockCoordinatorStreamStore), eq(fullJobConfig)); }
Source:
<code>private static boolean isInCorrectPackage(@NotNull GoFunctionOrMethodDeclaration element) { GoFile containingFile = element.getContainingFile(); <START> GoPackageClause filePackage = containingFile.getPackage(); <END> if (filePackage == null || filePackage.getIdentifier() == null || containingFile.getImportPath() == null) { return false; } String packageName = filePackage.getIdentifier().getText(); String packageImportPath = containingFile.getImportPath(); return (packageName.equals("fmt") && packageImportPath.equals("fmt")) || (packageName.equals("log") && packageImportPath.equals("log")); }</code><technical_language>is GoFile#getPackageName. Btw, request check package name. import path is enough. do think</technical_language>

Target:
private static boolean isInCorrectPackage(@NotNull GoFunctionOrMethodDeclaration element) { GoFile containingFile = element.getContainingFile(); return FORMATTING_FUNCTIONS.containsKey(getName(element)) && ("fmt".equals(containingFile.getImportPath()) || "log".equals(containingFile.getImportPath())); }