auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; HostCriteria other = (HostCriteria) obj; if (m_bare != other.m_bare) return false; if (m_configHash == null) { if (other.m_configHash != null) return false; } else if (!m_configHash.equals(other.m_configHash)) return false; if (m_enterprise != other.m_enterprise) return false; if (m_addAllowed != other.m_addAllowed) return false; if (m_safeMode != other.m_safeMode) return false; if (m_hostCount != other.m_hostCount) return false; if (m_meshHash == null) { if (other.m_meshHash != null) return false; } else if (!m_meshHash.equals(other.m_meshHash)) return false; if (m_terminusNonce == null) { if (other.m_terminusNonce != null) return false; } else if (!m_terminusNonce.equals(other.m_terminusNonce)) return false; if (m_paused != other.m_paused) return false; if (m_startAction != other.m_startAction) return false; if (m_nodeState != other.m_nodeState) return false; if ((m_startupCatalogHash == null) ^ (other.m_startupCatalogHash == null)){ return false; } if ((m_startupCatalogHash != null) && !m_startupCatalogHash.equals(other.m_startupCatalogHash)){ return false; } return true; }

Target:
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; HostCriteria other = (HostCriteria) obj; if (m_bare != other.m_bare) return false; if (m_configHash == null) { if (other.m_configHash != null) return false; } else if (!m_configHash.equals(other.m_configHash)) return false; if (m_enterprise != other.m_enterprise) return false; if (m_addAllowed != other.m_addAllowed) return false; if (m_safeMode != other.m_safeMode) return false; if (m_hostCount != other.m_hostCount) return false; if (m_meshHash == null) { if (other.m_meshHash != null) return false; } else if (!m_meshHash.equals(other.m_meshHash)) return false; if (m_terminusNonce == null) { if (other.m_terminusNonce != null) return false; } else if (!m_terminusNonce.equals(other.m_terminusNonce)) return false; if (m_paused != other.m_paused) return false; if (m_startAction != other.m_startAction) return false; if (m_nodeState != other.m_nodeState) return false; return true; }
Source:
public CompletableFuture<Long> append(ByteBuf data) { data.retain(); SyncAddCallback callback = new SyncAddCallback(); PendingAddOp op = new PendingAddOp(LedgerHandle.this, callback, null); doAsyncAddEntry(op, data, callback, null); return callback; }

Target:
public CompletableFuture<Long> append(ByteBuf data) { SyncAddCallback callback = new SyncAddCallback(); asyncAddEntry(data, callback, null); return callback; }
Source:
public void dispose() { logger.debug("Handler disposes. Unregistering listener."); if (lightId != null) { HueBridgeHandler bridgeHandler = getHueBridgeHandler(); if (bridgeHandler != null) { this.bridgeHandler.unregisterLightStatusListener(this); this.bridgeHandler = null; } lightId = null; } }

Target:
public void dispose() { logger.debug("Handler disposes. Unregistering listener."); if (lightId != null) { HueBridgeHandler bridgeHandler = getHueBridgeHandler(); if (bridgeHandler != null) { bridgeHandler.unregisterLightStatusListener(this); this.bridgeHandler = null; } lightId = null; } }
Source:
public static SELinux map(VDS entity, SELinux template) { SELinux model = template != null ? template : new SELinux(); if (entity.getSELinuxEnforceMode() == null) { return model; } model.setMode(entity.getSELinuxEnforceMode().toString().toLowerCase()); return model; }

Target:
public static SELinux map(VDS entity, SELinux template) { SELinux model = template != null ? template : new SELinux(); if (entity.getSELinuxEnforceMode() == null) { return model; } String mode = null; switch (entity.getSELinuxEnforceMode()) { case DISABLED: mode = SELinuxMode.DISABLED.value(); break; case PERMISSIVE: mode = SELinuxMode.PERMISSIVE.value(); break; case ENFORCING: mode = SELinuxMode.ENFORCING.value(); } model.setMode(mode); return model; }
Source:
private void checkCanModify() { if (isConstant) { MekanismAPI.logger.warn("TRIED TO MODIFY A CONSTANT FLOATING LONG"); } }

Target:
private void checkCanModify() { if (isConstant) { throw new IllegalStateException("Tried to modify a floating constant long"); } }
Source:
public void activate() { logger.info("LgTv servlet activate called"); try { bundleContext = FrameworkUtil.getBundle(this.getClass()).getBundleContext(); if (bundleContext != null) { ServiceReference<?> serviceReference1 = bundleContext .getServiceReference(LgtvBindingProvider.class.getName()); if (serviceReference1 != null) { bindingprovider = (LgtvBindingProvider) bundleContext.getService(serviceReference1); } else { logger.warn("Unable to get service reference from LgTv binding provider class"); } ServiceReference<?> serviceReference2 = bundleContext.getServiceReference(ItemRegistry.class.getName()); if (serviceReference2 != null) { itemregistry = (ItemRegistry) bundleContext.getService(serviceReference2); } else { logger.warn("Unable to get service reference from ItemRegistry class"); } } else { logger.warn("bundleContext is null. Unable to get binding provider or item registry."); } Hashtable<String, String> props = new Hashtable<String, String>(); httpService.registerServlet(WEBAPP_ALIAS + SERVLET_NAME, this, props, createHttpContext()); logger.info("Started LgTv Servlet at {}", WEBAPP_ALIAS, SERVLET_NAME); } catch (NamespaceException e) { logger.warn("NamespaceException occurred during servlet startup", e); } catch (ServletException e) { logger.warn("ServletException occurred during servlet startup", e); } catch (Exception e) { logger.warn("Unexpected exception occurred during servlet startup", e); } }

