auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testGetProjectedSchema5() throws Exception { MessageType originalMsg = MessageTypeParser.parseMessageType( "message hive_schema {\n" + " optional group structCol {\n" + " optional int32 a;\n" + " optional group subStructCol {\n" + " optional int64 b;\n" + " optional boolean c;\n" + " }\n" + " }\n" + " optional boolean d;\n" + "}\n"); testConversion("structCol", "struct<subStructCol:struct<b:bigint,c:boolean>>", DataWritableReadSupport .getProjectedSchema(originalMsg, Arrays.asList("structCol"), Arrays.asList(0), new HashSet<>(Arrays.asList("structCol.subStructCol", "structCol.subStructCol.b", "structCol.subStructCol.c"))).toString()); }

Target:
public void testGetProjectedSchema5() throws Exception { MessageType originalMsg = MessageTypeParser.parseMessageType( "message hive_schema {\n" + " optional group structCol {\n" + " optional int32 a;\n" + " optional group subStructCol {\n" + " optional int64 b;\n" + " optional boolean c;\n" + " }\n" + " }\n" + " optional boolean d;\n" + "}\n"); testConversion("structCol", "struct<subStructCol:struct<b:bigint,c:boolean>>", DataWritableReadSupport .getProjectedSchema(originalMsg, Arrays.asList("structCol"), Arrays.asList(0), Sets.newHashSet("structCol.subStructCol", "structCol.subStructCol.b", "structCol.subStructCol.c")).toString()); }
Source:
public void setupPinery() throws Exception { assertNotNull(System.getProperty("pineryWar"), "pineryWar is null"); File pineryWar = FileUtils.getFile(System.getProperty("pineryWar")); assertTrue(pineryWar.exists(), "pineryWar [ " + System.getProperty("pineryWar") + "] does not exist"); WebAppContext appContext = new WebAppContext(pineryWar.getAbsolutePath(), "/"); appContext.setParentLoaderPriority(true); appContext.setInitParameter("spring.profiles.active", "mock"); server = new Server(9999); server.setHandler(appContext); server.start(); DispatcherServlet dispatcherServlet = (DispatcherServlet) appContext.getServletHandler().getServlet("spring").getServletInstance(); assertNotNull(dispatcherServlet, "Unable to get spring servlet"); WebApplicationContext webApplicationContext = dispatcherServlet.getWebApplicationContext(); Log.debug("pinery beans = " + Arrays.toString(webApplicationContext.getBeanDefinitionNames())); limsMock = webApplicationContext.getBean(ca.on.oicr.pinery.api.Lims.class); assertNotNull(limsMock, "Pinery Lims mock is null"); pineryClient = new PineryClient("http://localhost:9999"); }

Target:
public void setupPinery() throws Exception { assertNotNull(System.getProperty("pineryWar"), "pineryWar is null"); File pineryWar = FileUtils.getFile(System.getProperty("pineryWar")); assertTrue(pineryWar.exists(), "pineryWar [ " + System.getProperty("pineryWar") + "] does not exist"); WebAppContext appContext = new WebAppContext(pineryWar.getAbsolutePath(), "/"); appContext.setParentLoaderPriority(true); appContext.setInitParameter("spring.profiles.active", "mock"); server = new Server(0); server.setHandler(appContext); server.start(); pineryUrl = "http://localhost:" + ((ServerConnector) server.getConnectors()[0]).getLocalPort(); DispatcherServlet dispatcherServlet = (DispatcherServlet) appContext.getServletHandler().getServlet("spring").getServletInstance(); assertNotNull(dispatcherServlet, "Unable to get spring servlet"); WebApplicationContext webApplicationContext = dispatcherServlet.getWebApplicationContext(); Log.debug("pinery beans = " + Arrays.toString(webApplicationContext.getBeanDefinitionNames())); limsMock = webApplicationContext.getBean(ca.on.oicr.pinery.api.Lims.class); assertNotNull(limsMock, "Pinery Lims mock is null"); pineryClient = new PineryClient(pineryUrl); }
Source:
public int hashCode() { return Objects.hash(super.getTokenValue(), jws); }

Target:
public int hashCode() { return Objects.hash( super.getTokenValue(), jsonWebSignature.getHeader(), jsonWebSignature.getPayload()); }
Source:
protected void addCommands() { UICommand command = UICommand.createDefaultOkUiCommand("OnSave", this); getCommands().add(command); getCommands().add(UICommand.createCancelUiCommand("Cancel", this)); }

Target:
protected void addCommands() { getCommands().add(UICommand.createDefaultOkUiCommand("OnSave", this)); getCommands().add(UICommand.createCancelUiCommand("Cancel", this)); }
Source:
public int appendFrom(ByteBuffer buffer) throws IOException { int bytesWritten = 0; if (state.equals(State.SEALED)) { ensureNext(metrics.overflowWriteError); bytesWritten = next.appendFrom(buffer); } else if (endOffset.get() + buffer.remaining() > capacityInBytes) { logger.info("{} : Writing data of size from a buffer. Current end offset is and capacity is {}", file.getAbsolutePath(), buffer.remaining(), getEndOffset(), capacityInBytes); ensureNext(metrics.overflowWriteError); state = State.SEALED; bytesWritten = next.appendFrom(buffer); } else { state = State.ACTIVE; while (buffer.hasRemaining()) { bytesWritten += fileChannel.write(buffer, endOffset.get()); } endOffset.addAndGet(bytesWritten); } return bytesWritten; }

Target:
public int appendFrom(ByteBuffer buffer) throws IOException { int bytesWritten = 0; if (endOffset.get() + buffer.remaining() > capacityInBytes) { metrics.overflowWriteError.inc(); throw new IllegalArgumentException( "Buffer cannot be written to segment [" + file.getAbsolutePath() + "] because " + "it exceeds the capacity [" + capacityInBytes + "]"); } else { while (buffer.hasRemaining()) { bytesWritten += fileChannel.write(buffer, endOffset.get()); } endOffset.addAndGet(bytesWritten); } return bytesWritten; }
Source:
private boolean containsDDF(UUID uuid) { return mDDFCache.asMap().containsKey(uuid); }

