auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
void writeReport() throws IOException { StringBuilder builder = new StringBuilder(); for (DumpProcessingAction action : this.clientConfiguration .getActions()) { if (this.clientConfiguration.getReportFilename() != null) { builder.append(action.getActionName() + ": "); builder.append(action.getReport()); builder.append(System.getProperty("line.separator")); } else { logger.info(action.getActionName() + ": " + action.getReport()); } } if (this.clientConfiguration.getReportFilename() != null) { Path outputDirectory = Paths.get( this.clientConfiguration.getReportFilename()).getParent(); if (outputDirectory == null) { outputDirectory = Paths.get("."); } DirectoryManager dm = DirectoryManagerFactory .createDirectoryManager(outputDirectory); OutputStream out = dm.getOutputStreamForFile(Paths .get(this.clientConfiguration.getReportFilename()) .getFileName().toString()); OutputStream bufferedFileOutputStream = new BufferedOutputStream( out, 1024 * 1024 * 5); bufferedFileOutputStream.write(builder.toString().getBytes( StandardCharsets.UTF_8)); bufferedFileOutputStream.close(); } }

Target:
void writeReport() throws IOException { StringBuilder builder = new StringBuilder(); for (DumpProcessingAction action : this.clientConfiguration .getActions()) { if (this.clientConfiguration.getReportFilename() != null) { builder.append(action.getActionName() + ": "); builder.append(action.getReport()); builder.append(System.getProperty("line.separator")); } else { logger.info(action.getActionName() + ": " + action.getReport()); } } if (this.clientConfiguration.getReportFilename() != null) { Path outputDirectory = Paths.get( this.clientConfiguration.getReportFilename()).getParent(); if (outputDirectory == null) { outputDirectory = Paths.get("."); } DirectoryManager dm = DirectoryManagerFactory .createDirectoryManager(outputDirectory); OutputStream out = dm.getOutputStreamForFile(Paths .get(this.clientConfiguration.getReportFilename()) .getFileName().toString()); out.write(builder.toString().getBytes(StandardCharsets.UTF_8)); out.close(); } }
Source:
private static Object convertValue( String name, Serializable value, AttributeType.AttributeFormat format) { if (value == null) { return null; } switch (format) { case DATE: if (!(value instanceof Date)) { LOGGER.debug( "Dropping attribute date value for because it isn't a Date object.", value, name); return null; } SimpleDateFormat dateFormat = new SimpleDateFormat(ISO_8601_DATE_FORMAT); dateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); return dateFormat.format((Date) value); case BINARY: byte[] bytes = (byte[]) value; return DatatypeConverter.printBase64Binary(bytes); case BOOLEAN: case DOUBLE: case LONG: case INTEGER: case SHORT: return value; case STRING: case XML: case FLOAT: case GEOMETRY: return value.toString(); case OBJECT: default: return null; } }

Target:
private Serializable convertValue( String name, Serializable value, AttributeType.AttributeFormat format) { if (value == null) { return null; } switch (format) { case DATE: if (!(value instanceof Date)) { LOGGER.debug( "Dropping attribute date value for because it isn't a Date object.", value, name); return null; } Instant instant = ((Date) value).toInstant(); ZoneId zoneId = ZoneId.of("UTC"); ZonedDateTime zonedDateTime = instant.atZone(zoneId); return zonedDateTime.format(formatter); case BINARY: byte[] bytes = (byte[]) value; return DatatypeConverter.printBase64Binary(bytes); case BOOLEAN: case DOUBLE: case LONG: case INTEGER: case SHORT: case STRING: case XML: case FLOAT: case GEOMETRY: return value; case OBJECT: default: return null; } }
Source:
public static Object getDefaultValue(Property swaggerProperty) { if (swaggerProperty instanceof IntegerProperty) { return ((IntegerProperty) swaggerProperty).getDefault(); } else if (swaggerProperty instanceof LongProperty) { return ((LongProperty) swaggerProperty).getDefault(); } else if (swaggerProperty instanceof FloatProperty) { return ((FloatProperty) swaggerProperty).getDefault(); } else if (swaggerProperty instanceof DoubleProperty) { return ((DoubleProperty) swaggerProperty).getDefault(); } else if (swaggerProperty instanceof UUIDProperty) { return ((UUIDProperty) swaggerProperty).getDefault(); } else if (swaggerProperty instanceof StringProperty) { return ((StringProperty) swaggerProperty).getDefault(); } return null; }

Target:
public static Object getDefaultValue(Property swaggerProperty) { if (swaggerProperty instanceof IntegerProperty) { return ((IntegerProperty) swaggerProperty).getDefault(); } else if (swaggerProperty instanceof LongProperty) { return ((LongProperty) swaggerProperty).getDefault(); } else if (swaggerProperty instanceof FloatProperty) { return ((FloatProperty) swaggerProperty).getDefault(); } else if (swaggerProperty instanceof DoubleProperty) { return ((DoubleProperty) swaggerProperty).getDefault(); } else if (swaggerProperty instanceof UUIDProperty) { return ((UUIDProperty) swaggerProperty).getDefault(); } else if (swaggerProperty instanceof StringProperty) { return ((StringProperty) swaggerProperty).getDefault(); } LOGGER.warning("Cannot get the default value " + "from a swagger property of unknown type '" + swaggerProperty.getType() + "'"); return null; }
Source:
public Set<Language> whitelistedLanguages() { if (isCdtPresent()) { return Collections.singleton(Language.CPP); } return Collections.emptySet(); }

Target:
public Set<Language> whitelistedLanguages() { if (isCdtPresent()) { return EnumSet.of(Language.CPP, Language.C); } return Collections.emptySet(); }
Source:
public void setDebugStatus( Reporter reporter, String message ) { if ( debug ) { log.setLogLevel(LogLevel.DEBUG); log.logDebug( message ); reporter.setStatus( message ); } }

Target:
public void setDebugStatus( Reporter reporter, String message ) { if ( log.isDebug() ) { log.logDebug( message ); reporter.setStatus( message ); } }
Source:
protected Map<String, Pair<String, String>> getExclusiveLocks() { Set<Guid> directLunsToLock = getParameters().getAttachedDirectLunDisksIds() == null ? getDiskToLunIdsOfDirectLunsAttachedToVmsInPool().keySet() : getParameters().getAttachedDirectLunDisksIds(); return directLunsToLock.stream() .collect(Collectors.toMap(Guid::toString, diskId -> LockMessagesMatchUtil.makeLockingPair( LockingGroup.DISK, EngineMessage.ACTION_TYPE_FAILED_OBJECT_LOCKED))); }

