auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static Stream<Arguments> escapeSupplier() { PercentEscaper defaultEscaper = new PercentEscaper(null, false); return Stream.of( Arguments.arguments(defaultEscaper, "$", "%24"), Arguments.arguments(defaultEscaper, "¢", "%C2%A2"), Arguments.arguments(defaultEscaper, "ह", "%E0%A4%B9"), Arguments.arguments(defaultEscaper, "€", "%E2%82%AC"), Arguments.arguments(defaultEscaper, "한", "%ED%95%9C"), Arguments.arguments(defaultEscaper, "円", "%E5%86%86"), Arguments.arguments(defaultEscaper, "\uD800\uDF48", "%F0%90%8D%88"), Arguments.arguments(defaultEscaper, "日本語", "%E6%97%A5%E6%9C%AC%E8%AA%9E"), Arguments.arguments(defaultEscaper, " ", "%20"), Arguments.arguments(new PercentEscaper(null, true), " ", "+"), Arguments.arguments(new PercentEscaper("$", false), "$", "$") ); }

Target:
private static Stream<Arguments> escapeSupplier() { PercentEscaper defaultEscaper = new PercentEscaper(null, false); return Stream.of( Arguments.arguments(defaultEscaper, null, null), Arguments.arguments(defaultEscaper, "", ""), Arguments.arguments(defaultEscaper, "$", "%24"), Arguments.arguments(defaultEscaper, "¢", "%C2%A2"), Arguments.arguments(defaultEscaper, "ह", "%E0%A4%B9"), Arguments.arguments(defaultEscaper, "€", "%E2%82%AC"), Arguments.arguments(defaultEscaper, "한", "%ED%95%9C"), Arguments.arguments(defaultEscaper, "円", "%E5%86%86"), Arguments.arguments(defaultEscaper, "\uD800\uDF48", "%F0%90%8D%88"), Arguments.arguments(defaultEscaper, "日本語", "%E6%97%A5%E6%9C%AC%E8%AA%9E"), Arguments.arguments(defaultEscaper, " ", "%20"), Arguments.arguments(new PercentEscaper(null, true), " ", "+"), Arguments.arguments(new PercentEscaper("$", false), "$", "$"), Arguments.arguments(new PercentEscaper("ह", false), "ह", "ह") ); }
Source:
private String createReplacementClassModifiers( VisitorState state, JCModifiers enclosingClassModifiers) { ImmutableList.Builder<String> classModifierStringsBuilder = new ImmutableList.Builder<>(); for (JCAnnotation annotation : enclosingClassModifiers.annotations) { classModifierStringsBuilder.add(state.getSourceForNode(annotation)); } EnumSet<Flag> classFlags = Flags.asFlagSet(enclosingClassModifiers.flags); classFlags.remove(Flags.Flag.FINAL); classFlags.add(Flags.Flag.ABSTRACT); for (Flag flag : classFlags) { classModifierStringsBuilder.add(flag.toString()); } return Joiner.on(' ').join(classModifierStringsBuilder.build()); }

Target:
private String createReplacementClassModifiers( VisitorState state, JCModifiers enclosingClassModifiers) { ImmutableList.Builder<String> classModifierStringsBuilder = ImmutableList.builder(); for (JCAnnotation annotation : enclosingClassModifiers.annotations) { classModifierStringsBuilder.add(state.getSourceForNode(annotation)); } EnumSet<Flag> classFlags = Flags.asFlagSet(enclosingClassModifiers.flags); classFlags.remove(Flags.Flag.FINAL); classFlags.add(Flags.Flag.ABSTRACT); for (Flag flag : classFlags) { classModifierStringsBuilder.add(flag.toString()); } return Joiner.on(' ').join(classModifierStringsBuilder.build()); }
Source:
private void resetSchemaProperties(DocumentModel target) throws OperationException { if (xpath != null) { target.setPropertyValue(xpath, null); } else if (schema != null) { for (Map.Entry<String, Object> entry : target.getProperties(schema).entrySet()) { target.setProperty(schema, entry.getKey(), null); } } else { throw new OperationException("No schema or xpath was provided"); } }

Target:
private void resetSchemaProperties(DocumentModel target) throws OperationException { if (xpath != null) { target.setPropertyValue(xpath, null); } else if (schema != null) { for (String key : target.getProperties(schema).keySet()) { target.setProperty(schema, key, null); } } else { throw new OperationException("No schema or xpath was provided"); } }
Source:
public List<FilterNode> getChildren() { return Stream.of(json.get(CHILDREN)) .map(List.class::cast) .flatMap(List::stream) .map(Map.class::cast) .map( new Function<Map, FilterNodeMapImpl>() { @Override public FilterNodeMapImpl apply(Map json1) { return new FilterNodeMapImpl(json1); } }) .collect(Collectors.toList()); }

Target:
public List<FilterNode> getChildren() { return Stream.of(json.get(CHILDREN)) .map(List.class::cast) .flatMap(List::stream) .map(Map.class::cast) .map(FilterNodeMapImpl::new) .collect(Collectors.toList()); }
Source:
private void raiseReadyForPlaybackEvent() { TimerTask raiseReadyForPlaybackEvent = new TimerTask() { @Override public void run() { try { IMediaStream mediaStream = packetizerCupertino.getAndSetStartStream(null); if (mediaStream == null) return; WMSProperties clientProperties = mediaStream.getProperties(); KalturaMediaServerIndex serverIndex = KalturaMediaServerIndex.get(clientProperties.getPropertyInt(LiveStreamEntry.CLIENT_PROPERTY_SERVER_INDEX, LiveStreamEntry.INVALID_SERVER_INDEX)); String entryId = getEntryIdFromStreamName(mediaStream.getName()); KalturaMediaStreamEvent event = new KalturaMediaStreamEvent(KalturaEventType.STREAM_READY_FOR_PLAYBACK, liveStreamManager.get(entryId), serverIndex, applicationName, mediaStream); KalturaEventsManager.raiseEvent(event); logger.info("Stream [" + mediaStream + "] raised READY_FOR_PLAYBACK"); eventLunched = true; } catch (Exception err) { logger.error(err); } } }; Timer timer = new Timer("register- readyForPlaybackEvent" , true); timer.schedule(raiseReadyForPlaybackEvent, 0); logger.debug("Scheduled initial timer - READY_FOR_PLAYBACK"); }

