auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
static ColumnCapabilities columnCapabilities(final IndexedTable table, final String columnName) { final ValueType valueType = table.rowSignature().getColumnType(columnName).orElse(null); if (valueType != null) { final ColumnCapabilitiesImpl capabilities = new ColumnCapabilitiesImpl().setType(valueType); if (valueType == ValueType.STRING) { capabilities.setDictionaryEncoded(true); } capabilities.setDictionaryValuesSorted(true); capabilities.setDictionaryValuesUnique(false); return capabilities.setIsComplete(true); } else { return null; } }

Target:
static ColumnCapabilities columnCapabilities(final IndexedTable table, final String columnName) { final ValueType valueType = table.rowSignature().getColumnType(columnName).orElse(null); if (valueType != null) { final ColumnCapabilitiesImpl capabilities = new ColumnCapabilitiesImpl().setType(valueType); if (valueType == ValueType.STRING) { capabilities.setDictionaryEncoded(true); } capabilities.setDictionaryValuesSorted(false); capabilities.setDictionaryValuesUnique(false); return capabilities.setIsComplete(true); } else { return null; } }
Source:
public void setUp() { jUnitCore = new JUnitCore(); testListener = new TestListener(); jUnitCore.addListener(testListener); }

Target:
public void setUp() { jUnitCore.addListener(testListener); }
Source:
protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_IMAGE && resultCode == RESULT_OK) { Objects.requireNonNull(data); Objects.requireNonNull(data.getData()); Uri uri = data.getData(); try { Bitmap image = MediaStore.Images.Media.getBitmap(getContentResolver(), uri); if (image != null) { String message = "User picture changed"; YieldsApplication.showToast(getApplicationContext(), message); Bitmap croppedImage; int h = image.getHeight(); int w = image.getWidth(); if (w > h){ croppedImage = Bitmap.createBitmap(image, (w-h)/2, 0, h, h); } else { croppedImage = Bitmap.createBitmap(image, 0, (h-w)/2, w, w); } int diameter = getResources().getInteger(R.integer.largeGroupImageDiameter); mUser.setImg(Bitmap.createScaledBitmap(croppedImage, diameter, diameter, false)); ServiceRequest request = new UserUpdateRequest(mUser); YieldsApplication.getBinder().sendRequest(request); } else { String message = "Could not retrieve image"; YieldsApplication.showToast(getApplicationContext(), message); } } catch (IOException e) { String message = "Could not retrieve image"; YieldsApplication.showToast(getApplicationContext(), message); Log.d(TAG, message); } } }

Target:
protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_IMAGE && resultCode == RESULT_OK) { Objects.requireNonNull(data); Objects.requireNonNull(data.getData()); Uri uri = data.getData(); try { Bitmap image = MediaStore.Images.Media.getBitmap(getContentResolver(), uri); if (image != null) { String message = "User picture changed"; YieldsApplication.showToast(getApplicationContext(), message); int diameter = getResources().getInteger(R.integer.largeGroupImageDiameter); mUser.setImg(Bitmap.createScaledBitmap(getCroppedSquaredBitmap(image), diameter, diameter, false)); ServiceRequest request = new UserUpdateRequest(mUser); YieldsApplication.getBinder().sendRequest(request); } else { String message = "Could not retrieve image"; YieldsApplication.showToast(getApplicationContext(), message); } } catch (IOException e) { String message = "Could not retrieve image"; YieldsApplication.showToast(getApplicationContext(), message); Log.d(TAG, message); } } }
Source:
public StoreConfig(VerifiableProperties verifiableProperties) { storeKeyFactory = verifiableProperties.getString("store.key.factory", "com.github.ambry.shared.BlobIdFactory"); storeDataFlushIntervalSeconds = verifiableProperties.getLong("store.data.flush.interval.seconds", 60); storeIndexMaxMemorySizeBytes = verifiableProperties.getInt("store.index.max.memory.size.bytes", 20971520); storeDataFlushDelaySeconds = verifiableProperties.getInt("store.data.flush.delay.seconds", 5); storeIndexMaxNumberOfElements = verifiableProperties.getInt("store.index.max.number.of.elements", 10000); storeIndexBloomMaxFalsePositiveProbability = verifiableProperties.getDoubleInRange( "store.index.bloom.max.false.positive.probability", 0.01, 0.0, 1.0); }

Target:
public StoreConfig(VerifiableProperties verifiableProperties) { storeKeyFactory = verifiableProperties.getString("store.key.factory", "com.github.ambry.shared.BlobIdFactory"); storeDataFlushIntervalSeconds = verifiableProperties.getLong("store.data.flush.interval.seconds", 60); storeIndexMaxMemorySizeBytes = verifiableProperties.getInt("store.index.max.memory.size.bytes", 20*1024*1024); storeDataFlushDelaySeconds = verifiableProperties.getInt("store.data.flush.delay.seconds", 5); storeIndexMaxNumberOfInmemElements = verifiableProperties.getInt("store.index.max.number.of.inmem.elements", 10000); storeIndexBloomMaxFalsePositiveProbability = verifiableProperties.getDoubleInRange( "store.index.bloom.max.false.positive.probability", 0.01, 0.0, 1.0); }
Source:
public void executeBehavior(final Class<?> testClass, final AbstractAjaxBehavior behavior, final String filename) throws Exception { assert(behavior != null); log.info("=== " + testClass.getName() + " : " + behavior.toString() + " ==="); executeBehavior(behavior); assertResultPage(testClass, filename); }

Target:
public void executeBehavior(final Class<?> testClass, final AbstractAjaxBehavior behavior, final String filename) throws Exception { assertNotNull(behavior); log.info("=== " + testClass.getName() + " : " + behavior.toString() + " ==="); executeBehavior(behavior); assertResultPage(testClass, filename); }
Source:
private static File loadLibraryFile(String libFolder, String libFileName, String tmpFolder) throws IOException { s_hostLog.debug("Loading library from jar using path = " + libFolder + "/" + libFileName); String uuid = UUID.randomUUID().toString(); String extractedLibFileName = String.format("voltdb-%s-%s", uuid, libFileName); File extractedLibFile = new File(tmpFolder, extractedLibFileName); String libPath = libFolder + "/" + libFileName; InputStream reader = null; FileOutputStream writer = null; try { reader = NativeLibraryLoader.class.getResourceAsStream(libPath); try { writer = new FileOutputStream(extractedLibFile); byte[] buffer = new byte[8192]; int bytesRead = 0; while ((bytesRead = reader.read(buffer)) != -1) { writer.write(buffer, 0, bytesRead); } } finally { if (writer != null) { writer.close(); } } } finally { if (reader != null) { reader.close(); } extractedLibFile.deleteOnExit(); } boolean success = extractedLibFile.setReadable(true) && extractedLibFile.setWritable(true, true) && extractedLibFile.setExecutable(true); if (!success) { String msg = "Could not update extracted lib file " + extractedLibFile + " to be rwx"; s_hostLog.warn(msg); throw new RuntimeException(msg); } return new File(tmpFolder, extractedLibFileName); }