Target:
protected Map<String, Pair<String, String>> getExclusiveLocks() { Set<Guid> directLunsToLock = Optional.ofNullable(getParameters().getAttachedDirectLunDisksIds()) .orElse(getDiskToLunIdsOfDirectLunsAttachedToVmsInPool().keySet()); return directLunsToLock.stream() .collect(Collectors.toMap(Guid::toString, diskId -> LockMessagesMatchUtil.makeLockingPair( LockingGroup.DISK, EngineMessage.ACTION_TYPE_FAILED_OBJECT_LOCKED))); }
Source:
public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException { if (config.getHstsMaxAge() != null && requestContext.getSecurityContext().isSecure()) { StringBuilder headerValue = new StringBuilder(String.format("%s=%d", MAX_AGE, config.getHstsMaxAge().roundTo(TimeUnit.SECONDS))); if (config.isIncludeSubDomains()) { headerValue.append(INCLUDE_SUB_DOMAINS); } if (config.isPreload()) { headerValue.append(PRELOAD); } responseContext.getHeaders().putSingle(HSTS, headerValue); } }

Target:
public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException { if (headerValue != null && requestContext.getSecurityContext().isSecure()) { responseContext.getHeaders().putSingle(HSTS, headerValue); } }
Source:
public Response removePhraseFromPackage(@HeaderParam("Authorization") String authorization, @PathParam("package") String packageCode, @PathParam("pageName") String pageName, @PathParam("id") UUID phraseId) { logger.info(String.format("Adding phrase w/ authorization %s", authorization)); AuthorizationRecord.checkAdminAccess(authorizationService.getAuthorizationRecord(null, authorization), clock.currentDateTime()); logger.info(String.format("Adding phrase, admin validated. Adding phrase for %s-%s", packageCode, pageName)); Optional<GodToolsTranslation> translationOptional = draftTranslation.retrieve(BASE_LANGUAGE_CODE, packageCode, false); if(!translationOptional.isPresent()) { translationOptional = publishedTranslation.retrieve(BASE_LANGUAGE_CODE, packageCode, false); if(!translationOptional.isPresent()) { logger.warn("Something weird... no published English translation for: " + packageCode); return Response.status(Response.Status.BAD_REQUEST).build(); } } Optional<PageStructure> pageOptional = translationOptional.get().getPage(pageName); if(!pageOptional.isPresent()) { logger.warn(String.format("Listing phrases, Page %s not found English translation for %s", pageName, packageCode)); return Response.status(Response.Status.NOT_FOUND).build(); } Package gtPackage = packageService.selectByCode(packageCode); translationElementService.delete(phraseId); translationUpload.doUpload(gtPackage.getTranslationProjectId(), BASE_LANGUAGE_CODE, pageName, true); return Response .noContent() .build(); }

Target:
public Response removePhraseFromPackage(@HeaderParam("Authorization") String authorization, @PathParam("package") String packageCode, @PathParam("pageName") String pageName, @PathParam("id") UUID phraseId) { logger.info(String.format("Removing phrase w/ authorization %s", authorization)); AuthorizationRecord.checkAdminAccess(authorizationService.getAuthorizationRecord(null, authorization), clock.currentDateTime()); logger.info(String.format("Removing phrase, admin validated. Adding phrase for %s-%s", packageCode, pageName)); Optional<GodToolsTranslation> translationOptional = getGodToolsTranslationOptional(packageCode); Optional<PageStructure> pageOptional = translationOptional.get().getPage(pageName); if(!pageOptional.isPresent()) { logger.warn(String.format("Removing phrases, Page %s not found English translation for %s", pageName, packageCode)); return Response.status(Response.Status.NOT_FOUND).build(); } Package gtPackage = packageService.selectByCode(packageCode); translationElementService.delete(phraseId); translationUpload.doUpload(gtPackage.getTranslationProjectId(), BASE_LANGUAGE_CODE, pageName, true); return Response .noContent() .build(); }
Source:
public boolean refreshConfigurations(String accessToken, Map<String, String> results) { boolean isSuccess = true; List<RandomizationConfiguration> randomizationConfigurations = new ArrayList<>(); ArrayList<Study> studies = studyDao.findAll(); studies.stream().filter(study->study.getStatus() == Status.AVAILABLE && StringUtils.isNotEmpty(study.getStudyEnvUuid())) .forEach(study-> { List<ModuleConfigDTO> configs = studyBuildService.getModuleConfigsFromStudyService(accessToken, study); String moduleEnabled = studyBuildService.isModuleEnabled(configs, study, Modules.RANDOMIZE); if (StringUtils.equalsIgnoreCase(moduleEnabled, StudyBuildService.ENABLED)) try { randomizationConfigurations.add(retrieveConfiguration(study.getStudyEnvUuid(), accessToken)); results.put(study.getOc_oid(), SUCCESS_STR); } catch (Exception e) { log.error("Error getting Randomize configuration for studyEnvUuid:" + study.getStudyEnvUuid()); log.error("Exception:" + e); results.put(study.getOc_oid(), "FAILED. Error:" + e.getMessage()); } }); randomizationMap.entrySet().stream().forEach(entry->{ if (results.get(entry.getValue().getConfiguration().getStudyOID()) == null) { randomizationMap.remove(entry.getKey()); } }); randomizationConfigurations.stream().forEach(config->{ randomizationMap.put(config.getStudyEnvUuid(), new RandomizationData(true, config)); }); isSuccess = results.size() == randomizationConfigurations.size() ? true: false; return isSuccess; }

