auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void writeExecuteBatch(NetPreparedStatement materialPreparedStatement, Section section, ColumnMetaData parameterMetaData, Object[] inputs, int numInputColumns, boolean outputExpected, boolean chained) throws SqlException { buildEXCSQLSTT(section, true, outputExpected, false, null, false, false, 0, false, 0, false, 0, false, 0, true, inputs.length); if (numInputColumns > 0) { if ((extdtaPositions_ != null) && (!extdtaPositions_.isEmpty())) { extdtaPositions_.clear(); } boolean overrideExists = buildSQLDTAcommandDataBatch(numInputColumns, parameterMetaData, inputs); buildEXTDTA(parameterMetaData, inputs, chained); } }

Target:
public void writeExecuteBatch(NetPreparedStatement materialPreparedStatement, Section section, ColumnMetaData parameterMetaData, Object[] inputs, int numInputColumns, boolean outputExpected, boolean chained) throws SqlException { buildEXCSQLSTT(section, true, outputExpected, false, null, false, false, 0, false, 0, false, 0, false, 0, true, inputs.length); if (numInputColumns > 0) { if ((extdtaPositions_ != null) && (!extdtaPositions_.isEmpty())) { extdtaPositions_.clear(); } boolean overrideExists = buildSQLDTAcommandData(numInputColumns, parameterMetaData, inputs); buildEXTDTA(parameterMetaData, inputs, chained); } }
Source:
public void execute(SensorContext context) { PythonConfiguration conf = new PythonConfiguration(context.fileSystem().encoding()); MetricVisitor metricVisitor = new MetricVisitor(fileLinesContextFactory, context.fileSystem(), conf.getIgnoreHeaderComments()); FilePredicates p = context.fileSystem().predicates(); List<InputFile> inputFiles = ImmutableList.copyOf( context.fileSystem().inputFiles(p.and(p.hasType(InputFile.Type.MAIN), p.hasLanguage(Python.KEY)))); new PythonScanner(context, checks, metricVisitor, noSonarFilter, inputFiles).scanFiles(); if (!isSonarLint(context)) { (new PythonCoverageSensor()).execute(context, metricVisitor.fileLinesVisitor().linesOfCodeByFile()); } }

Target:
public void execute(SensorContext context) { FilePredicates p = context.fileSystem().predicates(); List<InputFile> inputFiles = ImmutableList.copyOf( context.fileSystem().inputFiles(p.and(p.hasType(InputFile.Type.MAIN), p.hasLanguage(Python.KEY)))); PythonScanner scanner = new PythonScanner(context, checks, fileLinesContextFactory, noSonarFilter, inputFiles); scanner.scanFiles(); }
Source:
public void spellCheckAllText() throws BadLocationException { Document doc = rSyntaxTextArea.getDocument(); if (doc != null) { String editorText = rSyntaxTextArea.getText(0, doc.getLength()); if (editorText != null) { Highlighter highlighter = rSyntaxTextArea.getHighlighter(); Highlighter.HighlightPainter painter = new DefaultHighlighter.DefaultHighlightPainter(Color.PINK); JLanguageTool langTool = new JLanguageTool(new AmericanEnglish()); for (Rule rule : langTool.getAllActiveRules()) { if (rule instanceof SpellingCheckRule) { ((SpellingCheckRule)rule).acceptPhrases(Arrays.asList("tex", "Tex", "TEX", "documentclass", "maketitle")); } } boolean highlighted = getEditorState().isHighlighted(); if(!highlighted) { List<RuleMatch> matches = null; try { matches = langTool.check(editorText); } catch (IOException ex) { Exceptions.printStackTrace(ex); } for (RuleMatch match : matches) { highlighter.addHighlight(match.getFromPos(), match.getToPos(), painter); } } else { Highlighter.Highlight[] highlighters = highlighter.getHighlights(); for (int i = 0; i < highlighters.length; i++) { if (highlighters[i].getPainter() instanceof DefaultHighlighter.DefaultHighlightPainter) { highlighter.removeHighlight(highlighters[i]); } } } getEditorState().setHighlighted(!highlighted); } } }

Target:
public void spellCheckAllText() throws BadLocationException { Document doc = rSyntaxTextArea.getDocument(); if (doc != null) { String editorText = rSyntaxTextArea.getText(0, doc.getLength()); if (editorText != null) { Highlighter highlighter = rSyntaxTextArea.getHighlighter(); boolean highlighted = getEditorState().isHighlighted(); if(!highlighted) { List<RuleMatch> matches = null; try { matches = langTool.check(editorText); } catch (IOException ex) { Exceptions.printStackTrace(ex); } for (RuleMatch match : matches) { highlighter.addHighlight(match.getFromPos(), match.getToPos(), painter); } } else { highlighter.removeAllHighlights(); } getEditorState().setHighlighted(!highlighted); } } }
Source:
public static MongoClient getMongoClient(Properties properties) throws UnknownHostException { String[] hosts = properties.getProperty("eva.mongo.host").split(","); List<ServerAddress> servers = new ArrayList<>(); for (String host : hosts) { String[] params = host.split(":"); if (params.length > 1) { servers.add(new ServerAddress(params[0], Integer.parseInt(params[1]))); } else { servers.add(new ServerAddress(params[0], 27017)); } } List<MongoCredential> mongoCredentialList = null; String authenticationDb = properties.getProperty("eva.mongo.auth.db", null); if (authenticationDb != null && !authenticationDb.isEmpty()) { mongoCredentialList = Collections.singletonList(MongoCredential.createCredential( properties.getProperty("eva.mongo.user"), authenticationDb, properties.getProperty("eva.mongo.passwd").toCharArray())); } MongoClientOptions options = MongoClientOptions.builder() .readPreference(ReadPreference.valueOf(properties.getProperty("eva.mongo.read-preference"))) .build(); return new MongoClient(servers, mongoCredentialList, options); }

