auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testNanHash() { int nanValues[] = new int[] {floatToIntBits(Float.NaN), floatToRawIntBits(Float.NaN), -0x400000, 0x7fc00000}; assertEquals(RealOperators.hashCode(nanValues[0]), RealOperators.hashCode(nanValues[1])); assertEquals(RealOperators.hashCode(nanValues[0]), RealOperators.hashCode(nanValues[2])); assertEquals(RealOperators.hashCode(nanValues[0]), RealOperators.hashCode(nanValues[3])); }

Target:
public void testNanHash() { int[] nanRepresentations = {floatToIntBits(Float.NaN), 0xffc00000, 0x7fc00000, 0x7fc01234, 0xffc01234}; for (int nanRepresentation : nanRepresentations) { assertTrue(isNaN(intBitsToFloat(nanRepresentation))); assertEquals(RealOperators.hashCode(nanRepresentation), RealOperators.hashCode(nanRepresentations[0])); } }
Source:
public void testInitialization() { assertNull(fModule.getStateSystem()); fModule.schedule(); assertEquals("Initialization succeeded", true, fModule.waitForInitialization()); assertNotNull(fModule.getStateSystem()); }

Target:
public void testInitialization() { assertNull(fModule.getStateSystem()); fModule.schedule(); assertTrue("Initialization succeeded", fModule.waitForInitialization()); assertNotNull(fModule.getStateSystem()); }
Source:
private boolean isDetailFileLineValidCashAdvanceRequest(ConcurRequestExtractRequestDetailFileLine detailFileLine) { if (detailFileLine.getValidationResult().isCashAdvanceLine() && detailFileLine.getValidationResult().isValidCashAdvanceLine()) { return true; } else { return false; } }

Target:
private boolean isDetailFileLineValidCashAdvanceRequest(ConcurRequestExtractRequestDetailFileLine detailFileLine) { return (detailFileLine.getValidationResult().isCashAdvanceLine() && detailFileLine.getValidationResult().isValidCashAdvanceLine()); }
Source:
public CopyDepthNode(Context context) { DisplayResolutionDependentFBOs displayResolutionDependentFBOs = context.get(DisplayResolutionDependentFBOs.class); lastUpdatedGBuffer = displayResolutionDependentFBOs.getGBufferPair().getLastUpdatedFbo(); copyDepthFbo = requiresFBO(new FBOConfig(COPY_DEPTH_FBO_URI, FULL_SCALE, FBO.Type.HDR).useDepthBuffer(), displayResolutionDependentFBOs); addDesiredStateChange(new BindFbo(copyDepthFbo)); lastUpdatedGBuffer.attachDepthBufferTo(copyDepthFbo); activeCamera = context.get(WorldRenderer.class).getActiveCamera(); addDesiredStateChange(new EnableMaterial(COPY_DEPTH_MATERIAL_URN)); copyDepthMaterial = getMaterial(COPY_DEPTH_MATERIAL_URN); int textureSlot = 0; addDesiredStateChange(new SetInputTextureFromFbo(textureSlot++, lastUpdatedGBuffer, ColorTexture, displayResolutionDependentFBOs, COPY_DEPTH_MATERIAL_URN, "texSceneOpaque")); addDesiredStateChange(new SetInputTextureFromFbo(textureSlot++, lastUpdatedGBuffer, DepthStencilTexture, displayResolutionDependentFBOs, COPY_DEPTH_MATERIAL_URN, "texSceneOpaqueDepth")); addDesiredStateChange(new SwapGBuffers(displayResolutionDependentFBOs.getGBufferPair())); }

Target:
public CopyDepthNode(Context context) { DisplayResolutionDependentFBOs displayResolutionDependentFBOs = context.get(DisplayResolutionDependentFBOs.class); lastUpdatedGBuffer = displayResolutionDependentFBOs.getGBufferPair().getLastUpdatedFbo(); outputFbo = requiresFBO(new FBOConfig(COPY_DEPTH_FBO_URI, FULL_SCALE, Type.NO_COLOR).useDepthBuffer(), displayResolutionDependentFBOs); addDesiredStateChange(new BindFbo(outputFbo)); addDesiredStateChange(new SetViewportToSizeOf(outputFbo)); addDesiredStateChange(new EnableMaterial(COPY_DEPTH_MATERIAL_URN)); copyDepthMaterial = getMaterial(COPY_DEPTH_MATERIAL_URN); int textureSlot = 0; addDesiredStateChange(new SetInputTextureFromFbo(textureSlot++, lastUpdatedGBuffer, DepthStencilTexture, displayResolutionDependentFBOs, COPY_DEPTH_MATERIAL_URN, "texSceneOpaqueDepth")); }
Source:
public void equalsAndHashCodeEqualTest() throws Exception { final Take take = new TkText("text"); new Assertion<>( "Must evaluate true equality", new TkConsumes( take, "Content-Type: text/plain" ), new IsEqual<>( new TkConsumes( take, "Content-Type: text/plain" ) ) ).affirm(); }

Target:
public void equalsAndHashCodeEqualTest() throws Exception { final Take take = new TkText("text"); final String type = "Content-Type: text/plain"; new Assertion<>( "Must evaluate true equality", new TkConsumes(take, type), new IsEqual<>(new TkConsumes(take, type)) ).affirm(); }
Source:
public EntityManagerFactory getEntityManagerFactory() { if (entityManagerFactory == null) { return synchronizedGetEntityManagerFactory(); } return entityManagerFactory; }

Target:
public EntityManagerFactory getEntityManagerFactory() { if (entityManagerFactory != null && !entityManagerFactory.isOpen()) { return synchronizedGetEntityManagerFactory(); } return entityManagerFactory; }
Source:
private String getActionName(Action action, Command command) { if (command.getClass().isAnonymousClass()) { return action.getText(); } else { String ans = command.getClass().getSimpleName(); if (ans.contains("OldDatabaseCommandWrapper")) { OldDatabaseCommandWrapper tmp = (OldDatabaseCommandWrapper) command; return tmp.getActions().toString(); } else if (ans.contains("EditAction")) { return command.toString(); } else { return command.getClass().getSimpleName(); } } }

Target:
private String getActionName(Action action, Command command) { if (command.getClass().isAnonymousClass()) { return action.getText(); } else { String commandName = command.getClass().getSimpleName(); if ((command instanceof OldDatabaseCommandWrapper) || (command instanceof OldCommandWrapper) || commandName.contains("EditAction")) { return command.toString(); } else { return commandName; } } }
Source:
public Bucket couchbaseClient() throws Exception { Cluster cluster = couchbaseCluster(); if(getUserName().compareTo(getBucketName()) != 0) { cluster.authenticate(getUserName(), getBucketPassword()); } else if (getBucketPassword().compareTo("") != 0) { return cluster.openBucket(getBucketName(), getBucketPassword()); } return cluster.openBucket(getBucketName()); }