Target:
private static File loadLibraryFile(String libFolder, String libFileName, String tmpFolder) throws IOException { s_hostLog.debug("Loading library from jar using path = " + libFolder + "/" + libFileName); String uuid = UUID.randomUUID().toString(); String extractedLibFileName = String.format("voltdb-%s-%s", uuid, libFileName); File extractedLibFile = new File(tmpFolder, extractedLibFileName); String libPath = libFolder + "/" + libFileName; try (InputStream reader = NativeLibraryLoader.class.getResourceAsStream(libPath)) { try (FileOutputStream writer = new FileOutputStream(extractedLibFile)) { byte[] buffer = new byte[8192]; int bytesRead = 0; while ((bytesRead = reader.read(buffer)) != -1) { writer.write(buffer, 0, bytesRead); } } } finally { extractedLibFile.deleteOnExit(); } boolean success = extractedLibFile.setReadable(true) && extractedLibFile.setWritable(true, true) && extractedLibFile.setExecutable(true); if (! success) { String msg = "Could not update extracted lib file " + extractedLibFile + " to be rwx"; s_hostLog.warn(msg); throw new RuntimeException(msg); } return new File(tmpFolder, extractedLibFileName); }
Source:
public void testGeneralPurposeWindowFunctionsWithStandaloneValues() { execute("select col1, col2, " + "first_value(col1) OVER(order by col2, col1), " + "last_value(col1) OVER(order by col2, col1), " + "nth_value(col1, 3) OVER(order by col2, col1), " + "lag(col1) OVER(order by col2, col1) " + "from unnest([1, 1, 3, 2], [1, 2, 2, 3]) " + "order by col1, col2"); assertThat(printedTable(response.rows()), is("1| 1| 1| 1| NULL| NULL\n" + "1| 2| 1| 1| NULL| 1\n" + "2| 3| 1| 2| 3| 3\n" + "3| 2| 1| 3| 3| 1\n")); }

Target:
public void testGeneralPurposeWindowFunctionsWithStandaloneValues() { execute("select col1, col2, " + "first_value(col1) OVER(order by col2, col1), " + "last_value(col1) OVER(order by col2, col1), " + "nth_value(col1, 3) OVER(order by col2, col1) " + "from unnest([1, 1, 3, 2], [1, 2, 2, 3]) " + "order by col1, col2"); assertThat(printedTable(response.rows()), is("1| 1| 1| 1| NULL\n" + "1| 2| 1| 1| NULL\n" + "2| 3| 1| 2| 3\n" + "3| 2| 1| 3| 3\n")); }
Source:
public boolean hasEntry(long entryId, int bookieIndex) { int[] set = writeSets[(int) (entryId % ensembleSize)]; return ArrayUtils.contains(set, bookieIndex); }

Target:
public boolean hasEntry(long entryId, int bookieIndex) { WriteSet w = getWriteSet(entryId); try { return w.contains(bookieIndex); } finally { w.recycle(); } }
Source:
private void onBoardSaveAs() { logger.info("Menu: Boards > Save as"); List<PanelInfo> panels = getCurrentPanels(); if (panels.isEmpty()) { logger.info("Did not save new board"); return; } TextInputDialog dlg = new TextInputDialog(""); dlg.getEditor().setId("boardnameinput"); dlg.setTitle("Board Name"); dlg.getDialogPane().setContentText("What should this board be called?"); dlg.getDialogPane().setHeaderText("Please name this board"); Optional<String> response = dlg.showAndWait(); if (response.isPresent()) { String boardName = response.get(); if (boardName.equals("")) { logger.info("Did not save new board"); return; } prefs.addBoard(boardName, panels); prefs.setLastOpenBoard(boardName); ui.triggerEvent(new BoardSavedEvent()); logger.info("New board " + boardName + " saved"); } }

Target:
private void onBoardSaveAs() { logger.info("Menu: Boards > Save as"); List<PanelInfo> panels = getCurrentPanels(); if (panels.isEmpty()) { logger.info("Did not save new board"); return; } TextInputDialog dlg = new TextInputDialog(""); dlg.getEditor().setId("boardnameinput"); dlg.setTitle("Board Name"); dlg.getDialogPane().setContentText("What should this board be called?"); dlg.getDialogPane().setHeaderText("Please name this board"); Optional<String> response = dlg.showAndWait(); if (response.isPresent()) { String boardName = response.get().trim(); if (isBoardNameValid(boardName)) { prefs.addBoard(boardName, panels); prefs.setLastOpenBoard(boardName); ui.triggerEvent(new BoardSavedEvent()); logger.info("New board " + boardName + " saved"); } } }
Source:
private static void checkCommand(Command command) { checkArgument(command.hasMessage(), "Command message must be set."); checkArgument(command.hasContext(), "Command context must be set."); final CommandContext context = command.getContext(); checkValid(context.getCommandId()); checkTimestamp(context.getTimestamp(), "Command time"); final Message commandMessage = Commands.getMessage(command); final String commandType = TypeName.of(commandMessage).nameOnly(); checkNotEmptyOrBlank(commandType, "command type"); final Object targetId = tryToGetTargetId(commandMessage); if (targetId != null) { final String targetIdString = idToString(targetId); checkNotEmptyOrBlank(targetIdString, "command target ID"); final String targetIdType = targetId.getClass().getName(); checkNotEmptyOrBlank(targetIdType, "command target ID type"); } }

