auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void showException(PageBook pageBook, FormText exceptionText, Throwable e) { JBossCentralActivator.log(e); StringBuffer message = new StringBuffer("An error occurred"); if(e.getMessage()!=null) { message.append(": " + StringEscapeUtils.escapeXml(e.getMessage())); } else if (e.getClass().getCanonicalName()!=null) { message.append(": " + e.getClass().getCanonicalName()); } message.append(". See error log for details"); String text = JBossCentralActivator.FORM_START_TAG + "<img href=\"image\"/> " + message.toString() + JBossCentralActivator.FORM_END_TAG; exceptionText.setText(text, true, false); Image image = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING); exceptionText.setImage("image", image); pageBook.showPage(exceptionText); }

Target:
private void showException(PageBook pageBook, FormText exceptionText, Throwable e) { JBossCentralActivator.log(e); StringBuffer message = new StringBuffer("An error occurred"); if(e.getMessage()!=null) { message.append(": " + StringEscapeUtils.escapeXml(e.getMessage())); } else if (e.getClass().getCanonicalName()!=null) { message.append(": " + e.getClass().getCanonicalName()); } message.append(". Open the Error view for more details"); String text = JBossCentralActivator.FORM_START_TAG + "<img href=\"image\"/> " + message.toString() + JBossCentralActivator.FORM_END_TAG; exceptionText.setText(text, true, false); Image image = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING); exceptionText.setImage("image", image); pageBook.showPage(exceptionText); }
Source:
private OzoneManagerRatisServer(Configuration conf, OzoneManagerServerProtocol om, String raftGroupIdStr, RaftPeerId localRaftPeerId, InetSocketAddress addr, List<RaftPeer> raftPeers) throws IOException { this.ozoneManager = om; this.omRatisAddress = addr; this.port = addr.getPort(); RaftProperties serverProperties = newRaftProperties(conf); this.raftPeerId = localRaftPeerId; this.raftGroupId = RaftGroupId.valueOf( getRaftGroupIdFromOmServiceId(raftGroupIdStr)); this.raftGroup = RaftGroup.valueOf(raftGroupId, raftPeers); StringBuilder raftPeersStr = new StringBuilder(); for (RaftPeer peer : raftPeers) { raftPeersStr.append(", ").append(peer.getAddress()); } LOG.info("Instantiating OM Ratis server with GroupID: and " + "Raft Peers: {}", raftGroupIdStr, raftPeersStr.toString().substring(2)); this.omStateMachine = getStateMachine(this.raftGroupId); this.server = RaftServer.newBuilder() .setServerId(this.raftPeerId) .setGroup(this.raftGroup) .setProperties(serverProperties) .setStateMachine(omStateMachine) .build(); this.scheduledRoleChecker = Executors.newSingleThreadScheduledExecutor(); this.scheduledRoleChecker.scheduleWithFixedDelay(new Runnable() { @Override public void run() { if (cachedPeerRole.isPresent() && cachedPeerRole.get() == RaftPeerRole.LEADER) { updateServerRole(); } } }, roleCheckInitialDelayMs, roleCheckIntervalMs, TimeUnit.MILLISECONDS); }

Target:
private OzoneManagerRatisServer(Configuration conf, OzoneManagerServerProtocol om, String raftGroupIdStr, RaftPeerId localRaftPeerId, InetSocketAddress addr, List<RaftPeer> raftPeers) throws IOException { this.ozoneManager = om; this.omRatisAddress = addr; this.port = addr.getPort(); RaftProperties serverProperties = newRaftProperties(conf); this.raftPeerId = localRaftPeerId; this.raftGroupId = RaftGroupId.valueOf( getRaftGroupIdFromOmServiceId(raftGroupIdStr)); this.raftGroup = RaftGroup.valueOf(raftGroupId, raftPeers); StringBuilder raftPeersStr = new StringBuilder(); for (RaftPeer peer : raftPeers) { raftPeersStr.append(", ").append(peer.getAddress()); } LOG.info("Instantiating OM Ratis server with GroupID: and " + "Raft Peers: {}", raftGroupIdStr, raftPeersStr.toString().substring(2)); this.omStateMachine = getStateMachine(); this.server = RaftServer.newBuilder() .setServerId(this.raftPeerId) .setGroup(this.raftGroup) .setProperties(serverProperties) .setStateMachine(omStateMachine) .build(); this.scheduledRoleChecker = Executors.newSingleThreadScheduledExecutor(); this.scheduledRoleChecker.scheduleWithFixedDelay(new Runnable() { @Override public void run() { if (cachedPeerRole.isPresent() && cachedPeerRole.get() == RaftPeerRole.LEADER) { updateServerRole(); } } }, roleCheckInitialDelayMs, roleCheckIntervalMs, TimeUnit.MILLISECONDS); }
Source:
public void link(Attributes attributes, String hrefOrHashName, String text) { if (hrefOrHashName != null) { assertOpenBlock(); try { currentBlock.write('"'); writeAttributes(attributes); currentBlock.write(text); currentBlock.write('"'); currentBlock.write(':'); currentBlock.write(hrefOrHashName); } catch (IOException e) { throw new RuntimeException(e); } } }

Target:
public void link(Attributes attributes, String hrefOrHashName, String text) { assertOpenBlock(); try { currentBlock.write('"'); writeAttributes(attributes); currentBlock.write(text); currentBlock.write('"'); currentBlock.write(':'); if (hrefOrHashName != null) { currentBlock.write(hrefOrHashName); } } catch (IOException e) { throw new RuntimeException(e); } }
Source:
private static boolean checkData( Member[][] nonAllMembers, int cnt, Set<Member> measureSet, Evaluator evaluator) { if (cnt < 0) { boolean found = false; Object value = evaluator.evaluateCurrent(); if (value != null && !(value instanceof Throwable)) { found = true; } if (!measureSet.isEmpty()) { for (Member measure : measureSet) { evaluator.setContext(measure); value = evaluator.evaluateCurrent(); if (value != null && !(value instanceof Throwable)) { found = true; } } } return found; } else { boolean found = false; for (Member m : nonAllMembers[cnt]) { evaluator.setContext(m); if (checkData(nonAllMembers, cnt - 1, measureSet, evaluator)) { found = true; } } return found; } }

