auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
Repository getRepository(URL url) throws NotFoundException; Patch getPatch(URL url) throws NotFoundException; List<Patch> getPatchesAssociatedWith(Issue issue) throws NotFoundException; List<Patch> getPatchesByStatus(Repository repository, PatchStatus status) throws NotFoundException; List<Label> getLabelsfromRepository(Patch patch) throws NotFoundException; List<Label> getLabelsfromPatch(Patch patch) throws NotFoundException; void addLabelstoPatch(Patch patch, List<Label> labels) throws NotFoundException; void removeLabel(Patch patch, String name) throws NotFoundException; void addCommentToPatch(Patch patch, String comment) throws NotFoundException; void addLabelToPatch(Patch patch, String labelName) throws NotFoundException; List<Patch> findPatchesRelatedTo(Patch patch) throws NotFoundException; default void destroy() { }

Target:
Repository getRepository(URL url) throws NotFoundException; Patch getPatch(URL url) throws NotFoundException; List<Patch> getPatchesAssociatedWith(Issue issue) throws NotFoundException; List<Patch> getPatchesByStatus(Repository repository, PatchStatus status) throws NotFoundException; List<Label> getLabelsFromRepository(Repository repository) throws NotFoundException; List<Label> getLabelsFromPatch(Patch patch) throws NotFoundException; void setLabelsToPatch(Patch patch, List<Label> labels) throws NotFoundException, AphroditeException ; void removeLabelFromPatch(Patch patch, String name) throws NotFoundException; void addCommentToPatch(Patch patch, String comment) throws NotFoundException; void addLabelToPatch(Patch patch, String labelName) throws NotFoundException; List<Patch> findPatchesRelatedTo(Patch patch) throws NotFoundException; default void destroy() { }
Source:
public LdapProviderType autoDetectLdapProviderType(String domain) throws NamingException { log.infoFormat("Trying to auto-detect the LDAP provider type for domain {0}", domain); LdapProviderType retVal = LdapProviderType.general; Attributes attributes = getDomainAttributes(LdapProviderType.general, domain); if (attributes != null) { if (attributes.get(ADRootDSEAttributes.domainControllerFunctionality.name()) != null) { retVal = LdapProviderType.activeDirectory; } else if (attributes.get(RHDSRootDSEAttributes.vendorName.name()) != null) { String vendorName = (String) attributes.get(RHDSRootDSEAttributes.vendorName.name()).get(0); if (vendorName.equals(LdapVendorNameEnum.IPAVendorName.getName())) { retVal = LdapProviderType.ipa; } else if (vendorName.equals(LdapVendorNameEnum.RHDSVendorName.getName())) { retVal = LdapProviderType.rhds; } else if (vendorName.equals(LdapVendorNameEnum.IBMVendorName.getName())) { retVal = LdapProviderType.ibm; } } } log.infoFormat("Provider type is {0}", retVal.name()); updateProviderTypeInConfig(domain, retVal.name()); return retVal; }

Target:
public LdapProviderType autoDetectLdapProviderType(String domain) throws NamingException { log.infoFormat("Trying to auto-detect the LDAP provider type for domain {0}", domain); LdapProviderType retVal = LdapProviderType.general; Attributes attributes = getDomainAttributes(LdapProviderType.general, domain); if (attributes != null) { if (attributes.get(ADRootDSEAttributes.domainControllerFunctionality.name()) != null) { retVal = LdapProviderType.activeDirectory; } else if (attributes.get(RHDSRootDSEAttributes.vendorName.name()) != null) { String vendorName = (String) attributes.get(RHDSRootDSEAttributes.vendorName.name()).get(0); if (vendorName.equals(LdapVendorNameEnum.IPAVendorName.getName())) { retVal = LdapProviderType.ipa; } else if (vendorName.equals(LdapVendorNameEnum.RHDSVendorName.getName())) { retVal = LdapProviderType.rhds; } else if (vendorName.equals(LdapVendorNameEnum.ITDSVendorName.getName())) { retVal = LdapProviderType.itds; } } } log.infoFormat("Provider type is {0}", retVal.name()); updateProviderTypeInConfig(domain, retVal.name()); return retVal; }
Source:
public ActualMeterReadsGas(final Date logTime, final long consumption, final Date captureTime, final ScalerUnit scalerUnit) { super(logTime, consumption, captureTime); this.scalerUnit = scalerUnit; }

Target:
public ActualMeterReadsGas(final Date logTime, final long consumption, final Date captureTime, final ScalerUnit scalerUnit) { super(logTime, consumption, captureTime); this.scalerUnit = new ScalerUnit(scalerUnit.getDlmsUnit(), scalerUnit.getScaler()); }
Source:
private Class<?> resolveClassFromName(String className) { try { ClassLoader classLoader = getApplicationContext() == null ? getClass().getClassLoader() : getApplicationContext().getClassLoader(); return ClassUtils.forName(className, classLoader); } catch (ClassNotFoundException e) { throw new IllegalStateException("Cannot load class for channel mapping.", e); } }

Target:
private Class<?> resolveClassFromName(String className) { try { Assert.state(getApplicationContext() != null, "An ApplicationContext is required"); return ClassUtils.forName(className, getApplicationContext().getClassLoader()); } catch (ClassNotFoundException e) { throw new IllegalStateException("Cannot load class for channel mapping.", e); } }
Source:
private void updateStoragePoolFormatType() { storage_pool storagePool = getStoragePool(); Guid spId = storagePool.getId(); VDSBrokerFrontend resourceManager = Backend.getInstance() .getResourceManager(); Version spVersion = storagePool.getcompatibility_version(); Version oldSpVersion = _oldStoragePool.getcompatibility_version(); if (Version.OpEquality(spVersion, oldSpVersion)) { return; } StorageType spType = storagePool.getstorage_pool_type(); if (spType != StorageType.ISCSI && spType != StorageType.FCP) { return; } StorageFormatType targetFormat = StorageFormatType.V1; Version v2FormatChangeBar = new Version("3.0"); if (spVersion.compareTo(v2FormatChangeBar) >= 0) { targetFormat = StorageFormatType.V2; } storagePool.setStoragePoolFormatType(targetFormat); getStoragePoolDAO().update(storagePool); updateMemberDomainsFormat(targetFormat); if (storagePool.getstatus() != StoragePoolStatus.Up) { return; } UpgradeStoragePoolVDSCommandParameters parameters = new UpgradeStoragePoolVDSCommandParameters(spId, targetFormat); resourceManager.RunVdsCommand( VDSCommandType.UpgradeStoragePool, parameters); }

