auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public List<DataType> create(final DataType record, final DataType reference, final CreationType creationType) { switch (creationType) { case ABOVE: return dataTypeCreateHandler.insertAbove(record, reference, itemDefinitionCreateHandler.insertItemDefinitionAbove(reference)); case BELOW: return dataTypeCreateHandler.insertBelow(record, reference, itemDefinitionCreateHandler.insertItemDefinitionBelow(reference)); case NESTED: return dataTypeCreateHandler.insertNested(record, reference, itemDefinitionCreateHandler.insertNestedItemDefinition(reference)); default: throw new UnsupportedOperationException("The 'CreationType' " + creationType + " is not supported"); } }

Target:
public List<DataType> create(final DataType record, final DataType reference, final CreationType creationType) { if (creationType == NESTED) { final ItemDefinition nestedItemDefinition = itemDefinitionCreateHandler.insertNestedItemDefinition(reference); return dataTypeCreateHandler.insertNested(record, reference, nestedItemDefinition); } else { final ItemDefinition itemDefinition = itemDefinitionCreateHandler.insertItemDefinition(reference, creationType); return dataTypeCreateHandler.insert(record, reference, creationType, itemDefinition); } }
Source:
public Builder withTeam(String team) { studentAttributes.team = team; return this; }

Target:
public Builder withTeam(String team) { if (team != null) { studentAttributes.team = team; } return this; }
Source:
private void setLocation(final String location) { if (location != null) { try { this.location = PointType.valueOf(location); } catch (IllegalArgumentException e) { logger.warn("Could not set new location, keeping old one: ", e); } } }

Target:
private void setLocation(final String location) { if (location != null) { try { this.location = PointType.valueOf(location); } catch (IllegalArgumentException e) { logger.warn("Could not set new location, keeping old one: ", location, e.getMessage()); } } }
Source:
@Override public boolean isDisposed() { return inner == null; }

Target:
@Override public boolean isDisposed() { return get(); }
Source:
private void returnToSiteList() { try { Intent intent = new Intent(this, Class.forName("com.dozuki.ifixit.ui.dozuki.SiteListActivity")); intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION | Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); finish(); } catch (ClassNotFoundException e) { Log.e("BaseMenuDrawerActivity", "Cannot start SiteListActivity", e); } }

Target:
private void returnToSiteList() { try { Intent intent = new Intent(this, Class.forName("com.dozuki.ifixit.ui.dozuki.SiteListActivity")); intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION | Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); finish(); } catch (ClassNotFoundException e) { Toast.makeText(this, "Failed to return to site list.", Toast.LENGTH_SHORT).show(); Log.e("BaseMenuDrawerActivity", "Cannot start SiteListActivity", e); } }
Source:
public OriginIdElement(String id) { this.id = id; }

Target:
public OriginIdElement(String id) { super(id); }
Source:
public void initialise() { WidgetUtil.trySubscribe(this, "close", button -> triggerBackAnimation() ); WidgetUtil.trySubscribe(this, "play", button -> { GameManifest gameManifest = new GameManifest(); gameManifest.setTitle(universeWrapper.getGameName()); DependencyResolver resolver = new DependencyResolver(moduleManager.getRegistry()); ResolutionResult result = resolver.resolve(config.getDefaultModSelection().listModules()); if (!result.isSuccess()) { MessagePopup errorMessagePopup = getManager().pushScreen(MessagePopup.ASSET_URI, MessagePopup.class); if (errorMessagePopup != null) { errorMessagePopup.setMessage("Invalid Module Selection", "Please review your module seleciton and try again"); } return; } for (Module module : result.getModules()) { gameManifest.addModule(module.getId(), module.getVersion()); } SimpleUri uri = world.getWorldGeneratorInfo().getUri(); float timeOffset = 0.25f + 0.025f; WorldInfo worldInfo = new WorldInfo(TerasologyConstants.MAIN_WORLD, world.getWorldGenerator().getWorldSeed(), (long) (WorldTime.DAY_LENGTH * timeOffset), uri); gameManifest.addWorld(worldInfo); gameEngine.changeState(new StateLoading(gameManifest, (universeWrapper.getLoadingAsServer()) ? NetworkMode.DEDICATED_SERVER : NetworkMode.NONE)); }); }

Target:
public void initialise() { WidgetUtil.trySubscribe(this, "close", button -> triggerBackAnimation() ); WidgetUtil.trySubscribe(this, "play", button -> { GameManifest gameManifest = new GameManifest(); gameManifest.setTitle(universeWrapper.getGameName()); DependencyResolver resolver = new DependencyResolver(moduleManager.getRegistry()); ResolutionResult result = resolver.resolve(config.getDefaultModSelection().listModules()); if (!result.isSuccess()) { MessagePopup errorMessagePopup = getManager().pushScreen(MessagePopup.ASSET_URI, MessagePopup.class); if (errorMessagePopup != null) { errorMessagePopup.setMessage("Invalid Module Selection", "Please review your module seleciton and try again"); } return; } for (Module module : result.getModules()) { gameManifest.addModule(module.getId(), module.getVersion()); } SimpleUri uri = world.getWorldGeneratorInfo().getUri(); float timeOffset = 0.50f; WorldInfo worldInfo = new WorldInfo(TerasologyConstants.MAIN_WORLD, world.getWorldGenerator().getWorldSeed(), (long) (WorldTime.DAY_LENGTH * timeOffset), uri); gameManifest.addWorld(worldInfo); gameEngine.changeState(new StateLoading(gameManifest, (universeWrapper.getLoadingAsServer()) ? NetworkMode.DEDICATED_SERVER : NetworkMode.NONE)); }); }
Source:
public <R extends HttpRequest> R bindToRequest(R request, Object input) { Set<String> tags = Set.class.cast(checkNotNull(input, "parameters")); request.setPayload(buildJson(tags)); return request; }

Target:
public <R extends HttpRequest> R bindToRequest(R request, Object input) { checkArgument(input instanceof Set); Set<String> tags = Set.class.cast(checkNotNull(input, "input")); request.setPayload(buildJson(tags)); return request; }
Source:
public static List<File> compile(List<File> files, File outDir, boolean includeDebugInfo) throws IOException { JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); if (compiler == null) { LOG.error("Can not find compiler, please use JDK instead"); return Collections.emptyList(); } StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null); Iterable<? extends JavaFileObject> compilationUnits = fileManager.getJavaFileObjectsFromFiles(files); StaticFileManager staticFileManager = new StaticFileManager(fileManager, outDir); List<String> options = new ArrayList<>(); options.add(includeDebugInfo ? "-g" : "-g:none"); options.addAll(COMMON_ARGS); CompilationTask task = compiler.getTask(null, staticFileManager, null, options, null, compilationUnits); Boolean result = task.call(); fileManager.close(); if (Boolean.TRUE.equals(result)) { return staticFileManager.outputFiles(); } return Collections.emptyList(); }

