auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Status insert(String tableName, String key, HashMap<String, ByteIterator> values) { try { int numFields = values.size(); OrderedFieldInfo fieldInfo = getFieldInfo(values); StatementType type = new StatementType(StatementType.Type.INSERT, tableName, numFields, fieldInfo.getFieldKeys(), getShardIndexByKey(key)); PreparedStatement insertStatement = cachedStatements.get(type); if (insertStatement == null) { insertStatement = createAndCacheInsertStatement(type, key); } insertStatement.setString(1, key); int index = 2; for (String value: fieldInfo.getFieldValues()) { insertStatement.setString(index++, value); } int result; if (batchSize > 0) { insertStatement.addBatch(); if (++numRowsInBatch % batchSize == 0) { int[] results = insertStatement.executeBatch(); for (int r : results) { if (r != 1) { return Status.ERROR; } } } return Status.OK; } else { result = insertStatement.executeUpdate(); } if (result == 1) { return Status.OK; } return Status.UNEXPECTED_STATE; } catch (SQLException e) { System.err.println("Error in processing insert to table: " + tableName + e); return Status.ERROR; } }

Target:
public Status insert(String tableName, String key, HashMap<String, ByteIterator> values) { try { int numFields = values.size(); OrderedFieldInfo fieldInfo = getFieldInfo(values); StatementType type = new StatementType(StatementType.Type.INSERT, tableName, numFields, fieldInfo.getFieldKeys(), getShardIndexByKey(key)); PreparedStatement insertStatement = cachedStatements.get(type); if (insertStatement == null) { insertStatement = createAndCacheInsertStatement(type, key); } insertStatement.setString(1, key); int index = 2; for (String value: fieldInfo.getFieldValues()) { insertStatement.setString(index++, value); } int result; if (batchSize > 0) { insertStatement.addBatch(); if (++numRowsInBatch % batchSize == 0) { int[] results = insertStatement.executeBatch(); for (int r : results) { if (r != 1) { return Status.ERROR; } } return Status.OK; } return Status.BATCHED_OK; } else { result = insertStatement.executeUpdate(); } if (result == 1) { return Status.OK; } return Status.UNEXPECTED_STATE; } catch (SQLException e) { System.err.println("Error in processing insert to table: " + tableName + e); return Status.ERROR; } }
Source:
T convert(@Nonnull JarFile jarFile, @Nonnull JarEntry entry) throws IOException; } private <T> T storeAndConvert(JarFile jarFile, File file, String resourceName, Converter<T> converter) throws IOException { if (jarFile == null) { if (file.exists()) { jarFile = new JarFile(file); jarFiles.put(file, jarFile); } else { return null; } jarFile = (JarFile) jarFiles.get(file); } JarEntry entry = jarFile.getJarEntry(resourceName); if (entry == null) return null; return converter.convert(jarFile, entry); }

Target:
T convert(@Nonnull JarFile jarFile, @Nonnull JarEntry entry) throws IOException; } @CheckForNull private <T> T storeAndConvert(JarFile jarFile, File file, String resourceName, Converter<T> converter) throws IOException { if (jarFile == null) { if (file.exists()) { jarFile = new JarFile(file); jarFiles.put(file, jarFile); } else { return null; } jarFile = (JarFile) jarFiles.get(file); } JarEntry entry = jarFile.getJarEntry(resourceName); if (entry == null) return null; return converter.convert(jarFile, entry); }
Source:
public void close() { if (loggerThread == null) { return; } try { run = false; synchronized (sync) { sync.notify(); } loggerThread.join(0); } catch (InterruptedException e) { logger.log(Level.WARNING, "logger thread interrupted"); } }

Target:
public void close() { if (loggerThread == null) { return; } try { run = false; synchronized (sync) { sync.notify(); } loggerThread.join(); } catch (InterruptedException e) { logger.log(Level.WARNING, "logger thread interrupted"); } }
Source:
private boolean updateCategory(PopulatorContext context,CourseCategoryDAO category, String assessmentunitCode) throws IOException { boolean created = false; if (null == category.getCategoryId() && "".equals(category.getCategoryId())) { logMs(context, "Category ["+category.getCategoryType()+":"+category.getCategoryName()+"] ignored - invalid identifier"); return created; } if (null != dao) { CourseCategoryDAO categoryDao = dao.findCourseCategory(category.getCategoryId()); if (categoryDao == null) { categoryDao = category; created = true; } CourseGroupDAO courseDao = dao.findCourseGroupById(assessmentunitCode); categoryDao.getGroups().add(courseDao); dao.save(categoryDao); } return created; }

Target:
private boolean updateCategory(PopulatorContext context,CourseCategoryDAO category, String assessmentunitCode) throws IOException { boolean created = false; if (null == category.getCategoryId() && category.getCategoryId().isEmpty()) { logMs(context, "Category ["+category.getCategoryType()+":"+category.getCategoryName()+"] ignored - invalid identifier"); return created; } if (null != dao) { CourseCategoryDAO categoryDao = dao.findCourseCategory(category.getCategoryId()); if (categoryDao == null) { categoryDao = category; created = true; } CourseGroupDAO courseDao = dao.findCourseGroupById(assessmentunitCode); categoryDao.getGroups().add(courseDao); dao.save(categoryDao); } return created; }
Source:
getResponsesSortedByGiverRecipientQuestion(boolean sortByTeam) { if (sortByTeam) { responses.sort(compareByTeamGiverRecipientQuestion); } else { responses.sort(compareByGiverRecipientQuestion); } Map<String, Map<String, List<FeedbackResponseAttributes>>> sortedMap = new LinkedHashMap<>(); for (FeedbackResponseAttributes response : responses) { String giverEmail = response.giver; Map<String, List<FeedbackResponseAttributes>> responsesFromOneGiver = sortedMap.computeIfAbsent(giverEmail, (String key) -> new LinkedHashMap<>()); String recipientEmail = response.recipient; responsesFromOneGiver.computeIfAbsent(recipientEmail, (String key) -> new ArrayList<>()) .add(response); } return sortedMap; }

