auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public synchronized void traceOpened(final TmfTraceOpenedSignal signal) { final ITmfTrace trace = signal.getTrace(); final ITmfTimestamp startTs = trace.getStartTime(); final int SCALE = ITmfTimestamp.NANOSECOND_SCALE; long offset = trace.getInitialRangeOffset().normalize(0, SCALE).getValue(); long endTime = startTs.normalize(0, SCALE).getValue() + offset; final TmfTimeRange startTr = new TmfTimeRange(startTs, new TmfTimestamp(endTime, SCALE)); final TmfTraceContext startCtx = new TmfTraceContext(startTs, startTr); fTraces.put(trace, startCtx); <START> if (fCurrentTrace == null) { <END> fCurrentTrace = trace; } }</code><technical_language>fCurrentTrace set new trace. HistogramView (also others) get TmfTraceContext previous selected trace handling TmfTraceOpenedSignal</technical_language>

Target:
public synchronized void traceOpened(final TmfTraceOpenedSignal signal) { final ITmfTrace trace = signal.getTrace(); final ITmfTimestamp startTs = trace.getStartTime(); final int SCALE = ITmfTimestamp.NANOSECOND_SCALE; long offset = trace.getInitialRangeOffset().normalize(0, SCALE).getValue(); long endTime = startTs.normalize(0, SCALE).getValue() + offset; final TmfTimeRange startTr = new TmfTimeRange(startTs, new TmfTimestamp(endTime, SCALE)); final TmfTraceContext startCtx = new TmfTraceContext(startTs, startTr); fTraces.put(trace, startCtx); fCurrentTrace = trace; }
Source:
<code>public void recordWithNonexistentReferences(){ Individual individual = makeValidEntity("validName", "validId"); individual.setCollectedBy(null); individual = service.recordIndividual(individual, "feldwarker"); <START> assertNotNull(individual.getCollectedBy()); <END> }</code><technical_language>idea is "feldwarker" created a placeholder, right? I tests individual.getCollectedBy() id "feldwarker". id right is important enables fill in placeholder later. This expected behavior easier deduce test code</technical_language>

Target:
public void recordWithNonexistentReferences(){ Individual individual = makeValidEntity("validName", "validId"); individual.setCollectedBy(null); individual = service.recordIndividual(individual, "feldwarker"); assertNotNull(individual.getCollectedBy()); assertEquals(individual.getCollectedBy().getUuid(), "feldwarker"); }
Source:
<code>private CompletableFuture<LogReplicationContext> startDiscoveryService(ServerContext serverContext) { log.info("Start Discovery Service."); CompletableFuture<LogReplicationContext> discoveryServiceCallback = new CompletableFuture<>(); this.clusterManagerAdapter = buildClusterManagerAdapter(serverContext.getPluginConfigFilePath()); replicationDiscoveryService = new CorfuReplicationDiscoveryService(serverContext, clusterManagerAdapter, discoveryServiceCallback); <START> Thread replicationDiscoveryThread = new Thread(replicationDiscoveryService); replicationDiscoveryThread.start(); <END> return discoveryServiceCallback; }</code><technical_language>a thread name here</technical_language>

Target:
private CompletableFuture<CorfuInterClusterReplicationServerNode> startDiscoveryService(ServerContext serverContext) { log.info("Start Discovery Service."); CompletableFuture<CorfuInterClusterReplicationServerNode> discoveryServiceCallback = new CompletableFuture<>(); this.clusterManagerAdapter = buildClusterManagerAdapter(serverContext.getPluginConfigFilePath()); replicationDiscoveryService = new CorfuReplicationDiscoveryService(serverContext, clusterManagerAdapter, discoveryServiceCallback); Thread replicationDiscoveryThread = new Thread(replicationDiscoveryService, "discovery-service"); replicationDiscoveryThread.start(); return discoveryServiceCallback; }
Source:
<code>public Void run() throws Exception { FlowNode thisNode = getContext().get(FlowNode.class); LinearScanner scanner = new LinearScanner(); FlowNode getLock = scanner.findFirstMatch(thisNode, new NodeStepTypePredicate("getLock")); if (getLock != null) { LockedResourcesAction action = getLock.getAction(LockedResourcesAction.class); if (action != null && !action.isReleased()) { LockableResourcesManager.get().unlockNames(action.getResourceNames(), getContext().get(Run.class), action.isInversePrecedence()); action.release(); getContext().get(TaskListener.class).getLogger() .println("Lock released on resource [" + action.getResourceDescription()+ "]"); } else { getContext().get(TaskListener.class).getLogger().println("No active lock, proceeding."); } } else { <START> getContext().get(TaskListener.class).getLogger().println("No previous getLock step, proceeding."); <END> } return null; }</code><technical_language>this satisfy case of adding a post step of releaseLock guard deadlock? I agree this error, I valid safer allow unlocking of a resource locked (basically no-op)</technical_language>

Target:
public Void run() throws Exception { FlowNode thisNode = getContext().get(FlowNode.class); LinearScanner scanner = new LinearScanner(); FlowNode getLock = scanner.findFirstMatch(thisNode, new NodeStepTypePredicate("getLock")); if (getLock != null) { LockedFlowNodeAction action = getLock.getAction(LockedFlowNodeAction.class); if (action != null && !action.isReleased()) { LockableResourcesManager.get().unlockNames(action.getResourceNames(), getContext().get(Run.class), action.isInversePrecedence()); action.release(); getContext().get(TaskListener.class).getLogger() .println("Lock released on resource [" + action.getResourceDescription()+ "]"); } else { getContext().get(TaskListener.class).getLogger().println("No active lock, proceeding."); } } else { getContext().get(TaskListener.class).getLogger().println("No previous getLock step, proceeding."); } return null; }
Source:
<code>public void testGcjConnectionsAreCaching() throws IOException { String[] connectionEndpoints = {"127.0.0.1", "127.0.0.2"}; BigtableOptions.Builder optionsBuilder = BigtableOptions.builder() .setProjectId("fake-project") .setInstanceId("fake-instance") .setUsePlaintextNegotiation(true) .setCredentialOptions(CredentialOptions.nullCredential()) .setUseGCJClient(true) .setUseCachedDataPool(true) .setPort(fakeServer.getPort()) .setUserAgent("test"); Map<String, ClientContext> context = getGcjContext(optionsBuilder, connectionEndpoints[0]); Assert.assertEquals(context.size(), 1); Assert.assertTrue(context.containsKey(connectionEndpoints[0])); <START> ClientContext Context_0 = context.get(connectionEndpoints[0]); <END> context = getGcjContext(optionsBuilder, connectionEndpoints[1]); Assert.assertEquals(context.size(), 2); Assert.assertTrue(context.containsKey(connectionEndpoints[1])); Assert.assertEquals(Context_0, context.get(connectionEndpoints[0])); ClientContext Context_1 = context.get(connectionEndpoints[1]); context = getGcjContext(optionsBuilder, connectionEndpoints[1]); Assert.assertEquals(context.size(), 2); Assert.assertEquals(Context_1, context.get(connectionEndpoints[1])); Assert.assertEquals(Context_0, context.get(connectionEndpoints[0])); context = getGcjContext(optionsBuilder, connectionEndpoints[0]); Assert.assertEquals(context.size(), 2); Assert.assertEquals(Context_1, context.get(connectionEndpoints[1])); Assert.assertEquals(Context_0, context.get(connectionEndpoints[0])); }</code><technical_language>lowercase context_0</technical_language>