Target:
public boolean refreshConfigurations(String accessToken, Map<String, String> results) { boolean isSuccess = true; List<RandomizationConfiguration> randomizationConfigurations = new ArrayList<>(); ArrayList<Study> studies = studyDao.findAll(); studies.stream().filter(study->study.getStatus() == Status.AVAILABLE && StringUtils.isNotEmpty(study.getStudyEnvUuid())) .forEach(study-> { List<ModuleConfigDTO> configs = studyBuildService.getModuleConfigsFromStudyService(accessToken, study); String moduleEnabled = studyBuildService.isModuleEnabled(configs, study, Modules.RANDOMIZE); if (StringUtils.equalsIgnoreCase(moduleEnabled, ModuleStatus.ENABLED.name())) { boolean isRetrieveSuccess = false; try { randomizationConfigurations.add(retrieveConfiguration(study.getStudyEnvUuid(), accessToken)); isRetrieveSuccess = true; } catch (Exception e) { log.error("Error getting Randomize configuration for studyEnvUuid:" + study.getStudyEnvUuid()); log.error("Exception:" + e); results.put(study.getOc_oid(), "FAILED. Error:" + e.getMessage()); } if (isRetrieveSuccess) results.put(study.getOc_oid(), SUCCESS_STR); } }); randomizationMap.entrySet().stream().forEach(entry->{ if (results.get(entry.getValue().getConfiguration().getStudyOID()) == null) { randomizationMap.remove(entry.getKey()); } }); randomizationConfigurations.stream().forEach(config->{ randomizationMap.put(config.getStudyEnvUuid(), new RandomizationData(true, config)); }); isSuccess = results.size() == randomizationConfigurations.size() ? true: false; return isSuccess; }
Source:
public Breakpoints parse(NodeJsOutput nodeJsOutput) throws NodeJsDebuggerParseException { final List<Breakpoint> breakpoints = new ArrayList<>(); @SuppressWarnings("unchecked") Map<String, Object> m = GSON.fromJson(nodeJsOutput.getOutput(), Map.class); if (m.containsKey("breakpoints")) { @SuppressWarnings("unchecked") Iterator<Map> iter = ((Iterable)m.get("breakpoints")).iterator(); while (iter.hasNext()) { @SuppressWarnings("unchecked") Map<String, Object> item = iter.next(); try { final String condition = (String)item.get("condition"); final boolean isEnabled = (Boolean)item.getOrDefault("active", false); final int lineNumber = ((Double)item.get("line")).intValue(); final String target; String targetType = (String)item.get("type"); switch (targetType) { case "scriptId": target = item.get("script_id").toString(); break; case "scriptRegExp": target = (String)item.get("script_regexp"); break; default: throw new IllegalArgumentException("Unsupported 'type' value: " + targetType); } Location location = new LocationImpl(targetType + ":" + target, lineNumber + 1); Breakpoint breakpoint = new BreakpointImpl(location, isEnabled, condition); breakpoints.add(breakpoint); } catch (Exception e) { LOG.error("Failed to parse breakpoint: " + item.toString(), e); } } } return new Breakpoints(breakpoints); }

Target:
public Breakpoints parse(NodeJsOutput nodeJsOutput) throws NodeJsDebuggerParseException { final List<Breakpoint> breakpoints = new ArrayList<>(); JsonObject json = new JsonParser().parse(nodeJsOutput.getOutput()).getAsJsonObject(); if (json.has("breakpoints")) { Iterator<JsonElement> iter = json.getAsJsonArray("breakpoints").iterator(); while (iter.hasNext()) { JsonObject item = iter.next().getAsJsonObject(); try { final String condition = item.has("condition") && !item.get("condition").isJsonNull() ? item.get("condition").getAsString() : null; final boolean isEnabled = item.has("active") && !item.get("active").isJsonNull() && item.get("active").getAsBoolean(); final int lineNumber = item.get("line").getAsInt(); final String target; String targetType = item.get("type").getAsString(); switch (targetType) { case "scriptId": target = String.valueOf(item.get("script_id").getAsInt()); break; case "scriptRegExp": target = item.get("script_regexp").getAsString(); break; default: throw new IllegalArgumentException("Unsupported 'type' value: " + targetType); } Location location = new LocationImpl(targetType + ":" + target, lineNumber + 1); Breakpoint breakpoint = new BreakpointImpl(location, isEnabled, condition); breakpoints.add(breakpoint); } catch (Exception e) { LOG.error("Failed to parse breakpoint: " + item.toString(), e); } } } return new Breakpoints(breakpoints); }
Source:
private List<Message> readNewMessagesFromZK(HelixManager manager, String instanceName, HelixConstants.ChangeType changeType) { HelixDataAccessor accessor = manager.getHelixDataAccessor(); Builder keyBuilder = accessor.keyBuilder(); Set<String> messageIds = new HashSet<>(); if (changeType.equals(HelixConstants.ChangeType.MESSAGE)) { messageIds.addAll(accessor.getChildNames(keyBuilder.messages(instanceName))); } else if (changeType.equals(HelixConstants.ChangeType.MESSAGES_CONTROLLER)) { messageIds.addAll(accessor.getChildNames(keyBuilder.controllerMessages())); } else { LOG.warn("Unexpected ChangeType for Message Change CallbackHandler: " + changeType); return Collections.emptyList(); } _knownMessageIds.retainAll(messageIds); messageIds.removeAll(_knownMessageIds); List<PropertyKey> keys = new ArrayList<>(); for (String messageId : messageIds) { if (changeType.equals(HelixConstants.ChangeType.MESSAGE)) { keys.add(keyBuilder.message(instanceName, messageId)); } else if (changeType.equals(HelixConstants.ChangeType.MESSAGES_CONTROLLER)) { keys.add(keyBuilder.controllerMessage(messageId)); } } List<Message> newMessages = accessor.getProperty(keys, true); Iterator<Message> messageIterator = newMessages.iterator(); while(messageIterator.hasNext()) { if (messageIterator.next() == null) { messageIterator.remove(); } } return newMessages; }