Target:
private static boolean checkData( Member[][] nonAllMembers, int cnt, Set<Member> measureSet, Evaluator evaluator) { if (cnt < 0) { if (measureSet.isEmpty()) { Object value = evaluator.evaluateCurrent(); if (value != null && !(value instanceof Throwable)) { return true; } } else { boolean found = false; for (Member measure : measureSet) { evaluator.setContext(measure); Object value = evaluator.evaluateCurrent(); if (value != null && !(value instanceof Throwable)) { found = true; } } return found; } } else { boolean found = false; for (Member m : nonAllMembers[cnt]) { evaluator.setContext(m); if (checkData(nonAllMembers, cnt - 1, measureSet, evaluator)) { found = true; } } return found; } return false; }
Source:
public ShortcutManager shortcutManager() { return new ShortcutManager(shortcutDirectory, desktopShortcutDirectory, libraryManager(), scriptsConfiguration.scriptInterpreter(), new ObjectMapper()); }

Target:
public ShortcutManager shortcutManager() { return new ShortcutManager(shortcutDirectory, desktopShortcutDirectory, libraryManager(), scriptsConfiguration.scriptInterpreter(), phoenicisGlobalConfiguration.objectMapper()); }
Source:
public static String subtractFromCurrentTime(int days) { Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DAY_OF_YEAR, -days); return FormatUtil.getTimeZoneFormat().format(calendar.getTime()); }

Target:
public static String subtractFromCurrentTime(int days) { Calendar calendar = SystemTime.asCalendar(); calendar.add(Calendar.DAY_OF_YEAR, -days); return FormatUtil.getTimeZoneFormat().format(calendar.getTime()); }
Source:
public void addAlias(final String indexSuffix) { final Timer.Context timeRemoveAlias = updateAliasTimer.time(); try { String indexName = indexIdentifier.getIndex(indexSuffix); final AdminClient adminClient = esProvider.getClient().admin(); String[] indexNames = getIndexesFromEs( AliasType.Write ); final IndicesAliasesRequestBuilder aliasesRequestBuilder = adminClient.indices().prepareAliases(); for ( String currentIndex : indexNames ) { aliasesRequestBuilder.removeAlias( currentIndex, alias.getWriteAlias() ); logger.info("Removing existing write Alias Name from Index [{}]", alias.getReadAlias(), currentIndex); } aliasesRequestBuilder.addAlias( indexName, alias.getReadAlias()); logger.info("Created new read Alias Name on Index [{}]", alias.getReadAlias(), indexName); aliasesRequestBuilder.addAlias( indexName, alias.getWriteAlias() ); logger.info("Created new write Alias Name on Index [{}]", alias.getWriteAlias(), indexName); final IndicesAliasesResponse result = aliasesRequestBuilder.execute().actionGet(); final boolean isAcknowledged = result.isAcknowledged(); if(!isAcknowledged){ throw new RuntimeException( "Unable to add aliases to the new index " + indexSuffix ); } } finally{ aliasCache.invalidate(alias); timeRemoveAlias.stop(); } }

Target:
public void addAlias(final String indexSuffix) { final Timer.Context timeRemoveAlias = updateAliasTimer.time(); try { String indexName = indexIdentifier.getIndex(indexSuffix); final AdminClient adminClient = esProvider.getClient().admin(); String[] indexNames = getIndexesFromEs( AliasType.Write ); final IndicesAliasesRequestBuilder aliasesRequestBuilder = adminClient.indices().prepareAliases(); for ( String currentIndex : indexNames ) { aliasesRequestBuilder.removeAlias( currentIndex, alias.getWriteAlias() ); logger.info("Removing existing write Alias Name from Index [{}]", alias.getWriteAlias(), currentIndex); } aliasesRequestBuilder.addAlias( indexName, alias.getReadAlias()); logger.info( "Created new read Alias Name on Index [{}]", alias.getReadAlias(), indexName); aliasesRequestBuilder.addAlias( indexName, alias.getWriteAlias() ); logger.info("Created new write Alias Name on Index [{}]", alias.getWriteAlias(), indexName); final IndicesAliasesResponse result = aliasesRequestBuilder.execute().actionGet(); final boolean isAcknowledged = result.isAcknowledged(); if(!isAcknowledged){ throw new RuntimeException( "Unable to add aliases to the new index " + indexSuffix ); } } finally{ aliasCache.invalidate(alias); timeRemoveAlias.stop(); } }
Source:
ImmutableSet<Integer> getPartitionKeys() throws NoConnectionsException, IOException, ProcCallException { if (!m_useClientAffinity || m_partitionKeys.get() == null) { refreshPartitionKeys(); } return m_partitionKeys.get(); }

Target:
ImmutableSet<Integer> getPartitionKeys() throws NoConnectionsException, IOException, ProcCallException { refreshPartitionKeys(false); if (m_partitionUpdateStatus.get().getStatus() != ClientResponse.SUCCESS) { throw new ProcCallException(m_partitionUpdateStatus.get(), null, null); } return m_partitionKeys.get(); }
Source:
private void readNextChunk() throws IOException { assert chunkStartOffsetIndex > 0; long highOffset = chunkStartOffsetIndex == offsetsLength ? totalSize : offsets[chunkStartOffsetIndex]; int newLowOffsetIndex = chunkStartOffsetIndex; while ( newLowOffsetIndex > 0 ) { long deltaOffset = highOffset - offsets[--newLowOffsetIndex]; if ( deltaOffset > CHUNK_SIZE ) { if ( chunkStartOffsetIndex - newLowOffsetIndex > 1 ) { newLowOffsetIndex++; } break; } } assert chunkStartOffsetIndex - newLowOffsetIndex > 0; chunkLength = chunkStartOffsetIndex - newLowOffsetIndex; chunkStartOffsetIndex = newLowOffsetIndex; chunkCursor = 0; channel.setCurrentPosition( offsets[chunkStartOffsetIndex] ); chunkTransactions.clear(); for ( int i = 0; i < chunkLength; i++ ) { boolean success = transactionCursor.next(); assert success; chunkTransactions.add( transactionCursor.get() ); } }

