auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void selectAllImages() { for(ImageItem imageItem : localImageList) { imageItem.isSelected = true; deletableList.add(imageItem.path); } notifyDataSetChanged(); }

Target:
public void selectAllImages() { for(ImageItem imageItem : localImageList) { if(!deletableList.contains(imageItem.path)) { imageItem.isSelected = true; deletableList.add(imageItem.path); } } notifyDataSetChanged(); }
Source:
private List<HttpCookie> processCookieHeader(String headerKey, List<String> headerValues) { List<HttpCookie> foundCookies = new LinkedList<>(); for (String headerValue : headerValues) { foundCookies .addAll(HttpCookie.parse(headerKey + ':' + headerValue)); } return foundCookies; }

Target:
private List<HttpCookie> processCookieHeader(String headerKey, List<String> headerValues) { List<HttpCookie> foundCookies = new LinkedList<>(); for (String headerValue : headerValues) { foundCookies .addAll(HttpCookie.parse(headerKey + ':' + headerValue)); } for (HttpCookie foundCookie : foundCookies) { String domain = foundCookie.getDomain(); if (domain != null && domain.startsWith(".")) { foundCookie.setDomain(domain.substring(1)); } } return foundCookies; }
Source:
private Person[] createModel() { Person[] elements = new Person[4]; elements[0] = new Person("Tom", "Schindl", "tom.schindl@bestsolution.at", "M"); elements[1] = new Person("Boris", "Bokowski", "Boris_Bokowski@ca.ibm.com", "M"); elements[2] = new Person("Tod", "Creasey", "Tod_Creasey@ca.ibm.com", "M"); elements[3] = new Person("Wayne", "Beaton", "wayne@eclipse.org", "M"); return elements; }

Target:
private Person[] createModel() { return new Person[] { new Person("Tom", "Schindl", "tom.schindl@bestsolution.at", "M"), new Person("Boris", "Bokowski", "Boris_Bokowski@ca.ibm.com", "M"), new Person("Tod", "Creasey", "Tod_Creasey@ca.ibm.com", "M"), new Person("Wayne", "Beaton", "wayne@eclipse.org", "M"), new Person("Jeanderson", "Candido", "jeandersonbc@gmail.com", "M"), new Person("Lars", "Vogel", "lars.vogel@gmail.com", "M"), new Person("Hendrik", "Still", "hendrik.still@vogella.com", "M") }; }
Source:
private <T extends RMEvent> long findLargestCounter(Collection<T> events) { final Optional<T> max = events.stream().max(Comparator.comparing(RMEvent::getCounter)); return max.map(RMEvent::getCounter).orElse(0l); }

Target:
private <T extends RMEvent> long findLargestCounter(Collection<T> events) { final Optional<T> max = events.stream().max(Comparator.comparing(RMEvent::getCounter)); return max.map(RMEvent::getCounter).orElse(EMPTY_STATE); }
Source:
public synchronized void timeUpdated(final TmfTimeSynchSignal signal) { final ITmfTimestamp ts = signal.getCurrentTime(); if (ts.intersects(getCurrentValidTimerange())) { TmfTraceContext prevCtx = getCurrentTraceContext(); TmfTraceContext newCtx = new TmfTraceContext(prevCtx, ts); fTraces.put(fCurrentTrace, newCtx); } }

Target:
public synchronized void timeUpdated(final TmfTimeSynchSignal signal) { final ITmfTimestamp ts = signal.getCurrentTime(); for (Map.Entry<ITmfTrace, TmfTraceContext> entry : fTraces.entrySet()) { final ITmfTrace trace = entry.getKey(); if (ts.intersects(getCurrentTimeRange(trace))) { TmfTraceContext prevCtx = entry.getValue(); TmfTraceContext newCtx = new TmfTraceContext(prevCtx, ts); entry.setValue(newCtx); } } }
Source:
public static void setUpLocale() throws Exception { Locale.setDefault(Locale.US); }

Target:
public void setUpLocale() throws Exception { backupLocale = Locale.getDefault(); Locale.setDefault(Locale.ROOT); }
Source:
private static ContentValues toContentValues(ObaRegion region) { ContentValues values = new ContentValues(); values.put(ObaContract.Regions._ID, region.getId()); values.put(ObaContract.Regions.NAME, region.getName()); String obaUrl = region.getObaBaseUrl(); values.put(ObaContract.Regions.OBA_BASE_URL, obaUrl != null ? obaUrl : ""); String siriUrl = region.getSiriBaseUrl(); values.put(ObaContract.Regions.SIRI_BASE_URL, siriUrl != null ? siriUrl : ""); values.put(ObaContract.Regions.LANGUAGE, region.getLanguage()); values.put(ObaContract.Regions.CONTACT_EMAIL, region.getContactEmail()); values.put(ObaContract.Regions.SUPPORTS_OBA_DISCOVERY, region.getSupportsObaDiscoveryApis() ? 1 : 0); values.put(ObaContract.Regions.SUPPORTS_OBA_REALTIME, region.getSupportsObaRealtimeApis() ? 1 : 0); values.put(ObaContract.Regions.SUPPORTS_SIRI_REALTIME, region.getSupportsSiriRealtimeApis() ? 1 : 0); values.put(ObaContract.Regions.SUPPORTS_EMBEDDED_SOCIAL, region.getSupportsEmbeddedSocial() ? 1 : 0); values.put(ObaContract.Regions.TWITTER_URL, region.getTwitterUrl()); values.put(ObaContract.Regions.EXPERIMENTAL, region.getExperimental()); values.put(ObaContract.Regions.STOP_INFO_URL, region.getStopInfoUrl()); values.put(ObaContract.Regions.OTP_BASE_URL, region.getOtpBaseUrl()); values.put(ObaContract.Regions.OTP_CONTACT_EMAIL, region.getOtpContactEmail()); return values; }