Target:
getResponsesSortedByGiverRecipientQuestion(boolean sortByTeam) { if (sortByTeam) { responses.sort(compareByTeamGiverRecipientQuestion); } else { responses.sort(compareByGiverRecipientQuestion); } Map<String, Map<String, List<FeedbackResponseAttributes>>> sortedMap = new LinkedHashMap<>(); for (FeedbackResponseAttributes response : responses) { String giverEmail = response.giver; Map<String, List<FeedbackResponseAttributes>> responsesFromOneGiver = sortedMap.computeIfAbsent(giverEmail, key -> new LinkedHashMap<>()); String recipientEmail = response.recipient; responsesFromOneGiver.computeIfAbsent(recipientEmail, key -> new ArrayList<>()) .add(response); } return sortedMap; }
Source:
protected void onResume() { Intent intent = getIntent(); DBNote note = (DBNote) intent.getSerializableExtra(PARAM_NOTE); if ((note.getId()) != fragment.getNote().getId()) { db.updateNoteAndSync(fragment.getNote(), fragment.getNote().getContent(), null); originalNote = note; createEditFragment(note); } super.onResume(); }

Target:
protected void onResume() { super.onResume(); Intent intent = getIntent(); DBNote note = (DBNote) intent.getSerializableExtra(PARAM_NOTE); if ((note.getId()) != fragment.getNote().getId()) { originalNote = note; createEditFragment(note); } }
Source:
public void assertState(ModelClass instance, Class<?> state) { Class<?> currentState = ((SeqDiagModelClassRuntime) ((DefaultSeqDiagRuntime) getModelRuntime()) .getRuntimeOf(instance)).getCurrentState(); if (!currentState.equals(state)) { root.getExecutor().addError( new ModelStateAssertError(state.getCanonicalName(), currentState.getClass().getCanonicalName())); } }

Target:
public void assertState(ModelClass instance, Class<?> state) { Class<?> currentState = getModelRuntime().getRuntimeOf(instance).getCurrentState(); if (!currentState.equals(state)) { root.getExecutor() .addError(new ModelStateAssertError(state.getCanonicalName(), currentState.getCanonicalName())); } }
Source:
public synchronized void init(FilterConfig config) throws ServletException { super.init(config); setDefaultFields(config); for (GitilesView.Type type : GitilesView.Type.values()) { if (!servlets.containsKey(type) && type != GitilesView.Type.SHOW) { servlets.put(type, getDefaultHandler(type)); } } Filter repositoryFilter = new RepositoryFilter(resolver); Filter viewFilter = new ViewFilter(accessFactory, urls, visibilityCache); Filter dispatchFilter = new DispatchFilter(filters, servlets); ServletBinder root = serveRegex(ROOT_REGEX).through(viewFilter); if (gitwebRedirect != null) { root.through(gitwebRedirect); } root.through(dispatchFilter); serveRegex(REPO_REGEX) .through(repositoryFilter) .through(viewFilter) .through(dispatchFilter); serveRegex(REPO_PATH_REGEX) .through(repositoryFilter) .through(viewFilter) .through(dispatchFilter); initialized = true; }

Target:
public synchronized void init(FilterConfig config) throws ServletException { super.init(config); setDefaultFields(config); for (GitilesView.Type type : GitilesView.Type.values()) { if (!servlets.containsKey(type)) { servlets.put(type, getDefaultHandler(type)); } } Filter repositoryFilter = new RepositoryFilter(resolver); Filter viewFilter = new ViewFilter(accessFactory, urls, visibilityCache); Filter dispatchFilter = new DispatchFilter(filters, servlets); ServletBinder root = serveRegex(ROOT_REGEX).through(viewFilter); if (gitwebRedirect != null) { root.through(gitwebRedirect); } root.through(dispatchFilter); serveRegex(REPO_REGEX) .through(repositoryFilter) .through(viewFilter) .through(dispatchFilter); serveRegex(REPO_PATH_REGEX) .through(repositoryFilter) .through(viewFilter) .through(dispatchFilter); initialized = true; }
Source:
protected void doCatch(final Throwable throwable) { final Throwable t = throwable.getCause() != null ? throwable.getCause() : throwable; super.doCatch(t); final String message = "Error while querying REST resource " + getClass().getName() + " message: " + t.getMessage(); ErrorMessage errorMessage = new ErrorMessage(t); getResponse().setStatus(getStatus(), message); if (t instanceof IllegalArgumentException || t instanceof JsonParseException) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "***" + message); } getResponse().setStatus(Status.CLIENT_ERROR_BAD_REQUEST); } else if (t instanceof FileNotFoundException) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "***" + message); } getResponse().setStatus(Status.CLIENT_ERROR_NOT_FOUND); errorMessage.setMessage("File Not Found"); } else if (t instanceof NotFoundException) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "***" + message); } getResponse().setStatus(Status.CLIENT_ERROR_NOT_FOUND); errorMessage.setMessage("File Not Found"); } else { LOGGER.log(Level.SEVERE, t.getMessage(), t); } getResponse().setEntity(errorMessage.toEntity()); }

Target:
protected void doCatch(final Throwable throwable) { final Throwable t = throwable.getCause() != null ? throwable.getCause() : throwable; super.doCatch(t); final String message = "Error while querying REST resource " + getClass().getName() + " message: " + t.getMessage(); ErrorMessage errorMessage = new ErrorMessage(t); getResponse().setStatus(getStatus(), message); if (t instanceof IllegalArgumentException || t instanceof JsonParseException) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "***" + message); } getResponse().setStatus(Status.CLIENT_ERROR_BAD_REQUEST); } else if (t instanceof FileNotFoundException) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "***" + message); } getResponse().setStatus(Status.CLIENT_ERROR_NOT_FOUND); errorMessage.setMessage("File Not Found"); } else if (t instanceof NotFoundException) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "***" + message); } getResponse().setStatus(Status.CLIENT_ERROR_NOT_FOUND); } else { LOGGER.log(Level.SEVERE, t.getMessage(), t); } getResponse().setEntity(errorMessage.toEntity()); }
Source:
public void createGroupUnionForIndirectRelationship() throws Exception { System.out.println(CLASS_NAME + "createGroupUnionForIndirectRelationship"); Vo vo = setUpVo(); groupsManagerBl.createGroup(sess, vo, group2); groupsManagerBl.createGroup(sess, group2, group3); groupsManagerBl.createGroup(sess, group3, group4); groupsManagerBl.createGroupUnion(sess, group4, group2, false); }