Target:
private void updateStoragePoolFormatType() { storage_pool storagePool = getStoragePool(); Guid spId = storagePool.getId(); VDSBrokerFrontend resourceManager = Backend.getInstance() .getResourceManager(); Version spVersion = storagePool.getcompatibility_version(); Version oldSpVersion = _oldStoragePool.getcompatibility_version(); if (Version.OpEquality(spVersion, oldSpVersion)) { return; } StorageType spType = storagePool.getstorage_pool_type(); if (spType != StorageType.ISCSI && spType != StorageType.FCP) { return; } StorageFormatType targetFormat = StorageFormatType.V1; Version v2FormatChangeBar = new Version("3.0"); Version v3FormatChangeBar = new Version("3.1"); if (spVersion.compareTo(v3FormatChangeBar) >= 0) { targetFormat = StorageFormatType.V3; } else if (spVersion.compareTo(v2FormatChangeBar) >= 0) { targetFormat = StorageFormatType.V2; } storagePool.setStoragePoolFormatType(targetFormat); getStoragePoolDAO().update(storagePool); updateMemberDomainsFormat(targetFormat); if (storagePool.getstatus() != StoragePoolStatus.Up) { return; } UpgradeStoragePoolVDSCommandParameters parameters = new UpgradeStoragePoolVDSCommandParameters(spId, targetFormat); resourceManager.RunVdsCommand( VDSCommandType.UpgradeStoragePool, parameters); }
Source:
public void validateAddingNonExistingNetwork() { List<VdsNetworkInterface> vdsNics = new ArrayList<VdsNetworkInterface>(); VdsNetworkInterface nic1 = new VdsNetworkInterface(); nic1.setNetworkName("vmnet"); nic1.setName("nic1"); vdsNics.add(nic1); VdsNetworkInterface nic2 = new VdsNetworkInterface(); nic2.setNetworkName("mgmtnet"); nic2.setName("nic2"); vdsNics.add(nic2); List<network> clusterNetworks = new ArrayList<network>(); network net1 = new network(); net1.setname("vmnet"); network net2 = new network(); net2.setname("mgmtnet"); clusterNetworks.add(net1); clusterNetworks.add(net2); List<VdsNetworkInterface> nics = new ArrayList<VdsNetworkInterface>(); VdsNetworkInterface nicWithUknownNetowrk = new VdsNetworkInterface(); nicWithUknownNetowrk.setNetworkName("nonExisitigNetworkName"); nicWithUknownNetowrk.setName("nic3"); nics.add(nicWithUknownNetowrk); initMocks(vdsNics, clusterNetworks); SetupNetworksParameters params = new SetupNetworksParameters(); params.setInterfaces(nics); SetupNetworksHelper validator = createHelper(params); assertTrue(validator.validate().contains(NETWORK_NOT_EXISTS_IN_CURRENT_CLUSTER)); }

Target:
public void validateAddingNonExistingNetwork() { List<VdsNetworkInterface> vdsNics = new ArrayList<VdsNetworkInterface>(); VdsNetworkInterface nic1 = new VdsNetworkInterface(); nic1.setNetworkName("vmnet"); nic1.setName("nic1"); vdsNics.add(nic1); VdsNetworkInterface nic2 = new VdsNetworkInterface(); nic2.setNetworkName("mgmtnet"); nic2.setName("nic2"); vdsNics.add(nic2); List<network> clusterNetworks = new ArrayList<network>(); network net1 = new network(); net1.setname("vmnet"); network net2 = new network(); net2.setname("mgmtnet"); clusterNetworks.add(net1); clusterNetworks.add(net2); List<VdsNetworkInterface> nics = new ArrayList<VdsNetworkInterface>(); VdsNetworkInterface nicWithUnknownNetwork = new VdsNetworkInterface(); nicWithUnknownNetwork.setNetworkName("nonExisitigNetworkName"); nicWithUnknownNetwork.setName("nic3"); nics.add(nicWithUnknownNetwork); initMocks(vdsNics, clusterNetworks); SetupNetworksParameters params = new SetupNetworksParameters(); params.setInterfaces(nics); SetupNetworksHelper validator = createHelper(params); assertTrue(validator.validate().contains(NETWORK_NOT_EXISTS_IN_CURRENT_CLUSTER)); }
Source:
public static GameMode build(@Nullable final String mode, @Nullable final Locale locale) { try { return MAPS_CACHE.get(localeFromNullable(locale)).nameToMode(mode); } catch (ExecutionException e) { throw new RuntimeException(e); } }

Target:
public static GameMode build(@Nullable final String mode, @Nullable final Locale locale) { try { Locale targetLocale = localeFromNullable(locale); GameMode out = MAPS_CACHE.get(targetLocale).nameToMode(mode); if (out == null && !ALSO_ACCEPT_LOCALE.equals(targetLocale)) { out = MAPS_CACHE.get(ALSO_ACCEPT_LOCALE).nameToMode(mode); } return out; } catch (ExecutionException e) { throw new RuntimeException(e); } }
Source:
public static String getMetricName(String metricName, Map<String, String> tags) { Preconditions.checkState(tags.size() < MAX_ALLOWED_TAGS, "Too many tags set on the metric %s. " + "Maximum allowed number of tags is %d, found %s", metricName, MAX_ALLOWED_TAGS, tags.size()); return tags.entrySet().stream() .map(e -> e.getKey() + EQUALS + e.getValue()) .collect(Collectors.joining(DELIMITER, metricName + DELIMITER, "")); }

Target:
public static String getMetricName(String metricName, Map<String, String> tags) { Preconditions.checkArgument(tags.size() <= MAX_ALLOWED_TAGS, "Too many tags set on the metric %s. " + "Maximum allowed number of tags is %s, found %s.", metricName, MAX_ALLOWED_TAGS, tags.size()); validateMetricComponentName(metricName, "metric"); validateMetricTagNames(tags); return tags.entrySet().stream() .map(e -> e.getKey() + EQUALS + e.getValue()) .collect(Collectors.joining(DELIMITER, metricName + DELIMITER, "")); }
Source:
private void requestKeyTransfer(Set<Integer> segments) { boolean isTransferingKeys = false; synchronized (transferMapsLock) { List<Address> members = new ArrayList<>(cacheTopology.getActualMembers()); Collections.shuffle(members); for (Address source : members) { if (rpcManager.getAddress().equals(source)) { continue; } isTransferingKeys = true; InboundTransferTask inboundTransfer = new InboundTransferTask(segments, source, cacheTopology.getTopologyId(), rpcManager, commandsFactory, configuration.clustering().stateTransfer().timeout(), cacheName); addTransfer(inboundTransfer, segments); stateRequestExecutor.executeAsync(() -> { log.tracef("Requesting keys for segments %s from %s", inboundTransfer.getSegments(), inboundTransfer.getSource()); return inboundTransfer.requestKeys().whenComplete((nil, e) -> onTaskCompletion(inboundTransfer)); }); } } if (!isTransferingKeys) { log.trace("No keys in transfer, finishing segments " + segments); for (int segment : segments) { svm.notifyKeyTransferFinished(segment, false); } notifyEndOfStateTransferIfNeeded(cacheTopology.getTopologyId(), cacheTopology.getRebalanceId()); } }