Target:
public static MongoClient getMongoClient(Properties properties) throws UnknownHostException { String[] hosts = properties.getProperty("eva.mongo.host").split(","); List<ServerAddress> servers = new ArrayList<>(); for (String host : hosts) { String[] params = host.split(":"); if (params.length > 1) { servers.add(new ServerAddress(params[0], Integer.parseInt(params[1]))); } else { servers.add(new ServerAddress(params[0], 27017)); } } List<MongoCredential> mongoCredentialList = null; String authenticationDb = properties.getProperty("eva.mongo.auth.db", null); if (authenticationDb != null && !authenticationDb.isEmpty()) { mongoCredentialList = Collections.singletonList(MongoCredential.createCredential( properties.getProperty("eva.mongo.user"), authenticationDb, properties.getProperty("eva.mongo.passwd").toCharArray())); } String readPreference = properties.getProperty("eva.mongo.read-preference"); readPreference = readPreference == null || readPreference.isEmpty()? "secondaryPreferred" : readPreference; MongoClientOptions options = MongoClientOptions.builder() .readPreference(ReadPreference.valueOf(readPreference)) .build(); return new MongoClient(servers, mongoCredentialList, options); }
Source:
public void mapAndSend(Event[] events, OptionHolder optionHolder, TemplateBuilder payloadTemplateBuilder, SinkListener sinkListener, DynamicOptions dynamicOptions) throws ConnectionUnavailableException { StringBuilder sb = null; if (payloadTemplateBuilder == null) { String jsonString = constructJsonForDefaultMapping(events); if (jsonString != null) { sb = new StringBuilder(); sb.append(jsonString); } } else { sb = new StringBuilder(); sb.append(constructJsonForCustomMapping(events, payloadTemplateBuilder)); } if (sb != null) { if (!isJsonValidationEnabled) { sinkListener.publish(sb.toString(), dynamicOptions); } else if (isValidJson(sb.toString())) { sinkListener.publish(sb.toString(), dynamicOptions); } else { log.error("Invalid json string : " + sb.toString() + ". Hence dropping the message."); } } }

Target:
public void mapAndSend(Event[] events, OptionHolder optionHolder, TemplateBuilder payloadTemplateBuilder, SinkListener sinkListener, DynamicOptions dynamicOptions) throws ConnectionUnavailableException { StringBuilder sb = new StringBuilder(); if (payloadTemplateBuilder == null) { String jsonString = constructJsonForDefaultMapping(events); sb.append(jsonString); } else { sb.append(constructJsonForCustomMapping(events, payloadTemplateBuilder)); } if (!isJsonValidationEnabled) { sinkListener.publish(sb.toString(), dynamicOptions); } else if (isValidJson(sb.toString())) { sinkListener.publish(sb.toString(), dynamicOptions); } else { log.error("Invalid json string : " + sb.toString() + ". Hence dropping the message."); } }
Source:
static Response readBodyToBytesIfNecessary(Response response) throws IOException { final ResponseBody body = response.body(); if (body == null) { return response; } BufferedSource source = body.source(); final Buffer buffer = new Buffer(); buffer.writeAll(source); source.close(); return response.newBuilder() .body(new ResponseBody() { @Override public MediaType contentType() { return body.contentType(); } @Override public long contentLength() { return buffer.size(); } @Override public BufferedSource source() { return buffer; } }) .build(); }

Target:
static Response readBodyToBytesIfNecessary(Response response) throws IOException { final ResponseBody body = response.body(); if (body == null) { return response; } BufferedSource source = body.source(); final Buffer buffer = new Buffer(); buffer.writeAll(source); source.close(); return response.newBuilder() .body(new ResponseBody() { @Override public MediaType contentType() { return body.contentType(); } @Override public long contentLength() { return buffer.size(); } @Override public BufferedSource source() { return buffer.clone(); } }) .build(); }
Source:
static void validateValueUniquenessInScope(String type, List<Type> nestedTypes) { BitSet tags = new BitSet(); for (Type nestedType : nestedTypes) { if (nestedType instanceof EnumType) { EnumType enumType = (EnumType) nestedType; for (Value value : enumType.getValues()) { int tag = value.getTag(); if (tags.get(tag)) { throw new IllegalStateException("Duplicate enum tag " + tag + " in scope " + type); } tags.set(tag); } } } }

Target:
static void validateValueUniquenessInScope(String type, List<Type> nestedTypes) { Set<Integer> tags = new LinkedHashSet<Integer>(); for (Type nestedType : nestedTypes) { if (nestedType instanceof EnumType) { EnumType enumType = (EnumType) nestedType; for (Value value : enumType.getValues()) { int tag = value.getTag(); if (!tags.add(tag)) { throw new IllegalStateException("Duplicate enum tag " + tag + " in scope " + type); } } } } }
Source:
public CSVMetaDataBuilder addField(String fieldName, DataType type, List<MetaDataFieldProperty> fieldProperties) { fields.add(new DefaultMetaDataField(fieldName, new DefaultSimpleMetaDataModel(type), MetaDataField.FieldAccessType.READ, fieldProperties)); return this; }

Target:
public CSVMetaDataBuilder addField(String fieldName, DataType type, List<MetaDataFieldProperty> fieldProperties) { Objects.requireNonNull(fieldProperties, "fieldProperties must not be null"); fields.add(new DefaultMetaDataField(fieldName, new DefaultSimpleMetaDataModel(type), MetaDataField.FieldAccessType.READ, fieldProperties)); return this; }
Source:
public ListenableFuture<?> removeRemoteSource(TaskId remoteSourceTaskId) { URI remoteSourceUri = uriBuilderFrom(taskLocation) .appendPath("remote-source") .appendPath(remoteSourceTaskId.toString()) .build(); Request request = prepareDelete() .setUri(remoteSourceUri) .build(); RequestErrorTracker errorTracker = new RequestErrorTracker( taskId, remoteSourceUri, maxErrorDuration, errorScheduledExecutor, "Remove exchange remote source"); SettableFuture<?> future = SettableFuture.create(); removeRemoteSourceHelper(errorTracker, request, future); return future; }

Target:
public ListenableFuture<?> removeRemoteSource(TaskId remoteSourceTaskId) { URI remoteSourceUri = uriBuilderFrom(taskLocation) .appendPath("remote-source") .appendPath(remoteSourceTaskId.toString()) .build(); Request request = prepareDelete() .setUri(remoteSourceUri) .build(); RequestErrorTracker errorTracker = new RequestErrorTracker( taskId, remoteSourceUri, maxErrorDuration, errorScheduledExecutor, "Remove exchange remote source"); SettableFuture<?> future = SettableFuture.create(); doRemoveRemoteSource(errorTracker, request, future); return future; }
Source:
private static boolean isThriftSupported(VersionNumber cassandraVersion) { return cassandraVersion.compareTo(VersionNumber.parse("4.0-a")) < 0; }

