auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static void writeTilesToBlockBuilder( Geometry geometry, int zoomLevel, BingTile tile, BlockBuilder blockBuilder) { int tileZoomLevel = tile.getZoomLevel(); checkArgument(tile.getZoomLevel() <= zoomLevel); Envelope tileEnvelope = tileToPolygon(tile); if (tileZoomLevel == zoomLevel) { if (!disjoint(tileEnvelope, geometry, null)) { BIGINT.writeLong(blockBuilder, tile.encode()); } return; } if (contains(geometry, tileEnvelope, null)) { int subTileCount = 1 << (zoomLevel - tileZoomLevel); int minX = subTileCount * tile.getX(); int minY = subTileCount * tile.getY(); for (int x = minX; x < minX + subTileCount; x++) { for (int y = minY; y < minY + subTileCount; y++) { BIGINT.writeLong(blockBuilder, BingTile.fromCoordinates(x, y, zoomLevel).encode()); } } return; } if (disjoint(tileEnvelope, geometry, null)) { return; } int minX = 2 * tile.getX(); int minY = 2 * tile.getY(); int nextZoomLevel = tileZoomLevel + 1; verify(nextZoomLevel <= MAX_ZOOM_LEVEL); for (int x = minX; x < minX + 2; x++) { for (int y = minY; y < minY + 2; y++) { writeTilesToBlockBuilder( geometry, zoomLevel, BingTile.fromCoordinates(x, y, nextZoomLevel), blockBuilder); } } }

Target:
private static void writeTilesToBlockBuilder( Geometry geometry, int zoomLevel, BingTile tile, BlockBuilder blockBuilder) { int tileZoomLevel = tile.getZoomLevel(); checkArgument(tileZoomLevel <= zoomLevel); Envelope tileEnvelope = tileToEnvelope(tile); if (tileZoomLevel == zoomLevel) { if (!disjoint(tileEnvelope, geometry, null)) { BIGINT.writeLong(blockBuilder, tile.encode()); } return; } if (contains(geometry, tileEnvelope, null)) { int subTileCount = 1 << (zoomLevel - tileZoomLevel); int minX = subTileCount * tile.getX(); int minY = subTileCount * tile.getY(); for (int x = minX; x < minX + subTileCount; x++) { for (int y = minY; y < minY + subTileCount; y++) { BIGINT.writeLong(blockBuilder, BingTile.fromCoordinates(x, y, zoomLevel).encode()); } } return; } if (disjoint(tileEnvelope, geometry, null)) { return; } int minX = 2 * tile.getX(); int minY = 2 * tile.getY(); int nextZoomLevel = tileZoomLevel + 1; verify(nextZoomLevel <= MAX_ZOOM_LEVEL); for (int x = minX; x < minX + 2; x++) { for (int y = minY; y < minY + 2; y++) { writeTilesToBlockBuilder( geometry, zoomLevel, BingTile.fromCoordinates(x, y, nextZoomLevel), blockBuilder); } } }
Source:
public abstract void assertion(T actual) throws AssertionError; @Override public void describeTo(Description description) { if (lastError != null) { description.appendText("AssertionError with message: "); description.appendText(lastError.getMessage()); description.appendText("\n\nStacktrace was: "); description.appendText(Throwables.getStackTrace(lastError)); } }

Target:
public abstract void assertion(T actual) throws AssertionError; @Override public void describeTo(Description description) { if (lastError != null) { description.appendText("AssertionError with message: "); description.appendText(lastError.getMessage()); description.appendText(String.format("%n%nStacktrace was: ")); description.appendText(Throwables.getStackTrace(lastError)); } }
Source:
public String toString() { String effectiveSql = sqlStringBuilder.toString(); int parameterIndex = parameters.size(); while (parameterIndex > 0) { int lastQIndex = effectiveSql.lastIndexOf("?"); Object parameter = parameters.get(parameterIndex - 1); String parameterSql = parameter instanceof String ? "'" + parameter.toString() + "'" : parameter.toString(); effectiveSql = effectiveSql.substring(0, lastQIndex) + parameterSql + effectiveSql.substring(lastQIndex + 1); --parameterIndex; } return effectiveSql; }

Target:
public String toString() { String effectiveSql = sqlStringBuilder.toString(); for (Object parameter : parameters) { effectiveSql = effectiveSql.replaceFirst("\\?", parameter instanceof Integer ? ("%d") : "'%s'"); } return String.format(effectiveSql, parameters.toArray()); }
Source:
public static PreparedStatement prepareTableSelectStatement(Connection c, String storageKey, String[] fields, String[] values, Persistable p) { org.commcare.modern.database.TableBuilder mTableBuilder = new org.commcare.modern.database.TableBuilder(storageKey); mTableBuilder.addData(p); Pair<String, String[]> mPair = DatabaseHelper.createWhere(fields, values, p); try { String queryString = "SELECT * FROM " + storageKey + " WHERE " + mPair.first + ";"; PreparedStatement preparedStatement = c.prepareStatement(queryString); for (int i = 0; i < mPair.second.length; i++) { preparedStatement.setString(i + 1, mPair.second[i]); } return preparedStatement; } catch (SQLException e) { e.printStackTrace(); return null; } }

Target:
public static PreparedStatement prepareTableSelectStatement(Connection c, String storageKey, String[] fields, String[] values, Persistable p) { org.commcare.modern.database.TableBuilder mTableBuilder = new org.commcare.modern.database.TableBuilder(storageKey); mTableBuilder.addData(p); Pair<String, String[]> mPair = DatabaseHelper.createWhere(fields, values, p); try { String queryString = "SELECT * FROM " + storageKey + " WHERE " + mPair.first + ";"; PreparedStatement preparedStatement = c.prepareStatement(queryString); for (int i = 0; i < mPair.second.length; i++) { preparedStatement.setString(i + 1, mPair.second[i]); } return preparedStatement; } catch (SQLException e) { throw new RuntimeException(e); } }
Source:
public void start(BundleContext context) throws Exception { if ("true".equalsIgnoreCase(context.getProperty(OSGI_LOADING))) { LOGGER.info("Detected OSGi Environment (core is in bundle: " + context.getBundle() + "): OSGi Based Service Loading Enabled Via System/Framework Property"); SafeOsgi.OSGI = true; CORE_BUNDLE = context; } else { LOGGER.info("Detected OSGi Environment (core is in bundle: " + context.getBundle() + "): Using JDK Service Loading - Extensions Outside This Bundle Will Not Be Detected"); LOGGER.debug("JDK Service Loading Sees:\n\t" + stream(spliterator(ClassLoading.servicesOfType(ServiceFactory.class).iterator(), Long.MAX_VALUE, 0), false) .map(sf -> sf.getServiceType().getName()).collect(joining("\n\t"))); } }

