auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void unBindGpioPin(MCP23017BindingProvider provider, String itemName) { GpioPin pin = gpioPins.remove(itemName); gpio.unprovisionPin(pin); logger.debug("unbound " + itemName); }

Target:
private void unBindGpioPin(MCP23017BindingProvider provider, String itemName) { GpioPin pin = gpioPins.remove(itemName); gpio.unprovisionPin(pin); logger.debug("Unbound item {}", itemName); }
Source:
private String getMimeType(URI resourceURI, String productName) throws MimeTypeResolutionException, IOException { String mimeType = null; if (mimeTypeMapper == null) { LOGGER.debug("mimeTypeMapper is NULL"); } else { String fileExtension = FilenameUtils.getExtension(productName); mimeType = mimeTypeMapper.getMimeTypeForFileExtension(fileExtension); } if ((mimeType == null || mimeType.isEmpty() || mimeType.equals(DEFAULT_MIME_TYPE)) && URL_FILE_SCHEME.equalsIgnoreCase(resourceURI.getScheme())) { final Tika tika = new Tika(); try { mimeType = AccessController.doPrivileged( (PrivilegedExceptionAction<String>) () -> tika.detect(resourceURI.toURL())); } catch (PrivilegedActionException e) { throw new IOException("Error performing privileged action", e); } LOGGER.debug("Tika determined mimeType for url = {}", mimeType); } else { LOGGER.debug("mimeType = set by MimeTypeMapper", mimeType); } if (mimeType == null || mimeType.equals("content/unknown")) { mimeType = "application/unknown"; } LOGGER.debug("mimeType set to: {}", mimeType); return mimeType; }

Target:
private String getMimeType(URI resourceURI, String productName) throws MimeTypeResolutionException, IOException { String mimeType = null; if (mimeTypeMapper == null) { LOGGER.debug("mimeTypeMapper is NULL"); } else { String fileExtension = FilenameUtils.getExtension(productName); mimeType = mimeTypeMapper.getMimeTypeForFileExtension(fileExtension); } if ((mimeType == null || mimeType.isEmpty() || mimeType.equals(DEFAULT_MIME_TYPE)) && URL_FILE_SCHEME.equalsIgnoreCase(resourceURI.getScheme())) { final Tika tika = new Tika(); try { mimeType = AccessController.doPrivileged( (PrivilegedExceptionAction<String>) () -> tika.detect(resourceURI.toURL())); } catch (PrivilegedActionException e) { throw new IOException("Error performing privileged action", e.getException()); } LOGGER.debug("Tika determined mimeType for url = {}", mimeType); } else { LOGGER.debug("mimeType = set by MimeTypeMapper", mimeType); } if (mimeType == null || mimeType.equals("content/unknown")) { mimeType = "application/unknown"; } LOGGER.debug("mimeType set to: {}", mimeType); return mimeType; }
Source:
private void deleteTableData(Path tablePath, boolean ifPurge, Database db) throws MetaException { if (tablePath != null) { wh.deleteDir(tablePath, true, ifPurge, db); } }

Target:
private void deleteTableData(Path tablePath, boolean ifPurge, Database db) { if (tablePath != null) { try { wh.deleteDir(tablePath, true, ifPurge, db); } catch (Exception e) { LOG.error("Failed to delete table directory: " + tablePath + " " + e.getMessage()); } } }
Source:
public Collection<UberfireDock> provideDocks(final String perspectiveIdentifier) { List<UberfireDock> result = new ArrayList<>(); settingsDock = new UberfireDock(UberfireDockPosition.EAST, "SLIDERS", new DefaultPlaceRequest(SettingsPresenter.IDENTIFIER), perspectiveIdentifier); result.add(settingsDock.withSize(450).withLabel(ScenarioSimulationEditorConstants.INSTANCE.settings())); toolsDock = new UberfireDock(UberfireDockPosition.EAST, "INFO_CIRCLE", new DefaultPlaceRequest(TestToolsPresenter.IDENTIFIER), perspectiveIdentifier); result.add(toolsDock.withSize(450).withLabel(ScenarioSimulationEditorConstants.INSTANCE.testTools())); cheatSheetDock = new UberfireDock(UberfireDockPosition.EAST, "FILE_TEXT", new DefaultPlaceRequest(CheatSheetPresenter.IDENTIFIER), perspectiveIdentifier); result.add(cheatSheetDock.withSize(450).withLabel(ScenarioSimulationEditorConstants.INSTANCE.scenarioCheatSheet())); reportDock = new UberfireDock(UberfireDockPosition.EAST, "PLAY_CIRCLE", new DockPlaceHolderPlace(TEST_RUNNER_REPORTING_PANEL), perspectiveIdentifier); result.add(reportDock.withSize(450).withLabel("TEST REPORT" )); coverageDock = new UberfireDock(UberfireDockPosition.EAST, "BAR_CHART", new DefaultPlaceRequest(CoverageReportPresenter.IDENTIFIER), perspectiveIdentifier); result.add(coverageDock.withSize(450).withLabel(ScenarioSimulationEditorConstants.INSTANCE.coverageReport())); return result; }

Target:
public Collection<UberfireDock> provideDocks(final String perspectiveIdentifier) { List<UberfireDock> result = new ArrayList<>(); settingsDock = new UberfireDock(UberfireDockPosition.EAST, "SLIDERS", new DefaultPlaceRequest(SettingsPresenter.IDENTIFIER), perspectiveIdentifier); result.add(settingsDock.withSize(450).withLabel(ScenarioSimulationEditorConstants.INSTANCE.settings())); toolsDock = new UberfireDock(UberfireDockPosition.EAST, "INFO_CIRCLE", new DefaultPlaceRequest(TestToolsPresenter.IDENTIFIER), perspectiveIdentifier); result.add(toolsDock.withSize(450).withLabel(ScenarioSimulationEditorConstants.INSTANCE.testTools())); cheatSheetDock = new UberfireDock(UberfireDockPosition.EAST, "FILE_TEXT", new DefaultPlaceRequest(CheatSheetPresenter.IDENTIFIER), perspectiveIdentifier); result.add(cheatSheetDock.withSize(450).withLabel(ScenarioSimulationEditorConstants.INSTANCE.scenarioCheatSheet())); reportDock = new UberfireDock(UberfireDockPosition.EAST, "PLAY_CIRCLE", new DockPlaceHolderPlace(TEST_RUNNER_REPORTING_PANEL), perspectiveIdentifier); result.add(reportDock.withSize(450).withLabel(ScenarioSimulationEditorConstants.INSTANCE.testReport())); coverageDock = new UberfireDock(UberfireDockPosition.EAST, "BAR_CHART", new DefaultPlaceRequest(CoverageReportPresenter.IDENTIFIER), perspectiveIdentifier); result.add(coverageDock.withSize(450).withLabel(ScenarioSimulationEditorConstants.INSTANCE.coverageReport())); return result; }
Source:
public List<String> unapply(final String value) { if (value == null) { return Collections.EMPTY_LIST; } final List<String> retList; try { retList = reverseLoadingCache.get(value, new Callable<List<String>>() { @Override public List<String> call() throws Exception { return dataFetcher.reverseFetchKeys(value); } }); return retList; } catch (ExecutionException e) { LOGGER.debug("list of keys not found for value [%s]", value); return Collections.EMPTY_LIST; } }