Target:
private boolean containsDDF(UUID uuid) { return (mDDFCache.asMap().containsKey(uuid) || mDDFwithNameCache.asMap().containsKey(uuid)); }
Source:
public static FundingRecord adaptFundingRecord(BitmexWalletTransaction walletTransaction) { String datePattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"; SimpleDateFormat dateFormat = new SimpleDateFormat(datePattern); dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); Date dateFunding = null; if (walletTransaction.getTransactTime() != null) { try { dateFunding = dateFormat.parse(walletTransaction.getTransactTime()); } catch (ParseException e) { throw new IllegalArgumentException(e); } } FundingRecord.Type type = adaptFundingRecordtype(walletTransaction); return new FundingRecord( walletTransaction.getAddress(), dateFunding, adaptCurrency(walletTransaction.getCurrency()), walletTransaction.getAmount().abs().divide(SATOSHIS_BY_BTC), walletTransaction.getTransactID(), walletTransaction.getTx(), type, adaptFundingRecordStatus(walletTransaction.getTransactStatus()), null, walletTransaction.getFee() != null ? walletTransaction.getFee().abs().divide(SATOSHIS_BY_BTC) : null, walletTransaction.getText()); }

Target:
public static FundingRecord adaptFundingRecord(BitmexWalletTransaction walletTransaction) { return new FundingRecord( walletTransaction.getAddress(), walletTransaction.getTransactTime(), adaptCurrency(walletTransaction.getCurrency()), walletTransaction.getAmount().abs(), walletTransaction.getTransactID(), walletTransaction.getTx(), adaptFundingRecordtype(walletTransaction), adaptFundingRecordStatus(walletTransaction.getTransactStatus()), walletTransaction.getWalletBalance(), walletTransaction.getFee(), walletTransaction.getText()); }
Source:
public void write(ByteBuffer buff) throws IOException { if (buff != this.appBuffer) { int attempts = 0; while (buff.hasRemaining()) { SSLEngineResult result = this.engine.wrap(buff, this.packetBuffer); this.packetBuffer.flip(); int read = this.channel.write(this.packetBuffer); if (result.bytesConsumed() == 0 && read == 0) { attempts++; if (attempts > MAX_ATTEMPTS) { this.packetBuffer.clear(); } } this.packetBuffer.compact(); } return; } this.appBuffer.flip(); this.engine.wrap(this.appBuffer, this.packetBuffer); this.appBuffer.compact(); this.packetBuffer.flip(); this.channel.write(this.packetBuffer); this.packetBuffer.compact(); }

Target:
public void write(ByteBuffer buff) throws IOException { if (buff != this.appBuffer) { int attempts = 0; while (buff.hasRemaining()) { SSLEngineResult result = this.engine.wrap(buff, this.packetBuffer); this.packetBuffer.flip(); int written = this.channel.write(this.packetBuffer); if (result.bytesConsumed() == 0 && written == 0) { attempts++; if (attempts > MAX_ATTEMPTS) { this.packetBuffer.clear(); } } this.packetBuffer.compact(); } return; } this.appBuffer.flip(); this.engine.wrap(this.appBuffer, this.packetBuffer); this.appBuffer.compact(); this.packetBuffer.flip(); this.channel.write(this.packetBuffer); this.packetBuffer.compact(); }
Source:
public void loadMyStep(int id) { try { if (!Objects.equals(id, null)) { setMySchritt(this.serviceManager.getTaskService().getById(id)); } } catch (DAOException e) { Helper.setFehlerMeldung("Error retrieving task with ID '" + id + "'; ", e.getMessage()); } }

Target:
public void loadMyStep(int id) { try { setMySchritt(this.serviceManager.getTaskService().getById(id)); } catch (DAOException e) { Helper.setFehlerMeldung("Error retrieving task with ID '" + id + "'; ", e.getMessage()); } }
Source:
private synchronized void onReceiverInitialized(final String receiverId) { stateMachine.checkState("INIT"); receiverStateMachineMap.get(receiverId).checkState("RECEIVING"); LOG.log(Level.FINE, "A receiver is initialized " + receiverId); initializedReceiverNum++; broadcastIfAllReceiversAreInitialized(); }

Target:
private synchronized void onReceiverInitialized(final String receiverId) { stateMachine.checkState(INIT); receiverStateMachineMap.get(receiverId).checkState(PushShuffleReceiverState.RECEIVING); LOG.log(Level.FINE, "A receiver is initialized " + receiverId); numInitializedReceivers++; broadcastIfAllReceiversAreInitialized(); }
Source:
private void closeTestingServerSocket(ServerSocket serverSocket) throws IOException { serverSocket.close(); wizard.showMessage("Closing test socket"); while (!serverSocket.isClosed()) wizard.showMessage("Test socket closed"); }

Target:
private void closeTestingServerSocket(ServerSocket serverSocket) throws IOException { serverSocket.close(); while (!serverSocket.isClosed()) { try { Thread.sleep(500); } catch (InterruptedException e) { log.debug(e.toString()); } } }
Source:
public static final String[] getLine( LogChannelInterface log, InputStreamReader reader, EncodingType encodingType, int fileFormatType, StringBuilder line, String regex, long lineNumberInFile ) throws KettleFileException { String sline = getLine( log, reader, encodingType, fileFormatType, line ); while ( sline != null ) { if ( checkPattern( sline, regex ) % 2 == 0 ) { return new String[] { sline, String.valueOf( lineNumberInFile ) }; } String nextLine = getLine( log, reader, encodingType, fileFormatType, line ); if ( nextLine == null ) { break; } sline = sline + nextLine; lineNumberInFile++; } return new String[] { sline, String.valueOf( lineNumberInFile ) }; }

Target:
public static final TextFileLine getLine( LogChannelInterface log, InputStreamReader reader, EncodingType encodingType, int fileFormatType, StringBuilder line, String regex, long lineNumberInFile ) throws KettleFileException { String sline = getLine( log, reader, encodingType, fileFormatType, line ); while ( sline != null ) { if ( checkPattern( sline, regex ) % 2 == 0 ) { return new TextFileLine( sline, lineNumberInFile, null ); } String nextLine = getLine( log, reader, encodingType, fileFormatType, line ); if ( nextLine == null ) { break; } sline = sline + nextLine; lineNumberInFile++; } return new TextFileLine( sline, lineNumberInFile, null ); }
Source:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; PingNuageVspCommand that = (PingNuageVspCommand) o; if (shouldAudit != that.shouldAudit) return false; return true; }

