auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected boolean download(final DownloadableFile downloadableFile) throws Exception { File toDownload = downloadableFile.getLocalFile(); LOG.info("download of " + toDownload + " started at " + new Date()); String url = downloadableFile.url(urlGenerator); final HttpRequestBase request = new HttpGet(url); request.setConfig(RequestConfig.custom().setConnectTimeout(HTTP_TIMEOUT_IN_MILLISECONDS).build()); try (CloseableHttpClient httpClient = httpClientBuilder.build(); CloseableHttpResponse response = httpClient.execute(request)) { LOG.info("got server response at " + new Date()); handleInvalidResponse(response, url); response.getEntity().writeTo(new FileOutputStream(downloadableFile.getLocalFile())); LOG.info("piped the stream to " + downloadableFile + " at " + new Date()); } return true; }

Target:
protected synchronized boolean download(final DownloadableFile downloadableFile) throws Exception { File toDownload = downloadableFile.getLocalFile(); LOG.info("Downloading " + toDownload); String url = downloadableFile.url(urlGenerator); final HttpRequestBase request = new HttpGet(url); request.setConfig(RequestConfig.custom().setConnectTimeout(HTTP_TIMEOUT_IN_MILLISECONDS).build()); try (CloseableHttpClient httpClient = httpClientBuilder.build(); CloseableHttpResponse response = httpClient.execute(request)) { LOG.info("Got server response"); if (response.getEntity() == null) { LOG.error("Unable to read file from the server response"); return false; } handleInvalidResponse(response, url); try (BufferedOutputStream outStream = new BufferedOutputStream(new FileOutputStream(downloadableFile.getLocalFile()))) { response.getEntity().writeTo(outStream); LOG.info("Piped the stream to " + downloadableFile); } } return true; }
Source:
protected void appendName(ActivityPartition activitypartition, Collection<String> displayValue, StringBuilder sb) { Element represents = activitypartition.getRepresents(); ConnectableElement element = null; if ((activitypartition.getRepresents() instanceof ConnectableElement)) { element = (ConnectableElement) activitypartition.getRepresents(); } String activitypartitionName = UMLLabelInternationalization.getInstance().getLabel(activitypartition); if (element == null) { if (represents != null) { activitypartitionName = ((NamedElement) represents).getName() ; } appendString(sb, activitypartitionName, UNAMED); return; } else { if (displayValue.contains(SHOW_REPRESENT_NAME)) { appendString(sb,UMLLabelInternationalization.getInstance().getLabel( element), UNAMED); } else if (!displayValue.contains(SHOW_REPRESENT_TYPE)) { appendString(sb, activitypartitionName, UNAMED); } } }

Target:
protected void appendName(ActivityPartition activitypartition, Collection<String> displayValue, StringBuilder sb) { Element represents = activitypartition.getRepresents(); String activitypartitionName = UMLLabelInternationalization.getInstance().getLabel(activitypartition); if (represents != null) { try { activitypartitionName = ((NamedElement) represents).getName() ; } catch (ClassCastException e) { } } appendString(sb, activitypartitionName, UNAMED); return; }
Source:
void loadUrlDelayed(String url, int delayMs, Command onCompleted) { if (timer_ != null && timer_.isRunning()) timer_.cancel(); onCompleted_ = onCompleted; url_ = url; timer_ = new FrameLoadTimer(); timer_.schedule(delayMs); }

Target:
void loadUrlDelayed(String url, int delayMs, Command onCompleted) { if (timer_.isRunning()) timer_.cancel(); onCompleted_ = onCompleted; url_ = url; timer_.schedule(delayMs); }
Source:
private AtomicLong getOrCreateCounter(final String tag, final Map<String, AtomicLong> counterMap) { if (counterMap.containsKey(tag)) { return counterMap.get(tag); } else { final AtomicLong counter = new AtomicLong(0L); counterMap.put(tag, counter); return counter; } }

Target:
private AtomicLong getOrCreateCounter(final String tag, final Map<String, AtomicLong> counterMap) { if (!counterMap.containsKey(tag)) { synchronized (counterMap) { if (!counterMap.containsKey(tag)) { counterMap.put(tag, new AtomicLong(0L)); } } } return counterMap.get(tag); }
Source:
public static UserSqlSandbox getStaticStorage(String username) { PrototypeFactory factory = new PrototypeFactory(new ClassNameHasher()); return new UserSqlSandbox(username); }

Target:
public static UserSqlSandbox getStaticStorage(String username) { return new UserSqlSandbox(username); }
Source:
public String getActionProviders(HttpServletRequest request, HttpServletResponse response) throws SecurityServiceException { HttpSession session = httpSessionFactory.getOrCreateSession(request); Object token = ((SecurityTokenHolder) session.getAttribute(SecurityConstants.SECURITY_TOKEN_KEY)) .getPrincipals(); SessionToken sessionToken = new SessionToken(token, session.getId(), "127.0.0.1"); Subject subject = securityManager.getSubject(sessionToken); Map<String, Object> subjectMap = new HashMap<>(); subjectMap.put("http_request", request); subjectMap.put("http_response", response); subjectMap.put(SecurityConstants.SECURITY_SUBJECT, subject); List<Map<String, String>> actionPropertiesList = new ArrayList<>(); for (ActionProvider actionProvider : logoutActionProviders) { Map<String, String> actionProperties = new HashMap<>(); Action action = actionProvider.getAction(subjectMap); if (action != null) { String displayName = SubjectUtils.getName(subject, "", true); actionProperties.put("title", action.getTitle()); actionProperties.put("auth", displayName); actionProperties.put("description", action.getDescription()); actionProperties.put("url", action.getUrl().toString()); actionPropertiesList.add(actionProperties); } } return GSON.toJson(actionPropertiesList); }