Target:
static void checkCommand(Command command) { checkArgument(command.hasMessage(), "Command message must be set."); checkArgument(command.hasContext(), "Command context must be set."); final CommandContext context = command.getContext(); checkValid(context.getCommandId()); checkTimestamp(context.getTimestamp(), "Command time"); final Message commandMessage = Commands.getMessage(command); final String commandType = TypeName.of(commandMessage).nameOnly(); checkNotEmptyOrBlank(commandType, "command type"); final Object targetId = tryToGetTargetId(commandMessage); if (targetId != null) { final String targetIdString = idToString(targetId); checkNotEmptyOrBlank(targetIdString, "command target ID"); final String targetIdType = targetId.getClass().getName(); checkNotEmptyOrBlank(targetIdType, "command target ID type"); } }
Source:
private void configureDefaultCache() { final CacheConfiguration c = new CacheConfiguration(); c.setMaxElementsInMemory(1024); c.setMemoryStoreEvictionPolicyFromObject(MemoryStoreEvictionPolicy.LFU); c.setTimeToIdleSeconds(0); c.setTimeToLiveSeconds(0 ); if (mgr.getDiskStoreConfiguration() != null) { c.setMaxElementsOnDisk(16384); c.setOverflowToDisk(false); c.setDiskPersistent(false); c.setDiskSpoolBufferSizeMB(5); c.setDiskExpiryThreadIntervalSeconds(60 * 60); } mgr.setDefaultCacheConfiguration(c); }

Target:
private void configureDefaultCache() { final CacheConfiguration c = new CacheConfiguration(); c.setMaxElementsInMemory(1024); c.setMemoryStoreEvictionPolicyFromObject(MemoryStoreEvictionPolicy.LFU); c.setEternal(true); if (mgr.getDiskStoreConfiguration() != null) { c.setMaxElementsOnDisk(16384); c.setOverflowToDisk(false); c.setDiskPersistent(false); c.setDiskSpoolBufferSizeMB(5); c.setDiskExpiryThreadIntervalSeconds(60 * 60); } mgr.setDefaultCacheConfiguration(c); }
Source:
public WebVideoViewBase(Context context, Content model, ConversationFullScreenVideoFrame fullScreenContainer) { super(context); this.context = context; this.model = model; this.fullScreenContainer = fullScreenContainer; url = model.getValue(); height = Integer.parseInt(model.getHeight()); if (height <= 0) { height = 220; } String aStyle = "style='font-size: 0.6875em; color: #666; width:100%;'"; String pStyle = "style='text-align:center; margin-top:8px'"; errorHtml = ("<p " + pStyle + ">") + ("<a " + aStyle + " href='" + url.toString() + EXTERNAL_MARKER + "'>") + ("Can't see the video?</a>"); if (SwrveHelper.isNullOrEmpty(url)) { Toast.makeText(this.getContext(), "Unknown Video Player Detected", Toast.LENGTH_SHORT).show(); videoHtml = "<p>Sorry, a malformed URL was detected. This video cannot be played.</p> "; } else if (url.toLowerCase().contains(PLAYER_VIDEO_YOUTUBE) || url.toLowerCase().contains(PLAYER_VIDEO_VIMEO)) { videoHtml = "<iframe type='text/html' width='100%' height='" + height + "' src=" + url + " frameborder='0' webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>" + errorHtml; } else { Toast.makeText(this.getContext(), "Unknown Video Player Detected", Toast.LENGTH_SHORT).show(); videoHtml = errorHtml; } }

Target:
public WebVideoViewBase(Context context, Content model, ConversationFullScreenVideoFrame fullScreenContainer) { super(context); this.model = model; this.fullScreenContainer = fullScreenContainer; url = model.getValue(); height = Integer.parseInt(model.getHeight()); if (height <= 0) { height = 220; } String aStyle = "style='font-size: 0.6875em; color: #666; width:100%;'"; String pStyle = "style='text-align:center; margin-top:8px'"; errorHtml = ("<p " + pStyle + ">") + ("<a " + aStyle + " href='" + url.toString() + EXTERNAL_MARKER + "'>") + ("Can't see the video?</a>"); if (SwrveHelper.isNullOrEmpty(url)) { Toast.makeText(this.getContext(), "Unknown Video Player Detected", Toast.LENGTH_SHORT).show(); videoHtml = "<p>Sorry, a malformed URL was detected. This video cannot be played.</p> "; } else if (url.toLowerCase().contains(PLAYER_VIDEO_YOUTUBE) || url.toLowerCase().contains(PLAYER_VIDEO_VIMEO)) { videoHtml = "<iframe type='text/html' width='100%' height='" + height + "' src=" + url + " frameborder='0' webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>" + errorHtml; } else { Toast.makeText(this.getContext(), "Unknown Video Player Detected", Toast.LENGTH_SHORT).show(); videoHtml = errorHtml; } }
Source:
public static String getClientId(String id) { return id + CLIENT_ID_SUFFIX; }

Target:
public static String getClientId(String id) { if (id.endsWith(CLIENT_ID_SUFFIX)) { throw new IllegalStateException("Id already contains suffix: " + CLIENT_ID_SUFFIX); } return id + CLIENT_ID_SUFFIX; }
Source:
private CheckpointCoordinator instantiateCheckpointCoordinator( JobID jid, ScheduledExecutor testingScheduledExecutor, ExecutionVertex... ackVertices) { CheckpointCoordinatorConfiguration chkConfig = new CheckpointCoordinatorConfiguration( 10000000L, 600000L, 0L, 1, CheckpointRetentionPolicy.NEVER_RETAIN_AFTER_TERMINATION, true, false, false, 0); Executor executor = Executors.directExecutor(); return new CheckpointCoordinator( jid, chkConfig, new ExecutionVertex[0], ackVertices, new ExecutionVertex[0], Collections.emptyList(), new StandaloneCheckpointIDCounter(), new StandaloneCompletedCheckpointStore(10), new MemoryStateBackend(), executor, new CheckpointsCleaner(executor), testingScheduledExecutor, SharedStateRegistry.DEFAULT_FACTORY, new CheckpointFailureManager( 0, NoOpFailJobCall.INSTANCE)); }

Target:
private CheckpointCoordinator instantiateCheckpointCoordinator( JobID jid, ScheduledExecutor testingScheduledExecutor, ExecutionVertex... ackVertices) { CheckpointCoordinatorConfiguration chkConfig = new CheckpointCoordinatorConfiguration( 10000000L, 600000L, 0L, 1, CheckpointRetentionPolicy.NEVER_RETAIN_AFTER_TERMINATION, true, false, false, 0); Executor executor = Executors.directExecutor(); return new CheckpointCoordinator( jid, chkConfig, new ExecutionVertex[0], ackVertices, new ExecutionVertex[0], Collections.emptyList(), new StandaloneCheckpointIDCounter(), new StandaloneCompletedCheckpointStore(10), new MemoryStateBackend(), executor, new CheckpointsCleaner(), testingScheduledExecutor, SharedStateRegistry.DEFAULT_FACTORY, new CheckpointFailureManager( 0, NoOpFailJobCall.INSTANCE)); }
Source:
public SpliceCatalogUpgradeScripts(SpliceDataDictionary sdd,Splice_DD_Version catalogVersion,TransactionController tc){ this.sdd=sdd; this.catalogVersion=catalogVersion; this.tc=tc; ddComparator=new Comparator<Splice_DD_Version>(){ @Override public int compare(Splice_DD_Version version1,Splice_DD_Version version2){ long v1=version1.toLong(); long v2=version2.toLong(); if(v1<v2) return -1; else if(v1==v2) return 0; else return 1; } }; scripts=new TreeMap<>(ddComparator); scripts.put(new Splice_DD_Version(sdd,1,0,0),new UpgradeScriptForFuji(sdd,tc)); scripts.put(new Splice_DD_Version(sdd,1,1,1),new LassenUpgradeScript(sdd,tc)); scripts.put(new Splice_DD_Version(sdd,1,1,2),new SourceCodeUpgradeScript(sdd,tc)); }