Target:
private void readNextChunk() throws IOException { assert chunkStartOffsetIndex > 0; long highOffset = chunkStartOffsetIndex == offsetsLength ? totalSize : offsets[chunkStartOffsetIndex]; int newLowOffsetIndex = chunkStartOffsetIndex; while ( newLowOffsetIndex > 0 ) { long deltaOffset = highOffset - offsets[--newLowOffsetIndex]; if ( deltaOffset > CHUNK_SIZE ) { break; } } assert chunkStartOffsetIndex - newLowOffsetIndex > 0; int chunkLength = chunkStartOffsetIndex - newLowOffsetIndex; chunkStartOffsetIndex = newLowOffsetIndex; channel.setCurrentPosition( offsets[chunkStartOffsetIndex] ); assert chunkTransactions.isEmpty(); for ( int i = 0; i < chunkLength; i++ ) { boolean success = transactionCursor.next(); assert success; chunkTransactions.push( transactionCursor.get() ); } }
Source:
public int findWikiIndex(String wikiCode) { int index = ArrayUtils.indexOf(getWikiCodes(), wikiCode); if (index == ArrayUtils.INDEX_NOT_FOUND) { return findWikiIndex(FALLBACK_WIKI_LANG_CODE); } return index; }

Target:
public int findWikiIndex(String wikiCode) { int index = getWikiCodes().indexOf(wikiCode); if (index == -1) { return findWikiIndex(FALLBACK_WIKI_LANG_CODE); } return index; }
Source:
public int getCooldown() { return Balance.vpa.HALFINVULNERABLE_COOLDOWN; }

Target:
public int getCooldown() { return 20 * (Balance.vpa.HALFINVULNERABLE_COOLDOWN); }
Source:
public SBlock executeSBlock(final VirtualFrame frame) { return new SBlock(blockMethod, frame.materialize(), blockClass); }

Target:
public SBlock executeSBlock(final VirtualFrame frame) { return new SBlock(blockMethod, null, blockClass); }
Source:
public void testUpdate() { VirtualMachine vm = api().get(vmName); VirtualMachineProperties oldProperties = vm.properties(); StorageProfile oldStorageProfile = oldProperties.storageProfile(); String blob = storageService.storageServiceProperties().primaryEndpoints().get("blob"); VHD vhd = VHD.create(blob + "vhds/" + vmName + "new-data-disk.vhd"); DataDisk newDataDisk = DataDisk.create(vmName + "new-data-disk", "1", 1, vhd, "Empty"); List<DataDisk> oldDataDisks = oldStorageProfile.dataDisks(); ImmutableList<DataDisk> newDataDisks = ImmutableList.<DataDisk> builder().addAll(oldDataDisks).add(newDataDisk).build(); StorageProfile newStorageProfile = oldStorageProfile.toBuilder().dataDisks(newDataDisks).build(); VirtualMachineProperties newProperties = oldProperties.toBuilder().storageProfile(newStorageProfile).build(); VirtualMachine newVm = vm.toBuilder().properties(newProperties).build(); vm = api().createOrUpdate(vmName, newVm.location(), newVm.properties(), newVm.tags(), newVm.plan()); assertEquals(vm.properties().storageProfile().dataDisks().size(), 2); }

Target:
public void testUpdate() { VirtualMachine vm = api().get(vmName); VirtualMachineProperties oldProperties = vm.properties(); StorageProfile oldStorageProfile = oldProperties.storageProfile(); String blob = storageService.storageServiceProperties().primaryEndpoints().get("blob"); VHD vhd = VHD.create(blob + "vhds/" + vmName + "new-data-disk.vhd"); DataDisk newDataDisk = DataDisk.create(vmName + "new-data-disk", "1", 1, vhd, "Empty"); List<DataDisk> oldDataDisks = oldStorageProfile.dataDisks(); assertEquals(oldDataDisks.size(), 1); ImmutableList<DataDisk> newDataDisks = ImmutableList.<DataDisk> builder().addAll(oldDataDisks).add(newDataDisk).build(); StorageProfile newStorageProfile = oldStorageProfile.toBuilder().dataDisks(newDataDisks).build(); VirtualMachineProperties newProperties = oldProperties.toBuilder().storageProfile(newStorageProfile).build(); VirtualMachine newVm = vm.toBuilder().properties(newProperties).build(); vm = api().createOrUpdate(vmName, newVm.location(), newVm.properties(), newVm.tags(), newVm.plan()); assertEquals(vm.properties().storageProfile().dataDisks().size(), oldDataDisks.size() + 1); }
Source:
public AdapterResponse<Feed> getFeed(GetFeedRequest getFeedRequest) { AdapterResponse<Feed> response; int pageSize = PAGE_SIZE; final String pageSizeString = getFeedRequest.getPageSize(); if (StringUtils.isNotBlank(pageSizeString)) { pageSize = Integer.parseInt(pageSizeString); } final String marker = getFeedRequest.getPageMarker(); if (StringUtils.isNotBlank(marker) && marker.equals(MOCK_LAST_MARKER)) { response = getLastPage(getFeedRequest, pageSize); } else if (StringUtils.isNotBlank(marker)) { response = getFeedPage(getFeedRequest, marker, pageSize); } else { response = getFeedHead(getFeedRequest, pageSize); } return response; }

Target:
public AdapterResponse<Feed> getFeed(GetFeedRequest getFeedRequest) { AdapterResponse<Feed> response; int pageSize = PAGE_SIZE; final String pageSizeString = getFeedRequest.getPageSize(); if (StringUtils.isNotBlank(pageSizeString)) { pageSize = Integer.parseInt(pageSizeString); } final String marker = getFeedRequest.getPageMarker(); if ((StringUtils.isBlank(marker))) { response = getFeedHead(getFeedRequest, pageSize); } else if (marker.equals(MOCK_LAST_MARKER)) { response = getLastPage(getFeedRequest, pageSize); } else { response = getFeedPage(getFeedRequest, marker, pageSize); } return response; }
Source:
public boolean deleteBaseDir() { boolean wasDeleted = baseDir.delete(); if (wasDeleted) { Runtime.getRuntime().removeShutdownHook(shutdownHook); } return wasDeleted; }

Target:
public boolean deleteBaseDir() { boolean wasDeleted = baseDir.delete(); if (! baseDir.exists()) { Runtime.getRuntime().removeShutdownHook(shutdownHook); } return wasDeleted; }
Source:
public HashMap<String, String> getSearchFields() { return ProzesskopieForm.getSearchFieldsForCatalogue(opacKatalog); }