Target:
public static List<File> compile(List<File> files, File outDir, boolean includeDebugInfo) throws IOException { JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); if (compiler == null) { throw new IllegalStateException("Can not find compiler, please use JDK instead"); } StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null); Iterable<? extends JavaFileObject> compilationUnits = fileManager.getJavaFileObjectsFromFiles(files); StaticFileManager staticFileManager = new StaticFileManager(fileManager, outDir); List<String> options = new ArrayList<>(); options.add(includeDebugInfo ? "-g" : "-g:none"); options.addAll(COMMON_ARGS); CompilationTask task = compiler.getTask(null, staticFileManager, null, options, null, compilationUnits); Boolean result = task.call(); fileManager.close(); if (Boolean.TRUE.equals(result)) { return staticFileManager.outputFiles(); } return Collections.emptyList(); }
Source:
private void handleWidgetDispose(Event e) { if (e.widget == widget) { if (action.getStyle() == IAction.AS_DROP_DOWN_MENU && menuCreatorCalled) { IMenuCreator mc = action.getMenuCreator(); if (mc != null) { mc.dispose(); } } action.removePropertyChangeListener(propertyListener); if (action != null) { String commandId = action.getActionDefinitionId(); ExternalActionManager.ICallback callback = ExternalActionManager .getInstance().getCallback(); if ((callback != null) && (commandId != null)) { callback.removePropertyChangeListener(commandId, actionTextListener); } } widget = null; disposeOldImages(); } }

Target:
private void handleWidgetDispose(Event e) { if (e.widget != widget) { return; } if (action.getStyle() == IAction.AS_DROP_DOWN_MENU && menuCreatorCalled) { IMenuCreator mc = action.getMenuCreator(); if (mc != null) { mc.dispose(); } } action.removePropertyChangeListener(propertyListener); if (action != null) { String commandId = action.getActionDefinitionId(); ExternalActionManager.ICallback callback = ExternalActionManager.getInstance().getCallback(); if ((callback != null) && (commandId != null)) { callback.removePropertyChangeListener(commandId, actionTextListener); } } widget = null; disposeOldImages(); }
Source:
public ChangedLines changedLines(Provider<ReviewDb> db, PatchListCache cache) throws OrmException { if (currentFiles == null) { Change c = change(db); if (c == null) { return null; } PatchSet ps = currentPatchSet(db); if (ps == null) { return null; } changedLines = new ChangedLines(); PatchList p; try { p = cache.get(c, ps); } catch (PatchListNotAvailableException e) { return changedLines; } for (PatchListEntry e : p.getPatches()) { if (Patch.COMMIT_MSG.equals(e.getNewName())) { continue; } changedLines.insertions += e.getInsertions(); changedLines.deletions += e.getDeletions(); } } return changedLines; }

Target:
public ChangedLines changedLines(Provider<ReviewDb> db, PatchListCache cache) throws OrmException { if (changedLines == null) { Change c = change(db); if (c == null) { return null; } PatchSet ps = currentPatchSet(db); if (ps == null) { return null; } PatchList p; try { p = cache.get(c, ps); } catch (PatchListNotAvailableException e) { return null; } changedLines = new ChangedLines(p.getInsertions(), p.getDeletions()); for (PatchListEntry e : p.getPatches()) { if (Patch.COMMIT_MSG.equals(e.getNewName())) { continue; } } } return changedLines; }
Source:
private void readRecoveredChannelState() throws IOException, InterruptedException { ChannelStateReader reader = getEnvironment().getTaskStateManager().getChannelStateReader(); if (!reader.hasChannelStates()) { requestPartitions(); return; } ResultPartitionWriter[] writers = getEnvironment().getAllWriters(); if (writers != null) { for (ResultPartitionWriter writer : writers) { if (writer instanceof CheckpointedResultPartition) { ((CheckpointedResultPartition) writer).readRecoveredState(reader); } else { throw new IllegalStateException( "Cannot restore state to a non-checkpointable partition type: " + writer); } } if (!recordWriter.isAvailable()) { MailboxDefaultAction.Suspension suspendedDefaultAction = mailboxProcessor.suspendDefaultAction(); getInputOutputJointFuture(InputStatus.NOTHING_AVAILABLE).thenRun(suspendedDefaultAction::resume); } } InputGate[] inputGates = getEnvironment().getAllInputGates(); if (inputGates != null && inputGates.length > 0) { CompletableFuture[] futures = new CompletableFuture[inputGates.length]; for (int i = 0; i < inputGates.length; i++) { futures[i] = inputGates[i].readRecoveredState(channelIOExecutor, reader); } CompletableFuture.allOf(futures).thenRun(() -> mainMailboxExecutor.execute( this::requestPartitions, "Input gates request partitions")); } }

Target:
private void readRecoveredChannelState() throws IOException, InterruptedException { ChannelStateReader reader = getEnvironment().getTaskStateManager().getChannelStateReader(); if (!reader.hasChannelStates()) { requestPartitions(); return; } ResultPartitionWriter[] writers = getEnvironment().getAllWriters(); if (writers != null) { for (ResultPartitionWriter writer : writers) { if (writer instanceof CheckpointedResultPartition) { ((CheckpointedResultPartition) writer).readRecoveredState(reader); } else { throw new IllegalStateException( "Cannot restore state to a non-checkpointable partition type: " + writer); } } } InputGate[] inputGates = getEnvironment().getAllInputGates(); if (inputGates != null && inputGates.length > 0) { CompletableFuture[] futures = new CompletableFuture[inputGates.length]; for (int i = 0; i < inputGates.length; i++) { futures[i] = inputGates[i].readRecoveredState(channelIOExecutor, reader); } CompletableFuture.allOf(futures).thenRun(() -> mainMailboxExecutor.execute( this::requestPartitions, "Input gates request partitions")); } }
Source:
public static String getClientIp(final String ip, final String xff) { if (xff == null || xff.isEmpty() || xff.equals("-")) { return ip; } else { String[] proxiedIps = (xff + "," + ip).split(","); String lastKnownGoodIp = ""; for (int i=proxiedIps.length-1;i>=0;i--) { String proxiedIp = proxiedIps[i].trim(); if (InetAddressValidator.getInstance().isValid(proxiedIp)) { lastKnownGoodIp = proxiedIp; if ((! isSpecialAddress(proxiedIp)) && (! isTrustedProxy(proxiedIp))) { return lastKnownGoodIp; } } else { return lastKnownGoodIp; } } return lastKnownGoodIp; } }