Target:
public void start(BundleContext context) throws Exception { BundleContext currentContext = CORE_BUNDLE.getAndUpdate(current -> current == null ? context : current); if (currentContext == null) { String greeting = "Detected OSGi Environment (core is in bundle: " + context.getBundle() + ")"; if ("false".equalsIgnoreCase(context.getProperty(OSGI_LOADING))) { SafeOsgi.disableOSGiServiceLoading(); LOGGER.info(greeting + ": OSGi Based Service Loading Disabled Via System/Framework Property - Extensions Outside This Bundle Will Not Be Detected"); LOGGER.debug("JDK Service Loading Sees:\n\t" + stream(spliterator(ClassLoading.servicesOfType(ServiceFactory.class).iterator(), Long.MAX_VALUE, 0), false) .map(sf -> sf.getServiceType().getName()).collect(joining("\n\t"))); } else { SafeOsgi.enableOSGiServiceLoading(); LOGGER.info(greeting + ": Using OSGi Based Service Loading"); } } else { throw new IllegalStateException("Multiple bundle instances running against the same core classes: existing bundle: " + currentContext.getBundle() + " new bundle: " + context.getBundle()); } }
Source:
private static boolean checkForValidityOfAttributes(ArrayList<String> attributeList) { for (String str : attributeList) { if (str == "-1") { return false; } } return true; }

Target:
private static boolean checkForValidityOfAttributes(ArrayList<String> attributeList) { for (String str : attributeList) { if (str.equals("-1")) { return false; } } return true; }
Source:
public boolean hasNext() { if (this.peek != null) { return true; } if (!this.iterator.hasNext()) { this.iterator = this.iterable.iterator(); } return this.iterator.hasNext(); }

Target:
public boolean hasNext() { return true; }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } FlakeIdGeneratorConfig that = (FlakeIdGeneratorConfig) o; return prefetchCount == that.prefetchCount && prefetchValidityMillis == that.prefetchValidityMillis && epochStart == that.epochStart && idOffset == that.idOffset && nodeIdOffset == that.nodeIdOffset && bitsTimestamp == that.bitsTimestamp && bitsSequence == that.bitsSequence && bitsNodeId == that.bitsNodeId && allowedFutureMillis == that.allowedFutureMillis && (Objects.equals(name, that.name)) && statisticsEnabled == that.statisticsEnabled; }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } FlakeIdGeneratorConfig that = (FlakeIdGeneratorConfig) o; return prefetchCount == that.prefetchCount && prefetchValidityMillis == that.prefetchValidityMillis && epochStart == that.epochStart && nodeIdOffset == that.nodeIdOffset && bitsSequence == that.bitsSequence && bitsNodeId == that.bitsNodeId && allowedFutureMillis == that.allowedFutureMillis && Objects.equals(name, that.name) && statisticsEnabled == that.statisticsEnabled; }
Source:
public void addTriggerChangeListener(TriggerChangeListener listener) { if (listeners == null) { listeners = new CopyOnWriteArraySet<TriggerChangeListener>(); } listeners.add(listener); }

Target:
public void addTriggerChangeListener(TriggerChangeListener listener) { listeners.add(listener); }
Source:
public void testStartingWithoutTransport() { MockServerConfigurationBuilder b = new MockServerConfigurationBuilder(); b.startTransport(false); MockProtocolServer server = new MockProtocolServer(); try { server.start(b.build(), new DefaultCacheManager()); Assert.assertFalse(server.isTransportEnabled()); } finally { server.stop(); } }

Target:
public void testStartingWithoutTransport() { MockServerConfigurationBuilder b = new MockServerConfigurationBuilder(); b.startTransport(false); AbstractProtocolServer server = new MockProtocolServer(); try { server.start(b.build(), new DefaultCacheManager()); Assert.assertFalse(server.isTransportEnabled()); } finally { server.stop(); } }
Source:
private void configureHateoasObjectMapper(ObjectMapper mapper, boolean indentJson) { mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); if (indentJson) { mapper.configure(SerializationFeature.INDENT_OUTPUT, true); } SimpleFilterProvider filterProvider = new SimpleFilterProvider(); filterProvider = filterProvider.addFilter("DTOFilter", new DynamicPropertyFilter()); filterProvider = filterProvider.addFilter("OldDTOFilter", new DynamicPropertyFilter()); filterProvider = filterProvider.addFilter("ConsumerFilter", new MultiFilter(new HateoasBeanPropertyFilter(), new DynamicPropertyFilter())); filterProvider = filterProvider.addFilter("EntitlementFilter", new MultiFilter(new HateoasBeanPropertyFilter(), new DynamicPropertyFilter())); filterProvider = filterProvider.addFilter("OwnerFilter", new MultiFilter(new HateoasBeanPropertyFilter(), new DynamicPropertyFilter())); filterProvider = filterProvider.addFilter("GuestFilter", new MultiFilter(new HateoasBeanPropertyFilter(), new DynamicPropertyFilter())); filterProvider.setDefaultFilter(new DynamicPropertyFilter()); filterProvider.setFailOnUnknownId(false); mapper.setFilterProvider(filterProvider); addMixInAnnotationsForDTOs(mapper); AnnotationIntrospector primary = new JacksonAnnotationIntrospector(); AnnotationIntrospector secondary = new JaxbAnnotationIntrospector(mapper.getTypeFactory()); AnnotationIntrospector pair = new AnnotationIntrospectorPair(primary, secondary); mapper.setAnnotationIntrospector(pair); }

