auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void shiftRows(int startRow, int endRow, final int n, boolean copyRowHeight, boolean resetOriginalRowHeight) { XSSFVMLDrawing vml = getVMLDrawing(false); int sheetIndex = getWorkbook().getSheetIndex(this); String sheetName = getWorkbook().getSheetName(sheetIndex); FormulaShifter shifter = FormulaShifter.createForRowShift( sheetIndex, sheetName, startRow, endRow, n, SpreadsheetVersion.EXCEL2007); removeOverwritten(vml, startRow, endRow, n); XSSFRowShifter rowShifter = new XSSFRowShifter(this, shifter); rowShifter.doShiftingAndProcessComments(vml, startRow, endRow, n, copyRowHeight, rowIterator(), sheetComments); rowShifter.shiftMergedRegions(startRow, endRow, n); XSSFShiftingManager shiftingManager = new XSSFShiftingManager(this, shifter); shiftingManager.updateNamedRanges(); shiftingManager.updateFormulas(); shiftingManager.updateConditionalFormatting(); shiftingManager.updateHyperlinks(); <START> Map<Integer, XSSFRow> map = new HashMap<Integer, XSSFRow>(); <END> for(XSSFRow r : _rows.values()) { final Integer rownumI = new Integer(r.getRowNum()); map.put(rownumI, r); } _rows.clear(); _rows.putAll(map); }</code><technical_language>HashMap<></technical_language>

Target:
public void shiftRows(int startRow, int endRow, final int n, boolean copyRowHeight, boolean resetOriginalRowHeight) { XSSFVMLDrawing vml = getVMLDrawing(false); int sheetIndex = getWorkbook().getSheetIndex(this); String sheetName = getWorkbook().getSheetName(sheetIndex); FormulaShifter formulaShifter = FormulaShifter.createForRowShift( sheetIndex, sheetName, startRow, endRow, n, SpreadsheetVersion.EXCEL2007); removeOverwritten(vml, startRow, endRow, n); shiftCommentsAndRows(vml, startRow, endRow, n); XSSFRowShifter rowShifter = new XSSFRowShifter(this); rowShifter.shiftMergedRegions(startRow, endRow, n); rowShifter.updateNamedRanges(formulaShifter); rowShifter.updateFormulas(formulaShifter); rowShifter.updateConditionalFormatting(formulaShifter); rowShifter.updateHyperlinks(formulaShifter); Map<Integer, XSSFRow> map = new HashMap<>(); for(XSSFRow r : _rows.values()) { final Integer rownumI = new Integer(r.getRowNum()); map.put(rownumI, r); } _rows.clear(); _rows.putAll(map); }
Source:
<code>public int getSubscriberCount() { MessageDispatcher dispatcher = getRequiredDispatcher(); if (dispatcher instanceof AbstractDispatcher) { return ((AbstractDispatcher) dispatcher).getHandlerCount(); } <START> return this.handlerCounter.get(); <END> }</code><technical_language>this counter is contract requires AbstractSubscribableChannel, pull getHandlerCount() contract MessageDispatcher directly? Yeah, for master, of course, is point this persistent odd logic. WDYT? Otherwise, yes, is complain I merge cherry-pick</technical_language>

Target:
public int getSubscriberCount() { return getRequiredDispatcher().getHandlerCount(); }
Source:
<code><START> public RtCollaborators(final Request req, final Repo repo) { <END> this.entry = req; final Coordinates coords = repo.coordinates(); this.request = this.entry.uri() .path("/repos") .path(coords.user()) .path(coords.repo()) .path("/collaborators") .back(); this.owner = repo; }</code><technical_language>public, done in RtIssue</technical_language>

Target:
RtCollaborators(final Request req, final Repo repo) { this.entry = req; final Coordinates coords = repo.coordinates(); this.request = this.entry.uri() .path("/repos") .path(coords.user()) .path(coords.repo()) .path("/collaborators") .back(); this.owner = repo; }
Source:
<code>public synchronized void updateSolrPassword() { if (configuredToAttemptAutoPasswordChange() && isUsingDefaultPassword()) { initialize(); generatePassword(); setPasswordInSolr(); if (isSolrPasswordChangeSuccessfull()) { <START> setPasswordInMemory(); <END> setPasswordInPropertiesFile(); } } }</code><technical_language>if saving a file fails? Memory updated making work for restart, system work anymore ..</technical_language>

Target:
public synchronized void updateSolrPassword() { try { run(); } finally { cleanup(); } }
Source:
<code>private static List<CharValues> buildCharValues(final Dataset dataset, final DatasetDto datasetDto, final Map<String, SampleDTO> sampleDTOMap, final Map<String, Marker> markerMap) { <START> List<CharValues> charValuesList = new ArrayList<>(); <END> int row = 0; for (final DatasetDto.SampleKey sampleKey : datasetDto.getSampleAccesions()) { int column = 0; for (final String marker : datasetDto.getMarkers()) { final CharValues charValues = new CharValues(); final Sample sample = new Sample(); sample.setSampleId(sampleDTOMap.get(sampleKey.getSampleUID()).getSampleId()); charValues.setDataset(dataset); charValues.setSample(sample); charValues.setCharValue(getCharData(datasetDto.getCharValues()[row][column])); charValues.setMarkerId(markerMap.get(marker).getMarkerId()); charValues.setAccSampleId(sampleKey.getAccesion()); charValuesList.add(charValues); column++; } row++; } return charValuesList; }</code><technical_language>Please add final</technical_language>

Target:
private static List<CharValues> buildCharValues(final Dataset dataset, final DatasetDto datasetDto, final Map<String, SampleDTO> sampleDTOMap, final Map<String, Marker> markerMap) { final List<CharValues> charValuesList = new ArrayList<>(); int row = 0; for (final DatasetDto.SampleKey sampleKey : datasetDto.getSampleAccesions()) { int column = 0; for (final String marker : datasetDto.getMarkers()) { final CharValues charValues = new CharValues(); final Sample sample = new Sample(); sample.setSampleId(sampleDTOMap.get(sampleKey.getSampleUID()).getSampleId()); charValues.setDataset(dataset); charValues.setSample(sample); charValues.setCharValue(getCharData(datasetDto.getCharValues()[row][column])); charValues.setMarkerId(markerMap.get(marker).getMarkerId()); charValues.setAccSampleId(sampleKey.getAccesion()); charValuesList.add(charValues); column++; } row++; } return charValuesList; }
Source:
<code>private boolean skipEncoding(Object source) { <START> return source == null || isTypeExcluded(source.getClass()); <END> }</code><technical_language>Hrmm, this needed? I if this is a sign of else wrong</technical_language>

