auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected RowMapper<VmNetworkStatistics> createEntityRowMapper() { <START> return new VmNetworkStatisticsRowMapper(); <END> }</code><technical_language>Instead of instantiating this class DAO call, saved a static local member of (same other class extends NetworkStatisticsRowMapper). VnicProfileRowMapperBase VnicProfileRowMapper for example: private static class VnicProfileRowMapper extends VnicProfileRowMapperBase<VnicProfile> { public static final VnicProfileRowMapper INSTANCE = new VnicProfileRowMapper(); @Override protected VnicProfile createVnicProfileEntity() { return new VnicProfile(); } }</technical_language>

Target:
protected RowMapper<VmNetworkStatistics> createEntityRowMapper() { return VmNetworkStatisticsRowMapper.INSTANCE; }
Source:
<code>protected void init() { T parameters = getParameters(); super.setVmTemplateName(parameters.getName()); VmStatic parameterMasterVm = parameters.getMasterVm(); if (parameterMasterVm != null) { super.setVmId(parameterMasterVm.getId()); setVdsGroupId(parameterMasterVm.getVdsGroupId()); if (getVdsGroup() != null && VmDeviceUtils.shouldOverrideSoundDevice(getParameters().isSoundDeviceEnabled(), getParameters().getMasterVm(), <START> getVdsGroup().getCompatibilityVersion())) { <END> parameters.setSoundDeviceEnabled(true); } if (getParameters().isConsoleEnabled() == null) { parameters.setConsoleEnabled(false); } VmHandler.updateDefaultTimeZone(parameterMasterVm); VmHandler.autoSelectUsbPolicy(getParameters().getMasterVm(), getVdsGroup()); VmHandler.autoSelectDefaultDisplayType(getVmId(), getParameters().getMasterVm(), getVdsGroup(), getParameters().getGraphicsDevices()); separateCustomProperties(parameterMasterVm); } if (getVm() != null) { updateVmDevices(); images.addAll(getVmDisksFromDB()); setStoragePoolId(getVm().getStoragePoolId()); isVmInDb = true; } else if (getVdsGroup() != null && parameterMasterVm != null) { VM vm = new VM(parameterMasterVm, new VmDynamic(), null); vm.setVdsGroupCompatibilityVersion(getVdsGroup().getCompatibilityVersion()); setVm(vm); setStoragePoolId(getVdsGroup().getStoragePoolId()); } updateDiskInfoDestinationMap(); }</code><technical_language>formatting</technical_language>

Target:
protected void init() { T parameters = getParameters(); super.setVmTemplateName(parameters.getName()); VmStatic parameterMasterVm = parameters.getMasterVm(); if (parameterMasterVm != null) { super.setVmId(parameterMasterVm.getId()); setVdsGroupId(parameterMasterVm.getVdsGroupId()); if (getVdsGroup() != null && VmDeviceUtils.shouldOverrideSoundDevice(getParameters().isSoundDeviceEnabled(), getParameters().getMasterVm(), getVdsGroup().getCompatibilityVersion())) { parameters.setSoundDeviceEnabled(true); } if (getParameters().isConsoleEnabled() == null) { parameters.setConsoleEnabled(false); } VmHandler.updateDefaultTimeZone(parameterMasterVm); VmHandler.autoSelectUsbPolicy(getParameters().getMasterVm(), getVdsGroup()); VmHandler.autoSelectDefaultDisplayType(getVmId(), getParameters().getMasterVm(), getVdsGroup(), getParameters().getGraphicsDevices()); separateCustomProperties(parameterMasterVm); } if (getVm() != null) { updateVmDevices(); images.addAll(getVmDisksFromDB()); setStoragePoolId(getVm().getStoragePoolId()); isVmInDb = true; } else if (getVdsGroup() != null && parameterMasterVm != null) { VM vm = new VM(parameterMasterVm, new VmDynamic(), null); vm.setVdsGroupCompatibilityVersion(getVdsGroup().getCompatibilityVersion()); setVm(vm); setStoragePoolId(getVdsGroup().getStoragePoolId()); } updateDiskInfoDestinationMap(); parameters.setUseCinderCommandCallback(!getCinderDisks().isEmpty()); }
Source:
<code>private JSONObject createObject(String id, String value, String avatar, String type) { JSONObject o = new JSONObject(); StringBuilder idWithType = new StringBuilder(); idWithType.append(id).append(";").append(type); <START> o.put(UsersAndGroups.ID_KEY, idWithType.toString()); <END> o.put(UsersAndGroups.VALUE_KEY, value); o.put(UsersAndGroups.ICON_KEY, avatar); return o; }</code><technical_language>@marta- curious a strange ID format ("ID;type")</technical_language>

Target:
private JSONObject createObject(String id, String value, String avatar, String type) { JSONObject o = new JSONObject(); StringBuilder idWithType = new StringBuilder(); idWithType.append(id); o.put(UsersAndGroups.ID_KEY, idWithType.toString()); o.put(UsersAndGroups.VALUE_KEY, value); o.put(UsersAndGroups.ICON_KEY, avatar); return o; }
Source:
<code>public void testSTMax() throws Exception { assertQuery("select st_max_x(st_geometry_from_text('linestring(8 4, 4 8)'))", "select 8.0"); <START> assertQuery("select st_max_y(st_geometry_from_text('linestring(8 4, 4 8)'))", "select 8.0"); <END> assertQuery("select st_max_x(st_geometry_from_text('polygon ((2 0, 2 1, 3 1))'))", "select 3.0"); assertQuery("select st_max_y(st_geometry_from_text('polygon ((2 0, 2 1, 3 1))'))", "select 1.0"); }</code><technical_language>nit: consider testing a linestring max_x max_y; a typo in implementation max_x max_y return unnoticed</technical_language>

