auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public SimpleVersionedSerializer<List<MockSourceSplit>> getEnumeratorCheckpointSerializer() { return new SimpleVersionedSerializer<List<MockSourceSplit>>() { @Override public int getVersion() { return 0; } @Override public byte[] serialize(List<MockSourceSplit> obj) throws IOException { return InstantiationUtil.serializeObject(obj.toArray()); } @Override public List<MockSourceSplit> deserialize(int version, byte[] serialized) throws IOException { MockSourceSplit[] splitArray; try { splitArray = InstantiationUtil.deserializeObject(serialized, getClass().getClassLoader()); } catch (ClassNotFoundException e) { throw new RuntimeException("Failed to deserialize the source split."); } return new ArrayList<>(Arrays.asList(splitArray)); } }; }

Target:
public SimpleVersionedSerializer<List<MockSourceSplit>> getEnumeratorCheckpointSerializer() { return new SimpleVersionedSerializer<List<MockSourceSplit>>() { @Override public int getVersion() { return 0; } @Override public byte[] serialize(List<MockSourceSplit> obj) throws IOException { return InstantiationUtil.serializeObject(obj.toArray()); } @Override public List<MockSourceSplit> deserialize(int version, byte[] serialized) throws IOException { MockSourceSplit[] splitArray; try { splitArray = InstantiationUtil.deserializeObject(serialized, getClass().getClassLoader()); } catch (ClassNotFoundException e) { throw new IOException("Failed to deserialize the source split."); } return new ArrayList<>(Arrays.asList(splitArray)); } }; }
Source:
private static Method getMethod(@Nonnull Class clazz, @Nonnull String methodName, @Nonnull Class... types) throws NoSuchMethodException { Method res = null; try { res = clazz.getDeclaredMethod(methodName, types); } catch (NoSuchMethodException e) { Class superclass = clazz.getSuperclass(); if (superclass != null) { res = getMethod(superclass, methodName, types); } } catch (SecurityException e) { throw new AssertionError(e); } if (res == null) { throw new NoSuchMethodException("Method " + methodName + " not found in " + clazz.getName()); } return res; }

Target:
private static Method getMethod(@Nonnull Class clazz, @Nonnull String methodName, @Nonnull Class... types) { Method res = null; try { res = clazz.getDeclaredMethod(methodName, types); if (res != null && (Modifier.isPrivate(res.getModifiers()) || Modifier.isFinal(res.getModifiers()) || Modifier.isStatic(res.getModifiers()))) { res = null; } } catch (NoSuchMethodException e) { Class superclass = clazz.getSuperclass(); if (superclass != null) { res = getMethod(superclass, methodName, types); } } catch (SecurityException e) { throw new AssertionError(e); } if (res == null) { throw new IllegalArgumentException( String.format("Method %s not found in %s (or it is private, final or static)", methodName, clazz.getName())); } return res; }
Source:
public void testRoundTrip() throws IOException, StructureException { Structure structure = StructureIO.getStructure("4CUP"); AdapterToStructureData writerToEncoder = new AdapterToStructureData(); new MmtfStructureWriter(structure, writerToEncoder); MmtfStructureReader mmtfStructureReader = new MmtfStructureReader(); new StructureDataToAdapter(writerToEncoder, mmtfStructureReader); mmtfStructureReader.getStructure(); }

Target:
public void testRoundTrip() throws IOException, StructureException { Structure structure = StructureIO.getStructure("4CUP"); AdapterToStructureData writerToEncoder = new AdapterToStructureData(); new MmtfStructureWriter(structure, writerToEncoder); MmtfStructureReader mmtfStructureReader = new MmtfStructureReader(); new StructureDataToAdapter(writerToEncoder, mmtfStructureReader); assertTrue(checkIfAtomsSame(structure,mmtfStructureReader.getStructure())); }
Source:
private synchronized void ackImpl(long uso, Exception ackCallStack) { if (uso == Long.MIN_VALUE && m_onDrain != null) { if (!m_isInContinueingGeneration) m_drained = true; m_drainTraceForDebug = new Exception("Acking USO " + uso, ackCallStack); m_onDrain.run(); return; } if (uso > 0) { try { releaseExportBytes(uso); } catch (IOException e) { VoltDB.crashLocalVoltDB("Error attempting to release export bytes", true, e); return; } } }

Target:
private synchronized void ackImpl(long uso, Exception ackCallStack) { if (uso == Long.MIN_VALUE && m_onDrain != null) { m_drained = true; m_drainTraceForDebug = new Exception("Acking USO " + uso, ackCallStack); m_onDrain.run(); return; } if (uso > 0) { try { releaseExportBytes(uso); } catch (IOException e) { VoltDB.crashLocalVoltDB("Error attempting to release export bytes", true, e); return; } } }
Source:
protected void initExecutorService () { BlockingQueue bqueue; if (sessions == maxSessions) bqueue = new SynchronousQueue(); else bqueue = new LinkedBlockingQueue(); es = new ThreadPoolExecutor(maxSessions, Integer.MAX_VALUE, sessionIdle ,TimeUnit.SECONDS, bqueue, new TMThreadFactory(getName(),getLog())); es.allowCoreThreadTimeOut(true); }

Target:
protected void initExecutorService () { BlockingQueue bqueue; String strategy = cfg.get("queuing-strategy", "unbound"); if (strategy.equals("direct-hand-off")) bqueue = new SynchronousQueue(); else bqueue = new LinkedBlockingQueue(); es = new ThreadPoolExecutor(maxSessions, Integer.MAX_VALUE, sessionIdle ,TimeUnit.SECONDS, bqueue, new TMThreadFactory(getName(),getLog())); es.allowCoreThreadTimeOut(true); }
Source:
public KafkaManager(final LoggerContext loggerContext, final String name, final String topic, final boolean syncSend, final Property[] properties, final String key) { super(loggerContext, name); this.topic = Objects.requireNonNull(topic, "topic"); this.syncSend = syncSend; config.setProperty("key.serializer", "org.apache.kafka.common.serialization.ByteArraySerializer"); config.setProperty("value.serializer", "org.apache.kafka.common.serialization.ByteArraySerializer"); config.setProperty("batch.size", "0"); for (final Property property : properties) { config.setProperty(property.getName(), property.getValue()); } this.key = (key != null ) ? key.getBytes() : null ; this.timeoutMillis = Integer.parseInt(config.getProperty("timeout.ms", DEFAULT_TIMEOUT_MILLIS)); }