Target:
public HashMap<String, String> getSearchFields() { if (opacKatalog == null || opacKatalog.isEmpty()) { ProzesskopieForm pkf = new ProzesskopieForm(); List<String> allOpacCatalogues = pkf.getAllOpacCatalogues(); if (!allOpacCatalogues.isEmpty()) { opacKatalog = allOpacCatalogues.get(0); } } return ProzesskopieForm.getSearchFieldsForCatalogue(opacKatalog); }
Source:
public StatisticsLoadBalance() { CpuUsageService cpuUsageService = new CpuUsageServiceImpl(100L, 500L); cpuUsageService.addListener("statisticsloadbalance", (ip, cpu) -> cpuUsage.put(ip, cpu)); }

Target:
public StatisticsLoadBalance() { long collectCpuUsageInMill = Long.parseLong(ConfigurationUtils.getProperty("mill.to.check.cpu.usage.availability")); ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory(this.getClass().getSimpleName(), true)); executor.scheduleAtFixedRate(this::removeStatisticsWhichServerIsDown, collectCpuUsageInMill, collectCpuUsageInMill, TimeUnit.MILLISECONDS); }
Source:
public static <T> T deserializeObject(ObjectMapper mapper, Object payload, Class<T> clazz, JsonSerializer customJsonSerializer) throws JsonProcessingException { if (customJsonSerializer == null) { if (clazz.isAssignableFrom(String.class)){ return (T)mapper.writeValueAsString(payload); } else { return mapper.convertValue(payload, clazz); } } else { ByteArrayOutputStream sourceStream = new ByteArrayOutputStream(); customJsonSerializer.serialize(sourceStream, payload); return customJsonSerializer.deserialize(new ByteArrayInputStream(sourceStream.toByteArray()), createInstance(clazz)); } }

Target:
public static <T> T deserializeObject(ObjectMapper mapper, Object payload, Class<T> clazz, JsonSerializer customJsonSerializer) throws JsonProcessingException { if (customJsonSerializer == null) { if (clazz.isAssignableFrom(String.class)) { return (T)mapper.writeValueAsString(payload); } else { return mapper.convertValue(payload, clazz); } } ByteArrayOutputStream sourceStream = new ByteArrayOutputStream(); customJsonSerializer.serialize(sourceStream, payload); return customJsonSerializer.deserialize(new ByteArrayInputStream(sourceStream.toByteArray()), createInstance(clazz)); }
Source:
public void configurePipeline(PipelineConfigurer pipelineConfigurer) { pipelineConfigurer.createDataset(config.fileSetName, FileSet.class); Schema inputSchema = pipelineConfigurer.getStageConfigurer().getInputSchema(); if (inputSchema != null) { config.validate(inputSchema); } }

Target:
public void configurePipeline(PipelineConfigurer pipelineConfigurer) { pipelineConfigurer.createDataset(config.fileSetName, FileSet.class); Schema inputSchema = pipelineConfigurer.getStageConfigurer().getInputSchema(); Preconditions.checkArgument(inputSchema != null, "Input Schema must be a known constant."); config.validate(inputSchema); }
Source:
private static Set<UnitType> findTargets( final UnitType unitType, final Set<UnitType> unitTypes, final Set<UnitType> enemyUnitTypes) { final Set<UnitType> targets = new HashSet<>(enemyUnitTypes); targets.removeAll(UnitAttachment.get(unitType).getCanNotTarget()); if (!unitTypes.stream().anyMatch(Matches.unitTypeIsDestroyer())) { for (final UnitType target : targets) { if (UnitAttachment.get(target).getCanNotBeTargetedBy().contains(unitType)) { targets.remove(target); } } } return targets; }

Target:
private static Set<UnitType> findTargets( final UnitType unitType, final Set<UnitType> unitTypes, final Set<UnitType> enemyUnitTypes) { final Set<UnitType> targets = new HashSet<>(enemyUnitTypes); targets.removeAll(UnitAttachment.get(unitType).getCanNotTarget()); return unitTypes.stream().anyMatch(Matches.unitTypeIsDestroyer()) ? targets : targets.stream() .filter( target -> !UnitAttachment.get(target).getCanNotBeTargetedBy().contains(unitType)) .collect(Collectors.toSet()); }
Source:
public TextTranslationServiceImpl(StoreOntologyService storeOntologyService) { this.namedClassTypes = new ConcurrentHashMap<>(); try { this.urls.addAll(storeOntologyService.retrieveOntologyURLs()); } catch (Exception e) { throw new RuntimeException(e); } }

Target:
public TextTranslationServiceImpl(StoreOntologyService storeOntologyService) { this.namedClassTypes = new ConcurrentHashMap<>(); this.storeOntologyService = storeOntologyService; }
Source:
public void storeCommand() throws PersistenceException { final File inputFile = getInputFile(); if (inputFile == null) { return; } int totalFiles = 0; try { totalFiles = totalFileCount(inputFile); } catch (IOException e) { console.println("Unable to read directory"); } List<Map<String, Object>> importResults = new ArrayList<>(); console.println("Found " + totalFiles + " files to import\n"); try (Stream<Path> ingestStream = Files.walk(inputFile.toPath(), FileVisitOption.FOLLOW_LINKS)) { ingestStream .filter(Files::isRegularFile) .map(Path::toFile) .map(this::processFile) .filter(Objects::nonNull) .forEach(importResults::add); } catch (IOException e) { console.println("Unable to import files."); throw new UncheckedIOException(e); } persistentStore.add(type, importResults); console.println("Imported " + importResults.size() + " records \n"); }

Target:
public void storeCommand() throws PersistenceException { final File inputFile = getInputFile(); if (inputFile == null) { return; } int totalFiles = 0; long totalImport = 0; try { totalFiles = totalFileCount(inputFile); } catch (IOException e) { console.println("Unable to read directory"); } List<Map<String, Object>> importResults = new ArrayList<>(); console.println("Found " + totalFiles + " files to import\n"); try (Stream<Path> ingestStream = Files.walk(inputFile.toPath(), FileVisitOption.FOLLOW_LINKS)) { List<Path> regularFiles = ingestStream.filter(Files::isRegularFile).collect(Collectors.toList()); for (Collection<Path> batch : Lists.partition(regularFiles, batchSize)) { batch .stream() .map(Path::toFile) .map(this::processFile) .filter(Objects::nonNull) .forEach(importResults::add); persistentStore.add(type, importResults); totalImport += importResults.size(); } } catch (IOException e) { console.println("Unable to import files."); throw new UncheckedIOException(e); } console.println("Imported " + totalImport + " records \n"); }
Source:
private WritableSupplier<IndexedMultivalue<IndexedInts>> readMultiValuedColum(VERSION version, ByteBuffer buffer) { switch (version) { case UNCOMPRESSED_MULTI_VALUE: return VSizeIndexed.readFromByteBuffer(buffer).asWritableSupplier(); case COMPRESSED: return CompressedVSizeIndexedSupplier.fromByteBuffer(buffer, byteOrder); } throw new IAE("Unsupported version[%s]", version); }