Target:
public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof PingNuageVspCommand)) return false; if (!super.equals(o)) return false; PingNuageVspCommand that = (PingNuageVspCommand) o; if (shouldAudit != that.shouldAudit) return false; return true; }
Source:
public static void setUp() throws Exception { QueryRunnerFactory factory = new TopNQueryRunnerFactory( new StupidPool<ByteBuffer>( new Supplier<ByteBuffer>() { @Override public ByteBuffer get() { return ByteBuffer.allocate(2000); } } ), new TopNQueryQueryToolChest(new TopNQueryConfig()), QueryRunnerTestHelper.NOOP_QUERYWATCHER ); testCaseMap.put( TestCases.rtIndex, QueryRunnerTestHelper.makeQueryRunner( factory, new IncrementalIndexSegment(TestIndex.getIncrementalTestIndex(false), segmentId) ) ); testCaseMap.put( TestCases.mMappedTestIndex, QueryRunnerTestHelper.makeQueryRunner( factory, new QueryableIndexSegment(segmentId, TestIndex.getMMappedTestIndex()) ) ); testCaseMap.put( TestCases.mergedRealtimeIndex, QueryRunnerTestHelper.makeQueryRunner( factory, new QueryableIndexSegment(segmentId, TestIndex.mergedRealtimeIndex()) ) ); testCaseMap.put( TestCases.rtIndexOffheap, QueryRunnerTestHelper.makeQueryRunner( factory, new IncrementalIndexSegment(TestIndex.getIncrementalTestIndex(true), segmentId) ) ); }

Target:
public static void setUp() throws Exception { QueryRunnerFactory factory = new TopNQueryRunnerFactory( new StupidPool<ByteBuffer>( new Supplier<ByteBuffer>() { @Override public ByteBuffer get() { return ByteBuffer.allocateDirect(2000); } } ), new TopNQueryQueryToolChest(new TopNQueryConfig()), QueryRunnerTestHelper.NOOP_QUERYWATCHER ); testCaseMap.put( TestCases.rtIndex, QueryRunnerTestHelper.makeQueryRunner( factory, new IncrementalIndexSegment(TestIndex.getIncrementalTestIndex(false), segmentId) ) ); testCaseMap.put( TestCases.mMappedTestIndex, QueryRunnerTestHelper.makeQueryRunner( factory, new QueryableIndexSegment(segmentId, TestIndex.getMMappedTestIndex()) ) ); testCaseMap.put( TestCases.mergedRealtimeIndex, QueryRunnerTestHelper.makeQueryRunner( factory, new QueryableIndexSegment(segmentId, TestIndex.mergedRealtimeIndex()) ) ); testCaseMap.put( TestCases.rtIndexOffheap, QueryRunnerTestHelper.makeQueryRunner( factory, new IncrementalIndexSegment(TestIndex.getIncrementalTestIndex(true), segmentId) ) ); }
Source:
RemoteCommand(bnd bnd, RemoteOptions options) throws Exception { super(bnd); this.bnd = bnd; use(bnd); launcher = new LauncherSupervisor(); launcher.connect(host = options.host("localhost"), port = options.port(Agent.DEFAULT_PORT)); agent = launcher.getAgent(); List<BundleDTO> installedBundles = agent.getBundles(); if (options.list()) { installedBundles.forEach(b -> prettyPrintBundleDTO(b)); return; } String bundlePath = options.installOrUpdate(null); if (bundlePath != null) { File file = new File(bundlePath); Jar bundle = null; try { bundle = new Jar(file); } catch (Exception e) { error("Error occurred while parsing the specified file - %s", e.getMessage()); return; } String bsn = bundle.getBsn(); String version = bundle.getVersion(); Optional<BundleDTO> installedBundle = installedBundles.stream() .filter(b -> bsn.equals(b.symbolicName) && !version.equals(b.version)) .findAny(); if (installedBundle.isPresent()) { bnd.out.println("Bundle will be installed since a bundle in the framework matches the BSN " + "and the version of the specified bundle"); } else { bnd.out.println("Bundle will be updated since no bundle in the framework matches the BSN and " + "the version of the specified bundle"); } bnd.out.println(); try { String location = "reference:" + bsn + ":" + version; BundleDTO dto = agent.install(location, Files.readAllBytes(file.toPath())); prettyPrintBundleDTO(dto); } catch (Exception e) { error("Bundle cannot be installed or updated. Reason - %s", e.getMessage()); } } }

Target:
RemoteCommand(bnd bnd, RemoteOptions options) throws Exception { super(bnd); this.bnd = bnd; use(bnd); launcher = new LauncherSupervisor(); launcher.connect(host = options.host("localhost"), port = options.port(Agent.DEFAULT_PORT)); agent = launcher.getAgent(); }
Source:
public void release() { v8.getLocker().checkThread(); if (isReleased()) { return; } releasing = true; try { for (V8Value reference : references) { reference.close(); } v8.removeReferenceHandler(memoryManagerReferenceHandler); references.clear(); } finally { releasing = false; } released = true; }

Target:
public void release() { v8.getLocker().checkThread(); if (released) { return; } releasing = true; try { for (V8Value reference : references) { reference.close(); } v8.removeReferenceHandler(memoryManagerReferenceHandler); references.clear(); } finally { releasing = false; } released = true; }
Source:
@Test public void invokeMethod_vs_DefaultGroovyMethods() throws Exception { MetaMethod m1 = InvokerHelper.getMetaClass(ClassWithInvokeMethod.class).pickMethod("asBoolean",new Class[0]); assert m1!=null; assert (Boolean)m1.invoke(new ClassWithInvokeMethod(),new Object[0]); assertEvaluate( new ProxyWhitelist( new GenericWhitelist(), new AbstractWhitelist() { @Override public boolean permitsConstructor(Constructor<?> constructor, Object[] args) { return constructor.getDeclaringClass()==ClassWithInvokeMethod.class; } } ), true, "def c = new org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptorTest.ClassWithInvokeMethod(); c.asBoolean()" ); }