Target:
public String getActionProviders(HttpServletRequest request, HttpServletResponse response) throws SecurityServiceException { HttpSession session = httpSessionFactory.getOrCreateSession(request); Object token = ((SecurityTokenHolder) session.getAttribute(SecurityConstants.SECURITY_TOKEN_KEY)) .getPrincipals(); SessionToken sessionToken = new SessionToken(session.getId(), token, "127.0.0.1"); Subject subject = securityManager.getSubject(sessionToken); Map<String, Object> subjectMap = new HashMap<>(); subjectMap.put("http_request", request); subjectMap.put("http_response", response); subjectMap.put(SecurityConstants.SECURITY_SUBJECT, subject); List<Map<String, String>> actionPropertiesList = new ArrayList<>(); for (ActionProvider actionProvider : logoutActionProviders) { Map<String, String> actionProperties = new HashMap<>(); Action action = actionProvider.getAction(subjectMap); if (action != null) { String displayName = SubjectUtils.getName(subject, "", true); actionProperties.put("title", action.getTitle()); actionProperties.put("auth", displayName); actionProperties.put("description", action.getDescription()); actionProperties.put("url", action.getUrl().toString()); actionPropertiesList.add(actionProperties); } } return GSON.toJson(actionPropertiesList); }
Source:
public void resetAndSync(NomadChangeInfo[] nomadChanges) { DynamicConfigNomadSynchronizer nomadSynchronizer = new DynamicConfigNomadSynchronizer( nomadServerManager.getConfiguration().orElse(null), nomadServerManager.getNomadServer()); try { nomadSynchronizer.syncNomadChanges(Arrays.asList(nomadChanges)); } catch (NomadException e) { throw new RuntimeException(e); } }

Target:
public void resetAndSync(NomadChangeInfo[] nomadChanges) { UpgradableNomadServer<NodeContext> nomadServer = nomadServerManager.getNomadServer(); DynamicConfigNomadSynchronizer nomadSynchronizer = new DynamicConfigNomadSynchronizer( nomadServerManager.getConfiguration().orElse(null), nomadServer); List<NomadChangeInfo> backup; try { backup = nomadServer.getAllNomadChanges(); } catch (NomadException e) { throw new IllegalStateException("Unable to reset and sync Nomad system: " + e.getMessage(), e); } try { nomadSynchronizer.syncNomadChanges(Arrays.asList(nomadChanges)); } catch (NomadException e) { try { nomadServer.reset(); nomadSynchronizer.syncNomadChanges(backup); } catch (NomadException nomadException) { e.addSuppressed(nomadException); } throw new IllegalStateException("Unable to reset and sync Nomad system: " + e.getMessage(), e); } }
Source:
public static String lpad(@Nonnull String base, int len, @Nonnull String pad) { if (len < 0 || pad.isEmpty()) { return null; } else if (len == 0) { return ""; } char[] data = new char[len]; int pos = Math.max(len - base.length(), 0); for (int i = 0; i < pos; i += pad.length()) { for (int j = 0; j < pad.length() && j < pos - i; j++) { data[i + j] = pad.charAt(j); } } for (int i = 0; pos + i < len && i < base.length(); i++) { data[pos + i] = base.charAt(i); } return new String(data); }

Target:
public static String lpad(@Nonnull String base, int len, @Nonnull String pad) { if (len <= 0) { return ""; } int pos = Math.max(len - base.length(), 0); if (pos > 0 && pad.isEmpty()) { return base; } char[] data = new char[len]; for (int i = 0; !pad.isEmpty() && i < pos; i += pad.length()) { for (int j = 0; j < pad.length() && j < pos - i; j++) { data[i + j] = pad.charAt(j); } } for (int i = 0; pos + i < len && i < base.length(); i++) { data[pos + i] = base.charAt(i); } return new String(data); }
Source:
public void shouldReturnProxyHostWhenHostDoesNotMatchNonProxyHosts() { assertNotNull(ProxyConfigurator.create(method, "proxy.example.org", "3128", "www.example.org")); }

Target:
public void shouldReturnProxyHostWhenHostDoesNotMatchNonProxyHosts() throws IOException { final Properties proxyProperties = readProxyProperties(); proxyProperties.setProperty("http.nonProxyHosts", "www.example.org"); final ProxyHost httpProxy = ProxyConfigurator.create(HTTP_METHOD, proxyProperties); assertThat(httpProxy.getHostName(), is(HTTP_PROXY_HOST)); assertThat(httpProxy.getPort(), is(Integer.valueOf(HTTP_PROXY_PORT))); }
Source:
public boolean connect(Node ... nodeList) { boolean returnValue = true; Preconditions.checkArgument(nodeList.length > 1, "Expected at least 2 nodes as arguments to connect()"); Node fromNode = null; for (Node toNode : nodeList) { Preconditions.checkNotNull(toNode, "toNode cannot be null!"); if (fromNode != null) { boolean success = graph.putEdge(fromNode, toNode); if (!success) { logger.warn("Trying to connect two already connected nodes, " + fromNode.getUri() + " and " + toNode.getUri()); } returnValue = returnValue && success; } fromNode = toNode; } return returnValue; }

Target:
public void connect(Node ... nodeList) { Preconditions.checkArgument(nodeList.length > 1, "Expected at least 2 nodes as arguments to connect() - found " + nodeList.length); Node fromNode = null; for (Node toNode : nodeList) { Preconditions.checkNotNull(toNode, "toNode cannot be null!"); if (fromNode != null) { if (!graph.hasEdgeConnecting(fromNode, toNode)) { graph.putEdge(fromNode, toNode); } else { logger.warn("Trying to connect two already connected nodes, " + fromNode.getUri() + " and " + toNode.getUri()); } } fromNode = toNode; } }
Source:
protected Class<?>[] getAnnotatedClasses() { return new Class<?>[]{Parent.class, Child.class}; }

Target:
protected Class<?>[] getAnnotatedClasses() { return new Class<?>[]{Parent.class, Child.class, SubChild.class}; }
Source:
protected void populateMatchNode(MatchNode matchNode) { Match match = matchNode.getMatch(); if (isMatchWithOnlyResourceAttachmentChanges(match)) { return; } Multimap<Match, Diff> diffsBySubMatch = LinkedHashMultimap.create(); for (Diff diff : filter(match.getDifferences(), filter)) { if (mustDisplayAsDirectChildOfMatch(diff)) { Match targetMatch = getTargetMatch(diff); if (match == targetMatch) { addDiffNode(matchNode, diff); } else if (match.getSubmatches().contains(targetMatch)) { diffsBySubMatch.put(targetMatch, diff); } else if (targetMatch != null) { MatchNode targetMatchNode = createMatchNode(targetMatch); matchNode.addSubMatchNode(targetMatchNode); addDiffNode(targetMatchNode, diff); } } } for (Match subMatch : match.getSubmatches()) { MatchNode subMatchNode = createMatchNode(subMatch); for (Diff subMatchDiff : diffsBySubMatch.get(subMatch)) { addDiffNode(subMatchNode, subMatchDiff); } diffsBySubMatch.removeAll(subMatch); populateMatchNode(subMatchNode); if (!subMatchNode.getChildren().isEmpty()) { matchNode.addSubMatchNode(subMatchNode); } } }

