auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static HevcConfig parse(ParsableByteArray data) throws ParserException { try { data.skipBytes(21); int lengthSizeMinusOne = data.readUnsignedByte() & 0x03; int numberOfArrays = data.readUnsignedByte(); int csdLength = 0; int csdStartPosition = data.getPosition(); for (int i = 0; i < numberOfArrays; i++) { data.skipBytes(1); int numberOfNalUnits = data.readUnsignedShort(); for (int j = 0; j < numberOfNalUnits; j++) { int nalUnitLength = data.readUnsignedShort(); csdLength += 4 + nalUnitLength; data.skipBytes(nalUnitLength); } } @Nullable String codecs = null; data.setPosition(csdStartPosition); byte[] buffer = new byte[csdLength]; int bufferPosition = 0; for (int i = 0; i < numberOfArrays; i++) { final int nalUnitType = (data.getData()[data.getPosition()] & 0x7F); data.skipBytes(1); int numberOfNalUnits = data.readUnsignedShort(); for (int j = 0; j < numberOfNalUnits; j++) { int nalUnitLength = data.readUnsignedShort(); System.arraycopy(NalUnitUtil.NAL_START_CODE, 0, buffer, bufferPosition, NalUnitUtil.NAL_START_CODE.length); bufferPosition += NalUnitUtil.NAL_START_CODE.length; System.arraycopy( data.getData(), data.getPosition(), buffer, bufferPosition, nalUnitLength); bufferPosition += nalUnitLength; if (nalUnitType == SPS_NUT && j == 0) { codecs = buildCodecString(data, nalUnitLength); } data.skipBytes(nalUnitLength); } } @Nullable List<byte[]> initializationData = csdLength == 0 ? null : Collections.singletonList(buffer); return new HevcConfig(initializationData, lengthSizeMinusOne + 1, codecs); } catch (ArrayIndexOutOfBoundsException e) { throw new ParserException("Error parsing HEVC config", e); } }

Target:
public static HevcConfig parse(ParsableByteArray data) throws ParserException { try { data.skipBytes(1); final String codecs = buildCodecString(data); data.skipBytes(20); int lengthSizeMinusOne = data.readUnsignedByte() & 0x03; int numberOfArrays = data.readUnsignedByte(); int csdLength = 0; int csdStartPosition = data.getPosition(); for (int i = 0; i < numberOfArrays; i++) { data.skipBytes(1); int numberOfNalUnits = data.readUnsignedShort(); for (int j = 0; j < numberOfNalUnits; j++) { int nalUnitLength = data.readUnsignedShort(); csdLength += 4 + nalUnitLength; data.skipBytes(nalUnitLength); } } data.setPosition(csdStartPosition); byte[] buffer = new byte[csdLength]; int bufferPosition = 0; for (int i = 0; i < numberOfArrays; i++) { data.skipBytes(1); int numberOfNalUnits = data.readUnsignedShort(); for (int j = 0; j < numberOfNalUnits; j++) { int nalUnitLength = data.readUnsignedShort(); System.arraycopy(NalUnitUtil.NAL_START_CODE, 0, buffer, bufferPosition, NalUnitUtil.NAL_START_CODE.length); bufferPosition += NalUnitUtil.NAL_START_CODE.length; System.arraycopy( data.getData(), data.getPosition(), buffer, bufferPosition, nalUnitLength); bufferPosition += nalUnitLength; data.skipBytes(nalUnitLength); } } @Nullable List<byte[]> initializationData = csdLength == 0 ? null : Collections.singletonList(buffer); return new HevcConfig(initializationData, lengthSizeMinusOne + 1, codecs); } catch (ArrayIndexOutOfBoundsException e) { throw new ParserException("Error parsing HEVC config", e); } }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof CheEditor)) { return false; } CheEditor cheEditor = (CheEditor) o; return Objects.equals(getName(), cheEditor.getName()) && Objects.equals(getId(), cheEditor.getId()) && Objects.equals(getVersion(), cheEditor.getVersion()) && Objects.equals(getContainers(), cheEditor.getContainers()) && Objects.equals(getEndpoints(), cheEditor.getEndpoints()); }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof CheEditor)) { return false; } CheEditor cheEditor = (CheEditor) o; return super.equals(cheEditor); }
Source:
public List<Object> getAttributeAsList(final String key) { final Object o = getAttribute(key); if ( o == null ) return Collections.emptyList(); else if ( o instanceof List ) return (List<Object>)o; else if ( o instanceof int[]) { final int array[]=(int[])o; final List<Object> list = new ArrayList<>( array.length ); for( int i : array) list.add(i); return list; } else if ( o instanceof double[]) { final double array[]=(double[])o; final List<Object> list = new ArrayList<>( array.length ); for( double i : array) list.add(i); return list; } else if ( o.getClass().isArray() ) return Arrays.asList((Object[])o); return Collections.singletonList(o); }

Target:
public List<Object> getAttributeAsList(final String key) { Object o = getAttribute(key); if ( o == null ) return Collections.emptyList(); if ( o instanceof List ) return (List<Object>)o; if ( o.getClass().isArray() ) return Arrays.asList((Object[])o); return Collections.singletonList(o); }
Source:
static Task<BasicMachineDetails> taskForSshMachineLocation(SshMachineLocation location) { BufferedReader reader = new BufferedReader(Streams.reader( new ResourceUtils(BasicMachineDetails.class).getResourceFromUrl( "classpath://brooklyn/location/basic/os-details.sh"))); List<String> script; try { script = CharStreams.readLines(reader); reader.close(); } catch (IOException e) { LOG.error("Error reading os-details script", e); throw Throwables.propagate(e); } Task<BasicMachineDetails> task = new PlainSshExecTaskFactory<String>(location, script) .summary("Getting machine details for: " + location) .requiringZeroAndReturningStdout() .returning(taskToMachineDetailsFunction(location)) .newTask() .asTask(); return task; }