Target:
public List<String> unapply(final String value) { if (value == null) { return Collections.EMPTY_LIST; } final List<String> retList; try { retList = reverseLoadingCache.get(value, new unapplyCallable(value)); return retList; } catch (ExecutionException e) { LOGGER.debug("list of keys not found for value [%s]", value); return Collections.EMPTY_LIST; } }
Source:
public void startPlugins() { for (PluginWrapper pluginWrapper : resolvedPlugins) { PluginState pluginState = pluginWrapper.getPluginState(); if ((PluginState.DISABLED != pluginState) && (PluginState.STARTED != pluginState)) { tryStartPlugin(pluginWrapper, pluginWrapper.getDescriptor(), pluginState); } } }

Target:
public void startPlugins() { for (PluginWrapper pluginWrapper : resolvedPlugins) { PluginState pluginState = pluginWrapper.getPluginState(); if ((PluginState.DISABLED != pluginState) && (PluginState.STARTED != pluginState)) { tryStartPlugin(pluginWrapper); } } }
Source:
public void consume(Iterator<KeyMessage<String, String>> updateIterator) throws IOException { while (updateIterator.hasNext()) { KeyMessage<String, String> km = updateIterator.next(); String key = km.getKey(); String message = km.getMessage(); switch (key) { case "UP": List<?> update = MAPPER.readValue(message, List.class); int id = Integer.parseInt(update.get(0).toString()); double[] vector = MAPPER.convertValue(update.get(1), double[].class); model.update(id, vector); break; case "MODEL": PMML pmml; try { pmml = PMMLUtils.fromString(message); } catch (JAXBException e) { throw new IOException(e); } KMeansPMMLUtils.validatePMMLVsSchema(pmml, inputSchema); model = new KMeansSpeedModel(KMeansPMMLUtils.read(pmml)); log.info("Model with clusters", model.getClusters().size()); break; default: throw new IllegalStateException("Unexpected key " + key); } } }

Target:
public void consume(Iterator<KeyMessage<String, String>> updateIterator) throws IOException { while (updateIterator.hasNext()) { KeyMessage<String, String> km = updateIterator.next(); String key = km.getKey(); String message = km.getMessage(); switch (key) { case "UP": break; case "MODEL": PMML pmml; try { pmml = PMMLUtils.fromString(message); } catch (JAXBException e) { throw new IOException(e); } KMeansPMMLUtils.validatePMMLVsSchema(pmml, inputSchema); model = new KMeansSpeedModel(KMeansPMMLUtils.read(pmml)); log.info("Model with clusters", model.getClusters().size()); break; default: throw new IllegalStateException("Unexpected key " + key); } } }
Source:
void bindResource(OsgiVaadinStaticResource resource) throws NamespaceException { Bundle bundle = FrameworkUtil.getBundle(resource.getClass()); Delegate registration = new Delegate(resource.getAlias(), resource.getPath(), bundle); resourceToDelegate.put(resource, registration); registration.init(httpService); httpService.registerResources(registration.alias, registration.path, registration); }

Target:
void bindResource(OsgiVaadinStaticResource resource) throws NamespaceException { Bundle bundle = FrameworkUtil.getBundle(resource.getClass()); Delegate registration = new Delegate(resource.getAlias(), resource.getPath(), bundle, httpService.createDefaultHttpContext()); httpService.registerResources(registration.alias, registration.path, registration); }
Source:
public void setNotifierFrequency(org.wso2.iot.agent.beans.Operation operation) throws AndroidAgentException { try { JSONObject inputData = new JSONObject(operation.getPayLoad().toString()); int notifierFrequencyValue = inputData.getInt(getContextResources() .getString(R.string.notifire_frequency_value_key)); Preference.putInt(context, context.getString(R.string.shared_pref_frequency), notifierFrequencyValue); operation.setStatus(getContextResources().getString(R.string.operation_value_completed)); operation.setOperationResponse("Notification frequency updated successfully."); getResultBuilder().build(operation); } catch (JSONException | NullPointerException e) { operation.setStatus(getContextResources().getString(R.string.operation_value_error)); operation.setOperationResponse("Error in parsing NOTIFICATION payload."); getResultBuilder().build(operation); throw new AndroidAgentException("Invalid JSON format.", e); } }

Target:
public void setNotifierFrequency(org.wso2.iot.agent.beans.Operation operation) throws AndroidAgentException { try { if (operation.getPayLoad() != null) { JSONObject inputData = new JSONObject(operation.getPayLoad().toString()); int notifierFrequencyValue = inputData.getInt(Constants.NOTIFIRE_FREQUENCY_VALUE_KEY); Preference.putInt(context, context.getString(R.string.shared_pref_frequency), notifierFrequencyValue); operation.setStatus(getContextResources().getString(R.string.operation_value_completed)); operation.setOperationResponse("Notification frequency updated successfully."); getResultBuilder().build(operation); } else { operation.setStatus(getContextResources().getString(R.string.operation_value_error)); operation.setOperationResponse("invalid NOTIFICATION payload."); getResultBuilder().build(operation); } } catch (JSONException e) { operation.setStatus(getContextResources().getString(R.string.operation_value_error)); operation.setOperationResponse("Error in parsing NOTIFICATION payload."); getResultBuilder().build(operation); throw new AndroidAgentException("Invalid JSON format.", e); } }
Source:
public PluginInfo.Release preferReleaseVersion( @Nonnull String id, @Nonnull String releaseVersion, boolean preferred) { PluginInfo pluginInfo = repository.findById(id); Optional<PluginInfo.Release> release = pluginInfo.getReleaseByVersion(releaseVersion); if (release.isPresent()) { release.get().setPreferred(preferred); pluginInfo.setReleaseByVersion(releaseVersion, release.get()); if (preferred) { pluginInfo.getReleases().stream() .filter(it -> !it.getVersion().equals(release.get().getVersion())) .forEach(it -> it.setPreferred(false)); } repository.update(pluginInfo.getId(), pluginInfo); } return release.orElse(null); }