Target:
public Bucket couchbaseClient() throws Exception { Cluster cluster = couchbaseCluster(); if(!getUsername().contentEquals(getBucketName())){ cluster.authenticate(getUsername(), getBucketPassword()); } else if (!getBucketPassword().isEmpty()) { return cluster.openBucket(getBucketName(), getBucketPassword()); } return cluster.openBucket(getBucketName()); }
Source:
public void useDefaultTrustStoreMechanism() throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException { SSLContext c = SSLContext.getInstance(this.sslAlgorithm); c.init(null, new TrustManager[] { getDefaultTrustManager(TrustManagerFactory.getDefaultAlgorithm(), null) }, null); this.connectionFactory.useSslProtocol(c); }

Target:
private void useDefaultTrustStoreMechanism() throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException { SSLContext sslContext = SSLContext.getInstance(this.sslAlgorithm); TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); trustManagerFactory.init((KeyStore) null); sslContext.init(null, trustManagerFactory.getTrustManagers(), null); this.connectionFactory.useSslProtocol(sslContext); }
Source:
private File[] pack(final Repository src, final RevObject... list) throws IOException { try (final PackWriter pw = new PackWriter(src)) { for (final RevObject o : list) { pw.addObject(o); } final ObjectId name = pw.computeName(); final File packFile = fullPackFileName(name, ".pack"); final File idxFile = fullPackFileName(name, ".idx"); final File[] files = new File[] { packFile, idxFile }; write(files, pw); return files; } }

Target:
private File[] pack(final Repository src, final RevObject... list) throws IOException { try (PackWriter pw = new PackWriter(src)) { for (final RevObject o : list) { pw.addObject(o); } final ObjectId name = pw.computeName(); final File packFile = fullPackFileName(name, ".pack"); final File idxFile = fullPackFileName(name, ".idx"); final File[] files = new File[] { packFile, idxFile }; write(files, pw); return files; } }
Source:
public String renderAfterConstructorJs() { StringBuilder builder = new StringBuilder(); if (getModel().getObject().getLayers() != null) { for (Layer layer : getModel().getObject().getLayers()) { if (layer.getSource() != null && layer.getSource() instanceof VectorSource) { VectorSource vectorSource = (VectorSource) layer.getSource(); if (vectorSource.getFeatures() != null) { for (Feature feature : vectorSource.getFeatures()) { builder.append(feature.renderAfterConstructorJs()); } } } } } return builder.toString(); }

Target:
public String renderAfterConstructorJs() { StringBuilder builder = new StringBuilder(); Map map = getModelObject(); if (map.getLayers() != null) { for (Layer layer : map.getLayers()) { if (layer.getSource() != null && layer.getSource() instanceof VectorSource) { VectorSource vectorSource = (VectorSource) layer.getSource(); if (vectorSource.getFeatures() != null) { for (Feature feature : vectorSource.getFeatures()) { builder.append(feature.renderAfterConstructorJs()); } } } } } return builder.toString(); }
Source:
public Collision findWithMotion(Mover mover, Point start, Point motion, double part) { Point wh = mover.getAABBDimensions(); int steps = getSteps(mover, part, wh); if(steps == 0) { return new Collision(start, motion, false, null); } Point delta = motion.multiply(part).divide(steps); Collision collision = sweep(mover, start, null, delta, mover.getAABBDimensions(), mover.getMotion(), steps, 0); double newXLocation = Math.round(collision.getPoint().getX() * ONE_DEV_PRECISION) * PRECISION; double newYLocation = Math.round(collision.getPoint().getY() * ONE_DEV_PRECISION) * PRECISION; Point newLocation = new Point(newXLocation, newYLocation); newLocation = checkLevelBounds(mover, newLocation); return new Collision(newLocation, collision.getCurrent(), collision.isCollided(), collision.getCell()); }

Target:
public Collision findWithMotion(Mover mover, Point start, Point motion, double part) { Point widthHeight = mover.getAABBDimensions(); int steps = getSteps(mover, part, widthHeight); if(steps == 0) { return new Collision(start, motion, false, null); } Point delta = motion.multiply(part).divide(steps); Collision collision = sweep(start, null, delta, mover.getAABBDimensions(), mover.getMotion(), steps, 0); double newXLocation = Math.round(collision.getPoint().getX() * ONE_DEV_PRECISION) * PRECISION; double newYLocation = Math.round(collision.getPoint().getY() * ONE_DEV_PRECISION) * PRECISION; Point newLocation = new Point(newXLocation, newYLocation); newLocation = checkLevelBounds(mover, newLocation); return new Collision(newLocation, collision.getCurrent(), collision.isCollided(), collision.getCell()); }
Source:
public String toString() { return name().toLowerCase(); }

Target:
public String toString() { return name; }
Source:
public void testGetUriByFilenameFindsAbsoluteResourceOnClasspath() throws Exception { final String filename = "/" + PACKAGE_DIR_NAME + "/commonutil/Input" + SIMPLE_CLASS_NAME + "_empty_checks.xml"; final URI uri = CommonUtil.getUriByFilename(filename); assertThat("URI is null for: " + filename, uri, is(not(nullValue()))); }

Target:
public void testGetUriByFilenameFindsAbsoluteResourceOnClasspath() throws Exception { final String filename = "/" + getPackageLocation() + "/InputCommonUtilTest_empty_checks.xml"; final URI uri = CommonUtil.getUriByFilename(filename); assertThat("URI is null for: " + filename, uri, is(not(nullValue()))); }
Source:
public void stop(String workspaceId) throws NotFoundException, ServerException, ConflictException { ensurePreDestroyIsNotExecuted(); acquireWriteLock(workspaceId); final WorkspaceRuntimeImpl runtime; try { ensurePreDestroyIsNotExecuted(); final RuntimeDescriptor descriptor = descriptors.get(workspaceId); if (descriptor == null) { throw new NotFoundException("Workspace with id '" + workspaceId + "' is not running."); } if (descriptor.getRuntimeStatus() != WorkspaceStatus.RUNNING) { throw new ConflictException(format("Couldn't stop '%s' workspace because its status is '%s'. " + "Workspace can be stopped only if it is 'RUNNING'", workspaceId, descriptor.getRuntimeStatus())); } descriptor.setRuntimeStatus(WorkspaceStatus.STOPPING); startQueues.remove(workspaceId); runtime = new WorkspaceRuntimeImpl(descriptor.getRuntime()); } finally { releaseWriteLock(workspaceId); } destroyRuntime(workspaceId, runtime); }