Target:
static Task<BasicMachineDetails> taskForSshMachineLocation(SshMachineLocation location) { BufferedReader reader = new BufferedReader(Streams.reader( new ResourceUtils(BasicMachineDetails.class).getResourceFromUrl( "classpath://brooklyn/location/basic/os-details.sh"))); List<String> script; try { script = CharStreams.readLines(reader); } catch (IOException e) { LOG.error("Error reading os-details script", e); throw Throwables.propagate(e); } finally { try { reader.close(); } catch (IOException e) { LOG.error("Error closing os-details script reader", e); } } Task<BasicMachineDetails> task = new PlainSshExecTaskFactory<String>(location, script) .summary("Getting machine details for: " + location) .requiringZeroAndReturningStdout() .returning(taskToMachineDetailsFunction(location)) .newTask() .asTask(); return task; }
Source:
private void applyUcastAddition(MacLocation ml) { log.debug("Adding UCAST remote MAC to the VTEP: " + ml); try { List<UcastMac> ucasts = vtepDataClient.listUcastMacsRemote(); for (UcastMac uc : ucasts) { if (uc.mac.equals(ml.mac().toString())) { log.debug("UCAST remote MAC already in vtep"); return; } } } catch (VtepNotConnectedException e) { log.error("VTEP is not connected", e); return; } Status st = vtepDataClient.addUcastMacRemote(ml.logicalSwitchName(), ml.mac().IEEE802(), ml.ipAddr(), ml.vxlanTunnelEndpoint()); if (st.getCode().equals(StatusCode.CONFLICT)) { log.info("Conflict writing {}, not expected", ml); } else if (!st.isSuccess()) { throw new VxLanPeerSyncException("OVSDB error: " + st, ml, st.getCode()); } }

Target:
private void applyUcastAddition(MacLocation ml) { log.debug("Adding UCAST remote MAC to the VTEP: " + ml); List<UcastMac> ucasts = null; try { ucasts = vtepDataClient.listUcastMacsRemote(); } catch (VtepNotConnectedException e) { log.error("VTEP is not connected", e); return; } for (UcastMac uc : ucasts) { if (ml.mac().toString().equalsIgnoreCase(uc.mac)) { String mlIp = ml.ipAddr() == null ? "" : ml.ipAddr().toString(); String ucIp = Strings.nullToEmpty(uc.ipAddr); if (ucIp.equals(mlIp)) { log.debug("UCAST remote MAC already in vtep"); return; } } } Status st = vtepDataClient.addUcastMacRemote(ml.logicalSwitchName(), ml.mac().IEEE802(), ml.ipAddr(), ml.vxlanTunnelEndpoint()); if (st.getCode().equals(StatusCode.CONFLICT)) { log.info("Conflict writing {}, not expected", ml); } else if (!st.isSuccess()) { throw new VxLanPeerSyncException("OVSDB error: " + st, ml, st.getCode()); } }
Source:
protected boolean shouldShowSubjectDiscovery() { return getActivity() instanceof MainDashboardActivity && environment.getConfig().getDiscoveryConfig().getCourseDiscoveryConfig().isSubjectFilterEnabled() && getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE; }

Target:
private boolean shouldShowSubjectDiscovery() { return getActivity() instanceof MainDashboardActivity && environment.getConfig().getDiscoveryConfig().getCourseDiscoveryConfig().isSubjectFilterEnabled() && getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE; }
Source:
public void savePredicates() throws IOException { for (String session : sessions.keySet()) { String[] parts = session.split("_"); String username = parts[0]; String botname = session.substring(username.length() + 1); String sessionPredicateFilename = createSessionPredicateFilename(username, botname); File sessionPredFile = new File(sessionPredicateFilename); Chat chat = getChat(username, botname); log.info("Writing predicate file for session {}", session); FileWriter predWriter = new FileWriter(sessionPredFile, false); for (String predicate : chat.predicates.keySet()) { String value = chat.predicates.get(predicate); predWriter.write(predicate + ":" + value + "\n"); } predWriter.close(); } log.info("Done saving predicates."); }

Target:
public void savePredicates() throws IOException { for (String botName : sessions.keySet()) { for (String userName : sessions.get(botName).keySet()) { String sessionPredicateFilename = createSessionPredicateFilename(userName, botName); File sessionPredFile = new File(sessionPredicateFilename); Chat chat = getChat(userName, botName); log.info("Writing predicate file for session {}", botName, userName); FileWriter predWriter = new FileWriter(sessionPredFile, false); for (String predicate : chat.predicates.keySet()) { String value = chat.predicates.get(predicate); predWriter.write(predicate + ":" + value + "\n"); } predWriter.close(); } } log.info("Done saving predicates."); }
Source:
protected void onBindDialogView(View view) { SeekBar volumeBar = (SeekBar) view.findViewById(R.id.volume_bar); volumeBar.setProgress((int) (getPersistedFloat( PreferenceConstants.DEFAULT_BELL_VOLUME) * 100)); volumeBar.setOnSeekBarChangeListener(this); super.onBindDialogView(view); }

Target:
protected void onBindDialogView(View view) { super.onBindDialogView(view); SeekBar volumeBar = (SeekBar) view.findViewById(R.id.volume_bar); volumeBar.setProgress((int) (getPersistedFloat( PreferenceConstants.DEFAULT_BELL_VOLUME) * 100)); volumeBar.setOnSeekBarChangeListener(this); }
Source:
ContainerNode<?> asJson(Object target) throws AccessException { if (target instanceof String) { try { JsonNode json = this.objectMapper.readTree((String) target); return assertContainerNode(json); } catch (JsonProcessingException e) { throw new AccessException("Exception while trying to deserialize String", e); } catch (IOException e) { throw new AccessException("Exception while trying to deserialize String", e); } } else { throw new IllegalStateException("Can't happen. Check SUPPORTED_CLASSES"); } }

Target:
ContainerNode<?> asJson(Object target) throws AccessException { if (target instanceof String) { try { JsonNode json = this.objectMapper.readTree((String) target); return assertContainerNode(json); } catch (IOException e) { throw new AccessException("Exception while trying to deserialize String", e); } } else { throw new IllegalStateException("Can't happen. Check SUPPORTED_CLASSES"); } }
Source:
public String scheduleACronJob(Object instance, String methodName, Class<?>[] inputTypes, Object[] inputParams, String cronExpression) { String triggerName = ""; try { triggerName = generateUniqueNameForInstance(instance, TRIGGER_PREFIX); JavaCronTrigger trigger = new JavaCronTrigger(new JavaCronExpression(cronExpression)); executor.schedule(getRunnable(instance, methodName, inputTypes, inputParams), trigger); } catch (Exception se) { log.error("failed to schedule job: {}", se.getMessage()); log.debug("Exception", se); return null; } return triggerName; }