Target:
public PluginInfo.Release preferReleaseVersion( @Nonnull String id, @Nonnull String releaseVersion, boolean preferred) { PluginInfo pluginInfo = repository.findById(id); Optional<PluginInfo.Release> release = pluginInfo.getReleaseByVersion(releaseVersion); return release .map( r -> { r.setPreferred(preferred); pluginInfo.setReleaseByVersion(releaseVersion, r); if (preferred) { pluginInfo.getReleases().stream() .filter(it -> !it.getVersion().equals(r.getVersion())) .forEach(it -> it.setPreferred(false)); } repository.update(pluginInfo.getId(), pluginInfo); return r; }) .orElse(null); }
Source:
public static void registerLog4jMBeans() throws JMException { if (isLog4jJmxEnabled()) { LOG.debug("registerLog4jMBeans()"); MBeanServer mbs = MBeanRegistry.getInstance().getPlatformMBeanServer(); try { Object hdm = Class.forName("org.apache.log4j.jmx.HierarchyDynamicMBean").getDeclaredConstructor().newInstance(); ObjectName mbo = new ObjectName("log4j:hierarchy=default"); mbs.registerMBean(hdm, mbo); Object rootLogger = Class.forName("org.apache.log4j.Logger") .getMethod("getRootLogger", (Class<?>[]) null) .invoke(null, (Object[]) null); Object rootLoggerName = rootLogger.getClass() .getMethod("getName", (Class<?>[]) null) .invoke(rootLogger, (Object[]) null); hdm.getClass().getMethod("addLoggerMBean", String.class) .invoke(hdm, rootLoggerName); Object r = Class.forName("org.apache.log4j.LogManager") .getMethod("getLoggerRepository", (Class<?>[]) null) .invoke(null, (Object[]) null); Enumeration enumer = (Enumeration) r.getClass() .getMethod("getCurrentLoggers", (Class<?>[]) null) .invoke(r, (Object[]) null); while (enumer.hasMoreElements()) { Object logger = enumer.nextElement(); Object loggerName = logger.getClass() .getMethod("getName", (Class<?>[]) null) .invoke(logger, (Object[]) null); hdm.getClass().getMethod("addLoggerMBean", String.class) .invoke(hdm, loggerName); } } catch (Exception e) { LOG.error("Problems while registering log4j jmx beans!", e); throw new JMException(e.toString()); } } }

Target:
public static void registerLog4jMBeans() throws JMException { if (isLog4jJmxEnabled()) { LOG.debug("registerLog4jMBeans()"); MBeanServer mbs = MBeanRegistry.getInstance().getPlatformMBeanServer(); try { Object hdm = Class.forName("org.apache.log4j.jmx.HierarchyDynamicMBean").getConstructor().newInstance(); String mbean = System.getProperty("zookeeper.jmx.log4j.mbean", "log4j:hierarchy=default"); ObjectName mbo = new ObjectName(mbean); mbs.registerMBean(hdm, mbo); Object rootLogger = Class.forName("org.apache.log4j.Logger") .getMethod("getRootLogger", (Class<?>[]) null) .invoke(null, (Object[]) null); Object rootLoggerName = rootLogger.getClass() .getMethod("getName", (Class<?>[]) null) .invoke(rootLogger, (Object[]) null); hdm.getClass().getMethod("addLoggerMBean", String.class) .invoke(hdm, rootLoggerName); Object r = Class.forName("org.apache.log4j.LogManager") .getMethod("getLoggerRepository", (Class<?>[]) null) .invoke(null, (Object[]) null); Enumeration enumer = (Enumeration) r.getClass() .getMethod("getCurrentLoggers", (Class<?>[]) null) .invoke(r, (Object[]) null); while (enumer.hasMoreElements()) { Object logger = enumer.nextElement(); Object loggerName = logger.getClass() .getMethod("getName", (Class<?>[]) null) .invoke(logger, (Object[]) null); hdm.getClass().getMethod("addLoggerMBean", String.class) .invoke(hdm, loggerName); } } catch (Exception e) { LOG.error("Problems while registering log4j jmx beans!", e); throw new JMException(e.toString()); } } }
Source:
public void showChargesList(Page<Charges> chargesPage) { if (mApiRestCounter == 1) { chargesList = chargesPage.getPageItems(); mChargesNameListAdapter = new ChargeNameListAdapter(getActivity(), chargesList, clientId); rv_charges.setAdapter(mChargesNameListAdapter); ll_error.setVisibility(View.GONE); } else { chargesList.addAll(chargesPage.getPageItems()); mChargesNameListAdapter.notifyDataSetChanged(); if (chargesPage.getPageItems().size() == 0 && (chargesPage.getTotalFilteredRecords() == chargesList.size())) Toaster.show(rootView, getString(R.string.no_more_changes_available)); } }

Target:
public void showChargesList(Page<Charges> chargesPage) { if (mApiRestCounter == 1) { chargesList = chargesPage.getPageItems(); mChargesNameListAdapter = new ChargeNameListAdapter(getActivity(), chargesList, clientId); rv_charges.setAdapter(mChargesNameListAdapter); ll_error.setVisibility(View.GONE); } else { chargesList.addAll(chargesPage.getPageItems()); mChargesNameListAdapter.notifyDataSetChanged(); if (chargesPage.getPageItems().size() == 0 && (chargesPage.getTotalFilteredRecords() == chargesList.size())) Toaster.show(rootView, getString(R.string.no_more_charges_available)); } }
Source:
public <V> V getAttachment(Logger.AttachmentKey<V> key) { if (key == null) { throw new NullPointerException("key is null"); } synchronized (this) { if (key == attachmentKey1) return (V) attachmentValue1; if (key == attachmentKey2) return (V) attachmentValue2; } return null; }

Target:
public <V> V getAttachment(Logger.AttachmentKey<V> key) { Assert.checkNotNullParam("key", key); synchronized (this) { if (key == attachmentKey1) return (V) attachmentValue1; if (key == attachmentKey2) return (V) attachmentValue2; } return null; }
Source:
private static int msToSeconds(long millis) { return (int) (millis / 1000); }

