auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public IdentifierHolder signUp(Study study, StudyParticipant participant) { checkNotNull(study); checkNotNull(participant); if (BridgeUtils.isExternalIdAccount(participant) && !study.isExternalIdValidationEnabled()) { throw new UnauthorizedException("External ID management is not enabled for this study"); } try { return participantService.createParticipant(study, NO_CALLER_ROLES, participant, true); } catch(EntityAlreadyExistsException e) { AccountId accountId = null; if (e.getEntityKeys().get("email") != null) { accountId = AccountId.forEmail(study.getIdentifier(), participant.getEmail()); } else if (e.getEntityKeys().get("phone") != null) { accountId = AccountId.forPhone(study.getIdentifier(), participant.getPhone()); } else if (e.getEntityKeys().get("externalId") != null) { accountId = AccountId.forExternalId(study.getIdentifier(), participant.getExternalId()); } if (accountId != null) { accountWorkflowService.notifyAccountExists(study, accountId); LOG.info("Sign up attempt for existing credential '"+accountId+"'"); } else { LOG.error("Sign up attempt for existing credential, but could not create AccountId: '"+study.getIdentifier()+"'"); } } return null; }

Target:
public IdentifierHolder signUp(Study study, StudyParticipant participant) { checkNotNull(study); checkNotNull(participant); if (BridgeUtils.isExternalIdAccount(participant) && !study.isExternalIdValidationEnabled()) { throw new UnauthorizedException("External ID management is not enabled for this study"); } try { return participantService.createParticipant(study, NO_CALLER_ROLES, participant, true); } catch(EntityAlreadyExistsException e) { LOG.info("Sign up attempt using credential that exists in account '"+e.getEntityKeys().get("userId")+"'"); AccountId accountId = AccountId.forId(study.getIdentifier(), (String)e.getEntityKeys().get("userId")); accountWorkflowService.notifyAccountExists(study, accountId); return null; } }
Source:
public double[] getData() { RealAttribute field = new RealAttribute(fieldName); try { return ClassificationUtils.getSortedValues(layer.getDataSource(), field); } catch (Exception ex) { Logger.getLogger(ChoroplethDataModel.class.getName()).log(Level.SEVERE, null, ex); } return null; }

Target:
public double[] getData() { RealAttribute field = new RealAttribute(fieldName); try { return ClassificationUtils.getSortedValues(layer.getDataSource(), field); } catch (DriverException ex) { LOGGER.error(I18N.tr("Unable to load the map data"), ex); } catch (ParameterException ex) { LOGGER.error(I18N.tr("Unable to load the map data"), ex); } return null; }
Source:
public URI getURI() { Preconditions.checkNotNull(hostname, "Hostname is null!"); if (protocol.value == null){ protocol = HTTP; } if (port == 80) { return URI.create(format("%s://%s", protocol.value, hostname)); } return URI.create(format("%s://%s:%s", protocol.value, hostname, port)); }

Target:
public URI getURI() { Preconditions.checkNotNull(hostname, "Hostname is null!"); if (protocol == null) { protocol = HTTP; } return newInstance().scheme(protocol.name().toLowerCase()).host(hostname).port(port).build().toUri(); }
Source:
public static String[] getStringValuesFromDatabase(Connection dbConnection, String sqlStmt, Object... params) throws UserStoreException { String[] values = new String[0]; try (PreparedStatement prepStmt = dbConnection.prepareStatement(sqlStmt)) { if (params != null && params.length > 0) { for (int i = 0; i < params.length; i++) { Object param = params[i]; if (param == null) { prepStmt.setString(i + 1, null); } else if (param instanceof String) { prepStmt.setString(i + 1, (String) param); } else if (param instanceof Integer) { prepStmt.setInt(i + 1, (Integer) param); } } } try(ResultSet rs = prepStmt.executeQuery() ) { List<String> lst = new ArrayList<String>(); while (rs.next()) { String name = rs.getString(1); lst.add(name); } if (lst.size() > 0) { values = lst.toArray(new String[lst.size()]); } return values; } } catch (SQLException e) { String errorMessage = "Using sql : " + sqlStmt + " " + e.getMessage(); if (log.isDebugEnabled()) { log.debug(errorMessage, e); } throw new UserStoreException(errorMessage, e); } finally { close(dbConnection); } }

Target:
public static String[] getStringValuesFromDatabase(Connection dbConnection, String sqlStmt, Object... params) throws UserStoreException { String[] values = new String[0]; try (PreparedStatement prepStmt = dbConnection.prepareStatement(sqlStmt)) { if (params != null && params.length > 0) { for (int i = 0; i < params.length; i++) { Object param = params[i]; if (param == null) { prepStmt.setString(i + 1, null); } else if (param instanceof String) { prepStmt.setString(i + 1, (String) param); } else if (param instanceof Integer) { prepStmt.setInt(i + 1, (Integer) param); } } } try(ResultSet rs = prepStmt.executeQuery() ) { List<String> lst = new ArrayList<String>(); while (rs.next()) { String name = rs.getString(1); lst.add(name); } if (lst.size() > 0) { values = lst.toArray(new String[lst.size()]); } return values; } } catch (SQLException e) { String errorMessage = "Using sql : " + sqlStmt + " " + e.getMessage(); if (log.isDebugEnabled()) { log.debug(errorMessage, e); } throw new UserStoreException(errorMessage, e); } }
Source:
public void onRestoreInstanceState(Bundle savedInstanceStateBundle) { mStableIdMap = (HashMap<Integer, Boolean>) savedInstanceStateBundle.getSerializable(STABLE_ID_MAP); int i = 0; while (i < mItemList.size()) { if (mItemList.get(i) instanceof ParentObject) { ParentObject parentObject = (ParentObject) mItemList.get(i); if (mStableIdMap.containsKey(parentObject.getStableID())) { parentObject.setExpanded(mStableIdMap.get(parentObject.getStableID())); if (parentObject.isExpanded()) { i++; mItemList.add(i, parentObject.getChildObject()); } } else { parentObject.setExpanded(false); } } i++; } notifyDataSetChanged(); }