Target:
public String scheduleACronJob(Object instance, String methodName, Class<?>[] inputTypes, Object[] inputParams, String cronExpression) { TimerConfig config = new TimerConfig(); try { timerService.schedule(instance.getClass() .getName(), config, methodName, inputTypes, inputParams, cronExpression); } catch (Exception se) { log.error("failed to schedule job: {}", se.getMessage()); log.debug("Exception", se); return null; } return config.getInfo().toString(); }
Source:
public ModuleDirectiveTree PROVIDES_MODULE_DIRECTIVE() { return b.<ModuleDirectiveTree>nonterminal(JavaLexer.PROVIDES_DIRECTIVE) .is( f.newProvidesModuleDirective( b.token(JavaRestrictedKeyword.PROVIDES), EXPRESSION_QUALIFIED_IDENTIFIER(), b.token(JavaRestrictedKeyword.WITH), QUALIFIED_IDENTIFIER_LIST(), b.token(JavaPunctuator.SEMI))); }

Target:
public ModuleDirectiveTree PROVIDES_MODULE_DIRECTIVE() { return b.<ModuleDirectiveTree>nonterminal(JavaLexer.PROVIDES_DIRECTIVE) .is( f.newProvidesModuleDirective( b.token(JavaRestrictedKeyword.PROVIDES), TYPE_QUALIFIED_IDENTIFIER(), b.token(JavaRestrictedKeyword.WITH), QUALIFIED_IDENTIFIER_LIST(), b.token(JavaPunctuator.SEMI))); }
Source:
protected HBaseFieldValueGenerator(final Class<?> clazz, List<HBaseFieldInfo> fieldInfos) { for (HBaseFieldInfo fieldInfo : fieldInfos) { fieldInfoMap.put(fieldInfo.getFamilyName() + ":" + fieldInfo.getColumnName(), fieldInfo); PojoUtils.Getter<Object, Object> getter = PojoUtils.createGetter(clazz, fieldInfo.getPojoFieldExpression(), fieldInfo.getType().getJavaType()); fieldGetterMap.put(fieldInfo, getter); } for (HBaseFieldInfo fieldInfo : fieldInfos) { PojoUtils.Setter<Object, Object> setter = PojoUtils.createSetter(clazz, fieldInfo.getPojoFieldExpression(), fieldInfo.getType().getJavaType()); fieldSetterMap.put(fieldInfo, setter); } }

Target:
protected HBaseFieldValueGenerator(final Class<?> clazz, List<HBaseFieldInfo> fieldInfos) { for (HBaseFieldInfo fieldInfo : fieldInfos) { fieldInfoMap.put(fieldInfo.getFamilyName() + COLON + fieldInfo.getColumnName(), fieldInfo); PojoUtils.Getter<Object, Object> getter = PojoUtils.createGetter(clazz, fieldInfo.getPojoFieldExpression(), fieldInfo.getType().getJavaType()); fieldGetterMap.put(fieldInfo, getter); } for (HBaseFieldInfo fieldInfo : fieldInfos) { PojoUtils.Setter<Object, Object> setter = PojoUtils.createSetter(clazz, fieldInfo.getPojoFieldExpression(), fieldInfo.getType().getJavaType()); fieldSetterMap.put(fieldInfo, setter); } }
Source:
public SingularityRunNowRequestBuilder() { this.message = Optional.absent(); this.runId = Optional.absent(); this.commandLineArgs = Optional.absent(); this.skipHealthchecks = Optional.absent(); this.resources = Optional.absent(); this.envOverrides = null; this.runAt = Optional.absent(); }

Target:
public SingularityRunNowRequestBuilder() { this.message = Optional.absent(); this.runId = Optional.absent(); this.commandLineArgs = Optional.absent(); this.skipHealthchecks = Optional.absent(); this.resources = Optional.absent(); this.runAsUserOverride = Optional.absent(); this.envOverrides = Collections.emptyMap(); this.extraArtifacts = Collections.emptyList(); this.runAt = Optional.absent(); }
Source:
protected ObjectNode getDockerContainer(ObjectMapper mapper) { ObjectNode dockerNode = mapper.createObjectNode(); dockerNode.put(MarathonConstants.DOCKER_IMAGE, "ndustrialio/heron-executor:jre8"); dockerNode.put(MarathonConstants.DOCKER_NETWORK, "BRIDGE"); dockerNode.put(MarathonConstants.DOCKER_PRIVILEGED, false); dockerNode.put(MarathonConstants.DOCKER_FORCE_PULL, true); dockerNode.set(MarathonConstants.DOCKER_PORT_MAPPINGS, getPorts(mapper)); return dockerNode; }

Target:
protected ObjectNode getDockerContainer(ObjectMapper mapper) { ObjectNode dockerNode = mapper.createObjectNode(); dockerNode.put(MarathonConstants.DOCKER_IMAGE, MarathonContext.getExecutorDockerImage(config)); dockerNode.put(MarathonConstants.DOCKER_NETWORK, MarathonConstants.DOCKER_NETWORK_BRIDGE); dockerNode.put(MarathonConstants.DOCKER_PRIVILEGED, false); dockerNode.put(MarathonConstants.DOCKER_FORCE_PULL, true); dockerNode.set(MarathonConstants.DOCKER_PORT_MAPPINGS, getPorts(mapper)); return dockerNode; }
Source:
private void populateContent() { final VBox vBox = new VBox(); Label description = new Label(shortcut.getDescription()); description.setWrapText(true); final GridPane gridPane = new GridPane(); gridPane.getStyleClass().add("grid"); try { System.out.println(shortcut.getScript()); final Map<String, String> shortcutProperties = objectMapper.readValue(shortcut.getScript(), new TypeReference<Map<String, String>>() {}); int i = 0; for(String shortcutKey: shortcutProperties.keySet()) { final Label keyLabel = new Label(shortcutKey + ":"); keyLabel.getStyleClass().add(CAPTION_TITLE_CSS_CLASS); GridPane.setValignment(keyLabel, VPos.TOP); gridPane.add(keyLabel, 0, i); final Label valueLabel = new Label(shortcutProperties.get(shortcutKey)); valueLabel.setWrapText(true); gridPane.add(valueLabel, 1, i); i++; } } catch (IOException e) { LOGGER.warn("Could not parse shortcut script JSON", e); } gridPane.getColumnConstraints().addAll(new ColumnConstraintsWithPercentage(30), new ColumnConstraintsWithPercentage(70)); vBox.getChildren().addAll(description, gridPane); this.setCenter(vBox); }