Target:
private static boolean isThriftSupported(VersionNumber cassandraVersion) { return cassandraVersion.nextStable().compareTo(VersionNumber.parse("4.0")) < 0; }
Source:
private void createStudentProfile(String email, String pictureKey) { String shortName = "John"; String institute = "InstituteForJohnDoe"; String nationality = "Singaporean"; String gender = Const.GenderTypes.MALE; String moreInfo = "Information for John Doe."; if (pictureKey == null || pictureKey.isEmpty()) { this.pictureUrl = Const.SystemParams.DEFAULT_PROFILE_PICTURE_PATH; } else { this.pictureUrl = Const.ActionURIs.STUDENT_PROFILE_PICTURE + "?" + Const.ParamsNames.BLOB_KEY + "=" + pictureKey + "&" + Const.ParamsNames.USER_ID + "=" + GOOGLE_ID; } inputStudentProfile = StudentProfileAttributes.builder(GOOGLE_ID) .withShortName(shortName) .withEmail(email) .withInstitute(institute) .withNationality(nationality) .withGender(gender) .withMoreInfo(moreInfo) .withPictureKey(pictureKey) .build(); }

Target:
private void createStudentProfile(String email, String pictureKey) { String googleId = "valid.googleId"; String shortName = "John"; String institute = "InstituteForJohnDoe"; String nationality = "Singaporean"; String gender = Const.GenderTypes.MALE; String moreInfo = "Information for John Doe."; if (pictureKey == null || pictureKey.isEmpty()) { this.pictureUrl = Const.SystemParams.DEFAULT_PROFILE_PICTURE_PATH; } else { this.pictureUrl = Const.ActionURIs.STUDENT_PROFILE_PICTURE + "?" + Const.ParamsNames.BLOB_KEY + "=" + pictureKey + "&" + Const.ParamsNames.USER_ID + "=null"; } inputStudentProfile = StudentProfileAttributes.builder(googleId) .withShortName(shortName) .withEmail(email) .withInstitute(institute) .withNationality(nationality) .withGender(gender) .withMoreInfo(moreInfo) .withPictureKey(pictureKey) .build(); }
Source:
EsSettings(Props props) { this.props = props; String configuredClusterName = props.nonNullValue(ProcessProperties.CLUSTER_NAME); if (isBlank(configuredClusterName)) { this.clusterName = STANDALONE_CLUSTER_NAME; } else { this.clusterName = configuredClusterName; } this.clusterEnabled = props.valueAsBoolean(ProcessProperties.CLUSTER_ENABLED); if (this.clusterEnabled) { this.nodeName = props.value(CLUSTER_SEARCH_NODE_NAME, "sonarqube-" + UUID.randomUUID().toString()); } else { this.nodeName = STANDALONE_NODE_NAME; } }

Target:
EsSettings(Props props) { this.props = props; this.clusterName = props.nonNullValue(ProcessProperties.CLUSTER_NAME); this.clusterEnabled = props.valueAsBoolean(ProcessProperties.CLUSTER_ENABLED); if (this.clusterEnabled) { this.nodeName = props.value(CLUSTER_SEARCH_NODE_NAME, "sonarqube-" + UUID.randomUUID().toString()); } else { this.nodeName = STANDALONE_NODE_NAME; } }
Source:
public void addConnectionEventListener(ConnectionEventListener listener) { log.debug("addConnectionEventListener()"); if (listener == null) { throw new IllegalArgumentException("Listener is null"); } listeners.add(listener); }

Target:
public void addConnectionEventListener(ConnectionEventListener listener) { if (listener == null) { throw new IllegalArgumentException("Listener is null"); } listeners.add(listener); }
Source:
protected void createCopyFromExeGroup(Composite parent, int colSpan) { Composite mainComp = new Composite(parent, SWT.NONE); GridLayout mainLayout = new GridLayout(); mainLayout.numColumns = 1; mainLayout.marginHeight = 0; mainLayout.marginWidth = 0; mainComp.setLayout(mainLayout); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = colSpan; mainComp.setLayoutData(gd); enableCopyFromExeButton = createCheckButton(mainComp, "Copy C/C++ executable from:"); copyFromExeSelector = new ResourceSelectorWidget(mainComp, ResourceSelectorWidget.ResourceType.FILE, 2, "C/C++ executable origin", null); toLabel = new Label(mainComp, SWT.NONE); toLabel.setText("To:"); copyFromExeSelector.setEnabled(false); enableCopyFromExeButton.setSelection(false); toLabel.setEnabled(false); enableCopyFromExeButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { boolean copyEnabled = enableCopyFromExeButton.getSelection(); setEnableCopyFromSection(copyEnabled); updateLaunchConfigurationDialog(); } }); copyFromExeText = copyFromExeSelector.getURIText(); copyFromExeText.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent evt) { updateLaunchConfigurationDialog(); } }); }

Target:
protected void createCopyFromExeGroup(Composite parent, int colSpan) { Composite mainComp = new Composite(parent, SWT.NONE); GridLayout mainLayout = new GridLayout(); mainLayout.numColumns = 1; mainLayout.marginHeight = 0; mainLayout.marginWidth = 0; mainComp.setLayout(mainLayout); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = colSpan; mainComp.setLayoutData(gd); enableCopyFromExeButton = createCheckButton(mainComp, ProxyLaunchMessages.copy_cpp_executable); copyFromExeSelector = new ResourceSelectorWidget(mainComp, ResourceSelectorWidget.ResourceType.FILE, 2, ProxyLaunchMessages.executable_origin, null); toLabel = new Label(mainComp, SWT.NONE); toLabel.setText(ProxyLaunchMessages.to); copyFromExeSelector.setEnabled(false); enableCopyFromExeButton.setSelection(false); toLabel.setEnabled(false); enableCopyFromExeButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { boolean copyEnabled = enableCopyFromExeButton.getSelection(); setEnableCopyFromSection(copyEnabled); updateLaunchConfigurationDialog(); } }); copyFromExeText = copyFromExeSelector.getURIText(); copyFromExeText.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent evt) { updateLaunchConfigurationDialog(); } }); }
Source:
public static Double stSphericalArea(@SqlType(SPHERICAL_GEOGRAPHY_TYPE_NAME) Slice input) { OGCGeometry geometry = deserialize(input); if (geometry.isEmpty()) { return null; } validateSphericalType("ST_Area", geometry, EnumSet.of(POLYGON)); Polygon polygon = (Polygon) geometry.getEsriGeometry(); return sphericalPolygonArea(polygon); }