Target:
public void stop(String workspaceId) throws NotFoundException, ServerException, ConflictException { ensurePreDestroyIsNotExecuted(); acquireWriteLock(workspaceId); final WorkspaceRuntimeImpl runtime; try { ensurePreDestroyIsNotExecuted(); final RuntimeDescriptor descriptor = descriptors.get(workspaceId); if (descriptor == null) { throw new NotFoundException("Workspace with id '" + workspaceId + "' is not running."); } if (descriptor.getRuntimeStatus() != WorkspaceStatus.RUNNING) { throw new ConflictException( format("Couldn't stop '%s' workspace because its status is '%s'. Workspace can be stopped only if it is 'RUNNING'", workspaceId, descriptor.getRuntimeStatus())); } descriptor.setRuntimeStatus(WorkspaceStatus.STOPPING); startQueues.remove(workspaceId); runtime = new WorkspaceRuntimeImpl(descriptor.getRuntime()); } finally { releaseWriteLock(workspaceId); } destroyRuntime(workspaceId, runtime); }
Source:
public static void runFromServlet() { isRunFromServlet.compareAndSet(false, true); }

Target:
public static void runFromServlet() { isRunningFromServlet.set(true); }
Source:
public void testCanStartAndStopAReplicaSet() { final MongoDBReplicaSet replicaSet = makeAndStartReplicaSet(3, "can-start-and-stop"); for (MongoDBServer s : replicaSet.getSecondaries()) { System.err.println(s); } }

Target:
public void testCanStartAndStopAReplicaSet() { final MongoDBReplicaSet replicaSet = makeAndStartReplicaSet(3, "can-start-and-stop"); replicaSet.stop(); assertFalse(replicaSet.getAttribute(Startable.SERVICE_UP)); }
Source:
public void index(List<KObject> elements) { elements.stream() .forEach(ko -> this.index(ko)); }

Target:
public void index(List<KObject> elements) { elements.forEach(ko -> this.index(ko)); }
Source:
private void clear(final int noOfRecordsToKeep) { final String sqlTableName = this.dbHelper .sanitizeSqlTableAndColumnName(this.wireRecordStoreOptions.getTableName()); Connection conn = null; try { conn = this.dbHelper.getConnection(); final String catalog = conn.getCatalog(); final DatabaseMetaData dbMetaData = conn.getMetaData(); final ResultSet rsTbls = dbMetaData.getTables(catalog, null, this.wireRecordStoreOptions.getTableName(), TABLE_TYPE); if (rsTbls.next()) { if (noOfRecordsToKeep == 0) { logger.info(message.truncatingTable(sqlTableName)); this.dbHelper.execute(MessageFormat.format(SQL_TRUNCATE_TABLE, sqlTableName)); } else { this.dbHelper .execute(MessageFormat.format(SQL_DELETE_RANGE_TABLE, sqlTableName, noOfRecordsToKeep)); } } } catch (final SQLException sqlException) { logger.error(message.errorTruncatingTable(sqlTableName), sqlException); } finally { if (nonNull(conn)) { this.dbHelper.close(conn); } } }

Target:
private void clear(final int noOfRecordsToKeep) { final String tableName = this.wireRecordStoreOptions.getTableName(); final String sqlTableName = this.dbHelper.sanitizeSqlTableAndColumnName(tableName); Connection conn = null; try { conn = this.dbHelper.getConnection(); final String catalog = conn.getCatalog(); final DatabaseMetaData dbMetaData = conn.getMetaData(); final ResultSet rsTbls = dbMetaData.getTables(catalog, null, tableName, TABLE_TYPE); if (rsTbls.next()) { if (noOfRecordsToKeep == 0) { logger.info(message.truncatingTable(sqlTableName)); this.dbHelper.execute(MessageFormat.format(SQL_TRUNCATE_TABLE, sqlTableName)); } else { this.dbHelper .execute(MessageFormat.format(SQL_DELETE_RANGE_TABLE, sqlTableName, noOfRecordsToKeep)); } } } catch (final SQLException sqlException) { logger.error(message.errorTruncatingTable(sqlTableName), sqlException); } finally { if (nonNull(conn)) { this.dbHelper.close(conn); } } }
Source:
public WizardPage getRepositorySearchPage() throws CoreException { if (repositorySearchPageELement == null) return null; Object object = repositorySearchPageELement .createExecutableExtension("class"); WizardPage page = null; if (object instanceof WizardPage && object instanceof IRepositorySearchResult) { page = (WizardPage) object; } return page; }

Target:
public WizardPage getRepositorySearchPage() throws CoreException { if (repositorySearchPageELement == null) return null; Object object = repositorySearchPageELement .createExecutableExtension("class"); WizardPage page = null; if (object instanceof WizardPage && object instanceof IRepositorySearchResult) page = (WizardPage) object; return page; }
Source:
private void updateUndefinedSize() { assert !definedSize : "This method should never be called when using defined size"; int previousAssumedSize = assumedSize; if (resendEntireRange || sizeReset) { assumedSize = getRowCountEstimate(); } else { if (requestedRange.getEnd() + pageSize > assumedSize) { assumedSize += getRowCountEstimateIncrease(); } } getLogger(DataCommunicator.class).info( "Requested range: old size: new size: {}", requestedRange, previousAssumedSize, assumedSize); }

Target:
private void updateUndefinedSize() { assert !definedSize : "This method should never be called when using defined size"; int previousAssumedSize = assumedSize; if (resendEntireRange || sizeReset) { assumedSize = getRowCountEstimate(); } while (requestedRange.getEnd() + pageSize > assumedSize) { assumedSize += getRowCountEstimateIncrease(); } getLogger(DataCommunicator.class).info( "Requested range: old size: new size: {}", requestedRange, previousAssumedSize, assumedSize); }
Source:
public void init() throws APIManagerIntegrationTestException { apiPublisher = new APIPublisherRestClient(publisherURL); apiPublisher.login("admin", "admin"); }

Target:
public void init() throws Exception { createUsers(); apiPublisher = new APIPublisherRestClient(publisherURL); apiPublisher.login(APICreator, pw); }
Source:
public boolean start() { if (stopping()) return false; try { if (!started.compareAndSet(false, true)) return false; tmpSnpDir = U.resolveWorkDirectory(tmpTaskWorkDir.getAbsolutePath(), databaseRelativePath(cctx.kernalContext().pdsFolderResolver().resolveFolders().folderName()), false); for (Integer grpId : parts.keySet()) { CacheGroupContext gctx = cctx.cache().cacheGroup(grpId); if (gctx == null) throw new IgniteCheckedException("Cache group context has not found. Cache group is stopped: " + grpId); if (!CU.isPersistentCache(gctx.config(), cctx.kernalContext().config().getDataStorageConfiguration())) throw new IgniteCheckedException("In-memory cache groups are not allowed to be snapshot: " + grpId); if (gctx.config().isEncryptionEnabled()) throw new IgniteCheckedException("Encrypted cache groups are not allowed to be snapshot: " + grpId); U.ensureDirectory(cacheWorkDir(tmpSnpDir, cacheDirName(gctx.config())), "directory for snapshotting cache group", log); } startedFut.listen(f -> ((GridCacheDatabaseSharedManager)cctx.database()).removeCheckpointListener(this) ); ((GridCacheDatabaseSharedManager)cctx.database()).addCheckpointListener(this); if (log.isInfoEnabled()) { log.info("Snapshot operation is scheduled on local node and will be handled by the checkpoint " + "listener [sctx=" + this + ", topVer=" + cctx.discovery().topologyVersionEx() + ']'); } } catch (IgniteCheckedException e) { acceptException(e); return false; } return true; }

