auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private boolean sendHeaderPayloads(String path, String host, String schema, URI uri) throws IOException { String[] headerPayloads = { "X-Rewrite-URL: " + path, "X-Original-URL: " + path, "Referer: " + path, "X-Custom-IP-Authorization: 127.0.0.1", "X-Originating-IP: 127.0.0.1", "X-Forwarded-For: 127.0.0.1", "X-Remote-IP: 127.0.0.1", "X-Client-IP: 127.0.0.1", "X-Host: 127.0.0.1", "X-Forwared-Host: 127.0.0.1" }; for (String header : headerPayloads) { String tmpUri = schema + "://" + host; if (header.contains("X-Rewrite-URL")) { tmpUri = tmpUri + "/anything"; <START> } else if (header.contains("X-Original-URL")) { tmpUri = tmpUri + "://" + host + "/"; <END> } else if (header.contains("Referer")) { tmpUri = tmpUri + "://" + host + "/anything"; } else { tmpUri = tmpUri + path; } HttpMessage reqWithPayload = new HttpMessage(new URI(tmpUri, true)); String[] headerPayload = header.split(":"); reqWithPayload.getRequestHeader().setHeader(headerPayload[0], headerPayload[1]); sendAndReceive(reqWithPayload); if (reqWithPayload.getResponseHeader().getStatusCode() == HttpStatusCode.OK) { createAlert(uri.toString(), reqWithPayload).raise(); return true; } } return false; }</code><technical_language>cases covered tests too</technical_language>

Target:
private boolean sendHeaderPayloads(String path, String host, String schema, URI uri) throws IOException { String[] headerPayloads = { "X-Rewrite-URL: " + path, "X-Original-URL: " + path, "Referer: " + path, "X-Custom-IP-Authorization: 127.0.0.1", "X-Originating-IP: 127.0.0.1", "X-Forwarded-For: 127.0.0.1", "X-Remote-IP: 127.0.0.1", "X-Client-IP: 127.0.0.1", "X-Host: 127.0.0.1", "X-Forwared-Host: 127.0.0.1" }; for (String header : headerPayloads) { String tmpUri = schema + "://" + host; if (header.contains("X-Rewrite-URL") || header.contains("Referer")) { tmpUri = tmpUri + "/anything"; } else if (header.contains("X-Original-URL")) { tmpUri = tmpUri + "/"; } else { tmpUri = tmpUri + path; } HttpMessage reqWithPayload = new HttpMessage(new URI(tmpUri, true)); String[] headerPayload = header.split(":"); reqWithPayload.getRequestHeader().setHeader(headerPayload[0], headerPayload[1]); sendAndReceive(reqWithPayload); if (reqWithPayload.getResponseHeader().getStatusCode() == HttpStatusCode.OK) { createAlert(uri.toString(), reqWithPayload, header).raise(); return true; } } return false; }
Source:
<code><START> public ClientConfiguration getConf() { <END> return conf; }</code><technical_language>This is good. this object is mutable. Whitebox in tests</technical_language>

Target:
protected ClientConfiguration getConf() { return conf; }
Source:
<code><START> public ResponseEntity putSynonymCatalog(@PathVariable("tenant") final String tenant, <END> @PathVariable("name") final String name, @RequestBody final SynonymCatalogModel synonymCatalogModel) { final TenantContext context = _contextFactory.getContext(tenant); final FileResource resource = new FileResource(getResourceFile(context, name)); resource.write(stream -> { for (final Synonym synonym : synonymCatalogModel.getEntries()) { final List<String> line = new ArrayList<>(synonym.getSynonyms().size() + 1); line.add(synonym.getMasterTerm()); line.addAll(synonym.getSynonyms()); stream.write((Joiner.on(",").join(line) + "\n").getBytes("UTF-8")); } }); final TextFileSynonymCatalog catalog = new TextFileSynonymCatalog(name, resource.getFile(), synonymCatalogModel.isCaseSensitive(), "UTF-8"); _referenceDataDao.removeSynonymCatalog(context, name); _referenceDataDao.addSynonymCatalog(context, catalog); return ResponseEntity.created(ServletUriComponentsBuilder.fromCurrentRequestUri().build().toUri()).build(); }</code><technical_language>ResponseEntity is a raw type. References generic type ResponseEntity<T> parameterized</technical_language>

Target:
public ResponseEntity<Void> putSynonymCatalog(@PathVariable("tenant") final String tenant, @PathVariable("name") final String name, @RequestBody final SynonymCatalogModel synonymCatalogModel) { final TenantContext context = _contextFactory.getContext(tenant); final FileResource resource = new FileResource(getResourceFile(context, name)); resource.write(stream -> { for (final Synonym synonym : synonymCatalogModel.getEntries()) { final List<String> line = new ArrayList<>(synonym.getSynonyms().size() + 1); line.add(synonym.getMasterTerm()); line.addAll(synonym.getSynonyms()); stream.write((Joiner.on(",").join(line) + "\n").getBytes("UTF-8")); } }); final TextFileSynonymCatalog catalog = new TextFileSynonymCatalog(name, resource.getFile(), synonymCatalogModel.isCaseSensitive(), "UTF-8"); _referenceDataDao.removeSynonymCatalog(context, name); _referenceDataDao.addSynonymCatalog(context, catalog); return ResponseEntity.created(ServletUriComponentsBuilder.fromCurrentRequestUri().build().toUri()).build(); }
Source:
<code>public boolean isAvailable() { boolean isAvailable = false; <START> if (!isAvailable) return true; <END> if (!lastAvailable || (lastAvailableDate.before( new Date(System.currentTimeMillis() - AVAILABLE_TIMEOUT_CHECK)))) { WebClient client; Response response; try { client = factory.getWebClient(); response = client.head(); } catch (Exception e) { LOGGER.debug("Web Client was unable to connect to endpoint.", e); return false; } if (response != null && !(response.getStatus() >= 404 || response.getStatus() == 402)) { isAvailable = true; lastAvailableDate = new Date(); } } else { isAvailable = lastAvailable; } lastAvailable = isAvailable; return isAvailable; }</code><technical_language>this condition true</technical_language>