Target:
public void onRestoreInstanceState(Bundle savedInstanceStateBundle) { if (savedInstanceStateBundle == null) { return; } if (!savedInstanceStateBundle.containsKey(STABLE_ID_MAP)) { return; } mStableIdMap = (HashMap<Integer, Boolean>) savedInstanceStateBundle.getSerializable(STABLE_ID_MAP); int i = 0; while (i < mItemList.size()) { if (mItemList.get(i) instanceof ParentObject) { ParentObject parentObject = (ParentObject) mItemList.get(i); if (mStableIdMap.containsKey(parentObject.getStableID())) { parentObject.setExpanded(mStableIdMap.get(parentObject.getStableID())); if (parentObject.isExpanded()) { i++; mItemList.add(i, parentObject.getChildObject()); } } else { parentObject.setExpanded(false); } } i++; } notifyDataSetChanged(); }
Source:
private static Method normalizedValueOf(final String method) { return Method.valueOf(Objects.requireNonNull(method, "method").toUpperCase(Locale.ROOT)); }

Target:
private static Method normalizedValueOf(final String method) { return Method.valueOf(Args.notNull(method, "method").toUpperCase(Locale.ROOT)); }
Source:
public RX64Packet(XBee64BitAddress sourceAddress, int rssi, int receiveOptions, byte[] receivedData) { super(XBeeAPIType.RX_64); this.sourceAddress = sourceAddress; this.rssi = rssi; this.receiveOptions = receiveOptions; this.receivedData = receivedData; }

Target:
public RX64Packet(XBee64BitAddress sourceAddress, int rssi, int receiveOptions, byte[] receivedData) { super(APIFrameType.RX_64); if (sourceAddress == null) throw new NullPointerException("Source address cannot be null."); if (rssi < 0 || rssi > 100) throw new IllegalArgumentException("RSSI value must be between 0 and 100."); if (receiveOptions < 0 || receiveOptions > 255) throw new IllegalArgumentException("Receive options value must be between 0 and 255."); this.sourceAddress = sourceAddress; this.rssi = rssi; this.receiveOptions = receiveOptions; this.receivedData = receivedData; }
Source:
private static boolean isTupleDeclaration(Tree tree) { return tree.ancestors().stream() .anyMatch(t -> t.is(Kind.TUPLE) || (t.is(Kind.EXPRESSION_LIST) && ((PyExpressionListTree) t).expressions().size() > 1) || t.is(Kind.FOR_STMT) && ((PyForStatementTree) t).expressions().size() > 1 && ((PyForStatementTree) t).expressions().contains(tree)); }

Target:
private static boolean isTupleDeclaration(Tree tree) { return tree.ancestors().stream() .anyMatch(t -> t.is(Kind.TUPLE) || (t.is(Kind.EXPRESSION_LIST) && ((PyExpressionListTree) t).expressions().size() > 1) || (t.is(Kind.FOR_STMT) && ((PyForStatementTree) t).expressions().size() > 1 && ((PyForStatementTree) t).expressions().contains(tree))); }
Source:
public DnsServerAddressStreamProvider getNameServerProvider() { if (Strings.isNullOrEmpty(nameservers)) { return DnsServerAddressStreamProviders.platformDefault(); } final String servers[] = nameservers.split(","); return new SequentialDnsServerAddressStreamProvider(Arrays.stream(servers) .map(s -> { String parts[] = s.split(":"); if (parts.length > 1) { return SocketUtils.socketAddress(parts[0], Integer.parseInt(parts[1])); } else { return SocketUtils.socketAddress(parts[0],53); } }) .toArray(InetSocketAddress[]::new)); }

Target:
public DnsServerAddressStreamProvider getNameServerProvider() { if (Strings.isNullOrEmpty(nameservers)) { return DnsServerAddressStreamProviders.platformDefault(); } return new SequentialDnsServerAddressStreamProvider(toSocketAddresses(nameservers).toArray(new InetSocketAddress[]{})); }
Source:
public void test_MergingUpdater_failure() throws IOException, RDFHandlerException { final AbstractTripleStore store = getStore(); boolean ok = false; final String resource = "data-bad.ttl"; try { final MergingUpdater original = doMergingUpdate(store, resource); final String baseURL = new File(resource).toURI().toString(); ok = true; } catch (RDFParseException t) { log.info("Expected error {}", t.getMessage()); } finally { store.__tearDownUnitTest(); } if (ok) fail("Error should have been reported for " + resource); }

Target:
public void test_MergingUpdater_failure() throws IOException, RDFHandlerException, RDFParseException { final AbstractTripleStore store = getStore(); final String resource = "data-bad.ttl"; try { final MergingUpdaterResult original = doMergingUpdate(store, resource); final String baseURL = new File(resource).toURI().toString(); } finally { store.__tearDownUnitTest(); } }
Source:
public void startSignIn(@NonNull final String email, @NonNull final String password, @NonNull final IdpResponse inputResponse, @Nullable final AuthCredential credential) { mSignInLiveData.setValue(new Resource<IdpResponse>()); final IdpResponse outputResponse; if (credential == null) { outputResponse = new IdpResponse.Builder( new User.Builder(EmailAuthProvider.PROVIDER_ID, email).build()) .build(); } else { outputResponse = new IdpResponse.Builder(inputResponse.getUser()) .setToken(inputResponse.getIdpToken()) .setSecret(inputResponse.getIdpSecret()) .build(); } getAuth().signInWithEmailAndPassword(email, password) .addOnFailureListener(new TaskFailureLogger(TAG, "signInWithEmailAndPassword failed.")) .continueWithTask(new Continuation<AuthResult, Task<AuthResult>>() { @Override public Task<AuthResult> then(@NonNull Task<AuthResult> task) throws Exception { if (!task.isSuccessful()) { throw task.getException(); } if (credential == null) { return Tasks.forResult(task.getResult()); } else { return task.getResult().getUser() .linkWithCredential(credential) .continueWithTask(new ProfileMerger(outputResponse)) .addOnFailureListener(new TaskFailureLogger(TAG, "linkWithCredential+merge failed.")); } } }) .addOnCompleteListener(new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { if (!task.isSuccessful()) { mSignInLiveData.setValue(new Resource<IdpResponse>(task.getException())); return; } AuthResult authResult = task.getResult(); saveCredentialsOrFinish(authResult.getUser(), password, outputResponse); } }); }