Target:
public SpliceCatalogUpgradeScripts(SpliceDataDictionary sdd,Splice_DD_Version catalogVersion,TransactionController tc){ this.sdd=sdd; this.catalogVersion=catalogVersion; this.tc=tc; ddComparator=new Comparator<Splice_DD_Version>(){ @Override public int compare(Splice_DD_Version version1,Splice_DD_Version version2){ long v1=version1.toLong(); long v2=version2.toLong(); if(v1<v2) return -1; else if(v1==v2) return 0; else return 1; } }; scripts=new TreeMap<>(ddComparator); scripts.put(new Splice_DD_Version(sdd,1,0,0),new UpgradeScriptForFuji(sdd,tc)); scripts.put(new Splice_DD_Version(sdd,1,1,1),new LassenUpgradeScript(sdd,tc)); scripts.put(new Splice_DD_Version(sdd,2,6,0),new SourceCodeUpgradeScript(sdd,tc)); }
Source:
public RowBatch nextBatch(RowBatch previous, Class<T> clazz) throws IOException { RowBatch rowBatch = previous; if (rowBatch == null) { rowBatch = new RowBatch(); } ObjectColumnVector<T> columnVector; if (rowBatch.getColumns() == null) { columnVector = ColumnVector.ofType(clazz); rowBatch.setColumns(new ColumnVector[] { columnVector }); } else { columnVector = (ObjectColumnVector<T>) rowBatch.getColumns()[0]; } return readVector(columnVector) ? rowBatch : null; }

Target:
public RowBatch nextBatch(RowBatch previous, Class<T> clazz) throws IOException { RowBatch rowBatch = previous; if (rowBatch == null) { rowBatch = new RowBatch(new ColumnVector[] { ColumnVector.ofType(clazz) } ); } return readVector((ObjectColumnVector<T>) rowBatch.getColumns()[0]) ? rowBatch : null; }
Source:
public static ExecutorService newBlockingSingleThreaded( final String nameFormat, final int capacity, final Integer priority ) { final BlockingQueue<Runnable> queue; if (capacity > 0) { queue = new ArrayBlockingQueue<>(capacity); } else { queue = new SynchronousQueue<>(); } return new ThreadPoolExecutor( 1, 1, 0L, TimeUnit.MILLISECONDS, queue, makeThreadFactory(nameFormat), new RejectedExecutionHandler() { @Override public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) { try { executor.getQueue().put(r); } catch (InterruptedException e) { throw new RejectedExecutionException("Got Interrupted while adding to the Queue"); } } } ); }

Target:
public static ExecutorService newBlockingSingleThreaded( final String nameFormat, final int capacity, final Integer priority ) { final BlockingQueue<Runnable> queue; if (capacity > 0) { queue = new ArrayBlockingQueue<>(capacity); } else { queue = new SynchronousQueue<>(); } return new ThreadPoolExecutor( 1, 1, 0L, TimeUnit.MILLISECONDS, queue, makeThreadFactory(nameFormat, priority), new RejectedExecutionHandler() { @Override public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) { try { executor.getQueue().put(r); } catch (InterruptedException e) { throw new RejectedExecutionException("Got Interrupted while adding to the Queue"); } } } ); }
Source:
public ProductData populate(Product source) { if (source == null) { throw new IllegalArgumentException("source is null"); } super.populate(source); this.uuid = source.getUuid(); this.id = source.getId(); this.name = source.getName(); this.multiplier = source.getMultiplier(); this.href = source.getHref(); this.locked = source.isLocked(); this.setAttributes(source.getAttributes()); if (source.getProductContent() != null) { if (this.content == null) { this.content = new HashMap<>(); } else { this.content.clear(); } for (ProductContent entity : source.getProductContent()) { this.addProductContent(entity.toDTO()); } } else { this.setProductContent(null); } this.setDependentProductIds(source.getDependentProductIds()); this.setBranding(source.getBranding()); if (source.getProvidedProducts() != null) { this.setProvidedProducts(source.getProvidedProducts().stream() .map(prod -> this.populate(prod)) .collect(Collectors.toSet())); } return this; }

Target:
public ProductData populate(Product source) { if (source == null) { throw new IllegalArgumentException("source is null"); } super.populate(source); this.uuid = source.getUuid(); this.id = source.getId(); this.name = source.getName(); this.multiplier = source.getMultiplier(); this.href = source.getHref(); this.locked = source.isLocked(); this.setAttributes(source.getAttributes()); if (source.getProductContent() != null) { if (this.content == null) { this.content = new HashMap<>(); } else { this.content.clear(); } for (ProductContent entity : source.getProductContent()) { this.addProductContent(entity.toDTO()); } } else { this.setProductContent(null); } this.setDependentProductIds(source.getDependentProductIds()); this.setBranding(source.getBranding()); if (source.getProvidedProducts() != null) { this.setProvidedProducts(source.getProvidedProducts().stream() .map(prod -> new ProductData(prod)) .collect(Collectors.toSet())); } return this; }
Source:
GoogleCloudStorageSinkConfiguration(final FileStrategyConfiguration fileStrategy, @JsonProperty(required = true) final String bucket) { super(fileStrategy); this.bucket = bucket; }