Target:
public void createGroupUnionForIndirectRelationship() throws Exception { System.out.println(CLASS_NAME + "createGroupUnionForIndirectRelationship"); Vo vo = setUpVo(); groupsManagerBl.createGroup(sess, vo, group2); groupsManagerBl.createGroup(sess, group2, group3); groupsManagerBl.createGroup(sess, group3, group4); groupsManagerBl.createGroupUnion(sess, group2, group4, false); }
Source:
public void test() { connect(); click(jq("$listbox1").toWidget().firstChild()); waitResponse(); Assert.assertTrue(jq("@notification").exists()); waitResponse(); click(jq("body")); waitResponse(); click(jq("$listbox2").toWidget().firstChild()); waitResponse(); Assert.assertTrue(jq("@notification").exists()); waitResponse(); }

Target:
public void test() { connect(); click(jq("$listbox1").toWidget().firstChild()); waitResponse(); Assert.assertTrue(jq("@notification").exists()); waitResponse(); click(jq("body")); waitResponse(); click(jq("$listbox2").toWidget().firstChild()); waitResponse(); Assert.assertTrue(jq("@notification").exists()); }
Source:
private void assertNeverErrorObserver(Observer<String> observer) { verify(observer, never()).onNext("one"); verify(observer, never()).onNext("two"); verify(observer, never()).onNext("three"); verify(observer, never()).onNext("four"); verify(observer, times(1)).onError(any(Throwable.class)); verify(observer, never()).onCompleted(); }

Target:
private void assertNeverErrorObserver(Observer<String> observer) { verify(observer, never()).onNext("one"); verify(observer, never()).onNext("two"); verify(observer, never()).onNext("three"); verify(observer, never()).onNext("four"); verify(observer, times(1)).onError(any(Throwable.class)); verify(observer, never()).onCompleted(); verifyNoMoreInteractions(observer); }
Source:
public void start() { if (Boolean.TRUE.equals(NO_START.get())) { LOG.trace("Ignoring maybeStart() as NO_START is false"); return; } if (!isStarted() && !isStarting()) { try { StopWatch watch = new StopWatch(); super.start(); LOG.debug("start() took millis", watch.stop()); } catch (Exception e) { throw wrapRuntimeCamelException(e); } } else { LOG.trace("Ignoring maybeStart() as Apache Camel is already started"); } }

Target:
public void start() { if (Boolean.TRUE.equals(NO_START.get())) { LOG.trace("Ignoring start() as NO_START is false"); return; } if (!isStarted() && !isStarting()) { try { StopWatch watch = new StopWatch(); super.start(); LOG.debug("start() took millis", watch.stop()); } catch (Exception e) { throw wrapRuntimeCamelException(e); } } else { LOG.trace("Ignoring start() as Camel is already started"); } }
Source:
public String toString() { return String.format("%s, nextNode=[%s]", super.toString(), next); }

Target:
@Override public String toString() { return String.format("%s, nextNode=[%s]", super.toString(), next); }
Source:
public void pollDoesNotReturnNullBeforeTimeoutUsingTransactionContext() throws InterruptedException { assertThat(inQueue.getSize(), is(0)); long timeout = 300; long timeBeforePoll = currentTimeMillis(); Serializable polledValue = persistentTransactionContext.poll(inQueue, timeout); long timeAfterPoll = currentTimeMillis(); assertThat(polledValue, nullValue()); assertThat(timeAfterPoll - timeBeforePoll, greaterThanOrEqualTo(timeout)); }

Target:
public void pollDoesNotReturnNullBeforeTimeoutUsingTransactionContext() throws InterruptedException { assertThat(inQueue.getSize(), is(0)); long timeout = 300; long timeBeforePoll = currentTimeMillis(); Serializable polledValue = persistentTransactionContext.poll(inQueue, timeout); long timeAfterPoll = currentTimeMillis(); assertThat(polledValue, nullValue()); assertThat((double) (timeAfterPoll - timeBeforePoll), anyOf(greaterThanOrEqualTo((double) timeout), closeTo((double) timeout, 20))); }
Source:
private boolean areSameZone( ZoneId thisZone, ZoneId thatZone ) { boolean thisIsOffset = thisZone instanceof ZoneOffset; boolean thatIsOffset = thatZone instanceof ZoneOffset; if ( thisIsOffset && thatIsOffset ) { return thisZone.equals( thatZone ); } else if ( !thisIsOffset && !thatIsOffset ) { return TimeZones.map( thisZone.getId() ) == TimeZones.map( thatZone.getId() ); } return false; }

Target:
private boolean areSameZone( ZoneId thisZone, ZoneId thatZone ) { boolean thisIsOffset = thisZone instanceof ZoneOffset; boolean thatIsOffset = thatZone instanceof ZoneOffset; return areSameZone( thisZone, thatZone, thisIsOffset, thatIsOffset ); }
Source:
@Test public void testPutIntoBackgroundWithoutRestore() { final long msStarted = System.currentTimeMillis(); driver.runAppInBackground(-1); assertThat(System.currentTimeMillis() - msStarted, lessThan(1000L)); }

Target:
@Test public void testPutIntoBackgroundWithoutRestore() { assertThat(driver.findElementsById("IntegerA"), is(not(empty()))); driver.runAppInBackground(-1); assertThat(driver.findElementsById("IntegerA"), is(empty())); }
Source:
private File findDockerFileFile(Logger log) { if (dockerFile != null) { File dFile = new File(dockerFile); if (dockerFileDir == null) { return dFile; } else { if (dFile.isAbsolute() || !EnvUtil.isValidWindowsFileName(dockerFile)) { throw new IllegalArgumentException("<dockerFile> can not be absolute path if <dockerFileDir> also set."); } return new File(dockerFileDir, dockerFile); } } if (dockerFileDir != null) { return new File(dockerFileDir, "Dockerfile"); } if (dockerArchive == null) { String deprecatedDockerFileDir = getAssemblyConfiguration() != null ? getAssemblyConfiguration().getDockerFileDir() : null; if (deprecatedDockerFileDir != null) { log.warn("<dockerFileDir> in the <assembly> section of a <build> configuration is deprecated"); log.warn("Please use <dockerFileDir> or <dockerFile> directly within the <build> configuration instead"); return new File(deprecatedDockerFileDir,"Dockerfile"); } } return null; }

