auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void mountPathNotFoundTest() throws Exception { MockDataNodeId dataNode = clusterMap.getDataNodes().get(0); List<ReplicaId> replicas = clusterMap.getReplicaIds(dataNode); List<String> mountPaths = dataNode.getMountPaths(); String mountPathToDelete = mountPaths.get(RANDOM.nextInt(mountPaths.size())); deleteDirectory(new File(mountPathToDelete)); StorageManager storageManager = createAndStartStoreManager(replicas); for (ReplicaId replica : replicas) { if (replica.getMountPath().equals(mountPathToDelete)) { <START> assertNull(storageManager.getStore(replica.getPartitionId())); <END> } else { Store store = storageManager.getStore(replica.getPartitionId()); assertTrue("Store should be started", ((BlobStore) store).isStarted()); } } shutdownAndAssertStoresInaccessible(storageManager, replicas); }</code><technical_language>minor: add message (same in other places)</technical_language>

Target:
public void mountPathNotFoundTest() throws Exception { MockDataNodeId dataNode = clusterMap.getDataNodes().get(0); List<ReplicaId> replicas = clusterMap.getReplicaIds(dataNode); List<String> mountPaths = dataNode.getMountPaths(); String mountPathToDelete = mountPaths.get(RANDOM.nextInt(mountPaths.size())); deleteDirectory(new File(mountPathToDelete)); StorageManager storageManager = createAndStartStoreManager(replicas); for (ReplicaId replica : replicas) { if (replica.getMountPath().equals(mountPathToDelete)) { assertNull("This store should not be accessible.", storageManager.getStore(replica.getPartitionId())); } else { Store store = storageManager.getStore(replica.getPartitionId()); assertTrue("Store should be started", ((BlobStore) store).isStarted()); } } shutdownAndAssertStoresInaccessible(storageManager, replicas); }
Source:
<code>public void setValue(Object o) { <START> n = (Integer)o; <END> }</code><technical_language>attempting cast a null Object Integer throw a NullPointerException behavior did</technical_language>

Target:
public void setValue(Object o) { if (o == null) { throw new NullPointerException("Attempt to set an IAnswerData class to null."); } n = (Integer)o; }
Source:
<code>private Object putFromLoadInternal(Data key, Object value, long ttl, long maxIdle, boolean backup, Address callerAddress) { if (!isKeyAndValueLoadable(key, value)) { return null; } long now = getNow(); if (shouldEvict()) { return null; } markRecordStoreExpirable(ttl, maxIdle); <START> Record record = getRecordOrNull(key, now, backup); <END> Object oldValue = null; EntryEventType entryEventType; if (record == null) { value = mapServiceContext.interceptPut(interceptorRegistry, null, value); record = createRecord(key, value, ttl, maxIdle, now); storage.put(key, record); mutationObserver.onLoadRecord(key, record, backup); entryEventType = LOADED; } else { oldValue = record.getValue(); value = mapServiceContext.interceptPut(interceptorRegistry, oldValue, value); updateRecord(key, record, value, oldValue, now, true, ttl, maxIdle, false, null, backup); entryEventType = UPDATED; } if (!backup) { mapEventPublisher.publishEvent(callerAddress, name, entryEventType, key, oldValue, value); } return oldValue; }</code><technical_language>Nice catch :+1:</technical_language>

Target:
private Object putFromLoadInternal(Data key, Object value, long ttl, long maxIdle, boolean backup, Address callerAddress) { if (!isKeyAndValueLoadable(key, value)) { return null; } long now = getNow(); if (shouldEvict()) { return null; } markRecordStoreExpirable(ttl, maxIdle); Record record = getRecordOrNull(key, now, backup); Object oldValue = null; EntryEventType entryEventType; if (record == null) { value = mapServiceContext.interceptPut(interceptorRegistry, null, value); record = createRecord(key, value, ttl, maxIdle, now); storage.put(key, record); mutationObserver.onLoadRecord(key, record, backup); entryEventType = LOADED; } else { oldValue = record.getValue(); value = mapServiceContext.interceptPut(interceptorRegistry, oldValue, value); updateRecord(key, record, oldValue, value, now, true, ttl, maxIdle, false, null, backup); entryEventType = UPDATED; } if (!backup) { mapEventPublisher.publishEvent(callerAddress, name, entryEventType, key, oldValue, value); } return oldValue; }
Source:
<code>public void testValidationChecksumBuilderChecksumArtifactsNullFails() { final Builder builder = new ValidationChecksum.Builder().destination(checksumdirectory); final Artifact a1 = TestArtifactBuilder.testArtifact().groupId("org.apache.maven.plugins") .artifactId("maven-compiler-plugin").packaging("jar").version("1.0").build(); final Artifact a2 = TestArtifactBuilder.testArtifact().groupId("org.apache.commons").artifactId("commons-io") .packaging("jar").version("1.0").build(); <START> assertThatThrownBy(() -> builder.artifacts(asList(a1, a2, null)).build()) <END> .isExactlyInstanceOf(NullPointerException.class); }</code><technical_language>in this case asList(a1, a2, null) assigned variable, call build method</technical_language>

Target:
public void testValidationChecksumBuilderChecksumArtifactsNullFails() { final Builder builder = new ValidationChecksum.Builder().destination(checksumdirectory); final Artifact a1 = TestArtifactBuilder.testArtifact().groupId("org.apache.maven.plugins") .artifactId("maven-compiler-plugin").packaging("jar").version("1.0").build(); final Artifact a2 = TestArtifactBuilder.testArtifact().groupId("org.apache.commons").artifactId("commons-io") .packaging("jar").version("1.0").build(); final List<Artifact> artifacts = asList(a1, a2, null); assertThatCode(() -> builder.artifacts(artifacts).build()) .isExactlyInstanceOf(NullPointerException.class); }
Source:
<code>public void buildDelta(IResourceChangeDescriptionFactory builder) { if (fDeltaDescriptions == null) return; for (DeltaDescription <START> deltaDescription : <END> fDeltaDescriptions) { deltaDescription.buildDelta(builder); } }</code><technical_language>rename delta,</technical_language>

Target:
public void buildDelta(IResourceChangeDescriptionFactory builder) { if (fDeltaDescriptions == null) return; for (DeltaDescription delta : fDeltaDescriptions) { delta.buildDelta(builder); } }
Source:
<code>public Task updateTask(Task task) { task = taskDao.update(task); <START> task.setHref(MessageFormat.format(systemPropertiesProvider.getProperty(SDC_MANAGER_URL)+ <END> Configuration.TASK_BASE_PATH, Long.valueOf(task.getId()).toString(), task.getVdc())); return task; }</code><technical_language>is in this line, leave a blanck space "+"</technical_language>

