auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void schedule(Work work, Scheduling scheduling, boolean afterCommit) { String queueId = getStreamForCategory(work.getCategory()); if (log.isDebugEnabled()) { log.debug(String.format( "Scheduling: workId: %s, category: %s, queue: %s, scheduling: %s, afterCommit: %s, work: %s", work.getId(), work.getCategory(), queueId, scheduling, afterCommit, work)); } if (!isQueuingEnabled(queueId)) { log.info("Queue disabled, scheduling canceled: " + queueId); return; } if (CANCEL_SCHEDULED.equals(scheduling)) { if (storeState) { if (WorkStateHelper.getState(work.getId()) != null) { WorkStateHelper.setCanceled(work.getId()); } } else { log.warn(String.format("Canceling a work is only supported if '%s' is true. Skipping work: %s", STORESTATE_KEY, work)); } return; } if (afterCommit && scheduleAfterCommit(work, scheduling)) { return; } WorkSchedulePath.newInstance(work); LogAppender<Record> appender = logManager.getAppender(getStreamForCategory(work.getCategory())); if (appender == null) { log.error(String.format("Not scheduled work, unknown category: %s, mapped to %s", work.getCategory(), getStreamForCategory(work.getCategory()))); return; } String key = work.getPartitionKey(); LogOffset offset = appender.append(key, Record.of(key, WorkComputation.serialize(work))); if (work.isCoalescing() || storeState) { WorkStateHelper.setLastOffset(work.getId(), offset.offset(), stateTTL); } if (storeState) { WorkStateHelper.setState(work.getId(), Work.State.SCHEDULED, stateTTL); } }

Target:
public void schedule(Work work, Scheduling scheduling, boolean afterCommit) { String queueId = getStreamForCategory(work.getCategory()); if (log.isDebugEnabled()) { log.debug(String.format( "Scheduling: workId: %s, category: %s, queue: %s, scheduling: %s, afterCommit: %s, work: %s", work.getId(), work.getCategory(), queueId, scheduling, afterCommit, work)); } if (!isQueuingEnabled(queueId)) { log.info("Queue disabled, scheduling canceled: " + queueId); return; } if (CANCEL_SCHEDULED.equals(scheduling)) { if (storeState) { if (WorkStateHelper.getState(work.getId()) != null) { WorkStateHelper.setCanceled(work.getId()); } } else { log.warn(String.format("Canceling a work is only supported if '%s' is true. Skipping work: %s", STORESTATE_KEY, work)); } return; } if (afterCommit && scheduleAfterCommit(work, scheduling)) { return; } WorkSchedulePath.newInstance(work); LogAppender<Record> appender = logManager.getAppender(getStreamForCategory(work.getCategory())); if (appender == null) { log.error(String.format("Not scheduled work, unknown category: %s, mapped to %s", work.getCategory(), getStreamForCategory(work.getCategory()))); return; } String key = work.getPartitionKey(); LogOffset offset = appender.append(key, Record.of(key, WorkComputation.serialize(work))); if (work.isCoalescing()) { WorkStateHelper.setLastOffset(work.getId(), offset.offset(), stateTTL); } if (storeState) { WorkStateHelper.setState(work.getId(), Work.State.SCHEDULED, stateTTL); } }
Source:
public void getThreadData() throws Throwable { SyncUtil.runToLine(SOURCE_NAME, MIRunControlTest.LINE_MAIN_ALL_THREADS_STARTED); IThreadDMData mainThreadData = SyncUtil.getThreadData(1); Pattern pattern = Pattern.compile("\\d*", Pattern.MULTILINE); Matcher matcher = pattern.matcher(mainThreadData.getId()); assertTrue("Thread ID is a series of number", matcher.matches()); final String names[] = { EXEC_NAME, "monday", "tuesday", "wednesday", "thursday", "friday" }; for (int i = 2; i <= 6; i++) { IThreadDMData threadData = SyncUtil.getThreadData(i); String name = threadData.getName(); String expectedName = threadNamesSupported() ? names[i - 1] : ""; assertEquals("Thread name of thread " + i, expectedName, name); } }

Target:
public void getThreadData() throws Throwable { SyncUtil.runToLine(SOURCE_NAME, MIRunControlTest.LINE_MAIN_ALL_THREADS_STARTED); IThreadDMData mainThreadData = SyncUtil.getThreadData(1); Pattern pattern = Pattern.compile("\\d*", Pattern.MULTILINE); Matcher matcher = pattern.matcher(mainThreadData.getId()); assertTrue("Thread ID is a series of number", matcher.matches()); final String names[] = { EXEC_NAME, "monday", "tuesday", "wednesday", "thursday", "friday" }; for (int i = 1; i <= 6; i++) { IThreadDMData threadData = SyncUtil.getThreadData(i); String name = threadData.getName(); String expectedName = threadNamesSupported() ? names[i - 1] : ""; assertEquals("Thread name of thread " + i, expectedName, name); } }
Source:
public void canCreateBusinessService() throws Exception { final String businessServiceJson = "{" + "\"name\":\"some-name\"," + "\"attributes\":{\"attribute\":[{\"key\":\"some-key\",\"value\":\"some-value\"}]}," + "\"reductionKeys\": [\n" + " \"key1\", \"key2\", \"key3\"\n" + " ]" + "}"; final String businessServiceXml = "<business-service>" + " <name>some-name2</name>" + " <reductionKeys>" + " <reductionKey>key1</reductionKey>" + " <reductionKey>key2</reductionKey>" + " <reductionKey>key3</reductionKey>" + " </reductionKeys>" + "</business-service>"; sendData(POST, MediaType.APPLICATION_JSON, "/business-services", businessServiceJson, 201); sendData(POST, MediaType.APPLICATION_XML, "/business-services", businessServiceXml, 201); Assert.assertEquals(2, m_businessServiceDao.findAll().size()); assertTrue("createBusinessServiceWithReductionKeys", m_businessServiceDao.findAll().get(0).getReductionKeys().contains("key1")); assertTrue("createBusinessServiceWithReductionKeys", m_businessServiceDao.findAll().get(0).getReductionKeys().contains("key2")); assertTrue("createBusinessServiceWithReductionKeys", m_businessServiceDao.findAll().get(0).getReductionKeys().contains("key3")); assertEquals("createBusinessServiceWithReductionKeys", 3, m_businessServiceDao.findAll().get(1).getReductionKeys().size()); }

