auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testNestedFields() { String indexName = "data"; Map<String, Object> source = new HashMap<>(); source.put("name", "nestfield"); source.put("fields.fielda", 32); source.put("fields.fieldb", "valueb"); embeddedElasticsearchNode.getClient().prepareIndex(indexName, "doc").setSource(source).get(); embeddedElasticsearchNode.getClient().admin().indices().refresh(refreshRequest(indexName)).actionGet(); MaterializedResult actualColumns = computeActual("SELECT name, fields.fielda, fields.fieldb FROM nested.data").toTestTypes(); MaterializedResult.Builder builder = resultBuilder(getQueryRunner().getDefaultSession(), VARCHAR, BIGINT, VARCHAR); for (MaterializedRow row : actualColumns.getMaterializedRows()) { builder.row(row.getField(0), row.getField(1), row.getField(2)); } MaterializedResult actualResult = builder.build(); <START> builder = resultBuilder(getQueryRunner().getDefaultSession(), VARCHAR, BIGINT, VARCHAR); <END> MaterializedResult expectedColumns = builder.row("nestfield", 32, "valueb").build(); assertEquals(actualResult, expectedColumns, format("%s != %s", actualResult, expectedColumns)); }</code><technical_language>BIGINT wrong column is defined integer in nested.data.json. <LINK_0> simplifying code? java MaterializedResult actualResult = computeActual("SELECT name, fields.fielda, fields.fieldb nested.data").toTestTypes(); MaterializedResult expectedResult = resultBuilder(getQueryRunner().getDefaultSession(), VARCHAR, INTEGER, VARCHAR) .row("nestfield", 32, "valueb") .build(); assertEquals(actualResult, expectedResult);</technical_language>

Target:
public void testNestedFields() { String indexName = "data"; embeddedElasticsearchNode.getClient() .prepareIndex(indexName, "doc") .setSource(ImmutableMap.<String, Object>builder() .put("name", "nestfield") .put("fields.fielda", 32) .put("fields.fieldb", "valueb") .build()) .get(); embeddedElasticsearchNode.getClient() .admin() .indices() .refresh(refreshRequest(indexName)) .actionGet(); assertQuery( "SELECT name, fields.fielda, fields.fieldb FROM nested.data", "VALUES ('nestfield', 32, 'valueb')"); }
Source:
<code>protected final AuditRepositoryRecord createDBAuditObj(LogEventSecureRequestType mess, AssertionType assertion) { AuditRepositoryRecord auditRec = new AuditRepositoryRecord(); String eventCommunityId = mess.getRemoteHCID(); if (NullChecker.isNotNullish(eventCommunityId)) { auditRec.setRemoteHcid(eventCommunityId); } else { <START> auditRec.setRemoteHcid(""); <END> } auditRec.setDirection(mess.getDirection()); auditRec.setMessage(getBlobFromAuditMessage(mess.getAuditMessage())); XMLGregorianCalendar xMLCalDate = mess.getEventTimestamp(); if (xMLCalDate != null) { auditRec.setEventTimeStamp(convertXMLGregorianCalendarToDate(xMLCalDate)); } auditRec.setOutcome(mess.getEventOutcomeIndicator().intValue()); auditRec.setEventType(mess.getEventType()); auditRec.setEventId(mess.getEventID()); auditRec.setMessageId(mess.getRequestMessageId()); auditRec.setRelatesTo(mess.getRelatesTo()); auditRec.setUserId(mess.getUserId()); return auditRec; }</code><technical_language>AuditRepository table accept Null values for RemoteHcid. Is a reason set empty value</technical_language>

Target:
protected final AuditRepositoryRecord createDBAuditObj(LogEventSecureRequestType mess, AssertionType assertion) { AuditRepositoryRecord auditRec = new AuditRepositoryRecord(); String eventCommunityId = mess.getRemoteHCID(); auditRec.setRemoteHcid(eventCommunityId); auditRec.setDirection(mess.getDirection()); auditRec.setMessage(getBlobFromAuditMessage(mess.getAuditMessage())); XMLGregorianCalendar xMLCalDate = mess.getEventTimestamp(); if (xMLCalDate != null) { auditRec.setEventTimeStamp(convertXMLGregorianCalendarToDate(xMLCalDate)); } auditRec.setOutcome(mess.getEventOutcomeIndicator().intValue()); auditRec.setEventType(mess.getEventType()); auditRec.setEventId(mess.getEventID()); auditRec.setMessageId(mess.getRequestMessageId()); auditRec.setRelatesTo(mess.getRelatesTo()); auditRec.setUserId(mess.getUserId()); return auditRec; }
Source:
<code>public void log(RequestLogLine requestLogLine) throws IOException { final Map mdc; if (setMDC) { mdc = MDC.getCopyOfContextMap(); } else { mdc = null; } try { if (setMDC) { try { final Query query = requestLogLine.getQuery(); MDC.put("queryId", query.getId()); MDC.put("dataSource", query.getDataSource().toString()); MDC.put("queryType", query.getType()); MDC.put("hasFilters", Boolean.toString(query.hasFilters())); MDC.put("remoteAddr", requestLogLine.getRemoteAddr()); MDC.put("duration", query.getDuration().toString()); MDC.put("resultOrdering", query.getResultOrdering().toString()); MDC.put("descending", Boolean.toString(query.isDescending())); if (setContextMDC) { final Iterable<Map.Entry<String, Object>> entries = query.getContext() == null ? ImmutableList.<Map.Entry<String, Object>>of() : query.getContext().entrySet(); for (Map.Entry<String, Object> entry : entries) { MDC.put(entry.getKey(), entry.getValue() == null ? "NULL" : entry.getValue().toString()); } } } catch (RuntimeException re) { LOG.error(re, "Error preparing MDC"); } } final String line = requestLogLine.getLine(mapper); LOG.info("%s", line); } finally { <START> if (setMDC && mdc != null) { <END> MDC.setContextMap(mdc); } } }</code><technical_language>I right. SLF4J docs getCopyOfContextMap return null, source happen if set MDC keys. if mdc is null call MDC.clear() reset MDC here</technical_language>

