auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testUnmarshallTopLevelEventWithEdgesEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateMessageEventCatching emptyEvent = getCatchingIntermediateNodeById(diagram, EMPTY_WITH_INCOME_TOP_LEVEL_EVENT_ID, HAS_INCOME_EDGE, HAS_OUTGOING_EDGE); assertGeneralSet(emptyEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); <START> assertMessageEventExecutionSet(emptyEvent.getExecutionSet(), EMPTY_VALUE, CANCELLING, ""); <END> assertDataIOSet(emptyEvent.getDataIOSet(), EMPTY_VALUE); }</code><technical_language>suggestion assertMessageEventExecutionSet(emptyEvent.getExecutionSet(), EMPTY_VALUE, CANCELLING, EMPTY_VALUE);</technical_language>

Target:
public void testUnmarshallTopLevelEventWithEdgesEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateMessageEventCatching emptyEvent = getCatchingIntermediateNodeById(diagram, EMPTY_WITH_INCOME_TOP_LEVEL_EVENT_ID, HAS_INCOME_EDGE, HAS_OUTGOING_EDGE); assertGeneralSet(emptyEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertMessageEventExecutionSet(emptyEvent.getExecutionSet(), EMPTY_VALUE, CANCELLING, EMPTY_VALUE); assertDataIOSet(emptyEvent.getDataIOSet(), EMPTY_VALUE); }
Source:
<code>public ContentResolver getContentResolver() { <START> MockContentProvider mcp = new MockContentProvider(mContext) { <END> @Override public Bundle call(String method, String request, Bundle args) { return new Bundle(); } }; MockContentResolver mockContentResolver = new MockContentResolver(); mockContentResolver.addProvider(Settings.AUTHORITY, mcp); return mockContentResolver; }</code><technical_language>nit: I personally variable name mcp in production test code. does't sense reading code variable is beside declared. #Resolved</technical_language>

Target:
public ContentResolver getContentResolver() { MockContentProvider mockContentProvider = new MockContentProvider(mContext) { @Override public Bundle call(String method, String request, Bundle args) { return new Bundle(); } }; MockContentResolver mockContentResolver = new MockContentResolver(); mockContentResolver.addProvider(Settings.AUTHORITY, mockContentProvider); return mockContentResolver; }
Source:
<code>public void theResponseDataHasValues(final Map<String, String> settings) throws Throwable { final String correlationUid = settings.get(PlatformKeys.KEY_CORRELATION_UID); final short expectedNumberOfNotificationsSent = Short .parseShort(settings.get(PlatformKeys.KEY_NUMBER_OF_NOTIFICATIONS_SENT)); final String expectedMessageType = settings.get(PlatformKeys.KEY_MESSAGE_TYPE); <START> try { <END> this.assertResponseDataHasNotificationsAndMessageType(correlationUid, expectedNumberOfNotificationsSent, expectedMessageType); } catch (final AssertionError e) { Thread.sleep(500); this.assertResponseDataHasNotificationsAndMessageType(correlationUid, expectedNumberOfNotificationsSent, expectedMessageType); } }</code><technical_language>I suggest put logic retry retrieving asserting response data in method assertResponseDataHasNotificationsAndMessageType is called instead of here. This way, this class is understandable. method is called handle a failed assertion retry instead of calling method twice</technical_language>

Target:
public void theResponseDataHasValues(final Map<String, String> settings) throws Throwable { final String correlationUid = settings.get(PlatformKeys.KEY_CORRELATION_UID); final short expectedNumberOfNotificationsSent = Short .parseShort(settings.get(PlatformKeys.KEY_NUMBER_OF_NOTIFICATIONS_SENT)); final String expectedMessageType = settings.get(PlatformKeys.KEY_MESSAGE_TYPE); RetryableAssert.assertWithRetries(() -> ResponseDataSteps.this.assertResponseDataHasNotificationsAndMessageType( correlationUid, expectedNumberOfNotificationsSent, expectedMessageType), 3, 200, TimeUnit.MILLISECONDS); }
Source:
<code>public void testGetCommunicationSummaryStatisticsServiceNameMissingURI() throws StoreException { CompletionTime ct1 = new CompletionTime(); ct1.setOperation("op1"); ct1.setBusinessTransaction("testapp"); <START> ct1.getProperties().add(new Property("prop", "val")); <END> ct1.getProperties().add(new Property(Constants.PROP_SERVICE_NAME, "wildfly")); analytics.storeFragmentCompletionTimes(null, Arrays.asList(ct1)); Criteria criteria = new Criteria() .setStartTime(0) .setEndTime(100000) .setBusinessTransaction("testapp"); Collection<CommunicationSummaryStatistics> communicationSummaryStatisticsList = analytics.getCommunicationSummaryStatistics(null, criteria, false); Assert.assertEquals(1, communicationSummaryStatisticsList.size()); CommunicationSummaryStatistics communicationSummaryStatistics = communicationSummaryStatisticsList.iterator().next(); Assert.assertEquals("wildfly", communicationSummaryStatistics.getServiceName()); }</code><technical_language>This is tested</technical_language>

Target:
public void testGetCommunicationSummaryStatisticsServiceNameMissingURI() throws StoreException { CompletionTime ct1 = new CompletionTime(); ct1.setOperation("op1"); ct1.getProperties().add(new Property(Constants.PROP_SERVICE_NAME, "wildfly")); analytics.storeFragmentCompletionTimes(null, Arrays.asList(ct1)); Criteria criteria = new Criteria() .setStartTime(0) .setEndTime(100000); Collection<CommunicationSummaryStatistics> communicationSummaryStatisticsList = analytics.getCommunicationSummaryStatistics(null, criteria, false); Assert.assertEquals(1, communicationSummaryStatisticsList.size()); CommunicationSummaryStatistics communicationSummaryStatistics = communicationSummaryStatisticsList.iterator().next(); Assert.assertEquals("wildfly", communicationSummaryStatistics.getServiceName()); }
Source:
<code>public void remoteCallsElidedIfTalkingToLocalServer() throws IOException, InterruptedException { doAnswer(invocation -> { PingableLeader localPingableLeader = invocation.getArgumentAt(0, PingableLeader.class); availableServer.stubFor(LEADER_UUID_MAPPING.willReturn(aResponse() .withStatus(200) .withBody(("\"" + localPingableLeader.getUUID().toString() + "\"").getBytes()))); return null; }).when(environment).register(isA(PingableLeader.class)); when(config.leader()).thenReturn(Optional.of(ImmutableLeaderConfig.builder() .localServer(getUriForPort(availablePort)) .addLeaders(getUriForPort(availablePort)) .acceptorLogDir(temporaryFolder.newFolder()) .learnerLogDir(temporaryFolder.newFolder()) .quorumSize(1) .build())); TransactionManagers.LockAndTimestampServices lockAndTimestampServices = TransactionManagers.createLockAndTimestampServices( config, environment, LockServiceImpl::create, InMemoryTimestampService::new, invalidator, USER_AGENT); availableServer.verify(getRequestedFor(urlMatching(LEADER_UUID_PATH))); <START> lockAndTimestampServices.timestamp().getFreshTimestamp(); <END> lockAndTimestampServices.lock().currentTimeMillis(); availableServer.verify(0, postRequestedFor(urlMatching(TIMESTAMP_PATH)) .withHeader(USER_AGENT_HEADER, WireMock.equalTo(USER_AGENT))); availableServer.verify(0, postRequestedFor(urlMatching(LOCK_PATH)) .withHeader(USER_AGENT_HEADER, WireMock.equalTo(USER_AGENT))); }</code><technical_language>(as above, fine timelock())</technical_language>

