auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void reflogReader() throws IOException { Ref master = ref(MASTER, 1); Ref next = ref(NEXT, 2); ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ReftableWriter writer = new ReftableWriter().setMinUpdateIndex(1) .setMaxUpdateIndex(1).begin(buffer); writer.writeRef(master); writer.writeRef(next); PersonIdent who1 = new PersonIdent("Log", "Ger", 1500079709, -8 * 60); writer.writeLog(MASTER, 3, who1, ObjectId.zeroId(), id(1), "1"); PersonIdent who2 = new PersonIdent("Log", "Ger", 1500079710, -8 * 60); writer.writeLog(MASTER, 2, who2, id(1), id(2), "2"); PersonIdent who3 = new PersonIdent("Log", "Ger", 1500079711, -8 * 60); writer.writeLog(MASTER, 1, who3, id(2), id(3), "3"); writer.finish(); byte[] table = buffer.toByteArray(); ReentrantLock lock = new ReentrantLock(); ReftableReader t = read(table); ReftableReflogReader rlr = new ReftableReflogReader(lock, t, MASTER); assertEquals(rlr.getLastEntry().getWho(), who1); <START> List<PersonIdent> all = rlr.getReverseEntries().stream() <END> .map(x -> x.getWho()).collect(Collectors.toList()); List<PersonIdent> more = rlr.getReverseEntries(4).stream() .map(x -> x.getWho()).collect(Collectors.toList()); assertEquals(all.size(), 3); assertEquals(rlr.getReverseEntry(1).getWho(), who2); List<ReflogEntry> entries = rlr.getReverseEntries(2); assertEquals(entries.get(1).getWho(), who2); assertEquals(all, more); }</code><technical_language>I clearer if verify lists Matchers.contains. <LINK_0></technical_language>

Target:
public void reflogReader() throws IOException { Ref master = ref(MASTER, 1); Ref next = ref(NEXT, 2); ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ReftableWriter writer = new ReftableWriter().setMinUpdateIndex(1) .setMaxUpdateIndex(1).begin(buffer); writer.writeRef(master); writer.writeRef(next); PersonIdent who1 = new PersonIdent("Log", "Ger", 1500079709, -8 * 60); writer.writeLog(MASTER, 3, who1, ObjectId.zeroId(), id(1), "1"); PersonIdent who2 = new PersonIdent("Log", "Ger", 1500079710, -8 * 60); writer.writeLog(MASTER, 2, who2, id(1), id(2), "2"); PersonIdent who3 = new PersonIdent("Log", "Ger", 1500079711, -8 * 60); writer.writeLog(MASTER, 1, who3, id(2), id(3), "3"); writer.finish(); byte[] table = buffer.toByteArray(); ReentrantLock lock = new ReentrantLock(); ReftableReader t = read(table); ReftableReflogReader rlr = new ReftableReflogReader(lock, t, MASTER); assertEquals(rlr.getLastEntry().getWho(), who1); List<PersonIdent> all = rlr.getReverseEntries().stream() .map(x -> x.getWho()).collect(Collectors.toList()); Matchers.contains(all, who3, who2, who1); assertEquals(rlr.getReverseEntry(1).getWho(), who2); List<ReflogEntry> reverse2= rlr.getReverseEntries(2); Matchers.contains(reverse2, who3, who2); List<PersonIdent> more = rlr.getReverseEntries(4).stream() .map(x -> x.getWho()).collect(Collectors.toList()); assertEquals(all, more); }
Source:
<code>public LSPServer() throws IOException { serverSocket = new ServerSocket(Configuration.PORT); new Thread(new Runnable() { @Override public void run() { try { <START> clientSocket = serverSocket.accept(); <END> InputStream in = clientSocket.getInputStream(); OutputStream out = clientSocket.getOutputStream(); lspserver = new LanguageServerImpl(); Launcher<LanguageClient> launcher = LSPLauncher.createServerLauncher(lspserver, in, out); lspserver.connect(launcher.getRemoteProxy()); launcher.startListening(); } catch (Exception e) { e.printStackTrace(); } } }).start(); }</code><technical_language>a server multiple clients</technical_language>

Target:
public LSPServer() throws IOException { fServerSocket = new ServerSocket(Configuration.PORT); new Thread(new ServerLoop()).start(); }
Source:
<code>private void createStreamClient() throws IOException { if (streamClient == null) { RestStreamClient.Builder builder = RestStreamClient.builder(host, port); builder.ssl(sslEnabled); builder.writerPoolSize(writerPoolSize); builder.version(version); AuthenticationClient authClient = null; InputStream inStream = null; try { <START> authClient = (AuthenticationClient) Class.forName(authClientClassPath).getConstructor().newInstance(); <END> authClient.setConnectionInfo(host, port, sslEnabled); Properties properties = new Properties(); inStream = new FileInputStream(authClientPropertiesPath); properties.load(inStream); authClient.configure(properties); builder.authClient(authClient); } catch (ReflectiveOperationException e) { LOG.error("Can not resolve class {}: {}", new Object[]{authClientClassPath, host, port, e.getMessage(), e}); } catch (IOException e) { LOG.error("Cannot load properties", e); } finally { try { if (inStream != null) { inStream.close(); } } catch (IOException e) { LOG.warn("Error during closing input stream. {}", e.getMessage(), e); } } streamClient = builder.build(); } try { if (writer == null) { writer = streamClient.createWriter(streamName); } } catch (Throwable t) { closeWriterQuietly(); throw new IOException("Can not create stream writer by name: " + streamName, t); } }</code><technical_language>getConstructor() is needed here. (getConstructor is useful if need pass in arguments)</technical_language>