Target:
private void configureHateoasObjectMapper(ObjectMapper mapper, boolean indentJson) { mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); if (indentJson) { mapper.configure(SerializationFeature.INDENT_OUTPUT, true); } SimpleFilterProvider filterProvider = new SimpleFilterProvider(); filterProvider = filterProvider.addFilter("DTOFilter", new DynamicPropertyFilter()); filterProvider = filterProvider.addFilter("LegacyDTOFilter", new DynamicPropertyFilter()); filterProvider = filterProvider.addFilter("ConsumerFilter", new MultiFilter(new HateoasBeanPropertyFilter(), new DynamicPropertyFilter())); filterProvider = filterProvider.addFilter("EntitlementFilter", new MultiFilter(new HateoasBeanPropertyFilter(), new DynamicPropertyFilter())); filterProvider = filterProvider.addFilter("OwnerFilter", new MultiFilter(new HateoasBeanPropertyFilter(), new DynamicPropertyFilter())); filterProvider = filterProvider.addFilter("GuestFilter", new MultiFilter(new HateoasBeanPropertyFilter(), new DynamicPropertyFilter())); filterProvider.setDefaultFilter(new DynamicPropertyFilter()); filterProvider.setFailOnUnknownId(false); mapper.setFilterProvider(filterProvider); addMixInAnnotationsForDTOs(mapper); AnnotationIntrospector primary = new JacksonAnnotationIntrospector(); AnnotationIntrospector secondary = new JaxbAnnotationIntrospector(mapper.getTypeFactory()); AnnotationIntrospector pair = new AnnotationIntrospectorPair(primary, secondary); mapper.setAnnotationIntrospector(pair); }
Source:
public ExtendedQueryResult<T> orderAsc(String attribute, boolean appendEntityName) { lastPaginatedQuery = null; if (!context.getRepositoryMethod().isQuery()) { context.addCriteriaBuilderPostProcessor(new OrderByCriteriaBuilderPostProcessor(attribute, OrderDirection.ASC)); } else { context.addQueryStringPostProcessor(new OrderByQueryStringPostProcessor(attribute, OrderDirection.ASC, appendEntityName)); } return this; }

Target:
public ExtendedQueryResult<T> orderAsc(String attribute, boolean appendEntityName) { lastPaginatedQuery = null; if (context.getRepositoryMethod().isQuery()) { context.addQueryStringPostProcessor(new OrderByQueryStringPostProcessor(attribute, OrderDirection.ASC, appendEntityName)); } else { context.addCriteriaBuilderPostProcessor(new OrderByCriteriaBuilderPostProcessor(attribute, OrderDirection.ASC)); } return this; }
Source:
public void createIndices(final DBCollection coll){ BasicDBObject doc = new BasicDBObject(); doc.put(SUBJECT_HASH, 1); doc.put(PREDICATE_HASH, 1); coll.createIndex(doc); doc = new BasicDBObject(PREDICATE_HASH, 1); doc.put(OBJECT_HASH, 1); doc.put(OBJECT_TYPE, 1); coll.createIndex(doc); doc = new BasicDBObject(OBJECT_HASH, 1); doc.put(OBJECT_TYPE, 1); doc.put(SUBJECT, 1); coll.createIndex(doc); }

Target:
public void createIndices(final DBCollection coll){ BasicDBObject doc = new BasicDBObject(); doc.put(SUBJECT_HASH, 1); doc.put(PREDICATE_HASH, 1); doc.put(OBJECT_HASH, 1); doc.put(OBJECT_TYPE, 1); coll.createIndex(doc); doc = new BasicDBObject(PREDICATE_HASH, 1); doc.put(OBJECT_HASH, 1); doc.put(OBJECT_TYPE, 1); coll.createIndex(doc); doc = new BasicDBObject(OBJECT_HASH, 1); doc.put(OBJECT_TYPE, 1); doc.put(SUBJECT_HASH, 1); coll.createIndex(doc); }
Source:
public void assignAccessPoints() throws Exception { Venue venue = new Venue(new VenueGroup("group"), new VenueType("type"), Lists.newArrayList(new VenueName("info", new Language("en")))); Object apID1 = accessPointRepository.create(new NewAccessPoint(new ID("operID1"), "8.8.8.8", new MacAddress("aa:bb:cc"), "33:22:11", "model1", venue)); Object apID2 = accessPointRepository.create(new NewAccessPoint(new ID("operID1"), "9.9.9.9", new MacAddress("cc:bb:aa"), "11:22:33", "model2", venue)); Object operID = operRepository.create(newOperator().build()); List<ID> apIDs = Lists.newArrayList(new ID(apID1), new ID(apID2)); operRepository.assignAccessPoints(new ID(operID), apIDs); List<AccessPoint> got = operRepository.findAccessPoints(new ID(operID)); List<AccessPoint> want = Lists.newArrayList( new AccessPoint(new ID(apID1), "8.8.8.8", new MacAddress("aa:bb:cc"), "33:22:11", "model1", venue), new AccessPoint(new ID(apID2), "9.9.9.9", new MacAddress("cc:bb:aa"), "11:22:33", "model2", venue) ); assertThat(got, deepEquals(want)); }

Target:
public void assignAccessPoints() throws Exception { NewOperator operator = newOperator().build(); Object operID = operRepository.create(operator); Venue venue = new Venue(new VenueGroup("group"), new VenueType("type"), Lists.newArrayList(new VenueName("info", new Language("en")))); Object apID1 = accessPointRepository.create(new NewAccessPoint(new ID(operID), "8.8.8.8", new MacAddress("aa:bb:cc"), "33:22:11", "model1", venue)); Object apID2 = accessPointRepository.create(new NewAccessPoint(new ID(operID), "9.9.9.9", new MacAddress("cc:bb:aa"), "11:22:33", "model2", venue)); List<ID> apIDs = Lists.newArrayList(new ID(apID1), new ID(apID2)); operRepository.assignAccessPoints(new ID(operID), apIDs); List<AccessPoint> got = operRepository.findAccessPoints(new ID(operID)); List<AccessPoint> want = Lists.newArrayList( new AccessPoint(new ID(apID1), "8.8.8.8", new MacAddress("aa:bb:cc"), "33:22:11", "model1", venue), new AccessPoint(new ID(apID2), "9.9.9.9", new MacAddress("cc:bb:aa"), "11:22:33", "model2", venue) ); assertThat(got, deepEquals(want)); }
Source:
private Map<String, ActionInfo> toActionMap(RevisionResource rsrc) { Map<String, ActionInfo> out = new LinkedHashMap<>(); if (!rsrc.getControl().getCurrentUser().isIdentifiedUser()) { return out; } if (!rsrc.getPatchSet().getId().equals( rsrc.getChange().currentPatchSetId())) { return out; } Provider<CurrentUser> userProvider = Providers.of( rsrc.getControl().getCurrentUser()); for (UiAction.Description d : UiActions.from( revisions, rsrc, userProvider)) { out.put(d.getId(), new ActionInfo(d)); } return out; }

Target:
private Map<String, ActionInfo> toActionMap(RevisionResource rsrc) { Map<String, ActionInfo> out = new LinkedHashMap<>(); if (rsrc.getControl().getCurrentUser().isIdentifiedUser()) { Provider<CurrentUser> userProvider = Providers.of( rsrc.getControl().getCurrentUser()); for (UiAction.Description d : UiActions.from( revisions, rsrc, userProvider)) { out.put(d.getId(), new ActionInfo(d)); } } return out; }
Source:
public long getSegmentsNeeded() { return segmentsNeeded; }