Target:
private File findDockerFileFile(Logger log) { if (dockerFile != null) { File dFile = new File(dockerFile); if (dockerFileDir == null) { return dFile; } else { if (dFile.isAbsolute()) { throw new IllegalArgumentException("<dockerFile> can not be absolute path if <dockerFileDir> also set."); } if (EnvUtil.isWindows() && !EnvUtil.isValidWindowsFileName(dockerFile)) { throw new IllegalArgumentException(String.format("Invalid Windows file name %s for <dockerFile>", dockerFile)); } return new File(dockerFileDir, dockerFile); } } if (dockerFileDir != null) { return new File(dockerFileDir, "Dockerfile"); } if (dockerArchive == null) { String deprecatedDockerFileDir = getAssemblyConfiguration() != null ? getAssemblyConfiguration().getDockerFileDir() : null; if (deprecatedDockerFileDir != null) { log.warn("<dockerFileDir> in the <assembly> section of a <build> configuration is deprecated"); log.warn("Please use <dockerFileDir> or <dockerFile> directly within the <build> configuration instead"); return new File(deprecatedDockerFileDir,"Dockerfile"); } } return null; }
Source:
protected Map<K, V> fromString(String s) { final String[] buckets = s.split(Pattern.quote(delimiter)); final Map<K, V> resultMap = newHashMap(); for (String bucket : buckets) { saveConvertedBucket(resultMap, bucket); } Ints.stringConverter(); return resultMap; }

Target:
protected Map<K, V> fromString(String s) { final String escapedString = escaper.escape(s); final String[] buckets = escapedString.split(bucketPattern); final Map<K, V> resultMap = newHashMap(); for (String bucket : buckets) { final Map.Entry<K, V> convertedBucket = convert(bucket); resultMap.put(convertedBucket.getKey(), convertedBucket.getValue()); } return resultMap; }
Source:
public void onInitialize(MatchingFrame frame, ISearchContext context) { Iterable<? extends Object> values = context.getRuntimeContext().enumerateValues(type, null); it = Iterables.filter(values, EObject.class).iterator(); }

Target:
public void onInitialize(MatchingFrame frame, ISearchContext context) { Iterable<? extends Object> values = context.getRuntimeContext().enumerateValues(type, null); it = (Iterator<EObject>) values.iterator(); }
Source:
public List<String> findMissingUsers(Set<DbUser> usersToAdd) { List<String> missingUsers = new ArrayList<>(); usersToAdd.forEach(dbUser -> { DbUser userToAdd = dbUserDao.getByUsernameAndDomain(dbUser.getLoginName(), dbUser.getDomain()); if (userToAdd == null) { missingUsers.add(String.format("%s@%s", dbUser.getLoginName(), dbUser.getDomain())); } }); return missingUsers; }

Target:
public List<DbUser> findMissingUsers(Set<DbUser> usersToAdd) { List<DbUser> missingUsers = new ArrayList<>(); usersToAdd.forEach(dbUser -> { DbUser userToAdd = getDbUserDao().getByUsernameAndDomain(dbUser.getLoginName(), dbUser.getDomain()); if (userToAdd == null) { missingUsers.add(dbUser); } }); if (!missingUsers.isEmpty()) { log.warn("Missing users: {}", missingUsers .stream() .map(dbUser -> String.format("%s@%s", dbUser.getName(), dbUser.getDomain())) .collect(Collectors.joining(", "))); } return missingUsers; }
Source:
public void checkMergeConflictingTreesWithoutIndex() throws Exception { Git git = Git.wrap(db); writeTrashFile("d/1", "orig"); git.add().addFilepattern("d/1").call(); RevCommit first = git.commit().setMessage("added d/1").call(); writeTrashFile("d/1", "master"); RevCommit masterCommit = git.commit().setAll(true) .setMessage("modified d/1 on master").call(); git.checkout().setCreateBranch(true).setStartPoint(first) .setName("side").call(); writeTrashFile("d/1", "side"); git.commit().setAll(true).setMessage("modified d/1 on side").call(); git.rm().addFilepattern("d/1").call(); git.rm().addFilepattern("d").call(); MergeResult mergeRes = git.merge().include(masterCommit).call(); assertEquals(mergeRes.getMergeStatus(), MergeStatus.CONFLICTING); assertEquals( "[d/1, mode:100644, stage:1, content:orig][d/1, mode:100644, stage:2, content:side][d/1, mode:100644, stage:3, content:master]", indexState(CONTENT)); }

Target:
public void checkMergeConflictingTreesWithoutIndex() throws Exception { Git git = Git.wrap(db); writeTrashFile("d/1", "orig"); git.add().addFilepattern("d/1").call(); RevCommit first = git.commit().setMessage("added d/1").call(); writeTrashFile("d/1", "master"); RevCommit masterCommit = git.commit().setAll(true) .setMessage("modified d/1 on master").call(); git.checkout().setCreateBranch(true).setStartPoint(first) .setName("side").call(); writeTrashFile("d/1", "side"); git.commit().setAll(true).setMessage("modified d/1 on side").call(); git.rm().addFilepattern("d/1").call(); git.rm().addFilepattern("d").call(); MergeResult mergeRes = git.merge().include(masterCommit).call(); assertEquals(MergeStatus.CONFLICTING, mergeRes.getMergeStatus()); assertEquals( "[d/1, mode:100644, stage:1, content:orig][d/1, mode:100644, stage:2, content:side][d/1, mode:100644, stage:3, content:master]", indexState(CONTENT)); }
Source:
public void testTTLOnOutputTable() throws SQLException, IOException { String mockString = "mock_value"; byte[] mockStringBytes = Strings.toByteArray(mockString); ManualEnvironmentEdge customClock = new ManualEnvironmentEdge(); customClock.setValue(1); EnvironmentEdgeManager.injectEdge(customClock); try (Connection conn = DriverManager.getConnection(getUrl())) { IndexVerificationOutputRepository outputRepository = new IndexVerificationOutputRepository(mockStringBytes, conn); outputRepository.createOutputTable(conn); TestUtil.assertTableHasTtl(conn, TableName.valueOf(OUTPUT_TABLE_NAME_BYTES), DEFAULT_LOG_TTL); outputRepository.logToIndexToolOutputTable(mockStringBytes, mockStringBytes, 1, 2, mockString, mockStringBytes, mockStringBytes, EnvironmentEdgeManager.currentTimeMillis(), mockStringBytes, true); customClock.incrementValue(1000*(DEFAULT_LOG_TTL+5)); EnvironmentEdgeManager.injectEdge(customClock); HTable hTable = new HTable(config, OUTPUT_TABLE_NAME_BYTES); int count = TestUtil.getRowCount(hTable, false); Assert.assertEquals(0, count); } }