Target:
private void raiseReadyForPlaybackEvent() { TimerTask raiseReadyForPlaybackEvent = new TimerTask() { @Override public void run() { try { IMediaStream mediaStream = packetizerCupertino.getAndSetStartStream(null); WMSProperties clientProperties = mediaStream.getProperties(); KalturaMediaServerIndex serverIndex = KalturaMediaServerIndex.get(clientProperties.getPropertyInt(LiveStreamEntry.CLIENT_PROPERTY_SERVER_INDEX, LiveStreamEntry.INVALID_SERVER_INDEX)); String entryId = getEntryIdFromStreamName(mediaStream.getName()); KalturaMediaStreamEvent event = new KalturaMediaStreamEvent(KalturaEventType.STREAM_READY_FOR_PLAYBACK, liveStreamManager.get(entryId), serverIndex, applicationName, mediaStream); KalturaEventsManager.raiseEvent(event); eventLunched = true; } catch (Exception err) { logger.error(err); } } }; Timer timer = new Timer("register- readyForPlaybackEvent" , true); timer.schedule(raiseReadyForPlaybackEvent, 0); logger.debug("Scheduled initial timer - READY_FOR_PLAYBACK"); }
Source:
public static Archive<?> deploy() { JavaArchive jar = ShrinkWrap.create(JavaArchive.class, DEPLOYMENT + ".jar"); jar.addPackage(TestPassivationBean.class.getPackage()); jar.addClasses(DifferentCachePassivationBean.class, TwoPassivationStoresServerSetupTask.class); jar.addAsManifestResource(new StringAsset("Dependencies: org.jboss.as.controller-client, org.jboss.dmr \n"), "MANIFEST.MF"); jar.addAsManifestResource(TestPassivationBean.class.getPackage(), "persistence.xml", "persistence.xml"); return jar; }

Target:
public static Archive<?> deploy() { JavaArchive jar = ShrinkWrap.create(JavaArchive.class, DEPLOYMENT + ".jar"); jar.addClasses(DifferentCachePassivationBean.class, PassivationEnabledBean.class, Bean.class, CLIServerSetupTask.class); return jar; }
Source:
public static void flashOn() { Log.d(TAG, "flashOn()"); if (!isAvailable()) { return; } if (!CameraManager.getInstance().hasCurrentCameraFlash()) { currentFlashValue = false; CameraManager.getInstance().destroyStage(); } else { CameraManager.getInstance().setFlashParams(paramsOn); currentFlashValue = true; } }

Target:
public static void flashOn() { if (!available) { destroy(); return; } CameraManager.getInstance().setFlashParams(paramsOn); currentFlashValue = true; }
Source:
public void append(Number calculated) { values.add(calculated); }

Target:
public void append(Number calculated) { if (value == null) { value = calculated.doubleValue(); } else { value = Math.max(value,calculated.doubleValue()); } }
Source:
public void deploy(DeploymentPhaseContext deploymentPhaseContext) throws DeploymentUnitProcessingException { TracingExtensionLogger.ROOT_LOGGER.processingDeployment(); final DeploymentUnit deploymentUnit = deploymentPhaseContext.getDeploymentUnit(); final CapabilityServiceSupport support = deploymentUnit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT); final WeldCapability weldCapability; try { weldCapability = support.getCapabilityRuntimeAPI(WELD_CAPABILITY_NAME, WeldCapability.class); } catch (CapabilityServiceSupport.NoSuchCapabilityException e) { String msg = String.format("Deployment %s requires use of the '%s' capability but it is not currently registered", deploymentPhaseContext.getDeploymentUnit().getName(), WELD_CAPABILITY_NAME); throw new DeploymentUnitProcessingException(msg); } if (DeploymentTypeMarker.isType(DeploymentType.EAR, deploymentUnit)) { return; } if (!weldCapability.isPartOfWeldDeployment(deploymentUnit)) { TracingExtensionLogger.ROOT_LOGGER.noCdiDeployment(); return; } setServiceName(deploymentUnit); addListeners(deploymentUnit); }

Target:
public void deploy(DeploymentPhaseContext deploymentPhaseContext) throws DeploymentUnitProcessingException { TracingExtensionLogger.ROOT_LOGGER.processingDeployment(); final DeploymentUnit deploymentUnit = deploymentPhaseContext.getDeploymentUnit(); final CapabilityServiceSupport support = deploymentUnit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT); final WeldCapability weldCapability; try { weldCapability = support.getCapabilityRuntimeAPI(WELD_CAPABILITY_NAME, WeldCapability.class); } catch (CapabilityServiceSupport.NoSuchCapabilityException e) { throw new DeploymentUnitProcessingException(TracingExtensionLogger.ROOT_LOGGER.deploymentRequiresCapability( deploymentPhaseContext.getDeploymentUnit().getName(), WELD_CAPABILITY_NAME )); } if (DeploymentTypeMarker.isType(DeploymentType.EAR, deploymentUnit)) { return; } if (!weldCapability.isPartOfWeldDeployment(deploymentUnit)) { TracingExtensionLogger.ROOT_LOGGER.noCdiDeployment(); return; } setServiceName(deploymentUnit); addListeners(deploymentUnit); }
Source:
protected boolean userHasAddPermission(User user) { return user.isAdmin() || permissionsService.findResource(ResourceType.functionality, "generic-functionality") .filter(r -> r.hasPermission(user, PermissionType.ADD_MAPLAYER)).isPresent(); }

Target:
protected boolean userHasAddPermission(User user) { return user.isAdmin() || permissionsService.findResource(ResourceType.functionality, PermissionService.GENERIC_FUNCTIONALITY) .filter(r -> r.hasPermission(user, PermissionType.ADD_MAPLAYER)).isPresent(); }
Source:
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; throw new RuntimeException("Only one PropertiesModule may be installed"); }

Target:
public boolean equals(Object obj) { return this == obj; }
Source:
public String[] getAllValues(Collection<String> value, Attribute attr) { String[] result = null; Collection<String> intermediate = value; for (AttributeValueTransformer transformer : transformerList) { if(intermediate == null) { intermediate = Arrays.asList(result); } if(transformer.isMassTransformationPreferred()) { result = transformer.getAllValues(intermediate, attr); } else { result = intermediate.stream() .map(one -> transformer.getValue(one, attr)) .toArray(String[]::new); } intermediate = null; } return result; }

Target:
public String[] getAllValues(Collection<String> value, Attribute attr) { String[] result = null; Collection<String> intermediate = value; for (AttributeValueTransformer transformer : transformerList) { if(intermediate == null) { intermediate = (result == null) ? new ArrayList<String>() : Arrays.asList(result); } if(transformer.isMassTransformationPreferred()) { result = transformer.getAllValues(intermediate, attr); } else { result = intermediate.stream() .map(one -> transformer.getValue(one, attr)) .toArray(String[]::new); } intermediate = null; } return result; }
Source:
public DataSetGenerator lookupGenerator(DataSetDef def) { BeanDataSetDef beanDef = (BeanDataSetDef) def; String beanName = beanDef.getGeneratorClass(); DataSetGenerator generator = generatorMap.get(beanName); if (generator != null) { return generator; } else { throw new IllegalArgumentException("Data set generator class not found: " + beanName); } }