Target:
public boolean isAvailable() { boolean isAvailable = false; if (!lastAvailable || (lastAvailableDate.before( new Date(System.currentTimeMillis() - AVAILABLE_TIMEOUT_CHECK)))) { WebClient client; Response response; try { client = factory.getWebClient(); response = client.head(); } catch (Exception e) { LOGGER.debug("Web Client was unable to connect to endpoint.", e); return false; } if (response != null && !(response.getStatus() >= 404 || response.getStatus() == 402)) { isAvailable = true; lastAvailableDate = new Date(); } } else { isAvailable = lastAvailable; } lastAvailable = isAvailable; return isAvailable; }
Source:
<code><START> public static <T> T[] filter(T[] array, IUnaryPredicate<T> predicate) { <END> T[] result = array; int resultIndex = 0; for (int i = 0; i < array.length; ++i) { if (predicate.apply(array[i])) { if (result != array) { result[resultIndex] = array[i]; } ++resultIndex; } else { if (result == array) { result = (T[]) Array.newInstance(array.getClass().getComponentType(), array.length - 1); System.arraycopy(array, 0, result, 0, i); } } } return trim(result); }</code><technical_language>A method similar this parameter Connection<T> more convenient for in CPPSemantics. method moved /org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/util/CollectionUtils.java</technical_language>

Target:
public static <T> T[] filter(T[] array, IUnaryPredicate<T> predicate) { T[] result = array; int resultIndex = 0; for (int i = 0; i < array.length; ++i) { if (predicate.apply(array[i])) { if (result != array) { result[resultIndex] = array[i]; } ++resultIndex; } else { if (result == array) { result = Arrays.copyOf(array, array.length - 1); Arrays.fill(result, i, result.length, null); } } } return resultIndex == result.length ? result : Arrays.copyOf(result, resultIndex); }
Source:
<code>public void execute(CommandContext commandContext) { CoreExecution context = null; if (executionId != null) { context = getExecution(); ensureNotNull("Cannot find execution with id '" + executionId + "' referenced from job '" + this + "'", "execution", execution); } else if (caseExecutionId != null) { context = getCaseExecution(); ensureNotNull("Cannot find case execution with id '" + caseExecutionId + "' referenced from job '" + id + "'", caseExecution); } getActivityId(); incrementSequenceCounter(); preExecute(commandContext); JobHandler jobHandler = getJobHandler(); JobHandlerConfiguration configuration = getJobHandlerConfiguration(); ensureNotNull("Cannot find job handler '" + jobHandlerType + "' from job '" + this + "'", "jobHandler", jobHandler); <START> if(execution!=null) jobHandler.execute(configuration, execution, commandContext, tenantId); <END> else if(caseExecution!=null) jobHandler.execute(configuration,caseExecution,commandContext,tenantId); postExecute(commandContext); }</code><technical_language>In line 125 133 handles cases execution caseExecution is set. invoke job handler context is set. pass context job handler this: jobHandler.execute(configuration, context, commandContext, tenantId);</technical_language>

Target:
public void execute(CommandContext commandContext) { CoreExecution context = null; if (executionId != null) { context = getExecution(); ensureNotNull("Cannot find execution with id '" + executionId + "' referenced from job '" + this + "'", "execution", execution); } else if (caseExecutionId != null) { context = getCaseExecution(); ensureNotNull("Cannot find case execution with id '" + caseExecutionId + "' referenced from job '" + id + "'", caseExecution); } getActivityId(); incrementSequenceCounter(); preExecute(commandContext); JobHandler jobHandler = getJobHandler(); JobHandlerConfiguration configuration = getJobHandlerConfiguration(); ensureNotNull("Cannot find job handler '" + jobHandlerType + "' from job '" + this + "'", "jobHandler", jobHandler); jobHandler.execute(configuration, context, commandContext, tenantId); postExecute(commandContext); }
Source:
<code>public void open_withCompressDeflateCapability_shouldEnableCompression() throws Exception { settings.setUseCompression(true); MockImapServer server = new MockImapServer(); <START> simplePreAuthAndLoginDialog(server, "", "COMPRESS=DEFLATE"); <END> server.expect("3 COMPRESS DEFLATE"); server.output("3 OK"); server.enableCompression(); simplePostAuthenticationDialog(server, false, 4); ImapConnection imapConnection = startServerAndCreateImapConnection(server); imapConnection.open(); server.verifyConnectionStillOpen(); server.verifyInteractionCompleted(); }</code><technical_language>Please introduce a new method adding a new argument is non-obvious everywhere</technical_language>