Target:
private static long msToSeconds(long millis) { return TimeUnit.MILLISECONDS.toSeconds(millis); }
Source:
public boolean visit(final Method method) { int modifiers = method.getModifiers(); if (method.isAnnotationPresent(PostConstruct.class)) { String methodName = method.getName(); if (Modifier.isStatic(modifiers)) { LOG.info("invalid static @PostConstruct method {}.{}()", new Object[] { method.getDeclaringClass().getName(), methodName }); } else if (method.getParameterCount() > 0) { LOG.info("invalid @PostConstruct method {}.{}() with parameters", new Object[] { method.getDeclaringClass().getName(), methodName, method.getParameterCount() }); } else if (Void.TYPE != method.getReturnType()) { LOG.info("invalid @PostConstruct method {}.{}() with return type {}", new Object[] { method.getDeclaringClass().getName(), methodName, method.getReturnType().getName() }); } else { if (!visitContext.contains(methodName)) { if (!method.isAccessible()) { method.setAccessible(true); } PostConstructAction postConstructAction = new PostConstructAction(method); LOG.debug("adding lifecycle action for {}", postConstructAction.description); this.typeActions.addFirst(postConstructAction); visitContext.add(methodName); } } } return true; }

Target:
public boolean visit(final Method method) { int modifiers = method.getModifiers(); if (method.isAnnotationPresent(PostConstruct.class)) { String methodName = method.getName(); if (Modifier.isStatic(modifiers)) { LOG.info("invalid static @PostConstruct method {}.{}()", new Object[] { method.getDeclaringClass().getName(), methodName }); } else if (method.getParameterCount() > 0) { LOG.info("invalid @PostConstruct method {}.{}() with parameters", new Object[] { method.getDeclaringClass().getName(), methodName, method.getParameterCount() }); } else if (Void.TYPE != method.getReturnType()) { LOG.info("invalid @PostConstruct method {}.{}() with return type {}", new Object[] { method.getDeclaringClass().getName(), methodName, method.getReturnType().getName() }); } else { boolean hasCheckedException=false; if (method.getExceptionTypes().length > 0) { for (Class<?> e : method.getExceptionTypes()) { if (!RuntimeException.class.isAssignableFrom(e)) { LOG.info("invalid @PostConstruct method {}.{}() with checked exception type {}", new Object[] { method.getDeclaringClass().getName(), methodName, e.getName() }); hasCheckedException = true; } } } if (!hasCheckedException && !visitContext.contains(methodName)) { if (!method.isAccessible()) { method.setAccessible(true); } PostConstructAction postConstructAction = new PostConstructAction(method); LOG.debug("adding lifecycle action for {}", postConstructAction.description); this.typeActions.addFirst(postConstructAction); visitContext.add(methodName); } } } return true; }
Source:
public Repository open(HttpServletRequest req, String name) throws RepositoryNotFoundException, ServiceNotEnabledException { if (!name.equals(repoName)) throw new RepositoryNotFoundException(name); final Repository db = repo.getRepository(); db.incrementOpen(); return db; }

Target:
public Repository open(HttpServletRequest req, String name) throws RepositoryNotFoundException, ServiceNotEnabledException { if (!name.equals(repoName)) throw new RepositoryNotFoundException(name); Repository db = repo.getRepository(); db.incrementOpen(); return db; }
Source:
public void testWriteOrdering() throws Exception { WriteBehindTestLoaderWriter<String, String> loaderWriter = new WriteBehindTestLoaderWriter<String, String>(); CacheLoaderWriterProvider cacheLoaderWriterProvider = mock(CacheLoaderWriterProvider.class); when(cacheLoaderWriterProvider.createCacheLoaderWriter(anyString(), (CacheConfiguration<String, String>)anyObject())).thenReturn((CacheLoaderWriter)loaderWriter); CacheManager cacheManager = newCacheManagerBuilder().using(cacheLoaderWriterProvider).build(true); try { Cache<String, String> testCache = cacheManager.createCache("testWriteOrdering", configurationBuilder() .add(newWriteBehindConfiguration().queueSize(10).batchSize(10).delay(1, 2).build()) .buildConfig(String.class, String.class)); CountDownLatch countDownLatch = new CountDownLatch(8); loaderWriter.setLatch(countDownLatch); testCache.remove("key"); testCache.put("key", "value1"); testCache.remove("key"); testCache.put("key", "value2"); testCache.remove("key"); testCache.put("key", "value3"); testCache.remove("key"); testCache.put("key", "value4"); countDownLatch.await(4, TimeUnit.SECONDS); assertThat(loaderWriter.getData().get("key"), contains(null, "value1", null, "value2", null, "value3", null, "value4")); } finally { cacheManager.close(); } }

Target:
public void testWriteOrdering() throws Exception { WriteBehindTestLoaderWriter<String, String> loaderWriter = new WriteBehindTestLoaderWriter<String, String>(); CacheLoaderWriterProvider cacheLoaderWriterProvider = mock(CacheLoaderWriterProvider.class); when(cacheLoaderWriterProvider.createCacheLoaderWriter(anyString(), (CacheConfiguration<String, String>)anyObject())).thenReturn((CacheLoaderWriter)loaderWriter); CacheManager cacheManager = newCacheManagerBuilder().using(cacheLoaderWriterProvider).build(true); try { Cache<String, String> testCache = cacheManager.createCache("testWriteOrdering", configurationBuilder() .add(newWriteBehindConfiguration().batchSize(8).build()) .buildConfig(String.class, String.class)); CountDownLatch countDownLatch = new CountDownLatch(8); loaderWriter.setLatch(countDownLatch); testCache.remove("key"); testCache.put("key", "value1"); testCache.remove("key"); testCache.put("key", "value2"); testCache.remove("key"); testCache.put("key", "value3"); testCache.remove("key"); testCache.put("key", "value4"); countDownLatch.await(4, TimeUnit.SECONDS); assertThat(loaderWriter.getData().get("key"), contains(null, "value1", null, "value2", null, "value3", null, "value4")); } finally { cacheManager.close(); } }
Source:
public void initialize() { Configuration configuration = getConfig(); if (configuration.get("udn") != null) { logger.debug("Initializing WemoHandler for UDN '{}'", configuration.get("udn")); if (service.isRegistered(this)) { logger.debug("Setting up UPnP status Listener for '{}'", this); service.addStatusListener(this, "basicevent1", "GetBinaryState", 60); } super.initialize(); } else { logger.debug("Cannot initalize WemoHandler. UDN not set."); } }