Target:
public void log(RequestLogLine requestLogLine) throws IOException { final Map mdc = MDC.getCopyOfContextMap(); try { if (setMDC) { try { final Query query = requestLogLine.getQuery(); MDC.put("queryId", query.getId()); MDC.put("dataSource", query.getDataSource().toString()); MDC.put("queryType", query.getType()); MDC.put("hasFilters", Boolean.toString(query.hasFilters())); MDC.put("remoteAddr", requestLogLine.getRemoteAddr()); MDC.put("duration", query.getDuration().toString()); MDC.put("descending", Boolean.toString(query.isDescending())); if (setContextMDC) { final Iterable<Map.Entry<String, Object>> entries = query.getContext() == null ? ImmutableList.<Map.Entry<String, Object>>of() : query.getContext().entrySet(); for (Map.Entry<String, Object> entry : entries) { MDC.put(entry.getKey(), entry.getValue() == null ? "NULL" : entry.getValue().toString()); } } } catch (RuntimeException re) { LOG.error(re, "Error preparing MDC"); } } final String line = requestLogLine.getLine(mapper); LOG.info("%s", line); } finally { if (setMDC) { if (mdc != null) { MDC.setContextMap(mdc); } else { MDC.clear(); } } } }
Source:
<code>public final void setVisible(final Set<Sequence> visibleSequences) { Set<SequenceSegment> vertices = new TreeSet<SequenceSegment>(); for (Sequence seq : visibleSequences) { <START> Iterator<SequenceSegment> itSegments = seq.getSegments().iterator(); <END> while (itSegments.hasNext()) { vertices.add(itSegments.next()); } } visibles = vertices; this.visibleSequences = visibleSequences; changed = true; }</code><technical_language>enhanced for-loop cleaner iterator</technical_language>

Target:
public final void setVisible(final Set<Sequence> visibleSequences) { Set<SequenceSegment> vertices = new TreeSet<SequenceSegment>(); for (Sequence seq : visibleSequences) { for (SequenceSegment segment : seq.getSegments()) { vertices.add(segment); } } visibles = vertices; this.visibleSequences = visibleSequences; }
Source:
<code>private static MaxwellDiagnosticContext getDiagnosticContext(MaxwellContext context) { MaxwellDiagnosticContext.Config diagnosticConfig = context.getConfig().diagnosticConfig; if (diagnosticConfig.enable) { return new MaxwellDiagnosticContext(diagnosticConfig, context.getDiagnostics()); } else { return null; } <START> } <END></code><technical_language>this functionality belongs in MaxwellContext - access diagnosticConfig, store a (mutable) DiagnosticContext instance instead of managing a List<Diagnostic></technical_language>

Target:
private static MaxwellDiagnosticContext getDiagnosticContext(MaxwellContext context) { MaxwellDiagnosticContext.Config diagnosticConfig = context.getConfig().diagnosticConfig; if (diagnosticConfig.enable) { return context.getDiagnosticContext(); } else { return null; } }
Source:
<code>private static Boolean checkMatch(COSDictionary info, Map<String, Object> properties) { if (!checkProperty(info, properties, TITLE)) return Boolean.FALSE; if (!checkProperty(info, properties, SUBJECT)) return Boolean.FALSE; if (!checkProperty(info, properties, AUTHOR)) return Boolean.FALSE; if (!checkProperty(info, properties, KEYWORDS)) return Boolean.FALSE; if (!checkProperty(info, properties, PRODUCER)) return Boolean.FALSE; if (!checkProperty(info, properties, CREATOR)) return Boolean.FALSE; if (!checkProperty(info, properties, CREATION_DATE)) return Boolean.FALSE; if (!checkProperty(info, properties, MODIFICATION_DATE)) return Boolean.FALSE; return Boolean.TRUE; <START> } <END></code><technical_language>private static Boolean checkMatch(COSDictionary info, Map<String, Object> properties) { if ((checkProperty(info, properties, TITLE)) && (checkProperty(info, properties, SUBJECT)) && (checkProperty(info, properties, AUTHOR)) && (checkProperty(info, properties, KEYWORDS)) && (checkProperty(info, properties, PRODUCER)) && (checkProperty(info, properties, CREATOR)) && (checkProperty(info, properties, CREATION_DATE)) && (checkProperty(info, properties, MODIFICATION_DATE))) { return Boolean.TRUE; } else { return Boolean.FALSE; } }</technical_language>

Target:
private static Boolean checkMatch(COSDictionary info, Map<String, Object> properties) { if ((checkProperty(info, properties, TITLE)) && (checkProperty(info, properties, SUBJECT)) && (checkProperty(info, properties, AUTHOR)) && (checkProperty(info, properties, KEYWORDS)) && (checkProperty(info, properties, PRODUCER)) && (checkProperty(info, properties, CREATOR)) && (checkProperty(info, properties, CREATION_DATE)) && (checkProperty(info, properties, MODIFICATION_DATE))) { return Boolean.TRUE; } else { return Boolean.FALSE; } }
Source:
<code><START> public boolean hasTaskChanged(TaskRepository taskRepository, ITask task, TaskData taskData) { <END> String lastKnownLocalModValue = task .getAttribute(BugzillaRestTaskSchema.getDefault().DATE_MODIFICATION.getKey()); TaskAttribute latestRemoteModAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.DATE_MODIFICATION); String latestRemoteModValue = latestRemoteModAttribute != null ? latestRemoteModAttribute.getValue() : null; return !Objects.equal(latestRemoteModValue, lastKnownLocalModValue); }</code><technical_language>This is pretty important behaviour. tested</technical_language>

Target:
public boolean hasTaskChanged(TaskRepository taskRepository, ITask task, TaskData taskData) { String lastKnownLocalModValue = task .getAttribute(BugzillaRestTaskSchema.getDefault().DATE_MODIFICATION.getKey()); TaskAttribute latestRemoteModAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.DATE_MODIFICATION); String latestRemoteModValue = latestRemoteModAttribute != null ? latestRemoteModAttribute.getValue() : null; if (latestRemoteModValue != null && lastKnownLocalModValue != null) { return !latestRemoteModValue.equals(lastKnownLocalModValue); } else if (latestRemoteModValue != null && lastKnownLocalModValue == null) { return true; } else { return false; } }
Source:
<code>private void fetchSSHFingerprint() { getFetchSshFingerprint().setEntity(ConstantsManager.getInstance().getConstants().empty()); getFetchResult().setEntity(ConstantsManager.getInstance().getConstants().empty()); AsyncQuery aQuery = new AsyncQuery(); aQuery.setModel(this); aQuery.asyncCallback = new INewAsyncCallback() { @Override public void onSuccess(Object model, Object result) { String fingerprint = (String) result; if (fingerprint != null && fingerprint.length() > 0) { getFetchSshFingerprint().setEntity(result); <START> getFetchResult().setEntity(ConstantsManager.getInstance().getConstants().successLoadingFingerprint()); <END> } else { getFetchResult().setEntity(ConstantsManager.getInstance().getConstants().errorLoadingFingerprint()); } } }; getHost().validateEntity(new IValidation[] { new NotEmptyValidation(), new LengthValidation(255), new HostAddressValidation() }); if (!getHost().getIsValid()) { getFetchResult().setEntity(ConstantsManager.getInstance().getConstants().fingerprintAddressError() + getHost().getInvalidityReasons().get(0)); } else { getFetchResult().setEntity(ConstantsManager.getInstance().getConstants().loadingFingerprint()); AsyncDataProvider.getHostFingerprint(aQuery, getHost().getEntity().toString()); } }</code><technical_language>unrelated change</technical_language>