Target:
private void requestKeyTransfer(Set<Integer> segments) { boolean isTransferringKeys = false; synchronized (transferMapsLock) { List<Address> members = new ArrayList<>(cacheTopology.getActualMembers()); Collections.shuffle(members); for (Address source : members) { if (rpcManager.getAddress().equals(source)) { continue; } isTransferringKeys = true; InboundTransferTask inboundTransfer = new InboundTransferTask(segments, source, cacheTopology.getTopologyId(), rpcManager, commandsFactory, configuration.clustering().stateTransfer().timeout(), cacheName, true); addTransfer(inboundTransfer, segments); stateRequestExecutor.executeAsync(() -> { log.tracef("Requesting keys for segments %s from %s", inboundTransfer.getSegments(), inboundTransfer.getSource()); return inboundTransfer.requestKeys().whenComplete((nil, e) -> onTaskCompletion(inboundTransfer)); }); } } if (!isTransferringKeys) { log.trace("No keys in transfer, finishing segments " + segments); for (int segment : segments) { svm.notifyKeyTransferFinished(segment, false); } notifyEndOfStateTransferIfNeeded(cacheTopology.getTopologyId(), cacheTopology.getRebalanceId()); } }
Source:
public void setUp() throws Exception { MockitoAnnotations.initMocks(this); instance = new ReplayService(new ClientProperties(), preferencesService, replayFileReader, notificationService, gameService, taskService, i18n, reportingService, applicationContext, platformService, fafService, modService, mapService, eventBus, executorService); when(preferencesService.getReplaysDirectory()).thenReturn(replayDirectory.getRoot().toPath()); when(preferencesService.getCorruptedReplaysDirectory()).thenReturn(replayDirectory.getRoot().toPath().resolve("corrupt")); when(preferencesService.getCacheDirectory()).thenReturn(cacheDirectory.getRoot().toPath()); doAnswer(invocation -> invocation.getArgument(0)).when(taskService).submitTask(any()); }

Target:
public void setUp() throws Exception { MockitoAnnotations.initMocks(this); instance = new ReplayService(new ClientProperties(), preferencesService, replayFileReader, notificationService, gameService, taskService, i18n, reportingService, applicationContext, platformService, fafService, modService, mapService, publisher, executorService); when(preferencesService.getReplaysDirectory()).thenReturn(replayDirectory.getRoot().toPath()); when(preferencesService.getCorruptedReplaysDirectory()).thenReturn(replayDirectory.getRoot().toPath().resolve("corrupt")); when(preferencesService.getCacheDirectory()).thenReturn(cacheDirectory.getRoot().toPath()); doAnswer(invocation -> invocation.getArgument(0)).when(taskService).submitTask(any()); }
Source:
public void execute(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap metaDataMap) throws WorkflowException { ResourceResolver resourceResolver = null; try { resourceResolver = workflowHelper.getResourceResolver(workflowSession); final String originalPayload = (String) workItem.getWorkflowData().getPayload(); final List<String> payloads = workflowPackageManager.getPaths(resourceResolver, originalPayload); final ProcessArgs processArgs = new ProcessArgs(metaDataMap); final AtomicInteger count = new AtomicInteger(0); final ResourceRunnable replicatorRunnable = new ResourceRunnable() { @Override public void run(final Resource resource) throws Exception { throttledTaskRunner.waitForLowCpuAndLowMemory(); replicator.replicate(resource.getResourceResolver().adaptTo(Session.class), processArgs.getReplicationActionType(), resource.getPath(), processArgs.getReplicationOptions()); } }; final ContentVisitor visitor = new ContentVisitor(replicatorRunnable); for (final String payload : payloads) { final Resource resource = resourceResolver.getResource(payload); if (processArgs.isTraverseTree()) { visitor.accept(resource); } else { replicatorRunnable.run(resource); } } log.info("Synthetic Workflow Wrapper processed [ ] total payloads", count.get()); } catch (Exception e) { throw new WorkflowException(e); } }

Target:
public void execute(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap metaDataMap) throws WorkflowException { ResourceResolver resourceResolver = null; try { resourceResolver = workflowHelper.getResourceResolver(workflowSession); final String originalPayload = (String) workItem.getWorkflowData().getPayload(); final List<String> payloads = workflowPackageManager.getPaths(resourceResolver, originalPayload); final ProcessArgs processArgs = new ProcessArgs(metaDataMap); final AtomicInteger count = new AtomicInteger(0); final ResourceRunnable replicatorRunnable = new ResourceRunnable() { @Override public void run(final Resource resource) throws Exception { if (processArgs.isThrottle()) { throttledTaskRunner.waitForLowCpuAndLowMemory(); } replicator.replicate(resource.getResourceResolver().adaptTo(Session.class), processArgs.getReplicationActionType(), resource.getPath(), processArgs.getReplicationOptions()); count.incrementAndGet(); } }; final ContentVisitor visitor = new ContentVisitor(replicatorRunnable); for (final String payload : payloads) { final Resource resource = resourceResolver.getResource(payload); if (processArgs.isTraverseTree()) { visitor.accept(resource); } else { replicatorRunnable.run(resource); } } log.info("Synthetic Workflow Wrapper processed [ ] total payloads", count.get()); } catch (Exception e) { throw new WorkflowException(e); } }
Source:
private void setDictionaryBlockData(byte[] dictionaryData, int[] dictionaryOffsets, int positionCount) { verify(positionCount > 0); if (currentDictionaryData != dictionaryData) { boolean[] isNullVector = new boolean[positionCount]; isNullVector[positionCount - 1] = true; dictionaryOffsets[positionCount] = dictionaryOffsets[positionCount - 1]; dictionaryBlock = new VariableWidthBlock(positionCount, wrappedBuffer(dictionaryData), dictionaryOffsets, Optional.of(isNullVector)); if (filter != null && filter.isDeterministic()) { if (filterResults == null || filterResults.length < positionCount) { filterResults = new byte[positionCount]; } Arrays.fill(filterResults, (byte) 0); } currentDictionaryData = dictionaryData; } }

