auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Block copyPositions(int[] positions, int offset, int length) { checkValidPositionsArray(positions, offset, length); int finalLength = stream(positions, offset, offset + length) .map(this::getSliceLength) .sum(); SliceOutput newSlice = Slices.allocate(finalLength).getOutput(); int[] newOffsets = new int[length + 1]; boolean[] newValueIsNull = new boolean[length]; for (int i = 0; i < length; i++) { int position = positions[offset + i]; if (isEntryNull(position)) { newValueIsNull[i] = true; } else { newSlice.appendBytes(slice.getBytes(getPositionOffset(position), getSliceLength(position))); } newOffsets[i + 1] = newSlice.size(); } return new VariableWidthBlock(length, newSlice.slice(), newOffsets, newValueIsNull); }

Target:
public Block copyPositions(int[] positions, int offset, int length) { checkArrayRange(positions, offset, length); int finalLength = stream(positions, offset, offset + length) .map(this::getSliceLength) .sum(); SliceOutput newSlice = Slices.allocate(finalLength).getOutput(); int[] newOffsets = new int[length + 1]; boolean[] newValueIsNull = new boolean[length]; for (int i = 0; i < length; i++) { int position = positions[offset + i]; if (isEntryNull(position)) { newValueIsNull[i] = true; } else { newSlice.appendBytes(slice.getBytes(getPositionOffset(position), getSliceLength(position))); } newOffsets[i + 1] = newSlice.size(); } return new VariableWidthBlock(length, newSlice.slice(), newOffsets, newValueIsNull); }
Source:
public static void onBlockBreak(PlayerInteractEvent.LeftClickBlock event) { if(!event.getEntity().world.isRemote && getData(event.getPlayer()) != null) { EditData data = getData(event.getPlayer()); if(!MinestuckConfig.gristRefund.get()) { GristHelper.notifyEditPlayer(event.getWorld().getServer(), data.connection.getClientIdentifier(), new GristSet(GristTypes.BUILD, 1), false); GristHelper.decrease(event.getWorld(), data.connection.getClientIdentifier(), new GristSet(GristTypes.BUILD,1)); } else { BlockState block = event.getWorld().getBlockState(event.getPos()); ItemStack stack = block.getBlock().getPickBlock(block, null, event.getWorld(), event.getPos(), event.getPlayer()); GristSet set = GristCostRecipe.findCostForItem(stack, null, false, event.getWorld()); if(set != null && !set.isEmpty()) GristHelper.increase(event.getWorld(), data.connection.getClientIdentifier(), set); GristHelper.notifyEditPlayer(event.getWorld().getServer(), data.connection.getClientIdentifier(), new GristSet(GristTypes.BUILD, 1), true); } } }

Target:
public static void onBlockBreak(PlayerInteractEvent.LeftClickBlock event) { if(!event.getEntity().world.isRemote && getData(event.getPlayer()) != null) { EditData data = getData(event.getPlayer()); if(!MinestuckConfig.gristRefund.get()) { GristHelper.decrease(event.getWorld(), data.connection.getClientIdentifier(), new GristSet(GristTypes.BUILD,1)); GristHelper.notifyEditPlayer(event.getWorld().getServer(), data.connection.getClientIdentifier(), new GristSet(GristTypes.BUILD, 1), false); } else { BlockState block = event.getWorld().getBlockState(event.getPos()); ItemStack stack = block.getBlock().getPickBlock(block, null, event.getWorld(), event.getPos(), event.getPlayer()); GristSet set = GristCostRecipe.findCostForItem(stack, null, false, event.getWorld()); if(set != null && !set.isEmpty()) GristHelper.increase(event.getWorld(), data.connection.getClientIdentifier(), set); GristHelper.notifyEditPlayer(event.getWorld().getServer(), data.connection.getClientIdentifier(), new GristSet(GristTypes.BUILD, 1), true); } } }
Source:
public void start(StartAction action) throws DebuggerException { try { for (Breakpoint breakpoint : action.getBreakpoints()) { Location location = breakpoint.getLocation(); library.setBreakpoint(location.getTarget(), location.getLineNumber()); debuggerCallback.onEvent(new BreakpointActivatedEventImpl(breakpoint)); pendingBreakpoints.add(location); } debuggerCallback.onEvent(new SuspendEventImpl(library.backtrace())); checkActivatedBreakpoints(); } catch (NodeJsDebuggerTerminatedException e) { disconnect(); throw e; } catch (NodeJsDebuggerException e) { throw new DebuggerException("Start error. " + e.getMessage(), e); } }

Target:
public void start(StartAction action) throws DebuggerException { try { for (Breakpoint breakpoint : action.getBreakpoints()) { Location location = breakpoint.getLocation(); library.setBreakpoint(location.getTarget(), location.getLineNumber()); debuggerCallback.onEvent(new BreakpointActivatedEventImpl(breakpoint)); } debuggerCallback.onEvent(new SuspendEventImpl(library.backtrace())); } catch (NodeJsDebuggerTerminatedException e) { disconnect(); throw e; } catch (NodeJsDebuggerException e) { throw new DebuggerException("Start error. " + e.getMessage(), e); } }
Source:
public void setupOpticalDuplicateFinder() { this.opticalDuplicateFinder = new OpticalDuplicateFinder(READ_NAME_REGEX, OPTICAL_DUPLICATE_PIXEL_DISTANCE, LOG); opticalDuplicateFinder.setMaxDuplicateSetSize(MAX_OPTICAL_DUPLICATE_SET_SIZE); }

Target:
public void setupOpticalDuplicateFinder() { this.opticalDuplicateFinder = new OpticalDuplicateFinder(READ_NAME_REGEX, OPTICAL_DUPLICATE_PIXEL_DISTANCE, MAX_OPTICAL_DUPLICATE_SET_SIZE, LOG); }
Source:
private void visitClass( PersistenceUnitModel persistenceUnit, NodeList nodes ) { List<PersistableDataObject> persistableDataObjectList = new ArrayList<PersistableDataObject>(); parseSimpleTextElementList(nodes).forEach(node -> { persistableDataObjectList.add(new PersistableDataObject(node)); }); persistenceUnit.setClasses(persistableDataObjectList); }