Target:
public void activate() { logger.debug("LgTv servlet activate called"); try { bundleContext = FrameworkUtil.getBundle(this.getClass()).getBundleContext(); if (bundleContext != null) { ServiceReference<?> serviceReference1 = bundleContext .getServiceReference(LgtvBindingProvider.class.getName()); if (serviceReference1 != null) { bindingprovider = (LgtvBindingProvider) bundleContext.getService(serviceReference1); } else { logger.warn("Unable to get service reference from LgTv binding provider class"); } ServiceReference<?> serviceReference2 = bundleContext.getServiceReference(ItemRegistry.class.getName()); if (serviceReference2 != null) { itemregistry = (ItemRegistry) bundleContext.getService(serviceReference2); } else { logger.warn("Unable to get service reference from ItemRegistry class"); } } else { logger.warn("bundleContext is null. Unable to get binding provider or item registry."); } Hashtable<String, String> props = new Hashtable<String, String>(); httpService.registerServlet(WEBAPP_ALIAS + SERVLET_NAME, this, props, createHttpContext()); logger.info("Started LgTv Servlet at {}{}", WEBAPP_ALIAS, SERVLET_NAME); } catch (NamespaceException e) { logger.warn("NamespaceException occurred during servlet startup", e); } catch (ServletException e) { logger.warn("ServletException occurred during servlet startup", e); } catch (Exception e) { logger.warn("Unexpected exception occurred during servlet startup", e); } }
Source:
public void init( FilterConfig filterConfig ) throws ServletException { super.init(filterConfig); cookieName = filterConfig.getInitParameter(SSO_COOKIE_NAME); if (cookieName == null) { cookieName = DEFAULT_SSO_COOKIE_NAME; } String expectedAudiences = filterConfig.getInitParameter(SSO_EXPECTED_AUDIENCES); if (expectedAudiences != null) { audiences = parseExpectedAudiences(expectedAudiences); } authenticationProviderUrl = filterConfig.getInitParameter(SSO_AUTHENTICATION_PROVIDER_URL); if (authenticationProviderUrl == null) { LOGGER.missingAuthenticationProviderUrlConfiguration(); } String verificationPEM = filterConfig.getInitParameter(SSO_VERIFICATION_PEM); if (verificationPEM != null) { publicKey = CertificateUtils.parseRSAPublicKey(verificationPEM); } String unAuthPathString = filterConfig.getInitParameter(SSO_UNAUTHENTICATED_PATHS_PARAM); if (StringUtils.isBlank(unAuthPathString)) { unAuthPathString = DEFAULT_SSO_UNAUTHENTICATED_PATHS_PARAM; } final StringTokenizer st = new StringTokenizer(unAuthPathString, ";"); while (st.hasMoreTokens()) { unAuthenticatedPaths.add(st.nextToken()); } setGatewayPath(filterConfig); configureExpectedParameters(filterConfig); }

Target:
public void init( FilterConfig filterConfig ) throws ServletException { super.init(filterConfig); cookieName = filterConfig.getInitParameter(SSO_COOKIE_NAME); if (cookieName == null) { cookieName = DEFAULT_SSO_COOKIE_NAME; } String expectedAudiences = filterConfig.getInitParameter(SSO_EXPECTED_AUDIENCES); if (expectedAudiences != null) { audiences = parseExpectedAudiences(expectedAudiences); } authenticationProviderUrl = filterConfig.getInitParameter(SSO_AUTHENTICATION_PROVIDER_URL); if (authenticationProviderUrl == null) { LOGGER.missingAuthenticationProviderUrlConfiguration(); } String verificationPEM = filterConfig.getInitParameter(SSO_VERIFICATION_PEM); if (verificationPEM != null) { publicKey = CertificateUtils.parseRSAPublicKey(verificationPEM); } String unAuthPathString = filterConfig.getInitParameter(SSO_UNAUTHENTICATED_PATHS_PARAM); if (StringUtils.isBlank(unAuthPathString)) { unAuthPathString = DEFAULT_SSO_UNAUTHENTICATED_PATHS_PARAM; } final StringTokenizer st = new StringTokenizer(unAuthPathString, ";,"); while (st.hasMoreTokens()) { unAuthenticatedPaths.add(st.nextToken()); } setGatewayPath(filterConfig); configureExpectedParameters(filterConfig); }
Source:
private static boolean isHidden(TagNode node) { String ariaHidden = node.getAttribute("ARIA-HIDDEN"); return ariaHidden != null && "TRUE".equalsIgnoreCase(ariaHidden); }

Target:
private static boolean isHidden(TagNode node) { return "TRUE".equalsIgnoreCase(node.getAttribute("ARIA-HIDDEN")); }
Source:
private boolean queryHasDoNotSet(ExecutableElement v, boolean explicitSet) { Query annotation = v.getAnnotation(Query.class); if (annotation != null) { if (explicitSet) { return annotation.nullSavingStrategy() == NullSavingStrategy.DO_NOT_SET && nullSavingStrategyExplicitlySet(v, Query.class); } else { return annotation.nullSavingStrategy() == NullSavingStrategy.DO_NOT_SET; } } return false; }

Target:
private boolean queryHasDoNotSet(ExecutableElement v, boolean explicitSet) { return hasDoNotSet(Query.class, Query::nullSavingStrategy, v, explicitSet); }
Source:
private Instant retrieveDeadlineTimestamp(JobDataMap jobDataMap) { Object timestamp = jobDataMap.get(MESSAGE_TIMESTAMP); if (timestamp instanceof String) return Instant.parse(timestamp.toString()); return Instant.ofEpochMilli((long) timestamp); }

Target:
private Instant retrieveDeadlineTimestamp(JobDataMap jobDataMap) { Object timestamp = jobDataMap.get(MESSAGE_TIMESTAMP); if (timestamp instanceof String) { return Instant.parse(timestamp.toString()); } return Instant.ofEpochMilli((long) timestamp); }
Source:
public JUnitRule(MockitoLogger logger, Strictness strictness) { this.logger = logger; if (strictness == Strictness.SILENT) { listeners.add(new SilentTestListener()); } else if (strictness == Strictness.WARN) { listeners.add(new WarningTestListener(logger)); } else if (strictness == Strictness.STRICT_STUBS) { listeners.add(new StrictStubsTestListener()); } }

Target:
public JUnitRule(MockitoLogger logger, Strictness strictness) { this.logger = logger; switch (strictness) { case LENIENT: listener = new NoOpTestListener(); break; case WARN: listener = new WarningTestListener(logger); break; case STRICT_STUBS: listener = new StrictStubsTestListener(); break; default: throw new IllegalArgumentException("Illegal argument: " + strictness); } }
Source:
private void putHintsInExtensionsMap(Map<Object, Object> extensions) { List<Map<String, Object>> recordedHints = hints.stream() .map(Hint::toMap) .collect(toList()); Map<String, Object> cacheControl = new LinkedHashMap<>(); cacheControl.put("version", 1); cacheControl.put("hints", recordedHints); extensions.put("cacheControl", cacheControl); }