Target:
private List<Message> readNewMessagesFromZK(HelixManager manager, String instanceName, HelixConstants.ChangeType changeType) { HelixDataAccessor accessor = manager.getHelixDataAccessor(); Builder keyBuilder = accessor.keyBuilder(); Set<String> messageIds = new HashSet<>(); if (changeType.equals(HelixConstants.ChangeType.MESSAGE)) { messageIds.addAll(accessor.getChildNames(keyBuilder.messages(instanceName))); } else if (changeType.equals(HelixConstants.ChangeType.MESSAGES_CONTROLLER)) { messageIds.addAll(accessor.getChildNames(keyBuilder.controllerMessages())); } else { LOG.warn("Unexpected ChangeType for Message Change CallbackHandler: " + changeType); return Collections.emptyList(); } _knownMessageIds.retainAll(messageIds); messageIds.removeAll(_knownMessageIds); List<PropertyKey> keys = new ArrayList<>(); for (String messageId : messageIds) { if (changeType.equals(HelixConstants.ChangeType.MESSAGE)) { keys.add(keyBuilder.message(instanceName, messageId)); } else if (changeType.equals(HelixConstants.ChangeType.MESSAGES_CONTROLLER)) { keys.add(keyBuilder.controllerMessage(messageId)); } } List<Message> newMessages = accessor.getProperty(keys, false); Iterator<Message> messageIterator = newMessages.iterator(); while(messageIterator.hasNext()) { if (messageIterator.next() == null) { messageIterator.remove(); } } return newMessages; }
Source:
Slf4j(final Class<?> clazz) { this(clazz, Slf4j.DEFAULT_LEVEL); }

Target:
Slf4j(final Class<?> clazz) { this(clazz.getName()); }
Source:
public static Money zero() { return new Money(org.joda.money.BigMoney.zero(CurrencyManager.getInstance().getDefaultCurrency())); }

Target:
public static Money zero() { return zero(CurrencyManager.getInstance().getDefaultCurrency()); }
Source:
public Object getResult(VarianceData data) { return new Double(Math.sqrt(data.squaredSum / data.count)); }

Target:
public Double getResult(VarianceData data) { return Math.sqrt(super.getResult(data)); }
Source:
public boolean isActive() { return isActive && (Math.abs(speed - 1f) >= CLOSE_THRESHOLD || Math.abs(pitch - 1f) >= CLOSE_THRESHOLD); }

Target:
public boolean isActive() { return (Math.abs(speed - 1f) >= CLOSE_THRESHOLD || Math.abs(pitch - 1f) >= CLOSE_THRESHOLD); }
Source:
public static ShannonEntropy createEntropy(final List<Rule> passwordRules, final PasswordData passwordData) { final boolean[] dictionaryCheck = new boolean[1]; final boolean[] compositionCheck = new boolean[1]; passwordRules.stream().forEach((rule) -> { if (!compositionCheck[0]) { if (rule instanceof CharacterCharacteristicsRule) { final CharacterCharacteristicsRule characteristicRule = (CharacterCharacteristicsRule) rule; for (CharacterRule r : characteristicRule.getRules()) { compositionCheck[0] = hasComposition(r, r.getValidCharacters(), passwordData); if (compositionCheck[0]) { break; } } } else if (rule instanceof AllowedCharacterRule) { final AllowedCharacterRule allowedCharacterRule = (AllowedCharacterRule) rule; compositionCheck[0] = hasComposition( rule, String.valueOf(allowedCharacterRule.getAllowedCharacters()), passwordData); } } if (AbstractDictionaryRule.class.isAssignableFrom(rule.getClass())) { dictionaryCheck[0] = true; } }); return new ShannonEntropy(dictionaryCheck[0], compositionCheck[0], passwordData.getPassword().length()); }

Target:
public static ShannonEntropy createEntropy(final List<Rule> passwordRules, final PasswordData passwordData) { if (!passwordData.getOrigin().equals(PasswordData.Origin.User)) { throw new IllegalArgumentException("Password data must have an origin of " + PasswordData.Origin.User); } boolean dictionaryCheck = false; boolean compositionCheck = false; for (Rule rule : passwordRules) { if (!compositionCheck) { if (rule instanceof CharacterCharacteristicsRule) { final CharacterCharacteristicsRule characteristicRule = (CharacterCharacteristicsRule) rule; for (CharacterRule r : characteristicRule.getRules()) { compositionCheck = hasComposition(r, r.getValidCharacters(), passwordData); if (compositionCheck) { break; } } } else if (rule instanceof CharacterRule) { final CharacterRule characterRule = (CharacterRule) rule; compositionCheck = hasComposition(characterRule, characterRule.getValidCharacters(), passwordData); } else if (rule instanceof AllowedCharacterRule) { final AllowedCharacterRule allowedCharacterRule = (AllowedCharacterRule) rule; compositionCheck = hasComposition( rule, String.valueOf(allowedCharacterRule.getAllowedCharacters()), passwordData); } } if (AbstractDictionaryRule.class.isAssignableFrom(rule.getClass())) { dictionaryCheck = true; } } return new ShannonEntropy(dictionaryCheck, compositionCheck, passwordData.getPassword().length()); }
Source:
public String toString() { return MoreObjects.toStringHelper(this) .add("name", name) .add("column", columnName) .add("expression", expressionStr) .toString(); }

Target:
public String toString() { return "CheckColumnConstraint{" + "name='" + name + '\'' + ", columnName='" + columnName + '\'' + ", expression=" + expression + '}'; }
Source:
private static Collection<MethodNode> removeCovariantsAndInterfaceEquivalents(Collection<MethodNode> collection) { if (collection.size()<=1) return collection; List<MethodNode> toBeRemoved = new LinkedList<MethodNode>(); List<MethodNode> list = new LinkedList<MethodNode>(new HashSet<MethodNode>(collection)); for (int i=0;i<list.size()-1;i++) { MethodNode one = list.get(i); if (toBeRemoved.contains(one)) continue; for (int j=i+1;j<list.size();j++) { MethodNode two = list.get(j); if (toBeRemoved.contains(two)) continue; Parameter[] onePars = one.getParameters(); Parameter[] twoPars = two.getParameters(); if (onePars.length == twoPars.length) { if (areOverloadMethodsInSameClass(one,two)) { if (ParameterUtils.parametersEqual(onePars, twoPars)){ removeMethodWithSuperReturnType(toBeRemoved, one, two); } else { removeSyntheticMethodIfOne(toBeRemoved, one, two); } }else if(areEquivalentInterfaceMethods(one, two, onePars, twoPars)){ removeMethodInSuperInterface(toBeRemoved, one, two); } } } } if (toBeRemoved.isEmpty()) return list; List<MethodNode> result = new LinkedList<MethodNode>(list); result.removeAll(toBeRemoved); return result; }