Target:
private void visitClass(PersistenceUnitModel persistenceUnit, NodeList nodes) { persistenceUnit.setClasses(parseSimpleTextElementList(nodes).stream().map(p -> new PersistableDataObject(p)).collect(Collectors.toList())); }
Source:
public Map<String, Ref> filter(Map<String, Ref> refs) { final Set<Change.Id> visibleChanges = visibleChanges(); final Map<String, Ref> result = new HashMap<String, Ref>(); final List<Ref> deferredTags = new ArrayList<Ref>(); for (Ref ref : refs.values()) { if (PatchSet.isRef(ref.getName())) { if (visibleChanges.contains(Change.Id.fromRef(ref.getName()))) { result.put(ref.getName(), ref); } } else if (isTag(ref)) { deferredTags.add(ref); } else if (projectCtl.controlForRef(ref.getLeaf().getName()).isVisible()) { result.put(ref.getName(), ref); } } if (!deferredTags.isEmpty() && !result.isEmpty()) { Map<Ref, List<Ref>> reachableTags = tagCache.get(db); for (Ref tag : reachableTags.keySet()) { for (Ref ref : reachableTags.get(tag)) { if (projectCtl.controlForRef(ref.getName()).isVisible()) { result.put(tag.getName(), tag); break; } } } } return result; }

Target:
public Map<String, Ref> filter(Map<String, Ref> refs) { try { return doFilter(refs); } finally { if (rw != null) { rw.release(); rw = null; } } }
Source:
protected void onHandleIntent(Intent intent) { try { boolean unkownIntentContent = true; ArrayList<String> eventsExtras = intent.getExtras().getStringArrayList(EXTRA_EVENTS); if (eventsExtras != null) { unkownIntentContent = false; handleSendEvents(eventsExtras); } if (unkownIntentContent) { SwrveLogger.e(LOG_TAG, "SwrveWakefulService: Unknown intent received."); } } catch (Exception ex) { SwrveLogger.e(LOG_TAG, "SwrveWakefulService exception:", ex); } finally { SwrveWakefulReceiver.completeWakefulIntent(intent); } }

Target:
protected void onHandleIntent(Intent intent) { try { ArrayList<String> eventsExtras = intent.getExtras().getStringArrayList(EXTRA_EVENTS); if (eventsExtras != null && eventsExtras.size() > 0) { handleSendEvents(eventsExtras); } else { SwrveLogger.e(LOG_TAG, "SwrveWakefulService: Unknown intent received."); } } catch (Exception ex) { SwrveLogger.e(LOG_TAG, "SwrveWakefulService exception:", ex); } finally { SwrveWakefulReceiver.completeWakefulIntent(intent); } }
Source:
private static boolean isPositionBefore(final ContentPosition position, final Box box) { return position.getOffset() < box.getStartOffset(); }

Target:
private static boolean isPositionBefore(final ContentPosition position, final Box box) { return position.isBefore(new ContentPosition(box.getNode(), box.getStartOffset())); }
Source:
public void testNonOwnerConnectionClosed_whenHeartbeatStopped() throws InterruptedException { hazelcastFactory.newHazelcastInstance(); HazelcastInstance client = hazelcastFactory.newHazelcastClient(getClientConfig()); HazelcastInstance instance = hazelcastFactory.newHazelcastInstance(); HazelcastClientInstanceImpl clientImpl = getHazelcastClientInstanceImpl(client); final ClientConnectionManager connectionManager = clientImpl.getConnectionManager(); assertTrueEventually(new AssertTask() { @Override public void run() throws Exception { assertEquals(2, connectionManager.getActiveConnections().size()); } }); final CountDownLatch countDownLatch = new CountDownLatch(1); connectionManager.addConnectionListener(new ConnectionListener() { @Override public void connectionAdded(Connection connection) { } @Override public void connectionRemoved(Connection connection) { countDownLatch.countDown(); } }); blockMessagesFromInstance(instance, client); assertOpenEventually(countDownLatch); }

Target:
public void testNonOwnerConnectionClosed_whenHeartbeatStopped() { hazelcastFactory.newHazelcastInstance(); final HazelcastInstance client = hazelcastFactory.newHazelcastClient(getClientConfig()); HazelcastInstance instance = hazelcastFactory.newHazelcastInstance(); HazelcastClientInstanceImpl clientImpl = getHazelcastClientInstanceImpl(client); final ClientConnectionManager connectionManager = clientImpl.getConnectionManager(); assertTrueEventually(new AssertTask() { @Override public void run() throws Exception { assertEquals(2, connectionManager.getActiveConnections().size()); } }); final CountDownLatch countDownLatch = new CountDownLatch(1); connectionManager.addConnectionListener(new ConnectionListener() { @Override public void connectionAdded(Connection connection) { } @Override public void connectionRemoved(Connection connection) { ClientConnection clientConnection = (ClientConnection) connection; if (!clientConnection.isAuthenticatedAsOwner()) { countDownLatch.countDown(); } } }); blockMessagesFromInstance(instance, client); assertOpenEventually(countDownLatch); }
Source:
public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) { if (adapterType.equals(ICSourceNotFoundDescription.class) && adaptableObject instanceof IFrameDMContext) { final IFrameDMContext frameDMC = (IFrameDMContext) adaptableObject; return (T) new ICSourceNotFoundDescription() { @Override public String getDescription() { ICSourceNotFoundDescription frameDescription = createQuery(); if(frameDescription != null) return frameDescription.getDescription(); return frameDMC.toString(); } @Override public boolean isAddress() { ICSourceNotFoundDescription frameDescription = createQuery(); if(frameDescription != null) return frameDescription.isAddress(); return false; } private ICSourceNotFoundDescription createQuery() { Query<IStack.IFrameDMData> query = new Query<IStack.IFrameDMData>() { @Override protected void execute(DataRequestMonitor<IStack.IFrameDMData> rm) { DsfServicesTracker tracker = new DsfServicesTracker(DsfUIPlugin.getBundleContext(), frameDMC.getSessionId()); IStack stack = tracker.getService(IStack.class); if (stack != null) { stack.getFrameData(frameDMC, rm); } else { rm.setData(null); rm.done(); } tracker.dispose(); } }; DsfSession session = DsfSession.getSession(frameDMC.getSessionId()); if (session != null && session.getExecutor() != null) { session.getExecutor().execute(query); try { IFrameDMData dmData = query.get(); return getFrameDescription(dmData); } catch (Exception e) { return null; } } return null; } }; } return null; }