Target:
public static String getClientIp(final String ip, final String xff) { String ret = null; String sanitizedIp = sanitizeIp(ip); if (sanitizedIp != null) { ret = sanitizedIp; if (isTrustedProxy(ret) && xff != null) { String[] xffIps = xff.split(","); Collections.reverse(Arrays.asList(xffIps)); for (String xffIp : xffIps) { sanitizedIp = sanitizeIp(xffIp); if (sanitizedIp == null) { break; } ret = sanitizedIp; if (!isTrustedProxy(ret)) { break; } } } } return ret; }
Source:
public List<Integer> getLineToOffset() { return lineToOffset; }

Target:
List<Integer> getLineToOffset() { return lineToOffset; }
Source:
private void updatePath() { mPath.reset(); mBorderPath.reset(); mTempRect.set(getBounds()); mTempRect.inset(mBorderWidth/2, mBorderWidth/2); if (mIsCircle) { mBorderPath.addCircle(mTempRect.centerX(), mTempRect.centerY(), Math.min(mTempRect.width(), mTempRect.height())/2, Path.Direction.CW); } else { mBorderRadii[0] = mRadii[0] + mPadding - mBorderWidth/2; mBorderRadii[1] = mRadii[1] + mPadding - mBorderWidth/2; mBorderRadii[2] = mRadii[2] + mPadding - mBorderWidth/2; mBorderRadii[3] = mRadii[3] + mPadding - mBorderWidth/2; mBorderRadii[4] = mRadii[4] + mPadding - mBorderWidth/2; mBorderRadii[5] = mRadii[5] + mPadding - mBorderWidth/2; mBorderRadii[6] = mRadii[6] + mPadding - mBorderWidth/2; mBorderRadii[7] = mRadii[7] + mPadding - mBorderWidth/2; mBorderPath.addRoundRect(mTempRect, mBorderRadii, Path.Direction.CW); } mTempRect.inset(-mBorderWidth/2, -mBorderWidth/2); mTempRect.inset(mPadding, mPadding); if (mIsCircle) { float radius = Math.min(mTempRect.width(), mTempRect.height())/2; mPath.addCircle(mTempRect.centerX(), mTempRect.centerY(), radius, Path.Direction.CW); } else { mPath.addRoundRect(mTempRect, mRadii, Path.Direction.CW); } mTempRect.inset(-mPadding, -mPadding); }

Target:
private void updatePath() { mPath.reset(); mBorderPath.reset(); mTempRect.set(getBounds()); mTempRect.inset(mBorderWidth/2, mBorderWidth/2); if (mIsCircle) { float radius = Math.min(mTempRect.width(), mTempRect.height())/2; mBorderPath.addCircle(mTempRect.centerX(), mTempRect.centerY(), radius, Path.Direction.CW); } else { for (int i = 0; i < mBorderRadii.length; i++) { mBorderRadii[i] = mRadii[i] + mPadding - mBorderWidth/2; } mBorderPath.addRoundRect(mTempRect, mBorderRadii, Path.Direction.CW); } mTempRect.inset(-mBorderWidth/2, -mBorderWidth/2); mTempRect.inset(mPadding, mPadding); if (mIsCircle) { float radius = Math.min(mTempRect.width(), mTempRect.height())/2; mPath.addCircle(mTempRect.centerX(), mTempRect.centerY(), radius, Path.Direction.CW); } else { mPath.addRoundRect(mTempRect, mRadii, Path.Direction.CW); } mTempRect.inset(-mPadding, -mPadding); }
Source:
public Hosts list() { if (isFiltered()) { throw new WebApplicationException(Response.Status.FORBIDDEN); } ApplicationMode appMode = getCurrent().get(ApplicationMode.class); if (appMode == ApplicationMode.GlusterOnly) { return listGlusterOnly(); } else { return listAll(); } }

Target:
public Hosts list() { ApplicationMode appMode = getCurrent().get(ApplicationMode.class); if (appMode == ApplicationMode.GlusterOnly) { return listGlusterOnly(); } else { return listAll(); } }
Source:
protected void runTask() { UpdateProgress progress = UpdateProgress.START; DateTime start = new DateTime().withZone(DateTimeZone.UTC).minus(back); DateTime end = new DateTime().withZone(DateTimeZone.UTC).plus(forward); while (end.isAfter(start.plusDays(1))) { progress = progress.reduce(equivalateSchedule(start, start.plusDays(1))); start = start.plusDays(1); } progress = progress.reduce(equivalateSchedule(start, end)); reportStatus(String.format("Finished. %d Items processed, %d failed", progress.getProcessed(), progress.getFailures())); }

Target:
protected void runTask() { UpdateProgress progress = UpdateProgress.START; DayRange range = new DayRangeGenerator() .withLookBack(back) .withLookAhead(forward) .generate(new LocalDate()); Iterator<LocalDate> dayIterator = range.iterator(); LocalDate start, end; while(dayIterator.hasNext()) { start = dayIterator.next(); end = start.plusDays(1); progress = progress.reduce(equivalateSchedule(start, end)); } reportStatus(String.format("Finished. %d Items processed, %d failed", progress.getProcessed(), progress.getFailures())); }
Source:
private void deactivate() { if (activePatchSetId != -1) { PatchSetComplexDisclosurePanel patchSetPanel = patchSetPanels.get(activePatchSetId); if (patchSetPanel != null) { patchSetPanel.setActive(false); } activePatchSetId = -1; } }

Target:
private void deactivate() { if (activePatchSetId != -1) { PatchSetComplexDisclosurePanel patchSetPanel = patchSetPanels.get(activePatchSetId); patchSetPanel.setActive(false); activePatchSetId = -1; } }
Source:
protected void loadInterstitial(Context context, CustomEventInterstitialListener customEventInterstitialListener, Map<String, Object> map0, Map<String, String> serverExtras) { try { mMoPubListener = customEventInterstitialListener; sHandler = new Handler(Looper.getMainLooper()); if (context instanceof Activity) { String applicationKey = ""; if (serverExtras.get("applicationKey") != null) { applicationKey = serverExtras.get("applicationKey"); } else if (serverExtras.get("appKey") != null) { applicationKey = serverExtras.get("appKey"); } if (serverExtras.get("isTestEnabled") != null) { isTestEnabled = Boolean.valueOf(serverExtras.get("isTestEnabled")); } if (serverExtras.get("placementName") != null) { placementName = serverExtras.get("placementName"); } onLog("server extras: " + Arrays.toString(serverExtras.entrySet().toArray())); if (!TextUtils.isEmpty(applicationKey)) { initISIronSourceSDK(((Activity) context), applicationKey); if (initState == INIT_SUCCEEDED) { loadISIronSourceSDK(); } } } else { onLog("loadInterstitial must be called on an Activity context"); sHandler.post(new Runnable() { @Override public void run() { if (mMoPubListener != null) { mMoPubListener.onInterstitialFailed(MoPubErrorCode.INTERNAL_ERROR); } } }); } } catch (Exception e) { onLog(e.toString()); sHandler.post(new Runnable() { @Override public void run() { if (mMoPubListener != null) { mMoPubListener.onInterstitialFailed(MoPubErrorCode.INTERNAL_ERROR); } } }); } }