Target:
private static Collection<MethodNode> removeCovariantsAndInterfaceEquivalents(Collection<MethodNode> collection) { if (collection.size()<=1) return collection; List<MethodNode> toBeRemoved = new LinkedList<MethodNode>(); List<MethodNode> list = new LinkedList<MethodNode>(new HashSet<MethodNode>(collection)); for (int i=0;i<list.size()-1;i++) { MethodNode one = list.get(i); if (toBeRemoved.contains(one)) continue; for (int j=i+1;j<list.size();j++) { MethodNode two = list.get(j); if (toBeRemoved.contains(two)) continue; if (one.getParameters().length == two.getParameters().length) { if (areOverloadMethodsInSameClass(one,two)) { if (ParameterUtils.parametersEqual(one.getParameters(), two.getParameters())){ removeMethodWithSuperReturnType(toBeRemoved, one, two); } else { removeSyntheticMethodIfOne(toBeRemoved, one, two); } }else if(areEquivalentInterfaceMethods(one, two)){ removeMethodInSuperInterface(toBeRemoved, one, two); } } } } if (toBeRemoved.isEmpty()) return list; List<MethodNode> result = new LinkedList<MethodNode>(list); result.removeAll(toBeRemoved); return result; }
Source:
default <T> List<T> findDescendantsOfType(Class<T> targetType) { final List<T> list = new ArrayList<>(); TraversalUtils.findDescendantsOfType(this, targetType, list, false); return list; }

Target:
default <T> List<T> findDescendantsOfType(Class<T> targetType) { return findDescendantsOfType(targetType, false); }
Source:
public void setup() throws Exception { System.setProperty("java.naming.factory.initial", "org.osjava.sj.SimpleContextFactory"); System.setProperty("org.osjava.sj.root", "file://src/test/resources"); System.setProperty("org.osjava.sj.delimiter", "."); System.setProperty("jndi.syntax.separator", "/"); System.setProperty("org.osjava.sj.space", "java:/comp/env"); this.initContext = new InitialContext(); }

Target:
public void setup() throws Exception { this.initContext = new InitialContext(); }
Source:
public String toString() { return "MistDataEvent with value: " + value.toString() + ", timestamp: " + timestamp; }

Target:
public String toString() { return new StringBuilder("MistDataEvent with value: ") .append(value.toString()) .append(", timestamp: ") .append(timestamp) .toString(); }
Source:
public long extractTimestampMillis(final Message message) { JSONObject jsonObject = (JSONObject) JSONValue.parse(message.getPayload()); if (jsonObject != null) { Object fieldValue = jsonObject.get(mConfig.getMessageTimestampName()); if (fieldValue != null) { String timestamp = fieldValue.toString(); try { return toMillis(Double.valueOf(timestamp).longValue()); } catch (NumberFormatException e) { DateTime dateTime = new DateTime(timestamp); return dateTime.getMillis(); } } } return 0; }

Target:
public long extractTimestampMillis(final Message message) { JSONObject jsonObject = (JSONObject) JSONValue.parse(message.getPayload()); if (jsonObject != null) { Object fieldValue = jsonObject.get(mConfig.getMessageTimestampName()); if (fieldValue != null) { return toMillis(Double.valueOf(fieldValue.toString()).longValue()); } } return 0; }
Source:
private void initSmartLockForPasswords() { if (!isSmartLockAvailable()) { return; } mCredentialsClient = new GoogleApiClient.Builder(getActivity()) .addConnectionCallbacks(this) .enableAutoManage(getActivity(), this) .addApi(Auth.CREDENTIALS_API) .build(); }

Target:
private void initSmartLockForPasswords() { if (!isGooglePlayServicesAvailable()) { return; } mCredentialsClient = new GoogleApiClient.Builder(getActivity()) .addConnectionCallbacks(this) .enableAutoManage(getActivity(), this) .addApi(Auth.CREDENTIALS_API) .build(); }
Source:
private CreateWsResponse doHandle(DbSession dbSession, CreateRequest createRequest, Request request, OrganizationDto organization) { QProfileResult result = new QProfileResult(); QualityProfileDto profile = profileFactory.checkAndCreate(dbSession, organization, QProfileName.createFor(createRequest.getLanguage(), createRequest.getProfileName())); result.setProfile(profile); for (ProfileImporter importer : importers) { String importerKey = importer.getKey(); InputStream contentToImport = request.paramAsInputStream(getBackupParamName(importerKey)); if (contentToImport != null) { result.add(exporters.importXml(profile, importerKey, contentToImport, dbSession)); } } String organizationKey = qProfileWsSupport.getOrganization(dbSession, result.profile()).getKey(); dbSession.commit(); activeRuleIndexer.index(result.getChanges()); return buildResponse(result, organizationKey); }

Target:
private CreateWsResponse doHandle(DbSession dbSession, CreateRequest createRequest, Request request, OrganizationDto organization) { QProfileResult result = new QProfileResult(); QualityProfileDto profile = profileFactory.checkAndCreate(dbSession, organization, QProfileName.createFor(createRequest.getLanguage(), createRequest.getProfileName())); result.setProfile(profile); for (ProfileImporter importer : importers) { String importerKey = importer.getKey(); InputStream contentToImport = request.paramAsInputStream(getBackupParamName(importerKey)); if (contentToImport != null) { result.add(exporters.importXml(profile, importerKey, contentToImport, dbSession)); } } dbSession.commit(); activeRuleIndexer.index(result.getChanges()); return buildResponse(result, organization); }
Source:
public void testMetricIngestionWithEnum() throws Exception { final String tenant_id = "333333"; String prefix = getPrefix(); final String metric_name = prefix + "enum_metric_test"; Set<Locator> locators = new HashSet<Locator>(); locators.add(Locator.createLocatorFromPathComponents(tenant_id, metric_name)); HttpResponse response = postMetric(tenant_id, postAggregatedPath, "sample_enums_payload.json", prefix ); assertEquals( "Should get status 200 from ingestion server for POST", 200, response.getStatusLine().getStatusCode() ); EntityUtils.consume(response.getEntity()); EnumValidator enumValidator = new EnumValidator(locators); enumValidator.run(); Thread.sleep(3000); HttpResponse query_response = queryMetricIncludeEnum(tenant_id, metric_name); assertEquals( "Should get status 200 from query server for GET", 200, query_response.getStatusLine().getStatusCode() ); String responseContent = EntityUtils.toString(query_response.getEntity(), "UTF-8"); assertEquals( String.format( "[{\"metric\":\"%s\",\"enum_values\":[\"v1\",\"v2\",\"v3\"]}]", metric_name ), responseContent ); EntityUtils.consume(query_response.getEntity()); }