Target:
public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) { if (adapterType.equals(ICSourceNotFoundDescription.class) && adaptableObject instanceof IFrameDMContext) { final IFrameDMContext frameDMC = (IFrameDMContext) adaptableObject; return (T) new ICSourceNotFoundDescription() { @Override public String getDescription() { return createQuery().getDescription(); } @Override public boolean isAddressOnly() { return createQuery().isAddressOnly(); } private ICSourceNotFoundDescription createQuery() { Query<IStack.IFrameDMData> query = new Query<IStack.IFrameDMData>() { @Override protected void execute(DataRequestMonitor<IStack.IFrameDMData> rm) { DsfServicesTracker tracker = new DsfServicesTracker(DsfUIPlugin.getBundleContext(), frameDMC.getSessionId()); IStack stack = tracker.getService(IStack.class); if (stack != null) { stack.getFrameData(frameDMC, rm); } else { rm.setData(null); rm.done(); } tracker.dispose(); } }; DsfSession session = DsfSession.getSession(frameDMC.getSessionId()); if (session != null && session.getExecutor() != null) { session.getExecutor().execute(query); try { IFrameDMData dmData = query.get(); return getFrameDescription(dmData); } catch (Exception e) { } } return new ICSourceNotFoundDescription() { @Override public String getDescription() { return frameDMC.toString(); } }; } }; } return null; }
Source:
public void shutdown() { if (config.getTelemetryConfig().isTelemetryEnabled()) { Optional<Metric> optional = metrics.getMetric(BlockDestroyedMetric.class); if (optional.isPresent()) { Metric blockDestroyedMetric = optional.get(); Unstructured unstructuredBlockDestroyed = blockDestroyedMetric.getUnstructuredMetric(); TelemetryUtils.trackMetric(emitter, trackerNamespace, unstructuredBlockDestroyed, blockDestroyedMetric, bindingMap); } optional = metrics.getMetric(BlockPlacedMetric.class); if (optional.isPresent()) { Metric blockPlacedMetric = optional.get(); Unstructured unstructuredBlockPlaced = blockPlacedMetric.getUnstructuredMetric(); TelemetryUtils.trackMetric(emitter, trackerNamespace, unstructuredBlockPlaced, blockPlacedMetric, bindingMap); } optional = metrics.getMetric(GameConfigurationMetric.class); if (optional.isPresent()) { Metric gameConfigurationMetric = optional.get(); Unstructured unstructuredGameConfiguration = gameConfigurationMetric.getUnstructuredMetric(); TelemetryUtils.trackMetric(emitter, trackerNamespace, unstructuredGameConfiguration, gameConfigurationMetric, bindingMap); } optional = metrics.getMetric(GamePlayMetric.class); if (optional.isPresent()) { Metric gamePlayMetric = optional.get(); Unstructured unstructuredGamePlay = gamePlayMetric.getUnstructuredMetric(); TelemetryUtils.trackMetric(emitter, trackerNamespace, unstructuredGamePlay, gamePlayMetric, bindingMap); } optional = metrics.getMetric(MonsterKilledMetric.class); if (optional.isPresent()) { Metric monsterKilledMetric = optional.get(); Unstructured unstructuredMonsterKilled = monsterKilledMetric.getUnstructuredMetric(); TelemetryUtils.trackMetric(emitter, trackerNamespace, unstructuredMonsterKilled, monsterKilledMetric, bindingMap); } } }

Target:
public void shutdown() { if (config.getTelemetryConfig().isTelemetryEnabled()) { TelemetryUtils.fetchMetricAndSend(metrics, BlockPlacedMetric.class, emitter, trackerNamespace, bindingMap); TelemetryUtils.fetchMetricAndSend(metrics, BlockDestroyedMetric.class, emitter, trackerNamespace, bindingMap); TelemetryUtils.fetchMetricAndSend(metrics, GameConfigurationMetric.class, emitter, trackerNamespace, bindingMap); TelemetryUtils.fetchMetricAndSend(metrics, MonsterKilledMetric.class, emitter, trackerNamespace, bindingMap); TelemetryUtils.fetchMetricAndSend(metrics, GamePlayMetric.class, emitter, trackerNamespace, bindingMap); } }
Source:
private String getUnsatisfiedDependenciesAdditionalInfo(InjectionPoint ij, BeanManagerImpl beanManager) { Set<Bean<?>> beansMatchedByType = beanManager.getBeans(ij.getType()); if (beansMatchedByType.isEmpty()) { Class<?> rawType = Reflections.getRawType(ij.getType()); if (rawType != null) { String missingDependency = beanManager.getMissingDependencyForClass(rawType.getName()); if (missingDependency != null) { return loggerFactory().getMessageConveyor().getMessage( UNSATISFIED_DEPENDENCY_BECAUSE_CLASS_IGNORED, rawType.getName(), missingDependency); } } } else { return loggerFactory().getMessageConveyor().getMessage( UNSATISFIED_DEPENDENCY_BECAUSE_QUALIFIERS_DONT_MATCH, WeldCollections.toMultiRowString(beansMatchedByType)); } return ""; }

Target:
private String getUnsatisfiedDependenciesAdditionalInfo(InjectionPoint ij, BeanManagerImpl beanManager) { Set<Bean<?>> beansMatchedByType = beanManager.getBeans(ij.getType(), AnyLiteral.INSTANCE); if (beansMatchedByType.isEmpty()) { Class<?> rawType = Reflections.getRawType(ij.getType()); if (rawType != null) { MissingDependenciesRegistry missingDependenciesRegistry = beanManager.getServices().get(MissingDependenciesRegistry.class); String missingDependency = missingDependenciesRegistry.getMissingDependencyForClass(rawType.getName()); if (missingDependency != null) { return loggerFactory().getMessageConveyor().getMessage( UNSATISFIED_DEPENDENCY_BECAUSE_CLASS_IGNORED, rawType.getName(), missingDependency); } } } else { return loggerFactory().getMessageConveyor().getMessage( UNSATISFIED_DEPENDENCY_BECAUSE_QUALIFIERS_DONT_MATCH, WeldCollections.toMultiRowString(beansMatchedByType)); } return ""; }
Source:
void register() { register(repliedAddress, true, Promise.promise()); }

Target:
void register() { register(repliedAddress, true, null); }
Source:
public TripScheduleImpl ( TripTimes originalTripTimes, TripPattern originalTripPattern, int[] arrivals, int[] departures, int timeShift ) { final int numStops = originalTripTimes.getNumStops(); if (originalTripPattern.getStops().size() != numStops) { LOG.error("TripPattern is not the same size as the TripTimes. This indicates a bug."); } if (arrivals.length != numStops) { LOG.error("Arrivals arrays is not the same size as the TripTimes. This indicates a bug."); } if (departures.length != numStops) { LOG.error("Departures arrays is not the same size as the TripTimes. This indicates a bug."); } this.originalTripTimes = originalTripTimes; this.originalTripPattern = originalTripPattern; this.arrivals = arrivals; this.departures = departures; this.timeShift = timeShift; }