Target:
public static Double stSphericalArea(@SqlType(SPHERICAL_GEOGRAPHY_TYPE_NAME) Slice input) { OGCGeometry geometry = deserialize(input); if (geometry.isEmpty()) { return null; } validateSphericalType("ST_Area", geometry, EnumSet.of(POLYGON, MULTI_POLYGON)); Polygon polygon = (Polygon) geometry.getEsriGeometry(); double sphericalExcess = 0.0; int numPaths = polygon.getPathCount(); for (int i = 0; i < numPaths; i++) { double sign = polygon.isExteriorRing(i) ? 1.0 : -1.0; sphericalExcess += sign * Math.abs(computeSphericalExcess(polygon, polygon.getPathStart(i), polygon.getPathEnd(i))); } return Math.abs(sphericalExcess * EARTH_RADIUS_M * EARTH_RADIUS_M); }
Source:
public void should_return_translation_for_the_given_local() throws Exception { Map<String, String> parameters = new HashMap<>(); parameters.put("key1", "<strong>message 1</strong>"); parameters.put("key2", "autre méssage"); parameters.put("key3", "~%^*µ"); when(i18n.getLocale(AbstractI18n.LOCALE.fr)).thenReturn(parameters); Response response = request("/system/i18ntranslationv2?f=locale%3Dfr").get(); assertThat(response).hasStatus(Status.SUCCESS_OK); assertJsonEquals("[" + "{\"key\": \"key1\", \"value\": \"<strong>message 1</strong>\"}," + "{\"key\": \"key2\", \"value\": \"autre méssage\"}," + "{\"key\": \"key3\", \"value\": \"~%^*µ\"}" + "]", response.getEntityAsText(), JsonAssert.when(Option.IGNORING_ARRAY_ORDER)); }

Target:
public void should_return_translation_for_the_given_local() throws Exception { Map<String, String> parameters = new HashMap<>(); parameters.put("key1", "<strong>message 1</strong>"); parameters.put("key2", "autre méssage"); parameters.put("key3", "~%^*µ"); when(i18n.getLocale(AbstractI18n.LOCALE.fr)).thenReturn(parameters); Response response = request("/system/i18ntranslation?f=locale%3Dfr").get(); assertThat(response).hasStatus(Status.SUCCESS_OK); assertJsonEquals("[" + "{\"key\": \"key1\", \"value\": \"<strong>message 1</strong>\"}," + "{\"key\": \"key2\", \"value\": \"autre méssage\"}," + "{\"key\": \"key3\", \"value\": \"~%^*µ\"}" + "]", response.getEntityAsText(), JsonAssert.when(Option.IGNORING_ARRAY_ORDER)); }
Source:
protected void processConfigurationReport(SerialMessage serialMessage, int offset) { int parameter = serialMessage.getMessagePayloadByte(offset + 1); int size = serialMessage.getMessagePayloadByte(offset + 2); int value = 0; for (int i = 0; i < size; ++i) { value <<= 8; value |= serialMessage.getMessagePayloadByte(offset + 3 + i); } logger.debug(String.format("Node configuration report from nodeId = %d, parammeter = %d, value = 0x%02X", this .getNode().getNodeId(), parameter, value)); ZWaveConfigurationParameterEvent zEvent = new ZWaveConfigurationParameterEvent(this.getNode().getNodeId(), parameter, value, size); this.getController().notifyEventListeners(zEvent); }

Target:
protected void processConfigurationReport(SerialMessage serialMessage, int offset) { int parameter = serialMessage.getMessagePayloadByte(offset + 1); int size = serialMessage.getMessagePayloadByte(offset + 2); int value = extractValue(serialMessage.getMessagePayload(), offset + 3, size); logger.debug(String.format("Node configuration report from nodeId = %d, parameter = %d, value = 0x%02X", this .getNode().getNodeId(), parameter, value)); ConfigurationParameter configurationParameter = new ConfigurationParameter(parameter, value, size); this.configParameters.put(parameter, configurationParameter); ZWaveConfigurationParameterEvent zEvent = new ZWaveConfigurationParameterEvent(this.getNode().getNodeId(), configurationParameter); this.getController().notifyEventListeners(zEvent); }
Source:
public void testLocaleConsistency() { for (String culture: RoviCulture.cultures()) { Locale locale = RoviCulture.localeFromCulture(culture); assertEquals(culture, RoviCulture.cultureFromLocale(locale)); } }

Target:
public void testLocaleConsistency() { assertFalse(RoviCulture.cultures().isEmpty()); for (String culture: RoviCulture.cultures()) { Locale locale = RoviCulture.localeFromCulture(culture); assertEquals(culture, RoviCulture.cultureFromLocale(locale)); } }
Source:
protected final <T> ConstraintValidator<A, ?> getInitializedConstraintValidator(ValidationContext<T> validationContext, ValueContext<?, ?> valueContext) { ConstraintValidator<A, ?> validator; if ( validationContext.getConstraintValidatorFactory() == validationContext.getConstraintValidatorManager().getDefaultConstraintValidatorFactory() ) { validator = constraintValidatorForDefaultConstraintValidatorFactory; if ( validator == null ) { synchronized ( this ) { validator = constraintValidatorForDefaultConstraintValidatorFactory; if ( validator == null ) { validator = getInitializedConstraintValidator( validationContext ); if ( !( validator instanceof HibernateConstraintValidator ) ) { constraintValidatorForDefaultConstraintValidatorFactory = validator; } } } } } else { validator = getInitializedConstraintValidator( validationContext ); } if ( validator == DUMMY_CONSTRAINT_VALIDATOR ) { throw getExceptionForNullValidator( validatedValueType, valueContext.getPropertyPath().asString() ); } return validator; }