Target:
private void fetchSSHFingerprint() { getFetchSshFingerprint().setEntity(ConstantsManager.getInstance().getConstants().empty()); getFetchResult().setEntity(ConstantsManager.getInstance().getConstants().empty()); AsyncQuery aQuery = new AsyncQuery(); aQuery.setModel(this); aQuery.asyncCallback = new INewAsyncCallback() { @Override public void onSuccess(Object model, Object result) { String fingerprint = (String) result; if (fingerprint != null && fingerprint.length() > 0) { getFetchSshFingerprint().setEntity(result); getFetchResult().setEntity((String) ConstantsManager.getInstance().getConstants().successLoadingFingerprint()); } else { getFetchResult().setEntity((String) ConstantsManager.getInstance().getConstants().errorLoadingFingerprint()); } } }; getHost().validateEntity(new IValidation[] { new NotEmptyValidation(), new LengthValidation(255), new HostAddressValidation() }); if (!getHost().getIsValid()) { getFetchResult().setEntity(ConstantsManager.getInstance().getConstants().fingerprintAddressError() + getHost().getInvalidityReasons().get(0)); } else { getFetchResult().setEntity((String) ConstantsManager.getInstance().getConstants().loadingFingerprint()); AsyncDataProvider.getHostFingerprint(aQuery, getHost().getEntity().toString()); } }
Source:
<code>public Builder withFooterKey(byte[] footerKey) { <START> if (null == footerKey) { <END> return this; } if (null != this.footerKeyBytes) { throw new IllegalArgumentException("Footer key already set"); } this.footerKeyBytes = new byte[footerKey.length]; System.arraycopy(footerKey, 0, this.footerKeyBytes, 0, footerKey.length); return this; }</code><technical_language>Validation logic in constructor, in builder, in both. I recommend validate in constructor</technical_language>

Target:
public Builder withFooterKey(byte[] footerKey) { if (null == footerKey) { return this; } if (null != this.footerKeyBytes) { throw new IllegalStateException("Footer key already set"); } this.footerKeyBytes = new byte[footerKey.length]; System.arraycopy(footerKey, 0, this.footerKeyBytes, 0, footerKey.length); return this; }
Source:
<code>public boolean hideResource(ResourceInfo resource) { if (isFilterSubject()) { <START> List<String> disabledServices = Collections.emptyList(); <END> if (resource.isServiceConfiguration()) { disabledServices = CollectionUtils.isEmpty(resource.getDisabledServices()) ? Collections.emptyList() : resource.getDisabledServices(); } else { disabledServices = defaultDisabledServices(); } String service = request().getService(); return disabledServices .stream() .anyMatch(s -> service.toLowerCase().equals(s.trim().toLowerCase())); } return false; }</code><technical_language>Unecessary init, variable a in branches of subsequent if</technical_language>

Target:
public boolean hideResource(ResourceInfo resource) { if (isFilterSubject()) { List<String> disabledServices = disabledServices(resource); String service = request().getService(); return disabledServices .stream() .anyMatch(s -> service.toLowerCase().equals(s.trim().toLowerCase())); } return false; }
Source:
<code>public void testUnionAllWithLiteralColumn() throws Exception { String tableName1 = generateUniqueName(); Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(false); try { String ddl = "CREATE TABLE " + tableName1 + " " + " (id varchar not null, col1 varchar" + " CONSTRAINT pk PRIMARY KEY (id))\n"; createTestTable(getUrl(), ddl); String dml = "UPSERT INTO " + tableName1 + " VALUES(?, ?)"; PreparedStatement stmt = conn.prepareStatement(dml); stmt.setString(1, "a"); stmt.setString(2, "11111"); stmt.execute(); conn.commit(); String unionAll = "select id, col1 from " + tableName1 + " union all select 'b' id, '2' col1"; <START> String select = "select t.id, case when t.col1='11111' then 'yes' else 'no' end c from ( " + unionAll + " ) t"; <END> ResultSet rs = conn.createStatement().executeQuery(select); assertTrue(rs.next()); assertEquals("a", rs.getString(1)); assertEquals("yes", rs.getString(2)); assertTrue(rs.next()); assertEquals("b", rs.getString(1)); assertEquals("no", rs.getString(2)); } finally { conn.close(); } }</code><technical_language>reformat SQL</technical_language>

Target:
public void testUnionAllWithLiteralColumn() throws Exception { String tableName1 = generateUniqueName(); Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); try (Connection conn = DriverManager.getConnection(getUrl(), props)) { conn.setAutoCommit(false); String ddl = "CREATE TABLE " + tableName1 + " " + " (id varchar not null, col1 varchar, col2 varchar(10)" + " CONSTRAINT pk PRIMARY KEY (id))\n"; createTestTable(getUrl(), ddl); String dml = "UPSERT INTO " + tableName1 + " VALUES(?, ?, ?)"; PreparedStatement stmt = conn.prepareStatement(dml); stmt.setString(1, "a"); stmt.setString(2, "11111"); stmt.setString(3, "11111"); stmt.execute(); conn.commit(); String query = "select t.id, case when t.col1='11111' then 'yes' else 'no' end c1, " + " case when '11111'=t.col2 then 'yes' else 'no' end c2 " + "from ( " + " select id, col1, col2 from " + tableName1 + " union all" + " select 'b' id, '2' col1, '2' col2" + ") t"; ResultSet rs = conn.createStatement().executeQuery(query); assertTrue(rs.next()); assertEquals("a", rs.getString(1)); assertEquals("yes", rs.getString(2)); assertEquals("yes", rs.getString(3)); assertTrue(rs.next()); assertEquals("b", rs.getString(1)); assertEquals("no", rs.getString(2)); assertEquals("no", rs.getString(3)); } }
Source:
<code>public TmfLocation<L> clone() { <START> return new TmfLocation<L>(fLocation); <END> }</code><technical_language>a shallow copy is enough. if member fLocation is final, some other class a handle this object modify it. purpose of clone is create a deep copy a copy of fLocation</technical_language>