Target:
public TripScheduleImpl ( TripTimes originalTripTimes, TripPattern originalTripPattern, int[] arrivals, int[] departures, int timeShift ) { final int numStops = originalTripTimes.getNumStops(); if (originalTripPattern.getStops().size() != numStops) { throw new IllegalStateException( "TripPattern is not the same size as the TripTimes. This indicates a bug." ); } if (arrivals.length != numStops) { throw new IllegalStateException( "Arrivals arrays is not the same size as the TripTimes. This indicates a bug." ); } if (departures.length != numStops) { throw new IllegalStateException( "Departures arrays is not the same size as the TripTimes. This indicates a bug." ); } this.originalTripTimes = originalTripTimes; this.originalTripPattern = originalTripPattern; this.arrivals = arrivals; this.departures = departures; this.timeShift = timeShift; }
Source:
public PatientData<Integer> readJSON(JSONObject json) { if (json == null || json.length() == 0) { return null; } JSONObject data = json.optJSONObject(getJsonPropertyName()); if (data == null || data.length() == 0) { return null; } Map<String, Integer> result = new LinkedHashMap<>(); for (String property : getProperties()) { if (data.has(property)) { int age = data.getInt(property); if (age == 0) { result.put(property, null); } else { result.put(property, age); } } } return new DictionaryPatientData<>(getName(), result); }

Target:
public PatientData<Integer> readJSON(JSONObject json) { if (json == null || json.length() == 0) { return null; } JSONObject data = json.optJSONObject(getJsonPropertyName()); if (data == null || data.length() == 0) { return null; } Map<String, Integer> result = new LinkedHashMap<>(); for (String property : getProperties()) { if (data.has(property)) { int age = data.optInt(property); if (age == 0) { result.put(property, null); } else { result.put(property, age); } } } return new DictionaryPatientData<>(getName(), result); }
Source:
public void startUp(IngestJobContext context) throws IngestModuleException { this.context = context; Extract registry = null; try { registry = new ExtractRegistry(); } catch (FileNotFoundException ex) { Exceptions.printStackTrace(ex); } Extract iexplore = new ExtractIE(); Extract recentDocuments = new RecentDocumentsByLnk(); Extract chrome = new Chrome(); Extract firefox = new Firefox(); Extract SEUQA = new SearchEngineURLQueryAnalyzer(); extracters.add(chrome); extracters.add(firefox); extracters.add(iexplore); extracters.add(recentDocuments); extracters.add(SEUQA); extracters.add(registry); browserExtracters.add(chrome); browserExtracters.add(firefox); browserExtracters.add(iexplore); for (Extract extracter : extracters) { extracter.init(); } }

Target:
public void startUp(IngestJobContext context) throws IngestModuleException { this.context = context; Extract registry = new ExtractRegistry(); Extract iexplore = new ExtractIE(); Extract recentDocuments = new RecentDocumentsByLnk(); Extract chrome = new Chrome(); Extract firefox = new Firefox(); Extract SEUQA = new SearchEngineURLQueryAnalyzer(); extracters.add(chrome); extracters.add(firefox); extracters.add(iexplore); extracters.add(recentDocuments); extracters.add(SEUQA); extracters.add(registry); browserExtracters.add(chrome); browserExtracters.add(firefox); browserExtracters.add(iexplore); for (Extract extracter : extracters) { extracter.init(); } }
Source:
public TestNGCucumberRunner(Class clazz) { this.clazz = clazz; classLoader = clazz.getClassLoader(); resourceLoader = new MultiLoader(classLoader); RuntimeOptionsFactory runtimeOptionsFactory = new RuntimeOptionsFactory(clazz, new Class[]{CucumberOptions.class}); runtimeOptions = runtimeOptionsFactory.create(); List<String> uniqueGlue = new ArrayList<String>(new HashSet<String>(runtimeOptions.getGlue())); runtimeOptions.getGlue().clear(); runtimeOptions.getGlue().addAll(uniqueGlue); reporter = new TestNgReporter(System.out); runtimeOptions.getFormatters().add(reporter); classFinder = new ResourceLoaderClassFinder(resourceLoader, classLoader); }

Target:
public TestNGCucumberRunner(Class clazz) { classLoader = clazz.getClassLoader(); resourceLoader = new MultiLoader(classLoader); RuntimeOptionsFactory runtimeOptionsFactory = new RuntimeOptionsFactory(clazz, new Class[]{CucumberOptions.class}); runtimeOptions = runtimeOptionsFactory.create(); List<String> uniqueGlue = new ArrayList<String>(new HashSet<String>(runtimeOptions.getGlue())); runtimeOptions.getGlue().clear(); runtimeOptions.getGlue().addAll(uniqueGlue); TestNgReporter reporter = new TestNgReporter(System.out); runtimeOptions.getFormatters().add(reporter); classFinder = new ResourceLoaderClassFinder(resourceLoader, classLoader); }
Source:
public ValidationResult isOperationAllowedOnDisk(VdcActionType actionType) { List<DiskContentType> allowedTypes = allowedCommandsOnTypes.get(actionType); if (allowedTypes == null) { throw new IllegalArgumentException( String.format("Cannot validate operation on disk for action of type %s as it is not included in the allowed commands.", actionType)); } if (!allowedTypes.contains(disk.getContentType())) { return new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_DISK_CONTENT_TYPE_NOT_SUPPORTED_FOR_OPERATION, String.format("$diskContentType %s", disk.getContentType())); } return ValidationResult.VALID; }

Target:
public ValidationResult isOperationAllowedOnDisk(VdcActionType actionType) { List<DiskContentType> allowedTypes = allowedCommandsOnTypes.get(actionType); if (allowedTypes == null) { throw new IllegalArgumentException( String.format("Cannot validate operation on disk for action of type %s as it is not an allowed commands for the disk content type.", actionType)); } if (!allowedTypes.contains(disk.getContentType())) { return new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_DISK_CONTENT_TYPE_NOT_SUPPORTED_FOR_OPERATION, String.format("$diskContentType %s", disk.getContentType())); } return ValidationResult.VALID; }
Source:
public void verifySemanticException(QualifierType type, String invalidInput) { TurboIssue issue = new TurboIssue(REPO, 1, ""); thrown.expect(SemanticException.class); thrown.expectMessage(String.format(SemanticException.ERR_MSG, type, type.getValidInputs())); matches(invalidInput, issue); }