Target:
public void startSignIn(@NonNull final String email, @NonNull final String password, @NonNull final IdpResponse inputResponse, @Nullable final AuthCredential credential) { mSignInLiveData.setValue(new Resource<IdpResponse>()); final IdpResponse outputResponse; if (credential == null) { outputResponse = new IdpResponse.Builder( new User.Builder(EmailAuthProvider.PROVIDER_ID, email).build()) .build(); } else { outputResponse = new IdpResponse.Builder(inputResponse.getUser()) .setToken(inputResponse.getIdpToken()) .setSecret(inputResponse.getIdpSecret()) .build(); } getAuth().signInWithEmailAndPassword(email, password) .addOnFailureListener(new TaskFailureLogger(TAG, "signInWithEmailAndPassword failed.")) .continueWithTask(new Continuation<AuthResult, Task<AuthResult>>() { @Override public Task<AuthResult> then(@NonNull Task<AuthResult> task) throws Exception { AuthResult result = task.getResult(Exception.class); if (credential == null) { return Tasks.forResult(result); } else { return result.getUser() .linkWithCredential(credential) .continueWithTask(new ProfileMerger(outputResponse)) .addOnFailureListener(new TaskFailureLogger(TAG, "linkWithCredential+merge failed.")); } } }) .addOnCompleteListener(new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { if (!task.isSuccessful()) { mSignInLiveData.setValue(new Resource<IdpResponse>(task.getException())); return; } AuthResult authResult = task.getResult(); saveCredentialsOrFinish(authResult.getUser(), password, outputResponse); } }); }
Source:
protected void doPoll(SourcePollingChannelAdapter adapter) { try { Method method = AbstractPollingEndpoint.class.getDeclaredMethod("doPoll"); method.setAccessible(true); method.invoke(adapter); } catch (Exception e) { e.printStackTrace(); fail("Failed to invoke doPoll(): " + e.toString()); } }

Target:
protected void doPoll(SourcePollingChannelAdapter adapter) { try { Method method = AbstractPollingEndpoint.class.getDeclaredMethod("doPoll"); method.setAccessible(true); method.invoke(adapter); } catch (Exception e) { fail("Failed to invoke doPoll(): " + e.toString()); } }
Source:
public List<Question> getQuestions( @Scope(OAuthScope.QUESTIONS_READ) final AccessToken accessToken, @QueryParam("date") final String date) { LOGGER.debug("Returning list of questions for account id = {}", accessToken.accountId); final Optional<Account> accountOptional = accountDAO.getById(accessToken.accountId); if(!accountOptional.isPresent()) { throw new WebApplicationException(404); } int timeZoneOffset = - 26200000; final Optional<TimeZoneHistory> tzHistory = this.tzHistoryDAO.getCurrentTimeZone(accessToken.accountId); if (tzHistory.isPresent()) { timeZoneOffset = tzHistory.get().offsetMillis; } final DateTime today = DateTime.now(DateTimeZone.UTC).plusMillis(timeZoneOffset).withTimeAtStartOfDay(); LOGGER.debug("today = {}", today); if(date != null && !date.equals(today.toString("yyyy-MM-dd"))) { return Collections.EMPTY_LIST; } final int accountAgeInDays = (int) ((DateTime.now(DateTimeZone.UTC).getMillis() - accountOptional.get().created.getMillis()) / DAY_IN_MILLIS); return this.questionProcessor.getQuestions(accessToken.accountId, accountAgeInDays, today, DEFAULT_NUM_QUESTIONS, true); }

Target:
public List<Question> getQuestions( @Scope(OAuthScope.QUESTIONS_READ) final AccessToken accessToken, @QueryParam("date") final String date) { LOGGER.debug("Returning list of questions for account id = {}", accessToken.accountId); final int accountAgeInDays = this.getAccountAgeInDays(accessToken.accountId); if (accountAgeInDays == -1) { LOGGER.warn("Fail to get account age for {}", accessToken.accountId); throw new WebApplicationException(404); } final int timeZoneOffset = this.getTimeZoneOffsetMillis(accessToken.accountId); final DateTime today = DateTime.now(DateTimeZone.UTC).plusMillis(timeZoneOffset).withTimeAtStartOfDay(); LOGGER.debug("today = {}", today); if(date != null && !date.equals(today.toString("yyyy-MM-dd"))) { return Collections.EMPTY_LIST; } return this.questionProcessor.getQuestions(accessToken.accountId, accountAgeInDays, today, DEFAULT_NUM_QUESTIONS, true); }
Source:
@Override public int selectName(Options options) throws IOException { int p = peeked; if (p == PEEKED_NONE) { p = doPeek(); } if (p != PEEKED_DOUBLE_QUOTED_NAME) { return -1; } int result = source.select(options.doubleQuoteSuffix); if (result == -1) { String lastPathName = pathNames[stackSize - 1]; String nextName = nextName(); for (int i = 0, size = options.strings.length; i < size; i++) { if (nextName.equals(options.strings[i])) { result = i; peeked = PEEKED_NONE; pathNames[stackSize - 1] = nextName; break; } } if (result == -1) { peeked = PEEKED_BUFFERED_NAME; peekedString = nextName; pathNames[stackSize - 1] = lastPathName; } } else { peeked = PEEKED_NONE; pathNames[stackSize - 1] = options.strings[result]; } return result; }

Target:
@Override public int selectName(Options options) throws IOException { int p = peeked; if (p == PEEKED_NONE) { p = doPeek(); } if (p < PEEKED_SINGLE_QUOTED_NAME || p > PEEKED_BUFFERED_NAME) { return -1; } int result = source.select(options.doubleQuoteSuffix); if (result != -1) { peeked = PEEKED_NONE; pathNames[stackSize - 1] = options.strings[result]; return result; } String lastPathName = pathNames[stackSize - 1]; String nextName = nextName(); for (int i = 0, size = options.strings.length; i < size; i++) { if (nextName.equals(options.strings[i])) { peeked = PEEKED_NONE; pathNames[stackSize - 1] = nextName; return i; } } peeked = PEEKED_BUFFERED_NAME; peekedString = nextName; pathNames[stackSize - 1] = lastPathName; return -1; }
Source:
public int getListValue() { return intValue; }

Target:
public List<String> getListValue() { return listValue; }
Source:
private void checkSuperInvokedInAnyDerivedClassConstructor(MethodDeclarationTree method) { if (isConstructor(method) && !isInBaseClass(method) && !isInDummyDerivedClass(method)) { Set<SuperTreeImpl> superTrees = new SuperDetector().detectIn(method); if (!superTrees.stream().anyMatch(s -> s.getParent().is(Kind.CALL_EXPRESSION))) { addIssue(method.name(), MESSAGE_SUPER_REQUIRED_IN_ANY_DERIVED_CLASS_CONSTRUCTOR); } } }