Target:
private boolean skipEncoding(Object source) { return isTypeExcluded(source.getClass()); }
Source:
<code>public void testGetProducerInfoNoClient() { SpanCache spanCache = new TestSpanCache(); Span serverSpan = new Span(); serverSpan.setId("1"); serverSpan.setParentId("1"); List<Span> spans = new ArrayList<Span>(); spans.add(serverSpan); try { spanCache.store(null, spans, SpanUniqueIdGenerator::toUnique); <START> } catch (CacheException e) { <END> fail("Failed to store span"); } assertNull(ProducerInfoUtil.getProducerInfo(null, serverSpan, spanCache)); }</code><technical_language>I catch this test Error a failure</technical_language>

Target:
public void testGetProducerInfoNoClient() throws CacheException { SpanCache spanCache = new TestSpanCache(); Span serverSpan = new Span(); serverSpan.setId("1"); serverSpan.setParentId("1"); spanCache.store(null, Arrays.asList(serverSpan), SpanUniqueIdGenerator::toUnique); assertNull(ProducerInfoUtil.getProducerInfo(null, serverSpan, spanCache)); }
Source:
<code>StyleInfo createStyleFromFile(Resource styleFile, ImportTask task) { String ext = FilenameUtils.getExtension(styleFile.name()); if (ext != null) { StyleHandler styleHandler = Styles.handler(ext); if (styleHandler != null) { try { StyledLayerDescriptor sld = styleHandler.parse(styleFile, null, null, new EntityResolverProvider(getGeoServer()).getEntityResolver()); Style style = Styles.style(sld); if (style != null) { StyleInfo info = catalog.getFactory().createStyle(); String styleName = styleGen.generateUniqueStyleName(task.getLayer().getResource()); info.setName(styleName); info.setFilename(styleName + "." +ext); info.setFormat(styleHandler.getFormat()); info.setWorkspace(task.getStore().getWorkspace()); <START> catalog.getResourcePool().writeStyle(info, styleFile.in()); <END> return info; } else { LOGGER.warning("Style file contained no styling: " + styleFile.path()); } } catch(Exception e) { LOGGER.log(Level.WARNING, "Error parsing style: " + styleFile.path(), e); } } else { LOGGER.warning("Unable to find style handler for file extension: " + ext); } } return null; }</code><technical_language>I input stream get closed here, in a cursory code in writeStyle called methods I stream closed</technical_language>

Target:
StyleInfo createStyleFromFile(Resource styleFile, ImportTask task) { String ext = FilenameUtils.getExtension(styleFile.name()); if (ext != null) { StyleHandler styleHandler = Styles.handler(ext); if (styleHandler != null) { try { StyledLayerDescriptor sld = styleHandler.parse(styleFile, null, null, new EntityResolverProvider(getGeoServer()).getEntityResolver()); Style style = Styles.style(sld); if (style != null) { StyleInfo info = catalog.getFactory().createStyle(); String styleName = styleGen.generateUniqueStyleName(task.getLayer().getResource()); info.setName(styleName); info.setFilename(styleName + "." +ext); info.setFormat(styleHandler.getFormat()); info.setWorkspace(task.getStore().getWorkspace()); try (InputStream in = styleFile.in()) { catalog.getResourcePool().writeStyle(info, in); } return info; } else { LOGGER.warning("Style file contained no styling: " + styleFile.path()); } } catch(Exception e) { LOGGER.log(Level.WARNING, "Error parsing style: " + styleFile.path(), e); } } else { LOGGER.warning("Unable to find style handler for file extension: " + ext); } } return null; }
Source:
<code>private void dropAllEntities() { <START> for (MappedEntity mappedEntity : ImmutableList.copyOf(entities.values())) { <END> try { dropEntity(mappedEntity.getEntity()); } catch (final DatabaseEngineException ex) { logger.debug(String.format("Failed to drop entity '%s'", mappedEntity.getEntity().getName()), ex); } } }</code><technical_language>mappedEntity final, a blank lines in this method improve legibility</technical_language>

Target:
private void dropAllEntities() { for (final MappedEntity mappedEntity : ImmutableList.copyOf(entities.values())) { try { dropEntity(mappedEntity.getEntity()); } catch (final DatabaseEngineException ex) { logger.debug(String.format("Failed to drop entity '%s'", mappedEntity.getEntity().getName()), ex); } } }
Source:
<code>public void delete(Set<String> ids) { if (!ids.isEmpty()) { repository().write(writer -> { for (String id : ids) { <START> writer.remove(ValidationWhiteList.class, id); <END> } writer.commit(); return null; }); WhiteListNotification.removed(ids).publish(service(IEventBus.class)); } }</code><technical_language>com.b2international.index.Writer.removeAll(Map<Class<?>, Set<String>>)</technical_language>

Target:
public void delete(Set<String> ids) { objectsToDelete.put(ValidationWhiteList.class, ids); }
Source:
<code>public String getActionProviders(HttpServletRequest request) throws SecurityServiceException { HttpSession session = httpSessionFactory.getOrCreateSession(request); List<SecurityToken> tokenList = ((SecurityTokenHolder) session.getAttribute(SecurityConstants.SAML_ASSERTION)) .getSecurityTokens(); List<Subject> subjectList = new ArrayList<>(); for (SecurityToken token : tokenList) { subjectList.add(securityManager.getSubject(token)); } List<Map<String, String>> actionPropertiesList = new ArrayList<>(); for (ActionProvider actionProvider : logoutActionProviders) { Action action = actionProvider.getAction(subjectList); if (action != null) { <START> if (!tokenList.isEmpty()) { <END> Map<String, String> actionProperties = new HashMap<>(); String displayName = SubjectUtils.getName(subjectList.get(0), "", true); actionProperties.put("title", action.getTitle()); actionProperties.put("auth", displayName); actionProperties.put("description", action.getDescription()); actionProperties.put("url", action.getUrl().toString()); actionPropertiesList.add(actionProperties); } } } return GSON.toJson(actionPropertiesList); }</code><technical_language>I checking subjectList instead of tokenList more clear</technical_language>