Target:
private void populateContent() { final VBox vBox = new VBox(); Label description = new Label(shortcut.getDescription()); description.setWrapText(true); final GridPane gridPane = new GridPane(); gridPane.getStyleClass().add("grid"); try { LOGGER.info("Reading shortcut: {}", shortcut.getScript()); final Map<String, String> shortcutProperties = objectMapper.readValue(shortcut.getScript(), new TypeReference<Map<String, String>>() {}); int i = 0; for(String shortcutKey: shortcutProperties.keySet()) { final Label keyLabel = new Label(shortcutKey + ":"); keyLabel.getStyleClass().add(CAPTION_TITLE_CSS_CLASS); GridPane.setValignment(keyLabel, VPos.TOP); gridPane.add(keyLabel, 0, i); final Label valueLabel = new Label(shortcutProperties.get(shortcutKey)); valueLabel.setWrapText(true); gridPane.add(valueLabel, 1, i); i++; } } catch (IOException e) { LOGGER.warn("Could not parse shortcut script JSON", e); } gridPane.getColumnConstraints().addAll(new ColumnConstraintsWithPercentage(30), new ColumnConstraintsWithPercentage(70)); vBox.getChildren().addAll(description, gridPane); this.setCenter(vBox); }
Source:
private void handleGenerationException(Throwable e) { Throwable cause = e.getCause(); if (cause instanceof InvalidParameterException) { log.warn("Map generation failed", e); notificationService.addImmediateErrorNotification(e, "mapGenerator.invalidName"); } else if (cause instanceof UnsupportedVersionException) { log.warn("Map generation failed", e); notificationService.addImmediateErrorNotification(cause, "mapGenerator.tooNewVersion"); } else if (cause instanceof OutdatedVersionException) { log.warn("Map generation failed", e); notificationService.addImmediateErrorNotification(cause, "mapGenerator.tooOldVersion"); } else { log.warn("Map generation failed", e); notificationService.addImmediateErrorNotification(e, "mapGenerator.generationFailed"); } }

Target:
private void handleGenerationException(Throwable e) { Throwable cause = e.getCause(); if (cause instanceof InvalidParameterException) { log.warn("Map generation failed due to invalid parameter", e); notificationService.addImmediateErrorNotification(e, "mapGenerator.invalidName"); } else if (cause instanceof UnsupportedVersionException) { log.warn("Map generation failed due to unsupported version", e); notificationService.addImmediateErrorNotification(cause, "mapGenerator.tooNewVersion"); } else if (cause instanceof OutdatedVersionException) { log.warn("Map generation failed due to outdated version", e); notificationService.addImmediateErrorNotification(cause, "mapGenerator.tooOldVersion"); } else { log.warn("Map generation failed", e); notificationService.addImmediateErrorNotification(e, "mapGenerator.generationFailed"); } }
Source:
public static boolean isUsbPolicyLegal(UsbPolicy usbPolicy, VmOsType osType, VDSGroup vdsGroup, List<String> messages) { boolean retVal = true; if (usbPolicy != null && usbPolicy.equals(UsbPolicy.ENABLED_NATIVE)) { if (vdsGroup.getcompatibility_version().compareTo(Version.v3_1) < 0) { messages.add(VdcBllMessages.USB_NATIVE_SUPPORT_ONLY_AVAILABLE_ON_CLUSTER_LEVEL.toString()); retVal = false; } } else if (usbPolicy != null && usbPolicy.equals(UsbPolicy.ENABLED_LEGACY)) { if (osType.isLinux()) { messages.add(VdcBllMessages.USB_LEGACY_NOT_SUPPORTED_ON_LINUX_VMS.toString()); retVal = false; } } return retVal; }

Target:
public static boolean isUsbPolicyLegal(UsbPolicy usbPolicy, VmOsType osType, VDSGroup vdsGroup, List<String> messages) { boolean retVal = true; if (UsbPolicy.ENABLED_NATIVE.equals(usbPolicy)) { if (vdsGroup.getcompatibility_version().compareTo(Version.v3_1) < 0) { messages.add(VdcBllMessages.USB_NATIVE_SUPPORT_ONLY_AVAILABLE_ON_CLUSTER_LEVEL.toString()); retVal = false; } } else if (UsbPolicy.ENABLED_LEGACY.equals(usbPolicy)) { if (osType.isLinux()) { messages.add(VdcBllMessages.USB_LEGACY_NOT_SUPPORTED_ON_LINUX_VMS.toString()); retVal = false; } } return retVal; }
Source:
private void drawSideBar() { LeftSideBar leftContent = new LeftSideBar(); this.getChildren().add(leftContent); searchBar = new TextField(); searchBar.setOnKeyReleased(event -> { applicationListWidget.search(searchBar.getText()); }); this.runScript = new LeftButton("/com/playonlinux/ui/impl/javafx/mainwindow/library/script.png", "Run a script"); LeftSpacer spacer = new LeftSpacer(); leftContent.getChildren().addAll(searchBar, spacer, new LeftBarTitle("Advanced tools"), runScript); }

Target:
private void drawSideBar() { LeftSideBar leftContent = new LeftSideBar(); this.getChildren().add(leftContent); searchBar = new TextField(); searchBar.setOnKeyReleased(event -> applicationListWidget.search(searchBar.getText())); this.runScript = new LeftButton("/com/playonlinux/ui/impl/javafx/mainwindow/library/script.png", "Run a script"); LeftSpacer spacer = new LeftSpacer(); leftContent.getChildren().addAll(searchBar, spacer, new LeftBarTitle("Advanced tools"), runScript); }
Source:
public TypeSerializer<Row> createPriorSerializer() { return createRowSerializer(true); }

Target:
public TypeSerializer<Row> createPriorSerializer() { return createRowSerializer(); }
Source:
void extractPrefetchFiles(Content dataSource) { List<AbstractFile> pFiles; FileManager fileManager = Case.getCurrentCase().getServices().getFileManager(); try { pFiles = fileManager.findFiles(dataSource, "%.pf"); } catch (TskCoreException ex) { logger.log(Level.WARNING, "Unable to find prefetch files.", ex); return; } for (AbstractFile pFile : pFiles) { if (context.dataSourceIngestIsCancelled()) { return; } String prefetchFile = RAImageIngestModule.getRATempPath(Case.getCurrentCase(), "prefetch") + File.separator + pFile.getName(); if (pFile.getParentPath().contains(PREFETCH_FILE_LOCATION)) { try { ContentUtils.writeToFile(pFile, new File(prefetchFile)); } catch (IOException ex) { logger.log(Level.WARNING, String.format("Unable to write %s to temp directory. File name: %s", pFile.getName(), prefetchFile), ex); } } } }