Target:
public void testSTMax() throws Exception { assertFunction("ST_XMax(ST_GeometryFromText('POINT (1.5 2.5)'))", DOUBLE, 1.5); assertFunction("ST_YMax(ST_GeometryFromText('POINT (1.5 2.5)'))", DOUBLE, 2.5); assertFunction("ST_XMax(ST_GeometryFromText('MULTIPOINT (1 2, 2 4, 3 6, 4 8)'))", DOUBLE, 4.0); assertFunction("ST_YMax(ST_GeometryFromText('MULTIPOINT (1 2, 2 4, 3 6, 4 8)'))", DOUBLE, 8.0); assertFunction("ST_XMax(ST_GeometryFromText('LINESTRING (8 4, 5 7)'))", DOUBLE, 8.0); assertFunction("ST_YMax(ST_GeometryFromText('LINESTRING (8 4, 5 7)'))", DOUBLE, 7.0); assertFunction("ST_XMax(ST_GeometryFromText('MULTILINESTRING ((1 1, 5 1), (2 4, 4 4))'))", DOUBLE, 5.0); assertFunction("ST_YMax(ST_GeometryFromText('MULTILINESTRING ((1 1, 5 1), (2 4, 4 4))'))", DOUBLE, 4.0); assertFunction("ST_XMax(ST_GeometryFromText('POLYGON ((2 0, 2 1, 3 1))'))", DOUBLE, 3.0); assertFunction("ST_YMax(ST_GeometryFromText('POLYGON ((2 0, 2 1, 3 1))'))", DOUBLE, 1.0); assertFunction("ST_XMax(ST_GeometryFromText('MULTIPOLYGON (((1 1, 1 3, 3 3, 3 1)), ((2 4, 2 6, 6 6, 6 4)))'))", DOUBLE, 6.0); assertFunction("ST_YMax(ST_GeometryFromText('MULTIPOLYGON (((1 1, 1 3, 3 3, 3 1)), ((2 4, 2 6, 6 10, 6 4)))'))", DOUBLE, 10.0); }
Source:
<code>@Override public void run() { try { updateThreadName(data); if (picasso.loggingEnabled) { log(OWNER_HUNTER, VERB_EXECUTING, getLogIdsForHunter(this)); } result = hunt(); if (result == null) { dispatcher.dispatchFailed(this); } else { dispatcher.dispatchComplete(this); } } catch (Downloader.ResponseException e) { <START> if (!e.localCacheOnly && e.responseCode != 504){ <END> exception = e; } dispatcher.dispatchFailed(this); } catch (IOException e) { exception = e; dispatcher.dispatchRetry(this); } catch (OutOfMemoryError e) { StringWriter writer = new StringWriter(); stats.createSnapshot().dump(new PrintWriter(writer)); exception = new RuntimeException(writer.toString(), e); dispatcher.dispatchFailed(this); } catch (Exception e) { exception = e; dispatcher.dispatchFailed(this); } finally { Thread.currentThread().setName(Utils.THREAD_IDLE_NAME); } }</code><technical_language>||</technical_language>

Target:
@Override public void run() { try { updateThreadName(data); if (picasso.loggingEnabled) { log(OWNER_HUNTER, VERB_EXECUTING, getLogIdsForHunter(this)); } result = hunt(); if (result == null) { dispatcher.dispatchFailed(this); } else { dispatcher.dispatchComplete(this); } } catch (Downloader.ResponseException e) { if (!e.localCacheOnly || e.responseCode != 504) { exception = e; } dispatcher.dispatchFailed(this); } catch (IOException e) { exception = e; dispatcher.dispatchRetry(this); } catch (OutOfMemoryError e) { StringWriter writer = new StringWriter(); stats.createSnapshot().dump(new PrintWriter(writer)); exception = new RuntimeException(writer.toString(), e); dispatcher.dispatchFailed(this); } catch (Exception e) { exception = e; dispatcher.dispatchFailed(this); } finally { Thread.currentThread().setName(Utils.THREAD_IDLE_NAME); } }
Source:
<code>public List<ACL> getAcl(final String path) throws KeeperException { <START> return reporter.time(tag, "ensurePath", () -> client.getAcl(path)); <END> }</code><technical_language>"getAcl"</technical_language>

Target:
public List<ACL> getAcl(final String path) throws KeeperException { return reporter.time(tag, "getAcl", () -> client.getAcl(path)); }
Source:
<code>public static ScalarFunction getCeilExpression(List<Expression> children) throws SQLException { final Expression firstChild = children.get(0); final PDataType firstChildDataType = firstChild.getDataType(); if(firstChildDataType.isCoercibleTo(PDataType.DATE)) { return new CeilDateExpression(children); } else if(firstChildDataType == PDataType.TIMESTAMP) { return new CeilTimestampExpression(children) ; <START> } else if(firstChildDataType.isCoercibleTo(PDataType.DECIMAL)) { <END> return new CeilDecimalExpression(children); } else { throw new SQLException("Invalid data type: " + firstChildDataType); } }</code><technical_language>Change PDataType.LONG, sense a decimal number</technical_language>

Target:
public static ScalarFunction getCeilExpression(List<Expression> children) throws SQLException { final Expression firstChild = children.get(0); final PDataType firstChildDataType = firstChild.getDataType(); if(firstChildDataType.isCoercibleTo(PDataType.DATE)) { return new CeilDateExpression(children); } else if (firstChildDataType == PDataType.TIMESTAMP || firstChildDataType == PDataType.UNSIGNED_TIMESTAMP) { Object secondChild = ((LiteralExpression)children.get(1)).getValue(); String timeUnit = secondChild == null ? null : secondChild.toString(); TimeUnit tu = TimeUnit.getTimeUnit(timeUnit); LiteralExpression multiplierExpr = (LiteralExpression)children.get(2); if(tu == TimeUnit.MILLISECOND) { return CeilTimestampExpression.create(firstChild, multiplierExpr); } return new CeilDateExpression(children); } else if(firstChildDataType.isCoercibleTo(PDataType.DECIMAL)) { return new CeilDecimalExpression(children); } else { throw new TypeMismatchException(firstChildDataType, "1"); } }
Source:
<code>public org.apache.parquet.column.statistics.Statistics fromParquetStatistics( String createdBy, Statistics statistics, PrimitiveType type) { <START> SortOrder expectedOrder = isSignedOrderOkay(type) ? SortOrder.SIGNED : sortOrder(type); <END> return fromParquetStatisticsInternal( createdBy, statistics, type.getPrimitiveTypeName(), expectedOrder); }</code><technical_language>move checks shouldIgnoreStatistics. more steps necessary decide sort order is OK</technical_language>

Target:
public org.apache.parquet.column.statistics.Statistics fromParquetStatistics( String createdBy, Statistics statistics, PrimitiveType type) { SortOrder expectedOrder = overrideSortOrderToSigned(type) ? SortOrder.SIGNED : sortOrder(type); return fromParquetStatisticsInternal( createdBy, statistics, type.getPrimitiveTypeName(), expectedOrder); }
Source:
<code>void removeUserFromProjectSuccessfully() throws Exception { mvc() .perform(delete("/api/projects/" + testProject.getId() + "/users/" + testUser.getId())) .andExpect(MockMvcResultMatchers.status().isOk()) .andDo(document("user/role/project/remove")) <START> .andReturn(); END> Assertions.assertTrue(userRepository.listUsersForProject(testProject.getId()).isEmpty()); }</code><technical_language>please handle this TODO</technical_language>