Target:
public TmfLocation<L> clone() { TmfLocation<L> clone = null; try { clone = (TmfLocation<L>) super.clone(); if (fLocationData != null) { final Class<?> clazz = fLocationData.getClass(); final Method method = clazz.getMethod("clone", new Class[0]); final Object copy = method.invoke(this.fLocationData, new Object[0]); clone = new TmfLocation<L>((L) copy); } else { clone = new TmfLocation<L>((L) null); } } catch (final CloneNotSupportedException e) { } catch (final NoSuchMethodException e) { } catch (final Exception e) { throw new InternalError(e.toString()); } return clone; }
Source:
<code>protected void afterInvoke() throws Exception { LOG.debug("Finished task {}", getName()); final CompletableFuture<Void> timersFinishedFuture = new CompletableFuture<>(); operatorChain.closeOperators(actionExecutor); actionExecutor.runThrowing(() -> { FutureUtils.forward(timerService.quiesce(), timersFinishedFuture); mailboxProcessor.prepareClose(); isRunning = false; }); mailboxProcessor.drain(); timersFinishedFuture.get(); LOG.debug("Closed operators for task {}", getName()); operatorChain.flushOutputs(); disposeAllOperators(); <START> disposedOperators = true; <END> }</code><technical_language>This line is unnecessary disposedOperators is updated in disposeAllOperators throwing exception</technical_language>

Target:
protected void afterInvoke() throws Exception { LOG.debug("Finished task {}", getName()); final CompletableFuture<Void> timersFinishedFuture = new CompletableFuture<>(); operatorChain.closeOperators(actionExecutor); actionExecutor.runThrowing(() -> { FutureUtils.forward(timerService.quiesce(), timersFinishedFuture); mailboxProcessor.prepareClose(); isRunning = false; }); mailboxProcessor.drain(); timersFinishedFuture.get(); LOG.debug("Closed operators for task {}", getName()); operatorChain.flushOutputs(); disposeAllOperators(); }
Source:
<code>public void setUp() throws Exception { <START> jedis = new Jedis(hnp.getHost(), hnp.getPort(), 500); jedis.connect(); jedis.auth("foobared"); jedis.flushAll(); <END> jedis1 = new Jedis(hnp.getHost(), port, 500); jedis1.connect(); jedis1.flushAll(); }</code><technical_language>{suggestion} super.setUp();</technical_language>

Target:
public void setUp() throws Exception { super.setUp(); lfuJedis = new Jedis(lfuHnp.getHost(), lfuHnp.getPort(), 500); lfuJedis.connect(); lfuJedis.flushAll(); }
Source:
<code>protected List<?> doPublishIfEntries(List<?> entries) { if (entries == null || entries.size() == 0) { return entries; } Object entry = entries.get(0); if (entry instanceof LogEntry) { for (Object logEntry : entries) { try { doPublish((LogEntry) logEntry); <START> } catch (RuntimeException e) { <END> log.warn("unable to read log entry", e); } } } return entries; }</code><technical_language>exception observed here? Please catch exceptions are</technical_language>

Target:
protected List<?> doPublishIfEntries(List<?> entries) { if (entries == null || entries.size() == 0) { return entries; } Object entry = entries.get(0); if (entry instanceof LogEntry) { for (Object logEntry : entries) { doPublish((LogEntry) logEntry); } } return entries; }
Source:
<code>public Optional<String> retrieveStorageIdentifier() throws UnableToRetrieveIdentifierException { <START> return Optional.of(loadConfigurationToken()).map(i -> i.get("id")); <END> }</code><technical_language>i refers a configToken, right</technical_language>

Target:
public Optional<String> retrieveStorageIdentifier() throws UnableToRetrieveIdentifierException { return Optional.of(loadConfigurationToken()).map(configToken -> configToken.get("id")); }
Source:
<code>public boolean postDeserialize(int version, PostDeserializeSetup setup, boolean persistent) { boolean migrated = super.postDeserialize(version, setup, persistent); <START> if (version < this.getVersionNumber()) { <END> convertColumnsAndTableToUppercase.setValue(false); migrated = true; } return migrated; }</code><technical_language>Potentially, component multiple versions implement migration. Probably, want migration is related version. is change if condition in way: version < 1 thus, clear if clause body is related migration for version 1 do think</technical_language>

Target:
public boolean postDeserialize(int version, PostDeserializeSetup setup, boolean persistent) { boolean migrated = super.postDeserialize(version, setup, persistent); if (version < CONVERT_COLUMNS_AND_TABLE_TO_UPPERCASE_VERSION) { convertColumnsAndTableToUppercase.setValue(false); migrated = true; } return migrated; }
Source:
<code>public ViewResolver freemarkerResolver() { FreeMarkerViewResolver resolver = new FreeMarkerViewResolver(); <START> resolver.setOrder(1); <END> resolver.setViewClass(org.springframework.web.servlet.view.freemarker.FreeMarkerView.class); resolver.setPrefix(""); resolver.setSuffix(".ftl"); resolver.setRequestContextAttribute("req"); Properties properties = new Properties(); properties.put("nGrinderVersion" , ngrinderVersion); resolver.setExposeContextBeansAsAttributes(false); resolver.setAttributes(properties); resolver.setContentType("text/html; charset=UTF-8"); resolver.setExposeSpringMacroHelpers(true); resolver.setCache(false); return resolver; }</code><technical_language>I this set spring application.properties creating bean explicitly</technical_language>