Target:
public KafkaManager(final LoggerContext loggerContext, final String name, final String topic, final boolean syncSend, final Property[] properties, final String key) { super(loggerContext, name); this.topic = Objects.requireNonNull(topic, "topic"); this.syncSend = syncSend; config.setProperty("key.serializer", "org.apache.kafka.common.serialization.ByteArraySerializer"); config.setProperty("value.serializer", "org.apache.kafka.common.serialization.ByteArraySerializer"); config.setProperty("batch.size", "0"); for (final Property property : properties) { config.setProperty(property.getName(), property.getValue()); } this.key = (key != null ) ? key.getBytes(StandardCharsets.UTF_8) : null ; this.timeoutMillis = Integer.parseInt(config.getProperty("timeout.ms", DEFAULT_TIMEOUT_MILLIS)); }
Source:
public LocalDate randomDate() { return LocalDate.ofEpochDay( nextLong( (-999_999_999L - 1970) * 365, (999_999_999L - 1970) * 365) ); }

Target:
public LocalDate randomDate() { return LocalDate.ofEpochDay( nextLong( LocalDate.MIN.toEpochDay(), LocalDate.MAX.toEpochDay() ) ); }
Source:
public void setCredentialsProvider(CredentialsProvider credentialsProvider) { this.credentialsProvider = credentialsProvider; }

Target:
public PullCommand setCredentialsProvider( CredentialsProvider credentialsProvider) { checkCallable(); this.credentialsProvider = credentialsProvider; return this; }
Source:
private Registration getAndSetRegistration(final HttpServletRequest request) { final Registration registration = FenixFramework.getDomainObject(request.getParameter("registrationOID")); if (!getUserView(request).getPerson().getStudent().getAllRegistrations().contains(registration)) { return null; } request.setAttribute("registration", registration); request.setAttribute("registrationOID", registration.getExternalId().toString()); return registration; }

Target:
private Registration getAndSetRegistration(final HttpServletRequest request) { final Registration registration = FenixFramework.getDomainObject(request.getParameter("registrationOID")); if (!getUserView(request).getPerson().getStudent().getRegistrationStream().anyMatch(r -> r.equals(registration))) { return null; } request.setAttribute("registration", registration); request.setAttribute("registrationOID", registration.getExternalId().toString()); return registration; }
Source:
public DlmsConnectionHolder getConnection(final DlmsDevice device, final DlmsMessageListener dlmsMessageListener) throws TechnicalException { DlmsConnector connector; if (device.isHls5Active()) { connector = this.hls5ConnectorProvider.get(); } else if (device.isLls1Active()) { connector = this.lls1ConnectorProvider.get(); } else if (device.communicateUnencrypted()) { connector = this.publicConnectorProvider.get(); } else { throw new UnsupportedOperationException( "Only HLS 5, LLS 1 and public (LLS 0) connections are currently supported"); } final DlmsConnectionHolder holder = new DlmsConnectionHolder(connector, device, dlmsMessageListener); holder.connect(); return holder; }

Target:
public DlmsConnectionHolder getConnection(final DlmsDevice device, final DlmsMessageListener dlmsMessageListener) throws TechnicalException { DlmsConnector connector; if (device.isHls5Active()) { connector = this.hls5ConnectorProvider.get(); } else if (device.isLls1Active()) { connector = this.lls1ConnectorProvider.get(); } else if (device.communicateUnencrypted()) { connector = this.lls0ConnectorProvider.get(); } else { throw new UnsupportedOperationException( "Only HLS 5, LLS 1 and public (LLS 0) connections are currently supported"); } final DlmsConnectionHolder holder = new DlmsConnectionHolder(connector, device, dlmsMessageListener); holder.connect(); return holder; }
Source:
public ActivityStarterHolder onCreateViewHolder(ViewGroup parent, int viewType) { View itemView = LayoutInflater.from(parent.getContext()) .inflate(R.layout.activity_chooser_item, parent, false); int marginsInPx = (int) TypedValue.applyDimension( TypedValue.COMPLEX_UNIT_DIP, 8, parent.getResources().getDisplayMetrics()); RelativeLayout.LayoutParams text1Params = (RelativeLayout.LayoutParams) itemView.findViewById(android.R.id.text1) .getLayoutParams(); RelativeLayout.LayoutParams text2Params = (RelativeLayout.LayoutParams) itemView.findViewById(android.R.id.text2) .getLayoutParams(); text1Params.topMargin = marginsInPx; text2Params.bottomMargin = marginsInPx; return new ActivityStarterHolder(itemView); }

Target:
public ActivityStarterHolder onCreateViewHolder(ViewGroup parent, int viewType) { return new ActivityStarterHolder( LayoutInflater.from(parent.getContext()) .inflate(R.layout.activity_chooser_item, parent, false)); }
Source:
protected void initVNumaNodes() { unassignedVNodeModelList = new ArrayList<VNodeModel>(); p2vNumaNodesMap = new HashMap<Integer, List<VNodeModel>>(); final Set<Integer> hostIndizes = new HashSet<>(); for (VdsNumaNode numaNode : numaNodeList){ hostIndizes.add(numaNode.getIndex()); } for (final VM vm : getVmsWithvNumaNodeList()) { if (vm.getvNumaNodeList() != null) { for (VmNumaNode vmNumaNode : vm.getvNumaNodeList()) { VNodeModel vNodeModel = new VNodeModel(this, vm, vmNumaNode, false); if (vmNumaNode.getVdsNumaNodeList() != null && !vmNumaNode.getVdsNumaNodeList().isEmpty()) { for (Pair<Guid, Pair<Boolean, Integer>> pair : vmNumaNode.getVdsNumaNodeList()) { Integer hostIndex = pair.getSecond().getSecond(); if (pair.getSecond().getFirst()) { if (!hostIndizes.contains(hostIndex)) { vNodeModel.setPinned(false); break; } else { vNodeModel.setPinned(true); assignVNumaToPhysicalNuma(vNodeModel, hostIndex); break; } } } } if (!vNodeModel.isPinned()){ unassignedVNodeModelList.add(vNodeModel); if (vmNumaNode.getVdsNumaNodeList() != null) { vmNumaNode.getVdsNumaNodeList().clear(); } } } } } }