Target:
GoogleCloudStorageSinkConfiguration(final FileStrategyConfiguration fileStrategy, @JsonProperty(required = true) final String bucket) { super(fileStrategy); this.bucket = Objects.requireNonNull(bucket); }
Source:
private RemoteMethodCallResults invokeAndWaitRemote(final RemoteMethodCall remoteCall) { final UUID methodCallId = UUID.randomUUID(); final CountDownLatch latch = new CountDownLatch(1); synchronized (pendingLock) { pendingInvocations.put(methodCallId, latch); } final Invoke invoke = new HubInvoke(methodCallId, true, remoteCall); send(invoke, messenger.getServerNode()); if (!Interruptibles.awaitResult(() -> latch.await(1, TimeUnit.MINUTES)).result.orElse(false)) { throw new IllegalStateException( String.format( "Server timed out while waiting for result of method %s for remote %s with id %s", remoteCall.getMethodName(), remoteCall.getRemoteName(), methodCallId)); } synchronized (pendingLock) { final RemoteMethodCallResults methodCallResults = results.remove(methodCallId); if (methodCallResults == null) { throw new IllegalStateException( "No results from remote call. Method returned:" + remoteCall.getMethodName() + " for remote name:" + remoteCall.getRemoteName() + " with id:" + methodCallId); } return methodCallResults; } }

Target:
private RemoteMethodCallResults invokeAndWaitRemote(final RemoteMethodCall remoteCall) { final UUID methodCallId = UUID.randomUUID(); final CountDownLatch latch = new CountDownLatch(1); synchronized (pendingLock) { pendingInvocations.put(methodCallId, latch); } final Invoke invoke = new HubInvoke(methodCallId, true, remoteCall); send(invoke, messenger.getServerNode()); if (!Interruptibles.awaitResult(() -> latch.await(20, TimeUnit.SECONDS)).result.orElse(false)) { synchronized (pendingLock) { pendingInvocations.remove(methodCallId); } throw new IllegalStateException( String.format( "Server timed out while waiting for result of method %s for remote %s with id %s", remoteCall.getMethodName(), remoteCall.getRemoteName(), methodCallId)); } synchronized (pendingLock) { final RemoteMethodCallResults methodCallResults = results.remove(methodCallId); if (methodCallResults == null) { throw new IllegalStateException( "No results from remote call. Method returned:" + remoteCall.getMethodName() + " for remote name:" + remoteCall.getRemoteName() + " with id:" + methodCallId); } return methodCallResults; } }
Source:
public boolean test(final Object receiver, final String property, final Object[] args, final Object expectedValue) { final INattableModelManager manager = getNattableModelManager(); if (IS_NATTABLE_WIDGET.equals(property) && expectedValue instanceof Boolean) { return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().equals(PlatformUI.getWorkbench().getDisplay().getActiveShell()) && expectedValue.equals(manager != null); } if (manager != null && expectedValue instanceof Boolean) { if (HAS_FEATURE_ROW_HEADER_CONFIGURATION.equals(property)) { LabelConfigurationManagementUtils.getRowFeatureLabelConfigurationInTable(manager.getTable()); return expectedValue.equals(LabelConfigurationManagementUtils.hasRowFeatureLabelConfiguration(manager.getTable())); } else if (HAS_FEATURE_COLUMN_HEADER_CONFIGURATION.equals(property)) { return expectedValue.equals(LabelConfigurationManagementUtils.hasColumnFeatureLabelConfiguration(manager.getTable())); } else if (HAS_SLAVE_COLUMNS_AXIS_PROVIDER.equals(property)) { return expectedValue.equals(AxisUtils.getAxisProviderUsedForColumns(manager) instanceof ISlaveAxisProvider); } else if (HAS_SLAVE_ROWS_AXIS_PROVIDER.equals(property)) { return expectedValue.equals(AxisUtils.getAxisProviderUsedForRows(manager) instanceof ISlaveAxisProvider); } else if (CAN_INVERT_AXIS.equals(property)) { return expectedValue.equals(manager.canInvertAxis()); } else if (IS_HIERARCHIC_TABLE.equals(property)) { return expectedValue.equals(isHierarchicTable(manager)); } } return false; }

Target:
public boolean test(final Object receiver, final String property, final Object[] args, final Object expectedValue) { final INattableModelManager manager = getNattableModelManager(); if (IS_NATTABLE_WIDGET.equals(property) && expectedValue instanceof Boolean) { return expectedValue.equals(null != manager) && ((!(Boolean)expectedValue) || manager.getAdapter(NatTable.class).isFocusControl()); } if (manager != null && expectedValue instanceof Boolean) { if (HAS_FEATURE_ROW_HEADER_CONFIGURATION.equals(property)) { LabelConfigurationManagementUtils.getRowFeatureLabelConfigurationInTable(manager.getTable()); return expectedValue.equals(LabelConfigurationManagementUtils.hasRowFeatureLabelConfiguration(manager.getTable())); } else if (HAS_FEATURE_COLUMN_HEADER_CONFIGURATION.equals(property)) { return expectedValue.equals(LabelConfigurationManagementUtils.hasColumnFeatureLabelConfiguration(manager.getTable())); } else if (HAS_SLAVE_COLUMNS_AXIS_PROVIDER.equals(property)) { return expectedValue.equals(AxisUtils.getAxisProviderUsedForColumns(manager) instanceof ISlaveAxisProvider); } else if (HAS_SLAVE_ROWS_AXIS_PROVIDER.equals(property)) { return expectedValue.equals(AxisUtils.getAxisProviderUsedForRows(manager) instanceof ISlaveAxisProvider); } else if (CAN_INVERT_AXIS.equals(property)) { return expectedValue.equals(manager.canInvertAxis()); } else if (IS_HIERARCHIC_TABLE.equals(property)) { return expectedValue.equals(isHierarchicTable(manager)); } } return false; }
Source:
private Property toProperty(@NonNull String value) { switch (value) { case "hasStagedChanges": return Property.HAS_STAGED_CHANGES; case "hasUnstagedChanges": return Property.HAS_UNSTAGED_CHANGES; case "hasNotIgnoredResources": return Property.HAS_NOT_IGNORED_RESOURCES; case "hasTrackedResources": return Property.HAS_TRACKED_RESOURCES; default: break; } return null; }

Target:
private Property toProperty(@NonNull String value) { switch (value) { case "hasStagedChanges": return Property.HAS_STAGED_CHANGES; case "hasUnstagedChanges": return Property.HAS_UNSTAGED_CHANGES; case "hasNotIgnoredResources": return Property.HAS_NOT_IGNORED_RESOURCES; case "hasTrackedResources": return Property.HAS_TRACKED_RESOURCES; default: return null; } }
Source:
public void finished(TaskEvent taskEvent) { if (taskEvent.getKind() != Kind.ANALYZE) { return; } if (JavaCompiler.instance(context).errorCount() > 0) { return; } TreePath path = JavacTrees.instance(context).getPath(taskEvent.getTypeElement()); if (path == null) { path = new TreePath(taskEvent.getCompilationUnit()); } verify(seen.add(path.getLeaf()), "Duplicate FLOW event for: %s", taskEvent.getTypeElement()); Context subContext = new SubContext(context); subContext.put(ErrorProneOptions.class, errorProneOptions); Log log = Log.instance(context); JCCompilationUnit compilation = (JCCompilationUnit) path.getCompilationUnit(); DescriptionListener descriptionListener = descriptionListenerFactory.getDescriptionListener(log, compilation); try { if (path.getLeaf().getKind() == Tree.Kind.COMPILATION_UNIT) { if (!isExcludedPath(compilation.getSourceFile().toUri())) { transformer.get().apply(path, subContext, descriptionListener); } } else if (finishedCompilation(path.getCompilationUnit())) { if (!isExcludedPath(compilation.getSourceFile().toUri())) { transformer.get().apply(new TreePath(compilation), subContext, descriptionListener); } } } catch (ErrorProneError e) { e.logFatalError(log); throw e; } catch (CompletionFailure e) { log.error("proc.cant.access", e.sym, e.getDetailValue(), Throwables.getStackTraceAsString(e)); } }