Target:
private static ContentValues toContentValues(ObaRegion region) { ContentValues values = new ContentValues(); values.put(ObaContract.Regions._ID, region.getId()); values.put(ObaContract.Regions.NAME, region.getName()); String obaUrl = region.getObaBaseUrl(); values.put(ObaContract.Regions.OBA_BASE_URL, obaUrl != null ? obaUrl : ""); String siriUrl = region.getSiriBaseUrl(); values.put(ObaContract.Regions.SIRI_BASE_URL, siriUrl != null ? siriUrl : ""); values.put(ObaContract.Regions.LANGUAGE, region.getLanguage()); values.put(ObaContract.Regions.CONTACT_EMAIL, region.getContactEmail()); values.put(ObaContract.Regions.SUPPORTS_OBA_DISCOVERY, region.getSupportsObaDiscoveryApis() ? 1 : 0); values.put(ObaContract.Regions.SUPPORTS_OBA_REALTIME, region.getSupportsObaRealtimeApis() ? 1 : 0); values.put(ObaContract.Regions.SUPPORTS_SIRI_REALTIME, region.getSupportsSiriRealtimeApis() ? 1 : 0); values.put(ObaContract.Regions.TWITTER_URL, region.getTwitterUrl()); values.put(ObaContract.Regions.EXPERIMENTAL, region.getExperimental()); values.put(ObaContract.Regions.STOP_INFO_URL, region.getStopInfoUrl()); values.put(ObaContract.Regions.OTP_BASE_URL, region.getOtpBaseUrl()); values.put(ObaContract.Regions.OTP_CONTACT_EMAIL, region.getOtpContactEmail()); values.put(ObaContract.Regions.SUPPORTS_OTP_BIKESHARE, region.getSupportsOtpBikeshare() ? 1 : 0); values.put(ObaContract.Regions.SUPPORTS_EMBEDDED_SOCIAL, region.getSupportsEmbeddedSocial() ? 1 : 0); return values; }
Source:
private void putAllCookiesInASingleHeader(String host, CookieSpec matcher, Cookie[] cookies) { LOG.trace("enter putAllCookiesInASingleHeader(HttpState state, HttpConnection conn, Cookie[] cookies)" ); HashMap<String, Cookie> mergedCookies = new HashMap<String, Cookie>(); Header[] cookieLineHeaders = getRequestHeaderGroup().getHeaders(HttpHeader.COOKIE); for (Header cookieLineHeader : cookieLineHeaders) { List<Cookie> cookiesHeader = parseCookieHeader(host, cookieLineHeader.getValue()); for (Cookie cookieHeader: cookiesHeader){ mergedCookies.put(cookieHeader.getName(),cookieHeader); } getRequestHeaderGroup().removeHeader(cookieLineHeader); } for (Cookie cookie : cookies) { mergedCookies.put(cookie.getName(),cookie); } cookies = mergedCookies.values().toArray(new Cookie[mergedCookies.size()]); String s = matcher.formatCookies(cookies); getRequestHeaderGroup() .addHeader(new Header(HttpHeader.COOKIE, s, true)); }

Target:
private void putAllCookiesInASingleHeader(String host, CookieSpec matcher, Cookie[] cookies) { LOG.trace("enter putAllCookiesInASingleHeader(String host, CookieSpec matcher, Cookie[] cookies)" ); HashMap<String, Cookie> mergedCookies = new HashMap<String, Cookie>(); Header[] cookieLineHeaders = getRequestHeaderGroup().getHeaders(HttpHeader.COOKIE); for (Header cookieLineHeader : cookieLineHeaders) { List<Cookie> cookiesHeader = parseCookieHeader(host, cookieLineHeader.getValue()); for (Cookie cookieHeader: cookiesHeader){ mergedCookies.put(cookieHeader.getName(),cookieHeader); } getRequestHeaderGroup().removeHeader(cookieLineHeader); } for (Cookie cookie : cookies) { mergedCookies.put(cookie.getName(),cookie); } cookies = mergedCookies.values().toArray(new Cookie[mergedCookies.size()]); String s = matcher.formatCookies(cookies); getRequestHeaderGroup() .addHeader(new Header(HttpHeader.COOKIE, s, true)); }
Source:
public Integer getCreditsDistribution() { Thesis thesis = getThesis(); if (!thesis.hasCredits()) { return 0; } ThesisParticipationType type = this.getType(); if (type.equals(ThesisParticipationType.ORIENTATOR)) { if (thesis.getOrientatorCreditsDistribution() != null) { return thesis.getOrientatorCreditsDistribution(); } } if (type.equals(ThesisParticipationType.COORIENTATOR)) { if (thesis.getCoorientatorCreditsDistribution() != null) { return thesis.getCoorientatorCreditsDistribution(); } } return 0; }

Target:
public double getCreditsDistribution() { Thesis thesis = getThesis(); if (!thesis.hasCredits()) { return 0; } return getPercentageDistribution(); }
Source:
static void showBannerIfStartedOrExit( AbstractApplicationContext context ) { checkState( context.isRunning(), "Application context is not running." ); checkState( context.isActive(), "Application context is not active." ); checkState( startupRequirementsSatisfied( context ), "Startup requiremetns have not been met." ); showBanner(); }

Target:
static void showBannerIfStartedOrExit( AbstractApplicationContext context ) { checkState( context.isRunning(), "Application context is not running." ); checkState( context.isActive(), "Application context is not active." ); checkState( startupRequirementsSatisfied( context ), "Startup requirements have not been met." ); showBanner(); }
Source:
private void consume() { try { if (state.getType() == LogReplicationRuntimeStateType.STOPPED) { log.info("Log Replication Communication State Machine has been stopped. No more events will be processed."); return; } LogReplicationRuntimeEvent event = eventQueue.take(); try { LogReplicationRuntimeState newState = state.processEvent(event); transition(state, newState); state = newState; } catch (IllegalTransitionException illegalState) { log.error("Illegal log replication event when in state {}", event.getType(), state.getType()); } communicationFSMConsumer.submit(this::consume); } catch (Throwable t) { log.error("Error on event consumer: ", t); } }

Target:
private void consume() { try { if (state.getType() == LogReplicationRuntimeStateType.STOPPED) { log.info("Log Replication Communication State Machine has been stopped. No more events will be processed."); return; } LogReplicationRuntimeEvent event = eventQueue.take(); try { LogReplicationRuntimeState newState = state.processEvent(event); if (newState != null) { transition(state, newState); state = newState; } } catch (IllegalTransitionException illegalState) { log.error("Illegal log replication event when in state {}", event.getType(), state.getType()); } communicationFSMConsumer.submit(this::consume); } catch (Throwable t) { log.error("Error on event consumer: ", t); } }
Source:
public IManageablePage getPage(IPageContext context, int id) { IManageablePage page = super.getPage(context, id); if (page != null) { if (page instanceof SerializedPage == false) { throw new WicketRuntimeException("CryptingPageStore expects serialized pages"); } SerializedPage serializedPage = (SerializedPage)page; byte[] encrypted = serializedPage.getData(); byte[] decrypted = getSessionData(context).decrypt(encrypted); page = new SerializedPage(page.getPageId(), serializedPage.getPageType(), decrypted); } return page; }