Target:
public ViewResolver freemarkerResolver() { FreeMarkerViewResolver resolver = new FreeMarkerViewResolver(); resolver.setOrder(1); resolver.setViewClass(org.springframework.web.servlet.view.freemarker.FreeMarkerView.class); resolver.setPrefix(""); resolver.setSuffix(".ftl"); resolver.setRequestContextAttribute("req"); Properties properties = new Properties(); properties.put("nGrinderVersion" , ngrinderVersion); resolver.setExposeContextBeansAsAttributes(false); resolver.setAttributes(properties); resolver.setContentType("text/html; charset=" + defaultEncoding); resolver.setExposeSpringMacroHelpers(true); resolver.setCache(false); return resolver; }
Source:
<code>private void initCxfProviders(final Bus bus) { if (bus.getProperty("org.apache.cxf.jaxrs.bus.providers") == null) { bus.setProperty("skip.default.json.provider.registration", "true"); final Collection<Object> defaults = new ArrayList<>(); for (final String provider : asList( <START> "org.apache.johnzon.jaxrs.jsonb.jaxrs.JsonbJaxrsProvider", <END> "org.apache.openejb.server.cxf.rs.johnzon.TomEEJohnzonProvider", "org.apache.openejb.server.cxf.rs.johnzon.TomEEJsonpProvider")) { if (!isActive(provider)) { continue; } try { defaults.add(Class.forName(provider, true, CxfRSService.class.getClassLoader()).newInstance()); } catch (final Exception e) { } } try { final List<Object> all; final String userProviders = SystemInstance.get().getProperty("openejb.jaxrs.client.providers"); if (userProviders == null) { (all = new ArrayList<>(defaults.size())).addAll(defaults); } else { all = new ArrayList<>(defaults.size() + 2 ); for (String p : userProviders.split(" *, *")) { p = p.trim(); if (p.isEmpty()) { continue; } all.add(Thread.currentThread().getContextClassLoader().loadClass(p).newInstance()); } all.addAll(defaults); } bus.setProperty("org.apache.cxf.jaxrs.bus.providers", all); } catch (final Exception e) { throw new IllegalStateException(e); } } }</code><technical_language>a wrapper for this</technical_language>

Target:
private void initCxfProviders(final Bus bus) { if (bus.getProperty("org.apache.cxf.jaxrs.bus.providers") == null) { bus.setProperty("skip.default.json.provider.registration", "true"); final Collection<Object> defaults = new ArrayList<>(); for (final String provider : asList( "org.apache.openejb.server.cxf.rs.johnzon.TomEEJsonbProvider", "org.apache.openejb.server.cxf.rs.johnzon.TomEEJsonpProvider")) { if (!isActive(provider)) { continue; } try { defaults.add(Class.forName(provider, true, CxfRSService.class.getClassLoader()).newInstance()); } catch (final Exception e) { } } try { final List<Object> all; final String userProviders = SystemInstance.get().getProperty("openejb.jaxrs.client.providers"); if (userProviders == null) { (all = new ArrayList<>(defaults.size())).addAll(defaults); } else { all = new ArrayList<>(defaults.size() + 2 ); for (String p : userProviders.split(" *, *")) { p = p.trim(); if (p.isEmpty()) { continue; } all.add(Thread.currentThread().getContextClassLoader().loadClass(p).newInstance()); } all.addAll(defaults); } bus.setProperty("org.apache.cxf.jaxrs.bus.providers", all); } catch (final Exception e) { throw new IllegalStateException(e); } } }
Source:
<code>private static <T, E extends Throwable> T doRetry(Retryable<T, E> task, SuccessCondition condition) throws E { T result = task.runExec(); for (int delay = 1; !condition.isSuccessful(task) && delay <= MAX_DELAY_IN_S; delay *= 2) { logFailure(task, delay); ThreadHelper.waitFor(delay * 1000); task.beforeRetry(); result = task.runExec(); } <START> return result; <END> }</code><technical_language>do assertion fail if reached maximum delay? do this silently, right</technical_language>

Target:
private static <T, E extends Throwable> T doRetry(Retryable<T, E> task, SuccessCondition condition) throws E { T result = task.runExec(); for (int delay = 1; !condition.isSuccessful(task) && delay <= MAX_DELAY_IN_S; delay *= 2) { logFailure(task, delay); ThreadHelper.waitFor(delay * 1000); task.beforeRetry(); result = task.runExec(); } if (!condition.isSuccessful(task)) { throwFinalFailure(task); } return result; }
Source:
<code>void populate(final int row, final Branch k) { final GitwebLink c = Gerrit.getConfig().getGitwebLink(); if (k.getCanDelete()) { table.setWidget(row, 1, new CheckBox()); canDelete = true; } else { table.setText(row, 1, ""); } table.setText(row, 2, k.getShortName()); if (k.getRevision() != null) { table.setText(row, 3, k.getRevision().get()); } else { table.setText(row, 3, ""); } if (c != null) { table.setWidget(row, 4, new Anchor("(gitweb)", false, c.toBranch(k .getNameKey()))); } final FlexCellFormatter fmt = table.getFlexCellFormatter(); fmt.addStyleName(row, 1, Gerrit.RESOURCES.css().iconCell()); fmt.addStyleName(row, 2, Gerrit.RESOURCES.css().dataCell()); <START> if ("refs/meta/config".equals(k.getShortName()) <END> || Constants.HEAD.equals(k.getShortName())) { fmt.addStyleName(row, 2, Gerrit.RESOURCES.css().specialBranch()); } fmt.addStyleName(row, 3, Gerrit.RESOURCES.css().dataCell()); if (c != null) { fmt.addStyleName(row, 4, Gerrit.RESOURCES.css().dataCell()); } setRowItem(row, k); }</code><technical_language>Damn, GitRepositoryManager.REF_CONFIG 'refs/meta/config' defined, in client here. this constant in 'common' package</technical_language>

Target:
void populate(final int row, final Branch k) { final GitwebLink c = Gerrit.getConfig().getGitwebLink(); if (k.getCanDelete()) { table.setWidget(row, 1, new CheckBox()); canDelete = true; } else { table.setText(row, 1, ""); } table.setText(row, 2, k.getShortName()); if (k.getRevision() != null) { table.setText(row, 3, k.getRevision().get()); } else { table.setText(row, 3, ""); } if (c != null) { table.setWidget(row, 4, new Anchor("(gitweb)", false, c.toBranch(k .getNameKey()))); } final FlexCellFormatter fmt = table.getFlexCellFormatter(); String iconCellStyle = Gerrit.RESOURCES.css().iconCell(); String dataCellStyle = Gerrit.RESOURCES.css().dataCell(); if ("refs/meta/config".equals(k.getShortName()) || Constants.HEAD.equals(k.getShortName())) { iconCellStyle = Gerrit.RESOURCES.css().specialBranchIconCell(); dataCellStyle = Gerrit.RESOURCES.css().specialBranchDataCell(); fmt.setStyleName(row, 0, iconCellStyle); } fmt.addStyleName(row, 1, iconCellStyle); fmt.addStyleName(row, 2, dataCellStyle); fmt.addStyleName(row, 3, dataCellStyle); if (c != null) { fmt.addStyleName(row, 4, dataCellStyle); } setRowItem(row, k); }
Source:
<code>public LayerLinkPanel(String id, final IModel<ImportTask> model) { super(id); add(new Link<ImportTask>("link", model) { @Override public void onClick() { ImportTask task = getModelObject(); PageParameters pp = new PageParameters(); pp.add("id", task.getContext().getId()); setResponsePage(new LayerPage(task.getLayer(), pp) { protected void onSuccessfulSave() { super.onSuccessfulSave(); try { ImporterWebUtils.importer().changed(model.getObject()); } catch (IOException e) { <START> throw new RuntimeException(e); <END> } }; }); } }.add(new Label("name", new PropertyModel(model, "layer.name"))) .add(new Icon("icon",new DataIconModel(model.getObject().getData())))); }</code><technical_language>another RuntimeException</technical_language>