Target:
public DataSetGenerator lookupGenerator(DataSetDef def) { if (def instanceof BeanDataSetDef) { return loadDataSetGenerator((BeanDataSetDef) def); } throw new IllegalArgumentException("Not a BeanDataSetDef instance"); }
Source:
private static void createOutputDirectory(String outputDirectory) { File outputDir = new File(outputDirectory); if (!outputDir.exists()) { outputDir.mkdirs(); } }

Target:
private static File createOutputDirectory(String outputDirectory) { File outputDir = new File(outputDirectory); if (!outputDir.exists()) { outputDir.mkdirs(); } return outputDir; }
Source:
public static String getTSVForBedSedimentDownload(List<BedSedimentDownload> data, List<COLUMNS> outputColumns) { List<List<Object> > columns = new ArrayList<>(); List<String> headers = new ArrayList<>(); String output; HashMap<String, List> result = getBedSedimentDownloadData(data, outputColumns); columns.addAll(result.get("columns")); headers.addAll(result.get("headers")); if(columns.size() > 0 && headers.size() > 0){ output = TSVUtil.createTSV(headers, columns, data.size(), false, true); } else { output = "NO BED SEDIMENT DATA RETURNED FOR SPECIFIED PARAMETERS"; } return output; }

Target:
public static String getTSVForBedSedimentDownload(List<BedSedimentDownload> data, List<COLUMNS> outputColumns) { List<List<Object> > columns = new ArrayList<>(); List<String> headers = new ArrayList<>(); String output; HashMap<String, List> result = getBedSedimentDownloadData(data, outputColumns); columns = result.get("columns"); headers = result.get("headers"); if(columns.size() > 0 && headers.size() > 0){ output = TSVUtil.createTSV(headers, columns, data.size(), false, true); } else { output = "NO BED SEDIMENT DATA RETURNED FOR SPECIFIED PARAMETERS"; } return output; }
Source:
private void sendBypassEmail(final ReceiveCommand cmd) { final String destBranchName = cmd.getRefName().substring(Constants.R_HEADS.length()); BranchEmail bm = branchEmailFactory.create(project, destBranchName, cmd.getType()); bm.setFrom(currentUser.getAccountId()); try { bm.send(); } catch (EmailException e) { String error_head = ""; error_head = error_head + bm.getMessageClass() + " : "; log.error(error_head, e); } }

Target:
private void sendBypassEmail(final ReceiveCommand cmd) { final String destBranchName = cmd.getRefName(); BranchEmail bm = branchEmailFactory.create(project, destBranchName, cmd.getType()); bm.setFrom(currentUser.getAccountId()); try { bm.send(); } catch (EmailException e) { log.error(bm.getMessageClass() + " : ", e); } }
Source:
public CloudianGroup listGroup(final String groupId) { if (Strings.isNullOrEmpty(groupId)) { return null; } LOG.debug("Trying to find Cloudian group with id=" + groupId); try { final HttpResponse response = get(String.format("/group?groupId=%s", groupId)); checkResponseOK(response); if (response.getStatusLine().getStatusCode() == HttpStatus.SC_NO_CONTENT || response.getEntity() == null || response.getEntity().getContent() == null) { return null; } final ObjectMapper mapper = new ObjectMapper(); return mapper.readValue(response.getEntity().getContent(), CloudianGroup.class); } catch (final IOException e) { LOG.error("Failed to list Cloudian group due to:", e); checkResponseTimeOut(e); } return null; }

Target:
public CloudianGroup listGroup(final String groupId) { if (Strings.isNullOrEmpty(groupId)) { return null; } LOG.debug("Trying to find Cloudian group with id=" + groupId); try { final HttpResponse response = get(String.format("/group?groupId=%s", groupId)); checkResponseOK(response); if (checkEmptyResponse(response)) { return null; } final ObjectMapper mapper = new ObjectMapper(); return mapper.readValue(response.getEntity().getContent(), CloudianGroup.class); } catch (final IOException e) { LOG.error("Failed to list Cloudian group due to:", e); checkResponseTimeOut(e); } return null; }
Source:
@Override protected AbstractContinuousQuery<Integer, String> getContinuousQuery() { ContinuousQueryWithTransformer<Integer, String, String> qry = new ContinuousQueryWithTransformer<>(); Factory factory = FactoryBuilder.factoryOf( (IgniteClosure<CacheEntryEvent, String>)event -> ((String)event.getValue()) ); qry.setRemoteTransformerFactory(factory); qry.setLocalListener((evts) -> evts.forEach(e -> System.out.println("val=" + e))); return qry; }

Target:
@Override protected AbstractContinuousQuery<Integer, String> getContinuousQuery() { ContinuousQueryWithTransformer<Integer, String, String> qry = new ContinuousQueryWithTransformer<>(); Factory factory = FactoryBuilder.factoryOf( (IgniteClosure<CacheEntryEvent, String>)event -> ((String)event.getValue()) ); qry.setRemoteTransformerFactory(factory); ContinuousQueryWithTransformer.EventListener<String> lsnr = (evts) -> { for (String e : evts) updCntr.incrementAndGet(); }; qry.setLocalListener(lsnr); return qry; }
Source:
private void performDiskUpdate(final boolean unlockImage) { if (shouldPerformMetadataUpdate()) { updateMetaDataDescription((DiskImage) getNewDisk()); } final Disk disk = getDiskDao().get(getParameters().getDiskId()); applyUserChanges(disk); TransactionSupport.executeInNewTransaction(new TransactionMethod<Object>() { @Override public Object runInTransaction() { getVmStaticDAO().incrementDbGeneration(getVm().getId()); updateDeviceProperties(); getBaseDiskDao().update(disk); if (disk.getDiskStorageType() == DiskStorageType.IMAGE) { DiskImage diskImage = (DiskImage) disk; diskImage.setQuotaId(getQuotaId()); if (unlockImage && diskImage.getImageStatus() == ImageStatus.LOCKED) { diskImage.setImageStatus(ImageStatus.OK); } getImageDao().update(diskImage.getImage()); updateQuota(diskImage); updateDiskProfile(); } if (disk.getDiskStorageType() == DiskStorageType.LUN) { updateLunProperties((LunDisk)getNewDisk()); } reloadDisks(); updateBootOrder(); setSucceeded(true); return null; } private void updateDeviceProperties() { if (updateReadOnlyRequested()) { vmDeviceForVm.setIsReadOnly(getNewDisk().getReadOnly()); getVmDeviceDao().update(vmDeviceForVm); } if (getOldDisk().getDiskInterface() != getNewDisk().getDiskInterface()) { getVmDeviceDao().clearDeviceAddress(getOldDisk().getId()); } } private void updateLunProperties(LunDisk lunDisk) { vmDeviceForVm.setScsiReservationUsed(lunDisk.isUsingScsiReservation()); getVmDeviceDao().update(vmDeviceForVm); } }); }