Target:
public String getActionProviders(HttpServletRequest request) throws SecurityServiceException { HttpSession session = httpSessionFactory.getOrCreateSession(request); SecurityToken token = ((SecurityTokenHolder) session.getAttribute(SecurityConstants.SAML_ASSERTION)) .getSecurityToken(); Subject subject = securityManager.getSubject(token); List<Map<String, String>> actionPropertiesList = new ArrayList<>(); for (ActionProvider actionProvider : logoutActionProviders) { Map<String, String> actionProperties = new HashMap<>(); Action action = actionProvider.getAction(subject); if (action != null) { String displayName = SubjectUtils.getName(subject, "", true); actionProperties.put("title", action.getTitle()); actionProperties.put("auth", displayName); actionProperties.put("description", action.getDescription()); actionProperties.put("url", action.getUrl().toString()); actionPropertiesList.add(actionProperties); } } return GSON.toJson(actionPropertiesList); }
Source:
<code>public boolean equals(Object o) { if (o instanceof AdvertisedDataSource) { AdvertisedDataSource other = (AdvertisedDataSource)o; if (other.m_generation == m_generation && other.partitionId == partitionId) { <START> return true; <END> } } return false; }</code><technical_language>tableNames compared</technical_language>

Target:
public boolean equals(Object o) { if (o instanceof AdvertisedDataSource) { AdvertisedDataSource other = (AdvertisedDataSource)o; if (other.m_generation == m_generation && other.tableName.equals(tableName) && other.partitionId == partitionId) { return true; } } return false; }
Source:
<code>public String format_timestamp(TimestampType ts, String tz) throws VoltAbortException { if (ts == null) { return null; } if (tz == null) { return ts.toString(); } tz = tz.trim(); long millis = ts.getTime() / 1000; short usecs = ts.getUSec(); Instant fromEpochMilli = Instant.ofEpochMilli(millis); ZoneOffset offset; try { offset = ZonedDateTime.ofInstant(fromEpochMilli, ZoneId.of(tz)).getOffset(); } catch (DateTimeException offsetEx) { <START> throw new VoltAbortException("VOLTDB ERROR: SQL ERROR\n" + " invalid timezone string."); <END> } long offsetInSeconds = offset.getTotalSeconds(); TimestampType convertedTs = new TimestampType(millis * 1000 + usecs + offsetInSeconds * 1000000); return convertedTs.toString(); }</code><technical_language>need remove "VOLTDB ERROR: SQL ERROR\n". error message "Invalid timezone string." (Capitalized I). "VOLTDB ERROR " stuff is added EE. error message this: 6> select format_timestamp(a, 'abc') t; VOLTDB ERROR: SQL ERROR org.voltdb.VoltProcedure$VoltAbortException: VOLTDB ERROR: SQL ERROR invalid timezone string. org.voltdb.sysprocs.AdHoc_RO_SP.run(AdHoc_RO_SP.java:46)</technical_language>

Target:
public String format_timestamp(TimestampType ts, String tz) throws VoltAbortException { if (ts == null) { return null; } if (tz == null) { return ts.toString(); } tz = tz.trim(); long millis = ts.getTime() / 1000; short usecs = ts.getUSec(); Instant fromEpochMilli = Instant.ofEpochMilli(millis); ZoneOffset offset; try { offset = ZonedDateTime.ofInstant(fromEpochMilli, ZoneId.of(tz)).getOffset(); } catch (DateTimeException offsetEx) { throw new VoltAbortException("Invalid timezone string."); } long offsetInSeconds = offset.getTotalSeconds(); TimestampType convertedTs = new TimestampType(millis * 1000 + usecs + offsetInSeconds * 1000000); return convertedTs.toString(); }
Source:
<code>protected String getJBossJavaFlags() { IPath serverHome = getServerHome(); IJBossRuntimeResourceConstants c = new IJBossRuntimeResourceConstants() {}; IServerModeDetails det = (IServerModeDetails)Platform.getAdapterManager().getAdapter(server, IServerModeDetails.class); String basedir = det.getProperty(IServerModeDetails.PROP_SERVER_BASE_DIR_ABS); IPath base = new Path(basedir); IPath bootLog = base.append(c.FOLDER_LOG).append(c.AS7_BOOT_LOG); IPath logConfig = base.append(c.CONFIGURATION).append(c.LOGGING_PROPERTIES); String ret = "-Djava.awt.headless=true" + SPACE + QUOTE + SYSPROP + JB7_BOOT_LOG_ARG + EQ + bootLog.toString() + QUOTE + SPACE + QUOTE + SYSPROP + JB7_LOGGING_CONFIG_FILE + EQ + "file:" + logConfig.toString() + QUOTE + <START> SPACE + SYSPROP + "java.util.logging.manager=org.jboss.logmanager.LogManager" + END> SPACE + QUOTE + SYSPROP + JBOSS_HOME_DIR + EQ + serverHome.toString() + QUOTE + SPACE; return ret; }</code><technical_language>this unrelated test refactor</technical_language>

Target:
protected String getJBossJavaFlags() { IPath serverHome = getServerHome(); IJBossRuntimeResourceConstants c = new IJBossRuntimeResourceConstants() {}; IServerModeDetails det = (IServerModeDetails)Platform.getAdapterManager().getAdapter(server, IServerModeDetails.class); String basedir = det.getProperty(IServerModeDetails.PROP_SERVER_BASE_DIR_ABS); IPath base = new Path(basedir); IPath bootLog = base.append(c.FOLDER_LOG).append(c.AS7_BOOT_LOG); IPath logConfig = base.append(c.CONFIGURATION).append(c.LOGGING_PROPERTIES); String ret = "-Djava.awt.headless=true" + SPACE + QUOTE + SYSPROP + JB7_BOOT_LOG_ARG + EQ + bootLog.toString() + QUOTE + SPACE + QUOTE + SYSPROP + JB7_LOGGING_CONFIG_FILE + EQ + "file:" + logConfig.toString() + QUOTE + SPACE + QUOTE + SYSPROP + JBOSS_HOME_DIR + EQ + serverHome.toString() + QUOTE + SPACE; return ret; }
Source:
<code>boolean isConnectionAlive(final Connection connection) { try { if (isUseJdbc4Validation) { <START> return connection.isValid((int) MILLISECONDS.toSeconds(Math.max(1000, validationTimeout))); <END> } setNetworkTimeout(connection, validationTimeout); try (Statement statement = connection.createStatement()) { if (isNetworkTimeoutSupported != TRUE) { setQueryTimeout(statement, (int) MILLISECONDS.toSeconds(Math.max(1000, validationTimeout))); } statement.execute(config.getConnectionTestQuery()); } if (isIsolateInternalQueries && !isReadOnly && !isAutoCommit) { connection.rollback(); } setNetworkTimeout(connection, networkTimeout); return true; } catch (SQLException e) { lastConnectionFailure.set(e); LOGGER.warn("{} - Failed to validate connection ({})", poolName, connection, e.getMessage()); return false; } }</code><technical_language>If validationTimeout is int, incur additional unseen cast: java MILLISECONDS.toSeconds(Math.max(1000, validationTimeout)) ^ Math.max() return int</technical_language>