Target:
private void checkSuperInvokedInAnyDerivedClassConstructor(MethodDeclarationTree method) { if (isConstructor(method) && !isInBaseClass(method) && !isInDummyDerivedClass(method)) { Set<SuperTreeImpl> superTrees = new SuperDetector().detectIn(method); if (superTrees.stream().noneMatch(s -> s.getParent().is(Kind.CALL_EXPRESSION))) { addIssue(method.name(), MESSAGE_SUPER_REQUIRED_IN_ANY_DERIVED_CLASS_CONSTRUCTOR); } } }
Source:
public void testEncryptionOverRename() throws Throwable { Path src = path(createFilename(1024)); byte[] data = dataset(1024, 'a', 'z'); S3AFileSystem fs = getFileSystem(); EncryptionSecrets secrets = fs.getEncryptionSecrets(); validateEncrytionSecrets(secrets); writeDataset(fs, src, data, data.length, 1024 * 1024, true); ContractTestUtils.verifyFileContents(fs, src, data); Path targetDir = path("target"); Path dest = new Path(targetDir, src.getName() + "-another"); byte[] dataTarget = dataset(1024, 'A', 'Z'); writeDataset(fs, dest, dataTarget, dataTarget.length, 1024*1024, true); ContractTestUtils.verifyFileContents(fs, dest, dataTarget); fs.rename(src, targetDir); Path renamedFile = new Path(targetDir, src.getName()); ContractTestUtils.verifyFileContents(fs, renamedFile, data); assertEncrypted(renamedFile); }

Target:
public void testEncryptionOverRename() throws Throwable { Path src = path(createFilename(1024)); byte[] data = dataset(1024, 'a', 'z'); S3AFileSystem fs = getFileSystem(); EncryptionSecrets secrets = fs.getEncryptionSecrets(); validateEncrytionSecrets(secrets); writeDataset(fs, src, data, data.length, 1024 * 1024, true); ContractTestUtils.verifyFileContents(fs, src, data); assertEncrypted(src); Path targetDir = path("target"); mkdirs(targetDir); fs.rename(src, targetDir); Path renamedFile = new Path(targetDir, src.getName()); ContractTestUtils.verifyFileContents(fs, renamedFile, data); assertEncrypted(renamedFile); }
Source:
protected RemoteCallback<Object> getExportCallBack() { return rawResult -> { final AnchorElement exportAnchorElement = view.getExportAnchorElement((String) rawResult, path.getFileName() + CSV.getExtension()); final NativeEvent CLICK_EVENT = Document.get().createClickEvent(0, 0, 0, 0, 0, false, false, false, false); exportAnchorElement.dispatchEvent(CLICK_EVENT); exportAnchorElement.removeFromParent(); }; }

Target:
protected RemoteCallback<Object> getExportCallBack() { return rawResult -> { TextContent textContent = TextContent.create((String) rawResult); textFileExport.export(textContent, path.getFileName() + CSV.getExtension()); }; }
Source:
public static boolean isFullyQualified(String address) { List<String> split = Splitter.onPattern(SEPARATOR).splitToList(address); return address != null && split.size() == 2 && !split.contains(""); }

Target:
public static boolean isFullyQualified(String address) { if (address == null) { return false; } if (address.length() < SEPARATOR_LENGTH + 2) { return false; } int index = address.indexOf(SEPARATOR, 1); return index != -1 && index != address.length() - SEPARATOR_LENGTH; }
Source:
private boolean dontNeedEncoding(char ch) { return ch >= 'a' && ch <= 'z' || ch >= 'A' && ch <= 'Z' || ch >= '0' && ch <= '9' || ch == '-' || ch == '_' || ch == '.' || ch == '*'; }

Target:
private static boolean dontNeedEncoding(char ch) { return ch >= 'a' && ch <= 'z' || ch >= 'A' && ch <= 'Z' || ch >= '0' && ch <= '9' || ch == '-' || ch == '_' || ch == '.' || ch == '*'; }
Source:
public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || this.getClass() != o.getClass()) { return false; } final SecurityKey compareKey = (SecurityKey) o; return Objects.equals(this.getDlmsDevice(), compareKey.getDlmsDevice()) && Objects.equals(this.getSecurityKeyType(), compareKey.getSecurityKeyType()) && Objects.equals(this.getId(), compareKey.getId()); }

Target:
public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || this.getClass() != o.getClass()) { return false; } final SecurityKey compareKey = (SecurityKey) o; return Objects.equals(this.getId(), compareKey.getId()); }
Source:
@Test public void testPushAggragateOnTimeWithExtractDay() { String sql = "select EXTRACT( day from \"timestamp\") as \"day\",\"product_id\" from \"foodmart\" where \"product_id\" = 1016 and " + "\"timestamp\" < cast('1997-01-20' as timestamp) and \"timestamp\" > cast" + "('1997-01-01' as timestamp)" + " group by " + " EXTRACT( day from \"timestamp\"), \"product_id\" "; sql(sql).queryContains( druidChecker(",\"granularity\":\"all\"", "{\"type\":\"extraction\"," + "\"dimension\":\"__time\",\"outputName\":\"dayOfMonth\"," + "\"extractionFn\":{\"type\":\"timeFormat\",\"format\":\"dd\"," + "\"timeZone\":\"UTC\"}}")) .returnsUnordered("day=02; product_id=1016", "day=10; product_id=1016", "day=13; product_id=1016", "day=16; product_id=1016"); }

Target:
@Test public void testPushAggragateOnTimeWithExtractDay() { String sql = "select EXTRACT( day from \"timestamp\") as \"day\",\"product_id\" from \"foodmart\"" + " where \"product_id\" = 1016 and " + "\"timestamp\" < cast('1997-01-20' as timestamp) and \"timestamp\" > cast" + "('1997-01-01' as timestamp)" + " group by " + " EXTRACT( day from \"timestamp\"), \"product_id\" "; sql(sql).queryContains(druidChecker (",\"granularity\":\"all\"", "{\"type\":\"extraction\"," + "\"dimension\":\"__time\",\"outputName\":\"dayOfMonth\"," + "\"extractionFn\":{\"type\":\"timeFormat\",\"format\":\"dd\"," + "\"timeZone\":\"UTC\"}}" ) ).returnsUnordered("day=02; product_id=1016", "day=10; product_id=1016", "day=13; product_id=1016", "day=16; product_id=1016" ); }
Source:
public void testNoTimeformat() throws IOException { String str = "time:TIME, before:20170101, after:20120101, defaultExit:true, timeFormat:null, timeZone:EST"; BundleFilterTimeRange filter = Configs.decodeObject(BundleFilterTimeRange.class, str); }