Target:
private void performDiskUpdate(final boolean unlockImage) { if (shouldPerformMetadataUpdate()) { updateMetaDataDescription((DiskImage) getNewDisk()); } final Disk disk = getDiskDao().get(getParameters().getDiskId()); applyUserChanges(disk); TransactionSupport.executeInNewTransaction(new TransactionMethod<Object>() { @Override public Object runInTransaction() { getVmStaticDAO().incrementDbGeneration(getVm().getId()); updateDeviceProperties(); getBaseDiskDao().update(disk); if (disk.getDiskStorageType() == DiskStorageType.IMAGE) { DiskImage diskImage = (DiskImage) disk; diskImage.setQuotaId(getQuotaId()); if (unlockImage && diskImage.getImageStatus() == ImageStatus.LOCKED) { diskImage.setImageStatus(ImageStatus.OK); } getImageDao().update(diskImage.getImage()); updateQuota(diskImage); updateDiskProfile(); } else if (disk.getDiskStorageType() == DiskStorageType.LUN) { updateLunProperties((LunDisk)getNewDisk()); } else { log.error("Unexpected disk storage type ..."); } clearDeviceAddressIfNeeded(); reloadDisks(); updateBootOrder(); setSucceeded(true); return null; } private void updateDeviceProperties() { if (updateReadOnlyRequested()) { vmDeviceForVm.setIsReadOnly(getNewDisk().getReadOnly()); getVmDeviceDao().update(vmDeviceForVm); } } private void updateLunProperties(LunDisk lunDisk) { vmDeviceForVm.setUsingScsiReservation(lunDisk.isUsingScsiReservation()); getVmDeviceDao().update(vmDeviceForVm); } private void clearDeviceAddressIfNeeded() { if (getOldDisk().getDiskInterface() != getNewDisk().getDiskInterface()) { getVmDeviceDao().clearDeviceAddress(getOldDisk().getId()); } } }); }
Source:
private Integer populateBestHpMpMappings() throws SolrServerException, IOException, SQLException { Integer count = 0; String query = "SELECT 'hp_mp' AS type, hp_id, hp_term, mp_id, mp_term FROM best_impc_hp_mp_mapping "; try (Connection connection = phenodigmDataSource.getConnection(); PreparedStatement p = connection.prepareStatement(query, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY)) { p.setFetchSize(Integer.MIN_VALUE); ResultSet r = p.executeQuery(); while (r.next()) { String hpId = r.getString("hp_id"); PhenodigmDTO doc = new PhenodigmDTO(); doc.setType(r.getString("type")); doc.setHpID(hpId); doc.setHpTerm(r.getString("hp_term")); doc.setMpID(r.getString("mp_id")); doc.setMpTerm(r.getString("mp_term")); if (humanSynonymMap.containsKey(hpId)) doc.setHpSynonym(new ArrayList<>(humanSynonymMap.get(hpId))); phenodigmIndexing.addBean(doc); count++; } } return count; }

Target:
private Integer populateBestHpMpMappings() throws SolrServerException, IOException, SQLException { Integer count = 0; String query = "SELECT 'hp_mp' AS type, hp_id, hp_term, mp_id, mp_term FROM best_impc_hp_mp_mapping "; try (Connection connection = phenodigmDataSource.getConnection(); PreparedStatement p = connection.prepareStatement(query, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY)) { p.setFetchSize(Integer.MIN_VALUE); ResultSet r = p.executeQuery(); while (r.next()) { String hpId = r.getString("hp_id"); PhenodigmDTO doc = new PhenodigmDTO(); doc.setType(r.getString("type")); doc.setHpID(hpId); doc.setHpTerm(r.getString("hp_term")); doc.setMpID(r.getString("mp_id")); doc.setMpTerm(r.getString("mp_term")); if (humanSynonymMap.containsKey(hpId)) { doc.setHpSynonym(new ArrayList<>(humanSynonymMap.get(hpId))); } phenodigmIndexing.addBean(doc); count++; } } return count; }
Source:
public Result<Storage> getStorage(final String id) { final Optional<Storage> storage = storageDbRepository.getStorage(id); if (storage.isPresent()) { return Result.ok(storage.get()); } else { return Result.problem(Problem.valueOf(Response.Status.NOT_FOUND, "No storage with id " + id)); } }

Target:
public Result<Storage> getStorage(final String id) { final Optional<Storage> storage; try { storage = storageDbRepository.getStorage(id); } catch (InternalNakadiException e) { return Result.problem(Problem.valueOf(INTERNAL_SERVER_ERROR, e.getMessage())); } if (storage.isPresent()) { return Result.ok(storage.get()); } else { return Result.problem(Problem.valueOf(NOT_FOUND, "No storage with id " + id)); } }
Source:
public void star() throws IOException { final Directives gistlocation = new Directives().xpath( this.xpath() ); final Directives attributelocation = gistlocation.attr( "starred", MkGist.STARRED_VALUE ); this.storage.apply( attributelocation ); }

Target:
public void star() throws IOException { this.storage.apply( new Directives() .xpath(this.xpath()) .attr("starred", Boolean.toString(true)) ); }
Source:
public final void check(APIClient client, JmxMBeanServer server, EnumSet<RegistrationMode> mode) throws OperationsException, UnknownHostException { if (!lock.tryLock() && mode.contains(Wait)) { lock.lock(); lock.unlock(); return; } try { doCheck(client, server, mode); } finally { lock.unlock(); } }

Target:
public final void check(APIClient client, JmxMBeanServer server, EnumSet<RegistrationMode> mode) throws OperationsException, UnknownHostException { if (!lock.tryLock()) { if (mode.contains(Wait)) { lock.lock(); lock.unlock(); } return; } try { doCheck(client, server, mode); } finally { lock.unlock(); } }
Source:
public Map<ProjectRef, String> getRemoteDependencyVersionOverridesByProject( final ProjectVersionRef ref ) throws ManipulationException { final Map<ProjectRef, String> versionOverrides = new LinkedHashMap<>(); for (Map.Entry<ArtifactRef, String> entry : getRemoteDependencyVersionOverrides(ref).entrySet()) { ArtifactRef oldKey = entry.getKey(); ProjectRef newKey = new SimpleProjectRef(oldKey.getGroupId(), oldKey.getArtifactId()); versionOverrides.put(newKey, entry.getValue()); } return versionOverrides; }