Target:
protected void populateMatchNode(MatchNode matchNode) { Match match = matchNode.getMatch(); Multimap<Match, Diff> diffsBySubMatch = LinkedHashMultimap.create(); for (Diff diff : filter(match.getDifferences(), filter)) { if (mustDisplayAsDirectChildOfMatch(diff)) { Match targetMatch = getTargetMatch(diff); if (match == targetMatch) { addDiffNode(matchNode, diff); } else if (match.getSubmatches().contains(targetMatch)) { diffsBySubMatch.put(targetMatch, diff); } else if (targetMatch != null) { MatchNode targetMatchNode = createMatchNode(targetMatch); matchNode.addSubMatchNode(targetMatchNode); addDiffNode(targetMatchNode, diff); } } } for (Match subMatch : match.getSubmatches()) { MatchNode subMatchNode = createMatchNode(subMatch); for (Diff subMatchDiff : diffsBySubMatch.get(subMatch)) { addDiffNode(subMatchNode, subMatchDiff); } diffsBySubMatch.removeAll(subMatch); populateMatchNode(subMatchNode); if (!subMatchNode.getChildren().isEmpty()) { matchNode.addSubMatchNode(subMatchNode); } } }
Source:
private String getValueForOptionalKey(JSONObject object, String key) throws JSONException { return object.has(key) ? object.getJSONObject(key).getString("value") : ""; }

Target:
private String getValueForOptionalKey(JSONObject object, String key) throws JSONException { return object.has(key) ? object.getJSONObject(key).optString("value") : ""; }
Source:
String parse(Process process){ try { BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(process.getInputStream())); StringBuilder log = new StringBuilder(); String line; while ((line = bufferedReader.readLine()) != null) { log.append(line + "\n"); } return log.toString(); } catch (IOException e) { e.printStackTrace(); } return context.getString(R.string.output_is_empty); }

Target:
String parse(Process process){ try { BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(process.getInputStream())); StringBuilder log = new StringBuilder(); String line; while ((line = bufferedReader.readLine()) != null) { log.append(line + "\n"); } return log.toString(); } catch (IOException e) { Log.e(TAG, "Exception(05): " + e.getMessage()); } return context.getString(R.string.output_is_empty); }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof UserTuneElement)) { return false; } UserTuneElement userTuneElement = (UserTuneElement) obj; return this.toXML().toString().contentEquals(userTuneElement.toXML().toString()); }

Target:
public boolean equals(Object obj) { return EqualsUtil .equals(this, obj, (equalsBuilder, otherTune) -> equalsBuilder .append(artist, otherTune.artist) .append(length, otherTune.length) .append(rating, otherTune.rating) .append(source, otherTune.source) .append(title, otherTune.source) .append(title, otherTune.title) .append(track, otherTune.track) .append(uri, otherTune.uri)); }
Source:
public void registerActivityQueuer(IActivityQueuer activityQueuer) { if (activityQueuer == null || !activityQueuerChangeAllowed) { return; } synchronized (this.activityQueuer) { if (activityQueuerChangeAllowed) { log.info("register a new Activity Queue Handler: " + activityQueuer); this.activityQueuer = activityQueuer; activityQueuerChangeAllowed = false; } } }

Target:
public boolean registerActivityQueuer(IActivityQueuer activityQueuer) { if (activityQueuer == null || !activityQueuerChangeAllowed.get()) { return false; } if (activityQueuerChangeAllowed.compareAndSet(true, false)) { log.info("register a new Activity Queue Handler: " + activityQueuer); this.activityQueuer = activityQueuer; return true; } return false; }
Source:
static int[] encode(final Cigar cigar) { if (cigar.numCigarElements() == 0) { return new int[0]; } final int[] binaryCigar = new int[cigar.numCigarElements()]; int binaryCigarLength = 0; for (int i = 0; i < cigar.numCigarElements(); ++i) { final CigarElement cigarElement = cigar.getCigarElement(i); final int op = cigarElement.getOperator().bamCode(); binaryCigar[binaryCigarLength++] = cigarElement.getLength() << 4 | op; } return binaryCigar; }

Target:
static int[] encode(final Cigar cigar) { if (cigar.numCigarElements() == 0) { return new int[0]; } final int[] binaryCigar = new int[cigar.numCigarElements()]; int binaryCigarLength = 0; for (int i = 0; i < cigar.numCigarElements(); ++i) { final CigarElement cigarElement = cigar.getCigarElement(i); final int op = cigarElement.getOperator().getBamEncoding(); binaryCigar[binaryCigarLength++] = cigarElement.getLength() << 4 | op; } return binaryCigar; }
Source:
private String formatRoute(Collection<IResourceUIModel> routes) { if(routes.size() > 0) { IRoute route = (IRoute)routes.iterator().next().getResource(); return String.format("%s%s", route.getHost(), route.getPath()); } return ""; }

Target:
private String formatRoute(Collection<IResourceUIModel> routes) { if(routes.size() > 0) { IRoute route = (IRoute)routes.iterator().next().getResource(); return route.getURL(); } return ""; }
Source:
protected RepositoryMetadata resolveFromInterface(Class<?> repositoryInterface) { if (!Repository.class.isAssignableFrom(repositoryInterface)) { throw new RepositoryDefinitionException(repositoryInterface, "Expected interface to extend " + Repository.class); } final Class<?>[] arguments = GenericTypeResolver.resolveTypeArguments(repositoryInterface, Repository.class); final Class<?> entityType = arguments[0]; final Class<?> rawIdType = arguments[1]; final Class<?> idType = rawIdType.asSubclass(Object.class); final String idProperty = resolveIdProperty(entityType, idType); return new ImmutableRepositoryMetadata(idType, entityType, repositoryInterface, idProperty); }

Target:
protected RepositoryMetadata resolveFromInterface(Class<?> repositoryInterface) { if (!Repository.class.isAssignableFrom(repositoryInterface)) { throw new RepositoryDefinitionException(repositoryInterface, "Expected interface to extend " + Repository.class); } final Class<?>[] arguments = GenericTypeResolver.resolveTypeArguments(repositoryInterface, Repository.class); final Class<?> entityType = arguments[0]; final Class<?> idType = arguments[1]; final String idProperty = resolveIdProperty(entityType, idType); return new ImmutableRepositoryMetadata(idType, entityType, repositoryInterface, idProperty); }
Source:
private MediaLayout createPromptMedia(DisplayUnit display) { DisplayData displayData = display.evaluate(); String promptText = Localizer.processArguments(displayData.getName(), new String[]{""}).trim(); TextView text = new TextView(getApplicationContext()); text.setText(promptText); int padding = (int)getResources().getDimension(R.dimen.help_text_padding); text.setPadding(0, 0, 0, 7); MediaLayout helpLayout = new MediaLayout(this); helpLayout.setAVT(text, displayData.getAudioURI(), displayData.getImageURI(), true); helpLayout.setPadding(padding, padding, padding, padding); text.setTextColor(Color.BLACK); return helpLayout; }