Target:
public LayerLinkPanel(String id, final IModel<ImportTask> model) { super(id); add(new Link<ImportTask>("link", model) { @Override public void onClick() { ImportTask task = getModelObject(); PageParameters pp = new PageParameters(); pp.add("id", task.getContext().getId()); setResponsePage(new LayerPage(task.getLayer(), pp) { protected void onSuccessfulSave() { super.onSuccessfulSave(); try { ImporterWebUtils.importer().changed(model.getObject()); } catch (IOException e) { error(e); } }; }); } }.add(new Label("name", new PropertyModel(model, "layer.name"))) .add(new Icon("icon",new DataIconModel(model.getObject().getData())))); }
Source:
<code>public Object init(CarbonMessage cMsg, CarbonCallback callback, Map<String, Object> properties) throws ClientConnectorException { if (Constants.PROTOCOL_FTP.equals(properties.get("PROTOCOL"))) { properties.forEach((property, value) -> { <START> switch (property) { <END> case Constants.FTP_PASSIVE_MODE: FtpFileSystemConfigBuilder.getInstance().setPassiveMode(opts, (Boolean) value); break; } }); } return Boolean.TRUE; }</code><technical_language>replace "if"</technical_language>

Target:
public Object init(CarbonMessage cMsg, CarbonCallback callback, Map<String, Object> properties) throws ClientConnectorException { if (Constants.PROTOCOL_FTP.equals(properties.get("PROTOCOL"))) { properties.forEach((property, value) -> { if (Constants.FTP_PASSIVE_MODE.equals(property)) { FtpFileSystemConfigBuilder.getInstance().setPassiveMode(opts, (Boolean) value); } }); } return Boolean.TRUE; }
Source:
<code>protected void onDestroy() { <START> ((ViewGroup) mWebView.getParent()).removeView(mWebView); <END> mWebView.destroy(); super.onDestroy(); }</code><technical_language>add a null check detached</technical_language>

Target:
protected void onDestroy() { ViewGroup parent = (ViewGroup) mWebView.getParent(); if (parent != null) { parent.removeView(mWebView); } mWebView.destroy(); super.onDestroy(); }
Source:
<code>protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException, ChargeException, MaxMoneyException { <START> if(sign.getLine(3).startsWith(tl("signFormatWorth")) && updateFromWorth(sign, player, ess, new BigDecimal("1.0"))) { return false; <END> } Trade charge = getTrade(sign, 1, 2, player, ess); Trade money = getTrade(sign, 3, ess); if (ess.getSettings().isAllowBulkBuySell() && player.getBase().isSneaking()) { ItemStack heldItem = player.getItemInHand(); if (charge.getItemStack().isSimilar(heldItem)) { int initialItemAmount = charge.getItemStack().getAmount(); int newItemAmount = heldItem.getAmount(); ItemStack item = charge.getItemStack(); item.setAmount(newItemAmount); charge = new Trade(item, ess); BigDecimal chargeAmount = money.getMoney(); BigDecimal pricePerSingleItem = chargeAmount.divide(new BigDecimal(initialItemAmount)); pricePerSingleItem = pricePerSingleItem.multiply(new BigDecimal(newItemAmount)); money = new Trade(pricePerSingleItem, ess); } } charge.isAffordableFor(player); money.pay(player, OverflowType.DROP); charge.charge(player); Trade.log("Sign", "Sell", "Interact", username, charge, username, money, sign.getBlock().getLocation(), ess); return true; }</code><technical_language>suggestion if (sign.getLine(3).startsWith(tl("signFormatWorth")) && updateFromWorth(sign, player, ess, new BigDecimal("1.0"))) { return false; } Ditto (also, overloaded method for default scaling factor)</technical_language>

Target:
protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException, ChargeException, MaxMoneyException { if (sign.getLine(3).startsWith(tl("signFormatWorth")) && updateFromWorth(sign, player, ess)) { return false; } Trade charge = getTrade(sign, 1, 2, player, ess); Trade money = getTrade(sign, 3, ess); if (ess.getSettings().isAllowBulkBuySell() && player.getBase().isSneaking()) { ItemStack heldItem = player.getItemInHand(); if (charge.getItemStack().isSimilar(heldItem)) { int initialItemAmount = charge.getItemStack().getAmount(); int newItemAmount = heldItem.getAmount(); ItemStack item = charge.getItemStack(); item.setAmount(newItemAmount); charge = new Trade(item, ess); BigDecimal chargeAmount = money.getMoney(); BigDecimal pricePerSingleItem = chargeAmount.divide(new BigDecimal(initialItemAmount)); pricePerSingleItem = pricePerSingleItem.multiply(new BigDecimal(newItemAmount)); money = new Trade(pricePerSingleItem, ess); } } charge.isAffordableFor(player); money.pay(player, OverflowType.DROP); charge.charge(player); Trade.log("Sign", "Sell", "Interact", username, charge, username, money, sign.getBlock().getLocation(), ess); return true; }
Source:
<code>private static void runBuiltinFilterCommand(Repository repo, CheckoutMetadata checkoutMetadata, ObjectLoader ol, OutputStream channel) throws MissingObjectException, IOException { FilterCommand command = null; try { command = Repository.getCommand( checkoutMetadata.smudgeFilterCommand, repo, ol.openStream(), channel); } catch (IOException e) { <START> ol.copyTo(channel); <END> } if (command != null) { while (command.run() != -1) ; } }</code><technical_language>log error</technical_language>