Target:
public void remoteCallsElidedIfTalkingToLocalServer() throws IOException, InterruptedException { doAnswer(invocation -> { PingableLeader localPingableLeader = invocation.getArgumentAt(0, PingableLeader.class); availableServer.stubFor(LEADER_UUID_MAPPING.willReturn(aResponse() .withStatus(200) .withBody(("\"" + localPingableLeader.getUUID().toString() + "\"").getBytes()))); return null; }).when(environment).register(isA(PingableLeader.class)); when(config.leader()).thenReturn(Optional.of(ImmutableLeaderConfig.builder() .localServer(getUriForPort(availablePort)) .addLeaders(getUriForPort(availablePort)) .acceptorLogDir(temporaryFolder.newFolder()) .learnerLogDir(temporaryFolder.newFolder()) .quorumSize(1) .build())); TransactionManagers.LockAndTimestampServices lockAndTimestampServices = TransactionManagers.createLockAndTimestampServices( config, environment, LockServiceImpl::create, InMemoryTimestampService::new, invalidator, USER_AGENT); availableServer.verify(getRequestedFor(urlMatching(LEADER_UUID_PATH))); lockAndTimestampServices.timelock().getFreshTimestamp(); lockAndTimestampServices.lock().currentTimeMillis(); availableServer.verify(0, postRequestedFor(urlMatching(TIMESTAMP_PATH)) .withHeader(USER_AGENT_HEADER, WireMock.equalTo(USER_AGENT))); availableServer.verify(0, postRequestedFor(urlMatching(LOCK_PATH)) .withHeader(USER_AGENT_HEADER, WireMock.equalTo(USER_AGENT))); }
Source:
<code>public JsonElement serialize(JsonSerializationContext context) { JsonObject serialized = context.serialize(comment).getAsJsonObject(); serialized.remove("userProfileID"); Long userProfileID = comment.getUserProfileID(); <START> serialized.add("userProfileID", context.serialize(userProfileID != null ? String.valueOf(userProfileID) : null)); <END> serialized.remove("articleID"); normalizeField(serialized, "title"); normalizeField(serialized, "body"); normalizeField(serialized, "highlightedText"); serialized.remove("competingInterestBody"); serialized.add("competingInterestStatement", context.serialize(competingInterestStatement)); serialized.add("parentArticle", context.serialize(parentArticle)); serialized.add("replyTreeSize", context.serialize(replyTreeSize)); serialized.add("mostRecentActivity", context.serialize(mostRecentActivity)); serialized.add("replies", context.serialize(replies)); return serialized; }</code><technical_language><LINK_0> , good rename here</technical_language>

Target:
public JsonElement serialize(JsonSerializationContext context) { JsonObject serialized = context.serialize(comment).getAsJsonObject(); serialized.remove("userProfileID"); Long userProfileID = comment.getUserProfileID(); if (userProfileID == null) { throw new NullPointerException(); } HashMap<String, Object> creator = new HashMap<>(); creator.put("userId", String.valueOf(userProfileID)); serialized.add("creator", context.serialize(creator)); serialized.remove("articleID"); normalizeField(serialized, "title"); normalizeField(serialized, "body"); normalizeField(serialized, "highlightedText"); serialized.remove("competingInterestBody"); serialized.add("competingInterestStatement", context.serialize(competingInterestStatement)); serialized.add("parentArticle", context.serialize(parentArticle)); serialized.add("replyTreeSize", context.serialize(replyTreeSize)); serialized.add("mostRecentActivity", context.serialize(mostRecentActivity)); serialized.add("replies", context.serialize(replies)); return serialized; }
Source:
<code>public boolean doesCurrentUserHaveAccessToAllOfDevelopersListings(Long developerId, List<CertificationStatusType> listingStatuses) { List<CertifiedProductDetailsDTO> cpDtos = certifiedProductDAO.findByDeveloperId(developerId); for (CertifiedProductDetailsDTO cpDto : cpDtos) { if (isInStatuses(cpDto.getCertificationStatusName(), listingStatuses) <START> && !isAcbValidForCurrentUser(cpDto.getCertificationBodyId())) { <END> return false; } } return true; }</code><technical_language>I if this entire construction switched a stream style a lot "private isInStatuses method below. necessary, simplify logic</technical_language>

Target:
public boolean doesCurrentUserHaveAccessToAllOfDevelopersListings(Long developerId, List<CertificationStatusType> listingStatuses) { List<CertifiedProductDetailsDTO> cpDtos = certifiedProductDAO.findByDeveloperId(developerId); return !cpDtos.stream().filter(cpDto -> !isAcbValidForCurrentUser(cpDto.getCertificationBodyId()) && isInStatuses(cpDto.getCertificationStatusName(), listingStatuses)).findAny().isPresent(); }
Source:
<code>protected List<ExecutionErrorInfo> findErrorsToAck(EntityManager em) { List<ExecutionErrorInfo> errorsToAck = new ArrayList<>(); em.getTransaction().begin(); try { String findJobErrorsQuery = "select error from ExecutionErrorInfo error " + "where error.type = :type " + "and error.acknowledged =:acknowledged " + "and error.jobId in (select req.id from RequestInfo req where status in (:status))"; <START> errorsToAck = em.createQuery(findJobErrorsQuery) <END> .setParameter("type", JobExecutionErrorFilter.TYPE) .setParameter("acknowledged", new Short("0")) .setParameter("status", Arrays.asList(STATUS.DONE, STATUS.CANCELLED, STATUS.QUEUED)) .getResultList(); em.getTransaction().commit(); } catch (Exception e) { logger.error("Execution error in command ProcessAutoAckErrorCommand", e); em.getTransaction().rollback(); } return errorsToAck; }</code><technical_language>suggestion errorsToAck = em.createQuery(findJobErrorsQuery, ExecutionErrorInfo.class)</technical_language>