Target:
void extractPrefetchFiles(Content dataSource) { List<AbstractFile> pFiles; FileManager fileManager = Case.getCurrentCase().getServices().getFileManager(); try { pFiles = fileManager.findFiles(dataSource, "%.pf"); } catch (TskCoreException ex) { logger.log(Level.WARNING, "Unable to find prefetch files.", ex); return; } for (AbstractFile pFile : pFiles) { if (context.dataSourceIngestIsCancelled()) { return; } String prefetchFile = RAImageIngestModule.getRATempPath(Case.getCurrentCase(), PREFETCH_DIR_NAME) + File.separator + pFile.getName(); if (pFile.getParentPath().contains(PREFETCH_FILE_LOCATION)) { try { ContentUtils.writeToFile(pFile, new File(prefetchFile)); } catch (IOException ex) { logger.log(Level.WARNING, String.format("Unable to write %s to temp directory. File name: %s", pFile.getName(), prefetchFile), ex); } } } }
Source:
public EmailWrapper sendConfirmationEmailForSubmission(String courseId, String feedbackSessionName, String userId, String unregisteredStudentEmail, String regKey) throws EntityDoesNotExistException { FeedbackSessionAttributes session = getFeedbackSession(feedbackSessionName, courseId); StudentAttributes student = null; InstructorAttributes instructor = null; if (userId != null) { student = studentsLogic.isStudentInAnyCourse(userId) ? studentsLogic.getStudentForCourseIdAndGoogleId(courseId, userId) : null; instructor = instructorsLogic.isGoogleIdOfInstructorOfCourse(userId, courseId) ? instructorsLogic.getInstructorForGoogleId(courseId, userId) : null; } if (student == null && unregisteredStudentEmail != null) { student = new StudentAttributes(); student.email = unregisteredStudentEmail; student.name = ""; student.key = regKey; } try { EmailWrapper email = new EmailGenerator().generateFeedbackSubmissionConfirmationEmails( session, student, instructor); new EmailSender().sendEmailWithLogging(email); return email; } catch (Exception e) { throw new RuntimeException(ERROR_SENDING_EMAILS, e); } }

Target:
public EmailWrapper sendConfirmationEmailForSubmission(String courseId, String feedbackSessionName, String userId, String unregisteredStudentEmail, String regKey) throws EntityDoesNotExistException { if (!isFeedbackSessionExists(feedbackSessionName, courseId)) { throw new EntityDoesNotExistException(ERROR_NON_EXISTENT_FS_CONFIRM + courseId + "/" + feedbackSessionName); } FeedbackSessionAttributes session = getFeedbackSession(feedbackSessionName, courseId); StudentAttributes student = null; InstructorAttributes instructor = null; if (userId != null) { student = studentsLogic.getStudentForCourseIdAndGoogleId(courseId, userId); instructor = instructorsLogic.getInstructorForGoogleId(courseId, userId); } if (student == null && unregisteredStudentEmail != null) { student = new StudentAttributes(); student.email = unregisteredStudentEmail; student.name = unregisteredStudentEmail; student.key = regKey; } Assumption.assertFalse(student == null && instructor == null); try { String timestamp = TimeHelper.formatTime12H(Calendar.getInstance().getTime()); EmailWrapper email = instructor == null ? new EmailGenerator().generateFeedbackSubmissionConfirmationEmailForStudent(session, student, timestamp) : new EmailGenerator().generateFeedbackSubmissionConfirmationEmailForInstructor(session, instructor, timestamp); new EmailSender().sendEmail(email); return email; } catch (Exception e) { throw new RuntimeException(ERROR_SENDING_EMAILS, e); } }
Source:
public Container andNot(BitmapContainer x) { int card = this.getCardinality(); if (card <= ArrayContainer.DEFAULT_MAX_SIZE) { ArrayContainer answer = new ArrayContainer(card); answer.cardinality = 0; for (int rlepos = 0; rlepos < this.nbrruns; ++rlepos) { int runStart = Util.toIntUnsigned(this.getValue(rlepos)); int runEnd = runStart + Util.toIntUnsigned(this.getLength(rlepos)); for (int runValue = runStart; runValue <= runEnd; ++runValue) { if (!x.contains((short) runValue)) { answer.content[answer.cardinality++] = (short) runValue; } } } return answer; } BitmapContainer answer = x.clone(); int lastPos = 0; for (int rlepos = 0; rlepos < this.nbrruns; ++rlepos) { int start = Util.toIntUnsigned(this.getValue(rlepos)); int end = start + Util.toIntUnsigned(this.getLength(rlepos)) + 1; int prevOnes = Util.cardinalityInBitmapRange(answer.bitmap, lastPos, start); int flippedOnes = Util.cardinalityInBitmapRange(answer.bitmap, start, end); Util.resetBitmapRange(answer.bitmap, lastPos, start); Util.flipBitmapRange(answer.bitmap, start, end); answer.updateCardinality(prevOnes + flippedOnes, end - start - flippedOnes); lastPos = end; } int prevOnes = Util.cardinalityInBitmapRange(answer.bitmap, lastPos, BitmapContainer.MAX_CAPACITY); Util.resetBitmapRange(answer.bitmap, lastPos, BitmapContainer.MAX_CAPACITY); answer.updateCardinality(prevOnes, 0); if (answer.getCardinality() > ArrayContainer.DEFAULT_MAX_SIZE) { return answer; } else { return answer.toArrayContainer(); } }