Target:
@Test public void invokeMethod_vs_DefaultGroovyMethods() throws Exception { MetaMethod m1 = InvokerHelper.getMetaClass(ClassWithInvokeMethod.class).pickMethod("asBoolean",new Class[0]); assertNotNull(m1); assertTrue((Boolean) m1.invoke(new ClassWithInvokeMethod(), new Object[0])); assertEvaluate( new ProxyWhitelist( new GenericWhitelist(), new StaticWhitelist("new " + ClassWithInvokeMethod.class.getName()) ), true, "def c = new " + ClassWithInvokeMethod.class.getCanonicalName() + "(); c.asBoolean()" ); }
Source:
public ImmutableList<Arguments> toParamList(final ImmutableList<Ds3ResponseCode> ds3ResponseCodes) { final ImmutableList.Builder<Arguments> builder = ImmutableList.builder(); builder.add(new Arguments("int", "RetryAfterSeconds")); builder.add(new Arguments("Status", "Status")); if (hasContent(ds3ResponseCodes)) { final ImmutableList<Arguments> responseCodeArgs = ds3ResponseCodes.stream() .filter(i -> i.getCode() < 300) .map(BaseResponseGenerator::toParam) .filter(Optional::isPresent) .map(Optional::get) .collect(GuavaCollectors.immutableList()); builder.addAll(responseCodeArgs); } return builder.build().stream() .sorted(new CustomArgumentComparator()) .collect(GuavaCollectors.immutableList()); }

Target:
public ImmutableList<Arguments> toParamList(final ImmutableList<Ds3ResponseCode> ds3ResponseCodes) { final ImmutableList.Builder<Arguments> builder = ImmutableList.builder(); builder.add(new Arguments("int", "RetryAfterSeconds")); builder.add(new Arguments("Status", "Status")); if (hasContent(ds3ResponseCodes)) { final ImmutableList<Arguments> responseCodeArgs = ds3ResponseCodes.stream() .filter(i -> i.getCode() < ERROR_CODE_THRESHOLD) .map(BaseResponseGenerator::toParam) .filter(Optional::isPresent) .map(Optional::get) .collect(GuavaCollectors.immutableList()); builder.addAll(responseCodeArgs); } return builder.build().stream() .sorted(new CustomArgumentComparator()) .collect(GuavaCollectors.immutableList()); }
Source:
public void testBasicInjection() throws Exception { final CaffeineCacheConfig config = new CaffeineCacheConfig(); Injector injector = Initialization.makeInjectorWithModules( GuiceInjectors.makeStartupInjector(), ImmutableList.of( new Module() { @Override public void configure(Binder binder) { binder.bindConstant().annotatedWith(Names.named("serviceName")).to("druid/test/redis"); binder.bindConstant().annotatedWith(Names.named("servicePort")).to(0); binder.bind(CaffeineCacheConfig.class).toInstance(config); binder.bind(Cache.class).toProvider(CaffeineCacheProviderWithConfig.class).in(ManageLifecycle.class); } } ) ); final Lifecycle lifecycle = injector.getInstance(Lifecycle.class); lifecycle.start(); try { Cache cache = injector.getInstance(Cache.class); Assert.assertEquals(CaffeineCache.class, cache.getClass()); } finally { lifecycle.stop(); } }

Target:
public void testBasicInjection() throws Exception { final CaffeineCacheConfig config = new CaffeineCacheConfig(); Injector injector = Initialization.makeInjectorWithModules( GuiceInjectors.makeStartupInjector(), ImmutableList.<Module>of( binder -> { binder.bindConstant().annotatedWith(Names.named("serviceName")).to("druid/test/redis"); binder.bindConstant().annotatedWith(Names.named("servicePort")).to(0); binder.bind(CaffeineCacheConfig.class).toInstance(config); binder.bind(Cache.class).toProvider(CaffeineCacheProviderWithConfig.class).in(ManageLifecycle.class); } ) ); final Lifecycle lifecycle = injector.getInstance(Lifecycle.class); lifecycle.start(); try { Cache cache = injector.getInstance(Cache.class); Assert.assertEquals(CaffeineCache.class, cache.getClass()); } finally { lifecycle.stop(); } }
Source:
@Override public boolean handle(TraceContext context, MutableSpan span) { if (!context.isLocalRoot()) { parentToChildren.add(context.parentIdString(), span); } Iterable<MutableSpan> children = parentToChildren.remove(context.spanIdString()); FinishedChildrenHandler.this.handle(span, children != null ? children : emptyList()); return true; }

Target:
@Override public boolean handle(TraceContext context, MutableSpan span) { if (!context.isLocalRoot()) { parentToChildren.add(context.parentIdString(), span); } Set<MutableSpan> children = parentToChildren.remove(context.spanIdString()); Iterator<MutableSpan> child = children != null ? children.iterator() : emptyIterator(); FinishedChildrenHandler.this.handle(span, child); return true; }
Source:
public IndexingLevel getIndexingLevel(EClass type) { Object key = toKey(type); IndexingLevel level = directlyObservedClasses.get(key); if (level == null) { level = delayedClasses.get(key); } level = level == null ? wildcardMode : level; return level == null ? IndexingLevel.NONE : level; }

Target:
public IndexingLevel getIndexingLevel(EClass type) { Object key = toKey(type); IndexingLevel level = directlyObservedClasses.get(key); if (level == null) { level = delayedClasses.get(key); } return wildcardMode.merge(level); }
Source:
public void onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); if (!isAdded() || ((PageActivity)getActivity()).isSearching()) { return; } MenuItem savePageMenu = menu.findItem(R.id.menu_save_page); if (savePageMenu == null) { return; } MenuItem shareMenu = menu.findItem(R.id.menu_share_page); MenuItem otherLangMenu = menu.findItem(R.id.menu_other_languages); MenuItem findInPageMenu = menu.findItem(R.id.menu_find_in_page); MenuItem themeChooserMenu = menu.findItem(R.id.menu_themechooser); switch (state) { case STATE_NO_FETCH: case STATE_INITIAL_FETCH: savePageMenu.setEnabled(false); shareMenu.setEnabled(false); otherLangMenu.setEnabled(false); findInPageMenu.setEnabled(false); themeChooserMenu.setEnabled(false); break; case STATE_COMPLETE_FETCH: savePageMenu.setEnabled(true); shareMenu.setEnabled(true); if (page.getPageProperties().getLanguageCount() == 0) { otherLangMenu.setVisible(false); } else { otherLangMenu.setEnabled(true); } findInPageMenu.setEnabled(true); themeChooserMenu.setEnabled(true); if (subState == SUBSTATE_PAGE_SAVED) { savePageMenu.setEnabled(false); savePageMenu.setTitle(WikipediaApp.getInstance().getString(R.string.menu_page_saved)); } else if (subState == SUBSTATE_SAVED_PAGE_LOADED) { savePageMenu.setTitle(WikipediaApp.getInstance().getString(R.string.menu_refresh_saved_page)); } else { savePageMenu.setTitle(WikipediaApp.getInstance().getString(R.string.menu_save_page)); } break; default: throw new RuntimeException("This can't happen"); } }