Target:
public void initialize() { Configuration configuration = getConfig(); if (configuration.get("udn") != null) { logger.debug("Initializing WemoHandler for UDN '{}'", configuration.get("udn")); onSubscription(); onUpdate(); super.initialize(); } else { logger.debug("Cannot initalize WemoHandler. UDN not set."); } }
Source:
private void checkLoopbackHost(HttpUrl url) { try { for (InetAddress addr : InetAddress.getAllByName(url.host())) { if (!addr.isLoopbackAddress()) { throw new IllegalArgumentException(url.host() + " is not loopback only host"); } } } catch (UnknownHostException e) { throw new IllegalStateException("Host in " + url + " is not loopback address"); } }

Target:
private void checkLoopbackHost(HttpUrl url) { try { for (InetAddress addr : InetAddress.getAllByName(url.host())) { if (!addr.isLoopbackAddress()) { throw new ProviderException(url.host() + " is not loopback only host"); } } } catch (UnknownHostException e) { throw new ProviderException("Host in " + url + " is not loopback address"); } }
Source:
public void testMissingParameterWithVarArgs() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class ArrayTest {\n"); buf.append(" public void test(String a, String...b){\n"); buf.append(" a.concat(c);\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("ArrayTest.java", buf.toString(), false, null); CompilationUnit astRoot= getASTRoot(cu); ArrayList<IJavaCompletionProposal> proposals= collectCorrections(cu, astRoot); assertCorrectLabels(proposals); assertNumberOfProposals(proposals, 5); String[] expected= new String[1]; buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class ArrayTest {\n"); buf.append(" public void test(String a, String c, String...b){\n"); buf.append(" a.concat(c);\n"); buf.append(" }\n"); buf.append("}\n"); expected[0]= buf.toString(); assertExpectedExistInProposals(proposals, expected); }

Target:
public void testMissingParameterWithVarArgs() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); StringBuffer buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class ArrayTest {\n"); buf.append(" public void test(String a, String...b){\n"); buf.append(" a.concat(c);\n"); buf.append(" }\n"); buf.append("}\n"); ICompilationUnit cu= pack1.createCompilationUnit("ArrayTest.java", buf.toString(), false, null); CompilationUnit astRoot= getASTRoot(cu); ArrayList<IJavaCompletionProposal> proposals= collectCorrections(cu, astRoot); assertCorrectLabels(proposals); String[] expected= new String[1]; buf= new StringBuffer(); buf.append("package test1;\n"); buf.append("public class ArrayTest {\n"); buf.append(" public void test(String a, String c, String...b){\n"); buf.append(" a.concat(c);\n"); buf.append(" }\n"); buf.append("}\n"); expected[0]= buf.toString(); assertExpectedExistInProposals(proposals, expected); }
Source:
public HAProxyMessage touch(Object hint) { tryRecord(); return this; }

Target:
public HAProxyMessage touch(Object hint) { if (leak != null) { leak.record(hint); } return this; }
Source:
public boolean teleportToSpawn() { Location target = server.getWorlds().get(0).getSpawnLocation(); EntityPortalEvent event = EventFactory.callEvent(new EntityPortalEvent(this, location.clone(), target, null)); if (event.isCancelled()) { return false; } target = event.getTo(); teleport(target); return true; }

Target:
protected boolean teleportToSpawn() { Location target = server.getWorlds().get(0).getSpawnLocation(); EntityPortalEvent event = EventFactory.callEvent(new EntityPortalEvent(this, location.clone(), target, null)); if (event.isCancelled()) { return false; } target = event.getTo(); teleport(target); return true; }
Source:
public ActionResponseDto execute(final ClientConnection conn, final DlmsDevice device, final FindEventsQueryDto findEventsQuery) { List<EventDto> eventDtoList; try { eventDtoList = this.retrieveEventsCommandExecutor.execute(conn, device, findEventsQuery); } catch (final ProtocolAdapterException e) { LOGGER.error("Error while retrieving " + findEventsQuery.getEventLogCategory() + "events from device: " + device.getDeviceIdentification(), e); return new ActionResponseDto(e, "Error while retrieving " + findEventsQuery.getEventLogCategory() + "events from device: " + device.getDeviceIdentification()); } return new EventMessageDataContainerDto(eventDtoList); }

Target:
public ActionResponseDto execute(final ClientConnection conn, final DlmsDevice device, final FindEventsQueryDto findEventsQuery) { try { return new EventMessageDataContainerDto(this.retrieveEventsCommandExecutor.execute(conn, device, findEventsQuery)); } catch (final ProtocolAdapterException e) { LOGGER.error("Error while retrieving " + findEventsQuery.getEventLogCategory() + "events from device: " + device.getDeviceIdentification(), e); return new ActionResponseDto(e, "Error while retrieving " + findEventsQuery.getEventLogCategory() + "events from device: " + device.getDeviceIdentification()); } }
Source:
private HostVO getHost(SnapshotInfo snapshotInfo) { HostVO hostVO = getHost(snapshotInfo.getDataCenterId(), true); if (hostVO == null) { hostVO = getHost(snapshotInfo.getDataCenterId(), false); if (hostVO == null) { throw new CloudRuntimeException("Unable to locate an applicable host"); } } return hostVO; }

Target:
private HostVO getHost(SnapshotInfo snapshotInfo) { HostVO hostVO = getHost(snapshotInfo.getDataCenterId(), true); if (hostVO == null) { hostVO = getHost(snapshotInfo.getDataCenterId(), false); if (hostVO == null) { throw new CloudRuntimeException("Unable to locate an applicable host in data center with ID = " + snapshotInfo.getDataCenterId()); } } return hostVO; }
Source:
public Map<ShortBranchIssue, DefaultIssue> loadDefaultIssuesWithChanges(Collection<ShortBranchIssue> lightIssues) { if (lightIssues.isEmpty()) { return Collections.emptyMap(); } Map<String, ShortBranchIssue> issuesByKey = lightIssues.stream().collect(Collectors.toMap(ShortBranchIssue::getKey, i -> i)); try (DbSession session = dbClient.openSession(false)) { Map<String, List<IssueChangeDto>> changeDtoByIssueKey = dbClient.issueChangeDao() .selectByIssueKeys(session, issuesByKey.keySet()).stream().collect(groupingBy(IssueChangeDto::getIssueKey)); return dbClient.issueDao().selectByKeys(session, issuesByKey.keySet()) .stream() .map(IssueDto::toDefaultIssue) .map(i -> setChanges(changeDtoByIssueKey, i)) .collect(Collectors.toMap(i -> issuesByKey.get(i.key()), i -> i)); } }

Target:
public Map<ShortBranchIssue, DefaultIssue> loadDefaultIssuesWithChanges(Collection<ShortBranchIssue> lightIssues) { if (lightIssues.isEmpty()) { return Collections.emptyMap(); } Map<String, ShortBranchIssue> issuesByKey = lightIssues.stream().collect(Collectors.toMap(ShortBranchIssue::getKey, i -> i)); try (DbSession session = dbClient.openSession(false)) { Map<String, List<IssueChangeDto>> changeDtoByIssueKey = dbClient.issueChangeDao() .selectByIssueKeys(session, issuesByKey.keySet()).stream().collect(groupingBy(IssueChangeDto::getIssueKey)); return dbClient.issueDao().selectByKeys(session, issuesByKey.keySet()) .stream() .map(IssueDto::toDefaultIssue) .peek(i -> ComponentIssuesLoader.setChanges(changeDtoByIssueKey, i)) .collect(toMap(i -> issuesByKey.get(i.key()), i -> i)); } }
Source:
private void onRemove() { AsyncDataProvider.getInstance().getDataCentersByStorageDomain(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { TemplateBackupModel templateBackupModel = (TemplateBackupModel) model; ArrayList<StoragePool> pools = (ArrayList<StoragePool>) returnValue; if (pools != null && pools.size() > 0) { StoragePool pool = pools.get(0); getVmsFromExportDomain(pool.getId(), getEntity().getId()); } } }), getEntity().getId()); cancel(); }