Target:
public void testNoTimeformat() throws IOException { String str = "time:TIME, before:20170101, after:20120101, defaultExit:true, timeZone:EST"; BundleFilterTimeRange filter = Configs.decodeObject(BundleFilterTimeRange.class, str); }
Source:
public void onCreated(Iterable<CacheEntryEvent<? extends K, ? extends V>> events) throws CacheEntryListenerException { for (CacheEntryEvent<? extends K, ? extends V> event : events) { switch (event.getEventType()){ case CREATED: created.incrementAndGet(); break; case UPDATED: updated.incrementAndGet(); break; case REMOVED: removed.incrementAndGet(); break; case EXPIRED: expired.incrementAndGet(); break; } System.out.println("Received " + event); } }

Target:
public void onCreated(Iterable<CacheEntryEvent<? extends K, ? extends V>> events) throws CacheEntryListenerException { for (CacheEntryEvent<? extends K, ? extends V> event : events) { switch (event.getEventType()){ case CREATED: created.incrementAndGet(); break; case UPDATED: updated.incrementAndGet(); break; case REMOVED: removed.incrementAndGet(); break; case EXPIRED: expired.incrementAndGet(); break; default: unExpected.incrementAndGet(); break; } } }
Source:
private static Collection<ITestResult> sort(Set<ITestResult> results) { List<ITestResult> sortedResults = new ArrayList<>(results); sortedResults.sort(Comparator.comparingInt(o -> o.getMethod().getPriority())); return sortedResults; }

Target:
private static Collection<ITestResult> sort(Set<ITestResult> results) { List<ITestResult> sortedResults = new ArrayList<>(results); sortedResults.sort(Comparator.comparingInt(o -> o.getMethod().getPriority())); return Collections.unmodifiableList(sortedResults); }
Source:
public ChannelPinger() { String interval = System.getProperty(SYS_PROPERTY_NAME_INTERVAL_SECONDS); if (interval != null) { try { pingIntervalSeconds = Integer.parseInt(interval); } catch (NumberFormatException e) { LOGGER.warning("Ignoring invalid " + SYS_PROPERTY_NAME_INTERVAL_SECONDS + "=" + interval); } } if (interval == null) { interval = System.getProperty(SYS_PROPERTY_NAME_INTERVAL_MINUTES_DEPRECATED); if (interval != null) { LOGGER.warning(SYS_PROPERTY_NAME_INTERVAL_MINUTES_DEPRECATED + " property is deprecated, " + SYS_PROPERTY_NAME_INTERVAL_SECONDS + " should be used"); try { pingIntervalSeconds = Integer.parseInt(interval) * 60; } catch (NumberFormatException e) { LOGGER.warning("Ignoring invalid " + SYS_PROPERTY_NAME_INTERVAL_MINUTES_DEPRECATED + "=" + interval); } } } String timeout = System.getProperty(SYS_PROPERTY_NAME_TIMEOUT_SECONDS); if (timeout != null) { try { pingTimeoutSeconds = Integer.parseInt(timeout); } catch (NumberFormatException e) { LOGGER.warning("Ignoring invalid " + SYS_PROPERTY_NAME_TIMEOUT_SECONDS + "=" + timeout); } } }

Target:
public ChannelPinger() { Integer interval = SystemProperties.getInteger(INTERVAL_SECONDS_PROPERTY, null, Level.WARNING); if (interval == null) { interval = SystemProperties.getInteger(INTERVAL_MINUTES_PROPERTY_DEPRECATED,null, Level.WARNING); if (interval != null) { LOGGER.warning(INTERVAL_MINUTES_PROPERTY_DEPRECATED + " property is deprecated, " + INTERVAL_SECONDS_PROPERTY + " should be used"); interval *= 60; } } if (interval != null) { pingIntervalSeconds = interval; } }
Source:
public double getDouble(String key) throws JSONException { Object object = this.get(key); try { return object instanceof Number ? ((Number) object).doubleValue() : new BigDecimal((String) object).doubleValue(); } catch (Exception e) { throw new JSONException("JSONObject[" + quote(key) + "] is not a number.", e); } }

Target:
public double getDouble(String key) throws JSONException { Object object = this.get(key); try { return object instanceof Number ? ((Number) object).doubleValue() : Double.parseDouble(object.toString()); } catch (Exception e) { throw new JSONException("JSONObject[" + quote(key) + "] is not a number.", e); } }
Source:
private static double round(final double value, final int digits) { final double x = Math.pow(10, digits); return ((int)(value * x)) / x; }

Target:
private static double round(final double value, final int digits) { final double x = Math.pow(10, digits); return Math.round(value * x) / x; }
Source:
public @Nullable MobSpawnerBaseLogic getSpawner() { return spawner; }

Target:
public MobSpawnerBaseLogic getSpawner() { return spawner; }
Source:
public void testConvertToMimeType(String mimeType) throws IOException { String converterName = cs.getConverterName(mimeType, "text/html"); assertEquals("zip2html", converterName); checkConverterAvailability(converterName); BlobHolder htmlBH = getBlobFromPath("test-docs/hello.zip"); htmlBH.getBlob().setMimeType(mimeType); Map<String, Serializable> parameters = new HashMap<>(); BlobHolder result = cs.convert(converterName, htmlBH, parameters); assertNotNull(result); List<Blob> blobs = result.getBlobs(); assertNotNull(blobs); assertEquals(3, blobs.size()); String content = blobs.get(0).getString(); assertTrue(content.contains("Hello") || content.contains("hello")); }