Target:
private WritableSupplier<IndexedMultivalue<IndexedInts>> readMultiValuedColum(VERSION version, ByteBuffer buffer) { switch (version) { case UNCOMPRESSED_MULTI_VALUE: return VSizeIndexed.readFromByteBuffer(buffer).asWritableSupplier(); case COMPRESSED: return CompressedVSizeIndexedSupplier.fromByteBuffer(buffer, byteOrder); } throw new IAE("Unsupported multi-value version[%s]", version); }
Source:
public static String stackTrace(Exception ex) { Writer writer = new StringWriter(); PrintWriter printWriter = new PrintWriter(writer); ex.printStackTrace(printWriter); String str = writer.toString(); return str; }

Target:
public static String stackTrace(Exception ex) { Writer writer = new StringWriter(); PrintWriter printWriter = new PrintWriter(writer); ex.printStackTrace(printWriter); return writer.toString(); }
Source:
private Topology readTopology() throws Exception { try { final byte[] data = getCurator().getData().forPath(getSubscriptionPath(NODE_TOPOLOGY)); final Topology result = objectMapper.readValue(data, Topology.class); getLog().info("Topology is {}", result); return result; } catch (final IOException ex) { throw new OldSubscriptionFormatException(); } catch (KeeperException.NoNodeException ex) { throw new SubscriptionNotInitializedException(getSubscriptionId()); } }

Target:
private Topology readTopology() throws NakadiRuntimeException, OldSubscriptionFormatException, SubscriptionNotInitializedException { try { final byte[] data = getCurator().getData().forPath(getSubscriptionPath(NODE_TOPOLOGY)); final Topology result = objectMapper.readValue(data, Topology.class); getLog().info("Topology is {}", result); return result; } catch (final IOException ex) { throw new OldSubscriptionFormatException(); } catch (KeeperException.NoNodeException ex) { throw new SubscriptionNotInitializedException(getSubscriptionId()); } catch (final Exception ex) { throw new NakadiRuntimeException(ex); } }
Source:
private static KafkaConsumer<String, ChangeEvent> buildKafkaConsumer( String servers, String consumerId, Map<String, Class<? extends ChangeEvent>> topicToClass, int batchSize) { Properties props = new Properties(); props.put("bootstrap.servers", servers); props.put("group.id", consumerId); props.put("max.poll.interval.ms", "600000"); props.put("enable.auto.commit", "false"); props.put("max.poll.records", System.getProperty(MAX_POLL_PROPERTY, String.valueOf(batchSize))); props.put("max.partition.fetch.bytes", System.getProperty(MAX_FETCH_PROPERTY, String.valueOf(batchSize * 1024))); log.info("Creating consumer {}", consumerId); return new KafkaConsumer<>(props, new StringDeserializer(), new JsonDeserializer<>(topicToClass)); }

Target:
private static KafkaConsumer<String, ChangeEvent> buildKafkaConsumer( String servers, String consumerId, Map<String, Class<? extends ChangeEvent>> topicToClass, int batchSize) { Properties props = new Properties(); props.put("bootstrap.servers", servers); props.put("group.id", consumerId); props.put("max.poll.interval.ms", "600000"); props.put("enable.auto.commit", "false"); props.put("max.poll.records", System.getProperty(KafkaPoller.MAX_POLL_PROPERTY, String.valueOf(batchSize))); props.put("max.partition.fetch.bytes", System.getProperty(KafkaPoller.MAX_FETCH_PROPERTY, String.valueOf(batchSize * 1024))); log.info("Creating consumer {}", consumerId); return new KafkaConsumer<>(props, new StringDeserializer(), new JsonDeserializer<>(topicToClass)); }
Source:
protected void makeAuditRecord( final float time, final String messageType, final Map<String, Serializable> actionParams, String className ) { AuditHelper.audit( PentahoSessionHolder.getSession() != null ? PentahoSessionHolder.getSession().getId() : "", getValue( actionParams, ActionUtil.INVOKER_ACTIONUSER ), getValue( actionParams, ActionUtil.INVOKER_STREAMPROVIDER ), className, String.format( getValue( actionParams, ActionUtil.INVOKER_ACTIONID ) ), messageType, getValue( actionParams, ActionUtil.QUARTZ_LINEAGE_ID ), null, time, null ); }

Target:
protected void makeAuditRecord( final float time, final String messageType, final Map<String, Serializable> actionParams, String className ) { AuditHelper.audit( PentahoSessionHolder.getSession() != null ? PentahoSessionHolder.getSession().getId() : "", getValue( actionParams, ActionUtil.INVOKER_ACTIONUSER ), getValue( actionParams, ActionUtil.INVOKER_STREAMPROVIDER ), className, getValue( actionParams, ActionUtil.INVOKER_ACTIONID ), messageType, getValue( actionParams, ActionUtil.QUARTZ_LINEAGE_ID ), null, time, null ); }
Source:
private Set<ID> toSet(Iterable<ID> ids) { Set<ID> keys = emptySet(); if (ids instanceof Set) keys = (Set<ID>)ids; else { Iterator<ID> itr = ids.iterator(); if (itr.hasNext()) { ID key = itr.next(); keys = key instanceof Comparable ? new TreeSet<>() : new HashSet<>(); keys.add(key); while (itr.hasNext()) { key = itr.next(); keys.add(key); } } } return keys; }