Target:
private void createStreamClient() throws IOException { if (streamClient == null) { RestStreamClient.Builder builder = RestStreamClient.builder(host, port); builder.ssl(sslEnabled); builder.writerPoolSize(writerPoolSize); builder.version(version); InputStream inStream = null; try { authClient = (AuthenticationClient) Class.forName(authClientClassName).newInstance(); Properties properties = new Properties(); inStream = new FileInputStream(authClientPropertiesPath); properties.load(inStream); authClient.configure(properties); authClient.setConnectionInfo(host, port, sslEnabled); builder.authClient(authClient); } catch (ReflectiveOperationException e) { LOG.error("Can not resolve class {}: {}", new Object[]{authClientClassName, host, port, e.getMessage(), e}); } catch (IOException e) { LOG.error("Cannot load properties", e); } finally { try { if (inStream != null) { inStream.close(); } } catch (IOException e) { LOG.warn("Error during closing input stream. {}", e.getMessage(), e); } } streamClient = builder.build(); } try { if (writer == null) { writer = streamClient.createWriter(streamName); } } catch (Throwable t) { closeWriterQuietly(); throw new IOException("Can not create stream writer by name: " + streamName, t); } }
Source:
<code>private void setupFieldsForEdit(Button button, Collection<View> fieldViews, Activity activity) { button.setText("Add New"); for (View view : fieldViews) { fieldContainer.addView(view); } button.setOnClickListener(v -> { <START> Intent udfCreator = new Intent(App.getAppInstance(), UDFCollectionCreateActivity.class); <END> udfCreator.putParcelableArrayListExtra(UDFCollectionCreateActivity.UDF_DEFINITIONS, newArrayList(editableUdfDefinitions.values())); activity.startActivityForResult(udfCreator, TreeEditDisplay.FIELD_ACTIVITY_REQUEST_CODE); }); }</code><technical_language>Do sense a UdfCreatorIntent encapsulate some of commonly added attributes</technical_language>

Target:
private void setupFieldsForEdit(Button button, Collection<View> fieldViews, Activity activity) { button.setText(R.string.udf_create_new); for (View view : fieldViews) { fieldContainer.addView(view); } button.setOnClickListener(v -> { Intent udfCreator = new Intent(App.getAppInstance(), UDFCollectionCreateActivity.class); udfCreator.putParcelableArrayListExtra(UDFCollectionCreateActivity.UDF_DEFINITIONS, newArrayList(editableUdfDefinitions.values())); activity.startActivityForResult(udfCreator, TreeEditDisplay.FIELD_ACTIVITY_REQUEST_CODE); }); }
Source:
<code>public DataBag exec(Tuple input) throws IOException { DataBag output = bagFactory.newDefaultBag(); DataBag samples = (DataBag) input.get(0); if (samples == null || samples.size() == 0) { return output; } int numSamples = (int) samples.size(); if (numSamples == 1) return samples; Tuple[] tuples = new Tuple[numSamples]; int tupleIndex = 0; for (Tuple tuple : samples) { tuples[tupleIndex] = tuple; tupleIndex++; } double[] scores = new double[numSamples]; <START> if (input.size() <= 1) { <END> for (int i = 0; i < scores.length; i++) { scores[i] = scores.length + 1 - i; } } else { tupleIndex = 0; int scoreIndex = ((Number)input.get(1)).intValue(); for (Tuple tuple : samples) { double score = ((Number)tuple.get(scoreIndex)).doubleValue(); score = Math.max(score, Double.MIN_NORMAL); scores[tupleIndex] = score; tupleIndex++; } } int limitSamples = numSamples; if (input.size() == 3) { limitSamples = Math.min(((Number)input.get(2)).intValue(), numSamples); } Random rng = new Random(); if (System.getProperties().containsKey("pigunit.randseed")) { long randSeed = Long.parseLong(System.getProperties().getProperty("pigunit.randseed")); rng = new Random(randSeed); } for (int k = 0; k < limitSamples; k++) { double val = rng.nextDouble(); int idx = find_cumsum_interval(scores, val, k, numSamples); if (idx == numSamples) idx = rng.nextInt(numSamples - k) + k; output.add(tuples[idx]); scores[idx] = scores[k]; tuples[idx] = tuples[k]; } return output; }</code><technical_language>I remove this</technical_language>

Target:
public DataBag exec(Tuple input) throws IOException { DataBag output = bagFactory.newDefaultBag(); DataBag samples = (DataBag) input.get(0); if (samples == null || samples.size() == 0) { return output; } int numSamples = (int) samples.size(); if (numSamples == 1) return samples; Tuple[] tuples = new Tuple[numSamples]; int tupleIndex = 0; for (Tuple tuple : samples) { tuples[tupleIndex] = tuple; tupleIndex++; } double[] scores = new double[numSamples]; int scoreIndex = ((Number)input.get(1)).intValue(); tupleIndex = 0; for (Tuple tuple : samples) { double score = ((Number)tuple.get(scoreIndex)).doubleValue(); score = Math.max(score, Double.MIN_NORMAL); scores[tupleIndex] = score; tupleIndex++; } int limitSamples = numSamples; if (input.size() == 3) { limitSamples = Math.min(((Number)input.get(2)).intValue(), numSamples); } Random rng = null; if (seed == null) { rng = new Random(); } else { rng = new Random(seed); } for (int k = 0; k < limitSamples; k++) { double val = rng.nextDouble(); int idx = find_cumsum_interval(scores, val, k, numSamples); if (idx == numSamples) idx = rng.nextInt(numSamples - k) + k; output.add(tuples[idx]); scores[idx] = scores[k]; tuples[idx] = tuples[k]; } return output; }
Source:
<code>public Application getApplication() { if (application!=null) { if (application.getId().equals(getId())) { if (getProxy()!=null) return (Application)getProxy(); } return application; } if (getParent()==null) { <START> if (getProxy()!=null) return (Application)getProxy(); <END> return this; } return getParent().getApplication(); }</code><technical_language>a getProxyIfAvailable(), returning getProxy() ?: this</technical_language>

Target:
public Application getApplication() { if (application!=null) { if (application.getId().equals(getId())) return (Application) getProxyIfAvailable(); return application; } if (getParent()==null) return (Application)getProxyIfAvailable(); return getParent().getApplication(); }
Source:
<code>public Map<?, ?> merge(Map<?, ?>... items) { if (ArrayUtils.isEmpty(items)) { <START> return new HashMap<Object, Object>(); <END> } Map<Object, Object> result = new HashMap<Object, Object>(); for (Map<?, ?> item : items) { if (item != null) { result.putAll(item); } } return result; }</code><technical_language>pls. Collections.emptyMap() instead</technical_language>

Target:
public Map<?, ?> merge(Map<?, ?>... items) { if (ArrayUtils.isEmpty(items)) { return Collections.emptyMap(); } Map<Object, Object> result = new HashMap<Object, Object>(); for (Map<?, ?> item : items) { if (item != null) { result.putAll(item); } } return result; }
Source:
<code>protected void modified(Map<String, Object> parameters) { <START> minThreads = (Integer) parameters.get(CONFIG_MIN_THREADS); <END> maxThreads = (Integer) parameters.get(CONFIG_MAX_THREADS); keepAliveTimeout = (Integer) parameters.get(CONFIG_KEEP_ALIVE); queueSize = (Integer) parameters.get(CONFIG_QUEUE_SIZE); threadPool.setCorePoolSize(minThreads); threadPool.setMaximumPoolSize(maxThreads); threadPool.setKeepAliveTime(keepAliveTimeout, TimeUnit.SECONDS); logger.debug("jetty thread pool changed to min threads {}, max threads {}", minThreads, maxThreads); }</code><technical_language>primitive (int) sufficient</technical_language>