Target:
public Task updateTask(Task task) { task = taskDao.update(task); task.setHref(getHrefUrl(task)); return task; }
Source:
<code><START> MakeBucketArgs(Builder builder) { <END> super(builder); this.objectLock = builder.objectLock; }</code><technical_language>This constructor private ensure objects created builder</technical_language>

Target:
private MakeBucketArgs(Builder builder) { super(builder); this.objectLock = builder.objectLock; }
Source:
<code>private JRadioButtonMenuItem addZAPModeMenuItem(final Mode modeType){ <START> final JRadioButtonMenuItem modeItem = new JRadioButtonMenuItem(""+Constant.messages.getString("view.toolbar.mode."+modeType.name()+".select")); <END> modeItem.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { Control.getSingleton().setMode(modeType); if (View.isInitialised()){ View.getSingleton().getMainFrame().getMainToolbarPanel().setMode(modeType); } } }); return modeItem; }</code><technical_language>Is leading empty string necessary in concatenation</technical_language>

Target:
private JRadioButtonMenuItem addZAPModeMenuItem(final Mode modeType){ final JRadioButtonMenuItem modeItem = new JRadioButtonMenuItem(Constant.messages.getString("view.toolbar.mode."+modeType.name()+".select")); modeItem.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { Control.getSingleton().setMode(modeType); if (View.isInitialised()){ View.getSingleton().getMainFrame().getMainToolbarPanel().setMode(modeType); } } }); return modeItem; }
Source:
<code>private void performActionForServicesOfServer() { List<GlusterService> serviceList = getGlusterServiceDao().getByServiceType(serviceType); List<String> serviceListStr = new ArrayList<String>(); for (GlusterService srvc : serviceList) { serviceListStr.add(srvc.getServiceName()); } VDSReturnValue returnValue = null; returnValue = runVdsCommand(VDSCommandType.ManageGlusterService, new GlusterServiceVDSParameters(serverId, serviceListStr, actionType)); setSucceeded(returnValue.getSucceeded()); if (!getSucceeded()) { handleVdsError(manageActionDetailsMap.get(getParameters().getActionType()).getActionFailedActionLog(), returnValue.getVdsError().getMessage()); } else { VDS vds = new VDS(); vds.setStatus(VDSStatus.Up); <START> Pair<VDS, VDSReturnValue> pairRetVal = new Pair<VDS, VDSReturnValue>(vds, returnValue); <END> updateService(serverId, serviceList, pairRetVal); } }</code><technical_language>Consider refactoring updateService serverId, List<GlusterServerService>. Do create a VDS here</technical_language>

Target:
private void performActionForServicesOfServer() { List<String> serviceList = getServiceList(); VDSReturnValue returnValue = null; returnValue = runVdsCommand(VDSCommandType.ManageGlusterService, new GlusterServiceVDSParameters(serverId, serviceList, actionType)); setSucceeded(returnValue.getSucceeded()); if (!getSucceeded()) { handleVdsError(manageActionDetailsMap.get(getParameters().getActionType()).getActionFailedActionLog(), returnValue.getVdsError().getMessage()); } else { updateService(serverId); } }
Source:
<code>public FakeRequest(final int status, @NotNull(message = "HTTP reason can't be NULL") final String reason, @NotNull(message = "list of headers can't be NULL") final Collection<Map.Entry<String, String>> headers, final Map<Pattern, byte[]> bodies) { this.code = status; this.phrase = reason; this.hdrs = new Array<Map.Entry<String, String>>(headers); <START> this.content = bodies; <END> }</code><technical_language>@dmzaytsev instead of assigning add map elements object's internal map, unmodifiable. do think</technical_language>

Target:
public FakeRequest(final int status, @NotNull(message = "HTTP reason can't be NULL") final String reason, @NotNull(message = "list of headers can't be NULL") final Collection<Map.Entry<String, String>> headers, final Map<Pattern, byte[]> bodies) { this.code = status; this.phrase = reason; this.hdrs = new Array<Map.Entry<String, String>>(headers); this.content = new ArrayMap<Pattern, byte[]>(bodies); }
Source:
<code>public Duration getFullGcTime() { long endFullGcTimeNanos = this.endFullGcTimeNanos.get(); <START> if (endFullGcTimeNanos == 0) { <END> endFullGcTimeNanos = gcMonitor.getMajorGcTime().roundTo(NANOSECONDS); } return new Duration(max(0, endFullGcTimeNanos - startFullGcTimeNanos.get()), NANOSECONDS); }</code><technical_language>0 is a good initial for endFullGcTimeNanos endFullGcCount</technical_language>

Target:
public Duration getFullGcTime() { long startFullGcTimeNanos = this.startFullGcTimeNanos.get(); if (startFullGcTimeNanos < 0) { return new Duration(0, MILLISECONDS); } long endFullGcTimeNanos = this.endFullGcTimeNanos.get(); if (endFullGcTimeNanos < 0) { endFullGcTimeNanos = gcMonitor.getMajorGcTime().roundTo(NANOSECONDS); } return new Duration(max(0, endFullGcTimeNanos - startFullGcTimeNanos), NANOSECONDS); }
Source:
<code>private void testSelectBeforeUpdate() { <START> rebuildSessionFactory( ); <END> TransactionUtil.doInHibernate( this::sessionFactory, session -> { final Person john = new Person( 1, "John", new Address() ); session.save( john ); final Person mary = new Person( 2, "Mary", null ); session.save( mary ); } ); TransactionUtil.doInHibernate( this::sessionFactory, session -> { final Person john = session.find( Person.class, 1 ); i.reset(); john.setAddress( null ); session.flush(); assertEquals( 0, i.getCalls() ); i.reset(); final Person mary = session.find( Person.class, 2 ); mary.setAddress( new Address() ); session.flush(); assertEquals( 0, i.getCalls() ); } ); final Person john = TransactionUtil.doInHibernate( this::sessionFactory, session -> { return session.get( Person.class, 1 ); } ); final Person mary = TransactionUtil.doInHibernate( this::sessionFactory, session -> { return session.get( Person.class, 2 ); } ); TransactionUtil.doInHibernate( this::sessionFactory, session -> { i.reset(); john.setAddress( null ); session.update( john ); session.flush(); assertEquals( 0, i.getCalls() ); i.reset(); mary.setAddress( new Address() ); session.update( mary ); session.flush(); assertEquals( 0, i.getCalls() ); } ); }</code><technical_language>I this line removed otherwise, rebuild SessionFactory explicit AvailableSettings.CREATE_EMPTY_COMPOSITES_ENABLED setting</technical_language>