Target:
long getSegmentsNeeded() { return segmentsNeeded; }
Source:
private String emptyIfNull(Object value) { return value == null ? "" : value.toString(); }

Target:
private Object emptyIfNull(Object value) { return value == null ? "" : value; }
Source:
private long moveAwayToLookLikeOldBranchedDirectory() throws IOException { File dir = directory.directory(); long timestamp = System.currentTimeMillis(); File branchDir = new File( dir, "branched-" + timestamp ); assertTrue( "create directory: " + branchDir, branchDir.mkdirs() ); for ( File file : Objects.requireNonNull( dir.listFiles() ) ) { String fileName = file.getName(); if ( !fileName.equals( "debug.log" ) && !file.getName().startsWith( "branched-" ) ) { FileUtils.renameFile( file, new File( branchDir, file.getName() ) ); } } return timestamp; }

Target:
private long moveAwayToLookLikeOldBranchedDirectory() throws IOException { File dir = directory.directory(); long timestamp = System.currentTimeMillis(); File branchDir = new File( dir, "branched-" + timestamp ); assertTrue( "create directory: " + branchDir, branchDir.mkdirs() ); for ( File file : Objects.requireNonNull( dir.listFiles() ) ) { String fileName = file.getName(); if ( !fileName.equals( INTERNAL_LOG_FILE ) && !file.getName().startsWith( "branched-" ) ) { FileUtils.renameFile( file, new File( branchDir, file.getName() ) ); } } return timestamp; }
Source:
private static Class<?> getCollectionParameterType(MethodParameter methodParam) { Class<?> paramType = methodParam.getNestedParameterType(); if (Collection.class == paramType || List.class.isAssignableFrom(paramType)){ return ResolvableType.forMethodParameter(methodParam).asCollection().resolveGeneric(); } return null; }

Target:
private static Class<?> getCollectionParameterType(MethodParameter methodParam) { Class<?> paramType = methodParam.getNestedParameterType(); if (Collection.class == paramType || List.class.isAssignableFrom(paramType)){ Class<?> valueType = ResolvableType.forMethodParameter(methodParam).asCollection().resolveGeneric(); if (valueType != null) { return valueType; } } return null; }
Source:
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException { SettingsModelString tmp_filename = m_directory_name .createCloneWithValidatedValue(settings); if (tmp_filename == null || tmp_filename.equals("")) { throw new InvalidSettingsException("No Files selected."); } }

Target:
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException { SettingsModelString tmp_directoryname = m_directory_name .createCloneWithValidatedValue(settings); if (tmp_directoryname == null || tmp_directoryname.equals("")) { throw new InvalidSettingsException("No Directory selected."); } }
Source:
public Response add(Disk disk) { validateParameters(disk, "format", "interface"); if (!disk.isSetLunStorage()) { validateParameters(disk, "provisionedSize|size"); } validateEnums(Disk.class, disk); AddDiskParameters params = new AddDiskParameters(); params.setDiskInfo(getMapper(Disk.class, org.ovirt.engine.core.common.businessentities.Disk.class).map(disk, null)); if (disk.isSetStorageDomains() && disk.getStorageDomains().isSetStorageDomains() && disk.getStorageDomains().getStorageDomains().get(0).isSetId()) { params.setStorageDomainId(Guid.createGuidFromString(disk.getStorageDomains().getStorageDomains().get(0).getId())); } else if (disk.isSetStorageDomains() && disk.getStorageDomains().getStorageDomains().get(0).isSetName()) { Guid storageDomainId = getStorageDomainId(disk.getStorageDomains().getStorageDomains().get(0).getName()); if (storageDomainId == null) { notFound(StorageDomain.class); } else { params.setStorageDomainId(storageDomainId); } } return performCreation(VdcActionType.AddDisk, params, new QueryIdResolver(VdcQueryType.GetDiskByDiskId, GetDiskByDiskIdParameters.class)); }

Target:
public Response add(Disk disk) { validateParameters(disk, "format", "interface"); if (!disk.isSetLunStorage() || disk.getLunStorage().getLogicalUnits().isEmpty()) { validateParameters(disk, "provisionedSize|size"); } validateEnums(Disk.class, disk); AddDiskParameters params = new AddDiskParameters(); params.setDiskInfo(getMapper(Disk.class, org.ovirt.engine.core.common.businessentities.Disk.class).map(disk, null)); if (disk.isSetStorageDomains() && disk.getStorageDomains().isSetStorageDomains() && disk.getStorageDomains().getStorageDomains().get(0).isSetId()) { params.setStorageDomainId(Guid.createGuidFromString(disk.getStorageDomains().getStorageDomains().get(0).getId())); } else if (disk.isSetStorageDomains() && disk.getStorageDomains().getStorageDomains().get(0).isSetName()) { Guid storageDomainId = getStorageDomainId(disk.getStorageDomains().getStorageDomains().get(0).getName()); if (storageDomainId == null) { notFound(StorageDomain.class); } else { params.setStorageDomainId(storageDomainId); } } return performCreation(VdcActionType.AddDisk, params, new QueryIdResolver(VdcQueryType.GetDiskByDiskId, GetDiskByDiskIdParameters.class)); }
Source:
private void appendToLog(long size) throws IOException { byte[] bytes = TestUtils.getRandomBytes((int) size); bytes[random.nextInt((int) size)] = 1; ByteBuffer buffer = ByteBuffer.wrap(bytes); ReadableByteChannel channel = Channels.newChannel(new ByteBufferInputStream(buffer)); log.appendFrom(channel, buffer.capacity()); }

Target:
private void appendToLog(long size) throws IOException { byte[] bytes = TestUtils.getRandomBytes((int) size); if (size > HARD_DELETE_START_OFFSET) { int randomByte = (int) (HARD_DELETE_START_OFFSET + TestUtils.RANDOM.nextInt( (int) (size - HARD_DELETE_START_OFFSET - HARD_DELETE_LAST_PART_SIZE))); bytes[randomByte] = 1; } ByteBuffer buffer = ByteBuffer.wrap(bytes); ReadableByteChannel channel = Channels.newChannel(new ByteBufferInputStream(buffer)); log.appendFrom(channel, buffer.capacity()); }
Source:
private void close() { try { closeExecutors(); m_loader.close(); if (m_client != null) { m_client.close(); m_client = null; } } catch (Exception ex) { } }