Target:
private MediaLayout createPromptMedia(DisplayUnit display) { DisplayData displayData = display.evaluate(); String promptText = Localizer.processArguments(displayData.getName(), new String[]{""}).trim(); TextView text = new TextView(getApplicationContext()); text.setText(promptText); text.setPadding(0, 0, 0, 7); text.setTextColor(Color.BLACK); MediaLayout helpLayout = new MediaLayout(this); helpLayout.setAVT(text, displayData.getAudioURI(), displayData.getImageURI(), true); int padding = (int)getResources().getDimension(R.dimen.help_text_padding); helpLayout.setPadding(padding, padding, padding, padding); return helpLayout; }
Source:
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); inflater.inflate(R.menu.file_actions_menu, menu); MenuItem item = menu.findItem(R.id.action_see_details); if (item != null) { item.setVisible(false); item.setEnabled(false); } item = menu.findItem(R.id.action_send_file); boolean sendEnabled = getString(R.string.send_files_to_other_apps).equalsIgnoreCase("on"); if (item != null && sendEnabled) { item.setVisible(true); item.setEnabled(true); } else { item.setVisible(false); item.setEnabled(false); } }

Target:
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); inflater.inflate(R.menu.file_actions_menu, menu); MenuItem item = menu.findItem(R.id.action_see_details); if (item != null) { item.setVisible(false); item.setEnabled(false); } item = menu.findItem(R.id.action_send_file); boolean sendEnabled = getString(R.string.send_files_to_other_apps).equalsIgnoreCase("on"); if (item != null) { if (sendEnabled) { item.setVisible(true); item.setEnabled(true); } else { item.setVisible(false); item.setEnabled(false); } } }
Source:
protected Node getContainerNode(Node currentNode, org.jbpm.workflow.core.NodeContainer nodeContainer, long nodeId) { for (Node node : nodeContainer.getNodes()) { if (nodeId == node.getId()) { if (currentNode != null) { return currentNode; } } else { if (node instanceof org.jbpm.workflow.core.NodeContainer) { return getContainerNode(node, (org.jbpm.workflow.core.NodeContainer) node, nodeId); } } } return null; }

Target:
protected Node getContainerNode(Node currentNode, org.jbpm.workflow.core.NodeContainer nodeContainer, long nodeId) { for (Node node : nodeContainer.getNodes()) { if (nodeId == node.getId()) { return currentNode; } else { if (node instanceof org.jbpm.workflow.core.NodeContainer) { return getContainerNode(node, (org.jbpm.workflow.core.NodeContainer) node, nodeId); } } } return null; }
Source:
private void startRealtimeUpdates(Bundle params, Itinerary itinerary) { Log.d(TAG, "Checking whether to start realtime updates."); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); if (prefs.getBoolean(OTPConstants.PREFERENCE_KEY_LIVE_UPDATES, true)) { boolean realtimeLegsOnItineraries = true; for (Leg leg : itinerary.legs) { if (leg.realTime) { realtimeLegsOnItineraries = true; } } if (realtimeLegsOnItineraries) { Log.d(TAG, "Starting realtime updates for itinerary"); getAlarmManager().setInexactRepeating(AlarmManager.RTC, new Date().getTime(), OTPConstants.DEFAULT_UPDATE_INTERVAL_TRIP_TIME, getAlarmIntent(params)); } else { Log.d(TAG, "No realtime legs on itinerary"); } } }

Target:
private void startRealtimeUpdates(Bundle params, Itinerary itinerary) { Log.d(TAG, "Checking whether to start realtime updates."); boolean realtimeLegsOnItineraries = false; for (Leg leg : itinerary.legs) { if (leg.realTime) { realtimeLegsOnItineraries = true; } } if (realtimeLegsOnItineraries) { Log.d(TAG, "Starting realtime updates for itinerary"); getAlarmManager().setInexactRepeating(AlarmManager.RTC, new Date().getTime(), OTPConstants.DEFAULT_UPDATE_INTERVAL_TRIP_TIME, getAlarmIntent(params)); } else { Log.d(TAG, "No realtime legs on itinerary"); } }
Source:
public void setBucketTags(SetBucketTagsArgs args) throws ErrorResponseException, IllegalArgumentException, InsufficientDataException, InternalException, InvalidBucketNameException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, XmlParserException { if (args == null) { throw new IllegalArgumentException("null arguments"); } Map<String, String> queryParamMap = new HashMap<>(); queryParamMap.put("tagging", ""); Response response = executePut(args.bucket(), null, null, queryParamMap, args.tags(), 0); response.body().close(); }

Target:
public void setBucketTags(SetBucketTagsArgs args) throws ErrorResponseException, IllegalArgumentException, InsufficientDataException, InternalException, InvalidBucketNameException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, XmlParserException { checkArgs(args); Map<String, String> queryParamMap = new HashMap<>(); queryParamMap.put("tagging", ""); Response response = executePut(args.bucket(), null, null, queryParamMap, args.tags(), 0); response.close(); }
Source:
public Resource getResource(final String resourceName, final int resourceType, final String encoding) throws ResourceNotFoundException, ParseErrorException { final HttpServletRequest request = HttpServletRequestThreadLocal.INSTANCE.getRequest(); final User user = getUser(request); final String resourceKey = resourceType + resourceName + user.getUserId(); Resource resource = globalCache.get(resourceKey); if (resource != null) { try { if (resource.requiresChecking()) { resource = refreshResource(resource, encoding); } } catch (ResourceNotFoundException rnfe) { globalCache.remove(resourceKey); return getResource(resourceName, resourceType, encoding); } catch (ParseErrorException pee) { Logger.error(this,"ResourceManager.getResource() exception", pee); throw pee; } catch (RuntimeException re) { Logger.error(this,"ResourceManager.getResource() exception", re); throw re; } } else { try { resource = loadResource(resourceName, resourceType, encoding); if (DotResourceLoader.getInstance().isCachingOn()) { globalCache.put(resourceKey, resource); } } catch (ResourceNotFoundException rnfe) { Logger.error(this,"ResourceManager : unable to find resource '" + resourceName + "' in any resource loader."); throw rnfe; } catch (ParseErrorException pee) { Logger.error(this,"ResourceManager.getResource() parse exception", pee); throw pee; } catch (RuntimeException re) { Logger.error(this,"ResourceManager.getResource() load exception", re); throw re; } } return resource; }