Target:
private void testSelectBeforeUpdate() { TransactionUtil.doInHibernate( this::sessionFactory, session -> { final Person john = new Person( 1, "John", new Address() ); session.save( john ); final Person mary = new Person( 2, "Mary", null ); session.save( mary ); } ); TransactionUtil.doInHibernate( this::sessionFactory, session -> { final Person john = session.find( Person.class, 1 ); i.reset(); john.setAddress( null ); session.flush(); assertEquals( 0, i.getCalls() ); i.reset(); final Person mary = session.find( Person.class, 2 ); mary.setAddress( new Address() ); session.flush(); assertEquals( 0, i.getCalls() ); } ); final Person john = TransactionUtil.doInHibernate( this::sessionFactory, session -> { return session.get( Person.class, 1 ); } ); final Person mary = TransactionUtil.doInHibernate( this::sessionFactory, session -> { return session.get( Person.class, 2 ); } ); TransactionUtil.doInHibernate( this::sessionFactory, session -> { i.reset(); john.setAddress( null ); session.update( john ); session.flush(); assertEquals( 0, i.getCalls() ); i.reset(); mary.setAddress( new Address() ); session.update( mary ); session.flush(); assertEquals( 0, i.getCalls() ); } ); }
Source:
<code>protected Map<VmTemplate, List<DiskImage>> setUpTemplates(boolean notFound) { return IntStream.range(0, NAMES.length) <START> .filter(x -> !notFound).boxed().collect(Collectors.toMap(this::getEntity, <END> ArrayList::new)); }</code><technical_language>I it, iterate list instead of returning immediately if boolean is set false</technical_language>

Target:
protected Map<VmTemplate, List<DiskImage>> setUpTemplates(boolean notFound) { if (notFound) { return Collections.emptyMap(); } return IntStream.range(0, NAMES.length).boxed().collect(Collectors.toMap(this::getEntity, ArrayList::new)); }
Source:
<code>private void deleteProjectPreferences(ProjectDeletedEvent event) { <START> this.modelCache.invalidate(event.getProject().getName()); <END> deleteModel(event.getProject()); }</code><technical_language>This is done deleteModel()</technical_language>

Target:
private void deleteProjectPreferences(ProjectDeletedEvent event) { deleteModel(event.getProject()); }
Source:
<code>private void registerErrorsAndWarningsFromValidationReport(final HttpServletResponse resp, final Map<String, String> ret, final Map<String, ValidationReport> reports) { final StringBuffer errorMsgs = new StringBuffer(); final StringBuffer warnMsgs = new StringBuffer(); for (final Entry<String, ValidationReport> reportEntry : reports.entrySet()) { final ValidationReport report = reportEntry.getValue(); for (final String msg : report.getInfoMsgs()) { switch (ValidationReport.getInfoMsgLevel(msg)) { case ERROR: errorMsgs.append(ValidationReport.getInfoMsg(msg) + "<br/>"); break; case WARN: warnMsgs.append(ValidationReport.getInfoMsg(msg) + "<br/>"); break; default: break; } } if (!report.getErrorMsgs().isEmpty()) { errorMsgs.append("Validator " + reportEntry.getKey() + " reports errors:<ul>"); for (final String msg : report.getErrorMsgs()) { errorMsgs.append("<li>" + msg + "</li>"); } errorMsgs.append("</ul>"); } if (!report.getWarningMsgs().isEmpty()) { warnMsgs.append("Validator " + reportEntry.getKey() + " reports warnings:<ul>"); for (final String msg : report.getWarningMsgs()) { warnMsgs.append("<li>" + msg + "</li>"); } warnMsgs.append("</ul>"); } } if (errorMsgs.length() > 0) { registerError(ret, <START> errorMsgs.length() > 4000 ? errorMsgs.substring(0, 4000) : errorMsgs.toString(), resp, <END> 500); } if (warnMsgs.length() > 0) { ret.put("warn", warnMsgs.length() > 4000 ? warnMsgs.substring(0, 4000) : warnMsgs.toString()); } }</code><technical_language>Is a reason this is 4000 512? this consistent</technical_language>