Target:
public Map<ProjectRef, String> getRemoteDependencyVersionOverridesByProject( final ProjectVersionRef ref ) throws ManipulationException { Map<ArtifactRef, String> byArtifact = getRemoteDependencyVersionOverrides( ref ); return byArtifact.entrySet() .stream() .collect( Collectors.toMap( e -> e.getKey() .asProjectRef(), Map.Entry::getValue, ( key1, key2 ) -> { return key1; } ) ); }
Source:
private void bodyConsumerChunk(ChannelBuffer buffer) throws HandlerException { try { bodyConsumer.chunk(buffer, responder); } catch (Throwable t) { try { bodyConsumerError(t); } catch (Throwable t2) { exceptionHandler.handle(t2, request, responder); return; } exceptionHandler.handle(t, request, responder); } }

Target:
private void bodyConsumerChunk(ChannelBuffer buffer) throws HandlerException { try { bodyConsumer.chunk(buffer, responder); } catch (Throwable t) { try { bodyConsumerError(t); } catch (Throwable t2) { exceptionHandler.handle(t2, request, responder); LOG.debug("Handled exception thrown from handleError. original exception from chunk call was:", t); return; } exceptionHandler.handle(t, request, responder); } }
Source:
public SolenoidRetract(String name, SolenoidSubsystem system) { super(name, system, SolenoidState.REVERSE); }

Target:
public SolenoidRetract(String name, SolenoidSubsystem system) { super(name, system, SolenoidState.RETRACT); }
Source:
public ModuleMetadataResource toResource(ModuleMetadata entity) { return createResourceWithId(entity.getName(), entity); }

Target:
public ModuleMetadataResource toResource(ModuleMetadata entity) { return createResourceWithId(entity.getId(), entity); }
Source:
public Publisher<Integer> createPublisher(long elements) { return new Publisher<Integer>() { @Override public void subscribe(final Subscriber<? super Integer> s) { s.onSubscribe(new Subscription() { @Override public void request(long n) { s.onComplete(); } @Override public void cancel() { } }); } }; }

Target:
public Publisher<Integer> createPublisher(long elements) { return new AsyncIterablePublisher<Integer>(Collections.<Integer>emptyList(), ex); }
Source:
public ResponseEntity createSampleList(@PathVariable final String crop, @RequestBody final SampleListDto dto) { dto.setCropName(crop); Map<String, Object> map; try { map = this.sampleListService.createSampleList(dto); } catch (final MiddlewareException e) { final ErrorResponse response = new ErrorResponse(); if(e.getMessage().equalsIgnoreCase("List name should be unique within the same directory")){ response.addError(e.getMessage(),"ListName"); }else{ response.addError("Something went wrong, please try again"); } return new ResponseEntity<>(response, HttpStatus.CONFLICT); } return new ResponseEntity<>(map, HttpStatus.OK); }

Target:
public ResponseEntity createSampleList(@PathVariable final String crop, @RequestBody final SampleListDto dto) { dto.setCropName(crop); final Map<String, Object> map; try { map = this.sampleListService.createSampleList(dto); } catch (final MiddlewareException e) { final ErrorResponse response = new ErrorResponse(); if (e.getMessage().equalsIgnoreCase("List name should be unique within the same directory")) { response.addError(e.getMessage(), "ListName"); } else { response.addError("Something went wrong, please try again"); } return new ResponseEntity<>(response, HttpStatus.CONFLICT); } return new ResponseEntity<>(map, HttpStatus.OK); }
Source:
public void addExceptionalYield(SymbolicValue target, ProgramState exceptionalState, String exceptionFullyQualifiedName, SECheck check) { if (methodBehavior != null && methodBehavior.parameters().contains(target)) { Type exceptionType = semanticModel.getClassType(exceptionFullyQualifiedName); ProgramState newExceptionalState = exceptionalState.clearStack().stackValue(constraintManager.createExceptionalSymbolicValue(exceptionType)); ExplodedGraph.Node exitNode = explodedGraph.node(node.programPoint, newExceptionalState); MethodYield yield = methodBehavior.createExceptionalCheckBasedYield(exitNode, exceptionType, check); exitNode.addParent(node, yield); } }

Target:
public void addExceptionalYield(SymbolicValue target, ProgramState exceptionalState, String exceptionFullyQualifiedName, SECheck check) { if (methodBehavior != null && methodBehavior.parameters().contains(target)) { Type exceptionType = semanticModel.getClassType(exceptionFullyQualifiedName); ProgramState newExceptionalState = exceptionalState.clearStack().stackValue(constraintManager.createExceptionalSymbolicValue(exceptionType)); ExplodedGraph.Node exitNode = explodedGraph.node(node.programPoint, newExceptionalState); MethodYield yield = methodBehavior.createExceptionalCheckBasedYield(target, exitNode, exceptionType, check); exitNode.addParent(node, yield); } }
Source:
public String queryMaxSupportedVersion() { String version = queryNewestVersion(); String majorVersion = version.split("\\.")[0]; if (Integer.parseInt(majorVersion)>clientProperties.getMapGenerator().getMaxSupportedMajorVersion() || Integer.parseInt(majorVersion)<clientProperties.getMapGenerator().getMinSupportedMajorVersion()) { RestTemplate restTemplate = new RestTemplate(); LinkedMultiValueMap<String, String> headers = new LinkedMultiValueMap<>(); headers.add("Accept", "application/vnd.github.v3+json"); HttpEntity<String> entity = new HttpEntity<>(null, headers); ResponseEntity<String> response = restTemplate.exchange(clientProperties.getMapGenerator().getQueryVersionsUrl(), HttpMethod.GET, entity, String.class); JsonElement jsonElement = new JsonParser().parse(response.getBody()); for(JsonElement element: jsonElement.getAsJsonArray()) { JsonObject mainObject = element.getAsJsonObject(); version = mainObject.get("tag_name").getAsString(); majorVersion = version.split("\\.")[0]; if (Integer.parseInt(majorVersion)<clientProperties.getMapGenerator().getMaxSupportedMajorVersion() && Integer.parseInt(majorVersion)>clientProperties.getMapGenerator().getMinSupportedMajorVersion()) { return version; } } throw new RuntimeException("No Valid Generator Version Found"); } return version; }