Target:
private void putHintsInExtensionsMap(Map<Object, Object> extensions) { List<Map<String, Object>> recordedHints = map(hints, Hint::toMap); Map<String, Object> cacheControl = new LinkedHashMap<>(); cacheControl.put("version", 1); cacheControl.put("hints", recordedHints); extensions.put("cacheControl", cacheControl); }
Source:
public boolean hasValidKey(HttpRequestHeader reqHeader, JSONObject params) { String apiPath; try { apiPath = reqHeader.getURI().getPath(); } catch (URIException e) { logger.error(e.getMessage(), e); return false; } String nonceParam = reqHeader.getHeader(HttpHeader.X_ZAP_API_NONCE); if (nonceParam == null && params.has(API_NONCE_PARAM)) { nonceParam = params.getString(API_NONCE_PARAM); } if (nonceParam != null) { Nonce nonce = nonces.get(nonceParam); if (nonce == null) { logger.warn("API nonce " + nonceParam + " non found"); return false; } else if (nonce.isOneTime()) { nonces.remove(nonceParam); } if (! nonce.isValid()) { logger.warn("API nonce " + nonce.getNonceKey() + " expired at " + nonce.getExpires().toString()); return false; } if (! apiPath.equals(nonce.getApiPath())) { logger.warn("API nonce path was " + nonce.getApiPath() + " but call was for " + apiPath); return false; } } else { String keyParam = reqHeader.getHeader(HttpHeader.X_ZAP_API_KEY); if (keyParam == null && params.has(API_KEY_PARAM)) { keyParam = params.getString(API_KEY_PARAM); } if (!getOptionsParamApi().getKey().equals(keyParam)) { logger.warn("API key incorect or not supplied: " + keyParam); return false; } } return true; }

Target:
public boolean hasValidKey(HttpRequestHeader reqHeader, JSONObject params) { try { String apiPath; try { apiPath = reqHeader.getURI().getPath(); } catch (URIException e) { logger.error(e.getMessage(), e); return false; } String nonceParam = reqHeader.getHeader(HttpHeader.X_ZAP_API_NONCE); if (nonceParam == null && params.has(API_NONCE_PARAM)) { nonceParam = params.getString(API_NONCE_PARAM); } if (nonceParam != null) { Nonce nonce = nonces.get(nonceParam); if (nonce == null) { logger.warn("API nonce " + nonceParam + " not found in request from " + reqHeader.getSenderAddress().getHostAddress()); return false; } else if (nonce.isOneTime()) { nonces.remove(nonceParam); } if (! nonce.isValid()) { logger.warn("API nonce " + nonce.getNonceKey() + " expired at " + nonce.getExpires().toString() + " in request from " + reqHeader.getSenderAddress().getHostAddress()); return false; } if (! apiPath.equals(nonce.getApiPath())) { logger.warn("API nonce path was " + nonce.getApiPath() + " but call was for " + apiPath + " in request from " + reqHeader.getSenderAddress().getHostAddress()); return false; } } else { String keyParam = reqHeader.getHeader(HttpHeader.X_ZAP_API_KEY); if (keyParam == null && params.has(API_KEY_PARAM)) { keyParam = params.getString(API_KEY_PARAM); } if (!getOptionsParamApi().getKey().equals(keyParam)) { logger.warn("API key incorrect or not supplied: " + keyParam + " in request from " + reqHeader.getSenderAddress().getHostAddress()); return false; } } return true; } finally { for (Entry<String, Nonce> entry : nonces.entrySet()) { if (! entry.getValue().isValid()) { nonces.remove(entry.getKey()); } } } }
Source:
public Block remove( @OperatorDependency(operator = EQUAL, returnType = StandardTypes.BOOLEAN, argumentTypes = {"E", "E"}) MethodHandle equalsFunction, @TypeParameter("E") Type type, @SqlType("array(E)") Block array, @SqlType("E") Object value) { List<Integer> positions = new ArrayList<>(); for (int i = 0; i < array.getPositionCount(); i++) { Object element = readNativeValue(type, array, i); try { if (element == null) { positions.add(i); continue; } Boolean result = (Boolean) equalsFunction.invoke(element, value); if (result == null) { throw new PrestoException(NOT_SUPPORTED, "array_remove does not support indeterminate comparison results"); } if (!result) { positions.add(i); } } catch (Throwable t) { throw internalError(t); } } if (array.getPositionCount() == positions.size()) { return array; } if (pageBuilder.isFull()) { pageBuilder.reset(); } BlockBuilder blockBuilder = pageBuilder.getBlockBuilder(0); for (int position : positions) { type.appendTo(array, position, blockBuilder); } pageBuilder.declarePositions(positions.size()); return blockBuilder.getRegion(blockBuilder.getPositionCount() - positions.size(), positions.size()); }

Target:
public Block remove( @OperatorDependency(operator = EQUAL, returnType = StandardTypes.BOOLEAN, argumentTypes = {"E", "E"}) MethodHandle equalsFunction, @TypeParameter("E") Type type, @SqlType("array(E)") Block array, @SqlType("E") Object value) { List<Integer> positions = new ArrayList<>(); for (int i = 0; i < array.getPositionCount(); i++) { Object element = readNativeValue(type, array, i); try { if (element == null) { positions.add(i); continue; } Boolean result = (Boolean) equalsFunction.invoke(element, value); if (result == null) { throw new PrestoException(NOT_SUPPORTED, "array_remove does not support arrays with elements that are null or contain null"); } if (!result) { positions.add(i); } } catch (Throwable t) { throw internalError(t); } } if (array.getPositionCount() == positions.size()) { return array; } if (pageBuilder.isFull()) { pageBuilder.reset(); } BlockBuilder blockBuilder = pageBuilder.getBlockBuilder(0); for (int position : positions) { type.appendTo(array, position, blockBuilder); } pageBuilder.declarePositions(positions.size()); return blockBuilder.getRegion(blockBuilder.getPositionCount() - positions.size(), positions.size()); }
Source:
public BouncyCastleGpgKey findSecretKey() throws IOException, NoSuchAlgorithmException, NoSuchProviderException, PGPException, CanceledException, UnsupportedCredentialItem, URISyntaxException { Exception t = null; boolean haveKeybox = exists(USER_KEYBOX_PATH); if (haveKeybox) { PGPPublicKey publicKey = null; try { publicKey = findPublicKeyInKeyBox(USER_KEYBOX_PATH); } catch (IOException e) { t = e; } if (publicKey != null) { return findSecretKeyForKeyBoxPublicKey(publicKey, USER_KEYBOX_PATH); } } boolean haveSecring = exists(USER_PGP_LEGACY_SECRING_FILE); if (haveSecring) { PGPSecretKey secretKey = findSecretKeyInLegacySecring(signingKey, USER_PGP_LEGACY_SECRING_FILE); if (secretKey != null) { if (!secretKey.isSigningKey()) { throw new PGPException(MessageFormat.format( JGitText.get().gpgNotASigningKey, signingKey)); } return new BouncyCastleGpgKey(secretKey, USER_PGP_LEGACY_SECRING_FILE); } } if (haveKeybox) { throw new PGPException(MessageFormat .format(JGitText.get().gpgNoPublicKeyFound, signingKey), t); } else if (haveSecring) { throw new PGPException(MessageFormat.format( JGitText.get().gpgNoKeyInLegacySecring, signingKey), t); } throw new PGPException(JGitText.get().gpgNoKeyring, t); }