Target:
public void testGcjConnectionsAreCaching() throws IOException { String[] connectionEndpoints = {"127.0.0.1", "localhost"}; BigtableOptions.Builder optionsBuilder = BigtableOptions.builder() .setProjectId("fake-project") .setInstanceId("fake-instance") .setUsePlaintextNegotiation(true) .setCredentialOptions(CredentialOptions.nullCredential()) .setUseGCJClient(true) .setUseCachedDataPool(true) .setPort(fakeServer.getPort()) .setUserAgent("test"); Map<String, ClientContext> context = getGcjContext(optionsBuilder, connectionEndpoints[0]); Assert.assertEquals(context.size(), 1); Assert.assertTrue(context.containsKey(connectionEndpoints[0])); ClientContext context0 = context.get(connectionEndpoints[0]); context = getGcjContext(optionsBuilder, connectionEndpoints[1]); Assert.assertEquals(context.size(), 2); Assert.assertTrue(context.containsKey(connectionEndpoints[1])); Assert.assertEquals(context0, context.get(connectionEndpoints[0])); ClientContext context1 = context.get(connectionEndpoints[1]); context = getGcjContext(optionsBuilder, connectionEndpoints[1]); Assert.assertEquals(context.size(), 2); Assert.assertEquals(context1, context.get(connectionEndpoints[1])); Assert.assertEquals(context0, context.get(connectionEndpoints[0])); context = getGcjContext(optionsBuilder, connectionEndpoints[0]); Assert.assertEquals(context.size(), 2); Assert.assertEquals(context1, context.get(connectionEndpoints[1])); Assert.assertEquals(context0, context.get(connectionEndpoints[0])); }
Source:
<code>public void run() { Folder folder = getFolder(); logger.debug("Canceling IDLE"); if (folder != null) { folder.isOpen(); } <START> } <END></code><technical_language>I presume this avoid log noise. change? If intention is alert user of problem, log task executor printing stack trace</technical_language>

Target:
public void run() { try { Folder folder = getFolder(); logger.debug("Canceling IDLE"); if (folder != null) { folder.isOpen(); } } catch (Exception ex) { logger.error("Error during resetting idle state.", ex); } }
Source:
<code>public int execute() { try { if (work.dirCopyIteratorInitialized() || work.replPathIteratorInitialized()) { <START> intitiateDataCopyTasks(); <END> } else { Hive hiveDb = getHive(); Path dumpRoot = new Path(conf.getVar(HiveConf.ConfVars.REPLDIR), Base64.getEncoder().encodeToString(work.dbNameOrPattern.toLowerCase() .getBytes(StandardCharsets.UTF_8.name()))); Path currentDumpPath = new Path(dumpRoot, getNextDumpDir()); Path hiveDumpRoot = new Path(currentDumpPath, ReplUtils.REPL_HIVE_BASE_DIR); DumpMetaData dmd = new DumpMetaData(hiveDumpRoot, conf); ReplChangeManager.getInstance(conf); Path cmRoot = new Path(conf.getVar(HiveConf.ConfVars.REPLCMDIR)); Long lastReplId; if (!dumpRoot.getFileSystem(conf).exists(dumpRoot) || dumpRoot.getFileSystem(conf).listStatus(dumpRoot).length == 0) { lastReplId = bootStrapDump(hiveDumpRoot, dmd, cmRoot, hiveDb); } else { work.setEventFrom(getEventFromPreviousDumpMetadata(dumpRoot)); lastReplId = incrementalDump(hiveDumpRoot, dmd, cmRoot, hiveDb); } intitiateDataCopyTasks(); prepareReturnValues(Arrays.asList(currentDumpPath.toUri().toString(), String.valueOf(lastReplId))); } } catch (Exception e) { LOG.error("failed", e); setException(e); return ErrorMsg.getErrorMsg(e.getMessage()).getErrorCode(); } return 0; }</code><technical_language>external table copy task in parallel other tasks</technical_language>

Target:
public int execute() { try { if (work.tableDataCopyIteratorsInitialized()) { initiateDataCopyTasks(); } else { Hive hiveDb = getHive(); Path dumpRoot = new Path(conf.getVar(HiveConf.ConfVars.REPLDIR), Base64.getEncoder().encodeToString(work.dbNameOrPattern.toLowerCase() .getBytes(StandardCharsets.UTF_8.name()))); Path previousHiveDumpPath = getPreviousDumpMetadataPath(dumpRoot); if (shouldDump(previousHiveDumpPath)) { Path currentDumpPath = new Path(dumpRoot, getNextDumpDir()); Path hiveDumpRoot = new Path(currentDumpPath, ReplUtils.REPL_HIVE_BASE_DIR); DumpMetaData dmd = new DumpMetaData(hiveDumpRoot, conf); ReplChangeManager.getInstance(conf); Path cmRoot = new Path(conf.getVar(HiveConf.ConfVars.REPLCMDIR)); Long lastReplId; if (previousHiveDumpPath == null) { lastReplId = bootStrapDump(hiveDumpRoot, dmd, cmRoot, hiveDb); } else { work.setEventFrom(getEventFromPreviousDumpMetadata(previousHiveDumpPath)); lastReplId = incrementalDump(hiveDumpRoot, dmd, cmRoot, hiveDb); } work.setResultValues(Arrays.asList(currentDumpPath.toUri().toString(), String.valueOf(lastReplId))); work.setCurrentDumpPath(currentDumpPath); initiateDataCopyTasks(); } else { LOG.info("Previous Dump is not yet loaded"); } } } catch (Exception e) { LOG.error("failed", e); setException(e); return ErrorMsg.getErrorMsg(e.getMessage()).getErrorCode(); } return 0; }
Source:
<code>private SiriusServerActivityDto convertActivity(Session session, ActivityDescription activityDescription) { String activityIdentifier = activityDescription.getName(); DAnalysis self = <START> ((DAnalysisSessionImpl) session).getAnalyses().get(0); <END> Map<String, Object> variables = new HashMap<>(); variables.put(SELF, self); IEvaluationResult result = new SiriusBackendInterpreter(session).evaluateExpression(variables, activityDescription.getLabelExpression()); String activityName = result.asString(); return new SiriusServerActivityDto(activityIdentifier, activityName); }</code><technical_language>DAnalysisSession.allAnalyses</technical_language>