Target:
public void testTTLOnOutputTable() throws SQLException, IOException { String mockString = "mock_value"; byte[] mockStringBytes = Strings.toByteArray(mockString); ManualEnvironmentEdge customClock = new ManualEnvironmentEdge(); customClock.setValue(1); EnvironmentEdgeManager.injectEdge(customClock); try (Connection conn = DriverManager.getConnection(getUrl())) { HTable hTable = new HTable(config, OUTPUT_TABLE_NAME_BYTES); IndexVerificationOutputRepository outputRepository = new IndexVerificationOutputRepository(mockStringBytes, conn); outputRepository.createOutputTable(conn); TestUtil.assertTableHasTtl(conn, TableName.valueOf(OUTPUT_TABLE_NAME_BYTES), DEFAULT_LOG_TTL); outputRepository.logToIndexToolOutputTable(mockStringBytes, mockStringBytes, 1, 2, mockString, mockStringBytes, mockStringBytes, EnvironmentEdgeManager.currentTimeMillis(), mockStringBytes, true); Assert.assertEquals(1, TestUtil.getRowCount(hTable, false)); customClock.incrementValue(1000*(DEFAULT_LOG_TTL+5)); EnvironmentEdgeManager.injectEdge(customClock); int count = TestUtil.getRowCount(hTable, false); Assert.assertEquals(0, count); } }
Source:
private Integer findYearOwnedBy(HazelcastInstance hz) { int ownedKey = 0; Member localMember = hz.getCluster().getLocalMember(); for (int i = 0; i < BOOK_COUNT; i++) { if (localMember.equals(hz.getPartitionService().getPartition(i).getOwner())) { ownedKey = i; break; } } return 1800 + ownedKey % 200; }

Target:
private Integer findYearOwnedBy(HazelcastInstance hz) { int ownedKey = 0; Member localMember = hz.getCluster().getLocalMember(); for (int i = 0; i < BOOK_COUNT; i++) { if (localMember.equals(hz.getPartitionService().getPartition(i).getOwner())) { ownedKey = i; break; } } return getYearByKey(ownedKey); }
Source:
private void updatePlaybackSpeedButton() { if(butPlaybackSpeed == null) { return; } if (controller == null || !(this instanceof AudioplayerActivity)) { butPlaybackSpeed.setVisibility(View.GONE); return; } updatePlaybackSpeedButtonText(); ViewCompat.setAlpha(butPlaybackSpeed, controller.canSetPlaybackSpeed() ? 1.0f : 0.5f); butPlaybackSpeed.setVisibility(View.VISIBLE); }

Target:
protected void updatePlaybackSpeedButton() { }
Source:
private static void initUnSecureSSL() throws IOException { if ( sslSocketFactory == null) { final TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { public void checkClientTrusted( final X509Certificate[] chain, final String authType ) { } public void checkServerTrusted( final X509Certificate[] chain, final String authType ) { } public X509Certificate[] getAcceptedIssuers() { return null; } } }; final SSLContext sslContext; try { sslContext = SSLContext.getInstance("SSL"); sslContext.init( null, trustAllCerts, new java.security.SecureRandom() ); sslSocketFactory = sslContext.getSocketFactory(); } catch (NoSuchAlgorithmException e) { throw new IOException("Can't create unsecure trust manager"); } catch (KeyManagementException e) { throw new IOException("Can't create unsecure trust manager"); } } }

Target:
private static synchronized void initUnSecureSSL() throws IOException { if (sslSocketFactory == null) { final TrustManager[] trustAllCerts = new TrustManager[]{new X509TrustManager() { public void checkClientTrusted(final X509Certificate[] chain, final String authType) { } public void checkServerTrusted(final X509Certificate[] chain, final String authType) { } public X509Certificate[] getAcceptedIssuers() { return null; } }}; final SSLContext sslContext; try { sslContext = SSLContext.getInstance("SSL"); sslContext.init(null, trustAllCerts, new java.security.SecureRandom()); sslSocketFactory = sslContext.getSocketFactory(); } catch (NoSuchAlgorithmException e) { throw new IOException("Can't create unsecure trust manager"); } catch (KeyManagementException e) { throw new IOException("Can't create unsecure trust manager"); } } }
Source:
public void setNewName(String newName) { this.fRenameResourceProcessor.setNewResourceName(newName); super.setForcePreview(true); super.setForceFinish(true); System.out.println("new name set"); }

Target:
public void setNewName(String newName) { this.fRenameResourceProcessor.setNewResourceName(newName); super.setForcePreview(true); super.setForceFinish(true); }
Source:
public TaskJobLauncherApplicationRunnerFactoryBean(JobLauncher jobLauncher, JobExplorer jobExplorer, List<Job> jobs, TaskBatchProperties taskBatchProperties, JobRegistry jobRegistry, JobRepository jobRepository, BatchProperties batchProperties) { Assert.notNull(taskBatchProperties, "taskBatchProperties must not be null"); Assert.notNull(batchProperties, "batchProperties must not be null"); this.jobLauncher = jobLauncher; this.jobExplorer = jobExplorer; Assert.notEmpty(jobs, "jobs must not be null nor empty"); this.jobs = jobs; this.jobNames = taskBatchProperties.getJobNames(); this.jobRegistry = jobRegistry; this.taskBatchProperties = taskBatchProperties; if (StringUtils.hasText(batchProperties.getJob().getNames())) { this.jobNames = batchProperties.getJob().getNames(); } else { this.jobNames = taskBatchProperties.getJobNames(); } this.order = taskBatchProperties.getCommandLineRunnerOrder(); this.jobRepository = jobRepository; }