Target:
public BouncyCastleGpgKey findSecretKey() throws IOException, NoSuchAlgorithmException, NoSuchProviderException, PGPException, CanceledException, UnsupportedCredentialItem, URISyntaxException { BouncyCastleGpgKey key; if (exists(USER_KEYBOX_PATH)) { try { key = loadKeyFromKeybox(USER_KEYBOX_PATH); if (key != null) { return key; } throw new PGPException(MessageFormat.format( JGitText.get().gpgNoPublicKeyFound, signingKey)); } catch (NoOpenPgpKeyException e) { if (log.isDebugEnabled()) { log.debug("{} does not contain any OpenPGP keys", USER_KEYBOX_PATH); } } } if (exists(USER_PGP_LEGACY_SECRING_FILE)) { key = loadKeyFromSecring(USER_PGP_LEGACY_SECRING_FILE); if (key != null) { return key; } throw new PGPException(MessageFormat.format( JGitText.get().gpgNoKeyInLegacySecring, signingKey)); } throw new PGPException(JGitText.get().gpgNoKeyring); }
Source:
public static List<ShortcutInfoCompat> getDynamicShortcuts(@NonNull Context context) { if (Build.VERSION.SDK_INT >= 23) { try { return ShortcutInfoCompatSaver.getInstance(context).getShortcuts(); } catch (Exception e) { } } return new ArrayList<>(); }

Target:
public static List<ShortcutInfoCompat> getDynamicShortcuts(@NonNull Context context) { if (Build.VERSION.SDK_INT >= 25) { List<ShortcutInfo> shortcuts = context.getSystemService( ShortcutManager.class).getDynamicShortcuts(); List<ShortcutInfoCompat> compats = new ArrayList<>(shortcuts.size()); for (ShortcutInfo item : shortcuts) { compats.add(new ShortcutInfoCompat.Builder(context, item).build()); } return compats; } if (Build.VERSION.SDK_INT >= 23) { try { return ShortcutInfoCompatSaver.getInstance(context).getShortcuts(); } catch (Exception e) { } } return new ArrayList<>(); }
Source:
private IllegalStateException unableToLoadEvents(I id) { final String errMsg = format( "Unable to load events for the aggregate with ID: %s", Stringifiers.idToString(id) ); throw new IllegalStateException(errMsg); }

Target:
private static <I> IllegalStateException unableToLoadEvents(I id) { final String errMsg = format( "Unable to load events for the aggregate with ID: %s", idToString(id) ); throw new IllegalStateException(errMsg); }
Source:
public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller == null) { return false; } Target target = new TargetDiscard(0, Integer.MAX_VALUE, StaticFilters.FILTER_CARD, controller.getId()); target.choose(Outcome.BoostCreature, controller.getId(), source.getSourceId(), game); int numDiscarded = controller.discard(new CardsImpl(target.getTargets()), source, game).size(); if (numDiscarded > 0) { game.addEffect(new BoostControlledEffect(0, numDiscarded, Duration.EndOfTurn), source); } return true; }

Target:
public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller == null) { return false; } Target target = new TargetDiscard(0, Integer.MAX_VALUE, StaticFilters.FILTER_CARD, controller.getId()); target.choose(outcome, controller.getId(), source.getSourceId(), game); int numDiscarded = controller.discard(new CardsImpl(target.getTargets()), source, game).size(); if (numDiscarded > 0) { game.addEffect(new BoostControlledEffect(0, numDiscarded, Duration.EndOfTurn), source); } return true; }
Source:
private boolean checkAndDisableCLIScheduler() { GlusterVolumeEntity metaVolume = getGlusterVolumeDao().getByName(getVdsGroupId(), Config.<String> getValue(ConfigValues.GlusterMetaVolumeName)); VDSGroup cluster = getVdsGroup(); if (metaVolume != null && cluster.isGlusterCliBasedSchedulingOn()) { VdcReturnValueBase returnValue = runInternalAction(VdcActionType.DisableGlusterCliSnapshotScheduleInternal, new GlusterVolumeActionParameters(getGlusterVolumeId(), true)); return returnValue.getSucceeded(); } return true; }

Target:
private boolean checkAndDisableCLIScheduler() { GlusterVolumeEntity metaVolume = getGlusterVolumeDao().getByName(getVdsGroupId(), Config.<String> getValue(ConfigValues.GlusterMetaVolumeName)); VDSGroup cluster = getVdsGroup(); if (metaVolume != null && cluster.isGlusterCliBasedSchedulingOn()) { VdcReturnValueBase returnValue = runInternalAction(VdcActionType.DisableGlusterCliSnapshotScheduleInternal, new GlusterVolumeActionParameters(getGlusterVolumeId(), true)); handleVdsErrors(AuditLogType.GLUSTER_CLI_SNAPSHOT_SCHEDULE_DISABLE_FAILED, returnValue.getExecuteFailedMessages()); return returnValue.getSucceeded(); } return true; }
Source:
protected void appendRespondant() { try { logic.addInstructorRespondant(getUserEmailForCourse(), feedbackSessionName, courseId); } catch (InvalidParametersException | EntityDoesNotExistException e) { log.severe("Fail to append instructor respondant"); } }

Target:
protected void appendRespondant() { try { logic.addInstructorRespondant(getUserEmailForCourse(), feedbackSessionName, courseId); } catch (InvalidParametersException | EntityDoesNotExistException e) { log.severe("Failed to append instructor respondant. " + "Feedback Session [" + feedbackSessionName + "] of Course ID [" + courseId + "]"); } }
Source:
public Tag create(final JsonObject params) throws IOException { final Tag created = this.get( this.request.method(Request.POST) .body().set(params).back() .fetch().as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_CREATED) .as(JsonResponse.class) .json().readObject().getString("sha") ); final References refs = new RtReferences(this.refsEntry, this.owner); refs.create( new StringBuilder().append("refs/tags/").append( params.getString("tag") ).toString(), created.key() ); return created; }