Target:
private void setDictionaryBlockData(byte[] dictionaryData, int[] dictionaryOffsets, int positionCount) { verify(positionCount > 0); if (currentDictionaryData != dictionaryData) { boolean[] isNullVector = new boolean[positionCount]; isNullVector[positionCount - 1] = true; dictionaryOffsets[positionCount] = dictionaryOffsets[positionCount - 1]; dictionaryBlock = new VariableWidthBlock(positionCount, wrappedBuffer(dictionaryData), dictionaryOffsets, Optional.of(isNullVector)); if (deterministicFilter) { if (filterResults == null || filterResults.length < positionCount) { filterResults = new byte[positionCount]; } else { Arrays.fill(filterResults, FILTER_NOT_EVALUATED); } } currentDictionaryData = dictionaryData; } }
Source:
public ZNRecord getRecord() { return _record; }

Target:
public final ZNRecord getRecord() { return _record; }
Source:
private boolean isKfsSystemUserDvInitiator(CuDisbursementVoucherDocument dv) { String dvDocInitatorPrincipalId = dv.getDocumentHeader().getWorkflowDocument().getInitiatorPrincipalId(); Person kfsSystemUser = getPersonService().getPersonByPrincipalName(KFSConstants.SYSTEM_USER); String kfsSystemUserPrincipalId = kfsSystemUser.getPrincipalId(); if ( (dvDocInitatorPrincipalId != null) && (kfsSystemUserPrincipalId != null) && (!StringUtils.isBlank(dvDocInitatorPrincipalId)) && (!StringUtils.isBlank(kfsSystemUserPrincipalId)) && (StringUtils.equals(dvDocInitatorPrincipalId, kfsSystemUserPrincipalId)) ) return true; else return false; }

Target:
private boolean isKfsSystemUserDvInitiator(CuDisbursementVoucherDocument dv) { String dvDocInitatorPrincipalId = dv.getDocumentHeader().getWorkflowDocument().getInitiatorPrincipalId(); if ( StringUtils.equals(dvDocInitatorPrincipalId, getKfsSystemUserPrincipalId()) ) { return true; } else { return false; } }
Source:
protected final void handleMessageInternal(Message<?> message) { Object result; if (this.advisedRequestHandler == null) { result = this.handleRequestMessage(message); } else { result = doInvokeAdvisedRequestHandler(message); } if (result != null) { this.sendOutputs(result, message); } else if (this.requiresReply) { throw new ReplyRequiredException(message, "No reply produced by handler '" + this.getComponentName() + "', and its 'requiresReply' property is set to true."); } else if (logger.isDebugEnabled()) { logger.debug("handler '" + this + "' produced no reply for request Message: " + message); } }

Target:
protected final void handleMessageInternal(Message<?> message) { Object result; if (this.advisedRequestHandler == null) { result = handleRequestMessage(message); } else { result = doInvokeAdvisedRequestHandler(message); } if (result != null) { sendOutputs(result, message); } else if (this.requiresReply) { throw new ReplyRequiredException(message, "No reply produced by handler '" + getComponentName() + "', and its 'requiresReply' property is set to true."); } else if (logger.isDebugEnabled()) { logger.debug("handler '" + this + "' produced no reply for request Message: " + message); } }
Source:
public static ColdStorageContentStatus checkColdStorageContentAvailability(CoreSession session) { log.debug("Start checking the available cold storage content for repository: {}", session::getRepositoryName); DocumentModelList documents = session.query(GET_DOCUMENTS_TO_CHECK_QUERY); int beingRetrieved = documents.size(); int available = 0; EventService eventService = Framework.getService(EventService.class); for (DocumentModel doc : documents) { if (isColdStorageContentAvailable(doc)) { available++; beingRetrieved--; DocumentEventContext ctx = new DocumentEventContext(session, session.getPrincipal(), doc); Event event = ctx.newEvent(COLD_STORAGE_CONTENT_AVAILABLE_EVENT_NAME); eventService.fireEvent(event); } } log.debug( "End checking the available cold storage content for repository: {}, beingRetrieved: {}, available: {}", session.getRepositoryName(), beingRetrieved, available); return new ColdStorageContentStatus(session.getRepositoryName(), beingRetrieved, available); }

Target:
public static ColdStorageContentStatus checkColdStorageContentAvailability(CoreSession session) { log.debug("Start checking the available cold storage content for repository: {}", session::getRepositoryName); DocumentModelList documents = session.query(GET_DOCUMENTS_TO_CHECK_QUERY); int beingRetrieved = documents.size(); int available = 0; EventService eventService = Framework.getService(EventService.class); DownloadService downloadService = Framework.getService(DownloadService.class); for (DocumentModel doc : documents) { Blob coldContent = (Blob) doc.getPropertyValue(COLD_STORAGE_CONTENT_PROPERTY); BlobStatus blobStatus; try { blobStatus = Framework.getService(BlobManager.class) .getBlobProvider(coldContent) .getStatus((ManagedBlob) coldContent); } catch (IOException e) { log.error("Unable to get the cold storage blob status for document: {}", doc, e); continue; } if (blobStatus.downloadable) { available++; beingRetrieved--; doc.setPropertyValue(COLD_STORAGE_BEING_RETRIEVED_PROPERTY, false); session.saveDocument(doc); DocumentEventContext ctx = new DocumentEventContext(session, session.getPrincipal(), doc); Instant downloadableUntil = blobStatus.downloadableUntil; if (downloadableUntil != null) { ctx.getProperties() .put(COLD_STORAGE_CONTENT_AVAILABLE_UNTIL_MAIL_TEMPLATE_KEY, downloadableUntil.toString()); } String downloadUrl = downloadService.getDownloadUrl(doc, COLD_STORAGE_CONTENT_PROPERTY, null); ctx.getProperties().put(COLD_STORAGE_CONTENT_ARCHIVE_LOCATION_MAIL_TEMPLATE_KEY, downloadUrl); eventService.fireEvent(ctx.newEvent(COLD_STORAGE_CONTENT_AVAILABLE_EVENT_NAME)); } } log.debug( "End checking the available cold storage content for repository: {}, beingRetrieved: {}, available: {}", session.getRepositoryName(), beingRetrieved, available); return new ColdStorageContentStatus(beingRetrieved, available); }
Source:
public void writeProperty(final OutputStream outputStream, final Property p) throws IOException { final Output output = new Output(outputStream); writeHeader(output); kryo.writeObject(output, DetachedFactory.detach(p)); output.flush(); }