Target:
public void canCreateBusinessService() throws Exception { String key1 = "reductionKey-1"; String key2 = "reductionKey-2"; String key3 = "reductionKey-3"; final String businessServiceJson = "{" + "\"name\":\"some-name\"," + "\"attributes\":{\"attribute\":[{\"key\":\"some-key\",\"value\":\"some-value\"}]}," + "\"reductionKeys\": [\n" + " \"" + key1 + "\", \""+ key2 +"\", \""+ key3 +"\"\n" + " ]" + "}"; final String businessServiceXml = "<business-service>" + " <name>some-name2</name>" + " <reductionKeys>" + " <reductionKey>" + key1 + "</reductionKey>" + " <reductionKey>" + key2 + "</reductionKey>" + " <reductionKey>" + key3 + "</reductionKey>" + " </reductionKeys>" + "</business-service>"; sendData(POST, MediaType.APPLICATION_JSON, "/business-services", businessServiceJson, 201); sendData(POST, MediaType.APPLICATION_XML, "/business-services", businessServiceXml, 201); Assert.assertEquals(2, m_businessServiceDao.findAll().size()); for (BusinessService bs : m_businessServiceDao.findAll()) { assertTrue("Expect reductionkey '" + key1 + "' to be present in retrieved BusinessService.", bs.getReductionKeys().contains(key1)); assertTrue("Expect reductionkey '" + key2 + "' to be present in retrieved BusinessService.", bs.getReductionKeys().contains(key2)); assertTrue("Expect reductionkey '" + key3 + "' to be present in retrieved BusinessService.", bs.getReductionKeys().contains(key3)); assertEquals("Check amount of reductionkeys in BusinessService.", 3, bs.getReductionKeys().size()); } }
Source:
public RestService createRestService(String schemaRegistryUrl, Map<String, String> configs) { RestService restService = new RestService(schemaRegistryUrl); Map<String, Object> asslConfigs = configs.entrySet().stream() .filter(e -> !e.equals(SCHEMA_REGISTRY_REST_URL)) .filter(e -> e.getKey().startsWith("schema.registry.")) .collect(Collectors.toMap( e -> e.getKey().substring("schema.registry.".length()), Map.Entry::getValue)); Map<String, Object> sslConfigs = new HashMap<>(); for (String key : configs.keySet()) { if (!key.equals(SCHEMA_REGISTRY_REST_URL) && key.startsWith("schema.registry.")) { String value = configs.get(key); key = key.substring("schema.registry.".length()); if (key.contains("password")) { sslConfigs.put(key, new Password(value)); } else { sslConfigs.put(key, value); } } } System.out.println(configs.toString()); System.out.println(sslConfigs.toString()); System.out.println("CONFIGS CONFIGS"); if (!sslConfigs.isEmpty()) { SslFactory sslFactory = new SslFactory(Mode.CLIENT); sslFactory.configure(sslConfigs); restService.setSslSocketFactory(sslFactory.sslContext().getSocketFactory()); } return restService; }

Target:
public RestService createRestService(String schemaRegistryUrl, Map<String, String> configs) { RestService restService = new RestService(schemaRegistryUrl); ConfigDef configDef = new ConfigDef(); SslConfigs.addClientSslSupport(configDef); Map<String, ConfigDef.ConfigKey> configKeyMap = configDef.configKeys(); Map<String, Object> sslConfigs = new HashMap<>(); for (String key : configs.keySet()) { if (!key.equals(SCHEMA_REGISTRY_REST_URL) && key.startsWith(SCHEMA_REGISTRY_OPTS_PREFIX)) { String value = configs.get(key); key = key.substring(SCHEMA_REGISTRY_OPTS_PREFIX.length()); if (configKeyMap.containsKey(key)) { if (configKeyMap.get(key).type == ConfigDef.Type.PASSWORD) { sslConfigs.put(key, new Password(value)); } else { sslConfigs.put(key, value); } } } } if (!sslConfigs.isEmpty()) { SslFactory sslFactory = new SslFactory(Mode.CLIENT); sslFactory.configure(sslConfigs); restService.setSslSocketFactory(sslFactory.sslContext().getSocketFactory()); } return restService; }
Source:
private boolean isModifyAccessEnabled() { boolean returnValue; try { if (SystemGroup.OseeAccessAdmin.isCurrentUserMember()) { returnValue = true; } else if (policyTableViewer.getAccessControlList().size() > 0) { returnValue = AccessControlManager.hasPermission(accessControlledObject, PermissionEnum.OWNER); } else { returnValue = true; } } catch (OseeCoreException ex) { OseeLog.log(Activator.class, Level.SEVERE, ex); returnValue = false; } return returnValue; }

Target:
private boolean isModifyAccessEnabled() { boolean returnValue; try { if (!SystemGroup.OseeAccessAdmin.isCurrentUserMember() && policyTableViewer.getAccessControlList().size() > 0) { returnValue = AccessControlManager.hasPermission(accessControlledObject, PermissionEnum.OWNER); } else { returnValue = true; } } catch (OseeCoreException ex) { OseeLog.log(Activator.class, Level.SEVERE, ex); returnValue = false; } return returnValue; }
Source:
private static DialectName convertToDialect(final String dialectName) { if(dialectName.equals("h2")) { return DialectName.H2; } if(dialectName.equals("postgres")) { return DialectName.POSTGRES; } if(dialectName.equals("mysql")) { return DialectName.MYSQL; } throw new DolphinRuntimeException("Dialect not supported"); }

Target:
private static DialectName convertToDialect(final String dialectName) { if(dialectName.equals(DB_H2)) { return DialectName.H2; } if(dialectName.equals(DB_POSTGRES)) { return DialectName.POSTGRES; } if(dialectName.equals(DB_MYSQL)) { return DialectName.MYSQL; } throw new DolphinRuntimeException("Dialect not supported"); }
Source:
public void setCommandExecuted() { Transaction transaction = TransactionSupport.suspend(); try { CommandEntity cmdEntity = CommandCoordinatorUtil.getCommandEntity(getCommandId()); if (cmdEntity != null) { CommandEntity executedCmdEntity = buildCommandEntity(cmdEntity.getRootCommandId(), cmdEntity.isCallbackEnabled()); executedCmdEntity .setWaitingForEVent(getCallback() == null ? false : getCallback().isTriggeredByEvent()); CommandCoordinatorUtil.persistCommand(executedCmdEntity, getContext()); CommandCoordinatorUtil.updateCommandExecuted(getCommandId()); } } finally { if (transaction != null) { TransactionSupport.resume(transaction); } } }