Target:
public Tag create(final JsonObject params) throws IOException { final Tag created = this.get( this.request.method(Request.POST) .body().set(params).back() .fetch().as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_CREATED) .as(JsonResponse.class) .json().readObject().getString("sha") ); new RtReferences(this.entry, this.owner).create( new StringBuilder().append("refs/tags/").append( params.getString("tag") ).toString(), created.key() ); return created; }
Source:
public String getTechnologyLink() { String linkTechnology; String queryString = "?id=" + technology.getId(); String environment = System.getProperty(Constants.RUNTIME_ENVIRONMENT_PROPERTY); if (StringUtils.equals(Constants.PRODUCTION_PROPERTY, environment)) { String applicationId = System.getProperty(Constants.APPLICATION_ID_PROPERTY); String version = System.getProperty(Constants.APPLICATION_VERSION_PROPERTY); String versionName = version.split("\\.")[0]; linkTechnology = "https://" + versionName + "-dot-" + applicationId + ".appspot.com/"; } else { linkTechnology = Constants.LINK_LOCALHOST; } return linkTechnology + Constants.PATH_VIEW_TECH_HTML + queryString; }

Target:
public String getTechnologyLink() { String linkTechnology; String queryString = "?id=" + technology.getId(); String environment = System.getProperty(Constants.RUNTIME_ENVIRONMENT_PROPERTY); if (StringUtils.equals(Constants.PRODUCTION_PROPERTY, environment)) { String applicationId = System.getProperty(Constants.APPLICATION_ID_PROPERTY); linkTechnology = "https://" + TechGalleryUtil.getApplicationVersion() + "-dot-" + applicationId + ".appspot.com/"; } else { linkTechnology = Constants.LINK_LOCALHOST; } return linkTechnology + Constants.PATH_VIEW_TECH_HTML + queryString; }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mMapView = findViewById(R.id.mapView); ArcGISMap map = new ArcGISMap(); mMapView.setMap(map); WmtsService wmtsService = new WmtsService(getString(R.string.wmts_url)); wmtsService.addDoneLoadingListener(() -> { if (wmtsService.getLoadStatus() == LoadStatus.LOADED) { WmtsServiceInfo wmtsServiceInfo = wmtsService.getServiceInfo(); List<WmtsLayerInfo> layerInfoList = wmtsServiceInfo.getLayerInfos(); WmtsLayer wmtsLayer = new WmtsLayer(layerInfoList.get(0)); map.setBasemap(new Basemap(wmtsLayer)); } else { String error = "Error loading WMTS Service: " + wmtsService.getLoadError(); Log.e(TAG, error); Toast.makeText(this, error, Toast.LENGTH_LONG); } }); wmtsService.loadAsync(); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mMapView = findViewById(R.id.mapView); ArcGISMap map = new ArcGISMap(); mMapView.setMap(map); WmtsService wmtsService = new WmtsService(getString(R.string.wmts_url)); wmtsService.addDoneLoadingListener(() -> { if (wmtsService.getLoadStatus() == LoadStatus.LOADED) { WmtsServiceInfo wmtsServiceInfo = wmtsService.getServiceInfo(); List<WmtsLayerInfo> layerInfoList = wmtsServiceInfo.getLayerInfos(); WmtsLayer wmtsLayer = new WmtsLayer(layerInfoList.get(0)); map.setBasemap(new Basemap(wmtsLayer)); } else { String error = "Error loading WMTS Service: " + wmtsService.getLoadError(); Log.e(TAG, error); Toast.makeText(this, error, Toast.LENGTH_LONG).show(); } }); wmtsService.loadAsync(); }
Source:
public boolean markBackedUp() { try { processEvent(Event.OperationNotPerformed); } catch (NoTransitionException ex) { s_logger.error("no transition error: ", ex); return false; } return true; }

Target:
public void markBackedUp() throws CloudRuntimeException{ try { processEvent(Event.OperationNotPerformed); } catch (NoTransitionException ex) { s_logger.error("no transition error: ", ex); throw new CloudRuntimeException("Error marking snapshot backed up: " + this.snapshot.getId() + " " + ex.getMessage()); } }
Source:
public void shouldRemoveCompactionFromConfigTopicSettings() { Map<String, String> expectedTopicSettings = new HashMap<>(); expectedTopicSettings.put("foo", "foo value"); expectedTopicSettings.put("bar", "bar value"); expectedTopicSettings.put("baz.bim", "100"); Map<String, String> topicSettings = new HashMap<>(expectedTopicSettings); topicSettings.put("cleanup.policy", "something-else"); topicSettings.put("partitions", "3"); Map<String, String> settings = configs(); topicSettings.entrySet().forEach(e -> { settings.put(DistributedConfig.CONFIG_STORAGE_PREFIX + e.getKey(), e.getValue()); }); DistributedConfig config = new DistributedConfig(settings); Map<String, Object> actual = config.configStorageTopicSettings(); assertEquals(expectedTopicSettings, actual); assertNotEquals(topicSettings, actual); }

Target:
public void shouldRemoveCompactionFromConfigTopicSettings() { Map<String, String> expectedTopicSettings = new HashMap<>(); expectedTopicSettings.put("foo", "foo value"); expectedTopicSettings.put("bar", "bar value"); expectedTopicSettings.put("baz.bim", "100"); Map<String, String> topicSettings = new HashMap<>(expectedTopicSettings); topicSettings.put("cleanup.policy", "something-else"); topicSettings.put("partitions", "3"); Map<String, String> settings = configs(); topicSettings.forEach((k, v) -> { settings.put(DistributedConfig.CONFIG_STORAGE_PREFIX + k, v); }); DistributedConfig config = new DistributedConfig(settings); Map<String, Object> actual = config.configStorageTopicSettings(); assertEquals(expectedTopicSettings, actual); assertNotEquals(topicSettings, actual); }
Source:
public ChannelState(ChannelConfig config, ChannelUID channelUID, Value value, @Nullable ChannelStateUpdateListener channelStateUpdateListener) { this.config = config; this.channelStateUpdateListener = channelStateUpdateListener; this.channelUID = channelUID; this.value = value; this.readOnly = StringUtils.isBlank(config.commandTopic); this.trigger = config.trigger; }