Target:
protected void initVNumaNodes() { unassignedVNodeModelList = new ArrayList<VNodeModel>(); p2vNumaNodesMap = new HashMap<Integer, List<VNodeModel>>(); final Set<Integer> hostIndices = new HashSet<>(); for (VdsNumaNode numaNode : numaNodeList){ hostIndices.add(numaNode.getIndex()); } for (final VM vm : getVmsWithvNumaNodeList()) { if (vm.getvNumaNodeList() != null) { for (VmNumaNode vmNumaNode : vm.getvNumaNodeList()) { VNodeModel vNodeModel = new VNodeModel(this, vm, vmNumaNode, false); if (vmNumaNode.getVdsNumaNodeList() != null && !vmNumaNode.getVdsNumaNodeList().isEmpty()) { for (Pair<Guid, Pair<Boolean, Integer>> pair : vmNumaNode.getVdsNumaNodeList()) { Integer hostIndex = pair.getSecond().getSecond(); boolean pinned = pair.getSecond().getFirst(); if (pinned) { if (!hostIndices.contains(hostIndex)) { vNodeModel.setPinned(false); } else { vNodeModel.setPinned(true); assignVNumaToPhysicalNuma(vNodeModel, hostIndex); } break; } } } if (!vNodeModel.isPinned()){ unassignedVNodeModelList.add(vNodeModel); if (vmNumaNode.getVdsNumaNodeList() != null) { vmNumaNode.getVdsNumaNodeList().clear(); } } } } } }
Source:
public DirectoryProposalAutoCompleteField(Control control, IControlContentAdapter controlContentAdapter) { proposalProvider = new FileNameSubstringMatchContentProposalProvider(); KeyStroke triggeringKeyStroke = safeKeyStroke("Ctrl+Space"); char[] autoactivationChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\b\u007F" .toCharArray(); adapter = new ReopenableContentProposalAdapter(control, controlContentAdapter, proposalProvider, triggeringKeyStroke, autoactivationChars); adapter.setPropagateKeys(true); adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE); }

Target:
public DirectoryProposalAutoCompleteField(Control control, IControlContentAdapter controlContentAdapter) { proposalProvider = new FileNameSubstringMatchContentProposalProvider(); KeyStroke triggeringKeyStroke = safeKeyStroke("Ctrl+Space"); String backspace = "\b"; String delete = "\u007F"; char[] autoactivationChars = ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" + backspace + delete).toCharArray(); adapter = new ReopenableContentProposalAdapter(control, controlContentAdapter, proposalProvider, triggeringKeyStroke, autoactivationChars); adapter.setPropagateKeys(true); adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE); }
Source:
public ResponseEntity<?> listSubscriptions( @Nullable @RequestParam(value = "owning_application", required = false) final String owningApplication, @Nullable @RequestParam(value = "event_type", required = false) final Set<String> eventTypes, @RequestParam(value = "show_status", required = false, defaultValue = "false") final boolean showStatus, @RequestParam(value = "limit", required = false, defaultValue = "20") final int limit, @RequestParam(value = "offset", required = false, defaultValue = "0") final int offset, final NativeWebRequest request) { return status(OK) .body(subscriptionService .listSubscriptions(owningApplication, eventTypes, showStatus, limit, offset)); }

Target:
public ResponseEntity<?> listSubscriptions( @Nullable @RequestParam(value = "owning_application", required = false) final String owningApplication, @Nullable @RequestParam(value = "event_type", required = false) final Set<String> eventTypes, @RequestParam(value = "show_status", required = false, defaultValue = "false") final boolean showStatus, @RequestParam(value = "limit", required = false, defaultValue = "20") final int limit, @RequestParam(value = "offset", required = false, defaultValue = "0") final int offset, final NativeWebRequest request) throws InvalidLimitException, ServiceTemporarilyUnavailableException { return status(OK) .body(subscriptionService .listSubscriptions(owningApplication, eventTypes, showStatus, limit, offset)); }
Source:
void registerReceiverIfRequired() { if (!receiverRegistered) { networkBroadcastReceiver = new NetworkBroadcastReceiver(); IntentFilter filter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION); context.registerReceiver(networkBroadcastReceiver, filter); receiverRegistered = true; LogUtil.log(TAG, "Registered network broadcast receiver {}" + this); } }

Target:
void registerReceiverIfRequired() { if (null == networkBroadcastReceiver) { networkBroadcastReceiver = new NetworkBroadcastReceiver(); IntentFilter filter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION); context.registerReceiver(networkBroadcastReceiver, filter); LogUtil.log(TAG, "Registered network broadcast receiver {}" + this); } }
Source:
public void exampleShouldBeTheStored() { String csv = "name,lastname,age\n" + "alejo,abdala,25\n" + "pablo,cabrera,27\n"; DefaultCSVMetaDataBuilder builder = new DefaultCSVMetaDataBuilder(); CSVMetaDataModel model = builder.setDelimiter(",").setExample(csv).addField("name", DataType.STRING).addField("lastname", DataType.STRING).addField("age", DataType.DECIMAL).build(); Assert.assertThat(model, CoreMatchers.notNullValue()); Assert.assertThat(model.getDelimiter(), CoreMatchers.is(",")); Assert.assertThat(model.getFields().size(), CoreMatchers.is(3)); Assert.assertThat(model.getExample(), CoreMatchers.is(csv)); }

Target:
public void exampleShouldBeTheStored() { String csv = "name,lastname,age\n" + "alejo,abdala,25\n" + "pablo,cabrera,27\n"; DefaultCSVMetaDataBuilder builder = new DefaultCSVMetaDataBuilder(); CSVMetaDataModel model = builder.setDelimiter(COMMA_DELIMITER).setExample(csv).addField(FIELD_NAME, DataType.STRING).addField(FIELD_LAST_NAME, DataType.STRING).addField(FIELD_AGE, DataType.DECIMAL).build(); assertThat(model, notNullValue()); assertThat(model.getDelimiter(), is(COMMA_DELIMITER)); assertThat(model.getFields(), hasSize(3)); assertThat(model.getExample(), is(csv)); }
Source:
void checkUsages() { for (Map.Entry<Symbol.TypeSymbol, Multiset<Symbol>> usageByInnerClassEntry : usagesByInnerClass.entrySet()) { final Multiset<Symbol> innerClassUsages = usageByInnerClassEntry.getValue(); for (Symbol methodUsed : innerClassUsages.elementSet()) { final boolean matchArity = unknownInvocations.get(methodUsed.name()) .stream() .anyMatch(mit -> hasSameArity((Symbol.MethodSymbol) methodUsed, mit)); if (!matchArity && methodUsed.usages().size() == innerClassUsages.count(methodUsed)) { reportIssueOnMethod((MethodTree) methodUsed.declaration(), usageByInnerClassEntry.getKey()); } } } }