Target:
public IManageablePage getPage(IPageContext context, int id) { IManageablePage page = getDelegate().getPage(context, id); if (page != null) { if (page instanceof SerializedPage == false) { throw new WicketRuntimeException("CryptingPageStore expects serialized pages"); } SerializedPage serializedPage = (SerializedPage)page; byte[] encrypted = serializedPage.getData(); byte[] decrypted = getSessionData(context).decrypt(encrypted); page = new SerializedPage(page.getPageId(), serializedPage.getPageType(), decrypted); } return page; }
Source:
private void applyFirstTimeChanges(ServletContext ctx, String modelPath, String modelUri, OntModel userModel) { log.info("Start with check: Reload firsttime files on start-up if changed"); boolean updatedFiles = false; OntModel baseModelFirsttimeBackup = ModelAccess.on(ctx).getOntModel(modelUri + "Firsttime"); log.debug("compare firsttime files with configuration models (backup from first start) for " + modelPath); OntModel baseModelFirsttime = VitroModelFactory.createOntologyModel(); RDFFilesLoader.loadFirstTimeFiles(ctx, modelPath, baseModelFirsttime, true); if (baseModelFirsttime.isIsomorphicWith(baseModelFirsttimeBackup)) { log.debug("They are the same, so do nothing"); } else { log.debug("they differ, compare values in configuration models with user's triplestore"); updatedFiles = applyChanges(baseModelFirsttimeBackup, baseModelFirsttime, userModel, modelPath); if (updatedFiles) log.info("The model was updated, " + modelPath); } }

Target:
private void applyFirstTimeChanges(ServletContext ctx, String modelPath, String modelUri, OntModel userModel) { log.info("Reload firsttime files on start-up if changed: '" + modelPath +"', URI: '" + modelUri + "'"); boolean updatedFiles = false; OntModel baseModelFirsttimeBackup = ModelAccess.on(ctx).getOntModel(modelUri + "FirsttimeBackup"); log.debug("compare firsttime files with configuration models (backup from first start) for " + modelPath); OntModel baseModelFirsttime = VitroModelFactory.createOntologyModel(); RDFFilesLoader.loadFirstTimeFiles(ctx, modelPath, baseModelFirsttime, true); if (baseModelFirsttime.isIsomorphicWith(baseModelFirsttimeBackup)) { log.debug("They are the same, so do nothing: '" + modelPath + "'"); } else { log.debug("They differ:" + modelPath + ", compare values in configuration models with user's triplestore"); updatedFiles = applyChanges(baseModelFirsttimeBackup, baseModelFirsttime, userModel, modelPath); if (updatedFiles) log.info("The model was updated, " + modelPath); } }
Source:
public boolean compareCannonicalValues(String s1, String s2) { return delegate.compareCannonicalValues(Strings.emptyToNull(s1), Strings.emptyToNull(s2)); }

Target:
public boolean compareCannonicalValues(String s1, String s2) { return delegate.compareCannonicalValues(Strings.nullToEmpty(s1), Strings.nullToEmpty(s2)); }
Source:
private void analyzeVars(K term) { new VisitKORE() { @Override public Void apply(KApply k) { if (cfg.isParentCell(k.klabel())) { KVariable var = null; List<K> items = new ArrayList<>(k.klist().size()); for (K item : k.klist().items()) { if (item instanceof KVariable) { if (var != null) { throw new UnsupportedOperationException( "AC matching of multiple cell variables not yet supported. " + "encountered variables " + var.toString() + " and " + item.toString() + " in cell " + k); } else { var = (KVariable) item; } } else { items.add(item); } } if (var != null) { if (!variables.containsKey(var)) { variables.put(var, new VarInfo()); } variables.get(var).addOccurances(cfg, k.klabel(), var, items); } } return super.apply(k); } }.apply(term); }

Target:
private void analyzeVars(K term) { new VisitKORE() { @Override public Void apply(KApply k) { if (cfg.isParentCell(k.klabel())) { KVariable var = null; List<K> items = new ArrayList<>(k.klist().size()); for (K item : k.klist().items()) { if (item instanceof KVariable) { if (var != null) { throw KExceptionManager.criticalError( "AC matching of multiple cell variables not yet supported. " + "encountered variables " + var.toString() + " and " + item.toString() + " in cell " + k); } else { var = (KVariable) item; } } else { items.add(item); } } if (var != null) { if (!variables.containsKey(var)) { variables.put(var, new VarInfo()); } variables.get(var).addOccurances(cfg, k.klabel(), var, items); } } return super.apply(k); } }.apply(term); }
Source:
public void trailingWhitespaceIsIgnored() { BlockStmt blockStmt = JavaParser.parseBlock("{} assertEquals("\"}\" <95> (line 1,col 2)-(line 1,col 2)", blockStmt.getTokenRange().get().getEnd().toString()); }

