Skip to content

Commit

Permalink
Fixing some exception messages and making copyright notices more cons…
Browse files Browse the repository at this point in the history
…istent.

Summary: Adding "manage" to exception messages that include publish permissions, and making copyright notices more consistent.

Test Plan: builds.

Reviewers: mmarucheck, clang

Reviewed By: mmarucheck

CC: msdkexp@, platform-diffs@lists

Differential Revision: https://phabricator.fb.com/D655007

Task ID: 1939738
  • Loading branch information
mingflifb committed Dec 11, 2012
1 parent d680caa commit dfee756
Show file tree
Hide file tree
Showing 40 changed files with 146 additions and 43 deletions.
2 changes: 1 addition & 1 deletion facebook/src/com/facebook/FacebookDialogException.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2010 Facebook, Inc.
* Copyright 2012 Facebook
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion facebook/src/com/facebook/FacebookException.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2010 Facebook, Inc.
* Copyright 2012 Facebook
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
16 changes: 16 additions & 0 deletions facebook/src/com/facebook/GetTokenClient.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/**
* Copyright 2012 Facebook
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.facebook;


Expand Down
1 change: 1 addition & 0 deletions facebook/src/com/facebook/Response.java
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ static FileLruCache getResponseCache() {
return responseCache;
}

@SuppressWarnings("resource")
static List<Response> fromHttpConnection(HttpURLConnection connection, RequestBatch requests) {
InputStream stream = null;

Expand Down
14 changes: 7 additions & 7 deletions facebook/src/com/facebook/Session.java
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ public final List<String> getPermissions() {
*
* @param openRequest the open request, can be null only if the Session is in the
* {@link SessionState#CREATED_TOKEN_LOADED CREATED_TOKEN_LOADED} state
* @throws FacebookException if any publish permissions are requested
* @throws FacebookException if any publish or manage permissions are requested
*/
public final void openForRead(OpenRequest openRequest) {
open(openRequest, SessionAuthorizationType.READ);
Expand All @@ -408,7 +408,7 @@ public final void openForRead(OpenRequest openRequest) {
* </p>
* <p>
* The permissions associated with the openRequest passed to this method must
* be publish permissions only and must be non-empty. Any read permissions
* be publish or manage permissions only and must be non-empty. Any read permissions
* will result in a warning, and may fail during server-side authorization.
* </p>
* <p>
Expand Down Expand Up @@ -493,15 +493,15 @@ public final void requestNewReadPermissions(NewPermissionsRequest newPermissions

/**
* <p>
* Issues a request to add new publish permissions to the Session.
* Issues a request to add new publish or manage permissions to the Session.
* </p>
* <p>
* If successful, this will update the set of permissions on this session to
* match the newPermissions. If this fails, the Session remains unchanged.
* </p>
* <p>
* The permissions associated with the newPermissionsRequest passed to this method must
* be publish permissions only and must be non-empty. Any read permissions
* be publish or manage permissions only and must be non-empty. Any read permissions
* will result in a warning, and may fail during server-side authorization.
* </p>
*
Expand Down Expand Up @@ -1024,7 +1024,7 @@ private void validateLoginBehavior(AuthorizationRequest request) {
private void validatePermissions(AuthorizationRequest request, SessionAuthorizationType authType) {
if (request == null || Utility.isNullOrEmpty(request.getPermissions())) {
if (SessionAuthorizationType.PUBLISH.equals(authType)) {
throw new FacebookException("Cannot request publish authorization with no permissions.");
throw new FacebookException("Cannot request publish or manage authorization with no permissions.");
}
return; // nothing to check
}
Expand All @@ -1033,14 +1033,14 @@ private void validatePermissions(AuthorizationRequest request, SessionAuthorizat
if (SessionAuthorizationType.READ.equals(authType)) {
throw new FacebookException(
String.format(
"Cannot pass a publish permission (%s) to a request for read authorization",
"Cannot pass a publish or manage permission (%s) to a request for read authorization",
permission));
}
} else {
if (SessionAuthorizationType.PUBLISH.equals(authType)) {
Log.w(TAG,
String.format(
"Should not pass a read permission (%s) to a request for publish authorization",
"Should not pass a read permission (%s) to a request for publish or manage authorization",
permission));
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2010 Facebook, Inc.
* Copyright 2012 Facebook
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -390,7 +390,7 @@ private void deserializeKey(String key, Bundle bundle)
} else if (valueType.equals(TYPE_ENUM)) {
try {
String enumType = json.getString(JSON_VALUE_ENUM_TYPE);
@SuppressWarnings({ "unchecked", "rawTypes" })
@SuppressWarnings({ "unchecked", "rawtypes" })
Class<? extends Enum> enumClass = (Class<? extends Enum>) Class.forName(enumType);
@SuppressWarnings("unchecked")
Enum<?> enumValue = Enum.valueOf(enumClass, json.getString(JSON_VALUE));
Expand Down
2 changes: 1 addition & 1 deletion facebook/src/com/facebook/TokenCachingStrategy.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2010 Facebook, Inc.
* Copyright 2012 Facebook
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
16 changes: 16 additions & 0 deletions facebook/src/com/facebook/UiLifecycleHelper.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/**
* Copyright 2012 Facebook
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.facebook;

import android.app.Activity;
Expand Down
4 changes: 2 additions & 2 deletions facebook/src/com/facebook/android/AsyncFacebookRunner.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2010 Facebook, Inc.
/**
* Copyright 2010-present Facebook
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions facebook/src/com/facebook/android/DialogError.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2010 Facebook, Inc.
/**
* Copyright 2010-present Facebook
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions facebook/src/com/facebook/android/Facebook.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2010 Facebook, Inc.
/**
* Copyright 2010-present Facebook
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions facebook/src/com/facebook/android/FacebookError.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2010 Facebook, Inc.
/**
* Copyright 2010-present Facebook
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions facebook/src/com/facebook/android/FbDialog.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2010 Facebook, Inc.
/**
* Copyright 2010-present Facebook
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions facebook/src/com/facebook/android/Util.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2010 Facebook, Inc.
/**
* Copyright 2010-present Facebook
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
16 changes: 16 additions & 0 deletions facebook/src/com/facebook/internal/CacheableRequestBatch.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/**
* Copyright 2012 Facebook
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.facebook.internal;

import com.facebook.Request;
Expand Down
2 changes: 1 addition & 1 deletion facebook/src/com/facebook/internal/FileLruCache.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2010 Facebook, Inc.
* Copyright 2012 Facebook
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
16 changes: 16 additions & 0 deletions facebook/src/com/facebook/internal/SessionAuthorizationType.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/**
* Copyright 2012 Facebook
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.facebook.internal;

/**
Expand Down
2 changes: 1 addition & 1 deletion facebook/src/com/facebook/model/GraphLocation.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2010 Facebook, Inc.
* Copyright 2012 Facebook
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion facebook/src/com/facebook/model/GraphMultiResult.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2010 Facebook, Inc.
* Copyright 2012 Facebook
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion facebook/src/com/facebook/model/GraphObject.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2010 Facebook, Inc.
* Copyright 2012 Facebook
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion facebook/src/com/facebook/model/GraphObjectList.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2010 Facebook, Inc.
* Copyright 2012 Facebook
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion facebook/src/com/facebook/model/GraphPlace.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2010 Facebook, Inc.
* Copyright 2012 Facebook
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion facebook/src/com/facebook/model/GraphUser.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2010 Facebook, Inc.
* Copyright 2012 Facebook
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
16 changes: 16 additions & 0 deletions facebook/src/com/facebook/model/JsonUtil.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/**
* Copyright 2012 Facebook
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.facebook.model;

import android.annotation.SuppressLint;
Expand Down
2 changes: 1 addition & 1 deletion facebook/src/com/facebook/model/OpenGraphAction.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2010 Facebook, Inc.
* Copyright 2012 Facebook
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion facebook/src/com/facebook/widget/ImageResponseCache.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2010 Facebook, Inc.
* Copyright 2012 Facebook
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
1 change: 1 addition & 0 deletions facebook/src/com/facebook/widget/LoginButton.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.facebook.widget;

import android.app.Activity;
Expand Down
2 changes: 1 addition & 1 deletion facebook/src/com/facebook/widget/ProfilePictureView.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2010 Facebook, Inc.
* Copyright 2012 Facebook
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
1 change: 1 addition & 0 deletions facebook/src/com/facebook/widget/UserSettingsFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.facebook.widget;

import android.graphics.Bitmap;
Expand Down
1 change: 1 addition & 0 deletions facebook/tests/src/com/facebook/AsyncRequestTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.facebook;

import android.graphics.Bitmap;
Expand Down
1 change: 1 addition & 0 deletions facebook/tests/src/com/facebook/BatchRequestTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.facebook;

import android.graphics.Bitmap;
Expand Down
1 change: 1 addition & 0 deletions facebook/tests/src/com/facebook/GraphRequestTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.facebook;

import android.test.suitebuilder.annotation.LargeTest;
Expand Down
1 change: 1 addition & 0 deletions facebook/tests/src/com/facebook/RequestTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.facebook;

import android.graphics.Bitmap;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2010 Facebook, Inc.
* Copyright 2012 Facebook
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion facebook/tests/src/com/facebook/model/JsonUtilTests.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2010 Facebook, Inc.
* Copyright 2012 Facebook
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Loading

0 comments on commit dfee756

Please sign in to comment.