Target:
public void setCommandExecuted() { Transaction transaction = TransactionSupport.suspend(); try { CommandEntity cmdEntity = CommandCoordinatorUtil.getCommandEntity(getCommandId()); if (cmdEntity != null) { CommandEntity executedCmdEntity = buildCommandEntity(cmdEntity.getRootCommandId(), cmdEntity.isCallbackEnabled()); executedCmdEntity.setWaitingForEvent(callbackTriggeredByEvent()); CommandCoordinatorUtil.persistCommand(executedCmdEntity, getContext()); CommandCoordinatorUtil.updateCommandExecuted(getCommandId()); } } finally { if (transaction != null) { TransactionSupport.resume(transaction); } } }
Source:
public EventDrivenTransformationRule(String name, IQuerySpecification<Matcher> precondition, IMatchProcessor<Match> action, IncQueryActivationStateEnum transition, ActivationLifeCycle lifeCycle) { Job<Match> stJob = Jobs.newStatelessJob(transition, action); Job<Match> job = Jobs.newRecordingJob(stJob); ruleSpecification = Rules.newMatcherRuleSpecification(precondition, lifeCycle, CollectionLiterals.newHashSet(job)); }

Target:
public EventDrivenTransformationRule(String name, IQuerySpecification<Matcher> precondition, IMatchProcessor<Match> action, IncQueryActivationStateEnum transition, ActivationLifeCycle lifeCycle) { Job<Match> job = Jobs.newStatelessJob(transition, action); ruleSpecification = Rules.newMatcherRuleSpecification(precondition, lifeCycle, CollectionLiterals.newHashSet(job)); }
Source:
protected void executeQueryCommand() { VDSReturnValue nfsReturnValue = runVdsCommand(VDSCommandType.GetGlusterVolumeProfileInfo, new GlusterVolumeProfileInfoVDSParameters(getParameters().getClusterId(), getUpServerId(getParameters().getClusterId()), getGlusterVolumeName(getParameters().getVolumeId()), ((GlusterVolumeProfileParameters)getParameters()).isNfs())); getQueryReturnValue().setReturnValue((((GlusterVolumeProfileParameters)getParameters()).isNfs()) ? (GlusterVolumeProfileInfo) nfsReturnValue.getReturnValue() : setBrickNames((GlusterVolumeProfileInfo) nfsReturnValue.getReturnValue())); }

Target:
protected void executeQueryCommand() { VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GetGlusterVolumeProfileInfo, new GlusterVolumeProfileInfoVDSParameters(getParameters().getClusterId(), getUpServerId(getParameters().getClusterId()), getGlusterVolumeName(getParameters().getVolumeId()), ((GlusterVolumeProfileParameters)getParameters()).isNfs())); getQueryReturnValue().setReturnValue((((GlusterVolumeProfileParameters)getParameters()).isNfs()) ? (GlusterVolumeProfileInfo) returnValue.getReturnValue() : setBrickNames((GlusterVolumeProfileInfo) returnValue.getReturnValue())); }
Source:
private void logIn(String username, String password) { try { String uniqueId = uidService.generate(String.valueOf(sessionId.get()), preferencesService.getFafDataDirectory().resolve("uid.log")); writeToServer(new LoginClientMessage(username, Hashing.sha256().hashString(password, UTF_8).toString(), sessionId.get(), uniqueId, localIp)); } catch (IOException e) { onUIDNotFound(e); } }

Target:
private void logIn(String username, String password) { try { String uniqueId = uidService.generate(String.valueOf(sessionId.get()), preferencesService.getFafDataDirectory().resolve("uid.log")); writeToServer(new LoginClientMessage(username, Hashing.sha256().hashString(password, UTF_8).toString(), sessionId.get(), uniqueId, localIp)); } catch (IOException e) { onUIDNotExecuted(e); } }
Source:
private BaseEntity transformNbtData(BaseEntity state) { CompoundTag tag = state.getNbtData(); if (tag != null) { boolean hasTilePosition = tag.containsKey("TileX") && tag.containsKey("TileY") && tag.containsKey("TileZ"); boolean hasFacing = tag.containsKey("Facing"); if (hasTilePosition) { Vector3 tilePosition = Vector3.at(tag.asInt("TileX"), tag.asInt("TileY"), tag.asInt("TileZ")); BlockVector3 newTilePosition = transform.apply(tilePosition.subtract(from)).add(to).toBlockPoint(); CompoundTagBuilder builder = tag.createBuilder() .putInt("TileX", newTilePosition.getBlockX()) .putInt("TileY", newTilePosition.getBlockY()) .putInt("TileZ", newTilePosition.getBlockZ()); if (hasFacing) { boolean isPainting = state.getType() == EntityTypes.PAINTING; Direction direction = isPainting ? MCDirections.fromPre13Hanging(tag.asInt("Facing")) : MCDirections.fromHanging(tag.asInt("Facing")); if (direction != null) { Vector3 vector = transform.apply(direction.toVector()).subtract(transform.apply(Vector3.ZERO)).normalize(); Direction newDirection = Direction.findClosest(vector, Flag.CARDINAL); if (newDirection != null) { builder.putByte("Facing", (byte) (isPainting ? MCDirections.toPre13Hanging(newDirection) : MCDirections.toHanging(newDirection))); } } } return new BaseEntity(state.getType(), builder.build()); } } return state; }

Target:
private BaseEntity transformNbtData(BaseEntity state) { CompoundTag tag = state.getNbtData(); if (tag != null) { boolean hasTilePosition = tag.containsKey("TileX") && tag.containsKey("TileY") && tag.containsKey("TileZ"); boolean hasFacing = tag.containsKey("Facing"); if (hasTilePosition) { Vector3 tilePosition = Vector3.at(tag.asInt("TileX"), tag.asInt("TileY"), tag.asInt("TileZ")); BlockVector3 newTilePosition = transform.apply(tilePosition.subtract(from)).add(to).toBlockPoint(); CompoundTagBuilder builder = tag.createBuilder() .putInt("TileX", newTilePosition.getBlockX()) .putInt("TileY", newTilePosition.getBlockY()) .putInt("TileZ", newTilePosition.getBlockZ()); if (hasFacing) { boolean isPainting = state.getType() == EntityTypes.PAINTING; Direction direction = isPainting ? MCDirections.fromHorizontalHanging(tag.asInt("Facing")) : MCDirections.fromHanging(tag.asInt("Facing")); if (direction != null) { Vector3 vector = transform.apply(direction.toVector()).subtract(transform.apply(Vector3.ZERO)).normalize(); Direction newDirection = Direction.findClosest(vector, Flag.CARDINAL); if (newDirection != null) { builder.putByte("Facing", (byte) (isPainting ? MCDirections.toHorizontalHanging(newDirection) : MCDirections.toHanging(newDirection))); } } } return new BaseEntity(state.getType(), builder.build()); } } return state; }
Source:
public InlineHyperlink getPreviousPatchLink(int index, PatchScreen.Type patchType) { for(index--; index > -1; index--) { InlineHyperlink link = createLink(index, patchType, null, SafeHtml.asis(Util.C .nextPatchLinkIcon())); if(link != null) { return link; } } return null; }