Target:
protected void loadInterstitial(Context context, CustomEventInterstitialListener customEventInterstitialListener, Map<String, Object> map0, Map<String, String> serverExtras) { try { mMoPubListener = customEventInterstitialListener; sHandler = new Handler(Looper.getMainLooper()); if (!(context instanceof Activity)) { onLog("loadInterstitial must be called on an Activity context"); sendMoPubInterstitialFailed(MoPubErrorCode.INTERNAL_ERROR); return; } String applicationKey = ""; mInstanceId = "0"; if (serverExtras != null) { if (serverExtras.get(APPLICATION_KEY) != null) { applicationKey = serverExtras.get(APPLICATION_KEY); } else if (serverExtras.get(APP_KEY) != null) { applicationKey = serverExtras.get(APP_KEY); } if (serverExtras.get(TEST_ENABLED_KEY) != null) { mIsTestEnabled = Boolean.valueOf(serverExtras.get(TEST_ENABLED_KEY)); } if (serverExtras.get(PLACEMENT_KEY) != null) { mPlacementName = serverExtras.get(PLACEMENT_KEY); } if (serverExtras.get(INSTANCE_ID_KEY) != null) { mInstanceId = serverExtras.get(INSTANCE_ID_KEY); } onLog("server extras: " + Arrays.toString(serverExtras.entrySet().toArray())); } if (!TextUtils.isEmpty(applicationKey)) { initIronSourceSDK(((Activity) context), applicationKey); if (mInitInterstitialSuccessfully) { loadInterstitial(); } } else { onLog("Initialization Failed, make sure that 'applicationKey' server parameter is added"); sendMoPubInterstitialFailed(MoPubErrorCode.INTERNAL_ERROR); } } catch (Exception e) { onLog(e.toString()); sendMoPubInterstitialFailed(MoPubErrorCode.INTERNAL_ERROR); } }
Source:
private SortedMap<LockDescriptor, LockMode> generateDescriptorMap(int numLocks, int descriptorSize) { ImmutableSortedMap.Builder<LockDescriptor, LockMode> builder = ImmutableSortedMap.naturalOrder(); generateDescriptors(numLocks, descriptorSize).forEach(descriptor -> builder.put(descriptor, LockMode.WRITE)); return builder.build(); }

Target:
private SortedMap<LockDescriptor, LockMode> generateDescriptorMap(int numLocks, int descriptorSize) { return generateDescriptors(numLocks, descriptorSize).collect(ImmutableSortedMap .toImmutableSortedMap(Comparator.naturalOrder(), descriptor -> descriptor, no -> LockMode.WRITE)); }
Source:
protected int doWork() { IOUtil.assertFileIsWritable(UMI_METRICS_FILE); final int retval = super.doWork(); final MetricsFile<UmiMetrics, Double> metricsFile = getMetricsFile(); for (final Map.Entry<String, UmiMetrics> metric : metrics.entrySet()) { metricsFile.addMetric(metric.getValue()); } metricsFile.write(UMI_METRICS_FILE); return retval; }

Target:
protected int doWork() { IOUtil.assertFileIsWritable(UMI_METRICS_FILE); final int retval = super.doWork(); final MetricsFile<UmiMetrics, Double> metricsFile = getMetricsFile(); for (final UmiMetrics metric : metrics.values()) { metricsFile.addMetric(metric); } metricsFile.write(UMI_METRICS_FILE); return retval; }
Source:
private EC2 mockEnvironment() { final Work work = Mockito.mock(Work.class); final Wallet wallet = Mockito.mock(Wallet.class); final EC2Client client = Mockito.mock(EC2Client.class); final AmazonEC2 aws = Mockito.mock(AmazonEC2.class); final RunInstancesResult result = Mockito.mock(RunInstancesResult.class); final Reservation reservation = Mockito.mock(Reservation.class); final Instance instance = Mockito.mock(Instance.class); final List<Instance> instances = Arrays.asList(instance); Mockito.when( client.get() ).thenReturn(aws); Mockito.when( aws.runInstances( Mockito.any(RunInstancesRequest.class) ) ).thenReturn(result); Mockito.when( result.getReservation() ).thenReturn(reservation); Mockito.when(reservation.getInstances()) .thenReturn(instances); Mockito.when( instance.getInstanceId() ).thenReturn("InstanceId"); Mockito.when( work.unit() ).thenReturn("Unit"); Mockito.when( work.owner() ).thenReturn(new URN()); Mockito.when( work.scheduled() ).thenReturn(new Time()); final EC2 envs = new EC2(work, wallet, "type", "image", "group", "par", client); return envs; }

Target:
private EC2 mockEnvironment() { final Work work = Mockito.mock(Work.class); final Wallet wallet = Mockito.mock(Wallet.class); final EC2Client client = Mockito.mock(EC2Client.class); final AmazonEC2 aws = Mockito.mock(AmazonEC2.class); final RunInstancesResult result = Mockito.mock(RunInstancesResult.class); final Reservation reservation = Mockito.mock(Reservation.class); final Instance instance = Mockito.mock(Instance.class); final List<Instance> instances = Arrays.asList(instance); Mockito.when(client.get()).thenReturn(aws); Mockito.when(aws.runInstances(Mockito.any(RunInstancesRequest.class))) .thenReturn(result); Mockito.when(result.getReservation()).thenReturn(reservation); Mockito.when(reservation.getInstances()).thenReturn(instances); Mockito.when(instance.getInstanceId()).thenReturn("InstanceId"); Mockito.when(work.owner()).thenReturn(new URN()); Mockito.when(work.scheduled()).thenReturn(new Time()); final EC2 envs = new EC2( work, wallet, "type", "ami-ef9f2f1e", "group", "par", "eu-west-123t", client); return envs; }
Source:
private void copyDataToTmpTable(SQLiteDatabase db, Cursor c, int version) { if (c != null) { while (c.moveToNext()) { ContentValues cv = new ContentValues(); copyApnValuesV17(cv, c); if (version > 23) { getNetworkTypeBitmaskFromCursor(cv, c); } try { db.insertWithOnConflict(CARRIERS_TABLE_TMP, null, cv, SQLiteDatabase.CONFLICT_ABORT); if (VDBG) { log("dbh.copyPreservedApnsToNewTable: db.insert returned >= 0; " + "insert successful for cv " + cv); } } catch (SQLException e) { if (VDBG) log("dbh.copyPreservedApnsToNewTable insertWithOnConflict exception " + e + " for cv " + cv); } } } }