Target:
public void onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); if (!isAdded() || ((PageActivity)getActivity()).isSearching()) { return; } MenuItem savePageMenu = menu.findItem(R.id.menu_save_page); if (savePageMenu == null) { return; } MenuItem shareMenu = menu.findItem(R.id.menu_share_page); MenuItem otherLangMenu = menu.findItem(R.id.menu_other_languages); MenuItem findInPageMenu = menu.findItem(R.id.menu_find_in_page); MenuItem themeChooserMenu = menu.findItem(R.id.menu_themechooser); switch (state) { case STATE_NO_FETCH: case STATE_INITIAL_FETCH: savePageMenu.setEnabled(false); shareMenu.setEnabled(false); otherLangMenu.setEnabled(false); findInPageMenu.setEnabled(false); themeChooserMenu.setEnabled(false); break; case STATE_COMPLETE_FETCH: savePageMenu.setEnabled(true); shareMenu.setEnabled(true); otherLangMenu.setVisible(page.getPageProperties().getLanguageCount() != 0); findInPageMenu.setEnabled(true); themeChooserMenu.setEnabled(true); if (subState == SUBSTATE_PAGE_SAVED) { savePageMenu.setEnabled(false); savePageMenu.setTitle(WikipediaApp.getInstance().getString(R.string.menu_page_saved)); } else if (subState == SUBSTATE_SAVED_PAGE_LOADED) { savePageMenu.setTitle(WikipediaApp.getInstance().getString(R.string.menu_refresh_saved_page)); } else { savePageMenu.setTitle(WikipediaApp.getInstance().getString(R.string.menu_save_page)); } break; default: throw new RuntimeException("This can't happen"); } }
Source:
protected void processResults(final List<? extends Command> response, final List<CommandAndHandler> commandsAndHandlers) { if (LOG.isDebugEnabled() && response.size() > 0) { StringBuffer buffer = new StringBuffer(); for (Command command : response) { buffer.append(command.getClass().getSimpleName()); buffer.append(", "); } LOG.trace("Processing commands from server: {}", response.size(), buffer.substring(0, buffer.length() - 2)); } else { LOG.trace("Processing commands from server", response.size()); } for (Command serverCommand : response) { dispatchHandle(serverCommand); } OnFinishedHandler callback = commandsAndHandlers.get(0).getHandler(); if (callback != null) { LOG.trace("Handling registered callback"); try { callback.onFinished(); } catch (Exception e) { LOG.info("Error in handling callback", e); throw e; } } }

Target:
protected void processResults(final List<? extends Command> response, final List<CommandAndHandler> commandsAndHandlers) { if (LOG.isDebugEnabled() && response.size() > 0) { StringBuffer buffer = new StringBuffer(); for (Command command : response) { buffer.append(command.getClass().getSimpleName()); buffer.append(", "); } LOG.trace("Processing commands from server: {}", response.size(), buffer.substring(0, buffer.length() - 2)); } else { LOG.trace("Processing commands from server", response.size()); } for (Command serverCommand : response) { dispatchHandle(serverCommand); } OnFinishedHandler callback = commandsAndHandlers.get(0).getHandler(); if (callback != null) { LOG.trace("Handling registered callback"); try { callback.onFinished(); } catch (Exception e) { LOG.error("Error in handling callback", e); throw e; } } }
Source:
public boolean doPreUpdateIdP(String oldIdPName, IdentityProvider identityProvider) throws IdentityProviderManagementException { String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext() .getTenantDomain(); try { destroyConnector(oldIdPName, tenantDomain); } catch (IdentityProvisioningException e) { log.error("Error when provisioning IDP update", e); throw new IdentityProviderManagementException("Error when provisioning IDP update",e); } return true; }

Target:
public boolean doPreUpdateIdP(String oldIdPName, IdentityProvider identityProvider) throws IdentityProviderManagementException { String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext() .getTenantDomain(); try { destroyConnector(oldIdPName, tenantDomain); } catch (IdentityProvisioningException e) { throw new IdentityProviderManagementException("Error when provisioning IDP update", e); } return true; }
Source:
public DataMapKey() { super(); }

Target:
public DataMapKey() { }
Source:
public Stream<Condition> getConditions(BaselineExperiment experiment) { ImmutableSetMultimap<String, String> assayAccession2OntologyTerms = efoLookupService .expandOntologyTerms(experiment.getExperimentDesign().getAllOntologyTermIdsByAssayAccession()); return experiment.getDataColumnDescriptors().stream() .flatMap(assayGroup -> assayGroup.assaysAnalyzedForThisDataColumn().stream() .map(assayAccession -> new Condition( experiment.getAccession(), assayGroup.getId(), collectAssayProperties( experiment, assayAccession, assayAccession2OntologyTerms.get(assayAccession))))); }

Target:
public Stream<Condition> getConditions(BaselineExperiment experiment) { ImmutableSetMultimap<String, String> assayAccession2OntologyTerms = mapAssayAccessionsToOntologyTerms(experiment.getExperimentDesign()); return experiment.getDataColumnDescriptors().stream() .flatMap(assayGroup -> assayGroup.assaysAnalyzedForThisDataColumn().stream() .map(assayAccession -> new Condition( experiment.getAccession(), assayGroup.getId(), collectAssayProperties( experiment, assayAccession, assayAccession2OntologyTerms.get(assayAccession))))); }
Source:
private Consumer createConsumerForHypervisorId(String incHypervisorId, Owner owner, Principal principal, Consumer incoming) { Consumer consumer = new Consumer(); consumer.setName(sanitizeHypervisorId(incHypervisorId)); consumer.setType(this.hypervisorType); consumer.setFact("uname.machine", "x86_64"); consumer.setGuestIds(new ArrayList<GuestId>()); consumer.setOwner(owner); consumer.setAutoheal(!owner.getAutobindDisabled()); consumer.setCanActivate(subAdapter.canActivateSubscription(consumer)); if (owner.getDefaultServiceLevel() != null) { consumer.setServiceLevel(owner.getDefaultServiceLevel()); } else { consumer.setServiceLevel(""); } if (principal.getUsername() != null) { consumer.setUsername(principal.getUsername()); } consumerResource.sanitizeConsumerFacts(consumer); HypervisorId hypervisorId = new HypervisorId(consumer, incHypervisorId); consumer.setHypervisorId(hypervisorId); consumerResource.checkForFactsUpdate(consumer, incoming); consumer.setGuestIds(incoming.getGuestIds()); if (consumer.getGuestIds() != null) { for (GuestId g : consumer.getGuestIds()) { g.setConsumer(consumer); } } complianceRules.getStatus(consumer, null, false, false); return consumer; }