Target:
void checkUsages() { for (Map.Entry<Symbol.TypeSymbol, Multiset<Symbol>> usageByInnerClassEntry : usagesByInnerClass.entrySet()) { Multiset<Symbol> innerClassUsages = usageByInnerClassEntry.getValue(); for (Symbol methodUsed : innerClassUsages.elementSet()) { boolean matchArity = unknownInvocations.get(methodUsed.name()) .stream() .anyMatch(mit -> hasSameArity((Symbol.MethodSymbol) methodUsed, mit)); if (!matchArity && methodUsed.usages().size() == innerClassUsages.count(methodUsed)) { reportIssueOnMethod((MethodTree) methodUsed.declaration(), usageByInnerClassEntry.getKey()); } } } }
Source:
public void testEnumConverter() throws Exception { NsObjectInputTransducer transducer = new NsObjectInputTransducer(clientService, schema, typeDesc.getTypeName()); FieldDesc fieldDesc = typeDesc.getField("acctType"); AvroConverter<Enum<AccountType>, String> converter1 = (AvroConverter<Enum<AccountType>, String>) transducer.getValueConverter(fieldDesc); assertEquals(AvroUtils._string(), converter1.getSchema()); assertEquals(AccountType.class, converter1.getDatumClass()); Assert.assertEquals(AccountType.ACCOUNTS_PAYABLE.value(), converter1.convertToAvro(AccountType.ACCOUNTS_PAYABLE)); Assert.assertEquals(AccountType.ACCOUNTS_PAYABLE, converter1.convertToDatum(AccountType.ACCOUNTS_PAYABLE.value())); Assert.assertEquals(AccountType.ACCOUNTS_PAYABLE, converter1.convertToDatum(AccountType.ACCOUNTS_PAYABLE.name())); fieldDesc = typeDesc.getField("generalRate"); assertNotNull(fieldDesc); AvroConverter<Enum<ConsolidatedRate>, String> converter2 = (AvroConverter<Enum<ConsolidatedRate>, String>) transducer.getValueConverter(fieldDesc); Assert.assertEquals(ConsolidatedRate.HISTORICAL.value(), converter2.convertToAvro(ConsolidatedRate.HISTORICAL)); Assert.assertEquals(ConsolidatedRate.HISTORICAL, converter2.convertToDatum(ConsolidatedRate.HISTORICAL.value())); }

Target:
public void testEnumConverter() throws Exception { NsObjectInputTransducer transducer = new NsObjectInputTransducer(clientService, schema, typeDesc.getTypeName()); FieldDesc fieldDesc = typeDesc.getField("acctType"); AvroConverter<Enum<AccountType>, String> converter1 = (AvroConverter<Enum<AccountType>, String>) transducer.getValueConverter(fieldDesc); assertEquals(AvroUtils._string(), converter1.getSchema()); assertEquals(AccountType.class, converter1.getDatumClass()); assertEquals(AccountType.ACCOUNTS_PAYABLE.value(), converter1.convertToAvro(AccountType.ACCOUNTS_PAYABLE)); assertEquals(AccountType.ACCOUNTS_PAYABLE, converter1.convertToDatum(AccountType.ACCOUNTS_PAYABLE.value())); assertEquals(AccountType.ACCOUNTS_PAYABLE, converter1.convertToDatum(AccountType.ACCOUNTS_PAYABLE.name())); fieldDesc = typeDesc.getField("generalRate"); assertNotNull(fieldDesc); AvroConverter<Enum<ConsolidatedRate>, String> converter2 = (AvroConverter<Enum<ConsolidatedRate>, String>) transducer.getValueConverter(fieldDesc); assertEquals(ConsolidatedRate.HISTORICAL.value(), converter2.convertToAvro(ConsolidatedRate.HISTORICAL)); assertEquals(ConsolidatedRate.HISTORICAL, converter2.convertToDatum(ConsolidatedRate.HISTORICAL.value())); }
Source:
private void startGeoRepSession() { GlusterGeoRepSession selectedSession = (GlusterGeoRepSession) getSelectedItem(); if (selectedSession == null) { return; } GlusterVolumeGeoRepActionConfirmationModel cModel = new GlusterVolumeGeoRepActionConfirmationModel(); cModel.setTitle(constants.geoReplicationStartTitle()); cModel.setHelpTag(HelpTag.volume_geo_rep_start_confirmation); cModel.setHashName("volume_geo_rep_start_confirmation"); cModel.setMessage(constants.geoRepStartConfirmation()); cModel.setForceLabel(constants.geoRepStartForce()); cModel.getMasterVolume().setEntity(selectedSession.getMasterVolumeName() == null ? constants.notAvailableLabel() : selectedSession.getMasterVolumeName()); cModel.getSlaveVolume().setEntity(selectedSession.getSlaveVolumeName()); cModel.getSlaveHost().setEntity(selectedSession.getSlaveHostName()); UICommand okCommand = new UICommand("onStartGeoRepSession", this); okCommand.setTitle(constants.ok()); okCommand.setIsDefault(true); cModel.getCommands().add(okCommand); UICommand cancelCommand = new UICommand("closeWindow", this); cancelCommand.setTitle(constants.cancel()); cancelCommand.setIsCancel(true); cModel.getCommands().add(cancelCommand); setWindow(cModel); }

Target:
private void startGeoRepSession() { GlusterGeoRepSession selectedSession = (GlusterGeoRepSession) getSelectedItem(); if (selectedSession == null) { return; } GlusterVolumeGeoRepActionConfirmationModel cModel = new GlusterVolumeGeoRepActionConfirmationModel(); cModel.setTitle(constants.geoReplicationStartTitle()); cModel.setHelpTag(HelpTag.volume_geo_rep_start_confirmation); cModel.setHashName("volume_geo_rep_start_confirmation"); setWindow(cModel); cModel.initWindow(selectedSession); cModel.setForceHelp(constants.geoRepForceStartHelp()); cModel.setForceLabel(constants.geoRepStartForce()); UICommand okCommand = new UICommand("onStartGeoRepSession", this); okCommand.setTitle(constants.ok()); okCommand.setIsDefault(true); cModel.getCommands().add(okCommand); UICommand cancelCommand = new UICommand("closeWindow", this); cancelCommand.setTitle(constants.cancel()); cancelCommand.setIsCancel(true); cModel.getCommands().add(cancelCommand); }
Source:
private void launchModuleWithDependencies(String module, String[] args, String[] includes, String[] excludes) { try { Resource[] libraries = this.moduleResolver.resolve( new Coordinates[]{toCoordinates(module, DEFAULT_MODULE_CLASSIFIER)}, toCoordinateArray(includes), excludes); List<Archive> archives = new ArrayList<>(); for (Resource library : libraries) { archives.add(new JarFileArchive(library.getFile())); } MultiArchiveLauncher jarLauncher = new MultiArchiveLauncher(archives); jarLauncher.launch(args); } catch (IOException e) { throw new RuntimeException("failed to launch module: " + module, e); } }

