auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void resume() { checkRealm(); pauseDepth--; if (pauseDepth < 0) { throw new IllegalStateException( "The resume() method was called more <START> often than <END> pause()."); } else if (pauseDepth == 0) { sideEffects.forEach(s -> s.resume()); } }</code><technical_language>> times</technical_language>

Target:
public void resume() { checkRealm(); pauseDepth--; if (pauseDepth < 0) { throw new IllegalStateException( "The resume() method was called more times than pause()."); } else if (pauseDepth == 0) { sideEffects.forEach(s -> s.resume()); } }
Source:
<code>public ListParserValidator(String model) throws ModelSyntaxException { super(model); this.converter = new IdentityConverter(); String listRegexp = LIST_TYPE_REGEXP + "\\(([^)]+)\\)$"; String commaSeparatedValuesString = parseAndGetOneGroup(model, listRegexp); String[] stringValues = commaSeparatedValuesString.split(","); <START> Set<String> valuesSet = new HashSet<>(); <END> for (String value : stringValues) { valuesSet.add(value.trim()); } this.validator = new ListValidator(valuesSet); }</code><technical_language>Define initial capacity ImmutableSet.copyOf if possible</technical_language>

Target:
public ListParserValidator(String model) throws ModelSyntaxException { super(model); }
Source:
<code>private ServerSocketChannel openServerSocket(String host, int port) throws IOException { InetSocketAddress address = null; if (host == null || host.trim().isEmpty()) { address = new InetSocketAddress(port); } else { address = new InetSocketAddress(host, port); } ServerSocketChannel serverChannel = ServerSocketChannel.open(); serverChannel.configureBlocking(false); serverChannel.socket().setReuseAddress(true); try { serverChannel.socket().bind(address); } catch (BindException e) { logger.error("Failed to bind to address " + address); throw e; <START> } <END> logger.info("Awaiting socket connections on {}:{}", address.getHostName(), port); return serverChannel; }</code><technical_language>avoid catch rethrows...really much...logging exception context..</technical_language>

Target:
private ServerSocketChannel openServerSocket(String host, int port) throws IOException { InetSocketAddress address = null; if (host == null || host.trim().isEmpty()) { address = new InetSocketAddress(port); } else { address = new InetSocketAddress(host, port); } ServerSocketChannel serverChannel = ServerSocketChannel.open(); serverChannel.configureBlocking(false); serverChannel.socket().bind(address); logger.info("Awaiting socket connections on {}:{}", address.getHostName(), port); return serverChannel; }
Source:
<code>public void readExternal(ObjectInput in) throws IOException { if (in.readBoolean()) { if (!in.readBoolean()) { <START> precision = in.readUnsignedByte(); <END> scale = in.readUnsignedByte(); value = null; rawData = null; isNull = evaluateNull(); } else { setCoreValue(null); } return; } value = null; rawScale = in.readUnsignedByte(); int size = in.readUnsignedByte(); if ((rawData == null) || size != rawData.length) { rawData = new byte[size]; } in.readFully(rawData); isNull = evaluateNull(); }</code><technical_language>If write precision/scale unconditionally readByte() instead of readUnsignedByte()</technical_language>

Target:
public void readExternal(ObjectInput in) throws IOException { if (in.readBoolean()) { precision = in.readByte(); scale = in.readByte(); setCoreValue(null); return; } value = null; rawScale = in.readUnsignedByte(); int size = in.readUnsignedByte(); if ((rawData == null) || size != rawData.length) { rawData = new byte[size]; } in.readFully(rawData); isNull = evaluateNull(); }
Source:
<code>private static List<String> innerInitRange(int stopAfter, long startNum, long endNum) { if (startNum > endNum) { return Collections.emptyList(); } <START> List<String> macAddresses = new ArrayList<>(stopAfter); <END> for (long i = startNum; i <= endNum; i++) { if ((MAC_ADDRESS_MULTICAST_BIT & i) != 0) { continue; } macAddresses.add(macAddressIntToString(i)); if (stopAfter-- <= 0) { return macAddresses; } } return new ArrayList<>(macAddresses); }</code><technical_language>determine minimum of stopAfter endNum - startNum send this, avoiding need copy array end</technical_language>

Target:
private static List<String> innerInitRange(int stopAfter, long startNum, long endNum) { if (startNum > endNum) { return Collections.emptyList(); } List<String> macAddresses = new ArrayList<>(Math.min(stopAfter, (int)(endNum - startNum))); for (long i = startNum; i <= endNum; i++) { if ((MAC_ADDRESS_MULTICAST_BIT & i) != 0) { continue; } macAddresses.add(macAddressToString(i)); if (stopAfter-- <= 0) { return macAddresses; } } return new ArrayList<>(macAddresses); }
Source:
<code>private static Client newHttpClient(Optional<SSLSocketFactory> sslSocketFactory, OkHttpClientOptions options, String userAgent) { OkHttpClient okClient = new OkHttpClient(); okClient.setConnectTimeout( options.getConnectTimeoutMs().or((long) okClient.getConnectTimeout()), TimeUnit.MILLISECONDS); okClient.setReadTimeout(options.getReadTimeoutMs().or((long) okClient.getReadTimeout()), TimeUnit.MILLISECONDS); okClient.setWriteTimeout( options.getWriteTimeoutMs().or((long) okClient.getWriteTimeout()), TimeUnit.MILLISECONDS); RetryInterceptor retryInterceptor = options.getMaxNumberRetries().isPresent() ? new RetryInterceptor(options.getMaxNumberRetries().get()) : new RetryInterceptor(); <START> UserAgentInterceptor userAgentInterceptor = UserAgentInterceptor.of(userAgent); <END> okClient.interceptors().add(retryInterceptor); okClient.interceptors().add(userAgentInterceptor); okClient.setSslSocketFactory(sslSocketFactory.orNull()); return new OkClient(okClient); }</code><technical_language>inline</technical_language>