Target:
boolean isConnectionAlive(final Connection connection) { try { if (isUseJdbc4Validation) { return connection.isValid((int) MILLISECONDS.toSeconds(Math.max(1000L, validationTimeout))); } setNetworkTimeout(connection, validationTimeout); try (Statement statement = connection.createStatement()) { if (isNetworkTimeoutSupported != TRUE) { setQueryTimeout(statement, (int) MILLISECONDS.toSeconds(Math.max(1000L, validationTimeout))); } statement.execute(config.getConnectionTestQuery()); } if (isIsolateInternalQueries && !isReadOnly && !isAutoCommit) { connection.rollback(); } setNetworkTimeout(connection, networkTimeout); return true; } catch (SQLException e) { lastConnectionFailure.set(e); LOGGER.warn("{} - Failed to validate connection ({})", poolName, connection, e.getMessage()); return false; } }
Source:
<code>protected void setup(final SAMFileHeader header, final File samFile) { IOUtil.assertFileIsWritable(CHART_OUTPUT); if (SUMMARY_OUTPUT != null) IOUtil.assertFileIsWritable(SUMMARY_OUTPUT); try{ saveHeader = header.getReadGroups().get(0).getLibrary(); } catch (Exception ignored){ <START> saveHeader = "Unavailable"; <END> } }</code><technical_language>more specific message, "ReadGroupsUnavailable"</technical_language>

Target:
protected void setup(final SAMFileHeader header, final File samFile) { IOUtil.assertFileIsWritable(CHART_OUTPUT); if (SUMMARY_OUTPUT != null) IOUtil.assertFileIsWritable(SUMMARY_OUTPUT); try{ saveHeader = header.getReadGroups().get(0).getLibrary(); } catch (Exception ignored){ saveHeader = "LibraryNameUnavailable"; } }
Source:
<code>public void testJvmtiAgentStartupAgents() throws Exception { runJvmtiAgentLoadTest((ITestDevice device, String pkg, String apk, String abiName) -> { String startup_dir = null; try { String pwd = device.executeShellCommand( <START> "run-as " + pkg + " --user " + mCurrentUser + " <END> pwd"); if (pwd == null) { throw new RuntimeException("pwd failed"); } pwd = pwd.trim(); if (pwd.isEmpty()) { throw new RuntimeException("pwd failed"); } startup_dir = pwd + "/" + STARTUP_AGENT_DIR; device.executeShellCommand( "run-as " + pkg + " --user " + mCurrentUser + " mkdir " + startup_dir); } catch (Exception e) { throw new RuntimeException("Failed to install startup-agents"); } try { installLibToDataData(device, pkg, abiName, apk, startup_dir, AGENT, AGENT); runAttachTestCmd(device, pkg, ""); runAttachTestCmd(device, pkg, ""); } catch (Exception e) { throw new RuntimeException("Failed startup_agents attaching", e); } finally { try { device.executeShellCommand( "run-as " + pkg + " --user " + mCurrentUser + " rm -rf " + startup_dir); } catch (Exception e) { throw new RuntimeException("Failed to clean up " + startup_dir, e); } } }); }</code><technical_language>factor this out</technical_language>

Target:
public void testJvmtiAgentStartupAgents() throws Exception { runJvmtiAgentLoadTest((ITestDevice device, String pkg, String apk, String abiName) -> { String startup_dir = null; try { startup_dir = getPwd(device, pkg) + "/" + STARTUP_AGENT_DIR; device.executeShellCommand( "run-as " + pkg + " --user " + mCurrentUser + " mkdir " + startup_dir); } catch (Exception e) { throw new RuntimeException("Failed to install startup-agents"); } try { installLibToDataData(device, pkg, abiName, apk, startup_dir, AGENT, AGENT); runAttachTestCmd(device, pkg, ""); runAttachTestCmd(device, pkg, ""); } catch (Exception e) { throw new RuntimeException("Failed startup_agents attaching", e); } finally { try { device.executeShellCommand( "run-as " + pkg + " --user " + mCurrentUser + " rm -rf " + startup_dir); } catch (Exception e) { throw new RuntimeException("Failed to clean up " + startup_dir, e); } } }); }
Source:
<code>public Proxy apply(URI endpoint) { if (!useProxyForSockets && "socket".equals(endpoint.getScheme())) { return Proxy.NO_PROXY; } if (config.getProxy().isPresent()) { SocketAddress addr = new InetSocketAddress(config.getProxy().get().getHostText(), config.getProxy().get() .getPort()); Proxy proxy = new Proxy(config.getType(), addr); <START> <END> final Optional<Credentials> creds = config.getCredentials(); if (creds.isPresent()) { Authenticator authenticator = new Authenticator() { public PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(creds.get().identity, creds.get().credential.toCharArray()); } }; Authenticator.setDefault(authenticator); } return proxy; } if (config.canUseProxyFromJvm()) { return getDefaultProxy(endpoint); } if (config.useSystem()) { System.setProperty("java.net.useSystemProxies", "true"); return getDefaultProxy(endpoint); } return Proxy.NO_PROXY; }</code><technical_language>[nit] Remove this</technical_language>