Target:
private static void runBuiltinFilterCommand(Repository repo, CheckoutMetadata checkoutMetadata, ObjectLoader ol, OutputStream channel) throws MissingObjectException, IOException { FilterCommand command = null; try { command = Repository.getFilterCommand( checkoutMetadata.smudgeFilterCommand, repo, ol.openStream(), channel); } catch (IOException e) { LOG.error(JGitText.get().failedToDetermineFilterDefinition, e); ol.copyTo(channel); } if (command != null) { while (command.run() != -1) { } } }
Source:
<code>public void discussionsAdministratorOnMobileCanRemoveCategoriesOnPostsListPage() { CategoryPill.Data data = DiscussionsCategoryOperations.using(User.DISCUSSIONS_ADMINISTRATOR, driver) .createCategory(TextGenerator.createUniqueCategoryName()); final String temporaryCategoryName = TextGenerator.createUniqueCategoryName(); final PostsListPage page = new PostsListPage().open(); final CategoriesFieldset categoriesFieldset = page.getFiltersPopOver().click().getCategoriesFieldset(); addAndRemoveTemporaryCategory(page, temporaryCategoryName, categoriesFieldset); <START> Assertion.assertNull(categoriesFieldset.findCategoryWith(temporaryCategoryName), "Temporary category should not be added."); <END> removeCategory(data, page, categoriesFieldset); Assertion.assertNull(categoriesFieldset.findCategoryWith(data.getName()), "Temporary category should be removed."); }</code><technical_language>TEMPORARY_CATEGORY_SHOULD_NOT_BE_ADDED_MESSAGE is defined,</technical_language>

Target:
public void discussionsAdministratorOnMobileCanRemoveCategoriesOnPostsListPage() { CategoryPill.Data data = DiscussionsCategoryOperations.using(User.DISCUSSIONS_ADMINISTRATOR, driver) .createCategory(TextGenerator.createUniqueCategoryName()); final String temporaryCategoryName = TextGenerator.createUniqueCategoryName(); final PostsListPage page = new PostsListPage().open(); final CategoriesFieldset categoriesFieldset = page.getFiltersPopOver().click().getCategoriesFieldset(); addAndRemoveTemporaryCategory(page, temporaryCategoryName, categoriesFieldset); Assertion.assertNull(categoriesFieldset.findCategoryWith(temporaryCategoryName), TEMPORARY_CATEGORY_SHOULD_NOT_BE_ADDED_MESSAGE); removeCategory(data, page, categoriesFieldset); Assertion.assertNull(categoriesFieldset.findCategoryWith(data.getName()), CATEGORY_SHOULD_BE_REMOVED_MESSAGE); }
Source:
<code>private void plugDiskToVmIfNeeded() { if (Boolean.TRUE.equals(getParameters().getPlugDiskToVm())) { if (getVm() != null && !getVm().getStatus().isUpOrPaused()) { <START> log.warn("Disk id- '{}' wasn't plug to VM- '{}' because the VM status is- '{}'", <END> getParameters().getDiskInfo().getId(), getVmId(), getVm().getStatus()); } else { VmDiskOperationParameterBase params = new VmDiskOperationParameterBase(new DiskVmElement(getParameters().getDiskInfo().getId(), getVmId())); params.setShouldBeLogged(false); ActionReturnValue returnValue = runInternalAction(ActionType.HotPlugDiskToVm, params); if (!returnValue.getSucceeded()) { auditLogDirector.log(this, AuditLogType.USER_FAILED_HOTPLUG_DISK); } } } }</code><technical_language>please print name of vm</technical_language>

Target:
private void plugDiskToVmIfNeeded() { if (Boolean.TRUE.equals(getParameters().getPlugDiskToVm()) && getVm() != null) { if (!getVm().getStatus().isUpOrPaused()) { log.warn("Disk id - '{}' wasn't plug to VM - '{}' with id - '{}' because the VM status is - '{}'", getParameters().getDiskInfo().getId(), getVmName(), getVmId(), getVm().getStatus()); } else { VmDiskOperationParameterBase params = new VmDiskOperationParameterBase(new DiskVmElement(getParameters().getDiskInfo().getId(), getVmId())); params.setShouldBeLogged(false); ActionReturnValue returnValue = runInternalAction(ActionType.HotPlugDiskToVm, params); if (!returnValue.getSucceeded()) { auditLogDirector.log(this, AuditLogType.USER_FAILED_HOTPLUG_DISK); } } } }
Source:
<code><START> public void emit(final ServiceEmitter emitter) <END> { synchronized (lock) { ServiceMetricEvent.Builder builder = new ServiceMetricEvent.Builder(); singleValueDims.forEach(builder::setDimension); multiValueDims.forEach(builder::setDimension); metrics.forEach((metric, value) -> emitter.emit(builder.build(metric, value))); metrics.clear(); } }</code><technical_language>emit() concurrent. allow emitting owner thread</technical_language>

Target:
public void emit(final ServiceEmitter emitter) { final Thread currThread = Thread.currentThread(); synchronized (lock) { if (ownerThread == null) { ownerThread = currThread; } else if (!ownerThread.equals(currThread)) { throw new ISE("emit() from multiple threads is not allowed. If it is needed to emit metrics from " + "multiple threads, create a separate QueryMetrics instance for each thread instead."); } ServiceMetricEvent.Builder builder = new ServiceMetricEvent.Builder(); singleValueDims.forEach(builder::setDimension); multiValueDims.forEach(builder::setDimension); metrics.forEach((metric, value) -> emitter.emit(builder.build(metric, value))); metrics.clear(); } }
Source:
<code>public boolean onPrepareOptionsMenu(android.view.Menu menu) { MenuItem m = menu.findItem(R.id.option_edit_profile); if(state == State.EDIT) { m.setEnabled(false); m.setVisible(false); } else if(state == State.BACK) { state = State.DEFAULT; m.setEnabled(true); m.setVisible(true); } <START> if (DineOnUserApplication.getDineOnUser() == null) { <END> disableMenuItem(menu, R.id.option_check_in); disableMenuItem(menu, R.id.option_bill); return true; } if(DineOnUserApplication.getCurrentDiningSession() != null) { disableMenuItem(menu, R.id.option_check_in); enableMenuItem(menu, R.id.option_bill); } else { enableMenuItem(menu, R.id.option_check_in); disableMenuItem(menu, R.id.option_bill); } return true; }</code><technical_language>This happen. This a bug. a User passed login create account</technical_language>