Target:
private static Client newHttpClient(Optional<SSLSocketFactory> sslSocketFactory, OkHttpClientOptions options, String userAgent) { OkHttpClient okClient = new OkHttpClient(); okClient.setConnectTimeout( options.getConnectTimeoutMs().or((long) okClient.getConnectTimeout()), TimeUnit.MILLISECONDS); okClient.setReadTimeout(options.getReadTimeoutMs().or((long) okClient.getReadTimeout()), TimeUnit.MILLISECONDS); okClient.setWriteTimeout( options.getWriteTimeoutMs().or((long) okClient.getWriteTimeout()), TimeUnit.MILLISECONDS); RetryInterceptor retryInterceptor = options.getMaxNumberRetries().isPresent() ? new RetryInterceptor(options.getMaxNumberRetries().get()) : new RetryInterceptor(); okClient.interceptors().add(retryInterceptor); okClient.interceptors().add(UserAgentInterceptor.of(userAgent)); okClient.setSslSocketFactory(sslSocketFactory.orNull()); return new OkClient(okClient); }
Source:
<code>protected void executeCommand() { VDSGroup vdsGroup = getVdsGroup(); <START> setSucceeded(true); <END> if (vdsGroup.supportsVirtService()) { setSucceeded(initVirtResources()); } if (getSucceeded() && vdsGroup.supportsGlusterService()) { setSucceeded(initGlusterHost()); } }</code><technical_language>is wrong set succeeded true logic ended, if exception thrown initVirtResources(), succeede true.. sorry, i missed in previous review</technical_language>

Target:
protected void executeCommand() { VDSGroup vdsGroup = getVdsGroup(); boolean initSucceeded = true; if (vdsGroup.supportsVirtService()) { initSucceeded = initVirtResources(); } if (initSucceeded && vdsGroup.supportsGlusterService()) { initSucceeded = initGlusterHost(); } setSucceeded(initSucceeded); }
Source:
<code>private List<BuiltinCiphers> checkAndSetGitCiphers(String gitSshCiphers) { if (gitSshCiphers == null || gitSshCiphers.isEmpty()) { return managedCiphers; } else { List<BuiltinCiphers> ciphersHandled = new ArrayList<>(); List<String> ciphers = Arrays.asList(gitSshCiphers.split(",")); for (String cipherCode : ciphers) { BuiltinCiphers cipher = BuiltinCiphers.fromFactoryName(cipherCode.trim().toLowerCase()); if (cipher != null && managedCiphers.contains(cipher)) { ciphersHandled.add(cipher); LOG.info("Added Cipher to the git ssh configuration. ", cipher); }else{ <START> LOG.info("Cipher not handled in git ssh configuration. ", cipher); <END> } } return ciphersHandled; } }</code><technical_language>raise this WARN</technical_language>

Target:
private List<BuiltinCiphers> checkAndSetGitCiphers(String gitSshCiphers) { if (gitSshCiphers == null || gitSshCiphers.isEmpty()) { return managedCiphers; } else { List<BuiltinCiphers> ciphersHandled = new ArrayList<>(); List<String> ciphers = Arrays.asList(gitSshCiphers.split(",")); for (String cipherCode : ciphers) { BuiltinCiphers cipher = BuiltinCiphers.fromFactoryName(cipherCode.trim().toLowerCase()); if (cipher != null && managedCiphers.contains(cipher)) { ciphersHandled.add(cipher); LOG.info("Added Cipher to the git ssh configuration. ", cipher); } else { LOG.warn("Cipher not handled in git ssh configuration. ", cipher); } } return ciphersHandled; } }
Source:
<code>public boolean handles(final Object columnElement, final Object rowElement) { <START> boolean reult = false; <END> Object row = AxisUtils.getRepresentedElement(rowElement); Object column = AxisUtils.getRepresentedElement(columnElement); if (row instanceof EObject && column instanceof EStructuralFeature) { if (UMLPackage.Literals.VALUE_SPECIFICATION == ((EStructuralFeature) column) .getEType()) { reult = true; } } else if (row instanceof EStructuralFeature && column instanceof EObject) { if (UMLPackage.Literals.VALUE_SPECIFICATION == ((EStructuralFeature) row) .getEType()) { reult = true; } } return reult; }</code><technical_language>Replace "reult" "result"</technical_language>

Target:
public boolean handles(final Object columnElement, final Object rowElement) { boolean result = false; Object row = AxisUtils.getRepresentedElement(rowElement); Object column = AxisUtils.getRepresentedElement(columnElement); if (column instanceof EStructuralFeature) { result = UMLPackage.Literals.VALUE_SPECIFICATION == ((EStructuralFeature) column) .getEType(); } else if (row instanceof EStructuralFeature) { result = UMLPackage.Literals.VALUE_SPECIFICATION == ((EStructuralFeature) row) .getEType(); } return result; }
Source:
<code>public void testValidate() throws Exception { <START> boolean hasException = false; <END> try { orchestrator.validate(); } catch (Exception e) { hasException= true; } assertFalse(hasException); hasException = false; try { wrongOrchestrator.validate(); } catch (Exception e) { hasException= true; } assertTrue(hasException); }</code><technical_language>tests using: <LINK_0></technical_language>

Target:
public void testValidate() throws Exception { try { orchestrator.validate(); } catch (Exception e) { fail("Validate doesn't work on right formatted Dockerfile:"+e.getMessage()); } try { wrongOrchestrator.validate(); fail("Validate doesn't detect a wrong formatted Dockerfile"); } catch (Exception e) { assertEquals("Missing or misplaced FROM on line [1] of src/test/wrongDocker/Dockerfile, found WRONG wrong command", e.getMessage()); } }
Source:
<code>public boolean hasTutorPrivileges() { return !isAllowedForPrivilege(Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_COURSE) && !isAllowedForPrivilege(Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_INSTRUCTOR) && !isAllowedForPrivilege(Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION) && !isAllowedForPrivilege(Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_STUDENT) && isAllowedForPrivilege(Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_STUDENT_IN_SECTIONS) && !isAllowedForPrivilege(Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_COMMENT_IN_SECTIONS) && isAllowedForPrivilege(Const.ParamsNames.INSTRUCTOR_PERMISSION_GIVE_COMMENT_IN_SECTIONS) && !isAllowedForPrivilege(Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_COMMENT_IN_SECTIONS) && isAllowedForPrivilege(Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_SESSION_IN_SECTIONS) && isAllowedForPrivilege(Const.ParamsNames.INSTRUCTOR_PERMISSION_SUBMIT_SESSION_IN_SECTIONS) <START> && !isAllowedForPrivilege(Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION_COMMENT_IN_SECTIONS); <END> }</code><technical_language>methods fragile, 'magic conditions' :-p is this compound condition determined? Is based some data somewhere, in case generated based data</technical_language>