Target:
void removeUserFromProjectSuccessfully() throws Exception { mvc() .perform(delete("/api/projects/" + testProject.getId() + "/users/" + testUser.getId())) .andExpect(status().isOk()) .andDo(document("user/role/project/remove")) .andReturn(); Assertions.assertTrue(userRepository.listUsersForProject(testProject.getId()).isEmpty()); }
Source:
<code>public String render(DataObject dataobject, String contentModel, String langCode, RequestContext reqCtx) { <START> dataobject.getAttributeList().forEach(f -> logger.info("render value type {}", f.getName(), f.getValue(), f.getType())); <END> String renderedEntity; try { Context velocityContext = new VelocityContext(); DataObjectWrapper contentWrapper = (DataObjectWrapper) this.getEntityWrapper(dataobject); contentWrapper.setRenderingLang(langCode); velocityContext.put("data", contentWrapper); I18nManagerWrapper i18nWrapper = new I18nManagerWrapper(langCode, this.getI18nManager()); velocityContext.put("i18n", i18nWrapper); SystemInfoWrapper systemInfoWrapper = new SystemInfoWrapper(reqCtx); velocityContext.put("info", systemInfoWrapper); StringWriter stringWriter = new StringWriter(); boolean isEvaluated = Velocity.evaluate(velocityContext, stringWriter, "render", contentModel); if (!isEvaluated){ throw new ApsSystemException("Error rendering DataObject"); } stringWriter.flush(); renderedEntity = stringWriter.toString(); } catch (Throwable t) { logger.error("Error rendering dataobject", t); renderedEntity = ""; } return renderedEntity; }</code><technical_language>This statement debug level. loop is of debu this needs wrapped in if(logger.isDebugEnabled()) check</technical_language>

Target:
public String render(DataObject dataobject, String contentModel, String langCode, RequestContext reqCtx) { String renderedEntity; try { Context velocityContext = new VelocityContext(); DataObjectWrapper contentWrapper = (DataObjectWrapper) this.getEntityWrapper(dataobject); contentWrapper.setRenderingLang(langCode); velocityContext.put("data", contentWrapper); I18nManagerWrapper i18nWrapper = new I18nManagerWrapper(langCode, this.getI18nManager()); velocityContext.put("i18n", i18nWrapper); SystemInfoWrapper systemInfoWrapper = new SystemInfoWrapper(reqCtx); velocityContext.put("info", systemInfoWrapper); StringWriter stringWriter = new StringWriter(); boolean isEvaluated = Velocity.evaluate(velocityContext, stringWriter, "render", contentModel); if (!isEvaluated) { throw new ApsSystemException("Error rendering DataObject"); } stringWriter.flush(); renderedEntity = stringWriter.toString(); } catch (Throwable t) { logger.error("Error rendering dataobject", t); renderedEntity = ""; } return renderedEntity; }
Source:
<code>public static int formatBase10(final byte[] b, int o, int value) { if (value == 0) { b[--o] = '0'; return o; } final boolean isneg = value < 0; <START> if (isneg) { <END> value = -value; } while (value != 0) { b[--o] = base10byte[value % 10]; value /= 10; } if (isneg) b[--o] = '-'; return o; }</code><technical_language>Style-nit: curly braces necessary. cherry-pick this master, a simple bug fix I want held DIRC version 3 code</technical_language>

Target:
public static int formatBase10(final byte[] b, int o, int value) { if (value == 0) { b[--o] = '0'; return o; } final boolean isneg = value < 0; if (isneg) value = -value; while (value != 0) { b[--o] = base10byte[value % 10]; value /= 10; } if (isneg) b[--o] = '-'; return o; }
Source:
<code>private CompletableFuture<Optional<SnmpAgentConfig>> fitProfile(SnmpProfile snmpProfile, InetAddress inetAddress, String location, String oid) { final SnmpAgentConfig agentConfig = agentConfigFactory.getAgentConfigFromProfile(snmpProfile, inetAddress); if (!Strings.isNullOrEmpty(oid)) { snmpObjId = SnmpObjId.get(oid); } if (Strings.isNullOrEmpty(location)) { <START> location = "Default"; <END> } CompletableFuture<Optional<SnmpAgentConfig>> future = new CompletableFuture<>(); CompletableFuture<SnmpValue> snmpResult = locationAwareSnmpClient.get(agentConfig, snmpObjId) .withLocation(location) .withDescription("Snmp-Profile:" + snmpProfile.getLabel()) .execute(); snmpResult.whenComplete(((snmpValue, throwable) -> { if(throwable == null) { if (snmpValue != null && !snmpValue.isError()) { future.complete(Optional.of(agentConfig)); } else { future.complete(Optional.empty()); } } else { LOG.warn("Exception while doing SNMP get on OID '{}' with profile '{}'", snmpObjId, snmpProfile.getLabel(), throwable); future.complete(Optional.empty()); } })); return future; }</code><technical_language>a constant instead</technical_language>