Target:
public void writeProperty(final OutputStream outputStream, final Property p) throws IOException { final Output output = new Output(outputStream); writeHeader(output); kryo.writeObject(output, DetachedFactory.detach(p, true)); output.flush(); }
Source:
private void init(VM vm, VmInfoBuildUtils vmInfoBuildUtils, Guid hostId) { this.vm = vm; this.vmInfoBuildUtils = vmInfoBuildUtils; payloadIndex = -1; cdRomIndex = -1; vnicMetadata = new HashMap<>(); diskMetadata = new HashMap<>(); volumeLeases = new ArrayList<>(); hypervEnabled = vmInfoBuildUtils.isHypervEnabled(vm.getVmOsId(), vm.getCompatibilityVersion()); emulatedMachine = vm.getEmulatedMachine() != null ? vm.getEmulatedMachine() : vmInfoBuildUtils.getEmulatedMachineByClusterArch(vm.getClusterArch()); cdInterface = vmInfoBuildUtils.getCdInterface( vm.getOs(), vm.getCompatibilityVersion(), ChipsetType.fromMachineType(emulatedMachine)); writer = new XmlTextWriter(); qosCache = new HashMap<>(); vmCustomProperties = VmPropertiesUtils.getInstance().getVMProperties( vm.getCompatibilityVersion(), vm.getStaticData()); if (hostId != null) { hostDevicesSupplier = new MemoizingSupplier<>(() -> vmInfoBuildUtils.getHostDevices(hostId)); hostStatisticsSupplier = new MemoizingSupplier<>(() -> vmInfoBuildUtils.getVdsStatistics(hostId)); hostNumaNodesSupplier = new MemoizingSupplier<>(() -> vmInfoBuildUtils.getVdsNumaNodes(hostId)); } else { hostDevicesSupplier = new MemoizingSupplier<>(() -> Collections.emptyMap()); hostStatisticsSupplier = new MemoizingSupplier<>(() -> null); hostNumaNodesSupplier = new MemoizingSupplier<>(() -> Collections.emptyList()); } vmNumaNodesSupplier = new MemoizingSupplier<>(() -> vmInfoBuildUtils.getVmNumaNodes(vm)); }

Target:
private void init(VM vm, VmInfoBuildUtils vmInfoBuildUtils, Guid hostId) { this.vm = vm; this.vmInfoBuildUtils = vmInfoBuildUtils; payloadIndex = -1; cdRomIndex = -1; vnicMetadata = new HashMap<>(); diskMetadata = new HashMap<>(); hypervEnabled = vmInfoBuildUtils.isHypervEnabled(vm.getVmOsId(), vm.getCompatibilityVersion()); emulatedMachine = vm.getEmulatedMachine() != null ? vm.getEmulatedMachine() : vmInfoBuildUtils.getEmulatedMachineByClusterArch(vm.getClusterArch()); cdInterface = vmInfoBuildUtils.getCdInterface( vm.getOs(), vm.getCompatibilityVersion(), ChipsetType.fromMachineType(emulatedMachine)); writer = new XmlTextWriter(); qosCache = new HashMap<>(); vmCustomProperties = VmPropertiesUtils.getInstance().getVMProperties( vm.getCompatibilityVersion(), vm.getStaticData()); if (hostId != null) { hostDevicesSupplier = new MemoizingSupplier<>(() -> vmInfoBuildUtils.getHostDevices(hostId)); hostStatisticsSupplier = new MemoizingSupplier<>(() -> vmInfoBuildUtils.getVdsStatistics(hostId)); hostNumaNodesSupplier = new MemoizingSupplier<>(() -> vmInfoBuildUtils.getVdsNumaNodes(hostId)); } else { hostDevicesSupplier = new MemoizingSupplier<>(() -> Collections.emptyMap()); hostStatisticsSupplier = new MemoizingSupplier<>(() -> null); hostNumaNodesSupplier = new MemoizingSupplier<>(() -> Collections.emptyList()); } vmNumaNodesSupplier = new MemoizingSupplier<>(() -> vmInfoBuildUtils.getVmNumaNodes(vm)); }
Source:
public void testPageFetch() throws Throwable { WikiSite wiki = new WikiSite("test.wikipedia.org"); PageTitle title = new PageTitle(null, "Test_page_for_app_testing/Section1", wiki); new EditPreviewClient().wikitext(wiki, title, 2, new EditPreviewClient.WikitextCallback() { @Override public void success(@NonNull String wikitext) { assertNotNull(wikitext); } @Override public void failure(@NonNull Throwable caught) { throw new RuntimeException(caught); } }); }

Target:
public void testPageFetch() throws Throwable { WikiSite wiki = new WikiSite("test.wikipedia.org"); PageTitle title = new PageTitle(null, "Test_page_for_app_testing/Section1", wiki); new WikitextClient().request(wiki, title, 2, new WikitextClient.Callback() { @Override public void success(@NonNull String wikitext, @NonNull Call<Wikitext> call) { assertNotNull(wikitext); } @Override public void failure(@NonNull Throwable caught, @NonNull Call<Wikitext> call) { throw new RuntimeException(caught); } }); }
Source:
public Object deserialize(final Writable blob) throws SerDeException { final Text t = (Text) blob; if (t.getLength() == 0) { if (!this.nullEmptyLines) { throw new SerDeException("Encountered an empty row in the text file"); } final int fieldCount = soi.getAllStructFieldRefs().size(); return Collections.nCopies(fieldCount, null); } try { return jsonReader.parseStruct( new ByteArrayInputStream((t.getBytes()), 0, t.getLength())); } catch (Exception e) { LOG.warn("Error parsing JSON text [{}].", t, e); throw new SerDeException(e); } }

Target:
public Object deserialize(final Writable blob) throws SerDeException { final Text t = (Text) blob; if (t.getLength() == 0) { if (!this.nullEmptyLines) { throw new SerDeException("Encountered an empty row in the text file"); } final int fieldCount = soi.getAllStructFieldRefs().size(); return Collections.nCopies(fieldCount, null); } try { return jsonReader.parseStruct( new ByteArrayInputStream((t.getBytes()), 0, t.getLength())); } catch (Exception e) { LOG.debug("Problem parsing JSON text [{}].", t, e); throw new SerDeException(e); } }
Source:
protected void executeVdsBrokerCommand() { status = getBroker().glusterVolumeGeoRepSessionDelete(getParameters().getVolumeName(), getParameters().getSlaveHost(), getParameters().getVolumeName()); proceedProxyReturnValue(); }