Target:
public Proxy apply(URI endpoint) { if (!useProxyForSockets && "socket".equals(endpoint.getScheme())) { return Proxy.NO_PROXY; } if (config.getProxy().isPresent()) { SocketAddress addr = new InetSocketAddress(config.getProxy().get().getHostText(), config.getProxy().get() .getPort()); Proxy proxy = new Proxy(config.getType(), addr); final Optional<Credentials> creds = config.getCredentials(); if (creds.isPresent()) { Authenticator authenticator = new Authenticator() { public PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(creds.get().identity, creds.get().credential.toCharArray()); } }; Authenticator.setDefault(authenticator); } return proxy; } if (config.isJvmProxyEnabled()) { return getDefaultProxy(endpoint); } if (config.useSystem()) { System.setProperty("java.net.useSystemProxies", "true"); return getDefaultProxy(endpoint); } return Proxy.NO_PROXY; }
Source:
<code>public void setSortOrder(Integer order, boolean isAscending) { PreferenceManager.setSortOrder(order, mContext, FileStorageUtils.UPLOAD_SORT); PreferenceManager.setSortAscending(isAscending, mContext, FileStorageUtils.UPLOAD_SORT); FileStorageUtils.mSortOrderUpload = order; FileStorageUtils.mSortAscendingUpload = isAscending; if (mFiles != null && mFiles.length > 0) { <START> mFiles = transformVecOCFile(FileStorageUtils.sortFolder(transformFileArray(mFiles), <END> FileStorageUtils.mSortOrderUpload,FileStorageUtils.mSortAscendingUpload)); if (parentList != null) { for (int i = 0; i < mFiles.length; i++) { parentList.setItemChecked(i, false); } } notifyDataSetChanged(); } }</code><technical_language>here. Besides, split parameters lines more readable: mFiles = transformVecOCFile( FileStorageUtils.sortFolder(transformFileArray(mFiles), FileStorageUtils.mSortOrderUpload, FileStorageUtils.mSortAscendingUpload) );</technical_language>

Target:
public void setSortOrder(Integer order, boolean isAscending) { PreferenceManager.setSortOrder(order, mContext, FileStorageUtils.UPLOAD_SORT); PreferenceManager.setSortAscending(isAscending, mContext, FileStorageUtils.UPLOAD_SORT); FileStorageUtils.mSortOrderUpload = order; FileStorageUtils.mSortAscendingUpload = isAscending; if (mFiles != null && mFiles.length > 0) { mFiles = transformVecOCFilesToFilesArr( FileStorageUtils.sortFolder(transformFilesArrToVecOCFiles(mFiles), FileStorageUtils.mSortOrderUpload, FileStorageUtils.mSortAscendingUpload) ); if (parentList != null) { for (int i = 0; i < mFiles.length; i++) { parentList.setItemChecked(i, false); } } notifyDataSetChanged(); } }
Source:
<code>public void connect() throws Exception { super.connect(); if (properties.getSchema() != null && properties.getSchema().length() > 0 && !properties.getUsername().equals(properties.getSchema())) { <START> final Statement stmt = conn.createStatement(); <END> stmt.execute("ALTER SESSION SET CURRENT_SCHEMA=" + properties.getSchema()); stmt.close(); } }</code><technical_language>a try-with-resources, drop _stmt.close();_ below</technical_language>

Target:
public void connect() throws Exception { super.connect(); if (properties.getSchema() != null && properties.getSchema().length() > 0 && !properties.getUsername().equals(properties.getSchema())) { try (final Statement stmt = conn.createStatement()) { stmt.execute("ALTER SESSION SET CURRENT_SCHEMA=" + properties.getSchema()); } } }
Source:
<code>public void shouldRemoveExistingElements() { assertThat(of(1, 2, 3).removeAll(i -> i == 1)).isEqualTo(of(2, 3)); assertThat(of(1, 2, 3).removeAll(i -> i == 2)).isEqualTo(of(1, 3)); assertThat(of(1, 2, 3).removeAll(i -> i == 3)).isEqualTo(of(1, 2)); if (useIsEqualToInsteadOfIsSameAs()) { <START> assertThat(of(1, 2, 3).removeAll(ignore -> true)).isEmpty(); <END> assertThat(of(1, 2, 3).removeAll(ignore -> false)).isEqualTo(of(1, 2, 3)); } }</code><technical_language>this removed of shouldNotRemoveAllNonMatchedElementsFromNonNil()</technical_language>

Target:
public void shouldRemoveExistingElements() { assertThat(of(1, 2, 3).removeAll(i -> i == 1)).isEqualTo(of(2, 3)); assertThat(of(1, 2, 3).removeAll(i -> i == 2)).isEqualTo(of(1, 3)); assertThat(of(1, 2, 3).removeAll(i -> i == 3)).isEqualTo(of(1, 2)); if (useIsEqualToInsteadOfIsSameAs()) { assertThat(of(1, 2, 3).removeAll(ignore -> true)).isEmpty(); assertThat(of(1, 2, 3).removeAll(ignore -> false)).isEqualTo(of(1, 2, 3)); } else { Seq<Integer> seq = of(1, 2, 3); assertThat(seq.removeAll(ignore -> false)).isSameAs(seq); } }
Source:
<code>public MasterParser(final String... args) throws ArgumentParserException { super("helios-master", "Spotify Helios Master", args); final Namespace options = getNamespace(); final InetSocketAddress httpAddress = parseSocketAddress(options.getString(httpArg.getDest())); String masterPassword = System.getenv(ZK_MASTER_PASSWORD_ENVVAR); <START> if (masterPassword == null) { <END> masterPassword = options.getString(zkMasterPassword.getDest()); } final MasterConfig config = new MasterConfig() .setZooKeeperConnectString(getZooKeeperConnectString()) .setZooKeeperSessionTimeoutMillis(getZooKeeperSessionTimeoutMillis()) .setZooKeeperConnectionTimeoutMillis(getZooKeeperConnectionTimeoutMillis()) .setZooKeeperNamespace(getZooKeeperNamespace()) .setZooKeeperClusterId(getZooKeeperClusterId()) .setNoZooKeeperMasterRegistration(getNoZooKeeperRegistration()) .setZooKeeperEnableAcls(getZooKeeperEnableAcls()) .setZooKeeperAgentDigest(options.getString(zkAgentDigest.getDest())) .setZooKeeperMasterPassword(masterPassword) .setDomain(getDomain()) .setName(getName()) .setStatsdHostPort(getStatsdHostPort()) .setRiemannHostPort(getRiemannHostPort()) .setInhibitMetrics(getInhibitMetrics()) .setSentryDsn(getSentryDsn()) .setServiceRegistryAddress(getServiceRegistryAddress()) .setServiceRegistrarPlugin(getServiceRegistrarPlugin()) .setAdminPort(options.getInt(adminArg.getDest())) .setHttpEndpoint(httpAddress) .setKafkaBrokers(getKafkaBrokers()) .setStateDirectory(getStateDirectory()); this.masterConfig = config; }</code><technical_language>isNullOrEmpty</technical_language>