Target:
public Resource getResource(final String resourceName, final int resourceType, final String encoding) throws ResourceNotFoundException, ParseErrorException { final HttpServletRequest request = HttpServletRequestThreadLocal.INSTANCE.getRequest(); final String resourceKey = resourceType + resourceName; Resource resource = globalCache.get(resourceKey); if (resource != null) { try { if (resource.requiresChecking()) { resource = refreshResource(resource, encoding); } } catch (ResourceNotFoundException rnfe) { globalCache.remove(resourceKey); return getResource(resourceName, resourceType, encoding); } catch (ParseErrorException pee) { Logger.error(this,"ResourceManager.getResource() exception", pee); throw pee; } catch (RuntimeException re) { Logger.error(this,"ResourceManager.getResource() exception", re); throw re; } } else { try { resource = loadResource(resourceName, resourceType, encoding); if (DotResourceLoader.getInstance().isCachingOn()) { globalCache.put(resourceKey, resource); } } catch (ResourceNotFoundException rnfe) { Logger.error(this,"ResourceManager : unable to find resource '" + resourceName + "' in any resource loader."); throw rnfe; } catch (ParseErrorException pee) { Logger.error(this,"ResourceManager.getResource() parse exception", pee); throw pee; } catch (RuntimeException re) { Logger.error(this,"ResourceManager.getResource() load exception", re); throw re; } } return resource; }
Source:
public Slf4jReporter build() { LoggerHelper loggerHelper; switch (loggingLevel) { case TRACE: loggerHelper = new TraceLoggerHelper(logger); break; case DEBUG: loggerHelper = new DebugLoggerHelper(logger); break; case INFO: loggerHelper = new InfoLoggerHelper(logger); break; case WARN: loggerHelper = new WarnLoggerHelper(logger); break; case ERROR: loggerHelper = new ErrorLoggerHelper(logger); break; } loggerHelper = new DebugLoggerHelper(logger); return new Slf4jReporter(registry, loggerHelper, marker, rateUnit, durationUnit, filter); }

Target:
public Slf4jReporter build() { LoggerHelper loggerHelper; switch (loggingLevel) { case ERROR: loggerHelper = new ErrorLoggerHelper(logger); break; case WARN: loggerHelper = new WarnLoggerHelper(logger); break; case INFO: loggerHelper = new InfoLoggerHelper(logger); break; case TRACE: loggerHelper = new TraceLoggerHelper(logger); break; default: loggerHelper = new DebugLoggerHelper(logger); break; } return new Slf4jReporter(registry, loggerHelper, marker, rateUnit, durationUnit, filter); }
Source:
public void unregisterAll() { metricsModes.clear(); }

Target:
public void unregisterAll() { modes.clear(); cursor = 0; register(defaultMode); currentMode = defaultMode; }
Source:
public boolean hasCompatibleAnalyzer(LuceneFieldPredicateBuilderFactory other) { if ( !( other instanceof LuceneTextFieldPredicateBuilderFactory ) ) { return false; } LuceneTextFieldPredicateBuilderFactory castedOther = (LuceneTextFieldPredicateBuilderFactory) other; return Objects.equals( analyzer, castedOther.analyzer ) && Objects.equals( searchAnalyzer, castedOther.searchAnalyzer ) && Objects.equals( normalizer, castedOther.normalizer ); }

Target:
public boolean hasCompatibleAnalyzer(LuceneFieldPredicateBuilderFactory other) { if ( !( other instanceof LuceneTextFieldPredicateBuilderFactory ) ) { return false; } LuceneTextFieldPredicateBuilderFactory castedOther = (LuceneTextFieldPredicateBuilderFactory) other; return Objects.equals( analyzerOrNormalizer, castedOther.analyzerOrNormalizer ); }
Source:
public void validateRetentionPolicy() { String[] validSet = new String[]{"true", "keep_all", "false", "keep_none", "10 files", "10k files", "10K size", "10m txs", "10M entries", "10g hours", "10G days"}; String[] invalidSet = new String[]{"invalid", "all", "10", "10k", "10k a"}; for ( String valid : validSet ) { Config.defaults( keep_logical_logs, valid ); } for ( String invalid : invalidSet ) { try { Config.defaults( keep_logical_logs, invalid ); fail( "Value \"" + invalid + "\" should be considered invalid" ); } catch ( InvalidSettingException ignored ) { } } }

Target:
public void validateRetentionPolicy() { String[] validSet = new String[]{"true", "keep_all", "false", "keep_none", "10 files", "10k files", "10K size", "10m txs", "10M entries", "10g hours", "10G days"}; String[] invalidSet = new String[]{"invalid", "all", "10", "10k", "10k a"}; for ( String valid : validSet ) { assertEquals( valid, Config.defaults( keep_logical_logs, valid ).get( keep_logical_logs ) ); } for ( String invalid : invalidSet ) { try { Config.defaults( keep_logical_logs, invalid ); fail( "Value \"" + invalid + "\" should be considered invalid" ); } catch ( InvalidSettingException ignored ) { } } }
Source:
public void testAmend() throws Exception { Repository repository = lookupRepository(repositoryFile); RevCommit oldHeadCommit = TestUtil.getHeadCommit(repository); commitOneFileChange("Yet another Change"); RevCommit headCommit = TestUtil.getHeadCommit(repository); String changeId = CommitMessageUtil.extractChangeId(headCommit .getFullMessage()); configureTestCommitterAsUser(repository); setTestFileContent("Changes over changes"); CommitDialogTester commitDialogTester = CommitDialogTester .openCommitDialog(PROJ1); commitDialogTester.setAmend(true); assertTrue(commitDialogTester.getCommitMessage().indexOf("Change-Id") > 0); assertTrue(commitDialogTester.getCommitMessage().indexOf( "Signed-off-by") > 0); assertTrue(commitDialogTester.getSignedOff()); assertTrue(commitDialogTester.getInsertChangeId()); commitDialogTester.commit(); headCommit = TestUtil.getHeadCommit(repository); assertEquals(oldHeadCommit, headCommit.getParent(0)); assertTrue(headCommit.getFullMessage().indexOf(changeId) > 0); }