Target:
public ChannelState(ChannelConfig config, ChannelUID channelUID, Value value, @Nullable ChannelStateUpdateListener channelStateUpdateListener) { this.config = config; this.channelStateUpdateListener = channelStateUpdateListener; this.channelUID = channelUID; this.value = value; this.readOnly = StringUtils.isBlank(config.commandTopic); }
Source:
protected String convertToString(Locale locale, Object value) { if (Number.class.isInstance(value)) { NumberFormat format = NumberFormat.getNumberInstance(locale); format.setGroupingUsed(false); if (BigDecimal.class.isInstance(value) || Double.class.isInstance(value) || Float.class.isInstance(value)) { format.setMinimumFractionDigits(1); if (BigDecimal.class.isInstance(value)) format.setMaximumFractionDigits(Integer.MAX_VALUE); else if (Double.class.isInstance(value)) format.setMaximumFractionDigits(15); else if (Float.class.isInstance(value)) format.setMaximumFractionDigits(7); } return format.format(value); } else { return Objects.toString(value, null); } }

Target:
protected String convertToString(Locale locale, Object value) { if (Number.class.isInstance(value)) { NumberFormat format = NumberFormat.getNumberInstance(locale); format.setGroupingUsed(false); Object fixedValue = value; if (BigDecimal.class.isInstance(value) || Double.class.isInstance(value) || Float.class.isInstance(value)) { format.setMaximumFractionDigits(Integer.MAX_VALUE); if (Float.class.isInstance(value)) { fixedValue = Double.valueOf(value.toString()); } } return format.format(fixedValue); } else { return Objects.toString(value, null); } }
Source:
private static String computeNewName(String str) { String fileExtension = ""; String fileNameNoExtension = str; Pattern p = Pattern.compile("[0-9]+$"); Matcher m = p.matcher(fileNameNoExtension); if (m.find()) { int newNumber = Integer.parseInt(m.group()) + 1; String numberStr = m.replaceFirst(Integer.toString(newNumber)); return numberStr + fileExtension; } return fileNameNoExtension + "2" + fileExtension; }

Target:
private static String computeNewName(String str) { String fileNameNoExtension = str; Pattern p = Pattern.compile("[0-9]+$"); Matcher m = p.matcher(fileNameNoExtension); if (m.find()) { int newNumber = Integer.parseInt(m.group()) + 1; return m.replaceFirst(Integer.toString(newNumber)); } return fileNameNoExtension + "2"; }
Source:
public LockResponse lock(LockRequest request) { if (request.getLockDescriptors().size() <= LOCK_BATCH_THRESHOLD) { return timelockService.lock(request); } Instant startTime = clock.instant(); Duration initialAcquireTimeout = Duration.ofMillis(request.getAcquireTimeoutMs()); List<LockDescriptor> sortedLockDescriptors = Ordering.natural().immutableSortedCopy(request.getLockDescriptors()); BatchedLockDescriptors descriptors = new BatchedLockDescriptors(); try { for (List<LockDescriptor> batch : Iterables.partition(sortedLockDescriptors, LOCK_BATCH_THRESHOLD)) { Optional<Duration> acquireTimeout = acquireTimeout(startTime, initialAcquireTimeout); if (!acquireTimeout.isPresent()) { return descriptors.failure(); } LockRequest batchedRequest = ImmutableLockRequest.builder() .from(request) .acquireTimeoutMs(acquireTimeout.get().toMillis()) .lockDescriptors(batch) .build(); LockResponse response = timelockService.lock(batchedRequest); if (!response.wasSuccessful()) { return descriptors.failure(); } descriptors.add(response.getToken()); } } catch (RuntimeException e) { throw descriptors.failure(e); } return descriptors.success(); }

Target:
public LockResponse lock(LockRequest request) { if (request.getLockDescriptors().size() <= lockBatchThreshold) { return timelockService.lock(request); } Instant startTime = clock.instant(); Duration initialAcquireTimeout = Duration.ofMillis(request.getAcquireTimeoutMs()); List<LockDescriptor> sortedLockDescriptors = Ordering.natural().immutableSortedCopy(request.getLockDescriptors()); BatchedLockDescriptors descriptors = new BatchedLockDescriptors(); try { for (List<LockDescriptor> batch : Iterables.partition(sortedLockDescriptors, lockBatchThreshold)) { Optional<Duration> acquireTimeout = acquireTimeout(startTime, initialAcquireTimeout); if (!acquireTimeout.isPresent()) { return descriptors.failure(LockResponse.timedOut()); } LockRequest batchedRequest = ImmutableLockRequest.builder() .requestId(requestIdSupplier.get()) .acquireTimeoutMs(acquireTimeout.get().toMillis()) .lockDescriptors(batch) .build(); LockResponse response = timelockService.lock(batchedRequest); if (!response.wasSuccessful()) { return descriptors.failure(response); } descriptors.add(response.getToken()); } } catch (RuntimeException e) { throw descriptors.failure(e); } return descriptors.success(); }
Source:
public void processLeftCheckpoint(final MistCheckpointEvent input) { outputEmitter.emitCheckpoint(input); }

Target:
public void processLeftCheckpoint(final MistCheckpointEvent input) { leftUpstreamQueue.add(input); drainUntilMinimumWatermark(); }
Source:
private static Type targetType(TypeCastTree typeCastTree) { Tree parent = skipParentheses(typeCastTree.parent()); switch (parent.kind()) { case RETURN_STATEMENT: Tree method = parent; while (!method.is(Tree.Kind.METHOD, Tree.Kind.LAMBDA_EXPRESSION)) { method = method.parent(); } if (method.is(Tree.Kind.METHOD)) { MethodTree methodTree = (MethodTree) method; Type type = methodTree.symbol().type(); if (type instanceof MethodJavaType) { return ((MethodJavaType) type).resultType(); } return methodTree.symbol().returnType().type(); } return null; case VARIABLE: return ((VariableTree) parent).symbol().type(); case ARGUMENTS: Arguments arguments = (Arguments)parent; int castArgIndex = arguments.indexOf(typeCastTree); return arguments.get(castArgIndex).symbolType(); case MEMBER_SELECT: case CONDITIONAL_EXPRESSION: return typeCastTree.type().symbolType(); case ARRAY_ACCESS_EXPRESSION: return ((ArrayAccessExpressionTree) parent).expression().symbolType(); default: if (parent instanceof ExpressionTree) { return ((ExpressionTree) parent).symbolType(); } return null; } }