Target:
private Set<ID> toSet(Iterable<ID> ids) { if (ids instanceof Set) return (Set<ID>)ids; Iterator<ID> itr = ids.iterator(); if (!itr.hasNext()) return emptySet(); ID key = itr.next(); Set<ID> keys = key instanceof Comparable ? new TreeSet<>() : new HashSet<>(); keys.add(key); while (itr.hasNext()) { key = itr.next(); keys.add(key); } return keys; }
Source:
public long getNumberOfAssociations(Session session) { final InfinispanRemoteDatastoreProvider datastoreProvider = getProvider( session.getSessionFactory() ); final SessionFactoryImplementor sessionFactoryImplementor = getSessionFactoryImplementor( session.getSessionFactory() ); Collection<CollectionPersister> persisters = sessionFactoryImplementor.getMetamodel().collectionPersisters().values(); long totalCount = 0; for ( CollectionPersister ep : persisters ) { OgmCollectionPersister persister = (OgmCollectionPersister) ep; String tableName = persister.getTableName(); SingleTableOgmEntityPersister owningPersister = (SingleTableOgmEntityPersister) persister.getOwnerEntityPersister().getEntityPersister(); String ownerTableName = owningPersister.getTableName(); RemoteCache<Object, Object> cache = datastoreProvider.getCache( tableName ); if ( !( cache instanceof TransactionalRemoteCacheImpl ) ) { totalCount += countAssociations( tableName, ownerTableName, datastoreProvider ); continue; } final String[] ownerIdentifyingColumnNames = getIdentityOwnerColumnNames( ownerTableName, datastoreProvider ); totalCount += TransactionalRemoteCacheCounter.countAssociations( (TransactionalRemoteCacheImpl) cache, persister, session, ownerIdentifyingColumnNames ); } return totalCount; }

Target:
public long getNumberOfAssociations(Session session) { final InfinispanRemoteDatastoreProvider datastoreProvider = getProvider( session.getSessionFactory() ); final SessionFactoryImplementor sessionFactoryImplementor = getSessionFactoryImplementor( session.getSessionFactory() ); Collection<CollectionPersister> persisters = sessionFactoryImplementor.getMetamodel().collectionPersisters().values(); long totalCount = 0; for ( CollectionPersister ep : persisters ) { OgmCollectionPersister persister = (OgmCollectionPersister) ep; String tableName = persister.getTableName(); SingleTableOgmEntityPersister owningPersister = (SingleTableOgmEntityPersister) persister.getOwnerEntityPersister().getEntityPersister(); String ownerTableName = owningPersister.getTableName(); RemoteCache<Object, Object> cache = datastoreProvider.getCache( tableName ); if ( cache instanceof TransactionalRemoteCacheImpl ) { final String[] ownerIdentifyingColumnNames = getIdentityOwnerColumnNames( ownerTableName, datastoreProvider ); totalCount += TransactionalRemoteCacheCounter.countAssociations( (TransactionalRemoteCacheImpl) cache, persister, session, ownerIdentifyingColumnNames ); } else { totalCount += countAssociations( tableName, ownerTableName, datastoreProvider ); } } return totalCount; }
Source:
private void validateNewTraceName() { String newTraceName = fNewTraceNameText.getText(); IWorkspace workspace = fTrace.getResource().getWorkspace(); IStatus nameStatus = workspace.validateName(newTraceName, IResource.FOLDER); if ("".equals(newTraceName)) { updateStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, Messages.Dialog_EmptyNameError, null)); return; } if (!nameStatus.isOK()) { updateStatus(nameStatus); return; } IPath newPath = new Path(newTraceName); IContainer parentFolder = fTrace.getResource().getParent(); if (parentFolder.getFolder(newPath).exists() || parentFolder.getFile(newPath).exists()) { updateStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, Messages.Dialog_ExistingNameError, null)); return; } updateStatus(new Status(IStatus.OK, Activator.PLUGIN_ID, "")); }

Target:
private void validateNewTraceName() { String newTraceName = fNewTraceNameText.getText(); IWorkspace workspace = fTrace.getResource().getWorkspace(); IStatus nameStatus = workspace.validateName(newTraceName, IResource.FOLDER); if ("".equals(newTraceName)) { updateStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, Messages.Dialog_EmptyNameError, null)); return; } if (!nameStatus.isOK()) { updateStatus(nameStatus); return; } IContainer parentFolder = fTrace.getResource().getParent(); if (parentFolder.findMember(newTraceName) != null) { updateStatus(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, Messages.Dialog_ExistingNameError, null)); return; } updateStatus(new Status(IStatus.OK, Activator.PLUGIN_ID, "")); }
Source:
protected ClientId(String clientId, String clientSecret) { this.clientId = Preconditions.checkNotNull(clientId); this.clientSecret = clientSecret; }

Target:
public ClientId(String clientId, String clientSecret) { this.clientId = Preconditions.checkNotNull(clientId); this.clientSecret = clientSecret; }
Source:
public void acronym(String text, String definition) { assertOpenBlock(); try { currentBlock.write(text); currentBlock.write('('); currentBlock.write(definition); currentBlock.write(')'); } catch (IOException e) { throw new RuntimeException(e); } }

Target:
public void acronym(String text, String definition) { assertOpenBlock(); characters(text); characters("("); characters(definition); characters(")"); }
Source:
public TextAnalyticsAsyncClient createTextAnalyticsAsyncClient() { TextAnalyticsAsyncClient textAnalyticsAsyncClient = new TextAnalyticsClientBuilder() .credential(new AzureKeyCredential("{api_key}")) .endpoint("{endpoint}") .buildAsyncClient(); END: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.instantiation return textAnalyticsAsyncClient; }

Target:
public TextAnalyticsAsyncClient createTextAnalyticsAsyncClient() { TextAnalyticsAsyncClient textAnalyticsAsyncClient = new TextAnalyticsClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("{endpoint}") .buildAsyncClient(); END: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.instantiation return textAnalyticsAsyncClient; }
Source:
public LttngChannelColumn() { super(HEADER); }

Target:
public LttngChannelColumn() { super(CHANNEL_HEADER); }
Source:
protected void sendParams(HttpURLConnection request, Object params) throws IOException { request.setDoOutput(true); if (params != null) { request.setRequestProperty(HEADER_CONTENT_TYPE, CONTENT_TYPE_JSON + "; charset=" + CHARSET_UTF8); byte[] data = toJson(params).getBytes(CHARSET_UTF8); request.setFixedLengthStreamingMode(data.length); BufferedOutputStream output = new BufferedOutputStream( request.getOutputStream(), bufferSize); try { output.write(data); } finally { try { output.close(); } catch (IOException ignored) { } } } else request.setFixedLengthStreamingMode(0); }