Target:
public boolean hasTutorPrivileges() { return hasSamePrivileges(tutorPrivileges); }
Source:
<code>String readStringRaw() throws IOException { int len = readLength(); if (len == 0) return END; len -= 4; byte[] raw; <START> if (len < lineBuffer.length) <END> raw = lineBuffer; else raw = new byte[len]; IO.readFully(in, raw, 0, len); return RawParseUtils.decode(Constants.CHARSET, raw, 0, len); }</code><technical_language><= is more optrimal here. need reserve place for a NUL byte</technical_language>

Target:
String readStringRaw() throws IOException { int len = readLength(); if (len == 0) return END; len -= 4; byte[] raw; if (len <= lineBuffer.length) raw = lineBuffer; else raw = new byte[len]; IO.readFully(in, raw, 0, len); return RawParseUtils.decode(Constants.CHARSET, raw, 0, len); }
Source:
<code>public Result execute(UIExecutionContext context) throws Exception { <START> for (JavaClassSource klass : targets.getValue()) <END> { UIContext uiContext = context.getUIContext(); Project project = getSelectedProject(uiContext); JavaSourceFacet javaSource = project.getFacet(JavaSourceFacet.class); if (!klass.hasMethodSignature("hashCode") || !klass.hasMethodSignature("equals", Object.class)) { if (generateEqualsAndHashCode.getValue()) { if (klass.getField("id") != null) { Refactory.createHashCodeAndEquals(klass, klass.getField("id")); } else { Refactory.createHashCodeAndEquals(klass, (FieldSource<?>[]) klass.getFields().toArray()); } javaSource.saveJavaSource(klass); } } } return null; }</code><technical_language>"klass"</technical_language>

Target:
public Result execute(UIExecutionContext context) throws Exception { for (JavaClassSource javaSource : targets.getValue()) { UIContext uiContext = context.getUIContext(); Project project = getSelectedProject(uiContext); JavaSourceFacet javaSourceFacet = project.getFacet(JavaSourceFacet.class); if (!javaSource.hasMethodSignature("hashCode")) { if (generateEqualsAndHashCode.getValue()) { if (javaSource.getField("id") != null) { Refactory.createHashCode(javaSource, javaSource.getField("id")); } else { Refactory.createHashCode(javaSource, (FieldSource<?>[]) javaSource.getFields().toArray(new FieldSource[javaSource.getFields().size()])); } } } if(!javaSource.hasMethodSignature("equals", Object.class)) { if (generateEqualsAndHashCode.getValue()) { if (javaSource.getField("id") != null) { Refactory.createEquals(javaSource, javaSource.getField("id")); } else { Refactory.createEquals(javaSource, (FieldSource<?>[]) javaSource.getFields().toArray(new FieldSource[javaSource.getFields().size()])); } } } javaSourceFacet.saveJavaSource(javaSource); } return null; }
Source:
<code>public static GlusterHookEntity map(GlusterHook hook, GlusterHookEntity entity) { GlusterHookEntity hookEntity = entity != null ? entity : new GlusterHookEntity(); if (hook.isSetId()) { <START> hookEntity.setId(Guid.createGuidFromStringDefaultEmpty(hook.getId())); <END> } if (hook.isSetName()) { hookEntity.setName(hook.getName()); } if (hook.isSetGlusterCommand()) { hookEntity.setGlusterCommand(hook.getGlusterCommand()); } if (hook.isSetChecksum()) { hookEntity.setChecksum(hook.getChecksum()); } if (hook.isSetContent()) { hookEntity.setContent(hook.getContent()); } return hookEntity; }</code><technical_language>please GuidUtils populate UUID string</technical_language>

Target:
public static GlusterHookEntity map(GlusterHook hook, GlusterHookEntity entity) { GlusterHookEntity hookEntity = entity != null ? entity : new GlusterHookEntity(); if (hook.isSetId()) { hookEntity.setId(GuidUtils.asGuid(hook.getId())); } if (hook.isSetName()) { hookEntity.setName(hook.getName()); } if (hook.isSetGlusterCommand()) { hookEntity.setGlusterCommand(hook.getGlusterCommand()); } if (hook.isSetChecksum()) { hookEntity.setChecksum(hook.getChecksum()); } if (hook.isSetContent()) { hookEntity.setContent(hook.getContent()); } return hookEntity; }
Source:
<code>public String name() { try { <START> return new JdkRequest(UriBuilder.fromUri(this.home).build()) <END> .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .header(HttpHeaders.AUTHORIZATION, this.token) .method(Request.GET) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(XmlResponse.class) .xml() .xpath("/page/stand/name/text()") .get(0); } catch (IOException ex) { throw new IllegalStateException(ex); } }</code><technical_language>need UriBuilder</technical_language>

Target:
public String name() { try { return new JdkRequest(this.home) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .header(HttpHeaders.AUTHORIZATION, this.token) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(XmlResponse.class) .xml() .xpath("/page/stand/name/text()") .get(0); } catch (IOException ex) { throw new IllegalStateException(ex); } }
Source:
<code>private void processHeaderLine(StringBuffer line) throws HttpException { int colonIndex = line.indexOf(":"); if (colonIndex == -1) { int i; for (i = 0; i < line.length(); i++) if (!Character.isWhitespace(line.charAt(i))) break; if (i == line.length()) return; throw new HttpException("No colon in header:" + line); } String key = line.substring(0, colonIndex); int valueStart = colonIndex + 1; while (valueStart < line.length()) { int c = line.charAt(valueStart); if (c != ' ' && c != '\t') break; valueStart++; } String value = line.substring(valueStart); <START> headers.put(key.toLowerCase(), new String[] { value }); <END> }</code><technical_language>toLowerCase(Locale.ROOT)? rely default locale</technical_language>