Target:
private void copyDataToTmpTable(SQLiteDatabase db, Cursor c, int version) { if (c != null) { while (c.moveToNext()) { ContentValues cv = new ContentValues(); copyApnValuesV17(cv, c); getNetworkTypeBitmaskFromCursor(cv, c); try { db.insertWithOnConflict(CARRIERS_TABLE_TMP, null, cv, SQLiteDatabase.CONFLICT_ABORT); if (VDBG) { log("dbh.copyPreservedApnsToNewTable: db.insert returned >= 0; " + "insert successful for cv " + cv); } } catch (SQLException e) { if (VDBG) log("dbh.copyPreservedApnsToNewTable insertWithOnConflict exception " + e + " for cv " + cv); } } } }
Source:
public static void trackCreateProgram(String projectName, Boolean landscapeMode, boolean exampleProgram) { if (!BuildConfig.DATA_TRACKING) { return; } List<Pair<String, String>> trackingData = new ArrayList<>(); trackingData.add(new Pair<>(TrackingConstants.PROGRAM_NAME, projectName)); trackingData.add(new Pair<>(TrackingConstants.LANDSCAPE, String.valueOf(landscapeMode))); trackingData.add(new Pair<>(TrackingConstants.CREATE_EXAMPLE_PROGRAM, String.valueOf(exampleProgram))); createJsonAndLogCustomEvent(TrackingConstants.CREATE_PROGRAM, trackingData); }

Target:
public void trackCreateProgram(String projectName, Boolean landscapeMode, boolean exampleProgram) { List<Pair<String, String>> trackingData = new ArrayList<>(); trackingData.add(new Pair<>(TrackingConstants.PROGRAM_NAME, projectName)); trackingData.add(new Pair<>(TrackingConstants.LANDSCAPE, String.valueOf(landscapeMode))); trackingData.add(new Pair<>(TrackingConstants.CREATE_EXAMPLE_PROGRAM, String.valueOf(exampleProgram))); createJsonAndLogCustomEvent(TrackingConstants.CREATE_PROGRAM, trackingData); }
Source:
private RMAuthentication joinResourceManager(String rmURL) { logger.info("Joining Resource Manager at " + rmURL); final String fullUrl = rmURL.endsWith("/") ? rmURL + RMConstants.NAME_ACTIVE_OBJECT_RMAUTHENTICATION : rmURL + "/" + RMConstants.NAME_ACTIVE_OBJECT_RMAUTHENTICATION; try { RMAuthentication auth = RMConnection.waitAndJoin(fullUrl, WAIT_ON_JOIN_TIMEOUT_IN_MS); if (auth == null) { logger.error(ExitStatus.RMAUTHENTICATION_NULL.description); System.exit(ExitStatus.RMAUTHENTICATION_NULL.exitCode); } logger.info("Resource Manager joined."); return auth; } catch (Throwable t) { logger.error("Unable to join the Resource Manager at " + rmURL + "\n ProActive server can not send reply to Node (usually due to firewall). Please check server log for more information", t); System.exit(ExitStatus.RMNODE_ADD_ERROR.exitCode); } return null; }

Target:
private RMAuthentication joinResourceManager(String rmURL) { logger.info("Joining Resource Manager at " + rmURL); final String fullUrl = rmURL.endsWith("/") ? rmURL + RMConstants.NAME_ACTIVE_OBJECT_RMAUTHENTICATION : rmURL + "/" + RMConstants.NAME_ACTIVE_OBJECT_RMAUTHENTICATION; try { RMAuthentication auth = RMConnection.waitAndJoin(fullUrl, WAIT_ON_JOIN_TIMEOUT_IN_MS); if (auth == null) { logger.error(ExitStatus.RMAUTHENTICATION_NULL.description); System.exit(ExitStatus.RMAUTHENTICATION_NULL.exitCode); } logger.info("Resource Manager joined."); return auth; } catch (Throwable t) { logger.error("Unable to join the Resource Manager at " + rmURL, t); System.exit(ExitStatus.RMNODE_ADD_ERROR.exitCode); } return null; }
Source:
public EMFRefactorRequest(final EObject object) { this(object, getModelSet(object)); }