Target:
private void close() { try { closeExecutors(); if (m_loader != null) { m_loader.close(); m_loader = null; } if (m_client != null) { m_client.close(); m_client = null; } } catch (Exception ex) { } }
Source:
public void start() { if (getBoolean(IGNITE_JVM_PAUSE_DETECTOR_DISABLED, DEFAULT_JVM_PAUSE_DETECTOR_DISABLED)) { if (log.isDebugEnabled()) log.debug("JVM Pause Detector is disabled."); return; } lastWakeUpTime = System.currentTimeMillis(); final Thread worker = new Thread("jvm-pause-detector-worker") { @Override public void run() { if (log.isDebugEnabled()) log.debug(getName() + " has been started."); while (true) { try { Thread.sleep(PRECISION); final long now = System.currentTimeMillis(); final long pause = now - PRECISION - lastWakeUpTime; if (pause >= THRESHOLD) { log.warning("Possible too long JVM pause: " + pause + " milliseconds."); synchronized (LongJVMPauseDetector.this) { final int next = (int)(longPausesCnt % EVT_CNT); longPausesCnt++; longPausesTotalDuration += pause; longPausesTimestamps[next] = now; longPausesDurations[next] = pause; lastWakeUpTime = now; } } else { synchronized (LongJVMPauseDetector.this) { lastWakeUpTime = now; } } } catch (InterruptedException e) { if (workerRef.compareAndSet(this, null)) log.error(getName() + " has been interrupted.", e); else if (log.isDebugEnabled()) log.debug(getName() + " has been stopped."); break; } } } }; if (!workerRef.compareAndSet(null, worker)) { log.warning(LongJVMPauseDetector.class.getSimpleName() + " already started!"); return; } worker.setDaemon(true); worker.start(); if (log.isDebugEnabled()) log.debug("LongJVMPauseDetector was successfully started"); }

Target:
public void start() { if (DISABLED) { if (log.isDebugEnabled()) log.debug("JVM Pause Detector is disabled."); return; } final Thread worker = new Thread("jvm-pause-detector-worker") { @Override public void run() { synchronized (LongJVMPauseDetector.this) { lastWakeUpTime = System.currentTimeMillis(); } if (log.isDebugEnabled()) log.debug(getName() + " has been started."); while (true) { try { Thread.sleep(PRECISION); final long now = System.currentTimeMillis(); final long pause = now - PRECISION - lastWakeUpTime; if (pause >= THRESHOLD) { log.warning("Possible too long JVM pause: " + pause + " milliseconds."); synchronized (LongJVMPauseDetector.this) { final int next = (int)(longPausesCnt % EVT_CNT); longPausesCnt++; longPausesTotalDuration += pause; longPausesTimestamps[next] = now; longPausesDurations[next] = pause; lastWakeUpTime = now; } } else { synchronized (LongJVMPauseDetector.this) { lastWakeUpTime = now; } } } catch (InterruptedException e) { if (workerRef.compareAndSet(this, null)) log.error(getName() + " has been interrupted.", e); else if (log.isDebugEnabled()) log.debug(getName() + " has been stopped."); break; } } } }; if (!workerRef.compareAndSet(null, worker)) { log.warning(LongJVMPauseDetector.class.getSimpleName() + " already started!"); return; } worker.setDaemon(true); worker.start(); if (log.isDebugEnabled()) log.debug("LongJVMPauseDetector was successfully started"); }
Source:
public void putObject(String bucketName, String objectName, ServerSideEncryption sse, String fileName) throws InvalidBucketNameException, NoSuchAlgorithmException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException, InternalException, InvalidArgumentException, InsufficientDataException { if ((sse.getType() == (ServerSideEncryption.Type.SSE_C)) && (!this.baseUrl.isHttps())) { throw new InvalidArgumentException("SSE_C operations must be performed over a secure connection."); } else if ((sse.getType() == (ServerSideEncryption.Type.SSE_KMS)) && (!this.baseUrl.isHttps())) { throw new InvalidArgumentException("SSE_KMS operations must be performed over a secure connection."); } if (fileName == null || "".equals(fileName)) { throw new InvalidArgumentException("empty file name is not allowed"); } Path filePath = Paths.get(fileName); if (!Files.isRegularFile(filePath)) { throw new InvalidArgumentException("'" + fileName + "': not a regular file"); } String contentType = Files.probeContentType(filePath); long size = Files.size(filePath); RandomAccessFile file = new RandomAccessFile(filePath.toFile(), "r"); Map<String, String> headerMap = new HashMap<>(); headerMap.put("Content-Type", contentType); try { putObject(bucketName, objectName, size, file, headerMap, sse); } finally { file.close(); } }

Target:
public void putObject(String bucketName, String objectName, ServerSideEncryption sse, String fileName) throws InvalidBucketNameException, NoSuchAlgorithmException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException, InternalException, InvalidArgumentException, InsufficientDataException { if (sse.getType() == ServerSideEncryption.Type.SSE_C && !this.baseUrl.isHttps()) { throw new InvalidArgumentException("SSE_C operations must be performed over a secure connection."); } else if (sse.getType() == ServerSideEncryption.Type.SSE_KMS && !this.baseUrl.isHttps()) { throw new InvalidArgumentException("SSE_KMS operations must be performed over a secure connection."); } if (fileName == null || "".equals(fileName)) { throw new InvalidArgumentException("empty file name is not allowed"); } Path filePath = Paths.get(fileName); if (!Files.isRegularFile(filePath)) { throw new InvalidArgumentException("'" + fileName + "': not a regular file"); } String contentType = Files.probeContentType(filePath); long size = Files.size(filePath); RandomAccessFile file = new RandomAccessFile(filePath.toFile(), "r"); Map<String, String> headerMap = new HashMap<>(); headerMap.put("Content-Type", contentType); try { putObject(bucketName, objectName, size, file, headerMap, sse); } finally { file.close(); } }
Source:
public void AddNodeDuringInvalidateLayoutTest() { workflow(wf -> { wf.setupDocker(fixture -> { fixture.getCluster().numNodes(3); }); wf.deploy(); try { addNodeDuringInvalidateLayout(wf); } catch (Exception e) { Assertions.fail("Test failed: " + e); } } ); }