Target:
private void processHeaderLine(StringBuffer line) throws HttpException { int colonIndex = line.indexOf(":"); if (colonIndex == -1) { int i; for (i = 0; i < line.length(); i++) if (!Character.isWhitespace(line.charAt(i))) break; if (i == line.length()) return; throw new HttpException("No colon in header:" + line); } String key = line.substring(0, colonIndex); int valueStart = colonIndex + 1; while (valueStart < line.length()) { int c = line.charAt(valueStart); if (c != ' ' && c != '\t') break; valueStart++; } String value = line.substring(valueStart); headers.put(key.toLowerCase(Locale.ROOT), new String[] { value }); }
Source:
<code>public boolean initializeUnityAds(Activity activity, String gameId) { if (!UnityAds.isSupported()) { Log.w(UnityAdapter.TAG, "The current device is not supported by Unity Ads."); return false; } if (UnityAds.isInitialized()) { return true; } MediationMetaData mediationMetaData = new MediationMetaData(activity); mediationMetaData.setName("AdMob"); mediationMetaData.setVersion(MobileAds.getVersionString()); mediationMetaData.set("adapter_version", BuildConfig.VERSION_NAME); mediationMetaData.commit(); UnitySingletonListener listener = unitySingletonInstance.getUnitySingletonListenerInstance(); UnityAds.addListener(listener); <START> UnityAds.initialize(activity, gameId, false, true); <END> return true; }</code><technical_language>calling this method synchronously set UnityAds.isinitialized() true? If not, safer for adapter flag code: UnitySingletonListener unitySingletonListener = unitySingletonInstance.getUnitySingletonListenerInstance(); UnityAds.addListener(listener); is guaranteed run once. 2 ads loaded in quick succession 2 calls this initializeUnityAds() method</technical_language>

Target:
public boolean initializeUnityAds(Activity activity, String gameId) { if (!UnityAds.isSupported()) { Log.w(UnityAdapter.TAG, "The current device is not supported by Unity Ads."); return false; } if (UnityAds.isInitialized()) { return true; } MediationMetaData mediationMetaData = new MediationMetaData(activity); mediationMetaData.setName("AdMob"); mediationMetaData.setVersion(MobileAds.getVersionString()); mediationMetaData.set("adapter_version", BuildConfig.VERSION_NAME); mediationMetaData.commit(); UnitySingletonListener listener = unitySingletonInstance.getUnitySingletonListenerInstance(); UnityAds.initialize(activity, gameId, listener, false, true); return true; }
Source:
<code>private void publishCircuitThresholdsExceededEvent(Result result, CircuitBreakerMetrics metrics) { if (Result.hasFailureRateExceededThreshold(result)) { publishCircuitFailureRateExceededEvent(getName(), metrics.getFailureRate()); } if (Result.hasSlowCallRateExceededThreshold(result)) { <START> publishCircuitSlowCallRateExceededEvent(getName(), metrics.getFailureRate()); <END> } }</code><technical_language>metrics.getSlowCallRate()</technical_language>

Target:
private void publishCircuitThresholdsExceededEvent(Result result, CircuitBreakerMetrics metrics) { if (Result.hasFailureRateExceededThreshold(result)) { publishCircuitFailureRateExceededEvent(getName(), metrics.getFailureRate()); } if (Result.hasSlowCallRateExceededThreshold(result)) { publishCircuitSlowCallRateExceededEvent(getName(), metrics.getSlowCallRate()); } }
Source:
<code>public AccountResource.SshKey parse(AccountResource rsrc, IdString id) throws ResourceNotFoundException, OrmException { try { <START> int seq = Integer.parseInt(id.get()); <END> AccountSshKey sshKey = dbProvider.get().accountSshKeys() .get(new AccountSshKey.Id(rsrc.getUser().getAccountId(), seq)); if (sshKey == null) { throw new ResourceNotFoundException(id); } return new AccountResource.SshKey(rsrc.getUser(), sshKey); } catch (NumberFormatException e) { throw new ResourceNotFoundException(id); } }</code><technical_language>add ,10 ensure read in base 10</technical_language>