Target:
protected List<ExecutionErrorInfo> findErrorsToAck(EntityManager em) { List<ExecutionErrorInfo> errorsToAck = new ArrayList<>(); TransactionManager txm = TransactionManagerFactory.get().newTransactionManager(); boolean txOwner = txm.begin(); try { String findJobErrorsQuery = "select error from ExecutionErrorInfo error " + "where error.type = :type " + "and error.acknowledged =:acknowledged " + "and error.jobId in (select req.id from RequestInfo req where status in (:status))"; errorsToAck = em.createQuery(findJobErrorsQuery, ExecutionErrorInfo.class) .setParameter("type", JobExecutionErrorFilter.TYPE) .setParameter("acknowledged", new Short("0")) .setParameter("status", Arrays.asList(STATUS.DONE, STATUS.CANCELLED, STATUS.QUEUED)) .getResultList(); txm.commit(txOwner); } catch (Exception e) { logger.error("Execution error in command ProcessAutoAckErrorCommand", e); txm.rollback(txOwner); } return errorsToAck; }
Source:
<code>public S checkOut(ServiceEndPoint endPoint) throws Exception { checkNotNull(endPoint); _requestCount.incrementAndGet(); <START> long currentRevision = _revisionNumber.get(); <END> try { S service = _pool.borrowObject(endPoint); ServiceEndPointInstancePair pair = new ServiceEndPointInstancePair(endPoint, service); _checkOutCounts.add(pair); _checkOutRevisions.putIfAbsent(pair, currentRevision); return service; } catch (NoSuchElementException e) { _missCount.incrementAndGet(); throw new NoCachedInstancesAvailableException(); } }</code><technical_language>comfortable changed meaning of _revisionNumber. is this safe</technical_language>

Target:
public ServiceHandle<S> checkOut(ServiceEndPoint endPoint) throws Exception { checkNotNull(endPoint); _requestCount.incrementAndGet(); try { long revision = _revisionNumber.incrementAndGet(); S service = _pool.borrowObject(endPoint); ServiceHandle<S> handle = new ServiceHandle<S>(service, endPoint); _checkedOutRevisions.put(handle, revision); return handle; } catch (NoSuchElementException e) { _missCount.incrementAndGet(); throw new NoCachedInstancesAvailableException(); } }
Source:
<code>public void onResume() { <START> BottomBar.hideBottomBar(getActivity()); <END> super.onResume(); adapter.notifyDataSetChanged(); }</code><technical_language>Nice catch, instead of hiding bottom bar remove altogether, is in backpack anyway</technical_language>

Target:
public void onResume() { super.onResume(); adapter.notifyDataSetChanged(); }
Source:
<code>protected void addSearchFilter(final ActiveFilterItem filter, final ColumnFilter columnFilter) { <START> ((CoreFunctionFilter)columnFilter).setLabelValue(filter.getLabelValue()); <END> basicFilterAddEvent.fire(new BasicFilterAddEvent(getDataSetId(), filter, columnFilter)); }</code><technical_language>unchecked cast, in class a checked cast. necessary too</technical_language>

Target:
protected void addSearchFilter(final ActiveFilterItem filter, final ColumnFilter columnFilter) { if (columnFilter instanceof CoreFunctionFilter) { ((CoreFunctionFilter) columnFilter).setLabelValue(filter.getLabelValue()); } basicFilterAddEvent.fire(new BasicFilterAddEvent(getDataSetId(), filter, columnFilter)); }
Source:
<code><START> public void addHeaderLineTo(@Nonnull VCFHeader header) { <END> }</code><technical_language>This method is implementation of interface method. method removed interface</technical_language>

Target:
public void addHeaderLineTo(@Nonnull VCFHeader header) { throw new UnsupportedOperationException("github/gatk-protected issue #855"); }
Source:
<code>public void priceMoneyness() { double expiry = OPTION_ERU2.getExpirationTime(); EuropeanVanillaOption option = new EuropeanVanillaOption(STRIKE, expiry, IS_CALL); double priceFuture = METHOD_FUTURES.price(ERU2, MULTICURVES); <START> double volatility = NORMAL_PARAMETERS_MONEYNESS.getZValue(expiry, STRIKE); <END> NormalFunctionData dataNormal = new NormalFunctionData(priceFuture, 1.0, volatility); double priceExpected = NORMAL_FUNCTION.getPriceFunction(option).evaluate(dataNormal); double priceComputed = METHOD_SECURITY_OPTION_NORMAL.price(OPTION_ERU2, NORMAL_MULTICURVES_MONEYNESS); assertEquals("Future option with volatilities: option security price", priceExpected, priceComputed, TOLERANCE_PRICE); }</code><technical_language>Passing STRIKE instead of moneyness. test pass smile is extrapolated flat points in dataset (only 0.99 0.995 strikes). number of strikes in volatility surface increased cover strike of option tested. volatilities in surface (to avoid volatility request returning number)</technical_language>

Target:
public void priceMoneyness() { double expiry = OPTION_ERU2.getExpirationTime(); EuropeanVanillaOption option = new EuropeanVanillaOption(STRIKE, expiry, IS_CALL); double priceFuture = METHOD_FUTURES.price(ERU2, MULTICURVES); double volatility = NORMAL_PARAMETERS_MONEYNESS.getZValue(expiry, priceFuture - STRIKE); NormalFunctionData dataNormal = new NormalFunctionData(priceFuture, 1.0, volatility); double priceExpected = NORMAL_FUNCTION.getPriceFunction(option).evaluate(dataNormal); double priceComputed = METHOD_SECURITY_OPTION_NORMAL.price(OPTION_ERU2, NORMAL_MULTICURVES_MONEYNESS); assertEquals("Future option with volatilities: option security price", priceExpected, priceComputed, TOLERANCE_PRICE); }
Source:
<code>public void shouldBeCaseInSensitiveOfColumnAndPropertyNames() throws Exception { when(resultSetMetaData.getColumnCount()).thenReturn(1); when(resultSetMetaData.getColumnLabel(1)).thenReturn("LoNgfielD"); Long aLongVal = 100L; when(resultSet.getLong(1)).thenReturn(aLongVal); when(resultSet.wasNull()).thenReturn(false); SampleBean sampleBean = mapper.map(resultSet, ctx); <START> assertThat(sampleBean.getLongField()).isNotNull(); <END> }</code><technical_language>isEqualTo(aLongVal)</technical_language>