Target:
public boolean onPrepareOptionsMenu(android.view.Menu menu) { MenuItem m = menu.findItem(R.id.option_edit_profile); if(state == State.EDIT) { m.setEnabled(false); m.setVisible(false); } else if(state == State.BACK) { state = State.DEFAULT; m.setEnabled(true); m.setVisible(true); } if(DineOnUserApplication.getCurrentDiningSession() != null) { disableMenuItem(menu, R.id.option_check_in); enableMenuItem(menu, R.id.option_bill); } else { enableMenuItem(menu, R.id.option_check_in); disableMenuItem(menu, R.id.option_bill); } return true; }
Source:
<code>public void purgeExpired() { if (!enabled) return; long start = -1; try { if (trace) { log.trace("Purging cache store of expired entries"); start = timeService.time(); } storesMutex.readLock().lock(); try { checkStoreAvailability(); Consumer<CacheWriter> purgeWriter = writer -> { <START> if (getStoreConfig(writer).shared() && transport != null && !transport.isCoordinator()) <END> return; if (writer instanceof AdvancedCacheExpirationWriter) { ((AdvancedCacheExpirationWriter)writer).purge(persistenceExecutor, advancedListener); } else if (writer instanceof AdvancedCacheWriter) { ((AdvancedCacheWriter)writer).purge(persistenceExecutor, advancedListener); } }; nonTxWriters.forEach(purgeWriter); txWriters.forEach(purgeWriter); } finally { storesMutex.readLock().unlock(); } if (trace) { log.tracef("Purging cache store completed in %s", Util.prettyPrintTime(timeService.timeDuration(start, TimeUnit.MILLISECONDS))); } } catch (Exception e) { log.exceptionPurgingDataContainer(e); } }</code><technical_language>instead of transport!=null, globalConfiguration.isClustered() ? reading line, avoiding a null pointer exception (like protecting) for eventual transport null instead of explains needs clustered check a coordinator</technical_language>

Target:
public void purgeExpired() { if (!enabled) return; long start = -1; try { if (trace) { log.trace("Purging cache store of expired entries"); start = timeService.time(); } storesMutex.readLock().lock(); try { checkStoreAvailability(); Consumer<CacheWriter> purgeWriter = writer -> { if (globalConfiguration.isClustered() && getStoreConfig(writer).shared() && !transport.isCoordinator()) return; if (writer instanceof AdvancedCacheExpirationWriter) { ((AdvancedCacheExpirationWriter)writer).purge(persistenceExecutor, advancedListener); } else if (writer instanceof AdvancedCacheWriter) { ((AdvancedCacheWriter)writer).purge(persistenceExecutor, advancedListener); } }; nonTxWriters.forEach(purgeWriter); txWriters.forEach(purgeWriter); } finally { storesMutex.readLock().unlock(); } if (trace) { log.tracef("Purging cache store completed in %s", Util.prettyPrintTime(timeService.timeDuration(start, TimeUnit.MILLISECONDS))); } } catch (Exception e) { log.exceptionPurgingDataContainer(e); } }
Source:
<code>private String encodeBlob(String encodingType, String blobName) { <START> if (encodingType.equals("url")) { <END> return URLEncoder.encode(blobName, "UTF-8"); } else { return blobName; } }</code><technical_language>HttpServletRequest.getParameter return null check encodingType here</technical_language>

Target:
private static String encodeBlob(String encodingType, String blobName) { if (encodingType != null && encodingType.equals("url")) { try { return URLEncoder.encode(blobName, "UTF-8"); } catch (UnsupportedEncodingException e) { throw Throwables.propagate(e); } } else { return blobName; } }
Source:
<code>public Builder addSetupQueryId(String queryId) { <START> checkState(!this.queryId.isPresent(), "queryId is already set"); <END> this.setupQueryIds.add(queryId); return this; }</code><technical_language>is this right check</technical_language>

Target:
public Builder addSetupQueryId(String queryId) { this.setupQueryIds.add(queryId); return this; }
Source:
<code>private void createAndCacheNonBootclasspathSystemClassLoader(SharedLibraryInfo lib) { String path = lib.getPath(); List<SharedLibraryInfo> dependencies = lib.getDependencies(); ArrayList<ClassLoader> sharedLibraries = null; if (dependencies != null) { sharedLibraries = new ArrayList<ClassLoader>(dependencies.size()); for (SharedLibraryInfo dependency : dependencies) { String dependencyPath = dependency.getPath(); CachedClassLoader preload = mSystemLibsPreloadMap.get(dependencyPath); if (preload == null) { Log.e(TAG, "Failed to find dependency " + dependencyPath + " of preload library " + path); return; } sharedLibraries.add(preload.loader); } } ClassLoader classLoader = getClassLoader(path, Build.VERSION.SDK_INT, true , null , null , null , null , null , sharedLibraries ); if (classLoader == null) { Log.e(TAG, "Failed to preload " + path); return; } CachedClassLoader <START> preload = <END> new CachedClassLoader(); preload.loader = classLoader; preload.sharedLibraries = sharedLibraries; Log.d(TAG, "Created zygote-cached class loader: " + path); mSystemLibsPreloadMap.put(path, preload); }</code><technical_language>consistent of cache/preload. interchange a bit</technical_language>

Target:
private void createAndCacheNonBootclasspathSystemClassLoader(SharedLibraryInfo lib) { String path = lib.getPath(); List<SharedLibraryInfo> dependencies = lib.getDependencies(); ArrayList<ClassLoader> sharedLibraries = null; if (dependencies != null) { sharedLibraries = new ArrayList<ClassLoader>(dependencies.size()); for (SharedLibraryInfo dependency : dependencies) { String dependencyPath = dependency.getPath(); CachedClassLoader cached = mSystemLibsCacheMap.get(dependencyPath); if (cached == null) { Log.e(TAG, "Failed to find dependency " + dependencyPath + " of cached library " + path); return; } sharedLibraries.add(cached.loader); } } ClassLoader classLoader = getClassLoader(path, Build.VERSION.SDK_INT, true , null , null , null , null , null , sharedLibraries ); if (classLoader == null) { Log.e(TAG, "Failed to cache " + path); return; } CachedClassLoader cached = new CachedClassLoader(); cached.loader = classLoader; cached.sharedLibraries = sharedLibraries; Log.d(TAG, "Created zygote-cached class loader: " + path); mSystemLibsCacheMap.put(path, cached); }