Target:
public MasterParser(final String... args) throws ArgumentParserException { super("helios-master", "Spotify Helios Master", args); final Namespace options = getNamespace(); final InetSocketAddress httpAddress = parseSocketAddress(options.getString(httpArg.getDest())); String masterPassword = System.getenv(ZK_MASTER_PASSWORD_ENVVAR); if (masterPassword == null) { masterPassword = options.getString(zkAclMasterPassword.getDest()); } final MasterConfig config = new MasterConfig() .setZooKeeperConnectString(getZooKeeperConnectString()) .setZooKeeperSessionTimeoutMillis(getZooKeeperSessionTimeoutMillis()) .setZooKeeperConnectionTimeoutMillis(getZooKeeperConnectionTimeoutMillis()) .setZooKeeperClusterId(getZooKeeperClusterId()) .setNoZooKeeperMasterRegistration(getNoZooKeeperRegistration()) .setZooKeeperEnableAcls(getZooKeeperEnableAcls()) .setZookeeperAclAgentUser(getZooKeeperAclAgentUser()) .setZooKeeperAclAgentDigest(options.getString(zkAclAgentDigest.getDest())) .setZookeeperAclMasterUser(getZooKeeperAclMasterUser()) .setZooKeeperAclMasterPassword(masterPassword) .setDomain(getDomain()) .setName(getName()) .setStatsdHostPort(getStatsdHostPort()) .setRiemannHostPort(getRiemannHostPort()) .setInhibitMetrics(getInhibitMetrics()) .setSentryDsn(getSentryDsn()) .setServiceRegistryAddress(getServiceRegistryAddress()) .setServiceRegistrarPlugin(getServiceRegistrarPlugin()) .setAdminPort(options.getInt(adminArg.getDest())) .setHttpEndpoint(httpAddress) .setKafkaBrokers(getKafkaBrokers()) .setStateDirectory(getStateDirectory()); this.masterConfig = config; }
Source:
<code>public void sendException(String description, String service) { try { connection.getClient().event().description(description).service(service).tags("uncaught-exception").send(); } catch (Throwable t) { <START> logger.warn("Riemann error during exception send : " + stackTraceToString(t)); <END> } }</code><technical_language>1. I expect exceptions - user exception riemann exception. 2. loggers support exception stack trace built-in. This is syntax: logger.warn("Riemann error exception send",t);</technical_language>

Target:
public void sendException(String description, String service) { try { connection.getClient().event().description(description).service(service).tags("uncaught-exception").send(); } catch (Throwable t) { logger.warn("Riemann error during exception ("+description+") send attempt: ", t); } }
Source:
<code>default void logWarning(final ClientRuntimeError error) { <START> warn("[WARNING] DMNClientService could not get the asset list."); <END> warn(error.getMessage()); }</code><technical_language>I this message fromDMNIncludeModelsClient? this is general method for logging, I here</technical_language>

Target:
default void logWarning(final ClientRuntimeError error) { warn(error.getMessage()); }
Source:
<code>public OAuth2TokenValidatorResult validate(Jwt token) { Assert.notNull(token, "token cannot be null"); try { T claim = (T) token.getClaims().get(this.claim); return Optional.ofNullable(claim) .filter(test::test) .map(result -> OAuth2TokenValidatorResult.success()) .orElse(OAuth2TokenValidatorResult.failure(error)); } catch(ClassCastException ex) { <START> throw new RuntimeException("The " <END> + this.claim + " claim type and the provided test type mismatches"); } }</code><technical_language>This of application misconfiguration, please allow ClassCastException propagate. recommend simply doing: java T = token.getClaim(this.claim); // ... test</technical_language>

Target:
public OAuth2TokenValidatorResult validate(Jwt token) { Assert.notNull(token, "token cannot be null"); T claimValue = token.getClaim(this.claim); if (test.test(claimValue)) { return OAuth2TokenValidatorResult.success(); } else { return OAuth2TokenValidatorResult.failure(error); } }
Source:
<code><START> public synchronized void addEntry(String url) { <END> if (entries==null) entries = new ArrayList<String>(); entries.add(url); }</code><technical_language>is this synchronized? field is package-private private, convinced this synchronization model: unsafe, if in current calls do stuff in added if leave folk accessing field directly</technical_language>

Target:
public synchronized void addEntry(String url) { if (entries==null) entries = new CopyOnWriteArrayList<String>(); entries.add(url); }
Source:
<code><START> public void setProject(IProject project) { <END> this.project=project; }</code><technical_language>Do need this method public ? place is in package protected/default work</technical_language>

Target:
protected void setProject(IProject project) { this.project=project; }
Source:
<code>public Mono<ResponseEntity<?>> queryStatistics() { <START> return handleExceptions( <END> () -> scheduler.wrapBlocking(() -> ok(statisticsConverter.convert(statisticsService.getStatistics())))); }</code><technical_language>this wrapBlocking moved handleExceptions? create handleExceptionsAndWrap helper for it</technical_language>

Target:
public Mono<ResponseEntity<?>> queryStatistics() { return handleExceptions(() -> wrapBlocking(() -> ok(statisticsConverter.convert(statisticsService.getStatistics())))); }
Source:
<code>private boolean hasStashedCommits(final Repository repository) { try { return <START> repository.findRef(Constants.R_STASH) <END> != null; } catch (IOException e) { return false; } }</code><technical_language>exactRef</technical_language>

Target:
private boolean hasStashedCommits(final Repository repository) { try { return repository.exactRef(Constants.R_STASH) != null; } catch (IOException e) { return false; } }
Source:
<code>@Override protected DynamicFeature getAuthDynamicFeature(ContainerRequestFilter authFilter) { final Authenticator<BasicCredentials, JsonPrincipal> jsonAuthenticator = credentials -> { if (credentials.getUsername().equals(JSON_USERNAME)) { <START> return Optional.<JsonPrincipal>of(new JsonPrincipal(credentials.getUsername())); <END> } else { return Optional.empty(); } }; final Authenticator<BasicCredentials, NullPrincipal> nullAuthenticator = credentials -> { if (credentials.getUsername().equals(NULL_USERNAME)) { return Optional.<NullPrincipal>of(new NullPrincipal()); } else { return Optional.empty(); } }; final BasicCredentialAuthFilter jsonAuthFilter = new BasicCredentialAuthFilter.Builder<JsonPrincipal>() .setAuthenticator(jsonAuthenticator) .buildAuthFilter(); final BasicCredentialAuthFilter nullAuthFilter = new BasicCredentialAuthFilter.Builder<NullPrincipal>() .setAuthenticator(nullAuthenticator) .buildAuthFilter(); return new PolymorphicAuthDynamicFeature(ImmutableMap.of( JsonPrincipal.class, jsonAuthFilter, NullPrincipal.class, nullAuthFilter )); }</code><technical_language>Java 8 compiler infer explicit type arguments, I beleive <JsonPrincipal> is redundant</technical_language>