Target:
protected void modified(Map<String, Object> parameters) { getConfigParameters(parameters); if (threadPool != null) { threadPool.setMinThreads(minThreadsShared); threadPool.setMaxThreads(maxThreadsShared); threadPool.setIdleTimeout(keepAliveTimeoutShared * 1000); } }
Source:
<code>private void messageSpanTagger(Span span, Message<?> message) { <START> span.remoteServiceName("amazon-sqs"); <END> if (message.getHeaders().get(LOGICAL_RESOURCE_ID) != null) { span.tag("queue.url", message.getHeaders().get(LOGICAL_RESOURCE_ID).toString()); } }</code><technical_language>nit: is necessary prefix amazon- clones of SQS possibly work suggestion span.remoteServiceName("sqs");</technical_language>

Target:
private void messageSpanTagger(Span span, Message<?> message) { span.remoteServiceName("sqs"); if (message.getHeaders().get(LOGICAL_RESOURCE_ID) != null) { span.tag("sqs.queue_url", message.getHeaders().get(LOGICAL_RESOURCE_ID).toString()); } }
Source:
<code><START> public static Contact setContactMe(){ <END> Contact me = null; try{ Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://mysql.cs.iastate.edu/db30901", "adm309", "EXbDqudt4"); ResultSet rs = con.createStatement().executeQuery("select * from testTable where phoneNumber='" + Global.username + "'"); if(rs.next());{ me = new Contact(rs.getString("firstName"),rs.getString("lastName"), rs.getString("phoneNumber"),null); } rs.close(); con.close(); System.out.println("ContactED WORKED"); } catch(Exception e){ System.out.println("Login fail" + e.getMessage()); } return me; }</code><technical_language>This method removed. I prefer obtain name in Login() method, exact ResultSet selected verifying login username password. Simply add a lines get firstName lastName row instead of reconnecting database a time. Also, a lines sysou("ContactED WORKED"), lets get rid of kind of prints want remove in upstream</technical_language>

Target:
public static Contact setContactMe(){ Contact me = null; try{ Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://mysql.cs.iastate.edu/db30901", "adm309", "EXbDqudt4"); ResultSet rs = con.createStatement().executeQuery("select * from testTable where phoneNumber='" + Global.username + "'"); if(rs.next());{ me = new Contact(rs.getString("firstName"),rs.getString("lastName"), rs.getString("phoneNumber"),null); } rs.close(); con.close(); } catch(Exception e){ System.out.println("Login fail" + e.getMessage()); } return me; }
Source:
<code>public void processEvent(final CloudTrailEvent event) { List<String> keyNames = containsKeyNames(event.getEventData().getRequestParameters()); if (!CollectionUtils.isEmpty(keyNames)) { <START> LOG.info("KeyPair must be blank, but was {}", keyNames); <END> } }</code><technical_language>please validation store ;)</technical_language>

Target:
public void processEvent(final CloudTrailEvent event) { List<String> keyNames = CloudtrailEventSupport.containsKeyNames(event.getEventData().getRequestParameters()); if (!CollectionUtils.isEmpty(keyNames)) { violationStore.save(String.format("KeyPair must be blank, but was {}", keyNames)); } }
Source:
<code>private BlackboardArtifact createDownloadArtifact(AbstractFile zoneFile, ZoneIdentifierInfo zoneInfo) { Collection<BlackboardAttribute> bbattributes = createDownloadAttributes( null, null, zoneInfo.getURL(), null, <START> (zoneInfo.getURL() != null ? NetworkUtils.extractDomain(zoneInfo.getURL()) : ""), <END> null); return addArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD, zoneFile, bbattributes); }</code><technical_language>again, StringUtils.defaultString()</technical_language>

Target:
private BlackboardArtifact createDownloadArtifact(AbstractFile zoneFile, ZoneIdentifierInfo zoneInfo) { Collection<BlackboardAttribute> bbattributes = createDownloadAttributes( null, null, zoneInfo.getURL(), null, (zoneInfo.getURL() != null ? NetworkUtils.extractDomain(zoneInfo.getURL()) : ""), null); return addArtifact(TSK_WEB_DOWNLOAD, zoneFile, bbattributes); }
Source:
<code>public void modifyAST(IIndex index, IMarker marker) { String supressionComment = getSupressionComment(getProblem(marker)); if (supressionComment == null) { return; } try { int line = marker.getAttribute(IMarker.LINE_NUMBER, 0); <START> int offset = getDocument().getLineOffset(line) - 1; <END> String commentString = String.format(COMMENT_TEMPLATE, supressionComment); InsertEdit edit = new InsertEdit(offset, commentString); edit.apply(getDocument()); } catch (BadLocationException e) { CheckersUiActivator.log(e); } }</code><technical_language>problem is default, CDT "helpfully" auto-insert a trailing newline file save. disable this behaviour in test with: PreferenceConstants.getPreferenceStore().setValue(PreferenceConstants.ENSURE_NEWLINE_AT_EOF, false);</technical_language>

Target:
public void modifyAST(IIndex index, IMarker marker) { String supressionComment = getSupressionComment(getProblem(marker)); if (supressionComment == null) { return; } try { int line = marker.getAttribute(IMarker.LINE_NUMBER, 0); IRegion lineInformation = getDocument().getLineInformation(line - 1); int offset = lineInformation.getOffset() + lineInformation.getLength(); String commentString = String.format(COMMENT_TEMPLATE, supressionComment); InsertEdit edit = new InsertEdit(offset, commentString); edit.apply(getDocument()); } catch (BadLocationException e) { CheckersUiActivator.log(e); } }
Source:
<code>protected RestResponse handleRequest(RestRequest req) throws Exception { RestResponse res = new RestResponse(); res.setCode(String.valueOf(HttpServletResponse.SC_OK)); String surveyId = ((WebFormRequest)req).getSurveyId(); <START> String url = String.format("<LINK_0>", SystemProperty.applicationId.get(), surveyId); <END> res.setMessage(url); return res; }</code><technical_language>need add appengine-web config feed in EnvServlet.java</technical_language>

Target:
protected RestResponse handleRequest(RestRequest req) throws Exception { RestResponse res = new RestResponse(); res.setCode(String.valueOf(HttpServletResponse.SC_OK)); String surveyId = ((WebFormRequest)req).getSurveyId(); String url = String.format("%s/%s/%s", PropertyUtil.getProperty(EnvServlet.WEBFORM_REDIRECTION_URL), PropertyUtil.getProperty("appId"), surveyId); res.setMessage(url); return res; }
Source:
<code>private String getSearchResults(String searchId) throws Exception { String results = null; ArtifactReadable action = null; if (GUID.isValid(searchId)) { action = AtsServerImpl.get().getArtifactByGuid(searchId); } if (action != null) { IAtsWorkItem workItem = AtsServerImpl.get().getWorkItemFactory().getWorkItem(action); if (workItem != null) { results = ActionUtility.displayAction(registry, action, "Action - " + searchId, ActionLoadLevel.HEADER); } else { results = AHTML.simplePage(String.format("Undisplayable %s", action)); } } for (IAttributeType attrType : Arrays.asList(AtsAttributeTypes.AtsId, AtsAttributeTypes.LegacyPcrId)) { ResultSet<ArtifactReadable> results2 = orcsApi.getQueryFactory(null).fromBranch(AtsUtilRest.getAtsBranch()).and(attrType, org.eclipse.osee.framework.core.enums.Operator.EQUAL, searchId).getResults(); if (results2.size() == 1) { <START> results = <END> ActionUtility.displayAction(registry, results2.getExactlyOne(), "Action - " + searchId, ActionLoadLevel.HEADER); break; } else if (results2.size() > 1) { results = getGuidListHtml(results2); break; } } if (results == null) { results = AHTML.simplePage(String.format("Unknown Id [%s]", searchId)); } return results; }</code><technical_language>Is results meant overriden here? If action != null set line 143 overriden here. results2 renamed properly convey purpose</technical_language>

Target:
private String getSearchResults(String searchId) throws Exception { String results = null; ArtifactReadable action = null; if (GUID.isValid(searchId)) { action = AtsServerImpl.get().getArtifactByGuid(searchId); } if (action != null) { IAtsWorkItem workItem = AtsServerImpl.get().getWorkItemFactory().getWorkItem(action); if (workItem != null) { results = ActionUtility.displayAction(registry, action, "Action - " + searchId, ActionLoadLevel.HEADER); } else { results = AHTML.simplePage(String.format("Undisplayable %s", action)); } } if (!Strings.isValid(results)) { for (IAttributeType attrType : Arrays.asList(AtsAttributeTypes.AtsId, AtsAttributeTypes.LegacyPcrId)) { ResultSet<ArtifactReadable> legacyQueryResults = orcsApi.getQueryFactory(null).fromBranch(AtsUtilRest.getAtsBranch()).and(attrType, org.eclipse.osee.framework.core.enums.Operator.EQUAL, searchId).getResults(); if (legacyQueryResults.size() == 1) { results = ActionUtility.displayAction(registry, legacyQueryResults.getExactlyOne(), "Action - " + searchId, ActionLoadLevel.HEADER); break; } else if (legacyQueryResults.size() > 1) { results = getGuidListHtml(legacyQueryResults); break; } } } if (!Strings.isValid(results)) { results = AHTML.simplePage(String.format("Unknown Id [%s]", searchId)); } return results; }
Source:
<code>private static boolean isSerialVersionUID(Tree tree) { Tree parent = tree.parent(); while (parent != null && !parent.is(Tree.Kind.VARIABLE)) { parent = parent.parent(); } <START> return parent != null && "serialVersionUID".equals(((VariableTree) parent).symbol().name()); <END> }</code><technical_language>for semantic ?</technical_language>

Target:
private static boolean isSerialVersionUID(Tree tree) { Tree parent = tree.parent(); while (parent != null && !parent.is(Tree.Kind.VARIABLE)) { parent = parent.parent(); } return parent != null && "serialVersionUID".equals(((VariableTree) parent).simpleName().name()); }
Source:
<code>public void addReviewers(ReviewDb db, Change change, PatchSet ps, PatchSetInfo info, Set<Id> wantReviewers, Set<Account.Id> existingReviewers) throws OrmException { List<ApprovalType> allTypes = approvalTypes.getApprovalTypes(); if (allTypes.isEmpty()) { return; } Set<Account.Id> need = Sets.newHashSet(wantReviewers); Account.Id authorId = info.getAuthor() != null ? info.getAuthor().getAccount() : null; if (authorId != null && !ps.isDraft()) { need.add(authorId); } Account.Id committerId = info.getCommitter() != null ? info.getCommitter().getAccount() : null; if (committerId != null && !ps.isDraft()) { need.add(committerId); } need.remove(change.getOwner()); need.removeAll(existingReviewers); List<PatchSetApproval> cells = Lists.newArrayListWithCapacity(need.size()); ApprovalCategory.Id catId = new ApprovalCategory.Id( <START> allTypes.get(allTypes.size() - 1).getId()); <END> for (Account.Id account : need) { PatchSetApproval psa = new PatchSetApproval( new PatchSetApproval.Key(ps.getId(), account, catId), (short) 0); psa.cache(change); cells.add(psa); } db.patchSetApprovals().insert(cells); }</code><technical_language>[optional] ApprovalCategory.Id catId = allTypes.get(allTypes.size() - 1).getApprovalCategoryId();</technical_language>

Target:
public void addReviewers(ReviewDb db, Change change, PatchSet ps, PatchSetInfo info, Set<Id> wantReviewers, Set<Account.Id> existingReviewers) throws OrmException { List<ApprovalType> allTypes = approvalTypes.getApprovalTypes(); if (allTypes.isEmpty()) { return; } Set<Account.Id> need = Sets.newHashSet(wantReviewers); Account.Id authorId = info.getAuthor() != null ? info.getAuthor().getAccount() : null; if (authorId != null && !ps.isDraft()) { need.add(authorId); } Account.Id committerId = info.getCommitter() != null ? info.getCommitter().getAccount() : null; if (committerId != null && !ps.isDraft()) { need.add(committerId); } need.remove(change.getOwner()); need.removeAll(existingReviewers); List<PatchSetApproval> cells = Lists.newArrayListWithCapacity(need.size()); ApprovalCategory.Id catId = Iterables.getLast(allTypes).getApprovalCategoryId(); for (Account.Id account : need) { PatchSetApproval psa = new PatchSetApproval( new PatchSetApproval.Key(ps.getId(), account, catId), (short) 0); psa.cache(change); cells.add(psa); } db.patchSetApprovals().insert(cells); }
Source:
<code>public Gson getGson() { <START> return gsonBuilder.create(); <END> }</code><technical_language>I creating this here, getGson implies a gson instance exists, retrieved effects</technical_language>

Target:
public Gson getGson() { return gson; }
Source:
<code>public String getToken(HttpServletRequest req) { if (req.getHeader(HttpHeaders.AUTHORIZATION) == null) { return null; } if (req.getHeader(HttpHeaders.AUTHORIZATION).toLowerCase().startsWith("bearer")) { String[] parts = req.getHeader(HttpHeaders.AUTHORIZATION).split("\\s+"); if (parts.length != 2) { <START> throw new BadRequestException("Invalid authorization header format."); <END> } return parts[1]; } else { return req.getHeader(HttpHeaders.AUTHORIZATION); } }</code><technical_language>print full http headers here, exact request is coming happens? good indication more this is happening..</technical_language>

Target:
public String getToken(HttpServletRequest req) { if (req.getHeader(HttpHeaders.AUTHORIZATION) == null) { return null; } if (req.getHeader(HttpHeaders.AUTHORIZATION).toLowerCase().startsWith("bearer")) { String[] parts = req.getHeader(HttpHeaders.AUTHORIZATION).split(" "); if (parts.length != 2) { throw new BadRequestException("Invalid authorization header format."); } return parts[1]; } else { return req.getHeader(HttpHeaders.AUTHORIZATION); } }
Source:
<code><START> public long getRetainedSizeInBytes() <END> { return INSTANCE_SIZE + sizeOf(keyIndices) + sizeOf(nestedReadOffsets) + sizeOf(offsets) + sizeOf(nulls) + sizeOf(outputPositions) + sizeOf(nestedLengths) + (nestedPositions != null ? Arrays.stream(nestedPositions).mapToLong(SizeOf::sizeOf).sum() : 0) + sizeOf(nestedPositionCounts) + (nestedOutputPositions != null ? Arrays.stream(nestedOutputPositions).mapToLong(SizeOf::sizeOf).sum() : 0) + (inMap != null ? Arrays.stream(inMap).mapToLong(SizeOf::sizeOf).sum() : 0); }</code><technical_language>Do wanna add array list accounting? (e.g., inMapStreams)</technical_language>

Target:
public long getRetainedSizeInBytes() { return INSTANCE_SIZE + sizeOf(keyIndices) + sizeOf(nestedReadOffsets) + sizeOf(offsets) + sizeOf(nulls) + sizeOf(outputPositions) + sizeOf(nestedLengths) + (nestedPositions != null ? Arrays.stream(nestedPositions).mapToLong(SizeOf::sizeOf).sum() : 0) + sizeOf(nestedPositionCounts) + (nestedOutputPositions != null ? Arrays.stream(nestedOutputPositions).mapToLong(SizeOf::sizeOf).sum() : 0) + (inMap != null ? Arrays.stream(inMap).mapToLong(SizeOf::sizeOf).sum() : 0) + (valueStreamReaders != null ? valueStreamReaders.stream().mapToLong(StreamReader::getRetainedSizeInBytes).sum() : 0); }
Source:
<code>public byte[] getCacheKey() { return new CacheKeyBuilder(PostAggregatorIds.HLL_SKETCH_TO_ESTIMATE_CACHE_TYPE_ID) <START> .appendString(name) <END> .appendCacheable(field) .build(); }</code><technical_language>I name in cache key</technical_language>

Target:
public byte[] getCacheKey() { return new CacheKeyBuilder(PostAggregatorIds.HLL_SKETCH_TO_ESTIMATE_CACHE_TYPE_ID) .appendCacheable(field) .build(); }
Source:
<code>public void stop(BundleContext context) throws Exception { IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry(); matchEngineConfiguratorRegistry = null; <START> matchEngineConfiguratorRegistryListener = null; <END> extensionRegistry.removeListener(differenceGroupExtenderRegistryListener); differenceGroupExtenderRegistryListener = null; differenceGroupExtenderRegistry = null; extensionRegistry.removeListener(accessorFactoryRegistryListener); accessorFactoryRegistryListener = null; accessorFactoryRegistry = null; extensionRegistry.removeListener(filterRegistryListener); filterRegistryListener = null; filterRegistry = null; extensionRegistry.removeListener(groupProviderRegistryListener); groupProviderRegistryListener = null; groupProviderRegistry = null; plugin = null; disposeCachedImages(); super.stop(context); }</code><technical_language>remove listener registry</technical_language>

Target:
public void stop(BundleContext context) throws Exception { IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry(); extensionRegistry.removeListener(matchEngineConfiguratorRegistryListener); matchEngineConfiguratorRegistry = null; matchEngineConfiguratorRegistryListener = null; extensionRegistry.removeListener(differenceGroupExtenderRegistryListener); differenceGroupExtenderRegistryListener = null; differenceGroupExtenderRegistry = null; extensionRegistry.removeListener(accessorFactoryRegistryListener); accessorFactoryRegistryListener = null; accessorFactoryRegistry = null; extensionRegistry.removeListener(filterRegistryListener); filterRegistryListener = null; filterRegistry = null; extensionRegistry.removeListener(groupProviderRegistryListener); groupProviderRegistryListener = null; groupProviderRegistry = null; plugin = null; disposeCachedImages(); super.stop(context); }
Source:
<code>private boolean hasNewOrMissingSubstitutions() { for (NLSSubstitution <START> curr : <END> fSubstitutions) { if (curr.getInitialState() == NLSSubstitution.INTERNALIZED) { return true; } if (curr.getInitialState() == NLSSubstitution.EXTERNALIZED && curr.getInitialValue() == null) { return true; } } return false; }</code><technical_language>rename substitution</technical_language>

Target:
private boolean hasNewOrMissingSubstitutions() { for (NLSSubstitution substitution : fSubstitutions) { if (substitution.getInitialState() == NLSSubstitution.INTERNALIZED) { return true; } if (substitution.getInitialState() == NLSSubstitution.EXTERNALIZED && substitution.getInitialValue() == null) { return true; } } return false; }
Source:
<code>public String toString() { <START> return "[TmfTraceSynchronizedSignal (" + fAlgoSync.toString() + ")]"; END> }</code><technical_language>getClass().getSimpleName() trick mentioned earlier</technical_language>

Target:
public String toString() { return "[" + getClass().getSimpleName() + " (" + fAlgoSync.toString() + ")]"; }
Source:
<code>private PaymentTransaction findCreatedTransaction(final Payment payment, final TransactionType transactionType, @Nullable final String transactionExternalKey) { final List<PaymentTransaction> reversedTransactions = Lists.reverse(payment.getTransactions()); final Iterable<PaymentTransaction> matchingTransactions = Iterables.filter(reversedTransactions, new Predicate<PaymentTransaction>() { @Override public boolean apply(final PaymentTransaction input) { return input.getTransactionType() == transactionType; } }); if (transactionExternalKey != null) { for (final PaymentTransaction transaction : matchingTransactions) { <START> if (Objects.equal(transaction.getExternalKey(), transactionExternalKey)) { <END> return transaction; } } } return Iterables.getFirst(matchingTransactions, null); }</code><technical_language>Sure, works, transactionExternalKey != null, simply transactionExternalKey.equals(transaction.getExternalKey())</technical_language>

Target:
private PaymentTransaction findCreatedTransaction(final Payment payment, final TransactionType transactionType, @Nullable final String transactionExternalKey) { final List<PaymentTransaction> reversedTransactions = Lists.reverse(payment.getTransactions()); final Iterable<PaymentTransaction> matchingTransactions = Iterables.filter(reversedTransactions, new Predicate<PaymentTransaction>() { @Override public boolean apply(final PaymentTransaction input) { return input.getTransactionType() == transactionType; } }); if (transactionExternalKey != null) { for (final PaymentTransaction transaction : matchingTransactions) { if (transactionExternalKey.equals(transaction.getExternalKey())) { return transaction; } } } return Iterables.getFirst(matchingTransactions, null); }
Source:
<code>public Linkifier(GitilesUrls urls, Config config) { this.urls = checkNotNull(urls, "urls"); List<CommentLinkInfo> list = new ArrayList<>(); list.add(new CommentLinkInfo(HTTP_URL_PATTERN, "$0")); Set<String> subsections = config.getSubsections(COMMENTLINK); List<String> patterns = new ArrayList<>(); patterns.add(HTTP_URL_PATTERN.pattern()); patterns.add(CHANGE_ID_PATTERN.pattern()); for (String subsection : subsections) { String match = config.getString("commentlink", subsection, "match"); String link = config.getString("commentlink", subsection, "link"); String html = config.getString("commentlink", subsection, "html"); if (html != null) { log.warn("Beware: html in commentlinks is unsupported in gitiles; " + "Did you copy it from a gerrit config?"); } if (Strings.isNullOrEmpty(match)) { log.warn("invalid commentlink.%s.match", subsection); continue; } if (Strings.isNullOrEmpty(link)) { log.warn("invalid commentlink.%s.link", subsection); continue; } Pattern pattern = Pattern.compile(match); <START> if (link != null) { <END> list.add(new CommentLinkInfo(pattern, link)); } patterns.add(match); } this.commentLinks = Collections.unmodifiableList(list); allPattern = Pattern.compile(Joiner.on('|').join(patterns)); }</code><technical_language>needed more</technical_language>

Target:
public Linkifier(GitilesUrls urls, Config config) { this.urls = checkNotNull(urls, "urls"); List<CommentLinkInfo> list = new ArrayList<>(); list.add(new CommentLinkInfo(HTTP_URL_PATTERN, "$0")); Set<String> subsections = config.getSubsections(COMMENTLINK); List<String> patterns = new ArrayList<>(); patterns.add(HTTP_URL_PATTERN.pattern()); patterns.add(CHANGE_ID_PATTERN.pattern()); for (String subsection : subsections) { String match = config.getString("commentlink", subsection, "match"); String link = config.getString("commentlink", subsection, "link"); String html = config.getString("commentlink", subsection, "html"); if (html != null) { log.warn("Beware: html in commentlinks is unsupported in gitiles; " + "Did you copy it from a gerrit config?"); } if (Strings.isNullOrEmpty(match)) { log.warn("invalid commentlink.%s.match", subsection); continue; } if (Strings.isNullOrEmpty(link)) { log.warn("invalid commentlink.%s.link", subsection); continue; } Pattern pattern = Pattern.compile(match); list.add(new CommentLinkInfo(pattern, link)); patterns.add(match); } this.commentLinks = Collections.unmodifiableList(list); allPattern = Pattern.compile(Joiner.on('|').join(patterns)); }
Source:
<code>private ScoreData[] getScoreDataForNode(BeatmapSetNode node, boolean setTimeSince) { if (scoreMap == null || scoreMap.isEmpty() || node.beatmapIndex == -1) return null; Beatmap beatmap = node.getSelectedBeatmap(); ScoreData[] scores = scoreMap.get(beatmap.version); if (scores == null || scores.length < 1) return null; ScoreData s = scores[0]; if (beatmap.beatmapID == s.MID && beatmap.beatmapSetID == s.MSID && beatmap.title.equals(s.title) && beatmap.artist.equals(s.artist) && beatmap.creator.equals(s.creator)) { for (int i = 0; i < scores.length; i++) { if (setTimeSince) scores[i].getTimeSince(); scores[i].loadGlyphs(); } return scores; <START> } <END> return null; }</code><technical_language>change code style</technical_language>

Target:
private ScoreData[] getScoreDataForNode(BeatmapSetNode node, boolean setTimeSince) { if (scoreMap == null || scoreMap.isEmpty() || node.beatmapIndex == -1) return null; Beatmap beatmap = node.getSelectedBeatmap(); ScoreData[] scores = scoreMap.get(beatmap.version); if (scores == null || scores.length < 1) return null; ScoreData s = scores[0]; if (beatmap.beatmapID == s.MID && beatmap.beatmapSetID == s.MSID && beatmap.title.equals(s.title) && beatmap.artist.equals(s.artist) && beatmap.creator.equals(s.creator)) { for (int i = 0; i < scores.length; i++) { if (setTimeSince) scores[i].getTimeSince(); scores[i].loadGlyphs(); } return scores; } else return null; }
Source:
<code>public synchronized double getTotalDataFetchRate() { double fetchRate = 0; for (HdfsCopyStats copyStats : copyStatsMap.values()) { <START> fetchRate += copyStats.getBytesTransferredPerSecond(); <END> } return fetchRate; }</code><technical_language>fetchRate is updated calculated intervals. EventThrottler a rate sensor, output for totalFetchRate</technical_language>

Target:
public synchronized double getTotalDataFetchRate() { return HdfsFetcher.getDataFetchRate(); }
Source:
<code>public void testKilledSession() throws Exception { client.create().forPath("/test"); cache = newTreeCacheWithListeners(client, "/test"); cache.start(); assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test"); assertEvent(TreeCacheEvent.Type.INITIALIZED); client.create().forPath("/test/foo", "foo".getBytes()); assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test/foo"); client.create().withMode(CreateMode.EPHEMERAL).forPath("/test/me", "data".getBytes()); assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test/me"); KillSession2.kill(client.getZookeeperClient().getZooKeeper()); <START> if ( client.isZk34CompatibilityMode() ) <END> { assertEvent(TreeCacheEvent.Type.CONNECTION_LOST); assertEvent(TreeCacheEvent.Type.NODE_REMOVED, "/test/me", "data".getBytes()); assertEvent(TreeCacheEvent.Type.CONNECTION_RECONNECTED); assertEvent(TreeCacheEvent.Type.INITIALIZED); } else { assertEvent(TreeCacheEvent.Type.CONNECTION_LOST); assertEvent(TreeCacheEvent.Type.CONNECTION_RECONNECTED); assertEvent(TreeCacheEvent.Type.INITIALIZED); assertEvent(TreeCacheEvent.Type.NODE_REMOVED, "/test/me", "data".getBytes()); } assertNoMoreEvents(); }</code><technical_language>Is this a race condition? I reverted this test run fine for (the 5 times run it)</technical_language>

Target:
public void testKilledSession() throws Exception { client.create().forPath("/test"); cache = newTreeCacheWithListeners(client, "/test"); cache.start(); assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test"); assertEvent(TreeCacheEvent.Type.INITIALIZED); client.create().forPath("/test/foo", "foo".getBytes()); assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test/foo"); client.create().withMode(CreateMode.EPHEMERAL).forPath("/test/me", "data".getBytes()); assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test/me"); Compatibility.injectSessionExpiration(client.getZookeeperClient().getZooKeeper()); assertEvent(TreeCacheEvent.Type.NODE_REMOVED, "/test/me", "data".getBytes(), true); assertEvent(TreeCacheEvent.Type.INITIALIZED, null, null, true); assertNoMoreEvents(); }
Source:
<code>public static OzoneObjInfo fromProtobuf(OzoneManagerProtocolProtos.OzoneObj proto) { Builder builder = new Builder() .setResType(ResourceType.valueOf(proto.getResType().name())) .setStoreType(StoreType.valueOf(proto.getStoreType().name())); String path = proto.getPath(); if(path == null) { throw new IllegalArgumentException("Unexpected null path"); } <START> Path p = Paths.get(path); <END> switch (proto.getResType()) { case VOLUME: builder.setVolumeName(p.getName(0).toString()); break; case BUCKET: if (p.getNameCount() < 2) { throw new IllegalArgumentException("Unexpected argument for " + "Ozone bucket. Path:" + proto.getPath()); } builder.setVolumeName(p.getName(0).toString()); builder.setBucketName(p.getName(1).toString()); break; case KEY: if (p.getNameCount() < 3) { throw new IllegalArgumentException("Unexpected argument for " + "Ozone key. Path:" + proto.getPath()); } builder.setVolumeName(p.getName(0).toString()); builder.setBucketName(p.getName(1).toString()); String keyName = p.subpath(2, p.getNameCount()).toString(); builder.setKeyName(path.endsWith(OZONE_URI_DELIMITER) ? keyName + OZONE_URI_DELIMITER : keyName); break; case PREFIX: if (p.getNameCount() < 3) { throw new IllegalArgumentException("Unexpected argument for " + "Ozone prefix. Path:" + proto.getPath()); } builder.setVolumeName(p.getName(0).toString()); builder.setBucketName(p.getName(1).toString()); builder.setPrefixName(p.subpath(2, p.getNameCount()).toString() + OZONE_URI_DELIMITER); break; default: throw new IllegalArgumentException("Unexpected type for " + "Ozone key. Type:" + proto.getResType()); } return builder.build(); }</code><technical_language>prefix keyName? define parse accordingly</technical_language>

Target:
public static OzoneObjInfo fromProtobuf(OzoneManagerProtocolProtos.OzoneObj proto) { Builder builder = new Builder() .setResType(ResourceType.valueOf(proto.getResType().name())) .setStoreType(StoreType.valueOf(proto.getStoreType().name())); String[] tokens = StringUtils.split(proto.getPath(), OZONE_URI_DELIMITER, 3); if(tokens == null) { throw new IllegalArgumentException("Unexpected path:" + proto.getPath()); } switch (proto.getResType()) { case VOLUME: builder.setVolumeName(tokens[0]); break; case BUCKET: if (tokens.length < 2) { throw new IllegalArgumentException("Unexpected argument for " + "Ozone bucket. Path:" + proto.getPath()); } builder.setVolumeName(tokens[0]); builder.setBucketName(tokens[1]); break; case KEY: if (tokens.length < 3) { throw new IllegalArgumentException("Unexpected argument for " + "Ozone key. Path:" + proto.getPath()); } builder.setVolumeName(tokens[0]); builder.setBucketName(tokens[1]); builder.setKeyName(tokens[2]); break; case PREFIX: if (tokens.length < 3) { throw new IllegalArgumentException("Unexpected argument for " + "Ozone Prefix. Path:" + proto.getPath()); } builder.setVolumeName(tokens[0]); builder.setBucketName(tokens[1]); builder.setPrefixName(tokens[2]); break; default: throw new IllegalArgumentException("Unexpected type for " + "Ozone key. Type:" + proto.getResType()); } return builder.build(); }
Source:
<code>public void handle(Request request, Response response) throws Exception { verifySystemAdministrator(); <START> List<RuleKey> disabledTemplateAndCustomRuleKeys = null; <END> try (DbSession dbSession = dbClient.openSession(false)) { if (isSupportDisabled(dbSession)) { flagCurrentUserAsRoot(dbSession); createDefaultMembersGroup(dbSession); disabledTemplateAndCustomRuleKeys = disableTemplateRulesAndCustomRules(dbSession); enableFeature(dbSession); dbSession.commit(); } } if (disabledTemplateAndCustomRuleKeys != null) { ruleIndexer.indexRuleDefinitions(disabledTemplateAndCustomRuleKeys); } response.noContent(); }</code><technical_language>need define this variable early, move ruleIndexer.indexRuleDefinitions(disabledTemplateAndCustomRuleKeys); dbSession.commit(); get rid of ugly variable initialized null closing connection is important. correct code pass ruleIndexer.indexRuleDefinitions (or closed a single SQL session is HTTP request)</technical_language>

Target:
public void handle(Request request, Response response) throws Exception { verifySystemAdministrator(); try (DbSession dbSession = dbClient.openSession(false)) { if (isSupportDisabled(dbSession)) { flagCurrentUserAsRoot(dbSession); createDefaultMembersGroup(dbSession); List<RuleKey> disabledTemplateAndCustomRuleKeys = disableTemplateRulesAndCustomRules(dbSession); enableFeature(dbSession); dbSession.commit(); ruleIndexer.indexRuleDefinitions(disabledTemplateAndCustomRuleKeys); } } response.noContent(); }
Source:
<code>public void reinstatePatchUnauthorizedTest() throws Exception { context.turnOffAuthorisationSystem(); parentCommunity = CommunityBuilder.createCommunity(context) .withName("Parent Community") .build(); Community child1 = CommunityBuilder.createSubCommunity(context, parentCommunity) .withName("Sub Community") .build(); Collection col1 = CollectionBuilder.createCollection(context, child1) .withName("Collection 1").build(); context.setCurrentUser(admin); Item item = ItemBuilder.createItem(context, col1) .withTitle("Public item 1") .withIssueDate("2017-10-17") .withAuthor("Smith, Donald").withAuthor("Doe, John") .withSubject("ExtraEntry") .withdrawn() .build(); String tokenAdmin = getAuthToken(admin.getEmail(), password); List<Operation> ops = new ArrayList<Operation>(); <START> ReplaceOperation replaceOperation = new ReplaceOperation("/withdrawn", "false"); <END> ops.add(replaceOperation); String patchBody = getPatchContent(ops); getClient().perform(patch("/api/core/items/" + item.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isUnauthorized()); getClient(tokenAdmin).perform(get("/api/core/items/" + item.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$.uuid", Matchers.is(item.getID().toString()))) .andExpect(jsonPath("$.withdrawn", Matchers.is(true))) .andExpect(jsonPath("$.inArchive", Matchers.is(false))); }</code><technical_language>official true instead "true"</technical_language>

Target:
public void reinstatePatchUnauthorizedTest() throws Exception { context.turnOffAuthorisationSystem(); parentCommunity = CommunityBuilder.createCommunity(context) .withName("Parent Community") .build(); Community child1 = CommunityBuilder.createSubCommunity(context, parentCommunity) .withName("Sub Community") .build(); Collection col1 = CollectionBuilder.createCollection(context, child1) .withName("Collection 1").build(); context.setCurrentUser(admin); Item item = ItemBuilder.createItem(context, col1) .withTitle("Public item 1") .withIssueDate("2017-10-17") .withAuthor("Smith, Donald").withAuthor("Doe, John") .withSubject("ExtraEntry") .withdrawn() .build(); String tokenAdmin = getAuthToken(admin.getEmail(), password); List<Operation> ops = new ArrayList<Operation>(); ReplaceOperation replaceOperation = new ReplaceOperation("/withdrawn", false); ops.add(replaceOperation); String patchBody = getPatchContent(ops); getClient().perform(patch("/api/core/items/" + item.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isUnauthorized()); getClient(tokenAdmin).perform(get("/api/core/items/" + item.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$.uuid", Matchers.is(item.getID().toString()))) .andExpect(jsonPath("$.withdrawn", Matchers.is(true))) .andExpect(jsonPath("$.inArchive", Matchers.is(false))); }
Source:
<code>public List<QuotaEmailTemplatesVO> listAllQuotaEmailTemplates(final String templateName) { return Transaction.execute(TransactionLegacy.USAGE_DB, new TransactionCallback<List<QuotaEmailTemplatesVO>>() { @Override public List<QuotaEmailTemplatesVO> doInTransaction(final TransactionStatus status) { SearchCriteria<QuotaEmailTemplatesVO> sc = QuotaEmailTemplateSearch.create(); <START> if (templateName != null) { <END> sc.setParameters("template_name", templateName); } return listBy(sc); } }); }</code><technical_language>Is a blank template name acceptable? If not, check Strings.isNullOrEmpty() a simple null check</technical_language>

Target:
public List<QuotaEmailTemplatesVO> listAllQuotaEmailTemplates(final String templateName) { return Transaction.execute(TransactionLegacy.USAGE_DB, new TransactionCallback<List<QuotaEmailTemplatesVO>>() { @Override public List<QuotaEmailTemplatesVO> doInTransaction(final TransactionStatus status) { SearchCriteria<QuotaEmailTemplatesVO> sc = QuotaEmailTemplateSearch.create(); if (!Strings.isNullOrEmpty(templateName)) { sc.setParameters("template_name", templateName); } return listBy(sc); } }); }
Source:
<code>public void internalStart(String trigger) { StartNode startNode = getRuleFlowProcess().getStart(trigger); if (startNode != null) { ((NodeInstance) getNodeInstance(startNode)).trigger(null, null); } else if (!getRuleFlowProcess().isDynamic() && this.getRuleFlowProcess().getTimerStart().isEmpty()) { <START> throw new IllegalArgumentException("There is no start node that matches the trigger " + trigger == null ? "none" : trigger); <END> } List<Node> autoStartNodes = getRuleFlowProcess().getAutoStartNodes(); autoStartNodes .forEach(austoStartNode -> signalEvent(austoStartNode.getName(), null)); }</code><technical_language>I realized I checked failing test parentheses missing ternary operator, string concatenation higher priority. be: IllegalArgumentException("There is start node matches trigger " + (trigger == null ? "none" : trigger));</technical_language>

Target:
public void internalStart(String trigger) { StartNode startNode = getRuleFlowProcess().getStart(trigger); if (startNode != null) { ((NodeInstance) getNodeInstance(startNode)).trigger(null, null); } else if (!getRuleFlowProcess().isDynamic()) { throw new IllegalArgumentException("There is no start node that matches the trigger " + (trigger == null ? "none" : trigger)); } List<Node> autoStartNodes = getRuleFlowProcess().getAutoStartNodes(); autoStartNodes .forEach(austoStartNode -> signalEvent(austoStartNode.getName(), null)); }