Target:
public EMFRefactorRequest(final EObject object) throws ServiceException { this(object, getModelSet(object)); }
Source:
public Object execute() throws Exception { for (int i = 0; i < numberOfNotifications; i++) { sendNotification(); if (waitTime > 0) { try { Thread.sleep(waitTime * 1000L); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } } return null; }

Target:
public Object execute() throws Exception { for (int i = 0; i < numberOfNotifications; i++) { sendNotification(); if (waitTime > 0) { try { Thread.sleep(waitTime * 1000L); } catch (InterruptedException e) { } } } return null; }
Source:
public String getExchangeFileLocation() { if (file == null) { String sValue = PropertyAccessor.getInstance().getPropertyFileLocation(); if (sValue != null && sValue.length() > 0) { if (sValue.endsWith(File.separator)) { setFileName(sValue + EXCHANGE_XML_FILE_NAME); } else { setFileName(sValue + File.separator + EXCHANGE_XML_FILE_NAME); } } } return isFile() ? file.getAbsolutePath() : null; }

Target:
public String getExchangeFileLocation() { if (file == null) { String sValue = PropertyAccessor.getInstance().getPropertyFileLocation(); if (StringUtils.isNotEmpty(sValue)) { if (sValue.endsWith(File.separator)) { setFileName(sValue + EXCHANGE_XML_FILE_NAME); } else { setFileName(sValue + File.separator + EXCHANGE_XML_FILE_NAME); } } } return isFile() ? file.getAbsolutePath() : null; }
Source:
public EventData(byte[] body, Context context) { Objects.requireNonNull(body); this.body = ByteBuffer.wrap(body); this.properties = new HashMap<>(); this.systemProperties = new SystemProperties(Collections.emptyMap()); this.context = context; }

Target:
public EventData(byte[] body, Context context) { this(ByteBuffer.wrap(body), context); }
Source:
private boolean suggestGroupAsReviewer(final Project.NameKey project, final GroupReference group) throws OrmException { if (AccountGroup.ANONYMOUS_USERS.equals(group.getUUID()) || AccountGroup.REGISTERED_USERS.equals(group.getUUID())) { return false; } try { final Set<Account> members = groupMembersFactory.create(project, group.getUUID()).call(); if (members.isEmpty()) { return false; } final int maxAllowed = cfg.getInt("addreviewer", "maxAllowed", AddReviewer.DEFAULT_MAX_REVIEWERS); if (maxAllowed > 0 && members.size() > maxAllowed) { return false; } } catch (NoSuchGroupException e) { return false; } catch (NoSuchProjectException e) { return false; } return true; }

Target:
private boolean suggestGroupAsReviewer(final Project.NameKey project, final GroupReference group) throws OrmException { if (!AddReviewer.isLegalReviewerGroup(group.getUUID())) { return false; } try { final Set<Account> members = groupMembersFactory.create(project, group.getUUID()).call(); if (members.isEmpty()) { return false; } final int maxAllowed = cfg.getInt("addreviewer", "maxAllowed", AddReviewer.DEFAULT_MAX_REVIEWERS); if (maxAllowed > 0 && members.size() > maxAllowed) { return false; } } catch (NoSuchGroupException e) { return false; } catch (NoSuchProjectException e) { return false; } return true; }
Source:
private void runUserControllerTask(final int iteration) throws Exception { insertableMetricTracker.put(DolphinMetricKeys.CONTROLLER_TASK_USER_CONTROLLER_TASK_START, System.currentTimeMillis()); userControllerTask.run(iteration); insertableMetricTracker.put(DolphinMetricKeys.CONTROLLER_TASK_USER_CONTROLLER_TASK_END, System.currentTimeMillis()); }

Target:
private void runUserControllerTask(final int iteration) throws MetricException { insertableMetricTracker.put(CONTROLLER_TASK_USER_CONTROLLER_TASK_START, System.currentTimeMillis()); userControllerTask.run(iteration); insertableMetricTracker.put(CONTROLLER_TASK_USER_CONTROLLER_TASK_END, System.currentTimeMillis()); }
Source:
public void deleteCollectionAdminGroupUnAuthorizedTest() throws Exception { context.turnOffAuthorisationSystem(); Group adminGroup = collectionService.createAdministrators(context, collection); context.restoreAuthSystemState(); getClient().perform(delete("/api/core/collections/" + collection.getID() + "/adminGroup")) .andExpect(status().isUnauthorized()); }

Target:
public void deleteCollectionAdminGroupUnAuthorizedTest() throws Exception { context.turnOffAuthorisationSystem(); Group adminGroup = collectionService.createAdministrators(context, collection); context.restoreAuthSystemState(); getClient().perform(delete("/api/core/collections/" + collection.getID() + "/adminGroup")) .andExpect(status().isUnauthorized()); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(get("/api/core/collections/" + collection.getID() + "/adminGroup")) .andExpect(status().isOk()) .andExpect( jsonPath("$", GroupMatcher.matchGroupEntry(adminGroup.getID(), adminGroup.getName()))); }
Source:
TransferFormsTableView(TransferFormsTableViewModel model, String[] headers) { super(model); this.headers = headers; setName("forms"); addMouseListener(new MouseAdapterBuilder().onClick(this::relayClickToButton).build()); Dimension formNameDims = getHeaderDimension(this, getHeader(FORM_NAME_COL)); Dimension statusDims = getHeaderDimension(this, getHeader(STATUS_COL)); customizeHeader(getTableHeader()); customizeTable(this); TableColumnModel columns = getColumnModel(); columns.getColumn(SELECTED_CHECKBOX_COL).setMinWidth(40); columns.getColumn(SELECTED_CHECKBOX_COL).setMaxWidth(40); columns.getColumn(SELECTED_CHECKBOX_COL).setPreferredWidth(40); columns.getColumn(FORM_NAME_COL).setMinWidth(formNameDims.width + 25); columns.getColumn(FORM_NAME_COL).setPreferredWidth(formNameDims.width + 25); columns.getColumn(STATUS_COL).setMinWidth(statusDims.width + 25); columns.getColumn(STATUS_COL).setPreferredWidth(statusDims.width + 25); columns.getColumn(DETAIL_BUTTON_COL).setCellRenderer(UI::cellWithButton); columns.getColumn(DETAIL_BUTTON_COL).setMinWidth(40); columns.getColumn(DETAIL_BUTTON_COL).setMaxWidth(40); columns.getColumn(DETAIL_BUTTON_COL).setPreferredWidth(40); setFillsViewportHeight(true); TableRowSorter<TransferFormsTableViewModel> sorter = sortBy(getModel(), FORM_NAME_COL, ASCENDING); sorter.setComparator(SELECTED_CHECKBOX_COL, (Comparator<Boolean>) UI::compareSelectionButton); setRowSorter(sorter); sorter.sort(); }

Target:
TransferFormsTableView(TransferFormsTableViewModel model, String[] headers) { super(model); this.headers = headers; setName("forms"); addMouseListener(new MouseAdapterBuilder().onClick(this::relayClickToButton).build()); Dimension formNameDims = getHeaderDimension(this, getHeader(FORM_NAME_COL)); Dimension statusDims = getHeaderDimension(this, getHeader(STATUS_COL)); customizeHeader(getTableHeader()); customizeTable(this); TableColumnModel columns = getColumnModel(); columns.getColumn(SELECTED_CHECKBOX_COL).setMinWidth(40); columns.getColumn(SELECTED_CHECKBOX_COL).setMaxWidth(40); columns.getColumn(SELECTED_CHECKBOX_COL).setPreferredWidth(40); columns.getColumn(FORM_NAME_COL).setMinWidth(formNameDims.width + 25); columns.getColumn(FORM_NAME_COL).setPreferredWidth(formNameDims.width + 25); columns.getColumn(STATUS_COL).setMinWidth(statusDims.width + 25); columns.getColumn(STATUS_COL).setPreferredWidth(statusDims.width + 25); columns.getColumn(DETAIL_BUTTON_COL).setCellRenderer(ButtonProcessing::cellWithButton); columns.getColumn(DETAIL_BUTTON_COL).setMinWidth(40); columns.getColumn(DETAIL_BUTTON_COL).setMaxWidth(40); columns.getColumn(DETAIL_BUTTON_COL).setPreferredWidth(40); setFillsViewportHeight(true); TableRowSorter<TransferFormsTableViewModel> sorter = sortBy(getModel(), FORM_NAME_COL, ASCENDING); sorter.setComparator(SELECTED_CHECKBOX_COL, (Comparator<Boolean>) UI::compareSelectionButton); setRowSorter(sorter); sorter.sort(); }
Source:
protected Node visitShowPartitions(ShowPartitions showPartitions, Void context) { QualifiedObjectName table = createQualifiedObjectName(session, showPartitions, showPartitions.getTable()); TableHandle tableHandle = metadata.getTableHandle(session, table) .orElseThrow(() -> new SemanticException(MISSING_TABLE, showPartitions, "Table '%s' does not exist", table)); Optional<TableLayout> layout = getLayout(showPartitions, showPartitions.getTable(), showPartitions.getWhere()); List<Expression> rows = getPartitionsAsValuesRows(showPartitions, table, layout); Map<ColumnHandle, String> columnHandleNames = ImmutableBiMap.copyOf(metadata.getColumnHandles(session, tableHandle)).inverse(); List<String> partitioningColumns = getPartitioningColumns(showPartitions, table, tableHandle, layout, columnHandleNames); Optional<Expression> where; if (rows.isEmpty()) { List<Expression> row = partitioningColumns.stream() .map(partitioningColumn -> new NullLiteral()) .collect(toImmutableList()); rows = ImmutableList.of(new Row(row)); where = Optional.of(FALSE_LITERAL); } else { where = showPartitions.getWhere(); } return simpleQuery( selectList(partitioningColumns.stream().map(QueryUtil::identifier).collect(toImmutableList())), aliased(new Values(rows), "x", partitioningColumns), where, Optional.empty(), Optional.empty(), orderBy(showPartitions.getOrderBy()), showPartitions.getLimit()); }

Target:
protected Node visitShowPartitions(ShowPartitions showPartitions, Void context) { QualifiedObjectName table = createQualifiedObjectName(session, showPartitions, showPartitions.getTable()); TableHandle tableHandle = metadata.getTableHandle(session, table) .orElseThrow(() -> new SemanticException(MISSING_TABLE, showPartitions, "Table '%s' does not exist", table)); TableLayout layout = getLayoutFromFilterScanQuery(showPartitions, showPartitions.getTable(), showPartitions.getWhere()) .orElseGet(() -> getLayoutWithoutPartitionsFromMetadata(showPartitions, showPartitions.getTable(), tableHandle)); List<Expression> rows = getPartitionsAsValuesRows(showPartitions, table, layout); List<String> partitioningColumns = getPartitioningColumns(showPartitions, table, tableHandle, layout); Optional<Expression> where; if (rows.isEmpty()) { List<Expression> row = partitioningColumns.stream() .map(partitioningColumn -> new NullLiteral()) .collect(toImmutableList()); rows = ImmutableList.of(new Row(row)); where = Optional.of(FALSE_LITERAL); } else { where = showPartitions.getWhere(); } return simpleQuery( selectList(partitioningColumns.stream().map(QueryUtil::identifier).collect(toImmutableList())), aliased(new Values(rows), "x", partitioningColumns), where, Optional.empty(), Optional.empty(), orderBy(showPartitions.getOrderBy()), showPartitions.getLimit()); }
Source:
protected boolean setAndValidateDiskProfiles() { if (diskInfoDestinationMap != null) { Map<DiskImage, Guid> map = new HashMap<>(); for (DiskImage diskImage : diskInfoDestinationMap.values()) { map.put(diskImage, diskImage.getStorageIds().get(0)); } return validate(DiskProfileHelper.setAndValidateDiskProfiles(map)); } return true; }

Target:
protected boolean setAndValidateDiskProfiles() { if (diskInfoDestinationMap != null && !diskInfoDestinationMap.isEmpty()) { Map<DiskImage, Guid> map = new HashMap<>(); for (DiskImage diskImage : diskInfoDestinationMap.values()) { map.put(diskImage, diskImage.getStorageIds().get(0)); } return validate(DiskProfileHelper.setAndValidateDiskProfiles(map)); } return true; }
Source:
public void testDotProductAttention(){ final INDArray keys = Nd4j.rand(new int[]{10, 4, 3}); final INDArray values = Nd4j.rand(new int[]{10, 4, 3}); final INDArray query = Nd4j.rand(new int[]{10, 4, 1}); final INDArray exec = Nd4j.matmul(keys, query, true, false, false) .divi(Math.sqrt(keys.size(1))); Nd4j.exec(new SoftMax(exec, exec, 1)); final INDArray finalOut = Nd4j.matmul(values, exec).norm1(); SameDiff sd = SameDiff.create(); SDVariable sdQ = sd.var("q", query); SDVariable sdK = sd.var("k", keys); SDVariable sdV = sd.var("v", values); SDVariable t = sd.nn.dotProductAttention(sdQ, sdK, sdV, null, true); t.norm1("out"); String err = OpValidation.validate(new TestCase(sd) .expectedOutput("out", finalOut) .gradientCheck(true)); assertNull(err, err); }

Target:
public void testDotProductAttention(){ final INDArray keys = Nd4j.rand(new int[]{10, 4, 3}); final INDArray values = Nd4j.rand(new int[]{10, 4, 3}); final INDArray query = Nd4j.rand(new int[]{10, 4, 1}); final INDArray exec = Nd4j.matmul(keys, query, true, false, false) .divi(Math.sqrt(keys.size(1))); Nd4j.exec(new SoftMax(exec, exec, 1)); final INDArray finalOut = Nd4j.matmul(values, exec).norm1(); SameDiff sd = SameDiff.create(); SDVariable sdQ = sd.var("q", query); SDVariable sdK = sd.var("k", keys); SDVariable sdV = sd.var("v", values); SDVariable t = sd.nn.dotProductAttention(sdQ, sdK, sdV, null, true); t.norm1("out"); String err = OpValidation.validate(new TestCase(sd) .expectedOutput("out", finalOut) .gradientCheck(true)); assertNull(err); }
Source:
public JobSubjectEntity(Guid jobId, Guid entityId, VdcObjectType entityType) { super(); this.entityId = entityId; this.entityType = entityType; this.jobId = jobId; }

Target:
public JobSubjectEntity(Guid jobId, Guid entityId, VdcObjectType entityType) { this.entityId = entityId; this.entityType = entityType; this.jobId = jobId; }
Source:
private RMNode recoverNode(RMNodeData rmNodeData, NodeSource nodeSource, Map<NodeState, Integer> recoveredNodeStatesCounter) throws InterruptedException { Node node = null; String nodeUrl = rmNodeData.getNodeUrl(); NodeState previousState = rmNodeData.getState(); boolean isPAMR = nodeUrl.startsWith("pamr://"); int PAMR_MAXIMUM_TIMEOUT = 65000; boolean connected = false; long initialTime = System.currentTimeMillis(); do { try { node = nodeSource.lookupNode(nodeUrl, PAResourceManagerProperties.RM_NODELOOKUP_TIMEOUT.getValueAsInt()); logger.info("Node " + nodeUrl + " was looked up successfully"); connected = true; } catch (Exception e) { if (isPAMR) { logger.debug("Node " + nodeUrl + " could not be looked up. Wait for PAMR agent reconnection delay."); Thread.sleep(1000); } else { logger.error("Node " + nodeUrl + " could not be looked up."); } } } while (!connected && isPAMR && (System.currentTimeMillis() - initialTime) < PAMR_MAXIMUM_TIMEOUT); if (!connected) { node = new FakeDownNodeForRecovery(rmNodeData.getName(), rmNodeData.getNodeUrl()); rmNodeData.setState(NodeState.DOWN); if (isPAMR) { logger.error("Node " + nodeUrl + " could not be looked up."); } } return this.addRMNodeToCoreAndSource(nodeSource, recoveredNodeStatesCounter, rmNodeData, nodeUrl, node, previousState); }

Target:
private RMNode recoverNode(RMNodeData rmNodeData, NodeSource nodeSource, Map<NodeState, Integer> recoveredNodeStatesCounter) { Node node = null; String nodeUrl = rmNodeData.getNodeUrl(); NodeState previousState = rmNodeData.getState(); boolean isPAMR = nodeUrl.startsWith(PAMRRemoteObjectFactory.PROTOCOL_ID + "://"); boolean connected = false; long initialTime = System.currentTimeMillis(); do { try { node = nodeSource.lookupNode(nodeUrl, PAResourceManagerProperties.RM_NODELOOKUP_TIMEOUT.getValueAsInt()); logger.info("Node " + nodeUrl + " was looked up successfully"); connected = true; } catch (Exception e) { if (isPAMR) { logger.debug("Node " + nodeUrl + " could not be looked up. Wait for PAMR agent reconnection delay."); Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS); } else { logger.error("Node " + nodeUrl + " could not be looked up."); } } } while (!connected && isPAMR && (System.currentTimeMillis() - initialTime) < Agent.MAXIMUM_RETRY_DELAY_MS); if (!connected) { node = new FakeDownNodeForRecovery(rmNodeData.getName(), rmNodeData.getNodeUrl()); rmNodeData.setState(NodeState.DOWN); if (isPAMR) { logger.error("Node " + nodeUrl + " could not be looked up."); } } return this.addRMNodeToCoreAndSource(nodeSource, recoveredNodeStatesCounter, rmNodeData, nodeUrl, node, previousState); }
Source:
public static void resetUsageCountingDate() { prefs.edit().putLong(PREF_USAGE_COUNTING_DATE, Calendar.getInstance().getTimeInMillis()).apply(); }