Target:
private CompletableFuture<Optional<SnmpAgentConfig>> fitProfile(SnmpProfile snmpProfile, InetAddress inetAddress, String location, String oid) { SnmpObjId snmpObjectId = this.snmpObjId; final SnmpAgentConfig agentConfig = agentConfigFactory.getAgentConfigFromProfile(snmpProfile, inetAddress); if (!Strings.isNullOrEmpty(oid)) { snmpObjectId = SnmpObjId.get(oid); } CompletableFuture<Optional<SnmpAgentConfig>> future = new CompletableFuture<>(); CompletableFuture<SnmpValue> snmpResult = locationAwareSnmpClient.get(agentConfig, snmpObjectId) .withLocation(location) .withDescription("Snmp-Profile:" + snmpProfile.getLabel()) .execute(); final String objectId = Strings.isNullOrEmpty(oid) ? SYS_OBJECTID_INSTANCE : oid; snmpResult.whenComplete(((snmpValue, throwable) -> { if (throwable == null) { if (snmpValue != null && !snmpValue.isError()) { future.complete(Optional.of(agentConfig)); } else { future.complete(Optional.empty()); } } else { LOG.info("Exception while doing SNMP get on OID '{}' with profile '{}'", objectId, snmpProfile.getLabel()); future.complete(Optional.empty()); } })); return future; }
Source:
<code>private boolean alertVolumeLimitReached(final GlusterVolumeEntity volume, boolean checkHardLimit) { List<AuditLog> limitAlerts = DbFacade.getInstance() .getAuditLogDao() .getByVolumeIdAndType(volume.getId(), checkHardLimit ? AuditLogType.GLUSTER_VOLUME_SNAPSHOT_HARD_LIMIT_REACHED.getValue() <START> : AuditLogType.GLUSTER_VOLUME_SNAPSHOT_SOFT_LIMIT_REACHED.getValue()); <END> if (!limitAlerts.isEmpty()) { for (AuditLog alert : limitAlerts) { if (!alert.isDeleted()) { return true; } } } boolean limitReached = checkHardLimit ? GlusterDBUtils.getInstance().isVolumeSnapshotHardLimitReached(volume.getId()) : GlusterDBUtils.getInstance().isVolumeSnapshotSoftLimitReached(volume.getId()); if (limitReached) { GlusterAuditLogUtil.getInstance().logAuditMessage(volume.getClusterId(), volume, null, checkHardLimit ? AuditLogType.GLUSTER_VOLUME_SNAPSHOT_HARD_LIMIT_REACHED : AuditLogType.GLUSTER_VOLUME_SNAPSHOT_SOFT_LIMIT_REACHED, new HashMap<String, String>() { { put(GlusterConstants.VOLUME_NAME, volume.getName()); put(GlusterConstants.CLUSTER, volume.getVdsGroupName()); } }); return true; } return false; }</code><technical_language>important, for readability, define AuditLogType logType = checkHardLimit ? AuditLogType.GLUSTER_VOLUME_SNAPSHOT_HARD_LIMIT_REACHED : AuditLogType.GLUSTER_VOLUME_SNAPSHOT_SOFT_LIMIT_REACHED this logType in 2 instances here</technical_language>