Target:
public void finished(TaskEvent taskEvent) { if (taskEvent.getKind() != Kind.ANALYZE) { return; } if (JavaCompiler.instance(context).errorCount() > 0) { return; } TreePath path = JavacTrees.instance(context).getPath(taskEvent.getTypeElement()); if (path == null) { path = new TreePath(taskEvent.getCompilationUnit()); } verify(seen.add(path.getLeaf()), "Duplicate FLOW event for: %s", taskEvent.getTypeElement()); Context subContext = new SubContext(context); subContext.put(ErrorProneOptions.class, errorProneOptions); Log log = Log.instance(context); JCCompilationUnit compilation = (JCCompilationUnit) path.getCompilationUnit(); DescriptionListener descriptionListener = descriptionListenerFactory.getDescriptionListener(log, compilation); try { if (!isExcludedPath(compilation.getSourceFile().toUri())) { if (path.getLeaf().getKind() == Tree.Kind.COMPILATION_UNIT) { transformer.get().apply(path, subContext, descriptionListener); } else if (finishedCompilation(path.getCompilationUnit())) { transformer.get().apply(new TreePath(compilation), subContext, descriptionListener); } } } catch (ErrorProneError e) { e.logFatalError(log); throw e; } catch (CompletionFailure e) { log.error("proc.cant.access", e.sym, e.getDetailValue(), Throwables.getStackTraceAsString(e)); } }
Source:
protected TmfViewerFolder<ITmfStatisticsViewer> createStatisticsViewers() { int defaultStyle = SWT.NONE; TmfViewerFolder<ITmfStatisticsViewer> tabsView = new TmfViewerFolder<ITmfStatisticsViewer>(fParent); Composite folder = tabsView.getParentFolder(); ITmfStatisticsViewer viewer = new TmfStatisticsViewer(); viewer.init(folder, Messages.TmfStatisticsView_GlobalTabName, fExperiment); tabsView.addTab(viewer, defaultStyle); tabsView.setSelection(0); if (fExperiment != null) { String traceName; IResource traceResource; for (ITmfTrace trace : fExperiment.getTraces()) { traceName = trace.getName(); traceResource = trace.getResource(); viewer = TmfViewerFactory.getStatisticsViewer(traceResource); if (viewer == null) { viewer = new TmfStatisticsViewer(); } viewer.init(folder, traceName, trace); tabsView.addTab(viewer, defaultStyle); } } return tabsView; }

Target:
protected TmfViewerFolder createStatisticsViewers() { int defaultStyle = SWT.NONE; TmfViewerFolder tabsView = new TmfViewerFolder(fParent); Composite folder = tabsView.getParentFolder(); ITmfStatisticsViewer viewer = new TmfStatisticsViewer(); if (fExperiment != null) { viewer.init(folder, Messages.TmfStatisticsView_GlobalTabName + " - " + fExperiment.getName(), fExperiment); tabsView.addTab(viewer, defaultStyle); String traceName; IResource traceResource; for (ITmfTrace trace : fExperiment.getTraces()) { traceName = trace.getName(); traceResource = trace.getResource(); viewer = TmfViewerFactory.getStatisticsViewer(traceResource); if (viewer == null) { viewer = new TmfStatisticsViewer(); } viewer.init(folder, traceName, trace); tabsView.addTab(viewer, defaultStyle); } } else { viewer.init(folder, Messages.TmfStatisticsView_GlobalTabName, fExperiment); tabsView.addTab(viewer, defaultStyle); } tabsView.setSelection(0); return tabsView; }
Source:
public void errorChannelTest() { class ErrorThrower extends AbstractReplyProducingMessageHandler { @Override protected Object handleRequestMessage(Message<?> requestMessage) { throw new RuntimeException(); } } class DefaultTargetProducer extends AbstractReplyProducingMessageHandler { @Override protected Object handleRequestMessage(Message<?> requestMessage) { final Target defaultTarget = new Target(); defaultTarget.setName("Default"); return defaultTarget; } } context.getBean("requestChannel", DirectChannel.class).subscribe(new ErrorThrower()); context.getBean("errChannel", DirectChannel.class).subscribe(new DefaultTargetProducer()); final PollableChannel replyChannel = context.getBean("replyChannel", PollableChannel.class); Target original = new Target(); original.setName("John"); Message<?> request = MessageBuilder.withPayload(original).setReplyChannel(replyChannel).build(); context.getBean("inputChannel", DirectChannel.class).send(request); Message<?> reply = replyChannel.receive(0); Target enriched = (Target) reply.getPayload(); assertEquals("Mr. Default", enriched.getName()); }