Target:
public Container andNot(BitmapContainer x) { int card = this.getCardinality(); if (card <= ArrayContainer.DEFAULT_MAX_SIZE) { ArrayContainer answer = new ArrayContainer(card); answer.cardinality = 0; for (int rlepos = 0; rlepos < this.nbrruns; ++rlepos) { int runStart = Util.toIntUnsigned(this.getValue(rlepos)); int runEnd = runStart + Util.toIntUnsigned(this.getLength(rlepos)); for (int runValue = runStart; runValue <= runEnd; ++runValue) { if (!x.contains((short) runValue)) { answer.content[answer.cardinality++] = (short) runValue; } } } return answer; } BitmapContainer answer = x.clone(); int lastPos = 0; for (int rlepos = 0; rlepos < this.nbrruns; ++rlepos) { int start = Util.toIntUnsigned(this.getValue(rlepos)); int end = start + Util.toIntUnsigned(this.getLength(rlepos)) + 1; int prevOnes = answer.cardinalityInRange(lastPos, start); int flippedOnes = answer.cardinalityInRange(start, end); Util.resetBitmapRange(answer.bitmap, lastPos, start); Util.flipBitmapRange(answer.bitmap, start, end); answer.updateCardinality(prevOnes + flippedOnes, end - start - flippedOnes); lastPos = end; } int ones = answer.cardinalityInRange(lastPos, BitmapContainer.MAX_CAPACITY); Util.resetBitmapRange(answer.bitmap, lastPos, BitmapContainer.MAX_CAPACITY); answer.updateCardinality(ones, 0); if (answer.getCardinality() > ArrayContainer.DEFAULT_MAX_SIZE) { return answer; } else { return answer.toArrayContainer(); } }
Source:
public CallStatus call() throws Exception { if (this instanceof BlockingOperation) { BlockingOperation blockingOperation = (BlockingOperation) this; if (blockingOperation.shouldWait()) { return WAIT; } } run(); return returnsResponse() ? DONE_RESPONSE : DONE_VOID_BACKUP; }

Target:
public CallStatus call() throws Exception { if (this instanceof BlockingOperation) { BlockingOperation blockingOperation = (BlockingOperation) this; if (blockingOperation.shouldWait()) { return WAIT; } } run(); return returnsResponse() ? RESPONSE : VOID; }
Source:
public T getHighestRankingElement(final Collection<T> elements, final RankTester<T> rankTester) { T highestRankingElement = null; double highestRank = initialRank; for (final T element : elements) { final double rank = rankTester.getRank(element); if (ignoreRankValue != null && ignoreRankValue.equals(rank)) { continue; } else if (rank > highestRank) { highestRank = rank; highestRankingElement = element; } else if (rank == highestRank && highestRankingElement != null) { reportClashingPriorities(highestRankingElement, element, rank); } } return highestRankingElement; }

Target:
public T getHighestRankingElement(final Collection<T> elements, final RankTester<T> rankTester) { final List<T> highestRankingElements = new ArrayList<T>(); double highestRank = initialRank; for (final T element : elements) { final double rank = rankTester.getRank(element); if (ignoreRankValue != null && ignoreRankValue.equals(rank)) { continue; } else if (rank >= highestRank) { if (rank > highestRank) { highestRank = rank; highestRankingElements.clear(); } highestRankingElements.add(element); } } if (highestRankingElements.size() > 1) { reportClashingPriorities(createWarning(highestRankingElements, highestRank)); } if (highestRankingElements.isEmpty()) { return null; } return highestRankingElements.get(0); }
Source:
public int get(int index) { return 0; }

Target:
public int get(int index) { assert index == 0; return 0; }
Source:
public void start(StartContext context) { logger.debugf("Started AdvancedCacheLoader service with name = %s", className + " " + deployedCacheStoreFactory); deployedCacheStoreFactory.getValue().addInstance(extension); }

Target:
public void start(StartContext context) { InfinispanLogger.ROOT_LOGGER.deployedStoreStarted(className); deployedCacheStoreFactory.getValue().addInstance(extension); }
Source:
void initTable(ApplicationConstants constants) { getTable().enableColumnResizing(); TextColumnWithTooltip<VDSGroup> nameColumn = new TextColumnWithTooltip<VDSGroup>() { @Override public String getValue(VDSGroup object) { return object.getName(); } }; nameColumn.makeSortable(new Comparator<VDSGroup>() { @Override public int compare(VDSGroup a, VDSGroup b) { if (a == b) { return 0; } else if (a == null) { return -1; } else if (b == null) { return 1; } return a.getName().compareTo(b.getName()); } }); getTable().addColumn(nameColumn, constants.nameCluster(), "300px"); TextColumnWithTooltip<VDSGroup> versionColumn = new TextColumnWithTooltip<VDSGroup>() { @Override public String getValue(VDSGroup object) { return object.getcompatibility_version().getValue(); } }; getTable().addColumn(versionColumn, constants.comptVersCluster(), "300px"); TextColumnWithTooltip<VDSGroup> descColumn = new TextColumnWithTooltip<VDSGroup>() { @Override public String getValue(VDSGroup object) { return object.getdescription(); } }; getTable().addColumn(descColumn, constants.descriptionCluster()); }

Target:
void initTable(ApplicationConstants constants) { getTable().enableColumnResizing(); TextColumnWithTooltip<VDSGroup> nameColumn = new TextColumnWithTooltip<VDSGroup>() { @Override public String getValue(VDSGroup object) { return object.getName(); } }; nameColumn.makeSortable(new Linq.VDSGroupComparator()); getTable().addColumn(nameColumn, constants.nameCluster(), "300px"); TextColumnWithTooltip<VDSGroup> versionColumn = new TextColumnWithTooltip<VDSGroup>() { @Override public String getValue(VDSGroup object) { return object.getcompatibility_version().getValue(); } }; getTable().addColumn(versionColumn, constants.comptVersCluster(), "300px"); TextColumnWithTooltip<VDSGroup> descColumn = new TextColumnWithTooltip<VDSGroup>() { @Override public String getValue(VDSGroup object) { return object.getdescription(); } }; getTable().addColumn(descColumn, constants.descriptionCluster()); }
Source:
public CIBAGrant createCIBAGrant(User user, Client client, int expiresIn) { Long expirationDate = DateUtils.addSeconds(new Date(), expiresIn).getTime(); if (appConfiguration.getCibaGrantLifeExtraTimeSec() > 0) { expiresIn += appConfiguration.getCibaGrantLifeExtraTimeSec(); } CIBAGrant grant = grantInstance.select(CIBAGrant.class).get(); grant.init(user, client, expiresIn); CIBACacheGrant memcachedGrant = new CIBACacheGrant(grant, appConfiguration); cacheService.put(grant.getCIBAAuthenticationRequestId().getExpiresIn(), memcachedGrant.cacheKey(), memcachedGrant); log.trace("Put CIBA grant in cache, authReqId: " + grant.getCIBAAuthenticationRequestId().getCode() + ", clientId: " + grant.getClientId()); CIBACacheAuthReqIds cibaCacheAuthReqIds = grantService.getCacheCibaAuthReqIds(); cibaCacheAuthReqIds.getAuthReqIds().put(memcachedGrant.cacheKey(), expirationDate); cacheService.put(CIBACacheAuthReqIds.CACHE_KEY, cibaCacheAuthReqIds); log.trace("Put grant into the list of authentication request ids", memcachedGrant.cacheKey()); return grant; }