Target:
protected void executeVdsBrokerCommand() { status = getBroker().glusterVolumeGeoRepSessionDelete(getParameters().getVolumeName(), getParameters().getSlaveHost(), getParameters().getSlaveVolume()); proceedProxyReturnValue(); }
Source:
public void testCallingDecisionService() throws Exception { KieBase kbase = readKnowledgeBase(); KieSession ksession = createSession(kbase); BusinessRuleTaskHandler handler = new BusinessRuleTaskHandler(GROUP_ID, ARTIFACT_ID, VERSION); Map<String, Object> params = new HashMap<String, Object>(); params.put("Input", "Hello World"); WorkflowProcessInstance processInstance = (WorkflowProcessInstance) ksession.startProcess("CallDecision", params); Object output = processInstance.getVariable("Output Decision"); assertEquals("Hello World", output); Object encapsulatedOutput = processInstance.getVariable("Encapsulated Output"); assertEquals(null, encapsulatedOutput); }

Target:
public void testCallingDecisionService() throws Exception { KieBase kbase = readKnowledgeBase(); KieSession ksession = createSession(kbase); Map<String, Object> params = new HashMap<String, Object>(); params.put("Input", "Hello World"); WorkflowProcessInstance processInstance = (WorkflowProcessInstance) ksession.startProcess("CallDecision", params); Object output = processInstance.getVariable("Output Decision"); assertEquals("Hello World", output); Object encapsulatedOutput = processInstance.getVariable("Encapsulated Output"); assertEquals(null, encapsulatedOutput); }
Source:
public boolean isEdgeWithRectilinearRoutingStyle() { boolean isEdgeRectilinearRoutingStyle = false; if (Routing.RECTILINEAR_LITERAL.getLiteral().equals(getRoutingStyle())) { isEdgeRectilinearRoutingStyle = true; } return isEdgeRectilinearRoutingStyle; }

Target:
public boolean isEdgeWithRectilinearRoutingStyle() { boolean isEdgeRectilinearRoutingStyle = false; if (Routing.RECTILINEAR_LITERAL.equals(getRoutingStyle())) { isEdgeRectilinearRoutingStyle = true; } return isEdgeRectilinearRoutingStyle; }
Source:
public Object processElement(Object framedElement, Method method, Object[] arguments, JavaHandler annotation, FramedGraph<?> framedGraph, Element element) { try { Class<?>[] interfaces = framedElement.getClass().getInterfaces(); Class<?> superInterface = findTheMostSubInterface(interfaces); ClassAndMethod cAndMethod = new ClassAndMethod(superInterface.getName(),method.getName()); if (proxyToJavaHandlerCache.containsKey(cAndMethod)) { Class<?> classInvoke = proxyToJavaHandlerCache.get(cAndMethod); Object handler = module.createHandler(framedElement, framedGraph, element, classInvoke, method); return method.invoke(handler, arguments); } for (Class<?> interfaceClass : framedElement.getClass().getInterfaces()) { try { Object handler = module.createHandler(framedElement, framedGraph, element, interfaceClass, method); Object result = method.invoke(handler, arguments); proxyToJavaHandlerCache.put(cAndMethod, interfaceClass); return result; } catch (Exception e) { } } proxyToJavaHandlerCache.put(cAndMethod, method.getDeclaringClass()); Object handler = module.createHandler(framedElement, framedGraph, element, method.getDeclaringClass(), method); return method.invoke(handler, arguments); } catch (IllegalArgumentException e) { throw new JavaHandlerException("Problem calling Java handler", e); } catch (IllegalAccessException e) { throw new JavaHandlerException("Problem calling Java handler", e); } catch (InvocationTargetException e) { ExceptionUtils.sneakyThrow(e.getTargetException()); return null; } }

Target:
public Object processElement(Object framedElement, Method method, Object[] arguments, JavaHandler annotation, FramedGraph<?> framedGraph, Element element) { try { Object handler = module.createHandler(framedElement, framedGraph, element, method.getDeclaringClass(), method); return method.invoke(handler, arguments); } catch (IllegalArgumentException e) { throw new JavaHandlerException("Problem calling Java handler", e); } catch (IllegalAccessException e) { throw new JavaHandlerException("Problem calling Java handler", e); } catch (InvocationTargetException e) { ExceptionUtils.sneakyThrow(e.getTargetException()); return null; } }
Source:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest httpRequest = (HttpServletRequest) request; HttpServletResponse httpResponse= (HttpServletResponse) response; GHMyself myself = this.loginProvider.get(httpRequest).getMyself(); if (myself != null) { List<GHEmail> emails = myself.getEmails2(); ReviewDb db = null; try { db = this.schema.open(); AccountAccess accounts = db.accounts(); for (GHEmail email: emails) { List<Account> results = accounts.byPreferredEmail(email.getEmail()).toList(); if (results.size() > 1) { log.error(String.format("'%s' is register as preferred email for multiple accounts", email.getEmail())); break; } Account.Id accountId =results.get(0).getId(); AccountExternalId.Key gitHubKey = new AccountExternalId.Key(AccountExternalId.SCHEME_GERRIT, myself.getLogin()); if (haveGitHubIdEntry(db, accountId, gitHubKey)) { break; } log.info(String.format("Inserting external id entry for '%s' " + "who's preferred email '%s' matched their GitHub account.", myself.getLogin(), email.getEmail())); db.accountExternalIds().insert( Arrays .asList(new AccountExternalId(accountId, gitHubKey))); break; } } catch(com.google.gwtorm.server.OrmException orex) { log.error("Exception inserting GitHub external id entry", orex); } finally { if (db != null) { db.close(); } } } super.doFilter(request, response, chain); }

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest httpRequest = (HttpServletRequest) request; HttpServletResponse httpResponse= (HttpServletResponse) response; GHMyself myself = this.loginProvider.get(httpRequest).getMyself(); if (myself != null) { List<GHEmail> emails = myself.getEmails2(); ReviewDb db = null; try { db = this.schema.open(); AccountAccess accounts = db.accounts(); for (GHEmail email: emails) { List<Account> results = accounts.byPreferredEmail(email.getEmail()).toList(); if (results.isEmpty()) { continue; } else if (results.size() > 1) { log.error(String.format("'%s' is register as preferred email for multiple accounts", email.getEmail())); break; } Account.Id accountId = results.get(0).getId(); AccountExternalId.Key gitHubKey = new AccountExternalId.Key(AccountExternalId.SCHEME_GERRIT, myself.getLogin()); if (haveGitHubIdEntry(db, accountId, gitHubKey)) { break; } log.info(String.format("Inserting external id entry for '%s' " + "whose preferred email '%s' matched their GitHub account.", myself.getLogin(), email.getEmail())); db.accountExternalIds().insert( Arrays .asList(new AccountExternalId(accountId, gitHubKey))); break; } } catch(OrmException orex) { log.error("Exception inserting GitHub external id entry", orex); } finally { if (db != null) { db.close(); } } } super.doFilter(request, response, chain); }
Source:
public void actionPerformed(ActionEvent e) { switch (e.getActionCommand()) { case CREATE_REQUEST: try { reportingArea.setText(JMeterUtils.getResString("generate_report_ui.html_report_processing") + "\n"); reportLaunchButton.setForeground(Color.orange); new ReportGenerationWorker(reportLaunchButton).execute(); } catch (Exception exception) { if (LOGGER.isErrorEnabled()) { LOGGER.error("Error during html report generation : {}", exception.getMessage(), exception); } } if (LOGGER.isDebugEnabled()) { LOGGER.debug("CSV file path \n user.properties file path : \nOutput directory file path : {}", csvFilePathTextField.getText(), userPropertiesFilePathTextField.getText(), outputDirectoryPathTextField.getText()); } break; case BROWSE_USER_PROPERTIES: userPropertiesFilePathTextField.setText(showFileChooser(userPropertiesFileButton.getParent(), userPropertiesFilePathTextField, false, new String[] { ".properties" })); break; case BROWSE_CSV: csvFilePathTextField.setText(showFileChooser(csvFileButton.getParent(), csvFilePathTextField, false, new String[] { ".jtl", ".csv" })); break; case BROWSE_OUTPUT: outputDirectoryPathTextField.setText( showFileChooser(outputDirectoryButton.getParent(), outputDirectoryPathTextField, true, null)); break; default: break; } }