Target:
public boolean start() { if (stopping()) return false; try { if (!started.compareAndSet(false, true)) return false; tmpConsIdDir = U.resolveWorkDirectory(tmpSnpWorkDir.getAbsolutePath(), databaseRelativePath(cctx.kernalContext().pdsFolderResolver().resolveFolders().folderName()), false); for (Integer grpId : parts.keySet()) { CacheGroupContext gctx = cctx.cache().cacheGroup(grpId); if (gctx == null) throw new IgniteCheckedException("Cache group context not found: " + grpId); if (!CU.isPersistentCache(gctx.config(), cctx.kernalContext().config().getDataStorageConfiguration())) throw new IgniteCheckedException("In-memory cache groups are not allowed to be snapshot: " + grpId); if (gctx.config().isEncryptionEnabled()) throw new IgniteCheckedException("Encrypted cache groups are not allowed to be snapshot: " + grpId); U.ensureDirectory(cacheWorkDir(tmpConsIdDir, cacheDirName(gctx.config())), "directory for snapshotting cache group", log); } startedFut.listen(f -> ((GridCacheDatabaseSharedManager)cctx.database()).removeCheckpointListener(this) ); ((GridCacheDatabaseSharedManager)cctx.database()).addCheckpointListener(this); if (log.isInfoEnabled()) { log.info("Snapshot operation is scheduled on local node and will be handled by the checkpoint " + "listener [sctx=" + this + ", topVer=" + cctx.discovery().topologyVersionEx() + ']'); } } catch (IgniteCheckedException e) { acceptException(e); return false; } return true; }
Source:
protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException { try { ob.reset(abvs); TaggedValuePointable tvp; TaggedValuePointable tempKey = ppool.takeOne(TaggedValuePointable.class); TaggedValuePointable tempValue = ppool.takeOne(TaggedValuePointable.class); tvp = args[0]; if (tvp.getTag() == ValueTag.SEQUENCE_TAG) { tvp.getValue(seqp); int len = seqp.getEntryCount(); pointables = new TaggedValuePointable[len / 2]; for (int i = 0; i < len; i += 2) { seqp.getEntry(i, tempKey); seqp.getEntry(i + 1, tempValue); if (!isDuplicate(tempKey)) { pointables[i / 2] = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable(); tempKey.getValue(pointables[i / 2]); sp.set(vp); ob.addItem(sp, tempValue); } else { throw new SystemException(ErrorCode.JNDY0003); } } ppool.giveBack(tempKey); ppool.giveBack(tempValue); } ob.finish(); result.set(abvs); } catch (IOException e) { throw new SystemException(ErrorCode.SYSE0001, e); } }

Target:
protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException { TaggedValuePointable tvp; TaggedValuePointable tempKey = ppool.takeOne(TaggedValuePointable.class); TaggedValuePointable tempValue = ppool.takeOne(TaggedValuePointable.class); try { ob.reset(abvs); tvp = args[0]; if (tvp.getTag() == ValueTag.SEQUENCE_TAG) { tvp.getValue(seqp); int len = seqp.getEntryCount(); pointables = new TaggedValuePointable[len / 2]; for (int i = 0; i < len; i += 2) { seqp.getEntry(i, tempKey); seqp.getEntry(i + 1, tempValue); if (!isDuplicate(tempKey)) { pointables[i / 2] = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable(); tempKey.getValue(pointables[i / 2]); sp.set(vp); ob.addItem(sp, tempValue); } else { throw new SystemException(ErrorCode.JNDY0003); } } } ob.finish(); result.set(abvs); } catch (IOException e) { throw new SystemException(ErrorCode.SYSE0001, e); } finally { ppool.giveBack(tempKey); ppool.giveBack(tempValue); } }
Source:
public Response getTiers( @DefaultValue("false") @QueryParam("discover") boolean discover ) { try { if (discover) { return Response.ok().entity(lookupCoordinatorManager.discoverTiers()).build(); } final Map<String, Map<String, Map<String, Object>>> knownNamespaces = lookupCoordinatorManager.getKnownLookups(); if (knownNamespaces == null) { return Response.status(Response.Status.NOT_FOUND).build(); } else { return Response.ok().entity(knownNamespaces.keySet()).build(); } } catch (Exception e) { LOG.error(e, "Error getting list of lookups"); return Response.serverError().entity(ServletResourceUtils.sanitizeException(e)).build(); } }

Target:
public Response getTiers( @DefaultValue("false") @QueryParam("discover") boolean discover ) { try { if (discover) { return Response.ok().entity(lookupCoordinatorManager.discoverTiers()).build(); } final Map<String, Map<String, Map<String, Object>>> knownLookups = lookupCoordinatorManager.getKnownLookups(); if (knownLookups == null) { return Response.status(Response.Status.NOT_FOUND).build(); } else { return Response.ok().entity(knownLookups.keySet()).build(); } } catch (Exception e) { LOG.error(e, "Error getting list of lookups"); return Response.serverError().entity(ServletResourceUtils.sanitizeException(e)).build(); } }
Source:
public void testConvertProfileEntryValueDto() { final ProfileEntryValue result = this.mapper.map(this.profileEntryDtoDate(), ProfileEntryValue.class); Assert.assertTrue(result != null && result instanceof ProfileEntryValue); }

Target:
public void testConvertProfileEntryValueDto() { final ProfileEntryValue result = this.mapper.map(this.profileEntryDtoDate(), ProfileEntryValue.class); assertNotNull("mapping ProfileEntryValueDto should not return null", result); assertThat("mapping ProfileEntryValueDto should return correct type", result, instanceOf(ProfileEntryValue.class)); }
Source:
public static void injectDruidProperties(Configuration configuration, List<String> listOfAllowedPrefix) { String mapJavaOpts = configuration.get(MRJobConfig.MAP_JAVA_OPTS); String reduceJavaOpts = configuration.get(MRJobConfig.REDUCE_JAVA_OPTS); for (String propName: System.getProperties().stringPropertyNames()){ for (String prefix : listOfAllowedPrefix) { if (propName.startsWith(prefix)) { mapJavaOpts = String.format("%s -D%s=%s", mapJavaOpts, propName, System.getProperty(propName)); reduceJavaOpts = String.format("%s -D%s=%s", reduceJavaOpts, propName, System.getProperty(propName)); } } } if (!Strings.isNullOrEmpty(mapJavaOpts)) { configuration.set(MRJobConfig.MAP_JAVA_OPTS, mapJavaOpts); } if (!Strings.isNullOrEmpty(reduceJavaOpts)) { configuration.set(MRJobConfig.REDUCE_JAVA_OPTS, reduceJavaOpts); } }