Target:
public void shouldBeCaseInSensitiveOfColumnAndPropertyNames() throws Exception { when(resultSetMetaData.getColumnCount()).thenReturn(1); when(resultSetMetaData.getColumnLabel(1)).thenReturn("LoNgfielD"); Long aLongVal = 100L; when(resultSet.getLong(1)).thenReturn(aLongVal); when(resultSet.wasNull()).thenReturn(false); SampleBean sampleBean = mapper.map(resultSet, ctx); assertThat(sampleBean.getLongField()).isEqualTo(aLongVal); }
Source:
<code><START> private void commitDelete(AsyncFileEntry entry, boolean success) { <END> LOGGER.debug("commitDelete({},{}): Starting...", entry.getName(), success); if (success) { entry.getParent().ifPresent(e -> e.removeChild(entry)); entry.destroy(); } removeFromProcessors(entry); }</code><technical_language>listener null here</technical_language>

Target:
private void commitDelete(AsyncFileEntry entry, boolean success) { LOGGER.debug("commitDelete({},{}): Starting...", entry.getName(), success); if (success) { entry.getParent().ifPresent(e -> e.removeChild(entry)); entry.destroy(); } onFinish(); }
Source:
<code>public void httpHeadersAreSetProperly() { onRequest() .havingMethodEqualTo("GET") .havingHeader(HEADER_NAME, hasItem(HEADER_VALUE)) .havingPathEqualTo(Warehouses.URI) .respond() .withBody(readFromResource("/warehouse/warehouses.json")) .withStatus(200); final GoodDataSettings settings = new GoodDataSettings(); settings.setHttpHeader(HEADER_NAME, HEADER_VALUE); final GoodData goodData = new GoodData("localhost", LOGIN, PASS, port(), "http", settings){ @Override protected HttpClient createHttpClient(final String login, final String password, final String hostname, final int port, final String protocol, final HttpClientBuilder builder) { return builder.build(); } }; <START> goodData.getWarehouseService().listWarehouses(); <END> }</code><technical_language>some assert</technical_language>

Target:
public void httpHeadersAreSetProperly() { onRequest() .havingMethodEqualTo("GET") .havingHeader(HEADER_NAME, hasItem(HEADER_VALUE)) .havingPathEqualTo(Warehouses.URI) .respond() .withBody(readFromResource("/warehouse/warehouses.json")) .withStatus(200); final GoodDataSettings settings = new GoodDataSettings(); settings.setHttpHeader(HEADER_NAME, HEADER_VALUE); final GoodData goodData = new GoodData("localhost", LOGIN, PASS, port(), "http", settings){ @Override protected HttpClient createHttpClient(final String login, final String password, final String hostname, final int port, final String protocol, final HttpClientBuilder builder) { return builder.build(); } }; final PageableList<Warehouse> warehouses = goodData.getWarehouseService().listWarehouses(); assertTrue(warehouses.size() > 0); }
Source:
<code>private ObjectId insertMergeResult(MergeResult<RawText> result) throws IOException { TemporaryBuffer.LocalFile buf = new TemporaryBuffer.LocalFile( <START> nonNullRepo().getDirectory(), 10 << 20); <END> try { new MergeFormatter().formatMerge(buf, result, Arrays.asList(commitNames), CHARACTER_ENCODING); buf.close(); try (InputStream in = buf.openInputStream()) { return getObjectInserter().insert(OBJ_BLOB, buf.length(), in); } } finally { buf.destroy(); } }</code><technical_language>this assertion hold? caller is updateIndex, wants index. caller of updateIndex is processEntry. processEntry is called mergeTreeWalk, is called mergeTrees. I preventing this code triggering in no-repo case</technical_language>

Target:
private ObjectId insertMergeResult(MergeResult<RawText> result) throws IOException { File dir; if (db != null) { dir = nonNullRepo().getWorkTree(); } else { dir = null; } TemporaryBuffer.LocalFile buf = new TemporaryBuffer.LocalFile( dir, 10 << 20); try { new MergeFormatter().formatMerge(buf, result, Arrays.asList(commitNames), CHARACTER_ENCODING); buf.close(); try (InputStream in = buf.openInputStream()) { return getObjectInserter().insert(OBJ_BLOB, buf.length(), in); } } finally { buf.destroy(); } }
Source:
<code>protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { final VelocityEngine engine = new VelocityEngine(); engine.setProperty("runtime.log.logsystem.class", "org.apache.velocity.runtime.log.NullLogChute"); try { engine.init(); } catch (Exception e) { log.log(Level.SEVERE, "Could not initialize velocity", e); } Template t = null; try { t = engine.getTemplate("CurrentUser.vm"); } catch (Exception e) { log.log(Level.SEVERE, "Could not get the template `CurrentUser`", e); return; } final VelocityContext context = new VelocityContext(); final UserDao uDao = new UserDao(); final com.google.appengine.api.users.User currentGoogleUser = UserServiceFactory .getUserService().getCurrentUser(); <START> if (currentGoogleUser == null) { <END> return; } final String currentUserEmail = currentGoogleUser.getEmail().toLowerCase(); final User currentUser = uDao.findUserByEmail(currentUserEmail); context.put("user", currentUser); context.put("permissions", getPermissionsMap(currentUser)); final StringWriter writer = new StringWriter(); t.merge(context, writer); resp.setContentType("application/javascript;charset=UTF-8"); final PrintWriter pw = resp.getWriter(); pw.println(writer.toString()); pw.close(); }</code><technical_language>If return is point preparing a template use. I propose move this check do in method</technical_language>