Target:
private void onRemove() { cancel(); AsyncDataProvider.getInstance().getDataCentersByStorageDomain(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { TemplateBackupModel templateBackupModel = (TemplateBackupModel) model; ArrayList<StoragePool> pools = (ArrayList<StoragePool>) returnValue; if (pools != null && pools.size() > 0) { pool = pools.get(0); getVmsFromExportDomain(pool.getId(), getEntity().getId()); } } }), getEntity().getId()); }
Source:
public void testLeaderDiesAndNewLeaderIsElected() { ICluster seed = Cluster.joinAwait(); LeaderElection seedLeader = createLeaderElection(seed); List<LeaderElection> leaders = createCluster(seed); awaitSeconds(30); killTheLeader(leaders,seedLeader.leader()); awaitSeconds(30); Address newLeader = seedLeader.leader(); for (LeaderElection m : leaders) { Address memberLeaderAddress = m.leader(); assertTrue("Expected leader address " + newLeader + ", but actual: " + memberLeaderAddress, memberLeaderAddress.equals(newLeader)); } for (LeaderElection m : leaders) { m.cluster().shutdown(); } seed.shutdown(); }

Target:
public void testLeaderDiesAndNewLeaderIsElected() { ICluster seed = Cluster.joinAwait(); LeaderElection seedLeader = createLeaderElection(seed); Queue<LeaderElection> leaders = createCluster(seed, NUM_OF_NODES); awaitSeconds(3); killTheLeader(leaders, seedLeader.leader()); awaitSeconds(3); Member newLeader = leaders.peek().leader(); for (LeaderElection m : leaders) { Address memberLeaderAddress = m.leader().address(); assertTrue("Expected leader address " + newLeader.address() + ", but actual: " + memberLeaderAddress, memberLeaderAddress.equals(newLeader.address())); } teardownCluster(seed, leaders); }
Source:
public static void validateNonNegative(int[] data, String paramName){ boolean nonnegative = true; for(int value : data){ if(value < 0) { nonnegative = false; } } Preconditions.checkArgument(nonnegative, "Values for %s must be >= 0, got: %s", paramName, data); }

Target:
public static void validateNonNegative(int[] data, String paramName){ if(data == null) { return; } boolean nonnegative = true; for(int value : data){ if(value < 0) { nonnegative = false; } } Preconditions.checkArgument(nonnegative, "Values for %s must be >= 0, got: %s", paramName, data); }
Source:
public Path generateArtifact(PypiArtifactCoordinates coordinates, long byteSize) throws IOException { String packagePath = coordinates.toPath(); Path fullPath = basedir.resolve(packagePath); new File(fullPath.getParent().toString()).mkdirs(); Path path = Paths.get(fullPath.toString()); OutputStream outputStream = Files.newOutputStream(path, CREATE); try(ZipOutputStream zos = new ZipOutputStream(outputStream)) { if (coordinates.isSourcePackage()) { createSourcePackageFiles(zos, coordinates.getId(), coordinates.getVersion(), byteSize); } else { createWheelPackageFiles(zos, coordinates.getId(), coordinates.getVersion(), byteSize); } } return path; }

Target:
public Path generateArtifact(PypiArtifactCoordinates coordinates, long byteSize) throws IOException { String packagePath = coordinates.toPath(); Path fullPath = basedir.resolve(packagePath); Path fullPathParent = fullPath.getParent(); Files.createDirectories(fullPathParent); OutputStream outputStream = Files.newOutputStream(fullPath, CREATE); try(ZipOutputStream zos = new ZipOutputStream(outputStream)) { if (coordinates.isSourcePackage()) { createSourcePackageFiles(zos, coordinates.getId(), coordinates.getVersion(), byteSize); } else { createWheelPackageFiles(zos, coordinates.getId(), coordinates.getVersion(), byteSize); } } return fullPath; }
Source:
public ITmfTimestamp getCurrentTime() { return getCurrentTraceContext().getTimestamp(); }

Target:
public synchronized ITmfTimestamp getCurrentTime() { return getCurrentTraceContext().getTimestamp(); }
Source:
private String getUrl(Object eventData) { if (eventData == null) { return null; } if (eventData == null || !(eventData instanceof String)) { return null; } String[] dataLines = ((String) eventData) .split(System.getProperty("line.separator")); String url = dataLines[0]; return url; }

Target:
private String getUrl(Object eventData) { if (!(eventData instanceof String)) { return null; } String[] dataLines = ((String) eventData) .split(System.getProperty("line.separator")); String url = dataLines[0]; return url; }
Source:
public void cursorError1(SQLiteDatabase db, long route_id) { Cursor cursor = db.query("TABLE_TRIPS", new String[]{ "KEY_TRIP_ID" }, "ROUTE_ID=?", new String[]{Long.toString(route_id)}, null, null, null); cursor.close(); }