Target:
public void verifySemanticException(QualifierType type, String invalidInput) { TurboIssue issue = new TurboIssue(REPO, 1, ""); thrown.expect(SemanticException.class); thrown.expectMessage( String.format(SemanticException.ERROR_MESSAGE, type, type.getDescriptionOfValidInputs())); matches(invalidInput, issue); }
Source:
public void init(Map<String, String> options) { storeName = options.getOrDefault(STORE_NAME_OPTION, DEFAULT_STORE_NAME); thresholdSize = parseIntOrDefault(options.get(THRESHOLD_SIZE_OPTION), DEFAULT_THRESHOLD_SIZE); storeTTLSeconds = parseIntOrDefault(options.get(STORE_TTL_OPTION), DEFAULT_STORE_TTL); }

Target:
public void init(Map<String, String> options) { storeName = options.getOrDefault(STORE_NAME_OPTION, DEFAULT_STORE_NAME); thresholdSize = parseIntOrDefault(options.get(THRESHOLD_SIZE_OPTION), DEFAULT_THRESHOLD_SIZE); storeTTL = DurationUtils.parse(options.getOrDefault(STORE_TTL_OPTION, DEFAULT_STORE_TTL)); }
Source:
public void printStackTrace(PrintStream err) { super.printStackTrace(err); int currentIndex = -1; for (Throwable throwable : innerThrowables) { err.append("\n"); err.append(" Inner throwable "); err.append(Integer.toString(++currentIndex)); err.append(") "); throwable.printStackTrace(err); err.append("\n"); } }

Target:
public void printStackTrace(PrintStream err) { super.printStackTrace(err); int currentIndex = -1; for (Throwable throwable : innerThrowables) { err.append("\n"); err.append(" Inner throwable #"); err.append(Integer.toString(++currentIndex)); err.append(": "); throwable.printStackTrace(err); err.append("\n"); } }
Source:
public void testDelimiterList() throws InterruptedException { final String containerName = getScratchContainerName(); BlobStore blobStore = view.getBlobStore(); String payload = "foo"; try { createContainer(containerName, defaultLocation); blobStore.putBlob(containerName, blobStore.blobBuilder("test/foo/foo").payload(payload).build()); blobStore.putBlob(containerName, blobStore.blobBuilder("test/bar/foo").payload(payload).build()); blobStore.putBlob(containerName, blobStore.blobBuilder("foo").payload(payload).build()); checkListedSet(ImmutableSet.of("foo", "test"), blobStore.list( containerName, ListContainerOptions.Builder.delimiter('/'))); checkListedSet(ImmutableSet.of("test/foo/foo", "test/bar/foo", "foo"), blobStore.list( containerName, ListContainerOptions.Builder.delimiter('\\'))); checkListedSet(ImmutableSet.of("test/foo", "test/bar"), blobStore.list( containerName, ListContainerOptions.Builder.delimiter('/').inDirectory("test"))); checkListedSet(ImmutableSet.of("test/bar/foo"), blobStore.list( containerName, ListContainerOptions.Builder.delimiter('/').inDirectory("test/bar"))); } finally { recycleContainerAndAddToPool(containerName); } }

Target:
public void testDelimiterList() throws InterruptedException { final String containerName = getContainerName(); BlobStore blobStore = view.getBlobStore(); String payload = "foo"; try { blobStore.putBlob(containerName, blobStore.blobBuilder("test/foo/foo").payload(payload).build()); blobStore.putBlob(containerName, blobStore.blobBuilder("test/bar/foo").payload(payload).build()); blobStore.putBlob(containerName, blobStore.blobBuilder("foo").payload(payload).build()); blobStore.putBlob(containerName, blobStore.blobBuilder("test-foo").payload(payload).build()); blobStore.putBlob(containerName, blobStore.blobBuilder("test-bar").payload(payload).build()); checkEqualNames(ImmutableSet.of("foo", "test/", "test-foo", "test-bar"), blobStore.list( containerName, ListContainerOptions.Builder.delimiter("/"))); checkEqualNames(ImmutableSet.of("test/foo/foo", "test/bar/foo", "foo", "test-foo", "test-bar"), blobStore.list(containerName, ListContainerOptions.Builder.delimiter("\\"))); checkEqualNames(ImmutableSet.of("test-", "test/foo/foo", "test/bar/foo", "foo"), blobStore.list( containerName, ListContainerOptions.Builder.delimiter("-"))); } finally { returnContainer(containerName); } }
Source:
public ConceptV5 getByIdWithLicenseCheck(Long id) { ConceptV5 conceptV5 = conceptRepository.findOne(id); if (!checkLicense(conceptV5)) { throw new PermissionDeniedException(); } return conceptV5; }

Target:
public ConceptV5 getByIdWithLicenseCheck(Long id) { return conceptRepository.findOne(id); }
Source:
public void testRenameType() throws Exception { String xsltTemplate = ResourceUtils.create(XsltTransformerTest.class).getResourceAsString("classpath://brooklyn/entity/rebind/transformer/renameType.xslt"); String xslt = TemplateProcessor.processTemplateContents(xsltTemplate, ImmutableMap.of("old_val", "mytype.Before", "new_val", "mytype.After")); String input = "<entity myattrib=\"myval\">"+NL+ " <type myattrib2=\"myval2\">mytype.Before</type>"+NL+ " <nested>"+NL+ " <type myattrib3=\"myval3\">doesNotMatch</type>"+NL+ " <type myattrib4=\"myval4\">partial.mytype.Before</type>"+NL+ " <type myattrib5=\"myval5\">mytype.Before</type>"+NL+ " </nested>"+NL+ " <id>myid</id>"+NL+ "</entity>"; String expected = "<entity myattrib=\"myval\">"+NL+ " <type myattrib2=\"myval2\">mytype.After</type>"+NL+ " <nested>"+NL+ " <type myattrib3=\"myval3\">doesNotMatch</type>"+NL+ " <type myattrib4=\"myval4\">partial.mytype.Before</type>"+NL+ " <type myattrib5=\"myval5\">mytype.After</type>"+NL+ " </nested>"+NL+ " <id>myid</id>"+NL+ "</entity>"; XsltTransformer transformer = new XsltTransformer(xslt); String result = transformer.transform(input); assertEquals(result, expected); }