Target:
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { final com.google.appengine.api.users.User currentGoogleUser = UserServiceFactory .getUserService().getCurrentUser(); if (currentGoogleUser == null) { return; } final VelocityEngine engine = new VelocityEngine(); engine.setProperty("runtime.log.logsystem.class", "org.apache.velocity.runtime.log.NullLogChute"); try { engine.init(); } catch (Exception e) { log.log(Level.SEVERE, "Could not initialize velocity", e); } Template t = null; try { t = engine.getTemplate("CurrentUser.vm"); } catch (Exception e) { log.log(Level.SEVERE, "Could not get the template `CurrentUser`", e); return; } final VelocityContext context = new VelocityContext(); final UserDao uDao = new UserDao(); final String currentUserEmail = currentGoogleUser.getEmail().toLowerCase(); final User currentUser = uDao.findUserByEmail(currentUserEmail); context.put("user", currentUser); context.put("permissions", getPermissionsMap(currentUser)); final StringWriter writer = new StringWriter(); t.merge(context, writer); resp.setContentType("application/javascript;charset=UTF-8"); final PrintWriter pw = resp.getWriter(); pw.println(writer.toString()); pw.close(); }
Source:
<code>private OVirtNodeInfo() { <START> final String delimiter = ":"; <END> final String[] path = Config.resolveOVirtISOsRepositoryPath().split(delimiter); final String minimumVersion[] = Config.<String> GetValue(ConfigValues.OvirtInitialSupportedIsoVersion).split(delimiter); final String regexISO[] = Config.<String> GetValue(ConfigValues.OvirtIsoPrefix).split(delimiter); final String regexNode[] = Config.<String> GetValue(ConfigValues.OvirtNodeOS).split(delimiter); info = new LinkedList<Entry>(); log.debugFormat("NodeInfo: regexISO length {0} minimum length {1} path length {2} regexNode {3}", regexISO.length, minimumVersion.length, path.length, regexNode.length); if (regexISO.length != minimumVersion.length || regexISO.length != path.length || regexISO.length != regexNode.length) { throw new IllegalArgumentException("Illegal NodeInfo - length"); } for (int i=0; i < regexISO.length; i++) { log.debugFormat("NodeInfo: regexISO {0} path {1}, minimumVersion {2} regexNode {3}", regexISO[i], path[i], minimumVersion[i], regexNode[i]); Entry entry = new Entry(); entry.isoPattern = Pattern.compile(regexISO[i]); entry.osPattern = Pattern.compile(regexNode[i], Pattern.CASE_INSENSITIVE); entry.path = new File(path[i]); entry.minimumVersion = minimumVersion[i]; info.add(entry); } }</code><technical_language>Hi, for noticing before, out of curiosity - ":" delimiter "," ? In addition, move delimeter a private static final field</technical_language>

Target:
private OVirtNodeInfo() { final String[] path = Config.resolveOVirtISOsRepositoryPath().split(delimiter); final String minimumVersion[] = Config.<String> getValue(ConfigValues.OvirtInitialSupportedIsoVersion).split(delimiter); final String regexISO[] = Config.<String> getValue(ConfigValues.OvirtIsoPrefix).split(delimiter); final String regexNode[] = Config.<String> getValue(ConfigValues.OvirtNodeOS).split(delimiter); info = new LinkedList<Entry>(); log.debugFormat("NodeInfo: regexISO length {0} minimum length {1} path length {2} regexNode {3}", regexISO.length, minimumVersion.length, path.length, regexNode.length); if (regexISO.length != minimumVersion.length || regexISO.length != path.length || regexISO.length != regexNode.length) { throw new IllegalArgumentException("Illegal NodeInfo - length"); } for (int i=0; i < regexISO.length; i++) { log.debugFormat("NodeInfo: regexISO {0} path {1}, minimumVersion {2} regexNode {3}", regexISO[i], path[i], minimumVersion[i], regexNode[i]); Entry entry = new Entry(); entry.isoPattern = Pattern.compile(regexISO[i]); entry.osPattern = Pattern.compile(regexNode[i], Pattern.CASE_INSENSITIVE); entry.path = new File(path[i]); entry.minimumVersion = minimumVersion[i]; info.add(entry); } }
Source:
<code>private static void adjustChainingStrategy(StreamNode node) { StreamOperatorFactory<?> operatorFactory = node.getOperatorFactory(); ChainingStrategy currentChainingStrategy = operatorFactory.getChainingStrategy(); switch (currentChainingStrategy) { case ALWAYS: case HEAD_WITH_SOURCES: LOG.debug( <START> "Setting chaining strategy for an operator {}, because of the BATCH execution mode.", <END> node); operatorFactory.setChainingStrategy(ChainingStrategy.HEAD); break; case NEVER: case HEAD: break; } }</code><technical_language>"Setting chaining strategy HEAD for operator {}, of BATCH execution mode."</technical_language>

Target:
private static void adjustChainingStrategy(StreamNode node) { StreamOperatorFactory<?> operatorFactory = node.getOperatorFactory(); ChainingStrategy currentChainingStrategy = operatorFactory.getChainingStrategy(); switch (currentChainingStrategy) { case ALWAYS: case HEAD_WITH_SOURCES: LOG.debug( "Setting chaining strategy to HEAD for operator {}, because of the BATCH execution mode.", node); operatorFactory.setChainingStrategy(ChainingStrategy.HEAD); break; case NEVER: case HEAD: break; } }
Source:
<code><START> public void addSlf4jLogMessageConsumer( <END> BiConsumer<String, Slf4jLogMessageContext> slf4jLogMessageConsumer) { addLogMessageConsumer(logMessage -> { slf4jLogMessageConsumer.accept(logMessage, parseSlf4jContextFromLogMessage(logMessage)); }); }</code><technical_language>I find useful return instance methods, chain</technical_language>

Target:
public void addSlf4jLogMessageConsumer(BiConsumer<String, Slf4jLogMessageContext> slf4jLogMessageConsumer) { checkNotNull(slf4jLogMessageConsumer, "slf4jLogMessageConsumer parameter is NULL!"); addLogMessageConsumer(logMessage -> { slf4jLogMessageConsumer.accept(logMessage, parseSlf4jContextFromLogMessage(logMessage)); }); }
Source:
<code>public void visitSpec(SpecInfo spec) { Unroll unroll = spec.getAnnotation(Unroll.class); boolean unrollSpec = unroll != null; boolean rollupSpec = spec.getAnnotation(Rollup.class) != null; if (unrollSpec && rollupSpec) { throw new InvalidSpecException("@Unroll and @Rollup must not be used on the same spec: " + spec.getName()); } boolean doUnrollSpec; String specUnrollPattern; if (unrollSpec) { doUnrollSpec = true; specUnrollPattern = unroll.value(); } else if (rollupSpec) { doUnrollSpec = false; specUnrollPattern = ""; } else { doUnrollSpec = unrollConfiguration.enabledByDefault; specUnrollPattern = ""; } <START> spec <END> .getFeatures() .stream() .filter(FeatureInfo::isParameterized) .forEach(feature -> visitFeature(feature, doUnrollSpec, specUnrollPattern)); }</code><technical_language>add a Spec checks inheritance works expected? expected results in scenarios Root @Unroll Base extends Root A extends Base @Rollup B extends A C extends B @Unroll D extends C other Root @Rollup Base extends Root A extends Base @Unroll B extends A C extends B @Rollup D extends C</technical_language>