Target:
public void actionPerformed(ActionEvent e) { switch (e.getActionCommand()) { case CREATE_REQUEST: try { reportArea.setText(JMeterUtils.getResString("generate_report_ui.html_report_processing") + "\n"); reportLaunchButton.setForeground(Color.orange); new ReportGenerationWorker(reportLaunchButton).execute(); } catch (Exception exception) { if (LOGGER.isErrorEnabled()) { LOGGER.error("Error during html report generation: {}", exception.getMessage(), exception); } } if (LOGGER.isDebugEnabled()) { LOGGER.debug("CSV file path {}\nuser.properties file path: {}\nOutput directory file path: {}", csvFilePathTextField.getText(), userPropertiesFilePathTextField.getText(), outputDirectoryPathTextField.getText()); } break; case BROWSE_USER_PROPERTIES: userPropertiesFilePathTextField.setText(showFileChooser(userPropertiesFileButton.getParent(), userPropertiesFilePathTextField, false, new String[] { ".properties" })); break; case BROWSE_CSV: csvFilePathTextField.setText(showFileChooser(csvFileButton.getParent(), csvFilePathTextField, false, new String[] { ".jtl", ".csv" })); break; case BROWSE_OUTPUT: outputDirectoryPathTextField.setText( showFileChooser(outputDirectoryButton.getParent(), outputDirectoryPathTextField, true, null)); break; default: break; } }
Source:
private AbstractAlgorithm getAlgorithm(final ARXConfiguration config, final DataManager manager, final SolutionSpace solutionSpace, final NodeChecker checker) { for (PrivacyCriterion c : config.getPrivacyModels()) { if (c instanceof DataDependentEDDifferentialPrivacy) { int[] rootValues = new int[manager.getHierarchies().length]; for (int i = 0; i < manager.getHierarchies().length; i++) { int[] row = manager.getHierarchies()[i].getArray()[0]; rootValues[i] = row[row.length - 1]; } DataDependentEDDifferentialPrivacy dpCriterion = (DataDependentEDDifferentialPrivacy)c; return DataDependentEDDPAlgorithm.create(solutionSpace, checker, config.getQualityModel(), dpCriterion.isDeterministic(), dpCriterion.getSteps(), dpCriterion.getEpsilonSearch(), c.getMinimalClassSize(), manager.getDataGeneralized().getDataLength(), rootValues); } } if (config.isHeuristicSearchEnabled() || solutionSpace.getSize() > config.getHeuristicSearchThreshold()) { return LIGHTNINGAlgorithm.create(solutionSpace, checker, config.getHeuristicSearchTimeLimit()); } else { FLASHStrategy strategy = new FLASHStrategy(solutionSpace, manager.getHierarchies()); return FLASHAlgorithm.create(solutionSpace, checker, strategy); } }

Target:
private AbstractAlgorithm getAlgorithm(final ARXConfiguration config, final DataManager manager, final SolutionSpace solutionSpace, final NodeChecker checker) { if (config.isPrivacyModelSpecified(EDDifferentialPrivacyOptimal.class)){ EDDifferentialPrivacyOptimal dpCriterion = config.getPrivacyModel(EDDifferentialPrivacyOptimal.class); return DataDependentEDDPAlgorithm.create(solutionSpace, checker, dpCriterion.isDeterministic(), dpCriterion.getSteps(), dpCriterion.getEpsilonSearch()); } if (config.isHeuristicSearchEnabled() || solutionSpace.getSize() > config.getHeuristicSearchThreshold()) { return LIGHTNINGAlgorithm.create(solutionSpace, checker, config.getHeuristicSearchTimeLimit()); } else { FLASHStrategy strategy = new FLASHStrategy(solutionSpace, manager.getHierarchies()); return FLASHAlgorithm.create(solutionSpace, checker, strategy); } }
Source:
public void setMeter(Meter m) { if (lastSelectedMeterMenuItem != null) lastSelectedMeterMenuItem.setSelected(false); if (meter != null) { meter.disable(); meter.removePropertyChangeListener(NamedBean.PROPERTY_STATE, propertyChangeListener); } meter = m; if (meter == null) return; meter.addPropertyChangeListener(NamedBean.PROPERTY_STATE, propertyChangeListener); meter.enable(); if (frameIsInitialized) { scaleImage(); JCheckBoxMenuItem menuItem = meter_MenuItemMap.get(meter); menuItem.setSelected(true); lastSelectedMeterMenuItem = menuItem; updateMenuUnits(); initSelectedUnit(); } if (meter instanceof VoltageMeter) { setTitle(Bundle.getMessage("TrackVoltageMeterTitle2", m.getDisplayName())); } else { setTitle(Bundle.getMessage("TrackCurrentMeterTitle2", m.getDisplayName())); } }