Target:
public TaskJobLauncherApplicationRunnerFactoryBean(JobLauncher jobLauncher, JobExplorer jobExplorer, List<Job> jobs, TaskBatchProperties taskBatchProperties, JobRegistry jobRegistry, JobRepository jobRepository, BatchProperties batchProperties) { Assert.notNull(taskBatchProperties, "taskBatchProperties must not be null"); Assert.notNull(batchProperties, "batchProperties must not be null"); Assert.notEmpty(jobs, "jobs must not be null nor empty"); this.jobLauncher = jobLauncher; this.jobExplorer = jobExplorer; this.jobs = jobs; this.jobNames = taskBatchProperties.getJobNames(); this.jobRegistry = jobRegistry; this.taskBatchProperties = taskBatchProperties; if (StringUtils.hasText(batchProperties.getJob().getNames())) { this.jobNames = batchProperties.getJob().getNames(); } else { this.jobNames = taskBatchProperties.getJobNames(); } this.order = taskBatchProperties.getCommandLineRunnerOrder(); this.jobRepository = jobRepository; }
Source:
public void shiftBytes( int sourceOffset, int length, int shift ) { throw new UnsupportedOperationException( "Composite cursor does not support copyTo functionality." ); }

Target:
public void shiftBytes( int sourceOffset, int length, int shift ) { throw new UnsupportedOperationException( "Composite cursor does not support shiftBytes functionality... yet." ); }
Source:
public Long getNumberOfPagesPerIssue() { if (course.countIndividualIssues() != 0) { return numberOfPages != null ? numberOfPages / course.countIndividualIssues() : null; } else { return null; } }

Target:
public Long getNumberOfPagesPerIssue() { if (course.countIndividualIssues() != 0) { return numberOfPages != null ? numberOfPages / course.countIndividualIssues() : null; } else { return new Long(0); } }
Source:
protected void executeCommand() { if (getVds() == null) { return; } log.info("Before Installation host {}, {}", getVds().getId(), getVds().getName()); try { setVdsStatus(VDSStatus.Installing); if (getParameters().getAuthMethod() == AuthenticationMethod.Password) { copyEngineSshId(); } runAnsibleHostDeployPlaybook(); if(getVds().getClusterSupportsGlusterService() && (vdsDao.getAllForCluster(getClusterId()).size() >= 3)) { runAnsibleReconfigureGluster(); } else { if(!getVds().getClusterSupportsGlusterService()) { log.info("Skipping Reconfigure gluster since cluster does not support gluster"); } else if(vdsDao.getAllForCluster(getClusterId()).size()<3) { log.info("Skipping Reconfigure gluster since minimum of three hosts are required in the same cluster"); } } markCurrentCmdlineAsStored(); markVdsReinstalled(); configureManagementNetwork(); if (!getParameters().getActivateHost()) { setVdsStatus(VDSStatus.Maintenance); } else { setVdsStatus(VDSStatus.Initializing); } log.info("After Installation host {}, {}", getVds().getName(), getVds().getVdsType().name()); setSucceeded(true); } catch (VdsInstallException e) { handleError(e, e.getStatus()); } catch (Exception e) { handleError(e, VDSStatus.InstallFailed); } }

Target:
protected void executeCommand() { if (getVds() == null) { return; } log.info("Before Installation host {}, {}", getVds().getId(), getVds().getName()); try { setVdsStatus(VDSStatus.Installing); if (getParameters().getAuthMethod() == AuthenticationMethod.Password) { copyEngineSshId(); } runAnsibleHostDeployPlaybook(); List<VDS> hostlist = vdsDao.getAllForCluster(getClusterId()); if(getVds().getClusterSupportsGlusterService() && (hostlist.size()) >= 3) { String oldGlusterClusterNode = getVds().getName(); String firstGlusterClusterNode = null; String secondGlusterClusterNode = null; VDS vds = getVds(); hostlist.removeIf(hostname -> hostname.getHostName().equals(vds.getHostName())); firstGlusterClusterNode = hostlist.get(0).getName(); secondGlusterClusterNode = hostlist.get(1).getName(); VDS maintanceVds = hostlist.get(0); runAnsibleReconfigureGluster(oldGlusterClusterNode, firstGlusterClusterNode, secondGlusterClusterNode, maintanceVds); } else { if(!getVds().getClusterSupportsGlusterService()) { log.info("Skipping Reconfigure gluster since cluster does not support gluster"); } else if(vdsDao.getAllForCluster(getClusterId()).size()<3) { log.info("Skipping Reconfigure gluster since minimum of three hosts are required in the same cluster"); } } markCurrentCmdlineAsStored(); markVdsReinstalled(); configureManagementNetwork(); if (!getParameters().getActivateHost()) { setVdsStatus(VDSStatus.Maintenance); } else { setVdsStatus(VDSStatus.Initializing); } log.info("After Installation host {}, {}", getVds().getName(), getVds().getVdsType().name()); setSucceeded(true); } catch (VdsInstallException e) { handleError(e, e.getStatus()); } catch (Exception e) { handleError(e, VDSStatus.InstallFailed); } }
Source:
public ResourceType keyType() { if ( entityType == EntityType.NODE ) { return ResourceTypes.LABEL; } else if ( entityType == EntityType.RELATIONSHIP ) { return ResourceTypes.RELATIONSHIP_TYPE; } throw new UnsupportedOperationException( "Keys for non-schema indexes of type " + entityType + " is not supported." ); }

Target:
public ResourceType keyType() { return ResourceTypes.SCHEMA; }
Source:
private IConverter documentToRootContractInputName() { return new Converter(String.class, String.class) { @Override public Object convert(final Object fromObject) { final String name = selectedDataObservable.getValue() instanceof Document ? fromObject + "_doc_input" : fromObject + "_input"; return NamingUtils.generateNewName(newHashSet(transform(contract.getInputs(), toContactInputName())), name, 0); } }; }

Target:
private IConverter documentToRootContractInputName() { return new Converter(String.class, String.class) { @Override public Object convert(final Object fromObject) { final String name = selectedDataObservable.getValue() instanceof Document ? fromObject + DOC_INPUT : fromObject + INPUT; return NamingUtils.generateNewName(newHashSet(transform(contract.getInputs(), toContactInputName())), name, 0); } }; }
Source:
public void onActivityResult(int requestCode, int resultCode, Intent idata) { super.onActivityResult(requestCode, resultCode, idata); BarcodeScanIntegrator.ScanResult scanResult = BarcodeScanIntegrator .parseActivityResult(requestCode, resultCode, idata); if (resultCode != RESULT_CANCELED && scanResult != null) { if (scanResult.getContents() == null) { return; } else if (scanResult.getContents().length() < 3) { return; }else { account.setName(scanResult.getContents()); etName.setText(account.getName()); } } }