Target:
private Consumer createConsumerForHypervisorId(String incHypervisorId, Owner owner, Principal principal, Consumer incoming) { Consumer consumer = new Consumer(); if (incoming.getName() != null) { consumer.setName(incoming.getName()); } else { consumer.setName(sanitizeHypervisorId(incHypervisorId)); } consumer.setType(this.hypervisorType); consumer.setFact("uname.machine", "x86_64"); consumer.setGuestIds(new ArrayList<GuestId>()); consumer.setOwner(owner); consumer.setAutoheal(true); consumer.setCanActivate(subAdapter.canActivateSubscription(consumer)); if (owner.getDefaultServiceLevel() != null) { consumer.setServiceLevel(owner.getDefaultServiceLevel()); } else { consumer.setServiceLevel(""); } if (principal.getUsername() != null) { consumer.setUsername(principal.getUsername()); } consumer.setEntitlementCount(0L); consumerResource.sanitizeConsumerFacts(consumer); HypervisorId hypervisorId = new HypervisorId(consumer, incHypervisorId); consumer.setHypervisorId(hypervisorId); consumerResource.checkForFactsUpdate(consumer, incoming); consumer.setGuestIds(incoming.getGuestIds()); if (consumer.getGuestIds() != null) { for (GuestId g : consumer.getGuestIds()) { g.setConsumer(consumer); } } complianceRules.getStatus(consumer, null, false, false); return consumer; }
Source:
public Obs saveObs(Obs obs, String changeMessage) throws APIException { if(obs == null){ throw new APIException("Obs.error.cannot.be.null", (Object[]) null); } if(obs.getId() != null && changeMessage == null){ throw new APIException("Obs.error.ChangeMessage.required", (Object[]) null); } handleExistingObsWithComplexConcept(obs); ensureRequirePrivilege(obs); if (obs.getObsId() == null || obs.getVoided()) { if (obs.getObsId() == null){ obs = check_patient(obs); } return saveNewOrVoidedObs(obs,changeMessage); } else if(!obs.isDirty()){ setPersonFromEncounter(obs); return saveObsNotDirty(obs, changeMessage); } else { setPersonFromEncounter(obs); return saveExistingObs(obs,changeMessage); } }

Target:
public Obs saveObs(Obs obs, String changeMessage) throws APIException { if(obs == null){ throw new APIException("Obs.error.cannot.be.null", (Object[]) null); } if(obs.getId() != null && changeMessage == null){ throw new APIException("Obs.error.ChangeMessage.required", (Object[]) null); } handleExistingObsWithComplexConcept(obs); ensureRequirePrivilege(obs); if (obs.getObsId() == null || obs.getVoided()) { return saveNewOrVoidedObs(obs,changeMessage); } else if(!obs.isDirty()){ setPersonFromEncounter(obs); return saveObsNotDirty(obs, changeMessage); } else { setPersonFromEncounter(obs); return saveExistingObs(obs,changeMessage); } }
Source:
public static ProducerInfo getProducerInfo(String tenantId, Span serverSpan, SpanCache spanCache) { String clientSpanId = SpanUniqueIdGenerator.getClientId(serverSpan.getId()); if (spanCache != null && clientSpanId != null) { Span clientSpan = spanCache.get(tenantId, clientSpanId); Span rootOrServerSpan = findRootOrServerSpan(tenantId, clientSpan, spanCache); if (rootOrServerSpan != null) { ProducerInfo pi = new ProducerInfo(); pi.setDuration(TimeUnit.MILLISECONDS.convert(clientSpan.getDuration(), TimeUnit.MICROSECONDS)); pi.setTimestamp(TimeUnit.MILLISECONDS.convert(clientSpan.getTimestamp(), TimeUnit.MICROSECONDS)); pi.setFragmentId(clientSpan.getId()); pi.getProperties().addAll(clientSpan.binaryAnnotationMapping().getProperties()); pi.setHostAddress(clientSpan.ipv4()); if (serverSpan.service() != null) { pi.getProperties().add(new Property(Constants.PROP_SERVICE_NAME, serverSpan.service())); } pi.setId(clientSpan.getId()); pi.setMultipleConsumers(false); pi.setSourceOperation(SpanDeriverUtil.deriveOperation(rootOrServerSpan)); if (rootOrServerSpan.serverSpan()) { pi.setSourceUri(rootOrServerSpan.url().getPath()); } else { pi.setSourceUri(Constants.URI_CLIENT_PREFIX + clientSpan.url().getPath()); } return pi; } } return null; }

Target:
public static ProducerInfo getProducerInfo(String tenantId, Span serverSpan, SpanCache spanCache) { String clientSpanId = SpanUniqueIdGenerator.getClientId(serverSpan.getId()); if (spanCache != null && clientSpanId != null) { Span clientSpan = spanCache.get(tenantId, clientSpanId); Span rootOrServerSpan = findRootOrServerSpan(tenantId, clientSpan, spanCache); if (rootOrServerSpan != null) { ProducerInfo pi = new ProducerInfo(); pi.setDuration(TimeUnit.MILLISECONDS.convert(clientSpan.getDuration(), TimeUnit.MICROSECONDS)); pi.setTimestamp(TimeUnit.MILLISECONDS.convert(clientSpan.getTimestamp(), TimeUnit.MICROSECONDS)); pi.setFragmentId(clientSpan.getId()); pi.getProperties().addAll(clientSpan.binaryAnnotationMapping().getProperties()); pi.setHostAddress(clientSpan.ipv4()); if (clientSpan.service() != null) { pi.getProperties().add(new Property(Constants.PROP_SERVICE_NAME, clientSpan.service())); } pi.setId(clientSpan.getId()); pi.setMultipleConsumers(false); pi.setSourceOperation(SpanDeriverUtil.deriveOperation(rootOrServerSpan)); if (rootOrServerSpan.serverSpan()) { pi.setSourceUri(rootOrServerSpan.url().getPath()); } else { pi.setSourceUri(Constants.URI_CLIENT_PREFIX + clientSpan.url().getPath()); } return pi; } } return null; }
Source:
private boolean copyFile(URI srcUri, URI dstUri) throws IOException { try { String encodedUrl = null; try { encodedUrl = URLEncoder.encode(srcUri.getHost() + srcUri.getPath(), StandardCharsets.UTF_8.toString()); } catch (UnsupportedEncodingException e) { LOGGER.info("URL could not be encoded: {}", e.getMessage()); } String dstPath = sanitizePath(dstUri.getPath()); CopyObjectRequest copyReq = CopyObjectRequest.builder() .copySource(encodedUrl) .destinationBucket(dstUri.getHost()) .destinationKey(dstPath) .build(); CopyObjectResponse copyObjectResponse = s3Client.copyObject(copyReq); return copyObjectResponse.sdkHttpResponse().isSuccessful(); }catch(S3Exception e){ throw new IOException(e); } }