Target:
public void testConvertToMimeType(String mimeType) throws IOException { String converterName = cs.getConverterName(mimeType, "text/html"); assertEquals("zip2html", converterName); checkConverterAvailability(converterName); BlobHolder htmlBH = getBlobFromPath("test-docs/hello.zip"); htmlBH.getBlob().setMimeType(mimeType); Map<String, Serializable> parameters = Collections.emptyMap(); BlobHolder result = cs.convert(converterName, htmlBH, parameters); assertNotNull(result); List<Blob> blobs = result.getBlobs(); assertNotNull(blobs); assertEquals(3, blobs.size()); String content = blobs.get(0).getString(); String zipList = "<html>" + "<body>" + "<h1>hello.zip</h1>" + "<ul>" + "<li><a href=\"hello.xml\">hello.xml</a></li>" + "<li><a href=\"hello.txt\">hello.txt</a></li>" + "</ul>" + "</body>" + "</html>"; String zipListAlternative = "<html>" + "<body>" + "<h1>hello.zip</h1>" + "<ul>" + "<li><a href=\"hello.xml\">hello.xml</a></li>" + "<li><a href=\"hello.txt\">hello.txt</a></li>" + "</ul>" + "</body>" + "</html>"; assertTrue(zipList.equals(content) || zipListAlternative.equals(content)); content = DocumentUTUtils.readContent(blobs.get(1).getFile()); assertTrue(content.contains("Hello from a xml <b>document</b>")); content = DocumentUTUtils.readContent(blobs.get(2).getFile()); assertTrue(content.contains("Hello from a text document")); }
Source:
public void failedCacheActionAsCacheMiss() throws Exception { ActionResult actionResult = ActionResult.newBuilder().setExitCode(1).build(); when(remoteCache.getCachedActionResult(any(ActionKey.class))) .thenAnswer( (Answer<ActionResult>) invocation -> { RequestMetadata meta = TracingMetadataUtils.fromCurrentContext(); assertThat(meta.getCorrelatedInvocationsId()).isEqualTo("build-req-id"); assertThat(meta.getToolInvocationId()).isEqualTo("command-id"); return actionResult; }); CacheHandle entry = cache.lookup(simpleSpawn, simplePolicy); assertThat(entry.hasResult()).isFalse(); verify(remoteCache, never()) .download( any(ActionResult.class), any(Path.class), eq(outErr) ); assertThat(progressUpdates) .containsExactly(Pair.of(ProgressStatus.CHECKING_CACHE, "remote-cache")); }

Target:
public void failedCacheActionAsCacheMiss() throws Exception { ActionResult actionResult = ActionResult.newBuilder().setExitCode(1).build(); when(remoteCache.getCachedActionResult(any(ActionKey.class))).thenReturn(actionResult); CacheHandle entry = cache.lookup(simpleSpawn, simplePolicy); assertThat(entry.hasResult()).isFalse(); }
Source:
private static boolean hasLangAttribute(TagNode node) { return node.getAttribute("lang") != null || node.getAttribute("xml:lang") != null; }

Target:
private static boolean hasLangAttribute(TagNode node) { return node.hasProperty("lang") || node.hasProperty("xml:lang"); }
Source:
void ensureCameraEntityCreated() { if (!localPlayer.getCameraEntity().exists()) { ClientComponent clientComponent = localPlayer.getClientEntity().getComponent(ClientComponent.class); EntityBuilder builder = entityManager.newBuilder("engine:camera"); builder.setPersistent(false); clientComponent.camera = builder.build(); localPlayer.getClientEntity().saveComponent(clientComponent); mountCamera(); } }

Target:
private void ensureCameraEntityCreated() { if (!localPlayer.getCameraEntity().exists()) { ClientComponent clientComponent = localPlayer.getClientEntity().getComponent(ClientComponent.class); EntityBuilder builder = entityManager.newBuilder("engine:camera"); builder.setPersistent(false); clientComponent.camera = builder.build(); localPlayer.getClientEntity().saveComponent(clientComponent); } }
Source:
public void setPostId() { }

Target:
private void setPostId() { }
Source:
public int hashCode() { return Objects.hash(threadRecord); }

Target:
public int hashCode() { return threadRecord.hashCode(); }
Source:
static public FqInfo parse(String fqName) { ArrayList<String> packageParts = new ArrayList<String>(); ArrayList<String> classParts = new ArrayList<String>(); String[] parts = StringUtils.split(fqName, '.'); boolean inClassPart = false; for (String part : parts) { if (HaxeNameUtils.isValidClassName(part)) { classParts.add(part); inClassPart = true; } else if (HaxeNameUtils.isValidPackageName(part)) { if (inClassPart) { return null; } packageParts.add(part); } else { return null; } } if (classParts.size() > 2) { return null; } String className = ""; String fileName = ""; if (classParts.size() >= 1) { className = classParts.get(classParts.size() - 1); fileName = classParts.get(classParts.size() - ((classParts.size() >= 2) ? 2 : 1)); } return new FqInfo(Joiner.on('.').join(packageParts), fileName, className); }

Target:
static public FqInfo parse(String fqName) { ArrayList<String> packageParts = new ArrayList<String>(); ArrayList<String> classParts = new ArrayList<String>(); String[] parts = StringUtils.split(fqName, '.'); boolean inClassPart = false; for (String part : parts) { if (HaxeNameUtils.isValidClassName(part)) { classParts.add(part); inClassPart = true; } else if (HaxeNameUtils.isValidPackageName(part)) { if (inClassPart) { return null; } packageParts.add(part); } else { return null; } } if (classParts.isEmpty() || classParts.size() > 2) { return null; } String className = ""; String fileName = ""; if (classParts.size() >= 1) { className = classParts.get(classParts.size() - 1); fileName = classParts.get(classParts.size() - ((classParts.size() >= 2) ? 2 : 1)); } return new FqInfo(Joiner.on('.').join(packageParts), fileName, className); }
Source:
public List<ITmfEventField> getValue() { return new ArrayList<ITmfEventField>(Arrays.asList((ITmfEventField[])super.getValue())); }

Target:
public List<CtfTmfEventField> getValue() { return new ArrayList<CtfTmfEventField>(Arrays.asList((CtfTmfEventField[])super.getValue())); }
Source:
IndexValue(long size, Offset offset, long expiresAtMs) { this(size, offset, (byte) 0, expiresAtMs, offset.getOffset(), (int) Utils.Infinite_Time, (short) 0, (short) 0); }

Target:
IndexValue(long size, Offset offset, long expiresAtMs) { this(size, offset, FLAGS_DEFAULT_VALUE, expiresAtMs, offset.getOffset(), (int) Utils.Infinite_Time, SERVICE_CONTAINER_ID_DEFAULT_VALUE, SERVICE_CONTAINER_ID_DEFAULT_VALUE); }
Source:
static private void validateFilters(final VariantContext variantContext) { final Set<String> filters = variantContext.getFilters(); if (filters == null) { return; } for (String filter : filters) { if (!VALID_FILTER.matcher(filter).matches()) { throw new IllegalStateException("Filter '" + filter + "' contains an illegal character. It must conform to the regex ;'" + VALID_FILTER); } } }