Target:
public CIBAGrant createCIBAGrant(User user, Client client, int expiresIn) { if (appConfiguration.getCibaGrantLifeExtraTimeSec() > 0) { expiresIn += appConfiguration.getCibaGrantLifeExtraTimeSec(); } CIBAGrant grant = grantInstance.select(CIBAGrant.class).get(); grant.init(user, client, expiresIn); CIBACacheGrant memcachedGrant = new CIBACacheGrant(grant, appConfiguration); cacheService.put(grant.getCIBAAuthenticationRequestId().getExpiresIn(), memcachedGrant.cacheKey(), memcachedGrant); log.trace("Put CIBA grant in cache, authReqId: " + grant.getCIBAAuthenticationRequestId().getCode() + ", clientId: " + grant.getClientId()); return grant; }
Source:
public Brawl(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{R}{R}"); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BrawlEffect(), new TapSourceCost()); ability.addTarget(new TargetCreaturePermanent()); this.getSpellAbility().addEffect( new GainAbilityAllEffect(ability, Duration.EndOfTurn, new FilterCreaturePermanent()) .setText("Until end of turn, all creatures gain \"{T}: This creature deals damage equal to its power to target creature.\"") ); }

Target:
public Brawl(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{R}{R}"); Ability ability = new SimpleActivatedAbility(new DamageWithPowerTargetEffect(), new TapSourceCost()); ability.addTarget(new TargetCreaturePermanent()); this.getSpellAbility().addEffect( new GainAbilityAllEffect(ability, Duration.EndOfTurn, new FilterCreaturePermanent()) .setText("Until end of turn, all creatures gain \"{T}: This creature deals damage equal to its power to target creature.\"") ); }
Source:
private void writeObject(ObjectOutputStream out) throws IOException { out.defaultWriteObject(); final DataOutputSerializer ser = new DataOutputSerializer(256); hadoopConfig.write(out); out.writeInt(ser.length()); out.write(ser.getSharedBuffer(), 0, ser.length()); }

Target:
private void writeObject(ObjectOutputStream out) throws IOException { out.defaultWriteObject(); final DataOutputSerializer ser = new DataOutputSerializer(256); hadoopConfig.write(ser); out.writeInt(ser.length()); out.write(ser.getSharedBuffer(), 0, ser.length()); }
Source:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getParameters().getBricks() == null || getParameters().getBricks().size() == 0) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_BRICKS_REQUIRED); return false; } if (!validate(new GlusterVolumeValidator().isForceCreateVolumeAllowed(getVdsGroup().getcompatibility_version(), getParameters().isForce()))) { return false; } if (getGlusterVolume().getVolumeType().isReplicatedType()) { if (getParameters().getReplicaCount() > getGlusterVolume().getReplicaCount() + 1) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CAN_NOT_INCREASE_REPLICA_COUNT_MORE_THAN_ONE); } else if (getParameters().getReplicaCount() < getGlusterVolume().getReplicaCount()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CAN_NOT_REDUCE_REPLICA_COUNT); } } if (getGlusterVolume().getVolumeType().isStripedType()) { if (getParameters().getStripeCount() > getGlusterVolume().getStripeCount() + 1) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CAN_NOT_INCREASE_STRIPE_COUNT_MORE_THAN_ONE); } else if (getParameters().getStripeCount() < getGlusterVolume().getStripeCount()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CAN_NOT_REDUCE_STRIPE_COUNT); } } return updateBrickServerNames(getParameters().getBricks(), true) && validateDuplicateBricks(getParameters().getBricks()); }

Target:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getParameters().getBricks() == null || getParameters().getBricks().size() == 0) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_BRICKS_REQUIRED); return false; } if (!validate(createVolumeValidator().isForceCreateVolumeAllowed(getVdsGroup().getcompatibility_version(), getParameters().isForce()))) { return false; } if (getGlusterVolume().getVolumeType().isReplicatedType()) { if (getParameters().getReplicaCount() > getGlusterVolume().getReplicaCount() + 1) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CAN_NOT_INCREASE_REPLICA_COUNT_MORE_THAN_ONE); } else if (getParameters().getReplicaCount() < getGlusterVolume().getReplicaCount()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CAN_NOT_REDUCE_REPLICA_COUNT); } } if (getGlusterVolume().getVolumeType().isStripedType()) { if (getParameters().getStripeCount() > getGlusterVolume().getStripeCount() + 1) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CAN_NOT_INCREASE_STRIPE_COUNT_MORE_THAN_ONE); } else if (getParameters().getStripeCount() < getGlusterVolume().getStripeCount()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CAN_NOT_REDUCE_STRIPE_COUNT); } } return updateBrickServerNames(getParameters().getBricks(), true) && validateDuplicateBricks(getParameters().getBricks()); }
Source:
public GraphQLFieldDefinition build() { if (dataFetcher == null) { dataFetcher = new PropertyDataFetcher(name); } return new GraphQLFieldDefinition(name, description, type, dataFetcher, arguments, deprecationReason); }

Target:
public GraphQLFieldDefinition build() { if (dataFetcher == null) { dataFetcher = new DefaultDataFetcher( new MapDataFetcher(name), new PropertyDataFetcher(name, type), new FieldDataFetcher(name) ); } return new GraphQLFieldDefinition(name, description, type, dataFetcher, arguments, deprecationReason); }
Source:
public void jmxPortIsReportedAsTag() throws Exception { InfluxDbWriter writer = getTestInfluxDbWriterWithReportJmxPortAsTag(); writer.doWrite(dummyServer(), dummyQuery(), results); verify(influxDB).write(messageCaptor.capture()); BatchPoints batchPoints = messageCaptor.getValue(); assertThat(batchPoints.getDatabase()).isEqualTo(DATABASE_NAME); List<Point> points = batchPoints.getPoints(); assertThat(points).hasSize(1); Point point = points.get(0); String[] split = point.lineProtocol().split(" "); assertThat(split).hasSize(3); assertThat(split[0]).contains(JMX_PORT_KEY + "=" + DEFAULT_PORT); assertThat(split[1]).doesNotContain(JMX_PORT_KEY); }

Target:
public void jmxPortIsReportedAsTag() throws Exception { BatchPoints batchPoints = writeToInfluxDb(getTestInfluxDbWriterWithReportJmxPortAsTag()); verifyJMXPortOnlyInToken(batchPoints.getPoints().get(0).lineProtocol(), 0 ); }
Source:
public static boolean isOverlapping(Variant blockRecord, Variant variant) { return (blockRecord.getStart() <= variant.getStart() && blockRecord.getEnd() >= variant .getStart() + 1); }