Target:
@Override protected DynamicFeature getAuthDynamicFeature(ContainerRequestFilter authFilter) { final Authenticator<BasicCredentials, JsonPrincipal> jsonAuthenticator = credentials -> { if (credentials.getUsername().equals(JSON_USERNAME)) { return Optional.of(new JsonPrincipal(credentials.getUsername())); } else { return Optional.empty(); } }; final Authenticator<BasicCredentials, NullPrincipal> nullAuthenticator = credentials -> { if (credentials.getUsername().equals(NULL_USERNAME)) { return Optional.of(new NullPrincipal()); } else { return Optional.empty(); } }; final BasicCredentialAuthFilter jsonAuthFilter = new BasicCredentialAuthFilter.Builder<JsonPrincipal>() .setAuthenticator(jsonAuthenticator) .buildAuthFilter(); final BasicCredentialAuthFilter nullAuthFilter = new BasicCredentialAuthFilter.Builder<NullPrincipal>() .setAuthenticator(nullAuthenticator) .buildAuthFilter(); return new PolymorphicAuthDynamicFeature<Principal>(ImmutableMap.of( JsonPrincipal.class, jsonAuthFilter, NullPrincipal.class, nullAuthFilter )); }
Source:
<code>public void getRadiologyOrders_shouldReturnAllRadiologyOrdersForGivenUrgency() throws Exception { Patient patient = patientService.getPatient(PATIENT_ID_WITH_ONE_VOIDED_AND_TWO_NON_VOIDED_RADIOLOGY_ORDERS); RadiologyOrderSearchCriteria radiologyOrderSearchCriteria = <START> new RadiologyOrderSearchCriteria.Builder().withPatient(patient) <END> .withUrgency(Urgency.STAT) .build(); List<RadiologyOrder> radiologyOrders = radiologyOrderService.getRadiologyOrders(radiologyOrderSearchCriteria); assertThat(radiologyOrders.size(), is(2)); for (RadiologyOrder radiologyOrder : radiologyOrders) { assertThat(radiologyOrder.getUrgency(), is(Urgency.STAT)); } }</code><technical_language>@bgeVam add patient</technical_language>

Target:
public void getRadiologyOrders_shouldReturnAllRadiologyOrdersForGivenUrgency() throws Exception { RadiologyOrderSearchCriteria radiologyOrderSearchCriteria = new RadiologyOrderSearchCriteria.Builder().withUrgency(Urgency.STAT) .build(); List<RadiologyOrder> radiologyOrders = radiologyOrderService.getRadiologyOrders(radiologyOrderSearchCriteria); assertThat(radiologyOrders.size(), is(5)); for (RadiologyOrder radiologyOrder : radiologyOrders) { assertThat(radiologyOrder.getUrgency(), is(Urgency.STAT)); } }
Source:
<code>protected String getUrlValue() { <START> return getUrlField().getSelectedItem().toString(); <END> }</code><technical_language>This needs check for null (no item selected): 40220 [AWT-EventQueue-1] ERROR org.zaproxy.zap.ZAP$UncaughtExceptionLogger - Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException org.zaproxy.zap.extension.quickstart.launch.LaunchPanel.getUrlValue(LaunchPanel.java:245) org.zaproxy.zap.extension.quickstart.launch.LaunchPanel$3.actionPerformed(LaunchPanel.java:197)</technical_language>

Target:
protected String getUrlValue() { Object item = getUrlField().getSelectedItem(); if (item != null) { return item.toString(); } return null; }
Source:
<code>private void stage(final IStructuredSelection selection) { awaitStageThread(); <START> stageThread = new Thread() { <END> public void run() { syncLockUI(); try { Git git = new Git(currentRepository); AddCommand add = null; RmCommand rm = null; Iterator iterator = selection.iterator(); while (iterator.hasNext()) { StagingEntry entry = (StagingEntry) iterator.next(); switch (entry.getState()) { case ADDED: case CHANGED: case REMOVED: break; case CONFLICTING: case MODIFIED: case PARTIALLY_MODIFIED: case UNTRACKED: if (add == null) add = git.add(); add.addFilepattern(entry.getPath()); break; case MISSING: if (rm == null) rm = git.rm(); rm.addFilepattern(entry.getPath()); break; } } if (add != null) try { add.call(); } catch (NoFilepatternException e1) { } catch (Exception e2) { Activator.error(e2.getMessage(), e2); } if (rm != null) try { rm.call(); } catch (NoFilepatternException e) { } catch (Exception e2) { Activator.error(e2.getMessage(), e2); } } finally { syncUnlockUI(); } } }; stageThread.start(); }</code><technical_language>This done in a Job, in a Thread. user is running, cancel it, etc</technical_language>

Target:
private void stage(final IStructuredSelection selection) { awaitStageThread(); stageThread = new Thread() { public void run() { asyncLockUI(); try { Git git = new Git(currentRepository); AddCommand add = null; RmCommand rm = null; Iterator iterator = selection.iterator(); while (iterator.hasNext()) { StagingEntry entry = (StagingEntry) iterator.next(); switch (entry.getState()) { case ADDED: case CHANGED: case REMOVED: break; case CONFLICTING: case MODIFIED: case PARTIALLY_MODIFIED: case UNTRACKED: if (add == null) add = git.add(); add.addFilepattern(entry.getPath()); break; case MISSING: if (rm == null) rm = git.rm(); rm.addFilepattern(entry.getPath()); break; } } if (add != null) try { add.call(); } catch (NoFilepatternException e1) { } catch (Exception e2) { Activator.error(e2.getMessage(), e2); } if (rm != null) try { rm.call(); } catch (NoFilepatternException e) { } catch (Exception e2) { Activator.error(e2.getMessage(), e2); } } finally { asyncUnlockUI(); } } }; stageThread.start(); }
Source:
<code>public void onResponse(ReplicaId replicaId, boolean isSuccessFul) { inflightCount--; if (isSuccessFul) { succeededCount++; } else { failedCount++; } <START> getTracker(replicaId).update(time.milliseconds() - replicaRequestSendTimes.remove(replicaId)); <END> }</code><technical_language>wondering histogram updated for successful responses - in theory, failures in early (failed send time for some reason) late (timeouts)</technical_language>