Target:
private static Type targetType(TypeCastTree typeCastTree) { Tree parent = skipParentheses(typeCastTree.parent()); switch (parent.kind()) { case RETURN_STATEMENT: Tree method = parent; while (!method.is(Tree.Kind.METHOD, Tree.Kind.LAMBDA_EXPRESSION)) { method = method.parent(); } if (method.is(Tree.Kind.METHOD)) { MethodTree methodTree = (MethodTree) method; Type type = methodTree.symbol().type(); if (type instanceof MethodJavaType) { return ((MethodJavaType) type).resultType(); } return methodTree.symbol().returnType().type(); } return null; case VARIABLE: return ((VariableTree) parent).symbol().type(); case ARGUMENTS: Arguments arguments = (Arguments) parent; Tree invocation = arguments.parent(); if (invocation.is(Tree.Kind.METHOD_INVOCATION)) { return targetTypeFromMethodSymbol(((MethodInvocationTree) invocation).symbol(), arguments, typeCastTree); } if (invocation.is(Tree.Kind.NEW_CLASS)) { return targetTypeFromMethodSymbol(((NewClassTree) invocation).constructorSymbol(), arguments, typeCastTree); } return null; case MEMBER_SELECT: case CONDITIONAL_EXPRESSION: return typeCastTree.type().symbolType(); case ARRAY_ACCESS_EXPRESSION: return ((ArrayAccessExpressionTree) parent).expression().symbolType(); default: if (parent instanceof ExpressionTree) { return ((ExpressionTree) parent).symbolType(); } return null; } }
Source:
private Query rewriteDataSources(Query query) { DataSource dataSource = query.getDataSource(); if (dataSource instanceof RegexDataSource) { Set<String> found = Sets.newLinkedHashSet(); Iterable<DruidServer> inventory = serverInventoryView.getInventory(); for (String pattern : dataSource.getNames()) { Matcher matcher = Pattern.compile(pattern).matcher(""); for (DruidServer server : inventory) { for (DruidDataSource source : server.getDataSources()) { if (matcher.reset(source.getName()).matches()) { found.add(source.getName()); } } } } if (found.size() == 1) { query = query.withDataSource(new TableDataSource(Iterables.getOnlyElement(found))); } else { query = query.withDataSource(new UnionDataSource(TableDataSource.of(found))); } } else if (dataSource instanceof QueryDataSource) { Query subQuery = rewriteDataSources(((QueryDataSource) query).getQuery()); query = query.withDataSource(new QueryDataSource(subQuery)); } return query; }

Target:
private Query rewriteDataSources(Query query) { DataSource dataSource = query.getDataSource(); if (dataSource instanceof RegexDataSource) { List<Matcher> matchers = Lists.newArrayList(); for (String pattern : dataSource.getNames()) { matchers.add(Pattern.compile(pattern).matcher("")); } Set<String> found = Sets.newLinkedHashSet(); for (DruidServer server : serverInventoryView.getInventory()) { for (DruidDataSource source : server.getDataSources()) { if (!found.contains(source.getName())) { for (Matcher matcher : matchers) { if (matcher.reset(source.getName()).matches()){ found.add(source.getName()); break; } } } } } if (found.size() == 1) { query = query.withDataSource(new TableDataSource(Iterables.getOnlyElement(found))); } else { query = query.withDataSource(new UnionDataSource(TableDataSource.of(found))); } } else if (dataSource instanceof QueryDataSource) { Query subQuery = rewriteDataSources(((QueryDataSource) query).getQuery()); query = query.withDataSource(new QueryDataSource(subQuery)); } return query; }
Source:
public WorkspaceImpl createWorkspace( Devfile devfile, RecipeFileContentProvider recipeFileContentProvider) throws ServerException, DevfileFormatException, ConflictException, NotFoundException, ValidationException, DevfileRecipeFormatException { WorkspaceConfigImpl workspaceConfig = createWorkspaceConfig(devfile, recipeFileContentProvider); final String namespace = EnvironmentContext.getCurrent().getSubject().getUserName(); return workspaceManager.createWorkspace( findAvailableName(workspaceConfig), namespace, emptyMap()); }

Target:
public WorkspaceImpl createWorkspace( Devfile devfile, RecipeFileContentProvider recipeFileContentProvider) throws ServerException, ConflictException, NotFoundException, ValidationException, DevfileException { WorkspaceConfigImpl workspaceConfig = createWorkspaceConfig(devfile, recipeFileContentProvider); final String namespace = EnvironmentContext.getCurrent().getSubject().getUserName(); return workspaceManager.createWorkspace( findAvailableName(workspaceConfig), namespace, emptyMap()); }
Source:
public Boolean call() { try { query(sql); return false; } catch (QueryExecutionException ExceptionDueToQueryCancellation) { return true; } }

Target:
public Void call() { assertThat(() -> query(sql)).failsWithMessage("Query was canceled"); return null; }
Source:
public void testShowHideExperimentalPerspectiveMenus() { testAddMenusWithExperimentalPerspective(); presenter.onPerspectiveVisibilityChange(new PerspectiveVisibiltiyChangeEvent(PERSPECTIVE_ID, false)); verify(view, times(1)).setMenuItemVisible(PERSPECTIVE_ID, false); presenter.onPerspectiveVisibilityChange(new PerspectiveVisibiltiyChangeEvent(SECOND_PERSPECTIVE_ID, true)); verify(view, times(1)).setMenuItemVisible(SECOND_PERSPECTIVE_ID, true); presenter.onPerspectiveVisibilityChange(new PerspectiveVisibiltiyChangeEvent(THIRD_PERSPECTIVE_ID, false)); verify(view, times(1)).setMenuItemVisible(THIRD_PERSPECTIVE_ID, false); }

Target:
public void testShowHideExperimentalPerspectiveMenus() { testAddMenusWithExperimentalPerspective(); presenter.onPerspectiveVisibilityChange(new PerspectiveVisibiltiyChangeEvent(PERSPECTIVE_ID, false)); verify(view).setMenuItemVisible(PERSPECTIVE_ID, false); presenter.onPerspectiveVisibilityChange(new PerspectiveVisibiltiyChangeEvent(SECOND_PERSPECTIVE_ID, true)); verify(view).setMenuItemVisible(SECOND_PERSPECTIVE_ID, true); presenter.onPerspectiveVisibilityChange(new PerspectiveVisibiltiyChangeEvent(THIRD_PERSPECTIVE_ID, false)); verify(view).setMenuItemVisible(THIRD_PERSPECTIVE_ID, false); }
Source:
public void testDebugContextRsAllocationCopy2D_Short_BadYCount() { setupAllocationCopyTests AC = new setupAllocationCopyTests(this, 2, 128, (RenderScript rs)-> new Type.Builder(rs, Element.I16(rs))); int xOff = AC.RN.nextInt(AC.Width); int yOff = AC.RN.nextInt(AC.Height); int xCount = AC.RN.nextInt(AC.Width - xOff); Soob.set_dstXOff(xOff); Soob.set_srcXOff(xOff); Soob.set_yOff(yOff); Soob.set_xCount(xCount); Soob.set_yCount(AC.Height - yOff + 1); Soob.set_srcMip(0); Soob.set_dstMip(0); Soob.invoke_test2D(); AC.finishAllocationCopyTests(); assertTrue(mRanErrorHandler); RenderScript.releaseAllContexts(); }