Target:
public static void resetUsageCountingDate() { setUsageCountingDateMillis(Calendar.getInstance().getTimeInMillis()); }
Source:
private static Set<String> getAllAsciiCharacters() { final int SPACE = ' '; final int TILDE = '~'; Set<String> singleChars = new HashSet<>(TILDE - SPACE + 1); for (int i = SPACE; i <= TILDE; i++) { singleChars.add(Character.toString((char) i)); } return singleChars; }

Target:
private static Set<String> getAllAsciiCharacters() { final int SPACE = ' '; final int TILDE = '~'; Set<String> singleChars = new HashSet<>(TILDE - SPACE + 1); for (char i = SPACE; i <= TILDE; i++) { singleChars.add(Character.toString(i)); } return singleChars; }
Source:
public void before() { final NoOpRecordCollector collector = new NoOpRecordCollector() { @Override public <K, V> void send(final String topic, final K key, final V value, final Headers headers, final Integer partition, final Long timestamp, final Serializer<K> keySerializer, final Serializer<V> valueSerializer) { sent.put(key, value); } }; final StreamsMetricsImpl streamsMetrics = niceMock(StreamsMetricsImpl.class); replay(streamsMetrics); final InternalMockProcessorContext context = new InternalMockProcessorContext( TestUtils.tempDirectory(), Serdes.String(), Serdes.Long(), collector, new ThreadCache(new LogContext("testCache "), 0, streamsMetrics)); context.setTime(0); store.init(context, store); }