Target:
private static void validateFilters(final VariantContext variantContext) { final Set<String> filters = variantContext.getFilters(); if (filters == null) { return; } for (String filter : filters) { if (!VALID_FILTER.matcher(filter).matches()) { throw new IllegalStateException("Filter '" + filter + "' contains an illegal character. It must conform to the regex ;'" + VALID_FILTER); } } }
Source:
public String[] registerOAuthConsumer() throws IdentityOAuthAdminException { String loggedInUser = CarbonContext.getThreadLocalCarbonContext().getUsername(); if (log.isDebugEnabled()) { log.debug("Adding a consumer secret for the logged in user " + loggedInUser); } String tenantUser = MultitenantUtils.getTenantAwareUsername(loggedInUser); int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); String userDomain = UserCoreUtil.extractDomainFromName(loggedInUser); OAuthAppDAO dao = new OAuthAppDAO(); return dao.addOAuthConsumer(UserCoreUtil.removeDomainFromName(tenantUser), tenantId, userDomain); }

Target:
public String[] registerOAuthConsumer() throws IdentityOAuthAdminException { String loggedInUser = CarbonContext.getThreadLocalCarbonContext().getUsername(); if (log.isDebugEnabled()) { log.debug("Adding a consumer secret for the logged in user " + loggedInUser); } String tenantUser = MultitenantUtils.getTenantAwareUsername(loggedInUser); int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); String userDomain = IdentityUtil.extractDomainFromName(loggedInUser); OAuthAppDAO dao = new OAuthAppDAO(); return dao.addOAuthConsumer(UserCoreUtil.removeDomainFromName(tenantUser), tenantId, userDomain); }
Source:
private DDiagramElement findByTargetName(final List<DDiagramElement> list, final String targetName) { DDiagramElement found = list.stream().filter(input->input.getTarget() instanceof ENamedElement && targetName.equals(((ENamedElement) input.getTarget()).getName())).findFirst().get(); assertNotNull("'" + targetName + "' element not found", found); return found; }

Target:
private DDiagramElement findByTargetName(final List<DDiagramElement> list, final String targetName) { DDiagramElement found = list.stream().filter(input->input.getTarget() instanceof ENamedElement && targetName.equals(((ENamedElement) input.getTarget()).getName())).findFirst().orElse(null); assertNotNull("'" + targetName + "' element not found", found); return found; }
Source:
private void doInitialize(RequestMonitor requestMonitor) { fCommandControl = getServicesTracker().getService(ICommandControlService.class); fProcesses = getServicesTracker().getService(IGDBProcesses.class); stackService = getServicesTracker().getService(IStack.class); fGdbcontrol = getServicesTracker().getService(IGDBControl.class); fCommandFactory = fGdbcontrol.getCommandFactory(); register(new String[] { IGDBSynchronizer.class.getName()}, new Hashtable<String, String>()); fCommandControl.addEventListener(this); getSession().addServiceEventListener(this, null); fCurrentThreadCtx = createExecContextFromThreadId(THREAD_ID_DEFAULT); fCurrentStackFrameCtx = createFrameContext(fCurrentThreadCtx, STACKFRAME_ID_DEFAULT); requestMonitor.done(); }

Target:
private void doInitialize(RequestMonitor requestMonitor) { fCommandControl = getServicesTracker().getService(ICommandControlService.class); fProcesses = getServicesTracker().getService(IGDBProcesses.class); fStackService = getServicesTracker().getService(MIStack.class); fGdbcontrol = getServicesTracker().getService(IGDBControl.class); fCommandFactory = fGdbcontrol.getCommandFactory(); register(new String[] { IGDBSynchronizer.class.getName()}, new Hashtable<String, String>()); fCommandControl.addEventListener(this); getSession().addServiceEventListener(this, null); fCurrentThreadCtx = createExecContextFromThreadId(THREAD_ID_DEFAULT); fCurrentStackFrameCtx = createFrameContext(fCurrentThreadCtx, STACKFRAME_ID_DEFAULT); requestMonitor.done(); }
Source:
private ThreadPoolBulkheadRegistry createBulkheadRegistry( ThreadPoolBulkheadConfigurationProperties threadPoolBulkheadConfigurationProperties, RegistryEventConsumer<ThreadPoolBulkhead> threadPoolBulkheadRegistryEventConsumer, CompositeCustomizer<ThreadPoolBulkheadConfigCustomizer> compositeThreadPoolBulkheadCustomizer) { Map<String, ThreadPoolBulkheadConfig> configs = threadPoolBulkheadConfigurationProperties .getConfigs() .entrySet() .stream() .collect(Collectors.toMap(Map.Entry::getKey, entry -> threadPoolBulkheadConfigurationProperties .createThreadPoolBulkheadConfig(entry.getValue(), compositeThreadPoolBulkheadCustomizer, entry.getKey()))); return ThreadPoolBulkheadRegistry.of(configs, threadPoolBulkheadRegistryEventConsumer, threadPoolBulkheadConfigurationProperties.getTags()); }

Target:
private ThreadPoolBulkheadRegistry createBulkheadRegistry( ThreadPoolBulkheadConfigurationProperties threadPoolBulkheadConfigurationProperties, RegistryEventConsumer<ThreadPoolBulkhead> threadPoolBulkheadRegistryEventConsumer, CompositeCustomizer<ThreadPoolBulkheadConfigCustomizer> compositeThreadPoolBulkheadCustomizer) { Map<String, ThreadPoolBulkheadConfig> configs = threadPoolBulkheadConfigurationProperties .getConfigs() .entrySet() .stream() .collect(Collectors.toMap(Map.Entry::getKey, entry -> threadPoolBulkheadConfigurationProperties .createThreadPoolBulkheadConfig(entry.getValue(), compositeThreadPoolBulkheadCustomizer, entry.getKey()))); return ThreadPoolBulkheadRegistry.of(configs, threadPoolBulkheadRegistryEventConsumer, Map.copyOf(threadPoolBulkheadConfigurationProperties.getTags())); }
Source:
public String toString() { return "DroolsConstraint(" + constraintPackage + " " + constraintName + ") in " + fromStreamList.size() + " from() stream(s)"; }

Target:
public String toString() { return "DroolsConstraint(" + getConstraintId() + ") in " + fromStreamList.size() + " from() stream(s)"; }
Source:
public Subject getSubject() { return subject; }

Target:
public Subject getSubject() { return this.subject; }
Source:
public void onLoad(Screen screen) { String projectName = URL.decode(screen.getToken(1)); String fileName = URL.decode(screen.getToken(2)); screen.show(new XDocScreen(projectName, "HEAD", fileName)); screen.setWindowTitle(getFileName(fileName)); }