Target:
public void trailingWhitespaceIsIgnored() { BlockStmt blockStmt = JavaParser.parseBlock("{} assertEquals("{}", blockStmt.getTokenRange().get().toString()); }
Source:
public BugzillaRestRepositoryConnectorUi() { connector = BugzillaRestConnector.getDefault() == null ? new BugzillaRestConnector() : BugzillaRestConnector.getDefault(); }

Target:
public BugzillaRestRepositoryConnectorUi() { this.connector = BugzillaRestConnector.getDefault() == null ? new BugzillaRestConnector() : BugzillaRestConnector.getDefault(); }
Source:
public void update(final String path, final byte[] bytes) { synchronized (toAnnounce) { if (!started) { toUpdate.add(new Announceable(path, bytes, false)); return; } } byte[] oldBytes = announcements.get(path); if (oldBytes == null) { throw new ISE("Cannot update a path[%s] that hasn't been announced!", path); } synchronized (toAnnounce) { try { if (!Arrays.equals(oldBytes, bytes)) { announcements.put(path, bytes); updateAnnouncement(path, bytes); } } catch (Exception e) { throw Throwables.propagate(e); } } }

Target:
public void update(final String path, final byte[] bytes) { synchronized (toAnnounce) { if (!started) { toUpdate.add(new Announceable(path, bytes, false)); return; } } byte[] oldBytes = announcedPaths.get(path); if (oldBytes == null) { throw new ISE("Cannot update a path[%s] that hasn't been announced!", path); } synchronized (toAnnounce) { try { if (!Arrays.equals(oldBytes, bytes)) { announcedPaths.put(path, bytes); updateAnnouncement(path, bytes); } } catch (Exception e) { throw new RuntimeException(e); } } }
Source:
public boolean hasExpired() { return expired; }

Target:
public boolean hasExpired() { return false; }
Source:
public Tags getBucketTags(GetBucketTagsArgs 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", ""); try { Response response = executeGet(args.bucket(), null, null, queryParamMap); try (ResponseBody body = response.body()) { return Xml.unmarshal(Tags.class, body.charStream()); } } catch (ErrorResponseException e) { if (e.errorResponse().errorCode() != ErrorCode.NO_SUCH_TAG_SET) { throw e; } } return new Tags(); }

Target:
public Tags getBucketTags(GetBucketTagsArgs args) throws ErrorResponseException, IllegalArgumentException, InsufficientDataException, InternalException, InvalidBucketNameException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, XmlParserException { checkArgs(args); Map<String, String> queryParamMap = new HashMap<>(); queryParamMap.put("tagging", ""); try (Response response = executeGet(args.bucket(), null, null, queryParamMap)) { return Xml.unmarshal(Tags.class, response.body().charStream()); } catch (ErrorResponseException e) { if (e.errorResponse().errorCode() != ErrorCode.NO_SUCH_TAG_SET) { throw e; } } return new Tags(); }
Source:
public ListenableFuture<Void> getCloseFuture() { synchronized (mReleaseLock) { if (mReleaseFuture == null) { mReleaseFuture = CallbackToFutureAdapter.getFuture( new CallbackToFutureAdapter.Resolver<Void>() { @Override public Object attachCompleter(@NonNull CallbackToFutureAdapter.Completer<Void> completer) { synchronized (mReleaseLock) { Preconditions.checkState(Thread.holdsLock(mReleaseLock)); Preconditions.checkState(mReleaseCompleter == null, "Release completer expected to be null"); mReleaseCompleter = completer; return "Release[imageProxy=" + FakeImageProxy.this + "]"; } } }); } return mReleaseFuture; } }

Target:
public ListenableFuture<Void> getCloseFuture() { synchronized (mReleaseLock) { if (mReleaseFuture == null) { mReleaseFuture = CallbackToFutureAdapter.getFuture( new CallbackToFutureAdapter.Resolver<Void>() { @Override public Object attachCompleter(@NonNull CallbackToFutureAdapter.Completer<Void> completer) { synchronized (mReleaseLock) { Preconditions.checkState(mReleaseCompleter == null, "Release completer expected to be null"); mReleaseCompleter = completer; return "Release[imageProxy=" + FakeImageProxy.this + "]"; } } }); } return mReleaseFuture; } }
Source:
public static List<Integer> delimitedStringToIntegerList(String delimitedString, String delimiter) { List<Integer> ret = new ArrayList<>(); String[] tokens = delimitedString.split(delimiter); for (String token : tokens) { token = token.trim(); if (token.length() == 0) { } else { ret.add(Integer.valueOf(token)); } } return ret; }

Target:
public static List<Integer> delimitedStringToIntegerList(String delimitedString, String delimiter) { List<Integer> ret = new ArrayList<>(); String[] tokens = delimitedString.split(delimiter); for (String token : tokens) { token = token.trim(); if (token.length() != 0) { ret.add(Integer.valueOf(token)); } } return ret; }
Source:
public QueryControlResult createQueryWithCheckpoint(final AvroDag avroDag, final QueryCheckpoint checkpointedState) { final QueryControlResult queryControlResult = new QueryControlResult(); final String queryId = avroDag.getQueryId(); queryControlResult.setQueryId(queryId); try { checkpointManager.storeQuery(avroDag); final String appId = avroDag.getAppId(); if (LOG.isLoggable(Level.FINE)) { LOG.log(Level.FINE, "Create Query [aid: {0}, qid: {2}]", new Object[]{appId, queryId}); } if (!applicationMap.containsKey(appId)) { createApplication(appId, avroDag.getJarPaths()); } final ApplicationInfo applicationInfo = applicationMap.get(appId); if (applicationInfo.getGroups().size() == 0) { createGroup(applicationInfo); } final DAG<ConfigVertex, MISTEdge> configDag; if (checkpointedState == null) { configDag = configDagGenerator.generate(avroDag); } else { configDag = configDagGenerator.generateWithCheckpointedStates(avroDag, checkpointedState); } while (applicationInfo.getGroups().isEmpty()) { Thread.sleep(100); } final Query query = createAndStartQuery(queryId, applicationInfo, configDag); queryControlResult.setIsSuccess(true); queryControlResult.setMsg(ResultMessage.submitSuccess(queryId)); return queryControlResult; } catch (final Exception e) { e.printStackTrace(); LOG.log(Level.SEVERE, "An exception occurred while starting {0} query: {1}", new Object[] {queryId, e.toString()}); queryControlResult.setIsSuccess(false); queryControlResult.setMsg(e.getMessage()); return queryControlResult; } }

Target:
public QueryControlResult createQueryWithCheckpoint(final AvroDag avroDag, final QueryCheckpoint checkpointedState) { final QueryControlResult queryControlResult = new QueryControlResult(); final String queryId = avroDag.getQueryId(); queryControlResult.setQueryId(queryId); try { checkpointManager.storeQuery(avroDag); final String appId = avroDag.getAppId(); if (LOG.isLoggable(Level.FINE)) { LOG.log(Level.FINE, "Create Query [aid: {0}, qid: {2}]", new Object[]{appId, queryId}); } if (!applicationMap.containsKey(appId)) { createApplication(appId, avroDag.getJarPaths()); } final ApplicationInfo applicationInfo = applicationMap.get(appId); if (applicationInfo.getGroups().size() == 0) { synchronized (applicationInfo) { if (applicationInfo.getGroups().size() == 0) { createGroup(applicationInfo); while (applicationInfo.getGroups().isEmpty()) { Thread.sleep(100); } } } } final DAG<ConfigVertex, MISTEdge> configDag; if (checkpointedState == null) { configDag = configDagGenerator.generate(avroDag); } else { configDag = configDagGenerator.generateWithCheckpointedStates(avroDag, checkpointedState); } final Query query = createAndStartQuery(queryId, applicationInfo, configDag); queryControlResult.setIsSuccess(true); queryControlResult.setMsg(ResultMessage.submitSuccess(queryId)); return queryControlResult; } catch (final Exception e) { e.printStackTrace(); LOG.log(Level.SEVERE, "An exception occurred while starting {0} query: {1}", new Object[] {queryId, e.toString()}); queryControlResult.setIsSuccess(false); queryControlResult.setMsg(e.getMessage()); return queryControlResult; } }
Source:
public void bindingChanged(BindingProvider provider, String itemName) { logger.debug("Plex binding changed"); if (provider instanceof PlexBindingProvider) { PlexBindingProvider plexProvider = (PlexBindingProvider) provider; PlexBindingConfig config = plexProvider.getConfig(itemName); if (config != null) setInitialState(config); } }

Target:
public void bindingChanged(BindingProvider provider, String itemName) { logger.trace("Plex binding changed"); if (provider instanceof PlexBindingProvider) { PlexBindingProvider plexProvider = (PlexBindingProvider) provider; PlexBindingConfig config = plexProvider.getConfig(itemName); if (config != null) { setInitialState(config); } } }
Source:
private HTInterval getRelevantInterval(long t, int key) throws TimeRangeException, ClosedChannelException { checkValidTime(t); Deque<HTNode> queue = new LinkedList<>(); queue.add(fSht.getRootNode()); HTInterval interval = null; while (interval == null && !queue.isEmpty()) { HTNode currentNode = queue.pop(); if ((currentNode.getNodeType() == HTNode.NodeType.CORE)) { queue.addAll(fSht.selectNextChildren((CoreNode) currentNode, t)); } interval = currentNode.getRelevantInterval(key, t); } return interval; }

Target:
private HTInterval getRelevantInterval(long t, int key) throws TimeRangeException, ClosedChannelException { checkValidTime(t); Deque<HTNode> queue = new LinkedList<>(); queue.add(fSht.getRootNode()); HTInterval interval = null; while (interval == null && !queue.isEmpty()) { HTNode currentNode = queue.pop(); if (currentNode.getNodeType() == HTNode.NodeType.CORE) { queue.addAll(fSht.selectNextChildren((CoreNode) currentNode, t)); } interval = currentNode.getRelevantInterval(key, t); } return interval; }
Source:
@NonNull T execute() throws IOException, SchemaViolationError; @NonNull GraphCall<T> enqueue(@NonNull Callback<T> callback); interface Callback<T extends AbstractResponse<T>> { void onResponse(@NonNull T response); void onFailure(@NonNull Throwable t); }

Target:
@NonNull GraphResponse<T> execute() throws GraphError; @NonNull GraphCall<T> enqueue(@NonNull Callback<T> callback); interface Callback<T extends AbstractResponse<T>> { void onResponse(@NonNull GraphResponse<T> response); void onFailure(@NonNull GraphError error); }
Source:
public static JsonNode valueToJson(Object x) { JsonNode node; if(x==null) { node=JsonNodeFactory.instance.nullNode(); } else if(x instanceof Date) { node=JsonNodeFactory.instance.textNode(ClientConstants.getDateFormat().format((Date)x)); } else if(x instanceof Number) { if (x instanceof BigDecimal) { node=JsonNodeFactory.instance.numberNode((BigDecimal) x); } else if (x instanceof BigInteger) { node=JsonNodeFactory.instance.numberNode((BigInteger) x); } else if (x instanceof Double) { node=JsonNodeFactory.instance.numberNode((Double) x); } else if (x instanceof Float) { node=JsonNodeFactory.instance.numberNode((Float) x); } else if (x instanceof Long) { node=JsonNodeFactory.instance.numberNode((Long) x); } else { node=JsonNodeFactory.instance.numberNode(((Number) x).intValue()); } } else if(x instanceof Boolean) { node=JsonNodeFactory.instance.booleanNode((Boolean)x); } else if(x instanceof JsonNode) { node=(JsonNode)x; } else if(x instanceof Literal) { node=((Literal)x).node; } else if (x.getClass().isArray()) { if (x instanceof Literal[]) { node = toJson((Literal[]) x); } else if (x instanceof String[]) { node = toJson(values((String[]) x)); } else if (x instanceof Number[]) { node = toJson(numbers((Number[]) x)); } else if (x instanceof int[]){ node = toJson(values((int[]) x)); } else if (x instanceof long[]){ node = toJson(values((long[]) x)); } else { throw new UnsupportedOperationException("Array of type " + x.getClass() + " is not supported."); } } else { node=JsonNodeFactory.instance.textNode(x.toString()); } return node; }

Target:
public static JsonNode valueToJson(Object x) { JsonNode node; if(x==null) { node=JsonNodeFactory.instance.nullNode(); } else if(x instanceof Date) { node=JsonNodeFactory.instance.textNode(ClientConstants.getDateFormat().format((Date)x)); } else if(x instanceof Number) { if (x instanceof BigDecimal) { node=JsonNodeFactory.instance.numberNode((BigDecimal) x); } else if (x instanceof BigInteger) { node=JsonNodeFactory.instance.numberNode((BigInteger) x); } else if (x instanceof Double) { node=JsonNodeFactory.instance.numberNode((Double) x); } else if (x instanceof Float) { node=JsonNodeFactory.instance.numberNode((Float) x); } else if (x instanceof Long) { node=JsonNodeFactory.instance.numberNode((Long) x); } else { node=JsonNodeFactory.instance.numberNode(((Number) x).intValue()); } } else if(x instanceof Boolean) { node=JsonNodeFactory.instance.booleanNode((Boolean)x); } else if(x instanceof JsonNode) { node=(JsonNode)x; } else if(x instanceof Literal) { node=((Literal)x).node; } else if (x.getClass().isArray()) { if (x instanceof Literal[]) { node = toJson((Literal[]) x); } else if (x instanceof Object[]) { node = toJson(values((Object[]) x)); } else if (x instanceof int[]) { node = toJson(values((int[]) x)); } else if (x instanceof long[]) { node = toJson(values((long[]) x)); } else if (x instanceof boolean[]) { node = toJson(values((boolean[]) x)); } else { throw new UnsupportedOperationException("Array of type " + x.getClass() + " is not supported."); } } else { node=JsonNodeFactory.instance.textNode(x.toString()); } return node; }
Source:
public static InetAddress intToInetAddress(int hostAddress) { InetAddress inetAddress; String hostName; hostName = "" + (0xff & hostAddress) + "." + (0xff & (hostAddress >> 8)) + "." + (0xff & (hostAddress >> 16)) + "." + (0xff & (hostAddress >> 24)); try { inetAddress = InetAddress.getByName(hostName); } catch (UnknownHostException e) { return null; } return inetAddress; }

Target:
public static InetAddress intToInetAddress(int hostAddress) { InetAddress inetAddress; byte[] addressBytes = { (byte)(0xff & hostAddress), (byte)(0xff & (hostAddress >> 8)), (byte)(0xff & (hostAddress >> 16)), (byte)(0xff & (hostAddress >> 24)) }; try { inetAddress = InetAddress.getByAddress(addressBytes); } catch(UnknownHostException e) { return null; } return inetAddress; }
Source:
public boolean login(HttpServletRequest request, HttpServletResponse response) throws IOException { if (isLoggedIn()) { return true; } LOG.debug("Login " + this); if (OAuthProtocol.isOAuthFinal(request)) { String redirectUrl = oauth.getTargetUrl(request); if (redirectUrl == null) { response.sendError(HttpServletResponse.SC_NOT_FOUND); return false; } LOG.debug("Login-FINAL " + this); login(oauth.loginPhase2(request, response)); if (isLoggedIn()) { LOG.debug("Login-SUCCESS " + this); response.sendRedirect(redirectUrl); return true; } else { response.sendError(HttpStatus.SC_UNAUTHORIZED); return false; } } else { LOG.debug("Login-PHASE1 " + this); oauth.loginPhase1(request, response); return false; } }

Target:
public boolean login(HttpServletRequest request, HttpServletResponse response) throws IOException { if (isLoggedIn()) { return true; } LOG.debug("Login " + this); if (OAuthProtocol.isOAuthFinal(request)) { String redirectUrl = oauth.getTargetUrl(request); if (redirectUrl == null) { response.sendError(HttpServletResponse.SC_NOT_FOUND); return false; } LOG.debug("Login-Retrieve-User " + this); retrieveUser(oauth.loginPhase2(request, response)); if (isLoggedIn()) { LOG.debug("Login-SUCCESS " + this); response.sendRedirect(redirectUrl); return true; } else { response.sendError(HttpStatus.SC_UNAUTHORIZED); return false; } } else { LOG.debug("Login-PHASE1 " + this); oauth.loginPhase1(request, response); return false; } }
Source:
public CloudBlobMetadata getOldestExpiredBlob(String partitionPath) throws CloudStorageException { List<CloudBlobMetadata> deadBlobs = requestAgent.doWithRetries( () -> cloudDestination.getExpiredBlobs(partitionPath, System.currentTimeMillis(), queryLimit), "GetDeadBlobs", partitionPath); return deadBlobs.isEmpty() ? null : deadBlobs.get(0); }

Target:
public CloudBlobMetadata getOldestExpiredBlob(String partitionPath) throws CloudStorageException { List<CloudBlobMetadata> deadBlobs = requestAgent.doWithRetries( () -> cloudDestination.getExpiredBlobs(partitionPath, 1, System.currentTimeMillis(), 1), "GetDeadBlobs", partitionPath); return deadBlobs.isEmpty() ? null : deadBlobs.get(0); }
Source:
private void addInstrumentedMethod( Map<Method, MethodMetrics> existingMethodMetrics, Method method, MethodMetrics methodMetrics) { if (!isMethodAllowed(method)) { return; } for (Map.Entry<Method, MethodMetrics> existingMethodMetric : existingMethodMetrics.entrySet()) { String invocationsIdMetricName = existingMethodMetric.getValue().invocationsId.name(); if (invocationsIdMetricName.equals(methodMetrics.invocationsId.name())) { throw new MetricNameCollisionException( target, invocationsIdMetricName, existingMethodMetric.getKey(), method); } } existingMethodMetrics.put(method, methodMetrics); }

Target:
private void addInstrumentedMethod( Map<Method, MethodMetrics> existingMethodMetrics, Method method, MethodMetrics methodMetrics) { if (!isMethodAllowed(method)) { return; } existingMethodMetrics.putIfAbsent(method, methodMetrics); }
Source:
private void maybeNotifyListeners(List<Broadcaster.BroadcastRequest> broadcastRequests) { int numOfCompletedBroadcastsTarget = Math.max(1, Math.min(numPeersForBroadcast, 3)); if (numOfCompletedBroadcasts == numOfCompletedBroadcastsTarget) { broadcastRequests.stream() .filter(broadcastRequest -> broadcastRequest.getListener() != null) .map(Broadcaster.BroadcastRequest::getListener) .forEach(listener -> listener.onSufficientlyBroadcast(broadcastRequests)); } else { int openRequests = numPeersForBroadcast - numOfCompletedBroadcasts - numOfFailedBroadcasts; int maxPossibleSuccessCases = openRequests + numOfCompletedBroadcasts; if (maxPossibleSuccessCases == numOfCompletedBroadcastsTarget - 1) { broadcastRequests.stream() .filter(broadcastRequest -> broadcastRequest.getListener() != null) .map(Broadcaster.BroadcastRequest::getListener) .forEach(listener -> listener.onNotSufficientlyBroadcast(numOfCompletedBroadcasts, numOfFailedBroadcasts)); } else if (timeoutTriggered && numOfCompletedBroadcasts < numOfCompletedBroadcastsTarget) { broadcastRequests.stream() .filter(broadcastRequest -> broadcastRequest.getListener() != null) .map(Broadcaster.BroadcastRequest::getListener) .forEach(listener -> listener.onNotSufficientlyBroadcast(numOfCompletedBroadcasts, numOfFailedBroadcasts)); } } }

Target:
private void maybeNotifyListeners(List<Broadcaster.BroadcastRequest> broadcastRequests) { int numOfCompletedBroadcastsTarget = Math.max(1, Math.min(numPeersForBroadcast, 3)); if (numOfCompletedBroadcasts == numOfCompletedBroadcastsTarget) { broadcastRequests.stream() .filter(broadcastRequest -> broadcastRequest.getListener() != null) .map(Broadcaster.BroadcastRequest::getListener) .forEach(listener -> listener.onSufficientlyBroadcast(broadcastRequests)); } else { int maxPossibleSuccessCases = numPeersForBroadcast - numOfFailedBroadcasts; boolean notEnoughSucceededOrOpen = maxPossibleSuccessCases == numOfCompletedBroadcastsTarget - 1; boolean timeoutAndNotEnoughSucceeded = timeoutTriggered && numOfCompletedBroadcasts < numOfCompletedBroadcastsTarget; if (notEnoughSucceededOrOpen || timeoutAndNotEnoughSucceeded) { broadcastRequests.stream() .filter(broadcastRequest -> broadcastRequest.getListener() != null) .map(Broadcaster.BroadcastRequest::getListener) .forEach(listener -> listener.onNotSufficientlyBroadcast(numOfCompletedBroadcasts, numOfFailedBroadcasts)); } } }
Source:
public Map<String, ServerImpl> getServers() { Map<String, List<PortBinding>> ports = info.getNetworkSettings().getPorts(); Map<String, String> labels = info.getConfig().getLabels(); return addDefaultReferenceForServersWithoutReference( addRefAndUrlToServers(getServersWithFilledPorts(containerHost, ports != null ? ports : Collections.emptyMap()), labels != null ? labels : Collections.emptyMap())); }

Target:
public Map<String, ServerImpl> getServers() { Map<String, List<PortBinding>> ports; if (info.getNetworkSettings() != null && info.getNetworkSettings().getPorts() != null) { ports = info.getNetworkSettings().getPorts(); } else { ports = Collections.emptyMap(); } Map<String, String> labels; if (info.getConfig() != null && info.getConfig().getLabels() != null) { labels = info.getConfig().getLabels(); } else { labels = Collections.emptyMap(); } return addDefaultReferenceForServersWithoutReference( addRefAndUrlToServers( getServersWithFilledPorts(containerHost, ports), labels)); }
Source:
public JmsConfiguration incomingWebServiceJmsConfiguration(final JmsConfigurationFactory jmsConfigurationFactory) { return jmsConfigurationFactory.initializeConfiguration("jms.incoming.ws.requests", this.incomingWebServiceRequestMessageListener); }

Target:
public JmsConfiguration incomingWebServiceJmsConfiguration(final JmsConfigurationFactory jmsConfigurationFactory) { return jmsConfigurationFactory.initializeReceiveConfiguration("jms.incoming.ws.requests", this.incomingWebServiceRequestMessageListener); }
Source:
public void testPruneOneColumn() throws Exception { String inputFile = "src/test/java/org/apache/parquet/tools/data/test.parquet"; String outputFile = rand.nextInt() + ".parquet"; String cargs[] = {inputFile, outputFile, "gender"}; executeCommandLine(cargs); ParquetMetadata pmd = ParquetFileReader.readFooter(conf, new Path(outputFile), ParquetMetadataConverter.NO_FILTER); MessageType schema = pmd.getFileMetaData().getSchema(); List<Type> fields = schema.getFields(); assertEquals(fields.size(), 2); assertEquals(fields.get(0).getName(), "name"); assertEquals(fields.get(1).getName(), "age"); }

Target:
public void testPruneOneColumn() throws Exception { String inputFile = createParquetFile("input"); String outputFile = createTempFile("output"); String cargs[] = {inputFile, outputFile, "Gender"}; executeCommandLine(cargs); ParquetMetadata pmd = ParquetFileReader.readFooter(conf, new Path(outputFile), ParquetMetadataConverter.NO_FILTER); MessageType schema = pmd.getFileMetaData().getSchema(); List<Type> fields = schema.getFields(); assertEquals(fields.size(), 3); assertEquals(fields.get(0).getName(), "DocId"); assertEquals(fields.get(1).getName(), "Name"); assertEquals(fields.get(2).getName(), "Links"); List<Type> subFields = fields.get(2).asGroupType().getFields(); assertEquals(subFields.size(), 2); assertEquals(subFields.get(0).getName(), "Backward"); assertEquals(subFields.get(1).getName(), "Forward"); List<String> prunePaths = Arrays.asList("Gender"); validateColumns(inputFile, prunePaths); }
Source:
public void testHalfNumComputeTasks() { final int numComputeTask = 4; final Collection<EvaluatorParameters> activeEvaluators = generateEvaluatorParameters(4, new int[][]{{2500}, {2500}, {2500}, {2500}}); final int upperBoundToDelete = (int) Math.ceil((double) numComputeTask / 2); final Plan plan = ilpSolverOptimizer.optimize(activeEvaluators, numComputeTask / 2 + 1); assertEquals(0, plan.getEvaluatorsToAdd().size()); assertTrue("The number of evaluators to be deleted should be <= " + upperBoundToDelete, plan.getEvaluatorsToDelete().size() <= upperBoundToDelete); }

Target:
public void testHalfNumComputeTasks() { final int numComputeTasks = 4; final Collection<EvaluatorParameters> activeEvaluators = generateEvaluatorParameters(numComputeTasks, new int[][]{{2500}, {2500}, {2500}, {2500}}); final int upperBoundToDelete = (int) Math.ceil((double) numComputeTasks / 2); final Plan plan = ilpSolverOptimizer.optimize(activeEvaluators, numComputeTasks / 2 + 1); assertEquals(0, plan.getEvaluatorsToAdd().size()); assertTrue("The number of evaluators to be deleted should be <= " + upperBoundToDelete, plan.getEvaluatorsToDelete().size() <= upperBoundToDelete); }
Source:
public void setPollInterval(Integer interval) { this.pollInterval = interval; updateScheduler(); }

Target:
public void setPollInterval(Integer interval) { this.pollInterval = Math.max(1, interval); updateScheduler(); }
Source:
private final void clearActivations() { deactivateHandlers(handlerActivations); for (IHandlerActivation activation : handlerActivations) { IHandler handler = activation.getHandler(); if (handler != null) { try { handler.dispose(); } catch (Exception e) { WorkbenchPlugin.log("Failed to dispose handler for " + activation.getCommandId(), e); } catch (LinkageError e) { WorkbenchPlugin.log("Failed to dispose handler for " + activation.getCommandId(), e); } } } handlerActivations.clear(); }

Target:
private void clearActivations() { deactivateHandlers(handlerActivations); for (IHandlerActivation activation : handlerActivations) { final IHandler handler = activation.getHandler(); if (handler != null) { SafeRunner.run(new ISafeRunnable() { @Override public void run() throws Exception { handler.dispose(); } @Override public void handleException(Throwable exception) { WorkbenchPlugin.log("Failed to dispose handler for " + activation.getCommandId(), exception); } }); } } handlerActivations.clear(); }
Source:
public JoinOperatorInfo mergeWith(JoinOperatorInfo other) { checkState(this.joinType.equals(other.joinType), "different join types"); long[] logHistogramProbes = new long[HISTOGRAM_BUCKETS]; long[] logHistogramOutput = new long[HISTOGRAM_BUCKETS]; for (int i = 0; i < HISTOGRAM_BUCKETS; i++) { logHistogramProbes[i] = this.logHistogramProbes[i] + other.logHistogramProbes[i]; logHistogramOutput[i] = this.logHistogramOutput[i] + other.logHistogramOutput[i]; } long mergedSourcePositions = this.lookupSourcePositions; if (mergedSourcePositions >= 0 && other.lookupSourcePositions >= 0) { mergedSourcePositions += other.lookupSourcePositions; } else { mergedSourcePositions = other.lookupSourcePositions; } return new JoinOperatorInfo(this.joinType, logHistogramProbes, logHistogramOutput, mergedSourcePositions); }

Target:
public JoinOperatorInfo mergeWith(JoinOperatorInfo other) { checkState(this.joinType.equals(other.joinType), "different join types"); long[] logHistogramProbes = new long[HISTOGRAM_BUCKETS]; long[] logHistogramOutput = new long[HISTOGRAM_BUCKETS]; for (int i = 0; i < HISTOGRAM_BUCKETS; i++) { logHistogramProbes[i] = this.logHistogramProbes[i] + other.logHistogramProbes[i]; logHistogramOutput[i] = this.logHistogramOutput[i] + other.logHistogramOutput[i]; } Optional<Long> mergedSourcePositions = Optional.empty(); if (this.lookupSourcePositions.isPresent() || other.lookupSourcePositions.isPresent()) { mergedSourcePositions = Optional.of(this.lookupSourcePositions.orElse(0L) + other.lookupSourcePositions.orElse(0L)); } return new JoinOperatorInfo(this.joinType, logHistogramProbes, logHistogramOutput, mergedSourcePositions); }
Source:
public void upgrade() { try { final String description = "JClouds cloud " + getCloud().name + "." + name + " - auto-migrated"; String ju = getJenkinsUser(); if (Strings.isNullOrEmpty(getCredentialsId()) && !Strings.isNullOrEmpty(ju)) { setCredentialsId(convertJenkinsUser(ju, description, getCloud().getGlobalPrivateKey())); jenkinsUser = null; } if (Strings.isNullOrEmpty(getAdminCredentialsId())) { StandardUsernameCredentials u = null; String au = getAdminUser(); if (Strings.isNullOrEmpty(vmPassword)) { if (!au.equals("root")) { String privateKey = getCloud().getGlobalPrivateKey(); u = new BasicSSHUserPrivateKey(CredentialsScope.SYSTEM, null, au, new BasicSSHUserPrivateKey.DirectEntryPrivateKeySource(privateKey), null, description); } } else { u = new UsernamePasswordCredentialsImpl( CredentialsScope.SYSTEM, null, description, au, vmPassword); } setAdminCredentialsId(storeCredentials(u)); } } catch (Exception e) { LOGGER.log(Level.SEVERE, e.getMessage(), e); throw e; } }

Target:
void upgrade() { try { final String description = "JClouds cloud " + getCloud().name + "." + name + " - auto-migrated"; String ju = getJenkinsUser(); if (Strings.isNullOrEmpty(getCredentialsId()) && !Strings.isNullOrEmpty(ju)) { setCredentialsId(convertJenkinsUser(ju, description, getCloud().getGlobalPrivateKey())); jenkinsUser = null; } if (Strings.isNullOrEmpty(getAdminCredentialsId())) { StandardUsernameCredentials u = null; String au = getAdminUser(); if (Strings.isNullOrEmpty(vmPassword)) { if (!au.equals("root")) { String privateKey = getCloud().getGlobalPrivateKey(); u = new BasicSSHUserPrivateKey(CredentialsScope.SYSTEM, null, au, new BasicSSHUserPrivateKey.DirectEntryPrivateKeySource(privateKey), null, description); } } else { u = new UsernamePasswordCredentialsImpl( CredentialsScope.SYSTEM, null, description, au, vmPassword); } setAdminCredentialsId(storeCredentials(u)); } } catch (Exception e) { LOGGER.log(Level.SEVERE, e.getMessage(), e); throw e; } }
Source:
public void setup(ManagementClient managementClient, String containerId) throws Exception { ModelNode addTestLogOp = org.jboss.as.controller.operations.common.Util.createAddOperation(PathAddress.pathAddress().append(SUBSYSTEM, "logging") .append("periodic-rotating-file-handler", getHandlerName())); addTestLogOp.get("level").set(getLevel()); addTestLogOp.get("append").set("true"); addTestLogOp.get("suffix").set(".yyyy-MM-dd"); ModelNode file = new ModelNode(); file.get("relative-to").set("jboss.server.log.dir"); file.get("path").set(getLogFileName()); addTestLogOp.get("file").set(file); addTestLogOp.get("formatter").set("%-5p [%c] (%t) %s%e%n"); applyUpdate(managementClient.getControllerClient(), addTestLogOp, false); Collection<String> categories = getCategories(); if (categories == null || categories.isEmpty()) { LOGGER.warn("getCategories() returned empty collection."); return; } for (String category : categories) { if (category == null || category.length() == 0) { LOGGER.warn("Empty category name provided."); continue; } ModelNode op = org.jboss.as.controller.operations.common.Util.createAddOperation(PathAddress.pathAddress().append(SUBSYSTEM, "logging").append("logger", category)); op.get("level").set(getLevel()); op.get("handlers").add(getHandlerName()); applyUpdate(managementClient.getControllerClient(), op, false); } }

Target:
public void setup(ManagementClient managementClient, String containerId) throws Exception { final Operations.CompositeOperationBuilder builder = Operations.CompositeOperationBuilder.create(); final ModelNode handlerAddress = Operations.createAddress(SUBSYSTEM, "logging", "file-handler", getHandlerName()); ModelNode addTestLogOp = Operations.createAddOperation(handlerAddress); addTestLogOp.get("level").set(getLevel()); addTestLogOp.get("append").set("true"); ModelNode file = new ModelNode(); file.get("relative-to").set("jboss.server.log.dir"); file.get("path").set(getLogFileName()); addTestLogOp.get("file").set(file); addTestLogOp.get("formatter").set("%-5p [%c] (%t) %s%e%n"); builder.addStep(addTestLogOp); removeOps.add(Operations.createRemoveOperation(handlerAddress)); Collection<String> categories = getCategories(); if (categories == null || categories.isEmpty()) { LOGGER.warn("getCategories() returned empty collection."); return; } for (String category : categories) { if (category == null || category.isEmpty()) { LOGGER.warn("Empty category name provided."); continue; } final ModelNode loggerAddress = Operations.createAddress(SUBSYSTEM, "logging", "logger", category); ModelNode op = Operations.createAddOperation(loggerAddress); op.get("level").set(getLevel()); op.get("handlers").add(getHandlerName()); builder.addStep(op); removeOps.addFirst(Operations.createRemoveOperation(loggerAddress)); } applyUpdate(managementClient.getControllerClient(), builder.build(), false); }
Source:
public void actsOnInvalidHttpMethods() throws Exception { this.acts("INVALIDHTTPMETHOD"); }

Target:
public void actsOnInvalidHttpMethods() throws Exception { new FtRemote(new TkFixed("InvalidHeaderTest")).exec( new FtRemote.Script() { @Override public void exec(final URI home) throws IOException { TkProxyTest.this.actResponse( home, "INVALIDHTTPMETHOD" ); } } ); }