Target:
public InlineHyperlink getPreviousPatchLink(int index, PatchScreen.Type patchType) { for(index--; index > -1; index--) { InlineHyperlink link = createLink(index, patchType, SafeHtml.asis(Util.C .prevPatchLinkIcon()), null); if(link != null) { return link; } } return null; }
Source:
public void checkSpecificAccessControl() { if (userInfo.isStudent) { checkStudentAccess(); } else if (userInfo.isInstructor) { checkInstructorAccess(); } else { throw new UnauthorizedAccessException("Your account cannot access this student's profile."); } }

Target:
public void checkSpecificAccessControl() { String studentEmail = getRequestParamValue(Const.ParamsNames.STUDENT_EMAIL); String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID); if (studentEmail == null || courseId == null) { if (!userInfo.isStudent) { throw new UnauthorizedAccessException(MESSAGE_NOT_STUDENT_ACCOUNT); } } else { StudentAttributes student = logic.getStudentForEmail(courseId, studentEmail); if (student == null) { throw new UnauthorizedAccessException(MESSAGE_STUDENT_NOT_FOUND); } gateKeeper.verifyAccessibleForCurrentUserAsInstructorOrTeamMemberOrAdmin(userInfo.id, courseId, student.section, studentEmail); } }
Source:
public Step loadVariantsStep(StepBuilderFactory stepBuilderFactory, JobOptions jobOptions, SimpleCompletionPolicy chunkSizeCompletionPolicy) { logger.debug("Building '" + LOAD_VARIANTS_STEP + "'"); return stepBuilderFactory.get(LOAD_VARIANTS_STEP) .<Variant, Variant>chunk(chunkSizeCompletionPolicy) .reader(reader) .processor(variantProcessor) .writer(variantWriter) .faultTolerant().skipLimit(50).skip(FlatFileParseException.class) .allowStartIfComplete(jobOptions.isAllowStartIfComplete()) .listener(new SkippedItemListener()) .listener(new StepProgressListener()) .listener(new VariantLoaderStepStatisticsListener()) .build(); }

Target:
public Step loadVariantsStep(StepBuilderFactory stepBuilderFactory, JobOptions jobOptions, SimpleCompletionPolicy chunkSizeCompletionPolicy) { logger.debug("Building '" + LOAD_VARIANTS_STEP + "'"); return stepBuilderFactory.get(LOAD_VARIANTS_STEP) .<Variant, Variant>chunk(chunkSizeCompletionPolicy) .reader(reader) .processor(new VariantNoAlternateFilterProcessor()) .writer(variantWriter) .allowStartIfComplete(jobOptions.isAllowStartIfComplete()) .listener(new SkippedItemListener()) .listener(new StepProgressListener()) .listener(new VariantLoaderStepStatisticsListener()) .build(); }
Source:
private void addGroupsFrom(IConfigurationElement element, Collection<MarkerGroup> groupss) { for (IConfigurationElement configElement : element.getChildren(MarkerSupportRegistry.MARKER_GROUPING)) { groupss.add(MarkerGroup.createMarkerGroup(configElement)); } }

Target:
private void addGroupsFrom(IConfigurationElement element, Collection<MarkerGroup> groupss) { for (IConfigurationElement grouping : element.getChildren(MarkerSupportRegistry.MARKER_GROUPING)) { groupss.add(MarkerGroup.createMarkerGroup(grouping)); } }
Source:
public List<GeoEntry> query(final String queryString, final int maxResults) throws GeoEntryQueryException { try (final Directory directory = openDirectoryAndCheckForIndex()) { return doQuery(queryString, maxResults, directory); } catch (IOException e) { LOGGER.warn("Error querying from directory", e); } return Collections.emptyList(); }

Target:
public List<GeoEntry> query(final String queryString, final int maxResults) throws GeoEntryQueryException { try (final Directory directory = openDirectoryAndCheckForIndex()) { return doQuery(queryString, maxResults, directory); } catch (IOException e) { LOGGER.debug("Error querying from directory", e); } return Collections.emptyList(); }
Source:
void setCurrentTitleAndDescriptions(Title title, List<Description> descriptions) { setCurrentUploadTitle(title); setCurrentUploadDescriptions(descriptions); store.putString("Title", title.toString()); }

Target:
void setCurrentTitleAndDescriptions(Title title, List<Description> descriptions) { setCurrentUploadTitle(title); setCurrentUploadDescriptions(descriptions); }
Source:
public InputStream raw() throws IOException { return new ByteArrayInputStream( DatatypeConverter.parseBase64Binary( this.storage.xml().xpath( String.format( "/github/repos/repo[@coords='%s']/asset/text()", this.coords ) ).get(0) ) ); }

Target:
public InputStream raw() throws IOException { return new ByteArrayInputStream( DatatypeConverter.parseBase64Binary( this.storage.xml().xpath( String.format("%s/content/text()", this.xpath()) ).get(0) ) ); }
Source:
public String toString() { return new StringBuilder() .append("result: ").append(result).append("; ") .append("reason: ").append(failureReason).append("; ") .append("seqid=").append(flushSequenceId).toString(); }

Target:
public String toString() { return new StringBuilder() .append("flush result:").append(result).append(", ") .append("failureReason:").append(failureReason).append(",") .append("flush seq id").append(flushSequenceId).toString(); }
Source:
public void testDelete() throws IOException { String path = "/path"; String deletePath = path + "/delete"; try { _testBaseDataAccessor.create(deletePath, null, AccessOption.PERSISTENT); new JerseyUriRequestBuilder("zookeeper{}?command=delete").format(deletePath) .expectedReturnStatusCode(Response.Status.FORBIDDEN.getStatusCode()); Assert.assertTrue(_testBaseDataAccessor.exists(deletePath, AccessOption.PERSISTENT)); _testBaseDataAccessor.remove(deletePath, AccessOption.PERSISTENT); _testBaseDataAccessor.create(deletePath, null, AccessOption.EPHEMERAL); String data = new JerseyUriRequestBuilder("zookeeper{}?command=delete").format(deletePath) .isBodyReturnExpected(true).get(this); Map<String, String> result = OBJECT_MAPPER.readValue(data, HashMap.class); Assert.assertEquals(result.get("path"), deletePath); Assert.assertEquals(result.get("delete"), new Boolean(true).toString()); Assert.assertFalse(_testBaseDataAccessor.exists(deletePath, AccessOption.PERSISTENT)); } finally { _testBaseDataAccessor.remove(path, AccessOption.PERSISTENT); } }