Target:
public void cursorError1(SQLiteDatabase db, long route_id) { Cursor cursor = db.query("TABLE_TRIPS", new String[]{ "KEY_TRIP_ID" }, "ROUTE_ID=?", new String[]{Long.toString(route_id)}, null, null, null); if (cursor != null) { cursor.close(); } }
Source:
private void getRevisions() { gitService.log(workspaceId, project, Collections.singletonList(selectedFile), false, new AsyncRequestCallback<LogResponse>(dtoUnmarshallerFactory.newUnmarshaller(LogResponse.class)) { @Override protected void onSuccess(LogResponse result) { view.setRevisions(result.getCommits()); view.showDialog(); } @Override protected void onFailure(Throwable exception) { notificationManager.notify(exception.getMessage(), FAIL, false); } }); }

Target:
private void getRevisions() { gitService.log(workspaceId, project, Collections.singletonList(selectedFile), false, new AsyncRequestCallback<LogResponse>(dtoUnmarshallerFactory.newUnmarshaller(LogResponse.class)) { @Override protected void onSuccess(LogResponse result) { view.setRevisions(result.getCommits()); view.showDialog(); } @Override protected void onFailure(Throwable exception) { notificationManager.notify(locale.logFailed(), FAIL, false); } }); }
Source:
public void setUp() throws Exception { serverToClientReadyLatch = new CountDownLatch(1); messagesReceivedByFafServer = new ArrayBlockingQueue<>(10); startFakeFafLobbyServer(); final Server server = mock(Server.class); when(server.getHost()).thenReturn(LOOPBACK_ADDRESS.getHostAddress()); when(server.getPort()).thenReturn(fafLobbyServerSocket.getLocalPort()); when(clientProperties.getServer()).thenReturn(server); instance = new FafServerAccessorImpl(preferencesService, uidService, notificationService, i18n, reportingService, clientProperties); instance.afterPropertiesSet(); LoginPrefs loginPrefs = new LoginPrefs(); loginPrefs.setUsername("junit"); loginPrefs.setPassword("password"); when(preferencesService.getFafDataDirectory()).thenReturn(faDirectory.getRoot().toPath()); when(uidService.generate(any(), any())).thenReturn("encrypteduidstring"); }

Target:
public void setUp() throws Exception { serverToClientReadyLatch = new CountDownLatch(1); messagesReceivedByFafServer = new ArrayBlockingQueue<>(10); startFakeFafLobbyServer(); ClientProperties clientProperties = new ClientProperties(); clientProperties.getServer() .setHost(LOOPBACK_ADDRESS.getHostAddress()) .setPort(fafLobbyServerSocket.getLocalPort()); instance = new FafServerAccessorImpl(preferencesService, uidService, notificationService, i18n, reportingService, clientProperties); instance.afterPropertiesSet(); LoginPrefs loginPrefs = new LoginPrefs(); loginPrefs.setUsername("junit"); loginPrefs.setPassword("password"); when(preferencesService.getFafDataDirectory()).thenReturn(faDirectory.getRoot().toPath()); when(uidService.generate(any(), any())).thenReturn("encrypteduidstring"); }
Source:
protected File createAllowedTargetDirectory() throws IOException { File directory = File.createTempFile("target", "", new File("/tmp")); directory.delete(); directory.mkdirs(); return directory; }

Target:
protected File createAllowedTargetDirectory() throws IOException { File directory = File.createTempFile("target", "", FileUtils.getTempDirectory().getParentFile().getParentFile()); directory.delete(); directory.mkdirs(); return directory; }
Source:
public void execute(SensorContext context) { BiConsumer<Exception, InputFile> parsingExceptionHandler = parsingExceptionHandler(context); for (InputFile inputFile : fileSystem.inputFiles(mainFilesPredicate)) { XmlFile xmlFile = new XmlFile(inputFile, fileSystem); try { NewXmlFile newXmlFile = NewXmlFile.create(inputFile); LineCounter.analyse(context, fileLinesContextFactory, newXmlFile); runChecks(context, xmlFile, newXmlFile); } catch (Exception e) { processParseException(e, context, inputFile, parsingExceptionHandler); } } }

Target:
public void execute(SensorContext context) { for (InputFile inputFile : fileSystem.inputFiles(mainFilesPredicate)) { XmlFile xmlFile = new XmlFile(inputFile, fileSystem); try { NewXmlFile newXmlFile = NewXmlFile.create(inputFile); LineCounter.analyse(context, fileLinesContextFactory, newXmlFile); runChecks(context, xmlFile, newXmlFile); saveSyntaxHighlighting(context, XMLHighlighting.highlight(newXmlFile), inputFile); } catch (Exception e) { processParseException(e, context, inputFile); } } }
Source:
public void initFromPage(int valueCount, ByteBuffer in, int offset) throws IOException { if (DEBUG) LOG.debug("init from page at offset "+ offset + " for length " + (in.limit() - offset)); this.in = new LittleEndianDataInputStream(new ByteBufferInputStream(in.duplicate(), offset, in.limit() - offset)); }

Target:
public void initFromPage(int valueCount, ByteBuffer in, int offset) throws IOException { if (DEBUG) LOG.debug("init from page at offset "+ offset + " for length " + (in.limit() - offset)); this.in = new LittleEndianDataInputStream(toInputStream(in, offset)); }
Source:
public void tessellateAllExcept(Tessellator tessellator, String... excludedGroupNames) { for (GroupObject groupObject : groupObjects) { for (String excludedGroupName : excludedGroupNames) { if (!excludedGroupName.equalsIgnoreCase(groupObject.name)) { groupObject.render(tessellator); } } } }

Target:
public void tessellateAllExcept(Tessellator tessellator, String... excludedGroupNames) { boolean exclude; for (GroupObject groupObject : groupObjects) { exclude=false; for (String excludedGroupName : excludedGroupNames) { if (excludedGroupName.equalsIgnoreCase(groupObject.name)) { exclude=true; } } if(!exclude) { groupObject.render(tessellator); } } }
Source:
public void testPoolOfGivenGuidExist() { final MacPoolPerDc pool = new MacPoolPerDc(); mockStoragePools(storagePool); mockGettingAllMacPools(macPool); pool.initialize(); assertThat(pool.getMacPoolId(storagePool.getId()), is(notNullValue())); assertThat(pool.poolForDataCenter(storagePool.getId()), is(notNullValue())); }