Target:
private boolean alertVolumeLimitReached(final GlusterVolumeEntity volume, boolean checkHardLimit) { AuditLogType logType = checkHardLimit ? AuditLogType.GLUSTER_VOLUME_SNAPSHOT_HARD_LIMIT_REACHED : AuditLogType.GLUSTER_VOLUME_SNAPSHOT_SOFT_LIMIT_REACHED; List<AuditLog> limitAlerts = DbFacade.getInstance() .getAuditLogDao() .getByVolumeIdAndType(volume.getId(), logType.getValue()); if (!limitAlerts.isEmpty()) { for (AuditLog alert : limitAlerts) { if (!alert.isDeleted()) { return true; } } } boolean limitReached = checkHardLimit ? GlusterDBUtils.getInstance().isVolumeSnapshotHardLimitReached(volume.getId()) : GlusterDBUtils.getInstance().isVolumeSnapshotSoftLimitReached(volume.getId()); if (limitReached) { GlusterAuditLogUtil.getInstance().logAuditMessage(volume.getClusterId(), volume, null, logType, new HashMap<String, String>() { { put(GlusterConstants.VOLUME_NAME, volume.getName()); put(GlusterConstants.CLUSTER, volume.getVdsGroupName()); } }); return true; } return false; }
Source:
<code>public boolean syncCRLWithDB(File file) throws IOException { List<BigInteger> revoke = new LinkedList<BigInteger>(); List<CertificateSerial> serials = this.certificateSerialCurator.retrieveTobeCollectedSerials(); for (CertificateSerial serial : serials) { revoke.add(serial.getSerial()); serial.setCollected(true); } List<BigInteger> unrevoke = new LinkedList<BigInteger>(); for (CertificateSerial serial : this.certificateSerialCurator.getExpiredSerials()) { unrevoke.add(serial.getSerial()); } <START> if (revoke.size() > 0 || revoke.size() > 0) { <END> this.updateCRLFile(file, revoke, unrevoke); this.certificateSerialCurator.saveOrUpdateAll(serials); } return true; }</code><technical_language>this if (revoke.size() > 0 || unrevoke.size() > 0) {</technical_language>

Target:
public boolean syncCRLWithDB(File file) throws IOException { List<BigInteger> revoke = new LinkedList<BigInteger>(); List<CertificateSerial> serials = this.certificateSerialCurator.retrieveTobeCollectedSerials(); for (CertificateSerial serial : serials) { revoke.add(serial.getSerial()); serial.setCollected(true); } List<BigInteger> unrevoke = new LinkedList<BigInteger>(); for (CertificateSerial serial : this.certificateSerialCurator.getExpiredSerials()) { unrevoke.add(serial.getSerial()); } if (revoke.size() > 0 || unrevoke.size() > 0) { this.updateCRLFile(file, revoke, unrevoke); this.certificateSerialCurator.saveOrUpdateAll(serials); } return true; }
Source:
<code><START> public CharSequence toXML() { <END> XmlStringBuilder xml = new XmlStringBuilder(); xml.halfOpenElement(this); xml.attribute(ATTR_START, getStart()); xml.attribute(ATTR_END, getEnd()); xml.closeEmptyElement(); return xml; }</code><technical_language>toXML() method declare returns XmlStringBuilder if possible, allowing runtime shortcuts. This applies classes of this PR</technical_language>

Target:
public XmlStringBuilder toXML() { XmlStringBuilder xml = new XmlStringBuilder(); xml.halfOpenElement(this); xml.attribute(ATTR_START, getStart()); xml.attribute(ATTR_END, getEnd()); xml.closeEmptyElement(); return xml; }
Source:
<code>public String getBucketLifeCycle(String bucketName) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException, InternalException { Map<String,String> queryParamMap = new HashMap<>(); queryParamMap.put("lifecycle", ""); byte[] buf = new byte[16384]; int bytesRead = 0; HttpResponse response = null; try { response = executeGet(bucketName, "", null, queryParamMap); <START> bytesRead = response.body().byteStream().read(buf); <END> if (bytesRead < 0) { throw new IOException("reached EOF when reading bucket lifecycle"); } } catch (ErrorResponseException e) { if (e.errorResponse().errorCode() != ErrorCode.NO_SUCH_LIFECYCLE_CONFIGURATION) { throw e; } } finally { if (response != null && response.body() != null) { response.body().close(); } } return new String(buf, 0, bytesRead, StandardCharsets.UTF_8); }</code><technical_language>do read 16K only</technical_language>

Target:
public String getBucketLifeCycle(String bucketName) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException, InternalException { Map<String,String> queryParamMap = new HashMap<>(); queryParamMap.put("lifecycle", ""); HttpResponse response = null; String bodyContent = ""; Scanner scanner = null ; try { response = executeGet(bucketName, "", null, queryParamMap); scanner = new Scanner(response.body().charStream()); scanner.useDelimiter("\\A"); if (scanner.hasNext()) { bodyContent = scanner.next(); } } catch (ErrorResponseException e) { if (e.errorResponse().errorCode() != ErrorCode.NO_SUCH_LIFECYCLE_CONFIGURATION) { throw e; } } finally { if (response != null && response.body() != null) { response.body().close(); } if (scanner != null) { scanner.close(); } } return bodyContent; }
Source:
<code>public void write(OutgoingMessageEnvelope ome) throws IOException { Optional<IndexedRecord> optionalIndexedRecord; byte[] encodedRecord; if (ome.getMessage() instanceof IndexedRecord) { optionalIndexedRecord = Optional.of((IndexedRecord) ome.getMessage()); encodedRecord = encodeRecord((IndexedRecord) ome.getMessage()); <START> } else { <END> optionalIndexedRecord = Optional.empty(); encodedRecord = (byte[]) ome.getMessage(); } synchronized (currentDataFileWriterLock) { if (currentBlobWriterComponents == null || willCurrentBlobExceedSize(encodedRecord) || willCurrentBlobExceedRecordLimit()) { startNextBlob(optionalIndexedRecord); } currentBlobWriterComponents.dataFileWriter.appendEncoded(ByteBuffer.wrap(encodedRecord)); recordsInCurrentBlob++; } }</code><technical_language>If ome.getMessage() is IndexedRecord a byte[], good handle case explicitly</technical_language>

Target:
public void write(OutgoingMessageEnvelope ome) throws IOException { Optional<IndexedRecord> optionalIndexedRecord; byte[] encodedRecord; if (ome.getMessage() instanceof IndexedRecord) { optionalIndexedRecord = Optional.of((IndexedRecord) ome.getMessage()); encodedRecord = encodeRecord((IndexedRecord) ome.getMessage()); } else if (ome.getMessage() instanceof byte[]) { optionalIndexedRecord = Optional.empty(); encodedRecord = (byte[]) ome.getMessage(); } else { throw new IllegalArgumentException("AzureBlobAvroWriter only supports IndexedRecord and byte[]."); } synchronized (currentDataFileWriterLock) { if (currentBlobWriterComponents == null || willCurrentBlobExceedSize(encodedRecord) || willCurrentBlobExceedRecordLimit()) { startNextBlob(optionalIndexedRecord); } currentBlobWriterComponents.dataFileWriter.appendEncoded(ByteBuffer.wrap(encodedRecord)); recordsInCurrentBlob++; } }
Source:
<code><START> public TimeSpeedConverter() { <END> }</code><technical_language>reason this utility class instantiated (has state)</technical_language>

Target:
private TimeSpeedConverter() { }
Source:
<code>public void testJsonPathAsText() throws Exception { <START> String selectQuery = "SELECT col1 FROM testJson WHERE col1 #>> '{k6,nestk4,0}' LIKE '9'"; <END> String pk = "valueOne"; Connection conn = getConnection(); try { createTableAndUpsertRecord(json, pk, conn); PreparedStatement stmt = conn.prepareStatement(selectQuery); ResultSet rs = stmt.executeQuery(); assertTrue(rs.next()); assertEquals("Json data read from DB is not as expected for query: <" + selectQuery + ">", json, rs.getString(1)); assertFalse(rs.next()); } finally { conn.close(); } }</code><technical_language>Change =</technical_language>

Target:
public void testJsonPathAsText() throws Exception { String selectQuery = "SELECT col1 FROM testJson WHERE col1 #>> ARRAY['k6','nestk4','0'] = '9'"; String pk = "valueOne"; Connection conn = getConnection(); try { createTableAndUpsertRecord(json, pk, conn); PreparedStatement stmt = conn.prepareStatement(selectQuery); ResultSet rs = stmt.executeQuery(); assertTrue(rs.next()); assertEquals("Json data read from DB is not as expected for query: <" + selectQuery + ">", json, rs.getString(1)); assertFalse(rs.next()); } finally { conn.close(); } }
Source:
<code>public void have_own_assertTrue() { Tests.assertTrue(true); <START> Tests.assertTrue(false); <END> }</code><technical_language>This test case in error-prone. statement AssertionError. Try try-catch instead. This determine AssetionError is thrown statement</technical_language>

Target:
public void have_own_assertTrue() { Tests.assertTrue(false); }
Source:
<code>public Map<String,String> getOptions() { <START> return Collections.<String,String>emptyMap(); <END> }</code><technical_language>base implementation throw UnsupportedOperationException, feature is provided overriding method in a derived type</technical_language>

Target:
public Map<String,String> getOptions() { throw new UnsupportedOperationException("The current recognizer does not provide an option map"); }
Source:
<code>public List<T> nextN(long elements, long timeoutMillis, String errorMsg) throws InterruptedException { List<T> result = new LinkedList<T>(); long remaining = elements; while (remaining > 0) { <START> result.add(next(timeoutMillis, errorMsg)); END> remaining--; } return result; }</code><technical_language>is applying wrong timeout, display inaccuracy ;-)</technical_language>

Target:
public List<T> nextN(long elements, long timeoutMillis, String errorMsg) throws InterruptedException { List<T> result = new LinkedList<T>(); long remaining = elements; long deadline = System.currentTimeMillis() + timeoutMillis; while (remaining > 0) { long remainingMillis = deadline - System.currentTimeMillis(); result.add(next(remainingMillis, errorMsg)); remaining--; } return result; }
Source:
<code>private void setupBackgroundImage() { if (mode == 0) return; bgshape = bgblack; if (!Utility.isLowRamDevice(mContext)) { switch (settings.getBackgroundMode()){ case Settings.BACKGROUND_BLACK: { bgshape = bgblack; break; } case Settings.BACKGROUND_GRADIENT: { bgshape = ContextCompat.getDrawable(mContext, R.drawable.background_gradient); break; } case Settings.BACKGROUND_IMAGE: { bgshape = loadBackgroundImage(); break; } case Settings.BACKGROUND_SLIDESHOW: { if (preloadBackgroundImage == null) { bgshape = loadBackgroundSlideshowImage(); } else { bgshape = new BitmapDrawable(mContext.getResources(), preloadBackgroundImage); } break; } } } if ( settings.hideBackgroundImage && mode == 0 ) { background_images[background_image_active].setImageDrawable(bgblack); } else { <START> if (background_image_active == 0){ background_image_active = 1; }else { background_image_active = 0; } <END> switch (settings.slideshowStyle) { case Settings.SLIDESHOW_STYLE_CROPPED: background_images[background_image_active].setScaleType(ImageView.ScaleType.CENTER_CROP); break; case Settings.SLIDESHOW_STYLE_CENTER: background_images[background_image_active].setScaleType(ImageView.ScaleType.CENTER_INSIDE); break; } parentLayout.bringChildToFront(background_images[background_image_active]); background_images[background_image_active].setImageDrawable(bgshape); setupSlideshowAnimation(); } }</code><technical_language>background_image_active = (background_image_active + 1) % 2</technical_language>