Target:
private boolean copyFile(URI srcUri, URI dstUri) throws IOException { try { String encodedUrl = null; try { encodedUrl = URLEncoder.encode(srcUri.getHost() + srcUri.getPath(), StandardCharsets.UTF_8.toString()); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } String dstPath = sanitizePath(dstUri.getPath()); CopyObjectRequest copyReq = CopyObjectRequest.builder().copySource(encodedUrl).destinationBucket(dstUri.getHost()).destinationKey(dstPath) .build(); CopyObjectResponse copyObjectResponse = _s3Client.copyObject(copyReq); return copyObjectResponse.sdkHttpResponse().isSuccessful(); } catch (S3Exception e) { throw new IOException(e); } }
Source:
public void remove(String tenantId, String id) { Property<?> remove = propertyCache.remove(id); if (remove != null) { eventListener.observersMap.remove(id); } }

Target:
public void remove(String tenantId, String id) { propertyCache.remove(id); }
Source:
private void addAnimalHandler() { this.playerCount++; if (!this.eventSend && this.AllTeamsHaveOnePlayer()) { this.eventSend = true; GameAboutToStartEvent event = new GameAboutToStartEvent(); event.setSeconds(DELAY); this.eventDispatcher.dispatch(event); final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); scheduler.schedule(this::start, DELAY, TimeUnit.SECONDS); } }

Target:
private void addAnimalHandler() { this.playerCount++; if (!this.eventSend && this.AllTeamsHaveAPlayer()) { this.eventSend = true; GameAboutToStartEvent event = new GameAboutToStartEvent(); event.setSeconds(DELAY); this.eventDispatcher.dispatch(event); final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); scheduler.schedule(this::start, DELAY, TimeUnit.SECONDS); } }
Source:
public static void main(String[] args) throws IOException, RunnerException { BenchmarkData data = new BenchmarkData(); data.setup(); new BenchmarkSTContains().stContainsInnerPoint(data); Options options = new OptionsBuilder() .verbosity(VerboseMode.NORMAL) .include(".*" + BenchmarkSTContains.class.getSimpleName() + ".*") .build(); new Runner(options).run(); }

Target:
public static void main(String[] args) throws IOException, RunnerException { BenchmarkData data = new BenchmarkData(); data.setup(); BenchmarkSTContains benchmark = new BenchmarkSTContains(); if (!((Boolean) benchmark.stContainsInnerPoint(data)).booleanValue()) { throw new IllegalStateException("ST_Contains for inner point expected to return true, got false."); } if (((Boolean) benchmark.stContainsOuterPointInEnvelope(data)).booleanValue()) { throw new IllegalStateException("ST_Contains for outer point expected to return false, got true."); } Options options = new OptionsBuilder() .verbosity(VerboseMode.NORMAL) .include(".*" + BenchmarkSTContains.class.getSimpleName() + ".*") .build(); new Runner(options).run(); }
Source:
public String getDefaultMetaVariable() { T[] enumConstants = enumType.getEnumConstants(); List<String> items = new ArrayList<>(enumConstants.length); for (Enum<T> item : enumConstants) { try { if (enumType.getField(item.name()).getAnnotation(Deprecated.class) == null) { items.add(item.name()); } } catch (NoSuchFieldException e) { throw new AssertionError(); } catch (SecurityException e) { throw new AssertionError(); } } return new StringBuffer() .append('[') .append(Joiner.on(" | ").join(items)) .append(']') .toString(); }

Target:
public String getDefaultMetaVariable() { T[] enumConstants = enumType.getEnumConstants(); List<String> items = new ArrayList<>(enumConstants.length); for (Enum<T> item : enumConstants) { try { if (enumType.getField(item.name()).getAnnotation(Deprecated.class) == null) { items.add(item.name()); } } catch (NoSuchFieldException e) { throw new AssertionError(); } catch (SecurityException e) { items.add(item.name()); LoggerFactory.getLogger() .info( "A SecurityException occured while getting field '" + item.name() + "' from enum '" + enumType.getName() + "': " + e.getMessage()); } } return new StringBuffer() .append('[') .append(Joiner.on(" | ").join(items)) .append(']') .toString(); }
Source:
private String getDateTimeFromTimeStamp(Instant instant) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX"); sdf.setTimeZone(TimeZone.getTimeZone("UTC")); return sdf.format(new Date(instant.toEpochMilli())); }