Target:
private void launchModuleWithDependencies(String module, String[] args, String[] includes, String[] excludes) { try { Resource[] libraries = this.moduleResolver.resolve(toCoordinates(module, DEFAULT_MODULE_CLASSIFIER), toCoordinateArray(includes), excludes); List<Archive> archives = new ArrayList<>(); for (Resource library : libraries) { archives.add(new JarFileArchive(library.getFile())); } MultiArchiveLauncher jarLauncher = new MultiArchiveLauncher(archives); jarLauncher.launch(args); } catch (IOException e) { throw new RuntimeException("failed to launch module: " + module, e); } }
Source:
public ProviderSqlSource(Configuration configuration, Object provider, Class<?> mapperType, Method mapperMethod) { this(configuration, provider, mapperType, mapperMethod, new XMLLanguageDriver()); }

Target:
public ProviderSqlSource(Configuration configuration, Object provider, Class<?> mapperType, Method mapperMethod) { this(configuration, provider, mapperType, mapperMethod, configuration.getDefaultScriptingLanguageInstance()); }
Source:
private ValidationResult hostStatusValid() { VDSStatus hostStatus = getVds().getStatus(); if (hostStatus != VDSStatus.Maintenance && hostStatus != VDSStatus.Up) { addCanDoActionMessage(VdcBllMessages.VAR__HOST_STATUS__UP_OR_MAINTENANCE); return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_VDS_STATUS_ILLEGAL); } return ValidationResult.VALID; }

Target:
private ValidationResult hostStatusValid() { VDSStatus hostStatus = getVds().getStatus(); if (hostStatus != VDSStatus.Maintenance && hostStatus != VDSStatus.Up) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_VDS_STATUS_ILLEGAL, VdcBllMessages.VAR__HOST_STATUS__UP_OR_MAINTENANCE.name()); } return ValidationResult.VALID; }
Source:
public static AtsConfigurations getConfigurations() { AtsConfigurations configs = null; String appServer = OseeClientProperties.getApplicationServerAddress(); URI serverUri = URI.create(appServer); URI uri = UriBuilder.fromUri(serverUri).path("ats/config").build(); WebResource resource = WebClientProviderService.getProvider().createResource(uri); try { String jsonStr = resource.accept(MediaType.APPLICATION_JSON).get(String.class); configs = gson.fromJson(jsonStr, AtsConfigurations.class); } catch (UniformInterfaceException ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } return configs; }

Target:
public static AtsConfigurations getConfigurations() { AtsConfigurations configs = null; String appServer = OseeClientProperties.getApplicationServerAddress(); URI uri = UriBuilder.fromUri(appServer).path("ats").path("config").build(); WebResource resource = WebClientProviderService.getProvider().createResource(uri); try { String jsonStr = resource.accept(MediaType.APPLICATION_JSON).get(String.class); configs = gson.fromJson(jsonStr, AtsConfigurations.class); } catch (UniformInterfaceException ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } return configs; }
Source:
public SSHConnector(int port, StandardUsernameCredentials credentials, String username, String password, String privatekey, String jvmOptions, String javaPath, JDKInstaller jdkInstaller, String prefixStartSlaveCmd, String suffixStartSlaveCmd, Integer launchTimeoutSeconds, Integer maxNumRetries, Integer retryWaitTime) { this.jvmOptions = jvmOptions; this.port = port == 0 ? 22 : port; this.credentials = credentials; this.credentialsId = credentials == null ? null : this.credentials.getId(); this.username = username; this.password = Secret.fromString(fixEmpty(password)); this.privatekey = privatekey; this.javaPath = javaPath; this.jdkInstaller = jdkInstaller; this.prefixStartSlaveCmd = fixEmpty(prefixStartSlaveCmd); this.suffixStartSlaveCmd = fixEmpty(suffixStartSlaveCmd); this.launchTimeoutSeconds = launchTimeoutSeconds == null || launchTimeoutSeconds <= 0 ? null : launchTimeoutSeconds; final Integer zero = 0; this.maxNumRetries = maxNumRetries == null || maxNumRetries <= 0 ? zero : maxNumRetries; this.retryWaitTime = retryWaitTime == null || retryWaitTime <= 0 ? zero : retryWaitTime; }

Target:
public SSHConnector(int port, StandardUsernameCredentials credentials, String username, String password, String privatekey, String jvmOptions, String javaPath, JDKInstaller jdkInstaller, String prefixStartSlaveCmd, String suffixStartSlaveCmd, Integer launchTimeoutSeconds, Integer maxNumRetries, Integer retryWaitTime) { this.jvmOptions = jvmOptions; this.port = port == 0 ? 22 : port; this.credentials = credentials; this.credentialsId = credentials == null ? null : this.credentials.getId(); this.username = username; this.password = Secret.fromString(fixEmpty(password)); this.privatekey = privatekey; this.javaPath = javaPath; this.jdkInstaller = jdkInstaller; this.prefixStartSlaveCmd = fixEmpty(prefixStartSlaveCmd); this.suffixStartSlaveCmd = fixEmpty(suffixStartSlaveCmd); this.launchTimeoutSeconds = launchTimeoutSeconds == null || launchTimeoutSeconds <= 0 ? null : launchTimeoutSeconds; this.maxNumRetries = maxNumRetries != null && maxNumRetries > 0 ? maxNumRetries : 0; this.retryWaitTime = retryWaitTime != null && retryWaitTime > 0 ? retryWaitTime : 0; }
Source:
static void downloadJobResult(TDJobOperator j, Workspace workspace, Optional<String> downloadFile, Config state) { if (!downloadFile.isPresent()) { return; } Config downloadState = state.getNestedOrSetEmpty(DOWNLOAD); boolean done = downloadState.get(DONE, boolean.class, false); if (done) { return; } try { j.getResult(ite -> { try (BufferedWriter out = workspace.newBufferedWriter(downloadFile.get(), UTF_8)) { addCsvHeader(out, j.getResultColumnNames()); while (ite.hasNext()) { addCsvRow(out, ite.next().asArrayValue()); } downloadState.set(DONE, true); return true; } catch (IOException ex) { throw new UncheckedIOException(ex); } }); } catch (UncheckedIOException | TDClientException e) { if (isDeterministicClientException(e)) { throw new TaskExecutionException(e, TaskExecutionException.buildExceptionErrorConfig(e)); } int retry = downloadState.get(RETRY, int.class, 0); downloadState.set(RETRY, retry + 1); int interval = (int) Math.min(INITIAL_DOWNLOAD_RETRY_INTERVAL * Math.pow(2, retry), MAX_DOWNLOAD_RETRY_INTERVAL); logger.warn("Failed to download result of job '{}', retrying in seconds", j.getJobId(), interval, e); throw TaskExecutionException.ofNextPolling(interval, ConfigElement.copyOf(state)); } }