Target:
public static void injectDruidProperties(Configuration configuration, List<String> listOfAllowedPrefix) { String mapJavaOpts = configuration.get(MRJobConfig.MAP_JAVA_OPTS); String reduceJavaOpts = configuration.get(MRJobConfig.REDUCE_JAVA_OPTS); for (String propName : System.getProperties().stringPropertyNames()) { for (String prefix : listOfAllowedPrefix) { if (propName.startsWith(prefix)) { mapJavaOpts = String.format("%s -D%s=%s", mapJavaOpts, propName, System.getProperty(propName)); reduceJavaOpts = String.format("%s -D%s=%s", reduceJavaOpts, propName, System.getProperty(propName)); break; } } } if (!Strings.isNullOrEmpty(mapJavaOpts)) { configuration.set(MRJobConfig.MAP_JAVA_OPTS, mapJavaOpts); } if (!Strings.isNullOrEmpty(reduceJavaOpts)) { configuration.set(MRJobConfig.REDUCE_JAVA_OPTS, reduceJavaOpts); } }
Source:
public void consistentNormalBatchesAfterFullBatchesGravitatesTowardsInitialPause() { for (int i = 0; i < 20; i++) { delay.getNextPause(SUCCESS_TOO_SLOW); } for (int i = 0; i < 20; i++) { delay.getNextPause(SUCCESS); } long nextPause = delay.getNextPause(SUCCESS); assertThat(nextPause).isGreaterThanOrEqualTo((long) (INITIAL_DELAY * 0.95)); assertThat(nextPause).isLessThanOrEqualTo((long) (INITIAL_DELAY * 1.05)); }

Target:
public void consistentNormalBatchesAfterFullBatchesGravitatesTowardsInitialPause() { sweepTwentyIterationsWithResult(SUCCESS_TOO_SLOW); sweepTwentyIterationsWithResult(SUCCESS); long nextPause = delay.getNextPause(SUCCESS); assertThat(nextPause).isGreaterThanOrEqualTo((long) (INITIAL_DELAY * 0.95)); assertThat(nextPause).isLessThanOrEqualTo((long) (INITIAL_DELAY * 1.05)); }
Source:
protected String decryptBytes(@NonNull final Key key, @NonNull final byte[] bytes, @Nullable final DecryptBytesHandler handler) throws GeneralSecurityException, IOException { final Cipher cipher = getCachedInstance(); try (ByteArrayInputStream in = new ByteArrayInputStream(bytes); ByteArrayOutputStream output = new ByteArrayOutputStream()) { if (null != handler) { handler.initialize(cipher, key, in); } byte[] decryptedBytes = cipher.doFinal(bytes, IV.IV_LENGTH, bytes.length - IV.IV_LENGTH); return new String(decryptedBytes, UTF8); } catch (Throwable fail) { Log.w(LOG_TAG, fail.getMessage(), fail); throw fail; } }

Target:
protected String decryptBytes(@NonNull final Key key, @NonNull final byte[] bytes, @Nullable final DecryptBytesHandler handler) throws GeneralSecurityException, IOException { final Cipher cipher = getCachedInstance(); try (ByteArrayInputStream in = new ByteArrayInputStream(bytes); ByteArrayOutputStream output = new ByteArrayOutputStream()) { if (null != handler) { handler.initialize(cipher, key, in); } try (CipherInputStream decrypt = new CipherInputStream(in, cipher)) { copy(decrypt, output); } return new String(output.toByteArray(), UTF8); } catch (Throwable fail) { Log.w(LOG_TAG, fail.getMessage(), fail); throw fail; } }
Source:
public static void proceedLUNInDb(final LUNs lun, StorageType storageType, String volumeGroupId) { if (DbFacade.getInstance().getLunDao().get(lun.getLUN_id()) == null) { DbFacade.getInstance().getLunDao().save(lun); } else if (!volumeGroupId.isEmpty()){ DbFacade.getInstance().getLunDao().updateLUNsVolumeGroupId(lun.getLUN_id(), volumeGroupId); } for (storage_server_connections connection : lun.getLunConnections()) { List<storage_server_connections> connections = DbFacade.getInstance() .getStorageServerConnectionDao().getAllForConnection(connection); if (connections.isEmpty()) { connection.setid(Guid.NewGuid().toString()); connection.setstorage_type(storageType); DbFacade.getInstance().getStorageServerConnectionDao().save(connection); } else { connection.setid(connections.get(0).getid()); } if (DbFacade.getInstance() .getStorageServerConnectionLunMapDao() .get(new LUN_storage_server_connection_map_id(lun.getLUN_id(), connection.getid())) == null) { DbFacade.getInstance().getStorageServerConnectionLunMapDao().save( new LUN_storage_server_connection_map(lun.getLUN_id(), connection.getid())); } } }

Target:
public static void proceedLUNInDb(final LUNs lun, StorageType storageType, String volumeGroupId) { if (getLunDao().get(lun.getLUN_id()) == null) { getLunDao().save(lun); } else if (!volumeGroupId.isEmpty()){ getLunDao().updateLUNsVolumeGroupId(lun.getLUN_id(), volumeGroupId); } for (storage_server_connections connection : lun.getLunConnections()) { List<storage_server_connections> connections = DbFacade.getInstance() .getStorageServerConnectionDao().getAllForConnection(connection); if (connections.isEmpty()) { connection.setid(Guid.NewGuid().toString()); connection.setstorage_type(storageType); DbFacade.getInstance().getStorageServerConnectionDao().save(connection); } else { connection.setid(connections.get(0).getid()); } if (DbFacade.getInstance() .getStorageServerConnectionLunMapDao() .get(new LUN_storage_server_connection_map_id(lun.getLUN_id(), connection.getid())) == null) { DbFacade.getInstance().getStorageServerConnectionLunMapDao().save( new LUN_storage_server_connection_map(lun.getLUN_id(), connection.getid())); } } }
Source:
public void pingReturnsErrorIfTheTargetServerIsNotAMember() throws IOException { final String poolName = testName.getMethodName(); parametrizedSetUp(poolName, Collections.singletonList(server1Port)); int notUsedPort = getRandomAvailableTCPPortsForDUnitSite(1)[0]; InternalDistributedMember fakeDistributedMember = new InternalDistributedMember("localhost", notUsedPort); client.invoke(() -> { PoolImpl poolImpl = (PoolImpl) PoolManager.find(poolName); assertThatThrownBy(() -> { PingOp.execute(poolImpl, new ServerLocation("localhost", server1Port), fakeDistributedMember); }).isInstanceOf(ServerOperationException.class) .hasMessageContaining("Unable to ping non-member"); }); }