Target:
private void setupBackgroundImage() { if (mode == 0) return; bgshape = bgblack; if (!Utility.isLowRamDevice(mContext)) { switch (settings.getBackgroundMode()){ case Settings.BACKGROUND_BLACK: { bgshape = bgblack; break; } case Settings.BACKGROUND_GRADIENT: { bgshape = ContextCompat.getDrawable(mContext, R.drawable.background_gradient); break; } case Settings.BACKGROUND_IMAGE: { bgshape = loadBackgroundImage(); break; } case Settings.BACKGROUND_SLIDESHOW: { if (preloadBackgroundImage == null) { bgshape = loadBackgroundSlideshowImage(); } else { bgshape = new BitmapDrawable(mContext.getResources(), preloadBackgroundImage); setDominantColorFromBitmap(preloadBackgroundImage); } break; } } } if ( settings.hideBackgroundImage && mode == 0 ) { background_images[background_image_active].setImageDrawable(bgblack); } else { background_image_active = (background_image_active + 1) % 2; switch (settings.slideshowStyle) { case Settings.SLIDESHOW_STYLE_CENTER: background_images[background_image_active].setScaleType(ImageView.ScaleType.CENTER_INSIDE); break; case Settings.SLIDESHOW_STYLE_CROPPED: default: background_images[background_image_active].setScaleType(ImageView.ScaleType.CENTER_CROP); break; } background_images[background_image_active].setImageDrawable(bgshape); setupSlideshowAnimation(); } }
Source:
<code>public ValueNode[] getParsedIndexExpressions(LanguageConnectionContext context, Optimizable optTable) throws StandardException { LanguageConnectionContext lcc = context; if (lcc == null) { lcc = (LanguageConnectionContext) ContextService.getContext(LanguageConnectionContext.CONTEXT_ID); } assert lcc != null; if (exprAsts != null) { for (ValueNode ast : exprAsts) { <START> setTableNumberToIndexExpr(ast, optTable); bindNecessaryNodesInIndexExpr(ast, optTable, lcc); <END> } return exprAsts; } exprAsts = new ValueNode[exprTexts.length]; CompilerContext oldCC = (CompilerContext) ContextService.getContext(CompilerContext.CONTEXT_ID); assert(oldCC != null); CompilerContext newCC = lcc.pushCompilerContext(); newCC.setCurrentDependent(oldCC.getCurrentDependent()); Parser p = newCC.getParser(); for (int i = 0; i < exprTexts.length; i++) { ValueNode exprAst = (ValueNode) p.parseSearchCondition(exprTexts[i]); setTableNumberToIndexExpr(exprAst, optTable); bindNecessaryNodesInIndexExpr(exprAst, optTable, lcc); exprAsts[i] = exprAst; } lcc.popCompilerContext(newCC); return exprAsts; }</code><technical_language>@ascend1 check if IndexDescriptorImpl is cached part of TableDescriptor in dictionary cache? If so, is shared queries code data structure modified concurrently, problematic</technical_language>

Target:
public ValueNode[] getParsedIndexExpressions(LanguageConnectionContext context, Optimizable optTable) throws StandardException { LanguageConnectionContext lcc = context; if (lcc == null) { lcc = (LanguageConnectionContext) ContextService.getContext(LanguageConnectionContext.CONTEXT_ID); } assert lcc != null; ValueNode[] exprAsts = new ValueNode[exprTexts.length]; CompilerContext oldCC = (CompilerContext) ContextService.getContext(CompilerContext.CONTEXT_ID); assert(oldCC != null); CompilerContext newCC = lcc.pushCompilerContext(); newCC.setCurrentDependent(oldCC.getCurrentDependent()); Parser p = newCC.getParser(); for (int i = 0; i < exprTexts.length; i++) { ValueNode exprAst = (ValueNode) p.parseSearchCondition(exprTexts[i]); setTableNumberToIndexExpr(exprAst, optTable); bindNecessaryNodesInIndexExpr(exprAst, optTable, lcc); exprAsts[i] = exprAst; } lcc.popCompilerContext(newCC); return exprAsts; }
Source:
<code>public void setCustomAttributes(Map<String, String> attributes) { requireCustomAttributesEnabled("setCustomAttributes"); assert attributes != null; <START> synchronized (customAttributes) { <END> customAttributes.clear(); customAttributes.putAll(attributes); } }</code><technical_language>I need design this API thread safe. I legacy Smack code there, do in this case</technical_language>

Target:
public void setCustomAttributes(Map<String, String> attributes) { requireCustomAttributesEnabled(); assert attributes != null; for (String attr : attributes.keySet()) { failIfRegistered(attr); } requireCustomAttributes(); customAttributes.clear(); customAttributes.putAll(attributes); }
Source:
<code>public Statistic adopt(Statistic statistic) { <START> statistic.setGlusterVolume(clone(parent)); <END> return statistic; }</code><technical_language>is this clone necessary</technical_language>

Target:
public Statistic adopt(Statistic statistic) { statistic.setGlusterVolume(parent); return statistic; }
Source:
<code>public void terminatedPod() throws Exception { r.waitForMessage("+ sleep", b); deletePods(cloud.connect(), getLabels(this, name), false); r.assertBuildStatus(Result.ABORTED, r.waitForCompletion(b)); <START> r.waitForMessage("Container jnlp was terminated", b); <END> }</code><technical_language>Mm, making this test useless testing original fix. OK</technical_language>

Target:
public void terminatedPod() throws Exception { r.waitForMessage("+ sleep", b); deletePods(cloud.connect(), getLabels(this, name), false); r.assertBuildStatus(Result.ABORTED, r.waitForCompletion(b)); r.waitForMessage(new ExecutorStepExecution.RemovedNodeCause().getShortDescription(), b); }
Source:
<code>protected void run(Date lastRun) { try { ShareUtils.clearFolder(getContext()); <START> } catch (Exception e) { <END> Log.d("SharedImageCleanupTask", "Failed to clear shared image folder.", e); } }</code><technical_language>I prefer move catch block clearFolder implementation is called another place well</technical_language>