Target:
public void testDebugContextRsAllocationCopy2D_Short_BadYCount() { SetupAllocationCopyTests AC = new SetupAllocationCopyTests(2, 128, (RenderScript rs)-> new Type.Builder(rs, Element.I16(rs)), 0x172d8ac0); int xOff = AC.RN.nextInt(AC.Width); int yOff = AC.RN.nextInt(AC.Height); int xCount = AC.RN.nextInt(AC.Width - xOff); Soob.set_dstXOff(xOff); Soob.set_srcXOff(xOff); Soob.set_yOff(yOff); Soob.set_xCount(xCount); Soob.set_yCount(AC.Height - yOff + 1); Soob.set_srcMip(0); Soob.set_dstMip(0); Soob.invoke_test2D(); AC.finishAllocationCopyTests(); assertTrue(mRanErrorHandler); RenderScript.releaseAllContexts(); }
Source:
public static void registerClass(Event event) { typesByString.put(event.getType(), event.getClass()); }

Target:
public static void registerClass(Event event) { String type = event.getType(); if (typesByString.containsKey(type)) { throw new IllegalArgumentException( "Event type already registered: " + type); } typesByString.put(type, event.getClass()); }
Source:
private boolean isCheckStatusSupported() { VDS vds = getDbFacade().getVdsDao().get(getParameters().getVdsId()); return FeatureSupported.getDeviceListWithoutStatusSupported( vds.getVdsGroupCompatibilityVersion()); }

Target:
private boolean isCheckStatusSupported() { return FeatureSupported.getDeviceListWithoutStatusSupported( getVds().getVdsGroupCompatibilityVersion()); }
Source:
public static void main(String[] args) throws Exception { final String FROZEN_MLP = new ClassPathResource(BASE_DIR + "/frozen_model.pb").getFile().getPath(); Map<String, INDArray> inputsPredictions = readPlaceholdersAndPredictions(); val graph = TFGraphMapper.getInstance().importGraph(new File(FROZEN_MLP)); graph.associateArrayWithVariable(inputsPredictions.get("input_a"), graph.variableMap().get("input")); val executioner = new NativeGraphExecutioner(); val results = executioner.executeGraph(graph); INDArray libnd4jPred = ((INDArray[]) results)[0]; System.out.println("LIBND4J exec prediction for input_a:\n"+libnd4jPred); if (libnd4jPred.equals(inputsPredictions.get("prediction_a"))) { System.out.println("Predictions are equal to tensorflow"); } val graphSD = TFGraphMapper.getInstance().importGraph(new File(FROZEN_MLP)); graphSD.associateArrayWithVariable(inputsPredictions.get("input_b"), graph.variableMap().get("input")); INDArray samediffPred = graphSD.execAndEndResult(); System.out.println("SameDiff exec prediction for input_b:\n"+samediffPred); if(samediffPred.equals(inputsPredictions.get("prediction_b"))) { System.out.println("Predictions are equal to tensorflow"); } System.out.println("Adding new op to graph.."); SDVariable linspaceConstant = graphSD.var("linspace", Nd4j.linspace(1, 10, 10)); SDVariable totalOutput = graphSD.getVariable("output").add(linspaceConstant); INDArray totalOutputArr = totalOutput.eval(); System.out.println(totalOutputArr); }

Target:
public static void main(String[] args) throws Exception { final String FROZEN_MLP = new ClassPathResource(BASE_DIR + "/frozen_model.pb").getFile().getPath(); Map<String, INDArray> inputsPredictions = readPlaceholdersAndPredictions(); val graph = TFGraphMapper.getInstance().importGraph(new File(FROZEN_MLP)); graph.associateArrayWithVariable(inputsPredictions.get("input_a"), graph.variableMap().get("input")); val executioner = new NativeGraphExecutioner(); val results = executioner.executeGraph(graph); INDArray libnd4jPred = ((INDArray[]) results)[0]; System.out.println("LIBND4J exec prediction for input_a:\n" + libnd4jPred); if (libnd4jPred.equals(inputsPredictions.get("prediction_a"))) { System.out.println("Predictions are equal to tensorflow"); } else { throw new RuntimeException("Predictions don't match!"); } val graphSD = TFGraphMapper.getInstance().importGraph(new File(FROZEN_MLP)); graphSD.associateArrayWithVariable(inputsPredictions.get("input_b"), graph.variableMap().get("input")); INDArray samediffPred = graphSD.execAndEndResult(); System.out.println("SameDiff exec prediction for input_b:\n" + samediffPred); if (samediffPred.equals(inputsPredictions.get("prediction_b"))) { System.out.println("Predictions are equal to tensorflow"); } System.out.println("Adding new op to graph.."); SDVariable linspaceConstant = graphSD.var("linspace", Nd4j.linspace(1, 10, 10)); SDVariable totalOutput = graphSD.getVariable("output").add(linspaceConstant); INDArray totalOutputArr = totalOutput.eval(); System.out.println(totalOutputArr); }
Source:
PercentEscaper(String safeCharacters, boolean usePlusForSpace) { this.usePlusForSpace = usePlusForSpace; this.safeCharacterPoints = new HashSet<>(); SAFE_CHARACTERS.codePoints().forEach(safeCharacterPoints::add); if (!CoreUtils.isNullOrEmpty(safeCharacters)) { safeCharacters.codePoints().forEach(safeCharacterPoints::add); } }

Target:
PercentEscaper(String safeCharacters, boolean usePlusForSpace) { this.usePlusForSpace = usePlusForSpace; if (usePlusForSpace && safeCharacters != null && safeCharacters.contains(" ")) { throw logger.logExceptionAsError(new IllegalArgumentException( "' ' as a safe character with 'usePlusForSpace = true' is an invalid configuration.")); } this.safeCharacterPoints = new HashSet<>(); SAFE_CHARACTERS.codePoints().forEach(safeCharacterPoints::add); if (!CoreUtils.isNullOrEmpty(safeCharacters)) { safeCharacters.codePoints().forEach(safeCharacterPoints::add); } }