Target:
public void onLoad(Screen screen) { String projectName = URL.decode(screen.getToken(1)); String path = URL.decode(screen.getToken(2)); screen.show(new XDocScreen(projectName, "HEAD", path)); screen.setWindowTitle(getFileName(path)); }
Source:
private Collection<LoadBalancer> getAllLoadBalancers(Collection<BaragonGroup> baragonGroups) { Set<String> trafficSources = new HashSet<>(); for (BaragonGroup baragonGroup : baragonGroups) { for (TrafficSource trafficSource : baragonGroup.getSources()) { if (trafficSource.getType() == TrafficSourceType.APPLICATION) { trafficSources.add(trafficSource.getName()); } } } Collection<LoadBalancer> loadBalancers = new HashSet<>(); DescribeLoadBalancersRequest loadBalancersRequest = new DescribeLoadBalancersRequest() .withNames(trafficSources); DescribeLoadBalancersResult result = elbClient.describeLoadBalancers(loadBalancersRequest); String nextPage = result.getNextMarker(); loadBalancers.addAll(result.getLoadBalancers()); while (! nextPage.isEmpty()) { loadBalancersRequest = new DescribeLoadBalancersRequest() .withMarker(nextPage); result = elbClient.describeLoadBalancers(loadBalancersRequest); nextPage = result.getNextMarker(); loadBalancers.addAll(result.getLoadBalancers()); } return loadBalancers; }

Target:
private Collection<LoadBalancer> getAllLoadBalancers(Collection<BaragonGroup> baragonGroups) { Set<String> trafficSources = new HashSet<>(); for (BaragonGroup baragonGroup : baragonGroups) { for (TrafficSource trafficSource : baragonGroup.getSources()) { if (trafficSource.getType() == TrafficSourceType.APPLICATION) { trafficSources.add(trafficSource.getName()); } } } Collection<LoadBalancer> loadBalancers = new HashSet<>(); DescribeLoadBalancersRequest loadBalancersRequest = new DescribeLoadBalancersRequest() .withNames(trafficSources); DescribeLoadBalancersResult result = elbClient.describeLoadBalancers(loadBalancersRequest); String nextPage = result.getNextMarker(); loadBalancers.addAll(result.getLoadBalancers()); while (!Strings.isNullOrEmpty(nextPage)) { loadBalancersRequest = new DescribeLoadBalancersRequest() .withMarker(nextPage); result = elbClient.describeLoadBalancers(loadBalancersRequest); nextPage = result.getNextMarker(); loadBalancers.addAll(result.getLoadBalancers()); } return loadBalancers; }
Source:
protected Statement withInterruptIsolation(final Statement statement) { return new Statement() { @Override public void evaluate() throws Throwable { try { statement.evaluate(); } finally { Thread.interrupted(); } } }; }

Target:
protected final Statement withInterruptIsolation(final Statement statement) { return new Statement() { @Override public void evaluate() throws Throwable { try { statement.evaluate(); } finally { Thread.interrupted(); } } }; }
Source:
private boolean shouldReconnect(int code) { return !(code >= 4000 && code <= 4099); }

Target:
private boolean shouldReconnect(int code) { return code < 4000 || code >= 4100; }
Source:
public void testCleanupSequence() throws SQLException { Connection connection = dbsvc.getConnection(); connection.prepareStatement("TRUNCATE TABLE " + tableName).execute(); String emitterPid = "emitter"; List<WireRecord> wireRecords = new ArrayList<WireRecord>(); Map<String, TypedValue<?>> recordProps = new HashMap<String, TypedValue<?>>(); TypedValue<?> val = new StringValue("val"); recordProps.put("key", val); WireRecord record = new WireRecord(recordProps); wireRecords.add(record); WireEnvelope wireEvelope = new WireEnvelope(emitterPid, wireRecords); for (int i = 0; i < maxSize; i++) { dbstore.onWireReceive(wireEvelope); try { Thread.sleep(1); } catch (InterruptedException e) { } } try { Thread.sleep(500); } catch (InterruptedException e) { } ResultSet resultSet = connection.prepareStatement("SELECT count(*) FROM " + tableName).executeQuery(); resultSet.next(); int count = resultSet.getInt(1); assertEquals("Unexpected number of records", maxSize, count); for (int i = 0; i < 5; i++) { dbstore.onWireReceive(wireEvelope); try { Thread.sleep(1); } catch (InterruptedException e) { } } try { Thread.sleep(500); } catch (InterruptedException e) { } resultSet = connection.prepareStatement("SELECT count(*) FROM " + tableName).executeQuery(); resultSet.next(); count = resultSet.getInt(1); assertEquals("Unexpected number of records", cleanupSize + 5, count); }

Target:
public void testCleanupSequence() throws SQLException { Connection connection = dbsvc.getConnection(); connection.prepareStatement("TRUNCATE TABLE " + tableName).execute(); String emitterPid = "emitter"; List<WireRecord> wireRecords = new ArrayList<WireRecord>(); Map<String, TypedValue<?>> recordProps = new HashMap<String, TypedValue<?>>(); TypedValue<?> val = new StringValue("val"); recordProps.put("key", val); WireRecord record = new WireRecord(recordProps); wireRecords.add(record); WireEnvelope wireEvelope = new WireEnvelope(emitterPid, wireRecords); for (int i = 0; i < maxSize; i++) { dbstore.onWireReceive(wireEvelope); } try { Thread.sleep(500); } catch (InterruptedException e) { } ResultSet resultSet = connection.prepareStatement("SELECT count(*) FROM " + tableName).executeQuery(); resultSet.next(); int count = resultSet.getInt(1); assertEquals("Unexpected number of records", maxSize, count); for (int i = 0; i < 5; i++) { dbstore.onWireReceive(wireEvelope); } try { Thread.sleep(500); } catch (InterruptedException e) { } resultSet = connection.prepareStatement("SELECT count(*) FROM " + tableName).executeQuery(); resultSet.next(); count = resultSet.getInt(1); assertEquals("Unexpected number of records", cleanupSize + 5, count); }
Source:
protected CatalogStorage(String uriTemplate, Configuration conf) throws URISyntaxException { this(uriTemplate); setConf(conf); verifyAndUpdateConfiguration(conf); }

Target:
protected CatalogStorage(String uriTemplate, Configuration conf) throws URISyntaxException { if (uriTemplate == null || uriTemplate.length() == 0) { throw new IllegalArgumentException("URI template cannot be null or empty"); } final String processed = uriTemplate.replaceAll(DOLLAR_EXPR_START_REGEX, DOLLAR_EXPR_START_NORMALIZED) .replaceAll("}", EXPR_CLOSE_NORMALIZED); URI uri = new URI(processed); this.catalogUrl = uri.getScheme() + "://" + uri.getAuthority(); verifyAndUpdateConfiguration(conf); parseUriTemplate(uri); }