Target:
public ComparableVersion queryMaxSupportedVersion() { ComparableVersion version = new ComparableVersion(""); ComparableVersion minVersion = new ComparableVersion(String.valueOf(clientProperties.getMapGenerator().getMinSupportedMajorVersion())); ComparableVersion maxVersion = new ComparableVersion(String.valueOf(clientProperties.getMapGenerator().getMaxSupportedMajorVersion() + 1)); RestTemplate restTemplate = new RestTemplate(); LinkedMultiValueMap<String, String> headers = new LinkedMultiValueMap<>(); headers.add("Accept", "application/vnd.github.v3+json"); HttpEntity<String> entity = new HttpEntity<>(null, headers); ResponseEntity<List<GithubGeneratorRelease>> response = restTemplate.exchange(clientProperties.getMapGenerator().getQueryVersionsUrl(), HttpMethod.GET, entity, new ParameterizedTypeReference<>() { }); List<GithubGeneratorRelease> releases = response.getBody(); for (GithubGeneratorRelease release : releases) { version.parseVersion(release.getTagName()); if (version.compareTo(maxVersion) < 0 && minVersion.compareTo(version) < 0) { return version; } } throw new RuntimeException("No valid generator version found"); }
Source:
public void flush() throws TTransportException { if (!isOpen()) { throw TNatsServiceTransport.getClosedConditionException(conn, "flush:"); } byte[] data = new byte[writeBuffer.position()]; writeBuffer.flip(); writeBuffer.get(data); if (data.length == 0) { return; } if (data.length + 4 > TNatsServiceTransport.NATS_MAX_MESSAGE_SIZE) { throw new FMessageSizeException(String.format( "Message exceeds %d bytes, was %d bytes", TNatsServiceTransport.NATS_MAX_MESSAGE_SIZE, data.length)); } byte[] frame = new byte[data.length + 4]; ProtocolUtils.writeInt(data.length, frame, 0); System.arraycopy(data, 0, frame, 4, data.length); try{ conn.publish(getFormattedSubject(), frame); }catch(IOException e){ LOGGER.warning("flush: unable to publish data: " + e.getMessage()); } writeBuffer.clear(); }

Target:
public void flush() throws TTransportException { if (!isOpen()) { throw TNatsServiceTransport.getClosedConditionException(conn, "flush:"); } byte[] data = new byte[writeBuffer.position()]; writeBuffer.flip(); writeBuffer.get(data); if (data.length == 0) { return; } if (data.length + 4 > TNatsServiceTransport.NATS_MAX_MESSAGE_SIZE) { throw new FMessageSizeException(String.format( "Message exceeds %d bytes, was %d bytes", TNatsServiceTransport.NATS_MAX_MESSAGE_SIZE, data.length)); } byte[] frame = new byte[data.length + 4]; ProtocolUtils.writeInt(data.length, frame, 0); System.arraycopy(data, 0, frame, 4, data.length); try { conn.publish(getFormattedSubject(), frame); } catch (IOException e) { throw new TTransportException("flush: unable to publish data: " + e.getMessage()); } writeBuffer.clear(); }
Source:
private void displayMessages(List<VerificationMessage> validationMessages) { if (!validationMessages.isEmpty()) { getLog().info("There were some issues found during the verification of your plugin. Please refer to " + HOSTING_JIRA_PROJECT + " and/or the jenkinsci-dev ML to get hel if you don't understand the following message(s)."); } for (VerificationMessage validationMessage : validationMessages) { getLog().info(validationMessage.getSeverity() + " => " + validationMessage.getMessage()); } }

Target:
private void displayMessages(List<VerificationMessage> validationMessages) { if (!validationMessages.isEmpty()) { getLog().info("There were some issues found during the verification of your plugin. Please refer to " + HOSTING_WIKI_PAGE + " and/or the jenkinsci-dev ML to get help if you don't understand the following message(s)."); } else { getLog().info("No issue found for hosting"); } for (VerificationMessage validationMessage : validationMessages) { getLog().info(validationMessage.getSeverity() + " => " + validationMessage.getMessage()); } }
Source:
private boolean match(final MethodNode methodNode, final String superClassName) { firstIsALoad0(methodNode); nextIsInvoke(Opcodes.INVOKESPECIAL, superClassName, "<init>", CONSTRUCTOR_DESC); nextIs(Opcodes.RETURN); return cursor != null; }

Target:
private boolean match(final MethodNode methodNode, final String superClassName) { firstIsALoad0(methodNode); nextIsInvoke(Opcodes.INVOKESPECIAL, superClassName, CONSTRUCTOR_NAME, CONSTRUCTOR_DESC); nextIs(Opcodes.RETURN); return cursor != null; }
Source:
public void injectRuntime(WorkspaceImpl workspace) throws ServerException { try (Unlocker ignored = lockService.writeLock(workspace.getId())) { WorkspaceStatus workspaceStatus = statuses.get(workspace.getId()); if (workspaceStatus == null) { workspace.setStatus(STOPPED); return; } try { workspace.setRuntime(asRuntime(getRuntime(workspace.getId()))); } catch (ServerException | InfrastructureException e) { workspaceStatus = STOPPED; } workspace.setStatus(workspaceStatus); } }

Target:
public void injectRuntime(WorkspaceImpl workspace) throws ServerException { try (Unlocker ignored = lockService.writeLock(workspace.getId())) { WorkspaceStatus workspaceStatus = statuses.get(workspace.getId()); if (workspaceStatus == null) { workspace.setStatus(STOPPED); return; } InternalRuntime<?> internalRuntime; try { internalRuntime = getInternalRuntime(workspace.getId()); } catch (ServerException | InfrastructureException e) { workspace.setStatus(STOPPED); return; } workspace.setRuntime(asRuntime(internalRuntime)); workspace.setStatus(workspaceStatus); } }
Source:
public CompositeMetricsCollector(MetricsCollector... collectors) { this.collectors = new ArrayList<>(asList(collectors)); }

Target:
public CompositeMetricsCollector(MetricsCollector... collectors) { this.collectors = asList(collectors); }
Source:
public JSONArray getData(String sensorID, double fromDate, String sessionID) throws IOException, JSONException { if(fromDate == 0 || sensorID == null || sensorID.isEmpty() ||sessionID == null || sessionID.isEmpty()) throw new IOException("invalid input of date or or sensorID or sessionID"); double currTime = System.currentTimeMillis() /1000; if(fromDate > currTime){ throw new IOException ("start date cannot be after current date"); } String params = "?per_page=1000&start_date=" + fromDate + "&end_date=" + currTime +"&sort=DESC"; System.out.println("prev:" + fromDate); System.out.println("curr:" + currTime); String urlAction = URL_SENSORS + "/" + sensorID + "/" + URL_DATA; return getListForURLAction(urlAction, params, "data", sessionID, 1000, "getData"); }