Target:
public void open_withCompressDeflateCapability_shouldEnableCompression() throws Exception { settings.setUseCompression(true); MockImapServer server = new MockImapServer(); simplePreAuthAndLoginDialog(server, "COMPRESS=DEFLATE"); server.expect("3 COMPRESS DEFLATE"); server.output("3 OK"); server.enableCompression(); simplePostAuthenticationDialog(server, 4); ImapConnection imapConnection = startServerAndCreateImapConnection(server); imapConnection.open(); server.verifyConnectionStillOpen(); server.verifyInteractionCompleted(); }
Source:
<code>public void testReplaceURLsByAbsolutePaths() throws IOException { String filename = "plouf.png"; FileBlob imageBlob = new FileBlob("image"); imageBlob.setFilename(filename); imageBlob.setMimeType("image/png"); String url = "http://localhost:8080/nuxeo/nxfile/default/3727ef6b-cf8c/files:files/0/file/" + filename; Blob blob = new StringBlob("<h1>Hello World</><img src=\"" + url + "\" />"); blob.setMimeType("text/html"); Function<String, Blob> blobResolver = mock(Function.class); <START> doReturn(imageBlob).when(blobResolver).apply(url); <END> Path tempDirectory = Framework.createTempDirectory("blobs"); Blob newBlob = ConversionServiceImpl.replaceURLsByAbsolutePaths(blob, tempDirectory, blobResolver); String absolutePath = tempDirectory.toString() + "/" + filename; assertEquals("<h1>Hello World</><img src=\"" + absolutePath + "\" />", newBlob.getString()); FileUtils.deleteQuietly(tempDirectory.toFile()); }</code><technical_language>mock is needed (that's point of function), do Function<String, String> blobResolver = u -> { return url.equals(u) ? blob : null; };</technical_language>

Target:
public void testReplaceURLsByAbsolutePaths() throws IOException { String filename = "plouf.png"; FileBlob imageBlob = new FileBlob("image"); imageBlob.setFilename(filename); imageBlob.setMimeType("image/png"); String url = "http://localhost:8080/nuxeo/nxfile/default/3727ef6b-cf8c/files:files/0/file/" + filename; Blob blob = new StringBlob("<h1>Hello World</><img src=\"" + url + "\" />"); blob.setMimeType("text/html"); Function<String, Blob> blobResolver = u -> { return url.equals(u) ? imageBlob : null; }; Path tempDirectory = Framework.createTempDirectory("blobs"); Blob newBlob = ConversionServiceImpl.replaceURLsByAbsolutePaths(blob, tempDirectory, blobResolver); String absolutePath = tempDirectory.toString() + "/" + filename; assertEquals("<h1>Hello World</><img src=\"" + absolutePath + "\" />", newBlob.getString()); FileUtils.deleteQuietly(tempDirectory.toFile()); }
Source:
<code>public static Vector3d worldToLocal(Extent extent, double x, double y, double z) { Stack<Extent> stack = new Stack<Extent>(); <START> while (extent != null) { <END> stack.push(extent); extent = extent.getParent().orNull(); } while (!stack.isEmpty()) { Extent next = stack.pop(); x += next.getOrigin().getX(); y += next.getOrigin().getY(); z += next.getOrigin().getZ(); } return new Vector3d(x, y, z); }</code><technical_language>Sums commutative associative. matter if sum a + b + c c + b + a result same. dont need push a stack sum directly. matter values negative a fixed starting point (xyz)</technical_language>

Target:
public static Vector3d worldToLocal(Extent extent, double x, double y, double z) { while (extent != null) { x += extent.getOrigin().getX(); y += extent.getOrigin().getY(); z += extent.getOrigin().getZ(); extent = extent.getParent().orNull(); } return new Vector3d(x, y, z); }
Source:
<code>private boolean categorizeField(Element element) { VariableElement field = (VariableElement) element; if (field.getModifiers().contains(Modifier.STATIC)) { return true; } if (field.getAnnotation(Ignore.class) != null || field.getModifiers().contains(Modifier.TRANSIENT)) { return true; } if (field.getAnnotation(Index.class) != null) { if (!categorizeIndexField(element, field)) { return false; } } if (field.getAnnotation(Required.class) != null) { categorizeRequiredField(element, field); } else { if (!Utils.isPrimitiveType(field) && !Utils.isRealmList(field)) { nullableFields.add(field); } } if (field.getAnnotation(PrimaryKey.class) != null) { if (!categorizePrimaryKeyField(field)) { return false; } } if (field.getAnnotation(LinkingObjects.class) != null) { return categorizeBacklinkField(field); } if (Utils.isRealmInteger(field)) { <START> if (!categorizeMutableRealmIntegerField(field)) { return false; } <END> } fields.add(field); return true; }</code><technical_language>return categorizeMutableRealmIntegerField(field)</technical_language>

Target:
private boolean categorizeField(Element element) { VariableElement field = (VariableElement) element; if (field.getModifiers().contains(Modifier.STATIC)) { return true; } if (field.getAnnotation(Ignore.class) != null || field.getModifiers().contains(Modifier.TRANSIENT)) { return true; } if (field.getAnnotation(Index.class) != null) { if (!categorizeIndexField(element, field)) { return false; } } if (field.getAnnotation(Required.class) != null) { categorizeRequiredField(element, field); } else { if (!Utils.isPrimitiveType(field) && !Utils.isRealmList(field)) { nullableFields.add(field); } } if (field.getAnnotation(PrimaryKey.class) != null) { if (!categorizePrimaryKeyField(field)) { return false; } } if (field.getAnnotation(LinkingObjects.class) != null) { return categorizeBacklinkField(field); } if (Utils.isMutableRealmInteger(field)) { if (!categorizeMutableRealmIntegerField(field)) { return false; } } fields.add(field); return true; }
Source:
<code>private TaskStatusPlus( @JsonProperty("id") String id, @JsonProperty("type") @Nullable String type, @JsonProperty("createdTime") DateTime createdTime, @JsonProperty("queueInsertionTime") DateTime queueInsertionTime, @JsonProperty("statusCode") @Nullable TaskState statusCode, @Deprecated @JsonProperty("status") @Nullable TaskState status, @JsonProperty("runnerStatusCode") @Nullable RunnerTaskState runnerTaskState, @JsonProperty("duration") @Nullable Long duration, @JsonProperty("location") TaskLocation location, @JsonProperty("dataSource") @Nullable String dataSource, @JsonProperty("errorMsg") @Nullable String errorMsg ) { if (statusCode != null && statusCode.isComplete()) { Preconditions.checkNotNull(duration, "duration"); } this.id = Preconditions.checkNotNull(id, "id"); this.type = type; this.createdTime = Preconditions.checkNotNull(createdTime, "createdTime"); this.queueInsertionTime = Preconditions.checkNotNull(queueInsertionTime, "queueInsertionTime"); if (statusCode != null && status == null) { <START> this.state = statusCode; <END> this.status = statusCode; } else if (statusCode == null && status != null) { this.state = status; this.status = status; } else { if (statusCode != null && status != null && statusCode != status) { log.error("statusCode[%s] and status[%s] must be same", statusCode, status); } this.state = statusCode; this.status = status; } this.runnerTaskState = runnerTaskState; this.duration = duration; this.location = Preconditions.checkNotNull(location, "location"); this.dataSource = dataSource; this.errorMsg = errorMsg; }</code><technical_language>rename state statusCode</technical_language>

Target:
public TaskStatusPlus( @JsonProperty("id") String id, @JsonProperty("type") @Nullable String type, @JsonProperty("createdTime") DateTime createdTime, @JsonProperty("queueInsertionTime") DateTime queueInsertionTime, @JsonProperty("statusCode") @Nullable TaskState statusCode, @Deprecated @JsonProperty("status") @Nullable TaskState status, @JsonProperty("runnerStatusCode") @Nullable RunnerTaskState runnerTaskState, @JsonProperty("duration") @Nullable Long duration, @JsonProperty("location") TaskLocation location, @JsonProperty("dataSource") @Nullable String dataSource, @JsonProperty("errorMsg") @Nullable String errorMsg ) { if (statusCode != null && statusCode.isComplete()) { Preconditions.checkNotNull(duration, "duration"); } this.id = Preconditions.checkNotNull(id, "id"); this.type = type; this.createdTime = Preconditions.checkNotNull(createdTime, "createdTime"); this.queueInsertionTime = Preconditions.checkNotNull(queueInsertionTime, "queueInsertionTime"); if (statusCode != null && status == null) { this.statusCode = statusCode; } else if (statusCode == null && status != null) { this.statusCode = status; } else { if (statusCode != null && status != null && statusCode != status) { throw new RuntimeException(StringUtils.format("statusCode[%s] and status[%s] must match", statusCode, status)); } this.statusCode = statusCode; } this.runnerTaskState = runnerTaskState; this.duration = duration; this.location = Preconditions.checkNotNull(location, "location"); this.dataSource = dataSource; this.errorMsg = errorMsg; }
Source:
<code>private void deactivateSnapshot() { if (getSelectedItem() == null) { return; } ConfirmationModel model = new ConfirmationModel(); setConfirmWindow(model); model.setTitle(ConstantsManager.getInstance().getConstants().confirmDeactivateSnapshot() <START> + " - " + getEntity().getName()); END> model.setHelpTag(HelpTag.volume_deactivate_snapshot_confirmation); model.setHashName("volume_deactivate_snapshot_confirmation"); model.setMessage(ConstantsManager.getInstance().getMessages().confirmVolumeSnapshotDeactivate()); UICommand okCommand = UICommand.createDefaultOkUiCommand("onDeactivateSnapshot", this); model.getCommands().add(okCommand); UICommand cancelCommand = UICommand.createCancelUiCommand("CancelConfirmation", this); model.getCommands().add(cancelCommand); }</code><technical_language>Kindly move this UIMessages</technical_language>

Target:
private void deactivateSnapshot() { if (getSelectedItem() == null) { return; } ConfirmationModel model = new ConfirmationModel(); setConfirmWindow(model); model.setTitle(ConstantsManager.getInstance().getMessages().confirmDeactivateSnapshot(getEntity().getName())); model.setHelpTag(HelpTag.volume_deactivate_snapshot_confirmation); model.setHashName("volume_deactivate_snapshot_confirmation"); model.setMessage(ConstantsManager.getInstance().getConstants().confirmVolumeSnapshotDeactivateMessage()); UICommand okCommand = UICommand.createDefaultOkUiCommand("onDeactivateSnapshot", this); model.getCommands().add(okCommand); UICommand cancelCommand = UICommand.createCancelUiCommand("cancelConfirmation", this); model.getCommands().add(cancelCommand); }
Source:
<code>public RecipeImpl getRecipe(MachineConfig machineConfig) throws MachineException { URL recipeUrl; File file = null; final String location = machineConfig.getSource().getLocation(); try { UriBuilder targetUriBuilder = UriBuilder.fromUri(location); final String apiEndPointHost = apiEndpoint.getHost(); <START> final String host = UriBuilder.fromUri(location).build().getHost(); <END> if (host.equals(apiEndPointHost)) { if (EnvironmentContext.getCurrent().getSubject() != null && EnvironmentContext.getCurrent().getSubject().getToken() != null) { targetUriBuilder.queryParam("token", EnvironmentContext.getCurrent().getSubject().getToken()); } } recipeUrl = targetUriBuilder.build().toURL(); file = IoUtil.downloadFileWithRedirect(null, "recipe", null, recipeUrl); return new RecipeImpl().withType(machineConfig.getSource().getType()) .withScript(IoUtil.readAndCloseQuietly(new FileInputStream(file))); } catch (IOException | IllegalArgumentException e) { throw new MachineException(format("Can't start machine %s because machine recipe downloading failed. Recipe url %s. Error: %s", machineConfig.getName(), location, e.getLocalizedMessage())); } finally { if (file != null && !file.delete()) { LOG.error(String.format("Removal of recipe file %s failed.", file.getAbsolutePath())); } } }</code><technical_language>targetUriBuilder instead of creating new uribuilder</technical_language>

Target:
public RecipeImpl getRecipe(MachineConfig machineConfig) throws MachineException { URL recipeUrl; File file = null; final String location = machineConfig.getSource().getLocation(); try { UriBuilder targetUriBuilder = UriBuilder.fromUri(location); final String apiEndPointHost = apiEndpoint.getHost(); final String host = targetUriBuilder.build().getHost(); if (apiEndPointHost.equals(host)) { if (EnvironmentContext.getCurrent().getSubject() != null && EnvironmentContext.getCurrent().getSubject().getToken() != null) { targetUriBuilder.queryParam("token", EnvironmentContext.getCurrent().getSubject().getToken()); } } recipeUrl = targetUriBuilder.build().toURL(); file = IoUtil.downloadFileWithRedirect(null, "recipe", null, recipeUrl); return new RecipeImpl().withType(machineConfig.getSource().getType()) .withScript(IoUtil.readAndCloseQuietly(new FileInputStream(file))); } catch (IOException | IllegalArgumentException e) { throw new MachineException(format("Can't start machine %s because machine recipe downloading failed. Recipe url %s. Error: %s", machineConfig.getName(), location, e.getLocalizedMessage())); } finally { if (file != null && !file.delete()) { LOG.error(String.format("Removal of recipe file %s failed.", file.getAbsolutePath())); } } }
Source:
<code>private static boolean wiredMbusMatches(final MbusChannelElementsDto mbusChannelElements, final ChannelElementValuesDto channelElementValues) { <START> final boolean hasValidMbusAttributes = channelElementValues.isMbusSlaveDeviceConfigured() <END> && mbusChannelElements.getPrimaryAddress().equals(mbusChannelElements.getPrimaryAddress()); final boolean validateMbusDeviceInfoMatch = !(failMatchOnMbusIdentificationNumber(mbusChannelElements, channelElementValues) || failMatchOnMbusManufacturerIdentification(mbusChannelElements, channelElementValues) || failMatchOnMbusVersion(mbusChannelElements, channelElementValues) || failMatchOnMbusDeviceTypeIdentification(mbusChannelElements, channelElementValues)); return hasValidMbusAttributes && validateMbusDeviceInfoMatch; }</code><technical_language>Extract booleans methods, call in return statement (as above). find a create methods check stuff reused this class</technical_language>

Target:
private static boolean wiredMbusMatches(final MbusChannelElementsDto mbusChannelElements, final ChannelElementValuesDto channelElementValues) { return hasValidMbusAttributes(mbusChannelElements, channelElementValues) && validateMbusDeviceInfoMatch(mbusChannelElements, channelElementValues); }
Source:
<code>protected void init(final InputStream input, final OutputStream output, final OutputStream messages) { origOut = output; rawIn = input; rawOut = output; msgOut = messages; if (timeout > 0) { final Thread caller = Thread.currentThread(); timer = new InterruptTimer(caller.getName() + "-Timer"); timeoutIn = new TimeoutInputStream(rawIn, timer); TimeoutOutputStream o = new TimeoutOutputStream(rawOut, timer); timeoutIn.setTimeout(timeout * 1000); o.setTimeout(timeout * 1000); rawIn = timeoutIn; rawOut = o; } if (maxPackSizeLimit >= 0) { rawIn = new LimitedInputStream(rawIn, maxPackSizeLimit) { @Override protected void limitExceeded() throws TooLargePackException { throw new TooLargePackException(limit); } }; <START> } <END> pckIn = new PacketLineIn(rawIn); pckOut = new PacketLineOut(rawOut); pckOut.setFlushOnEnd(false); enabledCapabilities = new HashSet<String>(); commands = new ArrayList<ReceiveCommand>(); }</code><technical_language>nit: Unrelated? I jgit for single command blocks? other places in this change</technical_language>

Target:
protected void init(final InputStream input, final OutputStream output, final OutputStream messages) { origOut = output; rawIn = input; rawOut = output; msgOut = messages; if (timeout > 0) { final Thread caller = Thread.currentThread(); timer = new InterruptTimer(caller.getName() + "-Timer"); timeoutIn = new TimeoutInputStream(rawIn, timer); TimeoutOutputStream o = new TimeoutOutputStream(rawOut, timer); timeoutIn.setTimeout(timeout * 1000); o.setTimeout(timeout * 1000); rawIn = timeoutIn; rawOut = o; } if (maxPackSizeLimit >= 0) rawIn = new LimitedInputStream(rawIn, maxPackSizeLimit) { @Override protected void limitExceeded() throws TooLargePackException { throw new TooLargePackException(limit); } }; pckIn = new PacketLineIn(rawIn); pckOut = new PacketLineOut(rawOut); pckOut.setFlushOnEnd(false); enabledCapabilities = new HashSet<String>(); commands = new ArrayList<ReceiveCommand>(); }
Source:
<code><START> public Optional<QualityGateDto> getDefault(DbSession dbSession, OrganizationDto organization) { <END> QualityGateDto defaultQualityGate = dbClient.qualityGateDao().selectByOrganizationAndUuid(dbSession, organization, organization.getDefaultQualityGateUuid()); return Optional.ofNullable(defaultQualityGate); }</code><technical_language>return Optional, default QG</technical_language>

Target:
public QualityGateDto getDefault(DbSession dbSession, OrganizationDto organization) { QGateWithOrgDto qgate = dbClient.qualityGateDao().selectByOrganizationAndUuid(dbSession, organization, organization.getDefaultQualityGateUuid()); checkState(qgate != null, "Default quality gate [%s] is missing on organization [%s]", organization.getDefaultQualityGateUuid(), organization.getUuid()); return qgate; }
Source:
<code>protected void executeCommand() { VDSGroup vdsGroup = getVdsGroup(); if (vdsGroup.supportsVirtService()) { setSucceeded(initVirtResources()); } <START> if (vdsGroup.supportsGlusterService()) { <END> setSucceeded(initGlusterHost()); } }</code><technical_language>I this is part of patch, I do this if initVirtResources() succeeded (in gluster+virt mode). So, I suggest is, if (getSucceeded() && vdsGroup.supportsGlusterService()) { setSucceeded(initGlusterHost()); }</technical_language>

Target:
protected void executeCommand() { VDSGroup vdsGroup = getVdsGroup(); setSucceeded(true); if (vdsGroup.supportsVirtService()) { setSucceeded(initVirtResources()); } if (getSucceeded() && vdsGroup.supportsGlusterService()) { setSucceeded(initGlusterHost()); } }
Source:
<code><START> public static Interval between(Timestamp start, Timestamp end) { <END> final long secondsBetween = end.getSeconds() - start.getSeconds(); final int nanosBetween = end.getNanos() - start.getNanos(); final Duration duration = Duration.newBuilder() .setSeconds(abs(secondsBetween)) .setNanos(abs(nanosBetween)) .build(); final Interval.Builder interval = Interval.newBuilder() .setStart(start) .setEnd(end) .setDuration(duration); return interval.build(); }</code><technical_language>argument check verifies start is of equals end. If equal, method returns ZERO constant</technical_language>

Target:
public static Interval between(Timestamp start, Timestamp end) { checkArgument(isLaterThan(end, start), "The end must be after the start of the interval."); final Interval.Builder interval = Interval.newBuilder() .setStart(start) .setEnd(end); return interval.build(); }
Source:
<code>public void createMandatoryConstructorSignaturePredicate() { mandatoryConstructorSignature = createConstructorSignaturePredicate(VdcActionParametersBase.class, CommandContext.class); <START> } <END></code><technical_language>members static methods @BeforeClass - this data change test executed, is read only</technical_language>

Target:
public static void createMandatoryConstructorSignaturePredicate() { mandatoryConstructorSignature = createConstructorSignaturePredicate(VdcActionParametersBase.class, CommandContext.class); }
Source:
<code><START> private Stream<? extends SlotExecutionVertexAssignment> allocateLogicalSlotsFromSharedSlot( <END> SharedSlotProfileRetriever sharedSlotProfileRetriever, ExecutionSlotSharingGroup executionSlotSharingGroup, Collection<ExecutionVertexID> executions) { SharedSlot sharedSlot = getOrAllocateSharedSlot(executionSlotSharingGroup, sharedSlotProfileRetriever); return executions.stream().map(sharedSlot::createAssignment); }</code><technical_language>Stream<? extends SlotExecutionVertexAssignment> simply Stream<SlotExecutionVertexAssignment></technical_language>

Target:
private Stream<SlotExecutionVertexAssignment> allocateLogicalSlotsFromSharedSlot( SharedSlotProfileRetriever sharedSlotProfileRetriever, ExecutionSlotSharingGroup executionSlotSharingGroup, Collection<ExecutionVertexID> executions) { SharedSlot sharedSlot = getOrAllocateSharedSlot(executionSlotSharingGroup, sharedSlotProfileRetriever); return executions .stream() .map(execution -> new SlotExecutionVertexAssignment(execution, sharedSlot.allocateLogicalSlot(execution))); }
Source:
<code>void givenAChargeCapturedNotification_chargeNotificationProcessorInvokedWithNotificationAndCharge() { final String payload = notificationPayloadForTransaction( payId, EPDQ_PAYMENT_REQUESTED); setUpGatewayAccountToReturnGatewayAccountEntity(Optional.of(gatewayAccountEntity)); setUpChargeServiceToReturnCharge(Optional.of(charge)); <START> final boolean result = notificationService.handleNotificationFor(payload, FORWARDED_IP_ADDRESSES); assertTrue(result); <END> verifyNoInteractions(mockRefundNotificationProcessor); verify(mockChargeNotificationProcessor).invoke(payId, charge, CAPTURED, null); }</code><technical_language>inlined</technical_language>

Target:
void givenAChargeCapturedNotification_chargeNotificationProcessorInvokedWithNotificationAndCharge() { final String payload = notificationPayloadForTransaction( payId, EPDQ_PAYMENT_REQUESTED); setUpGatewayAccountToReturnGatewayAccountEntity(Optional.of(gatewayAccountEntity)); setUpChargeServiceToReturnCharge(Optional.of(charge)); assertTrue(notificationService.handleNotificationFor(payload, FORWARDED_IP_ADDRESSES)); verifyNoInteractions(mockRefundNotificationProcessor); verify(mockChargeNotificationProcessor).invoke(payId, charge, CAPTURED, null); }
Source:
<code><START> public InitialOffset getInitialOffset() <END> { return initialOffset; }</code><technical_language>JavaBean compliant getter/setter</technical_language>

Target:
public String getInitialOffset() { return initialOffset.name(); }
Source:
<code><START> public void slowLogShouldBeLoggedWhenLockResponseIsSlowButShouldNotBeLoggedAtDebug() { <END> long lockDurationMillis = SLOW_LOG_TRIGGER_MILLIS + 5; lockServiceImplLogger.setEnabledLevels(Level.DEBUG); lockService.logSlowLockAcquisition("test_lockId", LockClient.ANONYMOUS, lockDurationMillis); assertThat(lockServiceImplLogger.isDebugEnabled(), is(true)); assertThat(lockServiceImplLogger.getLoggingEvents().size(), is(0)); assertThat(testSlowLogger.getLoggingEvents().size(), is(1)); assertThat(Iterables.getOnlyElement(testSlowLogger.getLoggingEvents()), is(info("Blocked for ms to acquire lock {}.", lockDurationMillis, "test_lockId", "unsuccessfully"))); }</code><technical_language>extra test: debug log logged if response time is slow slow log is disabled</technical_language>

Target:
public void slowLogShouldBeLoggedWhenLockResponseIsSlowButShouldNotBeLoggedAtDebug() { long lockDurationMillis = SLOW_LOG_TRIGGER_MILLIS + 5; lockServiceWithSlowLogEnabled.logSlowLockAcquisition(TEST_LOCKID, LockClient.ANONYMOUS, lockDurationMillis); assertThat(testLockServiceImplLogger.isDebugEnabled(), is(true)); assertThat(testLockServiceImplLogger.getLoggingEvents().size(), is(0)); assertThat(testSlowLogger.getLoggingEvents().size(), is(1)); assertThat(Iterables.getOnlyElement(testSlowLogger.getLoggingEvents()), is(info("Blocked for ms to acquire lock {}.", lockDurationMillis, TEST_LOCKID, "unsuccessfully"))); }
Source:
<code>public StreamBlockQueue(String path, String nonce) throws java.io.IOException { m_persistentDeque = new PersistentBinaryDeque( nonce, new VoltFile(path), exportLog); m_path = path; m_nonce = nonce; m_reader = m_persistentDeque.openForRead(m_nonce); if (exportLog.isDebugEnabled()) { exportLog.debug(m_nonce + " At SBQ creation, PBD size is " + (m_reader.sizeInBytes() - (8 * m_reader.getNumObjects()))); } if (!m_compress) { <START> exportLog.info(m_nonce + " has compression disabled in " + path); <END> } }</code><technical_language>log a message matter compression is enabled not, easier search existence for a message find missing thousands of lines</technical_language>

Target:
public StreamBlockQueue(String path, String nonce) throws java.io.IOException { m_persistentDeque = new PersistentBinaryDeque( nonce, new VoltFile(path), exportLog); m_path = path; m_nonce = nonce; m_reader = m_persistentDeque.openForRead(m_nonce); if (exportLog.isDebugEnabled()) { exportLog.debug(m_nonce + " At SBQ creation, PBD size is " + (m_reader.sizeInBytes() - (8 * m_reader.getNumObjects()))); } }
Source:
<code>protected boolean canDoAction() { StorageServerConnectionExtension conn = getParameters().getStorageServerConnectionExtension(); return validate(StorageServerConnectionExtensionValidator.isConnectionExtensionExists(conn.getId())) && validate(StorageServerConnectionExtensionValidator.isConnectionDoesNotExistForHostAndTarget(conn.getHostId(), <START> conn.getIqn())); <END> }</code><technical_language>discussed, SSCE is access /hosts/[hostid]/storageserverconnection/extension resource, changing host id blocked completely. - t common usecase modify usersname/password. In this case query DB host ign, get SSCE object back, fail (wrongly). do is query DB new host+ign, check if returned SSCE's ID is update not</technical_language>

Target:
protected boolean canDoAction() { StorageServerConnectionExtension conn = getParameters().getStorageServerConnectionExtension(); return validate(getConnectionExtensionValidator().isConnectionExtensionExists(conn.getId())) && validate(getConnectionExtensionValidator().isConnectionDoesNotExistForHostAndTarget(conn)); }
Source:
<code>private String getLogMessage(String methodName, Uri uri) { String format = "%s.%s %s"; String path = uri == null ? null : uri.getPath(); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { return String.format(format, CardContentProvider.class.getSimpleName(), methodName, path); } else { <START> return String.format(format + " (%s)", CardContentProvider.class.getSimpleName(), methodName, path, getCallingPackage()); <END> } }</code><technical_language>getClass() in places</technical_language>

Target:
private String getLogMessage(String methodName, Uri uri) { String format = "%s.%s %s"; String path = uri == null ? null : uri.getPath(); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { return String.format(format, getClass().getSimpleName(), methodName, path); } else { return String.format(format + " (%s)", getClass().getSimpleName(), methodName, path, getCallingPackage()); } }
Source:
<code>protected TmfXmlStateValue(ITmfXmlModelFactory modelFactory, Element node, IXmlStateSystemContainer container, List<ITmfXmlStateAttribute> attributes, String eventField) { fPath = attributes; fContainer = container; fEventField = eventField; if (!node.getNodeName().equals(TmfXmlStrings.STATE_VALUE)) { throw new IllegalArgumentException("TmfXmlStateValue constructor: Element is not a stateValue"); } <START> fIncrement = Boolean.valueOf(node.getAttribute(TmfXmlStrings.INCREMENT)); <END> fStateValue = initializeStateValue(modelFactory, node); switch (node.getAttribute(TmfXmlStrings.FORCED_TYPE)) { case TmfXmlStrings.TYPE_STRING: fForcedType = ITmfStateValue.Type.STRING; break; case TmfXmlStrings.TYPE_INT: fForcedType = ITmfStateValue.Type.INTEGER; break; case TmfXmlStrings.TYPE_LONG: fForcedType = ITmfStateValue.Type.LONG; break; default: fForcedType = ITmfStateValue.Type.NULL; } String stack = node.getAttribute(TmfXmlStrings.ATTRIBUTE_STACK); switch (stack) { case TmfXmlStrings.STACK_PUSH: fStackType = ValueTypeStack.PUSH; break; case TmfXmlStrings.STACK_POP: fStackType = ValueTypeStack.POP; break; case TmfXmlStrings.STACK_PEEK: fStackType = ValueTypeStack.PEEK; break; default: fStackType = ValueTypeStack.NULL; } }</code><technical_language>in category random useless know: .valueOf() returns a Boolean object, unboxed a boolean. .parseBoolean(), returns a boolean directly</technical_language>

Target:
protected TmfXmlStateValue(ITmfXmlModelFactory modelFactory, Element node, IXmlStateSystemContainer container, List<ITmfXmlStateAttribute> attributes, String eventField) { fPath = attributes; fContainer = container; fEventField = eventField; if (!node.getNodeName().equals(TmfXmlStrings.STATE_VALUE)) { throw new IllegalArgumentException("TmfXmlStateValue constructor: Element is not a stateValue"); } fIncrement = Boolean.parseBoolean(node.getAttribute(TmfXmlStrings.INCREMENT)); fStateValue = initializeStateValue(modelFactory, node); switch (node.getAttribute(TmfXmlStrings.FORCED_TYPE)) { case TmfXmlStrings.TYPE_STRING: fForcedType = ITmfStateValue.Type.STRING; break; case TmfXmlStrings.TYPE_INT: fForcedType = ITmfStateValue.Type.INTEGER; break; case TmfXmlStrings.TYPE_LONG: fForcedType = ITmfStateValue.Type.LONG; break; default: fForcedType = ITmfStateValue.Type.NULL; } String stack = node.getAttribute(TmfXmlStrings.ATTRIBUTE_STACK); fStackType = ValueTypeStack.getTypeFromString(stack); }
Source:
<code>public void executeVmCommand() { addAuditLogForPartialVMs(); <START> drMappingHelper.mapVnicProfiles(vmFromConfiguration.getInterfaces(), getParameters().getExternalVnicProfileMappings()); <END> super.executeVmCommand(); if (getSucceeded()) { if (isImagesAlreadyOnTarget()) { getImages().stream().forEach(diskImage -> { initQcowVersionForDisks(diskImage.getId()); }); unregisteredOVFDataDao.removeEntity(ovfEntityData.getEntityId(), null); unregisteredDisksDao.removeUnregisteredDiskRelatedToVM(ovfEntityData.getEntityId(), null); auditLogDirector.log(this, AuditLogType.VM_IMPORT_FROM_CONFIGURATION_EXECUTED_SUCCESSFULLY); } else if (!vmDisksToAttach.isEmpty()) { auditLogDirector.log(this, attemptToAttachDisksToImportedVm(vmDisksToAttach)); } } setActionReturnValue(getVm().getId()); }</code><technical_language>if plan do in this patch mapping done in execute phase. map values in init phase validate mapped input</technical_language>

Target:
public void executeVmCommand() { addAuditLogForPartialVMs(); super.executeVmCommand(); if (getSucceeded()) { if (isImagesAlreadyOnTarget()) { getImages().stream().forEach(diskImage -> { initQcowVersionForDisks(diskImage.getId()); }); unregisteredOVFDataDao.removeEntity(ovfEntityData.getEntityId(), null); unregisteredDisksDao.removeUnregisteredDiskRelatedToVM(ovfEntityData.getEntityId(), null); auditLogDirector.log(this, AuditLogType.VM_IMPORT_FROM_CONFIGURATION_EXECUTED_SUCCESSFULLY); } else if (!vmDisksToAttach.isEmpty()) { auditLogDirector.log(this, attemptToAttachDisksToImportedVm(vmDisksToAttach)); } } setActionReturnValue(getVm().getId()); }
Source:
<code>private void init() { View rgbView = inflate(getContext(), R.layout.color_picker_layout_rgbview, null); addView(rgbView); <START> seekBarRed = rgbView.findViewById(R.id.color_picker_color_rgb_seekbar_red); <END> seekBarGreen = rgbView.findViewById(R.id.color_picker_color_rgb_seekbar_green); seekBarBlue = rgbView.findViewById(R.id.color_picker_color_rgb_seekbar_blue); seekBarAlpha = rgbView.findViewById(R.id.color_picker_color_rgb_seekbar_alpha); textViewRed = rgbView.findViewById(R.id.color_picker_rgb_red_value); textViewGreen = rgbView.findViewById(R.id.color_picker_rgb_green_value); textViewBlue = rgbView.findViewById(R.id.color_picker_rgb_blue_value); textViewAlpha = rgbView.findViewById(R.id.color_picker_rgb_alpha_value); editTextHex = rgbView.findViewById(R.id.color_picker_color_rgb_hex); resetTextColor(); setSelectedColor(Color.BLACK); }</code><technical_language>Please revert changes this file</technical_language>

Target:
private void init() { View rgbView = inflate(getContext(), R.layout.color_picker_layout_rgbview, null); addView(rgbView); seekBarRed = (SeekBar) rgbView.findViewById(R.id.color_picker_color_rgb_seekbar_red); seekBarGreen = (SeekBar) rgbView.findViewById(R.id.color_picker_color_rgb_seekbar_green); seekBarBlue = (SeekBar) rgbView.findViewById(R.id.color_picker_color_rgb_seekbar_blue); seekBarAlpha = (SeekBar) rgbView.findViewById(R.id.color_picker_color_rgb_seekbar_alpha); textViewRed = (TextView) rgbView.findViewById(R.id.color_picker_rgb_red_value); textViewGreen = (TextView) rgbView.findViewById(R.id.color_picker_rgb_green_value); textViewBlue = (TextView) rgbView.findViewById(R.id.color_picker_rgb_blue_value); textViewAlpha = (TextView) rgbView.findViewById(R.id.color_picker_rgb_alpha_value); editTextHex = (EditText) rgbView.findViewById(R.id.color_picker_color_rgb_hex); resetTextColor(); setSelectedColor(Color.BLACK); }
Source:
<code>public String toString() { boolean readwrite = getReads() > 0 || getWrites() > 0; StringBuilder sb = new StringBuilder(); <START> sb.append(' ').append(getName()).append(": "); <END> sb.append("(model: ").append(getModel()); sb.append(" - S/N: ").append(getSerial()).append(") "); sb.append("size: ").append(getSize() > 0 ? FormatUtil.formatBytesDecimal(getSize()) : "?").append(", "); sb.append("reads: ").append(readwrite ? getReads() : "?"); sb.append(" (").append(readwrite ? FormatUtil.formatBytes(getReadBytes()) : "?").append("), "); sb.append("writes: ").append(readwrite ? getWrites() : "?"); sb.append(" (").append(readwrite ? FormatUtil.formatBytes(getWriteBytes()) : "?").append("), "); sb.append("xfer: ").append(readwrite ? getTransferTime() : "?").append("\n"); return sb.toString(); }</code><technical_language>leave space SystemInfoTest class start this name</technical_language>

Target:
public String toString() { boolean readwrite = getReads() > 0 || getWrites() > 0; StringBuilder sb = new StringBuilder(); sb.append(getName()).append(": "); sb.append("(model: ").append(getModel()); sb.append(" - S/N: ").append(getSerial()).append(") "); sb.append("size: ").append(getSize() > 0 ? FormatUtil.formatBytesDecimal(getSize()) : "?").append(", "); sb.append("reads: ").append(readwrite ? getReads() : "?"); sb.append(" (").append(readwrite ? FormatUtil.formatBytes(getReadBytes()) : "?").append("), "); sb.append("writes: ").append(readwrite ? getWrites() : "?"); sb.append(" (").append(readwrite ? FormatUtil.formatBytes(getWriteBytes()) : "?").append("), "); sb.append("xfer: ").append(readwrite ? getTransferTime() : "?"); return sb.toString(); }
Source:
<code>private static void logMsg(String uniqname, String originalUrl, HttpServletRequest request, String baseString) { String remoteUser = request.getRemoteUser(); String loggingApiWithSessionInfo; <START> if (uniqname != null) { <END> loggingApiWithSessionInfo = String.format(baseString, uniqname, originalUrl); } else if (request.getRemoteUser() != null) { loggingApiWithSessionInfo = String.format(baseString, request.getRemoteUser(), originalUrl); } else { loggingApiWithSessionInfo = String.format(baseString, request.getSession().getAttribute("testUser"), originalUrl); } M_log.info(loggingApiWithSessionInfo); }</code><technical_language>real choice in this if is name for log message clearer if set a variable chosen name call String.format. Also, surprise, log simple formatting built in. replace brackets "{}" in a message variables provided message string. work for writing log messages quicker</technical_language>

Target:
private static void logMsg(String uniqname, String originalUrl, HttpServletRequest request, String baseString) { String remoteUser = request.getRemoteUser(); String testUser = (String) request.getSession().getAttribute("testUser"); String user; if (uniqname != null) { user = uniqname; } else if (remoteUser != null) { user = remoteUser; } else { user = testUser; } M_log.info(String.format(baseString, user, originalUrl)); }
Source:
<code>public OAuth2Authentication loadAuthentication(String accessToken) throws AuthenticationException, InvalidTokenException { MultiValueMap<String, String> formData = new LinkedMultiValueMap<String, String>(); formData.add(tokenName, accessToken); HttpHeaders headers = new HttpHeaders(); headers.set("Authorization", getAuthorizationHeader(clientId, clientSecret)); Map<String, Object> map = postForMap(checkTokenEndpointUrl, formData, headers); if (map == null) { if (logger.isDebugEnabled()) { <START> logger.debug("check_token returned empty: " + accessToken); <END> } throw new InvalidTokenException(accessToken); } if (map.containsKey("error")) { if (logger.isDebugEnabled()) { logger.debug("check_token returned error: " + map.get("error")); } throw new InvalidTokenException(accessToken); } if (map.containsKey("active") && !"true".equals(String.valueOf(map.get("active")))) { logger.debug("check_token returned active attribute: " + map.get("active")); throw new InvalidTokenException(accessToken); } return tokenConverter.extractAuthentication(map); }</code><technical_language>log credentials (accessToken) this leaks data</technical_language>

Target:
public OAuth2Authentication loadAuthentication(String accessToken) throws AuthenticationException, InvalidTokenException { MultiValueMap<String, String> formData = new LinkedMultiValueMap<String, String>(); formData.add(tokenName, accessToken); HttpHeaders headers = new HttpHeaders(); headers.set("Authorization", getAuthorizationHeader(clientId, clientSecret)); Map<String, Object> map = postForMap(checkTokenEndpointUrl, formData, headers); if (CollectionUtils.isEmpty(map)) { if (logger.isDebugEnabled()) { logger.debug("check_token returned empty"); } throw new InvalidTokenException(accessToken); } if (map.containsKey("error")) { if (logger.isDebugEnabled()) { logger.debug("check_token returned error: " + map.get("error")); } throw new InvalidTokenException(accessToken); } if (map.containsKey("active") && !"true".equals(String.valueOf(map.get("active")))) { logger.debug("check_token returned active attribute: " + map.get("active")); throw new InvalidTokenException(accessToken); } return tokenConverter.extractAuthentication(map); }
Source:
<code>private void handleError(Throwable throwable) { Timber.e(throwable, "Error occurred while loading queried depictions"); try { view.initErrorView(); view.showSnackbar(); } catch (Exception e) { <START> e.printStackTrace(); <END> } }</code><technical_language>Check error handling</technical_language>

Target:
private void handleError(Throwable throwable) { Timber.e(throwable, "Error occurred while loading queried depictions"); view.initErrorView(); view.showSnackbar(); }
Source:
<code>private void trySetHostNum(JSONObject rMeta) { try { mHostNum.setHostNum(rMeta.getString("hostNum")); } catch (Exception e) { <START> Timber.e(e, "Failed to set hostNum"); <END> } }</code><technical_language>if mildly unexpected fine continue without, Timber.w I think. Unimportant in grand scheme, want a good debate harmonize log levels. I consider 'e' need bomb out of activity entirely, completely unrecoverable a crash</technical_language>

Target:
private void trySetHostNum(JSONObject rMeta) { try { if (rMeta.has("hostNum")) { mHostNum.setHostNum(rMeta.getInt("hostNum")); } } catch (Exception e) { Timber.w(e, "Failed to set hostNum"); } }