Target:
public void testPoolOfGivenGuidExist() { final MacPoolPerDc pool = new MacPoolPerDc(); mockStoragePool(storagePool); mockGettingAllMacPools(macPool); pool.initialize(); assertThat(pool.poolForDataCenter(storagePool.getId()), is(notNullValue())); }
Source:
protected Observable<Integer> getSenderObservable(TagList tags, Metric[] batch) { JsonPayload payload = new UpdateRequest(tags, batch, batch.length); if (shouldDumpPayload()) { try { String name = getPayloadFilename(); File out = new File(getPayloadDirectory(), name); JsonGenerator generator = factory.createGenerator(out, JsonEncoding.UTF8); payload.toJson(generator); } catch (Exception ex) { LOGGER.debug("Ignoring error writing payload sent to atlas: {}", ex.getMessage()); } } return httpHelper.postSmile(config.getAtlasUri(), payload) .map(withBookkeeping(batch.length)); }

Target:
protected Observable<Integer> getSenderObservable(TagList tags, Metric[] batch) { JsonPayload payload = new UpdateRequest(tags, batch, batch.length); if (shouldDumpPayload()) { String name = getPayloadFilename(); File out = new File(getPayloadDirectory(), name); dumpPayload(out, payload); } return httpHelper.postSmile(config.getAtlasUri(), payload) .map(withBookkeeping(batch.length)); }
Source:
public Class<?> lookupDefinedClass(String name) { return defined.get(name.replace('/', '.')); }

Target:
public Class<?> lookupDefinedClass(String name) { return defined.get(StringUtils.slashesToPeriod(name)); }
Source:
public double getFlySpeed() { return flySpeed; }

Target:
public double getFlySpeed() { return this.flySpeed; }
Source:
public void split(TableName tableName, byte[] bytes) throws IOException { LOG.info("split is a no-op"); }

Target:
public void split(TableName tableName, byte[] bytes) throws IOException { throw new UnsupportedOperationException("split"); }
Source:
public void whenRemoveThenDeleteFromDatabase() throws Exception { EventType eventType = buildEventType(); String insertSQL = "INSERT INTO zn_data.event_type (et_name, et_event_type_object) VALUES (?, to_json(?::json))"; template.update(insertSQL, eventType.getName(), mapper.writer().writeValueAsString(eventType)); repository.removeEventType(eventType.getName()); final int rows = template.queryForObject("SELECT count(*) FROM zn_data.event_type", Integer.class); assertThat("Number of rows should encrease", rows, equalTo(0)); }

Target:
public void whenRemoveThenDeleteFromDatabase() throws Exception { EventType eventType = buildEventType(); insertEventType(eventType); repository.removeEventType(eventType.getName()); final int rows = template.queryForObject("SELECT count(*) FROM zn_data.event_type", Integer.class); assertThat("Number of rows should encrease", rows, equalTo(0)); }
Source:
public void close() { if (!isShutDown) { executor.shutdownNow(); wakeIndefiniteBlockers(); callOnClose.run(); } isShutDown = true; }

Target:
public void close() { if (isShutDown.compareAndSet(false, true)) { executor.shutdownNow(); wakeIndefiniteBlockers(); callOnClose.run(); } }
Source:
private static String replaceChipset(String emulatedMachine, ChipsetType chipsetType) { if (chipsetType != ChipsetType.Q35) { return emulatedMachine; } if (emulatedMachine.contains("i440fx")) { return emulatedMachine.replace("i440fx", "q35"); } return emulatedMachine.replace("pc-", "pc-q35-"); }

Target:
private static String replaceChipset(String emulatedMachine, ChipsetType chipsetType) { if (chipsetType != ChipsetType.Q35) { return emulatedMachine; } final String I440FX_CHIPSET_NAME = ChipsetType.I440FX.getChipsetName(); final String Q35_CHIPSET_NAME = ChipsetType.Q35.getChipsetName(); if (emulatedMachine.contains(I440FX_CHIPSET_NAME)) { return emulatedMachine.replace(I440FX_CHIPSET_NAME, Q35_CHIPSET_NAME); } return emulatedMachine.replace("pc-", "pc-" + Q35_CHIPSET_NAME + '-'); }
Source:
protected DestroyImageParameters buildDestroyImageParameters(Guid imageGroupId, List<Guid> imageList) { StorageDomain storageDomain = storageDomainDao.get(getParameters().getStorageDomainId()); DestroyImageParameters parameters = new DestroyImageParameters( getVdsId(), getVmId(), getParameters().getStoragePoolId(), storageDomain.getId(), imageGroupId, imageList, storageDomain.getWipeAfterDelete(), false); parameters.setEndProcedure(ActionParametersBase.EndProcedure.COMMAND_MANAGED); parameters.setParentParameters(getParameters()); return parameters; }

Target:
protected DestroyImageParameters buildDestroyImageParameters(Guid imageGroupId, List<Guid> imageList) { StorageDomain storageDomain = getStorageDomain(); DestroyImageParameters parameters = new DestroyImageParameters( getVdsId(), getVmId(), getParameters().getStoragePoolId(), storageDomain.getId(), imageGroupId, imageList, storageDomain.getWipeAfterDelete(), false); parameters.setEndProcedure(ActionParametersBase.EndProcedure.COMMAND_MANAGED); parameters.setParentParameters(getParameters()); return parameters; }
Source:
public void testGetJsonString() throws Exception { StudentProfileAttributes spa = StudentProfileAttributes.valueOf(profile.toEntity()); spa.modifiedDate = TimeHelper.convertToDate("2015-05-21 8:34 AM UTC"); assertEquals("{\n \"googleId\": \"valid.googleId\",\n \"shortName\": \"shor\"," + "\n \"email\": \"valid@email.com\",\n \"institute\": \"institute\"," + "\n \"nationality\": \"Lebanese\",\n \"gender\": \"OTHER\"," + "\n \"moreInfo\": \"moreInfo can have a lot more than this...\"," + "\n \"pictureKey\": \"profile Pic Key\"," + "\n \"modifiedDate\": \"2015-05-21 8:34 AM +0000\"\n}", spa.getJsonString()); }

Target:
public void testGetJsonString() throws Exception { StudentProfileAttributes spa = StudentProfileAttributes.valueOf(profile.toEntity()); spa.modifiedDate = TimeHelper.convertToDate("2015-05-21 8:34 AM UTC"); assertEquals("{\n \"googleId\": \"valid.googleId\",\n \"shortName\": \"shor\"," + "\n \"email\": \"valid@email.com\",\n \"institute\": \"institute\"," + "\n \"nationality\": \"Lebanese\",\n \"gender\": \"female\"," + "\n \"moreInfo\": \"moreInfo can have a lot more than this...\"," + "\n \"pictureKey\": \"profile Pic Key\"," + "\n \"modifiedDate\": \"2015-05-21 8:34 AM +0000\"\n}", spa.getJsonString()); }