Target:
public AccountResource.SshKey parse(AccountResource rsrc, IdString id) throws ResourceNotFoundException, OrmException { if (self.get() != rsrc.getUser() && !self.get().getCapabilities().canAdministrateServer()) { throw new ResourceNotFoundException(); } try { int seq = Integer.parseInt(id.get(), 10); AccountSshKey sshKey = dbProvider.get().accountSshKeys() .get(new AccountSshKey.Id(rsrc.getUser().getAccountId(), seq)); if (sshKey == null) { throw new ResourceNotFoundException(id); } return new AccountResource.SshKey(rsrc.getUser(), sshKey); } catch (NumberFormatException e) { throw new ResourceNotFoundException(id); } }
Source:
<code>private void sendPack() throws IOException { final boolean sideband = options.contains(OPTION_SIDE_BAND) || options.contains(OPTION_SIDE_BAND_64K); ProgressMonitor pm = NullProgressMonitor.INSTANCE; OutputStream packOut = rawOut; if (sideband) { int bufsz = SideBandOutputStream.SMALL_BUF; if (options.contains(OPTION_SIDE_BAND_64K)) bufsz = SideBandOutputStream.MAX_BUF; packOut = new SideBandOutputStream(SideBandOutputStream.CH_DATA, bufsz, rawOut); if (!options.contains(OPTION_NO_PROGRESS)) pm = new SideBandProgressMonitor(new SideBandOutputStream( SideBandOutputStream.CH_PROGRESS, bufsz, rawOut)); } PackConfig cfg = packConfig; if (cfg == null) cfg = new PackConfig(db); final PackWriter pw = new PackWriter(cfg, walk.getObjectReader()); try { pw.setDeltaBaseAsOffset(options.contains(OPTION_OFS_DELTA)); pw.setThin(options.contains(OPTION_THIN_PACK)); <START> if(depth > 0) { <END> pw.preparePack(pm, wantAll, depth); } else { pw.preparePack(pm, wantAll, commonBase); } if (options.contains(OPTION_INCLUDE_TAG)) { for (final Ref r : refs.values()) { final RevObject o; try { o = walk.parseAny(r.getObjectId()); } catch (IOException e) { continue; } if (o.has(WANT) || !(o instanceof RevTag)) continue; final RevTag t = (RevTag) o; if (!pw.willInclude(t) && pw.willInclude(t.getObject())) pw.addObject(t); } } pw.writePack(pm, NullProgressMonitor.INSTANCE, packOut); } finally { pw.release(); } packOut.flush(); if (sideband) pckOut.end(); }</code><technical_language>Style-nit: Space if (. above, curly braces simple conditionals this one</technical_language>

Target:
private void sendPack() throws IOException { final boolean sideband = options.contains(OPTION_SIDE_BAND) || options.contains(OPTION_SIDE_BAND_64K); ProgressMonitor pm = NullProgressMonitor.INSTANCE; OutputStream packOut = rawOut; if (sideband) { int bufsz = SideBandOutputStream.SMALL_BUF; if (options.contains(OPTION_SIDE_BAND_64K)) bufsz = SideBandOutputStream.MAX_BUF; packOut = new SideBandOutputStream(SideBandOutputStream.CH_DATA, bufsz, rawOut); if (!options.contains(OPTION_NO_PROGRESS)) pm = new SideBandProgressMonitor(new SideBandOutputStream( SideBandOutputStream.CH_PROGRESS, bufsz, rawOut)); } PackConfig cfg = packConfig; if (cfg == null) cfg = new PackConfig(db); final PackWriter pw = new PackWriter(cfg, walk.getObjectReader()); try { pw.setDeltaBaseAsOffset(options.contains(OPTION_OFS_DELTA)); pw.setThin(options.contains(OPTION_THIN_PACK)); if(depth > 0) { pw.preparePack(pm, wantAll, commonBase, unshallowCommits, depth); } else { pw.preparePack(pm, wantAll, commonBase); } if (options.contains(OPTION_INCLUDE_TAG)) { for (final Ref r : refs.values()) { final RevObject o; try { o = walk.parseAny(r.getObjectId()); } catch (IOException e) { continue; } if (o.has(WANT) || !(o instanceof RevTag)) continue; final RevTag t = (RevTag) o; if (!pw.willInclude(t) && pw.willInclude(t.getObject())) pw.addObject(t); } } pw.writePack(pm, NullProgressMonitor.INSTANCE, packOut); } finally { pw.release(); } packOut.flush(); if (sideband) pckOut.end(); }
Source:
<code>public Status read(String table, String key, Set<String> fields, HashMap<String, ByteIterator> result) { try { Boolean returnFields = false; String[] fieldList = null; if (fields != null) { returnFields = true; fieldList = fields.toArray(new String[fields.size()]); } SolrQuery query = new SolrQuery(); query.setQuery("id:" + key); if (returnFields) { query.setFields(fieldList); } final QueryResponse response = (cloudMode) ? cloudClient.query(table, query) : httpClient.query(table, query); if ((response.getResults() != null) && (response.getResults().getNumFound() > 0)) { for (String field : response.getResults().get(0).getFieldNames()) { result.put(field, new StringByteIterator( String.valueOf(response.getResults().get(0).getFirstValue(field)))); } return Status.OK; } return Status.NOT_FOUND; <START> } catch (Exception e) { <END> e.printStackTrace(); } return Status.ERROR; }</code><technical_language>avoid catching exceptions more explicit</technical_language>

Target:
public Status read(String table, String key, Set<String> fields, HashMap<String, ByteIterator> result) { try { Boolean returnFields = false; String[] fieldList = null; if (fields != null) { returnFields = true; fieldList = fields.toArray(new String[fields.size()]); } SolrQuery query = new SolrQuery(); query.setQuery("id:" + key); if (returnFields) { query.setFields(fieldList); } final QueryResponse response = client.query(table, query); SolrDocumentList results = response.getResults(); if ((results != null) && (results.getNumFound() > 0)) { for (String field : results.get(0).getFieldNames()) { result.put(field, new StringByteIterator(String.valueOf(results.get(0).getFirstValue(field)))); } } return checkStatus(response.getStatus()); } catch (IOException | SolrServerException e) { e.printStackTrace(); } return Status.ERROR; }
Source:
<code><START> public void testSetscopedInstance_withAppBindings_andExternalExports() throws InterruptedException { <END> AgentMessageProcessor processor = (AgentMessageProcessor) this.agent.getMessagingClient().getMessageProcessor(); TestApplicationTemplate app = new TestApplicationTemplate(); Map<String,String> externalExports = new HashMap<> (); externalExports.put( "Lamp", "Toto" ); Map<String,Set<String>> applicationBindings = new HashMap<> (); applicationBindings.put( "Tpl1", new HashSet<>( Arrays.asList( "app1", "app3" ))); applicationBindings.put( "Tpl2", new HashSet<>( Arrays.asList( "app2" ))); Map<String,byte[]> scriptResources = new HashMap<> (); Message msg = new MsgCmdSetScopedInstance( app.getMySqlVm(), externalExports, applicationBindings, scriptResources ); Assert.assertNull( processor.scopedInstance ); Assert.assertEquals( 0, processor.applicationBindings.size()); processor.processMessage( msg ); Assert.assertEquals( app.getMySqlVm(), processor.scopedInstance ); Assert.assertEquals( 2, processor.applicationBindings.size()); Assert.assertEquals( new HashSet<>( Arrays.asList( "app2" )), processor.applicationBindings.get( "Tpl2" )); Assert.assertEquals( new HashSet<>( Arrays.asList( "app1", "app3" )), processor.applicationBindings.get( "Tpl1" )); }</code><technical_language>No, this method throw interrupted exceptions</technical_language>

Target:
public void testSetscopedInstance_withAppBindings_andExternalExports() { AgentMessageProcessor processor = (AgentMessageProcessor) this.agent.getMessagingClient().getMessageProcessor(); TestApplicationTemplate app = new TestApplicationTemplate(); Map<String,String> externalExports = new HashMap<> (); externalExports.put( "Lamp", "Toto" ); Map<String,Set<String>> applicationBindings = new HashMap<> (); applicationBindings.put( "Tpl1", new HashSet<>( Arrays.asList( "app1", "app3" ))); applicationBindings.put( "Tpl2", new HashSet<>( Arrays.asList( "app2" ))); Map<String,byte[]> scriptResources = new HashMap<> (); Message msg = new MsgCmdSetScopedInstance( app.getMySqlVm(), externalExports, applicationBindings, scriptResources ); Assert.assertNull( processor.scopedInstance ); Assert.assertEquals( 0, processor.applicationBindings.size()); processor.processMessage( msg ); Assert.assertEquals( app.getMySqlVm(), processor.scopedInstance ); Assert.assertEquals( 2, processor.applicationBindings.size()); Assert.assertEquals( new HashSet<>( Arrays.asList( "app2" )), processor.applicationBindings.get( "Tpl2" )); Assert.assertEquals( new HashSet<>( Arrays.asList( "app1", "app3" )), processor.applicationBindings.get( "Tpl1" )); }
Source:
<code>public URI createAdminUnit(URI path, Model model) { model = populateModelTypes(path, model, <START> Arrays.asList(Cdr.AdminUnit, PcdmModels.Object)); <END> return createContentContainerObject(path, model); }</code><technical_language>PcdmModels.Collection agree rest of code</technical_language>

Target:
public URI createAdminUnit(URI path, Model model) { model = populateModelTypes(path, model, Arrays.asList(Cdr.AdminUnit, PcdmModels.Collection)); return createContentContainerObject(path, model); }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { QuranApplication quranApp = (QuranApplication) getApplication(); quranApp.getApplicationComponent().inject(this); quranApp.refreshLocale(this, false); super.onCreate(savedInstanceState); final ActionBar ab = getSupportActionBar(); if (ab != null) { ab.setTitle(R.string.audio_manager); ab.setDisplayHomeAsUpEnabled(true); } setContentView(R.layout.activity_surah_audio_manager); Intent intent = getIntent(); <START> sheikhPosition = intent.getIntExtra("Sheikh", -1); <END> recyclerView = findViewById(R.id.recycler_view); recyclerView.setHasFixedSize(true); recyclerView.setLayoutManager(new LinearLayoutManager(this)); recyclerView.setItemAnimator(new DefaultItemAnimator()); progressBar = findViewById(R.id.progress); qariItems = audioUtils.getQariList(this); basePath = quranFileUtils.getQuranAudioDirectory(this); surahAdapter = new SurahAdapter(qariItems); recyclerView.setAdapter(surahAdapter); getShuyookhData(); }</code><technical_language>replace a constant refer constant here</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { QuranApplication quranApp = (QuranApplication) getApplication(); quranApp.getApplicationComponent().inject(this); quranApp.refreshLocale(this, false); super.onCreate(savedInstanceState); final ActionBar ab = getSupportActionBar(); if (ab != null) { ab.setTitle(R.string.audio_manager); ab.setDisplayHomeAsUpEnabled(true); } setContentView(R.layout.activity_surah_audio_manager); Intent intent = getIntent(); sheikhPosition = intent.getIntExtra(EXTRA_SHEIKH_POSITION, -1); recyclerView = findViewById(R.id.recycler_view); recyclerView.setHasFixedSize(true); recyclerView.setLayoutManager(new LinearLayoutManager(this)); recyclerView.setItemAnimator(new DefaultItemAnimator()); progressBar = findViewById(R.id.progress); qariItems = audioUtils.getQariList(this); basePath = quranFileUtils.getQuranAudioDirectory(this); surahAdapter = new SurahAdapter(qariItems, this); recyclerView.setAdapter(surahAdapter); getShuyookhData(); }
Source:
<code>public void testUseJSONB() throws Exception { System.setProperty(ResteasyContextParameters.RESTEASY_PREFER_JACKSON_OVER_JSONB, "true"); JsonBindingProvider jbp = new JsonBindingProvider(); <START> boolean result = jbp.isReadable(null, null, null, mediaType); <END> assertFalse(result); }</code><technical_language>@rsearls this is fine, need set for this system property test is restored it. IOW, test leave environment in state executing, tests running this affected</technical_language>

Target:
public void testUseJSONB() throws Exception { String origValue = System.getProperty(ResteasyContextParameters.RESTEASY_PREFER_JACKSON_OVER_JSONB); System.setProperty(ResteasyContextParameters.RESTEASY_PREFER_JACKSON_OVER_JSONB, "true"); JsonBindingProvider jbp = new JsonBindingProvider(); boolean result = jbp.isReadable(null, null, null, mediaType); if (origValue == null) { System.setProperty(ResteasyContextParameters.RESTEASY_PREFER_JACKSON_OVER_JSONB, ""); } else { System.setProperty(ResteasyContextParameters.RESTEASY_PREFER_JACKSON_OVER_JSONB, origValue); } assertFalse(result); }
Source:
<code>public String getDefaultMetaVariable() { <START> return "regex"; <END> }</code><technical_language>meta variables uppercase</technical_language>

Target:
public String getDefaultMetaVariable() { return "REGEX"; }
Source:
<code>public Token emitEOF() { int cpos = getCharPositionInLine(); int line = getLine(); <START> if ( _token !=null && _token.getLine() == line ) { <END> int n = _token.getStopIndex() - _token.getStartIndex() + 1; cpos = _token.getCharPositionInLine()+n; } Token eof = _factory.create(_tokenFactorySourcePair, Token.EOF, null, Token.DEFAULT_CHANNEL, _input.index(), _input.index()-1, line, cpos); emit(eof); return eof; }</code><technical_language>_ever_ correct enter this block</technical_language>

Target:
public Token emitEOF() { int cpos = getCharPositionInLine(); int line = getLine(); Token eof = _factory.create(_tokenFactorySourcePair, Token.EOF, null, Token.DEFAULT_CHANNEL, _input.index(), _input.index()-1, line, cpos); emit(eof); return eof; }
Source:
<code>public SetMembers evaluate(CodeSystemURI uri, BranchContext context, Options search) { <START> if (!search.containsKey(OptionKey.SET)) { <END> return SetMemberSearchRequestEvaluator.NOOP.evaluate(uri, context, search); } final String refsetId = search.get(OptionKey.SET, String.class); final Integer limit = search.get(OptionKey.LIMIT, Integer.class); final String searchAfter = search.get(OptionKey.AFTER, String.class); SnomedConcepts concepts = SnomedRequests.prepareSearchConcept() .isActiveMemberOf(refsetId) .setExpand("preferredDescriptions()") .setLimit(limit) .setSearchAfter(searchAfter) .build() .execute(context); return new SetMembers(concepts.stream().map(c -> toMember(c, uri)).collect(Collectors.toList()), concepts.getSearchAfter(), concepts.getLimit(), concepts.getTotal() ); }</code><technical_language>This is optional filter, I return members if filters specified</technical_language>

Target:
public SetMembers evaluate(CodeSystemURI uri, BranchContext context, Options search) { final Integer limit = search.get(OptionKey.LIMIT, Integer.class); final String searchAfter = search.get(OptionKey.AFTER, String.class); final List<ExtendedLocale> locales = search.getList(OptionKey.AFTER, ExtendedLocale.class); SnomedRefSetMemberSearchRequestBuilder requestBuilder = SnomedRequests.prepareSearchMember(); if (search.containsKey(OptionKey.SET)) { final Collection<String> refsetId = search.getCollection(OptionKey.SET, String.class); requestBuilder.filterByRefSet(refsetId); } SnomedReferenceSetMembers referenceSetMembers = requestBuilder .filterByActive(true) .setLocales(locales) .setExpand("referencedComponent(expand(fsn()))") .setLimit(limit) .setSearchAfter(searchAfter) .build() .execute(context); return new SetMembers(referenceSetMembers.stream().map(m -> toMember(m, uri)).collect(Collectors.toList()), referenceSetMembers.getSearchAfter(), referenceSetMembers.getLimit(), referenceSetMembers.getTotal() ); }
Source:
<code>public InjectionProvider getInjectionProvider(ExternalContext externalContext) { <START> return new MyFacesInjectionProvider(); <END> }</code><technical_language>Instead of creating a new instance time, a final InjectionProvider instance variable added initialized in constructor</technical_language>

Target:
public InjectionProvider getInjectionProvider(ExternalContext externalContext) { return injectionProvider; }
Source:
<code>public ImportStatus importForms(Configuration config) { try { List<String> formUrls = getFormUrls(config); List<String> xmlFormDefinitions = getXmlFormDefinitions(formUrls, config); List<FormDefinition> formDefinitions = parseXmlFormDefinitions(xmlFormDefinitions, config); modifyFormDefinitionForImplementation(formDefinitions); updateFormDefinitions(formDefinitions, config.getName()); tasksService.updateTasksChannel(); return new ImportStatus(true); } catch (Exception e) { <START> LOGGER.error(e.toString()); <END> return new ImportStatus(false); } }</code><technical_language>Improve logging ("Unable import forms", e)</technical_language>

Target:
public ImportStatus importForms(Configuration config) { try { List<String> formUrls = getFormUrls(config); List<String> xmlFormDefinitions = getXmlFormDefinitions(formUrls, config); List<FormDefinition> formDefinitions = parseXmlFormDefinitions(xmlFormDefinitions, config); modifyFormDefinitionForImplementation(formDefinitions); updateFormDefinitions(formDefinitions, config.getName()); tasksService.updateTasksChannel(); return new ImportStatus(true); } catch (Exception e) { LOGGER.error("Unable to import forms.", e); return new ImportStatus(false); } }
Source:
<code>private int activateTexture (Texture texture) { subImageScaleWidth = texture.getWidth() * invMaxTextureWidth; subImageScaleHeight = texture.getHeight() * invMaxTextureHeight; if (subImageScaleWidth > 1f || subImageScaleHeight > 1f) { throw new IllegalStateException( "Texture " + texture.getTextureObjectHandle() + " is larger than the Array Texture: [" + texture.getWidth() + "," + texture.getHeight() + "] > [" + (int)(1f / invMaxTextureWidth) + "," + (int)(1f / invMaxTextureHeight) + "]"); } invTexWidth = subImageScaleWidth / texture.getWidth(); invTexHeight = subImageScaleHeight / texture.getHeight(); final int textureHandle = texture.getTextureObjectHandle(); for (int i = 0; i < currentTextureLFUSize; i++) { if (textureHandle == usedTextures[i].getTextureObjectHandle()) { usedTexturesLFU[i]++; return i; } } if (currentTextureLFUSize < maxTextureLevels) { usedTextures[currentTextureLFUSize] = texture; usedTexturesLFU[currentTextureLFUSize]++; copyTextureIntoArrayTexture(texture, currentTextureLFUSize); return currentTextureLFUSize++; } else { if (idx > 0) { <START> flush(); <END> } int slot = 0; int slotVal = usedTexturesLFU[0]; int max = 0; int average = 0; for (int i = 0; i < maxTextureLevels; i++) { final int val = usedTexturesLFU[i]; max = Math.max(val, max); average += val; if (val <= slotVal) { slot = i; slotVal = val; } } final int normalizeRange = 100; for (int i = 0; i < maxTextureLevels; i++) { usedTexturesLFU[i] = usedTexturesLFU[i] * normalizeRange / max; } average = (average * normalizeRange) / (max * maxTextureLevels); usedTexturesLFU[slot] = average; usedTextures[slot] = texture; copyTextureIntoArrayTexture(texture, slot); currentTextureLFUSwaps++; return slot; } }</code><technical_language>This get optimized a bit checking textures currently used, is important</technical_language>

Target:
private int activateTexture (Texture texture) { subImageScaleWidth = texture.getWidth() * invMaxTextureWidth; subImageScaleHeight = texture.getHeight() * invMaxTextureHeight; if (subImageScaleWidth > 1f || subImageScaleHeight > 1f) { throw new IllegalStateException("Texture " + texture.getTextureObjectHandle() + " is larger than the Array Texture: [" + texture.getWidth() + "," + texture.getHeight() + "] > [" + maxTextureWidth + "," + maxTextureHeight + "]"); } invTexWidth = subImageScaleWidth / texture.getWidth(); invTexHeight = subImageScaleHeight / texture.getHeight(); final int textureSlot = findTextureCacheIndex(texture); if (textureSlot >= 0) { if (textureSlot == usedTexturesNextSwapSlot) { usedTexturesNextSwapSlot = (usedTexturesNextSwapSlot + 1) % currentTextureLFUSize; } return textureSlot; } if (currentTextureLFUSize < maxTextureSlots) { usedTextures[currentTextureLFUSize] = texture; copyTextureIntoArrayTexture(texture, currentTextureLFUSize); currentTextureLFUSwaps++; return currentTextureLFUSize++; } else { if (idx > 0) { flush(); } final int slot = usedTexturesNextSwapSlot; usedTexturesNextSwapSlot = (usedTexturesNextSwapSlot + 1) % currentTextureLFUSize; usedTextures[slot] = texture; copyTextureIntoArrayTexture(texture, slot); currentTextureLFUSwaps++; return slot; } }
Source:
<code>public TLSSocketChannel( ByteChannel channel, Logger logger, SSLEngine sslEngine ) throws IOException { this.logger = logger; this.channel = channel; this.sslEngine = sslEngine; this.plainIn = ByteBuffer.allocate( sslEngine.getSession().getApplicationBufferSize() ); this.cipherIn = ByteBuffer.allocate( sslEngine.getSession().getPacketBufferSize() ); this.plainOut = ByteBuffer.allocate( sslEngine.getSession().getApplicationBufferSize() ); this.cipherOut = ByteBuffer.allocate( sslEngine.getSession().getPacketBufferSize() ); try { runHandshake(); } catch ( SSLHandshakeException e ) { Throwable error = e; if( error.getCause() != null ) { error = e.getCause(); } <START> throw new ClientException( "Failed to establish secured connection with the server: " + error.getMessage(), <END> error.getCause() ); } }</code><technical_language>is move this try-catch block runHandshake() re-throw ClientException IOException is thrown cause</technical_language>

Target:
TLSSocketChannel( ByteChannel channel, Logger logger, SSLEngine sslEngine ) throws IOException { this.logger = logger; this.channel = channel; this.sslEngine = sslEngine; this.plainIn = ByteBuffer.allocate( sslEngine.getSession().getApplicationBufferSize() ); this.cipherIn = ByteBuffer.allocate( sslEngine.getSession().getPacketBufferSize() ); this.plainOut = ByteBuffer.allocate( sslEngine.getSession().getApplicationBufferSize() ); this.cipherOut = ByteBuffer.allocate( sslEngine.getSession().getPacketBufferSize() ); }
Source:
<code>public List<Class<?>> getCommands() { List<Class<?>> cmdList = new ArrayList<Class<?>>(); cmdList.add(AddNuageVspDeviceCmd.class); cmdList.add(DeleteNuageVspDeviceCmd.class); cmdList.add(ListNuageVspDevicesCmd.class); cmdList.add(IssueNuageVspResourceRequestCmd.class); <START> cmdList.add(UpdateNuageVspDeviceCmd.class); <END> return cmdList; }</code><technical_language>Consider com.google.guava.collect.Lists#newHashMap for a more succinct build list</technical_language>

Target:
public List<Class<?>> getCommands() { return Lists.<Class<?>>newArrayList(AddNuageVspDeviceCmd.class, DeleteNuageVspDeviceCmd.class, ListNuageVspDevicesCmd.class, IssueNuageVspResourceRequestCmd.class, UpdateNuageVspDeviceCmd.class); }
Source:
<code>public void testExtractCheckConstraints() throws Exception { XContentBuilder builder = XContentFactory.jsonBuilder() .startObject() .startObject(Constants.DEFAULT_MAPPING_TYPE) .startObject("_meta") .startObject("check_constraints") .field("test3_check_1", "id >= 0") .field("test3_check_2", "title != 'Pink Power Ranger'") .endObject() .endObject() .startObject("properties") .startObject("id").field("type", "integer").endObject() .startObject("title").field("type", "string").endObject() .endObject() .endObject() .endObject(); IndexMetaData metaData = getIndexMetaData("test3", builder); DocIndexMetaData md = newMeta(metaData, "test3"); <START> assertThat(md.checkConstraints().size(), is(2)); for (AnalyzedCheckConstraint chk : md.checkConstraints()) { switch (chk.name()) { case "test3_check_1": assertThat(chk.expression(), is(SqlParser.createExpression("id >= 0"))); break; case "test3_check_2": assertThat(chk.expression(), is(SqlParser.createExpression("title <> 'Pink Power Ranger'"))); break; <END> } } }</code><technical_language>work assertThat(md.checkConstraints(), Matchers.contains(...)) error messages</technical_language>

Target:
public void testExtractCheckConstraints() throws Exception { XContentBuilder builder = XContentFactory.jsonBuilder() .startObject() .startObject(Constants.DEFAULT_MAPPING_TYPE) .startObject("_meta") .startObject("check_constraints") .field("test3_check_1", "id >= 0") .field("test3_check_2", "title != 'Programming Clojure'") .endObject() .endObject() .startObject("properties") .startObject("id").field("type", "integer").endObject() .startObject("title").field("type", "string").endObject() .endObject() .endObject() .endObject(); IndexMetaData metaData = getIndexMetaData("test3", builder); DocIndexMetaData md = newMeta(metaData, "test3"); assertThat(md.checkConstraints().size(), is(2)); assertThat(md.checkConstraints() .stream() .map(CheckConstraint::expressionStr) .collect(Collectors.toList()), containsInAnyOrder( equalTo("id >= 0"), equalTo("title != 'Programming Clojure'") )); }
Source:
<code>private List<Location> flowForNullableMethodParameters(ExplodedGraph.Node node) { if (node.parent() != null || !domains.contains(ObjectConstraint.class)) { <START> return ImmutableList.of(); <END> } ImmutableList.Builder<JavaFileScannerContext.Location> flowBuilder = ImmutableList.builder(); trackedSymbols.forEach(symbol -> { SymbolicValue sv = node.programState.getValue(symbol); if (sv == null) { return; } ObjectConstraint startConstraint = node.programState.getConstraint(sv, ObjectConstraint.class); if (startConstraint != null && !isAnnotatedNullable(symbol) && isMethodParameter(symbol)) { String msg = IMPLIES_CAN_BE_NULL_MSG; if (ObjectConstraint.NOT_NULL == startConstraint) { msg = "Implies '%s' can not be null."; } flowBuilder.add(new JavaFileScannerContext.Location(String.format(msg, symbol.name()), ((VariableTree) symbol.declaration()).simpleName())); } }); return flowBuilder.build(); }</code><technical_language>Minor: import for Location , imo</technical_language>

Target:
private List<JavaFileScannerContext.Location> flowForNullableMethodParameters(ExplodedGraph.Node node) { if (!node.edges().isEmpty() || !domains.contains(ObjectConstraint.class)) { return ImmutableList.of(); } ImmutableList.Builder<JavaFileScannerContext.Location> flowBuilder = ImmutableList.builder(); trackedSymbols.forEach(symbol -> { SymbolicValue sv = node.programState.getValue(symbol); if (sv == null) { return; } ObjectConstraint startConstraint = node.programState.getConstraint(sv, ObjectConstraint.class); if (startConstraint != null && isMethodParameter(symbol)) { String msg = IMPLIES_CAN_BE_NULL_MSG; if (ObjectConstraint.NOT_NULL == startConstraint) { msg = "Implies '%s' can not be null."; } flowBuilder.add(new JavaFileScannerContext.Location(String.format(msg, symbol.name()), ((VariableTree) symbol.declaration()).simpleName())); } }); return flowBuilder.build(); }
Source:
<code>public AuditLogType getAuditLogTypeValue() { <START> if (getSucceeded()) { <END> return AuditLogType.GLUSTER_VOLUME_BRICK_UPDATE; } else { return errorType == null ? AuditLogType.GLUSTER_VOLUME_BRICK_UPDATE_FAILED : errorType; } }</code><technical_language>want pass custom variable audit log type for reason of update</technical_language>

Target:
public AuditLogType getAuditLogTypeValue() { addCustomValue(GlusterConstants.UPDATE_REASON, getParameters().getReason()); if (getSucceeded()) { return AuditLogType.GLUSTER_VOLUME_BRICK_UPDATE; } else { return errorType == null ? AuditLogType.GLUSTER_VOLUME_BRICK_UPDATE_FAILED : errorType; } }