Target:
public void visitSpec(SpecInfo spec) { Unroll unroll = spec.getAnnotation(Unroll.class); boolean unrollSpec = unroll != null; boolean rollupSpec = spec.getAnnotation(Rollup.class) != null; if (unrollSpec && rollupSpec) { throw new InvalidSpecException("@Unroll and @Rollup must not be used on the same spec: " + spec.getName()); } boolean doUnrollSpec; String specUnrollPattern; if (unrollSpec) { doUnrollSpec = true; specUnrollPattern = unroll.value(); } else if (rollupSpec) { doUnrollSpec = false; specUnrollPattern = ""; } else { doUnrollSpec = unrollConfiguration.unrollByDefault; specUnrollPattern = ""; } spec .getFeatures() .stream() .filter(FeatureInfo::isParameterized) .forEach(feature -> visitFeature(feature, doUnrollSpec, specUnrollPattern)); SpecInfo superSpec = spec.getSuperSpec(); if (superSpec != null) { visitSpec(superSpec); } }
Source:
<code>public static long hashCode(@SqlType(GEOMETRY_TYPE_NAME) Slice slice) { <START> if (slice == null) { <END> return 0; } return deserialize(slice).hashCode(); }</code><technical_language>need for explicit null check</technical_language>

Target:
public static long hashCode(@SqlType(GEOMETRY_TYPE_NAME) Slice slice) { return XxHash64.hash(deserialize(slice).hashCode()); }
Source:
<code>private Set<Integer> getAvailableCameraLensFacing() { Set<Integer> available = new LinkedHashSet<>(Arrays.asList(LensFacingConverter.values())); <START> if (mLifecycleOwner != null) { <END> if (!hasCameraWithLensFacing(CameraSelector.LENS_FACING_BACK)) { available.remove(CameraSelector.LENS_FACING_BACK); } if (!hasCameraWithLensFacing(CameraSelector.LENS_FACING_FRONT)) { available.remove(CameraSelector.LENS_FACING_FRONT); } } return available; }</code><technical_language>do need check mLifecycleOwner ? This unrelated getAvailableCameraLensFacing</technical_language>

Target:
private Set<Integer> getAvailableCameraLensFacing() { Set<Integer> available = new LinkedHashSet<>(Arrays.asList(LensFacingConverter.values())); if (!hasCameraWithLensFacing(CameraSelector.LENS_FACING_BACK)) { available.remove(CameraSelector.LENS_FACING_BACK); } if (!hasCameraWithLensFacing(CameraSelector.LENS_FACING_FRONT)) { available.remove(CameraSelector.LENS_FACING_FRONT); } return available; }
Source:
<code><START> public boolean <END> affectsJavaCodeMining(PropertyChangeEvent event) { boolean result= isJavaCodeMiningPreference(event.getProperty()); if (result) { installCodeMinigProviders(); } return result; }</code><technical_language>protected other affects* methods</technical_language>

Target:
protected boolean affectsJavaCodeMining(PropertyChangeEvent event) { boolean result= isJavaCodeMiningPreference(event.getProperty()); if (result) { installCodeMinigProviders(); } return result; }
Source:
<code>@Test public void testIsAlwaysTrueAndFalse() { final RelDataType booleanNullableType = typeFactory.createTypeWithNullability( typeFactory.createSqlType(SqlTypeName.BOOLEAN), true); <START> RexNode node = rexBuilder.makeInputRef(booleanNullableType, 0); <END> RexNode exp1 = rexBuilder.makeCall(SqlStdOperatorTable.IS_FALSE, isNotNull(isNull(node))); assertEquals(exp1.isAlwaysTrue(), false); assertEquals(exp1.isAlwaysFalse(), true); RexNode exp2 = rexBuilder.makeCall(SqlStdOperatorTable.IS_TRUE, isNotNull(isNull(node))); assertEquals(exp2.isAlwaysTrue(), true); assertEquals(exp2.isAlwaysFalse(), false); }</code><technical_language>I sense clutter test code boiler-plate creation of RelDataType inputrefs</technical_language>

Target:
@Test public void testIsAlwaysTrueAndFalse() { final RelDataType type = typeFactory.createSqlType(SqlTypeName.BOOLEAN); RexNode inputRef = rexBuilder.makeInputRef(type, 0); RexNode isFalseExp = isFalse(isNotNull(isNull(inputRef))); assertEquals("expected false,but got true in isFalseExp.isAlwaysTrue()", isFalseExp.isAlwaysTrue(), false); assertEquals("expected true,but got false in isFalseExp.isAlwaysFalse()", isFalseExp.isAlwaysFalse(), true); RexNode isFalseExp2 = isFalse(not(isNotNull(isNull(inputRef)))); assertEquals("expected true,but got false in isFalseExp2.isAlwaysTrue()", isFalseExp2.isAlwaysTrue(), true); assertEquals("expected false,but got true in isFalseExp2.isAlwaysFalse()", isFalseExp2.isAlwaysFalse(), false); RexNode isTrueExp = isTrue(isNotNull(isNull(inputRef))); assertEquals("expected true,but got false in isTrueExp.isAlwaysTrue()", isTrueExp.isAlwaysTrue(), true); assertEquals("expected false,but got true in isTrueExp.isAlwaysFalse()", isTrueExp.isAlwaysFalse(), false); RexNode isTrueExp2 = isTrue(not(isNotNull(isNull(inputRef)))); assertEquals("expected false,but got true in isTrueExp2.isAlwaysTrue()", isTrueExp2.isAlwaysTrue(), false); assertEquals("expected true,but got false in isTrueExp2.isAlwaysFalse()", isTrueExp2.isAlwaysFalse(), true); RexNode isNotTrueExp = isNotTrue(isNotNull(isNull(inputRef))); assertEquals("expected false,but got true in isNotTrueExp.isAlwaysTrue()", isNotTrueExp.isAlwaysTrue(), false); assertEquals("expected true,but got false in isNotTrueExp.isAlwaysFalse()", isNotTrueExp.isAlwaysFalse(), true); RexNode isNotTrueExp2 = isNotTrue(not(isNotNull(isNull(inputRef)))); assertEquals("expected true,but got false in isNotTrueExp2.isAlwaysTrue()", isNotTrueExp2.isAlwaysTrue(), true); assertEquals("expected false,but got true in isNotTrueExp2.isAlwaysFalse()", isNotTrueExp2.isAlwaysFalse(), false); }
Source:
<code>public void calls_a_callback_each_time_there_is_a_change() { AtomicInteger changeCallbackCalledTimes = new AtomicInteger(0); JTextField field = new JTextField(); JLabel label = new JLabel(); label.setForeground(BLACK); <START> UiFieldValidator validator = UiFieldValidator.of(field, label, s -> s.equals("foo")).onChange(() -> changeCallbackCalledTimes.getAndIncrement()); <END> simulateKeyStroke(field); assertThat(validator.isValid(), is(false)); assertThat(changeCallbackCalledTimes.get(), is(0)); field.setText("bar"); simulateKeyStroke(field); assertThat(validator.isValid(), is(false)); assertThat(changeCallbackCalledTimes.get(), is(1)); field.setText("foo"); simulateKeyStroke(field); assertThat(validator.isValid(), is(true)); assertThat(changeCallbackCalledTimes.get(), is(2)); field.setText("bar"); simulateKeyStroke(field); assertThat(validator.isValid(), is(false)); assertThat(changeCallbackCalledTimes.get(), is(3)); }</code><technical_language>Lambda replaced method reference, IDEA points out</technical_language>