Target:
public void testDelete() { String path = "/path"; String deletePath = path + "/delete"; try { _testBaseDataAccessor.create(deletePath, null, AccessOption.PERSISTENT); new JerseyUriRequestBuilder("zookeeper{}").format(deletePath) .expectedReturnStatusCode(Response.Status.FORBIDDEN.getStatusCode()).delete(this); Assert.assertTrue(_testBaseDataAccessor.exists(deletePath, AccessOption.PERSISTENT)); new JerseyUriRequestBuilder("zookeeper{}").format(deletePath + "/foobar") .expectedReturnStatusCode(Response.Status.NOT_FOUND.getStatusCode()).delete(this); _testBaseDataAccessor.remove(deletePath, AccessOption.PERSISTENT); _testBaseDataAccessor.create(deletePath, null, AccessOption.EPHEMERAL); new JerseyUriRequestBuilder("zookeeper{}").format(deletePath) .expectedReturnStatusCode(Response.Status.OK.getStatusCode()).delete(this); Assert.assertFalse(_testBaseDataAccessor.exists(deletePath, AccessOption.PERSISTENT)); } finally { _testBaseDataAccessor.remove(path, AccessOption.PERSISTENT); } }
Source:
public void MercuryCuratedNavigationTests_003_navigateThroughNamespaces() { CuratedContentPageObject category = new CuratedContentPageObject(driver); category .openCuratedContentPage(wikiURL, MercurySubpages.CC_CATEGORY_ARTICLES) .isArticleIconVisible() .clickOnCuratedContentElementByIndex(0) .waitForLoadingSpinnerToFinishReloadingPage(); UrlChecker.isPathContainedInCurrentUrl(driver, ROOT_ARTICLE_PATH); category .openCuratedContentPage(wikiURL, MercurySubpages.CC_CATEGORY_BLOGS) .isBlogIconVisible() .clickOnCuratedContentElementByIndex(0) .waitForLoadingSpinnerToFinishReloadingPage(); UrlChecker.isPathContainedInCurrentUrl(driver, ROOT_ARTICLE_PATH); category .openCuratedContentPage(wikiURL, MercurySubpages.CC_CATEGORY_BLOGS) .isImageIconVisible() .clickOnCuratedContentElementByIndex(0) .waitForLoadingSpinnerToFinishReloadingPage(); UrlChecker.isPathContainedInCurrentUrl(driver, ROOT_ARTICLE_PATH); category .openCuratedContentPage(wikiURL, MercurySubpages.CC_CATEGORY_BLOGS) .isVideoIconVisible() .clickOnCuratedContentElementByIndex(0) .waitForLoadingSpinnerToFinishReloadingPage(); UrlChecker.isPathContainedInCurrentUrl(driver, ROOT_ARTICLE_PATH); }

Target:
public void MercuryCuratedNavigationTests_003_navigateThroughNamespaces() { CuratedContentPageObject category = new CuratedContentPageObject(driver); category .openCuratedContentPage(wikiURL, MercurySubpages.CC_CATEGORY_ARTICLES) .isArticleIconVisible() .clickOnCuratedContentElementByIndex(0) .waitForLoadingSpinnerToFinish(); category.isArticle(); UrlChecker.isPathContainedInCurrentUrl(driver, MercuryPaths.ROOT_ARTICLE_PATH); category .openCuratedContentPage(wikiURL, MercurySubpages.CC_CATEGORY_BLOGS) .isBlogIconVisible() .clickOnCuratedContentElementByIndex(0) .waitForLoadingSpinnerToFinish(); UrlChecker.isPathContainedInCurrentUrl(driver, MercuryPaths.ROOT_ARTICLE_PATH); category .openCuratedContentPage(wikiURL, MercurySubpages.CC_CATEGORY_BLOGS) .isImageIconVisible() .clickOnCuratedContentElementByIndex(0) .waitForLoadingSpinnerToFinish(); UrlChecker.isPathContainedInCurrentUrl(driver, MercuryPaths.ROOT_ARTICLE_PATH); category .openCuratedContentPage(wikiURL, MercurySubpages.CC_CATEGORY_BLOGS) .isVideoIconVisible() .clickOnCuratedContentElementByIndex(0) .waitForLoadingSpinnerToFinish(); UrlChecker.isPathContainedInCurrentUrl(driver, MercuryPaths.ROOT_ARTICLE_PATH); }
Source:
private void activate() { for (ExtensionEntry entry : loadedEntries.values()) { if (entry.enabled) { try { entry.extension = (Extension) lookupService( Extension.class, entry.getConfig().getProperty(CLASS), entry.getConfig().getProperty(MODULE) ).newInstance(); entry.extension.setContext(entry.context); entry.extension.init(); activatedEntries.put(entry.getName(), entry); MultiValueMapUtils.addToMap(entry.getProvides(), entry, providesEntries); } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | ConfigurationException ex ) { log.error( String.format( "Error in activating extension %1$s. Exception message is %2$s", entry.getName(), ex.getMessage() ) ); if (log.isDebugEnabled()) { log.error("", ex); } } } } }

Target:
private void activate() { for (ExtensionEntry entry : loadedEntries.values()) { if (entry.enabled) { try { entry.extension = (Extension) lookupService( Extension.class, entry.getConfig().getProperty(CLASS), entry.getConfig().getProperty(MODULE) ).newInstance(); entry.extension.setContext(entry.context); entry.extension.init(); activatedEntries.put(entry.getName(), entry); MultiValueMapUtils.addToMap(entry.getProvides(), entry, providesEntries); } catch (Exception ex) { log.error( String.format( "Error in activating extension %1$s. Exception message is %2$s", entry.getName(), ex.getMessage() ) ); if (log.isDebugEnabled()) { log.error("", ex); } } } } }
Source:
public void aggregate(ByteBuffer buf, int position) { ByteBuffer mutationBuffer = buf.duplicate(); mutationBuffer.position(position); Object value = valueSelector.getObject(); long time = Long.MIN_VALUE; String lastString = null; if (value instanceof SerializablePairLongString) { SerializablePairLongString serializablePair = (SerializablePairLongString) value; time = serializablePair.lhs; lastString = serializablePair.rhs; } else if (value instanceof String) { time = timeSelector.getLong(); lastString = (String) value; } else if (value != null) { throw new IllegalStateException( "Try to aggregate unsuported class type [" + value.getClass().getName() + "]. Supported class types: String or SerializablePairLongString" ); } long lastTime = mutationBuffer.getLong(position); if (lastString != null && time >= lastTime) { if (lastString.length() > maxStringBytes) { lastString = lastString.substring(0, maxStringBytes); } byte[] valueBytes = StringUtils.toUtf8(lastString); mutationBuffer.putLong(position, time); mutationBuffer.putInt(position + Long.BYTES, valueBytes.length); mutationBuffer.position(position + Long.BYTES + Integer.BYTES); mutationBuffer.put(valueBytes); } }