Target:
public void AddNodeDuringInvalidateLayoutTest() { workflow(wf -> { wf.deploy(); try { addNodeDuringInvalidateLayout(wf); } catch (Exception e) { Assertions.fail("Test failed: " + e); } } ); }
Source:
public String getIdentifier(DashboardData data) { XPathXMLParser parser = getParser(data.getRequestXML()); if (null == parser) { return ""; } String wpsPrefix = parser.getContext().getPrefix(WPS_NAMESPACE_URI); String owsPrefix = parser.getContext().getPrefix(OWS_NAMESPACE_URI); StringBuilder xpath = new StringBuilder(); xpath.append("/").append(wpsPrefix).append(":Execute/").append(owsPrefix).append(":Identifier"); return parser.getString(xpath.toString()); }

Target:
public String getIdentifier(DashboardData data) throws XPathExpressionException { XPathXMLParser parser = new XPathXMLParser(data.getRequestXML()); String wpsPrefix = parser.getContext().getPrefix(WPS_NAMESPACE_URI); String owsPrefix = parser.getContext().getPrefix(OWS_NAMESPACE_URI); StringBuilder xpath = new StringBuilder(); xpath.append("/").append(wpsPrefix).append(":Execute/").append(owsPrefix).append(":Identifier"); return parser.getString(xpath.toString()); }
Source:
public static <T> TupleDomain<T> columnWiseUnion(List<TupleDomain<T>> tupleDomains) { if (tupleDomains.isEmpty()) { throw new IllegalArgumentException("tupleDomains must have at least one element"); } if (tupleDomains.size() == 1) { return tupleDomains.get(0); } Set<T> commonColumns = new LinkedHashSet<>(); boolean found = false; Iterator<TupleDomain<T>> domains = tupleDomains.iterator(); while (domains.hasNext()) { TupleDomain<T> domain = domains.next(); if (!domain.isNone()) { found = true; commonColumns.addAll(domain.getDomains().get().keySet()); break; } } if (!found) { return TupleDomain.none(); } while (domains.hasNext()) { TupleDomain<T> domain = domains.next(); if (!domain.isNone()) { commonColumns.retainAll(domain.getDomains().get().keySet()); } } Map<T, List<Domain>> domainsByColumn = new LinkedHashMap<>(tupleDomains.size()); for (TupleDomain<T> domain : tupleDomains) { if (!domain.isNone()) { for (Map.Entry<T, Domain> entry : domain.getDomains().get().entrySet()) { if (commonColumns.contains(entry.getKey())) { List<Domain> domainForColumn = domainsByColumn.get(entry.getKey()); if (domainForColumn == null) { domainForColumn = new ArrayList<>(); domainsByColumn.put(entry.getKey(), domainForColumn); } domainForColumn.add(entry.getValue()); } } } } Map<T, Domain> result = new LinkedHashMap<>(domainsByColumn.size()); for (Map.Entry<T, List<Domain>> entry : domainsByColumn.entrySet()) { result.put(entry.getKey(), Domain.union(entry.getValue())); } return withColumnDomains(result); }

Target:
public static <T> TupleDomain<T> columnWiseUnion(List<TupleDomain<T>> tupleDomains) { if (tupleDomains.isEmpty()) { throw new IllegalArgumentException("tupleDomains must have at least one element"); } if (tupleDomains.size() == 1) { return tupleDomains.get(0); } Set<T> commonColumns = new HashSet<>(); boolean found = false; Iterator<TupleDomain<T>> domains = tupleDomains.iterator(); while (domains.hasNext()) { TupleDomain<T> domain = domains.next(); if (!domain.isNone()) { found = true; commonColumns.addAll(domain.getDomains().get().keySet()); break; } } if (!found) { return TupleDomain.none(); } while (domains.hasNext()) { TupleDomain<T> domain = domains.next(); if (!domain.isNone()) { commonColumns.retainAll(domain.getDomains().get().keySet()); } } Map<T, List<Domain>> domainsByColumn = new LinkedHashMap<>(tupleDomains.size()); for (TupleDomain<T> domain : tupleDomains) { if (!domain.isNone()) { for (Map.Entry<T, Domain> entry : domain.getDomains().get().entrySet()) { if (commonColumns.contains(entry.getKey())) { List<Domain> domainForColumn = domainsByColumn.get(entry.getKey()); if (domainForColumn == null) { domainForColumn = new ArrayList<>(); domainsByColumn.put(entry.getKey(), domainForColumn); } domainForColumn.add(entry.getValue()); } } } } Map<T, Domain> result = new LinkedHashMap<>(domainsByColumn.size()); for (Map.Entry<T, List<Domain>> entry : domainsByColumn.entrySet()) { result.put(entry.getKey(), Domain.union(entry.getValue())); } return withColumnDomains(result); }
Source:
public Set<File> findConfigurableLocations(File root, IProgressMonitor monitor) { LocalProjectScanner scanner = new LocalProjectScanner( ResourcesPlugin.getWorkspace().getRoot().getLocation().toFile(), root.getAbsolutePath(), false, MavenPlugin.getMavenModelManager()); try { scanner.run(monitor); } catch (Exception ex) { Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, ex.getMessage(), ex)); return null; } List<MavenProjectInfo> projects = new ArrayList<MavenProjectInfo>(); projects.addAll(scanner.getProjects()); HashSet<File> res = new HashSet<File>(); int i = 0; while (i < projects.size()) { MavenProjectInfo projectInfo = projects.get(i); res.add(projectInfo.getPomFile().getParentFile()); projects.addAll(projectInfo.getProjects()); i++; } return res; }