Target:
private String getDateTimeFromTimeStamp(Instant instant) { DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSXXX") .withZone(ZoneOffset.UTC); return formatter.format(instant); }
Source:
default ColumnValueSelector<Double> makeColumnValueSelector(ReadableOffset offset, ImmutableBitmap nullValueBitmap) { class HistoricalDoubleColumnSelector implements DoubleColumnSelector, HistoricalColumnSelector<Double> { @Override public double getDouble() { return ColumnarDoubles.this.get(offset.getOffset()); } @Override public double getDouble(int offset) { return ColumnarDoubles.this.get(offset); } @Override public boolean isNull() { return nullValueBitmap.get(offset.getOffset()); } @Override public void inspectRuntimeShape(RuntimeShapeInspector inspector) { inspector.visit("columnar", ColumnarDoubles.this); inspector.visit("offset", offset); } } return new HistoricalDoubleColumnSelector(); }

Target:
default ColumnValueSelector<Double> makeColumnValueSelector(ReadableOffset offset, ImmutableBitmap nullValueBitmap) { if (nullValueBitmap.isEmpty()) { class HistoricalDoubleColumnSelector implements DoubleColumnSelector, HistoricalColumnSelector<Double> { @Override public boolean isNull() { return false; } @Override public double getDouble() { return ColumnarDoubles.this.get(offset.getOffset()); } @Override public double getDouble(int offset) { return ColumnarDoubles.this.get(offset); } @Override public void inspectRuntimeShape(RuntimeShapeInspector inspector) { inspector.visit("columnar", ColumnarDoubles.this); inspector.visit("offset", offset); } } return new HistoricalDoubleColumnSelector(); } else { class HistoricalDoubleColumnSelectorWithNulls implements DoubleColumnSelector, HistoricalColumnSelector<Double> { @Override public boolean isNull() { return nullValueBitmap.get(offset.getOffset()); } @Override public double getDouble() { assert NullHandling.replaceWithDefault() || !isNull(); return ColumnarDoubles.this.get(offset.getOffset()); } @Override public double getDouble(int offset) { assert NullHandling.replaceWithDefault() || !nullValueBitmap.get(offset); return ColumnarDoubles.this.get(offset); } @Override public void inspectRuntimeShape(RuntimeShapeInspector inspector) { inspector.visit("columnar", ColumnarDoubles.this); inspector.visit("offset", offset); inspector.visit("nullValueBitmap", nullValueBitmap); } } return new HistoricalDoubleColumnSelectorWithNulls(); } }
Source:
public void allConfigurationFilesWithLocalPIDsAreProcessedAndConfigurationIsUpdated() { String configDirectory = configBaseDirectory + SEP + "local_pid_conf"; String servicesDirectory = "local_pid_services"; String defaultConfigFileName = configDirectory + SEP + "local.pid.default.file.cfg"; initialize(defaultConfigFileName); String absoluteConfigDirectory = configDirectory + SEP + servicesDirectory; ConfigDispatcher cd = new ConfigDispatcher(bundleContext, configAdmin); cd.processConfigFile(new File(absoluteConfigDirectory)); verifyValueOfConfigurationProperty("local.default.pid", "default.property", "default.value"); verifyValueOfConfigurationProperty("local.service.first.pid", "service.property", "service.value"); verifyValueOfConfigurationProperty("local.service.second.pid", "service.property", "service.value"); }

Target:
public void allConfigurationFilesWithLocalPIDsAreProcessedAndConfigurationIsUpdated() { String configDirectory = configBaseDirectory + SEP + "local_pid_conf"; String servicesDirectory = "local_pid_services"; String defaultConfigFileName = configDirectory + SEP + "local.pid.default.file.cfg"; initialize(defaultConfigFileName); cd.processConfigFile(new File(getAbsoluteConfigDirectory(configDirectory, servicesDirectory))); verifyValueOfConfigurationProperty("local.default.pid", "default.property", "default.value"); verifyValueOfConfigurationProperty("local.service.first.pid", "service.property", "service.value"); verifyValueOfConfigurationProperty("local.service.second.pid", "service.property", "service.value"); }
Source:
private Guid getClusterId() { Guid vdsGroupId; if (Guid.Empty.equals(getParameters().getVdsGroupId())) { vdsGroupId = Guid.createGuidFromStringDefaultEmpty( Config.<String> getValue(ConfigValues.AutoRegistrationDefaultVdsGroupID)); log.debug( "RegisterVdsQuery::ExecuteCommand - VdsGroupId received as -1, using AutoRegistrationDefaultVdsGroupID: '{}'", vdsGroupId); } else { vdsGroupId = getParameters().getVdsGroupId(); } if (vdsGroupId == null || Guid.Empty.equals(vdsGroupId)) { VdsGroupDAO dao = DbFacade.getInstance().getVdsGroupDao(); VDSGroup cluster = dao.getByName("Default"); if (cluster != null) { vdsGroupId = cluster.getId(); } else { List<VDSGroup> clusters = dao.getAll(); if (clusters.size() > 0) { vdsGroupId = clusters.get(0).getId(); } else { log.error("AddVdsCommand: No default or valid cluster was found, host registration failed."); AuditLogableBase logableBase = new AuditLogableBase(); AuditLogDirector.log(logableBase, AuditLogType.HOST_FAILED_REGISTRATION_INVALID_CLUSTER); } } } return vdsGroupId; }

Target:
private Guid getClusterId() { Guid vdsGroupId; if (Guid.Empty.equals(getParameters().getVdsGroupId())) { vdsGroupId = Guid.createGuidFromStringDefaultEmpty( Config.<String> getValue(ConfigValues.AutoRegistrationDefaultVdsGroupID)); log.debug( "RegisterVdsQuery::ExecuteCommand - VdsGroupId received as -1, using AutoRegistrationDefaultVdsGroupID: '{}'", vdsGroupId); } else { vdsGroupId = getParameters().getVdsGroupId(); } if (vdsGroupId == null || Guid.Empty.equals(vdsGroupId)) { VdsGroupDAO dao = DbFacade.getInstance().getVdsGroupDao(); VDSGroup cluster = dao.getByName("Default"); if (cluster != null) { vdsGroupId = cluster.getId(); } else { List<VDSGroup> clusters = dao.getAll(); if (clusters.size() > 0) { vdsGroupId = clusters.get(0).getId(); } } } return vdsGroupId; }
Source:
private ProtectionDomain create(ProtectionDomain domain) { Enumeration<Permission> permissions = domain.getPermissions().elements(); PermissionCollection proxyPermissions = new Permissions(); while (permissions.hasMoreElements()) { proxyPermissions.add(permissions.nextElement()); } proxyPermissions.add(ACCESS_DECLARED_MEMBERS_PERMISSION); return new ProtectionDomain(domain.getCodeSource(), proxyPermissions); }

Target:
private ProtectionDomain create(ProtectionDomain domain) { if (domain.implies(ACCESS_DECLARED_MEMBERS_PERMISSION)) { return domain; } Enumeration<Permission> permissions = domain.getPermissions().elements(); PermissionCollection proxyPermissions = new Permissions(); while (permissions.hasMoreElements()) { proxyPermissions.add(permissions.nextElement()); } proxyPermissions.add(ACCESS_DECLARED_MEMBERS_PERMISSION); return new ProtectionDomain(domain.getCodeSource(), proxyPermissions); }