Target:
public void testRenameType() throws Exception { String xsltTemplate = ResourceUtils.create(XsltTransformerTest.class).getResourceAsString("classpath://brooklyn/entity/rebind/transformer/renameType.xslt"); String xslt = TemplateProcessor.processTemplateContents(xsltTemplate, ImmutableMap.of("old_val", "mytype.Before", "new_val", "mytype.After")); String input = "<entity myattrib=\"myval\">"+NEWLINE+ " <type myattrib2=\"myval2\">mytype.Before</type>"+NEWLINE+ " <nested>"+NEWLINE+ " <type myattrib3=\"myval3\">doesNotMatch</type>"+NEWLINE+ " <type myattrib4=\"myval4\">partial.mytype.Before</type>"+NEWLINE+ " <type myattrib5=\"myval5\">mytype.Before</type>"+NEWLINE+ " </nested>"+NEWLINE+ " <id>myid</id>"+NEWLINE+ "</entity>"; String expected = "<entity myattrib=\"myval\">"+NEWLINE+ " <type myattrib2=\"myval2\">mytype.After</type>"+NEWLINE+ " <nested>"+NEWLINE+ " <type myattrib3=\"myval3\">doesNotMatch</type>"+NEWLINE+ " <type myattrib4=\"myval4\">partial.mytype.Before</type>"+NEWLINE+ " <type myattrib5=\"myval5\">mytype.After</type>"+NEWLINE+ " </nested>"+NEWLINE+ " <id>myid</id>"+NEWLINE+ "</entity>"; XsltTransformer transformer = new XsltTransformer(xslt); String result = transformer.transform(input); assertEquals(result, expected); }
Source:
public <E> Optional<E> getOptional(String key, TypeReference<E> type) { return (Optional<E>) Optional.fromNullable(get(key, mapper.getTypeFactory().constructType(type), null)); }

Target:
public <E> Optional<E> getOptional(String key, TypeReference<E> type) { return (Optional<E>) get(key, mapper.getTypeFactory().constructType(type), Optional.<E>absent()); }
Source:
private boolean isFullyFetched() { return currentPage.hasMorePages(); }

Target:
private boolean isFullyFetched() { return !currentPage.hasMorePages(); }
Source:
public void testConvertToDataModelTypeWithFiles() { variant.addSourceEntry(variantSourceEntry); BasicDBObject mongoFile = new BasicDBObject(DBObjectToVariantSourceEntryConverter.FILEID_FIELD, variantSourceEntry.getFileId()) .append(DBObjectToVariantSourceEntryConverter.STUDYID_FIELD, variantSourceEntry.getStudyId()); mongoFile.append(DBObjectToVariantSourceEntryConverter.ATTRIBUTES_FIELD, new BasicDBObject("QUAL", "0.01").append("AN", "2")); mongoFile.append(DBObjectToVariantSourceEntryConverter.FORMAT_FIELD, variantSourceEntry.getFormat()); BasicDBObject genotypeCodes = new BasicDBObject(); genotypeCodes.append("def", "0/0"); genotypeCodes.append("0/1", Arrays.asList(1)); mongoFile.append(DBObjectToVariantSourceEntryConverter.SAMPLES_FIELD, genotypeCodes); BasicDBList files = new BasicDBList(); files.add(mongoFile); mongoVariant.append("files", files); List<String> sampleNames = Lists.newArrayList("NA001", "NA002"); uk.ac.ebi.eva.commons.models.converters.data.DBObjectToVariantConverter converter = new uk.ac.ebi.eva.commons.models.converters.data.DBObjectToVariantConverter( new DBObjectToVariantSourceEntryConverter( VariantStorageManager.IncludeSrc.FULL, new DBObjectToSamplesConverter(sampleNames)), new DBObjectToVariantStatsConverter()); Variant converted = converter.convert(mongoVariant); assertEquals(variant, converted); }

Target:
public void testConvertToDataModelTypeWithFiles() { variant.addSourceEntry(variantSourceEntry); BasicDBObject mongoFile = new BasicDBObject(DBObjectToVariantSourceEntryConverter.FILEID_FIELD, variantSourceEntry.getFileId()) .append(DBObjectToVariantSourceEntryConverter.STUDYID_FIELD, variantSourceEntry.getStudyId()); mongoFile.append(DBObjectToVariantSourceEntryConverter.ATTRIBUTES_FIELD, new BasicDBObject("QUAL", "0.01").append("AN", "2")); mongoFile.append(DBObjectToVariantSourceEntryConverter.FORMAT_FIELD, variantSourceEntry.getFormat()); BasicDBObject genotypeCodes = new BasicDBObject(); genotypeCodes.append("def", "0/0"); genotypeCodes.append("0/1", Arrays.asList(1)); mongoFile.append(DBObjectToVariantSourceEntryConverter.SAMPLES_FIELD, genotypeCodes); BasicDBList files = new BasicDBList(); files.add(mongoFile); mongoVariant.append("files", files); List<String> sampleNames = new ArrayList<String>(); sampleNames.add("NA001"); sampleNames.add("NA002"); DBObjectToVariantConverter converter = new DBObjectToVariantConverter( new DBObjectToVariantSourceEntryConverter( new DBObjectToSamplesConverter(sampleNames)), new DBObjectToVariantStatsConverter()); Variant converted = converter.convert(mongoVariant); assertEquals(variant, converted); }
Source:
public static History getRevisions(File file, String rev) throws IOException { ArrayList<String> cmd = new ArrayList<String>(); cmd.add("p4"); cmd.add("filelog"); cmd.add("-lti"); cmd.add(PerforceRepository.protectPerforceFilename(file.getName()) + PerforceRepository.getRevisionCmd(rev)); Executor executor = new Executor(cmd, file.getCanonicalFile().getParentFile()); executor.exec(); return parseFileLog(executor.getOutputReader()); }

Target:
public static History getRevisions(File file, String rev) throws IOException { ArrayList<String> cmd = new ArrayList<String>(); cmd.add("p4"); cmd.add("filelog"); cmd.add("-lti"); cmd.add(protectPerforceFilename(file.getName()) + PerforceRepository.getRevisionCmd(rev)); Executor executor = new Executor(cmd, file.getCanonicalFile().getParentFile()); executor.exec(); return parseFileLog(executor.getOutputReader()); }
Source:
public LogItemViewHolder(View rootView) { this.rootView = rootView; ButterKnife.inject(this, rootView); rootView.setTag(this); }

Target:
public LogItemViewHolder(View rootView) { this.rootView = rootView; ButterKnife.inject(this, rootView); }
Source:
private static void setActivator(Activator a) { plugin = a; pluginId = a.getBundle().getSymbolicName(); }

Target:
private static void setActivator(Activator a) { plugin = a; }
Source:
public static User create(UUID uuid, String name) { Validate.notNull(uuid, "uuid can't be null!"); Validate.notNull(name, "name can't be null!"); Validate.notBlank(name, "name can't be blank!"); Validate.isTrue(FunnyGuilds.USERNAME_PATTERN.matcher(name).matches(), "name is not valid!"); User user = new User(uuid, name); UserUtils.addUser(user); RankManager.getInstance().update(user); return user; }