Target:
private SiriusServerActivityDto convertActivity(Session session, ActivityDescription activityDescription) { String activityIdentifier = activityDescription.getName(); DAnalysis self = ((DAnalysisSessionImpl) session).allAnalyses().stream().findFirst().orElse(null); Map<String, Object> variables = new HashMap<>(); variables.put(SELF, self); IEvaluationResult result = new SiriusBackendInterpreter(session).evaluateExpression(variables, activityDescription.getLabelExpression()); String activityName = result.asString(); return new SiriusServerActivityDto(activityIdentifier, activityName); }
Source:
<code>public void setImage (Image image) { checkWidget(); if ((style & SWT.SEPARATOR) != 0) return; super.setImage (image); if (OS.GTK3) { if (!OS.GTK_IS_MENU_ITEM (handle)) { return; } if (image != null && boxHandle != 0) { <START> ImageList imageList = parent.imageList; <END> if (imageList == null) imageList = parent.imageList = new ImageList (); int imageIndex = imageList.indexOf (image); if (imageIndex == -1) { imageIndex = imageList.add (image); } else { imageList.put (imageIndex, image); } long pixbuf = imageList.getPixbuf (imageIndex); if (OS.SWT_PADDED_MENU_ITEMS && imageHandle != 0) { OS.gtk_image_set_from_pixbuf(imageHandle, pixbuf); } else { imageHandle = OS.gtk_image_new_from_pixbuf (pixbuf); if (imageHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_container_add (boxHandle, imageHandle); OS.gtk_box_reorder_child (boxHandle, imageHandle, 0); } } } else { if (!OS.GTK_IS_IMAGE_MENU_ITEM (handle)) { return; } if (image != null) { ImageList imageList = parent.imageList; if (imageList == null) imageList = parent.imageList = new ImageList (); int imageIndex = imageList.indexOf (image); if (imageIndex == -1) { imageIndex = imageList.add (image); } else { imageList.put (imageIndex, image); } long pixbuf = imageList.getPixbuf (imageIndex); imageHandle = OS.gtk_image_new_from_pixbuf (pixbuf); if (imageHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_image_menu_item_set_image (handle, imageHandle); } else { OS.gtk_image_menu_item_set_image (handle, 0); } } OS.gtk_widget_show (imageHandle); }</code><technical_language>Again, is some code is duplicate in cases of if-statment</technical_language>

Target:
public void setImage (Image image) { checkWidget(); if ((style & SWT.SEPARATOR) != 0) return; super.setImage (image); if (image != null) { ImageList imageList = parent.imageList; if (imageList == null) imageList = parent.imageList = new ImageList (); int imageIndex = imageList.indexOf (image); if (imageIndex == -1) { imageIndex = imageList.add (image); } else { imageList.put (imageIndex, image); } long pixbuf = imageList.getPixbuf (imageIndex); if (OS.GTK3) { if (!OS.GTK_IS_MENU_ITEM (handle)) return; if (OS.SWT_PADDED_MENU_ITEMS && imageHandle != 0) { OS.gtk_image_set_from_pixbuf(imageHandle, pixbuf); } else { imageHandle = OS.gtk_image_new_from_pixbuf (pixbuf); if (imageHandle == 0) error (SWT.ERROR_NO_HANDLES); if (boxHandle != 0) { OS.gtk_container_add (boxHandle, imageHandle); OS.gtk_box_reorder_child (boxHandle, imageHandle, 0); } } } else { if (!OS.GTK_IS_IMAGE_MENU_ITEM (handle)) return; imageHandle = OS.gtk_image_new_from_pixbuf (pixbuf); OS.gtk_image_menu_item_set_image (handle, imageHandle); } } OS.gtk_widget_show (imageHandle); }
Source:
<code>ResourceSupport listSearchMethods(@PathVariable String apiCategory, @PathVariable String model) { ResourceSupport root = new ResourceSupport(); DSpaceRestRepository repository = utils.getResourceRepository(apiCategory, model); boolean searchEnabled = false; <START> for (Method method : repository.getClass().getMethods()) { <END> SearchRestMethod ann = method.getAnnotation(SearchRestMethod.class); if (ann != null) { String name = ann.name(); if (name.isEmpty()) { name = method.getName(); } Link link = linkTo(this.getClass(), apiCategory, model).slash("search").slash(name).withRel(name); root.add(link); searchEnabled = true; } } if (!searchEnabled) { throw new RepositorySearchNotFoundException(model); } return root; }</code><technical_language>RestResourceController is big, move "reflection" related logic a DSpaceRestReflectionHelper class (or similar)? For example this for-loop moved a method List<String> getSearchMethodNames(DSpaceRestRepository repository) names construct links</technical_language>

Target:
public ResourceSupport listSearchMethods(@PathVariable String apiCategory, @PathVariable String model) { ResourceSupport root = new ResourceSupport(); DSpaceRestRepository repository = utils.getResourceRepository(apiCategory, model); List<String> searchMethods = repositoryUtils.listSearchMethods(repository); if (CollectionUtils.isEmpty(searchMethods)) { throw new RepositorySearchNotFoundException(model); } for (String name : searchMethods) { Link link = linkTo(this.getClass(), apiCategory, model).slash("search").slash(name).withRel(name); root.add(link); } return root; }
Source:
<code>private static final String formatInterval(TimeZone zone, Interval interval) { return String.format( "(%s, %s)", DateTimeFormatter.ofPattern("HH:mm").withZone(zone.toZoneId()).format(Instant.ofEpochMilli(interval.getStart())), <START> DateTimeFormatter.ofPattern("HH:mm").withZone(zone.toZoneId()).format(Instant.ofEpochMilli(interval.getEnd())) <END> ); }</code><technical_language>dateFormat(zone).format(Instant.ofEpochMilli(interval.getStart())) etc</technical_language>

Target:
private static final String formatInterval(TimeZone zone, Interval interval) { final Function<Long, String> f = ms -> dateFormat(zone).format(Instant.ofEpochMilli(ms)); return String.format("(%s, %s)", f.apply(interval.getStart()), f.apply(interval.getEnd())); }
Source:
<code>public SnomedSimpleTypeRefSetDSVExporter(final SnomedRefSetDSVExportModel exportSetting) { this.refSetId = exportSetting.getRefSetId(); this.includeDescriptionId = exportSetting.includeDescriptionId(); this.includeRelationshipId = exportSetting.includeRelationshipTargetId(); this.includeInactiveMembers = exportSetting.includeInactiveMembers(); this.exportItems = exportSetting.getExportItems(); this.locales = exportSetting.getLocales(); this.delimiter = exportSetting.getDelimiter(); this.branchPath = BranchPathUtils.createPath(exportSetting.getBranchPath()); exportPath = exportSetting.getExportPath(); <START> lineSeparator = System.getProperty("line.separator"); <END> groupedRelationships = Maps.newTreeMap(); groupedOnlyItems = Lists.newArrayList(); }</code><technical_language>Extract this constant</technical_language>

Target:
public SnomedSimpleTypeRefSetDSVExporter(final SnomedRefSetDSVExportModel exportSetting) { this.refSetId = exportSetting.getRefSetId(); this.includeDescriptionId = exportSetting.includeDescriptionId(); this.includeRelationshipId = exportSetting.includeRelationshipTargetId(); this.includeInactiveMembers = exportSetting.includeInactiveMembers(); this.exportItems = exportSetting.getExportItems(); this.locales = exportSetting.getLocales(); this.delimiter = exportSetting.getDelimiter(); this.branchPath = BranchPathUtils.createPath(exportSetting.getBranchPath()); exportPath = exportSetting.getExportPath(); groupedRelationships = Maps.newTreeMap(); groupedOnlyItems = Lists.newArrayList(); }
Source:
<code>public ZkJobCoordinator(Config config, MetricsRegistry metricsRegistry) { this.config = config; ZkConfig zkConfig = new ZkConfig(config); <START> ZkKeyBuilder keyBuilder = new ZkKeyBuilder(new ApplicationConfig(config).getAppId()); <END> this.metrics = new ZkJobCoordinatorMetrics(metricsRegistry); this.zkUtils = new ZkUtils( keyBuilder, ZkCoordinationServiceFactory.createZkClient( zkConfig.getZkConnect(), zkConfig.getZkSessionTimeoutMs(), zkConfig.getZkConnectionTimeoutMs()), zkConfig.getZkConnectionTimeoutMs(), metrics); this.processorId = createProcessorId(config); LeaderElector leaderElector = new ZkLeaderElector(processorId, zkUtils); leaderElector.setLeaderElectorListener(new LeaderElectorListenerImpl()); this.zkController = new ZkControllerImpl(processorId, zkUtils, this, leaderElector); this.barrier = new ZkBarrierForVersionUpgrade( keyBuilder.getJobModelVersionBarrierPrefix(), zkUtils, new ZkBarrierListenerImpl()); this.debounceTimeMs = new JobConfig(config).getDebounceTimeMs(); this.reporters = MetricsReporterLoader.getMetricsReporters(new MetricsConfig(config), processorId); }</code><technical_language>Is change getGlobalAppId getAppId intentional? If not, please change a severe bug for zk based deployments (as 0.13.0 release testing fixed in SAMZA-1326: StreamProcessor ApplicationConfig.getGlobalAppId()). is obvious a "globalAppId" is. that. Please correct it</technical_language>

Target:
public ZkJobCoordinator(Config config, MetricsRegistry metricsRegistry) { this.config = config; ZkConfig zkConfig = new ZkConfig(config); ZkKeyBuilder keyBuilder = new ZkKeyBuilder(new ApplicationConfig(config).getGlobalAppId()); this.metrics = new ZkJobCoordinatorMetrics(metricsRegistry); this.zkUtils = new ZkUtils( keyBuilder, ZkCoordinationServiceFactory.createZkClient( zkConfig.getZkConnect(), zkConfig.getZkSessionTimeoutMs(), zkConfig.getZkConnectionTimeoutMs()), zkConfig.getZkConnectionTimeoutMs(), metrics); this.processorId = createProcessorId(config); LeaderElector leaderElector = new ZkLeaderElector(processorId, zkUtils); leaderElector.setLeaderElectorListener(new LeaderElectorListenerImpl()); this.zkController = new ZkControllerImpl(processorId, zkUtils, this, leaderElector); this.barrier = new ZkBarrierForVersionUpgrade( keyBuilder.getJobModelVersionBarrierPrefix(), zkUtils, new ZkBarrierListenerImpl()); this.debounceTimeMs = new JobConfig(config).getDebounceTimeMs(); this.reporters = MetricsReporterLoader.getMetricsReporters(new MetricsConfig(config), processorId); }
Source:
<code>private static Collection<OAuth2Error> validateRequiredClaims(Jwt idToken){ Collection<OAuth2Error> errors = new ArrayList<>(); URL issuer = idToken.getIssuer(); if (issuer == null) { errors.add(requiredClaimError(JwtClaimNames.ISS)); } <START> String subject = idToken.getSubject(); <END> if (subject == null) { errors.add(requiredClaimError(JwtClaimNames.SUB)); } List<String> audience = idToken.getAudience(); if (CollectionUtils.isEmpty(audience)) { errors.add(requiredClaimError(JwtClaimNames.AUD)); } Instant expiresAt = idToken.getExpiresAt(); if (expiresAt == null) { errors.add(requiredClaimError(JwtClaimNames.EXP)); } Instant issuedAt = idToken.getIssuedAt(); if (issuedAt == null) { errors.add(requiredClaimError(JwtClaimNames.IAT)); } return errors; }</code><technical_language>change method signature invalidIdToken(Map<String, Object> invalidClaims). This method return OAuth2Error a generic message lists invalidClaims in comma-delimited format</technical_language>

Target:
private static Map<String, Object> validateRequiredClaims(Jwt idToken){ Map<String, Object> requiredClaims = new HashMap<>(); URL issuer = idToken.getIssuer(); if (issuer == null) { requiredClaims.put(IdTokenClaimNames.ISS, issuer); } String subject = idToken.getSubject(); if (subject == null) { requiredClaims.put(IdTokenClaimNames.SUB, subject); } List<String> audience = idToken.getAudience(); if (CollectionUtils.isEmpty(audience)) { requiredClaims.put(IdTokenClaimNames.AUD, audience); } Instant expiresAt = idToken.getExpiresAt(); if (expiresAt == null) { requiredClaims.put(IdTokenClaimNames.EXP, expiresAt); } Instant issuedAt = idToken.getIssuedAt(); if (issuedAt == null) { requiredClaims.put(IdTokenClaimNames.IAT, issuedAt); } return requiredClaims; }
Source:
<code>public ListBoxModel doFillCredentialsIdItems(@AncestorInPath SCMSourceOwner owner, @QueryParameter String source) { <START> return new StandardListBoxModel() <END> .withEmptySelection() .withAll(availableCredentials(owner, source)); }</code><technical_language>reason for this change</technical_language>

Target:
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath SCMSourceOwner owner, @QueryParameter String source) { return new StandardUsernameListBoxModel() .withEmptySelection() .withAll(availableCredentials(owner, source)); }
Source:
<code>public void runWithEvent(Event event) { ISelection selection = selectionProvider.getSelection(); Collection<IFeatureModel> featureModels = FeatureSupport.toFeatureModels(selection); Collection<IPluginModelBase> pluginModels = PluginSupport.toPluginModels(selection); Collection<IProject> projects = new HashSet<>(); addUnderlyingResources(projects, featureModels); addUnderlyingResources(projects, pluginModels); String[] fileData = new String[projects.size()]; int i = 0; for (IProject project : projects) { fileData[i++] = project.getLocation().toOSString(); } <START> String textData = getTextData(featureModels, pluginModels); <END> Object[] data = { projects.toArray(new IResource[projects.size()]), textData, fileData }; Transfer[] dataTypes = { ResourceTransfer.getInstance(), TextTransfer.getInstance(), FileTransfer.getInstance() }; clipboard.setContents(data, dataTypes); }</code><technical_language>textData preserve selection order</technical_language>

Target:
public void runWithEvent(Event event) { IStructuredSelection selection = fStructuredViewer.getStructuredSelection(); List<IModel> models = toModels(selection); String textData = toTextData(models); IResource[] projectResources = toProjectResources(models); String[] fileData = toFileData(projectResources); Object[] data = { textData, projectResources, fileData }; Transfer[] dataTypes = { TextTransfer.getInstance(), ResourceTransfer.getInstance(), FileTransfer.getInstance() }; fClipboard.setContents(data, dataTypes); }
Source:
<code>public static PrimaryElectorType instance() { <START> return new PrimaryElectorType(); <END> }</code><technical_language>Sounds a singleton</technical_language>

Target:
public static PrimaryElectorType instance() { return TYPE; }
Source:
<code>public void testSyncTaskWithMultiplePartition() throws Exception { Map<Integer, List<KV>> inputPartitionData = new HashMap<>(); Map<Integer, List<Integer>> expectedOutputPartitionData = new HashMap<>(); genData(inputPartitionData, expectedOutputPartitionData); InMemorySystemDescriptor isd = new InMemorySystemDescriptor("test"); InMemoryInputDescriptor<KV> imid = isd .getInputDescriptor("input", new NoOpSerde<KV>()); InMemoryOutputDescriptor<Integer> imod = isd .getOutputDescriptor("output", new NoOpSerde<Integer>()); TestRunner <START> .of(new LegacyTaskApplication(MyStreamTestTask.class.getName())) <END> .addInputStream(imid, inputPartitionData) .addOutputStream(imod, 5) .run(Duration.ofSeconds(2)); StreamAssert.containsInOrder(expectedOutputPartitionData, imod, Duration.ofMillis(1000)); }</code><technical_language>FWIW, please a PR #642 , of changes incorporated in PR. Question here: specific reason want explicitly construct a LegacyTaskApplication here, instead of retaining API, internally convert MyStreamTestTask.class a LegacyTaskApplication instance in TestRunner</technical_language>

Target:
public void testSyncTaskWithMultiplePartition() throws Exception { Map<Integer, List<KV>> inputPartitionData = new HashMap<>(); Map<Integer, List<Integer>> expectedOutputPartitionData = new HashMap<>(); genData(inputPartitionData, expectedOutputPartitionData); InMemorySystemDescriptor isd = new InMemorySystemDescriptor("test"); InMemoryInputDescriptor<KV> imid = isd .getInputDescriptor("input", new NoOpSerde<KV>()); InMemoryOutputDescriptor<Integer> imod = isd .getOutputDescriptor("output", new NoOpSerde<Integer>()); TestRunner .of(MyStreamTestTask.class) .addInputStream(imid, inputPartitionData) .addOutputStream(imod, 5) .run(Duration.ofSeconds(2)); StreamAssert.containsInOrder(expectedOutputPartitionData, imod, Duration.ofMillis(1000)); }
Source:
<code>private void checkFraPvIsZero(FraCurveNode node, LocalDate valuationDate, RatesProvider ratesProvider) { Trade trade = node.buildTrade(valuationDate, ImmutableMap.of()); FraProduct product = ((FraTrade) trade).getProduct(); <START> CurrencyAmount currencyAmount = DiscountingFraProductPricer.DEFAULT.presentValue(product, ratesProvider); <END> double pv = currencyAmount.getAmount(); assertThat(pv).isCloseTo(0, offset(1e-6)); }</code><technical_language>DiscountingFraTradePricer instead of product pricer</technical_language>

Target:
private void checkFraPvIsZero(FraCurveNode node, LocalDate valuationDate, RatesProvider ratesProvider) { Trade trade = node.buildTrade(valuationDate, ImmutableMap.of()); CurrencyAmount currencyAmount = DiscountingFraTradePricer.DEFAULT.presentValue((FraTrade) trade, ratesProvider); double pv = currencyAmount.getAmount(); assertThat(pv).isCloseTo(0, offset(1e-6)); }
Source:
<code>public static Map<String, Object> parseCaddisflyResponseValue(String caddisflyValue) { <START> Map<String, Object> caddisflyResponseMap = new HashMap<String, Object>(); <END> try { caddisflyResponseMap = JSON_OBJECT_MAPPER.readValue(caddisflyValue, Map.class); } catch (IOException e) { log.error("Failed to parse the caddisfly response"); } if (caddisflyResponseMap != null) { return caddisflyResponseMap; } else { return Collections.emptyMap(); } }</code><technical_language>new HashMap<>(), explicit type is longer necessary</technical_language>

Target:
public static Map<String, Object> parseCaddisflyResponseValue(String caddisflyValue) { Map<String, Object> caddisflyResponseMap = new HashMap<>(); try { caddisflyResponseMap = JSON_OBJECT_MAPPER.readValue(caddisflyValue, Map.class); } catch (IOException e) { log.error("Failed to parse the caddisfly response"); } if (caddisflyResponseMap != null) { return caddisflyResponseMap; } else { return Collections.emptyMap(); } }
Source:
<code>public void modified(Map<String, Object> properties) { MagicServiceConfig config = new Configuration(properties).as(MagicServiceConfig.class); <START> List<Field> l = ConfigUtil.getAllFields(MagicServiceConfig.class); <END> l.forEach(field -> { try { Object value = field.get(config); if (value != null) { logger.debug("MagicService config = {}", field.getName(), value); } } catch (IllegalArgumentException | IllegalAccessException ignored) { } }); }</code><technical_language>instead of exposing reflection based method getAllFields give a toString MagicServiceConfig</technical_language>

Target:
public void modified(Map<String, Object> properties) { MagicServiceConfig config = new Configuration(properties).as(MagicServiceConfig.class); logger.debug(config.toString()); }
Source:
<code>protected void firstListenerAdded() { <START> if (!isDisposed()) { if (listener == null) { <END> listener = property .adaptListener(new ISimplePropertyListener<ValueDiff<T>>() { @Override public void handleEvent( final SimplePropertyEvent<ValueDiff<T>> event) { if (!isDisposed() && !updating) { getRealm().exec(new Runnable() { @Override public void run() { if (event.type == SimplePropertyEvent.CHANGE) { notifyIfChanged(event.diff); } else if (event.type == SimplePropertyEvent.STALE && !stale) { stale = true; fireStale(); } } }); } } }); } getRealm().exec(new Runnable() { @Override public void run() { cachedValue = property.getValue(source); stale = false; if (listener != null) listener.addTo(source); } }); } }</code><technical_language>combine conditions of 'if' statements</technical_language>

Target:
protected void firstListenerAdded() { if (!isDisposed() && listener == null) { listener = property.adaptListener(new ISimplePropertyListener<ValueDiff<T>>() { @Override public void handleEvent(final SimplePropertyEvent<ValueDiff<T>> event) { if (!isDisposed() && !updating) { getRealm().exec(new Runnable() { @Override public void run() { if (event.type == SimplePropertyEvent.CHANGE) { notifyIfChanged(event.diff); } else if (event.type == SimplePropertyEvent.STALE && !stale) { stale = true; fireStale(); } } }); } } }); } getRealm().exec(new Runnable() { @Override public void run() { cachedValue = property.getValue(source); stale = false; if (listener != null) listener.addTo(source); } }); }
Source:
<code>public static String getGeneralMaterialName(String fullName) { fullName = fullName.toUpperCase(); if (fullName.startsWith("STRIPPED")) { return fullName.replaceFirst("_[^_]+", ""); <START> } else { <END> return fullName.replaceFirst(".+?_", ""); } }</code><technical_language>Remove else statement here. unnecessarily</technical_language>

Target:
public static String getGeneralMaterialName(String fullName) { String newName = fullName.toUpperCase(); if (newName.startsWith("STRIPPED")) { return newName.replaceFirst("_[^_]+", ""); } else if (newName.matches("^(DARK|LIGHT).+")) { return newName.replaceFirst(".+?_.+?_", ""); } else if (newName.matches( "^(WHITE|ORANGE|MAGENTA|YELLOW|LIME|PINK|GRAY|CYAN|PURPLE|BLUE|BROWN|GREEN|RED|BLACK|" + "OAK|SPRUCE|BIRCH|JUNGLE|ACACIA).+")) { return newName.replaceFirst(".+?_", ""); } return fullName; }
Source:
<code>public static int getInternalInboundHttpPort() { File synapseProperties = Paths.get(CarbonUtils.getCarbonConfigDirPath(), "synapse.properties").toFile(); Properties properties = new Properties(); try (InputStream inputStream = new FileInputStream(synapseProperties)) { properties.load(inputStream); } catch (FileNotFoundException e) { handleException("synapse.properties file not found", e); } catch (IOException e) { handleException("Error while reading synapse.properties file", e); } String internalInboundEnabledProperty = properties.getProperty(Constants.INTERNAL_HTTP_API_ENABLED); if (internalInboundEnabledProperty == null) { return -1; } boolean internalInboundEnabled = Boolean.parseBoolean(internalInboundEnabledProperty); if (!internalInboundEnabled) { return -1; } int internalInboundHttpPort = Constants.DEFAULT_INTERNAL_HTTP_API_PORT; String internalInboundPortProperty = properties.getProperty(Constants.INTERNAL_HTTP_API_PORT); if (internalInboundPortProperty != null) { try { internalInboundHttpPort = Integer.parseInt(internalInboundPortProperty); <START> } catch (Exception ex) { <END> handleException(Constants.INTERNAL_HTTP_API_PORT + " is not in proper format", ex); } } internalInboundHttpsPort = Constants.DEFAULT_INTERNAL_HTTPS_API_PORT; String internalInboundHttpsProperty = properties.getProperty(Constants.INTERNAL_HTTPS_API_PORT); if (internalInboundPortProperty != null) { try { internalInboundHttpsPort = Integer.parseInt(internalInboundHttpsProperty); } catch (Exception ex) { handleException(Constants.INTERNAL_HTTPS_API_PORT + " is not in proper format", ex); } } return internalInboundHttpPort; }</code><technical_language>Catch generic exception</technical_language>

Target:
public static int getInternalInboundHttpPort() { return getPort(Constants.INTERNAL_HTTP_API_PORT, internalInboundHttpPortProperty, Constants.DEFAULT_INTERNAL_HTTP_API_PORT); }
Source:
<code>public T read() throws Exception, UnexpectedInputException, ParseException, NonTransientResourceException { <START> while (bufferIterator == null || !bufferIterator.hasNext()) { <END> Collection<? extends T> buffer = windedReader.read(); if (buffer == null) { return null; } this.bufferIterator = buffer.iterator(); } return bufferIterator.next(); }</code><technical_language>"while" "if"</technical_language>

Target:
public T read() throws Exception, UnexpectedInputException, ParseException, NonTransientResourceException { while (bufferIterator == null || !bufferIterator.hasNext()) { Collection<? extends T> buffer = reader.read(); if (buffer == null) { return null; } this.bufferIterator = buffer.iterator(); } return bufferIterator.next(); }
Source:
<code>private void prepareForSending() { try { if (partitionId != null) { attemptedPartitionIds.add(partitionId); } partitionId = getPartitionForPut(attemptedPartitionIds); chunkBlobId = new BlobId(partitionId); <START> operationTracker = new SimpleOperationTracker(routerConfig.routerDatacenterName, partitionId, false, <END> routerConfig.routerPutSuccessTarget, routerConfig.routerPutRequestParallelism); correlationIdToChunkPutRequest.clear(); state = ChunkState.Ready; } catch (RouterException e) { setOperationException(e); } }</code><technical_language>Unrelated this pathc - @xiahome I discussing SimpleOperationTracker throw IllegalArgumentException if numReplicas < successTarget</technical_language>

Target:
private void prepareForSending() { try { if (partitionId != null) { attemptedPartitionIds.add(partitionId); } partitionId = getPartitionForPut(attemptedPartitionIds); chunkBlobId = new BlobId(partitionId); operationTracker = new SimpleOperationTracker(routerConfig.routerDatacenterName, partitionId, false, routerConfig.routerPutSuccessTarget, routerConfig.routerPutRequestParallelism); correlationIdToChunkPutRequestInfo.clear(); state = ChunkState.Ready; } catch (RouterException e) { setOperationException(e); } }
Source:
<code>protected void runInternal() { boolean exist = recordStore.existInMemory(dataKey); recordStore.removeBackupTx(dataKey, getCallerProvenance(), transactionId); recordStore.forceUnlock(dataKey); if (!exist) { <START> wbqCapacityCounter().decrement(transactionId, getPartitionId()); <END> } }</code><technical_language>do decrement if exist</technical_language>

Target:
protected void runInternal() { boolean exist = recordStore.existInMemory(dataKey); recordStore.removeBackupTxn(dataKey, getCallerProvenance(), transactionId); recordStore.forceUnlock(dataKey); if (!exist) { wbqCapacityCounter().decrement(transactionId); } }
Source:
<code>public Command findCommand(String name, ClassLoader cl) { synchronized (commandCache) { if (!commandCache.containsKey(name)) { try { Command commandInstance = (Command) Class.forName(name, true, cl).newInstance(); commandCache.put(name, commandInstance); } catch (Exception ex) { <START> throw new IllegalArgumentException("Unknown Command implementation with name '" + name + "': " + ex.getMessage()); <END> } } else { Command cmd = commandCache.get(name); if (!cmd.getClass().getClassLoader().equals(cl)) { commandCache.remove(name); try { Command commandInstance = (Command) Class.forName(name, true, cl).newInstance(); commandCache.put(name, commandInstance); } catch (Exception ex) { throw new IllegalArgumentException("Unknown Command implementation with name '" + name + "': " + ex.getMessage()); } } } } return commandCache.get(name); }</code><technical_language>add of IllegalArgumentException</technical_language>

Target:
public Command findCommand(String name, ClassLoader cl) { synchronized (commandCache) { if (!commandCache.containsKey(name)) { try { Command commandInstance = (Command) Class.forName(name, true, cl).newInstance(); commandCache.put(name, commandInstance); } catch (Exception ex) { throw new IllegalArgumentException("Unknown Command implementation with name '" + name + "': " + ex.getMessage(), ex); } } else { Command cmd = commandCache.get(name); if (!cmd.getClass().getClassLoader().equals(cl)) { commandCache.remove(name); try { Command commandInstance = (Command) Class.forName(name, true, cl).newInstance(); commandCache.put(name, commandInstance); } catch (Exception ex) { throw new IllegalArgumentException("Unknown Command implementation with name '" + name + "': " + ex.getMessage(), ex); } } } } return commandCache.get(name); }
Source:
<code>public void setup() throws ParseException { context = new Context(); <START> context.turnOffAuthorisationSystem(); <END> if (commandLine.hasOption('h')) { help = true; return; } if (!commandLine.hasOption('f')) { throw new ParseException("Required parameter -f missing!"); } filename = commandLine.getOptionValue('f'); exportAllMetadata = commandLine.hasOption('a'); if (commandLine.hasOption('i')) { exportAllItems = true; } handle = commandLine.getOptionValue('i'); try { context.setCurrentUser(ePersonService.find(context, getEpersonIdentifier())); } catch (SQLException e) { handler.handleException(e); } }</code><technical_language>turning Authorisation in this Context for a *long time* (which unintended consequences). turned in setup, restored internalRun() finishes up. means context is checking authorizations entire time. practice is turnOffAuthorisationSystem() restoreAuthSystemState() small blocks of code. leave authorization turned methods</technical_language>

Target:
public void setup() throws ParseException { if (commandLine.hasOption('h')) { help = true; return; } if (!commandLine.hasOption('f')) { throw new ParseException("Required parameter -f missing!"); } filename = commandLine.getOptionValue('f'); exportAllMetadata = commandLine.hasOption('a'); if (!commandLine.hasOption('i')) { exportAllItems = true; } handle = commandLine.getOptionValue('i'); }
Source:
<code>public CreateBranchWizard(Repository repository, String base) { try (RevWalk rw = new RevWalk(repository)) { if (base == null) { myPage = new CreateBranchPage(repository, (Ref) null); } else if (ObjectId.isId(base)) { RevCommit commit = rw.parseCommit(ObjectId .fromString(base)); myPage = new CreateBranchPage(repository, commit); } else { if (base.startsWith(Constants.R_HEADS) || base.startsWith(Constants.R_REMOTES) || base.startsWith(Constants.R_TAGS)) { Ref currentBranch = repository.exactRef(base); myPage = new CreateBranchPage(repository, currentBranch); } else { RevCommit commit = rw.parseCommit( repository.resolve(base + "^{commit}")); myPage = new CreateBranchPage(repository, commit); } } } catch (IOException e) { myPage = new CreateBranchPage(repository, (Ref) null); } <START> if (newBranchName != null) <END> myPage.setBranchName(newBranchName); setWindowTitle(UIText.CreateBranchWizard_NewBranchTitle); }</code><technical_language>Missing braces</technical_language>

Target:
public CreateBranchWizard(Repository repository, String base) { try (RevWalk rw = new RevWalk(repository)) { if (base == null) { myPage = new CreateBranchPage(repository, (Ref) null); } else if (ObjectId.isId(base)) { RevCommit commit = rw.parseCommit(ObjectId .fromString(base)); myPage = new CreateBranchPage(repository, commit); } else { if (base.startsWith(Constants.R_HEADS) || base.startsWith(Constants.R_REMOTES) || base.startsWith(Constants.R_TAGS)) { Ref currentBranch = repository.exactRef(base); myPage = new CreateBranchPage(repository, currentBranch); } else { RevCommit commit = rw.parseCommit( repository.resolve(base + "^{commit}")); myPage = new CreateBranchPage(repository, commit); } } } catch (IOException e) { myPage = new CreateBranchPage(repository, (Ref) null); } if (newBranchName != null) { myPage.setBranchName(newBranchName); } setWindowTitle(UIText.CreateBranchWizard_NewBranchTitle); }
Source:
<code>public long takeSnapshot() throws IOException { LOG.info("Saving Ratis snapshot on the OM."); <START> return ozoneManager.saveRatisSnapshot(); <END> }</code><technical_language>Question: consider this applied snapshot is consider is completed? writing rocksdb means is is written disk(As writing sync false), a snapshot, flush DB applied index transaction is applied OM DB</technical_language>

Target:
public long takeSnapshot() throws IOException { LOG.info("Saving Ratis snapshot on the OM."); if (ozoneManager != null) { return ozoneManager.saveRatisSnapshot(); } return 0; }
Source:
<code>public void testSetProperties() throws Exception { DocumentModel model = session.getDocument(new PathRef("/default-domain/workspaces/test")); String nxql = String.format("SELECT * from ComplexDoc where ecm:parentId='%s'", model.getId()); String title = "test title"; String description = "test description"; String foo = "test foo"; String bar = "test bar"; HashMap<String, Serializable> complex = new HashMap<>(); complex.put("foo", foo); complex.put("bar", bar); String commandId = service.submit(new BulkCommand().withRepository(session.getRepositoryName()) .withUsername(session.getPrincipal().getName()) .withQuery(nxql) .withAction(ACTION_NAME) .withParam("dc:title", title) .withParam("dc:description", description) .withParam("cpx:complex", complex)); assertTrue("Bulk action didn't finish", service.await(Duration.ofSeconds(10))); BulkStatus status = service.getStatus(commandId); assertNotNull(status); assertEquals(COMPLETED, status.getState()); <START> assertEquals(SIZE * 2, status.getProcessed()); <END> txFeature.nextTransaction(); for (DocumentModel child : session.query(nxql)) { assertEquals(title, child.getTitle()); assertEquals(description, child.getPropertyValue("dc:description")); assertEquals(foo, child.getPropertyValue("cpx:complex/foo")); assertEquals(bar, child.getPropertyValue("cpx:complex/bar")); } }</code><technical_language>of other static variables hard understand want SIZE * 2 if aware of code</technical_language>

Target:
public void testSetProperties() throws Exception { DocumentModel model = session.getDocument(new PathRef("/default-domain/workspaces/test")); String nxql = String.format("SELECT * from ComplexDoc where ecm:parentId='%s'", model.getId()); String title = "test title"; String description = "test description"; String foo = "test foo"; String bar = "test bar"; HashMap<String, Serializable> complex = new HashMap<>(); complex.put("foo", foo); complex.put("bar", bar); String commandId = service.submit(new BulkCommand().withRepository(session.getRepositoryName()) .withUsername(session.getPrincipal().getName()) .withQuery(nxql) .withAction(ACTION_NAME) .withParam("dc:title", title) .withParam("dc:description", description) .withParam("cpx:complex", complex)); assertTrue("Bulk action didn't finish", service.await(Duration.ofSeconds(10))); BulkStatus status = service.getStatus(commandId); assertNotNull(status); assertEquals(COMPLETED, status.getState()); assertEquals(DOC_BY_LEVEL, status.getProcessed()); txFeature.nextTransaction(); for (DocumentModel child : session.query(nxql)) { assertEquals(title, child.getTitle()); assertEquals(description, child.getPropertyValue("dc:description")); assertEquals(foo, child.getPropertyValue("cpx:complex/foo")); assertEquals(bar, child.getPropertyValue("cpx:complex/bar")); } }
Source:
<code>private ClosableObservable<EditableConfiguration> edit(ClosableObservable<Configuration> config) { <START> ObservableEditableConfiguration editableConfig = new ObservableEditableConfiguration( <END> config, configServer); return editableConfig; }</code><technical_language>re-add registerForClose extend closer</technical_language>

Target:
private ObservableEditableConfiguration edit(ClosableObservable<Configuration> config) { return registerForClose(new ObservableEditableConfiguration(config,configServer)); }
Source:
<code>public String generateCommonJar() throws IOException { <START> File file = new File("/tmp/schemaSQL.jar"); <END> if (file.exists()) { file.delete(); } FileSystem fs = FileSystem.newInstance(file.toURI(), new Configuration()); FSDataOutputStream out = fs.create(new Path(file.getAbsolutePath())); JarOutputStream jout = new JarOutputStream(out); for (Schema schema : schemas.values()) { jout.putNextEntry(new ZipEntry(schema.fqcn.replace(".", "/") + ".class")); jout.write(schema.beanClassBytes); jout.closeEntry(); } jout.close(); out.close(); return file.getAbsolutePath(); }</code><technical_language>This is re-entrant</technical_language>

Target:
public String generateCommonJar() throws IOException { File file = File.createTempFile("schemaSQL", ".jar"); FileSystem fs = FileSystem.newInstance(file.toURI(), new Configuration()); FSDataOutputStream out = fs.create(new Path(file.getAbsolutePath())); JarOutputStream jout = new JarOutputStream(out); for (Schema schema : schemas.values()) { jout.putNextEntry(new ZipEntry(schema.fqcn.replace(".", "/") + ".class")); jout.write(schema.beanClassBytes); jout.closeEntry(); } jout.close(); out.close(); return file.getAbsolutePath(); }