Target:
public void setMeter(Meter m) { if (lastSelectedMeterMenuItem != null) lastSelectedMeterMenuItem.setSelected(false); if (meter != null) { meter.disable(); meter.removePropertyChangeListener(NamedBean.PROPERTY_STATE, propertyChangeListener); } meter = m; if (meter == null) return; meter.addPropertyChangeListener(NamedBean.PROPERTY_STATE, propertyChangeListener); meter.enable(); if (frameIsInitialized) { scaleImage(); JCheckBoxMenuItem menuItem = meter_MenuItemMap.get(meter); menuItem.setSelected(true); lastSelectedMeterMenuItem = menuItem; updateMenuUnits(); initSelectedUnit(); } if (meter instanceof VoltageMeter) { setTitle(Bundle.getMessage("VoltageMeterTitle2", m.getDisplayName())); } else { setTitle(Bundle.getMessage("CurrentMeterTitle2", m.getDisplayName())); } }
Source:
protected void executeCommand() { getStoragePool().setstatus(getParameters().getStatus()); setVdsIdRef(getStoragePool().getspm_vds_id()); DbFacade.getInstance().getStoragePoolDAO().updateStatus(getStoragePool().getId(), getStoragePool().getstatus()); if (getParameters().getStatus() == StoragePoolStatus.Problematic || getParameters().getStatus() == StoragePoolStatus.NotOperational) { List<storage_pool_iso_map> storagesStatusInPool = DbFacade.getInstance() .getStoragePoolIsoMapDAO().getAllForStoragePool(getStoragePool().getId()); for (storage_pool_iso_map storageStatusInPool : storagesStatusInPool) { if (storageStatusInPool.getstatus() != null && storageStatusInPool.getstatus() == StorageDomainStatus.Active) { storageStatusInPool.setstatus(StorageDomainStatus.Unknown); DbFacade.getInstance() .getStoragePoolIsoMapDAO() .updateStatus(storageStatusInPool.getId(), storageStatusInPool.getstatus()); final List<Guid> asyncTasks = getDbFacade().getAsyncTaskDAO().getAsyncTaskIdsByEntity(storageStatusInPool.getstorage_id()); for(Guid taskId: asyncTasks) { AuditLogableBase auditLogableBase = new AuditLogableBase() { @Override public AuditLogType getAuditLogTypeValue() { return AuditLogType.STORAGE_DOMAIN_TASKS_ERROR; } }; auditLogableBase.setStorageDomain(getStorageDomain()); auditLogableBase.setJobId(taskId); AuditLogDirector.log(auditLogableBase); } } } } StoragePoolStatusHandler.PoolStatusChanged(getStoragePool().getId(), getStoragePool().getstatus()); setSucceeded(true); }

Target:
protected void executeCommand() { getStoragePool().setstatus(getParameters().getStatus()); setVdsIdRef(getStoragePool().getspm_vds_id()); DbFacade.getInstance().getStoragePoolDAO().updateStatus(getStoragePool().getId(), getStoragePool().getstatus()); if (getParameters().getStatus() == StoragePoolStatus.Problematic || getParameters().getStatus() == StoragePoolStatus.NotOperational) { List<storage_pool_iso_map> storagesStatusInPool = DbFacade.getInstance() .getStoragePoolIsoMapDAO().getAllForStoragePool(getStoragePool().getId()); for (storage_pool_iso_map storageStatusInPool : storagesStatusInPool) { if (storageStatusInPool.getstatus() != null && storageStatusInPool.getstatus() == StorageDomainStatus.Active) { storageStatusInPool.setstatus(StorageDomainStatus.Unknown); DbFacade.getInstance() .getStoragePoolIsoMapDAO() .updateStatus(storageStatusInPool.getId(), storageStatusInPool.getstatus()); final List<Guid> asyncTasks = getDbFacade().getAsyncTaskDAO().getAsyncTaskIdsByEntity(storageStatusInPool.getstorage_id()); for(Guid taskId: asyncTasks) { AuditLogableBase auditLogableBase = new AuditLogableBase(); auditLogableBase.setStorageDomain(getStorageDomain()); auditLogableBase.setJobId(taskId); AuditLogDirector.log(auditLogableBase, AuditLogType.STORAGE_DOMAIN_TASKS_ERROR); } } } } StoragePoolStatusHandler.PoolStatusChanged(getStoragePool().getId(), getStoragePool().getstatus()); setSucceeded(true); }
Source:
private static ObjectMapper configure(ObjectMapper mapper) { return mapper .registerModule(new DecimalModule()) .enable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); }

Target:
private static ObjectMapper configure(ObjectMapper mapper) { return mapper.copy() .registerModule(new DecimalModule()) .enable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); }
Source:
private static void addFilesToCompression(TarArchiveOutputStream taos, File file, String dir, String bundleRoot) throws IOException { if(!file.isHidden()) { if(!dir.equals(".")) if(File.separator.equals("\\")){ dir = dir.replaceAll("\\\\", "/"); } taos.putArchiveEntry(new TarArchiveEntry(file, dir + "/" + file.getName())); if (file.isFile()) { BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file)); FileInputStream in = new FileInputStream(file); IOUtils.copy(in, taos); taos.closeArchiveEntry(); in.close(); bis.close(); } else if (file.isDirectory()) { if(!dir.equals(".")) taos.closeArchiveEntry(); for (File childFile : file.listFiles()) { addFilesToCompression(taos, childFile, file.getPath().substring(bundleRoot.length()), bundleRoot); } } } }

Target:
private static void addFilesToCompression(TarArchiveOutputStream taos, File file, String dir, String bundleRoot) throws IOException { if(!file.isHidden()) { if(!dir.equals(".")) if(File.separator.equals("\\")){ dir = dir.replaceAll("\\\\", "/"); } taos.putArchiveEntry(new TarArchiveEntry(file, dir + "/" + file.getName())); if (file.isFile()) { try(BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file))) { IOUtils.copy(bis, taos); taos.closeArchiveEntry(); } } else if (file.isDirectory()) { if(!dir.equals(".")) taos.closeArchiveEntry(); for (File childFile : file.listFiles()) { addFilesToCompression(taos, childFile, file.getPath().substring(bundleRoot.length()), bundleRoot); } } } }