Target:
public void before() { final NoOpRecordCollector collector = new NoOpRecordCollector() { @Override public <K, V> void send(final String topic, final K key, final V value, final Headers headers, final Integer partition, final Long timestamp, final Serializer<K> keySerializer, final Serializer<V> valueSerializer) { sent.put(key, value); } }; final InternalMockProcessorContext context = new InternalMockProcessorContext( TestUtils.tempDirectory(), Serdes.String(), Serdes.Long(), collector, new ThreadCache( new LogContext("testCache "), 0, new StreamsMetricsImpl(new Metrics(), "test", StreamsConfig.METRICS_LATEST))); context.setTime(0); store.init(context, store); }
Source:
public void saveCurrentProperty() { List<Property> ppList = getProperties(); for (Property pp : ppList) { this.property = pp; Process p = this.currentStep.getProcess(); List<Property> props = p.getProperties(); for (Property processProperty : props) { if (processProperty.getTitle() == null) { p.getProperties().remove(processProperty); } } for (Process process : this.property.getProcesses()) { if (!process.getProperties().contains(this.property)) { process.getProperties().add(this.property); } } try { this.serviceManager.getProcessService().save(this.currentStep.getProcess()); Helper.setMeldung("Property saved"); } catch (DataException e) { logger.error(e.getMessage(), e); Helper.setFehlerMeldung("Properties could not be saved"); } } }

Target:
public void saveCurrentProperty() { List<Property> ppList = getProperties(); for (Property pp : ppList) { this.property = pp; Process p = this.currentStep.getProcess(); List<Property> props = p.getProperties(); for (Property processProperty : props) { if (processProperty.getTitle() == null) { p.getProperties().remove(processProperty); } } for (Process process : this.property.getProcesses()) { if (!process.getProperties().contains(this.property)) { process.getProperties().add(this.property); } } try { this.serviceManager.getProcessService().save(this.currentStep.getProcess()); Helper.setMeldung("Property saved"); } catch (DataException e) { Helper.setErrorMessage("Properties could not be saved", logger, e); } } }