Target:
private void registerErrorsAndWarningsFromValidationReport(final HttpServletResponse resp, final Map<String, String> ret, final Map<String, ValidationReport> reports) { final StringBuffer errorMsgs = new StringBuffer(); final StringBuffer warnMsgs = new StringBuffer(); for (final Entry<String, ValidationReport> reportEntry : reports.entrySet()) { final ValidationReport report = reportEntry.getValue(); for (final String msg : report.getInfoMsgs()) { switch (ValidationReport.getInfoMsgLevel(msg)) { case ERROR: errorMsgs.append(ValidationReport.getInfoMsg(msg) + "<br/>"); break; case WARN: warnMsgs.append(ValidationReport.getInfoMsg(msg) + "<br/>"); break; default: break; } } if (!report.getErrorMsgs().isEmpty()) { errorMsgs.append("Validator " + reportEntry.getKey() + " reports errors:<ul>"); for (final String msg : report.getErrorMsgs()) { errorMsgs.append("<li>" + msg + "</li>"); } errorMsgs.append("</ul>"); } if (!report.getWarningMsgs().isEmpty()) { warnMsgs.append("Validator " + reportEntry.getKey() + " reports warnings:<ul>"); for (final String msg : report.getWarningMsgs()) { warnMsgs.append("<li>" + msg + "</li>"); } warnMsgs.append("</ul>"); } } if (errorMsgs.length() > 0) { registerError(ret, errorMsgs.length() > 4000 ? errorMsgs.substring(0, 4000) : errorMsgs.toString(), resp, HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } if (warnMsgs.length() > 0) { ret.put("warn", warnMsgs.length() > 4000 ? warnMsgs.substring(0, 4000) : warnMsgs.toString()); } }
Source:
<code>public String getPrivateKeyAsHex(){ <START> return getPrivKey().toString(16); <END> }</code><technical_language>Mike spotted changing formatting of private keys "Utils.HEX.encode(getPrivKey().toByteArray())" "getPrivKey().toString(16)". reason? StackExchange I read .toString(16) is stripping leading zeros. personally prefer bytes intact</technical_language>

Target:
public String getPrivateKeyAsHex() { return Utils.HEX.encode(getPrivKeyBytes()); }
Source:
<code><START> public static void main(String[] args) throws FormatException, IOException, DependencyException, ServiceException { <END> int tileSizeX = Integer.parseInt(args[2]); int tileSizeY = Integer.parseInt(args[3]); SimpleTiledWriter tiledWriter = new SimpleTiledWriter(args[0], args[1], tileSizeX, tileSizeY); tiledWriter.readWriteTiles(); tiledWriter.cleanup(); }</code><technical_language>exception doc resources closed</technical_language>

Target:
public static void main(String[] args) throws FormatException, IOException, DependencyException, ServiceException { int tileSizeX = Integer.parseInt(args[2]); int tileSizeY = Integer.parseInt(args[3]); SimpleTiledWriter tiledWriter = new SimpleTiledWriter(args[0], args[1], tileSizeX, tileSizeY); tiledWriter.initialize(); try { tiledWriter.readWriteTiles(); } catch(Exception e) { System.err.println("Failed to read and write tiles."); e.printStackTrace(); throw e; } finally { tiledWriter.cleanup(); } }
Source:
<code><START> private synchronized int getUseSessionTimeoutMs() { <END> int lastNegotiatedSessionTimeoutMs = client.getZookeeperClient().getLastNegotiatedSessionTimeoutMs(); int useSessionTimeoutMs = (lastNegotiatedSessionTimeoutMs > 0) ? lastNegotiatedSessionTimeoutMs : sessionTimeoutMs; useSessionTimeoutMs = sessionExpirationPercent > 0 && startOfSuspendedEpoch != 0 ? (useSessionTimeoutMs * sessionExpirationPercent) / 100 : useSessionTimeoutMs; return useSessionTimeoutMs; }</code><technical_language>I volatile is cleaner. I read/increments need AtomicLong either</technical_language>

Target:
private int getUseSessionTimeoutMs() { int lastNegotiatedSessionTimeoutMs = client.getZookeeperClient().getLastNegotiatedSessionTimeoutMs(); int useSessionTimeoutMs = (lastNegotiatedSessionTimeoutMs > 0) ? lastNegotiatedSessionTimeoutMs : sessionTimeoutMs; useSessionTimeoutMs = sessionExpirationPercent > 0 && startOfSuspendedEpoch != 0 ? (useSessionTimeoutMs * sessionExpirationPercent) / 100 : useSessionTimeoutMs; return useSessionTimeoutMs; }
Source:
<code>public int compareOrder(NodeInfo other) { int result = 0; if (other != null) { result = getRootDepth(this) - getRootDepth(other); } if (result == 0 && other instanceof ElementNode) { result = indexAmongSiblings - ((ElementNode) other).indexAmongSiblings; <START> } <END> return result; }</code><technical_language>@gaurabdg interesting approach, store this depth object avoid unnecessary calculations</technical_language>

Target:
public int compareOrder(NodeInfo other) { int result = 0; if (other instanceof AbstractNode) { result = getDepth() - ((AbstractNode) other).getDepth(); if (result == 0) { final ElementNode[] children = getCommonAncestorChildren(other); result = children[0].indexAmongSiblings - children[1].indexAmongSiblings; } } return result; }
Source:
<code>void calculatePercentageFrequencyAndAverage() { percentageFrequencyAndAverage = <START> new float[numOfRubricSubQuestions][numOfRubricChoices + 1]; <END> for (int i = 0; i < percentageFrequencyAndAverage.length; i++) { int totalForSubQuestion = responseFrequency[i][responseTotalIndex]; if (totalForSubQuestion == 0) { continue; } for (int j = 0; j < numOfRubricChoices; j++) { percentageFrequencyAndAverage[i][j] = (float) responseFrequency[i][j] / totalForSubQuestion; } if (questionDetails.hasAssignedWeights) { for (int j = 0; j < numOfRubricChoices; j++) { float choiceWeight = (float) (questionDetails.rubricWeights.get(j) * percentageFrequencyAndAverage[i][j]); percentageFrequencyAndAverage[i][numOfRubricChoices] += choiceWeight; } } } }</code><technical_language>line if possible</technical_language>

Target:
void calculatePercentageFrequencyAndAverage() { Assumption.assertNotNull("Response Frequency should be initialised and calculated first.", responseFrequency); percentageFrequencyAndAverage = new float[numOfRubricSubQuestions][numOfRubricChoices + 1]; for (int i = 0; i < percentageFrequencyAndAverage.length; i++) { int totalForSubQuestion = responseFrequency[i][responseTotalIndex]; if (totalForSubQuestion == 0) { continue; } for (int j = 0; j < numOfRubricChoices; j++) { percentageFrequencyAndAverage[i][j] = (float) responseFrequency[i][j] / totalForSubQuestion; } if (questionDetails.hasAssignedWeights) { for (int j = 0; j < numOfRubricChoices; j++) { float choiceWeight = (float) (questionDetails.rubricWeights.get(j) * percentageFrequencyAndAverage[i][j]); percentageFrequencyAndAverage[i][numOfRubricChoices] += choiceWeight; } } } }
Source:
<code>private int getApproximateReadByteCount(Map<ByteBuffer, List<ColumnOrSuperColumn>> result) { return result.entrySet().stream() <START> .mapToInt((entry) -> entry.getKey().array().length + entry.getValue().stream() <END> .mapToInt(columnOrSuperColumn -> SerializationUtils.serialize(columnOrSuperColumn).length) .sum()) .sum(); }</code><technical_language>this is hard reason about. Perhaps: .mapToInt(entry -> getRowKeySize(entry) + getValueSize(entry)) noting briefly discussed verbally computational overhead of this is enough. so</technical_language>

Target:
private long getApproximateReadByteCount(Map<ByteBuffer, List<ColumnOrSuperColumn>> result) { return getCollectionSize(result.entrySet(), rowResult -> ThriftObjectSizeUtils.getByteBufferSize(rowResult.getKey()) + getCollectionSize(rowResult.getValue(), ThriftObjectSizeUtils::getColumnOrSuperColumnSize)); }
Source:
<code>private static String verifyXmlrpcUrl(final String siteUrl, final String httpUsername, final String httpPassword) throws XMLRPCUtilsException { final Set<String> urlsToTry = new LinkedHashSet<>(); final String sanitizedSiteUrlHttps = XMLRPCUtils.sanitizeSiteUrl(siteUrl, true); urlsToTry.add(XMLRPCUtils.appendXMLRPCPath(sanitizedSiteUrlHttps)); urlsToTry.add(sanitizedSiteUrlHttps); final String sanitizedSiteUrlHttp = XMLRPCUtils.sanitizeSiteUrl(siteUrl, false); urlsToTry.add(XMLRPCUtils.appendXMLRPCPath(sanitizedSiteUrlHttp)); urlsToTry.add(sanitizedSiteUrlHttp); urlsToTry.add(siteUrl); AppLog.i(AppLog.T.NUX, "The app will call system.listMethods on the following URLs: " + urlsToTry); for (String url : urlsToTry) { try { if (XMLRPCUtils.checkXMLRPCEndpointValidity(url, httpUsername, httpPassword)) { return url; } <START> } catch (XMLRPCUtilsException e) { <END> continue; } catch (RuntimeException re) { continue; } } return null; }</code><technical_language>this breaks support for hosted sites signed certificate</technical_language>

Target:
private static String verifyXmlrpcUrl(final String siteUrl, final String httpUsername, final String httpPassword) throws XMLRPCUtilsException { final Set<String> urlsToTry = new LinkedHashSet<>(); final String sanitizedSiteUrlHttps = XMLRPCUtils.sanitizeSiteUrl(siteUrl, true); final String sanitizedSiteUrlHttp = XMLRPCUtils.sanitizeSiteUrl(siteUrl, false); urlsToTry.add(XMLRPCUtils.appendXMLRPCPath(sanitizedSiteUrlHttp)); urlsToTry.add(XMLRPCUtils.appendXMLRPCPath(sanitizedSiteUrlHttps)); urlsToTry.add(sanitizedSiteUrlHttp); urlsToTry.add(sanitizedSiteUrlHttps); urlsToTry.add(siteUrl); AppLog.i(AppLog.T.NUX, "The app will call system.listMethods on the following URLs: " + urlsToTry); for (String url : urlsToTry) { try { if (XMLRPCUtils.checkXMLRPCEndpointValidity(url, httpUsername, httpPassword)) { return url; } } catch (XMLRPCUtilsException e) { if (e.kind == XMLRPCUtilsException.Kind.ERRONEOUS_SSL_CERTIFICATE || e.kind == XMLRPCUtilsException.Kind.HTTP_AUTH_REQUIRED || e.kind == XMLRPCUtilsException.Kind.MISSING_XMLRPC_METHOD) { throw e; } continue; } catch (RuntimeException re) { continue; } } return null; }
Source:
<code>public static Message parse(byte[] array) { String[] message = new String(array, UTF8).split("\n"); Message result = new Message(); Command parsedCommand = Command.valueOf(message[0]); result.setCommand(parsedCommand.toString()); Map<String, String> headers = new HashMap<>(); int i = 1; String currentLine = message[i]; while (currentLine.length() > 0) { int ind = currentLine.indexOf(':'); String key = currentLine.substring(0, ind); String value = currentLine.substring(ind + 1, currentLine.length()); headers.put(key, value); currentLine = message[++i]; } result.withHeaders(headers); <START> result.withContent(getContent(array, message, ++i)); <END> return result; }</code><technical_language>reason clever. Putting ++ operator mid operation is confusing</technical_language>

Target:
public static Message parse(byte[] array) { String[] message = new String(array, UTF8).split("\n"); Message result = new Message(); Command parsedCommand = Command.valueOf(message[0]); result.setCommand(parsedCommand.toString()); Map<String, String> headers = new HashMap<>(); int i = 1; String currentLine = message[i]; while (currentLine.length() > 0) { int ind = currentLine.indexOf(':'); String key = currentLine.substring(0, ind); String value = currentLine.substring(ind + 1, currentLine.length()); headers.put(key, value); currentLine = message[++i]; } result.withHeaders(headers); i = i + 1; result.withContent(getContent(array, message, i)); return result; }
Source:
<code>public AndroidDocumentProvider( Application application, List<DescriptorProvider> descriptorProviders, ThreadBound enforcer) { super(enforcer); mApplication = Util.throwIfNull(application); mDocumentRoot = new AndroidDocumentRoot(application); mDescriptorMap = new DescriptorMap() .beginInit() .register(Activity.class, new ActivityDescriptor()) .register(AndroidDocumentRoot.class, mDocumentRoot) .register(Application.class, new ApplicationDescriptor()) .register(Dialog.class, new DialogDescriptor()); DialogFragmentDescriptor.register(mDescriptorMap); FragmentDescriptor.register(mDescriptorMap) .register(Object.class, new ObjectDescriptor()) .register(TextView.class, new TextViewDescriptor()) .register(View.class, new ViewDescriptor()) .register(ViewGroup.class, new ViewGroupDescriptor()) .register(Window.class, new WindowDescriptor()); <START> for (DescriptorProvider descriptorProvider : descriptorProviders) { <END> descriptorProvider.register(mDescriptorMap); } mDescriptorMap.setHost(this) .endInit(); mHighlighter = ViewHighlighter.newInstance(); mInspectModeHandler = new InspectModeHandler(); }</code><technical_language>a List, avoid temporary Iterator allocation looping so: for (int i = 0, size = descriptorProviders.size(); i < size; ++i) { final DescriptorProvider descriptorProvider = descriptorProviders.get(i); ... }</technical_language>

Target:
public AndroidDocumentProvider( Application application, List<DescriptorProvider> descriptorProviders, ThreadBound enforcer) { super(enforcer); mApplication = Util.throwIfNull(application); mDocumentRoot = new AndroidDocumentRoot(application); mDescriptorMap = new DescriptorMap() .beginInit() .registerDescriptor(Activity.class, new ActivityDescriptor()) .registerDescriptor(AndroidDocumentRoot.class, mDocumentRoot) .registerDescriptor(Application.class, new ApplicationDescriptor()) .registerDescriptor(Dialog.class, new DialogDescriptor()) .registerDescriptor(Object.class, new ObjectDescriptor()) .registerDescriptor(TextView.class, new TextViewDescriptor()) .registerDescriptor(View.class, new ViewDescriptor()) .registerDescriptor(ViewGroup.class, new ViewGroupDescriptor()) .registerDescriptor(Window.class, new WindowDescriptor()); DialogFragmentDescriptor.register(mDescriptorMap); FragmentDescriptor.register(mDescriptorMap); for (int i = 0, size = descriptorProviders.size(); i < size; ++i) { final DescriptorProvider descriptorProvider = descriptorProviders.get(i); descriptorProvider.registerDescriptor(mDescriptorMap); } mDescriptorMap.setHost(this).endInit(); mHighlighter = ViewHighlighter.newInstance(); mInspectModeHandler = new InspectModeHandler(); }
Source:
<code>public void onPartitionBecomeLeaderFromStandby(String partitionName) { logger.info("Partition state change notification from Standby to Leader received for partition {}", partitionName); <START> if (!partitionsToReplicate.isEmpty() && !partitionsToReplicate.contains(partitionName)) { <END> logger.info("Ignoring state change of partition as it is not in recovery partition config", partitionName); return; } synchronized (notificationLock) { try { addCloudReplica(partitionName); } catch (ReplicationException rex) { logger.error("Exception while adding replication for partition {}", rex, partitionName); replicationMetrics.addCloudPartitionErrorCount.inc(); } } }</code><technical_language>do this multiple times, suggest utility like: boolean shouldReplicatePartition(String partitionName) check logging</technical_language>

Target:
public void onPartitionBecomeLeaderFromStandby(String partitionName) { logger.info("Partition state change notification from Standby to Leader received for partition {}", partitionName); if (shouldReplicatePartition(partitionName)) { synchronized (notificationLock) { try { addCloudReplica(partitionName); } catch (ReplicationException rex) { logger.error("Exception while adding replication for partition {}", rex, partitionName); replicationMetrics.addCloudPartitionErrorCount.inc(); } } } }
Source:
<code>public void test() { connect(); click(jq("$low")); waitResponse(); <START> Assert.assertTrue(getBarWidth() == 998); <END> click(jq("$reset")); waitResponse(); click(jq("$high")); waitResponse(); Assert.assertTrue(getBarWidth() >= 800); click(jq("$reset")); waitResponse(); click(jq("$veryhigh")); waitResponse(); Assert.assertTrue(getBarWidth() >= 800); }</code><technical_language>Hard-coded 998. zk.$('$prog').$n().clientWidth</technical_language>

Target:
public void test() { connect(); click(jq("$low")); waitResponse(); Assert.assertTrue(getBarWidth() == jq("$prog").width()); click(jq("$reset")); waitResponse(); click(jq("$high")); waitResponse(); Assert.assertTrue(getBarWidth() >= 800); click(jq("$reset")); waitResponse(); click(jq("$veryhigh")); waitResponse(); Assert.assertTrue(getBarWidth() >= 800); }
Source:
<code>private String getAggrTransactionList(Collection<?> collection, int columnIndex) { Object headCursor = collection; Object tailCursor = collection; String columnText = ""; while (headCursor instanceof List<?> && !((List<?>) headCursor).isEmpty()) { headCursor = ((List<?>) headCursor).get(0); } while (tailCursor instanceof List<?> && !((List<?>) tailCursor).isEmpty()) { List<?> list = (List<?>) tailCursor; tailCursor = list.get(list.size() - 1); } if (headCursor instanceof TransactionRecord && tailCursor instanceof TransactionRecord) { TransactionRecord headTransaction = (TransactionRecord) headCursor; TransactionRecord tailTransaction = (TransactionRecord) tailCursor; if (columnIndex == 0) { columnText = String.valueOf(headTransaction.getId() + "..." + tailTransaction.getId()); } else if (columnIndex == 1) { DateFormat DATE_FORMAT = <START> new SimpleDateFormat("MM/dd/yyyy <END> hh:mm a"); columnText = DATE_FORMAT.format(headTransaction.getTimeStamp()); } } else { columnText = "Unexpected aggregation of " + headCursor.getClass().getSimpleName() + " and " + tailCursor.getClass().getSimpleName(); } return columnText; }</code><technical_language>Instead of potentially instantiating DateFormat object multiple times, remove static keyword final class variable DATE_FORMAT previously line 47</technical_language>

Target:
private String getAggrTransactionList(Collection<?> collection, int columnIndex) { Object headCursor = collection; Object tailCursor = collection; String columnText = ""; while (headCursor instanceof List<?> && !((List<?>) headCursor).isEmpty()) { headCursor = ((List<?>) headCursor).get(0); } while (tailCursor instanceof List<?> && !((List<?>) tailCursor).isEmpty()) { List<?> list = (List<?>) tailCursor; tailCursor = list.get(list.size() - 1); } if (headCursor instanceof TransactionRecord && tailCursor instanceof TransactionRecord) { TransactionRecord headTransaction = (TransactionRecord) headCursor; TransactionRecord tailTransaction = (TransactionRecord) tailCursor; if (columnIndex == 0) { columnText = String.valueOf(headTransaction.getId() + "..." + tailTransaction.getId()); } else if (columnIndex == 1) { columnText = DATE_FORMAT.format(headTransaction.getTimeStamp()); } } else { columnText = "Unexpected aggregation of " + headCursor.getClass().getSimpleName() + " and " + tailCursor.getClass().getSimpleName(); } return columnText; }
Source:
<code>public void undepend(final String... jids) throws IOException { final List<String> args = new ArrayList<>(); args.add(this.jid); args.add("off"); for (final String jid : jids) { <START> args.add(jid); <END> } final String[] array = new String[args.size()]; args.toArray(array); this.client.call( LuaCommand.DEPENDS.toString(), array); }</code><technical_language>Collections.addAll</technical_language>

Target:
public void undepend(final String... jids) throws IOException { final List<String> args = new ArrayList<>(); args.add(this.jid); args.add("off"); Collections.addAll(args, jids); final String[] array = new String[args.size()]; args.toArray(array); this.client.call( LuaCommand.DEPENDS.toString(), array); }
Source:
<code>public void checkSystemNotExists() throws IOException, XmlPullParserException { final File baseDir = new File("src/test/files/structure/test-suite-folders-exist/system-not-exists"); when(fs.baseDir()).thenReturn(baseDir); final TestSuiteFoldersExistCheck check = new TestSuiteFoldersExistCheck(fs); final Iterable<ConnectorIssue> pomIssues = check.analyze(null); assertThat(Iterables.size(pomIssues), is(1)); <START> final ConnectorIssue first = Iterables.getFirst(pomIssues, null); <END> assertThat(first.ruleKey(), is("test-suite-folders-exists")); assertThat(first.message(), is("System test suite directory doesn't exist.")); }</code><technical_language>getOnlyElement()</technical_language>

Target:
public void checkSystemNotExists() throws IOException, XmlPullParserException { final File baseDir = new File("src/test/files/structure/test-suite-folders-exist/system-not-exists"); when(fs.baseDir()).thenReturn(baseDir); final TestSuiteFoldersExistCheck check = new TestSuiteFoldersExistCheck(fs); final Iterable<ConnectorIssue> pomIssues = check.analyze(null); assertThat(Iterables.size(pomIssues), is(1)); final ConnectorIssue first = Iterables.getOnlyElement(pomIssues, null); assertThat(first.ruleKey(), is("test-suite-folders-exists")); assertThat(first.message(), is("System test suite directory doesn't exist.")); }
Source:
<code>public void testRenameLimit() throws Exception { ObjectId aId = blob("foo\nbar\nbaz\nblarg\n"); ObjectId bId = blob("foo\nbar\nbaz\nblah\n"); DiffEntry a = DiffEntry.add(PATH_A, aId); DiffEntry b = DiffEntry.delete(PATH_Q, bId); ObjectId cId = blob("a\nb\nc\nd\n"); ObjectId dId = blob("a\nb\nc\n"); DiffEntry c = DiffEntry.add(PATH_B, cId); DiffEntry d = DiffEntry.delete(PATH_H, dId); rd.add(a); rd.add(b); rd.add(c); rd.add(d); rd.setRenameLimit(1); <START> assertTrue(rd.isOverRenameLimit()); <END> }</code><technical_language>test ask for compute here. return a,b,c,d unmodified exact renames</technical_language>

Target:
public void testRenameLimit() throws Exception { ObjectId aId = blob("foo\nbar\nbaz\nblarg\n"); ObjectId bId = blob("foo\nbar\nbaz\nblah\n"); DiffEntry a = DiffEntry.add(PATH_A, aId); DiffEntry b = DiffEntry.delete(PATH_B, bId); ObjectId cId = blob("a\nb\nc\nd\n"); ObjectId dId = blob("a\nb\nc\n"); DiffEntry c = DiffEntry.add(PATH_H, cId); DiffEntry d = DiffEntry.delete(PATH_Q, dId); rd.add(a); rd.add(b); rd.add(c); rd.add(d); rd.setRenameLimit(1); assertTrue(rd.isOverRenameLimit()); List<DiffEntry> entries = rd.compute(); assertEquals(4, entries.size()); assertSame(a, entries.get(0)); assertSame(b, entries.get(1)); assertSame(c, entries.get(2)); assertSame(d, entries.get(3)); }
Source:
<code>public static void main(String[] args) throws ExecutionException, InterruptedException { if (args.length < 2) { LOG.error("Required at least two arguments, only python file or python module is available."); System.exit(1); } final CommandLineParser<PythonDriverOptions> commandLineParser = new CommandLineParser<>( new PythonDriverOptionsParserFactory()); PythonDriverOptions pythonDriverOptions = null; try { pythonDriverOptions = commandLineParser.parse(args); } catch (Exception e) { LOG.error("Could not parse command line arguments {}.", args, e); commandLineParser.printHelp(PythonDriver.class.getSimpleName()); System.exit(1); } Configuration config = ExecutionEnvironment.getExecutionEnvironment().getConfiguration(); GatewayServer gatewayServer = PythonEnvUtils.startGatewayServer(); final List<String> commands = constructPythonCommands(pythonDriverOptions); try { String tmpDir = System.getProperty("java.io.tmpdir") + File.separator + "pyflink" + File.separator + UUID.randomUUID(); Process pythonProcess = PythonEnvUtils.launchPy4jPythonClient( gatewayServer, config, commands, pythonDriverOptions.getEntryPointScript().orElse(null), tmpDir); <START> setGatewayServer(gatewayServer); <END> int exitCode = pythonProcess.waitFor(); if (exitCode != 0) { throw new RuntimeException("Python process exits with code: " + exitCode); } } catch (Throwable e) { LOG.error("Run python process failed", e); throw new ProgramAbortException(); } finally { gatewayServer.shutdown(); setGatewayServer(null); } }</code><technical_language>is need set gatewayServer a static variable in PythonDriver. do think</technical_language>

Target:
public static void main(String[] args) throws ExecutionException, InterruptedException { if (args.length < 2) { LOG.error("Required at least two arguments, only python file or python module is available."); System.exit(1); } final CommandLineParser<PythonDriverOptions> commandLineParser = new CommandLineParser<>( new PythonDriverOptionsParserFactory()); PythonDriverOptions pythonDriverOptions = null; try { pythonDriverOptions = commandLineParser.parse(args); } catch (Exception e) { LOG.error("Could not parse command line arguments {}.", args, e); commandLineParser.printHelp(PythonDriver.class.getSimpleName()); System.exit(1); } Configuration config = ExecutionEnvironment.getExecutionEnvironment().getConfiguration(); GatewayServer gatewayServer = PythonEnvUtils.startGatewayServer(); PythonEnvUtils.setGatewayServer(gatewayServer); final List<String> commands = constructPythonCommands(pythonDriverOptions); try { String tmpDir = System.getProperty("java.io.tmpdir") + File.separator + "pyflink" + File.separator + UUID.randomUUID(); Process pythonProcess = PythonEnvUtils.launchPy4jPythonClient( gatewayServer, config, commands, pythonDriverOptions.getEntryPointScript().orElse(null), tmpDir); int exitCode = pythonProcess.waitFor(); if (exitCode != 0) { throw new RuntimeException("Python process exits with code: " + exitCode); } } catch (Throwable e) { LOG.error("Run python process failed", e); throw new ProgramAbortException(); } finally { PythonEnvUtils.setGatewayServer(null); gatewayServer.shutdown(); } }
Source:
<code>protected void handleGroupedCounterAspect(ITmfEvent event, ITmfStateSystemBuilder ss, CounterAspect aspect, int rootQuark) { String[] cpu = { "cpu" }; String[] thread = { "thread" }; boolean isCpu = Arrays.deepEquals(aspect.getGroupIds(), cpu); boolean isThread = Arrays.deepEquals(aspect.getGroupIds(), thread); if (isCpu || isThread) { <START> Integer id = isCpu ? TmfTraceUtils.resolveIntEventAspectOfClassForEvent(event.getTrace(), TmfCpuAspect.class, event) : KernelTidAspect.INSTANCE.resolve(event); <END> if (id != null) { int parentQuark = ss.getQuarkRelativeAndAdd(rootQuark, isCpu ? cpu[0] : thread[0]); int quark = ss.getQuarkRelativeAndAdd(parentQuark, Integer.toString(id)); quark = ss.getQuarkRelativeAndAdd(quark, aspect.getName()); Long resolve = aspect.resolve(event); ss.modifyAttribute(event.getTimestamp().toNanos(), resolve == null ? TmfStateValue.nullValue() : TmfStateValue.newValueLong(resolve), quark); } } }</code><technical_language>If groups aspects, resolve aspect, save "grouped", aspect1.getName(), aspect1.resolvedValue, aspect2.getName(), aspect2.resolvedValue -> counter code in base CounterStateProvider class</technical_language>

Target:
protected void handleGroupedCounterAspect(ITmfEvent event, ITmfStateSystemBuilder ss, CounterAspect aspect, int rootQuark) { String[] cpu = { "cpu" }; String[] thread = { "thread" }; boolean isCpu = Arrays.deepEquals(aspect.getGroupIds(), cpu); boolean isThread = Arrays.deepEquals(aspect.getGroupIds(), thread); if (isCpu || isThread) { Integer id = isCpu ? TmfTraceUtils.resolveIntEventAspectOfClassForEvent(event.getTrace(), TmfCpuAspect.class, event) : TmfTraceUtils.resolveIntEventAspectOfClassForEvent(event.getTrace(), LinuxTidAspect.class, event); if (id != null) { int parentQuark = ss.getQuarkRelativeAndAdd(rootQuark, isCpu ? cpu[0] : thread[0]); int quark = ss.getQuarkRelativeAndAdd(parentQuark, Integer.toString(id)); quark = ss.getQuarkRelativeAndAdd(quark, aspect.getName()); Long eventContent = aspect.resolve(event); ss.modifyAttribute(event.getTimestamp().toNanos(), eventContent, quark); } } }
Source:
<code>public VocabularyTreeNode get(String vocabularyName, boolean displayObsoleteEntries, char keySeparator, String orderingField) { if (treeModels == null) { treeModels = new HashMap<String, VocabularyTreeNode>(); } VocabularyTreeNode treeModel = treeModels.get(vocabularyName); if (treeModel != null) { return treeModel; } <START> DirectoryService directoryService = DirectoryHelper.getDirectoryService(); <END> try { Directory directory = Framework.getService(DirectoryService.class).getDirectory(vocabularyName); if (directory == null) { throw new DirectoryException(vocabularyName + " is not a registered directory"); } } catch (DirectoryException e) { throw new RuntimeException(e); } treeModel = new VocabularyTreeNode(0, "", "", "", vocabularyName, directoryService, displayObsoleteEntries, keySeparator, orderingField); treeModels.put(vocabularyName, treeModel); return treeModel; }</code><technical_language>add a dependency DirectoryHelper current code</technical_language>

Target:
public VocabularyTreeNode get(String vocabularyName, boolean displayObsoleteEntries, char keySeparator, String orderingField) { if (treeModels == null) { treeModels = new HashMap<String, VocabularyTreeNode>(); } VocabularyTreeNode treeModel = treeModels.get(vocabularyName); if (treeModel != null) { return treeModel; } DirectoryService directoryService = Framework.getService(DirectoryService.class); try { Directory directory = Framework.getService(DirectoryService.class).getDirectory(vocabularyName); if (directory == null) { throw new DirectoryException(vocabularyName + " is not a registered directory"); } } catch (DirectoryException e) { throw new RuntimeException(e); } treeModel = new VocabularyTreeNode(0, "", "", "", vocabularyName, directoryService, displayObsoleteEntries, keySeparator, orderingField); treeModels.put(vocabularyName, treeModel); return treeModel; }
Source:
<code>public void setLockStatePrefetchEnabled(boolean enabled) { checkActive(); IEvent event = null; synchronized (CDOViewImpl.this) { if (enabled != lockStatePrefetchEnabled) { lockStatePrefetchEnabled = enabled; if (enabled) { cdoLockStatePrefetcher = new CDOLockStatePrefetcher(CDOViewImpl.this); } <START> else if (cdoLockStatePrefetcher != null) <END> { cdoLockStatePrefetcher.dispose(); cdoLockStatePrefetcher = null; } event = new LockStatePrefetchEventImpl(enabled); } } fireEvent(event); }</code><technical_language>"else"</technical_language>

Target:
public void setLockStatePrefetchEnabled(boolean enabled) { checkActive(); IEvent event = null; synchronized (CDOViewImpl.this) { if (enabled != lockStatePrefetchEnabled) { lockStatePrefetchEnabled = enabled; if (enabled) { cdoLockStatePrefetcher = new CDOLockStatePrefetcher(); } else { cdoLockStatePrefetcher.dispose(); cdoLockStatePrefetcher = null; } event = new LockStatePrefetchEventImpl(enabled); } } fireEvent(event); }
Source:
<code>public E add(E element) { if (this.managedProvider != null) { this.managedProvider.add(element); } else { throw new IllegalStateException("ManagedProvider is not available"); } <START> return element; <END> }</code><technical_language>I prefer move this line in if branch, is more clear, "return element" is done if a managed provider is</technical_language>

Target:
public E add(E element) { if (this.managedProvider != null) { this.managedProvider.add(element); return element; } else { throw new IllegalStateException("ManagedProvider is not available"); } }
Source:
<code>public void testExecuteQueryComplete() throws InterruptedException { AsyncQuery queryObj = mock(AsyncQuery.class); String query = "/group?sort=commonName&fields%5Bgroup%5D=commonName,description"; String id = "edc4a871-dff2-4054-804e-d80075cf827d"; <START> UUID uuid = UUID.fromString("edc4a871-dff2-4054-804e-d80075cf827d"); <END> when(queryObj.getQuery()).thenReturn(query); when(queryObj.getId()).thenReturn(id); when(queryObj.getRequestId()).thenReturn(uuid); when(queryObj.getQueryType()).thenReturn(QueryType.JSONAPI_V1_0); when(queryObj.getAsyncAfterSeconds()).thenReturn(10); service.executeQuery(queryObj, testUser, NO_VERSION); verify(queryObj, times(1)).setStatus(QueryStatus.PROCESSING); verify(queryObj, times(1)).setStatus(QueryStatus.COMPLETE); }</code><technical_language>change this UUID.fromString(id)</technical_language>

Target:
public void testExecuteQueryComplete() throws InterruptedException { AsyncQuery queryObj = mock(AsyncQuery.class); String query = "/group?sort=commonName&fields%5Bgroup%5D=commonName,description"; String id = "edc4a871-dff2-4054-804e-d80075cf827d"; when(queryObj.getQuery()).thenReturn(query); when(queryObj.getId()).thenReturn(id); when(queryObj.getRequestId()).thenReturn(id); when(queryObj.getQueryType()).thenReturn(QueryType.JSONAPI_V1_0); when(queryObj.getAsyncAfterSeconds()).thenReturn(10); service.executeQuery(queryObj, testUser, NO_VERSION); verify(queryObj, times(1)).setStatus(QueryStatus.PROCESSING); verify(queryObj, times(1)).setStatus(QueryStatus.COMPLETE); }
Source:
<code><START> public static ReplicationFilter all() { <END> return new ReplicationFilter(ImmutableList.<String>of()); }</code><technical_language>nit: static non-static</technical_language>

Target:
public static ReplicationFilter all() { return new ReplicationFilter(Collections.<String> emptyList()); }