Target:
protected void run(Date lastRun) { ShareUtils.clearFolder(getContext()); }
Source:
<code>private <ResultType> ResultType doGet(String path, Class<ResultType> resultTypeClass) throws TDClientException <START> { <END> TDApiRequest request = TDApiRequest.Builder.GET(path).build(); return httpClient.call(request, apiKeyCache, resultTypeClass); }</code><technical_language>checkNotNull(path, "pash is null");</technical_language>

Target:
private <ResultType> ResultType doGet(String path, Class<ResultType> resultTypeClass) throws TDClientException { checkNotNull(path, "path is null"); checkNotNull(resultTypeClass, "resultTypeClass is null"); TDApiRequest request = TDApiRequest.Builder.GET(path).build(); return httpClient.call(request, apiKeyCache, resultTypeClass); }
Source:
<code>public static ColorDescriptor getDecorationsColorDescriptorFromCurrentTheme() { ITheme theme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme(); <START> System.out.println(theme.getColorRegistry().getKeySet()); <END> return Preconditions.checkNotNull(theme.getColorRegistry().getColorDescriptor(DECORATIONS_COLOR)); }</code><technical_language>this System.out here</technical_language>

Target:
public static ColorDescriptor getDecorationsColorDescriptorFromCurrentTheme() { ITheme theme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme(); return Preconditions.checkNotNull(theme.getColorRegistry().getColorDescriptor(DECORATIONS_COLOR)); }
Source:
<code>public void trace(Object arg0) { <START> if(log.isTraceEnabled()) { <END> log.trace(arg0); } }</code><technical_language>i line replaced log.trace(addPrefixToLogMessage(arg0)); in order justify log.isTraceEnabled(). (as added originally addPrefixToLogMessage() introduced in this file)</technical_language>

Target:
public void trace(Object arg0) { if(log.isTraceEnabled()) { log.trace(addPrefixToLogMessage(arg0)); } }
Source:
<code>public boolean performNextOperation(int completedChildren) { if (completedChildren == getParameters().getImageIds().size()) { return false; } if (completedChildren == 0) { ImagesHandler.updateAllDiskImageSnapshotsStatus(getImageGroupId(), ImageStatus.LOCKED); } else { if (isLiveMerge()) { checkImageIdConsistency(completedChildren - 1); } } Guid nextImageId = getParameters().getImageIds().get(completedChildren); log.info("Starting child command of {}, image '{}'", completedChildren + 1, getParameters().getImageIds().size(), nextImageId); ImagesContainterParametersBase parameters = isLiveMerge() ? buildRemoveSnapshotSingleDiskLiveParameters(nextImageId, completedChildren) : buildRemoveSnapshotSingleDiskParameters(nextImageId); parameters.setEndProcedure(EndProcedure.COMMAND_MANAGED); <START> persistCommand(getParameters().getParentCommand(), true); <END> CommandCoordinatorUtil.executeAsyncCommand( isLiveMerge() ? VdcActionType.RemoveSnapshotSingleDiskLive : VdcActionType.RemoveSnapshotSingleDisk, parameters, cloneContextAndDetachFromParent()); return true; }</code><technical_language>this is relevant for live merge (after modify command parameters)</technical_language>

Target:
public boolean performNextOperation(int completedChildren) { return isLiveMerge() ? performNextOperationLiveMerge(completedChildren) : performNextOperationColdMerge(completedChildren); }
Source:
<code>private void toggleWatchingState() { WatchingService service = ServiceFactory.get(WatchingService.class, false); final String repoOwner = mRepository.owner().login(), repoName = mRepository.name(); final Single<?> responseSingle; if (mIsWatching) { responseSingle = service.deleteRepositorySubscription(repoOwner, repoName) .map(ApiHelpers::throwOnFailure); } else { SubscriptionRequest request = SubscriptionRequest.builder() .subscribed(true) .build(); responseSingle = service.setRepositorySubscription(repoOwner, repoName, request) .map(ApiHelpers::throwOnFailure); } responseSingle.compose(RxUtils::doInBackground) .subscribe(result -> { if (mIsWatching != null) { mIsWatching = !mIsWatching; mRepository = mRepository.toBuilder() .watchersCount(mRepository.watchersCount() + (mIsWatching ? 1 : -1)) .build(); <START> updateStargazerUi(); <END> } }, error -> { handleActionFailure("Updating repo watching state failed", error); updateStargazerUi(); }); }</code><technical_language>Yes, should</technical_language>

Target:
private void toggleWatchingState() { WatchingService service = ServiceFactory.get(WatchingService.class, false); final String repoOwner = mRepository.owner().login(), repoName = mRepository.name(); final Single<?> responseSingle; if (mIsWatching) { responseSingle = service.deleteRepositorySubscription(repoOwner, repoName) .map(ApiHelpers::throwOnFailure); } else { SubscriptionRequest request = SubscriptionRequest.builder() .subscribed(true) .build(); responseSingle = service.setRepositorySubscription(repoOwner, repoName, request) .map(ApiHelpers::throwOnFailure); } responseSingle.compose(RxUtils::doInBackground) .subscribe(result -> { if (mIsWatching != null) { mIsWatching = !mIsWatching; mRepository = mRepository.toBuilder() .subscribersCount(mRepository.subscribersCount() + (mIsWatching ? 1 : -1)) .build(); updateWatcherUi(); } }, error -> { handleActionFailure("Updating repo watching state failed", error); updateWatcherUi(); }); }
Source:
<code>public Map<Cell, byte[]> get(TableReference tableRef, Set<Cell> cells) { try { return get( tableRef, cells, <START> ((tableReference, toRead) -> Futures.immediateFuture(super.get(tableReference, toRead)))).get(); <END> } catch (InterruptedException | ExecutionException e) { throw Throwables.rewrapAndThrowUncheckedException(e.getCause()); } }</code><technical_language>nit: extra parenthesis</technical_language>