Target:
protected final <T> ConstraintValidator<A, ?> getInitializedConstraintValidator(ValidationContext<T> validationContext, ValueContext<?, ?> valueContext) { ConstraintValidator<A, ?> validator; if ( validationContext.getConstraintValidatorFactory() == validationContext.getConstraintValidatorManager().getDefaultConstraintValidatorFactory() && validationContext.getConstraintValidatorInitializationContext() == validationContext.getConstraintValidatorManager() .getDefaultConstraintValidatorInitializationContext() ) { validator = constraintValidatorForDefaultConstraintValidatorFactoryAndInitializationContext; if ( validator == null ) { synchronized ( this ) { validator = constraintValidatorForDefaultConstraintValidatorFactoryAndInitializationContext; if ( validator == null ) { validator = getInitializedConstraintValidator( validationContext ); constraintValidatorForDefaultConstraintValidatorFactoryAndInitializationContext = validator; } } } } else { validator = getInitializedConstraintValidator( validationContext ); } if ( validator == DUMMY_CONSTRAINT_VALIDATOR ) { throw getExceptionForNullValidator( validatedValueType, valueContext.getPropertyPath().asString() ); } return validator; }
Source:
public void stop(BundleContext context) throws Exception { ArchiveCommand.unregisterFormat("zip"); ArchiveCommand.unregisterFormat("txz"); ArchiveCommand.unregisterFormat("tgz"); ArchiveCommand.unregisterFormat("tar"); }

Target:
public void stop(BundleContext context) throws Exception { stop(); }
Source:
public void onUpdated(Iterable<CacheEntryEvent<? extends K, ? extends V>> events) throws CacheEntryListenerException { for (Object event1 : events) { CacheEntryEvent event = (CacheEntryEvent) event1; Assert.assertEquals(EventType.UPDATED, event.getEventType()); this.updated.incrementAndGet(); event.getKey(); if (event.isOldValueAvailable()) { event.getOldValue(); } } }

Target:
public void onUpdated(Iterable<CacheEntryEvent<? extends K, ? extends V>> events) throws CacheEntryListenerException { for (CacheEntryEvent<? extends K, ? extends V> event : events) { Assert.assertEquals(EventType.UPDATED, event.getEventType()); this.updated.incrementAndGet(); if (event.isOldValueAvailable()) { event.getOldValue(); } } }
Source:
@Override public T convert(ResponseBody value) throws IOException { BufferedSource source = value.source(); try { if (source.rangeEquals(0, UTF8_BOM)) { source.skip(UTF8_BOM.size()); } JsonReader reader = JsonReader.of(source); T result = adapter.fromJson(reader); if (requireFullConsumption && reader.peek() == JsonReader.Token.END_DOCUMENT) { throw new RuntimeException("JSON document was not fully consumed."); } return result; } finally { value.close(); } }

Target:
@Override public T convert(ResponseBody value) throws IOException { BufferedSource source = value.source(); try { if (source.rangeEquals(0, UTF8_BOM)) { source.skip(UTF8_BOM.size()); } JsonReader reader = JsonReader.of(source); T result = adapter.fromJson(reader); if (reader.peek() != JsonReader.Token.END_DOCUMENT) { throw new JsonDataException("JSON document was not fully consumed."); } return result; } finally { value.close(); } }
Source:
public void onReceive(final Context context, Intent intent) { DownloadManager dm = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE); String action = intent.getAction(); if (DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(action)) { long downloadId = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, 0); Query query = new Query(); query.setFilterById(downloadId); Cursor c = dm.query(query); if (c.moveToFirst()) { int columnIndex = c.getColumnIndex(DownloadManager.COLUMN_STATUS); if (DownloadManager.STATUS_SUCCESSFUL == c.getInt(columnIndex)) { Uri filenameUri = Uri.parse(c.getString(c.getColumnIndex(DownloadManager.COLUMN_LOCAL_URI))); final String filename = filenameUri.getPath(); if (StorageManager.shouldEncryptDecrypt(context, filename)) { new Thread() { @Override public void run() { try { CipherUtils.encryptFile(context, filename, true); } catch (Exception e) { e.printStackTrace(); } } }.start(); } } } } }

Target:
public void onReceive(final Context context, Intent intent) { DownloadManager dm = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE); String action = intent.getAction(); if (DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(action)) { long downloadId = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, 0); Query query = new Query(); query.setFilterById(downloadId); Cursor c = dm.query(query); if (c.moveToFirst()) { int columnIndex = c.getColumnIndex(DownloadManager.COLUMN_STATUS); if (DownloadManager.STATUS_SUCCESSFUL == c.getInt(columnIndex)) { Uri filenameUri = Uri.parse(c.getString(c.getColumnIndex(DownloadManager.COLUMN_LOCAL_URI))); final String filename = filenameUri.getPath(); if (StorageManager.shouldEncryptDecrypt(context, filename)) { new Thread() { @Override public void run() { try { CipherUtils.encryptFile(context, filename, true); } catch (Exception e) { Log.d(TAG, Log.getStackTraceString(e)); } } }.start(); } } } } }
Source:
public String toString() { return systemName + "/" + clientId + "/" + super.toString(); }

Target:
public String toString() { return String.format("%s:%s", systemName, clientId); }
Source:
private boolean validateImagesAvailability() { for (DiskImage image : new ArrayList<>(getImages())) { Guid imageGroupId = image.getId() != null ? image.getId() : Guid.Empty; boolean imageAvailable = false; for (Guid storageDomainId : image.getStorageIds()) { DiskImage fromIrs = null; try { fromIrs = (DiskImage) runVdsCommand(VDSCommandType.GetImageInfo, new GetImageInfoVDSCommandParameters(getStoragePool().getId(), storageDomainId, imageGroupId, image.getImageId())).getReturnValue(); } catch (Exception e) { log.debug("Unable to get image info from storage", e); } if (fromIrs == null) { log.warn("Disk image '{}/{}' doesn't exist on storage domain '{}'", imageGroupId, image.getImageId(), storageDomainId); } else { imageAvailable = true; } } if (!imageAvailable) { if (getParameters().isAllowPartialImport()) { log.warn("Disk image '{}/{}' doesn't exist on any of its storage domains. " + "Ignoring since the force flag in on", imageGroupId, image.getImageId()); getImages().remove(image); failedDisksToImportForAuditLog.putIfAbsent(image.getId(), image.getDiskAlias()); } else { return failValidation(EngineMessage.TEMPLATE_IMAGE_NOT_EXIST); } } } return true; }

Target:
private boolean validateImagesAvailability() { for (DiskImage image : new ArrayList<>(getImages())) { Guid imageGroupId = image.getId() != null ? image.getId() : Guid.Empty; if (!validateImageAvailability(image, imageGroupId)) { if (getParameters().isAllowPartialImport()) { log.warn("Disk image '{}/{}' doesn't exist on any of its storage domains. " + "Ignoring since the force flag in on", imageGroupId, image.getImageId()); getImages().remove(image); failedDisksToImportForAuditLog.putIfAbsent(image.getId(), image.getDiskAlias()); } else { return failValidation(EngineMessage.TEMPLATE_IMAGE_NOT_EXIST); } } } return true; }
Source:
public String toString() { return "BootstrapSession [endpoint=" + endpoint + ", clientIdentity=" + clientIdentity + ", authenticated=" + authenticated + "]"; }