Target:
public void testMetricIngestionWithEnum() throws Exception { final String tenant_id = "333333"; String postfix = getPostfix(); final String metric_name = "enum_metric_test" + postfix; Set<Locator> locators = new HashSet<Locator>(); locators.add(Locator.createLocatorFromPathComponents(tenant_id, metric_name)); HttpResponse response = postMetric(tenant_id, postAggregatedPath, "sample_enums_payload.json", postfix ); assertEquals( "Should get status 200 from ingestion server for POST", 200, response.getStatusLine().getStatusCode() ); EntityUtils.consume(response.getEntity()); EnumValidator enumValidator = new EnumValidator(locators); enumValidator.run(); Thread.sleep(3000); HttpResponse query_response = queryMetricIncludeEnum(tenant_id, metric_name); assertEquals( "Should get status 200 from query server for GET", 200, query_response.getStatusLine().getStatusCode() ); String responseContent = EntityUtils.toString(query_response.getEntity(), "UTF-8"); assertEquals( String.format( "[{\"metric\":\"%s\",\"enum_values\":[\"v1\",\"v2\",\"v3\"]}]", metric_name ), responseContent ); EntityUtils.consume(query_response.getEntity()); }
Source:
protected void drawStepContent() { Text textWidget = new Text(textToShow); ScrollPane scrollPane = new ScrollPane(); scrollPane.setBackground(new Background(new BackgroundFill(Color.WHITE, CornerRadii.EMPTY, Insets.EMPTY))); scrollPane.setStyle("-fx-background: #F4F4F4; -fx-border-color: #F4F4F4;"); scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); scrollPane.setFitToWidth(true); scrollPane.setContent(new TextFlow(textWidget)); this.addToContentPane(scrollPane); }

Target:
protected void drawStepContent() { Text textWidget = new Text(textToShow); ScrollPane scrollPane = new ScrollPane(); scrollPane.setId("stepScrollPane"); scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); scrollPane.setFitToWidth(true); scrollPane.setContent(new TextFlow(textWidget)); this.addToContentPane(scrollPane); }
Source:
public void shouldReportOOMAfterWait() { try ( GenericContainer container = new GenericContainer<>() .waitingFor(new WaitForState(ContainerState::getOOMKilled)) .withCreateContainerCmdModifier(it -> { it.getHostConfig().withMemory(4 * FileUtils.ONE_MB); }) .withCommand("sh", "-c", "usleep 100; dd if=/dev/urandom bs=128GB count=1 > test.txt") ) { assertThatThrownBy(container::start) .hasStackTraceContaining("Container crashed with out-of-memory"); } }

Target:
public void shouldReportOOMAfterWait() { try ( GenericContainer container = new GenericContainer<>() .withStartupCheckStrategy(new NoopStartupCheckStrategy()) .waitingFor(new WaitForState(ContainerState::getOOMKilled)) .withCreateContainerCmdModifier(it -> { it.getHostConfig().withMemory(4 * FileUtils.ONE_MB); }) .withCommand("sh", "-c", "A='0123456789'; for i in $(seq 0 32); do A=$A$A; done") ) { assertThatThrownBy(container::start) .hasStackTraceContaining("Container crashed with out-of-memory"); } }
Source:
private Integer getQosBandwidth(Guid clusterId) { final HostNetworkQos migrationalHostNetworkQos = getDbFacade().getHostNetworkQosDao() .getHostNetworkQosOfMigrationNetworkByClusterId(clusterId); if (migrationalHostNetworkQos == null) { return null; } if (migrationalHostNetworkQos.getOutAverageRealtime() != null) { return migrationalHostNetworkQos.getOutAverageRealtime(); } return migrationalHostNetworkQos.getOutAverageUpperlimit(); }

Target:
private Integer getQosBandwidth(Guid clusterId) { final HostNetworkQos migrationHostNetworkQos = getDbFacade().getHostNetworkQosDao() .getHostNetworkQosOfMigrationNetworkByClusterId(clusterId); if (migrationHostNetworkQos == null) { return null; } if (migrationHostNetworkQos.getOutAverageRealtime() != null) { return migrationHostNetworkQos.getOutAverageRealtime(); } return migrationHostNetworkQos.getOutAverageUpperlimit(); }
Source:
private List<String> generateTableList() throws ODataServiceFault { List<String> tableList = new ArrayList<>(); Connection connection = null; ResultSet rs = null; try { connection = initializeConnection(); DatabaseMetaData meta = connection.getMetaData(); if (meta.getDatabaseProductName().toLowerCase().contains(ORACLE_SERVER)) { rs = meta.getTables(null, meta.getUserName(), null, new String[] { TABLE, VIEW }); } else if (meta.getDatabaseProductName().toLowerCase().contains(MSSQL_SERVER)) { rs = meta.getTables(null, connection.getSchema(), null, new String[] { TABLE, VIEW }); } else { rs = meta.getTables(null, null, null, new String[] { TABLE, VIEW }); } while (rs.next()) { String tableName = rs.getString(TABLE_NAME); tableList.add(tableName); } if (meta.getDatabaseProductName().toLowerCase().contains(ORACLE_SERVER) && !connection.getSchema(). equals(meta.getUserName())) { rs = meta.getTables(null, connection.getSchema(), null, new String[] { TABLE, VIEW }); while (rs.next()) { String tableName = rs.getString(TABLE_NAME); tableList.add(tableName); } } return tableList; } catch (SQLException e) { throw new ODataServiceFault(e, "Error in reading tables from the database. :" + e.getMessage()); } finally { releaseResources(rs, null); releaseConnection(connection); } }