Target:
public Map<Cell, byte[]> get(TableReference tableRef, Set<Cell> cells) { try { return get( tableRef, cells, (tableReference, toRead) -> Futures.immediateFuture(super.get(tableReference, toRead))).get(); } catch (InterruptedException | ExecutionException e) { throw Throwables.rewrapAndThrowUncheckedException(e.getCause()); } }
Source:
<code>private void sendEmail(JobExecutionContext jobContext, List<List<String>> csvRows, List<CertificationBodyDTO> acbs) throws MessagingException { LOGGER.info("Sending email to with contents and a total of pending change requests", getEmailRecipients(jobContext).get(0), getHtmlMessage(csvRows.size()), csvRows.size()); EmailBuilder emailBuilder = new EmailBuilder(env); emailBuilder.recipients(getEmailRecipients(jobContext)) .subject(getSubject(jobContext)) <START> .htmlMessage(getHtmlMessage(csvRows.size()) + getAcbNamesAsCommaSeparatedList(jobContext)) <END> .fileAttachments(getAttachments(csvRows, acbs)) .sendEmail(); }</code><technical_language>a change in getHtmlMessage method</technical_language>

Target:
private void sendEmail(JobExecutionContext jobContext, List<List<String>> csvRows, List<CertificationBodyDTO> acbs) throws MessagingException { LOGGER.info("Sending email to with contents and a total of pending change requests", getEmailRecipients(jobContext).get(0), getHtmlMessage(csvRows.size(), getAcbNamesAsCommaSeparatedList(jobContext))); EmailBuilder emailBuilder = new EmailBuilder(env); emailBuilder.recipients(getEmailRecipients(jobContext)) .subject(getSubject(jobContext)) .htmlMessage(getHtmlMessage(csvRows.size(), getAcbNamesAsCommaSeparatedList(jobContext))) .fileAttachments(getAttachments(csvRows, acbs)) .sendEmail(); }
Source:
<code>public void handle(StateContext state, SubCollectionReadCollectionContext ctx) { String subCollection = ctx.term().getText(); EntityDictionary dictionary = state.getRequestScope().getDictionary(); try { RelationshipType type = dictionary.getRelationshipType(resource.getObject(), subCollection); if (type == RelationshipType.NONE) { <START> throw new ForbiddenAccessException(subCollection); <END> } String entityName = dictionary.getJsonAliasFor(dictionary.getParameterizedType(resource.getObject(), subCollection)); Class<?> entityClass = dictionary.getEntityClass(entityName); if (entityClass == null) { throw new IllegalArgumentException("Unknown type " + entityName); } final BaseState nextState; final CollectionTerminalState collectionTerminalState = new CollectionTerminalState(entityClass, Optional.of(resource), Optional.of(subCollection)); Set<PersistentResource> collection = null; if (type.isToOne()) { Optional<FilterExpression> filterExpression = state.getRequestScope().getExpressionForRelation(resource, subCollection); collection = resource.getRelationCheckedFiltered(subCollection, filterExpression, Optional.empty(), Optional.empty()); } if (collection instanceof SingleElementSet) { PersistentResource record = ((SingleElementSet<PersistentResource>) collection).getValue(); nextState = new RecordTerminalState(record, collectionTerminalState); } else { nextState = collectionTerminalState; } state.setState(nextState); } catch (InvalidAttributeException e) { throw new InvalidCollectionException(subCollection); } }</code><technical_language>is a missed case in other handle function</technical_language>

Target:
public void handle(StateContext state, SubCollectionReadCollectionContext ctx) { String subCollection = ctx.term().getText(); EntityDictionary dictionary = state.getRequestScope().getDictionary(); try { RelationshipType type = dictionary.getRelationshipType(resource.getObject(), subCollection); if (type == RelationshipType.NONE) { throw new ForbiddenAccessException(subCollection); } String entityName = dictionary.getJsonAliasFor(dictionary.getParameterizedType(resource.getObject(), subCollection)); Class<?> entityClass = dictionary.getEntityClass(entityName); if (entityClass == null) { throw new IllegalArgumentException("Unknown type " + entityName); } final BaseState nextState; final CollectionTerminalState collectionTerminalState = new CollectionTerminalState(entityClass, Optional.of(resource), Optional.of(subCollection)); Set<PersistentResource> collection = null; if (type.isToOne()) { Optional<FilterExpression> filterExpression = state.getRequestScope().getExpressionForRelation(resource, subCollection); collection = resource.getRelationCheckedFiltered(subCollection, filterExpression, Optional.empty(), Optional.empty()); } if (collection instanceof SingleElementSet) { PersistentResource record = ((SingleElementSet<PersistentResource>) collection).getValue(); nextState = new RecordTerminalState(record, collectionTerminalState); } else { nextState = collectionTerminalState; } state.setState(nextState); } catch (InvalidAttributeException e) { throw new ForbiddenAccessException(subCollection); } }
Source:
<code>public void onReceivedError (WebView view, int errorCode, String description, String failingUrl) { Log_OC.e(TAG, "onReceivedError : " + failingUrl + ", code " + errorCode + ", description: " + description); if (!failingUrl.equals(mLastReloadedUrlAtError)) { view.reload(); mLastReloadedUrlAtError = failingUrl; <START> } else { <END> mLastReloadedUrlAtError = null; } }</code><technical_language>call super.onReceivedError();</technical_language>

Target:
public void onReceivedError (WebView view, int errorCode, String description, String failingUrl) { Log_OC.e(TAG, "onReceivedError : " + failingUrl + ", code " + errorCode + ", description: " + description); if (!failingUrl.equals(mLastReloadedUrlAtError)) { view.reload(); mLastReloadedUrlAtError = failingUrl; } else { mLastReloadedUrlAtError = null; super.onReceivedError(view, errorCode, description, failingUrl); } }
Source:
<code>private final void configureConstructorInjection() { Constructor<?>[] constructors = msgHandler.getDeclaredConstructors(); for (Constructor<?> constructor : constructors) { if (constructor.isAnnotationPresent(Inject.class)) { <START> this.constructor = constructor; <END> this.constructorAnnotations = this.constructor.getParameterAnnotations(); break; } } }</code><technical_language>worth log error warning (realistically, logging error is more immediately useful) multiple constructors annotated @Inject</technical_language>

Target:
private final void configureConstructorInjection() { Constructor<?>[] constructors = msgHandler.getDeclaredConstructors(); List<Constructor> injectableConstructors = Arrays.stream(constructors).filter(constructor -> constructor.isAnnotationPresent(Inject.class)).collect(Collectors.toList()); if (injectableConstructors.size() > 0) { this.constructor = injectableConstructors.get(0); this.constructorAnnotations = this.constructor.getParameterAnnotations(); if (injectableConstructors.size() > 1) { log.error("Multiple constructors annotated with Inject. Using first injectable constructor found"); } } }