Target:
public void onResponse(ReplicaId replicaId, boolean isSuccessFul) { super.onResponse(replicaId, isSuccessFul); long elapsedTime; if (unexpiredRequestSendTimes.containsKey(replicaId)) { elapsedTime = time.milliseconds() - unexpiredRequestSendTimes.remove(replicaId); } else { elapsedTime = time.milliseconds() - expiredRequestSendTimes.remove(replicaId); } getLatencyHistogram(replicaId).update(elapsedTime); }
Source:
<code>private void doPublish(EventMessage<?> message, T target) { <START> getHandler(message, target).ifPresent(h -> { <END> try { h.handle(message, target); } catch (Exception e) { throw new MessageHandlerInvocationException( format("Error handling event of type [%s] in aggregate", message.getPayloadType()), e); } }); children.forEach(i -> i.publish(message, target)); }</code><technical_language>provide entire target if target class</technical_language>

Target:
private void doPublish(EventMessage<?> message, T target) { getHandler(message, target.getClass()).ifPresent(h -> { try { h.handle(message, target); } catch (Exception e) { throw new MessageHandlerInvocationException( format("Error handling event of type [%s] in aggregate", message.getPayloadType()), e); } }); children.forEach(i -> i.publish(message, target)); }
Source:
<code>public <T> T request(Class<T> type) throws CamelExecutionException { validate(); T result; if (type == Exchange.class) { result = (T)template().request(endpoint, processorSupplier.get()); } else if (type == Message.class) { <START> result = (T)template().request(endpoint, processorSupplier.get()).getIn(); <END> } else { Exchange exchange = template().send(endpoint, ExchangePattern.InOut, processorSupplier.get()); result = context.getTypeConverter().convertTo( type, ExchangeHelper.extractResultBody(exchange, exchange.getPattern()) ); } return result; }</code><technical_language>Ah need return OUT instead. do a hasOut ? getOut : getIn code exchange, correct Message instance is returned</technical_language>

Target:
public <T> T request(Class<T> type) throws CamelExecutionException { T result; if (type == Exchange.class) { result = (T)template().request(endpoint, processorSupplier.get()); } else if (type == Message.class) { Exchange exchange = template().request(endpoint, processorSupplier.get()); result = exchange.hasOut() ? (T)exchange.getOut() : (T)exchange.getIn(); } else { Exchange exchange = template().send(endpoint, ExchangePattern.InOut, processorSupplier.get()); result = context.getTypeConverter().convertTo( type, ExchangeHelper.extractResultBody(exchange, exchange.getPattern()) ); } return result; }
Source:
<code>private TestResult runAll() throws Exception { List<String> testClassNames = new ArrayList<>(); Files.walk(Paths.get(projectPath, "target", "test-classes")).forEach(filePath -> { if (Files.isRegularFile(filePath) && filePath.toString().toLowerCase().endsWith(".class")) { String path = Paths.get(projectPath, "target", "test-classes").relativize(filePath).toString(); <START> String className = path.replace('/', '.'); <END> className = className.replace('\\', '.'); className = className.substring(0, className.length() - 6); testClassNames.add(className); } }); List<Class> testableClasses = new ArrayList<>(); for (String className : testClassNames) { Class<?> clazz = Class.forName(className, false, projectClassLoader); if (isTestable(clazz)) { testableClasses.add(clazz); } } return runTestClasses(testableClasses.toArray(new Class[testableClasses.size()])); }</code><technical_language>path separator</technical_language>

Target:
private TestResult runAll() throws Exception { List<String> testClassNames = new ArrayList<>(); Files.walk(Paths.get(projectPath, "target", "test-classes")).forEach(filePath -> { if (Files.isRegularFile(filePath) && filePath.toString().toLowerCase().endsWith(".class")) { String path = Paths.get(projectPath, "target", "test-classes").relativize(filePath).toString(); String className = path.replace(File.separatorChar, '.'); className = className.substring(0, className.length() - 6); testClassNames.add(className); } }); List<Class> testableClasses = new ArrayList<>(); for (String className : testClassNames) { Class<?> clazz = Class.forName(className, false, projectClassLoader); if (isTestable(clazz)) { testableClasses.add(clazz); } } return runTestClasses(testableClasses.toArray(new Class[testableClasses.size()])); }
Source:
<code>private void showCallout(String title){ RelativeLayout calloutLayout = new RelativeLayout(getApplicationContext()); TextView calloutContent = new TextView(getApplicationContext()); calloutContent.setId(R.id.textview); calloutContent.setTextColor(Color.BLACK); calloutContent.setTextSize(18); calloutContent.setPadding(0,10,10,0); calloutContent.setText(title); RelativeLayout.LayoutParams relativeParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); relativeParams.addRule(RelativeLayout.RIGHT_OF, calloutContent.getId()); ImageView imageView = new ImageView(getApplicationContext()); <START> imageView.setImageDrawable(getResources().getDrawable(R.drawable.ic_info_outline_black_18dp)); <END> imageView.setLayoutParams(relativeParams); imageView.setOnClickListener(new ImageViewOnclickListener()); calloutLayout.addView(calloutContent); calloutLayout.addView(imageView); mCallout.setLocation(mMapView.screenToLocation(mClickPoint)); mCallout.setContent(calloutLayout); mCallout.show(); }</code><technical_language>getDrawable() is deprecated result in a logcat warning. Refactor AppCompat library: java ContextCompat.getDrawable(getActivity(), R.drawable.ic_info_outline_black_18dp);</technical_language>

Target:
private void showCallout(String title){ RelativeLayout calloutLayout = new RelativeLayout(getApplicationContext()); TextView calloutContent = new TextView(getApplicationContext()); calloutContent.setId(R.id.textview); calloutContent.setTextColor(Color.BLACK); calloutContent.setTextSize(18); calloutContent.setPadding(0,10,10,0); calloutContent.setText(title); RelativeLayout.LayoutParams relativeParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); relativeParams.addRule(RelativeLayout.RIGHT_OF, calloutContent.getId()); ImageView imageView = new ImageView(getApplicationContext()); imageView.setImageDrawable(ContextCompat.getDrawable(getApplicationContext(), R.drawable.ic_info_outline_black_18dp)); imageView.setLayoutParams(relativeParams); imageView.setOnClickListener(new ImageViewOnclickListener()); calloutLayout.addView(calloutContent); calloutLayout.addView(imageView); mCallout.setLocation(mMapView.screenToLocation(mClickPoint)); mCallout.setContent(calloutLayout); mCallout.show(); }