Target:
public String toString() { return String.format("BootstrapSession [endpoint=%s, clientIdentity=%s, authorized=%s]", endpoint, clientIdentity, authorized); }
Source:
public LocationHandle forExistingTable(SemiTransactionalHiveMetastore metastore, ConnectorSession session, Table table) { HdfsContext context = new HdfsContext(session, table.getDatabaseName(), table.getTableName()); Path targetPath = new Path(table.getStorage().getLocation()); if (table.isTemporary()) { return new LocationHandle(targetPath, targetPath, true, DIRECT_TO_TARGET_EXISTING_DIRECTORY, true); } return createLocationHandle(context, session, targetPath, true); }

Target:
public LocationHandle forExistingTable(SemiTransactionalHiveMetastore metastore, ConnectorSession session, Table table) { HdfsContext context = new HdfsContext(session, table.getDatabaseName(), table.getTableName()); Path targetPath = new Path(table.getStorage().getLocation()); return createLocationHandle(context, session, targetPath, EXISTING); }
Source:
public static void setMenuIconSize(View contentView, Rect desiredIconSize) { if (!isLargeSize()) { return; } ViewGroup content = (ViewGroup) contentView; for (int i = 0; i < content.getChildCount(); i++) { View child = content.getChildAt(i); if (child instanceof LinearLayout || child instanceof RelativeLayout || child instanceof ScrollView) { setMenuIconSize(child, desiredIconSize); } else if (child instanceof Button) { Button button = (Button) child; Drawable drawable = button.getCompoundDrawables()[0]; drawable.setBounds(desiredIconSize); button.setCompoundDrawables(drawable, null, null, null); } } }

Target:
public static void setMenuIconSize(View contentView, Rect desiredIconSize) { if (!isLargeSize()) { return; } ViewGroup content = (ViewGroup) contentView; for (int i = 0; i < content.getChildCount(); i++) { View child = content.getChildAt(i); if (child instanceof ViewGroup) { setMenuIconSize(child, desiredIconSize); } else if (child instanceof Button) { Button button = (Button) child; Drawable drawable = button.getCompoundDrawables()[0]; drawable.setBounds(desiredIconSize); button.setCompoundDrawables(drawable, null, null, null); } } }
Source:
public static boolean isLengthValid(Logger logger, short responseCommand, byte[] thisResponseData, int requiredResponseDataLength) { logger.trace("isLengthValid() called for ({}) with bytes of data.", Command.get(responseCommand).toString(), new CommandNumber(responseCommand).toString(), thisResponseData.length); if (thisResponseData.length != requiredResponseDataLength) { logger.warn( "Gateway response ({}) consists of a malformed packet (effective length is {}, required length is {}).", Command.get(responseCommand).toString(), new CommandNumber(responseCommand).toString(), thisResponseData.length, requiredResponseDataLength); return false; } else { logger.trace("isLengthValid() returns {}.", true); return true; } }

Target:
public static boolean isLengthValid(Logger logger, short responseCommand, byte[] thisResponseData, int requiredResponseDataLength) { logger.trace("isLengthValid() called for ({}) with bytes of data.", Command.get(responseCommand).toString(), new CommandNumber(responseCommand).toString(), thisResponseData.length); if (thisResponseData.length != requiredResponseDataLength) { logger.warn( "Gateway response ({}) consists of a malformed packet (effective length is {}, required length is {}).", Command.get(responseCommand).toString(), new CommandNumber(responseCommand).toString(), thisResponseData.length, requiredResponseDataLength); return false; } logger.trace("isLengthValid() returns {}.", true); return true; }
Source:
private void parsedReadWriteQueryPct(String readWriteQueryPct) { String[] readWriteQueryPctList = readWriteQueryPct.split(","); if (readWriteQueryPctList.length == 3) { try { if (Integer.valueOf(readWriteQueryPctList[0]) + Integer.valueOf(readWriteQueryPctList[1]) + Integer.valueOf(readWriteQueryPctList[2]) == 100) { readPct = Integer.valueOf(readWriteQueryPctList[0]); writePct = Integer.valueOf(readWriteQueryPctList[1]); queryPct = Integer.valueOf(readWriteQueryPctList[2]); } else { logger.warn(PERCENT_PARSING_ERROR, readPct, writePct, queryPct); } } catch (NumberFormatException ex) { logger.warn(PERCENT_PARSING_ERROR, readPct, writePct, queryPct); } } else { logger.warn(PERCENT_PARSING_ERROR, readPct, writePct, queryPct); } }

Target:
private void parsedReadWriteQueryPct(String readWriteQueryPct) { String[] readWriteQueryPctList = readWriteQueryPct.split(","); if (readWriteQueryPctList.length == 3) { try { if (Integer.valueOf(readWriteQueryPctList[0]) + Integer.valueOf(readWriteQueryPctList[1]) + Integer.valueOf(readWriteQueryPctList[2]) == 100) { readPct = Integer.valueOf(readWriteQueryPctList[0]); writePct = Integer.valueOf(readWriteQueryPctList[1]); queryPct = Integer.valueOf(readWriteQueryPctList[2]); } else { throw new IllegalArgumentException(PERCENT_PARSING_ERROR + readWriteQueryPct); } } catch (NumberFormatException ex) { throw new IllegalArgumentException(PERCENT_PARSING_ERROR + readWriteQueryPct); } } else { throw new IllegalArgumentException(PERCENT_PARSING_ERROR + readWriteQueryPct); } }
Source:
public List<OntClass> listRelated(OntClass cls) { List<OntClass> range = new ArrayList<>(); cls.listDeclaredProperties().toList().stream() .filter(OntProperty::isObjectProperty) .forEach(prop -> { prop.listRange().toList().forEach(ontRes -> { range.add(ontology.getOntClass(ontRes.getURI())); }); }); return range; }