Target:
public void onActivityResult(int requestCode, int resultCode, Intent idata) { super.onActivityResult(requestCode, resultCode, idata); BarcodeScanIntegrator.ScanResult scanResult = BarcodeScanIntegrator .parseActivityResult(requestCode, resultCode, idata); if (resultCode != RESULT_CANCELED && scanResult != null) { if (scanResult.getContents() == null) { return; } else if (scanResult.getContents().length() < 3) { return; } else { etName.setText(scanResult.getContents()); } } }
Source:
public ProcessService(RestTemplate restTemplate, AccountService accountService) { super(restTemplate); this.accountService = accountService; }

Target:
public ProcessService(RestTemplate restTemplate, AccountService accountService) { super(restTemplate); this.accountService = notNull(accountService, "accountService"); }
Source:
public void theUserGetsTabLink(String tab) throws Throwable { WebElement element; switch (tab) { case "Pozíciók": element = driverProvider.getDriver().findElement(By.id("positions_link")); assertThat(element.getText(), is("Pozíciók")); assertThat(element.isDisplayed(), is(true)); break; case "Csatornák": element = driverProvider.getDriver().findElement(By.id("channels_link")); assertThat(element.getText(), is("Csatornák")); assertThat(element.isDisplayed(), is(true)); break; case "Jelszó-változtatás": element = driverProvider.getDriver().findElement(By.id("password_link")); assertThat(element.getText(), is("Jelszó változtatás")); assertThat(element.isDisplayed(), is(true)); break; } }

Target:
public void theUserGetsTabLink(String tab) throws Throwable { WebElement element; switch (tab) { case "Pozíciók": element = getDriver().findElement(By.id("positions_link")); assertThat(element.getText(), is("Pozíciók")); assertThat(element.isDisplayed(), is(true)); break; case "Csatornák": element = getDriver().findElement(By.id("channels_link")); assertThat(element.getText(), is("Csatornák")); assertThat(element.isDisplayed(), is(true)); break; case "Jelszó-változtatás": element = getDriver().findElement(By.id("password_link")); assertThat(element.getText(), is("Jelszó változtatás")); assertThat(element.isDisplayed(), is(true)); break; } }
Source:
private void setupBackPressureCheckTimer(final Map<String, Object> topologyConf) { final Integer workerCount = ObjectReader.getInt(topologyConf.get(Config.TOPOLOGY_WORKERS)); if (workerCount <= 1) { LOG.info("BackPressure change checking is disabled as there is only one worker"); return; } final Long bpCheckIntervalMs = ObjectReader.getLong(topologyConf.get(Config.TOPOLOGY_BACKPRESSURE_CHECK_MILLIS)); workerState.backPressureCheckTimer.scheduleRecurringMs(bpCheckIntervalMs, bpCheckIntervalMs, new Runnable() { @Override public void run() { workerState.refreshBackPressureStatus(); } }); LOG.info("BackPressure status change checking will be performed every millis", bpCheckIntervalMs); }

Target:
private void setupBackPressureCheckTimer(final Map<String, Object> topologyConf) { final Integer workerCount = ObjectReader.getInt(topologyConf.get(Config.TOPOLOGY_WORKERS)); if (workerCount <= 1) { LOG.info("BackPressure change checking is disabled as there is only one worker"); return; } final Long bpCheckIntervalMs = ObjectReader.getLong(topologyConf.get(Config.TOPOLOGY_BACKPRESSURE_CHECK_MILLIS)); workerState.backPressureCheckTimer.scheduleRecurringMs(bpCheckIntervalMs , bpCheckIntervalMs, () -> workerState.refreshBackPressureStatus()); LOG.info("BackPressure status change checking will be performed every millis", bpCheckIntervalMs); }
Source:
public static void main(String[] args) { ExtMap context = new ExtMap(); try { context.mput(ContextKeys.TAIL, new LinkedList<>(Arrays.asList(args))); context.put(Schema.InvokeKeys.SETTINGS_RESULT, new ExtMap()); context.put(ContextKeys.THROWABLES, new ArrayList<>()); context.put(ContextKeys.ERR_MESSAGES, new ArrayList<>()); context.put(ContextKeys.OUT_MESSAGES, new ArrayList<>()); commands.get("root").invoke(context); for (String msg: (List<String>)context.get(ContextKeys.ERR_MESSAGES, List.class)) { System.err.print(newLine(msg)); } for (String msg: (List<String>)context.get(ContextKeys.OUT_MESSAGES, List.class)) { System.out.print(newLine(msg)); } for (Object thr: context.get(ContextKeys.THROWABLES, List.class)) { LOG.debug("Exception", thr); } System.exit( context.get(ContextKeys.EXIT_STATUS, Integer.class, SUCCESS) ); } catch (Throwable t) { if (context.get(ContextKeys.LOGGING_STARTED, Boolean.class, false)) { LOG.error(t.getMessage() != null ? t.getMessage() : t.getClass().getName()); LOG.debug("exception", t); } else { t.printStackTrace(); } System.exit(GENERAL_ERROR); } }