Target:
public static boolean isOverlapping(Variant blockRecord, Variant variant) { return blockRecord.getStart() <= variant.getStart() && blockRecord.getEnd() >= variant.getStart() + 1; }
Source:
protected List<String> matchingProjects(@NonNull final Collection<AuthScope> scopes) { val result = scopes.stream().filter(s -> matches(s)) .map(s -> s.getProject()) .collect(Collectors.toList()); return result; }

Target:
protected List<String> matchingProjects(@NonNull final Collection<AuthScope> scopes) { return scopes.stream() .filter(this::matches) .map(AuthScope::getProject) .collect(toUnmodifiableList()); }
Source:
public ThriftHiveMetastore(HiveCluster hiveCluster, MetastoreClientConfig config, MBeanExporter exporter, ThriftHiveMetastoreStats stats, Function<Exception, Exception> exceptionMapper) { this.isHmsImpersonationEnabled = config.isHmsImpersonationEnabled(); this.exporter = requireNonNull(exporter, "exporter is null"); this.clientProvider = requireNonNull(hiveCluster, "hiveCluster is null"); this.stats = requireNonNull(stats, "stats is null"); this.exceptionMapper = requireNonNull(exceptionMapper, "exceptionMapper is null"); this.hmsStats = new HashMap<>(); for (HostAndPort hostAndPort : hiveCluster.getAddresses()) { hmsStats.put(hostAndPort, new ThriftHiveMetastoreStats()); } exportHmsStats(); }

Target:
public ThriftHiveMetastore(HiveCluster hiveCluster, MetastoreClientConfig config, MBeanExporter exporter, ThriftHiveMetastoreStats stats, Function<Exception, Exception> exceptionMapper) { this.isHmsImpersonationEnabled = config.isMetastoreImpersonationEnabled(); this.exporter = requireNonNull(exporter, "exporter is null"); this.clientProvider = requireNonNull(hiveCluster, "hiveCluster is null"); this.stats = requireNonNull(stats, "stats is null"); this.exceptionMapper = requireNonNull(exceptionMapper, "exceptionMapper is null"); ImmutableMap.Builder<HostAndPort, ThriftHiveMetastoreStats> metastoreStatsBuilder = ImmutableMap.builder(); for (HostAndPort hostAndPort : hiveCluster.getAddresses()) { metastoreStatsBuilder.put(hostAndPort, new ThriftHiveMetastoreStats()); } this.metastoreStats = metastoreStatsBuilder.build(); exportMetastoreStatistics(); }
Source:
public synchronized void initialize() { try { writeLock.lock(); if (!isInitialized()) { super.initialize(); setInitialized(true); this.initCalled = true; } } finally { readLock.lock(); writeLock.unlock(); readLock.unlock(); } }

Target:
public void initialize() { try { writeLock.lock(); if (!isInitialized()) { super.initialize(); setInitialized(true); this.initCalled = true; } } finally { readLock.lock(); writeLock.unlock(); readLock.unlock(); } }
Source:
public void testExecutableAttributes() throws Exception { FS fs = FS.DETECTED; org.junit.Assume.assumeTrue(fs.getClass().equals(FS_POSIX_Java7.class)); File f = new File(trash, "bla"); assertTrue(f.createNewFile()); assertFalse(fs.canExecute(f)); String umask = readUmask(); if (umask == null) return; char others = umask.charAt(umask.length() - 1); boolean badUmask; if (others != '0' && others != '2' && others != '4' && others != '6') { badUmask = true; } else { badUmask = false; } Set<PosixFilePermission> permissions = readPermissions(f); assertTrue(!permissions.contains(PosixFilePermission.OTHERS_EXECUTE)); assertTrue(!permissions.contains(PosixFilePermission.GROUP_EXECUTE)); assertTrue(!permissions.contains(PosixFilePermission.OWNER_EXECUTE)); fs.setExecute(f, true); RepositoryTestCase.fsTick(f); permissions = readPermissions(f); assertTrue("'owner' execute permission not set", permissions.contains(PosixFilePermission.OWNER_EXECUTE)); assertTrue("'group' execute permission not set", permissions.contains(PosixFilePermission.GROUP_EXECUTE)); if (badUmask) { assertFalse("'others' execute permission set", permissions.contains(PosixFilePermission.OTHERS_EXECUTE)); fail("Unexpected umask during test execution: " + umask); } else { assertTrue("'others' execute permission not set", permissions.contains(PosixFilePermission.OTHERS_EXECUTE)); } }

Target:
public void testExecutableAttributes() throws Exception { FS fs = FS.DETECTED; assumeTrue(fs.getClass().equals(FS_POSIX_Java7.class)); File f = new File(trash, "bla"); assertTrue(f.createNewFile()); assertFalse(fs.canExecute(f)); String umask = readUmask(); if (umask == null) return; char others = umask.charAt(umask.length() - 1); boolean badUmask; if (others != '0' && others != '2' && others != '4' && others != '6') { badUmask = true; } else { badUmask = false; } Set<PosixFilePermission> permissions = readPermissions(f); assertTrue(!permissions.contains(PosixFilePermission.OTHERS_EXECUTE)); assertTrue(!permissions.contains(PosixFilePermission.GROUP_EXECUTE)); assertTrue(!permissions.contains(PosixFilePermission.OWNER_EXECUTE)); fs.setExecute(f, true); RepositoryTestCase.fsTick(f); permissions = readPermissions(f); assertTrue("'owner' execute permission not set", permissions.contains(PosixFilePermission.OWNER_EXECUTE)); assertTrue("'group' execute permission not set", permissions.contains(PosixFilePermission.GROUP_EXECUTE)); if (badUmask) { assertFalse("'others' execute permission set", permissions.contains(PosixFilePermission.OTHERS_EXECUTE)); System.err.println("WARNING: your system's umask: \"" + umask + "\" doesn't allow FSJava7Test to test if setting posix" + " permissions for \"others\" works properly"); assumeFalse(badUmask); } else { assertTrue("'others' execute permission not set", permissions.contains(PosixFilePermission.OTHERS_EXECUTE)); } }
Source:
public String toString() { return "KeySetCommand{" + "set=" + cache.size() + " elements" + '}'; }

Target:
public String toString() { return "KeySetCommand{" + "cache=" + cache.getName() + '}'; }