Target:
public Set<Pair<ObjectProperty, OntClass>> listRelated(OntClass cls) { Set<Pair<ObjectProperty, OntClass>> range = new HashSet<>(); listObjectProperties(cls).stream().forEach(prop -> range.addAll(getRange(prop).stream() .map(rcls -> Pair.of(prop, rcls)) .collect(Collectors.toSet()))); return range; }
Source:
private static byte[] convertFileToByte(String xmlFilePath) { FileInputStream fileInputStream=null; File file = new File(xmlFilePath); byte[] bFile = new byte[(int) file.length()]; try { fileInputStream = new FileInputStream(file); fileInputStream.read(bFile); fileInputStream.close(); }catch(Exception e){ e.printStackTrace(); } return bFile; }

Target:
private byte[] convertFileToByte(String xmlFilePath) { ByteArrayOutputStream os = new ByteArrayOutputStream(); try { Utils.copyStream ( new File(xmlFilePath), os ); } catch (IOException e) { this.logger.severe( e.getMessage() ); } return os.toByteArray(); }
Source:
public final void authenticateURN() { final AuthKeys authKeys = new AuthKeys(); final String user = "urn:git:rultor"; final String password = "test"; MatcherAssert.assertThat( authKeys.authenticate(user, password) .name(), Matchers.equalTo(Identity.ANONYMOUS.name()) ); }

Target:
public final void authenticateURN() throws Exception { final AuthKeys authKeys = new AuthKeys(); MatcherAssert.assertThat( authKeys.authenticate("urn:git:rultor", "test").name(), Matchers.equalTo(Identity.ANONYMOUS.name()) ); }
Source:
public static boolean isIpWithtInCidrRange(final String ipAddress, final String cidr) { if (!isValidIp(ipAddress)) { return false; } if (!isValidCIDR(cidr)) { return false; } final SubnetUtils subnetUtils = new SubnetUtils(cidr); subnetUtils.setInclusiveHostCount(true); final boolean isInRange = subnetUtils.getInfo().isInRange(ipAddress); return !isInRange; }

Target:
public static boolean isIpWithtInCidrRange(final String ipAddress, final String cidr) { if (!isValidIp(ipAddress)) { return false; } if (!isValidCIDR(cidr)) { return false; } final SubnetUtils subnetUtils = new SubnetUtils(cidr); subnetUtils.setInclusiveHostCount(true); final boolean isInRange = subnetUtils.getInfo().isInRange(ipAddress); return isInRange; }
Source:
protected ActionResult execute() throws EntityDoesNotExistException { String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID); String feedbackSessionName = getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME); String nextUrl = getRequestParamValue(Const.ParamsNames.NEXT_URL); Assumption.assertNotNull(courseId); Assumption.assertNotNull(feedbackSessionName); nextUrl = nextUrl == null ? Const.ActionURIs.INSTRUCTOR_FEEDBACKS_PAGE : nextUrl; new GateKeeper().verifyAccessible( logic.getInstructorForGoogleId(courseId, account.googleId), logic.getFeedbackSession(feedbackSessionName, courseId), false, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION); logic.deleteFeedbackSession(feedbackSessionName, courseId); statusToUser.add(new StatusMessage(Const.StatusMessages.FEEDBACK_SESSION_DELETED, StatusMessageColor.SUCCESS)); statusToAdmin = "Feedback Session <span class=\"bold\">[" + feedbackSessionName + "]</span> " + "from Course: <span class=\"bold\">[" + courseId + " deleted."; nextUrl = nextUrl == null ? Const.ActionURIs.INSTRUCTOR_FEEDBACKS_PAGE : nextUrl; return createRedirectResult(nextUrl); }

Target:
protected ActionResult execute() throws EntityDoesNotExistException { String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID); String feedbackSessionName = getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME); String nextUrl = getRequestParamValue(Const.ParamsNames.NEXT_URL); Assumption.assertNotNull(courseId); Assumption.assertNotNull(feedbackSessionName); nextUrl = nextUrl == null ? Const.ActionURIs.INSTRUCTOR_FEEDBACKS_PAGE : nextUrl; new GateKeeper().verifyAccessible( logic.getInstructorForGoogleId(courseId, account.googleId), logic.getFeedbackSession(feedbackSessionName, courseId), false, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION); logic.deleteFeedbackSession(feedbackSessionName, courseId); statusToUser.add(new StatusMessage(Const.StatusMessages.FEEDBACK_SESSION_DELETED, StatusMessageColor.SUCCESS)); statusToAdmin = "Feedback Session <span class=\"bold\">[" + feedbackSessionName + "]</span> " + "from Course: <span class=\"bold\">[" + courseId + " deleted."; return createRedirectResult(nextUrl); }
Source:
private int getLocalAdminPort(IPod pod) { return PortForwardingUtils.getForwardablePorts(pod).stream().filter(p -> p.getRemotePort() == 9999) .mapToInt(p -> p.getLocalPort()).findAny().orElse(9999); }

Target:
private int getLocalAdminPort(IPod pod) { return PortForwardingUtils.getForwardablePorts(pod).stream().filter(p -> p.getRemotePort() == OpenShiftDebugUtils.NATIVE_MANAGMENT_PORT) .mapToInt(p -> p.getLocalPort()).findAny().orElse(OpenShiftDebugUtils.NATIVE_MANAGMENT_PORT); }
Source:
public Builder(CircuitBreakerConfig baseConfig) { this.waitDurationInOpenState = baseConfig.waitDurationInOpenState; this.permittedNumberOfCallsInHalfOpenState = baseConfig.permittedNumberOfCallsInHalfOpenState; this.slidingWindowSize = baseConfig.slidingWindowSize; this.slidingWindowType = baseConfig.slidingWindowType; this.minimumNumberOfCalls = baseConfig.minimumNumberOfCalls; this.failureRateThreshold = baseConfig.failureRateThreshold; this.ignoreExceptions = baseConfig.ignoreExceptions; this.recordExceptions = baseConfig.recordExceptions; this.recordExceptionPredicate = baseConfig.recordExceptionPredicate; this.ignoreExceptionPredicate = baseConfig.ignoreExceptionPredicate; this.automaticTransitionFromOpenToHalfOpenEnabled = baseConfig.automaticTransitionFromOpenToHalfOpenEnabled; this.slowCallRateThreshold = baseConfig.slowCallRateThreshold; this.slowCallDurationThreshold = baseConfig.slowCallDurationThreshold; this.disableStackTraces = baseConfig.disableStackTraces; }