Target:
static void downloadJobResult(TDJobOperator j, Workspace workspace, Optional<String> downloadFile, Config state) { if (!downloadFile.isPresent()) { return; } Config downloadState = state.getNestedOrSetEmpty(DOWNLOAD); boolean done = downloadState.get(DONE, boolean.class, false); if (done) { return; } try { j.getResult(ite -> { try (BufferedWriter out = workspace.newBufferedWriter(downloadFile.get(), UTF_8)) { addCsvHeader(out, j.getResultColumnNames()); while (ite.hasNext()) { addCsvRow(out, ite.next().asArrayValue()); } downloadState.remove(RETRY); downloadState.set(DONE, true); return true; } catch (IOException ex) { throw new UncheckedIOException(ex); } }); } catch (UncheckedIOException | TDClientException e) { if (isDeterministicClientException(e)) { throw new TaskExecutionException(e, TaskExecutionException.buildExceptionErrorConfig(e)); } int retry = downloadState.get(RETRY, int.class, 0); downloadState.set(RETRY, retry + 1); int interval = (int) Math.min(INITIAL_DOWNLOAD_RETRY_INTERVAL * Math.pow(2, retry), MAX_DOWNLOAD_RETRY_INTERVAL); logger.warn("Failed to download result of job '{}', retrying in seconds", j.getJobId(), interval, e); throw TaskExecutionException.ofNextPolling(interval, ConfigElement.copyOf(state)); } }
Source:
public static String sanitizeFileDirectory(String value){ while (value.startsWith("\\") || value.startsWith("/") || value.startsWith("-") || value.startsWith(".")){ value = value.substring(1); } while (value.endsWith("\\") || value.endsWith("/") || value.endsWith("-") || value.endsWith(".")){ value = value.substring(0, value.length() - 1); } return value; }

Target:
public static String sanitizeFileDirectory(String value) { return sanitizeFileDirectory(value, false); }
Source:
public BudgetGoalDTO(@JsonProperty(required = true, value = "activityCategoryUrl") String activityCategoryUrl, @JsonProperty(required = true, value = "maxDurationMinutes") int maxDurationMinutes) { this(null, determineActivityCategoryID(activityCategoryUrl), maxDurationMinutes, false ); }

Target:
public BudgetGoalDTO(@JsonProperty(required = true, value = "activityCategoryUrl") String activityCategoryUrl, @JsonProperty(required = true, value = "maxDurationMinutes") int maxDurationMinutes) { super(activityCategoryUrl); this.maxDurationMinutes = maxDurationMinutes; }
Source:
protected Object processResponseBeforeSending(Object response) { ReplicatedMapService replicatedMapService = getService(ReplicatedMapService.SERVICE_NAME); if (replicatedMapService.getReplicatedMapConfig(parameters.name).isStatisticsEnabled()) { LocalReplicatedMapStatsImpl stats = replicatedMapService.getLocalReplicatedMapStatsImpl(parameters.name); stats.incrementGets(TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTimeNanos)); } return response; }

Target:
protected Object processResponseBeforeSending(Object response) { ReplicatedMapService replicatedMapService = getService(ReplicatedMapService.SERVICE_NAME); if (replicatedMapService.getReplicatedMapConfig(parameters.name).isStatisticsEnabled()) { LocalReplicatedMapStatsImpl stats = replicatedMapService.getLocalReplicatedMapStatsImpl(parameters.name); stats.incrementGetsNanos(System.nanoTime() - startTimeNanos); } return response; }
Source:
private static List<byte[]> chunkMetadataStoreValue(byte[] value) { try { byte[] valueCrcAsBytes = getCRCChecksum(value); value = ArrayUtils.addAll(value, valueCrcAsBytes); List<byte[]> valueSegments = new ArrayList<>(); int valueLength = value.length; for (int index = 0; index < valueLength; index += VALUE_SEGMENT_SIZE_IN_BYTES) { byte[] valueSegment = ArrayUtils.subarray(value, index, Math.min(index + VALUE_SEGMENT_SIZE_IN_BYTES, valueLength)); valueSegments.add(valueSegment); } return valueSegments; } catch (Exception e) { throw new SamzaException(String.format("Exception occurred when splitting the value: %s to small chunks.", value), e); } }

Target:
private static List<byte[]> chunkMetadataStoreValue(byte[] value) { try { byte[] checksum = getCRCChecksum(value); byte[] valueWithChecksum = ArrayUtils.addAll(value, checksum); List<byte[]> valueSegments = new ArrayList<>(); int length = valueWithChecksum.length; for (int index = 0; index < length; index += VALUE_SEGMENT_SIZE_IN_BYTES) { byte[] valueSegment = ArrayUtils.subarray(valueWithChecksum, index, Math.min(index + VALUE_SEGMENT_SIZE_IN_BYTES, length)); valueSegments.add(valueSegment); } return valueSegments; } catch (Exception e) { throw new SamzaException(String.format("Exception occurred when splitting the value: %s to small chunks.", value), e); } }
Source:
public IntegerValidation() { super(Integer.MIN_VALUE, Integer.MAX_VALUE, Integer.class); }

Target:
public IntegerValidation() { this(Integer.MIN_VALUE, Integer.MAX_VALUE); }
Source:
public void update(Long id) { AgentInfo agent = getOne(id); if (agent == null) { return; } hazelcastService.publish(new TopicEvent<>(AGENT_MANAGER_TOPIC_LISTENER_KEY, extractRegionFromAgentRegion(agent.getRegion()), new ClusteredAgentRequest(agent.getIp(), agent.getName(), UPDATE_AGENT))); }