Target:
public JSONArray getData(String sensorID, double fromDate, String sessionID) throws IllegalArgumentException, IOException { if(fromDate == 0 || sensorID == null || sensorID.isEmpty() ||sessionID == null || sessionID.isEmpty()) throw new IllegalArgumentException("invalid input of date or or sensorID or sessionID"); SNTP sntp = new SNTP(); double currTime = sntp.getTime() /1000; if(fromDate > currTime){ throw new IllegalArgumentException ("start date cannot be after current date"); } String params = "?per_page=1000&start_date=" + fromDate + "&end_date=" + currTime +"&sort=DESC"; String urlAction = URL_SENSORS + "/" + sensorID + "/" + URL_DATA; JSONArray dataList; try { dataList = getListForURLAction(urlAction, params, "data", sessionID, 1000, "getData"); }catch(JSONException js){ throw new IOException("Failed to get the list of data from the server"); } return dataList; }
Source:
public void testPrepareView() throws Exception { model.setConditionPatterns(Collections.singletonList( new Pattern52() {{ setChildColumns(Collections.singletonList(new ConditionCol52())); }}) ); actionSetFieldsPage.prepareView(); verify(actionSetFieldsPageView).setAvailablePatterns(patternsCaptor.capture()); assertEquals(1, patternsCaptor.getValue().size()); }

Target:
public void testPrepareView() throws Exception { final Pattern52 pattern = new Pattern52() {{ setFactType("Person"); setBoundName("p"); setChildColumns(Collections.singletonList(new ConditionCol52())); }}; model.setConditionPatterns(Collections.singletonList(pattern)); actionSetFieldsPage.prepareView(); verify(actionSetFieldsPageView).setAvailablePatterns(patternsCaptor.capture()); assertEquals(1, patternsCaptor.getValue().size()); assertEquals(pattern, patternsCaptor.getValue().get(0)); }
Source:
public MarshalledEntryFactory getMarshalledEntryFactory() { throw new UnsupportedOperationException("User InitializationContext::getMarshallableEntryFactory instead"); }

Target:
public MarshalledEntryFactory getMarshalledEntryFactory() { throw new UnsupportedOperationException("Use InitializationContext::getMarshallableEntryFactory instead"); }
Source:
private Map<Pair<Guid, Guid>, Double> storageResourceMapForConsume() { Map<Pair<Guid, Guid>, Double> quotaForStorageConsumeMap = new HashMap<Pair<Guid, Guid>, Double>(); for (DiskImage diskImage : mImages) { Pair<Guid, Guid> quotaDomainKey = new Pair<Guid, Guid>(diskImage.getQuotaId(), diskImage.getstorage_id().getValue()); Double quotaConsumeValue = quotaForStorageConsumeMap.get(quotaDomainKey); if (quotaConsumeValue != null) { quotaConsumeValue += getVm().getActualDiskWithSnapshotsSize(); } else { quotaForStorageConsumeMap.put(quotaDomainKey, 0d); } } return quotaForStorageConsumeMap; }

Target:
private Map<Pair<Guid, Guid>, Double> storageResourceMapForConsume() { Map<Pair<Guid, Guid>, Double> quotaForStorageConsumeMap = new HashMap<Pair<Guid, Guid>, Double>(); for (DiskImage diskImage : mImages) { Pair<Guid, Guid> quotaDomainKey = new Pair<Guid, Guid>(diskImage.getQuotaId(), diskImage.getstorage_ids().get(0).getValue()); Double quotaConsumeValue = quotaForStorageConsumeMap.get(quotaDomainKey); if (quotaConsumeValue != null) { quotaConsumeValue += getVm().getActualDiskWithSnapshotsSize(); } else { quotaForStorageConsumeMap.put(quotaDomainKey, 0d); } } return quotaForStorageConsumeMap; }
Source:
private void notifyClient() { synchronized (instanceLock) { if (stopped) { return; } } synchronized (instanceLock) { final List<Endpoint> newEndpoints = getNewEndpoints(); final Map<String, Endpoint> newEndpointsByName = new HashMap<String, Endpoint>(); for (Endpoint endpoint : newEndpoints) { newEndpointsByName.put(getEndpointKey(endpoint), endpoint); } Iterator<Map.Entry<String, Endpoint>> it = clientPicture.entrySet().iterator(); while (it.hasNext()) { final Map.Entry<String, Endpoint> endpointEntry = it.next(); final String key = endpointEntry.getKey(); if (! newEndpointsByName.containsKey(key)) { it.remove(); clientCallback.endpointEvent( Resolver.ResolverListener.Event.REMOVED_ENDPOINT, endpointEntry.getValue()); } } for (final Endpoint endpoint : newEndpoints) { String key = getEndpointKey(endpoint); if (! clientPicture.containsKey(key)) { clientCallback.endpointEvent( Resolver.ResolverListener.Event.NEW_ENDPOINT, endpoint); clientPicture.put(key, endpoint); } else { if (! clientPicture.get(key).equals(endpoint)) { clientCallback.endpointEvent( Resolver.ResolverListener.Event.REMOVED_ENDPOINT, clientPicture.get(key)); clientCallback.endpointEvent( Resolver.ResolverListener.Event.NEW_ENDPOINT, endpoint); clientPicture.put(key, endpoint); } } } } }

Target:
private void notifyClient() { synchronized (instanceLock) { if (stopped) { return; } final List<Endpoint> newEndpoints = getNewEndpoints(); final Map<String, Endpoint> newEndpointsByName = new HashMap<String, Endpoint>(); for (final Endpoint endpoint : newEndpoints) { newEndpointsByName.put(getEndpointKey(endpoint), endpoint); } Iterator<Map.Entry<String, Endpoint>> it = clientPicture.entrySet().iterator(); while (it.hasNext()) { final Map.Entry<String, Endpoint> endpointEntry = it.next(); final String key = endpointEntry.getKey(); if (! newEndpointsByName.containsKey(key)) { it.remove(); clientCallback.endpointEvent( Resolver.ResolverListener.Event.REMOVED_ENDPOINT, endpointEntry.getValue()); } } for (final Endpoint endpoint : newEndpoints) { String key = getEndpointKey(endpoint); if (! clientPicture.containsKey(key)) { clientCallback.endpointEvent( Resolver.ResolverListener.Event.NEW_ENDPOINT, endpoint); clientPicture.put(key, endpoint); } else { if (! clientPicture.get(key).equals(endpoint)) { clientCallback.endpointEvent( Resolver.ResolverListener.Event.REMOVED_ENDPOINT, clientPicture.get(key)); clientCallback.endpointEvent( Resolver.ResolverListener.Event.NEW_ENDPOINT, endpoint); clientPicture.put(key, endpoint); } } } } }
Source:
private OnlineOptions(Data data) { if (data.protocol == null && System.getProperty(CREAPER_WILDFLY) != null) { if (data.sslOptions == null) { data.protocol = ManagementProtocol.HTTP_REMOTING; } else { data.protocol = ManagementProtocol.HTTPS_REMOTING; } } if (data.localDefault) { data.host = "localhost"; if (data.protocol == ManagementProtocol.HTTP_REMOTING || data.protocol == ManagementProtocol.HTTP) { data.port = 9990; } else if (data.protocol == ManagementProtocol.HTTPS_REMOTING || data.protocol == ManagementProtocol.HTTPS) { data.port = 9993; } else { data.port = 9999; } } this.isStandalone = data.isStandalone; this.isDomain = data.isDomain; this.defaultProfile = data.defaultProfile; this.defaultHost = data.defaultHost; this.host = data.host; this.port = data.port; this.protocol = data.protocol; this.connectionTimeout = data.connectionTimeout; this.bootTimeout = data.bootTimeout; this.username = data.username; this.password = data.password; this.localAuthDisabled = data.localAuthDisabled; this.sslOptions = data.sslOptions; this.wrappedModelControllerClient = data.wrappedModelControllerClient; this.isWrappedClient = data.wrappedModelControllerClient != null; }