Target:
public void aggregate(ByteBuffer buf, int position) { ByteBuffer mutationBuffer = buf.duplicate(); mutationBuffer.position(position); Object value = valueSelector.getObject(); long time = timeSelector.getLong(); String lastString = null; if (value != null) { if (value instanceof SerializablePairLongString) { SerializablePairLongString serializablePair = (SerializablePairLongString) value; time = serializablePair.lhs; lastString = serializablePair.rhs; } else if (value instanceof String) { lastString = (String) value; } else { throw new ISE( "Try to aggregate unsuported class type [%s].Supported class types: String or SerializablePairLongString", value.getClass().getCanonicalName() ); } } long lastTime = mutationBuffer.getLong(position); if (time >= lastTime) { if (lastString != null) { if (lastString.length() > maxStringBytes) { lastString = lastString.substring(0, maxStringBytes); } byte[] valueBytes = StringUtils.toUtf8(lastString); mutationBuffer.putLong(position, time); mutationBuffer.putInt(position + Long.BYTES, valueBytes.length); mutationBuffer.position(position + Long.BYTES + Integer.BYTES); mutationBuffer.put(valueBytes); } else { mutationBuffer.putLong(position, time); mutationBuffer.putInt(position + Long.BYTES, 0); } } }
Source:
public byte[] toBytes() { ByteBuffer idBuf = ByteBuffer.allocate(sizeInBytes()); idBuf.putShort(version); switch (version) { case BLOB_ID_V1: break; case BLOB_ID_V2: case BLOB_ID_V3: byte flag = (byte) (type.ordinal() & 0x3); flag = isEncrypted ? (byte) (flag | 0x4) : flag; idBuf.put(flag); idBuf.put(datacenterId); idBuf.putShort(accountId); idBuf.putShort(containerId); break; default: throw new IllegalArgumentException("blobId version=" + version + " not supported"); } idBuf.put(partitionId.getBytes()); idBuf.putInt(uuid.getBytes().length); idBuf.put(uuid.getBytes()); return idBuf.array(); }

Target:
public byte[] toBytes() { ByteBuffer idBuf = ByteBuffer.allocate(sizeInBytes()); idBuf.putShort(version); switch (version) { case BLOB_ID_V1: break; case BLOB_ID_V2: case BLOB_ID_V3: byte flag = (byte) (type.ordinal() & BLOB_ID_TYPE_MASK); flag |= isEncrypted ? IS_ENCRYPTED_MASK : 0; idBuf.put(flag); idBuf.put(datacenterId); idBuf.putShort(accountId); idBuf.putShort(containerId); break; default: throw new IllegalArgumentException("blobId version=" + version + " not supported"); } idBuf.put(partitionId.getBytes()); idBuf.putInt(uuid.getBytes().length); idBuf.put(uuid.getBytes()); return idBuf.array(); }
Source:
public void snapshot() { map.snapshot(new GoogleMap.SnapshotReadyCallback() { @Override public void onSnapshotReady(Bitmap snapshot) { TiBlob sblob = TiBlob.blobFromImage(snapshot); KrollDict data = new KrollDict(); data.put("snapshot", sblob); data.put("source", proxy); proxy.fireEvent("onsnapshotready", data); } }); }

Target:
public void snapshot() { map.snapshot(new GoogleMap.SnapshotReadyCallback() { @Override public void onSnapshotReady(Bitmap snapshot) { TiBlob sblob = TiBlob.blobFromImage(snapshot); KrollDict data = new KrollDict(); data.put("snapshot", sblob); data.put("source", proxy); proxy.fireEvent(MapModule.EVENT_ON_SNAPSHOT_READY, data); } }); }
Source:
private void onSafeRename() { if (context.getEditorModelContent().getOriginalClassName() != null) { final String className = context.getEditorModelContent().getOriginalClassName(); showAssetUsagesDisplayer.showAssetUsages(Constants.INSTANCE.modelEditor_confirm_renaming_of_used_class(className), versionRecordManager.getCurrentPath(), className, ResourceType.JAVA, () -> rename(), () -> { }); } else { rename(); } }

Target:
public void onSafeRename() { if (context.getEditorModelContent().getOriginalClassName() != null) { final String className = context.getEditorModelContent().getOriginalClassName(); showAssetUsagesDisplayer.showAssetUsages(Constants.INSTANCE.modelEditor_confirm_renaming_of_used_class(className), versionRecordManager.getCurrentPath(), className, ResourceType.JAVA, () -> rename(), () -> { }); } else { rename(); } }
Source:
public boolean execute(String jobName, Date jobRunDate) throws InterruptedException { boolean jobCompletedSuccessfully = true; concurRequestExtractCreatePdpFeedService.createPdpFeedsFromRequestExtracts(); return jobCompletedSuccessfully; }

Target:
public boolean execute(String jobName, Date jobRunDate) throws InterruptedException { getConcurRequestExtractCreatePdpFeedService().createPdpFeedsFromRequestExtracts(); return true; }
Source:
private PDataType getViewIndexDataType() throws SQLException { boolean supportsLongViewIndexId = "true".equalsIgnoreCase(connection.getClientInfo(LONG_VIEW_INDEX_ENABLED_ATTRIB)); return supportsLongViewIndexId ? MetaDataUtil.getViewIndexIdDataType() : MetaDataUtil.getLegacyViewIndexIdDataType(); }

Target:
private PDataType getViewIndexDataType() throws SQLException { boolean supportsLongViewIndexId = connection.getQueryServices().getProps().getBoolean( QueryServices.LONG_VIEW_INDEX_ENABLED_ATTRIB, QueryServicesOptions.DEFAULT_LONG_VIEW_INDEX_ENABLED); return supportsLongViewIndexId ? MetaDataUtil.getViewIndexIdDataType() : MetaDataUtil.getLegacyViewIndexIdDataType(); }
Source:
private Boolean calcNoAutoImportAll() { return containsCompileDirectiveWithOption("no_auto_import"); }