Target:
public void testAmend() throws Exception { Repository repository = lookupRepository(repositoryFile); RevCommit oldHeadCommit = TestUtil.getHeadCommit(repository); commitOneFileChange("Yet another Change"); RevCommit headCommit = TestUtil.getHeadCommit(repository); String changeId = CommitMessageUtil.extractChangeId(headCommit .getFullMessage().replaceAll("\n", Text.DELIMITER)); configureTestCommitterAsUser(repository); setTestFileContent("Changes over changes"); CommitDialogTester commitDialogTester = CommitDialogTester .openCommitDialog(PROJ1); commitDialogTester.setAmend(true); assertTrue(commitDialogTester.getCommitMessage().indexOf("Change-Id") > 0); assertTrue(commitDialogTester.getCommitMessage().indexOf( "Signed-off-by") > 0); assertTrue(commitDialogTester.getSignedOff()); assertTrue(commitDialogTester.getInsertChangeId()); commitDialogTester.commit(); headCommit = TestUtil.getHeadCommit(repository); assertEquals(oldHeadCommit, headCommit.getParent(0)); assertTrue(headCommit.getFullMessage().indexOf(changeId) > 0); }
Source:
public Server getServer(ObjectNode obj, String location, ParseResult result) { if (obj == null) { return null; } Server server = new Server(); String value = getString("url", obj, true, location, result); server.setUrl(value); value = getString("description", obj, false, location, result); server.setDescription(value); server.setVariables(getServerVariables(obj,location,result)); server.setExtensions(new LinkedHashMap<>()); Set<String> keys = getKeys(obj); for(String key : keys) { if(key.startsWith("x-")) { server.getExtensions().put(key, Json.mapper().convertValue(obj.get(key), Object.class)); } } return server; }

Target:
public Server getServer(ObjectNode obj, String location, ParseResult result) { if (obj == null) { return null; } Server server = new Server(); String value = getString("url", obj, true, location, result); if(StringUtils.isNotBlank(value)) { server.setUrl(value); } value = getString("description", obj, false, location, result); if(StringUtils.isNotBlank(value)) { server.setDescription(value); } ServerVariables serverVariables = getServerVariables(obj,location,result); if (serverVariables != null && serverVariables.size() > 0){ server.setVariables(serverVariables); } Map <String,Object> extensions = getExtensions(obj,location,result); if(extensions != null && extensions.size() > 0) { server.setExtensions(extensions); } return server; }
Source:
public boolean process(Exchange exchange, AsyncCallback callback) { final Message in = exchange.getIn(); String firebaseKey = (String) in.getHeader(endpoint.getKeyName()); Object value = in.getBody(); DatabaseReference ref = FirebaseDatabase .getInstance(endpoint.getFirebaseApp()) .getReference(rootReference).child(firebaseKey); ref.setValue(value, (DatabaseError databaseError, DatabaseReference databaseReference) -> { if (databaseError != null) { exchange.setException(new DatabaseErrorException(databaseError)); exchange.getOut().setFault(true); } else { exchange.getOut().setBody(databaseReference); } callback.done(endpoint.isAsync()); }); return endpoint.isAsync(); }

Target:
public boolean process(Exchange exchange, AsyncCallback callback) { final Message in = exchange.getIn(); final Message out = exchange.getOut(); String firebaseKey = (String) in.getHeader(endpoint.getKeyName()); Object value = in.getBody(); DatabaseReference ref = FirebaseDatabase .getInstance(endpoint.getFirebaseApp()) .getReference(rootReference).child(firebaseKey); final boolean reply = endpoint.isReply(); out.setHeaders(in.getHeaders()); if (reply) { processReply(exchange, callback, value, ref); } else { ref.setValue(value); out.setBody(in.getBody()); callback.done(true); } return !reply; }
Source:
public void testCreatePayment() { Account account = new Account("GATEWAY_ACCOUNT_ID", TokenPaymentType.CARD); CreatePaymentRequest requestPayload = new CreatePaymentRequest(100, "<LINK_1>", "a reference", "a description"); createPaymentService.invoke(account, requestPayload); }

Target:
public void testCreatePayment() { Account account = new Account("GATEWAY_ACCOUNT_ID", TokenPaymentType.CARD); CreatePaymentRequest requestPayload = new CreatePaymentRequest(100, "<LINK_1>", "a reference", "a description"); PaymentWithAllLinks paymentResponse = createPaymentService.create(account, requestPayload); assertThat(paymentResponse.getPayment().getPaymentId(), is("ch_ab2341da231434l")); assertThat(paymentResponse.getPayment().getAmount(), is(100L)); assertThat(paymentResponse.getPayment().getReference(), is("a reference")); assertThat(paymentResponse.getPayment().getDescription(), is("a description")); assertThat(paymentResponse.getPayment().getEmail(), is(nullValue())); assertThat(paymentResponse.getPayment().getState(), is(new PaymentState("created", false))); assertThat(paymentResponse.getPayment().getReturnUrl(), is("<LINK_1>")); assertThat(paymentResponse.getPayment().getPaymentProvider(), is("Sandbox")); assertThat(paymentResponse.getPayment().getCreatedDate(), is("2016-01-01T12:00:00Z")); assertThat(paymentResponse.getLinks().getSelf(), is(new Link("<LINK_0>", "GET"))); assertThat(paymentResponse.getLinks().getNextUrl(), is(new Link("http://frontend_connector/charge/token_1234567asdf", "GET"))); PostLink expectedLink = new PostLink("http://frontend_connector/charge/", "POST", "application/x-www-form-urlencoded", Collections.singletonMap("chargeTokenId", "token_1234567asdf")); assertThat(paymentResponse.getLinks().getNextUrlPost(), is(expectedLink)); }
Source:
private void addShowTextItem(final Menu menu) { final MenuItem showtextMenuItem = new MenuItem(menu, SWT.CHECK); showtextMenuItem.setText(WorkbenchMessages.PerspectiveBar_showText); showtextMenuItem.addSelectionListener(widgetSelectedAdapter(e -> { boolean preference = showtextMenuItem.getSelection(); if (preference != PrefUtil.getAPIPreferenceStore().getDefaultBoolean( IWorkbenchPreferenceConstants.SHOW_TEXT_ON_PERSPECTIVE_BAR)) { PrefUtil.getInternalPreferenceStore().setValue( IPreferenceConstants.OVERRIDE_PRESENTATION, true); } PrefUtil.getAPIPreferenceStore().setValue( IWorkbenchPreferenceConstants.SHOW_TEXT_ON_PERSPECTIVE_BAR, preference); changeShowText(preference); })); showtextMenuItem.setSelection(PrefUtil.getAPIPreferenceStore().getBoolean( IWorkbenchPreferenceConstants.SHOW_TEXT_ON_PERSPECTIVE_BAR)); }