Target:
public Builder(CircuitBreakerConfig baseConfig) { this.waitDurationInOpenState = baseConfig.waitDurationInOpenState; this.permittedNumberOfCallsInHalfOpenState = baseConfig.permittedNumberOfCallsInHalfOpenState; this.slidingWindowSize = baseConfig.slidingWindowSize; this.slidingWindowType = baseConfig.slidingWindowType; this.minimumNumberOfCalls = baseConfig.minimumNumberOfCalls; this.failureRateThreshold = baseConfig.failureRateThreshold; this.ignoreExceptions = baseConfig.ignoreExceptions; this.recordExceptions = baseConfig.recordExceptions; this.recordExceptionPredicate = baseConfig.recordExceptionPredicate; this.ignoreExceptionPredicate = baseConfig.ignoreExceptionPredicate; this.automaticTransitionFromOpenToHalfOpenEnabled = baseConfig.automaticTransitionFromOpenToHalfOpenEnabled; this.slowCallRateThreshold = baseConfig.slowCallRateThreshold; this.slowCallDurationThreshold = baseConfig.slowCallDurationThreshold; this.writableStackTraceEnabled = baseConfig.writableStackTraceEnabled; }
Source:
public String toString() { return "Pool[id: " + getId() + ", owner: " + ((owner == null) ? "null" : owner.getId()) + ", product: " + productId + ", quantity: " + getQuantity() + ", expires: " + getEndDate() + "]"; }

Target:
public String toString() { return "Pool[id: " + getId() + ", owner: " + owner + ", product: " + productId + ", quantity: " + getQuantity() + ", expires: " + getEndDate() + "]"; }
Source:
public boolean validate(String definition) { boolean isValid = false; try { SchemaParser schemaParser = new SchemaParser(); TypeDefinitionRegistry typeRegistry = schemaParser.parse(definition); GraphQLSchema graphQLSchema = UnExecutableSchemaGenerator.makeUnExecutableSchema(typeRegistry); SchemaValidator schemaValidation = new SchemaValidator(); Set<SchemaValidationError> validationErrors = schemaValidation.validateSchema(graphQLSchema); isValid = (validationErrors.toArray().length == 0); } catch (SchemaProblem e) { log.error("Unable to parse the GraphQL definition", e); } return isValid; }

Target:
public boolean validate(String definition) throws DefinitionValidationException { boolean isValid; try { SchemaParser schemaParser = new SchemaParser(); TypeDefinitionRegistry typeRegistry = schemaParser.parse(definition); GraphQLSchema graphQLSchema = UnExecutableSchemaGenerator.makeUnExecutableSchema(typeRegistry); SchemaValidator schemaValidation = new SchemaValidator(); Set<SchemaValidationError> validationErrors = schemaValidation.validateSchema(graphQLSchema); isValid = (validationErrors.toArray().length == 0); } catch (SchemaProblem e) { throw new DefinitionValidationException("Unable to parse the GraphQL definition", e); } return isValid; }
Source:
private void cleanUp() throws IOException { if (!packageUpdater.nodeModulesFolder.exists()) { return; } File modulesYaml = new File(packageUpdater.nodeModulesFolder, MODULES_YAML); boolean hasModulesYaml = modulesYaml.exists() && modulesYaml.isFile(); if (!enablePnpm && hasModulesYaml) { FileUtils.forceDelete(packageUpdater.nodeModulesFolder); } else if (enablePnpm && !hasModulesYaml) { File staging = new File(".staging"); if (!staging.isDirectory() || staging.listFiles( (dir, name) -> name.startsWith("pnpm-")).length == 0) { FileUtils.forceDelete(packageUpdater.nodeModulesFolder); } } }

Target:
private void cleanUp() throws IOException { if (!packageUpdater.nodeModulesFolder.exists()) { return; } File modulesYaml = new File(packageUpdater.nodeModulesFolder, MODULES_YAML); boolean hasModulesYaml = modulesYaml.exists() && modulesYaml.isFile(); if (!enablePnpm && hasModulesYaml) { FileUtils.forceDelete(packageUpdater.nodeModulesFolder); } else if (enablePnpm && !hasModulesYaml) { File staging = new File(packageUpdater.nodeModulesFolder, ".staging"); if (!staging.isDirectory() || staging.listFiles( (dir, name) -> name.startsWith("pnpm-")).length == 0) { FileUtils.forceDelete(packageUpdater.nodeModulesFolder); } } }
Source:
protected TreeSet<CClassType> getTypes() { TreeSet<CClassType> t = new TreeSet<>(Comparator.comparing(CClassType::getFQCN)); for(FullyQualifiedClassName type : types) { try { t.add(CClassType.get(type)); } catch (ClassNotFoundException ex) { throw new Error(ex); } } return t; }

Target:
protected Set<CClassType> getTypes() { Set<CClassType> t = new TreeSet<>(Comparator.comparing(CClassType::getFQCN)); for(FullyQualifiedClassName type : types) { try { t.add(CClassType.get(type)); } catch (ClassNotFoundException ex) { throw new Error(ex); } } return t; }
Source:
public void start() { try { coreContainer = (CoreContainer) getHelped().getContext() .getAttributes().get("CoreContainer"); if (coreContainer == null) { String directory = getHelped().getContext().getParameters() .getFirstValue("directory"); String configFile = getHelped().getContext().getParameters() .getFirstValue("configFile"); if (directory != null && configFile != null) { File config = new File(configFile); if (!config.exists()) { config = new File(new URI(configFile)); } coreContainer = CoreContainer.createAndLoad(Paths.get(directory), config.toPath()); } } if (coreContainer == null) { throw new RuntimeException( "Could not initialize core container"); } } catch (Exception e) { throw new RuntimeException("Could not initialize core container", e); } }

Target:
public void start() { try { coreContainer = (CoreContainer) getHelped().getContext() .getAttributes().get("CoreContainer"); if (coreContainer == null) { String directory = getHelped().getContext().getParameters() .getFirstValue("directory"); String configFile = getHelped().getContext().getParameters() .getFirstValue("configFile"); if (directory != null && configFile != null) { Path configPath = Paths.get(configFile); if (configPath.toFile().exists()) { coreContainer = CoreContainer.createAndLoad(Paths.get(directory), configPath); } else { coreContainer = CoreContainer.createAndLoad(Paths.get(directory), Paths.get(new URI(configFile))); } } } if (coreContainer == null) { throw new RuntimeException( "Could not initialize core container"); } } catch (Exception e) { throw new RuntimeException("Could not initialize core container", e); } }