Target:
private List<String> generateTableList() throws ODataServiceFault { List<String> tableList = new ArrayList<>(); Connection connection = null; ResultSet rs = null; try { connection = initializeConnection(); DatabaseMetaData meta = connection.getMetaData(); if (meta.getDatabaseProductName().toLowerCase().contains(ORACLE_SERVER)) { rs = meta.getTables(null, meta.getUserName(), null, new String[] { TABLE, VIEW }); } else if (meta.getDatabaseProductName().toLowerCase().contains(MSSQL_SERVER)) { rs = meta.getTables(null, connection.getSchema(), null, new String[] { TABLE, VIEW }); } else { rs = meta.getTables(null, null, null, new String[] { TABLE, VIEW }); } while (rs.next()) { String tableName = rs.getString(TABLE_NAME); tableList.add(tableName); } if (connection.getSchema() != null) { if (meta.getDatabaseProductName().toLowerCase().contains(ORACLE_SERVER) && !connection.getSchema(). equals(meta.getUserName())) { rs = meta.getTables(null, connection.getSchema(), null, new String[] { TABLE, VIEW }); while (rs.next()) { String tableName = rs.getString(TABLE_NAME); tableList.add(tableName); } } } return tableList; } catch (SQLException e) { throw new ODataServiceFault(e, "Error in reading tables from the database. :" + e.getMessage()); } finally { releaseResources(rs, null); releaseConnection(connection); } }
Source:
private void processDirectoryTree(Path path) throws IOException, InterruptedException { FileStatus[] fileStatuses = abfsStore.listStatus(path); for (FileStatus fileStatus : fileStatuses) { if (fileStatus.isDirectory()) { queue.put(fileStatus); processDirectory(); synchronized (this) { if (!queue.isEmpty()) { executorService.submit(() -> { try { FileStatus fileStatus1; while ((fileStatus1 = queue.poll(100, TimeUnit.MILLISECONDS)) != null) { processDirectoryTree(fileStatus1.getPath()); } } catch (InterruptedException | IOException e) { e.printStackTrace(); } }); } } } else { processFile(fileStatus); } } }

Target:
private void processDirectoryTree(Path path) throws IOException, InterruptedException { FileStatus[] fileStatuses = abfsStore.listStatus(path); for (FileStatus fileStatus : fileStatuses) { if (fileStatus.isDirectory()) { queue.put(fileStatus); processDirectory(); synchronized (this) { if (!queue.isEmpty() && numTasks.get() < NUM_THREADS) { numTasks.incrementAndGet(); Future<Object> future = executorService.submit(() -> { FileStatus fileStatus1; while ((fileStatus1 = queue.poll(POLL_TIMEOUT, TimeUnit.MILLISECONDS)) != null) { processDirectoryTree(fileStatus1.getPath()); } numTasks.decrementAndGet(); return null; }); futures.add(future); } } } else { processFile(fileStatus); } } }
Source:
public Pattern getHeaderPattern(String key) { String pattern = configuration.getString(key); if(pattern == null) return null; return Pattern.compile(configuration.getString(key)); }

Target:
public Optional<Pattern> getHeaderPattern(String key) { Optional<String> property = getString(key); if (property.isPresent()) { return Optional.of(Pattern.compile(property.get())); } else { return Optional.empty(); } }
Source:
public void downloadLockedEmailTest() throws Exception { when(authService.getUserDetails("test@test.com")) .thenReturn((Map)ImmutableMap.of( "locked", true )); this.mockMvc.perform(get("/occurrences/offline/download*") .param("reasonTypeId", "10") .param("email", "test@test.com")) .andExpect(status().is4xxClientError()); verify(authService).getUserDetails("test@test.com"); }

Target:
public void downloadLockedEmailTest() throws Exception { when(authService.getUserDetails("test@test.com")) .thenReturn((Map)ImmutableMap.of( "activated", true, "locked", true )); this.mockMvc.perform(get("/occurrences/offline/download*") .param("reasonTypeId", "10") .param("email", "test@test.com")) .andExpect(status().is4xxClientError()); verify(authService).getUserDetails("test@test.com"); }
Source:
public boolean belongsTo(Object family) { return family == AbstractDispatchJob.class; }

Target:
public boolean belongsTo(Object family) { return family == EventDispatcher.class || family == EventDispatcher.this; }
Source:
public String getName() { return "Line"; }

Target:
public String getName() { return "line"; }
Source:
private boolean contentCheck(DirCacheEntry entry) { if (getEntryObjectId().equals(entry.getObjectId())) { entry.setLength((int) getEntryLength()); return false; } else { switch (getOptions().getAutoCRLF()) { case INPUT: case TRUE: InputStream dcIn = null; try { ObjectLoader loader = repository.open(entry.getObjectId()); dcIn = loader.openStream(); if (RawText.isBinary(dcIn)) return true; dcIn.close(); dcIn = new EolCanonicalizingInputStream( loader.openStream(), true); long dcInLen = computeLength(dcIn); dcIn.close(); dcIn = new EolCanonicalizingInputStream( loader.openStream(), true); byte[] autoCrLfHash = computeHash(dcIn, dcInLen); return getEntryObjectId().compareTo(autoCrLfHash, 0) != 0; } catch (IOException e) { return false; } finally { if (dcIn != null) try { dcIn.close(); } catch (IOException e) { } } case FALSE: break; } return true; } }

Target:
private boolean contentCheck(DirCacheEntry entry) { if (getEntryObjectId().equals(entry.getObjectId())) { entry.setLength((int) getEntryLength()); return false; } else { switch (getOptions().getAutoCRLF()) { case INPUT: case TRUE: InputStream dcIn = null; try { ObjectLoader loader = repository.open(entry.getObjectId()); dcIn = loader.openStream(); if (RawText.isBinary(dcIn)) return true; dcIn.close(); dcIn = new EolCanonicalizingInputStream( loader.openStream(), true); long dcInLen = computeLength(dcIn); dcIn.close(); dcIn = new EolCanonicalizingInputStream( loader.openStream(), true); byte[] autoCrLfHash = computeHash(dcIn, dcInLen); boolean changed = getEntryObjectId().compareTo( autoCrLfHash, 0) != 0; if (!changed) { entry.setLength((int) getEntryLength()); entry.setObjectIdFromRaw(autoCrLfHash, 0); } return changed; } catch (IOException e) { return false; } finally { if (dcIn != null) try { dcIn.close(); } catch (IOException e) { } } case FALSE: break; } return true; } }
Source:
protected CharacterHit hit(double x, double y) { VirtualFlowHit<Cell<Paragraph<S, PS>, ParagraphBox<S, PS>>> hit = virtualFlow.hit(x, y); if(hit.isBeforeCells()) { return CharacterHit.insertionAt(0); } else if(hit.isAfterCells()) { return CharacterHit.insertionAt(getLength()); } else { int parIdx = hit.getCellIndex(); int parOffset = getParagraphOffset(parIdx); ParagraphBox<S, PS> cell = hit.getCell().getNode(); Point2D cellOffset = hit.getCellOffset(); CharacterHit parHit = cell.hit(cellOffset); return parHit.offset(parOffset); } }