Target:
protected void sendParams(HttpURLConnection request, Object params) throws IOException { request.setDoOutput(true); if (params != null) { request.setRequestProperty(HEADER_CONTENT_TYPE, CONTENT_TYPE_JSON + "; charset=" + CHARSET_UTF8); byte[] data = toJson(params).getBytes(CHARSET_UTF8); request.setFixedLengthStreamingMode(data.length); BufferedOutputStream output = new BufferedOutputStream( request.getOutputStream(), bufferSize); try { output.write(data); output.flush(); } finally { try { output.close(); } catch (IOException ignored) { } } } else request.setFixedLengthStreamingMode(0); }
Source:
public List<String> getUrls() { List<String> updateSites = new ArrayList<String>(); for (UpdateSite site : Jenkins.getActiveInstance().getUpdateCenter().getSiteList()) { String siteUrl = site.getUrl(); int baseUrlEnd = siteUrl.indexOf("update-center.json"); String siteBaseUrl = siteUrl.substring(0, baseUrlEnd); updateSites.add(siteBaseUrl + "updates/" + url); } return updateSites; }

Target:
public List<String> getUrls() { List<String> updateSites = new ArrayList<String>(); for (UpdateSite site : Jenkins.getActiveInstance().getUpdateCenter().getSiteList()) { String siteUrl = site.getUrl(); int baseUrlEnd = siteUrl.indexOf("update-center.json"); if (baseUrlEnd != -1) { String siteBaseUrl = siteUrl.substring(0, baseUrlEnd); updateSites.add(siteBaseUrl + "updates/" + url); } else { LOGGER.log(Level.WARNING, "Url {0} does not look like an update center:", siteUrl); } } return updateSites; }
Source:
protected void checkPycaLibrary(SubscriptionContext ctx, CallExpression callExpression, Symbol calleeSymbol) { if (PYCA_ALGORITHM_METHODS.contains(calleeSymbol.fullyQualifiedName())) { List<Argument> arguments = callExpression.arguments(); if (arguments.size() < 2) { return; } Argument argument = arguments.get(1); if (argument.is(REGULAR_ARGUMENT)) { InferredType type = ((RegularArgument) argument).expression().type(); if (PYCA_VULNERABLE_MODES_AND_PADDING_SCHEMES.stream().anyMatch(type::canOnlyBe)) { ctx.addIssue(argument, MESSAGE); } } } }

Target:
protected void checkPycaLibrary(SubscriptionContext ctx, CallExpression callExpression, Symbol calleeSymbol) { if ("cryptography.hazmat.primitives.ciphers.Cipher".equals(calleeSymbol.fullyQualifiedName())) { RegularArgument mode = TreeUtils.nthArgumentOrKeyword(1, "mode", callExpression.arguments()); if (mode != null) { InferredType type = mode.expression().type(); if (PYCA_VULNERABLE_MODES.stream().anyMatch(type::canOnlyBe)) { ctx.addIssue(mode, MESSAGE); } } return; } if (PYCA_RSA_KEY_METHODS.contains(calleeSymbol.fullyQualifiedName())) { RegularArgument padding = TreeUtils.nthArgumentOrKeyword(1, "padding", callExpression.arguments()); if (padding != null && padding.expression().type().canOnlyBe("cryptography.hazmat.primitives.asymmetric.padding.PKCS1v15")) { ctx.addIssue(padding, MESSAGE); } } }
Source:
public void handleDelivery(String consumerTag, Envelope envelope, BasicProperties properties, byte[] body) throws IOException { MessageProperties messageProperties = messagePropertiesConverter.toMessageProperties( properties, envelope, "UTF-8"); messageProperties.setMessageCount(0); messageProperties.setConsumerTag(consumerTag); messageProperties.setConsumerQueue(queue); Message message = new Message(body, messageProperties); try { invokeListener(message, getChannel()); getChannel().basicAck(envelope.getDeliveryTag(), false); } catch (Exception e) { getChannel().basicNack(envelope.getDeliveryTag(), false, requeueRejected); } }

Target:
public void handleDelivery(String consumerTag, Envelope envelope, BasicProperties properties, byte[] body) throws IOException { MessageProperties messageProperties = SimpleDirectMessageListenerContainer.this.messagePropertiesConverter .toMessageProperties(properties, envelope, "UTF-8"); messageProperties.setMessageCount(0); messageProperties.setConsumerTag(consumerTag); messageProperties.setConsumerQueue(this.queue); Message message = new Message(body, messageProperties); try { invokeListener(getChannel(), message); if (this.ackRequired) { getChannel().basicAck(envelope.getDeliveryTag(), false); } } catch (Exception e) { if (this.ackRequired) { getChannel().basicNack(envelope.getDeliveryTag(), false, SimpleDirectMessageListenerContainer.this.requeueRejected); } } }
Source:
public void initialize() throws Exception { super.init(); carbonHome = CarbonUtils.getCarbonHome(); String pathToCarbonXML = FrameworkPathUtil.getSystemResourceLocation() + "artifacts" + File.separator + "CARBON" + File.separator + "encryption" + File.separator + "carbon.xml"; String targetCarbonXML = carbonHome + File.separator + "repository" + File.separator + "conf" + File.separator + "carbon.xml"; String pathToSymmetricProperties = FrameworkPathUtil.getSystemResourceLocation() + "artifacts" + File .separator + "CARBON" + File.separator + "encryption" + File.separator + "symmetric-key.properties"; String securityFolder = carbonHome + File.separator + "repository" + File.separator + "resources" + File.separator + "security" + File.separator + "symmetric-key.properties"; serverConfigurationManager = new ServerConfigurationManager(automationContext); serverConfigurationManager.applyConfigurationWithoutRestart(new File(pathToSymmetricProperties), new File (securityFolder), false); serverConfigurationManager.applyConfigurationWithoutRestart(new File(pathToCarbonXML), new File (targetCarbonXML), false); serverConfigurationManager.restartGracefully(); super.init(); uploadApp(); readSymmetricKey(); }