Target:
public void pingReturnsErrorIfTheTargetServerIsNotAMember() { final String poolName = testName.getMethodName(); parametrizedSetUp(poolName, Collections.singletonList(server1Port)); int notUsedPort = getRandomAvailableTCPPortsForDUnitSite(1)[0]; InternalDistributedMember fakeDistributedMember = new InternalDistributedMember("localhost", notUsedPort); client.invoke(() -> { PoolImpl poolImpl = (PoolImpl) PoolManager.find(poolName); assertThatThrownBy(() -> { PingOp.execute(poolImpl, new ServerLocation("localhost", server1Port), fakeDistributedMember); }).isInstanceOf(ServerOperationException.class) .hasMessageContaining("Unable to ping non-member"); }); }
Source:
@Override public Appendable write(Appendable appendable, Context context) throws IOException { String sep = ""; for (TypeName className : typeNames) { appendable.append(sep); className.write(appendable, context); sep = " & "; } return appendable; }

Target:
@Override public Appendable write(Appendable appendable, Context context) throws IOException { Iterator<TypeName> iterator = typeNames.iterator(); if (iterator.hasNext()) { iterator.next().write(appendable, context); while (iterator.hasNext()) { appendable.append(" & "); iterator.next().write(appendable, context); } } return appendable; }
Source:
public static boolean validSegments(String[] value) { if (value == null) { return false; } for (String element : value) { if (!validSegment(element)) { return false; } } return true; }

Target:
public static boolean validSegments(String[] value) { if (value == null) { return false; } for (String segment : value) { if (!validSegment(segment)) { return false; } } return true; }
Source:
void release(AssignableReplica assignableReplica) throws IllegalArgumentException { String resourceName = assignableReplica.getResourceName(); String partitionName = assignableReplica.getPartitionName(); if (!_currentAssignments.containsKey(resourceName)) { _logger.warn("Resource " + resourceName + " is not on this node. Ignore the release call."); return; } Set<String> partitions = _currentAssignments.get(resourceName); if (!partitions.contains(partitionName)) { _logger.warn(String .format("Resource %s does not have a replica from partition %s on this node", resourceName, partitionName)); return; } partitions.remove(assignableReplica.getPartitionName()); if (assignableReplica.isReplicaTopState()) { _currentTopStateAssignments.get(resourceName).remove(partitionName); } _totalReplicaAssignmentCount -= 1; _highestCapacityUtilization = 0; assignableReplica.getCapacity().entrySet().stream() .forEach(entry -> updateCapacityAndUtilization(entry.getKey(), -1 * entry.getValue())); }

Target:
void release(AssignableReplica assignableReplica) throws IllegalArgumentException { String resourceName = assignableReplica.getResourceName(); String partitionName = assignableReplica.getPartitionName(); if (!_currentAssignments.containsKey(resourceName)) { LOG.warn("Resource is not on node {}. Ignore the release call.", resourceName, getInstanceName()); return; } Set<String> partitions = _currentAssignments.get(resourceName); if (!partitions.contains(partitionName)) { LOG.warn(String .format("Resource %s does not have a replica from partition %s on node %s", resourceName, partitionName, getInstanceName())); return; } partitions.remove(assignableReplica.getPartitionName()); if (assignableReplica.isReplicaTopState()) { _currentTopStateAssignments.get(resourceName).remove(partitionName); } _highestCapacityUtilization = 0; assignableReplica.getCapacity().entrySet().stream() .forEach(entry -> updateCapacityAndUtilization(entry.getKey(), -1 * entry.getValue())); }
Source:
public ShovingMatch(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{U}"); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TapTargetEffect(), new TapSourceCost()); ability.addTarget(new TargetCreaturePermanent()); this.getSpellAbility().addEffect( new GainAbilityAllEffect(ability, Duration.EndOfTurn, new FilterCreaturePermanent()) .setText("Until end of turn, all creatures gain \"{T}: Tap target creature.\"") ); }

Target:
public ShovingMatch(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{U}"); Ability ability = new SimpleActivatedAbility(new TapTargetEffect(), new TapSourceCost()); ability.addTarget(new TargetCreaturePermanent()); this.getSpellAbility().addEffect( new GainAbilityAllEffect(ability, Duration.EndOfTurn, new FilterCreaturePermanent()) .setText("Until end of turn, all creatures gain \"{T}: Tap target creature.\"") ); }
Source:
public CompletableFuture<Void> loadInstalledMods() { try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(modsDirectory, entry -> Files.isDirectory(entry))) { for (Path path : directoryStream) { addMod(path); } } catch (IOException e) { logger.warn("Mods could not be read from: " + modsDirectory, e); } return completedFuture(null); }

Target:
public void loadInstalledMods() { try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(modsDirectory, entry -> Files.isDirectory(entry))) { for (Path path : directoryStream) { addMod(path); } } catch (IOException e) { logger.warn("Mods could not be read from: " + modsDirectory, e); } }
Source:
private IdpConfig(Parcel in) { mProviderId = in.readString(); mScopes = Collections.unmodifiableList(in.createStringArrayList()); mParams = in.readBundle(); }

Target:
private IdpConfig(Parcel in) { mProviderId = in.readString(); mScopes = Collections.unmodifiableList(in.createStringArrayList()); mParams = in.readBundle(getClass().getClassLoader()); }
Source:
private static Strategy chooseStrategy(GraphDatabase graphDatabaseService) { Transaction tx = graphDatabaseService.beginTx(); try { if (isAlreadyIndexed(graphDatabaseService)) return Strategy.Indexed; if (isAlreadySubRef(graphDatabaseService)) return Strategy.SubRef; if (isAlreadyLabeled(graphDatabaseService)) return Strategy.Labeled; return Strategy.Indexed; } finally { tx.success();tx.finish(); } }