Target:
private boolean calcNoAutoImportAll() { return containsCompileDirectiveWithOption("no_auto_import"); }
Source:
public void testDeregister() { tested.init(canvasHandler); tested.register(element); tested.deregister(element); verify(shapeEventHandler, times(3)).removeHandler(any(ViewHandler.class)); assertFalse(tested.isRegistered(element)); }

Target:
public void testDeregister() { tested.init(canvasHandler); tested.register(element); tested.deregister(element); verify(shapeEventHandler, atLeastOnce()).removeHandler(any(ViewHandler.class)); assertFalse(tested.isRegistered(element)); }
Source:
public static void buildAndDeployArtifacts() { KieServerDeployer.buildAndDeployCommonMavenParent(); KieServerDeployer.buildAndDeployMavenProjectFromResource("/kjars-sources/scorecard_mm"); KieMavenRepository kmp = KieMavenRepository.getKieMavenRepository(); File artifact = kmp.resolveArtifact(releaseId).getFile(); if (artifact != null) { URL urls[] = new URL[1]; try { urls[0] = artifact.toURI().toURL(); classLoader = new KieURLClassLoader(urls, PMML4Result.class.getClassLoader()); } catch (MalformedURLException e) { logger.error("FAILED TO GET CLASSLOADER !!!"); } } else { logger.error("Could not find artifact file and no class loader created"); } KieServicesClient client = createDefaultStaticClient(EXTENDED_TIMEOUT); ServiceResponse<KieContainerResource> reply = client.createContainer(CONTAINER_ID, new KieContainerResource(CONTAINER_ID, releaseId)); KieServerAssert.assertSuccess(reply); }

Target:
public static void buildAndDeployArtifacts() { KieServerDeployer.buildAndDeployCommonMavenParent(); KieServerDeployer.buildAndDeployMavenProjectFromResource(KJAR_RESOURCE_PATH); KieMavenRepository kmp = KieMavenRepository.getKieMavenRepository(); File artifact = kmp.resolveArtifact(releaseId).getFile(); if (artifact != null) { URL urls[] = new URL[1]; try { urls[0] = artifact.toURI().toURL(); classLoader = new KieURLClassLoader(urls, PMML4Result.class.getClassLoader()); } catch (MalformedURLException e) { logger.error("FAILED TO GET CLASSLOADER !!!"); } } else { logger.error("Could not find artifact file and no class loader created"); } KieServicesClient client = createDefaultStaticClient(EXTENDED_TIMEOUT); ServiceResponse<KieContainerResource> reply = client.createContainer(CONTAINER_ID, new KieContainerResource(CONTAINER_ID, releaseId)); KieServerAssert.assertSuccess(reply); }
Source:
public void testMultipleAsyncClients() { Injector injector = Guice.createInjector( new Module() { @Override public void configure(Binder binder) { httpClientBinder(binder).bindAsyncHttpClient("foo", FooClient.class); httpClientBinder(binder).bindAsyncHttpClient("bar", BarClient.class); } }, new ConfigurationModule(new ConfigurationFactory(Collections.<String, String>emptyMap()))); AsyncHttpClient fooClient = injector.getInstance(Key.get(AsyncHttpClient.class, FooClient.class)); AsyncHttpClient barClient = injector.getInstance(Key.get(AsyncHttpClient.class, BarClient.class)); Assert.assertNotSame(fooClient, barClient); injector.getInstance(NettyIoPool.class).close(); }

Target:
public void testMultipleAsyncClients() { Injector injector = Guice.createInjector( new Module() { @Override public void configure(Binder binder) { httpClientBinder(binder).bindAsyncHttpClient("foo", FooClient.class); httpClientBinder(binder).bindAsyncHttpClient("bar", BarClient.class); } }, new ConfigurationModule(new ConfigurationFactory(Collections.<String, String>emptyMap()))); AsyncHttpClient fooClient = injector.getInstance(Key.get(AsyncHttpClient.class, FooClient.class)); AsyncHttpClient barClient = injector.getInstance(Key.get(AsyncHttpClient.class, BarClient.class)); Assert.assertNotSame(fooClient, barClient); assertNull(injector.getExistingBinding(Key.get(NettyIoPool.class, FooClient.class))); assertNull(injector.getExistingBinding(Key.get(NettyIoPool.class, BarClient.class))); injector.getInstance(NettyIoPool.class).close(); }
Source:
private static Statistics stringColumnStats(String minimum, String maximum) { Statistics.Builder builder = Statistics.getBuilderForReading(new PrimitiveType(Type.Repetition.OPTIONAL, PrimitiveType.PrimitiveTypeName.BINARY, "testFile", OriginalType.UTF8)); builder.withMin(minimum.getBytes()) .withMax(maximum.getBytes()) .withNumNulls(0); return builder.build(); }

Target:
private static Statistics stringColumnStats(String minimum, String maximum) { Statistics.Builder builder = Statistics.getBuilderForReading(new PrimitiveType(OPTIONAL, BINARY, "testFile", UTF8)); builder.withMin(minimum.getBytes()) .withMax(maximum.getBytes()) .withNumNulls(0); return builder.build(); }
Source:
public void testGetNonOverWritingFileNameReturnsUniqueNameOver1Conflict() throws IOException { Path dummyFilePath1 = tempDir.resolve("differentFile.txt"); Files.createFile(dummyFilePath1); String outputFileName = FileNameUniqueness.getNonOverWritingFileName(tempDir, "differentFile.txt"); assertEquals("differentFile (1).txt", outputFileName); Files.delete(dummyFilePath1); }

Target:
public void testGetNonOverWritingFileNameReturnsUniqueNameOver1Conflict() throws IOException { Path dummyFilePath1 = tempDir.resolve("differentFile.txt"); Files.createFile(dummyFilePath1); String outputFileName = FileNameUniqueness.getNonOverWritingFileName(tempDir, "differentFile.txt"); assertEquals("differentFile (1).txt", outputFileName); }
Source:
public void testPush() throws Exception { AzureDataSegmentPusher pusher = new AzureDataSegmentPusher(azureStorage, azureAccountConfig, jsonMapper); File tmpDir = Files.createTempDir(); tmpDir.deleteOnExit(); File tmp = new File(tmpDir, "version.bin"); tmp.deleteOnExit(); final byte[] data = new byte[]{0x0, 0x0, 0x0, 0x1}; Files.write(data, tmp); final long size = data.length; DataSegment segmentToPush = new DataSegment( "foo", new Interval("2015/2016"), "0", Maps.<String, Object>newHashMap(), Lists.<String>newArrayList(), Lists.<String>newArrayList(), new NoneShardSpec(), 0, size ); DataSegment segment = pusher.push(tmpDir, segmentToPush); Assert.assertEquals(segmentToPush.getSize(), segment.getSize()); }