Target:
public Set<File> findConfigurableLocations(File root, IProgressMonitor monitor) { LocalProjectScanner scanner = new LocalProjectScanner( ResourcesPlugin.getWorkspace().getRoot().getLocation().toFile(), root.getAbsolutePath(), false, MavenPlugin.getMavenModelManager()); try { scanner.run(monitor); } catch (Exception ex) { Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, ex.getMessage(), ex)); return null; } Queue<MavenProjectInfo> projects = new LinkedList<MavenProjectInfo>(); projects.addAll(scanner.getProjects()); HashSet<File> res = new HashSet<File>(); while (!projects.isEmpty()) { MavenProjectInfo projectInfo = projects.poll(); res.add(projectInfo.getPomFile().getParentFile()); projects.addAll(projectInfo.getProjects()); } return res; }
Source:
public AsyncRunLoop(Map<TaskName, TaskInstance> taskInstances, ExecutorService threadPool, SystemConsumers consumerMultiplexer, int maxConcurrency, long windowMs, long commitMs, long callbackTimeoutMs, long maxThrottlingDelayMs, SamzaContainerMetrics containerMetrics, HighResolutionClock clock, boolean isAsyncCommitEnabled) { this.threadPool = threadPool; this.consumerMultiplexer = consumerMultiplexer; this.containerMetrics = containerMetrics; this.containerMetricsCompletedCounter = containerMetrics.newCounter("async-callback-complete-calls"); this.containerMetricsFailureCounter = containerMetrics.newCounter("async-callback-failure-calls"); this.windowMs = windowMs; this.commitMs = commitMs; this.maxConcurrency = maxConcurrency; this.callbackTimeoutMs = callbackTimeoutMs; this.callbackTimer = (callbackTimeoutMs > 0) ? Executors.newSingleThreadScheduledExecutor() : null; this.callbackExecutor = new ThrottlingScheduler(maxThrottlingDelayMs); this.coordinatorRequests = new CoordinatorRequests(taskInstances.keySet()); this.latch = new Object(); this.workerTimer = Executors.newSingleThreadScheduledExecutor(); this.clock = clock; Map<TaskName, AsyncTaskWorker> workers = new HashMap<>(); for (TaskInstance task : taskInstances.values()) { workers.put(task.taskName(), new AsyncTaskWorker(task)); } this.sspToTaskWorkerMapping = Collections.unmodifiableMap(getSspToAsyncTaskWorkerMap(taskInstances, workers)); this.taskWorkers = Collections.unmodifiableList(new ArrayList<>(workers.values())); this.isAsyncCommitEnabled = isAsyncCommitEnabled; }

Target:
public AsyncRunLoop(Map<TaskName, TaskInstance> taskInstances, ExecutorService threadPool, SystemConsumers consumerMultiplexer, int maxConcurrency, long windowMs, long commitMs, long callbackTimeoutMs, long maxThrottlingDelayMs, SamzaContainerMetrics containerMetrics, HighResolutionClock clock, boolean isAsyncCommitEnabled) { this.threadPool = threadPool; this.consumerMultiplexer = consumerMultiplexer; this.containerMetrics = containerMetrics; this.windowMs = windowMs; this.commitMs = commitMs; this.maxConcurrency = maxConcurrency; this.callbackTimeoutMs = callbackTimeoutMs; this.callbackTimer = (callbackTimeoutMs > 0) ? Executors.newSingleThreadScheduledExecutor() : null; this.callbackExecutor = new ThrottlingScheduler(maxThrottlingDelayMs); this.coordinatorRequests = new CoordinatorRequests(taskInstances.keySet()); this.latch = new Object(); this.workerTimer = Executors.newSingleThreadScheduledExecutor(); this.clock = clock; Map<TaskName, AsyncTaskWorker> workers = new HashMap<>(); for (TaskInstance task : taskInstances.values()) { workers.put(task.taskName(), new AsyncTaskWorker(task)); } this.sspToTaskWorkerMapping = Collections.unmodifiableMap(getSspToAsyncTaskWorkerMap(taskInstances, workers)); this.taskWorkers = Collections.unmodifiableList(new ArrayList<>(workers.values())); this.isAsyncCommitEnabled = isAsyncCommitEnabled; }
Source:
private synchronized void handleNiInEs(GpsNiNotification notif) { if (DEBUG) Log.d(TAG, "entering handleNiInEs(GpsNiNotification notif)"); boolean isUEInEmergencyMode = getEmergencyStatus() || Boolean.parseBoolean(SystemProperties.get(TelephonyProperties.PROPERTY_INECM_MODE)); if (DEBUG) Log.d(TAG, "isUEInEmergencyMode is" + isUEInEmergencyMode + "getEmergencyStatus() is" + getEmergencyStatus() + "Boolean.parseBoolean(SystemProperties.get(TelephonyProperties" + ".PROPERTY_INECM_MODE)) is" + Boolean.parseBoolean(SystemProperties.get(TelephonyProperties.PROPERTY_INECM_MODE))); if ((notif.niType == GPS_NI_TYPE_EMERGENCY_SUPL) != isUEInEmergencyMode) { if (DEBUG) Log.d(TAG, "(notif.niType == GPS_NI_TYPE_EMERGENCY_SUPL)" + " != isUEInEmergencyMode"); try { if (DEBUG) Log.d(TAG, "ignoring the NI"); mNetInitiatedListener.sendNiResponse(notif.notificationId, GPS_NI_RESPONSE_IGNORE); } catch (RemoteException e) { Slog.e(TAG, "RemoteException in sendNiResponse"); } } else { if (DEBUG) Log.d(TAG, "(notif.niType == GPS_NI_TYPE_EMERGENCY_SUPL)" + " == isUEInEmergencyMode;"+ "calling handleSuplNi(notif)"); handleNi(notif); } if (DEBUG) Log.d(TAG, "leaving handleNiInEs(GpsNiNotification notif)"); }

Target:
private void handleNiInEs(GpsNiNotification notif) { if (DEBUG) Log.d(TAG, "in handleNiInEs () :" + " niType: " + notif.niType + " notificationId: " + notif.notificationId); boolean isUEInEmergencyMode = mIsInEmergency || Boolean.parseBoolean(SystemProperties.get(TelephonyProperties.PROPERTY_INECM_MODE)); boolean isNiTypeES = notif.niType == GPS_NI_TYPE_EMERGENCY_SUPL ? true : false; if (isNiTypeES != isUEInEmergencyMode) { try { mNetInitiatedListener.sendNiResponse(notif.notificationId, GPS_NI_RESPONSE_IGNORE); } catch (RemoteException e) { Log.e(TAG, "RemoteException in sendNiResponse"); } } else { handleNi(notif); } }
Source:
public GlowEnderPearl(Location location, float speed) { super(location); setDrag(0.99, false); setDrag(0.99, true); setHorizontalAirDrag(1); setGravityAccel(new Vector(0, -0.03, 0)); setVelocity(location.getDirection().multiply(speed)); setBoundingBox(0.25, 0.25); }

Target:
public GlowEnderPearl(Location location, float speed) { super(location); setDrag(0.99, false); setDrag(0.99, true); setHorizontalAirDrag(1); setGravityAccel(new Vector(0, VERTICAL_GRAVITY_ACCEL, 0)); setVelocity(location.getDirection().multiply(speed)); setBoundingBox(0.25, 0.25); }
Source:
protected void initializeSuppliedImage() { super.initSuppliedImage(transferImageCommand); DiskImage diskImage = new DiskImage(); diskImage.setId(transferImageCommand.getParameters().getImageId()); diskImage.setStorageIds(new ArrayList<>(Collections.singletonList(Guid.newGuid()))); doReturn(diskImage).when(diskImageDao).get(any()); doReturn(diskValidator).when(getCommand()).getDiskValidator(any()); doReturn(diskImagesValidator).when(getCommand()).getDiskImagesValidator(any()); doReturn(storageDomainValidator).when(getCommand()).getStorageDomainValidator(any()); }