Target:
public void errorChannelTest() { class ErrorThrower extends AbstractReplyProducingMessageHandler { @Override protected Object handleRequestMessage(Message<?> requestMessage) { throw new RuntimeException(); } } class DefaultTargetProducer extends AbstractReplyProducingMessageHandler { @Override protected Object handleRequestMessage(Message<?> requestMessage) { final Target defaultTarget = new Target(); defaultTarget.setName("Default"); return defaultTarget; } } context.getBean("requestChannel", DirectChannel.class).subscribe(new ErrorThrower()); context.getBean("errChannel", DirectChannel.class).subscribe(new DefaultTargetProducer()); Target original = new Target(); original.setName("John"); Message<?> request = MessageBuilder.withPayload(original).build(); context.getBean("inputChannel", DirectChannel.class).send(request); Message<?> reply = context.getBean("outputChannel", PollableChannel.class).receive(10000); Target enriched = (Target) reply.getPayload(); assertEquals("Mr. Default", enriched.getName()); }
Source:
static public float getPercentUniqueMovements(final List<TrackerMotion> userOriginalTrackerMotions, final List<TrackerMotion> partnerOriginalTrackerMotions){ final int numUserMotions = userOriginalTrackerMotions.size(); final int numPartnerMotions = partnerOriginalTrackerMotions.size(); int numUniqueUserMotions = numUserMotions; if (numUserMotions == 0){ return 0.0f; } else if (numPartnerMotions == 0){ return 1.0f; } long currentPartnerMotionTS = partnerOriginalTrackerMotions.get(0).timestamp; int i = 0; for (TrackerMotion userMotion : userOriginalTrackerMotions){ long currentUserMotionTS = userMotion.timestamp; while (currentUserMotionTS > currentPartnerMotionTS + DateTimeConstants.MILLIS_PER_MINUTE & i < numPartnerMotions - 1){ i+=1; currentPartnerMotionTS = partnerOriginalTrackerMotions.get(i).timestamp; } if (currentUserMotionTS >= currentPartnerMotionTS - DateTimeConstants.MILLIS_PER_MINUTE & currentUserMotionTS <= currentPartnerMotionTS + DateTimeConstants.MILLIS_PER_MINUTE){ numUniqueUserMotions -= 1; } } final float percentUniqueMovements = (float)numUniqueUserMotions / (float) numUserMotions; return percentUniqueMovements; }

Target:
static public float getPercentUniqueMovements(final List<TrackerMotion> userOriginalTrackerMotions, final List<TrackerMotion> partnerOriginalTrackerMotions){ final int numUserMotions = userOriginalTrackerMotions.size(); final int numPartnerMotions = partnerOriginalTrackerMotions.size(); int numUniqueUserMotions = numUserMotions; if (numUserMotions == 0){ return 0.0f; } else if (numPartnerMotions == 0){ return 1.0f; } long currentPartnerMotionTS = partnerOriginalTrackerMotions.get(0).timestamp; int i = 0; for (final TrackerMotion userMotion : userOriginalTrackerMotions){ final long currentUserMotionTS = userMotion.timestamp; while (currentUserMotionTS > currentPartnerMotionTS + DateTimeConstants.MILLIS_PER_MINUTE && i < numPartnerMotions - 1){ i+=1; currentPartnerMotionTS = partnerOriginalTrackerMotions.get(i).timestamp; } if (currentUserMotionTS >= currentPartnerMotionTS - DateTimeConstants.MILLIS_PER_MINUTE && currentUserMotionTS <= currentPartnerMotionTS + DateTimeConstants.MILLIS_PER_MINUTE){ numUniqueUserMotions -= 1; } } final float percentUniqueMovements = (float)numUniqueUserMotions / (float) numUserMotions; return percentUniqueMovements; }
Source:
public static Transform<FullQuery, QueryResultPart> fromResultGroup( final ClusterShard shard ) { return result -> { final ImmutableList<ShardedResultGroup> groups = ImmutableList.copyOf(result .getGroups() .stream() .map(ResultGroup.toShardedResultGroup(shard)) .iterator()); long sampleSize = 0; if (result.getStatistics().getCounters().containsKey(AggregationInstance.SAMPLE_SIZE)) { sampleSize = result.getStatistics().getCounters().get(AggregationInstance.SAMPLE_SIZE); } else { for (final ShardedResultGroup g : groups) { sampleSize += g.getMetrics().getData().size(); } } return new QueryResultPart(groups, result.getErrors(), result.getTrace(), result.getLimits(), sampleSize); }; }

Target:
public static Transform<FullQuery, QueryResultPart> fromResultGroup( final ClusterShard shard ) { return result -> { final ImmutableList<ShardedResultGroup> groups = ImmutableList.copyOf(result .getGroups() .stream() .map(ResultGroup.toShardedResultGroup(shard)) .iterator()); final long preAggregationSampleSize = result .getStatistics() .getCounterValue(AggregationInstance.SAMPLE_SIZE) .orElseGet(() -> { long sum = 0; for (final ShardedResultGroup g : groups) { sum += g.getMetrics().getData().size(); } return sum; }); return new QueryResultPart(groups, result.getErrors(), result.getTrace(), result.getLimits(), preAggregationSampleSize); }; }
Source:
public int runEmpiOnAllTargetTypes(String theCriteria) { int submittedCount = 0; submittedCount += runEmpiOnPatientType(theCriteria); submittedCount += runEmpiOnPractitionerType(theCriteria); return submittedCount; }

Target:
public long runEmpiOnAllTargetTypes(String theCriteria) { long submittedCount = 0; submittedCount += runEmpiOnPatientType(theCriteria); submittedCount += runEmpiOnPractitionerType(theCriteria); return submittedCount; }
Source:
private void startCounterCache() { if (counterCacheStarted.compareAndSet(false, true)) { new Thread(() -> cacheManager.getCache(CounterModuleLifecycle.COUNTER_CACHE_NAME), threadName()).start(); } }

Target:
private void startCounterCache() { if (counterCacheStarted.compareAndSet(false, true)) { cacheManager.getGlobalComponentRegistry() .getComponent(Executor.class, KnownComponentNames.ASYNC_OPERATIONS_EXECUTOR) .execute(() -> { String oldName = Thread.currentThread().getName(); try { Thread.currentThread().setName(threadName()); cacheManager.getCache(CounterModuleLifecycle.COUNTER_CACHE_NAME); } finally { Thread.currentThread().setName(oldName); } }); } }
Source:
protected void executeCommand() { initPoolUser(); getParameters().setEntityInfo(new EntityInfo(VdcObjectType.VM, getVmId())); VdcReturnValueBase vdcReturnValue = attachUserToVm(); if (!vdcReturnValue.getSucceeded()) { log.info("Failed to give user '{}' permission to Vm '{}'", getAdUserId(), getVmId()); setActionReturnValue(vdcReturnValue); vmPoolHandler.releaseVm(getVmId(), !isVmPrestarted()); return; } else { log.info("Succeeded giving user '{}' permission to Vm '{}'", getAdUserId(), getVmId()); } if (!isVmPrestarted()) { vdcReturnValue = runVm(); setSucceeded(vdcReturnValue.getSucceeded()); getReturnValue().getVdsmTaskIdList().addAll(getReturnValue().getInternalVdsmTaskIdList()); } else { setSucceeded(true); } setActionReturnValue(getVmId()); }