Target:
private void addShowTextItem(final Menu menu) { final MenuItem showtextMenuItem = new MenuItem(menu, SWT.CHECK); showtextMenuItem.setText(WorkbenchMessages.PerspectiveBar_showText); String showTextOnPerspectiveBarPreference = IWorkbenchPreferenceConstants.SHOW_TEXT_ON_PERSPECTIVE_BAR; showtextMenuItem.addSelectionListener(widgetSelectedAdapter(e -> { boolean preference = showtextMenuItem.getSelection(); IPreferenceStore apiPreferenceStore = PrefUtil.getAPIPreferenceStore(); if (preference != apiPreferenceStore.getDefaultBoolean(showTextOnPerspectiveBarPreference)) { PrefUtil.getInternalPreferenceStore().setValue(IPreferenceConstants.OVERRIDE_PRESENTATION, true); } apiPreferenceStore.setValue(showTextOnPerspectiveBarPreference, preference); changeShowText(preference); })); showtextMenuItem.setSelection(PrefUtil.getAPIPreferenceStore().getBoolean(showTextOnPerspectiveBarPreference)); }
Source:
private void setupGetNewSensorTest(final Metrics metrics, final String level, final RecordingLevel recordingLevel) { final String fullSensorName = INTERNAL_PREFIX + SENSOR_PREFIX_DELIMITER + level + SENSOR_NAME_DELIMITER + sensorName1; expect(metrics.getSensor(fullSensorName)).andStubReturn(null); final Sensor[] parents = {}; expect(metrics.sensor(fullSensorName, recordingLevel, parents)).andReturn(sensor); replay(metrics); }

Target:
private void setupGetNewSensorTest(final Metrics metrics, final String level, final RecordingLevel recordingLevel) { final String fullSensorName = fullSensorName(level); expect(metrics.getSensor(fullSensorName)).andStubReturn(null); final Sensor[] parents = {}; expect(metrics.sensor(fullSensorName, recordingLevel, parents)).andReturn(sensor); replay(metrics); }
Source:
private void visitSwitchInsn(final Label dflt, final Label[] labels) { visitInsn(); LabelInfo.resetDone(labels); int branch = 0; jumps.add(new Jump(lastInsn, dflt, branch)); LabelInfo.setDone(dflt); for (final Label l : labels) { branch++; if (!LabelInfo.isDone(l)) { jumps.add(new Jump(lastInsn, l, branch)); LabelInfo.setDone(l); } } }

Target:
private void visitSwitchInsn(final Label dflt, final Label[] labels) { visitInsn(); LabelInfo.resetDone(labels); int branch = 0; jumps.add(new Jump(lastInsn, dflt, branch)); LabelInfo.setDone(dflt); for (final Label l : labels) { if (!LabelInfo.isDone(l)) { branch++; jumps.add(new Jump(lastInsn, l, branch)); LabelInfo.setDone(l); } } }
Source:
public EntityImage(Image base, Image wreck, int tint, Image camo, Component comp, Entity entity, int secondaryPos, boolean preview) { this.base = base; this.tint = tint; this.camo = camo; parent = comp; this.wreck = wreck; this.dmgLevel = entity.getDamageLevel(); this.weight = entity.getWeight(); isInfantry = entity instanceof Infantry; isSecondaryPos = secondaryPos != 0 && secondaryPos != -1; isPreview = preview; isSlim = entity instanceof Tank || entity instanceof Aero; isVerySlim = entity instanceof VTOL; }

Target:
public EntityImage(Image base, Image wreck, int tint, Image camo, Component comp, Entity entity, int secondaryPos, boolean preview) { this.base = base; this.tint = tint; this.camo = camo; parent = comp; this.wreck = wreck; this.dmgLevel = entity.getDamageLevel(); this.weight = entity.getWeight(); isInfantry = entity instanceof Infantry; isPreview = preview; isSlim = entity instanceof Tank || entity instanceof Aero; isVerySlim = entity instanceof VTOL; pos = secondaryPos; isSingleHex = secondaryPos == -1; decal = getDamageDecal(entity, secondaryPos); smoke = getSmokeImage(entity, secondaryPos); }
Source:
public void defaultSharedPreferences() throws Exception { final String KEY = "app_language_selection_pref_key"; final String DATA = "us-en"; SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); sharedPreferences.edit().putString("foo", "bar").commit(); SharedPreferences anotherSharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); String restored = anotherSharedPreferences.getString("foo", null); assertThat(restored).isEqualTo(restored); }

Target:
public void defaultSharedPreferences() throws Exception { SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); sharedPreferences.edit().putString("foo", "bar").commit(); SharedPreferences anotherSharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); String restored = anotherSharedPreferences.getString("foo", null); assertThat(restored).isEqualTo("bar"); }
Source:
public void register_with_invalid_request() throws InterruptedException, IOException { helper.assertClientNotRegisterered(); Request coapRequest = new Request(Code.POST); coapRequest.setDestination(helper.server.getNonSecureAddress().getAddress()); coapRequest.setDestinationPort(helper.server.getNonSecureAddress().getPort()); coapRequest.getOptions().setContentFormat(ContentFormat.LINK.getCode()); coapRequest.getOptions().addUriPath("rd"); coapRequest.getOptions().addUriQuery("ep=" + helper.currentEndpointIdentifier); CoapEndpoint coapEndpoint = new CoapEndpoint(new InetSocketAddress(0)); coapEndpoint.start(); coapEndpoint.sendRequest(coapRequest); Response response = coapRequest.waitForResponse(1000); assertEquals(response.getCode(), org.eclipse.californium.core.coap.CoAP.ResponseCode.BAD_REQUEST); System.out.println(response.getPayloadString()); coapEndpoint.stop(); }