Target:
private static Strategy chooseStrategy(GraphDatabase graphDatabaseService) { try (Transaction tx = graphDatabaseService.beginTx()) { if (AbstractIndexBasedTypeRepresentationStrategy.isStrategyAlreadyInUse(graphDatabaseService)) return Strategy.Indexed; if (SubReferenceNodeTypeRepresentationStrategy.isStrategyAlreadyInUse(graphDatabaseService)) return Strategy.SubRef; if (LabelBasedNodeTypeRepresentationStrategy.isStrategyAlreadyInUse(graphDatabaseService)) return Strategy.Labeled; tx.success(); return Strategy.Labeled; } }
Source:
private void generateEnumReadMany(EnumType type) { JavaClassName typeName = javaTypes.getInterfaceName(type); javaBuffer.addImport(typeName); javaBuffer.addImport(ArrayList.class); javaBuffer.addImport(JsonReader.class); javaBuffer.addImport(List.class); javaBuffer.addImport(JsonException.class); javaBuffer.addLine("public static List<%1$s> readMany(JsonReader reader) {", typeName.getSimpleName()); javaBuffer.addLine( "List<%1$s> list = new ArrayList<>();", typeName.getSimpleName()); javaBuffer.addLine( "while (reader.next() != Event.START_ARRAY);"); javaBuffer.addLine( "try {"); javaBuffer.addLine( "for (;;) {"); javaBuffer.addLine( "list.add(readOne(reader));"); javaBuffer.addLine( "}"); javaBuffer.addLine( "}"); javaBuffer.addLine( "catch (JsonException ex) {"); javaBuffer.addLine( " javaBuffer.addLine( "}"); javaBuffer.addLine( "reader.next();"); javaBuffer.addLine( "return list;"); javaBuffer.addLine("}"); javaBuffer.addLine(); }

Target:
private void generateEnumReadMany(EnumType type) { JavaClassName typeName = javaTypes.getInterfaceName(type); javaBuffer.addImport(typeName); javaBuffer.addImport(ArrayList.class); javaBuffer.addImport(JsonReader.class); javaBuffer.addImport(List.class); javaBuffer.addImport(JsonException.class); javaBuffer.addImport(JsonParser.Event.class); javaBuffer.addImport(JsonParser.class); javaBuffer.addLine("public static List<%1$s> readMany(JsonReader reader) {", typeName.getSimpleName()); javaBuffer.addLine( "List<%1$s> list = new ArrayList<>();", typeName.getSimpleName()); javaBuffer.addLine( "while (reader.next() != Event.START_ARRAY) {"); javaBuffer.addLine( " javaBuffer.addLine( "}"); javaBuffer.addLine(); javaBuffer.addLine( "boolean enumArrayEnd = false;"); javaBuffer.addLine( "while (!enumArrayEnd) {"); javaBuffer.addLine( "JsonParser.Event next = reader.next();"); javaBuffer.addLine( "switch (next) {"); javaBuffer.addLine( "case VALUE_STRING:"); javaBuffer.addLine( " String value = reader.getString();"); javaBuffer.addLine( " list.add(%1$s.fromValue(value));", typeName.getSimpleName()); javaBuffer.addLine( " break;"); javaBuffer.addLine( "case END_ARRAY:"); javaBuffer.addLine( " enumArrayEnd = true;"); javaBuffer.addLine( " break;"); javaBuffer.addLine( "default:"); javaBuffer.addLine( " reader.skip();"); javaBuffer.addLine( "}"); javaBuffer.addLine( "}"); javaBuffer.addLine( "reader.next();"); javaBuffer.addLine( "return list;"); javaBuffer.addLine("}"); javaBuffer.addLine(); }
Source:
BibStractor(Class c) { BibRecordParser b = null; try { b = (BibRecordParser) c.newInstance(); } catch(Exception e) { log.info("Exception " + e.getStackTrace()); } recParser = b; }

Target:
BibStractor(Class c) { BibRecordParser b = null; try { b = (BibRecordParser) c.newInstance(); } catch(final Exception e) { log.warn("Exception while creating BibStractor", e); } recParser = b; }
Source:
private void logBrickStatusChange(GlusterVolumeEntity volume, final GlusterBrickEntity brick, final GlusterStatus fetchedStatus) { log.debug("Detected that status of brick '{}' in volume '{}' changed from '{}' to '{}'", brick.getQualifiedName(), volume.getName(), brick.getStatus(), fetchedStatus); logUtil.logAuditMessage(volume.getClusterId(), volume, null, AuditLogType.GLUSTER_BRICK_STATUS_CHANGED, new HashMap<String, String>() { { put(GlusterConstants.BRICK_PATH, brick.getQualifiedName()); put(GlusterConstants.OPTION_OLD_VALUE, brick.getStatus().toString()); put(GlusterConstants.OPTION_NEW_VALUE, fetchedStatus.toString()); put("source", "cli"); } }); if(fetchedStatus == GlusterStatus.DOWN){ logUtil.logAuditMessage(volume.getClusterId(), volume, null, AuditLogType.GLUSTER_BRICK_STATUS_DOWN, brick.getId(), brick.getQualifiedName()); }else if(fetchedStatus == GlusterStatus.UP){ AlertDirector.removeAlertsByBrickIdLogType(brick.getId(), AuditLogType.GLUSTER_BRICK_STATUS_DOWN); } }

Target:
private void logBrickStatusChange(GlusterVolumeEntity volume, final GlusterBrickEntity brick, final GlusterStatus fetchedStatus) { log.debug("Detected that status of brick '{}' in volume '{}' changed from '{}' to '{}'", brick.getQualifiedName(), volume.getName(), brick.getStatus(), fetchedStatus); logUtil.logAuditMessage(volume.getClusterId(), volume, null, AuditLogType.GLUSTER_BRICK_STATUS_CHANGED, new HashMap<String, String>() { { put(GlusterConstants.BRICK_PATH, brick.getQualifiedName()); put(GlusterConstants.OPTION_OLD_VALUE, brick.getStatus().toString()); put(GlusterConstants.OPTION_NEW_VALUE, fetchedStatus.toString()); put(GlusterConstants.SOURCE, GlusterConstants.SOURCE_CLI); } }); if(fetchedStatus == GlusterStatus.DOWN){ logUtil.logAuditMessage(volume.getClusterId(), volume, null, AuditLogType.GLUSTER_BRICK_STATUS_DOWN, brick.getId(), brick.getQualifiedName()); }else if(fetchedStatus == GlusterStatus.UP){ AlertDirector.removeAlertsByBrickIdLogType(brick.getId(), AuditLogType.GLUSTER_BRICK_STATUS_DOWN); } }
Source:
public void testInitAsyncPrettyPrinterForResponseWithRegisteredHeader() { NetworkEventReporter.InspectorResponse mockResponse = mock( NetworkEventReporter.InspectorResponse.class); when(mockResponse.requestId()).thenReturn(TEST_REQUEST_ID); when(mockResponse.headerCount()).thenReturn(1); when(mockResponse.headerName(0)).thenReturn(TEST_HEADER_NAME); when(mockResponse.headerValue(0)).thenReturn(TEST_HEADER_VALUE); NetworkEventReporterImpl.initAsyncPrettyPrinterForResponse(mockResponse, mNetworkPeerManager); verify(mResponseBodyFileManager, times(1)).associateAsyncPrettyPrinterWithId( eq(TEST_REQUEST_ID), any(AsyncPrettyPrinter.class) ); }