Target:
public void update(Long id) { AgentInfo agent = getOne(id); if (agent == null) { return; } publishTopic(agent, AGENT_TOPIC_LISTENER_NAME, UPDATE_AGENT); }
Source:
Map<String, String> toParameters() { final Map<String, String> outParams = new LinkedHashMap<String, String>(); if (this.params != null) { outParams.putAll(this.params); } if(!outParams.containsKey("scope")) { outParams.put("scope", "openid"); } outParams.putAll(grant.toParameters()); return outParams; }

Target:
Map<String, String> toParameters() { final Map<String, String> outParams = new LinkedHashMap<String, String>(); if (this.params != null) { outParams.putAll(this.params); } outParams.put("scope", "openid"); outParams.putAll(grant.toParameters()); return outParams; }
Source:
private ClientConfig createClientConfig() { ClientConfig cc = new ClientConfig(); cc.setProcedureCallTimeout(10 * 60 * 1000); return cc; }

Target:
private ClientConfig createClientConfig() { ClientConfig cc = new ClientConfig(); cc.setProcedureCallTimeout(30 * 1000); return cc; }
Source:
public void testGetAllForQuotaId() { List<DiskImage> disks = dao.getAllForQuotaId(FixturesTool.QUOTA_GENERAL); assertEquals("Wrong number of disk images for quota ", 12, disks.size()); }

Target:
public void testGetAllForQuotaId() { List<DiskImage> disks = dao.getAllForQuotaId(FixturesTool.QUOTA_GENERAL); assertEquals("Wrong number of disk images for quota ", TOTAL_DISK_IMAGES_FOR_QAUOTA, disks.size()); }
Source:
public static RoleMappingsProvider bootstrapRoleMappingsProvider(final SamlDeployment deployment, final ResourceLoader loader, final SP.RoleMappingsProviderConfig providerConfig) { String providerId; if (providerConfig == null || providerConfig.getId() == null) { providerId = PropertiesBasedRoleMapper.PROVIDER_ID; } else { providerId = providerConfig.getId(); } Map<String, RoleMappingsProvider> roleMappingsProviders = new HashMap<>(); loadProviders(roleMappingsProviders, RoleMappingsProviderUtils.class.getClassLoader()); loadProviders(roleMappingsProviders, Thread.currentThread().getContextClassLoader()); RoleMappingsProvider provider = roleMappingsProviders.get(providerId); if (provider == null) { throw new RuntimeException("Couldn't find RoleMappingsProvider implementation class with id: " + providerId + ". Loaded authentication providers: " + roleMappingsProviders.keySet()); } provider.init(deployment, loader, providerConfig != null ? providerConfig.getConfiguration() : new Properties()); return provider; }

Target:
public static RoleMappingsProvider bootstrapRoleMappingsProvider(final SamlDeployment deployment, final ResourceLoader loader, final SP.RoleMappingsProviderConfig providerConfig) { String providerId; if (providerConfig == null || providerConfig.getId() == null) { return null; } else { providerId = providerConfig.getId(); } Map<String, RoleMappingsProvider> roleMappingsProviders = new HashMap<>(); loadProviders(roleMappingsProviders, RoleMappingsProviderUtils.class.getClassLoader()); loadProviders(roleMappingsProviders, Thread.currentThread().getContextClassLoader()); RoleMappingsProvider provider = roleMappingsProviders.get(providerId); if (provider == null) { throw new RuntimeException("Couldn't find RoleMappingsProvider implementation class with id: " + providerId + ". Loaded role mappings providers: " + roleMappingsProviders.keySet()); } provider.init(deployment, loader, providerConfig != null ? providerConfig.getConfiguration() : new Properties()); return provider; }
Source:
public boolean shutdown() { return freeze() && kill(); }

Target:
public boolean shutdown() { if (status.isDown()) { return false; } status = SchedulerStatus.SHUTTING_DOWN; logger.info("Scheduler is shutting down, this may take time to finish every running tasks!"); listener.schedulerStateUpdated(SchedulerEvent.SHUTTING_DOWN); infrastructure.schedule(new Runnable() { public void run() { if (jobs.getRunningTasks().isEmpty()) { kill(); } else { infrastructure.schedule(this, 5000); } } }, 5000); return true; }
Source:
public void addAppenderator(String taskId, Appenderator appenderator) { taskAppenderatorMap.computeIfAbsent( taskId, (myTaskId) -> { return new ArrayList<>(); } ); taskAppenderatorMap.get(taskId).add(appenderator); }

Target:
public void addAppenderator(String taskId, Appenderator appenderator) { taskAppenderatorMap.computeIfAbsent( taskId, (myTaskId) -> { return new ArrayList<>(); } ).add(appenderator); }
Source:
public void save() { Globals.prefs.setProtectedTermsPreferences(termsLoader); }

Target:
public void save() { preferences.setProtectedTermsPreferences(termsLoader); }
Source:
public boolean validateSourceGroup() { File sourceArchiveFile = getSourceArchiveFile(); File source = fImportFromDirectoryRadio.getSelection() ? getSourceDirectory() : sourceArchiveFile; if (source == null) { setMessage(Messages.ImportTraceWizard_SelectTraceSourceEmpty); setErrorMessage(null); return false; } if (sourceConflictsWithDestination(new Path(source.getPath()))) { setMessage(null); setErrorMessage(getSourceConflictMessage()); return false; } if (!fImportFromDirectoryRadio.getSelection() && sourceArchiveFile != null) { if (!ensureTarSourceIsValid(getSourceArchiveFile().getAbsolutePath()) && !ensureZipSourceIsValid(getSourceArchiveFile().getAbsolutePath())) { setMessage(null); setErrorMessage(Messages.ImportTraceWizard_BadArchiveFormat); return false; } } if (fSelectionGroup.getCheckedElementCount() == 0) { setMessage(null); setErrorMessage(Messages.ImportTraceWizard_SelectTraceNoneSelected); return false; } IContainer container = getSpecifiedContainer(); if (container != null && container.isVirtual()) { if (Platform.getPreferencesService().getBoolean(Activator.PLUGIN_ID, ResourcesPlugin.PREF_DISABLE_LINKING, false, null)) { setMessage(null); setErrorMessage(Messages.ImportTraceWizard_CannotImportFilesUnderAVirtualFolder); return false; } if (fCreateLinksInWorkspaceButton == null || !fCreateLinksInWorkspaceButton.getSelection()) { setMessage(null); setErrorMessage(Messages.ImportTraceWizard_HaveToCreateLinksUnderAVirtualFolder); return false; } } setErrorMessage(null); return true; }