Target:
public void register_with_invalid_request() throws InterruptedException, IOException { helper.assertClientNotRegisterered(); Request coapRequest = new Request(Code.POST); coapRequest.setDestination(helper.server.getNonSecureAddress().getAddress()); coapRequest.setDestinationPort(helper.server.getNonSecureAddress().getPort()); coapRequest.getOptions().setContentFormat(ContentFormat.LINK.getCode()); coapRequest.getOptions().addUriPath("rd"); coapRequest.getOptions().addUriQuery("ep=" + helper.currentEndpointIdentifier); CoapEndpoint coapEndpoint = new CoapEndpoint(new InetSocketAddress(0)); coapEndpoint.start(); coapEndpoint.sendRequest(coapRequest); Response response = coapRequest.waitForResponse(1000); assertEquals(response.getCode(), org.eclipse.californium.core.coap.CoAP.ResponseCode.BAD_REQUEST); coapEndpoint.stop(); }
Source:
public OperationResult<List<String>> d_mget(final String... keys) { if (CompressionStrategy.NONE == connPool.getConfiguration().getCompressionStrategy()) { return connPool.executeWithFailover(new MultiKeyOperation<List<String>>(new ArrayList<String>(Arrays.asList(keys)), OpName.MGET) { @Override public List<String> execute(Jedis client, ConnectionContext state) { return client.mget(keys); } }); } else { return connPool.executeWithFailover(new CompressionValueMultiKeyOperation<List<String>>(new ArrayList<String>(Arrays.asList(keys)), OpName.MGET) { @Override public List<String> execute(final Jedis client, final ConnectionContext state) throws DynoException { return new ArrayList<String>(CollectionUtils.transform(client.mget(keys), new CollectionUtils.Transform<String, String>() { @Override public String get(String s) { return decompressValue(s, state); } })); } }); } }

Target:
public OperationResult<List<String>> d_mget(final String... keys) { if (CompressionStrategy.NONE == connPool.getConfiguration().getCompressionStrategy()) { return connPool.executeWithFailover(new MultiKeyOperation<List<String>>(Arrays.asList(keys), OpName.MGET) { @Override public List<String> execute(Jedis client, ConnectionContext state) { return client.mget(keys); } }); } else { return connPool.executeWithFailover(new CompressionValueMultiKeyOperation<List<String>>(Arrays.asList(keys), OpName.MGET) { @Override public List<String> execute(final Jedis client, final ConnectionContext state) throws DynoException { return new ArrayList<String>(CollectionUtils.transform(client.mget(keys), new CollectionUtils.Transform<String, String>() { @Override public String get(String s) { return decompressValue(s, state); } })); } }); } }
Source:
public long size() { return cacheHash.size(); }

Target:
public int size() { return conflictKeys.size(); }
Source:
public static void initialize() { if (INITIALIZED) { return; } INITIALIZED = true; final String pack = "org.spongepowered.common.launch.transformer.tracker."; Launch.classLoader.addTransformerExclusion(pack); Launch.classLoader.registerTransformer(pack + "TrackerClassTransformer"); }

Target:
public static void initialize() { if (initialized) { return; } initialized = true; Launch.classLoader.addTransformerExclusion("org.spongepowered.common.launch.transformer.tracker."); Launch.classLoader.registerTransformer("org.spongepowered.common.launch.transformer.tracker.TrackerClassTransformer"); }
Source:
public void testCastWithJsonParse() { assertCastWithJsonParse("[[1,1], [2,2]]", "ARRAY<ARRAY<INTEGER>>", new ArrayType(new ArrayType(INTEGER)), ImmutableList.of(ImmutableList.of(1, 1), ImmutableList.of(2, 2))); assertInvalidCastWithJsonParse("[1, false]", "ARRAY<INTEGER>", INVALID_CAST_ARGUMENT); assertCastWithJsonParse("{\"a\"\n:1, \"b\":\t2}", "MAP<VARCHAR,INTEGER>", mapType(VARCHAR, INTEGER), ImmutableMap.of("a", 1, "b", 2)); assertInvalidCastWithJsonParse("{\"[1, 1]\":[2, 2]}", "MAP<ARRAY<INTEGER>,ARRAY<INTEGER>>", INVALID_CAST_ARGUMENT); assertInvalidCastWithJsonParse("{true: false, false:false}", "MAP<BOOLEAN,BOOLEAN>", INVALID_CAST_ARGUMENT); }

Target:
public void testCastWithJsonParse() { assertCastWithJsonParse("[[1,1], [2,2]]", "ARRAY<ARRAY<INTEGER>>", new ArrayType(new ArrayType(INTEGER)), ImmutableList.of(ImmutableList.of(1, 1), ImmutableList.of(2, 2))); assertInvalidCastWithJsonParse("[1, \"abc\"]", "ARRAY<INTEGER>", INVALID_CAST_ARGUMENT, "Cannot cast to array(integer)"); assertCastWithJsonParse("{\"a\"\n:1, \"b\":\t2}", "MAP<VARCHAR,INTEGER>", mapType(VARCHAR, INTEGER), ImmutableMap.of("a", 1, "b", 2)); assertInvalidCastWithJsonParse("{\"[1, 1]\":[2, 2]}", "MAP<ARRAY<INTEGER>,ARRAY<INTEGER>>", INVALID_CAST_ARGUMENT, "Cannot cast JSON to map(array(integer),array(integer))"); assertInvalidCastWithJsonParse("{true: false, false:false}", "MAP<BOOLEAN,BOOLEAN>", INVALID_CAST_ARGUMENT, "Cannot cast to map(boolean,boolean)"); }
Source:
SourceDescriptionFile(File sourceDescriptionFile, ResourceSyncUriHelper uriHelper) throws ResourceSyncException { xmlHelper = new ResourceSyncXmlHelper(sourceDescriptionFile, this::updateMetaData); this.uriHelper = uriHelper; }

Target:
SourceDescriptionFile(File sourceDescriptionFile, ResourceSyncUriHelper uriHelper) throws ResourceSyncException { this.uriHelper = uriHelper; this.xmlHelper = new ResourceSyncXmlHelper(sourceDescriptionFile); xmlHelper.getOrCreateMetadataNode().setAttribute("capability", "description"); }
Source:
public void testSpelUnauthorizedType2() throws ValidationException { SpelValidator validator = new SpelValidator("T(java.lang.Runtime).getRuntime().exec('sleep 100') instanceof T(Integer)"); String value = "MyString123"; validator.validate(value, new ModelValidatorContext(context)); }

Target:
public void testSpelUnauthorizedType2() throws ValidationException { SpelValidator validator = new SpelValidator("T(java.lang.Runtime).getRuntime().exec('hostname').waitFor() instanceof T(Integer)"); String value = "MyString123"; validator.validate(value, new ModelValidatorContext(context)); }