Target:
public void initialize() throws Exception { super.init(); carbonHome = CarbonUtils.getCarbonHome(); String pathToCarbonXML = FrameworkPathUtil.getSystemResourceLocation() + "artifacts" + File.separator + "CARBON" + File.separator + "encryption" + File.separator + "carbon.xml"; String targetCarbonXML = carbonHome + File.separator + "repository" + File.separator + "conf" + File.separator + "carbon.xml"; String pathToSymmetricProperties = FrameworkPathUtil.getSystemResourceLocation() + "artifacts" + File .separator + "CARBON" + File.separator + "encryption" + File.separator + "symmetric-key.properties"; String securityFolder = carbonHome + File.separator + "repository" + File.separator + "resources" + File.separator + "security" + File.separator + "symmetric-key.properties"; serverConfigurationManager = new ServerConfigurationManager(automationContext); serverConfigurationManager.applyConfigurationWithoutRestart(new File(pathToSymmetricProperties), new File (securityFolder), false); serverConfigurationManager.applyConfigurationWithoutRestart(new File(pathToCarbonXML), new File (targetCarbonXML), false); serverConfigurationManager.restartGracefully(); uploadApp(); readSymmetricKey(); }
Source:
private boolean validateDestStorage(Guid imageId, Guid destDomainId) { DiskImage diskImage = getDiskImageById(imageId); Guid storagePoolId = diskImage.getStoragePoolId().getValue(); StorageDomainValidator validator = getValidator(destDomainId, storagePoolId); return validate(validator.isDomainExistAndActive()) && validate(validator.domainIsValidDestination()); }

Target:
private boolean validateDestStorage(Guid imageId, Guid destDomainId) { StorageDomainValidator validator = getValidator(destDomainId, getStoragePoolId().getValue()); return validate(validator.isDomainExistAndActive()) && validate(validator.domainIsValidDestination()); }
Source:
public void deserialize(byte[] message, Collector<RowData> out) throws IOException { if (message == null || message.length == 0) { return; } try { GenericRowData row = (GenericRowData) avroDeserializer.deserialize(message); GenericRowData before = null; int index = rowType.getFieldIndex("before"); if (index >= 0) { before = (GenericRowData) row.getField(index); } GenericRowData after = (GenericRowData) row.getField(rowType.getFieldIndex("after")); String op = row.getField(rowType.getFieldIndex("op")).toString(); if (OP_CREATE.equals(op) || OP_READ.equals(op)) { after.setRowKind(RowKind.INSERT); out.collect(after); } else if (OP_UPDATE.equals(op)) { if (before == null) { throw new IllegalStateException(String.format(REPLICA_IDENTITY_EXCEPTION, "UPDATE")); } before.setRowKind(RowKind.UPDATE_BEFORE); after.setRowKind(RowKind.UPDATE_AFTER); out.collect(before); out.collect(after); } else if (OP_DELETE.equals(op)) { if (before == null) { throw new IllegalStateException(String.format(REPLICA_IDENTITY_EXCEPTION, "DELETE")); } before.setRowKind(RowKind.DELETE); out.collect(before); } else { throw new IOException(format( "Unknown \"op\" value \"%s\". The Debezium Avro message is '%s'", op, new String(message))); } } catch (Throwable t) { throw new IOException(format( "Corrupt Debezium Avro message '%s'.", new String(message)), t); } }

Target:
public void deserialize(byte[] message, Collector<RowData> out) throws IOException { if (message == null || message.length == 0) { return; } try { GenericRowData row = (GenericRowData) avroDeserializer.deserialize(message); GenericRowData before = (GenericRowData) row.getField(0); GenericRowData after = (GenericRowData) row.getField(1); String op = row.getField(2).toString(); if (OP_CREATE.equals(op) || OP_READ.equals(op)) { after.setRowKind(RowKind.INSERT); out.collect(after); } else if (OP_UPDATE.equals(op)) { if (before == null) { throw new IllegalStateException(String.format(REPLICA_IDENTITY_EXCEPTION, "UPDATE")); } before.setRowKind(RowKind.UPDATE_BEFORE); after.setRowKind(RowKind.UPDATE_AFTER); out.collect(before); out.collect(after); } else if (OP_DELETE.equals(op)) { if (before == null) { throw new IllegalStateException(String.format(REPLICA_IDENTITY_EXCEPTION, "DELETE")); } before.setRowKind(RowKind.DELETE); out.collect(before); } else { throw new IOException(format( "Unknown \"op\" value \"%s\". The Debezium Avro message is '%s'", op, new String(message))); } } catch (Throwable t) { throw new IOException("Can't deserialize Debezium Avro message.", t); } }
Source:
public static Alias getLegacyFilmAlias(String id) { return new Alias(NEW_PA_BASE_ALIAS + "rt_filmnumber", id); }

Target:
public static Alias getLegacyFilmAlias(String id) { return new Alias(PA_BASE_ALIAS_V2 + "rt_filmnumber", id); }
Source:
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if(method.getDeclaringClass()==IReadResolve.class) { if(goingHome) return Channel.current().getExportedObject(oid); else return proxy; } if(channel==null) throw new IllegalStateException("proxy is not connected to a channel"); if(args==null) args = EMPTY_ARRAY; Class<?> dc = method.getDeclaringClass(); if(dc ==Object.class) { try { return method.invoke(this,args); } catch (InvocationTargetException e) { throw e.getTargetException(); } } boolean async = method.isAnnotationPresent(Asynchronous.class); RPCRequest req = new RPCRequest(oid, method, args, userProxy ? dc.getClassLoader() : null); try { if(userProxy) { if (async) channel().callAsync(req); else return channel().call(req); } else { if (async) req.callAsync(channel()); else return req.call(channel()); } return null; } catch (Throwable e) { for (Class exc : method.getExceptionTypes()) { if (exc.isInstance(e)) throw e; } if (e instanceof RuntimeException || e instanceof Error) throw e; throw new RemotingSystemException(e); } }

Target:
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if(method.getDeclaringClass()==IReadResolve.class) { if(goingHome) return Channel.current().getExportedObject(oid); else return proxy; } if(channel==null) throw new IllegalStateException("proxy is not connected to a channel"); if(args==null) args = EMPTY_ARRAY; Class<?> dc = method.getDeclaringClass(); if(dc ==Object.class) { try { return method.invoke(this,args); } catch (InvocationTargetException e) { throw e.getTargetException(); } } boolean async = method.isAnnotationPresent(Asynchronous.class); RPCRequest req = new RPCRequest(oid, method, args, userProxy ? dc.getClassLoader() : null); try { if(userProxy) { if (async) channelOrFail().callAsync(req); else return channelOrFail().call(req); } else { if (async) req.callAsync(channelOrFail()); else return req.call(channelOrFail()); } return null; } catch (Throwable e) { for (Class exc : method.getExceptionTypes()) { if (exc.isInstance(e)) throw e; } if (e instanceof RuntimeException || e instanceof Error) throw e; throw new RemotingSystemException(e); } }