Target:
public boolean validateSourceGroup() { File source = fImportFromDirectoryRadio.getSelection() ? getSourceDirectory() : getSourceArchiveFile(); if (source == null) { setMessage(Messages.ImportTraceWizard_SelectTraceSourceEmpty); setErrorMessage(null); return false; } if (sourceConflictsWithDestination(new Path(source.getPath()))) { setMessage(null); setErrorMessage(getSourceConflictMessage()); return false; } if (!fImportFromDirectoryRadio.getSelection()) { if (!ensureTarSourceIsValid(source.getAbsolutePath()) && !ensureZipSourceIsValid(source.getAbsolutePath())) { setMessage(null); setErrorMessage(Messages.ImportTraceWizard_BadArchiveFormat); return false; } } if (fSelectionGroup.getCheckedElementCount() == 0) { setMessage(null); setErrorMessage(Messages.ImportTraceWizard_SelectTraceNoneSelected); return false; } IContainer container = getSpecifiedContainer(); if (container != null && container.isVirtual()) { if (Platform.getPreferencesService().getBoolean(Activator.PLUGIN_ID, ResourcesPlugin.PREF_DISABLE_LINKING, false, null)) { setMessage(null); setErrorMessage(Messages.ImportTraceWizard_CannotImportFilesUnderAVirtualFolder); return false; } if (fCreateLinksInWorkspaceButton == null || !fCreateLinksInWorkspaceButton.getSelection()) { setMessage(null); setErrorMessage(Messages.ImportTraceWizard_HaveToCreateLinksUnderAVirtualFolder); return false; } } setErrorMessage(null); return true; }
Source:
public Map<String, Object> toMap() { Map<String, Object> map = new HashMap<String, Object>(); map.put("active", this.getActive()); map.put("actualCompanyId", this.getActualCompanyId()); map.put("birthday", this.getBirthday()); map.put("comments", this.getComments()); map.put("companyId", this.getCompanyId()); map.put("createDate", this.getCreateDate()); map.put("modificationDate", this.getModificationDate()); map.put("emailAddress", this.getEmailAddress()); map.put("failedLoginAttempts", this.getFailedLoginAttempts()); map.put("male", this.getMale()); map.put("firstName", this.getFirstName()); map.put("fullName", this.getFullName()); map.put("languageId", this.getLanguageId()); map.put("lastLoginDate", this.getLastLoginDate()); map.put("lastLoginIP", this.getLastLoginIP()); map.put("lastName", this.getLastName()); map.put("middleName", this.getMiddleName()); map.put("female", this.getFemale()); map.put("nickname", this.getNickName()); map.put("userId", this.getUserId()); map.put("timeZoneId", this.getTimeZoneId()); map.put("deleteInProgress", getDeleteInProgress()); map.put("deleteDate", getDeleteDate()); return map; }

Target:
public Map<String, Object> toMap() throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { Map<String, Object> map = new HashMap<String, Object>(); map.put("active", this.getActive()); map.put("actualCompanyId", this.getActualCompanyId()); map.put("birthday", this.getBirthday()); map.put("comments", this.getComments()); map.put("companyId", this.getCompanyId()); map.put("createDate", this.getCreateDate()); map.put("modificationDate", this.getModificationDate()); map.put("emailAddress", this.getEmailAddress()); map.put("failedLoginAttempts", this.getFailedLoginAttempts()); map.put("male", this.getMale()); map.put("firstName", this.getFirstName()); map.put("fullName", this.getFullName()); map.put("languageId", this.getLanguageId()); map.put("lastLoginDate", this.getLastLoginDate()); map.put("lastLoginIP", this.getLastLoginIP()); map.put("lastName", this.getLastName()); map.put("middleName", this.getMiddleName()); map.put("female", this.getFemale()); map.put("nickname", this.getNickName()); map.put("userId", this.getUserId()); map.put("timeZoneId", this.getTimeZoneId()); map.put("deleteInProgress", getDeleteInProgress()); map.put("deleteDate", getDeleteDate()); return map; }
Source:
public String getRecoveredAdUnitId(String adUnitId) { jsActions.waitForJavaScriptTruthy("window._sp_"); jsActions.waitForJavaScriptTruthy("window._sp_.getElementId"); return jsActions.execute(String.format("window._sp_.getElementId('%s')", adUnitId)).toString(); }

Target:
public String getRecoveredAdUnitId(String adUnitId) { jsActions.waitForJavaScriptTruthy("window._sp_ && window._sp_.getElementId"); return jsActions.execute(String.format("window._sp_.getElementId('%s')", adUnitId)).toString(); }
Source:
private RulesetManagementInterface openRulesetFile(String fileName) throws IOException, RulesetNotFoundException { final long begin = System.nanoTime(); String metadataLanguage = ServiceManager.getUserService().getCurrentUser().getMetadataLanguage(); priorityList = Locale.LanguageRange.parse(metadataLanguage.isEmpty() ? "en" : metadataLanguage); RulesetManagementInterface ruleset = ServiceManager.getRulesetManagementService().getRulesetManagement(); try { ruleset.load(new File(Paths.get(ConfigCore.getParameter(ParameterCore.DIR_RULESETS), fileName).toString())); } catch (FileNotFoundException e) { throw new RulesetNotFoundException("Ruleset " + fileName + " not found"); } if (logger.isTraceEnabled()) { logger.trace("Reading ruleset took ms", TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - begin)); } return ruleset; }

Target:
private RulesetManagementInterface openRulesetFile(String fileName) throws IOException, RulesetNotFoundException { final long begin = System.nanoTime(); String metadataLanguage = ServiceManager.getUserService().getCurrentUser().getMetadataLanguage(); priorityList = Locale.LanguageRange.parse(metadataLanguage.isEmpty() ? "en" : metadataLanguage); RulesetManagementInterface ruleset = ServiceManager.getRulesetManagementService().getRulesetManagement(); try { ruleset.load(new File(Paths.get(ConfigCore.getParameter(ParameterCore.DIR_RULESETS), fileName).toString())); } catch (FileNotFoundException e) { List<String> param = new ArrayList<>(); param.add(fileName); throw new RulesetNotFoundException(Helper.getTranslation("rulesetNotFound", param)); } if (logger.isTraceEnabled()) { logger.trace("Reading ruleset took ms", TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - begin)); } return ruleset; }