Target:
public void testInitAsyncPrettyPrinterForResponseWithRegisteredHeader() { ArrayList<String> headerNames = new ArrayList<String>(); ArrayList<String> headerValues = new ArrayList<String>(); headerNames.add(UNREGISTERED_HEADER_NAMES[0]); headerNames.add(UNREGISTERED_HEADER_NAMES[1]); headerNames.add(TEST_HEADER_NAME); headerValues.add(UNREGISTERED_HEADER_VALUES[0]); headerValues.add(UNREGISTERED_HEADER_VALUES[1]); headerValues.add(TEST_HEADER_VALUE); TestInspectorResponse testResponse = new TestInspectorResponse( headerNames, headerValues, TEST_REQUEST_ID ); NetworkEventReporterImpl.initAsyncPrettyPrinterForResponse( testResponse, mNetworkPeerManager); verify(mResponseBodyFileManager, times(1)).associateAsyncPrettyPrinterWithId( eq(TEST_REQUEST_ID), any(AsyncPrettyPrinter.class) ); }
Source:
public NormalizedDateSegmentNameGenerator(String tableName, @Nullable String segmentNamePrefix, boolean excludeSequenceId, @Nullable String pushType, @Nullable String pushFrequency, @Nullable DateTimeFormatSpec dateTimeFormatSpec) { _segmentNamePrefix = segmentNamePrefix != null ? segmentNamePrefix.trim() : tableName; _excludeSequenceId = excludeSequenceId; _appendPushType = "APPEND".equalsIgnoreCase(pushType); END push type if (_appendPushType) { if ("HOURLY".equalsIgnoreCase(pushFrequency)) { _outputSDF = new SimpleDateFormat("yyyy-MM-dd-HH"); } else { _outputSDF = new SimpleDateFormat("yyyy-MM-dd"); } _outputSDF.setTimeZone(TimeZone.getTimeZone("UTC")); Preconditions.checkNotNull(dateTimeFormatSpec); TimeFormat timeFormat = dateTimeFormatSpec.getTimeFormat(); if (timeFormat.equals(TimeFormat.EPOCH)) { _inputTimeUnit = dateTimeFormatSpec.getColumnUnit(); _inputSDF = null; } else { Preconditions.checkNotNull(dateTimeFormatSpec.getSDFPattern(), "Must provide pattern for SIMPLE_DATE_FORMAT"); _inputTimeUnit = null; _inputSDF = new SimpleDateFormat(dateTimeFormatSpec.getSDFPattern()); _inputSDF.setTimeZone(TimeZone.getTimeZone("UTC")); } } else { _outputSDF = null; _inputTimeUnit = null; _inputSDF = null; } }

Target:
public NormalizedDateSegmentNameGenerator(String tableName, @Nullable String segmentNamePrefix, boolean excludeSequenceId, @Nullable String pushType, @Nullable String pushFrequency, @Nullable DateTimeFormatSpec dateTimeFormatSpec) { _segmentNamePrefix = segmentNamePrefix != null ? segmentNamePrefix.trim() : tableName; _excludeSequenceId = excludeSequenceId; _appendPushType = "APPEND".equalsIgnoreCase(pushType); END push type if (_appendPushType) { if ("HOURLY".equalsIgnoreCase(pushFrequency)) { _outputSDF = new SimpleDateFormat("yyyy-MM-dd-HH"); } else { _outputSDF = new SimpleDateFormat("yyyy-MM-dd"); } _outputSDF.setTimeZone(TimeZone.getTimeZone("UTC")); Preconditions.checkNotNull(dateTimeFormatSpec); TimeFormat timeFormat = dateTimeFormatSpec.getTimeFormat(); if (timeFormat == TimeFormat.EPOCH) { _inputTimeUnit = dateTimeFormatSpec.getColumnUnit(); _inputSDF = null; } else { Preconditions.checkNotNull(dateTimeFormatSpec.getSDFPattern(), "Must provide pattern for SIMPLE_DATE_FORMAT"); _inputTimeUnit = null; _inputSDF = new SimpleDateFormat(dateTimeFormatSpec.getSDFPattern()); _inputSDF.setTimeZone(TimeZone.getTimeZone("UTC")); } } else { _outputSDF = null; _inputTimeUnit = null; _inputSDF = null; } }
Source:
public DiskStore create(String name) { this.attrs.name = name; DiskStore result; try { if (this.cache instanceof GemFireCacheImpl) { ((GemFireCacheImpl) this.cache).lockDiskStore(name); } result = findExisting(name); if (result == null) { if (this.cache instanceof GemFireCacheImpl) { TypeRegistry registry = this.cache.getPdxRegistry(); DiskStoreImpl dsi = new DiskStoreImpl(this.cache, this.attrs); result = dsi; this.cache.getInternalDistributedSystem() .handleResourceEvent(ResourceEvent.DISKSTORE_CREATE, dsi); initializeDiskStore(dsi); this.cache.addDiskStore(dsi); if (registry != null) { registry.creatingDiskStore(dsi); } } else if (this.cache instanceof CacheCreation) { CacheCreation creation = (CacheCreation) this.cache; result = new DiskStoreAttributesCreation(this.attrs); creation.addDiskStore(result); } } } finally { if (this.cache instanceof GemFireCacheImpl) { ((GemFireCacheImpl) this.cache).unlockDiskStore(name); } } if (this.cache instanceof GemFireCacheImpl) { BackupService backup = this.cache.getBackupService(); if (backup != null) { backup.waitForBackup(); } } return result; }

Target:
public DiskStore create(String name) { this.attrs.name = name; DiskStore result; try { this.cache.lockDiskStore(name); result = findExisting(name); if (result == null) { if (this.cache instanceof GemFireCacheImpl) { TypeRegistry registry = this.cache.getPdxRegistry(); DiskStoreImpl dsi = new DiskStoreImpl(this.cache, this.attrs); result = dsi; this.cache.getInternalDistributedSystem() .handleResourceEvent(ResourceEvent.DISKSTORE_CREATE, dsi); initializeDiskStore(dsi); this.cache.addDiskStore(dsi); if (registry != null) { registry.creatingDiskStore(dsi); } } else if (this.cache instanceof CacheCreation) { CacheCreation creation = (CacheCreation) this.cache; result = new DiskStoreAttributesCreation(this.attrs); creation.addDiskStore(result); } } } finally { this.cache.unlockDiskStore(name); } if (this.cache instanceof GemFireCacheImpl) { BackupService backup = this.cache.getBackupService(); if (backup != null) { backup.waitForBackup(); } } return result; }