Target:
protected void initializeSuppliedImage() { super.initSuppliedImage(transferImageCommand); DiskImage diskImage = new DiskImage(); diskImage.setImageId(transferImageCommand.getParameters().getImageId()); diskImage.setStorageIds(new ArrayList<>(Collections.singletonList(Guid.newGuid()))); doReturn(diskImage).when(diskImageDao).get(any()); doReturn(diskValidator).when(getCommand()).getDiskValidator(any()); doReturn(diskImagesValidator).when(getCommand()).getDiskImagesValidator(any()); doReturn(storageDomainValidator).when(getCommand()).getStorageDomainValidator(any()); }
Source:
public double logEmissionProbability(final AllelicCount data, final Double minorFraction) { return logEmissionProbability(data, minorFraction, parameters, allelicPoN); }

Target:
public double logEmissionProbability(final AllelicCount data, final Double minorFraction) { ParamUtils.inRange(minorFraction, 0.0, 0.5, "Minor fraction must be in [0, 1/2]."); return logEmissionProbability(data, minorFraction, parameters, allelicPoN); }
Source:
public boolean isOperationPermitted(Object id, Action action) { if (action == Action.CREATE || action == Action.UPDATE) { throw new UnexpectedEnumException(action); } return checkEntityTypePermission(id, action); }

Target:
public boolean isOperationPermitted(Object id, Action action) { if (action == Action.CREATE || action == Action.UPDATE) { throw new IllegalStateException( "CREATE and UPDATE permission checks should use 'isOperationPermitted(EntityType entityType, Action action)'"); } return checkEntityTypePermission(id, action); }
Source:
private void setShuffleKeysFromPartitionedTableStore(StoreTableNode node, DataChannel channel) { Preconditions.checkState(node.hasTargetTable(), "A target table must be a partitioned table."); PartitionMethodDesc partitionMethod = node.getPartitionMethod(); if (node.getType() == NodeType.INSERT) { InsertNode insertNode = (InsertNode) node; channel.setSchema(((InsertNode) node).getProjectedSchema()); Column[] shuffleKeys = new Column[partitionMethod.getExpressionSchema().size()]; int i = 0; for (Column column : partitionMethod.getExpressionSchema().getColumns()) { int id = insertNode.getTableSchema().getColumnId(column.getQualifiedName()); shuffleKeys[i++] = insertNode.getProjectedSchema().getColumn(id); } channel.setShuffleKeys(shuffleKeys); channel.setShuffleType(SCATTERED_HASH_SHUFFLE); } else if (node.getType() == NodeType.CREATE_TABLE) { channel.setSchema(node.getInSchema()); Column[] shuffleKeys = new Column[partitionMethod.getExpressionSchema().size()]; int i = 0; for (int j = 0; j < partitionMethod.getExpressionSchema().getColumns().size(); j++) { int id = node.getOutSchema().getColumns().size() + j; shuffleKeys[i++] = node.getInSchema().getColumn(id); } channel.setShuffleKeys(shuffleKeys); channel.setShuffleType(SCATTERED_HASH_SHUFFLE); } else { channel.setShuffleKeys(partitionMethod.getExpressionSchema().toArray()); channel.setShuffleType(HASH_SHUFFLE); } channel.setShuffleOutputNum(32); }

Target:
private void setShuffleKeysFromPartitionedTableStore(StoreTableNode node, DataChannel channel) { Preconditions.checkState(node.hasTargetTable(), "A target table must be a partitioned table."); PartitionMethodDesc partitionMethod = node.getPartitionMethod(); if (node.getType() == NodeType.INSERT || node.getType() == NodeType.CREATE_TABLE) { Schema tableSchema = null, projectedSchema = null; if (node.getType() == NodeType.INSERT) { tableSchema = ((InsertNode) node).getTableSchema(); projectedSchema = ((InsertNode) node).getProjectedSchema(); } else { tableSchema = node.getOutSchema(); projectedSchema = node.getInSchema(); } channel.setSchema(projectedSchema); Column[] shuffleKeys = new Column[partitionMethod.getExpressionSchema().size()]; int i = 0, id = 0; for (Column column : partitionMethod.getExpressionSchema().getColumns()) { if (node.getType() == NodeType.INSERT) { id = tableSchema.getColumnId(column.getQualifiedName()); } else { id = tableSchema.getColumns().size() + i; } shuffleKeys[i++] = projectedSchema.getColumn(id); } channel.setShuffleKeys(shuffleKeys); channel.setShuffleType(SCATTERED_HASH_SHUFFLE); } else { channel.setShuffleKeys(partitionMethod.getExpressionSchema().toArray()); channel.setShuffleType(HASH_SHUFFLE); } channel.setShuffleOutputNum(32); }
Source:
private void finishedTestClassRun(Class<?> testClazz) throws IOException { File directory = new File(FileUtils.getTempDirectoryPath() .concat(File.separator) .concat(XML_SNAPSHOT_DIRECTORY) .concat(File.separator) .concat(testClazz.getCanonicalName())); if (!directory.exists()) { if (!directory.mkdirs()) { throw new IOException("Unable to create path '" + directory.toString() + "'."); } } File copyTo = File.createTempFile(PropUtils.get("snapshots.target.file.prefix"), PropUtils.get("snapshots.target.file.suffix"), directory); File copyFrom = getSourceFile(); FileUtils.copyFile(copyFrom, copyTo); log.debug("Created snapshot of server configuration in '{}'.", copyTo); }

Target:
private void finishedTestClassRun(Class<?> testClazz) throws IOException { LocalTime time = LocalTime.now(); String timeStamp = String.format("%02d:%02d:%02d_", time.getHour(), time.getMinute(), time.getSecond()); File directory = new File(FileUtils.getTempDirectoryPath() .concat(File.separator) .concat(XML_SNAPSHOT_DIRECTORY) .concat(File.separator) .concat(timeStamp) .concat(testClazz.getCanonicalName())); if (!directory.exists()) { if (!directory.mkdirs()) { throw new IOException("Unable to create path '" + directory.toString() + "'."); } } File copyTo = File.createTempFile(PropUtils.get("snapshots.target.file.prefix"), PropUtils.get("snapshots.target.file.suffix"), directory); File copyFrom = getSourceFile(); FileUtils.copyFile(copyFrom, copyTo); log.debug("Created snapshot of server configuration in '{}'.", copyTo); }