Target:
protected void executeCommand() { initPoolUser(); VdcReturnValueBase vdcReturnValue = attachUserToVm(); if (!vdcReturnValue.getSucceeded()) { log.info("Failed to give user '{}' permission to Vm '{}'", getAdUserId(), getVmId()); setActionReturnValue(vdcReturnValue); return; } else { log.info("Succeeded giving user '{}' permission to Vm '{}'", getAdUserId(), getVmId()); } if (!isVmPrestarted()) { vdcReturnValue = runVm(); setSucceeded(vdcReturnValue.getSucceeded()); getReturnValue().getVdsmTaskIdList().addAll(getReturnValue().getInternalVdsmTaskIdList()); } else { setSucceeded(true); } setActionReturnValue(getVmId()); }
Source:
public FunInputAnchor() { this.curried = false; this.inputType = new Label(".....") { @Override public void relocate(double x, double y) { super.relocate(x, y); FunInputAnchor.this.dragShift(y); } }; this.inputType.setMinWidth(USE_PREF_SIZE); this.inputType.getStyleClass().add("inputType"); this.anchor = new InputAnchor(FunApplyBlock.this); this.anchor.layoutXProperty().bind(this.inputType.widthProperty().divide(2)); this.getChildren().addAll(this.anchor, this.inputType); dragContext = new DragContext(this.inputType); dragContext.setDragInitAction(c -> {this.curried = false;}); dragContext.setDragFinishAction(c -> { double height = this.inputType.getHeight(); this.curried = this.inputType.getLayoutY() > height; this.inputType.relocate(0, this.curried ? 2*height : 0); FunApplyBlock.this.initiateConnectionChanges(); }); }

Target:
public FunInputAnchor() { this.curried = false; this.inputType = new Label(".....") { @Override public void relocate(double x, double y) { super.relocate(x, y); FunInputAnchor.this.dragShift(y); } }; this.inputType.setMinWidth(USE_PREF_SIZE); this.inputType.getStyleClass().add("inputType"); this.anchor = new InputAnchor(FunApplyBlock.this); this.anchor.layoutXProperty().bind(this.inputType.widthProperty().divide(2)); this.getChildren().addAll(this.anchor, this.inputType); dragContext = new DragContext(this.inputType); dragContext.setDragInitAction(c -> {this.curried = false;}); dragContext.setDragFinishAction(c -> { double height = this.inputType.getHeight(); boolean mostlyDown = this.inputType.getLayoutY() > height; double newY = mostlyDown ? 2*height : 0; this.inputType.relocate(0, newY); this.curried = mostlyDown; FunApplyBlock.this.dragShiftOuput(newY - height); FunApplyBlock.this.initiateConnectionChanges(); }); }
Source:
public void invalidAntNameTest() { for (String invalidAntName : INVALID_ANT_NAMES) { inputFile = new String[] { "0000", "0000", "0a00", "0000" }; runs = new Run[] { new ErrorRun("create " + invalidAntName + ",1,1"), quit() }; sessionTest(runs, Input.getFile(inputFile)); inputFile = new String[] { "0000", "0000", "0a00", "0000" }; runs = new Run[] { new ErrorRun("direction " + invalidAntName), quit() }; sessionTest(runs, Input.getFile(inputFile)); inputFile = new String[] { "0000", "0000", "0a00", "0000" }; runs = new Run[] { new ErrorRun("escape " + invalidAntName), quit() }; sessionTest(runs, Input.getFile(inputFile)); inputFile = new String[] { "0000", "0000", "0a00", "0000" }; runs = new Run[] { new ErrorRun("position " + invalidAntName), quit() }; sessionTest(runs, Input.getFile(inputFile)); } }

Target:
public void invalidAntNameTest() { for (String invalidAntName : INVALID_ANT_NAMES) { inputFile = new String[] { "0000", "0000", "0a00", "0000" }; runs = new Run[] { new ErrorRun("create " + invalidAntName + ",1,1"), quit() }; sessionTest(runs, Input.getFile(inputFile)); runs = new Run[] { new ErrorRun("direction " + invalidAntName), quit() }; sessionTest(runs, Input.getFile(TASK_SHEET_INPUT_FILE_1)); runs = new Run[] { new ErrorRun("escape " + TASK_SHEET_INPUT_FILE_1), quit() }; sessionTest(runs, Input.getFile(inputFile)); runs = new Run[] { new ErrorRun("position " + invalidAntName), quit() }; sessionTest(runs, Input.getFile(TASK_SHEET_INPUT_FILE_1)); } }
Source:
public XStream getConfiguredXStream(XStream xs) { Class<AzureBlobStoreInfo> clazz = AzureBlobStoreInfo.class; xs.alias("AzureBlobStore", clazz); xs.registerLocalConverter(clazz, "maxConnections", EnvironmentStringConverter); xs.registerLocalConverter(clazz, "proxyPort", EnvironmentStringConverter); xs.registerLocalConverter(clazz, "useHTTPS", EnvironmentNullableBooleanConverter); xs.registerLocalConverter(clazz, "container", EnvironmentStringConverter); xs.registerLocalConverter(clazz, "accountName", EnvironmentStringConverter); xs.registerLocalConverter(clazz, "accountKey", EnvironmentStringConverter); xs.registerLocalConverter(clazz, "prefix", EnvironmentStringConverter); xs.registerLocalConverter(clazz, "proxyHost", EnvironmentStringConverter); xs.registerLocalConverter( BlobStoreInfo.class, "enabled", EnvironmentNullableBooleanConverter); xs.aliasField("id", clazz, "name"); return xs; }

Target:
public XStream getConfiguredXStream(XStream xs) { Class<AzureBlobStoreInfo> clazz = AzureBlobStoreInfo.class; xs.alias("AzureBlobStore", clazz); xs.aliasField("id", clazz, "name"); return xs; }
Source:
protected boolean probeForDirectoryListing(Repository repository, String path) { String filePath = path.replaceAll("/", Matcher.quoteReplacement(File.separator)); String dir = repository.getBasedir() + File.separator + filePath; File file = new File(dir); if ((repository.getLayout().equals(RepositoryLayoutEnum.MAVEN_2.getLayout()) && path.startsWith(".index")) || (!file.isHidden() && !path.startsWith(".") && !path.contains("/."))) { if (file.exists() && file.isDirectory()) { return true; } file = new File(dir + File.separator); return file.exists() && file.isDirectory(); } else { return false; } }

Target:
protected boolean probeForDirectoryListing(Repository repository, String path) { String filePath = path.replaceAll("/", Matcher.quoteReplacement(File.separator)); String dir = repository.getBasedir() + File.separator + filePath; File file = new File(dir); if (isPermittedForDirectoryListing(file, path)) { if (file.exists() && file.isDirectory()) { return true; } file = new File(dir + File.separator); return file.exists() && file.isDirectory(); } else { return false; } }