Target:
public static User create(UUID uuid, String name) { Validate.notNull(uuid, "uuid can't be null!"); Validate.notNull(name, "name can't be null!"); Validate.notBlank(name, "name can't be blank!"); Validate.isTrue(UserUtils.validateUsername(name), "name is not valid!"); User user = new User(uuid, name); UserUtils.addUser(user); RankManager.getInstance().update(user); return user; }
Source:
public boolean start() throws IOException { connection = new BigtableConnection(config.toHBaseConfig()); table = connection.getTable(TableName.valueOf(config.getTable())); scanner = table.getScanner(scan); return advance(); }

Target:
public boolean start() throws IOException { connection = new BigtableConnection(config.toHBaseConfig()); table = connection.getTable(TableName.valueOf(config.getTableId())); scanner = table.getScanner(scan); return advance(); }
Source:
public synchronized void write(char[] cbuf, int off, int len) throws IOException { if (closed) throw new IOException("stream is already closed"); _write(cbuf, off, len); }

Target:
public void write(char[] cbuf, int off, int len) throws IOException { if (closeCause != null) { throw new IOException("stream is already closed"); } _write(cbuf, off, len); }
Source:
protected void Perform() { if (getVm().getstatus() == VMStatus.Up) { executeVdscommand(); } setSucceeded(true); }

Target:
protected void Perform() { if (getVm().getstatus() == VMStatus.Up) { runVdsCommand(getParameters().getAction().getCommandType(), new HotPlugUnplgNicVDSParameters(getVm().getrun_on_vds().getValue(), getVm().getId(), DbFacade.getInstance().getVmNetworkInterfaceDAO().get(getParameters().getNicId()), vmDevice)); } TransactionSupport.executeInNewTransaction(updateDevice()); setSucceeded(true); }
Source:
public void testAttributeMapping() { Map<String, List<String>> attributeMap = plugin.getAttributeMap(); assertThat(attributeMap.containsKey("invalid-state"), is(true)); assertThat(attributeMap.get("invalid-state").size(), is(2)); assertThat(attributeMap.get("invalid-state").contains("datamanager"), is(true)); assertThat(attributeMap.get("invalid-state").contains("admin"), is(true)); }

Target:
public void testAttributeMapping() { Map<String, List<String>> attributeMap = plugin.getAttributeMap(); assertThat(attributeMap.containsKey("invalid-state"), is(true)); assertThat(attributeMap.get("invalid-state").size(), is(2)); assertThat(attributeMap.get("invalid-state").contains("data-manager"), is(true)); assertThat(attributeMap.get("invalid-state").contains("system-admin"), is(true)); }
Source:
public OrderByOperatorFactory( int operatorId, PlanNodeId planNodeId, List<? extends Type> sourceTypes, List<Integer> outputChannels, int expectedPositions, List<Integer> sortChannels, List<SortOrder> sortOrder, PagesIndex.Factory pagesIndexFactory, boolean spillEnabled, Optional<SpillerFactory> spillerFactory) { this.operatorId = operatorId; this.planNodeId = requireNonNull(planNodeId, "planNodeId is null"); this.sourceTypes = ImmutableList.copyOf(requireNonNull(sourceTypes, "sourceTypes is null")); this.outputChannels = requireNonNull(outputChannels, "outputChannels is null"); this.expectedPositions = expectedPositions; this.sortChannels = ImmutableList.copyOf(requireNonNull(sortChannels, "sortChannels is null")); this.sortOrder = ImmutableList.copyOf(requireNonNull(sortOrder, "sortOrder is null")); this.pagesIndexFactory = requireNonNull(pagesIndexFactory, "pagesIndexFactory is null"); this.spillEnabled = spillEnabled; if (spillEnabled) { checkState(spillerFactory.isPresent(), "Spiller Factory is not present when spill is enabled"); } this.spillerFactory = spillerFactory; }

Target:
public OrderByOperatorFactory( int operatorId, PlanNodeId planNodeId, List<? extends Type> sourceTypes, List<Integer> outputChannels, int expectedPositions, List<Integer> sortChannels, List<SortOrder> sortOrder, PagesIndex.Factory pagesIndexFactory, boolean spillEnabled, Optional<SpillerFactory> spillerFactory) { this.operatorId = operatorId; this.planNodeId = requireNonNull(planNodeId, "planNodeId is null"); this.sourceTypes = ImmutableList.copyOf(requireNonNull(sourceTypes, "sourceTypes is null")); this.outputChannels = requireNonNull(outputChannels, "outputChannels is null"); this.expectedPositions = expectedPositions; this.sortChannels = ImmutableList.copyOf(requireNonNull(sortChannels, "sortChannels is null")); this.sortOrder = ImmutableList.copyOf(requireNonNull(sortOrder, "sortOrder is null")); this.pagesIndexFactory = requireNonNull(pagesIndexFactory, "pagesIndexFactory is null"); this.spillEnabled = spillEnabled; checkState(!spillEnabled || spillerFactory.isPresent(), "Spiller Factory is not present when spill is enabled"); this.spillerFactory = spillerFactory; }
Source:
public VirtualGuestToImage(OperatingSystemToImage operatingSystemToImage) { this.operatingSystemToImage = operatingSystemToImage; }

Target:
protected VirtualGuestToImage(OperatingSystemToImage operatingSystemToImage) { this.operatingSystemToImage = checkNotNull(operatingSystemToImage, "operatingSystemToImage"); }
Source:
private Optional<Long> gettimeofdayImpl(POSIX posix) { Timeval tv = posix.allocateTimeval(); int rv = posix.gettimeofday(tv); if (rv != 0) { LOG.info("Expected 0 return value from gettimeofday(), observed " + rv); return Optional.empty(); } return Optional.of(tv.sec() * 1_000_000 + tv.usec()); }

Target:
private Optional<Long> gettimeofdayImpl(POSIX posix) { Timeval tv = posix.allocateTimeval(); int rv = posix.gettimeofday(tv); if (rv != 0) { LOG.debug("Expected 0 return value from gettimeofday(), observed " + rv); return Optional.empty(); } return Optional.of(tv.sec() * 1_000_000 + tv.usec()); }
Source:
public String buildQueryParams() { return (this.buildQueryParams(false)); }