Target:
public CharacterHit hit(double x, double y) { VirtualFlowHit<Cell<Paragraph<S, PS>, ParagraphBox<S, PS>>> hit = virtualFlow.hit(x, y); if(hit.isBeforeCells()) { return CharacterHit.insertionAt(0); } else if(hit.isAfterCells()) { return CharacterHit.insertionAt(getLength()); } else { int parIdx = hit.getCellIndex(); int parOffset = getParagraphOffset(parIdx); ParagraphBox<S, PS> cell = hit.getCell().getNode(); Point2D cellOffset = hit.getCellOffset(); CharacterHit parHit = cell.hit(cellOffset); return parHit.offset(parOffset); } }
Source:
public boolean isConstantExpression(IASTNode point) { return fArgument.isConstantExpression(point) && (getOverload(point) == null || getOverload(point).isConstexpr()); }

Target:
public boolean isConstantExpression(IASTNode point) { return fArgument.isConstantExpression(point) && isConstexprFuncOrNull(getOverload(point)); }
Source:
private HikariCPCollector getCollector() { if (collector == null) { if (globalCollector == null) { collector = globalCollector = new HikariCPCollector(); } else { collector = globalCollector; } } return collector; }

Target:
private HikariCPCollector getCollector() { if (collector == null) { checkGlobalCollector(); collector = globalCollector; } return collector; }
Source:
public void run(Display display, Shell shell) { shell.setSize(700, 500); try { new TextCanvas(shell, SWT.NONE); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } FillLayout fillLayout = new FillLayout(); shell.setLayout(fillLayout); shell.open(); shell.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { ColorFactory.disposeAll(); } }); }

Target:
public void run(Display display, Shell shell) { shell.setSize(700, 500); try { new TextCanvas(shell, SWT.NONE); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } FillLayout fillLayout = new FillLayout(); shell.setLayout(fillLayout); shell.open(); }
Source:
public void onModelFound(Request _request) { request = _request; User client = request.getClient(); createViews(client); createMapViews(client); bar.setTitle(request.getDisplayDollars() + " | " + request.getTitle()); bar.setXMarkVisibility(View.VISIBLE, null); bar.setRightArrowVisibility(View.VISIBLE, new View.OnClickListener() { @Override public void onClick(View v) { request.setState(Request.State.PENDING); request.saveEventually(new SaveCallback() { @Override public void done(ParseException e) { if (e==null) { Intent i = new Intent(getBaseContext(), RequestPendingVendorActivity.class); startActivity(i); } else { onError(e); } } }); } }); }

Target:
public void onModelFound(Request _request) { request = _request; User client = request.getClient(); createViews(client); createMapViews(client); bar.setTitle(request.getDisplayDollars() + " | " + request.getTitle()); bar.setXMarkVisibility(View.VISIBLE, null); bar.setRightArrowVisibility(View.VISIBLE, new View.OnClickListener() { @Override public void onClick(View v) { request.setState(Request.State.PENDING); request.saveEventually(new SaveCallback() { @Override public void done(ParseException e) { if (e==null) { Intent i = new Intent( RequestActiveVendorActivity.this, RequestPendingVendorActivity.class ); startActivity(i); } else { onError(e); } } }); } }); }
Source:
public void sequentialPredict(PredictParams predictParams) throws Exception { try { MultiLayerNetwork model = predictParams.getSequentialModel(); DataSetIterator dataSetIterator = new HDF5MiniBatchDataSetIterator( predictParams.getFeaturesDirectory() ); while(dataSetIterator.hasNext()) { DataSet data = dataSetIterator.next(); model.output(data.getFeatures()); } log.info("model.predict() operation complete."); } catch (Throwable e) { log.error("Error while performing model.predict()", e); throw e; } }

Target:
public double[][] sequentialPredict(PredictParams predictParams) throws Exception { try { MultiLayerNetwork model = predictParams.getSequentialModel(); DataSetIterator dataSetIterator = new HDF5MiniBatchDataSetIterator( predictParams.getFeaturesDirectory() ); INDArray ret = model.output(dataSetIterator); log.info("model.predict() operation complete."); return NDArrayHelper.toFlattened(ret); } catch (Throwable e) { log.error("Error while performing model.predict()", e); throw e; } }
Source:
public void applicationDefaultServiceAccountWhenConfigured() throws Exception { CredentialFactory credentialFactory = getCredentialFactory(); withEnvironmentVariable(CREDENTIAL_ENV_VAR, getStringPath("test-credential.json")) .execute(() -> { GoogleCredentialWithRetry credential = (GoogleCredentialWithRetry) credentialFactory.getCredential(TEST_SCOPES); assertThat(credential.getServiceAccountId()).isEqualTo("test-email@gserviceaccount.com"); assertThat(credential.getServiceAccountPrivateKeyId()).isEqualTo("test-key-id"); }); }

Target:
public void applicationDefaultServiceAccountWhenConfigured() throws Exception { CredentialFactory credentialFactory = getCredentialFactory(); GoogleCredentialWithRetry credential = (GoogleCredentialWithRetry) withEnvironmentVariable(CREDENTIAL_ENV_VAR, getStringPath("test-credential.json")) .execute(() -> credentialFactory.getCredential(TEST_SCOPES)); assertThat(credential.getServiceAccountId()).isEqualTo("test-email@gserviceaccount.com"); assertThat(credential.getServiceAccountPrivateKeyId()).isEqualTo("test-key-id"); }
Source:
String getApiTailUrl(String tail) { return repo.getApiTailUrl(tail); }

Target:
String getApiTailUrl(String tail) { return repo.getApiTailUrl("stats/" + tail); }
Source:
private void log(Level level, Object message, Throwable t) { log(level, message, t, null); }

Target:
private void log(Level level, Object message, Throwable t) { if (!logger.isLoggable(level)) { return; } String msg = (message == null) ? "NULL" : message.toString(); LogRecord record = new LogRecord(level, msg); record.setLoggerName(logger.getName()); record.setThrown(t); record.setSourceClassName(null); logger.log(record); }