Target:
public void calls_a_callback_each_time_there_is_a_change() { AtomicInteger changeCallbackCalledTimes = new AtomicInteger(0); JTextField field = new JTextField(); JLabel label = new JLabel(); label.setForeground(BLACK); UiFieldValidator validator = UiFieldValidator.of(field, label, s -> s.equals("foo")).onChange(changeCallbackCalledTimes::getAndIncrement); simulateKeyStroke(field); assertThat(validator.isValid(), is(false)); assertThat(changeCallbackCalledTimes.get(), is(0)); field.setText("bar"); simulateKeyStroke(field); assertThat(validator.isValid(), is(false)); assertThat(changeCallbackCalledTimes.get(), is(1)); field.setText("foo"); simulateKeyStroke(field); assertThat(validator.isValid(), is(true)); assertThat(changeCallbackCalledTimes.get(), is(2)); field.setText("bar"); simulateKeyStroke(field); assertThat(validator.isValid(), is(false)); assertThat(changeCallbackCalledTimes.get(), is(3)); }
Source:
<code>private void display(DiffInfo diffInfo) { cmA = displaySide(diffInfo.meta_a(), diffInfo.text_a(), diffTable.getCmA()); cmB = displaySide(diffInfo.meta_b(), diffInfo.text_b(), diffTable.getCmB()); render(diffInfo); initialBoxes = new ArrayList<CommentBox>(); <START> publishedMap = new HashMap<String, PublishedBox>(published.length()); <END> lineActiveBoxMap = new HashMap<LineHandle, CommentBox>(); lineLastPublishedBoxMap = new HashMap<LineHandle, PublishedBox>(); linePaddingManagerMap = new HashMap<LineHandle, PaddingManager>(); if (published != null) { renderPublished(); } if (drafts != null) { renderDrafts(); } published = null; drafts = null; cmA.on("cursorActivity", updateActiveLine(cmA)); cmB.on("cursorActivity", updateActiveLine(cmB)); if (Gerrit.isSignedIn()) { cmA.addKeyMap(KeyMap.create().on("'c'", insertNewDraft(cmA))); cmB.addKeyMap(KeyMap.create().on("'c'", insertNewDraft(cmB))); } resizeHandler = Window.addResizeHandler(new ResizeHandler() { @Override public void onResize(ResizeEvent event) { if (cmA != null) { cmA.setHeight(event.getHeight() - HEADER_FOOTER); cmA.refresh(); } if (cmB != null) { cmB.setHeight(event.getHeight() - HEADER_FOOTER); cmB.refresh(); } } }); cmA.on("scroll", doScroll(cmB)); cmB.on("scroll", doScroll(cmA)); }</code><technical_language>this NPE if published == null below? missing bug fix in base</technical_language>

Target:
private void display(DiffInfo diffInfo) { cmA = displaySide(diffInfo.meta_a(), diffInfo.text_a(), diffTable.getCmA()); cmB = displaySide(diffInfo.meta_b(), diffInfo.text_b(), diffTable.getCmB()); render(diffInfo); initialBoxes = new ArrayList<CommentBox>(); lineActiveBoxMap = new HashMap<LineHandle, CommentBox>(); lineLastPublishedBoxMap = new HashMap<LineHandle, PublishedBox>(); linePaddingManagerMap = new HashMap<LineHandle, PaddingManager>(); if (published != null) { publishedMap = new HashMap<String, PublishedBox>(published.length()); renderPublished(); } if (drafts != null) { renderDrafts(); } published = null; drafts = null; cmA.on("cursorActivity", updateActiveLine(cmA)); cmB.on("cursorActivity", updateActiveLine(cmB)); if (Gerrit.isSignedIn()) { cmA.addKeyMap(KeyMap.create().on("'c'", insertNewDraft(cmA))); cmB.addKeyMap(KeyMap.create().on("'c'", insertNewDraft(cmB))); } resizeHandler = Window.addResizeHandler(new ResizeHandler() { @Override public void onResize(ResizeEvent event) { if (cmA != null) { cmA.setHeight(event.getHeight() - HEADER_FOOTER); cmA.refresh(); } if (cmB != null) { cmB.setHeight(event.getHeight() - HEADER_FOOTER); cmB.refresh(); } } }); cmA.on("scroll", doScroll(cmB)); cmB.on("scroll", doScroll(cmA)); }
Source:
<code>@Test public void stringConverterReturningNullResultsInDefault() { class MyConverterFactory extends Converter.Factory { @Override public Converter<?, String> toString(Type type, Annotation[] annotations) { return null; } } Retrofit retrofit = new Retrofit.Builder() .baseUrl(server.url("/")) .addConverterFactory(new MyConverterFactory()) .build(); CallMethod service = retrofit.create(CallMethod.class); <START> service.queryObject(null); <END> }</code><technical_language>this assert something</technical_language>

Target:
@Test public void stringConverterReturningNullResultsInDefault() { final AtomicBoolean factoryCalled = new AtomicBoolean(); class MyConverterFactory extends Converter.Factory { @Override public Converter<?, String> stringConverter(Type type, Annotation[] annotations) { factoryCalled.set(true); return null; } } Retrofit retrofit = new Retrofit.Builder() .baseUrl(server.url("/")) .addConverterFactory(new MyConverterFactory()) .build(); CallMethod service = retrofit.create(CallMethod.class); Call<ResponseBody> call = service.queryObject(null); assertThat(call).isNotNull(); assertThat(factoryCalled.get()).isTrue(); }
Source:
<code>public VariantType getType() { if (this.alternate.equals(".")) { return VariantType.NO_ALTERNATE; <START> } else if (this.reference.startsWith("(") && this.reference.endsWith(")") <END> || this.alternate.startsWith("(") && this.alternate.endsWith(")")) { return VariantType.SEQUENCE_ALTERATION; } else if (!reference.equals(".") && reference.length() == alternate.length()) { if (getLength() > 1) { return VariantType.MNV; } else { return VariantType.SNV; } } else if (getLength() <= SV_THRESHOLD) { return VariantType.INDEL; } else { return VariantType.SV; } }</code><technical_language>create objects (legacy) dbSNP input angle-bracketed symbolic alleles</technical_language>