Target:
public void testPush() throws Exception { AzureDataSegmentPusher pusher = new AzureDataSegmentPusher(azureStorage, azureAccountConfig, jsonMapper); File tmp = tempFolder.newFile("version.bin"); final byte[] data = new byte[]{0x0, 0x0, 0x0, 0x1}; Files.write(data, tmp); final long size = data.length; DataSegment segmentToPush = new DataSegment( "foo", new Interval("2015/2016"), "0", Maps.<String, Object>newHashMap(), Lists.<String>newArrayList(), Lists.<String>newArrayList(), new NoneShardSpec(), 0, size ); DataSegment segment = pusher.push(tempFolder.getRoot(), segmentToPush); Assert.assertEquals(segmentToPush.getSize(), segment.getSize()); }
Source:
public void recreateStructures(Chunk chunkIn, int x, int z) { if (this.baseGenerator instanceof IChunkGenerator) { ((IChunkGenerator) this.baseGenerator).recreateStructures(chunkIn, x, z); return; } if (this.baseGenerator instanceof SpongeGenerationPopulator) { ((SpongeGenerationPopulator) this.baseGenerator).getHandle(this.world).recreateStructures(chunkIn, x, z); } for (GenerationPopulator populator : this.genpop) { if (populator instanceof MapGenStructure) { ((MapGenStructure) populator).generate(chunkIn.getWorld(), x, z, null); } } }

Target:
public void recreateStructures(Chunk chunkIn, int x, int z) { if (this.baseGenerator instanceof IChunkGenerator) { ((IChunkGenerator) this.baseGenerator).recreateStructures(chunkIn, x, z); } if (this.baseGenerator instanceof SpongeGenerationPopulator) { ((SpongeGenerationPopulator) this.baseGenerator).getHandle(this.world).recreateStructures(chunkIn, x, z); } for (GenerationPopulator populator : this.genpop) { if (populator instanceof MapGenStructure) { ((MapGenStructure) populator).generate(chunkIn.getWorld(), x, z, null); } } }
Source:
public org.atlasapi.media.entity.simple.Image simplify(Image image, Set<Annotation> annotations, ApplicationConfiguration config) { if (image == null) { return new org.atlasapi.media.entity.simple.Image(); } org.atlasapi.media.entity.simple.Image simpleImage = new org.atlasapi.media.entity.simple.Image(image.getCanonicalUri()); if (image.getType() != null) { if(image.getType() != ImageType.GENERIC) { simpleImage.setImageType(image.getType().getName()); } } if (image.getColor() != null) { simpleImage.setColor(image.getColor().getName()); } if (image.getTheme() != null) { simpleImage.setTheme(image.getTheme().getName()); } if (image.getWidth() != null) { simpleImage.setWidth(image.getWidth()); } if (image.getHeight() != null) { simpleImage.setHeight(image.getHeight()); } if (image.getAspectRatio() != null) { simpleImage.setAspectRatio(image.getAspectRatio().getName()); } if (image.getMimeType() != null) { simpleImage.setMimeType(image.getMimeType().toString()); } if (image.getAvailabilityStart() != null) { simpleImage.setAvailabilityStart(image.getAvailabilityStart().toDate()); } if (image.getAvailabilityEnd() != null) { simpleImage.setAvailabilityEnd(image.getAvailabilityEnd().toDate()); } return simpleImage; }

Target:
public org.atlasapi.media.entity.simple.Image simplify(Image image, Set<Annotation> annotations, ApplicationConfiguration config) { if (image == null) { return new org.atlasapi.media.entity.simple.Image(); } org.atlasapi.media.entity.simple.Image simpleImage = new org.atlasapi.media.entity.simple.Image(image.getCanonicalUri()); if (image.getType() != null) { simpleImage.setImageType(image.getType().getName()); } if (image.getColor() != null) { simpleImage.setColor(image.getColor().getName()); } if (image.getTheme() != null) { simpleImage.setTheme(image.getTheme().getName()); } if (image.getWidth() != null) { simpleImage.setWidth(image.getWidth()); } if (image.getHeight() != null) { simpleImage.setHeight(image.getHeight()); } if (image.getAspectRatio() != null) { simpleImage.setAspectRatio(image.getAspectRatio().getName()); } if (image.getMimeType() != null) { simpleImage.setMimeType(image.getMimeType().toString()); } if (image.getAvailabilityStart() != null) { simpleImage.setAvailabilityStart(image.getAvailabilityStart().toDate()); } if (image.getAvailabilityEnd() != null) { simpleImage.setAvailabilityEnd(image.getAvailabilityEnd().toDate()); } return simpleImage; }
Source:
public static void init() { handle = new DBI("jdbc:postgresql:jdbi_test", "postgres", "").open(); handle.execute("create table something (id int primary key, name varchar(100))"); }

Target:
public static void init() { handle = new DBI("jdbc:postgresql:jdbi_test", "postgres", "").open(); handle.execute("create table something (id int primary key, name varchar(100))"); handle.execute("insert into something(id, name) values(1, null)"); handle.execute("insert into something(id, name) values(2, 'bla')"); handle.execute("insert into something(id, name) values(3, 'null')"); handle.execute("insert into something(id, name) values(4, '')"); }
Source:
protected void doTask(Channel channel) { Long lastRead = lastRead(channel); Long now = now(); if (lastRead != null && now - lastRead > heartbeatTimeout) { if (channel instanceof Client) { try { logger.warn("Reconnect to remote channel " + channel.getRemoteAddress() + ", because heartbeat read idle time out: " + heartbeatTimeout + "ms"); ((Client) channel).reconnect(); } catch (Throwable t) { logger.warn("Exception when reconnect to remote channel " + channel.getRemoteAddress(), t); } } else { try { logger.warn("Close channel " + channel + ", because heartbeat read idle time out: " + heartbeatTimeout + "ms"); channel.close(); } catch (Throwable t) { logger.warn("Exception when close channel " + channel, t); } } } }

Target:
protected void doTask(Channel channel) { Long lastRead = lastRead(channel); Long now = now(); if (lastRead != null && now - lastRead > heartbeatTimeout) { if (channel instanceof Client) { try { logger.warn("Reconnect to remote channel " + channel.getRemoteAddress() + ", because heartbeat read idle time out: " + heartbeatTimeout + "ms"); ((Client) channel).reconnect(); } catch (Throwable t) { } } else { try { logger.warn("Close channel " + channel + ", because heartbeat read idle time out: " + heartbeatTimeout + "ms"); channel.close(); } catch (Throwable t) { logger.warn("Exception when close channel " + channel, t); } } } }