Target:
private OnlineOptions(Data data) { if (data.protocol == null && System.getProperty(CREAPER_WILDFLY) != null) { if (data.sslOptions == null) { data.protocol = ManagementProtocol.HTTP_REMOTING; } else { data.protocol = ManagementProtocol.HTTPS_REMOTING; } } if (data.localDefault) { data.host = "localhost"; if (data.protocol == ManagementProtocol.HTTP_REMOTING || data.protocol == ManagementProtocol.HTTP) { data.port = 9990; } else if (data.protocol == ManagementProtocol.HTTPS_REMOTING) { data.port = 9993; } else { data.port = 9999; } } this.isStandalone = data.isStandalone; this.isDomain = data.isDomain; this.defaultProfile = data.defaultProfile; this.defaultHost = data.defaultHost; this.host = data.host; this.port = data.port; this.protocol = data.protocol; this.connectionTimeout = data.connectionTimeout; this.bootTimeout = data.bootTimeout; this.username = data.username; this.password = data.password; this.localAuthDisabled = data.localAuthDisabled; this.sslOptions = data.sslOptions; this.wrappedModelControllerClient = data.wrappedModelControllerClient; this.isWrappedClient = data.wrappedModelControllerClient != null; }
Source:
public void init(FilterConfig filterConfig) throws ServletException { showGitBlitBanner(); try { InputStream resin = getClass().getResourceAsStream(GITBLIT_GERRIT_PROPERTIES); Properties properties = null; try { properties = new Properties(); properties.load(resin); properties.put("git.repositoriesFolder", repoManager.getBasePath() .getAbsolutePath()); properties.put("realm.userService", GerritToGitBlitUserService.class.getName()); properties.put("web.otherUrls", (config.getGitHttpUrl() + " " + config.getGitSshUrl()).trim() + " " + properties.get("web.otherUrls")); } finally { resin.close(); } IStoredSettings settings = new GitBlitSettings(properties); GitBlit.self().configureContext(settings, repoManager.getBasePath(), false); GitBlit.self().contextInitialized( new ServletContextEvent(filterConfig.getServletContext())); super.init(new CustomFilterConfig(filterConfig)); } catch (Exception e) { throw new ServletException(e); } }

Target:
public void init(FilterConfig filterConfig) throws ServletException { showGitBlitBanner(); try { InputStream resin = getClass().getResourceAsStream(GITBLIT_GERRIT_PROPERTIES); Properties properties = null; try { properties = new Properties(); properties.load(resin); properties.put("git.repositoriesFolder", repoManager.getBasePath() .getAbsolutePath()); properties.put("realm.userService", GerritToGitBlitUserService.class.getName()); if (properties.get("web.otherUrls") != null) { properties.put("web.otherUrls", (config.getGitHttpUrl() + " " + config.getGitSshUrl()).trim() + " " + properties.get("web.otherUrls")); } else { properties.put("web.otherUrls", (config.getGitHttpUrl() + " " + config.getGitSshUrl()).trim()); } } finally { resin.close(); } IStoredSettings settings = new GitBlitSettings(properties); GitBlit.self().configureContext(settings, repoManager.getBasePath(), false); GitBlit.self().contextInitialized( new ServletContextEvent(filterConfig.getServletContext())); super.init(new CustomFilterConfig(filterConfig)); } catch (Exception e) { throw new ServletException(e); } }
Source:
public static boolean isJSONValid(String jsonInString) { JsonParser parser = new JsonParser(); try { parser.parse(jsonInString); return true; } catch (com.google.gson.JsonSyntaxException ex) { return false; } }

Target:
public static boolean isJSONValid(String jsonInString) { try { JSON_PARSER.parse(jsonInString); return true; } catch (JsonSyntaxException ex) { return false; } }
Source:
public void beforeChannel(@NonNull JnlpConnectionState event) { DefaultJnlpSlaveReceiver.State state = event.getStash(DefaultJnlpSlaveReceiver.State.class); final SlaveComputer computer = state.getNode(); final OutputStream log = computer.openLogFile(); state.setLog(log); try (PrintWriter logw = new PrintWriter(log, true)) { logw.println("Inbound agent connected from " + event.getSocket().getInetAddress()); } for (ChannelConfigurator cc : ChannelConfigurator.all()) { cc.onChannelBuilding(event.getChannelBuilder(), computer); } event.getChannelBuilder().withHeaderStream(log); String cookie = event.getProperty(JnlpConnectionState.COOKIE_KEY); if (cookie != null) { event.getChannelBuilder().withProperty(COOKIE_NAME, cookie); } }

Target:
public void beforeChannel(@NonNull JnlpConnectionState event) { DefaultJnlpSlaveReceiver.State state = event.getStash(DefaultJnlpSlaveReceiver.State.class); final SlaveComputer computer = state.getNode(); final OutputStream log = computer.openLogFile(); state.setLog(log); PrintWriter logw = new PrintWriter(log, true); logw.println("Inbound agent connected from " + event.getSocket().getInetAddress()); for (ChannelConfigurator cc : ChannelConfigurator.all()) { cc.onChannelBuilding(event.getChannelBuilder(), computer); } event.getChannelBuilder().withHeaderStream(log); String cookie = event.getProperty(JnlpConnectionState.COOKIE_KEY); if (cookie != null) { event.getChannelBuilder().withProperty(COOKIE_NAME, cookie); } }