Target:
public VariantType getType() { if (this.alternate.equals(".")) { return VariantType.NO_ALTERNATE; } else if (this.reference.startsWith("<") && this.reference.endsWith(">") || this.alternate.startsWith("<") && this.alternate.endsWith(">")) { return VariantType.SEQUENCE_ALTERATION; } else if (!reference.equals(".") && reference.length() == alternate.length()) { if (getLength() > 1) { return VariantType.MNV; } else { return VariantType.SNV; } } else if (getLength() <= SV_THRESHOLD) { if (reference.isEmpty()) { return VariantType.INS; } else if (alternate.isEmpty()) { return VariantType.DEL; } else { return VariantType.INDEL; } } else { return VariantType.SV; } }
Source:
<code>public boolean hasNext() { try { return !in.isEnd(); } catch (IOException e) { <START> throw new RuntimeException(e); <END> } }</code><technical_language>Add message RuntimeException</technical_language>

Target:
public boolean hasNext() { try { return !in.isEnd(); } catch (IOException e) { throw new RuntimeException("Failed to check for more records", e); } }
Source:
<code>public static Optional<InsightCard> scoreCardBedLightDuration(final int avgLightOn, final Long accountId) { Text text; if (avgLightOn <= 60) { return Optional.absent(); } else if (avgLightOn <= 120) { text = BedLightDurationMsgEN.getMediumLight(); } else { text = BedLightDurationMsgEN.getHighLight(); } <START> <END> return Optional.of(new InsightCard(accountId, text.title, text.message, InsightCard.Category.BED_LIGHT_DURATION, InsightCard.TimePeriod.MONTHLY, DateTime.now(DateTimeZone.UTC))); }</code><technical_language>final String text = (avgLightOn <= 120) ? BedLightDurationMsgEN.getMediumLight() : BedLightDurationMsgEN.getHighLight();</technical_language>

Target:
public static Optional<InsightCard> scoreCardBedLightDuration(final int avgLightOn, final Long accountId) { final Text text; if (avgLightOn <= 60) { return Optional.absent(); } if (avgLightOn <= 120) { text = BedLightDurationMsgEN.getMediumLight(); } else { text = BedLightDurationMsgEN.getHighLight(); } return Optional.of(new InsightCard(accountId, text.title, text.message, InsightCard.Category.BED_LIGHT_DURATION, InsightCard.TimePeriod.MONTHLY, DateTime.now(DateTimeZone.UTC))); }
Source:
<code>public void checkClientCompDenpendency() throws IOException { String p = new File(".").getCanonicalPath(); <START> File src = new File(p + "/src/org/zkoss/zktest/test2/ZK3848_lang_addon.xml"); <END> File dst = new File(p + "/debug/classes/metainfo/zk/lang-addon.xml"); String name = "metainfo/zk/lang-addon.xml"; String elName = "addon-name"; String elDepends = "depends"; Path zkPath = dst.toPath().getParent(); if (!Files.exists(zkPath)) Files.createDirectories(zkPath); Files.copy(src.toPath(), dst.toPath(), StandardCopyOption.REPLACE_EXISTING); try { clToTest.getDependentXMLResources(name, elName, elDepends); verify(logger, times(2)).warn(anyString()); } catch (Exception ex) { } finally { Files.delete(dst.toPath()); Path metainfoPath = zkPath.getParent(); Files.delete(zkPath); Files.delete(metainfoPath); } System.out.println(results.size()); }</code><technical_language>File p = new File("."); new File(File, String) instead</technical_language>

Target:
public void checkClientCompDenpendency() throws IOException { File p = new File("."); File src = new File(p, "/src/org/zkoss/zktest/test2/ZK3848_lang_addon.xml"); File dst = new File(p, "/debug/classes/metainfo/zk/lang-addon.xml"); String name = "metainfo/zk/lang-addon.xml"; String elName = "addon-name"; String elDepends = "depends"; Path zkPath = dst.toPath().getParent(); if (!Files.exists(zkPath)) Files.createDirectories(zkPath); Files.copy(src.toPath(), dst.toPath(), StandardCopyOption.REPLACE_EXISTING); try { clToTest.getDependentXMLResources(name, elName, elDepends); verify(logger, times(2)).warn(anyString()); } catch (Exception ex) { Assert.fail(); } finally { Files.delete(dst.toPath()); Path metainfoPath = zkPath.getParent(); Files.delete(zkPath); Files.delete(metainfoPath); } System.out.println(results.size()); }
Source:
<code>public DataSchema( @JsonProperty("dataSource") String dataSource, @JsonProperty("parser") Map<String, Object> parser, @JsonProperty("metricsSpec") AggregatorFactory[] aggregators, @JsonProperty("granularitySpec") GranularitySpec granularitySpec, @JacksonInject ObjectMapper jsonMapper ) { this.jsonMapper = Preconditions.checkNotNull(jsonMapper, "null ObjectMapper."); this.dataSource = Preconditions.checkNotNull(dataSource, "dataSource cannot be null. Please provide a dataSource."); this.parser = parser; <START> this.aggregators = Preconditions.checkNotNull( <END> aggregators, "metricsSpec cannot be null. Please provide metricsSpec" ); if (aggregators.length == 0) { log.warn("No metricsSpec has been specified. Are you sure this is what you want?"); } if (granularitySpec == null) { log.warn("No granularitySpec has been specified. Using UniformGranularitySpec as default."); this.granularitySpec = new UniformGranularitySpec(null, null, null); } else { this.granularitySpec = granularitySpec; } }</code><technical_language>null? a dimension-only dataSource valid, yes</technical_language>

Target:
public DataSchema( @JsonProperty("dataSource") String dataSource, @JsonProperty("parser") Map<String, Object> parser, @JsonProperty("metricsSpec") AggregatorFactory[] aggregators, @JsonProperty("granularitySpec") GranularitySpec granularitySpec, @JacksonInject ObjectMapper jsonMapper ) { this.dataSource = Preconditions.checkNotNull(dataSource, "dataSource cannot be null. Please provide a dataSource."); this.jsonMapper = jsonMapper; this.parser = parser; this.aggregators = aggregators == null ? new AggregatorFactory[]{} : aggregators; if (this.aggregators.length == 0) { log.warn("No metricsSpec has been specified. Are you sure this is what you want?"); } if (granularitySpec == null) { log.warn("No granularitySpec has been specified. Using UniformGranularitySpec as default."); this.granularitySpec = new UniformGranularitySpec(null, null, null); } else { this.granularitySpec = granularitySpec; } }