Target:
public static void main(String[] args) { ExtMap context = new ExtMap(); try { context.mput(ContextKeys.TAIL, new LinkedList<>(Arrays.asList(args))); context.put(Schema.InvokeKeys.SETTINGS_RESULT, new ExtMap()); context.put(ContextKeys.THROWABLES, new ArrayList<>()); context.put(ContextKeys.ERR_MESSAGES, new ArrayList<>()); context.put(ContextKeys.OUT_MESSAGES, new ArrayList<>()); commands.get("root").invoke(context); for (String msg: (List<String>)context.get(ContextKeys.ERR_MESSAGES, List.class)) { System.err.print(newLine(msg)); } for (String msg: (List<String>)context.get(ContextKeys.OUT_MESSAGES, List.class)) { System.out.print(newLine(msg)); } for (Object thr: context.get(ContextKeys.THROWABLES, List.class)) { LOG.debug("Exception", thr); } System.exit( context.get(ContextKeys.EXIT_STATUS, Integer.class, SUCCESS) ); } catch (Throwable t) { if (context.get(ContextKeys.LOGGING_STARTED, Boolean.class, false)) { LOG.error("Unexpected Exception invoking Cli: {}", t.getMessage()); LOG.debug("exception", t); } else { t.printStackTrace(); } System.exit(GENERAL_ERROR); } }
Source:
static Set<Class<?>> getClasses(ClassLoader loader, String packageName) { Set<Class<?>> classes = new HashSet<Class<?>>(); String path = packageName.replace('.', '/'); try { Enumeration<URL> resources = loader.getResources(path); if (resources != null) { while (resources.hasMoreElements()) { String filePath = resources.nextElement().getFile(); if (filePath != null && filePath.indexOf("%20") > 0) filePath = filePath.replaceAll("%20", " "); if (filePath != null) { if ((filePath.indexOf("!") > 0) && (filePath.indexOf(".jar") > 0)) { String jarPath = filePath.substring(0, filePath.indexOf("!")).substring(filePath.indexOf(":") + 1); if (jarPath.indexOf(":") >= 0) jarPath = jarPath.substring(1); classes.addAll(getFromJARFile(jarPath, path)); } else { classes.addAll(getFromDirectory(new File(filePath), packageName)); } } } } } catch (IOException e) { s_logger.debug("Encountered IOException", e); } catch (ClassNotFoundException e) { } return classes; }

Target:
static Set<Class<?>> getClasses(ClassLoader loader, String packageName) { Set<Class<?>> classes = new HashSet<Class<?>>(); String path = packageName.replace('.', '/'); try { Enumeration<URL> resources = loader.getResources(path); if (resources != null) { while (resources.hasMoreElements()) { String filePath = resources.nextElement().getFile(); if (filePath != null) { if (filePath.indexOf("%20") > 0) filePath = filePath.replaceAll("%20", " "); if ((filePath.indexOf("!") > 0) && (filePath.indexOf(".jar") > 0)) { String jarPath = filePath.substring(0, filePath.indexOf("!")).substring(filePath.indexOf(":") + 1); if (jarPath.indexOf(":") >= 0) jarPath = jarPath.substring(1); classes.addAll(getFromJARFile(jarPath, path)); } else { classes.addAll(getFromDirectory(new File(filePath), packageName)); } } } } } catch (IOException e) { s_logger.debug("Encountered IOException", e); } catch (ClassNotFoundException e) { } return classes; }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); realm = Realm.getDefaultInstance(); RealmResults<SmsDetectionString> msgItems = realm.allObjects(SmsDetectionString.class); listViewAdv.setAdapter(new DetectionStringAdapter(this, msgItems, true)); listViewAdv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> a, View v, int position, long id) { SmsDetectionString detectionString = (SmsDetectionString) listViewAdv.getItemAtPosition(position); String string = detectionString.getDetectionString(); detectionString.removeFromRealm(); Toast.makeText(getApplicationContext(), getString(R.string.deleted) + ": " + string, Toast.LENGTH_SHORT).show(); return true; } }); insertButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (editAdvUserDet.getText().toString().contains("\"")) { Toast.makeText(AdvancedUserActivity.this, R.string.double_quote_will_cause_db_error, Toast.LENGTH_SHORT).show(); } else { realm.executeTransaction(new Realm.Transaction() { @Override public void execute(Realm realm) { SmsDetectionString detectionString = realm.createObject(SmsDetectionString.class); detectionString.setDetectionString(editAdvUserDet.getText().toString()); detectionString.setSmsType(spinner.getSelectedItem().toString()); Toast.makeText(AdvancedUserActivity.this, R.string.the_string_was_added_to_db, Toast.LENGTH_SHORT).show(); } }); } } }); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); realm = Realm.getDefaultInstance(); RealmResults<SmsDetectionString> msgItems = realm.allObjects(SmsDetectionString.class); listViewAdv.setAdapter(new DetectionStringAdapter(this, msgItems, true)); listViewAdv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> a, View v, int position, long id) { final SmsDetectionString detectionString = (SmsDetectionString) listViewAdv.getItemAtPosition(position); String string = detectionString.getDetectionString(); realm.executeTransaction(new Realm.Transaction() { @Override public void execute(Realm realm) { detectionString.removeFromRealm(); } }); Toast.makeText(getApplicationContext(), getString(R.string.deleted) + ": " + string, Toast.LENGTH_SHORT).show(); return true; } }); insertButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (editAdvUserDet.getText().toString().contains("\"")) { Toast.makeText(AdvancedUserActivity.this, R.string.double_quote_will_cause_db_error, Toast.LENGTH_SHORT).show(); } else { realm.executeTransaction(new Realm.Transaction() { @Override public void execute(Realm realm) { SmsDetectionString detectionString = realm.createObject(SmsDetectionString.class); detectionString.setDetectionString(editAdvUserDet.getText().toString()); detectionString.setSmsType(spinner.getSelectedItem().toString()); Toast.makeText(AdvancedUserActivity.this, R.string.the_string_was_added_to_db, Toast.LENGTH_SHORT).show(); } }); } } }); }
Source:
public void missingUpdatedElementHasValueAdded() throws Exception { Assert.assertEquals("2014-01-01T00:00:00.000Z", publishEntry.element("entry").elementText("updated")); Element item = (Element) this.publishEntry.clone(); item.element("entry").element("updated").detach(); validator = getEntryObject(item); Assert.assertTrue(validator.isValid()); Element entry = validator.getPayload(); System.out.println(entry.elementText("updated")); Assert.assertTrue(entry.elementText("updated").matches(ISO_8601_REGEX)); }

Target:
public void missingUpdatedElementHasValueAdded() throws Exception { Assert.assertEquals("2014-01-01T00:00:00.000Z", publishEntry.element("entry").elementText("updated")); Element item = (Element) this.publishEntry.clone(); item.element("entry").element("updated").detach(); validator = getEntryObject(item); Assert.assertTrue(validator.isValid()); Element entry = validator.getPayload(); Assert.assertTrue(entry.elementText("updated").matches(ISO_8601_REGEX)); }