Target:
public String buildQueryParams() { return this.buildQueryParams(false); }
Source:
private Map<String, AuthConfig> normalizeDockerHubRegistryUrl(Map<String, AuthConfig> authConfigs) { if (authConfigs.containsKey("docker.io")) { Map<String,AuthConfig> normalizedAuthConfigMap = new HashMap<>(authConfigs); normalizedAuthConfigMap.put(DEFAULT_REGISTRY, normalizedAuthConfigMap.remove("docker.io")); return normalizedAuthConfigMap; } else if (authConfigs.containsKey("index.docker.io")) { Map<String,AuthConfig> normalizedAuthConfigMap = new HashMap<>(authConfigs); normalizedAuthConfigMap.put(DEFAULT_REGISTRY, normalizedAuthConfigMap.remove("index.docker.io")); return normalizedAuthConfigMap; } return authConfigs; }

Target:
private Map<String, AuthConfig> normalizeDockerHubRegistryUrl(Map<String, AuthConfig> authConfigs) { for (String defaultRegistryAlias : DEFAULT_REGISTRY_SYNONYMS) { if (authConfigs.containsKey(defaultRegistryAlias)) { Map<String, AuthConfig> normalizedAuthConfigMap = new HashMap<>(authConfigs); normalizedAuthConfigMap.put(DEFAULT_REGISTRY, normalizedAuthConfigMap.remove(defaultRegistryAlias)); return normalizedAuthConfigMap; } } return authConfigs; }
Source:
public void migrateAfter(Model model, Metamodel metamodel) throws MigrationException { final EPackage viewPkg = getEPackageWithNSPrefix(metamodel, "org.eclipse.emf.ecp.view.model"); final EClass fpdmrClass = (EClass) viewPkg.getEClassifier("FeaturePathDomainModelReference"); final EReference feature = (EReference) fpdmrClass.getEStructuralFeature("domainModelEFeature"); final EReference path = (EReference) fpdmrClass.getEStructuralFeature("domainModelEReferencePath"); final EList<Instance> allTableDMRs = model.getAllInstances("table.TableDomainModelReference"); for (final Instance tableDMR : allTableDMRs) { if (null == tableDMR.get(feature)) { continue; } final Instance childDMR = model.newInstance(fpdmrClass); final Object featureInstance = tableDMR.unset(feature); final Object pathInstance = tableDMR.unset(path); childDMR.set(feature, featureInstance); childDMR.set(path, pathInstance); tableDMR.set("domainModelReference", childDMR); } }

Target:
public void migrateAfter(Model model, Metamodel metamodel) throws MigrationException { final EPackage viewPkg = getEPackageWithNSPrefix(metamodel, "org.eclipse.emf.ecp.view.model"); final EClass featurePathDMREClass = (EClass) viewPkg.getEClassifier("FeaturePathDomainModelReference"); final EReference feature = (EReference) featurePathDMREClass.getEStructuralFeature("domainModelEFeature"); final EReference path = (EReference) featurePathDMREClass.getEStructuralFeature("domainModelEReferencePath"); final EList<Instance> allTableDMRs = model.getAllInstances("table.TableDomainModelReference"); for (final Instance tableDMR : allTableDMRs) { if (null == tableDMR.get(feature)) { continue; } final Instance childDMR = model.newInstance(featurePathDMREClass); final Object featureInstance = tableDMR.unset(feature); final Object pathInstance = tableDMR.unset(path); childDMR.set(feature, featureInstance); childDMR.set(path, pathInstance); tableDMR.set("domainModelReference", childDMR); } }
Source:
public IPath getAbsolutePath() { return new Path(db.getWorkTree().getAbsolutePath() + File.separatorChar + path); }

Target:
public IPath getAbsolutePath() { if (db.isBare()) { return null; } return new Path(db.getWorkTree().getAbsolutePath() + File.separatorChar + path); }
Source:
private MoveOrCopyImageGroupParameters buildMoveOrCopyImageGroupParametersForMemoryDumpImage(Guid containerID, Guid storageId, Guid imageId, Guid volumeId) { MoveOrCopyImageGroupParameters params = new MoveOrCopyImageGroupParameters(containerID, imageId, volumeId, imageId, volumeId, storageId, getMoveOrCopyImageOperation()); params.setParentCommand(getActionType()); params.setCopyVolumeType(CopyVolumeType.LeafVol); params.setForceOverride(getParameters().getForceOverride()); params.setSourceDomainId(getParameters().getSourceDomainId()); params.setStoragePoolId(getParameters().getStoragePoolId()); params.setImportEntity(true); params.setEntityInfo(new EntityInfo(VdcObjectType.VM, getVm().getId())); params.setParentParameters(getParameters()); StorageDomainStatic storageDomain = getStorageDomainStaticDAO().get(storageId); if (storageDomain != null && storageDomain.getStorageType().isBlockDomain()) { params.setUseCopyCollapse(true); params.setVolumeType(VolumeType.Preallocated); params.setVolumeFormat(VolumeFormat.RAW); } return params; }

Target:
private MoveOrCopyImageGroupParameters buildMoveOrCopyImageGroupParametersForMemoryDumpImage(Guid containerID, Guid storageId, Guid imageId, Guid volumeId) { MoveOrCopyImageGroupParameters params = new MoveOrCopyImageGroupParameters(containerID, imageId, volumeId, imageId, volumeId, storageId, getMoveOrCopyImageOperation()); params.setParentCommand(getActionType()); params.setCopyVolumeType(CopyVolumeType.LeafVol); params.setForceOverride(getParameters().getForceOverride()); params.setSourceDomainId(getParameters().getSourceDomainId()); params.setStoragePoolId(getParameters().getStoragePoolId()); params.setImportEntity(true); params.setEntityInfo(new EntityInfo(VdcObjectType.VM, getVm().getId())); params.setParentParameters(getParameters()); StorageDomainStatic storageDomain = getStorageDomainStaticDAO().get(storageId); if (storageDomain.getStorageType().isBlockDomain()) { params.setUseCopyCollapse(true); params.setVolumeType(VolumeType.Preallocated); params.setVolumeFormat(VolumeFormat.RAW); } return params; }
Source:
public boolean onOptionsItemSelected(MenuItem item) { super.onOptionsItemSelected(item); switch (item.getItemId()) { case android.R.id.home: finish(); break; default: Log_OC.w(TAG, "Unknown menu item triggered"); return false; } return true; }

Target:
public boolean onOptionsItemSelected(MenuItem item) { super.onOptionsItemSelected(item); switch (item.getItemId()) { case android.R.id.home: finish(); return true; default: Log_OC.w(TAG, "Unknown menu item triggered"); return false; } }